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

Class for Cells of Particles. More...

#include <ParticleCell.h>

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

Public Types

using ParticleType = Particle_T
 The particle type for this cell.
 

Public Member Functions

virtual ~ParticleCell ()=default
 Default destructor.
 
 ParticleCell ()=default
 Default default constructor.
 
 ParticleCell (ParticleCell &&other) noexcept=default
 Default move constructor.
 
 ParticleCell (const ParticleCell &other)
 Copy constructor that creates a new default constructed lock for the new cell.
 
virtual void addParticle (const Particle_T &p)=0
 Adds a Particle to the cell.
 
virtual size_t size () const =0
 Get the number of all particles stored in this cell (owned, halo and dummy).
 
virtual size_t getNumberOfParticles (IteratorBehavior behavior=IteratorBehavior::owned) const =0
 Get the number of particles with respect to the specified IteratorBehavior.
 
virtual bool isEmpty () const =0
 Check if the cell is empty.
 
virtual void clear ()=0
 Deletes all particles in this cell.
 
virtual void deleteDummyParticles ()=0
 Deletes all dummy particles in this cell.
 
virtual CellType getParticleCellTypeAsEnum ()=0
 Get the ParticleCell type as an ParticleCellTypeEnum.
 
virtual void deleteByIndex (size_t index)=0
 Deletes the index-th particle.
 
virtual void setCellLength (std::array< double, 3 > &cellLength)=0
 Set the side lengths of this cell.
 
virtual std::array< double, 3 > getCellLength () const =0
 Get the side lengths of this cell.
 
OwnershipState getPossibleParticleOwnerships () const
 Get the type of particles contained in this cell.
 
void setPossibleParticleOwnerships (OwnershipState state)
 Set the type of particles contained in this cell.
 
AutoPasLockgetCellLock () const
 Get a reference to the lock object for exclusive access to this cell.
 

Protected Attributes

AutoPasLock _cellLock {}
 Lock object for exclusive access to this cell.
 
OwnershipState _ownershipState {autopas::OwnershipState::owned | autopas::OwnershipState::halo}
 The particles which can be contained in this cell are determined by the OwnershipState.
 
bool _ownershipStateDefined {false}
 Flag that is set to true once OwnershipState has been set to avoid resetting the OwnershipState.
 

Detailed Description

template<class Particle_T>
class autopas::ParticleCell< Particle_T >

Class for Cells of Particles.

The class handles to storage particles and provides an interface to add the particles

Template Parameters
Particle_Tthe type of particles to be stored in the cells
Iteratorthe type of the iterator iterate through the particles in this cell

Member Typedef Documentation

◆ ParticleType

template<class Particle_T >
using autopas::ParticleCell< Particle_T >::ParticleType = Particle_T

The particle type for this cell.

Used to refer to the Particle_T typename for an instantiation of ParticleCell.

Constructor & Destructor Documentation

◆ ParticleCell() [1/2]

template<class Particle_T >
autopas::ParticleCell< Particle_T >::ParticleCell ( ParticleCell< Particle_T > &&  other)
defaultnoexcept

Default move constructor.

Parameters
other

◆ ParticleCell() [2/2]

template<class Particle_T >
autopas::ParticleCell< Particle_T >::ParticleCell ( const ParticleCell< Particle_T > &  other)
inline

Copy constructor that creates a new default constructed lock for the new cell.

Parameters
other

Member Function Documentation

◆ addParticle()

template<class Particle_T >
virtual void autopas::ParticleCell< Particle_T >::addParticle ( const Particle_T &  p)
pure virtual

◆ clear()

template<class Particle_T >
virtual void autopas::ParticleCell< Particle_T >::clear ( )
pure virtual

◆ deleteByIndex()

template<class Particle_T >
virtual void autopas::ParticleCell< Particle_T >::deleteByIndex ( size_t  index)
pure virtual

◆ deleteDummyParticles()

template<class Particle_T >
virtual void autopas::ParticleCell< Particle_T >::deleteDummyParticles ( )
pure virtual

◆ getCellLength()

template<class Particle_T >
virtual std::array< double, 3 > autopas::ParticleCell< Particle_T >::getCellLength ( ) const
pure virtual

◆ getCellLock()

template<class Particle_T >
AutoPasLock & autopas::ParticleCell< Particle_T >::getCellLock ( ) const
inline

Get a reference to the lock object for exclusive access to this cell.

Returns
reference to the cell lock

◆ getNumberOfParticles()

template<class Particle_T >
virtual size_t autopas::ParticleCell< Particle_T >::getNumberOfParticles ( IteratorBehavior  behavior = IteratorBehavior::owned) const
pure virtual

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.

Implemented in autopas::FullParticleCell< Particle_T >, autopas::ReferenceParticleCell< Particle_T >, autopas::SortedCellView< ParticleCellType >, autopas::OctreeLeafNode< Particle_T >, and autopas::OctreeNodeWrapper< Particle_T >.

◆ getParticleCellTypeAsEnum()

template<class Particle_T >
virtual CellType autopas::ParticleCell< Particle_T >::getParticleCellTypeAsEnum ( )
pure virtual

◆ getPossibleParticleOwnerships()

template<class Particle_T >
OwnershipState autopas::ParticleCell< Particle_T >::getPossibleParticleOwnerships ( ) const
inline

Get the type of particles contained in this cell.

Possible values: dummy: this cell is empty owned: this cell can ONLY contain owned particles halo: this cell can ONLY contain halo particles ownedOrHalo: this cell can contain owned or halo particles

Returns
type of particles inside this cell

◆ isEmpty()

template<class Particle_T >
virtual bool autopas::ParticleCell< Particle_T >::isEmpty ( ) const
pure virtual

◆ setCellLength()

template<class Particle_T >
virtual void autopas::ParticleCell< Particle_T >::setCellLength ( std::array< double, 3 > &  cellLength)
pure virtual

◆ setPossibleParticleOwnerships()

template<class Particle_T >
void autopas::ParticleCell< Particle_T >::setPossibleParticleOwnerships ( OwnershipState  state)
inline

Set the type of particles contained in this cell.

Possible values: dummy: this cell is empty owned: this cell can ONLY contain owned particles halo: this cell can ONLY contain halo particles ownedOrHalo: this cell can contain owned or halo particles

Note
: At the moment an ownership of a cell can only be set once.
Parameters
statetype of particles inside this cell

◆ size()

template<class Particle_T >
virtual size_t autopas::ParticleCell< Particle_T >::size ( ) const
pure virtual

Get the number of all particles stored in this cell (owned, halo and dummy).

Returns
number of particles stored in this cell (owned, halo and dummy).

Implemented in autopas::FullParticleCell< Particle_T >, autopas::ReferenceParticleCell< Particle_T >, autopas::SortedCellView< ParticleCellType >, autopas::OctreeLeafNode< Particle_T >, autopas::OctreeNodeWrapper< Particle_T >, and autopas::internal::ClusterTower< Particle_T >.

Member Data Documentation

◆ _cellLock

template<class Particle_T >
AutoPasLock autopas::ParticleCell< Particle_T >::_cellLock {}
mutableprotected

Lock object for exclusive access to this cell.

This lock has to be mutable since it is set in getNumberOfParticles() const.


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