HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType > Class Template Reference

#include <RootNode.h>

Classes

struct  SameConfiguration
 SameConfiguration<OtherNodeType>::value is true if and only if OtherNodeType is the type of a RootNode whose ChildNodeType has the same configuration as this node's ChildNodeType. More...
 
struct  ValueConverter
 ValueConverter<T>::Type is the type of a RootNode having the same child hierarchy as this node but a different value type, T. More...
 

Public Types

typedef ChildType ChildNodeType
 
typedef ChildType::LeafNodeType LeafNodeType
 
typedef ChildType::ValueType ValueType
 
typedef ChildType::BuildType BuildType
 
typedef NodeChain< RootNode,
LEVEL >::Type 
NodeChainType
 NodeChainType is a list of this tree's node types, from LeafNodeType to RootNode. More...
 
typedef ChildIter< RootNode,
MapIter, ChildOnPred,
ChildType > 
ChildOnIter
 
typedef ChildIter< const
RootNode, MapCIter,
ChildOnPred, const ChildType > 
ChildOnCIter
 
typedef ValueIter< RootNode,
MapIter, ChildOffPred, const
ValueType
ChildOffIter
 
typedef ValueIter< const
RootNode, MapCIter,
ChildOffPred, ValueType
ChildOffCIter
 
typedef DenseIter< RootNode,
MapIter, ChildType, ValueType
ChildAllIter
 
typedef DenseIter< const
RootNode, MapCIter, const
ChildType, const ValueType
ChildAllCIter
 
typedef ValueIter< RootNode,
MapIter, ValueOnPred,
ValueType
ValueOnIter
 
typedef ValueIter< const
RootNode, MapCIter,
ValueOnPred, const ValueType
ValueOnCIter
 
typedef ValueIter< RootNode,
MapIter, ValueOffPred,
ValueType
ValueOffIter
 
typedef ValueIter< const
RootNode, MapCIter,
ValueOffPred, const ValueType
ValueOffCIter
 
typedef ValueIter< RootNode,
MapIter, ValueAllPred,
ValueType
ValueAllIter
 
typedef ValueIter< const
RootNode, MapCIter,
ValueAllPred, const ValueType
ValueAllCIter
 

Public Member Functions

 HBOOST_STATIC_ASSERT (hboost::mpl::size< NodeChainType >::value==LEVEL+1)
 
 RootNode ()
 Construct a new tree with a background value of 0. More...
 
 RootNode (const ValueType &background)
 Construct a new tree with the given background value. More...
 
 RootNode (const RootNode &other)
 
template<typename OtherChildType >
 RootNode (const RootNode< OtherChildType > &other)
 Construct a new tree that reproduces the topology and active states of a tree of a different ValueType but the same configuration (levels, node dimensions and branching factors). Cast the other tree's values to this tree's ValueType. More...
 
template<typename OtherChildType >
 RootNode (const RootNode< OtherChildType > &other, const ValueType &background, const ValueType &foreground, TopologyCopy)
 Construct a new tree that reproduces the topology and active states of another tree (which may have a different ValueType), but not the other tree's values. More...
 
template<typename OtherChildType >
 RootNode (const RootNode< OtherChildType > &other, const ValueType &background, TopologyCopy)
 Construct a new tree that reproduces the topology and active states of another tree (which may have a different ValueType), but not the other tree's values. All tiles and voxels in the new tree are set to background regardless of their active states in the other tree. More...
 
RootNodeoperator= (const RootNode &other)
 Copy a root node of the same type as this node. More...
 
template<typename OtherChildType >
RootNodeoperator= (const RootNode< OtherChildType > &other)
 Copy a root node of the same tree configuration as this node but a different ValueType. More...
 
 ~RootNode ()
 
ChildOnCIter cbeginChildOn () const
 
ChildOffCIter cbeginChildOff () const
 
ChildAllCIter cbeginChildAll () const
 
ChildOnCIter beginChildOn () const
 
ChildOffCIter beginChildOff () const
 
ChildAllCIter beginChildAll () const
 
ChildOnIter beginChildOn ()
 
ChildOffIter beginChildOff ()
 
ChildAllIter beginChildAll ()
 
ValueOnCIter cbeginValueOn () const
 
ValueOffCIter cbeginValueOff () const
 
ValueAllCIter cbeginValueAll () const
 
ValueOnCIter beginValueOn () const
 
ValueOffCIter beginValueOff () const
 
ValueAllCIter beginValueAll () const
 
ValueOnIter beginValueOn ()
 
ValueOffIter beginValueOff ()
 
ValueAllIter beginValueAll ()
 
Index64 memUsage () const
 Return the total amount of memory in bytes occupied by this node and its children. More...
 
void evalActiveBoundingBox (CoordBBox &bbox, bool visitVoxels=true) const
 Expand the specified bbox so it includes the active tiles of this root node as well as all the active values in its child nodes. If visitVoxels is false LeafNodes will be approximated as dense, i.e. with all voxels active. Else the individual active voxels are visited to produce a tight bbox. More...
 
void setBackground (const ValueType &value, bool updateChildNodes)
 Change inactive tiles or voxels with a value equal to +/- the old background to the specified value (with the same sign). Active values are unchanged. More...
 
const ValueTypebackground () const
 Return this node's background value. More...
 
bool isBackgroundTile (const Tile &) const
 Return true if the given tile is inactive and has the background value. More...
 
size_t numBackgroundTiles () const
 Return the number of background tiles. More...
 
size_t eraseBackgroundTiles ()
 Remove all background tiles. More...
 
void clear ()
 
bool empty () const
 Return true if this node's table is either empty or contains only background tiles. More...
 
bool expand (const Coord &xyz)
 Expand this node's table so that (x, y, z) is included in the index range. More...
 
Index getTableSize () const
 Return the number of entries in this node's table. More...
 
Index getWidth () const
 
Index getHeight () const
 
Index getDepth () const
 
Coord getMinIndex () const
 Return the smallest index of the current tree. More...
 
Coord getMaxIndex () const
 Return the largest index of the current tree. More...
 
void getIndexRange (CoordBBox &bbox) const
 Return the current index range. Both min and max are inclusive. More...
 
template<typename OtherChildType >
bool hasSameTopology (const RootNode< OtherChildType > &other) const
 Return true if the given tree has the same node and active value topology as this tree (but possibly a different ValueType). More...
 
Index32 leafCount () const
 
Index32 nonLeafCount () const
 
Index64 onVoxelCount () const
 
Index64 offVoxelCount () const
 
Index64 onLeafVoxelCount () const
 
Index64 offLeafVoxelCount () const
 
Index64 onTileCount () const
 
bool isValueOn (const Coord &xyz) const
 
bool hasActiveTiles () const
 Return true if this root node, or any of its child nodes, have active tiles. More...
 
const ValueTypegetValue (const Coord &xyz) const
 
bool probeValue (const Coord &xyz, ValueType &value) const
 
int getValueDepth (const Coord &xyz) const
 Return the tree depth (0 = root) at which the value of voxel (x, y, z) resides. More...
 
void setActiveState (const Coord &xyz, bool on)
 Set the active state of the voxel at the given coordinates but don't change its value. More...
 
