chombo-discharge
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ParticleContainer< P > Class Template Reference

Templated class for holding particles on an AMR hierarchy with particle remapping. More...

#include <CD_ParticleContainer.H>

Inheritance diagram for ParticleContainer< P >:
Inheritance graph
[legend]

Public Types

using ValidMask = RefCountedPtr< LevelData< BaseFab< bool > >>
 

Public Member Functions

 ParticleContainer ()
 Default constructor. Leaves object in undefined state.
 
 ParticleContainer (const Vector< DisjointBoxLayout > &a_grids, const Vector< ProblemDomain > &a_domains, const Vector< Real > &a_dx, const Vector< int > &a_refRat, const Vector< ValidMask > &a_validMask, const Vector< RefCountedPtr< LevelTiles >> &a_levelTiles, const RealVect &a_probLo, const int a_blockingFactor, const int a_finestLevel, const std::string a_realm)
 Full constructor. More...
 
virtual ~ParticleContainer ()
 Destructor ( does nothing)
 
void define (const Vector< DisjointBoxLayout > &a_grids, const Vector< ProblemDomain > &a_domains, const Vector< Real > &a_dx, const Vector< int > &a_refRat, const Vector< ValidMask > &a_validMask, const Vector< RefCountedPtr< LevelTiles >> &a_levelTiles, const RealVect &a_probLo, const int a_blockingFactor, const int a_finestLevel, const std::string a_realm)
 Define the container. This will do a clear-out of all particles. More...
 
void regrid (const Vector< DisjointBoxLayout > &a_grids, const Vector< ProblemDomain > &a_domains, const Vector< Real > &a_dx, const Vector< int > &a_refRat, const Vector< ValidMask > &a_validMask, const Vector< RefCountedPtr< LevelTiles >> &a_levelTiles, const int a_base, const int a_newFinestLevel)
 Regrid function. a_base is the coarsest grid level which did not change. More...
 
void preRegrid (const int a_base)
 Cache particles before calling regrid. More...
 
void copyMaskParticles (const Vector< RefCountedPtr< LevelData< BaseFab< bool >>>> &a_mask) const
 Copy particles to mask particle data holder. More...
 
void copyMaskParticles (const int a_level, const LevelData< BaseFab< bool >> &a_mask) const
 Copy particles to masked particle data holder. More...
 
void transferMaskParticles (const Vector< RefCountedPtr< LevelData< BaseFab< bool >>>> &a_mask)
 Copy particles to the mask particle data holder. More...
 
void transferMaskParticles (const int a_level, const LevelData< BaseFab< bool >> &a_mask)
 Copy particles to masked particle data holder. More...
 
void sortParticles () noexcept
 Sort particles according to the < operator in the particle.
 
void clearParticles ()
 Clear all particles.
 
void clearBufferParticles () const
 Clear the buffer particles.
 
void clearMaskParticles () const
 Clear the "mask" particles.
 
void clearOutcast () noexcept
 Clear outcast particles.
 
void clear (AMRParticles< P > &a_particles) const
 Clear particles on input data holder. More...
 
bool isOrganizedByCell () const
 Is cell-sorted or not.
 
int getFinestLevel () const
 Get finest AMR level.
 
const std::string getRealm () const
 Get the realm where this ParticleContainer lives.
 
AMRParticles< P > & getParticles ()
 Get all particles on all levels. More...
 
const AMRParticles< P > & getParticles () const
 Get all particles on a level. Const version. More...
 
AMRParticles< P > & getBufferParticles ()
 Get buffer particles on all levels. More...
 
const AMRParticles< P > & getBufferParticles () const
 Get buffer particles on all levels. Const version. More...
 
AMRParticles< P > & getMaskParticles ()
 Get the mask particles. More...
 
const AMRParticles< P > & getMaskParticles () const
 Get the mask particles. Const version. More...
 
const Vector< DisjointBoxLayout > & getGrids () const
 Get the AMR grids.
 
const RealVect getProbLo () const noexcept
 Get lower-left corner. More...
 
const Vector< RealVect > getDx () const noexcept
 Get grid resolutions. More...
 
ParticleData< P > & operator[] (const int a_level)
 Get particle data on a level. More...
 
