Reference documentation for deal.II version 9.3.3
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Particles::ParticleAccessor< dim, spacedim > Class Template Reference

#include <deal.II/particles/particle_accessor.h>

Inheritance diagram for Particles::ParticleAccessor< dim, spacedim >:
[legend]

Public Member Functions

void * write_particle_data_to_memory (void *data) const
 
const void * read_particle_data_from_memory (const void *data)
 
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< dim, spacedim > &property_pool)
 
bool has_properties () const
 
void set_properties (const std::vector< double > &new_properties)
 
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
 
Triangulation< dim, spacedim >::cell_iterator get_surrounding_cell (const Triangulation< dim, spacedim > &triangulation) const
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 
void next ()
 
void prev ()
 
bool operator!= (const ParticleAccessor< dim, spacedim > &other) const
 
bool operator== (const ParticleAccessor< dim, spacedim > &other) const
 

Private Member Functions

 ParticleAccessor ()
 
 ParticleAccessor (const std::multimap< internal::LevelInd, Particle< dim, spacedim > > &map, const typename std::multimap< internal::LevelInd, Particle< dim, spacedim > >::iterator &particle)
 

Private Attributes

std::multimap< internal::LevelInd, Particle< dim, spacedim > > * map
 
std::multimap< internal::LevelInd, Particle< dim, spacedim > >::iterator particle
 

Friends

template<int , int >
class ParticleIterator
 
template<int , int >
class ParticleHandler
 

Detailed Description

template<int dim, int spacedim = dim>
class Particles::ParticleAccessor< dim, spacedim >

Accessor class used by ParticleIterator to access particle data.

Definition at line 43 of file particle_accessor.h.

Constructor & Destructor Documentation

◆ ParticleAccessor() [1/2]

template<int dim, int spacedim>
Particles::ParticleAccessor< dim, spacedim >::ParticleAccessor
inlineprivate

Construct an invalid accessor. Such an object is not usable.

Definition at line 296 of file particle_accessor.h.

◆ ParticleAccessor() [2/2]

template<int dim, int spacedim>
Particles::ParticleAccessor< dim, spacedim >::ParticleAccessor ( const std::multimap< internal::LevelInd, Particle< dim, spacedim > > &  map,
const typename std::multimap< internal::LevelInd, Particle< dim, spacedim > >::iterator &  particle 
)
inlineprivate

Construct an accessor from a reference to a map and an iterator to the map. This constructor is private so that it can only be accessed by friend classes.

Definition at line 304 of file particle_accessor.h.

Member Function Documentation

◆ write_particle_data_to_memory()

template<int dim, int spacedim>
void * Particles::ParticleAccessor< dim, spacedim >::write_particle_data_to_memory ( void *  data) const
inline

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 entry of the array to which the data should be written. This function is meant for serializing all particle properties and later de-serializing the properties by calling the appropriate constructor Particle(void *&data, PropertyPool *property_pool = nullptr);

Parameters
[in]dataThe memory location to write particle data into.
Returns
A pointer to the next byte after the array to which data has been written.

Definition at line 329 of file particle_accessor.h.

◆ read_particle_data_from_memory()

template<int dim, int spacedim>
const void * Particles::ParticleAccessor< dim, spacedim >::read_particle_data_from_memory ( const void *  data)
inline

Update all of the data associated with a particle: id, location, reference location and, if any, properties by using a data array. The array is expected to be large enough to take the data, and the void pointer should point to the first entry of the array to which the data should be written. This function is meant for de-serializing the particle data without requiring that a new Particle class be built. This is used in the ParticleHandler to update the ghost particles without de-allocating and re-allocating memory.

Parameters
[in]dataA 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.
Returns
A pointer to the next byte after the array from which data has been read.

Definition at line 317 of file particle_accessor.h.

◆ set_location()

template<int dim, int spacedim>
void Particles::ParticleAccessor< dim, spacedim >::set_location ( const Point< spacedim > &  new_location)
inline

