chombo-discharge
Loading...
Searching...
No Matches
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 > > >
 alias type alias.
 

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, int a_blockingFactor, int a_finestLevel, std::string a_realm)
 Full constructor.
 
virtual ~ParticleContainer ()
 Destructor ( does nothing)
 
 ParticleContainer (const ParticleContainer &)=delete
 
ParticleContaineroperator= (const ParticleContainer &)=delete
 
 ParticleContainer (ParticleContainer &&)=default
 Move constructor.
 
ParticleContaineroperator= (ParticleContainer &&)=default
 Move assignment operator.
 
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, int a_blockingFactor, int a_finestLevel, const std::string &a_realm)
 Define the container. This will do a clear-out of all particles.
 
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, int a_base, int a_newFinestLevel)
 Regrid function. a_base is the coarsest grid level which did not change.
 
void preRegrid (int a_lmin)
 Cache particles before calling regrid.
 
void resetParticleIDs () noexcept
 Compute new particle IDs.
 
void copyMaskParticles (const Vector< RefCountedPtr< LevelData< BaseFab< bool > > > > &a_mask) const
 Copy particles to mask particle data holder.
 
void copyMaskParticles (int a_level, const LevelData< BaseFab< bool > > &a_mask) const
 Copy particles to masked particle data holder.
 
void transferMaskParticles (const Vector< RefCountedPtr< LevelData< BaseFab< bool > > > > &a_mask)
 Copy particles to the mask particle data holder.
 
void transferMaskParticles (int a_level, const LevelData< BaseFab< bool > > &a_mask)
 Copy particles to masked particle data holder.
 
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.
 
bool isOrganizedByCell () const
 Is cell-sorted or not.
 
int getFinestLevel () const
 Get finest AMR level.
 
std::string getRealm () const
 Get the realm where this ParticleContainer lives.
 
AMRParticles< P > & getParticles ()
 Get all particles on all levels.
 
const AMRParticles< P > & getParticles () const
 Get all particles on a level. Const version.
 
AMRParticles< P > & getBufferParticles ()
 Get buffer particles on all levels.
 
const AMRParticles< P > & getBufferParticles () const
 Get buffer particles on all levels. Const version.
 
AMRParticles< P > & getMaskParticles ()
 Get the mask particles.
 
const AMRParticles< P > & getMaskParticles () const
 Get the mask particles. Const version.
 
const Vector< DisjointBoxLayout > & getGrids () const
 Get the AMR grids.
 
RealVect getProbLo () const noexcept
 Get lower-left corner.
 
Vector< RealVectgetDx () const noexcept
 Get grid resolutions.
 
ParticleData< P > & operator[] (int a_lvl)
 Get particle data on a level.
 
const ParticleData< P > & operator[] (int a_level) const
 Get data on a level. Const version.
 
AMRCellParticles< P > & getCellParticles ()
 Get all cell particles.
 
const AMRCellParticles< P > & getCellParticles () const
 Get cell particles, const version.
 
LayoutData< BinFab< P > > & getCellParticles (int a_level)
 Get cell particles.
 
const LayoutData< BinFab< P > > & getCellParticles (int a_level) const
 Get cell particles, const version.
 
BinFab< P > & getCellParticles (int a_level, const DataIndex &a_dit)
 Get cell particles on a specific level and grid inex.
 
const BinFab< P > & getCellParticles (int a_level, const DataIndex &a_dit) const
 Get cell particles, const version.
 
void getCellParticles (BinFab< P > &a_cellParticles, int a_lvl, const DataIndex &a_dit) const
 Fill a cell-sorted particle data holder with all the particles in the grid patch.
 