const ParticleData< P > & operator[] (const int a_level) const
 Get data on a level. Const version. More...
 
AMRCellParticles< P > & getCellParticles ()
 Get all cell particles. More...
 
const AMRCellParticles< P > & getCellParticles () const
 Get cell particles, const version. More...
 
LayoutData< BinFab< P > > & getCellParticles (const int a_level)
 Get cell particles. More...
 
const LayoutData< BinFab< P > > & getCellParticles (const int a_level) const
 Get cell particles, const version. More...
 
BinFab< P > & getCellParticles (const int a_level, const DataIndex a_dit)
 Get cell particles on a specific level and grid inex. More...
 
const BinFab< P > & getCellParticles (const int a_level, const DataIndex a_dit) const
 Get cell particles, const version. More...
 
void getCellParticles (BinFab< P > &a_cellParticles, const int a_lvl, const DataIndex a_dit) const
 Fill a cell-sorted particle data holder with all the particles in the grid patch. More...
 
void getCellParticlesDestructive (BinFab< P > &a_cellParticles, const int a_lvl, const DataIndex a_dit)
 Fill a cell-sorted particle data holder with all the particles in the grid patch. The original particles are destroyed. More...
 
void organizeParticlesByCell ()
 Sort particles by cell. More...
 
void organizeParticlesByPatch ()
 Sort particles by cell. More...
 
void addParticles (const List< P > &a_particles)
 Add particles to container. More...
 
void addParticlesDestructive (List< P > &a_particles)
 Add particles to container. The input particles are destroyed by this routine. More...
 
void addParticles (const BinFab< P > &a_particles, const int a_lvl, const DataIndex a_dit)
 Add particles to a certain level and patch. The input particles are cell-sorted. More...
 
void addParticlesDestructive (BinFab< P > &a_particles, const int a_lvl, const DataIndex a_dit)
 Add particles to a certain level and patch. The input particles are cell-sorted (and destroyed on output). More...
 
void addParticles (const ParticleContainer< P > &a_otherContainer)
 Add particles from other container to this one. More...
 
void addParticlesDestructive (ParticleContainer< P > &a_otherContainer)
 Add particles from other container to this one. This destroys the particles in the other container. More...
 
void sanityCheck () const noexcept
 Run a sanity check and make sure all particles are in their correctly assigned box.
 
void remap ()
 Remap over the entire AMR hierarchy.
 
void transferParticles (ParticleContainer< P > &a_otherContainer)
 Move particles into this container. More...
 
void transferParticles (AMRParticles< P > &a_otherContainer)
 Move particles into this container. More...
 
void admitValidParticles (List< P > &a_evictedParticles, ParticleData< P > &a_particles, const int a_coarseLevel)
 Evict particles if they move out of the valid region. More...
 
template<Real &(P::*)() particleScalarField>
void setValue (const Real a_value)
 Set the particle member to the input value. More...
 
template<RealVect &(P::*)() particleVectorField>
void setValue (const RealVect a_value)
 Set the particle member to the input value. More...
 
unsigned long long getNumberOfValidParticlesLocal () const
 Get local number of particles.
 
unsigned long long getNumberOfValidParticlesGlobal () const
 Get global number of particles.
 
unsigned long long getNumberOfOutcastParticlesLocal () const
 Get local number of particles.
 
unsigned long long getNumberOfOutcastParticlesGlobal () const
 Get global number of particles.
 
unsigned long long getNumberOfMaskParticlesLocal () const
 Get the number particles in the halo cells.
 
unsigned long long getNumberOfMaskParticlesGlobal () const
 Get the number particles in the halo cells.
 

Protected Member Functions

void setupGrownGrids (const int a_base, const int a_finestLevel)
 Set up grown grids. More...
 
void setupParticleData (const int a_base, const int a_finestLevel)
 Setup function for the particle data (m_particles and m_maskParticles) More...
 
void transferParticlesToSingleList (List< P > &a_list, AMRParticles< P > &a_particles) const noexcept
 Gather the particles onto a single list. More...
 
void copyParticlesToSingleList (List< P > &a_list, const AMRParticles< P > &a_particles) const noexcept
 Copy the input particles onto a single list. More...
 
