OpenVDB
1.1.0
|
This class manages a linear array of pointers to a given tree's leaf nodes, as well as optional auxiliary buffers (one or more per leaf) that can be swapped with the leaf nodes' voxel data buffers. More...
#include <LeafManager.h>
Classes | |
class | LeafRange |
Public Types | |
typedef TreeT | TreeType |
typedef TreeType::LeafNodeType | NonConstLeafType |
typedef CopyConstness < TreeType, NonConstLeafType > ::Type | LeafType |
typedef leafmgr::TreeTraits < TreeT >::LeafIterType | LeafIterType |
typedef LeafType::Buffer | NonConstBufferType |
typedef CopyConstness < TreeType, NonConstBufferType > ::Type | BufferType |
typedef tbb::blocked_range < size_t > | RangeType |
Public Member Functions | |
LeafManager (TreeType &tree, size_t auxBuffersPerLeaf=0, bool serial=false) | |
Constructor from a tree reference and an auxiliary buffer count (default is no auxiliary buffers) | |
LeafManager (const LeafManager &other) | |
virtual | ~LeafManager () |
void | rebuild (bool serial=false) |
(Re)initialize by resizing (if necessary) and repopulating the leaf array and by deleting existing auxiliary buffers and allocating new ones. | |
void | rebuildAuxBuffers (size_t auxBuffersPerLeaf, bool serial=false) |
Change the number of auxiliary buffers. | |
void | removeAuxBuffers () |
Remove the auxiliary buffers, but don't rebuild the leaf array. | |
void | rebuildLeafArray () |
Remove the auxiliary buffers and rebuild the leaf array. | |
OPENVDB_DEPRECATED void | rebuildLeafs () |
size_t | auxBufferCount () const |
Return the total number of allocated auxiliary buffers. | |
size_t | auxBuffersPerLeaf () const |
Return the number of auxiliary buffers per leaf node. | |
size_t | leafCount () const |
Return the number of leaf nodes. | |
TreeType & | tree () |
Return the tree associated with this manager. | |
bool | isConstTree () const |
Return true if the tree associated with this manager is immutable. | |
LeafType & | leaf (size_t leafIdx) const |
Return a pointer to the leaf node at index leafIdx in the array. | |
BufferType & | getBuffer (size_t leafIdx, size_t bufferIdx) const |
Return the leaf or auxiliary buffer for the leaf node at index leafIdx. If bufferIdx is zero, return the leaf buffer, otherwise return the nth auxiliary buffer, where n = bufferIdx - 1. | |
RangeType | getRange (size_t grainsize=1) const |
Return a tbb::blocked_range of leaf array indices. | |
LeafRange | leafRange (size_t grainsize=1) const |
Return a TBB-compatible LeafRange. | |
bool | swapLeafBuffer (size_t bufferIdx, bool serial=false) |
Swap each leaf node's buffer with the nth corresponding auxiliary buffer, where n = bufferIdx. | |
bool | swapBuffer (size_t bufferIdx1, size_t bufferIdx2, bool serial=false) |
Swap any two buffers for each leaf node. | |
bool | syncAuxBuffer (size_t bufferIdx, bool serial=false) |
Sync up the specified auxiliary buffer with the corresponding leaf node buffer. | |
bool | syncAllBuffers (bool serial=false) |
Sync up all auxiliary buffers with their corresponding leaf node buffers. | |
void | operator() (const RangeType &r) const |
Used internally by tbb::parallel_for() - never call it directly! | |
void | rebuild (size_t auxBuffersPerLeaf, bool serial=false) |
Repopulate the leaf array and delete and reallocate auxiliary buffers. | |
void | rebuild (TreeType &tree, bool serial=false) |
Repopulate the leaf array and delete and reallocate auxiliary buffers. | |
void | rebuild (TreeType &tree, size_t auxBuffersPerLeaf, bool serial=false) |
Repopulate the leaf array and delete and reallocate auxiliary buffers. |
Static Public Attributes | |
static const bool | IsConstTree = leafmgr::TreeTraits<TreeT>::IsConstTree |
This class manages a linear array of pointers to a given tree's leaf nodes, as well as optional auxiliary buffers (one or more per leaf) that can be swapped with the leaf nodes' voxel data buffers.
The leaf array is useful for multithreaded computations over leaf voxels in a tree with static topology but varying voxel values. The auxiliary buffers are convenient for temporal integration. Efficient methods are provided for multithreaded swapping and sync'ing (i.e., copying the contents) of these buffers.
typedef CopyConstness<TreeType, NonConstBufferType>::Type BufferType |
typedef leafmgr::TreeTraits<TreeT>::LeafIterType LeafIterType |
typedef CopyConstness<TreeType, NonConstLeafType>::Type LeafType |
typedef LeafType::Buffer NonConstBufferType |
typedef TreeType::LeafNodeType NonConstLeafType |
typedef tbb::blocked_range<size_t> RangeType |
typedef TreeT TreeType |
|
inline |
Constructor from a tree reference and an auxiliary buffer count (default is no auxiliary buffers)
|
inline |
Shallow copy constructor called by tbb::parallel_for() threads
|
inlinevirtual |
|
inline |
Return the total number of allocated auxiliary buffers.
|
inline |
Return the number of auxiliary buffers per leaf node.
|
inline |
Return the leaf or auxiliary buffer for the leaf node at index leafIdx. If bufferIdx is zero, return the leaf buffer, otherwise return the nth auxiliary buffer, where n = bufferIdx - 1.
const_cast
and modify any auxiliary buffer (bufferIdx > 0), but it is not safe to modify the leaf buffer (bufferIdx = 0).
|
inline |
Return a tbb::blocked_range
of leaf array indices.
|
inline |
Return true
if the tree associated with this manager is immutable.
|
inline |
Return a pointer to the leaf node at index leafIdx in the array.
|
inline |
Return the number of leaf nodes.
|
inline |
Used internally by tbb::parallel_for() - never call it directly!
|
inline |
(Re)initialize by resizing (if necessary) and repopulating the leaf array and by deleting existing auxiliary buffers and allocating new ones.
Call this method if the tree's topology, and therefore the number of leaf nodes, changes. New auxiliary buffers are initialized with copies of corresponding leaf node buffers.
|
inline |
Repopulate the leaf array and delete and reallocate auxiliary buffers.
|
inline |
Repopulate the leaf array and delete and reallocate auxiliary buffers.
|
inline |
Repopulate the leaf array and delete and reallocate auxiliary buffers.
|
inline |
Change the number of auxiliary buffers.
If auxBuffersPerLeaf is 0, all existing auxiliary buffers are deleted. New auxiliary buffers are initialized with copies of corresponding leaf node buffers. This method does not rebuild the leaf array.
|
inline |
Remove the auxiliary buffers and rebuild the leaf array.
|
inline |
|
inline |
Remove the auxiliary buffers, but don't rebuild the leaf array.
|
inline |
Swap any two buffers for each leaf node.
|
inline |
Swap each leaf node's buffer with the nth corresponding auxiliary buffer, where n = bufferIdx.
true
if the swap was successful bufferIdx | index of the buffer that will be swapped with the corresponding leaf node buffer |
serial | if false, swap buffers in parallel using multiple threads. |
|
inline |
Sync up all auxiliary buffers with their corresponding leaf node buffers.
serial | if false, sync buffers in parallel using multiple threads. |
|
inline |
Sync up the specified auxiliary buffer with the corresponding leaf node buffer.
true
if the sync was successful bufferIdx | index of the buffer that will contain a copy of the corresponding leaf node buffer |
serial | if false, sync buffers in parallel using multiple threads. |
|
inline |
Return the tree associated with this manager.
|
static |