ls1-MarDyn
ls1-MarDyn molecular dynamics code
Public Member Functions | List of all members
ParticleContainerToBasisWrapper Class Reference
Inheritance diagram for ParticleContainerToBasisWrapper:
ParticleContainer MemoryProfilable

Public Member Functions

void readXML (XMLfileUnits &xmlconfig) override
 
void setBoundingBox (std::shared_ptr< Object > object)
 
bool addParticle (Molecule &particle, bool inBoxCheckedAlready=false, bool checkWhetherDuplicate=false, const bool &rebuildCaches=false) override
 add a single Molecule to the ParticleContainer. More...
 
BasisgetBasis ()
 return reference to internal basis object.
 
void clear () override
 Delete all molecules in container. More...
 
unsigned long getNumberOfParticles () override
 
double getBoundingBoxMin (int dimension) const override
 returns one coordinate of the lower corner of the bounding box More...
 
double getBoundingBoxMax (int dimension) const override
 returns one coordinate of the higher corner of the bounding box More...
 
bool isInBoundingBox (double r[3]) const override
 checks, whether given coordinates are within the bounding box More...
 
void update () override
 do necessary updates resulting from changed particle positions More...
 
void addParticles (std::vector< Molecule > &particles, bool checkWhetherDuplicate=false) override
 adds a whole vector of particles More...
 
void traverseCells (CellProcessor &cellProcessor) override
 traverse pairs which are close to each other More...
 
void traverseNonInnermostCells (CellProcessor &cellProcessor) override
 
void traversePartialInnermostCells (CellProcessor &cellProcessor, unsigned int stage, int stageCount) override
 
ParticleIterator iterator (ParticleIterator::Type t) override
 
RegionParticleIterator regionIterator (const double startCorner[3], const double endCorner[3], ParticleIterator::Type t) override
 
void deleteOuterParticles () override
 delete all Particles which are not within the bounding box More...
 
double get_halo_L (int index) const override
 returns the width of the halo stripe (for the given dimension index) More...
 
double getCutoff () const override
 
void deleteMolecule (ParticleIterator &moleculeIter, const bool &rebuildCaches) override
 
double getEnergy (ParticlePairsHandler *particlePairsHandler, Molecule *m1, CellProcessor &cellProcessor) override
 
void updateInnerMoleculeCaches () override
 Update the caches of the molecules, that lie in inner cells. The caches of boundary and halo cells is not updated. This method is used for a multi-step scheme of overlapping mpi communication. More...
 
void updateBoundaryAndHaloMoleculeCaches () override
 Update the caches of the molecules, that lie in the boundary or halo cells. The caches of boundary and halo cells is updated, the caches of the inner cells are not updated. This method is used for a multi-step scheme of overlapping mpi communication. More...
 
void updateMoleculeCaches () override
 Update the caches of the molecules. More...
 
std::variant< ParticleIterator, SingleCellIterator< ParticleCell > > getMoleculeAtPosition (const double pos[3]) override
 Gets a molecule by its position. More...
 
unsigned long initCubicGrid (std::array< unsigned long, 3 > numMoleculesPerDimension, std::array< double, 3 > simBoxLength, size_t seed_offset) override
 
size_t getTotalSize () override
 
void printSubInfo (int offset) override
 
std::string getName () override
 
double * getCellLength () override
 
string getConfigurationAsString () override
 
- Public Member Functions inherited from ParticleContainer
 ParticleContainer (double bBoxMin[3], double bBoxMax[3])
 The constructor. More...
 
 ParticleContainer ()
 Default constructor.
 
virtual ~ParticleContainer ()
 The destructor.
 
virtual bool rebuild (double bBoxMin[3], double bBoxMax[3])
 rebuild the datastructure More...
 
virtual bool addHaloParticle (Molecule &particle, bool inBoxCheckedAlready=false, bool checkWhetherDuplicate=false, const bool &rebuildCaches=false)
 add a single Molecule to the ParticleContainer, ensures that it is added in the halo. More...
 
virtual int getHaloWidthNumCells ()
 
virtual double getSkin () const
 
virtual bool requiresForceExchange () const
 
virtual double * getHaloSize ()
 
virtual std::vector< unsigned long > getParticleCellStatistics ()
 
virtual void setCutoff (double rc)
 
virtual std::vector< MoleculegetInvalidParticles ()
 
virtual bool isInvalidParticleReturner ()
 

Additional Inherited Members

- Protected Attributes inherited from ParticleContainer
double _boundingBoxMin [3]
 coordinates of the left, lower, front corner of the bounding box
 
double _boundingBoxMax [3]
 coordinates of the right, upper, back corner of the bounding box
 

