OpenVDB 10.0.1
Loading...
Searching...
No Matches
ValueAccessor< TreeType, IsSafe, 0, tbb::null_mutex > Class Template Reference

Template specialization of the ValueAccessor with no mutex and no cache levels. More...

#include <openvdb/tree/ValueAccessor.h>

Inheritance diagram for ValueAccessor< TreeType, IsSafe, 0, tbb::null_mutex >:
ValueAccessorBase< TreeType, IsSafe > ValueAccessor0< TreeType, IsSafe > ValueAccessorBase< TreeType, IsSafe >

Public Types

using TreeType
using RootNodeT
using LeafNodeT
using ValueType
using BaseT
using LockT

Public Member Functions

 ValueAccessor (TreeType &tree)
 ValueAccessor (const ValueAccessor &other)
 ~ValueAccessor () override=default
ValueAccessoroperator= (const ValueAccessor &other)
bool isCached (const Coord &xyz) const
 Return true if nodes along the path to the given voxel have been cached.
const ValueTypegetValue (const Coord &xyz) const
 Return the value of the voxel at the given coordinates.
bool isValueOn (const Coord &xyz) const
 Return the active state of the voxel at the given coordinates.
bool probeValue (const Coord &xyz, ValueType &value) const
 Return the active state of the voxel as well as its value.
int getValueDepth (const Coord &xyz) const
bool isVoxel (const Coord &xyz) const
void setValue (const Coord &xyz, const ValueType &value)
 Set the value of the voxel at the given coordinates and mark the voxel as active.
void setValueOn (const Coord &xyz, const ValueType &value)
void setValueOnly (const Coord &xyz, const ValueType &value)
 Set the value of the voxel at the given coordinate but don't change its active state.
void setValueOff (const Coord &xyz, const ValueType &value)
 Set the value of the voxel at the given coordinates and mark the voxel as inactive.
void modifyValue (const Coord &xyz, const ModifyOp &op)
 Apply a functor to the value of the voxel at the given coordinates and mark the voxel as active.
void modifyValueAndActiveState (const Coord &xyz, const ModifyOp &op)
 Apply a functor to the voxel at the given coordinates.
void setActiveState (const Coord &xyz, bool on=true)
 Set the active state of the voxel at the given coordinates but don't change its value.
NodeType * getNode ()
 Return the cached node of type NodeType. [Mainly for internal use].
void insertNode (const Coord &xyz, NodeType &node)
void eraseNode ()
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.
void addTile (Index level, const Coord &xyz, const ValueType &value, bool state)
 Add a tile at the specified tree level that contains voxel (x, y, z), possibly deleting existing nodes or creating new nodes in the process.
LeafNodeTtouchLeaf (const Coord &xyz)
 Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, create one, but preserve the values and active states of all voxels.
NodeT * probeNode (const Coord &xyz)
 Return a pointer to the node of the specified type that contains voxel (x, y, z), or nullptr if no such node exists.
const NodeT * probeConstNode (const Coord &xyz) const
LeafNodeTprobeLeaf (const Coord &xyz)
 Return a pointer to the leaf node that contains voxel (x, y, z), or nullptr if no such node exists.
const LeafNodeTprobeConstLeaf (const Coord &xyz) const
void clear () override
 Remove all nodes from this cache, then reinsert the root node.
TreeTypegetTree () const
 Return a pointer to the tree associated with this accessor.
TreeTypetree () const
 Return a reference to the tree associated with this accessor.
bool probeValue (const Coord &xyz, ValueType &value) const
 Return the active state and, in value, the value of the voxel at the given coordinates.
void setValue (const Coord &xyz, const ValueType &value)
 Set the value of the voxel at the given coordinates and mark the voxel as active.
void setValueOn (const Coord &xyz, const ValueType &value)
void setValueOnly (const Coord &xyz, const ValueType &value)
 Set the value of the voxel at the given coordinate but don't change its active state.
void setValueOff (const Coord &xyz, const ValueType &value)
 Set the value of the voxel at the given coordinates and mark the voxel as inactive.