Set the location of this particle. Note that this does not check whether this is a valid location in the simulation domain.

Parameters
[in]new_locationThe new location for this particle.
Note
In parallel programs, the ParticleHandler class stores particles on both the locally owned cells, as well as on ghost cells. The particles on the latter are copies of particles owned on other processors, and should therefore be treated in the same way as ghost entries in vectors with ghost elements or ghost cells: In both cases, one should treat the ghost elements or cells as const objects that shouldn't be modified even if the objects allow for calls that modify properties. Rather, properties should only be modified on processors that actually own the particle.

Definition at line 341 of file particle_accessor.h.

◆ get_location()

template<int dim, int spacedim>
const Point< spacedim > & Particles::ParticleAccessor< dim, spacedim >::get_location
inline

Get the location of this particle.

Returns
The location of this particle.

Definition at line 352 of file particle_accessor.h.

◆ set_reference_location()

template<int dim, int spacedim>
void Particles::ParticleAccessor< dim, spacedim >::set_reference_location ( const Point< dim > &  new_reference_location)
inline

Set the reference location of this particle.

Parameters
[in]new_reference_locationThe new reference location for this particle.
Note
In parallel programs, the ParticleHandler class stores particles on both the locally owned cells, as well as on ghost cells. The particles on the latter are copies of particles owned on other processors, and should therefore be treated in the same way as ghost entries in vectors with ghost elements or ghost cells: In both cases, one should treat the ghost elements or cells as const objects that shouldn't be modified even if the objects allow for calls that modify properties. Rather, properties should only be modified on processors that actually own the particle.

Definition at line 363 of file particle_accessor.h.

◆ get_reference_location()

template<int dim, int spacedim>
const Point< dim > & Particles::ParticleAccessor< dim, spacedim >::get_reference_location
inline

Return the reference location of this particle in its current cell.

Definition at line 375 of file particle_accessor.h.

◆ get_id()

template<int dim, int spacedim>
types::particle_index Particles::ParticleAccessor< dim, spacedim >::get_id
inline

Return the ID number of this particle.

Definition at line 386 of file particle_accessor.h.

◆ set_property_pool()

template<int dim, int spacedim>
void Particles::ParticleAccessor< dim, spacedim >::set_property_pool ( PropertyPool< dim, spacedim > &  property_pool)
inline

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 generator 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 397 of file particle_accessor.h.

◆ has_properties()

template<int dim, int spacedim>
bool Particles::ParticleAccessor< dim, spacedim >::has_properties
inline

Return whether this particle has a valid property pool and a valid handle to properties.

Definition at line 409 of file particle_accessor.h.

◆ set_properties() [1/2]

template<int dim, int spacedim>
void Particles::ParticleAccessor< dim, spacedim >::set_properties ( const std::vector< double > &  new_properties)
inline

Set the properties of this particle.

Parameters
[in]new_propertiesA vector containing the new properties for this particle.
Note
In parallel programs, the ParticleHandler class stores particles on both the locally owned cells, as well as on ghost cells. The particles on the latter are copies of particles owned on other processors, and should therefore be treated in the same way as ghost entries in vectors with ghost elements or ghost cells: In both cases, one should treat the ghost elements or cells as const objects that shouldn't be modified even if the objects allow for calls that modify properties. Rather, properties should only be modified on processors that actually own the particle.

Definition at line 420 of file particle_accessor.h.

◆ set_properties() [2/2]

template<int dim, int spacedim>
void Particles::ParticleAccessor< dim, spacedim >::set_properties ( const ArrayView< const double > &  new_properties)
inline

Set the properties of this particle.

Parameters
[in]new_propertiesAn ArrayView pointing to memory locations containing the new properties for this particle.
Note
In parallel programs, the ParticleHandler class stores particles on both the locally owned cells, as well as on ghost cells. The particles on the latter are copies of particles owned on other processors, and should therefore be treated in the same way as ghost entries in vectors with ghost elements or ghost cells: In both cases, one should treat the ghost elements or cells as const objects that shouldn't be modified even if the objects allow for calls that modify properties. Rather, properties should only be modified on processors that actually own the particle.