void mapParticlesToAMRGrid (std::vector< std::map< std::pair< unsigned int, unsigned int >, List< P >>> &a_mappedParticles, List< P > &a_unmappedParticles) const noexcept
 Iterate through the unmapped particles and map them to proper level, grid indices, and grid ranks. More...
 
void catenateParticleMaps (std::vector< std::map< std::pair< unsigned int, unsigned int >, List< P >>> &a_globalParticles, std::vector< std::map< std::pair< unsigned int, unsigned int >, List< P >>> &a_localParticles) const noexcept
 Catenate the particles. This is usually called within OpenMP parallel regions. More...
 
void assignLocalParticles (std::map< std::pair< unsigned int, unsigned int >, List< P >> &a_mappedParticles, AMRParticles< P > &a_particleData) const noexcept
 Gather particles locally. More...
 

Protected Attributes

std::string m_realm
 Realm on which the ParticleContainer is defined.
 
int m_blockingFactor
 Blocking factor, aka grid size.
 
int m_finestLevel
 Finest grid level.
 
RealVect m_probLo
 Lower left corner of the physical domain.
 
bool m_isDefined
 Check if particle container is defined.
 
bool m_isOrganizedByCell
 Check if particle container is "cell sorted".
 
bool m_profile
 Profile or not.
 
bool m_debug
 Debug or not.
 
bool m_verbose
 Verbose or not.
 
Vector< RefCountedPtr< LevelTiles > > m_levelTiles
 Tiled AMR space.
 
Vector< DisjointBoxLayout > m_grids
 AMR grids.
 
Vector< DisjointBoxLayout > m_oldGrids
 Old AMR grids. Used during regrids.
 
Vector< ProblemDomain > m_domains
 Problem domains.
 
Vector< RefCountedPtr< LevelData< BaseFab< bool > > > > m_validRegion
 Map of valid cells; evaluates to false if a cell is covered by a finer grid.
 
Vector< BoxLayout > m_grownGrids
 Grown layouts.
 
Vector< RealVect > m_dx
 Resolutions on each grid level.
 
Vector< int > m_refRat
 Refinement ratios. Entry at index 'l' is the refinement between level 'l' and level 'l+1'.
 
AMRParticles< P > m_particles
 The actual particles that this ParticleContainer represents.
 
AMRParticles< P > m_bufferParticles
 Special data holder that holds particles on a grown grid layout. More...
 
AMRParticles< P > m_maskParticles
 Special data holder that holds copies of particles on the coarse level that are within a specified range of the refinement boundary. Used for deposition of coarse-level particle clouds across refinement boundaries.
 
AMRParticles< P > m_cacheParticles
 Particles stored on the old grid. More...
 
AMRCellParticles< P > m_cellSortedParticles
 Cell particles.
 

Detailed Description

template<class P>
class ParticleContainer< P >

Templated class for holding particles on an AMR hierarchy with particle remapping.

The template parameter P should derive from Chombo's BinItem.

Note
ParticleContainers are, because of Chombo, restricted to square-block grids. This means that the blocking factor and maximum box size must be the same.

Constructor & Destructor Documentation

◆ ParticleContainer()

template<class P >
ParticleContainer< P >::ParticleContainer ( const Vector< DisjointBoxLayout > &  a_grids,
const Vector< ProblemDomain > &  a_domains,
const Vector< Real > &  a_dx,
const Vector< int > &  a_refRat,
const Vector< ValidMask > &  a_validMask,
const Vector< RefCountedPtr< LevelTiles >> &  a_levelTiles,
const RealVect &  a_probLo,
const int  a_blockingFactor,
const int  a_finestLevel,
const std::string  a_realm 
)

Full constructor.

Parameters
[in]a_gridsAMR grids
[in]a_domainsAMR domains
[in]a_dxGrid resolutions
[in]a_refRatRefinement ratios
[in]a_validMaskValid cells (false for cells covered by a finer grid)
[in]a_levelTilesTiled AMR grids
[in]a_probLoLower-left corner of the physical domain
[in]a_blockingFactorGrid blocking factor
[in]a_finestLevelFinest grid level
[in]a_realmRealm where these particles live.

Member Function Documentation

◆ addParticles() [1/3]