void setValueOnly (const Coord &xyz, const ValueType &value)
 Set the value of the voxel at the given coordinates but don't change its active state. More...
 
void setValueOn (const Coord &xyz, const ValueType &value)
 Set the value of the voxel at the given coordinates and mark the voxel as active. More...
 
void setValueOff (const Coord &xyz)
 Mark the voxel at the given coordinates as inactive but don't change its value. More...
 
void setValueOff (const Coord &xyz, const ValueType &value)
 Set the value of the voxel at the given coordinates and mark the voxel as inactive. More...
 
template<typename ModifyOp >
void modifyValue (const Coord &xyz, const ModifyOp &op)
 Apply a functor to the value of the voxel at the given coordinates and mark the voxel as active. More...
 
template<typename ModifyOp >
void modifyValueAndActiveState (const Coord &xyz, const ModifyOp &op)
 Apply a functor to the voxel at the given coordinates. More...
 
void denseFill (const CoordBBox &bbox, const ValueType &value, bool active=true)
 Set all voxels within a given axis-aligned box to a constant value. More...
 
template<typename DenseT >
void copyToDense (const CoordBBox &bbox, DenseT &dense) const
 Copy into a dense grid the values of all voxels, both active and inactive, that intersect a given bounding box. More...
 
bool writeTopology (std::ostream &, bool toHalf=false) const
 
bool readTopology (std::istream &, bool fromHalf=false)
 
void writeBuffers (std::ostream &, bool toHalf=false) const
 
void readBuffers (std::istream &, bool fromHalf=false)
 
void readBuffers (std::istream &, const CoordBBox &, bool fromHalf=false)
 
template<typename AccessorT >
const ValueTypegetValueAndCache (const Coord &xyz, AccessorT &) const
 
template<typename AccessorT >
bool isValueOnAndCache (const Coord &xyz, AccessorT &) const
 
template<typename AccessorT >
void setValueAndCache (const Coord &xyz, const ValueType &value, AccessorT &)
 
template<typename AccessorT >
void setValueOnlyAndCache (const Coord &xyz, const ValueType &value, AccessorT &)
 
template<typename ModifyOp , typename AccessorT >
void modifyValueAndCache (const Coord &xyz, const ModifyOp &op, AccessorT &)
 
template<typename ModifyOp , typename AccessorT >
void modifyValueAndActiveStateAndCache (const Coord &xyz, const ModifyOp &op, AccessorT &)
 
template<typename AccessorT >
void setValueOffAndCache (const Coord &xyz, const ValueType &value, AccessorT &)
 
template<typename AccessorT >
void setActiveStateAndCache (const Coord &xyz, bool on, AccessorT &)
 
template<typename AccessorT >
bool probeValueAndCache (const Coord &xyz, ValueType &value, AccessorT &) const
 
template<typename AccessorT >
int getValueDepthAndCache (const Coord &xyz, AccessorT &) const
 
void clip (const CoordBBox &)
 Set all voxels that lie outside the given axis-aligned box to the background. More...
 
void prune (const ValueType &tolerance=zeroVal< ValueType >())
 Reduce the memory footprint of this tree by replacing with tiles any nodes whose values are all the same (optionally to within a tolerance) and have the same active state. More...
 
void addLeaf (LeafNodeType *leaf)
 Add the given leaf node to this tree, creating a new branch if necessary. If a leaf node with the same origin already exists, replace it. More...
 
template<typename AccessorT >
void addLeafAndCache (LeafNodeType *leaf, AccessorT &)
 Same as addLeaf() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate. More...
 
template<typename NodeT >
NodeT * stealNode (const Coord &xyz, const ValueType &value, bool state)
 Return a pointer to the node of type NodeT that contains voxel (x, y, z) and replace it with a tile of the specified value and state. If no such node exists, leave the tree unchanged and return nullptr. More...
 
void addTile (const Coord &xyz, const ValueType &value, bool state)
 Add a tile containing voxel (x, y, z) at the root level, deleting the existing branch if necessary. More...
 
void addTile (Index level, const Coord &xyz, const ValueType &value, bool state)
 Add a tile containing voxel (x, y, z) at the specified tree level, creating a new branch if necessary. Delete any existing lower-level nodes that contain (x, y, z). More...
 
template<typename AccessorT >
void addTileAndCache (Index level, const Coord &xyz, const ValueType &, bool state, AccessorT &)
 Same as addTile() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate. More...
 
LeafNodeTypetouchLeaf (const Coord &xyz)
 Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, create one that preserves the values and active states of all voxels. More...
 
template<typename AccessorT >
LeafNodeTypetouchLeafAndCache (const Coord &xyz, AccessorT &acc)
 Same as touchLeaf() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate. More...
 
void voxelizeActiveTiles (bool threaded=true)
 Densify active tiles, i.e., replace them with leaf-level active voxels. More...
 
template<MergePolicy Policy>
void merge (RootNode &other)
 Efficiently merge another tree into this tree using one of several schemes. More...
 
template<typename OtherChildType >
void topologyUnion (const RootNode< OtherChildType > &other)
 Union this tree's set of active values with the active values of the other tree, whose ValueType may be different. More...
 
template<typename OtherChildType >
void topologyIntersection (const RootNode< OtherChildType > &other)
 Intersects this tree's set of active values with the active values of the other tree, whose ValueType may be different. More...
 
template<typename OtherChildType >
void topologyDifference (const RootNode< OtherChildType > &other)
 Difference this tree's set of active values with the active values of the other tree, whose ValueType may be different. So a resulting voxel will be active only if the original voxel is active in this tree and inactive in the other tree. More...
 
template<typename CombineOp >
void combine (RootNode &other, CombineOp &, bool prune=false)
 
template<typename CombineOp , typename OtherRootNode >
void combine2 (const RootNode &other0, const OtherRootNode &other1, CombineOp &op, bool prune=false)
 
template<typename BBoxOp >
void visitActiveBBox (BBoxOp &) const
 Call the templated functor BBoxOp with bounding box information for all active tiles and leaf nodes in the tree. An additional level argument is provided for each callback. More...
 
template<typename VisitorOp >
void visit (VisitorOp &)
 
template<typename VisitorOp >
void visit (VisitorOp &) const
 
template<typename OtherRootNodeType , typename VisitorOp >
void visit2 (OtherRootNodeType &other, VisitorOp &)
 
template<typename OtherRootNodeType , typename VisitorOp >
void visit2 (OtherRootNodeType &other, VisitorOp &) const
 
template<typename OtherChildType >
RootNode< ChildT > & operator= (const RootNode< OtherChildType > &other)
 
template<typename AccessorT >
const ChildT::ValueType & getValueAndCache (const Coord &xyz, AccessorT &acc) const
 
template<typename AccessorT >
ChildT::LeafNodeType * touchLeafAndCache (const Coord &xyz, AccessorT &acc)
 
template<typename AccessorT >
ChildT::LeafNodeType * probeLeafAndCache (const Coord &xyz, AccessorT &acc)
 
template<typename AccessorT >
const ChildT::LeafNodeType * probeConstLeafAndCache (const Coord &xyz, AccessorT &acc) const
 
template<typename AccessorT >
const ChildT::LeafNodeType * probeLeafAndCache (const Coord &xyz, AccessorT &acc) const
 
