HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence > Class Template Reference

The Value Accessor Implementation and API methods. The majoirty of the API matches the API of a compatible OpenVDB Tree Node. More...

#include <ValueAccessor.h>

+ Inheritance diagram for openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >:

Public Types

using BaseT = ValueAccessorBase< _TreeType, IsSafe >
 
using LockT = ValueAccessorLock< MutexT >
 
using LeafCacheT = ValueAccessorLeafBuffer< _TreeType, IntegerSequence >
 
using TreeType = _TreeType
 
using ValueType = typename TreeType::ValueType
 
using RootNodeT = typename TreeType::RootNodeType
 
using LeafNodeT = typename TreeType::LeafNodeType
 
using NodeChainT = typename RootNodeT::NodeChainType
 
using NodeLevelList = typename value_accessor_internal::NodeListBuilder< NodeChainT, RootNodeT::LEVEL, IntegerSequence >::ListT
 A resolved, flattened TypeList of node types which this accessor is caching. The nodes index in this list does not necessarily correspond to the nodes level in the tree. More...
 
using NodePtrList = typename NodeLevelList::template Transform< std::add_pointer_t >
 
template<size_t Level>
using NodeTypeAtLevel = typename NodeLevelList::template Get< Level >
 Return a node type at a particular cache level in the Value accessor. The node type at a given cache level does not necessarily equal the same node type in the TreeType as this depends entirely on which tree levels this Accessor is caching. For example: More...
 
using NodeTypeAtLevel = typename std::conditional<(NumCacheLevels > 0), NodeTypeAtLevel< 0 >, void >::type
 
using NodeTypeAtLevel = typename std::conditional<(NumCacheLevels > 1), NodeTypeAtLevel< 1 >, void >::type
 
using NodeTypeAtLevel = typename std::conditional<(NumCacheLevels > 2), NodeTypeAtLevel< 2 >, void >::type
 

Public Member Functions

 ValueAccessorImpl (TreeType &tree)
 Constructor from a tree. More...
 
 ~ValueAccessorImpl () overridefinal=default
 
 ValueAccessorImpl (const ValueAccessorImpl &)=default
 
ValueAccessorImploperator= (const ValueAccessorImpl &)=default
 
bool isCached (const Coord &xyz) const
 Return true if any of the nodes along the path to the given coordinate have been cached. More...
 
const ValueTypegetValue (const Coord &xyz) const
 Return the value of the voxel at the given coordinates. More...
 
bool isValueOn (const Coord &xyz) const
 Return the active state of the voxel at the given coordinates. More...
 
bool probeValue (const Coord &xyz, ValueType &value) const
 Return the active state of the value at a given coordinate as well as its value. More...
 
int getValueDepth (const Coord &xyz) const
 Return the tree depth (0 = root) at which the value of voxel (x, y, z) resides, or -1 if (x, y, z) isn't explicitly represented in the tree (i.e., if it is implicitly a background voxel). More...
 
bool isVoxel (const Coord &xyz) const
 Return true if the value of voxel (x, y, z) resides at the leaf level of the tree, i.e., if it is not a tile value. More...
 
void setValueOnly (const Coord &xyz, const ValueType &value)
 Set a particular value at the given coordinate but preserve its active state. More...
 
void setValueOff (const Coord &xyz, const ValueType &value)
 Set a particular value at the given coordinate and mark the coordinate as inactive. More...
 
template<typename ModifyOp >
void modifyValue (const Coord &xyz, const ModifyOp &op)
 Apply a functor to the value at the given coordinate and mark mark the coordinate 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 setActiveState (const Coord &xyz, bool on=true)
 Set the active state of the voxel at the given coordinates without changing its value. More...
 
void setValueOn (const Coord &xyz)
 Mark the voxel at the given coordinates as active without changing its value. More...
 
void setValueOff (const Coord &xyz)
 Mark the voxel at the given coordinates as inactive without changing its value. More...
 
LeafNodeTtouchLeaf (const Coord &xyz)
 Returns the leaf node that contains voxel (x, y, z) and if it doesn't exist, create it, but preserve the values and active states of the pre-existing branch. More...
 