template<class P >
void ParticleContainer< P >::addParticles ( const BinFab< P > &  a_particles,
const int  a_lvl,
const DataIndex  a_dit 
)

Add particles to a certain level and patch. The input particles are cell-sorted.

Parameters
[in]a_particlesInput particles (cell-sorted)
[in]a_lvlGrid level
[in]a_ditGrid index

◆ addParticles() [2/3]

template<class P >
void ParticleContainer< P >::addParticles ( const List< P > &  a_particles)

Add particles to container.

Parameters
[in]a_particlesparticles to add to this container.

◆ addParticles() [3/3]

template<class P >
void ParticleContainer< P >::addParticles ( const ParticleContainer< P > &  a_otherContainer)

Add particles from other container to this one.

Parameters
[in]a_otherContainerOther particle container.

◆ addParticlesDestructive() [1/3]

template<class P >
void ParticleContainer< P >::addParticlesDestructive ( BinFab< P > &  a_particles,
const int  a_lvl,
const DataIndex  a_dit 
)

Add particles to a certain level and patch. The input particles are cell-sorted (and destroyed on output).

Parameters
[in,out]a_particlesInput particles (cell-sorted). Destroyed on exit.
[in]a_lvlGrid level
[in]a_ditGrid index

◆ addParticlesDestructive() [2/3]

template<class P >
void ParticleContainer< P >::addParticlesDestructive ( List< P > &  a_particles)

Add particles to container. The input particles are destroyed by this routine.

Parameters
[in]a_particlesparticles to add to this container. .

◆ addParticlesDestructive() [3/3]

template<class P >
void ParticleContainer< P >::addParticlesDestructive ( ParticleContainer< P > &  a_otherContainer)

Add particles from other container to this one. This destroys the particles in the other container.

Parameters
[in,out]a_otherContainerOther particle container (destroyed on output).

◆ admitValidParticles()

template<class P >
void ParticleContainer< P >::admitValidParticles ( List< P > &  a_evictedParticles,
ParticleData< P > &  a_particles,
const int  a_coarseLevel 
)

Evict particles if they move out of the valid region.

Parameters
[in,out]a_evictedParticlesList that the particles are moved into.
[in,out]a_particlesParticles.
[in]a_levelGrid level.

◆ assignLocalParticles()

template<typename P >
void ParticleContainer< P >::assignLocalParticles ( std::map< std::pair< unsigned int, unsigned int >, List< P >> &  a_mappedParticles,
AMRParticles< P > &  a_particleData 
) const
inlineprotectednoexcept

Gather particles locally.

Parameters
[in,out]a_mappedParticlesParticles that have been mapped to this rank.
[in,out]a_particleDataWhere to assign the mapped particles

◆ catenateParticleMaps()

template<typename P >
void ParticleContainer< P >::catenateParticleMaps ( std::vector< std::map< std::pair< unsigned int, unsigned int >, List< P >>> &  a_globalParticles,
std::vector< std::map< std::pair< unsigned int, unsigned int >, List< P >>> &  a_localParticles 
) const
inlineprotectednoexcept

Catenate the particles. This is usually called within OpenMP parallel regions.

Parameters
[in,out]a_globalParticlesGlobal particle map
[in,out]a_localParticlesLocal particle map

◆ clear()

template<class P >
void ParticleContainer< P >::clear ( AMRParticles< P > &  a_particles) const

Clear particles on input data holder.

Parameters
[in,out]a_particles

◆ copyMaskParticles() [1/2]

template<class P >
void ParticleContainer< P >::copyMaskParticles ( const int  a_level,
const LevelData< BaseFab< bool >> &  a_mask 
) const

Copy particles to masked particle data holder.

Parameters
[in]a_levelGrid level
[in]a_maskMask

◆ copyMaskParticles() [2/2]

template<class P >
void ParticleContainer< P >::copyMaskParticles ( const Vector< RefCountedPtr< LevelData< BaseFab< bool >>>> &  a_mask) const

Copy particles to mask particle data holder.

Parameters
[in]a_maskMask
Note
If the mask is nullptr on any of the levels, those levels will be ignored.

◆ copyParticlesToSingleList()