bool isBackgroundTile (const MapIter &) const
 Return true if the given iterator points to an inactive tile with the background value. More...
 
bool isBackgroundTile (const MapCIter &) const
 Return true if the given iterator points to an inactive tile with the background value. More...
 
void fill (const CoordBBox &bbox, const ValueType &value, bool active=true)
 Set all voxels within a given axis-aligned box to a constant value. More...
 
void sparseFill (const CoordBBox &bbox, const ValueType &value, bool active=true)
 Set all voxels within a given axis-aligned box to a constant value. More...
 
template<typename NodeT >
NodeT * probeNode (const Coord &xyz)
 Return a pointer to the node that contains voxel (x, y, z). If no such node exists, return nullptr. More...
 
template<typename NodeT >
const NodeT * probeConstNode (const Coord &xyz) const
 Return a pointer to the node that contains voxel (x, y, z). If no such node exists, return nullptr. More...
 
template<typename NodeT , typename AccessorT >
NodeT * probeNodeAndCache (const Coord &xyz, AccessorT &acc)
 Same as probeNode() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate. More...
 
template<typename NodeT , typename AccessorT >
const NodeT * probeConstNodeAndCache (const Coord &xyz, AccessorT &acc) const
 Same as probeNode() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate. More...
 
LeafNodeTypeprobeLeaf (const Coord &xyz)
 Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, return nullptr. More...
 
const LeafNodeTypeprobeConstLeaf (const Coord &xyz) const
 Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, return nullptr. More...
 
const LeafNodeTypeprobeLeaf (const Coord &xyz) const
 Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, return nullptr. More...
 
template<typename AccessorT >
LeafNodeTypeprobeLeafAndCache (const Coord &xyz, AccessorT &acc)
 Same as probeLeaf() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate. More...
 
template<typename AccessorT >
const LeafNodeTypeprobeConstLeafAndCache (const Coord &xyz, AccessorT &acc) const
 Same as probeLeaf() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate. More...
 
template<typename AccessorT >
const LeafNodeTypeprobeLeafAndCache (const Coord &xyz, AccessorT &acc) const
 Same as probeLeaf() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate. More...
 
template<typename ArrayT >
void getNodes (ArrayT &array)
 Adds all nodes of a certain type to a container with the following API: More...
 
template<typename ArrayT >
void getNodes (ArrayT &array) const
 Adds all nodes of a certain type to a container with the following API: More...
 
template<typename ArrayT >
void stealNodes (ArrayT &array, const ValueType &value, bool state)
 Steals all nodes of a certain type from the tree and adds them to a container with the following API: More...
 
template<typename ArrayT >
void stealNodes (ArrayT &array)
 Steals all nodes of a certain type from the tree and adds them to a container with the following API: More...
 

Static Public Member Functions

static CoordBBox getNodeBoundingBox ()
 Return the bounding box of this RootNode, i.e., an infinite bounding box. More...
 
static Index getLevel ()
 
static void getNodeLog2Dims (std::vector< Index > &dims)
 
static Index getChildDim ()
 
template<typename OtherChildType >
static bool hasSameConfiguration (const RootNode< OtherChildType > &other)
 Return false if the other node's dimensions don't match this node's. More...
 
template<typename OtherChildType >
static bool hasCompatibleValueType (const RootNode< OtherChildType > &other)
 

Static Public Attributes

static const Index LEVEL = 1 + ChildType::LEVEL
 

Friends

template<typename >
class RootNode
 
template<typename , typename , bool >
struct RootNodeCopyHelper
 
template<typename , typename , typename , bool >
struct RootNodeCombineHelper
 

Detailed Description

template<typename ChildType>
class openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >

Definition at line 75 of file RootNode.h.

Member Typedef Documentation

template<typename ChildType>
typedef ChildType::BuildType openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::BuildType

Definition at line 81 of file RootNode.h.

template<typename ChildType>
typedef DenseIter<const RootNode, MapCIter, const ChildType, const ValueType> openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::ChildAllCIter

Definition at line 401 of file RootNode.h.

template<typename ChildType>
typedef DenseIter<RootNode, MapIter, ChildType, ValueType> openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::ChildAllIter

Definition at line 400 of file RootNode.h.

template<typename ChildType>
typedef ChildType openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::ChildNodeType

Definition at line 78 of file RootNode.h.

template<typename ChildType>
typedef ValueIter<const RootNode, MapCIter, ChildOffPred, ValueType> openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::ChildOffCIter

Definition at line 399 of file RootNode.h.

template<typename ChildType>
typedef ValueIter<RootNode, MapIter, ChildOffPred, const ValueType> openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::ChildOffIter

Definition at line 398 of file RootNode.h.

template<typename ChildType>
typedef ChildIter<const RootNode, MapCIter, ChildOnPred, const ChildType> openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::ChildOnCIter

Definition at line 397 of file RootNode.h.

template<typename ChildType>
typedef ChildIter<RootNode, MapIter, ChildOnPred, ChildType> openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::ChildOnIter

Definition at line 396 of file RootNode.h.

template<typename ChildType>
typedef ChildType::LeafNodeType openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::LeafNodeType

Definition at line 79 of file RootNode.h.

template<typename ChildType>
typedef NodeChain<RootNode, LEVEL>::Type openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::NodeChainType

NodeChainType is a list of this tree's node types, from LeafNodeType to RootNode.

Definition at line 86 of file RootNode.h.

template<typename ChildType>
typedef ValueIter<const RootNode, MapCIter, ValueAllPred, const ValueType> openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::ValueAllCIter

Definition at line 408 of file RootNode.h.

template<typename ChildType>
typedef ValueIter<RootNode, MapIter, ValueAllPred, ValueType> openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::ValueAllIter

Definition at line 407 of file RootNode.h.

template<typename ChildType>
typedef ValueIter<const RootNode, MapCIter, ValueOffPred, const ValueType> openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::ValueOffCIter

Definition at line 406 of file RootNode.h.

template<typename ChildType>
typedef ValueIter<RootNode, MapIter, ValueOffPred, ValueType> openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::ValueOffIter

Definition at line 405 of file RootNode.h.

template<typename ChildType>
typedef ValueIter<const RootNode, MapCIter, ValueOnPred, const ValueType> openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::ValueOnCIter

Definition at line 404 of file RootNode.h.

template<typename ChildType>
typedef ValueIter<RootNode, MapIter, ValueOnPred, ValueType> openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::ValueOnIter

Definition at line 403 of file RootNode.h.

template<typename ChildType>
typedef ChildType::ValueType openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::ValueType

Definition at line 80 of file RootNode.h.

Constructor & Destructor Documentation

template<typename ChildT >
openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::RootNode ( )
inline

Construct a new tree with a background value of 0.

Definition at line 1053 of file RootNode.h.

template<typename ChildT >
openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::RootNode ( const ValueType background)
inlineexplicit

Construct a new tree with the given background value.

Definition at line 1061 of file RootNode.h.

template<typename ChildType>
openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::RootNode ( const RootNode< ChildType > &  other)
inline

Definition at line 111 of file RootNode.h.

template<typename ChildType>
template<typename OtherChildType >
openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::RootNode ( const RootNode< OtherChildType > &  other)
inlineexplicit

