OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Public Types | Public Member Functions | Public Attributes | Protected Attributes | Private Member Functions | Private Attributes | List of all members
AmrParticleBase< PLayout > Class Template Reference

#include <AmrParticleBase.h>

Inheritance diagram for AmrParticleBase< PLayout >:
Inheritance graph
[legend]
Collaboration diagram for AmrParticleBase< PLayout >:
Collaboration graph
[legend]

Public Types

typedef PLayout::ParticlePos_t ParticlePos_t
 
typedef PLayout::ParticleIndex_t ParticleIndex_t
 
typedef PLayout::SingleParticlePos_t SingleParticlePos_t
 
typedef PLayout::AmrField_t AmrField_t
 
typedef PLayout::AmrVectorField_t AmrVectorField_t
 
typedef PLayout::AmrScalarFieldContainer_t AmrScalarFieldContainer_t
 
typedef PLayout::AmrVectorFieldContainer_t AmrVectorFieldContainer_t
 
typedef long SortListIndex_t
 
typedef std::vector< SortListIndex_tSortList_t
 
typedef std::vector< ParticleAttribBase * > attrib_container_t
 
typedef AmrParticleLevelCounter< size_t, size_t > ParticleLevelCounter_t
 
- Public Types inherited from IpplParticleBase< PLayout >
enum  { Dim = PLayout::Dimension }
 
typedef PLayout Layout_t
 
typedef PLayout::Position_t Position_t
 
typedef PLayout::Index_t Index_t
 
typedef PLayout::ParticlePos_t ParticlePos_t
 
typedef PLayout::ParticleIndex_t ParticleIndex_t
 
typedef PLayout::pair_iterator pair_iterator
 
typedef PLayout::pair_t pair_t
 
typedef PLayout::UpdateFlags UpdateFlags
 
typedef std::vector< ParticleAttribBase * > attrib_container_t
 
typedef attrib_container_t::iterator attrib_iterator
 
typedef ParticleAttribBase::SortList_t SortList_t
 
- Public Types inherited from DataSource
enum  DsMode { INPUT , OUTPUT , BOTH , DEFAULT }
 
typedef std::vector< DataSourceObject * > container_t
 
- Public Types inherited from AbstractParticle< PLayout::Position_t, PLayout::Dimension >
typedef ParticleLayout< PLayout::Position_t, Dim >::SingleParticlePos_t SingleParticlePos_t
 
typedef ParticleLayout< PLayout::Position_t, Dim >::Index_t Index_t
 
typedef ParticleAttrib< SingleParticlePos_tParticlePos_t
 
typedef ParticleAttrib< Index_tParticleIndex_t
 
typedef ParticleLayout< PLayout::Position_t, Dim >::UpdateFlags UpdateFlags
 
typedef ParticleLayout< PLayout::Position_t, Dim >::Position_t Position_t
 
typedef ParticleLayout< PLayout::Position_t, DimLayout_t
 

Public Member Functions

 AmrParticleBase ()
 
 AmrParticleBase (PLayout *layout)
 
 ~AmrParticleBase ()
 
void initializeAmr ()
 
const ParticleLevelCounter_tgetLocalNumPerLevel () const
 
ParticleLevelCounter_tgetLocalNumPerLevel ()
 
void setLocalNumPerLevel (const ParticleLevelCounter_t &LocalNumPerLevel)
 
void createWithID (unsigned id)
 
void create (size_t M)
 
void destroy (size_t M, size_t I, bool doNow=false)
 
void performDestroy (bool updateLocalNum=false)
 
void update ()
 
void update (int lev_min, int lev_max, bool isRegrid=false)
 
void update (const ParticleAttrib< char > &canSwap)
 
void sort ()
 
void sort (SortList_t &sortlist)
 
PLayoutgetAmrLayout ()
 
const PLayoutgetAmrLayout () const
 
void setForbidTransform (bool forbidTransform)
 
bool isForbidTransform () const
 
