ls1-MarDyn
ls1-MarDyn molecular dynamics code
Public Member Functions | List of all members
AutoPasContainer Class Reference

#include <AutoPasContainer.h>

Inheritance diagram for AutoPasContainer:
ParticleContainer MemoryProfilable

Public Member Functions

 AutoPasContainer (double cutoff)
 
void readXML (XMLfileUnits &xmlconfig) override
 
bool rebuild (double bBoxMin[3], double bBoxMax[3]) override
 rebuild the datastructure More...
 
void update () override
 do necessary updates resulting from changed particle positions More...
 
bool addParticle (Molecule &particle, bool inBoxCheckedAlready=false, bool checkWhetherDuplicate=false, const bool &rebuildCaches=false) override
 add a single Molecule to the ParticleContainer. More...
 
bool addHaloParticle (Molecule &particle, bool inBoxCheckedAlready=false, bool checkWhetherDuplicate=false, const bool &rebuildCaches=false) override
 add a single Molecule to the ParticleContainer, ensures that it is added in the halo. 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
 
unsigned long getNumberOfParticles () override
 
void clear () override
 Delete all molecules in container. More...
 
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
 
double getSkin () 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
 
double * getCellLength () override
 
double * getHaloSize () override
 
size_t getTotalSize () override
 
void printSubInfo (int offset) override
 
std::string getName () override
 
void setCutoff (double cutoff) override
 
std::vector< MoleculegetInvalidParticles () override
 
bool isInvalidParticleReturner () override
 
std::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 double getBoundingBoxMin (int dimension) const
 returns one coordinate of the lower corner of the bounding box More...
 
virtual bool isInBoundingBox (double r[3]) const
 checks, whether given coordinates are within the bounding box More...
 
virtual int getHaloWidthNumCells ()
 
virtual double getBoundingBoxMax (int dimension) const
 returns one coordinate of the higher corner of the bounding box More...
 
virtual bool requiresForceExchange () const
 
virtual std::vector< unsigned long > getParticleCellStatistics ()
 

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

A wrapper for the AutoPas library.

Member Function Documentation

◆ addHaloParticle()

bool AutoPasContainer::addHaloParticle ( Molecule particle,
bool  inBoxCheckedAlready = false,
bool  checkWhetherDuplicate = false,
const bool &  rebuildCaches = false 
)
overridevirtual

add a single Molecule to the ParticleContainer, ensures that it is added in the halo.

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

Reimplemented from ParticleContainer.

◆ addParticle()

bool AutoPasContainer::addParticle ( Molecule particle,
bool  inBoxCheckedAlready = false,
bool  checkWhetherDuplicate = false,
const bool &  rebuildCaches = false 
)
overridevirtual

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 AutoPasContainer::addParticles ( std::vector< Molecule > &  particles,
bool  checkWhetherDuplicate = false 
)
overridevirtual

adds a whole vector of particles

Parameters
particlesreference to a vector of pointers to particles

Implements ParticleContainer.

◆ clear()

void AutoPasContainer::clear ( )
overridevirtual

Delete all molecules in container.

Implements ParticleContainer.

◆ deleteMolecule()

void AutoPasContainer::deleteMolecule ( ParticleIterator moleculeIter,
const bool &  rebuildCaches 
)
overridevirtual

Implements ParticleContainer.

◆ deleteOuterParticles()

void AutoPasContainer::deleteOuterParticles ( )
overridevirtual

delete all Particles which are not within the bounding box

Implements ParticleContainer.

◆ get_halo_L()

double AutoPasContainer::get_halo_L ( int  index) const
overridevirtual

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.

◆ getCellLength()

double * AutoPasContainer::getCellLength ( )
overridevirtual

Implements ParticleContainer.

◆ getConfigurationAsString()

std::string AutoPasContainer::getConfigurationAsString ( )
overridevirtual

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 AutoPasContainer::getCutoff ( ) const
overridevirtual

Implements ParticleContainer.

◆ getEnergy()

double AutoPasContainer::getEnergy ( ParticlePairsHandler particlePairsHandler,
Molecule m1,
CellProcessor cellProcessor 
)
overridevirtual

Implements ParticleContainer.

◆ getHaloSize()

double * AutoPasContainer::getHaloSize ( )
overridevirtual

Return the size of the halo

Returns

Reimplemented from ParticleContainer.

◆ getInvalidParticles()

std::vector<Molecule> AutoPasContainer::getInvalidParticles ( )
inlineoverridevirtual

Reimplemented from ParticleContainer.

◆ getMoleculeAtPosition()

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

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 AutoPasContainer::getName ( )
inlineoverridevirtual

