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

Class that manages a block of ParticleCells. More...

#include <CellBlock3D.h>

Inheritance diagram for autopas::internal::CellBlock3D< ParticleCell >:
Inheritance graph
[legend]
Collaboration diagram for autopas::internal::CellBlock3D< ParticleCell >:
Collaboration graph
[legend]

Public Types

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

Public Member Functions

 CellBlock3D (std::vector< ParticleCell > &vec, const std::array< double, 3 > &bMin, const std::array< double, 3 > &bMax, double interactionLength, double cellSizeFactor=1.0)
 Constructor of CellBlock3D.
 
 CellBlock3D (const CellBlock3D &)=delete
 Deleted copy constructor.
 
CellBlock3Doperator= (const CellBlock3D)=delete
 Deleted assignment operator.
 
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.
 
ParticleCellgetCell (index_t index1d) const
 get the ParticleCell of a specified 1d index.
 
ParticleCellgetCell (const std::array< index_t, 3 > &index3d) const
 Get the ParticleCell of a specified 3d index.
 
void reserve (size_t numParticles)
 Reserve memory for a given number of particles.
 
void rebuild (std::vector< ParticleCell > &vec, const std::array< double, 3 > &bMin, const std::array< double, 3 > &bMax, double interactionLength, double cellSizeFactor)
 Rebuild the cell block.
 
ParticleCellgetContainingCell (const std::array< double, 3 > &pos) const
 Get the containing cell of a specified position.
 
std::pair< std::array< double, 3 >, std::array< double, 3 > > getCellBoundingBox (index_t index1d) const
 Get the lower and upper corner of the cell at the 1d index index1d.
 
std::pair< std::array< double, 3 >, std::array< double, 3 > > getCellBoundingBox (const std::array< index_t, 3 > &index3d) const
 Get the lower and upper corner of the cell at the 3d index index3d.
 
std::array< index_t, 3 > get3DIndexOfPosition (const std::array< double, 3 > &pos) const
 Get the 3d index of the cell block for a given position.
 
index_t get1DIndexOfPosition (const std::array< double, 3 > &pos) const
 Get the 1d index of the cell block for a given position.
 
const std::array< index_t, 3 > & getCellsPerDimensionWithHalo () const
 Get the dimension of the cell block including the halo boxes.
 
bool checkInHalo (const std::array< double, 3 > &position) const
 Checks whether a given position is inside the halo region of the managed cell block.
 
void clearHaloCells ()
 Deletes all particles in the halo cells of the managed cell block.
 
std::vector< ParticleCell * > getNearbyHaloCells (const std::array< double, 3 > &position, double allowedDistance) const
 Get the halo cells around a given point.
 
const std::array< double, 3 > & getHaloBoxMin () const
 Get the lower corner of the halo region.
 
const std::array< double, 3 > & getHaloBoxMax () const
 Get the upper corner of the halo region.
 
unsigned long getCellsPerInteractionLength () const
 Get the number of cells per interaction length.
 
const std::array< double, 3 > & getCellLength () const
 Get the cell lengths.
 
index_t getNumCells () const
 Get the number of cells in this block.
 
index_t getFirstOwnedCellIndex () const
 1D id of the first cell that is not in the halo.
 
index_t getLastOwnedCellIndex () const
 1D id of the last cell before there are only halo cells left.
 
- 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.
 

Detailed Description

template<class ParticleCell>
class autopas::internal::CellBlock3D< ParticleCell >

Class that manages a block of ParticleCells.

It is used to resize the cell block and to handle the conversion of 3d to 1d indices.

Template Parameters
ParticleCellType of the handled ParticleCells.

Constructor & Destructor Documentation

◆ CellBlock3D()

template<class ParticleCell >
autopas::internal::CellBlock3D< ParticleCell >::CellBlock3D ( std::vector< ParticleCell > &  vec,
const std::array< double, 3 > &  bMin,
const std::array< double, 3 > &  bMax,
double  interactionLength,
double  cellSizeFactor = 1.0 
)
inline

Constructor of CellBlock3D.

Parameters
vecVector of ParticleCells that this class manages.
bMinLower corner of the cell block.
bMaxHigher corner of the cell block.
interactionLengthMax. radius of interaction between particles.
cellSizeFactorCell size factor relative to interactionLength.

Member Function Documentation

◆ cellCanContainHaloParticles()

template<class ParticleCell >
bool autopas::internal::CellBlock3D< ParticleCell >::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 ParticleCell >
bool autopas::internal::CellBlock3D< ParticleCell >::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.

◆ checkInHalo()

template<class ParticleCell >
bool autopas::internal::CellBlock3D< ParticleCell >::checkInHalo ( const std::array< double, 3 > &  position) const

Checks whether a given position is inside the halo region of the managed cell block.

Parameters
positionThe given position.
Returns
true if the position is inside the halo region.

◆ get1DIndexOfPosition()

template<class ParticleCell >
CellBlock3D< ParticleCell >::index_t autopas::internal::CellBlock3D< ParticleCell >::get1DIndexOfPosition ( const std::array< double, 3 > &  pos) const
inline

Get the 1d index of the cell block for a given position.

Parameters
posthe position of interest.
Returns
The 1d cell index.

◆ get3DIndexOfPosition()

template<class ParticleCell >
std::array< typename CellBlock3D< ParticleCell >::index_t, 3 > autopas::internal::CellBlock3D< ParticleCell >::get3DIndexOfPosition ( const std::array< double, 3 > &  pos) const
inline

Get the 3d index of the cell block for a given position.

Note
If pos is outside the domain the returned 3d index is also outside the domain.
Parameters
posThe position of interest.
Returns
The 3d cell index,

◆ getCell() [1/2]

template<class ParticleCell >
ParticleCell & autopas::internal::CellBlock3D< ParticleCell >::getCell ( const std::array< index_t, 3 > &  index3d) const
inline

Get the ParticleCell of a specified 3d index.

Parameters
index3dThe 3D index of the cell.
Returns
Non-const cell reference.

◆ getCell() [2/2]

template<class ParticleCell >
ParticleCell & autopas::internal::CellBlock3D< ParticleCell >::getCell ( index_t  index1d) const
inline

get the ParticleCell of a specified 1d index.

Parameters
index1dThe 1D index of the cell.
Returns
Non-const cell reference.

◆ getCellBoundingBox() [1/2]

template<class ParticleCell >
std::pair< std::array< double, 3 >, std::array< double, 3 > > autopas::internal::CellBlock3D< ParticleCell >::getCellBoundingBox ( const std::array< index_t, 3 > &  index3d) const
inline

Get the lower and upper corner of the cell at the 3d index index3d.

Parameters
index3dThe 3d cell index.
Returns
std::pair of boxMin (lower corner) and boxMax (upper corner) of the box.

◆ getCellBoundingBox() [2/2]

template<class ParticleCell >
std::pair< std::array< double, 3 >, std::array< double, 3 > > autopas::internal::CellBlock3D< ParticleCell >::getCellBoundingBox ( index_t  index1d) const
inline

Get the lower and upper corner of the cell at the 1d index index1d.

Parameters
index1dThe 1d cell index.
Returns
std::pair of boxMin (lower corner) and boxMax (upper corner) of the box.

◆ getCellLength()

template<class ParticleCell >
const std::array< double, 3 > & autopas::internal::CellBlock3D< ParticleCell >::getCellLength ( ) const
inline

Get the cell lengths.

Returns
Array of cell lengths.

◆ getCellsPerDimensionWithHalo()

template<class ParticleCell >
const std::array< index_t, 3 > & autopas::internal::CellBlock3D< ParticleCell >::getCellsPerDimensionWithHalo ( ) const
inline

Get the dimension of the cell block including the halo boxes.

Returns
The dimensions of the cell block.

◆ getCellsPerInteractionLength()

template<class ParticleCell >
unsigned long autopas::internal::CellBlock3D< ParticleCell >::getCellsPerInteractionLength ( ) const
inline

Get the number of cells per interaction length.

Returns
Cells per interaction length.

◆ getContainingCell()

template<class ParticleCell >
ParticleCell & autopas::internal::CellBlock3D< ParticleCell >::getContainingCell ( const std::array< double, 3 > &  pos) const
inline

Get the containing cell of a specified position.

Note
If pos is outside the domain vector->operator[]() will trigger undefined behavior.
Parameters
posThe position for which the cell is needed.
Returns
Cell at the given position.

◆ getFirstOwnedCellIndex()

1D id of the first cell that is not in the halo.

Returns

◆ getHaloBoxMax()

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

Get the upper corner of the halo region.

Returns
Coordinates of the upper corner.

◆ getHaloBoxMin()

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

Get the lower corner of the halo region.

Returns
Coordinates of the lower corner.

◆ getLastOwnedCellIndex()

1D id of the last cell before there are only halo cells left.

Returns

◆ getNearbyHaloCells()

template<class ParticleCell >
std::vector< ParticleCell * > autopas::internal::CellBlock3D< ParticleCell >::getNearbyHaloCells ( const std::array< double, 3 > &  position,
double  allowedDistance 
) const
inline

Get the halo cells around a given point.

Returns a list of halo cells that are at least partially within allowedDistance of the given position. If position is inside a halo cell that cell is also returned.

Note
The 1 norm is used, i.e. the distance is computed for each dimension separately, aka. Manhattan distance)
Parameters
positionCells close to this position are to be returned.
allowedDistanceThe maximal distance to the position.
Returns
A vector of references to nearby halo cells.

◆ getNumCells()

Get the number of cells in this block.

Returns

◆ operator=()

template<class ParticleCell >
CellBlock3D & autopas::internal::CellBlock3D< ParticleCell >::operator= ( const CellBlock3D< ParticleCell )
delete

Deleted assignment operator.

Returns

◆ rebuild()

template<class ParticleCell >
void autopas::internal::CellBlock3D< ParticleCell >::rebuild ( std::vector< ParticleCell > &  vec,
const std::array< double, 3 > &  bMin,
const std::array< double, 3 > &  bMax,
double  interactionLength,
double  cellSizeFactor 
)
inline

Rebuild the cell block.

This resizes the cell block and sets the appropriate internal variables.

Parameters
vecNew vector of ParticleCells to which the internal pointer is set.
bMinNew lower corner of the cell block.
bMaxNew higher corner of the cell block.
interactionLengthMax. radius of interaction between particles.
cellSizeFactorCell size factor relative to interactionLength.

◆ reserve()

template<class ParticleCell >
void autopas::internal::CellBlock3D< ParticleCell >::reserve ( size_t  numParticles)

Reserve memory for a given number of particles.

Parameters
numParticlesParticles incl. halo particles.

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