const double & domainMapping (bool inverse=false)
 
const double & getScalingFactor () const
 
void setLorentzFactor (const Vector_t &lorentzFactor)
 
- Public Member Functions inherited from IpplParticleBase< PLayout >
 IpplParticleBase ()
 
 IpplParticleBase (PLayout *layout)
 
 ~IpplParticleBase ()
 
void initialize (PLayout *)
 
size_t getTotalNum () const
 
size_t getLocalNum () const
 
size_t getDestroyNum () const
 
size_t getGhostNum () const
 
void setTotalNum (size_t n)
 
void setLocalNum (size_t n)
 
PLayoutgetLayout ()
 
const PLayoutgetLayout () const
 
ParticleBConds< Position_t, PLayout::Dimension > & getBConds ()
 
void setBConds (const ParticleBConds< Position_t, PLayout::Dimension > &bc)
 
bool singleInitNode () const
 
bool getUpdateFlag (UpdateFlags f) const
 
void setUpdateFlag (UpdateFlags f, bool val)
 
void addAttribute (ParticleAttribBase &pa)
 
ParticleAttribBasegetAttribute (attrib_container_t::size_type N)
 
attrib_container_t::size_type numAttributes () const
 
attrib_iterator begin ()
 
attrib_iterator end ()
 
void resetID ()
 
virtual void update ()
 
virtual void update (const ParticleAttrib< char > &canSwap)
 
void createWithID (unsigned id)
 
void create (size_t)
 
void globalCreate (size_t np)
 
void destroy (size_t, size_t, bool=false)
 
size_t putMessage (Message &, size_t, size_t)
 
size_t putMessage (Message &, const std::vector< size_t > &)
 
size_t putMessage (Message &, size_t)
 
FormatgetFormat ()
 
size_t writeMsgBuffer (MsgBuffer *&, const std::vector< size_t > &)
 
template<class O >
size_t writeMsgBufferWithOffsets (MsgBuffer *&, const std::vector< size_t > &, const std::vector< O > &)
 
size_t readMsgBuffer (MsgBuffer *)
 
size_t readGhostMsgBuffer (MsgBuffer *, int)
 
size_t getMessage (Message &)
 
size_t getSingleMessage (Message &)
 
size_t getMessageAndCreate (Message &)
 
void performDestroy (bool updateLocalNum=false)
 
void sort (SortList_t &)
 
size_t ghostPutMessage (Message &, size_t, size_t)
 
size_t ghostPutMessage (Message &, const std::vector< size_t > &)
 
size_t ghostGetMessage (Message &, int)
 
size_t ghostGetSingleMessage (Message &, int)
 
void ghostDestroy (size_t, size_t)
 
void printDebug (Inform &)
 
- Public Member Functions inherited from DataSource
 DataSource ()
 
virtual ~DataSource ()
 
bool connected (DataConnect *=0) const
 
DataSourceObjectfindDataSourceObject (DataConnect *) const
 
DataConnectconnect (const char *, DataConnect *=0, int=DataSource::DEFAULT)
 
bool connect (DataSourceObject *)
 
bool disconnect (DataConnect *=0)
 
bool updateConnection (DataConnect *=0)
 
void interact (DataConnect *=0)
 
void interact (const char *, DataConnect *=0)
 
- Public Member Functions inherited from AbstractParticle< PLayout::Position_t, PLayout::Dimension >
 AbstractParticle ()
 
virtual ~AbstractParticle ()
 
virtual void addAttribute (ParticleAttribBase &pa)=0
 
virtual size_t getTotalNum () const=0
 
virtual size_t getLocalNum () const=0
 
virtual size_t getDestroyNum () const=0
 
virtual size_t getGhostNum () const=0
 
virtual void setTotalNum (size_t n)=0
 
virtual void setLocalNum (size_t n)=0
 
virtual Layout_tgetLayout ()=0
 
virtual const Layout_tgetLayout () const=0
 