template<typename P >
void ParticleContainer< P >::copyParticlesToSingleList ( List< P > &  a_list,
const AMRParticles< P > &  a_particles 
) const
inlineprotectednoexcept

Copy the input particles onto a single list.

Parameters
[in,out]a_listList containing all the particles in a_particles
[in,out]a_particlesParticles to transfer to list
Note
This is supposed to get inside an OpenMP parallel region.

◆ define()

template<class P >
void ParticleContainer< P >::define ( const Vector< DisjointBoxLayout > &  a_grids,
const Vector< ProblemDomain > &  a_domains,
const Vector< Real > &  a_dx,
const Vector< int > &  a_refRat,
const Vector< ValidMask > &  a_validMask,
const Vector< RefCountedPtr< LevelTiles >> &  a_levelTiles,
const RealVect &  a_probLo,
const int  a_blockingFactor,
const int  a_finestLevel,
const std::string  a_realm 
)

Define the container. This will do a clear-out of all particles.

Parameters
[in]a_gridsAMR grids
[in]a_domainsAMR domains
[in]a_dxGrid resolutions
[in]a_refRatRefinement ratios
[in]a_validMaskValid cells (false for cells covered by a finer grid)
[in]a_levelTilesTiled AMR grids
[in]a_probLoLower-left corner of the physical domain
[in]a_blockingFactorGrid blocking factor
[in]a_finestLevelFinest grid level
[in]a_realmRealm where these particles live.

◆ getBufferParticles() [1/2]

template<class P >
AMRParticles< P > & ParticleContainer< P >::getBufferParticles

Get buffer particles on all levels.

Returns
m_bufferParticles

◆ getBufferParticles() [2/2]

template<class P >
const AMRParticles< P > & ParticleContainer< P >::getBufferParticles

Get buffer particles on all levels. Const version.

Returns
m_bufferParticles

◆ getCellParticles() [1/7]

template<class P >
AMRCellParticles< P > & ParticleContainer< P >::getCellParticles

Get all cell particles.

Note
This will issue an error if the particles are not sorted by cell.

◆ getCellParticles() [2/7]

template<class P >
const AMRCellParticles< P > & ParticleContainer< P >::getCellParticles

Get cell particles, const version.

Note
This will issue an error if the particles are not sorted by cell.

◆ getCellParticles() [3/7]

template<class P >
void ParticleContainer< P >::getCellParticles ( BinFab< P > &  a_cellParticles,
const int  a_lvl,
const DataIndex  a_dit 
) const

Fill a cell-sorted particle data holder with all the particles in the grid patch.

Parameters
[out]a_cellParticlesParticles in the input grid patch, sorted by cell.
[in]a_levelGrid level
[in]a_ditGrid index
Note
This will define a_cellParticles over the DisjointBoxLayout grid box and fill it with the particles in the patch.

◆ getCellParticles() [4/7]

template<class P >
LayoutData< BinFab< P > > & ParticleContainer< P >::getCellParticles ( const int  a_level)

Get cell particles.

Parameters
[in]a_levelGrid level
Note
This will issue an error if the particles are not sorted by cell.

◆ getCellParticles() [5/7]

template<class P >
const LayoutData< BinFab< P > > & ParticleContainer< P >::getCellParticles ( const int  a_level) const

Get cell particles, const version.

Parameters
[in]a_levelGrid level
Note
This will issue an error if the particles are not sorted by cell.

◆ getCellParticles() [6/7]

template<class P >
BinFab< P > & ParticleContainer< P >::getCellParticles ( const int  a_level,
const DataIndex  a_dit 
)

Get cell particles on a specific level and grid inex.

Parameters
[in]a_levelGrid level
[in]a_ditGrid index
Note
This will issue an error if the particles are not sorted by cell.

◆ getCellParticles() [7/7]

template<class P >
const BinFab< P > & ParticleContainer< P >::getCellParticles ( const int  a_level,
const DataIndex  a_dit 
) const

Get cell particles, const version.

Parameters
[in]a_levelGrid level
[in]a_ditGrid index
Note
This will issue an error if the particles are not sorted by cell.

◆ getCellParticlesDestructive()