Detailed Description

The ParticleContainerToBasisWrapper class is there to read in any phase space input and save it into a Basis object instead of a regular particle container, so it can be used for the grid filler.

Warning
While providing all interface methods the ParticleContainerToBasisWrapper is not a fully working particle container!
Todo:
Find a better way to reuse all the different I/O classes and their readPhase space methods. Maybe bring back the Dummy domain decomposition?

Member Function Documentation

◆ addParticle()

bool ParticleContainerToBasisWrapper::addParticle ( Molecule particle,
bool  inBoxCheckedAlready = false,
bool  checkWhetherDuplicate = false,
const bool &  rebuildCaches = false 
)
inlineoverridevirtual

add a single Molecule to the ParticleContainer.

Note: a copy of the particle is pushed. Destroying the argument is responsibility of the programmer.

Parameters
particlereference to the particle which has to be added
inBoxCheckedAlready- if true, spare check whether molecule is in bounding box
checkWhetherDuplicate- if true, check whether molecule already exists and don't insert it.
rebuildCachesspecifies, whether the caches should be rebuild
Returns
true if successful, false if particle outside domain

Implements ParticleContainer.

◆ addParticles()

void ParticleContainerToBasisWrapper::addParticles ( std::vector< Molecule > &  particles,
bool  checkWhetherDuplicate = false 
)
inlineoverridevirtual

adds a whole vector of particles

Parameters
particlesreference to a vector of pointers to particles

Implements ParticleContainer.

◆ clear()

void ParticleContainerToBasisWrapper::clear ( )
inlineoverridevirtual

Delete all molecules in container.

Implements ParticleContainer.

◆ deleteMolecule()

void ParticleContainerToBasisWrapper::deleteMolecule ( ParticleIterator moleculeIter,
const bool &  rebuildCaches 
)
inlineoverridevirtual

Implements ParticleContainer.

◆ deleteOuterParticles()

void ParticleContainerToBasisWrapper::deleteOuterParticles ( )
inlineoverridevirtual

delete all Particles which are not within the bounding box

Implements ParticleContainer.

◆ get_halo_L()

double ParticleContainerToBasisWrapper::get_halo_L ( int  index) const
inlineoverridevirtual

returns the width of the halo stripe (for the given dimension index)

Todo:
remove this method, because a halo_L shouldn't be necessary for every ParticleContainer e.g. replace it by the cutoff-radius

Implements ParticleContainer.

◆ getBoundingBoxMax()

double ParticleContainerToBasisWrapper::getBoundingBoxMax ( int  dimension) const
inlineoverridevirtual

returns one coordinate of the higher corner of the bounding box

Parameters
dimensionthe coordinate which should be returned

Reimplemented from ParticleContainer.

◆ getBoundingBoxMin()

double ParticleContainerToBasisWrapper::getBoundingBoxMin ( int  dimension) const
inlineoverridevirtual

returns one coordinate of the lower corner of the bounding box

Parameters
dimensionthe coordinate which should be returned

Reimplemented from ParticleContainer.

◆ getCellLength()

double* ParticleContainerToBasisWrapper::getCellLength ( )
inlineoverridevirtual

Implements ParticleContainer.

◆ getConfigurationAsString()

string ParticleContainerToBasisWrapper::getConfigurationAsString ( )
inlineoverridevirtual

Return a string representation of the algorithmic configuration of the container. Only used for logging / output.

Note
: Formatting rules:
  • The whole configuration should be enclosed in curly brackets.
  • Different elements should be separated by a comma sourrounded by spaces: " , ".
  • Every element should be in the form "key: value"
Returns

Implements ParticleContainer.

◆ getCutoff()

double ParticleContainerToBasisWrapper::getCutoff ( ) const
inlineoverridevirtual

Implements ParticleContainer.

◆ getEnergy()

double ParticleContainerToBasisWrapper::getEnergy ( ParticlePairsHandler particlePairsHandler,
Molecule m1,
CellProcessor cellProcessor 
)
inlineoverridevirtual

Implements ParticleContainer.

◆ getMoleculeAtPosition()

std::variant<ParticleIterator, SingleCellIterator<ParticleCell> > ParticleContainerToBasisWrapper::getMoleculeAtPosition ( const double  pos[3])
inlineoverridevirtual

Gets a molecule by its position.

Parameters
posMolecule position
Returns
Iterator to the molecule. The iterator is invalid if no molecule was found.

Implements ParticleContainer.

◆ getName()

std::string ParticleContainerToBasisWrapper::getName ( )
inlineoverridevirtual

Implements MemoryProfilable.

◆ getNumberOfParticles()