Implements MemoryProfilable.

◆ getNumberOfParticles()

unsigned long AutoPasContainer::getNumberOfParticles ( )
overridevirtual
Returns
the number of particles stored in this container

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

Implements ParticleContainer.

◆ getSkin()

double AutoPasContainer::getSkin ( ) const
overridevirtual

Reimplemented from ParticleContainer.

◆ getTotalSize()

size_t AutoPasContainer::getTotalSize ( )
inlineoverridevirtual

Implements MemoryProfilable.

◆ initCubicGrid()

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

Implements ParticleContainer.

◆ isInvalidParticleReturner()

bool AutoPasContainer::isInvalidParticleReturner ( )
inlineoverridevirtual

Reimplemented from ParticleContainer.

◆ iterator()

ParticleIterator AutoPasContainer::iterator ( ParticleIterator::Type  t)
overridevirtual

Implements ParticleContainer.

◆ printSubInfo()

void AutoPasContainer::printSubInfo ( int  offset)
inlineoverridevirtual

Implements MemoryProfilable.

◆ readXML()

void AutoPasContainer::readXML ( XMLfileUnits xmlconfig)
overridevirtual

This function parses parameters for the AutoPas container. The following xml object structure is handled by this method:

<datastructure type="AutoPas">
<allowedTraversals>STRINGLIST</allowedTraversals>
<allowedContainers>STRINGLIST</allowedContainers>
<selectorStrategy>STRING</selectorStrategy>
<tuningStrategy>STRING</tuningStrategy>
<extrapolationMethod>STRING</extrapolationMethod>
<dataLayouts>STRINGLIST</dataLayouts>
<newton3>STRINGLIST</newton3>
<tuningAcquisitionFunction>STRING</tuningAcquisitionFunction>
<maxEvidence>INTEGER</maxEvidence>
<tuningPhasesWithoutTest>INTEGER</tuningPhasesWithoutTest>
<evidenceForPrediction>INTEGER</evidenceForPrediction>
<tuningSamples>INTEGER</tuningSamples>
<tuningInterval>INTEGER</tuningInterval>
<rebuildFrequency>INTEGER</rebuildFrequency>
<skin>DOUBLE</skin>
<optimumRange>DOUBLE</optimumRange>
<blacklistRange>DOUBLE</blacklistRange>
<useAVXFunctor>BOOL</useAVXFunctor>
<verletClusterSize>INTEGER</verletClusterSize>
</datastructure>

If you are using MPI-parallel simulations, tuningSamples should be a multiple of rebuildFrequency! A list of the different Options can be found here: https://www5.in.tum.de/AutoPas/doxygen_doc/master/namespaceautopas_1_1options.html For multiple options, a comma separated list of strings is possible. Auto-Tuning is then performed on all possible combinations of those.

Parameters
xmlconfig

Implements ParticleContainer.

◆ rebuild()

bool AutoPasContainer::rebuild ( double  bBoxMin[3],
double  bBoxMax[3] 
)
overridevirtual

rebuild the datastructure

Load-balancing decompositions change the position and size of the local region during runtime. Therefore, the datastructure needs to be rebuild completely. This method basically does what the constructor does as well, with the difference, that there are already particles stored, and particles which don't belong to the new region have to be deleted after rebuild @parameter bBoxMin minimum of the box @parameter bBoxMax maximum of the box

Todo:
return sendHaloAndLeavingTogether, (always false) for simplicity.

Reimplemented from ParticleContainer.

◆ regionIterator()

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

Implements ParticleContainer.

◆ setCutoff()

void AutoPasContainer::setCutoff ( double  rc)
inlineoverridevirtual

set the cutoff

Parameters
rc

Reimplemented from ParticleContainer.

◆ traverseCells()

void AutoPasContainer::traverseCells ( CellProcessor cellProcessor)
overridevirtual

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 AutoPasContainer::traverseNonInnermostCells ( CellProcessor cellProcessor)
overridevirtual

Implements ParticleContainer.

◆ traversePartialInnermostCells()

void AutoPasContainer::traversePartialInnermostCells ( CellProcessor cellProcessor,
unsigned int  stage,
int  stageCount 
)
overridevirtual

Implements ParticleContainer.

◆ update()

void AutoPasContainer::update ( )
overridevirtual

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 AutoPasContainer::updateBoundaryAndHaloMoleculeCaches ( )
overridevirtual

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 AutoPasContainer::updateInnerMoleculeCaches ( )
overridevirtual

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 AutoPasContainer::updateMoleculeCaches ( )
overridevirtual

Update the caches of the molecules.

Implements ParticleContainer.


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