virtual bool getUpdateFlag (UpdateFlags f) const=0
 
virtual void setUpdateFlag (UpdateFlags f, bool val)=0
 
virtual ParticleBConds< Position_t, Dim > & getBConds ()=0
 
virtual void setBConds (const ParticleBConds< Position_t, Dim > &bc)=0
 
virtual bool singleInitNode () const=0
 
virtual void resetID ()=0
 
virtual void update ()=0
 
virtual void update (const ParticleAttrib< char > &canSwap)=0
 
virtual void createWithID (unsigned id)=0
 
virtual void create (size_t)=0
 
virtual void globalCreate (size_t np)=0
 
virtual void destroy (size_t, size_t, bool=false)=0
 
virtual void performDestroy (bool updateLocalNum=false)=0
 
virtual void ghostDestroy (size_t M, size_t I)=0
 

Public Attributes

ParticleIndex_t Level
 
ParticleIndex_t Grid
 
- Public Attributes inherited from IpplParticleBase< PLayout >
ParticlePos_t R
 
ParticleIndex_t ID
 
- Public Attributes inherited from AbstractParticle< PLayout::Position_t, PLayout::Dimension >
ParticlePos_tR_p
 
ParticleIndex_tID_p
 

Protected Attributes

IpplTimings::TimerRef updateParticlesTimer_m
 
IpplTimings::TimerRef sortParticlesTimer_m
 
IpplTimings::TimerRef domainMappingTimer_m
 
bool forbidTransform_m
 To avoid multiple transformations during regrid. More...
 
double scale_m
 
Vector_t lorentzFactor_m
 
- Protected Attributes inherited from IpplParticleBase< PLayout >
std::vector< std::pair< size_t, size_t > > DestroyList
 

Private Member Functions

void getLocalBounds_m (Vector_t &rmin, Vector_t &rmax)
 
void getGlobalBounds_m (Vector_t &rmin, Vector_t &rmax)
 

Private Attributes

ParticleLevelCounter_t LocalNumPerLevel_m
 

Additional Inherited Members

- Protected Member Functions inherited from IpplParticleBase< PLayout >
virtual DataSourceObjectcreateDataSourceObject (const char *nm, DataConnect *dc, int tm)
 
virtual DataSourceObjectcreateDataSourceObject (const char *, DataConnect *, int)=0
 

Detailed Description

template<class PLayout>
class AmrParticleBase< PLayout >

Definition at line 46 of file AmrParticleBase.h.

Member Typedef Documentation

◆ AmrField_t

template<class PLayout >
typedef PLayout::AmrField_t AmrParticleBase< PLayout >::AmrField_t

Definition at line 52 of file AmrParticleBase.h.

◆ AmrScalarFieldContainer_t

template<class PLayout >
typedef PLayout::AmrScalarFieldContainer_t AmrParticleBase< PLayout >::AmrScalarFieldContainer_t

Definition at line 54 of file AmrParticleBase.h.

◆ AmrVectorField_t

template<class PLayout >
typedef PLayout::AmrVectorField_t AmrParticleBase< PLayout >::AmrVectorField_t

Definition at line 53 of file AmrParticleBase.h.

◆ AmrVectorFieldContainer_t

template<class PLayout >
typedef PLayout::AmrVectorFieldContainer_t AmrParticleBase< PLayout >::AmrVectorFieldContainer_t

Definition at line 55 of file AmrParticleBase.h.

◆ attrib_container_t

template<class PLayout >
typedef std::vector<ParticleAttribBase *> AmrParticleBase< PLayout >::attrib_container_t

Definition at line 59 of file AmrParticleBase.h.

◆ ParticleIndex_t

template<class PLayout >
typedef PLayout::ParticleIndex_t AmrParticleBase< PLayout >::ParticleIndex_t

Definition at line 50 of file AmrParticleBase.h.

◆ ParticleLevelCounter_t