void addLeaf (LeafNodeT *leaf)
 Add the specified leaf to this tree, possibly creating a child branch in the process. If the leaf node already exists, replace it. More...
 
void addTile (Index level, const Coord &xyz, const ValueType &value, bool state)
 Add a tile at the specified tree level that contains the coordinate xyz, possibly deleting existing nodes or creating new nodes in the process. More...
 
template<typename NodeT >
NodeT * getNode ()
 Return the node of type NodeT that has been cached on this accessor. If this accessor does not cache this NodeT, or if no node of this type has been cached, returns a nullptr. More...
 
template<typename NodeT >
void insertNode (const Coord &xyz, NodeT &node)
 Explicitly insert a node of the type NodeT into this Value Accessors cache. More...
 
template<typename NodeT >
void eraseNode ()
 Explicitly remove this Value Accessors cached node of the given NodeT. If this Value Accessor does not support the caching of the provided NodeT, this method does nothing. More...
 
void clear () overridefinal
 Remove all the cached nodes and invalidate the corresponding hash-keys. More...
 
void setValue (const Coord &xyz, const ValueType &value)
 Set a particular value at the given coordinate and mark the coordinate as active. More...
 
void setValueOn (const Coord &xyz, const ValueType &value)
 Set a particular value at the given coordinate and mark the coordinate as active. More...
 
template<typename NodeT >
NodeT * probeNode (const Coord &xyz)
 Return a pointer to the node of the specified type that contains the value located at xyz. If no node of the given NodeT exists which contains the value, a nullptr is returned. More...
 
template<typename NodeT >
const NodeT * probeConstNode (const Coord &xyz) const
 Return a pointer to the node of the specified type that contains the value located at xyz. If no node of the given NodeT exists which contains the value, a nullptr is returned. More...
 
LeafNodeTprobeLeaf (const Coord &xyz)
 Return a pointer to the leaf node that contains the voxel coordinate xyz. If no LeafNode exists, returns a nullptr. More...
 
const LeafNodeTprobeLeaf (const Coord &xyz) const
 Return a pointer to the leaf node that contains the voxel coordinate xyz. If no LeafNode exists, returns a nullptr. More...
 
const LeafNodeTprobeConstLeaf (const Coord &xyz) const
 Return a pointer to the leaf node that contains the voxel coordinate xyz. If no LeafNode exists, returns a nullptr. More...
 
- Public Member Functions inherited from openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorBase< _TreeType, IsSafe >
 ValueAccessorBase (_TreeType &tree)
 Construct from a tree. Should rarely be invoked directly, the drived implementation class calls this. Remains public for backwards compatibility. More...
 
 ValueAccessorBase (const ValueAccessorBase &other)
 Copy constructor - if IsSafe, then the copy also registers itself against the tree it is accessing. More...
 
virtual ~ValueAccessorBase ()
 
ValueAccessorBaseoperator= (const ValueAccessorBase &other)
 
_TreeType * getTree () const
 Return a pointer to the tree associated with this accessor. More...
 
_TreeType & tree () const
 Return a reference to the tree associated with this accessor. More...
 
- Public Member Functions inherited from openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorLeafBuffer< _TreeType, IntegerSequence >
const _TreeType::ValueType * buffer ()
 
const _TreeType::ValueType * buffer () const
 
void setBuffer (const typename _TreeType::ValueType *b) const
 
- Public Member Functions inherited from openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorLock< MutexT >
auto lock () const
 

Static Public Member Functions

static constexpr Index numCacheLevels ()
 Return the number of cache levels employed by this ValueAccessor. More...
 
- Static Public Member Functions inherited from openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorBase< _TreeType, IsSafe >
static constexpr bool isSafe ()
 Return true if this accessor is safe, i.e. registered by the tree from which it is constructed. Un-registered accessors can in rare cases be faster because it avoids the (small) overhead of registration, but they are unsafe if the tree is modified. So unless you're an expert it is highly recommended to set IsSafe = true (which is the default). More...
 

Static Public Attributes

template<typename NodeT >
static constexpr bool IsLeafAndBypassLeafAPI
 Given a node type, return whether this Accessor can perform optimized value buffer accesses. This is only possible for LeafNodes so will always return false for any non LeafNode type. It also depends on the value type - if the value buffer is a contiguous index-able array of values then this returns true. More...
 
static constexpr bool BypassLeafAPI
 Helper alias which is true if the lowest cached node level is a LeafNode type and has a compatible value type for optimized access. More...
 
static constexpr size_t NumCacheLevels = NodeLevelList::Size-1
 The number of node levels that this accessor can cache, excluding the RootNode. More...
 
- Static Public Attributes inherited from openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorBase< _TreeType, IsSafe >
static constexpr bool IsConstTree
 Returns true if this accessor is operating on a const tree type. More...
 
- Static Public Attributes inherited from openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorLeafBuffer< _TreeType, IntegerSequence >
static constexpr bool BypassLeafAPI
 

Protected Member Functions

void release () overridefinal
 Release this accessor from the tree, set the tree to null and clear the accessor cache. After calling this method the accessor will be completely invalid. More...
 
template<typename NodeT >
OPENVDB_FORCE_INLINE void insert ([[maybe_unused]] const Coord &xyz, [[maybe_unused]] const NodeT *node) const
 Insert a node into this ValueAccessor's cache. More...
 
template<typename NodeT >
OPENVDB_FORCE_INLINE bool isHashed ([[maybe_unused]] const Coord &xyz) const
 

Friends

template<typename >
class RootNode
 
template<typename , Index >
class InternalNode
 
template<typename , Index >
class LeafNode
 
template<typename >
class Tree
 

Additional Inherited Members

- Protected Attributes inherited from openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorBase< _TreeType, IsSafe >
_TreeType * mTree
 

Detailed Description

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
class openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >

The Value Accessor Implementation and API methods. The majoirty of the API matches the API of a compatible OpenVDB Tree Node.

Definition at line 68 of file ValueAccessor.h.

Member Typedef Documentation

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
using openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::BaseT = ValueAccessorBase<_TreeType, IsSafe>
Note
Not strictly the only Base Type but provided for backwards compatibility.

Definition at line 371 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
using openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::LeafCacheT = ValueAccessorLeafBuffer<_TreeType, IntegerSequence>

Definition at line 373 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
using openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::LeafNodeT = typename TreeType::LeafNodeType

Definition at line 378 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
using openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::LockT = ValueAccessorLock<MutexT>

Definition at line 372 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
using openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::NodeChainT = typename RootNodeT::NodeChainType

Definition at line 379 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
using openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::NodeLevelList = typename value_accessor_internal::NodeListBuilder <NodeChainT, RootNodeT::LEVEL, IntegerSequence>::ListT

A resolved, flattened TypeList of node types which this accessor is caching. The nodes index in this list does not necessarily correspond to the nodes level in the tree.

Definition at line 386 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
using openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::NodePtrList = typename NodeLevelList::template Transform<std::add_pointer_t>

Definition at line 387 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
template<size_t Level>
using openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::NodeTypeAtLevel = typename NodeLevelList::template Get<Level>

Return a node type at a particular cache level in the Value accessor. The node type at a given cache level does not necessarily equal the same node type in the TreeType as this depends entirely on which tree levels this Accessor is caching. For example:

Example:
// Cache tree levels 0 and 2
using Impl = ValueAccessorImpl<FloatTree, true, void, 0, 2>
using CacheLevel1 = Impl::template NodeTypeAtLevel<1>
using TreeLevel2 = TreeType::RootNodeType::NodeChainType::Get<2>;

Definition at line 402 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
using openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::NodeTypeAtLevel = typename std::conditional<(NumCacheLevels > 0), NodeTypeAtLevel<0>, void>::type

Definition at line 896 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
using openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::NodeTypeAtLevel = typename std::conditional<(NumCacheLevels > 1), NodeTypeAtLevel<1>, void>::type

Definition at line 898 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
using openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::NodeTypeAtLevel = typename std::conditional<(NumCacheLevels > 2), NodeTypeAtLevel<2>, void>::type

Definition at line 900 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
using openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::RootNodeT = typename TreeType::RootNodeType

Definition at line 377 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
using openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::TreeType = _TreeType

Definition at line 375 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
using openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::ValueType = typename TreeType::ValueType

Definition at line 376 of file ValueAccessor.h.

Constructor & Destructor Documentation

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::ValueAccessorImpl ( TreeType tree)
inline

Constructor from a tree.

Definition at line 425 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::~ValueAccessorImpl ( )
finaloverridedefault
template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::ValueAccessorImpl ( const ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence > &  )
default

Member Function Documentation

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
void openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::addLeaf ( LeafNodeT leaf)
inline

Add the specified leaf to this tree, possibly creating a child branch in the process. If the leaf node already exists, replace it.

Parameters
leafThe LeafNode to insert into the tree. Must not be a nullptr.

Definition at line 729 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
void openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::addTile ( Index  level,
const Coord &  xyz,
const ValueType value,
bool  state 
)
inline

Add a tile at the specified tree level that contains the coordinate xyz, possibly deleting existing nodes or creating new nodes in the process.

Note
Calling this with a level of 0 will modify voxel values. This function will always densify a tree branch up to the requested level (regardless if the value and active state match).
Parameters
levelThe level of the tree to add a tile. Level 0 refers to voxels (and is similar to ::setValue, except will always density).
xyzThe index space coordinate to add a tile
valueThe value of the tile
stateThe active state to set on the new tile

Definition at line 754 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
void openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::clear ( void  )
inlinefinaloverridevirtual

Remove all the cached nodes and invalidate the corresponding hash-keys.

Implements openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorBase< _TreeType, IsSafe >.

Definition at line 880 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
template<typename NodeT >
void openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::eraseNode ( )
inline

Explicitly remove this Value Accessors cached node of the given NodeT. If this Value Accessor does not support the caching of the provided NodeT, this method does nothing.

Definition at line 869 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
template<typename NodeT >
NodeT* openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::getNode ( )
inline

Return the node of type NodeT that has been cached on this accessor. If this accessor does not cache this NodeT, or if no node of this type has been cached, returns a nullptr.

Definition at line 848 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
const ValueType& openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::getValue ( const Coord &  xyz) const
inline

Return the value of the voxel at the given coordinates.

Parameters
xyzThe index space coordinate to query

Definition at line 455 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
int openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::getValueDepth ( const Coord &  xyz) const
inline

Return the tree depth (0 = root) at which the value of voxel (x, y, z) resides, or -1 if (x, y, z) isn't explicitly represented in the tree (i.e., if it is implicitly a background voxel).

Note
This is the inverse of the node LEVEL (where the RootNode level is the highest in the tree).
Parameters
xyzThe index space coordinate to query

Definition at line 516 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
template<typename NodeT >
OPENVDB_FORCE_INLINE void openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::insert ( [[maybe_unused] ] const Coord &  xyz,
[[maybe_unused] ] const NodeT *  node 
) const
inlineprotected

Insert a node into this ValueAccessor's cache.

******************************* WARNING ******************************* Methods here must be force inline otherwise compilers do not optimize out the function call due to recursive templates and performance degradation is significant.


Definition at line 930 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
template<typename NodeT >
void openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::insertNode ( const Coord &  xyz,
NodeT &  node 
)
inline

Explicitly insert a node of the type NodeT into this Value Accessors cache.

Todo:
deprecate?

Definition at line 860 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
bool openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::isCached ( const Coord &  xyz) const
inline

Return true if any of the nodes along the path to the given coordinate have been cached.

Parameters
xyzThe index space coordinate to query

Definition at line 441 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
template<typename NodeT >
OPENVDB_FORCE_INLINE bool openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::isHashed ( [[maybe_unused] ] const Coord &  xyz) const
inlineprotected

Definition at line 949 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
bool openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::isValueOn ( const Coord &  xyz) const
inline

Return the active state of the voxel at the given coordinates.

Parameters
xyzThe index space coordinate to query

Definition at line 480 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
bool openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::isVoxel ( const Coord &  xyz) const
inline

Return true if the value of voxel (x, y, z) resides at the leaf level of the tree, i.e., if it is not a tile value.

Parameters
xyzThe index space coordinate to query

Definition at line 535 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
template<typename ModifyOp >
void openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::modifyValue ( const Coord &  xyz,
const ModifyOp &  op 
)
inline

Apply a functor to the value at the given coordinate and mark mark the coordinate as active.

See Tree::modifyValue() for details.

Parameters
xyzThe index space coordinate to modify
opThe modify operation

Definition at line 632 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
template<typename ModifyOp >
void openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::modifyValueAndActiveState ( const Coord &  xyz,
const ModifyOp &  op 
)
inline

Apply a functor to the voxel at the given coordinates.

See Tree::modifyValueAndActiveState() for details.

Parameters
xyzThe index space coordinate to modify
opThe modify operation

Definition at line 656 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
static constexpr Index openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::numCacheLevels ( )
inlinestatic

Return the number of cache levels employed by this ValueAccessor.

Definition at line 903 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
ValueAccessorImpl& openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::operator= ( const ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence > &  )
default
template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
const LeafNodeT* openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::probeConstLeaf ( const Coord &  xyz) const
inline

Return a pointer to the leaf node that contains the voxel coordinate xyz. If no LeafNode exists, returns a nullptr.

Parameters
xyzThe index space coordinate to query

Definition at line 838 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
template<typename NodeT >
const NodeT* openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::probeConstNode ( const Coord &  xyz) const
inline

Return a pointer to the node of the specified type that contains the value located at xyz. If no node of the given NodeT exists which contains the value, a nullptr is returned.

This function may return a nullptr even if the coordinate xyz is represented in tree, as it depends on the type NodeT provided. For example, the value may exist as a tile in an InternalNode but note as a LeafNode.

Parameters
xyzThe index space coordinate to query

Definition at line 805 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
LeafNodeT* openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::probeLeaf ( const Coord &  xyz)
inline

Return a pointer to the leaf node that contains the voxel coordinate xyz. If no LeafNode exists, returns a nullptr.

Parameters
xyzThe index space coordinate to query

Definition at line 836 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
const LeafNodeT* openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::probeLeaf ( const Coord &  xyz) const
inline

Return a pointer to the leaf node that contains the voxel coordinate xyz. If no LeafNode exists, returns a nullptr.

Parameters
xyzThe index space coordinate to query

Definition at line 837 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
template<typename NodeT >
NodeT* openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::probeNode ( const Coord &  xyz)
inline

Return a pointer to the node of the specified type that contains the value located at xyz. If no node of the given NodeT exists which contains the value, a nullptr is returned.

This function may return a nullptr even if the coordinate xyz is represented in tree, as it depends on the type NodeT provided. For example, the value may exist as a tile in an InternalNode but note as a LeafNode.

Parameters
xyzThe index space coordinate to query

Definition at line 777 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
bool openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::probeValue ( const Coord &  xyz,
ValueType value 
) const
inline

Return the active state of the value at a given coordinate as well as its value.

Parameters
xyzThe index space coordinate to query
valueThe value to get

Definition at line 492 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
void openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::release ( )
inlinefinaloverrideprotectedvirtual

Release this accessor from the tree, set the tree to null and clear the accessor cache. After calling this method the accessor will be completely invalid.

Reimplemented from openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorBase< _TreeType, IsSafe >.

Definition at line 916 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
void openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::setActiveState ( const Coord &  xyz,
bool  on = true 
)
inline

Set the active state of the voxel at the given coordinates without changing its value.

Note
This method will densify branches of the tree if the coordinate points to a tile and if the provided activate state flag is different to the tiles
Parameters
xyzThe index space coordinate to modify
onWhether to set the active state to on (true) or off (false)

Definition at line 683 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
void openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::setValue ( const Coord &  xyz,
const ValueType value 
)
inline

Set a particular value at the given coordinate and mark the coordinate as active.

Note
This method will densify branches of the tree if the coordinate points to a tile and if the provided value or active state is different to the tiles
Parameters
xyzThe index space coordinate to set
valueThe value to set

Definition at line 550 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
void openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::setValueOff ( const Coord &  xyz,
const ValueType value 
)
inline

Set a particular value at the given coordinate and mark the coordinate as inactive.

Note
This method will densify branches of the tree if the coordinate points to a tile and if the provided value or active state is different to the tiles
Parameters
xyzThe index space coordinate to set
valueThe value to set

Definition at line 607 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
void openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::setValueOff ( const Coord &  xyz)
inline

Mark the voxel at the given coordinates as inactive without changing its value.

Note
This method will densify branches of the tree if the coordinate points to a tile and if the tiles active state is on.
Parameters
xyzThe index space coordinate to modify

Definition at line 704 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
void openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::setValueOn ( const Coord &  xyz,
const ValueType value 
)
inline

Set a particular value at the given coordinate and mark the coordinate as active.

Note
This method will densify branches of the tree if the coordinate points to a tile and if the provided value or active state is different to the tiles
Parameters
xyzThe index space coordinate to set
valueThe value to set

Definition at line 569 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
void openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::setValueOn ( const Coord &  xyz)
inline

Mark the voxel at the given coordinates as active without changing its value.

Note
This method will densify branches of the tree if the coordinate points to a tile and if the tiles active state is off.
Parameters
xyzThe index space coordinate to modify

Definition at line 698 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
void openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::setValueOnly ( const Coord &  xyz,
const ValueType value 
)
inline

Set a particular value at the given coordinate but preserve its active state.

Note
This method will densify branches of the tree if the coordinate points to a tile and if the provided value is different to the tiles
Parameters
xyzThe index space coordinate to set
valueThe value to set

Definition at line 578 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
LeafNodeT* openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::touchLeaf ( const Coord &  xyz)
inline

Returns the leaf node that contains voxel (x, y, z) and if it doesn't exist, create it, but preserve the values and active states of the pre-existing branch.

Note
You can use this method to preallocate a static tree topology over which to safely perform multithreaded processing.
Parameters
xyzThe index space coordinate at which to create a LeafNode. Note that if this coordinate is not a LeafNode origin then the LeafNode that would otherwise contain this coordinate is created and returned.

Definition at line 715 of file ValueAccessor.h.

Friends And Related Function Documentation

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
template<typename , Index >
friend class InternalNode
friend

Definition at line 908 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
template<typename , Index >
friend class LeafNode
friend

Definition at line 909 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
template<typename >
friend class RootNode
friend

Definition at line 907 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
template<typename >
friend class Tree
friend

Definition at line 911 of file ValueAccessor.h.

Member Data Documentation

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
constexpr bool openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::BypassLeafAPI
static
Initial value:
=
IsLeafAndBypassLeafAPI<NodeTypeAtLevel<0>>

Helper alias which is true if the lowest cached node level is a LeafNode type and has a compatible value type for optimized access.

Definition at line 415 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
template<typename NodeT >
constexpr bool openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::IsLeafAndBypassLeafAPI
static
Initial value:
=
LeafCacheT::template BypassLeafAPI<NodeT>

Given a node type, return whether this Accessor can perform optimized value buffer accesses. This is only possible for LeafNodes so will always return false for any non LeafNode type. It also depends on the value type - if the value buffer is a contiguous index-able array of values then this returns true.

Definition at line 410 of file ValueAccessor.h.

template<typename TreeType, bool IsSafe = true, typename MutexT = void, typename IndexSequence = openvdb::make_index_sequence<std::max(size_t(1),TreeType::DEPTH)-1>>
constexpr size_t openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessorImpl< TreeType, IsSafe, MutexT, IndexSequence >::NumCacheLevels = NodeLevelList::Size-1
static

The number of node levels that this accessor can cache, excluding the RootNode.

Definition at line 420 of file ValueAccessor.h.


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