This class wraps the functionality provided by the octree leaves and inner nodes in a structure that adheres to the ParticleCell concept.
More...
|
| OctreeNodeWrapper (const std::array< double, 3 > &boxMin, const std::array< double, 3 > &boxMax, int unsigned const treeSplitThreshold, double const interactionLength, double const cellSizeFactor) |
| Constructs a new, empty octree and stores the root.
|
|
void | collectAllParticles (StorageType &ps) |
| Append all particles in the octree to a list using DFS.
|
|
void | appendAllLeaves (std::vector< OctreeLeafNode< Particle_T > * > &leaves) |
| Append all leaves in the octree to a list.
|
|
void | addParticle (const Particle_T &p) override |
| Adds a Particle to the cell.
|
|
CellIterator< StorageType, true > | begin () |
| Get an iterator to the start of a ParticleCell.
|
|
CellIterator< StorageType, false > | begin () const |
| Get an iterator to the start of a ParticleCell.
|
|
CellIterator< StorageType, true > | end () |
| Get an iterator to the end of a ParticleCell.
|
|
CellIterator< StorageType, false > | end () const |
| Get an iterator to the end of a ParticleCell.
|
|
size_t | size () const override |
| Get the number of all particles stored in this cell (owned, halo and dummy).
|
|
size_t | getNumberOfParticles (IteratorBehavior behavior) const override |
| Get the number of particles with respect to the specified IteratorBehavior.
|
|
bool | isEmpty () const override |
| Check if the cell is not empty.
|
|
void | clear () override |
| Deletes all particles in this cell.
|
|
void | deleteDummyParticles () override |
| Deletes all dummy particles in this cell.
|
|
CellType | getParticleCellTypeAsEnum () override |
| Get the ParticleCell type as an ParticleCellTypeEnum.
|
|
bool | deleteParticle (Particle_T &particle) |
| Delete the given particle from the data structure.
|
|
void | deleteByIndex (size_t index) override |
| Deletes the index-th particle.
|
|
void | setCellLength (std::array< double, 3 > &cellLength) override |
| Set the side lengths of this cell.
|
|
std::array< double, 3 > | getCellLength () const override |
| Get the side lengths of this cell.
|
|
Particle_T & | at (size_t index) |
| Get a particle from the iterator.
|
|
const Particle_T & | at (size_t index) const |
| Get a particle from the iterator.
|
|
Particle_T & | operator[] (size_t index) |
| Get a particle from the iterator.
|
|
const Particle_T & | operator[] (size_t index) const |
| Get a particle from the iterator.
|
|
std::set< OctreeLeafNode< Particle_T > * > | getLeavesInRange (const std::array< double, 3 > &min, const std::array< double, 3 > &max) |
| Find all leaves below this subtree that are in the given range.
|
|
OctreeNodeInterface< Particle_T > * | getRaw () const |
| Get a raw pointer to the enclosed cell.
|
|
template<typename Lambda > |
void | forEach (Lambda forEachLambda) |
| Apply the forEach lambda to each particle.
|
|
template<typename Lambda , typename A > |
void | reduce (Lambda reduceLambda, A &result) |
| Apply the reduce lambda to each particle.
|
|
template<typename Lambda > |
void | forEachInRegion (Lambda forEachLambda, const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner) |
| Apply the forEach lambda to each particle in the region.
|
|
template<typename Lambda , typename A > |
void | reduceInRegion (Lambda reduceLambda, A &result, const std::array< double, 3 > &lowerCorner, const std::array< double, 3 > &higherCorner) |
| Apply the reduce lambda to each particle in the region.
|
|
Public Member Functions inherited from autopas::ParticleCell< Particle_T > |
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.
|
|
AutoPasLock & | getCellLock () const |
| Get a reference to the lock object for exclusive access to this cell.
|
|
template<typename Particle_T>
class autopas::OctreeNodeWrapper< Particle_T >
This class wraps the functionality provided by the octree leaves and inner nodes in a structure that adheres to the ParticleCell concept.
What this wrapper does is the following: It hides implementation details of the octree nodes that should not be exposed to the outside. (For instance, the OctreeNodeInterface::insert()
method has a very specific method signature that requires the caller to change the pointer to a subtree if necessary. Since the user should not care about this, it is wrapped in this class inside of the addParticle()
method. This method does not have to be treated special like insert()
.)
This class includes some proxy methods: appendAllParticles()
, appendAllLeaves()
and some more. Those methods only invoke similar functions on the pointer to an octree. This indirection could be removed by implementing the OctreeNodeInterface<Particle_T>
. However, if this class inherited directly from OctreeNodeInterface<Particle_T>
, it would have to implement the entire interface provided by OctreeNodeInterface<Particle_T>
. This does not increase the code quality, since one would have to implement other interface methods (like insert()
) that should not be exposed to the outside. Having proxy calls inside this class keeps the interface clean.
- Template Parameters
-
Particle_T | The particle class that should be used in the octree cell. |