template<class P >
void ParticleContainer< P >::getCellParticlesDestructive ( BinFab< P > &  a_cellParticles,
const int  a_lvl,
const DataIndex  a_dit 
)

Fill a cell-sorted particle data holder with all the particles in the grid patch. The original particles are destroyed.

Parameters
[out]a_cellParticlesParticles in the input grid patch, sorted by cell.
[in]a_levelGrid level
[in]a_ditGrid index
Note
This will define a_cellParticles over the DisjointBoxLayout grid box and fill it with the particles in the patch.

◆ getDx()

template<class P >
const Vector< RealVect > ParticleContainer< P >::getDx
noexcept

Get grid resolutions.

Returns
m_dx

◆ getMaskParticles() [1/2]

template<class P >
AMRParticles< P > & ParticleContainer< P >::getMaskParticles

Get the mask particles.

Returns
m_maskParticles

◆ getMaskParticles() [2/2]

template<class P >
const AMRParticles< P > & ParticleContainer< P >::getMaskParticles

Get the mask particles. Const version.

Returns
m_maskParticles

◆ getParticles() [1/2]

template<class P >
AMRParticles< P > & ParticleContainer< P >::getParticles

Get all particles on all levels.

Returns
m_particles

◆ getParticles() [2/2]

template<class P >
const AMRParticles< P > & ParticleContainer< P >::getParticles

Get all particles on a level. Const version.

Returns
m_particles

◆ getProbLo()

template<class P >
const RealVect ParticleContainer< P >::getProbLo
noexcept

Get lower-left corner.

Returns
m_probLo

◆ mapParticlesToAMRGrid()

template<typename P >
void ParticleContainer< P >::mapParticlesToAMRGrid ( std::vector< std::map< std::pair< unsigned int, unsigned int >, List< P >>> &  a_mappedParticles,
List< P > &  a_unmappedParticles 
) const
inlineprotectednoexcept

Iterate through the unmapped particles and map them to proper level, grid indices, and grid ranks.

Parameters
[in,out]a_mappedParticlesParticles mapped according to rank ownership (vector index) and grid level and index (std::pair)
[in,out]a_unmappedParticlesParticles that are not mapped (yet)

◆ operator[]() [1/2]

template<class P >
ParticleData< P > & ParticleContainer< P >::operator[] ( const int  a_level)

Get particle data on a level.

Parameters
[in]a_levelAMR level

◆ operator[]() [2/2]

template<class P >
const ParticleData< P > & ParticleContainer< P >::operator[] ( const int  a_level) const

Get data on a level. Const version.

Parameters
[in]a_levelAMR level

◆ organizeParticlesByCell()

template<class P >
void ParticleContainer< P >::organizeParticlesByCell

Sort particles by cell.

This will fill m_cellSortedParticles and destroy the patch-sorted particles.

◆ organizeParticlesByPatch()

template<class P >
void ParticleContainer< P >::organizeParticlesByPatch

Sort particles by cell.

This will fill m_particles from m_cellSortedParticles and destroy the cell-sorted particles.

◆ preRegrid()

template<class P >
void ParticleContainer< P >::preRegrid ( const int  a_base)

Cache particles before calling regrid.

Parameters
[in]a_baseCoarsest grid level which will not change.

◆ regrid()

template<class P >
void ParticleContainer< P >::regrid ( const Vector< DisjointBoxLayout > &  a_grids,
const Vector< ProblemDomain > &  a_domains,
const Vector< Real > &  a_dx,
const Vector< int > &  a_refRat,
const Vector< ValidMask > &  a_validMask,
const Vector< RefCountedPtr< LevelTiles >> &  a_levelTiles,
const int  a_base,
const int  a_newFinestLevel 
)

Regrid function. a_base is the coarsest grid level which did not change.

Parameters
[in]a_gridsAMR grids
[in]a_domainsAMR domains
[in]a_dxGrid resolutions
[in]a_refRatRefinement ratios
[in]a_validMaskValid cells
[in]a_levelTilesTiled AMR grids
[in]a_baseCoarsest grid level that did not change.
[in]a_newFinestLevelNew finest grid level

◆ setupGrownGrids()

template<class P >
void ParticleContainer< P >::setupGrownGrids ( const int  a_base,
const int  a_finestLevel 
)
protected