void getCellParticlesDestructive (BinFab< P > &a_cellParticles, 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.
 
void organizeParticlesByCell ()
 Sort particles by cell.
 
void organizeParticlesByPatch ()
 Sort particles by cell.
 
void addParticles (const List< P > &a_particles)
 Add particles to container.
 
void addParticlesDestructive (List< P > &a_particles)
 Add particles to container. The input particles are destroyed by this routine.
 
void addParticles (const BinFab< P > &a_particles, int a_lvl, const DataIndex &a_dit)
 Add particles to a certain level and patch. The input particles are cell-sorted.
 
void addParticlesDestructive (BinFab< P > &a_particles, 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).
 
void addParticles (const ParticleContainer< P > &a_otherContainer)
 Add particles from other container to this one.
 
void addParticlesDestructive (ParticleContainer< P > &a_otherContainer)
 Add particles from other container to this one. This destroys the particles in the other container.
 
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.
 
void transferParticles (AMRParticles< P > &a_otherContainer)
 Move particles into this container.
 
void admitValidParticles (List< P > &a_evictedParticles, ParticleData< P > &a_particles, int a_coarseLevel)
 Evict particles if they move out of the valid region.
 
template<Real &(P::*)() particleScalarField>
void setValue (Real a_value)
 Set the particle member to the input value.
 
template<RealVect &(P::*)() particleVectorField>
void setValue (const RealVect &a_value)
 Set the particle member to the input value.
 
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 (int a_base, int a_finestLevel)
 Set up grown grids.
 
void setupParticleData (int a_base, int a_finestLevel)
 Setup function for the particle data (m_particles and m_maskParticles)
 
void transferParticlesToSingleList (List< P > &a_list, AMRParticles< P > &a_particles) const noexcept
 Gather the particles onto a single list.
 
void copyParticlesToSingleList (List< P > &a_list, const AMRParticles< P > &a_particles) const noexcept
 Copy the input particles onto a single list.
 
void mapParticlesToAMRGrid (std::vector< ParticleMap< 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.
 
void catenateParticleMaps (std::vector< ParticleMap< List< P > > > &a_globalParticles, std::vector< ParticleMap< List< P > > > &a_localParticles) const noexcept
 Catenate the particles. This is usually called within OpenMP parallel regions.
 
void assignLocalParticles (ParticleMap< List< P > > &a_mappedParticles, AMRParticles< P > &a_particleData) const noexcept
 Gather particles locally.
 

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 = false
 Check if particle container is defined.
 
bool m_isOrganizedByCell = false
 Check if particle container is "cell sorted".
 
bool m_profile = false
 Profile or not.
 
bool m_debug = false
 Debug or not.
 
bool m_verbose = false
 Verbose or not.
 
Vector< RefCountedPtr< LevelTiles > > m_levelTiles
 Tiled AMR space.
 
Vector< DisjointBoxLayoutm_grids
 AMR grids.
 
Vector< DisjointBoxLayoutm_oldGrids
 Old AMR grids. Used during regrids.
 
Vector< ProblemDomainm_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< BoxLayoutm_grownGrids
 Grown layouts.
 
Vector< RealVectm_dx
 Resolutions on each grid level.
 
Vector< intm_refRat
 Refinement ratios. Entry at index 'l' is the refinement between level 'l' and level 'l+1'.
 
AMRParticles< Pm_particles
 The actual particles that this ParticleContainer represents.
 
AMRParticles< Pm_bufferParticles
 Special data holder that holds particles on a grown grid layout.
 
AMRParticles< Pm_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< Pm_cacheParticles
 Particles stored on the old grid.
 
AMRCellParticles< Pm_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,
int  a_blockingFactor,
int  a_finestLevel,
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,
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,
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,
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_coarseLevelCoarse level

◆ assignLocalParticles()

template<typename P >
void ParticleContainer< P >::assignLocalParticles ( ParticleMap< 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< ParticleMap< List< P > > > &  a_globalParticles,
std::vector< ParticleMap< 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 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.

◆ copyMaskParticles() [2/2]

template<class P >
void ParticleContainer< P >::copyMaskParticles ( 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

◆ 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,
int  a_blockingFactor,
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 ( ) const

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.
Returns
Cell particles

◆ getCellParticles() [2/7]

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

Get cell particles, const version.

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

◆ getCellParticles() [3/7]

template<class P >
void ParticleContainer< P >::getCellParticles ( BinFab< P > &  a_cellParticles,
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_ditGrid index
Note
This will define a_cellParticles over the DisjointBoxLayout grid box and fill it with the particles in the patch.
Parameters
[in]a_lvlLvl

◆ getCellParticles() [4/7]

template<class P >
LayoutData< BinFab< P > > & ParticleContainer< P >::getCellParticles ( 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.
Returns
Cell particles

◆ getCellParticles() [5/7]

template<class P >
const LayoutData< BinFab< P > > & ParticleContainer< P >::getCellParticles ( 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.
Returns
Cell particles

◆ getCellParticles() [6/7]

template<class P >
BinFab< P > & ParticleContainer< P >::getCellParticles ( 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.
Returns
Cell particles

◆ getCellParticles() [7/7]

template<class P >
const BinFab< P > & ParticleContainer< P >::getCellParticles ( 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.
Returns
Cell particles

◆ getCellParticlesDestructive()

template<class P >
void ParticleContainer< P >::getCellParticlesDestructive ( BinFab< P > &  a_cellParticles,
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_ditGrid index
Note
This will define a_cellParticles over the DisjointBoxLayout grid box and fill it with the particles in the patch.
Parameters
[in]a_lvlLvl

◆ getDx()

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

Get grid resolutions.

Returns
m_dx

◆ getFinestLevel()

template<class P >
int ParticleContainer< P >::getFinestLevel ( ) const

Get finest AMR level.

Returns
Finest level

◆ getGrids()

template<class P >
const Vector< DisjointBoxLayout > & ParticleContainer< P >::getGrids ( ) const

Get the AMR grids.

Returns
Grids

◆ 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 ( ) const

Get the mask particles. Const version.

Returns
m_maskParticles

◆ getNumberOfMaskParticlesGlobal()

template<class P >
unsigned long long ParticleContainer< P >::getNumberOfMaskParticlesGlobal ( ) const

Get the number particles in the halo cells.

Returns
Number of mask particles global

◆ getNumberOfMaskParticlesLocal()

template<class P >
unsigned long long ParticleContainer< P >::getNumberOfMaskParticlesLocal ( ) const

Get the number particles in the halo cells.

Returns
Number of mask particles local

◆ getNumberOfOutcastParticlesGlobal()

template<class P >
unsigned long long ParticleContainer< P >::getNumberOfOutcastParticlesGlobal ( ) const

Get global number of particles.

Returns
Number of outcast particles global

◆ getNumberOfOutcastParticlesLocal()

template<class P >
unsigned long long ParticleContainer< P >::getNumberOfOutcastParticlesLocal ( ) const

Get local number of particles.

Returns
Number of outcast particles local

◆ getNumberOfValidParticlesGlobal()

template<class P >
unsigned long long ParticleContainer< P >::getNumberOfValidParticlesGlobal ( ) const

Get global number of particles.

Returns
Number of valid particles global

◆ getNumberOfValidParticlesLocal()

template<class P >
unsigned long long ParticleContainer< P >::getNumberOfValidParticlesLocal ( ) const

Get local number of particles.

Returns
Number of valid particles local

◆ 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 ( ) const

Get all particles on a level. Const version.

Returns
m_particles

◆ getProbLo()

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

Get lower-left corner.

Returns
m_probLo

◆ getRealm()

template<class P >
std::string ParticleContainer< P >::getRealm ( ) const

Get the realm where this ParticleContainer lives.

Returns
Realm

◆ isOrganizedByCell()

template<class P >
bool ParticleContainer< P >::isOrganizedByCell ( ) const

Is cell-sorted or not.

Returns
True if organized by cell, false otherwise

◆ mapParticlesToAMRGrid()

template<typename P >
void ParticleContainer< P >::mapParticlesToAMRGrid ( std::vector< ParticleMap< 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=()

Move assignment operator.

Returns
Reference to this.

◆ operator[]() [1/2]

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

Get data on a level. Const version.

Parameters
[in]a_levelAMR level
Returns
Return value

◆ operator[]() [2/2]

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

Get particle data on a level.

Parameters
[in]a_lvlAMR level
Returns
Return value

◆ 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 ( int  a_lmin)

Cache particles before calling regrid.

Parameters
[in]a_lminCoarsest 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,
int  a_base,
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 ( int  a_base,
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 ( int  a_base,
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<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

◆ setValue() [2/2]

template<class P >
template<Real &(P::*)() particleScalarField>
void ParticleContainer< P >::setValue ( 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

◆ transferMaskParticles() [1/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.

◆ transferMaskParticles() [2/2]

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

Copy particles to masked particle data holder.

Parameters
[in]a_levelGrid level
[in]a_maskMask

◆ 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: