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

LinkedCells class. More...

#include <LinkedCells.h>

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

Public Types

using ParticleCell = FullParticleCell< Particle_T >
 Type of the ParticleCell.
 
using ParticleType = typename ParticleCell::ParticleType
 Type of the Particle.
 
- Public Types inherited from autopas::ParticleContainerInterface< ParticleCell::ParticleType >
using ParticleType = ParticleCell::ParticleType
 Type of the Particle.
 

Public Member Functions

 LinkedCells (const std::array< double, 3 > &boxMin, const std::array< double, 3 > &boxMax, const double cutoff, const double skin, const unsigned int rebuildFrequency, const double cellSizeFactor=1.0, LoadEstimatorOption loadEstimator=LoadEstimatorOption::squaredParticlesPerCell)
 Constructor of the LinkedCells class.
 
ContainerOption getContainerType () const override
 Get the ContainerType.
 
CellType getParticleCellTypeEnum () const override
 Get the ParticleCell type as an Enum.
 
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 ParticleType &p) override
 Adds a particle to the container.
 
void addHaloParticleImpl (const ParticleType &haloParticle) override
 Adds a particle to the container that lies in the halo region of the container.
 
bool updateHaloParticle (const ParticleType &haloParticle) override
 Update a halo particle of the container with the given haloParticle.
 
void deleteHaloParticles () override
 Deletes all halo particles.
 
void rebuildNeighborLists (TraversalInterface *traversal) override
 Rebuilds the neighbor lists for the next traversals.
 
BalancedTraversal::EstimatorFunction getLoadEstimatorFunction ()
 Generates the load estimation function depending on _loadEstimator.
 
void computeInteractions (TraversalInterface *traversal) override
 Iterates over all particle multiples (e.g.
 
std::vector< ParticleTypeupdateContainer (bool keepNeighborListsValid) override
 Updates the container.
 
TraversalSelectorInfo getTraversalSelectorInfo () const override
 Generates a traversal selector info for this container.
 
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.
 
ContainerIterator< ParticleType, true, false > begin (IteratorBehavior behavior=autopas::IteratorBehavior::ownedOrHalo, typename ContainerIterator< ParticleType, true, false >::ParticleVecType *additionalVectors=nullptr) override
 Iterate over all particles using for(auto iter = container.begin(); iter.isValid(); ++iter) .
 
ContainerIterator< ParticleType, false, false > begin (IteratorBehavior behavior=autopas::IteratorBehavior::ownedOrHalo, typename ContainerIterator< ParticleType, 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=IteratorBehavior::ownedOrHalo)
 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=IteratorBehavior::ownedOrHalo)
 Reduce properties of particles as defined by a lambda function.
 
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) override
 Iterate over all particles in a specified region for(auto iter = container.getRegionIterator(lowCorner, highCorner);iter.isValid();++iter) .
 
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 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.
 
internal::CellBlock3D< ParticleCell > & getCellBlock ()
 Get the cell block, not supposed to be used except by verlet lists.
 
const internal::CellBlock3D< ParticleCell > & getCellBlock () const
 Get the cell block, not supposed to be used except by verlet lists.
 
std::vector< ParticleCell > & getCells ()
 Returns a non-const reference to the cell data structure.
 
- Public Member Functions inherited from autopas::CellBasedParticleContainer< FullParticleCell< Particle_T > >
 CellBasedParticleContainer (const std::array< double, 3 > &boxMin, const std::array< double, 3 > &boxMax, const double cutoff, double skin, unsigned int rebuildFrequency)
 Constructor of CellBasedParticleContainer.
 
 CellBasedParticleContainer (const CellBasedParticleContainer &obj)=delete
 Delete the copy constructor to prevent unwanted copies.
 
 ~CellBasedParticleContainer () override=default
 Destructor of CellBasedParticleContainer.
 
CellBasedParticleContaineroperator= (const CellBasedParticleContainer &other)=delete
 Delete the copy assignment operator to prevent unwanted copies No particle container should ever be copied.
 
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 getInteractionLength () const final
 Return the interaction length (cutoff+skin) of the container.
 