Construct a new tree that reproduces the topology and active states of a tree of a different ValueType but the same configuration (levels, node dimensions and branching factors). Cast the other tree's values to this tree's ValueType.

Exceptions
TypeErrorif the other tree's configuration doesn't match this tree's or if this tree's ValueType is not constructible from the other tree's ValueType.

Definition at line 120 of file RootNode.h.

template<typename ChildT >
template<typename OtherChildType >
openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::RootNode ( const RootNode< OtherChildType > &  other,
const ValueType background,
const ValueType foreground,
TopologyCopy   
)
inline

Construct a new tree that reproduces the topology and active states of another tree (which may have a different ValueType), but not the other tree's values.

All tiles and voxels that are active in the other tree are set to foreground in the new tree, and all inactive tiles and voxels are set to background.

Parameters
otherthe root node of a tree having (possibly) a different ValueType
backgroundthe value to which inactive tiles and voxels are initialized
foregroundthe value to which active tiles and voxels are initialized
Exceptions
TypeErrorif the other tree's configuration doesn't match this tree's.

Definition at line 1070 of file RootNode.h.

template<typename ChildT >
template<typename OtherChildType >
openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::RootNode ( const RootNode< OtherChildType > &  other,
const ValueType background,
TopologyCopy   
)
inline

Construct a new tree that reproduces the topology and active states of another tree (which may have a different ValueType), but not the other tree's values. All tiles and voxels in the new tree are set to background regardless of their active states in the other tree.

Parameters
otherthe root node of a tree having (possibly) a different ValueType
backgroundthe value to which inactive tiles and voxels are initialized
Note
This copy constructor is generally faster than the one that takes both a foreground and a background value. Its main application is in multithreaded operations where the topology of the output tree exactly matches the input tree.
Exceptions
TypeErrorif the other tree's configuration doesn't match this tree's.

Definition at line 1092 of file RootNode.h.

template<typename ChildType>
openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::~RootNode ( )
inline

Definition at line 159 of file RootNode.h.

Member Function Documentation

template<typename ChildT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::addLeaf ( LeafNodeType leaf)
inline

Add the given leaf node to this tree, creating a new branch if necessary. If a leaf node with the same origin already exists, replace it.

Definition at line 2464 of file RootNode.h.

template<typename ChildT >
template<typename AccessorT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::addLeafAndCache ( LeafNodeType leaf,
AccessorT &  acc 
)
inline

Same as addLeaf() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.

Definition at line 2499 of file RootNode.h.

template<typename ChildT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::addTile ( const Coord &  xyz,
const ValueType value,
bool  state 
)
inline

Add a tile containing voxel (x, y, z) at the root level, deleting the existing branch if necessary.

Definition at line 2533 of file RootNode.h.

template<typename ChildT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::addTile ( Index  level,
const Coord &  xyz,
const ValueType value,
bool  state 
)
inline

Add a tile containing voxel (x, y, z) at the specified tree level, creating a new branch if necessary. Delete any existing lower-level nodes that contain (x, y, z).

Definition at line 2545 of file RootNode.h.

template<typename ChildT >
template<typename AccessorT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::addTileAndCache ( Index  level,
const Coord &  xyz,
const ValueType value,
bool  state,
AccessorT &  acc 
)
inline

Same as addTile() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.

Definition at line 2580 of file RootNode.h.

template<typename ChildType>
const ValueType& openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::background ( ) const
inline

Return this node's background value.

Definition at line 459 of file RootNode.h.

template<typename ChildType>
ChildAllCIter openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::beginChildAll ( ) const
inline

Definition at line 416 of file RootNode.h.

template<typename ChildType>
ChildAllIter openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::beginChildAll ( )
inline

Definition at line 419 of file RootNode.h.

template<typename ChildType>
ChildOffCIter openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::beginChildOff ( ) const
inline

Definition at line 415 of file RootNode.h.

template<typename ChildType>
ChildOffIter openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::beginChildOff ( )
inline

Definition at line 418 of file RootNode.h.

template<typename ChildType>
ChildOnCIter openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::beginChildOn ( ) const
inline

Definition at line 414 of file RootNode.h.

template<typename ChildType>
ChildOnIter openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::beginChildOn ( )
inline

Definition at line 417 of file RootNode.h.

template<typename ChildType>
ValueAllCIter openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::beginValueAll ( ) const
inline

Definition at line 426 of file RootNode.h.

template<typename ChildType>
ValueAllIter openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::beginValueAll ( )
inline

Definition at line 429 of file RootNode.h.

template<typename ChildType>
ValueOffCIter openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::beginValueOff ( ) const
inline

Definition at line 425 of file RootNode.h.

template<typename ChildType>
ValueOffIter openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::beginValueOff ( )
inline

Definition at line 428 of file RootNode.h.

template<typename ChildType>
ValueOnCIter openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::beginValueOn ( ) const
inline

Definition at line 424 of file RootNode.h.

template<typename ChildType>
ValueOnIter openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::beginValueOn ( )
inline

Definition at line 427 of file RootNode.h.

template<typename ChildType>
ChildAllCIter openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::cbeginChildAll ( ) const
inline

Definition at line 413 of file RootNode.h.

template<typename ChildType>
ChildOffCIter openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::cbeginChildOff ( ) const
inline

Definition at line 412 of file RootNode.h.

template<typename ChildType>
ChildOnCIter openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::cbeginChildOn ( ) const
inline

Definition at line 411 of file RootNode.h.

template<typename ChildType>
ValueAllCIter openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::cbeginValueAll ( ) const
inline

Definition at line 423 of file RootNode.h.

template<typename ChildType>
ValueOffCIter openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::cbeginValueOff ( ) const
inline

Definition at line 422 of file RootNode.h.

template<typename ChildType>
ValueOnCIter openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::cbeginValueOn ( ) const
inline

Definition at line 421 of file RootNode.h.

template<typename ChildT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::clear ( void  )
inline

Definition at line 1481 of file RootNode.h.

template<typename ChildT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::clip ( const CoordBBox &  clipBBox)
inline

Set all voxels that lie outside the given axis-aligned box to the background.

Definition at line 2384 of file RootNode.h.

template<typename ChildT >
template<typename CombineOp >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::combine ( RootNode< ChildType > &  other,
CombineOp &  op,
bool  prune = false 
)
inline

Definition at line 3117 of file RootNode.h.

template<typename ChildT >
template<typename CombineOp , typename OtherRootNode >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::combine2 ( const RootNode< ChildType > &  other0,
const OtherRootNode< ChildType > &  other1,
CombineOp &  op,
bool  prune = false 
)
inline

Definition at line 3207 of file RootNode.h.

template<typename ChildT >
template<typename DenseT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::copyToDense ( const CoordBBox &  bbox,
DenseT &  dense 
) const
inline

Copy into a dense grid the values of all voxels, both active and inactive, that intersect a given bounding box.

Parameters
bboxinclusive bounding box of the voxels to be copied into the dense grid
densedense grid with a stride in z of one (see tools::Dense in tools/Dense.h for the required API)

Definition at line 2146 of file RootNode.h.

template<typename ChildT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::denseFill ( const CoordBBox &  bbox,
const ValueType value,
bool  active = true 
)
inline

Set all voxels within a given axis-aligned box to a constant value.

