Reference documentation for deal.II version 9.0.0
|
#include <deal.II/particles/property_pool.h>
Public Types | |
typedef double * | Handle |
Public Member Functions | |
PropertyPool (const unsigned int n_properties_per_slot) | |
Handle | allocate_properties_array () |
void | deallocate_properties_array (const Handle handle) |
ArrayView< double > | get_properties (const Handle handle) |
void | reserve (const std::size_t size) |
unsigned int | n_properties_per_slot () const |
Static Public Attributes | |
static const Handle | invalid_handle = nullptr |
Private Attributes | |
const unsigned int | n_properties |
This class manages a memory space in which particles store their properties. Because this is dynamic memory and often every particle needs the same amount, it is more efficient to let this be handled by a central manager that does not need to allocate/deallocate memory every time a particle is constructed/destroyed. The current implementation uses simple new/delete allocation for every block. Additionally, the current implementation assumes the same number of properties per particle, but of course the PropertyType could contain a pointer to dynamically allocated memory with varying sizes per particle (this memory would not be managed by this class). Because PropertyPool only returns handles it could be enhanced internally (e.g. to allow for varying number of properties per handle) without affecting its interface.
Definition at line 41 of file property_pool.h.
typedef double* Particles::PropertyPool::Handle |
Typedef for the handle that is returned to the particles, and that uniquely identifies the slot of memory that is reserved for this particle.
Definition at line 49 of file property_pool.h.
Particles::PropertyPool::PropertyPool | ( | const unsigned int | n_properties_per_slot | ) |
Constructor. Stores the number of properties per reserved slot.
Definition at line 26 of file property_pool.cc.
PropertyPool::Handle Particles::PropertyPool::allocate_properties_array | ( | ) |
Return a new handle that allows accessing the reserved block of memory. If the number of properties is zero this will return an invalid handle.
Definition at line 34 of file property_pool.cc.
void Particles::PropertyPool::deallocate_properties_array | ( | const Handle | handle | ) |
Mark the properties corresponding to the handle handle
as deleted. Calling this function more than once for the same handle causes undefined behavior.
Definition at line 46 of file property_pool.cc.
Return an ArrayView to the properties that correspond to the given handle handle
.
Definition at line 54 of file property_pool.cc.
void Particles::PropertyPool::reserve | ( | const std::size_t | size | ) |
Reserve the dynamic memory needed for storing the properties of size
particles.
Definition at line 62 of file property_pool.cc.
unsigned int Particles::PropertyPool::n_properties_per_slot | ( | ) | const |
Return how many properties are stored per slot in the pool.
Definition at line 70 of file property_pool.cc.
|
static |
Define a default (invalid) value for handles.
Definition at line 54 of file property_pool.h.
|
private |
The number of properties that are reserved per particle.
Definition at line 96 of file property_pool.h.