Reference documentation for deal.II version 9.0.0
|
#include <deal.II/particles/particle.h>
Public Member Functions | |
Particle () | |
Particle (const Point< spacedim > &location, const Point< dim > &reference_location, const types::particle_index id) | |
Particle (const Particle< dim, spacedim > &particle) | |
Particle (const void *&begin_data, PropertyPool *const =nullptr) | |
Particle (Particle< dim, spacedim > &&particle) noexcept | |
Particle< dim, spacedim > & | operator= (const Particle< dim, spacedim > &particle) |
Particle< dim, spacedim > & | operator= (Particle< dim, spacedim > &&particle) noexcept |
~Particle () | |
void | write_data (void *&data) const |
void | set_location (const Point< spacedim > &new_location) |
const Point< spacedim > & | get_location () const |
void | set_reference_location (const Point< dim > &new_reference_location) |
const Point< dim > & | get_reference_location () const |
types::particle_index | get_id () const |
void | set_property_pool (PropertyPool &property_pool) |
bool | has_properties () const |
void | set_properties (const ArrayView< const double > &new_properties) |
const ArrayView< double > | get_properties () |
const ArrayView< const double > | get_properties () const |
std::size_t | serialized_size_in_bytes () const |
template<class Archive > | |
void | save (Archive &ar, const unsigned int version) const |
template<class Archive > | |
void | load (Archive &ar, const unsigned int version) |
Private Attributes | |
Point< spacedim > | location |
Point< dim > | reference_location |
types::particle_index | id |
PropertyPool * | property_pool |
PropertyPool::Handle | properties |
Base class of particles - represents a particle with position, an ID number and a variable number of properties. This class can be extended to include data related to a particle by the property manager.
Definition at line 101 of file particle.h.
Particles::Particle< dim, spacedim >::Particle | ( | ) |
Empty constructor for Particle, creates a particle at the origin.
Definition at line 23 of file particle.cc.
Particles::Particle< dim, spacedim >::Particle | ( | const Point< spacedim > & | location, |
const Point< dim > & | reference_location, | ||
const types::particle_index | id | ||
) |
Constructor for Particle, creates a particle with the specified ID at the specified location. Note that there is no check for duplicate particle IDs so the user must make sure the IDs are unique over all processes.
[in] | location | Initial location of particle. |
[in] | reference_location | Initial location of the particle in the coordinate system of the reference cell. |
[in] | id | Globally unique ID number of particle. |
Definition at line 36 of file particle.cc.
Particles::Particle< dim, spacedim >::Particle | ( | const Particle< dim, spacedim > & | particle | ) |
Copy-Constructor for Particle, creates a particle with exactly the state of the input argument. Note that since each particle has a handle for a certain piece of the property memory, and is responsible for registering and freeing this memory in the property pool this constructor registers a new chunk, and copies the properties.
Definition at line 51 of file particle.cc.
Particles::Particle< dim, spacedim >::Particle | ( | const void *& | begin_data, |
PropertyPool * const | new_property_pool = nullptr |
||
) |
Constructor for Particle, creates a particle from a data vector. This constructor is usually called after serializing a particle by calling the write_data function.
[in,out] | begin_data | A pointer to a memory location from which to read the information that completely describes a particle. This class then de-serializes its data from this memory location and advance the pointer accordingly. |
[in,out] | property_pool | An optional pointer to a property pool that is used to manage the property data used by this particle. Note that if a non-null pointer is handed over this constructor assumes begin_data contains serialized data of the same length and type that is allocated by property_pool . |
Definition at line 71 of file particle.cc.
|
noexcept |
Move constructor for Particle, creates a particle from an existing one by stealing its state.
Definition at line 105 of file particle.cc.
Particles::Particle< dim, spacedim >::~Particle | ( | ) |
Destructor. Releases the property handle if it is valid, and therefore frees that memory space for other particles. (Note: the memory is managed by the property pool, and the pool is responsible for what happens to the memory.
Definition at line 164 of file particle.cc.
Particle< dim, spacedim > & Particles::Particle< dim, spacedim >::operator= | ( | const Particle< dim, spacedim > & | particle | ) |
Copy assignment operator.
Definition at line 120 of file particle.cc.
|
noexcept |
Move assignment operator.
Definition at line 147 of file particle.cc.
void Particles::Particle< dim, spacedim >::write_data | ( | void *& | data | ) | const |
Write particle data into a data array. The array is expected to be large enough to take the data, and the void pointer should point to the first element in which the data should be written. This function is meant for serializing all particle properties and afterwards de-serializing the properties by calling the appropriate constructor Particle(void *&data, PropertyPool *property_pool = NULL);
[in,out] | data | The memory location to write particle data into. This pointer points to the begin of the memory, in which the data will be written and it will be advanced by the serialized size of this particle. |
Definition at line 174 of file particle.cc.
void Particles::Particle< dim, spacedim >::set_location | ( | const Point< spacedim > & | new_location | ) |
Set the location of this particle. Note that this does not check whether this is a valid location in the simulation domain.
[in] | new_location | The new location for this particle. |
Definition at line 222 of file particle.cc.
const Point< spacedim > & Particles::Particle< dim, spacedim >::get_location | ( | ) | const |
Get the location of this particle.
Definition at line 231 of file particle.cc.
void Particles::Particle< dim, spacedim >::set_reference_location | ( | const Point< dim > & | new_reference_location | ) |
Set the reference location of this particle.
[in] | new_reference_location | The new reference location for this particle. |
Definition at line 240 of file particle.cc.
const Point< dim > & Particles::Particle< dim, spacedim >::get_reference_location | ( | ) | const |
Return the reference location of this particle in its current cell.
Definition at line 249 of file particle.cc.
types::particle_index Particles::Particle< dim, spacedim >::get_id | ( | ) | const |
Return the ID number of this particle.
Definition at line 258 of file particle.cc.
void Particles::Particle< dim, spacedim >::set_property_pool | ( | PropertyPool & | property_pool | ) |
Tell the particle where to store its properties (even if it does not own properties). Usually this is only done once per particle, but since the particle does not know about the properties, we want to do it not at construction time. Another use for this function is after particle transfer to a new process.
Definition at line 267 of file particle.cc.
bool Particles::Particle< dim, spacedim >::has_properties | ( | ) | const |
Return whether this particle has a valid property pool and a valid handle to properties.
Definition at line 321 of file particle.cc.
void Particles::Particle< dim, spacedim >::set_properties | ( | const ArrayView< const double > & | new_properties | ) |
Set the properties of this particle.
[in] | new_properties | An ArrayView containing the new properties for this particle. |
Definition at line 276 of file particle.cc.
const ArrayView< double > Particles::Particle< dim, spacedim >::get_properties | ( | ) |
Get write-access to properties of this particle.
Definition at line 309 of file particle.cc.
const ArrayView< const double > Particles::Particle< dim, spacedim >::get_properties | ( | ) | const |
Get read-access to properties of this particle.
Definition at line 297 of file particle.cc.
std::size_t Particles::Particle< dim, spacedim >::serialized_size_in_bytes | ( | ) | const |
Return the size in bytes this particle occupies if all of its data is serialized (i.e. the number of bytes that is written by the write_data function of this class).
Definition at line 204 of file particle.cc.
void Particles::Particle< dim, spacedim >::save | ( | Archive & | ar, |
const unsigned int | version | ||
) | const |
Write the data of this object to a stream for the purpose of serialization.
Definition at line 347 of file particle.h.
void Particles::Particle< dim, spacedim >::load | ( | Archive & | ar, |
const unsigned int | version | ||
) |
Read the data of this object from a stream for the purpose of serialization.
Definition at line 329 of file particle.h.
|
private |
Current particle location.
Definition at line 301 of file particle.h.
|
private |
Current particle location in the reference cell.
Definition at line 306 of file particle.h.
|
private |
Globally unique ID of particle.
Definition at line 311 of file particle.h.
|
private |
A pointer to the property pool. Necessary to translate from the handle to the actual memory locations.
Definition at line 317 of file particle.h.
|
private |
A handle to all particle properties
Definition at line 322 of file particle.h.