HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT > Struct Template Reference

Convenience class that contains a pointer to a tree to be stolen or deep copied depending on the tag dispatch class used and a subset of methods to retrieve data from the tree. More...

#include <Merge.h>

Classes

struct  MaskPtr
 Wrapper around unique_ptr that deep-copies mask on copy construction. More...
 
struct  MaskUnionOp
 DynamicNodeManager operator used to generate a mask of the input tree, but with dense leaf nodes replaced with active tiles for compactness. More...
 

Public Types

using TreeType = std::remove_const_t< TreeT >
 
using RootNodeType = typename TreeType::RootNodeType
 
using ValueType = typename TreeType::ValueType
 
using MaskTreeType = typename TreeT::template ValueConverter< ValueMask >::Type
 

Public Member Functions

 TreeToMerge ()=delete
 
 TreeToMerge (TreeType &tree, Steal)
 Non-const pointer tree constructor for stealing data. More...
 
 TreeToMerge (typename TreeType::Ptr treePtr, Steal)
 Non-const shared pointer tree constructor for stealing data. More...
 
 TreeToMerge (const TreeType &tree, DeepCopy, bool initialize=true)
 Const tree pointer constructor for deep-copying data. As the tree is not mutable and thus cannot be pruned, a lightweight mask tree with the same topology is created that can be pruned to use as a reference. Initialization of this mask tree can optionally be disabled for delayed construction. More...
 
 TreeToMerge (TreeType &tree, DeepCopy tag, bool initialize=true)
 Non-const tree pointer constructor for deep-copying data. The tree is not intended to be modified so is not pruned, instead a lightweight mask tree with the same topology is created that can be pruned to use as a reference. Initialization of this mask tree can optionally be disabled for delayed construction. More...
 
void reset (typename TreeType::Ptr treePtr, Steal)
 Reset the non-const tree shared pointer. This is primarily used to preserve the order of trees to merge in a container but have the data in the tree be lazily loaded or resampled. More...
 
TreeTypetreeToSteal ()
 Return a pointer to the tree to be stolen. More...
 
const TreeTypetreeToDeepCopy ()
 Return a pointer to the tree to be deep-copied. More...
 
const RootNodeTyperootPtr () const
 Retrieve a const pointer to the root node. More...
 
template<typename NodeT >
const NodeT * probeConstNode (const Coord &ijk) const
 Return a pointer to the node of type NodeT that contains voxel (x, y, z). If no such node exists, return nullptr. More...
 
void pruneMask (Index level, const Coord &ijk)
 Prune the mask and remove the node associated with this coord. More...
 
template<typename NodeT >
std::unique_ptr< NodeT > stealOrDeepCopyNode (const Coord &ijk, const ValueType &value)
 Return a pointer to the node of type NodeT that contains voxel (x, y, z). If the tree is non-const, steal the node and replace it with the value provided. If the tree is const, deep-copy the node and modify the mask tree to prune the node. More...
 
template<typename NodeT >
std::unique_ptr< NodeT > stealOrDeepCopyNode (const Coord &ijk)
 Return a pointer to the node of type NodeT that contains voxel (x, y, z). If the tree is non-const, steal the node and replace it with an inactive background-value tile. If the tree is const, deep-copy the node and modify the mask tree to prune the node. More...
 
template<typename NodeT >
void addTile (const Coord &ijk, const ValueType &value, bool active)
 Add a tile containing voxel (x, y, z) at the level of NodeT, deleting the existing branch if necessary. More...
 
void initializeMask ()
 
bool hasMask () const
 
MaskTreeTypemask ()
 
const MaskTreeTypemask () const
 

Detailed Description

template<typename TreeT>
struct openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT >

Convenience class that contains a pointer to a tree to be stolen or deep copied depending on the tag dispatch class used and a subset of methods to retrieve data from the tree.

The primary purpose of this class is to be able to create an array of TreeToMerge objects that each store a tree to be stolen or a tree to be deep-copied in an arbitrary order. Certain operations such as floating-point addition are non-associative so the order in which they are merged is important for the operation to remain deterministic regardless of how the data is being extracted from the tree.

Note
Stealing data requires a non-const tree pointer. There is a constructor to pass in a tree shared pointer for cases where it is desirable for this class to maintain shared ownership.

Definition at line 47 of file Merge.h.

Member Typedef Documentation

template<typename TreeT>
using openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT >::MaskTreeType = typename TreeT::template ValueConverter<ValueMask>::Type

Definition at line 52 of file Merge.h.

template<typename TreeT>
using openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT >::RootNodeType = typename TreeType::RootNodeType

