The base class that provides the necessary function definitions that can be applied to an octree. More...
#include <OctreeNodeInterface.h>
Public Member Functions | |
OctreeNodeInterface (const std::array< double, 3 > &boxMin, const std::array< double, 3 > &boxMax, OctreeNodeInterface< Particle_T > *parent, const int unsigned treeSplitThreshold, const double interactionLength, const double cellSizeFactor) | |
Create an octree node interface by initializing the given fields. | |
virtual | ~OctreeNodeInterface ()=default |
To make clang happy. | |
OctreeNodeInterface (const OctreeNodeInterface< Particle_T > &)=default | |
Default copy constructor. | |
virtual std::unique_ptr< OctreeNodeInterface< Particle_T > > | insert (const Particle_T &p)=0 |
Insert a particle into the octree. | |
virtual bool | deleteParticle (Particle_T &particle)=0 |
Delete the given particle from the data structure. | |
virtual void | collectAllParticles (std::vector< Particle_T * > &ps) const =0 |
Put all particles that are below this node into the vector. | |
virtual void | appendAllLeafBoxes (std::vector< std::pair< std::array< double, 3 >, std::array< double, 3 > > > &boxes) const =0 |
Put the min/max corner coordinates of every leaf into the vector. | |
virtual void | appendAllLeaves (std::vector< OctreeLeafNode< Particle_T > * > &leaves) const =0 |
Put all leaves below this subtree into a given list. | |
virtual void | clearChildren (std::unique_ptr< OctreeNodeInterface< Particle_T > > &ref)=0 |
Delete the entire tree below this node. | |
virtual size_t | size () const =0 |
Get the total number of particles saved in the container (owned + halo + dummy). | |
virtual size_t | getNumberOfParticles (IteratorBehavior behavior=IteratorBehavior::owned) const =0 |
Get the number of particles with respect to the specified IteratorBehavior. | |
virtual OctreeNodeInterface< Particle_T > * | SON (octree::Octant O)=0 |
Get a child node of this node (if there are children) given a specific octant using the spacial structure of the stored children. | |
virtual bool | hasChildren ()=0 |
Check if the node is a leaf or an inner node. | |
virtual OctreeNodeInterface< Particle_T > * | getChild (int index)=0 |
Get a child by its index from the node. | |
virtual std::set< OctreeLeafNode< Particle_T > * > | getLeavesInRange (const std::array< double, 3 > &min, const std::array< double, 3 > &max)=0 |
Find all leaves below this subtree that are in the given range. | |
bool | isInside (const std::array< double, 3 > &point) |
Check if a 3d point is inside the node's axis aligned bounding box. | |
bool | enclosesVolumeWithOtherOnAxis (const int axis, const OctreeNodeInterface< Particle_T > *other) |
Check if an octree node's box encloses volume with another octree node's box on a specific axis. | |
bool | overlapsBox (const std::array< double, 3 > &otherMin, const std::array< double, 3 > &otherMax) |
Check if the node's axis aligned bounding box overlaps with the given axis aligned bounding box. | |
double | getEnclosedVolumeWith (const std::array< double, 3 > &otherMin, const std::array< double, 3 > &otherMax) |
Calculate the overlap volume between the node's axis aligned bounding box and the given box. | |
OctreeNodeInterface< Particle_T > * | EQ_FACE_NEIGHBOR (const octree::Face I) |
Find a node (via the pointer structure) that is of equal size of the current node's bounding box, according to the Samet paper. | |
OctreeNodeInterface< Particle_T > * | EQ_EDGE_NEIGHBOR (const octree::Edge I) |
Find a node (via the pointer structure) that is of equal size of the current node's bounding box, according to the Samet paper. | |
OctreeNodeInterface< Particle_T > * | EQ_VERTEX_NEIGHBOR (const octree::Vertex I) |
Find a node (via the pointer structure) that is of equal size of the current node's bounding box, according to the Samet paper. | |
OctreeNodeInterface< Particle_T > * | GTEQ_FACE_NEIGHBOR (octree::Face I) |
Find a node (via the pointer structure) that is of greater than or equal to the size of the current node's bounding box, according to the Samet paper. | |
OctreeNodeInterface< Particle_T > * | GTEQ_EDGE_NEIGHBOR (octree::Edge I) |
Find a node (via the pointer structure) that is of greater than or equal to the size of the current node's bounding box, according to the Samet paper. | |
OctreeNodeInterface< Particle_T > * | GTEQ_VERTEX_NEIGHBOR (octree::Vertex I) |
Find a node (via the pointer structure) that is of greater than or equal to the size of the current node's bounding box, according to the Samet paper. | |
virtual std::vector< OctreeLeafNode< Particle_T > * > | getLeavesFromDirections (const std::vector< octree::Vertex > &directions)=0 |
Find all leaf nodes along a list of given directions. | |
std::vector< OctreeLeafNode< Particle_T > * > | getNeighborLeaves (const octree::Any direction) |
This function combines all required functions when traversing down a subtree of the octree and finding all leaves. | |
std::set< OctreeLeafNode< Particle_T > * > | getNeighborLeaves () |
Get the neighbor leaves in all directions. | |
const std::array< double, 3 > & | getBoxMin () const |
Get the minimum coordinate of the enclosing box. | |
const std::array< double, 3 > & | getBoxMax () const |
Get the maximum coordinate of the enclosing box. | |
OctreeNodeInterface< Particle_T > * | getParent () const |
Get the parent node of this node. | |
Static Public Member Functions | |
static bool | volumeExistsOnAxis (const int axis, const std::array< double, 3 > &aMin, const std::array< double, 3 > &aMax, const std::array< double, 3 > &bMin, const std::array< double, 3 > &bMax) |
Check if the volume enclosed by two boxes a and b is nonzero on a specific axis. | |
static double | getEnclosedVolumeWith (const std::array< double, 3 > &aMin, const std::array< double, 3 > &aMax, const std::array< double, 3 > &bMin, const std::array< double, 3 > &bMax) |
Get the enclosed volume between two boxes a and b. | |
Protected Member Functions | |
bool | hasParent () |
Check if this is not the root node. | |
Protected Attributes | |
OctreeNodeInterface< Particle_T > * | _parent |
A pointer to the parent node. | |
std::array< double, 3 > | _boxMin |
The min coordinate of the enclosed volume. | |
std::array< double, 3 > | _boxMax |
The max coordinate of the enclosed volume. | |
int unsigned | _treeSplitThreshold |
Maximum number of particles inside a leaf node before the leaf tries to split itself. | |
double | _interactionLength |
The minimum distance at which a force is considered nonzero, cutoff+skin. | |
double | _cellSizeFactor |
The cell size factor for this node. | |
The base class that provides the necessary function definitions that can be applied to an octree.
Particle_T |
|
inline |
Create an octree node interface by initializing the given fields.
boxMin | The minimum coordinate of the enclosing box |
boxMax | The maximum coordinate of the enclosing box |
parent | A pointer to the parent of this node, may be nullptr for the root. |
treeSplitThreshold | Maximum number of particles inside a leaf before it tries to split itself |
interactionLength | The minimum distance at which a force is considered nonzero, cutoff+skin. |
cellSizeFactor | The cell size factor |
|
pure virtual |
Put the min/max corner coordinates of every leaf into the vector.
boxes | A reference to the vector that should contain pairs of the min/max corner coordinates |
Implemented in autopas::OctreeInnerNode< Particle_T >, and autopas::OctreeLeafNode< Particle_T >.
|
pure virtual |
Put all leaves below this subtree into a given list.
leaves | A reference to the vector that should contain pointers to the leaves |
Implemented in autopas::OctreeInnerNode< Particle_T >, and autopas::OctreeLeafNode< Particle_T >.
|
pure virtual |
Delete the entire tree below this node.
ref | A reference that contains this node |
Implemented in autopas::OctreeInnerNode< Particle_T >, and autopas::OctreeLeafNode< Particle_T >.
|
pure virtual |
Put all particles that are below this node into the vector.
ps | A reference to the vector that should contain the particles after the operation |
Implemented in autopas::OctreeInnerNode< Particle_T >, and autopas::OctreeLeafNode< Particle_T >.
|
pure virtual |
Delete the given particle from the data structure.
This function does not change the tree layout if the node is empty after the operation.
particle |
Implemented in autopas::OctreeInnerNode< Particle_T >, and autopas::OctreeLeafNode< Particle_T >.
|
inline |
Check if an octree node's box encloses volume with another octree node's box on a specific axis.
axis | An axis index (0, 1 or 2) |
other | The octree node to check against. |
|
inline |
Find a node (via the pointer structure) that is of equal size of the current node's bounding box, according to the Samet paper.
This function searches along an edge.
I | The edge in which direction the search should find a node |
|
inline |
Find a node (via the pointer structure) that is of equal size of the current node's bounding box, according to the Samet paper.
This function searches along a face.
I | The face in which direction the search should find a node |
|
inline |
Find a node (via the pointer structure) that is of equal size of the current node's bounding box, according to the Samet paper.
This function searches along a vertex.
I | The face in which direction the search should find a node |
|
inline |
Get the maximum coordinate of the enclosing box.
|
inline |
Get the minimum coordinate of the enclosing box.
|
pure virtual |
Get a child by its index from the node.
index | The index of the child. Must be between 0 and 7 inclusive. |
Implemented in autopas::OctreeInnerNode< Particle_T >, and autopas::OctreeLeafNode< Particle_T >.
|
inlinestatic |
Get the enclosed volume between two boxes a and b.
aMin | The minimum coordinate of box a |
aMax | The maximum coordinate of box b |
bMin | The minimum coordinate of box a |
bMax | The maximum coordinate of box b |
|
inline |
Calculate the overlap volume between the node's axis aligned bounding box and the given box.
otherMin | The minimum coordinate of the other box |
otherMax | The maximum coordinate of the other box |
|
pure virtual |
Find all leaf nodes along a list of given directions.
directions | A list of allowed directions for traversal. |
Implemented in autopas::OctreeInnerNode< Particle_T >, and autopas::OctreeLeafNode< Particle_T >.
|
pure virtual |
Find all leaves below this subtree that are in the given range.
min | The minimum coordinate in 3D space of the query area |
max | The maximum coordinate in 3D space of the query area |
Implemented in autopas::OctreeInnerNode< Particle_T >, and autopas::OctreeLeafNode< Particle_T >.
|
inline |
Get the neighbor leaves in all directions.
|
inline |
This function combines all required functions when traversing down a subtree of the octree and finding all leaves.
direction | The "original" direction. The leaves will be found along the opposite direction. |
|
pure virtual |
Get the number of particles with respect to the specified IteratorBehavior.
behavior | Behavior of the iterator, see IteratorBehavior. |
Implemented in autopas::OctreeInnerNode< Particle_T >, and autopas::OctreeLeafNode< Particle_T >.
|
inline |
Get the parent node of this node.
OctreeNodeInterface< Particle_T > * autopas::OctreeNodeInterface< Particle_T >::GTEQ_EDGE_NEIGHBOR | ( | octree::Edge | I | ) |
Find a node (via the pointer structure) that is of greater than or equal to the size of the current node's bounding box, according to the Samet paper.
This function searches along an edge.
I | The edge in which direction the search should find a node |
OctreeNodeInterface< Particle_T > * autopas::OctreeNodeInterface< Particle_T >::GTEQ_FACE_NEIGHBOR | ( | octree::Face | I | ) |
Find a node (via the pointer structure) that is of greater than or equal to the size of the current node's bounding box, according to the Samet paper.
This function searches along a face.
I | The face in which direction the search should find a node |
OctreeNodeInterface< Particle_T > * autopas::OctreeNodeInterface< Particle_T >::GTEQ_VERTEX_NEIGHBOR | ( | octree::Vertex | I | ) |
Find a node (via the pointer structure) that is of greater than or equal to the size of the current node's bounding box, according to the Samet paper.
This function searches along a vertex.
I | The vertex in which direction the search should find a node |
|
pure virtual |
Check if the node is a leaf or an inner node.
Use this over dynamic_cast to distinguish node types. It is 20-50 times faster! https://stackoverflow.com/a/49296405/7019073
Implemented in autopas::OctreeInnerNode< Particle_T >, and autopas::OctreeLeafNode< Particle_T >.
|
inlineprotected |
Check if this is not the root node.
|
pure virtual |
Insert a particle into the octree.
p | The particle to insert |
Implemented in autopas::OctreeInnerNode< Particle_T >, and autopas::OctreeLeafNode< Particle_T >.
|
inline |
Check if a 3d point is inside the node's axis aligned bounding box.
(Set by the boxMin and boxMax fields.)
point | The node to test |
|
inline |
Check if the node's axis aligned bounding box overlaps with the given axis aligned bounding box.
otherMin | The minimum coordinate of the other box |
otherMax | The maximum coordinate of the other box |
|
pure virtual |
Get the total number of particles saved in the container (owned + halo + dummy).
Implemented in autopas::OctreeInnerNode< Particle_T >, and autopas::OctreeLeafNode< Particle_T >.
|
pure virtual |
Get a child node of this node (if there are children) given a specific octant using the spacial structure of the stored children.
O | The octant |
Implemented in autopas::OctreeLeafNode< Particle_T >, and autopas::OctreeInnerNode< Particle_T >.
|
inlinestatic |
Check if the volume enclosed by two boxes a and b is nonzero on a specific axis.
axis | An axis index (0, 1 or 2) |
aMin | The minimum coordinate of a's volume |
aMax | The maximum coordinate of a's volume |
bMin | The minimum coordinate of b's volume |
bMax | The maximum coordinate of b's volume |
|
protected |
A pointer to the parent node.
Can be nullptr (iff this is the root node).