AutoPas  3.0.0
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | List of all members
autopas::VerletClusterLists< Particle_T > Class Template Reference

Particles are divided into clusters. More...

#include <VerletClusterLists.h>

Inheritance diagram for autopas::VerletClusterLists< Particle_T >:
Inheritance graph
[legend]
Collaboration diagram for autopas::VerletClusterLists< Particle_T >:
Collaboration graph
[legend]

Classes

struct  ClusterRange
 Defines a cluster range used in the static cluster-thread-partition. More...
 

Public Member Functions

 VerletClusterLists (const std::array< double, 3 > &boxMin, const std::array< double, 3 > &boxMax, double cutoff, double skin, unsigned int rebuildFrequency, size_t clusterSize, LoadEstimatorOption loadEstimator=LoadEstimatorOption::none)
 Constructor of the VerletClusterLists class.
 
CellType getParticleCellTypeEnum () const override
 Get the ParticleCell type as an Enum.
 
ContainerOption getContainerType () const override
 Get the ContainerType.
 
BalancedTraversal::EstimatorFunction getLoadEstimatorFunction ()
 Generates the load estimation function depending on _loadEstimator.
 
void computeInteractions (TraversalInterface *traversal) override
 Iterates over all particle multiples (e.g.
 
void reserve (size_t numParticles, size_t numParticlesHaloEstimate) override
 Reserve memory for a given number of particles in the container and logic layers.
 
void addParticleImpl (const Particle_T &p) override
 Adds the given particle to the container.
 
void addHaloParticleImpl (const Particle_T &haloParticle) override
 Adds a particle to the container that lies in the halo region of the container.
 
bool updateHaloParticle (const Particle_T &haloParticle) override
 Update a halo particle of the container with the given haloParticle.
 
void deleteHaloParticles () override
 Deletes all halo particles.
 
std::tuple< const Particle_T *, size_t, size_t > getParticle (size_t cellIndex, size_t particleIndex, IteratorBehavior iteratorBehavior, const std::array< double, 3 > &boxMin, const std::array< double, 3 > &boxMax) const override
 Fetch the pointer to a particle, identified via a cell and particle index.
 
std::tuple< const Particle_T *, size_t, size_t > getParticle (size_t cellIndex, size_t particleIndex, IteratorBehavior iteratorBehavior) const override
 Fetch the pointer to a particle, identified via a cell and particle index.
 
template<bool regionIter>
std::tuple< const Particle_T *, size_t, size_t > getParticleImpl (size_t cellIndex, size_t particleIndex, IteratorBehavior iteratorBehavior, const std::array< double, 3 > &boxMin, const std::array< double, 3 > &boxMax) const
 Container specific implementation for getParticle.
 
bool deleteParticle (Particle_T &particle) override
 Deletes the given particle as long as this does not compromise the validity of the container.
 
bool deleteParticle (size_t cellIndex, size_t particleIndex) override
 Deletes the particle at the given index positions as long as this does not compromise the validity of the container.
 
std::vector< Particle_T > updateContainer (bool keepNeighborListsValid) override
 Updates the container.
 
TraversalSelectorInfo getTraversalSelectorInfo () const override
 Generates a traversal selector info for this container.
 
ContainerIterator< Particle_T, true, false > begin (IteratorBehavior behavior=autopas::IteratorBehavior::ownedOrHalo, typename ContainerIterator< Particle_T, true, false >::ParticleVecType *additionalVectors=nullptr) override
 Iterate over all particles using for(auto iter = container.begin(); iter.isValid(); ++iter) .
 
ContainerIterator< Particle_T, false, false > begin (IteratorBehavior behavior=autopas::IteratorBehavior::ownedOrHalo, typename ContainerIterator< Particle_T, false, false >::ParticleVecType *additionalVectors=nullptr) const override
 Iterate over all particles using for(auto iter = container.begin(); iter.isValid(); ++iter) .
 
template<typename Lambda >
void forEach (Lambda forEachLambda, IteratorBehavior behavior=autopas::IteratorBehavior::ownedOrHalo)
 Execute code on all particles in this container as defined by a lambda function.
 
template<typename Lambda >
void forEach (Lambda forEachLambda, IteratorBehavior behavior=autopas::IteratorBehavior::ownedOrHalo) const
 Execute code on all particles in this container as defined by a lambda function.
 
template<typename Lambda , typename A >
void reduce (Lambda reduceLambda, A &result, IteratorBehavior behavior=autopas::IteratorBehavior::ownedOrHalo)
 Reduce properties of particles as defined by a lambda function.
 
template<typename Lambda , typename A >
void reduce (Lambda reduceLambda, A &result, IteratorBehavior behavior=autopas::IteratorBehavior::ownedOrHalo) const
 Reduce properties of particles as defined by a lambda function.
 
ContainerIterator< Particle_T, true, true > getRegionIterator (const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior, typename ContainerIterator< Particle_T, true, true >::ParticleVecType *additionalVectors=nullptr) override
 Iterate over all particles in a specified region for(auto iter = container.getRegionIterator(lowCorner, highCorner);iter.isValid();++iter) .
 
ContainerIterator< Particle_T, false, true > getRegionIterator (const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior, typename ContainerIterator< Particle_T, false, true >::ParticleVecType *additionalVectors=nullptr) const override
 Iterate over all particles in a specified region for(auto iter = container.getRegionIterator(lowCorner, highCorner);iter.isValid();++iter) .
 
template<typename Lambda >
void forEachInRegion (Lambda forEachLambda, const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior=autopas::IteratorBehavior::ownedOrHalo)
 Execute code on all particles in this container in a certain region as defined by a lambda function.
 
template<typename Lambda >
void forEachInRegion (Lambda forEachLambda, const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior=autopas::IteratorBehavior::ownedOrHalo) const
 Execute code on all particles in this container in a certain region as defined by a lambda function.
 
template<typename Lambda , typename A >
void reduceInRegion (Lambda reduceLambda, A &result, const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior=autopas::IteratorBehavior::ownedOrHalo)
 Execute code on all particles in this container in a certain region as defined by a lambda function.
 
template<typename Lambda , typename A >
void reduceInRegion (Lambda reduceLambda, A &result, const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior=autopas::IteratorBehavior::ownedOrHalo) const
 Execute code on all particles in this container in a certain region as defined by a lambda function.
 
void rebuildNeighborLists (TraversalInterface *traversal) override
 Rebuilds the neighbor lists for the next traversals.
 
template<bool inParallel, class LoopBody >
void traverseClusters (LoopBody &&loopBody)
 Helper method to iterate over all clusters.
 
size_t size () const override
 Get the number of all particles stored in this container (owned + halo + dummy).
 
size_t getNumberOfParticles (IteratorBehavior behavior) const override
 Get the number of particles with respect to the specified IteratorBehavior.
 
const auto & getClusterThreadPartition () const
 Returns the cluster-thread-partition.
 
auto getNumClusters () const
 Returns the number of clusters in this container.
 
auto getTowerSideLength () const
 Returns the grid side length of the grids in the container.
 
auto getTowersPerDimension () const
 Returns the number of grids per dimension on the container.
 
auto getClusterSize () const
 Returns the number of particles in each cluster.
 
auto getNumTowersPerInteractionLength () const
 Returns the towers per interaction length.
 
template<class Functor >
void loadParticlesIntoSoAs (Functor *functor)
 Loads all particles of the container in their correct SoA and generates the SoAViews for the clusters.
 
template<class Functor >
void extractParticlesFromSoAs (Functor *functor)
 Extracts all SoAs of the container into the particles.
 
internal::ClusterTower< Particle_T > & getTowerByIndex (size_t x, size_t y)
 Returns a reference to the tower for the given tower grid coordinates.
 
internal::ClusterTowerBlock2D< Particle_T > & getTowerBlock ()
 Getter for the cell block.
 
const std::array< double, 3 > & getBoxMax () const override
 Get the upper corner of the container without halo.
 
const std::array< double, 3 > & getHaloBoxMax () const
 Get the upper corner of the halo box.
 
const std::array< double, 3 > & getBoxMin () const override
 Get the lower corner of the container without halo.
 
const std::array< double, 3 > & getHaloBoxMin () const
 Get the lower corner of the halo box.
 
double getCutoff () const override
 Return the cutoff of the container.
 
void setCutoff (double cutoff) override
 Set the cutoff of the container.
 
double getVerletSkin () const override
 Return the verletSkin of the container verletSkin.
 
void setSkin (double skin)
 Set the verlet skin length for the container.
 
unsigned int getRebuildFrequency ()
 Get the rebuild Frequency value for the container.
 
void setRebuildFrequency (unsigned int rebuildFrequency)
 Set the rebuild Frequency value for the container.
 
double getInteractionLength () const override
 Return the interaction length (cutoff+skin) of the container.
 
void deleteAllParticles () override
 Deletes all particles.
 
const internal::VerletClusterListsRebuilder< Particle_T >::NeighborListsBuffer_T & getNeighborLists () const
 Get the neighbor lists buffer object.
 
void rebuildTowersAndClusters (bool newton3)
 Initializes a new VerletClusterListsRebuilder and uses it to rebuild the towers and the clusters.
 
template<class LoopBody >
void traverseClustersSequential (LoopBody &&loopBody)
 Helper method to sequentially iterate over all owned clusters.
 
template<class LoopBody >
void traverseClustersParallel (LoopBody &&loopBody)
 Helper method to iterate over all clusters in parallel.
 
- Public Member Functions inherited from autopas::ParticleContainerInterface< Particle_T >
virtual CellType getParticleCellTypeEnum () const =0
 Get the ParticleCell type as an Enum.
 
 ParticleContainerInterface (double skin)
 Constructor.
 
virtual ~ParticleContainerInterface ()=default
 Destructor of ParticleContainerInterface.
 
 ParticleContainerInterface (const ParticleContainerInterface &obj)=delete
 Delete the copy constructor to prevent unwanted copies.
 
ParticleContainerInterfaceoperator= (const ParticleContainerInterface &other)=delete
 Delete the copy assignment operator to prevent unwanted copies.
 
virtual ContainerOption getContainerType () const =0
 Get the ContainerType.
 
virtual void reserve (size_t numParticles, size_t numParticlesHaloEstimate)=0
 Reserve memory for a given number of particles in the container and logic layers.
 
template<bool checkInBox = true>
void addParticle (const Particle_T &p)
 Adds a particle to the container.
 
template<bool checkInBox = true>
void addHaloParticle (const Particle_T &haloParticle)
 Adds a particle to the container that lies in the halo region of the container.
 
virtual bool updateHaloParticle (const Particle_T &haloParticle)=0
 Update a halo particle of the container with the given haloParticle.
 
virtual void rebuildNeighborLists (TraversalInterface *traversal)=0
 Rebuilds the neighbor lists for the next traversals.
 
virtual void deleteHaloParticles ()=0
 Deletes all halo particles.
 
virtual void deleteAllParticles ()=0
 Deletes all particles.
 
virtual size_t getNumberOfParticles (IteratorBehavior behavior=IteratorBehavior::owned) const =0
 Get the number of particles with respect to the specified IteratorBehavior.
 
virtual size_t size () const =0
 Get the total number of particles saved in the container (owned + halo + dummy).
 
virtual ContainerIterator< ParticleType, true, false > begin (IteratorBehavior behavior=autopas::IteratorBehavior::ownedOrHalo, typename ContainerIterator< ParticleType, true, false >::ParticleVecType *additionalVectors=nullptr)=0
 Iterate over all particles using for(auto iter = container.begin(); iter.isValid(); ++iter) .
 
virtual ContainerIterator< ParticleType, false, false > begin (IteratorBehavior behavior=autopas::IteratorBehavior::ownedOrHalo, typename ContainerIterator< ParticleType, false, false >::ParticleVecType *additionalVectors=nullptr) const =0
 Iterate over all particles using for(auto iter = container.begin(); iter.isValid(); ++iter) .
 
virtual ContainerIterator< ParticleType, false, false > cbegin (IteratorBehavior behavior=autopas::IteratorBehavior::ownedOrHalo, typename ContainerIterator< ParticleType, false, false >::ParticleVecType *additionalVectors=nullptr) const final
 Iterate over all particles using for(auto iter = container.begin(); iter.isValid(); ++iter) .
 
virtual ContainerIterator< ParticleType, true, true > getRegionIterator (const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior, typename ContainerIterator< ParticleType, true, true >::ParticleVecType *additionalVectors=nullptr)=0
 Iterate over all particles in a specified region for(auto iter = container.getRegionIterator(lowCorner, highCorner);iter.isValid();++iter) .
 
virtual ContainerIterator< ParticleType, false, true > getRegionIterator (const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner, IteratorBehavior behavior, typename ContainerIterator< ParticleType, false, true >::ParticleVecType *additionalVectors=nullptr) const =0
 Iterate over all particles in a specified region for(auto iter = container.getRegionIterator(lowCorner, highCorner);iter.isValid();++iter) .
 
constexpr bool end () const
 Dummy to make range-based for loops work.
 
virtual void computeInteractions (TraversalInterface *traversal)=0
 Iterates over all particle multiples (e.g.
 
virtual const std::array< double, 3 > & getBoxMax () const =0
 Get the upper corner of the container without halo.
 
virtual const std::array< double, 3 > & getBoxMin () const =0
 Get the lower corner of the container without halo.
 
virtual double getCutoff () const =0
 Return the cutoff of the container.
 
virtual void setCutoff (double cutoff)=0
 Set the cutoff of the container.
 
virtual double getVerletSkin () const =0
 Return the verletSkin of the container verletSkin.
 
virtual size_t getStepsSinceLastRebuild () const
 Return the number of time-steps since last neighbor list rebuild.
 
virtual void setStepsSinceLastRebuild (size_t stepsSinceLastRebuild)
 Set the number of time-steps since last neighbor list rebuild.
 
virtual double getInteractionLength () const =0
 Return the interaction length (cutoff+skin) of the container.
 
virtual std::vector< ParticleTypeupdateContainer (bool keepNeighborListsValid)=0
 Updates the container.
 
virtual TraversalSelectorInfo getTraversalSelectorInfo () const =0
 Generates a traversal selector info for this container.
 
std::set< TraversalOption > getAllTraversals (const InteractionTypeOption interactionType) const
 Generates a list of all traversals that are theoretically applicable to this container.
 
virtual std::tuple< const Particle_T *, size_t, size_t > getParticle (size_t cellIndex, size_t particleIndex, IteratorBehavior iteratorBehavior) const =0
 Fetch the pointer to a particle, identified via a cell and particle index.
 
virtual std::tuple< const Particle_T *, size_t, size_t > getParticle (size_t cellIndex, size_t particleIndex, IteratorBehavior iteratorBehavior, const std::array< double, 3 > &boxMin, const std::array< double, 3 > &boxMax) const =0
 Fetch the pointer to a particle, identified via a cell and particle index.
 
std::tuple< Particle_T *, size_t, size_t > getParticle (size_t cellIndex, size_t particleIndex, IteratorBehavior iteratorBehavior, const std::array< double, 3 > &boxMin, const std::array< double, 3 > &boxMax)
 Fetch the pointer to a particle, identified via a cell and particle index.
 
std::tuple< Particle_T *, size_t, size_t > getParticle (size_t cellIndex, size_t particleIndex, IteratorBehavior iteratorBehavior)
 Fetch the pointer to a particle, identified via a cell and particle index.
 
virtual bool deleteParticle (Particle_T &particle)=0
 Deletes the given particle as long as this does not compromise the validity of the container.
 
virtual bool deleteParticle (size_t cellIndex, size_t particleIndex)=0
 Deletes the particle at the given index positions as long as this does not compromise the validity of the container.
 
virtual void notifyParticleDeleted ()=0
 This function is called when a particle is deleted.
 

Protected Member Functions

void calculateClusterThreadPartition ()
 Calculates a cluster thread partition that aims to give each thread about the same amount of cluster pair interactions, if each thread handles the neighbors of all clusters it gets assigned.
 
void fillClusterRanges (size_t numClusterPairsPerThread, int numThreads)
 Fills in the cluster ranges of the cluster thread partition.
 
void notifyParticleDeleted () override
 If a particle is deleted, we want _isValid to be set to invalid, as the tower structure is invalidated.
 
virtual void addParticleImpl (const Particle_T &p)=0
 Adds a particle to the container.
 
virtual void addHaloParticleImpl (const Particle_T &haloParticle)=0
 Adds a particle to the container that lies in the halo region of the container.
 

Additional Inherited Members

- Public Types inherited from autopas::ParticleContainerInterface< Particle_T >
using ParticleType = Particle_T
 Type of the Particle.
 
- Protected Attributes inherited from autopas::ParticleContainerInterface< Particle_T >
size_t _stepsSinceLastRebuild {0}
 Stores the number of time-steps since last neighbor list rebuild.
 
double _skin
 Skin distance a particle is allowed to move in one time-step.
 

Detailed Description

template<class Particle_T>
class autopas::VerletClusterLists< Particle_T >

Particles are divided into clusters.

The VerletClusterLists class uses neighborhood lists for each cluster to calculate pairwise interactions of particles. It is optimized for a constant, i.e. particle independent, cutoff radius of the interaction.

This Container does (currently?) not make use of the cellSizeFactor.

The _particlesToAdd buffer structure is (currently) still necessary, even if the LogicHandler basically holds the same buffer structure. In principle, moving the particles directly into one of the towers would be possible, since particles are moved from LogicHandler to VCL only in a rebuild iteration. However, storing the particles in a tower (e.g. tower0) is only possible very inefficiently, since several threads would write to this buffer at the same time. Even if we could add the particles to tower0 efficiently, there are still problems in getRegionIterator(), because this function is executed between the addition of particles and the actual rebuild. getRegionIterator() expects that all particles are already sorted correctly into the towers (if we do not use _particlesToAdd).

Note
See VerletClusterListsRebuilder for the layout of the towers and clusters.
Template Parameters
Particle_T

Constructor & Destructor Documentation

◆ VerletClusterLists()

template<class Particle_T >
autopas::VerletClusterLists< Particle_T >::VerletClusterLists ( const std::array< double, 3 > &  boxMin,
const std::array< double, 3 > &  boxMax,
double  cutoff,
double  skin,
unsigned int  rebuildFrequency,
size_t  clusterSize,
LoadEstimatorOption  loadEstimator = LoadEstimatorOption::none 
)
inline

Constructor of the VerletClusterLists class.

The neighbor lists are build using a estimated density. The box is divided into cuboids with roughly the same side length.

Parameters
boxMinThe lower corner of the domain.
boxMaxThe upper corner of the domain.
cutoffThe cutoff radius of the interaction.
skinThe skin radius.
rebuildFrequencyThe rebuild Frequency.
clusterSizeNumber of particles per cluster.
loadEstimatorload estimation algorithm for balanced traversals.

Member Function Documentation

◆ addHaloParticleImpl()

template<class Particle_T >
void autopas::VerletClusterLists< Particle_T >::addHaloParticleImpl ( const Particle_T &  haloParticle)
inlineoverridevirtual

Adds a particle to the container that lies in the halo region of the container.

This is an unsafe version of addParticle() and does not perform a boundary check.

Parameters
haloParticleParticle to be added. This particle is already checked to be outside of the bounding box.
Note
Only call this function if the position of the particle is guaranteed to be outside of the bounding box!

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ addParticleImpl()

template<class Particle_T >
void autopas::VerletClusterLists< Particle_T >::addParticleImpl ( const Particle_T &  p)
inlineoverridevirtual

Adds the given particle to the container.

rebuildTowersAndClusters() has to be called to have it actually sorted in.

Parameters
pThe particle to add.

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ begin() [1/2]

template<class Particle_T >
ContainerIterator< Particle_T, false, false > autopas::VerletClusterLists< Particle_T >::begin ( IteratorBehavior  behavior = autopas::IteratorBehavior::ownedOrHalo,
typename ContainerIterator< Particle_T, false, false >::ParticleVecType *  additionalVectors = nullptr 
) const
inlineoverridevirtual

Iterate over all particles using for(auto iter = container.begin(); iter.isValid(); ++iter) .

Note
The default argument for behavior is necessary to enable range based for loops.
Parameters
behaviorBehavior of the iterator, see IteratorBehavior.
additionalVectorsVectors that should be included besides the container.
Returns
Iterator to the first particle.
Note
const version.

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ begin() [2/2]

template<class Particle_T >
ContainerIterator< Particle_T, true, false > autopas::VerletClusterLists< Particle_T >::begin ( IteratorBehavior  behavior = autopas::IteratorBehavior::ownedOrHalo,
typename ContainerIterator< Particle_T, true, false >::ParticleVecType *  additionalVectors = nullptr 
)
inlineoverridevirtual

Iterate over all particles using for(auto iter = container.begin(); iter.isValid(); ++iter) .

Note
The default argument for behavior is necessary to enable range based for loops.
Parameters
behaviorBehavior of the iterator, see IteratorBehavior.
additionalVectorsVectors that should be included besides the container.
Returns
Iterator to the first particle.

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ computeInteractions()

template<class Particle_T >
void autopas::VerletClusterLists< Particle_T >::computeInteractions ( TraversalInterface traversal)
inlineoverridevirtual

Iterates over all particle multiples (e.g.

pairs, triplets) in the container using the given traversal.

Parameters
traversalThe traversal to use for the iteration.

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ deleteAllParticles()

template<class Particle_T >
void autopas::VerletClusterLists< Particle_T >::deleteAllParticles ( )
inlineoverridevirtual

Deletes all particles.

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ deleteHaloParticles()

template<class Particle_T >
void autopas::VerletClusterLists< Particle_T >::deleteHaloParticles ( )
inlineoverridevirtual

Deletes all halo particles.

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ deleteParticle() [1/2]

template<class Particle_T >
bool autopas::VerletClusterLists< Particle_T >::deleteParticle ( Particle_T &  particle)
inlineoverridevirtual

Deletes the given particle as long as this does not compromise the validity of the container.

If this is not possible the particle is just marked as deleted.

Note
This function might be implemented via swap-delete and is thus not completely thread safe.
Parameters
particleReference to the particle that is to be deleted.
Returns
True if the given pointer still points to a new particle.

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ deleteParticle() [2/2]

template<class Particle_T >
bool autopas::VerletClusterLists< Particle_T >::deleteParticle ( size_t  cellIndex,
size_t  particleIndex 
)
inlineoverridevirtual

Deletes the particle at the given index positions as long as this does not compromise the validity of the container.

If this is not possible the particle is just marked as deleted. If the positions do not exist the behavior is undefined.

Parameters
cellIndex
particleIndex
Returns
True if the given indices still point to a new particle.

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ extractParticlesFromSoAs()

template<class Particle_T >
template<class Functor >
void autopas::VerletClusterLists< Particle_T >::extractParticlesFromSoAs ( Functor functor)
inline

Extracts all SoAs of the container into the particles.

Template Parameters
FunctorThe type of the functor to use.
Parameters
functorThe functor to use for extracting the SoAs into the particles..
Todo:
: find sensible chunksize

◆ fillClusterRanges()

template<class Particle_T >
void autopas::VerletClusterLists< Particle_T >::fillClusterRanges ( size_t  numClusterPairsPerThread,
int  numThreads 
)
inlineprotected

Fills in the cluster ranges of the cluster thread partition.

It aims to assign each thread appropriately the same number of cluster pairs.

Parameters
numClusterPairsPerThreadThe approximate number of cluster pairs per thread.
numThreadsThe number of threads to use.

◆ forEach() [1/2]

template<class Particle_T >
template<typename Lambda >
void autopas::VerletClusterLists< Particle_T >::forEach ( Lambda  forEachLambda,
IteratorBehavior  behavior = autopas::IteratorBehavior::ownedOrHalo 
)
inline

Execute code on all particles in this container as defined by a lambda function.

Template Parameters
Lambda(Particle_T &p) -> void
Parameters
forEachLambdacode to be executed on all particles
behavior
See also
IteratorBehavior

◆ forEach() [2/2]

template<class Particle_T >
template<typename Lambda >
void autopas::VerletClusterLists< Particle_T >::forEach ( Lambda  forEachLambda,
IteratorBehavior  behavior = autopas::IteratorBehavior::ownedOrHalo 
) const
inline

Execute code on all particles in this container as defined by a lambda function.

Template Parameters
Lambda(Particle_T &p) -> void
Parameters
forEachLambdacode to be executed on all particles
behavior
See also
IteratorBehavior
Note
const version.
This function additionally iterates over the _particlesToAdd vector if the tower-structure isn't valid.

◆ forEachInRegion() [1/2]

template<class Particle_T >
template<typename Lambda >
void autopas::VerletClusterLists< Particle_T >::forEachInRegion ( Lambda  forEachLambda,
const std::array< double, 3 > &  lowerCorner,
const std::array< double, 3 > &  higherCorner,
IteratorBehavior  behavior = autopas::IteratorBehavior::ownedOrHalo 
)
inline

Execute code on all particles in this container in a certain region as defined by a lambda function.

Template Parameters
Lambda(Particle_T &p) -> void
Parameters
forEachLambdacode to be executed on all particles
lowerCornerlower corner of bounding box
higherCornerhigher corner of bounding box
behavior
See also
IteratorBehavior

◆ forEachInRegion() [2/2]

template<class Particle_T >
template<typename Lambda >
void autopas::VerletClusterLists< Particle_T >::forEachInRegion ( Lambda  forEachLambda,
const std::array< double, 3 > &  lowerCorner,
const std::array< double, 3 > &  higherCorner,
IteratorBehavior  behavior = autopas::IteratorBehavior::ownedOrHalo 
) const
inline

Execute code on all particles in this container in a certain region as defined by a lambda function.

Template Parameters
Lambda(Particle_T &p) -> void
Parameters
forEachLambdacode to be executed on all particles
lowerCornerlower corner of bounding box
higherCornerhigher corner of bounding box
behavior
See also
IteratorBehavior
Note
const version.
This function additionally iterates over the _particlesToAdd vector if the tower-structure isn't valid.

◆ getBoxMax()

template<class Particle_T >
const std::array< double, 3 > & autopas::VerletClusterLists< Particle_T >::getBoxMax ( ) const
inlineoverridevirtual

Get the upper corner of the container without halo.

Returns
Upper corner of the container.

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ getBoxMin()

template<class Particle_T >
const std::array< double, 3 > & autopas::VerletClusterLists< Particle_T >::getBoxMin ( ) const
inlineoverridevirtual

Get the lower corner of the container without halo.

Returns
Lower corner of the container.

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ getClusterSize()

template<class Particle_T >
auto autopas::VerletClusterLists< Particle_T >::getClusterSize ( ) const
inline

Returns the number of particles in each cluster.

Returns
the number of particles in each cluster.

◆ getClusterThreadPartition()

template<class Particle_T >
const auto & autopas::VerletClusterLists< Particle_T >::getClusterThreadPartition ( ) const
inline

Returns the cluster-thread-partition.

Returns
The cluster-thread-partition.

◆ getContainerType()

template<class Particle_T >
ContainerOption autopas::VerletClusterLists< Particle_T >::getContainerType ( ) const
inlineoverridevirtual

Get the ContainerType.

Returns
ContainerOption of the type of this container.

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ getCutoff()

template<class Particle_T >
double autopas::VerletClusterLists< Particle_T >::getCutoff ( ) const
inlineoverridevirtual

Return the cutoff of the container.

Returns
Cutoff radius.

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ getHaloBoxMax()

template<class Particle_T >
const std::array< double, 3 > & autopas::VerletClusterLists< Particle_T >::getHaloBoxMax ( ) const
inline

Get the upper corner of the halo box.

Returns
the upper corner of the halo box.

◆ getHaloBoxMin()

template<class Particle_T >
const std::array< double, 3 > & autopas::VerletClusterLists< Particle_T >::getHaloBoxMin ( ) const
inline

Get the lower corner of the halo box.

Returns
the lower corner of the halo box.

◆ getInteractionLength()

template<class Particle_T >
double autopas::VerletClusterLists< Particle_T >::getInteractionLength ( ) const
inlineoverridevirtual

Return the interaction length (cutoff+skin) of the container.

Returns
interaction length

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ getLoadEstimatorFunction()

template<class Particle_T >
BalancedTraversal::EstimatorFunction autopas::VerletClusterLists< Particle_T >::getLoadEstimatorFunction ( )
inline

Generates the load estimation function depending on _loadEstimator.

Returns
load estimator function object.

◆ getNeighborLists()

template<class Particle_T >
const internal::VerletClusterListsRebuilder< Particle_T >::NeighborListsBuffer_T & autopas::VerletClusterLists< Particle_T >::getNeighborLists ( ) const
inline

Get the neighbor lists buffer object.

Returns

◆ getNumberOfParticles()

template<class Particle_T >
size_t autopas::VerletClusterLists< Particle_T >::getNumberOfParticles ( IteratorBehavior  behavior) const
inlineoverridevirtual

Get the number of particles with respect to the specified IteratorBehavior.

Warning
: Since this function counts the number of the respective particles in the internal particle storage, this is in O(n) + lock is required. Only use it when it is absolutely necessary to have the exact number of different particle types like owned or halo. If it is enough to have the whole number of particles (owned + halo + dummy), the function size() can be used.
Parameters
behaviorBehavior of the iterator, see IteratorBehavior.
Returns
The number of particles with respect to the specified IteratorBehavior.

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ getNumClusters()

template<class Particle_T >
auto autopas::VerletClusterLists< Particle_T >::getNumClusters ( ) const
inline

Returns the number of clusters in this container.

Returns
The number of clusters in this container.

◆ getNumTowersPerInteractionLength()

template<class Particle_T >
auto autopas::VerletClusterLists< Particle_T >::getNumTowersPerInteractionLength ( ) const
inline

Returns the towers per interaction length.

That is how many towers fit into one interaction length rounded up.

Returns
the number of towers per interaction length.

◆ getParticle() [1/2]

template<class Particle_T >
std::tuple< const Particle_T *, size_t, size_t > autopas::VerletClusterLists< Particle_T >::getParticle ( size_t  cellIndex,
size_t  particleIndex,
IteratorBehavior  iteratorBehavior 
) const
inlineoverridevirtual

Fetch the pointer to a particle, identified via a cell and particle index.

These indices are only meaningful in the context of the current container at its current state. The same indices might (and probably will) yield different particles for different container types or might not even exist. The only guarantee is that the indices {0,0} yield the first particle in the container that satisfies the iterator requirements.

Note
This function should handle any offsets if used in a parallel iterator.
Parameters
cellIndexIndex of the cell the particle is located in.
particleIndexParticle index within the cell.
iteratorBehaviorWhich ownership states should be considered for the next particle.
Returns
Pointer to the particle and its indices. tuple<Particle_T*, cellIndex, particleIndex> If a index pair is given that does not exist but is also not beyond the last cell, the next fitting particle shall be returned. Example: If [4,2] does not exist, [5,1] shall be returned (or whatever is the next particle that fulfills the iterator requirements). If there is no next fitting particle {nullptr, 0, 0} is returned.

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ getParticle() [2/2]

template<class Particle_T >
std::tuple< const Particle_T *, size_t, size_t > autopas::VerletClusterLists< Particle_T >::getParticle ( size_t  cellIndex,
size_t  particleIndex,
IteratorBehavior  iteratorBehavior,
const std::array< double, 3 > &  boxMin,
const std::array< double, 3 > &  boxMax 
) const
inlineoverridevirtual

Fetch the pointer to a particle, identified via a cell and particle index.

These indices are only meaningful in the context of the current container at its current state. The same indices might (and probably will) yield different particles for different container types or might not even exist. The only guarantee is that the indices {0,0} yield the first particle in the container that satisfies the iterator requirements.

Note
This function should handle any offsets if used in a parallel iterator.
Parameters
cellIndexIndex of the cell the particle is located in.
particleIndexParticle index within the cell.
iteratorBehaviorWhich ownership states should be considered for the next particle.
Returns
Pointer to the particle and its indices. tuple<Particle_T*, cellIndex, particleIndex> If a index pair is given that does not exist but is also not beyond the last cell, the next fitting particle shall be returned. Example: If [4,2] does not exist, [5,1] shall be returned (or whatever is the next particle that fulfills the iterator requirements). If there is no next fitting particle {nullptr, 0, 0} is returned.
Parameters
boxMinstart of region in which the next particle should be. The coordinates are expected to be within the domain.
boxMaxend of region in which the next particle should be. The coordinates are expected to be within the domain.

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ getParticleCellTypeEnum()

template<class Particle_T >
CellType autopas::VerletClusterLists< Particle_T >::getParticleCellTypeEnum ( ) const
inlineoverridevirtual

Get the ParticleCell type as an Enum.

Returns
The Cell type as an Enum

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ getParticleImpl()

template<class Particle_T >
template<bool regionIter>
std::tuple< const Particle_T *, size_t, size_t > autopas::VerletClusterLists< Particle_T >::getParticleImpl ( size_t  cellIndex,
size_t  particleIndex,
IteratorBehavior  iteratorBehavior,
const std::array< double, 3 > &  boxMin,
const std::array< double, 3 > &  boxMax 
) const
inline

Container specific implementation for getParticle.

See ParticleContainerInterface::getParticle().

Template Parameters
regionIter
Parameters
cellIndex
particleIndex
iteratorBehavior
boxMin
boxMax
Returns
tuple<ParticlePointer, CellIndex, ParticleIndex>

◆ getRebuildFrequency()

template<class Particle_T >
unsigned int autopas::VerletClusterLists< Particle_T >::getRebuildFrequency ( )
inline

Get the rebuild Frequency value for the container.

Returns
rebuildFrequency

◆ getRegionIterator() [1/2]

template<class Particle_T >
ContainerIterator< Particle_T, false, true > autopas::VerletClusterLists< Particle_T >::getRegionIterator ( const std::array< double, 3 > &  lowerCorner,
const std::array< double, 3 > &  higherCorner,
IteratorBehavior  behavior,
typename ContainerIterator< Particle_T, false, true >::ParticleVecType *  additionalVectors = nullptr 
) const
inlineoverridevirtual

Iterate over all particles in a specified region for(auto iter = container.getRegionIterator(lowCorner, highCorner);iter.isValid();++iter) .

Parameters
lowerCornerLower corner of the region
higherCornerHigher corner of the region
behaviorThe behavior of the iterator (shall it iterate over halo particles as well?).
additionalVectorsVectors that should be included besides the container.
Returns
Iterator to iterate over all particles in a specific region.
Note
const version.

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ getRegionIterator() [2/2]

template<class Particle_T >
ContainerIterator< Particle_T, true, true > autopas::VerletClusterLists< Particle_T >::getRegionIterator ( const std::array< double, 3 > &  lowerCorner,
const std::array< double, 3 > &  higherCorner,
IteratorBehavior  behavior,
typename ContainerIterator< Particle_T, true, true >::ParticleVecType *  additionalVectors = nullptr 
)
inlineoverridevirtual

Iterate over all particles in a specified region for(auto iter = container.getRegionIterator(lowCorner, highCorner);iter.isValid();++iter) .

Parameters
lowerCornerLower corner of the region
higherCornerHigher corner of the region
behaviorThe behavior of the iterator (shall it iterate over halo particles as well?).
additionalVectorsVectors that should be included besides the container.
Returns
Iterator to iterate over all particles in a specific region.

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ getTowerBlock()

template<class Particle_T >
internal::ClusterTowerBlock2D< Particle_T > & autopas::VerletClusterLists< Particle_T >::getTowerBlock ( )
inline

Getter for the cell block.

Note
This is only used for testing.
Returns

◆ getTowerByIndex()

template<class Particle_T >
internal::ClusterTower< Particle_T > & autopas::VerletClusterLists< Particle_T >::getTowerByIndex ( size_t  x,
size_t  y 
)
inline

Returns a reference to the tower for the given tower grid coordinates.

Parameters
xThe x-th tower in x direction.
yThe y-th tower in y direction.
Returns
a reference to the tower for the given tower grid coordinates.

◆ getTowerSideLength()

template<class Particle_T >
auto autopas::VerletClusterLists< Particle_T >::getTowerSideLength ( ) const
inline

Returns the grid side length of the grids in the container.

Returns
the grid side length of the grids in the container.

◆ getTowersPerDimension()

template<class Particle_T >
auto autopas::VerletClusterLists< Particle_T >::getTowersPerDimension ( ) const
inline

Returns the number of grids per dimension on the container.

Returns
the number of grids per dimension on the container.

◆ getTraversalSelectorInfo()

template<class Particle_T >
TraversalSelectorInfo autopas::VerletClusterLists< Particle_T >::getTraversalSelectorInfo ( ) const
inlineoverridevirtual

Generates a traversal selector info for this container.

Returns
Traversal selector info for this container.

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ getVerletSkin()

template<class Particle_T >
double autopas::VerletClusterLists< Particle_T >::getVerletSkin ( ) const
inlineoverridevirtual

Return the verletSkin of the container verletSkin.

Returns
verletSkin

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ loadParticlesIntoSoAs()

template<class Particle_T >
template<class Functor >
void autopas::VerletClusterLists< Particle_T >::loadParticlesIntoSoAs ( Functor functor)
inline

Loads all particles of the container in their correct SoA and generates the SoAViews for the clusters.

Template Parameters
FunctorThe type of the functor to use.
Parameters
functorThe functor to use for loading the particles into the SoA.
Todo:
: find sensible chunksize

◆ notifyParticleDeleted()

template<class Particle_T >
void autopas::VerletClusterLists< Particle_T >::notifyParticleDeleted ( )
inlineoverrideprotectedvirtual

If a particle is deleted, we want _isValid to be set to invalid, as the tower structure is invalidated.

This function is not called, if a particle from the _particlesToAdd vector is deleted!

Implements autopas::internal::ParticleDeletedObserver.

◆ rebuildNeighborLists()

template<class Particle_T >
void autopas::VerletClusterLists< Particle_T >::rebuildNeighborLists ( TraversalInterface traversal)
inlineoverridevirtual

Rebuilds the neighbor lists for the next traversals.

Parameters
traversalThe used traversal.

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ rebuildTowersAndClusters()

template<class Particle_T >
void autopas::VerletClusterLists< Particle_T >::rebuildTowersAndClusters ( bool  newton3)
inline

Initializes a new VerletClusterListsRebuilder and uses it to rebuild the towers and the clusters.

This function sets the container structure to valid.

Parameters
newton3Indicate whether the VerletClusterRebuilder should consider newton3 or not.

◆ reduce() [1/2]

template<class Particle_T >
template<typename Lambda , typename A >
void autopas::VerletClusterLists< Particle_T >::reduce ( Lambda  reduceLambda,
A &  result,
IteratorBehavior  behavior = autopas::IteratorBehavior::ownedOrHalo 
)
inline

Reduce properties of particles as defined by a lambda function.

Template Parameters
Lambda(Particle_T p, A initialValue) -> void
Atype of particle attribute to be reduced
Parameters
reduceLambdacode to reduce properties of particles
resultreference to result of type A
behavior
See also
IteratorBehavior default:
IteratorBehavior::ownedOrHalo

◆ reduce() [2/2]

template<class Particle_T >
template<typename Lambda , typename A >
void autopas::VerletClusterLists< Particle_T >::reduce ( Lambda  reduceLambda,
A &  result,
IteratorBehavior  behavior = autopas::IteratorBehavior::ownedOrHalo 
) const
inline

Reduce properties of particles as defined by a lambda function.

Template Parameters
Lambda(Particle_T p, A initialValue) -> void
Atype of particle attribute to be reduced
Parameters
reduceLambdacode to reduce properties of particles
resultreference to result of type A
behavior
See also
IteratorBehavior default:
IteratorBehavior::ownedOrHalo
Note
const version.
This function additionally iterates over the _particlesToAdd vector if the tower-structure isn't valid.

◆ reduceInRegion() [1/2]

template<class Particle_T >
template<typename Lambda , typename A >
void autopas::VerletClusterLists< Particle_T >::reduceInRegion ( Lambda  reduceLambda,
A &  result,
const std::array< double, 3 > &  lowerCorner,
const std::array< double, 3 > &  higherCorner,
IteratorBehavior  behavior = autopas::IteratorBehavior::ownedOrHalo 
)
inline

Execute code on all particles in this container in a certain region as defined by a lambda function.

Template Parameters
Lambda(Particle_T &p, A &result) -> void
Atype of reduction Value
Parameters
reduceLambdacode to be executed on all particles
resultreference to starting and final value for reduction
lowerCornerlower corner of bounding box
higherCornerhigher corner of bounding box
behavior
See also
IteratorBehavior

◆ reduceInRegion() [2/2]

template<class Particle_T >
template<typename Lambda , typename A >
void autopas::VerletClusterLists< Particle_T >::reduceInRegion ( Lambda  reduceLambda,
A &  result,
const std::array< double, 3 > &  lowerCorner,
const std::array< double, 3 > &  higherCorner,
IteratorBehavior  behavior = autopas::IteratorBehavior::ownedOrHalo 
) const
inline

Execute code on all particles in this container in a certain region as defined by a lambda function.

Template Parameters
Lambda(Particle_T &p, A &result) -> void
Atype of reduction Value
Parameters
reduceLambdacode to be executed on all particles
resultreference to starting and final value for reduction
lowerCornerlower corner of bounding box
higherCornerhigher corner of bounding box
behavior
See also
IteratorBehavior
Note
const version.
This function additionally iterates over the _particlesToAdd vector if the tower-structure isn't valid.

◆ reserve()

template<class Particle_T >
void autopas::VerletClusterLists< Particle_T >::reserve ( size_t  numParticles,
size_t  numParticlesHaloEstimate 
)
inlineoverridevirtual

Reserve memory for a given number of particles in the container and logic layers.

This function assumes a uniform distribution of particles throughout the domain. For example, this means that in a LinkedCells Container in each cell vector.reserve(numParticles/numCells) is called.

Note
This functions will create an estimate for the number of halo particles.
Parameters
numParticlesNo buffer factor is applied. It is probably wise to slightly over-reserve to account for imbalance or particle movement.
numParticlesHaloEstimateEstimate for the number of halo particles. Reserves space in the container data structure.

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ setCutoff()

template<class Particle_T >
void autopas::VerletClusterLists< Particle_T >::setCutoff ( double  cutoff)
inlineoverridevirtual

Set the cutoff of the container.

Parameters
cutoff

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ setRebuildFrequency()

template<class Particle_T >
void autopas::VerletClusterLists< Particle_T >::setRebuildFrequency ( unsigned int  rebuildFrequency)
inline

Set the rebuild Frequency value for the container.

Parameters
rebuildFrequency

◆ setSkin()

template<class Particle_T >
void autopas::VerletClusterLists< Particle_T >::setSkin ( double  skin)
inline

Set the verlet skin length for the container.

Parameters
skin

◆ size()

template<class Particle_T >
size_t autopas::VerletClusterLists< Particle_T >::size ( ) const
inlineoverridevirtual

Get the number of all particles stored in this container (owned + halo + dummy).

Returns
number of particles stored in this container (owned + halo + dummy).

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ traverseClusters()

template<class Particle_T >
template<bool inParallel, class LoopBody >
void autopas::VerletClusterLists< Particle_T >::traverseClusters ( LoopBody &&  loopBody)
inline

Helper method to iterate over all clusters.

Template Parameters
LoopBodyThe type of the lambda to execute for all clusters.
inParallelIf the iteration should be executed in parallel or sequential. See traverseClustersParallel() for thread safety.
Parameters
loopBodyThe lambda to execute for all clusters. Parameters given is internal::Cluster& cluster.

◆ traverseClustersParallel()

template<class Particle_T >
template<class LoopBody >
void autopas::VerletClusterLists< Particle_T >::traverseClustersParallel ( LoopBody &&  loopBody)
inline

Helper method to iterate over all clusters in parallel.

It is always safe to modify the particles in the cluster that is passed to the given loop body. However, when modifying particles from other clusters, the caller has to make sure that no data races occur. Particles must not be added or removed during the traversal.

Template Parameters
LoopBodyThe type of the lambda to execute for all clusters.
Parameters
loopBodyThe lambda to execute for all clusters. Parameters given is internal::Cluster& cluster.
Todo:
: find sensible chunksize

◆ traverseClustersSequential()

template<class Particle_T >
template<class LoopBody >
void autopas::VerletClusterLists< Particle_T >::traverseClustersSequential ( LoopBody &&  loopBody)
inline

Helper method to sequentially iterate over all owned clusters.

Template Parameters
LoopBodyThe type of the lambda to execute for all clusters.
Parameters
loopBodyThe lambda to execute for all clusters. Parameters given is internal::Cluster& cluster.

◆ updateContainer()

template<class Particle_T >
std::vector< Particle_T > autopas::VerletClusterLists< Particle_T >::updateContainer ( bool  keepNeighborListsValid)
inlineoverridevirtual

Updates the container.

This deletes halo particles, resorts particles into appropriate cells and might remove particles from the container, if necessary.

Parameters
keepNeighborListsValidDefines whether the neighbor lists have to be kept valid.
Returns
A vector of invalid particles that do not belong into the container.

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ updateHaloParticle()

template<class Particle_T >
bool autopas::VerletClusterLists< Particle_T >::updateHaloParticle ( const Particle_T &  haloParticle)
inlineoverridevirtual

Update a halo particle of the container with the given haloParticle.

Parameters
haloParticleParticle to be updated.
Returns
Returns true if the particle was updated, false if no particle could be found.

Implements autopas::ParticleContainerInterface< Particle_T >.


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