void insertNode (const Coord &, NodeT &)
void addTile (Index level, const Coord &xyz, const ValueType &value, bool state)
 Add a tile at the specified tree level that contains voxel (x, y, z), possibly deleting existing nodes or creating new nodes in the process.

Static Public Member Functions

static Index numCacheLevels ()
 Return the number of cache levels employed by this accessor.
static 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).

Static Public Attributes

static const bool IsConstTree
static constexpr bool BypassLeafAPI

Protected Attributes

TreeTypemTree

Friends

class RootNode
class InternalNode
class LeafNode
class Tree

Detailed Description

template<typename TreeType, bool IsSafe>
class openvdb::v10_0::tree::ValueAccessor< TreeType, IsSafe, 0, tbb::null_mutex >

Template specialization of the ValueAccessor with no mutex and no cache levels.

This specialization is provided mainly for benchmarking. Accessors with caching will almost always be faster.

Member Typedef Documentation

◆ BaseT

using BaseT

◆ LeafNodeT

using LeafNodeT

◆ LockT

using LockT

◆ RootNodeT

using RootNodeT

◆ TreeType

using TreeType

◆ ValueType

using ValueType

Constructor & Destructor Documentation

◆ ValueAccessor() [1/2]

template<typename TreeType, bool IsSafe>
ValueAccessor ( TreeType & tree)
inline

◆ ValueAccessor() [2/2]

template<typename TreeType, bool IsSafe>
ValueAccessor ( const ValueAccessor< TreeType, IsSafe, 0, tbb::null_mutex > & other)
inline

◆ ~ValueAccessor()

template<typename TreeType, bool IsSafe>
~ValueAccessor ( )
overridedefault

Member Function Documentation

◆ addLeaf()

void 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.

◆ addTile() [1/2]

void addTile ( Index level,
const Coord & xyz,
const ValueType & value,
bool state )
inlineinherited

Add a tile at the specified tree level that contains voxel (x, y, z), possibly deleting existing nodes or creating new nodes in the process.

◆ addTile() [2/2]

void addTile ( Index level,
const Coord & xyz,
const ValueType & value,
bool state )
inline

Add a tile at the specified tree level that contains voxel (x, y, z), possibly deleting existing nodes or creating new nodes in the process.

◆ clear()

void clear ( )
inlineoverridevirtual

Remove all nodes from this cache, then reinsert the root node.

Implements ValueAccessorBase< TreeType, IsSafe >.

◆ eraseNode()

void eraseNode ( )
inline

If a node of the given type exists in the cache, remove it, so that isCached(xyz) returns false for any voxel (x, y, z) contained in that node. [Mainly for internal use]

◆ getNode()

NodeType * getNode ( )
inline

Return the cached node of type NodeType. [Mainly for internal use].

◆ getTree()

TreeType * getTree ( ) const
inline

Return a pointer to the tree associated with this accessor.

The pointer will be null only if the tree from which this accessor was constructed was subsequently deleted (which generally leaves the accessor in an unsafe state).

◆ getValue()

const ValueType & getValue ( const Coord & xyz) const
inline

Return the value of the voxel at the given coordinates.

◆ getValueDepth()

int 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).

◆ insertNode() [1/2]

void insertNode ( const Coord & ,
NodeT &  )
inlineinherited

Cache the given node, which should lie along the path from the root node to the node containing voxel (x, y, z). [Mainly for internal use]

◆ insertNode() [2/2]

void insertNode ( const Coord & xyz,
NodeType & node )
inline

Cache the given node, which should lie along the path from the root node to the node containing voxel (x, y, z). [Mainly for internal use]

◆ isCached()

bool isCached ( const Coord & xyz) const
inline

Return true if nodes along the path to the given voxel have been cached.

◆ isSafe()

bool isSafe ( )
inlinestatic

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).

◆ isValueOn()

bool isValueOn ( const Coord & xyz) const
inline

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

◆ isVoxel()

