|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
Octree class without anything special (this uses full tree representation rather than linear/pointerless). More...
#include <EBGeometry_Octree.hpp>


Public Types | |
| using | SplitFunction = std::function< bool(const Node< Meta, Data > &a_node)> |
| Predicate for deciding whether a leaf node should be subdivided further. | |
| using | MetaConstructor = std::function< Meta(const OctantIndex &a_index, const Meta &a_parentMeta)> |
| For assigning meta-data to the child octs during the build process. | |
| using | DataConstructor = std::function< std::shared_ptr< Data >(const OctantIndex &a_index, const std::shared_ptr< Data > &a_parentData)> |
| For assigning data to child octs during the build process. | |
| using | LeafEvaluator = std::function< void(const Node< Meta, Data > &a_node)> |
| LeafEvaluator pattern for Node::traverse. This is called when visiting a leaf node. | |
| using | PrunePredicate = std::function< bool(const Node< Meta, Data > &a_node)> |
| PrunePredicate pattern for Node::traverse. This is called on interior and leaf nodes. Must return true if we should query the node and false otherwise. | |
| using | ChildOrderer = std::function< void(std::array< std::shared_ptr< const Node< Meta, Data > >, 8 > &a_children)> |
| ChildOrderer for traverse pattern. This is called on interior nodes for deciding which sub-tree to visit first. | |
Public Member Functions | |
| Node ()=default | |
| Default constructor. All children default-null (leaf node); m_meta and m_data are default-constructed. | |
| Node (const Node &a_other)=default | |
| Copy constructor. | |
| Node (Node &&a_other)=default | |
| Move constructor. | |
| ~Node ()=default | |
| Destructor. | |
| Node & | operator= (const Node &a_other)=default |
| Copy assignment. | |
| Node & | operator= (Node &&a_other)=default |
| Move assignment. | |
| const std::array< std::shared_ptr< Node< Meta, Data > >, 8 > & | getChildren () const noexcept |
| Get children. | |
| std::array< std::shared_ptr< Node< Meta, Data > >, 8 > & | getChildren () noexcept |
| Get children. | |
| Meta & | getMetaData () noexcept |
| Get node meta-data. | |
| const Meta & | getMetaData () const noexcept |
| Get node meta-data. | |
| std::shared_ptr< Data > & | getData () noexcept |
| Get node data. | |
| const std::shared_ptr< Data > & | getData () const noexcept |
| Get node data. | |
| bool | isLeaf () const noexcept |
| Check if this is a leaf node. | |
| void | buildDepthFirst (const SplitFunction &a_splitFunction, const MetaConstructor &a_metaConstructor, const DataConstructor &a_dataConstructor) noexcept |
| Build the octree in depth-first order. | |
| void | buildBreadthFirst (const SplitFunction &a_splitFunction, const MetaConstructor &a_metaConstructor, const DataConstructor &a_dataConstructor) noexcept |
| Build the octree in breadth-first order. | |
| 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. | |
Protected Attributes | |
| Meta | m_meta |
| Meta-data for the node. This is typically the lower-left and upper-right corners of the node, but it's the users' responsibility to fill this with the meta-information they need for the tree. | |
| std::shared_ptr< Data > | m_data |
| Node contents. | |
| std::array< std::shared_ptr< Node< Meta, Data > >, 8 > | m_children |
| Node children. | |
Octree class without anything special (this uses full tree representation rather than linear/pointerless).
Meta is the meta-data for the node (user can put in e.g. level, volume, etc) and Data is the leaf node contents.
| Meta | Meta-data type stored in every node (e.g. an AABB or level index). |
| Data | Payload type stored at leaf nodes. |
| using EBGeometry::Octree::Node< Meta, Data >::ChildOrderer = std::function<void(std::array<std::shared_ptr<const Node<Meta, Data> >, 8>& a_children)> |
ChildOrderer for traverse pattern. This is called on interior nodes for deciding which sub-tree to visit first.
| [in,out] | a_children | Sortable children nodes, first node is visited first, then the second, etc. |
| using EBGeometry::Octree::Node< Meta, Data >::DataConstructor = std::function<std::shared_ptr<Data>(const OctantIndex& a_index, const std::shared_ptr<Data>& a_parentData)> |
For assigning data to child octs during the build process.
| [in] | a_index | Octant index |
| [in] | a_parentData | Parent data. |
| using EBGeometry::Octree::Node< Meta, Data >::LeafEvaluator = std::function<void(const Node<Meta, Data>& a_node)> |
LeafEvaluator pattern for Node::traverse. This is called when visiting a leaf node.
| [in] | a_node | Leaf node that is visited. |
| using EBGeometry::Octree::Node< Meta, Data >::MetaConstructor = std::function<Meta(const OctantIndex& a_index, const Meta& a_parentMeta)> |
For assigning meta-data to the child octs during the build process.
| [in] | a_index | Octant index |
| [in] | a_parentMeta | Parent meta data |
| using EBGeometry::Octree::Node< Meta, Data >::PrunePredicate = std::function<bool(const Node<Meta, Data>& a_node)> |
PrunePredicate pattern for Node::traverse. This is called on interior and leaf nodes. Must return true if we should query the node and false otherwise.
| [in] | a_node | Node to visit or not. |
| using EBGeometry::Octree::Node< Meta, Data >::SplitFunction = std::function<bool(const Node<Meta, Data>& a_node)> |
Predicate for deciding whether a leaf node should be subdivided further.
Called on each leaf node during tree construction. Returns true if the node should be split into eight children, false if it should remain a leaf.
| [in] | a_node | Leaf node under consideration. |
Copy constructor.
Shallow copy: the copy shares ownership of a_other's children and data (standard std::shared_ptr semantics) rather than deep-cloning the subtree.
| [in] | a_other | Other node. |
Move constructor.
| [in,out] | a_other | Other node. |
|
inlinenoexcept |
Build the octree in breadth-first order.
Must be called on a leaf node; calling it on an interior node is a no-op (with a diagnostic printed to stderr). All three callables must be non-empty (callable). Since this uses shared_from_this() internally, the node must already be owned by a std::shared_ptr (see the class-level
| [in] | a_splitFunction | Predicate returning true if a leaf node should be split further. |
| [in] | a_metaConstructor | Constructor for node meta-data. |
| [in] | a_dataConstructor | Constructor for node data. |
|
inlinenoexcept |
Build the octree in depth-first order.
Must be called on a leaf node; calling it on an interior node is a no-op (with a diagnostic printed to stderr). All three callables must be non-empty (callable).
| [in] | a_splitFunction | Predicate returning true if a leaf node should be split further. |
| [in] | a_metaConstructor | Constructor for node meta-data. |
| [in] | a_dataConstructor | Constructor for node data. |
|
inlinenoexcept |
Get children.
|
inlinenoexcept |
Get children.
|
inlinenoexcept |
Get node data.
|
inlinenoexcept |
Get node data.
|
inlinenoexcept |
Get node meta-data.
|
inlinenoexcept |
Get node meta-data.
|
inlinenoexcept |
Check if this is a leaf node.
|
default |
Copy assignment.
See the copy constructor for the shallow-copy semantics.
| [in] | a_other | Other node. |
Move assignment.
| [in,out] | a_other | Other node. |
|
inlinenoexcept |
Traverse the tree.
Since this uses shared_from_this() internally, the node must already be owned by a std::shared_ptr (see the class-level
| [in] | a_leafEvaluator | LeafEvaluator when visiting leaf nodes. |
| [in] | a_prunePredicate | PrunePredicate for deciding to visit a node. |
| [in] | a_childOrderer | ChildOrderer method for deciding which subtree to investigate first. |