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

Class to manage the grid of towers for the Verlet Cluster Lists container. More...

#include <ClusterTowerBlock2D.h>

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

Public Member Functions

 ClusterTowerBlock2D (const std::array< double, 3 > &boxMin, const std::array< double, 3 > &boxMax, double interactionLength)
 Constructor.
 
std::vector< ClusterTower< Particle_T > >::iterator begin ()
 Start iterator over towers.
 
std::vector< ClusterTower< Particle_T > >::const_iterator begin () const
 Start iterator over towers.
 
std::vector< ClusterTower< Particle_T > >::iterator end ()
 End iterator over towers.
 
std::vector< ClusterTower< Particle_T > >::const_iterator end () const
 End iterator over towers.
 
ClusterTower< Particle_T > & operator[] (size_t i)
 Access operator for towers.
 
const ClusterTower< Particle_T > & operator[] (size_t i) const
 Access operator for towers.
 
size_t size () const
 Return the number of towers.
 
void resize (const std::array< double, 2 > &towerSideLength, const std::array< size_t, 2 > &towersPerDim)
 Resize the internal grid and storage.
 
bool empty () const
 Indicator if the block contains any towers.
 
void addTower (size_t clusterSize)
 Construct a new tower at the end of the storage.
 
std::tuple< std::array< double, 2 >, std::array< size_t, 2 > > estimateOptimalGridSideLength (size_t numParticles, size_t clusterSize) const
 Estimates the optimal 2D tower grid side length.
 
std::tuple< std::array< double, 3 >, std::array< double, 3 > > getTowerBoundingBox (size_t index1D) const
 Calculates the low and high corner of a tower given by its index.
 
std::tuple< std::array< double, 3 >, std::array< double, 3 > > getTowerBoundingBox (const std::array< size_t, 2 > &index2D) const
 Calculates the low and high corner of a tower given by its 2D grid index.
 
std::array< size_t, 2 > getTowerIndex2DAtPosition (const std::array< double, 3 > &pos) const
 Returns the 2D index of the tower in the tower grid the given 3D coordinates are in.
 
size_t getTowerIndex1DAtPosition (const std::array< double, 3 > &pos) const
 Return the 1D index of the tower at a given position.
 