bool 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.

◆ modifyValue()

void modifyValue ( const Coord & xyz,
const ModifyOp & op )
inline

Apply a functor to the value of the voxel at the given coordinates and mark the voxel as active.

See Tree::modifyValue() for details.

◆ modifyValueAndActiveState()

void modifyValueAndActiveState ( const Coord & xyz,
const ModifyOp & op )
inline

Apply a functor to the voxel at the given coordinates.

See Tree::modifyValueAndActiveState() for details.

◆ numCacheLevels()

Index numCacheLevels ( )
inlinestatic

Return the number of cache levels employed by this accessor.

◆ operator=()

ValueAccessor & operator= ( const ValueAccessor< TreeType, IsSafe, 0, tbb::null_mutex > & other)
inline

◆ probeConstLeaf()

const LeafNodeT * probeConstLeaf ( const Coord & xyz) const
inline

◆ probeConstNode()

const NodeT * probeConstNode ( const Coord & xyz) const
inline

◆ probeLeaf()

LeafNodeT * probeLeaf ( const Coord & xyz)
inline

Return a pointer to the leaf node that contains voxel (x, y, z), or nullptr if no such node exists.

◆ probeNode()

NodeT * probeNode ( const Coord & xyz)
inline

Return a pointer to the node of the specified type that contains voxel (x, y, z), or nullptr if no such node exists.

◆ probeValue() [1/2]

bool probeValue ( const Coord & xyz,
ValueType & value ) const
inlineinherited

Return the active state and, in value, the value of the voxel at the given coordinates.

◆ probeValue() [2/2]

bool probeValue ( const Coord & xyz,
ValueType & value ) const
inline

Return the active state of the voxel as well as its value.

◆ setActiveState()

void setActiveState ( const Coord & xyz,
bool on = true )
inline

Set the active state of the voxel at the given coordinates but don't change its value.

◆ setValue() [1/2]

void setValue ( const Coord & xyz,
const ValueType & value )
inlineinherited

Set the value of the voxel at the given coordinates and mark the voxel as active.

◆ setValue() [2/2]

void setValue ( const Coord & xyz,
const ValueType & value )
inline

Set the value of the voxel at the given coordinates and mark the voxel as active.

◆ setValueOff() [1/2]

void setValueOff ( const Coord & xyz,
const ValueType & value )
inlineinherited

Set the value of the voxel at the given coordinates and mark the voxel as inactive.

◆ setValueOff() [2/2]

void setValueOff ( const Coord & xyz,
const ValueType & value )
inline

Set the value of the voxel at the given coordinates and mark the voxel as inactive.

◆ setValueOn() [1/2]

void setValueOn ( const Coord & xyz,
const ValueType & value )
inlineinherited

◆ setValueOn() [2/2]

void setValueOn ( const Coord & xyz,
const ValueType & value )
inline

◆ setValueOnly() [1/2]

void setValueOnly ( const Coord & xyz,
const ValueType & value )
inlineinherited

Set the value of the voxel at the given coordinate but don't change its active state.

◆ setValueOnly() [2/2]

void setValueOnly ( const Coord & xyz,
const ValueType & value )
inline

Set the value of the voxel at the given coordinate but don't change its active state.

◆ touchLeaf()

LeafNodeT * touchLeaf ( const Coord & xyz)
inline

Return a pointer to the leaf node that contains voxel (x, y, z). If no such node exists, create one, but preserve the values and active states of all voxels.

Use this method to preallocate a static tree topology over which to safely perform multithreaded processing.

◆ tree()

TreeType & tree ( ) const
inline

Return a reference to the tree associated with this accessor.

◆ InternalNode

friend class InternalNode
friend

◆ LeafNode

friend class LeafNode
friend

◆ RootNode

friend class RootNode
friend

◆ Tree

friend class Tree
friend

Member Data Documentation

◆ BypassLeafAPI

bool BypassLeafAPI
staticconstexpr

◆ IsConstTree

static

◆ mTree

TreeType* mTree
protected