11#ifndef EBGEOMETRY_OCTREE_HPP
12#define EBGEOMETRY_OCTREE_HPP
79template <
typename Meta,
typename Data =
void>
80class Node :
public std::enable_shared_from_this<Node<Meta, Data>>
171 [[
nodiscard]]
inline const std::array<std::shared_ptr<Node<Meta, Data>>, 8>&
282#include "EBGeometry_OctreeImplem.hpp"
Utility macros for EBGeometry.
Declaration of 2D and 3D point/vector classes with templated precision. Used with DCEL tools.
Octree class without anything special (this uses full tree representation rather than linear/pointerl...
Definition EBGeometry_Octree.hpp:81
std::function< void(std::array< std::shared_ptr< const Node< Meta, Data > >, 8 > &a_children)> ChildOrderer
ChildOrderer for traverse pattern. This is called on interior nodes for deciding which sub-tree to vi...
Definition EBGeometry_Octree.hpp:123
std::function< void(const Node< Meta, Data > &a_node)> LeafEvaluator
LeafEvaluator pattern for Node::traverse. This is called when visiting a leaf node.
Definition EBGeometry_Octree.hpp:110
void buildDepthFirst(const SplitFunction &a_splitFunction, const MetaConstructor &a_metaConstructor, const DataConstructor &a_dataConstructor) noexcept
Build the octree in depth-first order.
std::array< std::shared_ptr< Node< Meta, Data > >, 8 > m_children
Node children.
Definition EBGeometry_Octree.hpp:276
Node(const Node &a_other)=default
Copy constructor.
void traverse(const LeafEvaluator &a_leafEvaluator, const PrunePredicate &a_prunePredicate, const ChildOrderer &a_childOrderer=[](std::array< std::shared_ptr< const Node< Meta, Data > >, 8 > &) -> void { return;}) const noexcept
Traverse the tree.
std::function< bool(const Node< Meta, Data > &a_node)> SplitFunction
Predicate for deciding whether a leaf node should be subdivided further.
Definition EBGeometry_Octree.hpp:89
std::shared_ptr< Data > & getData() noexcept
Get node data.
void buildBreadthFirst(const SplitFunction &a_splitFunction, const MetaConstructor &a_metaConstructor, const DataConstructor &a_dataConstructor) noexcept
Build the octree in breadth-first order.
Node & operator=(Node &&a_other)=default
Move assignment.
Meta & getMetaData() noexcept
Get node meta-data.
std::function< Meta(const OctantIndex &a_index, const Meta &a_parentMeta)> MetaConstructor
For assigning meta-data to the child octs during the build process.
Definition EBGeometry_Octree.hpp:96
Meta m_meta
Meta-data for the node. This is typically the lower-left and upper-right corners of the node,...
Definition EBGeometry_Octree.hpp:266
std::function< bool(const Node< Meta, Data > &a_node)> PrunePredicate
PrunePredicate pattern for Node::traverse. This is called on interior and leaf nodes....
Definition EBGeometry_Octree.hpp:117
Node & operator=(const Node &a_other)=default
Copy assignment.
std::shared_ptr< Data > m_data
Node contents.
Definition EBGeometry_Octree.hpp:271
const std::array< std::shared_ptr< Node< Meta, Data > >, 8 > & getChildren() const noexcept
Get children.
bool isLeaf() const noexcept
Check if this is a leaf node.
Node(Node &&a_other)=default
Move constructor.
Node()=default
Default constructor. All children default-null (leaf node); m_meta and m_data are default-constructed...
~Node()=default
Destructor.
std::function< std::shared_ptr< Data >(const OctantIndex &a_index, const std::shared_ptr< Data > &a_parentData)> DataConstructor
For assigning data to child octs during the build process.
Definition EBGeometry_Octree.hpp:104
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:225
static constexpr Vec3T< T > ones() noexcept
Return a vector with x = y = z = 1.
constexpr std::array< Vec3T< T >, 8 > HighCorner
Upper-right corners of the octants on the unit cube, indexed lexicographically in x-y-z.
Definition EBGeometry_Octree.hpp:63
OctantIndex
Lexicographical x-y-z octant indexing.
Definition EBGeometry_Octree.hpp:35
constexpr std::array< Vec3T< T >, 8 > LowCorner
Lower-left corners of the octants on the unit cube, indexed lexicographically in x-y-z.
Definition EBGeometry_Octree.hpp:50
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:31