OpenVDB  0.104.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
LeafArray< TreeT, BufferCount > Class Template Reference

This is a range and iterator class useful for multithreading computations on leaf values that require the use of multiple temporal buffers but static tree topology (i.e. only voxel values are dynamic). The internal buffer in LeafNodes is referred to as the read buffer, and the external buffers allocated by the LeafArray class are called write buffers. LeafArray::swapBuffers implements a multi-threaded method to efficiently swap the read buffer with any of the write buffers. See tools/Filter.h for an application. More...

#include <LeafArray.h>

Classes

struct  BufferStruct
 Simple structure of LeafNode pointers and corresponding write buffers. More...
 

Public Types

typedef boost::shared_ptr
< LeafArray
Ptr
 
typedef TreeT TreeType
 
typedef TreeType::ValueType ValueType
 
typedef TreeType::LeafNodeType LeafType
 
typedef LeafType::Buffer BufferType
 
typedef std::vector< BufferStructArrayType
 
typedef ArrayType::iterator IterType
 
typedef tbb::blocked_range
< IterType
IterRangeType
 

Public Member Functions

OPENVDB_DEPRECATED LeafArray (TreeType &tree, bool sync=true)
 Constructor from a Tree reference. More...
 
void init (TreeType &tree, bool sync)
 
void clear ()
 
Index size () const
 
TreeTypetree ()
 
LeafTypeoperator[] (int i)
 
IterRangeType getRange (size_t grainsize=1)
 Return range of the buffer-array. Needed for multithreading by tbb. More...
 
void swapBuffers (Index n=0, bool serial=false)
 
void copyBuffers (Index n=0, bool serial=false)
 
void syncBuffers (bool serial=false)
 

Static Public Member Functions

static void swapBufferRange (const IterRangeType &r, Index n)
 
static void copyBufferRange (const IterRangeType &r, Index n)
 
static void syncBufferRange (const IterRangeType &r)
 

Detailed Description

template<typename TreeT, int BufferCount>
class openvdb::v0_104_0::tree::LeafArray< TreeT, BufferCount >

This is a range and iterator class useful for multithreading computations on leaf values that require the use of multiple temporal buffers but static tree topology (i.e. only voxel values are dynamic). The internal buffer in LeafNodes is referred to as the read buffer, and the external buffers allocated by the LeafArray class are called write buffers. LeafArray::swapBuffers implements a multi-threaded method to efficiently swap the read buffer with any of the write buffers. See tools/Filter.h for an application.

Member Typedef Documentation

typedef std::vector<BufferStruct> ArrayType
typedef LeafType::Buffer BufferType
typedef tbb::blocked_range<IterType> IterRangeType
typedef ArrayType::iterator IterType
typedef TreeType::LeafNodeType LeafType
typedef boost::shared_ptr<LeafArray> Ptr
typedef TreeT TreeType
typedef TreeType::ValueType ValueType

Constructor & Destructor Documentation

OPENVDB_DEPRECATED LeafArray ( TreeType tree,
bool  sync = true 
)
inline

Constructor from a Tree reference.

Member Function Documentation

void clear ( )
inline
static void copyBufferRange ( const IterRangeType r,
Index  n 
)
inlinestatic

For each leaf node in the given range, copy the leaf node's internal buffer into its nth external write buffer.

Parameters
rthe range of leaf nodes to process
nthe index of the external write buffer
Note
Consider using the non-static method copyBuffers() instead, since it supports multithreading and has a simpler API.
void copyBuffers ( Index  n = 0,
bool  serial = false 
)
inline

Copy each leaf node's internal buffer into its nth external write buffer.

Parameters
nthe index of the external write buffer
serialif false, copy buffers in parallel using multiple threads
IterRangeType getRange ( size_t  grainsize = 1)
inline

Return range of the buffer-array. Needed for multithreading by tbb.

void init ( TreeType tree,
bool  sync 
)
inline
LeafType* operator[] ( int  i)
inline
Index size ( ) const
inline
static void swapBufferRange ( const IterRangeType r,
Index  n 
)
inlinestatic

For each leaf node in the given range, swap the leaf node's internal buffer with its nth external write buffer.

Parameters
rthe range of leaf nodes to process
nthe index of the external write buffer
Note
Consider using the non-static method swapBuffers() instead, since it supports multithreading and has a simpler API.
void swapBuffers ( Index  n = 0,
bool  serial = false 
)
inline

Swap each leaf node's internal buffer with its nth external write buffer.

Parameters
nthe index of the external write buffer
serialif false, swap buffers in parallel using multiple threads
static void syncBufferRange ( const IterRangeType r)
inlinestatic

For each leaf node in the given range, sync the leaf node's internal buffer with all the external write buffers.

Parameters
rthe range of leaf nodes to process
Note
Consider using the non-static method syncBuffers() instead, since it supports multithreading and has a simpler API.
void syncBuffers ( bool  serial = false)
inline

Sync each leaf node's internal buffer with all its external write buffer.

Parameters
serialif false, sync buffers in parallel using multiple threads
TreeType& tree ( )
inline

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