Set up grown grids.

Parameters
[in]a_baseBase level
[in]a_finestLevelFinest AMR level

◆ setupParticleData()

template<class P >
void ParticleContainer< P >::setupParticleData ( const int  a_base,
const int  a_finestLevel 
)
protected

Setup function for the particle data (m_particles and m_maskParticles)

Parameters
[in]a_baseBase level
[in]a_finestLevelFinest AMR level

◆ setValue() [1/2]

template<class P >
template<Real &(P::*)() particleScalarField>
void ParticleContainer< P >::setValue ( const Real  a_value)
inline

Set the particle member to the input value.

This is a jack-of-all-trades kind of routine for setting a particle field. The template parameter indicates the field to be set, it must be a pointer-to-member-function that returns the field to be set. For example, if the particle class P has a field mass which one wants to set, and this field is returned by a function Real& P::mass(), one can set the quantity for all particles by calling ParticleContainer<P>::setValue<&P::mass>(Real)

Parameters
[in]a_valueValue

◆ setValue() [2/2]

template<class P >
template<RealVect &(P::*)() particleVectorField>
void ParticleContainer< P >::setValue ( const RealVect  a_value)
inline

Set the particle member to the input value.

This is a jack-of-all-trades kind of routine for setting a particle field. The template parameter indicates the field to be set, it must be a pointer-to-member-function that returns the field to be set. For example, if the particle class P has a field vector which one wants to set, and this field is returned by a function RealVect& P::velocity(), one can set the quantity for all particles by calling ParticleContainer<P>::setValue<&P::velocity>(RealVect);

Parameters
[in]a_valueValue

◆ transferMaskParticles() [1/2]

template<class P >
void ParticleContainer< P >::transferMaskParticles ( const int  a_level,
const LevelData< BaseFab< bool >> &  a_mask 
)

Copy particles to masked particle data holder.

Parameters
[in]a_levelGrid level
[in]a_maskMask

◆ transferMaskParticles() [2/2]

template<class P >
void ParticleContainer< P >::transferMaskParticles ( const Vector< RefCountedPtr< LevelData< BaseFab< bool >>>> &  a_mask)

Copy particles to the mask particle data holder.

Parameters
[in]a_maskMask
Note
If the mask is nullptr on any of the levels, those levels will be ignored.

◆ transferParticles() [1/2]

template<class P >
void ParticleContainer< P >::transferParticles ( AMRParticles< P > &  a_otherContainer)

Move particles into this container.

Parameters
[in,out]a_otherContainerOther particle container.
Note
The grids MUST be the same for both containers. That is, the containers MUST be defined over the same realm.

◆ transferParticles() [2/2]

template<class P >
void ParticleContainer< P >::transferParticles ( ParticleContainer< P > &  a_otherContainer)

Move particles into this container.

Parameters
[in,out]a_otherContainerOther particle container.
Note
The grids MUST be the same for both containers. That is, the containers MUST be defined over the same realm.

◆ transferParticlesToSingleList()

template<typename P >
void ParticleContainer< P >::transferParticlesToSingleList ( List< P > &  a_list,
AMRParticles< P > &  a_particles 
) const
inlineprotectednoexcept

Gather the particles onto a single list.

Parameters
[in,out]a_listList containing all the particles in a_particles
[in,out]a_particlesParticles to transfer to list
Note
This is supposed to get inside an OpenMP parallel region.

Member Data Documentation

◆ m_bufferParticles

template<class P >
AMRParticles<P> ParticleContainer< P >::m_bufferParticles
mutableprotected

Special data holder that holds particles on a grown grid layout.

This particle data holder uses grids that exceed the DisjointBoxLayout on each level (boxes are grown by m_refRat). This means that this particle data holder can store particles that are out the DisjointBoxLayout by m_refRat cells. This is very useful when one wants to deposit particles on the fine level, but where the particles live on the coarse level. In such cases one will typically copy some (or all) particles from the coarse level to this data holder and deposit from this data holder onto the fine level.

◆ m_cacheParticles

template<class P >
AMRParticles<P> ParticleContainer< P >::m_cacheParticles
protected

Particles stored on the old grid.

Populated during the preRegrid call.


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