Parameters
bboxinclusive coordinates of opposite corners of an axis-aligned box.
valuethe value to which to set voxels within the box.
activeif true, mark voxels within the box as active, otherwise mark them as inactive.
Note
This operation generates a dense representation of the filled box. This implies that active tiles are voxelized, i.e. only active voxels are generated from this fill operation.

Definition at line 2137 of file RootNode.h.

template<typename ChildType>
bool openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::empty ( void  ) const
inline

Return true if this node's table is either empty or contains only background tiles.

Definition at line 477 of file RootNode.h.

template<typename ChildT >
size_t openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::eraseBackgroundTiles ( )
inline

Remove all background tiles.

Returns
the number of tiles removed.

Definition at line 1271 of file RootNode.h.

template<typename ChildT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::evalActiveBoundingBox ( CoordBBox &  bbox,
bool  visitVoxels = true 
) const
inline

Expand the specified bbox so it includes the active tiles of this root node as well as all the active values in its child nodes. If visitVoxels is false LeafNodes will be approximated as dense, i.e. with all voxels active. Else the individual active voxels are visited to produce a tight bbox.

Definition at line 1492 of file RootNode.h.

template<typename ChildT >
bool openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::expand ( const Coord &  xyz)
inline

Expand this node's table so that (x, y, z) is included in the index range.

Returns
true if an expansion was performed (i.e., if (x, y, z) was not already included in the index range).

Definition at line 1310 of file RootNode.h.

template<typename ChildT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::fill ( const CoordBBox &  bbox,
const ValueType value,
bool  active = true 
)
inline

Set all voxels within a given axis-aligned box to a constant value.

Parameters
bboxinclusive coordinates of opposite corners of an axis-aligned box
valuethe value to which to set voxels within the box
activeif true, mark voxels within the box as active, otherwise mark them as inactive
Note
This operation generates a sparse, but not always optimally sparse, representation of the filled box. Follow fill operations with a prune() operation for optimal sparseness.

Definition at line 2082 of file RootNode.h.

template<typename ChildType>
static Index openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::getChildDim ( )
inlinestatic

Definition at line 486 of file RootNode.h.

template<typename ChildType>
Index openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::getDepth ( ) const
inline

Definition at line 493 of file RootNode.h.

template<typename ChildType>
Index openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::getHeight ( ) const
inline

Definition at line 492 of file RootNode.h.

template<typename ChildT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::getIndexRange ( CoordBBox &  bbox) const
inline

Return the current index range. Both min and max are inclusive.

Definition at line 1348 of file RootNode.h.

template<typename ChildType>
static Index openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::getLevel ( )
inlinestatic

Definition at line 484 of file RootNode.h.

template<typename ChildT >
Coord openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::getMaxIndex ( ) const
inline

Return the largest index of the current tree.

Definition at line 1340 of file RootNode.h.

template<typename ChildT >
Coord openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::getMinIndex ( ) const
inline

Return the smallest index of the current tree.

Definition at line 1333 of file RootNode.h.

template<typename ChildType>
static CoordBBox openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::getNodeBoundingBox ( )
inlinestatic

Return the bounding box of this RootNode, i.e., an infinite bounding box.

Definition at line 442 of file RootNode.h.

template<typename ChildT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::getNodeLog2Dims ( std::vector< Index > &  dims)
inlinestatic

Definition at line 1324 of file RootNode.h.

template<typename ChildT >
template<typename ArrayT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::getNodes ( ArrayT &  array)
inline

Adds all nodes of a certain type to a container with the following API:

struct ArrayT {
typedef value_type;// defines the type of nodes to be added to the array
void push_back(value_type nodePtr);// method that add nodes to the array
};

An example of a wrapper around a c-style array is:

struct MyArray {
typedef LeafType* value_type;
MyArray(value_type* array) : ptr(array) {}
void push_back(value_type leaf) { *ptr++ = leaf; }
};

An example that constructs a list of pointer to all leaf nodes is:

std::vector<const LeafNodeType*> array;//most std contains have the required API
array.reserve(tree.leafCount());//this is a fast preallocation.
tree.getNodes(array);

Definition at line 2784 of file RootNode.h.

template<typename ChildT >
template<typename ArrayT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::getNodes ( ArrayT &  array) const
inline

Adds all nodes of a certain type to a container with the following API:

struct ArrayT {
typedef value_type;// defines the type of nodes to be added to the array
void push_back(value_type nodePtr);// method that add nodes to the array
};

An example of a wrapper around a c-style array is:

struct MyArray {
typedef LeafType* value_type;
MyArray(value_type* array) : ptr(array) {}
void push_back(value_type leaf) { *ptr++ = leaf; }
};

An example that constructs a list of pointer to all leaf nodes is:

std::vector<const LeafNodeType*> array;//most std contains have the required API
array.reserve(tree.leafCount());//this is a fast preallocation.
tree.getNodes(array);

Definition at line 2811 of file RootNode.h.

template<typename ChildType>
Index openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::getTableSize ( ) const
inline

Return the number of entries in this node's table.

Definition at line 489 of file RootNode.h.

template<typename ChildT >
const ChildT::ValueType & openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::getValue ( const Coord &  xyz) const
inline

Definition at line 1684 of file RootNode.h.

template<typename ChildType>
template<typename AccessorT >
const ValueType& openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::getValueAndCache ( const Coord &  xyz,
AccessorT &   
) const

Return the value of the voxel at the given coordinates and, if necessary, update the accessor with pointers to the nodes along the path from the root node to the node containing the voxel.

Note
Used internally by ValueAccessor.
template<typename ChildType>
template<typename AccessorT >
const ChildT::ValueType& openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::getValueAndCache ( const Coord &  xyz,
AccessorT &  acc 
) const
inline

Definition at line 1694 of file RootNode.h.

template<typename ChildT >
int openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::getValueDepth ( const Coord &  xyz) const
inline

Return the tree depth (0 = root) at which the value of voxel (x, y, z) resides.

If (x, y, z) isn't explicitly represented in the tree (i.e., it is implicitly a background voxel), return -1.

Definition at line 1708 of file RootNode.h.

template<typename ChildT >
template<typename AccessorT >
int openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::getValueDepthAndCache ( const Coord &  xyz,
AccessorT &  acc 
) const
inline

Return the tree depth (0 = root) at which the value of voxel (x, y, z) resides. If (x, y, z) isn't explicitly represented in the tree (i.e., it is implicitly a background voxel), return -1. If necessary, update the accessor with pointers to the nodes along the path from the root node to the node containing the voxel.

Note
Used internally by ValueAccessor.

Definition at line 1718 of file RootNode.h.

template<typename ChildType>
Index openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::getWidth ( ) const
inline

Definition at line 491 of file RootNode.h.

template<typename ChildT >
bool openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::hasActiveTiles ( ) const
inline

Return true if this root node, or any of its child nodes, have active tiles.

Definition at line 1661 of file RootNode.h.

template<typename ChildT >
template<typename OtherChildType >
bool openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::hasCompatibleValueType ( const RootNode< OtherChildType > &  other)
inlinestatic

Return true if values of the other node's ValueType can be converted to values of this node's ValueType.

Definition at line 1440 of file RootNode.h.