double getVerletSkin () const final
 Returns the verlet Skin length.
 
void deleteAllParticles () override
 Deletes all particles from the container.
 
size_t getNumberOfParticles (IteratorBehavior behavior) const override
 Get the number of particles with respect to the specified IteratorBehavior.
 
size_t size () const override
 Get the total number of particles saved in the container (owned + halo + dummy).
 
const std::vector< FullParticleCell< Particle_T > > & getCells () const
 Get immutable vector of cells.
 
- Public Member Functions inherited from autopas::ParticleContainerInterface< ParticleCell::ParticleType >
virtual CellType getParticleCellTypeEnum () const=0
 Get the ParticleCell type as an Enum.
 
 ParticleContainerInterface (double skin)
 Constructor.
 
 ParticleContainerInterface (const ParticleContainerInterface &obj)=delete
 Delete the copy constructor to prevent unwanted copies.
 
virtual ~ParticleContainerInterface ()=default
 Destructor of ParticleContainerInterface.
 
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.
 
void addParticle (const ParticleCell::ParticleType &p)
 Adds a particle to the container.
 
void addHaloParticle (const ParticleCell::ParticleType &haloParticle)
 Adds a particle to the container that lies in the halo region of the container.
 
virtual bool updateHaloParticle (const ParticleCell::ParticleType &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 ParticleCell::ParticleType *, 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 ParticleCell::ParticleType *, 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< ParticleCell::ParticleType *, 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< ParticleCell::ParticleType *, 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 (ParticleCell::ParticleType &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

template<bool regionIter>
std::tuple< size_t, size_t > advanceIteratorIndices (size_t cellIndex, size_t particleIndex, IteratorBehavior iteratorBehavior, const std::array< double, 3 > &boxMin, const std::array< double, 3 > &boxMax, std::array< double, 3 > boxMinWithSafetyMargin, std::array< double, 3 > boxMaxWithSafetyMargin, size_t endCellIndex) const
 Given a pair of cell-/particleIndex and iterator restrictions either returns the next indices that match these restrictions or indices that are out of bounds (e.g.
 
template<typename Traversal >
void prepareTraversal (Traversal &traversal)
 Checks if a given traversal is allowed for LinkedCells and sets it up for the force interactions.
 
virtual void addParticleImpl (const ParticleCell::ParticleType &p)=0
 Adds a particle to the container.
 
virtual void addHaloParticleImpl (const ParticleCell::ParticleType &haloParticle)=0
 Adds a particle to the container that lies in the halo region of the container.
 

Protected Attributes

internal::CellBlock3D< ParticleCell_cellBlock
 object to manage the block of cells.
 
autopas::LoadEstimatorOption _loadEstimator
 load estimation algorithm for balanced traversals.
 
- Protected Attributes inherited from autopas::CellBasedParticleContainer< FullParticleCell< Particle_T > >
std::vector< FullParticleCell< Particle_T > > _cells
 Vector of particle cells.
 
- Protected Attributes inherited from autopas::ParticleContainerInterface< ParticleCell::ParticleType >
size_t _stepsSinceLastRebuild
 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::LinkedCells< Particle_T >

LinkedCells class.

This class uses a list of neighboring cells to store the particles. These cells dimensions are at least as large as the given cutoff radius, therefore short-range interactions only need to be calculated between particles in neighboring cells.

Template Parameters
Particle_Ttype of the Particle

Constructor & Destructor Documentation

◆ LinkedCells()

template<class Particle_T >
autopas::LinkedCells< Particle_T >::LinkedCells ( const std::array< double, 3 > &  boxMin,
const std::array< double, 3 > &  boxMax,
const double  cutoff,
const double  skin,
const unsigned int  rebuildFrequency,
const double  cellSizeFactor = 1.0,
LoadEstimatorOption  loadEstimator = LoadEstimatorOption::squaredParticlesPerCell 
)
inline

Constructor of the LinkedCells class.

Parameters
boxMin
boxMax
cutoff
skin
rebuildFrequency
cellSizeFactorcell size factor relative to cutoff
loadEstimatorthe load estimation algorithm for balanced traversals. By default all applicable traversals are allowed.

Member Function Documentation

◆ addHaloParticleImpl()

template<class Particle_T >
void autopas::LinkedCells< Particle_T >::addHaloParticleImpl ( const ParticleType 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< ParticleCell::ParticleType >.

◆ addParticleImpl()

template<class Particle_T >
void autopas::LinkedCells< Particle_T >::addParticleImpl ( const ParticleType p)
inlineoverridevirtual

Adds a particle to the container.

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

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

Implements autopas::ParticleContainerInterface< ParticleCell::ParticleType >.

◆ advanceIteratorIndices()

template<class Particle_T >
template<bool regionIter>
std::tuple< size_t, size_t > autopas::LinkedCells< Particle_T >::advanceIteratorIndices ( size_t  cellIndex,
size_t  particleIndex,
IteratorBehavior  iteratorBehavior,
const std::array< double, 3 > &  boxMin,
const std::array< double, 3 > &  boxMax,
std::array< double, 3 >  boxMinWithSafetyMargin,
std::array< double, 3 >  boxMaxWithSafetyMargin,
size_t  endCellIndex 
) const
inlineprotected

Given a pair of cell-/particleIndex and iterator restrictions either returns the next indices that match these restrictions or indices that are out of bounds (e.g.

cellIndex >= cells.size())

Template Parameters
regionIter
Parameters
cellIndex
particleIndex
iteratorBehavior
boxMinThe actual search box min
boxMaxThe actual search box max
boxMinWithSafetyMarginSearch box min that includes a surrounding of skin
boxMaxWithSafetyMarginSearch box max that includes a surrounding of skin
endCellIndexLast relevant cell index
Returns
tuple<cellIndex, particleIndex>

◆ begin() [1/2]

template<class Particle_T >
ContainerIterator< ParticleType, false, false > autopas::LinkedCells< Particle_T >::begin ( IteratorBehavior  behavior = autopas::IteratorBehavior::ownedOrHalo,
typename ContainerIterator< ParticleType, 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< ParticleCell::ParticleType >.

◆ begin() [2/2]

template<class Particle_T >
ContainerIterator< ParticleType, true, false > autopas::LinkedCells< Particle_T >::begin ( IteratorBehavior  behavior = autopas::IteratorBehavior::ownedOrHalo,
typename ContainerIterator< ParticleType, 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< ParticleCell::ParticleType >.

◆ computeInteractions()

template<class Particle_T >
void autopas::LinkedCells< 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< ParticleCell::ParticleType >.

◆ deleteHaloParticles()

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

◆ deleteParticle() [1/2]

template<class Particle_T >
bool autopas::LinkedCells< 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< ParticleCell::ParticleType >.

◆ deleteParticle() [2/2]

template<class Particle_T >
bool autopas::LinkedCells< 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< ParticleCell::ParticleType >.

◆ forEach()

template<class Particle_T >
template<typename Lambda >
void autopas::LinkedCells< Particle_T >::forEach ( Lambda  forEachLambda,
IteratorBehavior  behavior = 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

◆ forEachInRegion()

template<class Particle_T >
template<typename Lambda >
void autopas::LinkedCells< Particle_T >::forEachInRegion ( Lambda  forEachLambda,
const std::array< double, 3 > &  lowerCorner,
const std::array< double, 3 > &  higherCorner,
IteratorBehavior  behavior 
)
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

◆ getCellBlock() [1/2]

template<class Particle_T >
internal::CellBlock3D< ParticleCell > & autopas::LinkedCells< Particle_T >::getCellBlock ( )
inline

Get the cell block, not supposed to be used except by verlet lists.

Returns
the cell block

◆ getCellBlock() [2/2]

template<class Particle_T >
const internal::CellBlock3D< ParticleCell > & autopas::LinkedCells< Particle_T >::getCellBlock ( ) const
inline

Get the cell block, not supposed to be used except by verlet lists.

Returns
the cell block
Note
const version

◆ getCells()

template<class Particle_T >
std::vector< ParticleCell > & autopas::LinkedCells< Particle_T >::getCells ( )
inline

Returns a non-const reference to the cell data structure.

Returns
Non-const reference.

◆ getContainerType()

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

Get the ContainerType.

Returns
ContainerOption of the type of this container.

Implements autopas::ParticleContainerInterface< ParticleCell::ParticleType >.

◆ getLoadEstimatorFunction()

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

Generates the load estimation function depending on _loadEstimator.

Returns
load estimator function object.

◆ getParticle() [1/2]

template<class Particle_T >
std::tuple< const Particle_T *, size_t, size_t > autopas::LinkedCells< 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< ParticleCell::ParticleType >.

◆ getParticle() [2/2]

template<class Particle_T >
std::tuple< const Particle_T *, size_t, size_t > autopas::LinkedCells< 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< ParticleCell::ParticleType >.

◆ getParticleCellTypeEnum()

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

Get the ParticleCell type as an Enum.

Returns
The Cell type as an Enum

Implements autopas::ParticleContainerInterface< ParticleCell::ParticleType >.

◆ getParticleImpl()

template<class Particle_T >
template<bool regionIter>
std::tuple< const Particle_T *, size_t, size_t > autopas::LinkedCells< 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>

◆ getRegionIterator() [1/2]

template<class Particle_T >
ContainerIterator< ParticleType, false, true > autopas::LinkedCells< Particle_T >::getRegionIterator ( const std::array< double, 3 > &  lowerCorner,
const std::array< double, 3 > &  higherCorner,
IteratorBehavior  behavior,
typename ContainerIterator< ParticleType, 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< ParticleCell::ParticleType >.

◆ getRegionIterator() [2/2]

template<class Particle_T >
ContainerIterator< ParticleType, true, true > autopas::LinkedCells< Particle_T >::getRegionIterator ( const std::array< double, 3 > &  lowerCorner,
const std::array< double, 3 > &  higherCorner,
IteratorBehavior  behavior,
typename ContainerIterator< ParticleType, 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< ParticleCell::ParticleType >.

◆ getTraversalSelectorInfo()

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

Generates a traversal selector info for this container.

Returns
Traversal selector info for this container.

Implements autopas::ParticleContainerInterface< ParticleCell::ParticleType >.

◆ prepareTraversal()

template<class Particle_T >
template<typename Traversal >
void autopas::LinkedCells< Particle_T >::prepareTraversal ( Traversal &  traversal)
inlineprotected

Checks if a given traversal is allowed for LinkedCells and sets it up for the force interactions.

Template Parameters
TraversalTraversal type. E.g. pairwise, triwise
Parameters
traversal

◆ rebuildNeighborLists()

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

Rebuilds the neighbor lists for the next traversals.

Parameters
traversalThe used traversal.

Implements autopas::ParticleContainerInterface< ParticleCell::ParticleType >.

◆ reduce()

template<class Particle_T >
template<typename Lambda , typename A >
void autopas::LinkedCells< Particle_T >::reduce ( Lambda  reduceLambda,
A &  result,
IteratorBehavior  behavior = 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

◆ reduceInRegion()

template<class Particle_T >
template<typename Lambda , typename A >
void autopas::LinkedCells< Particle_T >::reduceInRegion ( Lambda  reduceLambda,
A &  result,
const std::array< double, 3 > &  lowerCorner,
const std::array< double, 3 > &  higherCorner,
IteratorBehavior  behavior 
)
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

◆ reserve()

template<class Particle_T >
void autopas::LinkedCells< 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< ParticleCell::ParticleType >.

◆ updateContainer()

template<class Particle_T >
std::vector< ParticleType > autopas::LinkedCells< 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< ParticleCell::ParticleType >.

◆ updateHaloParticle()

template<class Particle_T >
bool autopas::LinkedCells< Particle_T >::updateHaloParticle ( const ParticleType 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< ParticleCell::ParticleType >.


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