EBGeometry
1.0
|
Octree class without anything special (this uses full tree representation rather than linear/pointerless). More...
#include <EBGeometry_Octree.hpp>
Public Types | |
using | StopFunction = std::function< bool(const Node< Meta, Data > &a_node)> |
Function for deciding whether or not to split a node. More... | |
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. More... | |
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. More... | |
using | Updater = std::function< void(const Node< Meta, Data > &a_node)> |
Updater pattern for Node::traverse. This is called when visiting a leaf node. More... | |
using | Visiter = std::function< bool(const Node< Meta, Data > &a_node)> |
Visiter pattern for Node::traverse. This is called on interior and leaf nodes. Must return true if we should query the node and false otherwise. More... | |
using | Sorter = std::function< void(std::array< std::shared_ptr< const Node< Meta, Data > >, 8 > &a_children)> |
Sorter for traverse pattern. This is called on interior nodes for deciding which sub-tree to visit first. More... | |
Public Member Functions | |
Node () | |
Default constructor. | |
virtual | ~Node () |
Destructor. | |
const std::array< std::shared_ptr< Node< Meta, Data > >, 8 > & | getChildren () const noexcept |
Get children. More... | |
std::array< std::shared_ptr< Node< Meta, Data > >, 8 > & | getChildren () noexcept |
Get children. More... | |
Meta & | getMetaData () noexcept |
Get node meta-data. More... | |
const Meta & | getMetaData () const noexcept |
Get node meta-data. More... | |
std::shared_ptr< Data > & | getData () noexcept |
Get node data. More... | |
const std::shared_ptr< Data > & | getData () const noexcept |
Get node data. More... | |
bool | isLeaf () const noexcept |
Check if this is a leaf node. | |
void | buildDepthFirst (const StopFunction &a_stopFunction, const MetaConstructor &a_metaConstructor, const DataConstructor &a_dataConstructor) noexcept |
Build the octree in depth-first order. User decides if the node should be split, and how to split it. More... | |
void | buildBreadthFirst (const StopFunction &a_stopFunction, const MetaConstructor &a_metaConstructor, const DataConstructor &a_dataConstructor) noexcept |
Build the octree in breadth-first order. User decides if the node should be split, and how to split it. More... | |
void | traverse (const Updater &a_updater, const Visiter &a_visiter, const Sorter &a_sorter=[](std::array< std::shared_ptr< const Node< Meta, Data >>, 8 > &a_children) -> void { return;}) const noexcept |
Traverse the tree. More... | |
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.
using 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 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 Octree::Node< Meta, Data >::Sorter = std::function<void(std::array<std::shared_ptr<const Node<Meta, Data> >, 8>& a_children)> |
Sorter 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 Octree::Node< Meta, Data >::StopFunction = std::function<bool(const Node<Meta, Data>& a_node)> |
Function for deciding whether or not to split a node.
This is called on leaf nodes – if the function returns true the node will be split.
[in] | a_node | Node to split. |
using Octree::Node< Meta, Data >::Updater = std::function<void(const Node<Meta, Data>& a_node)> |
Updater pattern for Node::traverse. This is called when visiting a leaf node.
[in] | a_node | Leaf node that is visited. |
using Octree::Node< Meta, Data >::Visiter = std::function<bool(const Node<Meta, Data>& a_node)> |
Visiter 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. |
|
inlinenoexcept |
Build the octree in breadth-first order. User decides if the node should be split, and how to split it.
[in] | a_stopFunction | Function for deciding whether or not to split a node. |
[in] | a_metaConstructor | Constructor for node meta-data |
[in] | a_dataConstructor | Constructor for node data |
|
inlinenoexcept |
Build the octree in depth-first order. User decides if the node should be split, and how to split it.
[in] | a_stopFunction | Function for deciding whether or not to split a node. |
[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 |
Traverse the tree.
[in] | a_updater | Updater when visiting leaf nodes. |
[in] | a_visiter | Visiter for deciding to visit a node. |
[in] | a_sorter | Sorter method for deciding which subtree to investigate first. |