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

Verlet Lists container. More...

#include <VerletLists.h>

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

Public Types

enum  BuildVerletListType { VerletAoS , VerletSoA }
 Enum that specifies how the verlet lists should be build. More...
 
- Public Types inherited from autopas::ParticleContainerInterface< Particle_T >
using ParticleType = Particle_T
 Type of the Particle.
 

Public Member Functions

 VerletLists (const std::array< double, 3 > &boxMin, const std::array< double, 3 > &boxMax, const double cutoff, const double skin, const unsigned int rebuildFrequency, const BuildVerletListType buildVerletListType=BuildVerletListType::VerletSoA, const double cellSizeFactor=1.0)
 Constructor of the VerletLists class.
 
ContainerOption getContainerType () const override
 Get the ContainerType.
 
void computeInteractions (TraversalInterface *traversal) override
 Iterates over all particle multiples (e.g.
 
VerletListHelpers< Particle_T >::NeighborListAoSType & getVerletListsAoS ()
 get the actual neighbor list
 
void rebuildNeighborLists (TraversalInterface *traversal) override
 Rebuilds the verlet lists, marks them valid and resets the internal counter.
 
- Public Member Functions inherited from autopas::VerletListsLinkedBase< Particle_T >
 VerletListsLinkedBase (const std::array< double, 3 > &boxMin, const std::array< double, 3 > &boxMax, const double cutoff, const double skin, const unsigned int rebuildFrequency, const std::set< TraversalOption > &applicableTraversals, const double cellSizeFactor)
 Constructor of the VerletListsLinkedBase class.
 
CellType getParticleCellTypeEnum () const override
 Get the ParticleCell type as an Enum.
 
void setStepsSinceLastRebuild (size_t stepsSinceLastRebuild) override
 Set the number of time-steps since last neighbor list rebuild.
 
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 a 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.
 
size_t size () const override
 Get the total number of particles saved in the container (owned + halo + dummy).
 
size_t getNumberOfParticles (IteratorBehavior behavior) const override
 Get the number of particles with respect to the specified IteratorBehavior.
 
void deleteHaloParticles () override
 Deletes all halo particles.
 
void deleteAllParticles () override
 Deletes all 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.
 
bool updateHaloParticle (const Particle_T &haloParticle) override
 Searches the provided halo particle and updates the found particle.
 
ContainerIterator< Particle_T, true, false > begin (IteratorBehavior behavior=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=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)
 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)
 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)
 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)
 Execute code on all particles in this container in a certain region as defined by a lambda function.
 
const std::array< std::size_t, 3 > & getCellsPerDimension () const
 Get the dimension of the used cellblock including the haloboxes.
 
TraversalSelectorInfo getTraversalSelectorInfo () const override
 Generates a traversal selector info for this container.
 
const std::array< double, 3 > & getBoxMax () const final
 Get the upper corner of the container without halo.
 
const std::array< double, 3 > & getBoxMin () const final
 Get the lower corner of the container without halo.
 
double getCutoff () const final
 Return the cutoff of the container.
 
void setCutoff (double cutoff) final
 Set the cutoff of the container.
 
double getVerletSkin () const final
 Return the verletSkin of the container verletSkin.
 
double getInteractionLength () const final
 Return the interaction length (cutoff+skin) of the container.
 
- 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.
 

Protected Member Functions

virtual void updateVerletListsAoS (bool useNewton3)
 Update the verlet lists for AoS usage.
 
size_t generateAoSNeighborLists ()
 Clears and then generates the AoS neighbor lists.
 
void generateSoAListFromAoSVerletLists ()
 Fills SoA neighbor list with particle indices.
 
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

- Protected Attributes inherited from autopas::VerletListsLinkedBase< Particle_T >
LinkedCells< Particle_T > _linkedCells
 internal linked cells storage, handles Particle storage and used to build verlet lists
 
std::atomic< bool > _neighborListIsValid {false}
 specifies if the neighbor list is currently valid
 
bool _verletBuiltNewton3 {false}
 specifies if the current verlet list was built for newton3
 
- 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::VerletLists< Particle_T >

Verlet Lists container.

The VerletLists class uses neighborhood lists to calculate pairwise interactions of particles. It is optimized for a constant, i.e. particle independent, cutoff radius of the interaction. Cells are created using a cell size of at least cutoff + skin radius.

Template Parameters
Particle_T

Member Enumeration Documentation

◆ BuildVerletListType

template<class Particle_T >
enum autopas::VerletLists::BuildVerletListType

Enum that specifies how the verlet lists should be build.

Enumerator
VerletAoS 

Build it using AoS.

VerletSoA 

Build it using AoS.

Constructor & Destructor Documentation

◆ VerletLists()

template<class Particle_T >
autopas::VerletLists< Particle_T >::VerletLists ( const std::array< double, 3 > &  boxMin,
const std::array< double, 3 > &  boxMax,
const double  cutoff,
const double  skin,
const unsigned int  rebuildFrequency,
const BuildVerletListType  buildVerletListType = BuildVerletListType::VerletSoA,
const double  cellSizeFactor = 1.0 
)
inline

Constructor of the VerletLists class.

The neighbor lists are build using a search radius of cutoff + skin.

Parameters
boxMinThe lower corner of the domain.
boxMaxThe upper corner of the domain.
cutoffThe cutoff radius of the interaction.
skinThe skin radius per timestep.
rebuildFrequencyrebuild fequency.
buildVerletListTypeSpecifies how the verlet list should be build, see BuildVerletListType
cellSizeFactorcell size factor ralative to cutoff

Member Function Documentation

◆ computeInteractions()

template<class Particle_T >
void autopas::VerletLists< 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 >.

◆ generateAoSNeighborLists()

template<class Particle_T >
size_t autopas::VerletLists< Particle_T >::generateAoSNeighborLists ( )
inlineprotected

Clears and then generates the AoS neighbor lists.

The Id Map is used to map the id of a particle to the actual particle.

Returns
Number of particles in the container

◆ getContainerType()

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

Get the ContainerType.

Returns
ContainerOption of the type of this container.

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ getVerletListsAoS()

template<class Particle_T >
VerletListHelpers< Particle_T >::NeighborListAoSType & autopas::VerletLists< Particle_T >::getVerletListsAoS ( )
inline

get the actual neighbor list

Returns
the neighbor list

◆ rebuildNeighborLists()

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

Rebuilds the verlet lists, marks them valid and resets the internal counter.

Note
This function will be called in computeInteractions()!
Parameters
traversal

Implements autopas::ParticleContainerInterface< Particle_T >.

◆ updateVerletListsAoS()

template<class Particle_T >
virtual void autopas::VerletLists< Particle_T >::updateVerletListsAoS ( bool  useNewton3)
inlineprotectedvirtual

Update the verlet lists for AoS usage.

Parameters
useNewton3
Todo:
autotune traversal

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