template<class PLayout >
typedef AmrParticleLevelCounter<size_t, size_t> AmrParticleBase< PLayout >::ParticleLevelCounter_t

Definition at line 64 of file AmrParticleBase.h.

◆ ParticlePos_t

template<class PLayout >
typedef PLayout::ParticlePos_t AmrParticleBase< PLayout >::ParticlePos_t

Definition at line 49 of file AmrParticleBase.h.

◆ SingleParticlePos_t

template<class PLayout >
typedef PLayout::SingleParticlePos_t AmrParticleBase< PLayout >::SingleParticlePos_t

Definition at line 51 of file AmrParticleBase.h.

◆ SortList_t

template<class PLayout >
typedef std::vector<SortListIndex_t> AmrParticleBase< PLayout >::SortList_t

Definition at line 58 of file AmrParticleBase.h.

◆ SortListIndex_t

template<class PLayout >
typedef long AmrParticleBase< PLayout >::SortListIndex_t

Definition at line 57 of file AmrParticleBase.h.

Constructor & Destructor Documentation

◆ AmrParticleBase() [1/2]

◆ AmrParticleBase() [2/2]

template<class PLayout >
AmrParticleBase< PLayout >::AmrParticleBase ( PLayout layout)

◆ ~AmrParticleBase()

template<class PLayout >
AmrParticleBase< PLayout >::~AmrParticleBase ( )
inline

Definition at line 72 of file AmrParticleBase.h.

Member Function Documentation

◆ create()

template<class PLayout >
void AmrParticleBase< PLayout >::create ( size_t  M)
virtual

Implements AbstractParticle< PLayout::Position_t, PLayout::Dimension >.

Definition at line 135 of file AmrParticleBase.hpp.

References IpplParticleBase< PLayout >::create().

Here is the call graph for this function:

◆ createWithID()

template<class PLayout >
void AmrParticleBase< PLayout >::createWithID ( unsigned  id)
virtual

Implements AbstractParticle< PLayout::Position_t, PLayout::Dimension >.

Definition at line 152 of file AmrParticleBase.hpp.

References IpplParticleBase< PLayout >::createWithID().

Here is the call graph for this function:

◆ destroy()

template<class PLayout >
void AmrParticleBase< PLayout >::destroy ( size_t  M,
size_t  I,
bool  doNow = false 
)
virtual

Implements AbstractParticle< PLayout::Position_t, PLayout::Dimension >.

Definition at line 95 of file AmrParticleBase.hpp.

References IpplParticleBase< PLayout >::destroy().

Here is the call graph for this function:

◆ domainMapping()

template<class PLayout >
const double & AmrParticleBase< PLayout >::domainMapping ( bool  inverse = false)

Linear mapping to AMReX computation domain [-1, 1]^3 including the Lorentz transform. All dimensions are mapped by the same scaling factor. The potential and electric field need to be scaled afterwards appropriately.

Parameters
PDatais the particle data
inverseis true if we want to do the inverse operation
Returns
scaling factor

Definition at line 265 of file AmrParticleBase.hpp.

References abs(), matheval::detail::math::isinf(), matheval::detail::math::isnan(), max(), IpplInfo::myNode(), Attrib::Distribution::R, IpplTimings::startTimer(), and IpplTimings::stopTimer().

Referenced by AmrPartBunch::boundp(), AmrBoxLib::computeSelfFields_cycl(), AmrPartBunch::do_binaryRepart(), and AmrBoxLib::initFineLevels().

Here is the call graph for this function:

◆ getAmrLayout() [1/2]

template<class PLayout >
PLayout & AmrParticleBase< PLayout >::getAmrLayout ( )
inline

Definition at line 125 of file AmrParticleBase.h.

References IpplParticleBase< PLayout >::getLayout().

Referenced by AmrPartBunch::set_meshEnlargement(), AmrPartBunch::setAmrDomainRatio(), and AmrYtWriter::writeBunch().

Here is the call graph for this function:

◆ getAmrLayout() [2/2]

