Reference documentation for deal.II version 9.6.0
\(\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\}}\)
Loading...
Searching...
No Matches
Particles::ParticleAccessor< dim, spacedim >::ParticlesInCell Struct Reference

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

Public Member Functions

 ParticlesInCell ()=default
 
 ParticlesInCell (const std::vector< typename PropertyPool< dim, spacedim >::Handle > &particles, const typename Triangulation< dim, spacedim >::active_cell_iterator &cell)
 

Public Attributes

std::vector< typename PropertyPool< dim, spacedim >::Handle > particles
 
Triangulation< dim, spacedim >::active_cell_iterator cell
 

Detailed Description

template<int dim, int spacedim = dim>
struct Particles::ParticleAccessor< dim, spacedim >::ParticlesInCell

Data structure to describe the particles in a given cell. This is used inside an std::list in particle_container. The storage of this field is typically handled by ParticleHandler, using an std::list of this structure.

There are four main reasons for the present design:

  • The list represents a compact storage for all particles on a cell, handling e.g. the case where only a few cells hold particles without storage overhead.
  • The particles on a cell are identified by their handle object, i.e., a single integer, again ensuring only 4 byte storage cost for the handling of the particles for the case of sufficiently many particles per cell.
  • Combined with a cache object that holds an iterator to the std::list of particles (8 bytes per cell), or the std::list::end in case no particles are present on a cell, there is a fast access from a ParticleAccessor -> surrounding cell (by access to ParticlesInCell::cell_iterator), as well as fast access from cell -> all particles (through the cache). It also allows for a fast iteration through all particles, by incrementing either the index of particles within a cell, or, if at the end of the cell, to the next element in the outer list. The cache is simple to keep consistent because the iterators into std::list remain valid upon insertion or deletion of entries in the list, as specified by std::list's API.
  • In order to detect the start and end of all cells with particles, the std::list contains some dummy entry with a cell_iterator past the end of valid cells, which is used as a criterion to terminate the loops of ParticleAccessor, again minimizing the computational cost of handling the loop over particles.

Definition at line 80 of file particle_accessor.h.

Constructor & Destructor Documentation

◆ ParticlesInCell() [1/2]

template<int dim, int spacedim = dim>
Particles::ParticleAccessor< dim, spacedim >::ParticlesInCell::ParticlesInCell ( )
default

Default constructor.

◆ ParticlesInCell() [2/2]

template<int dim, int spacedim = dim>
Particles::ParticleAccessor< dim, spacedim >::ParticlesInCell::ParticlesInCell ( const std::vector< typename PropertyPool< dim, spacedim >::Handle > & particles,
const typename Triangulation< dim, spacedim >::active_cell_iterator & cell )
inline

Construct from a vector of particles and a cell iterator.

Definition at line 90 of file particle_accessor.h.

Member Data Documentation

◆ particles

template<int dim, int spacedim = dim>
std::vector<typename PropertyPool<dim, spacedim>::Handle> Particles::ParticleAccessor< dim, spacedim >::ParticlesInCell::particles

A vector of particles on a cell.

Definition at line 101 of file particle_accessor.h.

◆ cell

template<int dim, int spacedim = dim>
Triangulation<dim,spacedim>::active_cell_iterator Particles::ParticleAccessor< dim, spacedim >::ParticlesInCell::cell

The underlying cell.

Definition at line 106 of file particle_accessor.h.


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