Definition at line 432 of file particle_accessor.h.

◆ get_properties() [1/2]

template<int dim, int spacedim>
const ArrayView< double > Particles::ParticleAccessor< dim, spacedim >::get_properties
inline

Get write-access to properties of this particle.

Returns
An ArrayView of the properties of this particle.

Definition at line 469 of file particle_accessor.h.

◆ get_properties() [2/2]

template<int dim, int spacedim>
const ArrayView< const double > Particles::ParticleAccessor< dim, spacedim >::get_properties
inline

Get read-access to properties of this particle.

Returns
An ArrayView of the properties of this particle.

Definition at line 444 of file particle_accessor.h.

◆ serialized_size_in_bytes()

template<int dim, int spacedim>
std::size_t Particles::ParticleAccessor< dim, spacedim >::serialized_size_in_bytes
inline

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 480 of file particle_accessor.h.

◆ get_surrounding_cell()

template<int dim, int spacedim>
Triangulation< dim, spacedim >::cell_iterator Particles::ParticleAccessor< dim, spacedim >::get_surrounding_cell ( const Triangulation< dim, spacedim > &  triangulation) const
inline

Get a cell iterator to the cell surrounding the current particle. As particles are organized in the structure of a triangulation, but the triangulation itself is not stored in the particle this operation requires a reference to the triangulation.

Definition at line 455 of file particle_accessor.h.

◆ serialize()

template<int dim, int spacedim>
template<class Archive >
void Particles::ParticleAccessor< dim, spacedim >::serialize ( Archive &  ar,
const unsigned int  version 
)

Serialize the contents of this class using the BOOST serialization library.

Definition at line 286 of file particle_accessor.h.

◆ next()

template<int dim, int spacedim>
void Particles::ParticleAccessor< dim, spacedim >::next
inline

Advance the ParticleAccessor to the next particle.

Definition at line 491 of file particle_accessor.h.

◆ prev()

template<int dim, int spacedim>
void Particles::ParticleAccessor< dim, spacedim >::prev
inline

Move the ParticleAccessor to the previous particle.

Definition at line 501 of file particle_accessor.h.

◆ operator!=()

template<int dim, int spacedim>
bool Particles::ParticleAccessor< dim, spacedim >::operator!= ( const ParticleAccessor< dim, spacedim > &  other) const
inline

Inequality operator.

Definition at line 511 of file particle_accessor.h.

◆ operator==()

template<int dim, int spacedim>
bool Particles::ParticleAccessor< dim, spacedim >::operator== ( const ParticleAccessor< dim, spacedim > &  other) const
inline

Equality operator.

Definition at line 521 of file particle_accessor.h.

Friends And Related Function Documentation

◆ ParticleIterator

template<int dim, int spacedim = dim>
template<int , int >
friend class ParticleIterator
friend

Definition at line 276 of file particle_accessor.h.

◆ ParticleHandler

template<int dim, int spacedim = dim>
template<int , int >
friend class ParticleHandler
friend

Definition at line 278 of file particle_accessor.h.

Member Data Documentation

◆ map

template<int dim, int spacedim = dim>
std::multimap<internal::LevelInd, Particle<dim, spacedim> >* Particles::ParticleAccessor< dim, spacedim >::map
private

A pointer to the container that stores the particles. Obviously, this accessor is invalidated if the container changes.

Definition at line 264 of file particle_accessor.h.

◆ particle

template<int dim, int spacedim = dim>
std::multimap<internal::LevelInd,Particle<dim,spacedim>>::iterator Particles::ParticleAccessor< dim, spacedim >::particle
private

An iterator into the container of particles. Obviously, this accessor is invalidated if the container changes.

Definition at line 271 of file particle_accessor.h.


The documentation for this class was generated from the following file: