OpenVDB 13.2.0
Loading...
Searching...
No Matches
LeafBuffer< T, Log2Dim > Class Template Reference

Array of fixed size 23Log2Dim that stores the voxel values of a LeafNode. More...

#include <openvdb/tree/LeafBuffer.h>

Public Types

using ValueType = T
using StorageType = ValueType
using NodeMaskType = util::NodeMask<Log2Dim>

Public Member Functions

 LeafBuffer ()
 Default constructor.
 LeafBuffer (const ValueType &)
 Construct a buffer populated with the specified value.
 LeafBuffer (const LeafBuffer &)
 Copy constructor.
 LeafBuffer (PartialCreate, const ValueType &)
 Construct a buffer without allocating the value array. The buffer is left unallocated; call allocate() before use. Populating the buffer (via allocate() or data()) must be done single-threaded per leaf, or externally synchronized. The valid advanced pattern is: create all nodes single-threaded, then call allocate() in parallel across distinct leaves.
 ~LeafBuffer ()
 Destructor.
bool isOutOfCore () const
bool empty () const
 Return true if memory for this buffer has not yet been allocated.
bool allocate ()
 Allocate memory for this buffer if it has not already been allocated.
void fill (const ValueType &)
 Populate this buffer with a constant value.
const ValueType & getValue (Index i) const
 Return a const reference to the i'th element of this buffer.
const ValueType & operator[] (Index i) const
 Return a const reference to the i'th element of this buffer.
void setValue (Index i, const ValueType &)
 Set the i'th value of this buffer to the specified value.
LeafBuffer & operator= (const LeafBuffer &)
 Copy the other buffer's values into this buffer.
bool operator== (const LeafBuffer &) const
 Return true if the contents of the other buffer exactly equal the contents of this buffer.
bool operator!= (const LeafBuffer &other) const
 Return true if the contents of the other buffer are not exactly equal to the contents of this buffer.
void swap (LeafBuffer &)
 Exchange this buffer's values with the other buffer's values.
Index memUsage () const
 Return the memory footprint of this buffer in bytes.
Index memUsageIfLoaded () const
const ValueType * data () const
 Return a const pointer to the array of voxel values.
ValueType * data ()
 Return a pointer to the array of voxel values.

Static Public Member Functions

static Index size ()
 Return the number of values contained in this buffer.

Static Public Attributes

static const Index SIZE = 1 << 3 * Log2Dim

Friends

class ::TestLeaf
template<typename, Index>
class LeafNode

Detailed Description

template<typename T, Index Log2Dim>
class openvdb::v13_2::tree::LeafBuffer< T, Log2Dim >

Array of fixed size 23Log2Dim that stores the voxel values of a LeafNode.

Member Typedef Documentation

◆ NodeMaskType

template<typename T, Index Log2Dim>
using NodeMaskType = util::NodeMask<Log2Dim>

◆ StorageType

template<typename T, Index Log2Dim>
using StorageType = ValueType

◆ ValueType

template<typename T, Index Log2Dim>
using ValueType = T

Constructor & Destructor Documentation

◆ LeafBuffer() [1/4]

template<typename T, Index Log2Dim>
LeafBuffer ( )
inline

Default constructor.

◆ LeafBuffer() [2/4]

template<typename T, Index Log2Dim>
LeafBuffer ( const ValueType & val)
inlineexplicit

Construct a buffer populated with the specified value.

◆ LeafBuffer() [3/4]

template<typename T, Index Log2Dim>
LeafBuffer ( const LeafBuffer< T, Log2Dim > & other)
inline

Copy constructor.

◆ LeafBuffer() [4/4]

template<typename T, Index Log2Dim>
LeafBuffer ( PartialCreate ,
const ValueType &  )
inline

Construct a buffer without allocating the value array. The buffer is left unallocated; call allocate() before use. Populating the buffer (via allocate() or data()) must be done single-threaded per leaf, or externally synchronized. The valid advanced pattern is: create all nodes single-threaded, then call allocate() in parallel across distinct leaves.