unsigned long ParticleContainerToBasisWrapper::getNumberOfParticles ( )
inlineoverridevirtual
Returns
the number of particles stored in this container

This number may include particles which are outside of the bounding box

Implements ParticleContainer.

◆ getTotalSize()

size_t ParticleContainerToBasisWrapper::getTotalSize ( )
inlineoverridevirtual

Implements MemoryProfilable.

◆ initCubicGrid()

unsigned long ParticleContainerToBasisWrapper::initCubicGrid ( std::array< unsigned long, 3 >  numMoleculesPerDimension,
std::array< double, 3 >  simBoxLength,
size_t  seed_offset 
)
inlineoverridevirtual

Implements ParticleContainer.

◆ isInBoundingBox()

bool ParticleContainerToBasisWrapper::isInBoundingBox ( double  r[3]) const
inlineoverridevirtual

checks, whether given coordinates are within the bounding box

Parameters
rthe coordinates to check
Returns
true if coordinates within bounding box, false otherwise

Reimplemented from ParticleContainer.

◆ iterator()

ParticleIterator ParticleContainerToBasisWrapper::iterator ( ParticleIterator::Type  t)
inlineoverridevirtual

Implements ParticleContainer.

◆ printSubInfo()

void ParticleContainerToBasisWrapper::printSubInfo ( int  offset)
inlineoverridevirtual

Implements MemoryProfilable.

◆ readXML()

void ParticleContainerToBasisWrapper::readXML ( XMLfileUnits xmlconfig)
inlineoverridevirtual

Implements ParticleContainer.

◆ regionIterator()

RegionParticleIterator ParticleContainerToBasisWrapper::regionIterator ( const double  startCorner[3],
const double  endCorner[3],
ParticleIterator::Type  t 
)
inlineoverridevirtual

Implements ParticleContainer.

◆ traverseCells()

void ParticleContainerToBasisWrapper::traverseCells ( CellProcessor cellProcessor)
inlineoverridevirtual

traverse pairs which are close to each other

Only interactions between particles which have a distance which is not larger than the cutoff radius are to be considered.
This method has to be implemented in derived classes Precondition: All Particles of the process + halo molecules are stored Task: Run over all pairs (Each pair exactely once!) of particles (within cutoffradius) Important: Some pairs might be "duplicated": All pairs which cross the boundary occur twice (second time at the periodic image). Those pairs are from the point of view of the datastructure two different pairs, but they both times connect the same particles. For a pair which occurs twice, it has to be made sure, that one gets the status "original pair" and the other one "duplicated pair". For each pair found, there is an action executed, but it is a different action for original and duplicated pairs. Details about how to handle pairs can be found in the documentation for the class ParticlePairsHandler

Parameters
particlePairsHandlerspecified concrete action to be done for each pair

Implements ParticleContainer.

◆ traverseNonInnermostCells()

void ParticleContainerToBasisWrapper::traverseNonInnermostCells ( CellProcessor cellProcessor)
inlineoverridevirtual

Implements ParticleContainer.

◆ traversePartialInnermostCells()

void ParticleContainerToBasisWrapper::traversePartialInnermostCells ( CellProcessor cellProcessor,
unsigned int  stage,
int  stageCount 
)
inlineoverridevirtual

Implements ParticleContainer.

◆ update()

void ParticleContainerToBasisWrapper::update ( )
inlineoverridevirtual

do necessary updates resulting from changed particle positions

For some implementations of the interface ParticleContainer, the place where particles are stored might e.g. depend on the spacial position of the particle. So when some externel method (e.g. Leap-Frog) changes the spacial position of a particle, the representation within the particleContainer becomes invalid. This method restores a valid representation.

Implements ParticleContainer.

◆ updateBoundaryAndHaloMoleculeCaches()

void ParticleContainerToBasisWrapper::updateBoundaryAndHaloMoleculeCaches ( )
inlineoverridevirtual

Update the caches of the molecules, that lie in the boundary or halo cells. The caches of boundary and halo cells is updated, the caches of the inner cells are not updated. This method is used for a multi-step scheme of overlapping mpi communication.

Implements ParticleContainer.

◆ updateInnerMoleculeCaches()

void ParticleContainerToBasisWrapper::updateInnerMoleculeCaches ( )
inlineoverridevirtual

Update the caches of the molecules, that lie in inner cells. The caches of boundary and halo cells is not updated. This method is used for a multi-step scheme of overlapping mpi communication.

Implements ParticleContainer.

◆ updateMoleculeCaches()

void ParticleContainerToBasisWrapper::updateMoleculeCaches ( )
inlineoverridevirtual

Update the caches of the molecules.

Implements ParticleContainer.


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