template<typename ChildT >
template<typename OtherChildType >
bool openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::hasSameConfiguration ( const RootNode< OtherChildType > &  other)
inlinestatic

Return false if the other node's dimensions don't match this node's.

Definition at line 1408 of file RootNode.h.

template<typename ChildT >
template<typename OtherChildType >
bool openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::hasSameTopology ( const RootNode< OtherChildType > &  other) const
inline

Return true if the given tree has the same node and active value topology as this tree (but possibly a different ValueType).

Definition at line 1361 of file RootNode.h.

template<typename ChildType>
openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::HBOOST_STATIC_ASSERT ( hboost::mpl::size< NodeChainType >::value  = =LEVEL+1)
template<typename ChildT >
bool openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::isBackgroundTile ( const Tile &  tile) const
inline

Return true if the given tile is inactive and has the background value.

Definition at line 1237 of file RootNode.h.

template<typename ChildT >
bool openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::isBackgroundTile ( const MapIter &  iter) const
inline

Return true if the given iterator points to an inactive tile with the background value.

Definition at line 1244 of file RootNode.h.

template<typename ChildT >
bool openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::isBackgroundTile ( const MapCIter &  iter) const
inline

Return true if the given iterator points to an inactive tile with the background value.

Definition at line 1251 of file RootNode.h.

template<typename ChildT >
bool openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::isValueOn ( const Coord &  xyz) const
inline

Definition at line 1652 of file RootNode.h.

template<typename ChildT >
template<typename AccessorT >
bool openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::isValueOnAndCache ( const Coord &  xyz,
AccessorT &  acc 
) const
inline

Return true if the voxel at the given coordinates is active and, if necessary, update the accessor with pointers to the nodes along the path from the root node to the node containing the voxel.

Note
Used internally by ValueAccessor.

Definition at line 1672 of file RootNode.h.

template<typename ChildT >
Index32 openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::leafCount ( ) const
inline

Definition at line 1553 of file RootNode.h.

template<typename ChildT >
Index64 openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::memUsage ( ) const
inline

Return the total amount of memory in bytes occupied by this node and its children.

Definition at line 1467 of file RootNode.h.

template<typename ChildT >
template<MergePolicy Policy>
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::merge ( RootNode< ChildType > &  other)
inline

Efficiently merge another tree into this tree using one of several schemes.

This operation is primarily intended to combine trees that are mostly non-overlapping (for example, intermediate trees from computations that are parallelized across disjoint regions of space).

Note
This operation is not guaranteed to produce an optimally sparse tree. Follow merge() with prune() for optimal sparseness.
Warning
This operation always empties the other tree.

Definition at line 2894 of file RootNode.h.

template<typename ChildT >
template<typename ModifyOp >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::modifyValue ( const Coord &  xyz,
const ModifyOp &  op 
)
inline

Apply a functor to the value of the voxel at the given coordinates and mark the voxel as active.

Definition at line 1921 of file RootNode.h.

template<typename ChildT >
template<typename ModifyOp >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::modifyValueAndActiveState ( const Coord &  xyz,
const ModifyOp &  op 
)
inline

Apply a functor to the voxel at the given coordinates.

Definition at line 1989 of file RootNode.h.

template<typename ChildT >
template<typename ModifyOp , typename AccessorT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::modifyValueAndActiveStateAndCache ( const Coord &  xyz,
const ModifyOp &  op,
AccessorT &  acc 
)
inline

Apply a functor to the voxel at the given coordinates. If necessary, update the accessor with pointers to the nodes along the path from the root node to the node containing the voxel.

Note
Used internally by ValueAccessor.

Definition at line 2016 of file RootNode.h.

template<typename ChildT >
template<typename ModifyOp , typename AccessorT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::modifyValueAndCache ( const Coord &  xyz,
const ModifyOp &  op,
AccessorT &  acc 
)
inline

Apply a functor to the value of the voxel at the given coordinates and mark the voxel as active. If necessary, update the accessor with pointers to the nodes along the path from the root node to the node containing the voxel.

Note
Used internally by ValueAccessor.

Definition at line 1953 of file RootNode.h.

template<typename ChildT >
Index32 openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::nonLeafCount ( ) const
inline

Definition at line 1565 of file RootNode.h.

template<typename ChildT >
size_t openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::numBackgroundTiles ( ) const
inline

Return the number of background tiles.

Definition at line 1259 of file RootNode.h.

template<typename ChildT >
Index64 openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::offLeafVoxelCount ( ) const
inline

Definition at line 1623 of file RootNode.h.

template<typename ChildT >
Index64 openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::offVoxelCount ( ) const
inline

Definition at line 1595 of file RootNode.h.

template<typename ChildT >
Index64 openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::onLeafVoxelCount ( ) const
inline

Definition at line 1611 of file RootNode.h.

template<typename ChildT >
Index64 openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::onTileCount ( ) const
inline

Definition at line 1634 of file RootNode.h.

template<typename ChildT >
Index64 openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::onVoxelCount ( ) const
inline

Definition at line 1579 of file RootNode.h.

template<typename ChildT >
RootNode< ChildT > & openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::operator= ( const RootNode< ChildType > &  other)
inline

Copy a root node of the same type as this node.

Definition at line 1175 of file RootNode.h.

template<typename ChildType>
template<typename OtherChildType >
RootNode& openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::operator= ( const RootNode< OtherChildType > &  other)

Copy a root node of the same tree configuration as this node but a different ValueType.

Exceptions
TypeErrorif the other tree's configuration doesn't match this tree's.
Note
This node's ValueType must be constructible from the other node's ValueType. For example, a root node with values of type float can be assigned to a root node with values of type Vec3s, because a Vec3s can be constructed from a float. But a Vec3s root node cannot be assigned to a float root node.
template<typename ChildType>
template<typename OtherChildType >
RootNode<ChildT>& openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::operator= ( const RootNode< OtherChildType > &  other)
inline

Definition at line 1195 of file RootNode.h.

template<typename ChildT >
const ChildT::LeafNodeType * openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::probeConstLeaf ( const Coord &  xyz) const
inline

Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, return nullptr.

Definition at line 2708 of file RootNode.h.

template<typename ChildType>
template<typename AccessorT >
const LeafNodeType* openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::probeConstLeafAndCache ( const Coord &  xyz,
AccessorT &  acc 
) const

Same as probeLeaf() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.

template<typename ChildType>
template<typename AccessorT >
const ChildT::LeafNodeType* openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::probeConstLeafAndCache ( const Coord &  xyz,
AccessorT &  acc 
) const
inline

Definition at line 2726 of file RootNode.h.

template<typename ChildT >
template<typename NodeT >
const NodeT * openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::probeConstNode ( const Coord &  xyz) const
inline

Return a pointer to the node that contains voxel (x, y, z). If no such node exists, return nullptr.

Definition at line 2683 of file RootNode.h.

template<typename ChildT >
template<typename NodeT , typename AccessorT >
const NodeT * openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::probeConstNodeAndCache ( const Coord &  xyz,
AccessorT &  acc 
) const
inline

Same as probeNode() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.

Definition at line 2763 of file RootNode.h.

template<typename ChildT >
ChildT::LeafNodeType * openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::probeLeaf ( const Coord &  xyz)
inline

Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, return nullptr.

Definition at line 2700 of file RootNode.h.