◆ ~LeafBuffer()

template<typename T, Index Log2Dim>
~LeafBuffer ( )
inline

Destructor.

Member Function Documentation

◆ allocate()

template<typename T, Index Log2Dim>
bool allocate ( )
inline

Allocate memory for this buffer if it has not already been allocated.

◆ data() [1/2]

template<typename T, Index Log2Dim>
LeafBuffer< T, Log2Dim >::ValueType * data ( )
inline

Return a pointer to the array of voxel values.

Warning
The buffer must already be allocated (call allocate() first). First-touch allocation via data() is not thread-safe; concurrent access to an unallocated buffer is a programming error flagged in debug builds.
This method should only be used by experts seeking low-level optimizations.

◆ data() [2/2]

template<typename T, Index Log2Dim>
const LeafBuffer< T, Log2Dim >::ValueType * data ( ) const
inline

Return a const pointer to the array of voxel values.

Warning
The buffer must already be allocated (call allocate() first). First-touch allocation via data() is not thread-safe; concurrent access to an unallocated buffer is a programming error flagged in debug builds.
This method should only be used by experts seeking low-level optimizations.

◆ empty()

template<typename T, Index Log2Dim>
bool empty ( ) const
inline

Return true if memory for this buffer has not yet been allocated.

◆ fill()

template<typename T, Index Log2Dim>
void fill ( const ValueType & val)
inline

Populate this buffer with a constant value.

◆ getValue()

template<typename T, Index Log2Dim>
const ValueType & getValue ( Index i) const
inline

Return a const reference to the i'th element of this buffer.

◆ isOutOfCore()

template<typename T, Index Log2Dim>
bool isOutOfCore ( ) const
inline
Deprecated
"Always returns false. This method is deprecated and will be removed. Delayed loading is no longer supported."

◆ memUsage()

template<typename T, Index Log2Dim>
Index memUsage ( ) const
inline

Return the memory footprint of this buffer in bytes.

◆ memUsageIfLoaded()

template<typename T, Index Log2Dim>
Index memUsageIfLoaded ( ) const
inline
Deprecated
"Use memUsage() instead. This method is deprecated and will be removed. Delayed loading is no longer supported."

◆ operator!=()

template<typename T, Index Log2Dim>
bool operator!= ( const LeafBuffer< T, Log2Dim > & other) const
inline

Return true if the contents of the other buffer are not exactly equal to the contents of this buffer.

◆ operator=()

template<typename T, Index Log2Dim>
LeafBuffer< T, Log2Dim > & operator= ( const LeafBuffer< T, Log2Dim > & other)
inline

Copy the other buffer's values into this buffer.

◆ operator==()

template<typename T, Index Log2Dim>
bool operator== ( const LeafBuffer< T, Log2Dim > & other) const
inline

Return true if the contents of the other buffer exactly equal the contents of this buffer.

◆ operator[]()

template<typename T, Index Log2Dim>
const ValueType & operator[] ( Index i) const
inline

Return a const reference to the i'th element of this buffer.

◆ setValue()

template<typename T, Index Log2Dim>
void setValue ( Index i,
const ValueType & val )
inline

Set the i'th value of this buffer to the specified value.

◆ size()

template<typename T, Index Log2Dim>
Index size ( )
inlinestatic

Return the number of values contained in this buffer.

◆ swap()

template<typename T, Index Log2Dim>
void swap ( LeafBuffer< T, Log2Dim > & other)
inline

Exchange this buffer's values with the other buffer's values.

◆ ::TestLeaf

template<typename T, Index Log2Dim>
friend class ::TestLeaf
friend

◆ LeafNode

template<typename T, Index Log2Dim>
template<typename, Index>
friend class LeafNode
friend

Member Data Documentation

◆ SIZE

template<typename T, Index Log2Dim>
const Index SIZE = 1 << 3 * Log2Dim
static