template<class PLayout >
const PLayout & AmrParticleBase< PLayout >::getAmrLayout ( ) const
inline

Definition at line 126 of file AmrParticleBase.h.

References IpplParticleBase< PLayout >::getLayout().

Here is the call graph for this function:

◆ getGlobalBounds_m()

template<class PLayout >
void AmrParticleBase< PLayout >::getGlobalBounds_m ( Vector_t rmin,
Vector_t rmax 
)
private

Definition at line 370 of file AmrParticleBase.hpp.

References allreduce(), and min().

Here is the call graph for this function:

◆ getLocalBounds_m()

template<class PLayout >
void AmrParticleBase< PLayout >::getLocalBounds_m ( Vector_t rmin,
Vector_t rmax 
)
private

Definition at line 349 of file AmrParticleBase.hpp.

References max(), and Attrib::Distribution::R.

Here is the call graph for this function:

◆ getLocalNumPerLevel() [1/2]

template<class PLayout >
AmrParticleBase< PLayout >::ParticleLevelCounter_t & AmrParticleBase< PLayout >::getLocalNumPerLevel

Definition at line 80 of file AmrParticleBase.hpp.

◆ getLocalNumPerLevel() [2/2]

template<class PLayout >
const AmrParticleBase< PLayout >::ParticleLevelCounter_t & AmrParticleBase< PLayout >::getLocalNumPerLevel

◆ getScalingFactor()

template<class PLayout >
const double & AmrParticleBase< PLayout >::getScalingFactor
inline

This function is used during the cell tagging routines.

Returns
the scaling factor of the particle domain mapping.

Definition at line 338 of file AmrParticleBase.hpp.

Referenced by AmrPartBunch::get_hr(), and AmrBoxLib::tagForChargeDensity_m().

◆ initializeAmr()

template<class PLayout >
void AmrParticleBase< PLayout >::initializeAmr ( )
inline

Definition at line 75 of file AmrParticleBase.h.

References IpplParticleBase< PLayout >::addAttribute().

Here is the call graph for this function:

◆ isForbidTransform()

template<class PLayout >
bool AmrParticleBase< PLayout >::isForbidTransform
inline
Returns
true if we are not mapping the particles onto \([-1, 1]^3\) during an update call.

Definition at line 259 of file AmrParticleBase.hpp.

Referenced by AmrPartBunch::boundp(), AmrPartBunch::do_binaryRepart(), and AmrBoxLib::initFineLevels().

◆ performDestroy()

template<class PLayout >
void AmrParticleBase< PLayout >::performDestroy ( bool  updateLocalNum = false)
virtual

Implements AbstractParticle< PLayout::Position_t, PLayout::Dimension >.

Definition at line 110 of file AmrParticleBase.hpp.

References IpplParticleBase< PLayout >::performDestroy().

Here is the call graph for this function:

◆ setForbidTransform()

template<class PLayout >
void AmrParticleBase< PLayout >::setForbidTransform ( bool  forbidTransform)
inline

This method is used in the AmrPartBunch::boundp() function in order to avoid multpile particle mappings during the mesh regridding process.

Parameters
forbidTransformtrue if we don't want to map particles onto \([-1, 1]^3\)

Definition at line 253 of file AmrParticleBase.hpp.

Referenced by AmrPartBunch::boundp(), AmrBoxLib::computeSelfFields_cycl(), AmrPartBunch::do_binaryRepart(), and AmrBoxLib::initFineLevels().

◆ setLocalNumPerLevel()

template<class PLayout >
void AmrParticleBase< PLayout >::setLocalNumPerLevel ( const ParticleLevelCounter_t LocalNumPerLevel)

Definition at line 87 of file AmrParticleBase.hpp.

◆ setLorentzFactor()

template<class PLayout >
void AmrParticleBase< PLayout >::setLorentzFactor ( const Vector_t lorentzFactor)

Definition at line 343 of file AmrParticleBase.hpp.