template<typename ChildType>
const LeafNodeType* openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::probeLeaf ( const Coord &  xyz) const

Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, return nullptr.

template<typename ChildType>
template<typename AccessorT >
LeafNodeType* openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::probeLeafAndCache ( const Coord &  xyz,
AccessorT &  acc 
)

Same as probeLeaf() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.

template<typename ChildType>
template<typename AccessorT >
const LeafNodeType* openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::probeLeafAndCache ( const Coord &  xyz,
AccessorT &  acc 
) const

Same as probeLeaf() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.

template<typename ChildType>
template<typename AccessorT >
ChildT::LeafNodeType* openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::probeLeafAndCache ( const Coord &  xyz,
AccessorT &  acc 
)
inline

Definition at line 2717 of file RootNode.h.

template<typename ChildType>
template<typename AccessorT >
const ChildT::LeafNodeType* openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::probeLeafAndCache ( const Coord &  xyz,
AccessorT &  acc 
) const
inline

Definition at line 2735 of file RootNode.h.

template<typename ChildT >
template<typename NodeT >
NodeT * openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::probeNode ( const Coord &  xyz)
inline

Return a pointer to the node that contains voxel (x, y, z). If no such node exists, return nullptr.

Definition at line 2665 of file RootNode.h.

template<typename ChildT >
template<typename NodeT , typename AccessorT >
NodeT * openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::probeNodeAndCache ( const Coord &  xyz,
AccessorT &  acc 
)
inline

Same as probeNode() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.

Definition at line 2744 of file RootNode.h.

template<typename ChildT >
bool openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::probeValue ( const Coord &  xyz,
ValueType value 
) const
inline

Definition at line 2047 of file RootNode.h.

template<typename ChildT >
template<typename AccessorT >
bool openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::probeValueAndCache ( const Coord &  xyz,
ValueType value,
AccessorT &  acc 
) const
inline

Return, in value, the value of the voxel at the given coordinates and, if necessary, update the accessor with pointers to the nodes along the path from the root node to the node containing the voxel.

Returns
true if the voxel at the given coordinates is active
Note
Used internally by ValueAccessor.

Definition at line 2063 of file RootNode.h.

template<typename ChildT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::prune ( const ValueType tolerance = zeroVal<ValueType>())
inline

Reduce the memory footprint of this tree by replacing with tiles any nodes whose values are all the same (optionally to within a tolerance) and have the same active state.

Note
Consider instead using tools::prune which is multi-threaded!

Definition at line 2424 of file RootNode.h.

template<typename ChildT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::readBuffers ( std::istream &  is,
bool  fromHalf = false 
)
inline

Definition at line 2350 of file RootNode.h.

template<typename ChildT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::readBuffers ( std::istream &  is,
const CoordBBox &  clipBBox,
bool  fromHalf = false 
)
inline

Definition at line 2360 of file RootNode.h.

template<typename ChildT >
bool openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::readTopology ( std::istream &  is,
bool  fromHalf = false 
)
inline

Definition at line 2226 of file RootNode.h.

template<typename ChildT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::setActiveState ( const Coord &  xyz,
bool  on 
)
inline

Set the active state of the voxel at the given coordinates but don't change its value.

Definition at line 1744 of file RootNode.h.

template<typename ChildT >
template<typename AccessorT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::setActiveStateAndCache ( const Coord &  xyz,
bool  on,
AccessorT &  acc 
)
inline

Set the active state of the voxel at the given coordinates without changing its value. If necessary, update the accessor with pointers to the nodes along the path from the root node to the node containing the voxel.

Note
Used internally by ValueAccessor.

Definition at line 1767 of file RootNode.h.

template<typename ChildT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::setBackground ( const ValueType value,
bool  updateChildNodes 
)
inline

Change inactive tiles or voxels with a value equal to +/- the old background to the specified value (with the same sign). Active values are unchanged.

Parameters
valueThe new background value
updateChildNodesIf true the background values of the child nodes is also updated. Else only the background value stored in the RootNode itself is changed.
Note
Instead of setting updateChildNodes to true, consider using tools::changeBackground or tools::changeLevelSetBackground which are multi-threaded!

Definition at line 1210 of file RootNode.h.

template<typename ChildT >
template<typename AccessorT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::setValueAndCache ( const Coord &  xyz,
const ValueType value,
AccessorT &  acc 
)
inline

Change the value of the voxel at the given coordinates and mark it as active. If necessary, update the accessor with pointers to the nodes along the path from the root node to the node containing the voxel.

Note
Used internally by ValueAccessor.

Definition at line 1857 of file RootNode.h.

template<typename ChildT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::setValueOff ( const Coord &  xyz)
inline

Mark the voxel at the given coordinates as inactive but don't change its value.

Definition at line 1730 of file RootNode.h.

template<typename ChildT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::setValueOff ( const Coord &  xyz,
const ValueType value 
)
inline

Set the value of the voxel at the given coordinates and mark the voxel as inactive.

Definition at line 1793 of file RootNode.h.

template<typename ChildT >
template<typename AccessorT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::setValueOffAndCache ( const Coord &  xyz,
const ValueType value,
AccessorT &  acc 
)
inline

Change the value of the voxel at the given coordinates and mark it as inactive. If necessary, update the accessor with pointers to the nodes along the path from the root node to the node containing the voxel.

Note
Used internally by ValueAccessor.

Definition at line 1814 of file RootNode.h.

template<typename ChildT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::setValueOn ( const Coord &  xyz,
const ValueType value 
)
inline

Set the value of the voxel at the given coordinates and mark the voxel as active.

Definition at line 1838 of file RootNode.h.

template<typename ChildT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::setValueOnly ( const Coord &  xyz,
const ValueType value 
)
inline

Set the value of the voxel at the given coordinates but don't change its active state.

Definition at line 1879 of file RootNode.h.

template<typename ChildT >
template<typename AccessorT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::setValueOnlyAndCache ( const Coord &  xyz,
const ValueType value,
AccessorT &  acc 
)
inline

Set the value of the voxel at the given coordinates without changing its active state. If necessary, update the accessor with pointers to the nodes along the path from the root node to the node containing the voxel.

Note
Used internally by ValueAccessor.

Definition at line 1898 of file RootNode.h.

template<typename ChildType>
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::sparseFill ( const CoordBBox &  bbox,
const ValueType value,
bool  active = true 
)
inline

Set all voxels within a given axis-aligned box to a constant value.

Parameters
bboxinclusive coordinates of opposite corners of an axis-aligned box
valuethe value to which to set voxels within the box
activeif true, mark voxels within the box as active, otherwise mark them as inactive
Note
This operation generates a sparse, but not always optimally sparse, representation of the filled box. Follow fill operations with a prune() operation for optimal sparseness.

Definition at line 566 of file RootNode.h.

template<typename ChildT >
template<typename NodeT >
NodeT * openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::stealNode ( const Coord &  xyz,
const ValueType value,
bool  state 
)
inline

Return a pointer to the node of type NodeT that contains voxel (x, y, z) and replace it with a tile of the specified value and state. If no such node exists, leave the tree unchanged and return nullptr.

Note
The caller takes ownership of the node and is responsible for deleting it.
Warning
Since this method potentially removes nodes and branches of the tree, it is important to clear the caches of all ValueAccessors associated with this tree.