Definition at line 50 of file Merge.h.

template<typename TreeT>
using openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT >::TreeType = std::remove_const_t<TreeT>

Definition at line 49 of file Merge.h.

template<typename TreeT>
using openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT >::ValueType = typename TreeType::ValueType

Definition at line 51 of file Merge.h.

Constructor & Destructor Documentation

template<typename TreeT>
openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT >::TreeToMerge ( )
delete
template<typename TreeT>
openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT >::TreeToMerge ( TreeType tree,
Steal   
)
inline

Non-const pointer tree constructor for stealing data.

Definition at line 57 of file Merge.h.

template<typename TreeT>
openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT >::TreeToMerge ( typename TreeType::Ptr  treePtr,
Steal   
)
inline

Non-const shared pointer tree constructor for stealing data.

Definition at line 60 of file Merge.h.

template<typename TreeT>
openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT >::TreeToMerge ( const TreeType tree,
DeepCopy  ,
bool  initialize = true 
)
inline

Const tree pointer constructor for deep-copying data. As the tree is not mutable and thus cannot be pruned, a lightweight mask tree with the same topology is created that can be pruned to use as a reference. Initialization of this mask tree can optionally be disabled for delayed construction.

Definition at line 68 of file Merge.h.

template<typename TreeT>
openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT >::TreeToMerge ( TreeType tree,
DeepCopy  tag,
bool  initialize = true 
)
inline

Non-const tree pointer constructor for deep-copying data. The tree is not intended to be modified so is not pruned, instead a lightweight mask tree with the same topology is created that can be pruned to use as a reference. Initialization of this mask tree can optionally be disabled for delayed construction.

Definition at line 79 of file Merge.h.

Member Function Documentation

template<typename TreeT >
template<typename NodeT >
void openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT >::addTile ( const Coord &  ijk,
const ValueType value,
bool  active 
)

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

Definition at line 489 of file Merge.h.

template<typename TreeT >
bool openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT >::hasMask ( ) const

Definition at line 414 of file Merge.h.

template<typename TreeT >
void openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT >::initializeMask ( )

Definition at line 404 of file Merge.h.

template<typename TreeT>
MaskTreeType* openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT >::mask ( )
inline

Definition at line 129 of file Merge.h.

template<typename TreeT>
const MaskTreeType* openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT >::mask ( ) const
inline

Definition at line 130 of file Merge.h.

template<typename TreeT >
template<typename NodeT >
const NodeT * openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT >::probeConstNode ( const Coord &  ijk) const

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

Definition at line 440 of file Merge.h.

template<typename TreeT >
void openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT >::pruneMask ( Index  level,
const Coord &  ijk 
)

Prune the mask and remove the node associated with this coord.

Definition at line 449 of file Merge.h.

template<typename TreeT >
void openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT >::reset ( typename TreeType::Ptr  treePtr,
Steal   
)

Reset the non-const tree shared pointer. This is primarily used to preserve the order of trees to merge in a container but have the data in the tree be lazily loaded or resampled.

Definition at line 420 of file Merge.h.

template<typename TreeT >
const TreeToMerge< TreeT >::RootNodeType * openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT >::rootPtr ( ) const

Retrieve a const pointer to the root node.

Definition at line 432 of file Merge.h.

template<typename TreeT >
template<typename NodeT >
std::unique_ptr< NodeT > openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT >::stealOrDeepCopyNode ( const Coord &  ijk,
const ValueType value 
)

Return a pointer to the node of type NodeT that contains voxel (x, y, z). If the tree is non-const, steal the node and replace it with the value provided. If the tree is const, deep-copy the node and modify the mask tree to prune the node.

Definition at line 460 of file Merge.h.

template<typename TreeT >
template<typename NodeT >
std::unique_ptr< NodeT > openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT >::stealOrDeepCopyNode ( const Coord &  ijk)

Return a pointer to the node of type NodeT that contains voxel (x, y, z). If the tree is non-const, steal the node and replace it with an inactive background-value tile. If the tree is const, deep-copy the node and modify the mask tree to prune the node.

Definition at line 481 of file Merge.h.

template<typename TreeT>
const TreeType* openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT >::treeToDeepCopy ( )
inline

Return a pointer to the tree to be deep-copied.

Definition at line 90 of file Merge.h.

template<typename TreeT>
TreeType* openvdb::OPENVDB_VERSION_NAME::tools::TreeToMerge< TreeT >::treeToSteal ( )
inline

Return a pointer to the tree to be stolen.

Definition at line 88 of file Merge.h.


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