ClusterTower< Particle_T > & getTowerAtPosition (const std::array< double, 3 > &pos)
 Return a reference to the tower at a given position in the simulation coordinate system (e.g.
 
ClusterTower< Particle_T > & getTowerByIndex2D (const size_t x, const size_t y)
 Returns a reference to the tower for the given tower grid coordinates.
 
size_t towerIndex2DTo1D (const size_t x, const size_t y) const
 Returns the 1D index for the given 2D-coordinates of a tower.
 
std::array< size_t, 2 > towerIndex1DTo2D (size_t index) const
 Returns the 2D index for the given 1D index of a tower.
 
size_t getFirstOwnedTowerIndex () const
 Getter.
 
size_t getLastOwnedTowerIndex () const
 Getter.
 
double getInteractionLength () const
 Getter.
 
int getNumTowersPerInteractionLength () const
 Getter.
 
const std::array< double, 3 > & getBoxMin () const
 Getter.
 
const std::array< double, 3 > & getBoxMax () const
 Getter.
 
const std::array< double, 3 > & getHaloBoxMin () const
 Getter.
 
const std::array< double, 3 > & getHaloBoxMax () const
 Getter.
 
const std::vector< ClusterTower< Particle_T > > & getTowers () const
 Getter.
 
std::vector< ClusterTower< Particle_T > > & getTowersRef ()
 Getter for a mutable reference.
 
const std::array< size_t, 2 > & getTowersPerDim () const
 Getter.
 
const std::array< double, 2 > & getTowerSideLength () const
 Getter.
 
const std::array< double, 2 > & getTowerSideLengthReciprocal () const
 Getter.
 
bool cellCanContainHaloParticles (index_t index1d) const override
 Checks if the cell with the one-dimensional index index1d can contain halo particles.
 
bool cellCanContainOwnedParticles (index_t index1d) const override
 Checks if the cell with the one-dimensional index index1d can contain owned particles.
 
- Public Member Functions inherited from autopas::internal::CellBorderAndFlagManager
virtual ~CellBorderAndFlagManager ()=default
 Cestructor.
 
virtual bool cellCanContainHaloParticles (index_t index1d) const =0
 Checks if the cell with the one-dimensional index index1d can contain halo particles.
 
virtual bool cellCanContainOwnedParticles (index_t index1d) const =0
 Checks if the cell with the one-dimensional index index1d can contain owned particles.
 
bool ignoreCellForIteration (index_t index1d, IteratorBehavior behavior) const
 Checks if cell with index1d can be ignored for iteration with currently selected behavior.
 

Additional Inherited Members

- Public Types inherited from autopas::internal::CellBorderAndFlagManager
using index_t = std::size_t
 The index type to access the particle cells.
 

Detailed Description

template<class Particle_T>
class autopas::internal::ClusterTowerBlock2D< Particle_T >

Class to manage the grid of towers for the Verlet Cluster Lists container.

This also includes the geometric shape of the container.

Template Parameters
Particle_T

Constructor & Destructor Documentation

◆ ClusterTowerBlock2D()

template<class Particle_T >
autopas::internal::ClusterTowerBlock2D< Particle_T >::ClusterTowerBlock2D ( const std::array< double, 3 > &  boxMin,
const std::array< double, 3 > &  boxMax,
double  interactionLength 
)
inline

Constructor.

Note
This constructor does not initialize the tower grid! For this, the number of particles is required.
Parameters
boxMin
boxMax
interactionLength

Member Function Documentation

◆ addTower()

template<class Particle_T >
void autopas::internal::ClusterTowerBlock2D< Particle_T >::addTower ( size_t  clusterSize)
inline

Construct a new tower at the end of the storage.

Parameters
clusterSize

◆ begin() [1/2]

template<class Particle_T >
std::vector< ClusterTower< Particle_T > >::iterator autopas::internal::ClusterTowerBlock2D< Particle_T >::begin ( )
inline

Start iterator over towers.

Returns

◆ begin() [2/2]

template<class Particle_T >
std::vector< ClusterTower< Particle_T > >::const_iterator autopas::internal::ClusterTowerBlock2D< Particle_T >::begin ( ) const
inline

Start iterator over towers.

Returns

◆ cellCanContainHaloParticles()

template<class Particle_T >
bool autopas::internal::ClusterTowerBlock2D< Particle_T >::cellCanContainHaloParticles ( index_t  index1d) const
inlineoverridevirtual

Checks if the cell with the one-dimensional index index1d can contain halo particles.

Parameters
index1dthe one-dimensional index of the cell that should be checked
Returns
true if the cell can contain halo particles

Implements autopas::internal::CellBorderAndFlagManager.

◆ cellCanContainOwnedParticles()

template<class Particle_T >
bool autopas::internal::ClusterTowerBlock2D< Particle_T >::cellCanContainOwnedParticles ( index_t  index1d) const
inlineoverridevirtual

Checks if the cell with the one-dimensional index index1d can contain owned particles.

Parameters
index1dthe one-dimensional index of the cell that should be checked
Returns
true if the cell can contain owned particles

Implements autopas::internal::CellBorderAndFlagManager.

◆ empty()

template<class Particle_T >
bool autopas::internal::ClusterTowerBlock2D< Particle_T >::empty ( ) const
inline

Indicator if the block contains any towers.

Returns

◆ end() [1/2]

template<class Particle_T >
std::vector< ClusterTower< Particle_T > >::iterator autopas::internal::ClusterTowerBlock2D< Particle_T >::end ( )
inline

End iterator over towers.

Returns

◆ end() [2/2]

template<class Particle_T >
std::vector< ClusterTower< Particle_T > >::const_iterator autopas::internal::ClusterTowerBlock2D< Particle_T >::end ( ) const
inline

End iterator over towers.

Returns

◆ estimateOptimalGridSideLength()

template<class Particle_T >
std::tuple< std::array< double, 2 >, std::array< size_t, 2 > > autopas::internal::ClusterTowerBlock2D< Particle_T >::estimateOptimalGridSideLength ( size_t  numParticles,
size_t  clusterSize 
) const
inline

Estimates the optimal 2D tower grid side length.

sideLength = (clusterSize / (numParticles / volume))^(1/3)

The side length is then adjusted such that towers exactly fill the (non-halo) box by increasing the side length such that the number of towers does not change.

Parameters
numParticlesThe number of particles in the container.
clusterSizethe number of particles per cluster.
Returns
tuple{gridSideLength, numberOfTowers}.

◆ getBoxMax()

template<class Particle_T >
const std::array< double, 3 > & autopas::internal::ClusterTowerBlock2D< Particle_T >::getBoxMax ( ) const
inline

Getter.

Returns

◆ getBoxMin()

template<class Particle_T >
const std::array< double, 3 > & autopas::internal::ClusterTowerBlock2D< Particle_T >::getBoxMin ( ) const
inline

Getter.

Returns

◆ getFirstOwnedTowerIndex()

template<class Particle_T >
size_t autopas::internal::ClusterTowerBlock2D< Particle_T >::getFirstOwnedTowerIndex ( ) const
inline

Getter.

Returns

◆ getHaloBoxMax()

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

Getter.

Returns

◆ getHaloBoxMin()

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

Getter.

Returns

◆ getInteractionLength()

template<class Particle_T >
double autopas::internal::ClusterTowerBlock2D< Particle_T >::getInteractionLength ( ) const
inline

Getter.

Returns

◆ getLastOwnedTowerIndex()

template<class Particle_T >
size_t autopas::internal::ClusterTowerBlock2D< Particle_T >::getLastOwnedTowerIndex ( ) const
inline

Getter.

Returns

◆ getNumTowersPerInteractionLength()

template<class Particle_T >
int autopas::internal::ClusterTowerBlock2D< Particle_T >::getNumTowersPerInteractionLength ( ) const
inline

Getter.

Returns

◆ getTowerAtPosition()

template<class Particle_T >
ClusterTower< Particle_T > & autopas::internal::ClusterTowerBlock2D< Particle_T >::getTowerAtPosition ( const std::array< double, 3 > &  pos)
inline

Return a reference to the tower at a given position in the simulation coordinate system (e.g.

particle position).

Parameters
pos
Returns

◆ getTowerBoundingBox() [1/2]

template<class Particle_T >
std::tuple< std::array< double, 3 >, std::array< double, 3 > > autopas::internal::ClusterTowerBlock2D< Particle_T >::getTowerBoundingBox ( const std::array< size_t, 2 > &  index2D) const
inline

Calculates the low and high corner of a tower given by its 2D grid index.

Parameters
index2D
Returns

◆ getTowerBoundingBox() [2/2]

template<class Particle_T >
std::tuple< std::array< double, 3 >, std::array< double, 3 > > autopas::internal::ClusterTowerBlock2D< Particle_T >::getTowerBoundingBox ( size_t  index1D) const
inline

Calculates the low and high corner of a tower given by its index.

Note
If towers are not built yet the corners of the full container are returned.
Parameters
index1DThe tower's index in _towerBlock.
Returns
tuple<lowCorner, highCorner>

◆ getTowerByIndex2D()

template<class Particle_T >
ClusterTower< Particle_T > & autopas::internal::ClusterTowerBlock2D< Particle_T >::getTowerByIndex2D ( const size_t  x,
const 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.

◆ getTowerIndex1DAtPosition()

template<class Particle_T >
size_t autopas::internal::ClusterTowerBlock2D< Particle_T >::getTowerIndex1DAtPosition ( const std::array< double, 3 > &  pos) const
inline

Return the 1D index of the tower at a given position.

Parameters
pos
Returns

◆ getTowerIndex2DAtPosition()

template<class Particle_T >
std::array< size_t, 2 > autopas::internal::ClusterTowerBlock2D< Particle_T >::getTowerIndex2DAtPosition ( const std::array< double, 3 > &  pos) const
inline

Returns the 2D index of the tower in the tower grid the given 3D coordinates are in.

If the location is outside of the domain, the tower nearest tower is returned.

  • Parameters
    posThe 3D coordinates
    Returns
    array<X, Y>
Todo:
this is a sanity check to prevent doubling of particles, but could be done better! e.g. by border and

◆ getTowers()

template<class Particle_T >
const std::vector< ClusterTower< Particle_T > > & autopas::internal::ClusterTowerBlock2D< Particle_T >::getTowers ( ) const
inline

Getter.

Returns

◆ getTowerSideLength()

template<class Particle_T >
const std::array< double, 2 > & autopas::internal::ClusterTowerBlock2D< Particle_T >::getTowerSideLength ( ) const
inline

Getter.

Returns

◆ getTowerSideLengthReciprocal()

template<class Particle_T >
const std::array< double, 2 > & autopas::internal::ClusterTowerBlock2D< Particle_T >::getTowerSideLengthReciprocal ( ) const
inline

Getter.

Returns

◆ getTowersPerDim()

template<class Particle_T >
const std::array< size_t, 2 > & autopas::internal::ClusterTowerBlock2D< Particle_T >::getTowersPerDim ( ) const
inline

Getter.

Returns

◆ getTowersRef()

template<class Particle_T >
std::vector< ClusterTower< Particle_T > > & autopas::internal::ClusterTowerBlock2D< Particle_T >::getTowersRef ( )
inline

Getter for a mutable reference.

Returns

◆ operator[]() [1/2]

template<class Particle_T >
ClusterTower< Particle_T > & autopas::internal::ClusterTowerBlock2D< Particle_T >::operator[] ( size_t  i)
inline

Access operator for towers.

Parameters
i1D tower index
Returns

◆ operator[]() [2/2]

template<class Particle_T >
const ClusterTower< Particle_T > & autopas::internal::ClusterTowerBlock2D< Particle_T >::operator[] ( size_t  i) const
inline

Access operator for towers.

Parameters
i1D tower index
Returns

◆ resize()

template<class Particle_T >
void autopas::internal::ClusterTowerBlock2D< Particle_T >::resize ( const std::array< double, 2 > &  towerSideLength,
const std::array< size_t, 2 > &  towersPerDim 
)
inline

Resize the internal grid and storage.

Parameters
towerSideLength
towersPerDim

◆ size()

template<class Particle_T >
size_t autopas::internal::ClusterTowerBlock2D< Particle_T >::size ( ) const
inline

Return the number of towers.

Returns

◆ towerIndex1DTo2D()

template<class Particle_T >
std::array< size_t, 2 > autopas::internal::ClusterTowerBlock2D< Particle_T >::towerIndex1DTo2D ( size_t  index) const
inline

Returns the 2D index for the given 1D index of a tower.

Parameters
index
Returns
the 2D index for the given 1D index of a tower.

◆ towerIndex2DTo1D()

template<class Particle_T >
size_t autopas::internal::ClusterTowerBlock2D< Particle_T >::towerIndex2DTo1D ( const size_t  x,
const size_t  y 
) const
inline

Returns the 1D index for the given 2D-coordinates of a tower.

Parameters
xThe x-coordinate of the tower.
yThe y-coordinate of the tower.
Returns
the 1D index for the given 2D-coordinates of a tower.

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