AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
|
Handles the non-geometric operations for our octree such as refinement, finding the parents and children of a node and determining whether a leaf node exists. More...
#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/v0.3.3/src/axom/spin/OctreeBase.hpp>
Classes | |
class | BlockIndex |
Inner class encapsulating the index of an octree block. More... | |
Public Types | |
using | CoordType = axom::IndexType |
using | GridPt = primal::Point< CoordType, DIM > |
using | GridVec = primal::Vector< CoordType, DIM > |
using | MAX_LEVEL_SIZE = slam::policies::CompileTimeSize< CoordType, std::numeric_limits< CoordType >::digits > |
using | OctreeLevels = slam::OrderedSet< CoordType, CoordType, MAX_LEVEL_SIZE > |
using | OctreeLevelType = OctreeLevel< DIM, BlockDataType > |
using | LeafIndicesLevelMap = slam::Map< slam::Set< CoordType, CoordType >, OctreeLevelType * > |
Public Member Functions | |
OctreeBase () | |
~OctreeBase () | |
OctreeBase destructor. More... | |
int | maxLeafLevel () const |
The max level for leaf blocks of the octree. More... | |
int | maxInternalLevel () const |
The max level for internal blocks of the octree. More... | |
OctreeLevelType & | getOctreeLevel (int lev) |
Accessor for a reference to the octree level instance at level lev. More... | |
const OctreeLevelType & | getOctreeLevel (int lev) const |
Const accessor for a reference to the octree level instance at level lev. More... | |
bool | isLevelValid (int lev) const |
Predicate to determine if level lev is in the range. More... | |
bool | isLeaf (const GridPt &pt, int lev) const |
Determine whether the octree contains a leaf block associated with grid point pt at level lev. More... | |
bool | isLeaf (const BlockIndex &block) const |
Determine whether the octree contains a leaf block associated with this BlockIndex. More... | |
bool | isInternal (const GridPt &pt, int lev) const |
Determine whether the octree contains an internal block associated with grid point pt at level lev. More... | |
bool | isInternal (const BlockIndex &block) const |
Determine whether the octree contains an internal block associated with this BlockIndex. More... | |
bool | hasBlock (const GridPt &pt, int lev) const |
Determine whether the octree contains a block (internal or leaf) associated with grid point pt at level lev. More... | |
bool | hasBlock (const BlockIndex &block) const |
Determine whether the octree contains a block (internal or leaf) associated with this BlockIndex. More... | |
bool | inBounds (const GridPt &pt, int lev) const |
Determine whether the octree block associated with grid point pt and level lev is a possible block in this octree. More... | |
bool | inBounds (const BlockIndex &block) const |
Determine whether the octree block associated with BlockIndex is a possible block in this octree. More... | |
void | refineLeaf (const BlockIndex &leafBlock) |
Refines the given leaf block in the octree. More... | |
BlockDataType & | operator[] (const BlockIndex &block) |
Accessor to the data associated with block. More... | |
const BlockDataType & | operator[] (const BlockIndex &block) const |
Const accessor to the data associated with block. More... | |
BlockIndex | coveringLeafBlock (const BlockIndex &blk, bool checkInBounds=true) const |
Finds the finest octree leaf covering BlockIndex blk. More... | |
BlockIndex | parent (const GridPt &pt, int level) const |
Finds the grid index and level of the current octree block's parent. More... | |
BlockIndex | parent (const BlockIndex &block) const |
Finds the BlockIndex of the given block's parent. More... | |
BlockIndex | child (const GridPt &pt, int level, int childIndex) const |
Finds the BlockIndex of the given block's child. More... | |
BlockIndex | child (const BlockIndex &block, int childIndex) const |
Finds the BlockIndex of the given block's child. More... | |
Static Public Member Functions | |
static CoordType | maxCoordAtLevel (int level) |
Utility function to find the number of (possible) grid cells at a given level or resolution. More... | |
static BlockIndex | root () |
Protected Member Functions | |
TreeBlockStatus | blockStatus (const GridPt &pt, int lev) const |
Helper function to determine the status of a BlockIndex within an octree instance. More... | |
TreeBlockStatus | blockStatus (const BlockIndex &blk) const |
Helper function to determine the status of a BlockIndex within an octree instance. More... | |
Protected Attributes | |
OctreeLevels | m_levels |
LeafIndicesLevelMap | m_leavesLevelMap |
Handles the non-geometric operations for our octree such as refinement, finding the parents and children of a node and determining whether a leaf node exists.
There are two concepts here: A set of nested dyadic integer grids – A grid at level n has 2^n cells in each of the DIM dimensions and an adaptive octree defined by a subset of the grid cells from these nested grids. The former is a conceptual aid in the sense that it is implicitly encoded.
An octree block at level l is refined by adding its 2^DIM children blocks at level (l+1). The root of the octree covers the entire domains and has no parent. The leaf blocks of the octree have no children. The interior of the children do not overlap, and their union covers that of their parent block. Non-leaf blocks are referred to as 'internal'
Requirements for BlockDataType: it must be default constructible and provide an isLeaf() predicate as well as a setInternal() function that changes its state from representing a leaf block to an internal block.
using axom::spin::OctreeBase< DIM, BlockDataType >::CoordType = axom::IndexType |
using axom::spin::OctreeBase< DIM, BlockDataType >::GridPt = primal::Point<CoordType,DIM> |
using axom::spin::OctreeBase< DIM, BlockDataType >::GridVec = primal::Vector<CoordType,DIM> |
using axom::spin::OctreeBase< DIM, BlockDataType >::MAX_LEVEL_SIZE = slam::policies::CompileTimeSize<CoordType, std::numeric_limits<CoordType>::digits> |
using axom::spin::OctreeBase< DIM, BlockDataType >::OctreeLevels = slam::OrderedSet<CoordType, CoordType, MAX_LEVEL_SIZE> |
using axom::spin::OctreeBase< DIM, BlockDataType >::OctreeLevelType = OctreeLevel<DIM, BlockDataType> |
using axom::spin::OctreeBase< DIM, BlockDataType >::LeafIndicesLevelMap = slam::Map<slam::Set<CoordType,CoordType>, OctreeLevelType*> |
|
inline |
Sets up an octree containing only the root block
|
inline |
OctreeBase destructor.
|
inline |
The max level for leaf blocks of the octree.
Referenced by axom::spin::SpatialOctree< DIM, InOutBlockData >::findLeafBlock().
|
inline |
The max level for internal blocks of the octree.
|
inlinestatic |
Utility function to find the number of (possible) grid cells at a given level or resolution.
[in] | level | The level or resolution. |
Referenced by axom::spin::SpatialOctree< DIM, InOutBlockData >::findGridCellAtLevel().
|
inlinestatic |
Auxiliary function to return the root of the octree
|
inline |
Finds the grid index and level of the current octree block's parent.
[in] | pt | The grid index of the block whose parent we want to find. |
[in] | level | The level of the block whose parent we want to find. |
|
inline |
Finds the BlockIndex of the given block's parent.
[in] | block | The block whose parent we want to find |
|
inline |
Finds the BlockIndex of the given block's child.
[in] | pt | The grid index of the block whose child we want to find. |
[in] | level | The level of the block whose child we want to find. |
[in] | childIndex | The index of the child to find |
|
inline |
Finds the BlockIndex of the given block's child.
[in] | block | The block whose child we want to find |
[in] | childIndex | The index of the child to find |
|
inline |
Accessor for a reference to the octree level instance at level lev.
|
inline |
Const accessor for a reference to the octree level instance at level lev.
|
inline |
Predicate to determine if level lev is in the range.
|
inline |
Determine whether the octree contains a leaf block associated with grid point pt at level lev.
[in] | pt | The grid point to check |
[in] | lev | The level of the grid point |
|
inline |
Determine whether the octree contains a leaf block associated with this BlockIndex.
[in] | block | The BlockIndex of the tree to check |
|
inline |
Determine whether the octree contains an internal block associated with grid point pt at level lev.
[in] | pt | The grid point to check |
[in] | lev | The level of the grid point |
|
inline |
Determine whether the octree contains an internal block associated with this BlockIndex.
[in] | block | The BlockIndex of the tree to check |
|
inline |
Determine whether the octree contains a block (internal or leaf) associated with grid point pt at level lev.
[in] | pt | The grid point to check |
[in] | lev | The level of the grid point |
|
inline |
Determine whether the octree contains a block (internal or leaf) associated with this BlockIndex.
[in] | block | The BlockIndex of the tree to check |
|
inline |
Determine whether the octree block associated with grid point pt and level lev is a possible block in this octree.
|
inline |
Determine whether the octree block associated with BlockIndex is a possible block in this octree.
|
inline |
Refines the given leaf block in the octree.
Marks leafBlock as internal (non-leaf) and adds its children to the tree
|
inline |
Accessor to the data associated with block.
block | A block (internal or leaf) in the tree |
|
inline |
Const accessor to the data associated with block.
block | A block (internal or leaf) in the tree |
|
inline |
Finds the finest octree leaf covering BlockIndex blk.
blk | A BlockIndex, not necessarily in the octree |
checkInBounds | A flag to determine if we should check that the block lies within the octree bounds (default=true) |
|
inlineprotected |
Helper function to determine the status of a BlockIndex within an octree instance.
pt | The grid point of the block index that we are testing |
lev | The level of the block index that we are testing |
Referenced by axom::spin::SpatialOctree< DIM, InOutBlockData >::findLeafBlock().
|
inlineprotected |
Helper function to determine the status of a BlockIndex within an octree instance.
blk | The block index we are testing |
|
protected |
|
protected |