Referenced by AmrPartBunch::updateLorentzFactor().

◆ sort() [1/2]

template<class PLayout >
void AmrParticleBase< PLayout >::sort

Definition at line 215 of file AmrParticleBase.hpp.

References IpplTimings::startTimer(), and IpplTimings::stopTimer().

Here is the call graph for this function:

◆ sort() [2/2]

template<class PLayout >
void AmrParticleBase< PLayout >::sort ( SortList_t sortlist)

Definition at line 244 of file AmrParticleBase.hpp.

References begin(), and end().

Here is the call graph for this function:

◆ update() [1/3]

template<class PLayout >
void AmrParticleBase< PLayout >::update
virtual

◆ update() [2/3]

template<class PLayout >
void AmrParticleBase< PLayout >::update ( const ParticleAttrib< char > &  canSwap)
virtual

Reimplemented from IpplParticleBase< PLayout >.

Definition at line 194 of file AmrParticleBase.hpp.

References INCIPPLSTAT, PAssert, IpplTimings::startTimer(), and IpplTimings::stopTimer().

Here is the call graph for this function:

◆ update() [3/3]

template<class PLayout >
void AmrParticleBase< PLayout >::update ( int  lev_min,
int  lev_max,
bool  isRegrid = false 
)

There's is NO check performed if lev_min <= lev_max and lev_min >= 0.

Parameters
lev_minis the start level to update
lev_maxis the last level to update
isRegridis true if we are updating the grids (default: false)

Definition at line 173 of file AmrParticleBase.hpp.

References INCIPPLSTAT, PAssert, IpplTimings::startTimer(), and IpplTimings::stopTimer().

Here is the call graph for this function:

Member Data Documentation

◆ domainMappingTimer_m

template<class PLayout >
IpplTimings::TimerRef AmrParticleBase< PLayout >::domainMappingTimer_m
protected

Definition at line 173 of file AmrParticleBase.h.

Referenced by AmrParticleBase< PLayout >::AmrParticleBase().

◆ forbidTransform_m

template<class PLayout >
bool AmrParticleBase< PLayout >::forbidTransform_m
protected

To avoid multiple transformations during regrid.

Definition at line 175 of file AmrParticleBase.h.

◆ Grid

template<class PLayout >
ParticleIndex_t AmrParticleBase< PLayout >::Grid

Definition at line 62 of file AmrParticleBase.h.

Referenced by AmrYtWriter::writeParticles_m().

◆ Level

template<class PLayout >
ParticleIndex_t AmrParticleBase< PLayout >::Level

Definition at line 61 of file AmrParticleBase.h.

◆ LocalNumPerLevel_m

template<class PLayout >
ParticleLevelCounter_t AmrParticleBase< PLayout >::LocalNumPerLevel_m
private

Definition at line 194 of file AmrParticleBase.h.

◆ lorentzFactor_m

template<class PLayout >
Vector_t AmrParticleBase< PLayout >::lorentzFactor_m
protected

Lorentz factor used for the domain mapping. Is updated in AmrBoxLib

Definition at line 188 of file AmrParticleBase.h.

◆ scale_m

template<class PLayout >
double AmrParticleBase< PLayout >::scale_m
protected

Scaling factor for particle coordinate transform (used for Poisson solve and particle-to-core distribution)

Definition at line 181 of file AmrParticleBase.h.

◆ sortParticlesTimer_m

template<class PLayout >
IpplTimings::TimerRef AmrParticleBase< PLayout >::sortParticlesTimer_m
protected

Definition at line 172 of file AmrParticleBase.h.

Referenced by AmrParticleBase< PLayout >::AmrParticleBase().

◆ updateParticlesTimer_m

template<class PLayout >
IpplTimings::TimerRef AmrParticleBase< PLayout >::updateParticlesTimer_m
protected

Definition at line 171 of file AmrParticleBase.h.

Referenced by AmrParticleBase< PLayout >::AmrParticleBase().


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