Definition at line 2445 of file RootNode.h.

template<typename ChildT >
template<typename ArrayT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::stealNodes ( ArrayT &  array,
const ValueType value,
bool  state 
)
inline

Steals all nodes of a certain type from the tree and adds them to a container with the following API:

struct ArrayT {
typedef value_type;// defines the type of nodes to be added to the array
void push_back(value_type nodePtr);// method that add nodes to the array
};

An example of a wrapper around a c-style array is:

struct MyArray {
typedef LeafType* value_type;
MyArray(value_type* array) : ptr(array) {}
void push_back(value_type leaf) { *ptr++ = leaf; }
};

An example that constructs a list of pointer to all leaf nodes is:

std::vector<const LeafNodeType*> array;//most std contains have the required API
array.reserve(tree.leafCount());//this is a fast preallocation.
tree.stealNodes(array);

Definition at line 2839 of file RootNode.h.

template<typename ChildType>
template<typename ArrayT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::stealNodes ( ArrayT &  array)
inline

Steals all nodes of a certain type from the tree and adds them to a container with the following API:

struct ArrayT {
typedef value_type;// defines the type of nodes to be added to the array
void push_back(value_type nodePtr);// method that add nodes to the array
};

An example of a wrapper around a c-style array is:

struct MyArray {
typedef LeafType* value_type;
MyArray(value_type* array) : ptr(array) {}
void push_back(value_type leaf) { *ptr++ = leaf; }
};

An example that constructs a list of pointer to all leaf nodes is:

std::vector<const LeafNodeType*> array;//most std contains have the required API
array.reserve(tree.leafCount());//this is a fast preallocation.
tree.stealNodes(array);

Definition at line 830 of file RootNode.h.

template<typename ChildT >
template<typename OtherChildType >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::topologyDifference ( const RootNode< OtherChildType > &  other)
inline

Difference this tree's set of active values with the active values of the other tree, whose ValueType may be different. So a resulting voxel will be active only if the original voxel is active in this tree and inactive in the other tree.

Note
This operation can delete branches in this grid if they overlap with active tiles in the other grid. Likewise active voxels can be turned into inactive voxels resulting in leaf nodes with no active values. Thus, it is recommended to subsequently call prune.

Definition at line 3078 of file RootNode.h.

template<typename ChildT >
template<typename OtherChildType >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::topologyIntersection ( const RootNode< OtherChildType > &  other)
inline

Intersects this tree's set of active values with the active values of the other tree, whose ValueType may be different.

The resulting state of a value is active only if the corresponding value was already active AND if it is active in the other tree. Also, a resulting value maps to a voxel if the corresponding value already mapped to an active voxel in either of the two grids and it maps to an active tile or voxel in the other grid.

Note
This operation can delete branches in this grid if they overlap with inactive tiles in the other grid. Likewise active voxels can be turned into inactive voxels resulting in leaf nodes with no active values. Thus, it is recommended to subsequently call prune.

Definition at line 3042 of file RootNode.h.

template<typename ChildT >
template<typename OtherChildType >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::topologyUnion ( const RootNode< OtherChildType > &  other)
inline

Union this tree's set of active values with the active values of the other tree, whose ValueType may be different.

The resulting state of a value is active if the corresponding value was already active OR if it is active in the other tree. Also, a resulting value maps to a voxel if the corresponding value already mapped to a voxel OR if it is a voxel in the other tree. Thus, a resulting value can only map to a tile if the corresponding value already mapped to a tile AND if it is a tile value in other tree.

Note
This operation modifies only active states, not values. Specifically, active tiles and voxels in this tree are not changed, and tiles or voxels that were inactive in this tree but active in the other tree are marked as active in this tree but left with their original values.

Definition at line 3006 of file RootNode.h.

template<typename ChildT >
ChildT::LeafNodeType * openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::touchLeaf ( const Coord &  xyz)
inline

Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, create one that preserves the values and active states of all voxels.

Use this method to preallocate a static tree topology over which to safely perform multithreaded processing.

Definition at line 2621 of file RootNode.h.

template<typename ChildType>
template<typename AccessorT >
LeafNodeType* openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::touchLeafAndCache ( const Coord &  xyz,
AccessorT &  acc 
)

Same as touchLeaf() but, if necessary, update the given accessor with pointers to the nodes along the path from the root node to the node containing the coordinate.

template<typename ChildType>
template<typename AccessorT >
ChildT::LeafNodeType* openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::touchLeafAndCache ( const Coord &  xyz,
AccessorT &  acc 
)
inline

Definition at line 2641 of file RootNode.h.

template<typename ChildT >
template<typename VisitorOp >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::visit ( VisitorOp &  op)
inline

Definition at line 3313 of file RootNode.h.

template<typename ChildT >
template<typename VisitorOp >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::visit ( VisitorOp &  op) const
inline

Definition at line 3322 of file RootNode.h.

template<typename ChildT >
template<typename OtherRootNodeType , typename VisitorOp >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::visit2 ( OtherRootNodeType &  other,
VisitorOp &  op 
)
inline

Definition at line 3349 of file RootNode.h.

template<typename ChildT >
template<typename OtherRootNodeType , typename VisitorOp >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::visit2 ( OtherRootNodeType &  other,
VisitorOp &  op 
) const
inline

Definition at line 3359 of file RootNode.h.

template<typename ChildT >
template<typename BBoxOp >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::visitActiveBBox ( BBoxOp &  op) const
inline

Call the templated functor BBoxOp with bounding box information for all active tiles and leaf nodes in the tree. An additional level argument is provided for each callback.

Note
The bounding boxes are guaranteed to be non-overlapping.

Definition at line 3292 of file RootNode.h.

template<typename ChildT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::voxelizeActiveTiles ( bool  threaded = true)
inline

Densify active tiles, i.e., replace them with leaf-level active voxels.

Parameters
threadedif true, this operation is multi-threaded (over the internal nodes).
Warning
This method can explode the tree's memory footprint, especially if it contains active tiles at the upper levels, e.g. root level!

Definition at line 2869 of file RootNode.h.

template<typename ChildT >
void openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::writeBuffers ( std::ostream &  os,
bool  toHalf = false 
) const
inline

Definition at line 2340 of file RootNode.h.

template<typename ChildT >
bool openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildT >::writeTopology ( std::ostream &  os,
bool  toHalf = false 
) const
inline

Definition at line 2190 of file RootNode.h.

Friends And Related Function Documentation

template<typename ChildType>
template<typename >
friend class RootNode
friend

During topology-only construction, access is needed to protected/private members of other template instances.

Definition at line 920 of file RootNode.h.

template<typename ChildType>
template<typename , typename , typename , bool >
friend struct RootNodeCombineHelper
friend

Definition at line 923 of file RootNode.h.

template<typename ChildType>
template<typename , typename , bool >
friend struct RootNodeCopyHelper
friend

Definition at line 922 of file RootNode.h.

Member Data Documentation

template<typename ChildType>
const Index openvdb::OPENVDB_VERSION_NAME::tree::RootNode< ChildType >::LEVEL = 1 + ChildType::LEVEL
static

Definition at line 83 of file RootNode.h.


The documentation for this class was generated from the following file: