OpenVDB: ValueAccessor< TreeType, IsSafe, 3, tbb::null_mutex > Class Template Reference

OpenVDB 10.0.1

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
ValueAccessor< TreeType, IsSafe, 3, tbb::null_mutex > Class Template Reference

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

`#include <openvdb/tree/ValueAccessor.h>`

Inheritance diagram for ValueAccessor< TreeType, IsSafe, 3, tbb::null_mutex >:

## Public Types
using | TreeType = TreeType
using | ValueType = typename TreeType::ValueType
using | RootNodeT = typename TreeType::RootNodeType
using | LeafNodeT = typename TreeType::LeafNodeType
using | BaseT = ValueAccessorBase< TreeType, IsSafe >
using | InvTreeT = typename RootNodeT::NodeChainType
using | NodeT0 = typename InvTreeT::template Get< L0 >
using | NodeT1 = typename InvTreeT::template Get< L1 >
using | NodeT2 = typename InvTreeT::template Get< L2 >

## Public Member Functions
| ValueAccessor (TreeType &tree)
| ValueAccessor (const ValueAccessor &)=default
ValueAccessor & | operator= (const ValueAccessor &)=default
| ~ValueAccessor () override=default
bool | isCached (const Coord &xyz) const
const ValueType & | getValue (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 | setValueOn (const Coord &xyz)
| Mark the voxel at the given coordinates as active without changing its value.
void | setValueOnly (const Coord &xyz, const ValueType &value)
| Set the value of the voxel at the given coordinate but preserves 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 | setValueOff (const Coord &xyz)
| Mark the voxel at the given coordinates as inactive without changing its value.
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 without changing its value.
NodeT * | getNode ()
| Return the cached node of type NodeType. [Mainly for internal use].
void | insertNode (const Coord &xyz, NodeT &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.
LeafNodeT * | touchLeaf (const Coord &xyz)
NodeT * | probeNode (const Coord &xyz)
LeafNodeT * | probeLeaf (const Coord &xyz)
const LeafNodeT * | probeLeaf (const Coord &xyz) const
const NodeT * | probeConstNode (const Coord &xyz) const
const LeafNodeT * | probeConstLeaf (const Coord &xyz) const
void | clear () override
| Remove all the cached nodes and invalidate the corresponding hash-keys.
TreeType * | getTree () const
| Return a pointer to the tree associated with this accessor.
TreeType & | tree () const
| Return a reference to the tree associated with this accessor.

## Static Public Member Functions
static Index | numCacheLevels ()
| Return the number of cache levels employed by this ValueAccessor.
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 constexpr bool | BypassLeafAPI
static const bool | IsConstTree = std::is_const<TreeType>::value

## Protected Attributes
TreeType * | mTree

## Detailed Description

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

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

## Member Typedef Documentation

## ◆ BaseT

using BaseT = ValueAccessorBase<TreeType, IsSafe>
| inherited

## ◆ InvTreeT

using InvTreeT = typename RootNodeT::NodeChainType
| inherited

## ◆ LeafNodeT

using LeafNodeT = typename TreeType::LeafNodeType
| inherited

## ◆ NodeT0

using NodeT0 = typename InvTreeT::template Get<L0>
| inherited

## ◆ NodeT1

using NodeT1 = typename InvTreeT::template Get<L1>
| inherited

## ◆ NodeT2

using NodeT2 = typename InvTreeT::template Get<L2>
| inherited

## ◆ RootNodeT

using RootNodeT = typename TreeType::RootNodeType
| inherited

## ◆ TreeType

using TreeType = TreeType
| inherited

## ◆ ValueType

using ValueType = typename TreeType::ValueType
| inherited

## 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, 3, tbb::null_mutex > & |  | ) |
| default

## ◆ ~ValueAccessor()

template<typename TreeType , bool IsSafe>

~ValueAccessor | ( |  | ) |
| overridedefault

## Member Function Documentation

## ◆ addLeaf()

void addLeaf | ( | LeafNodeT * | leaf | ) |
| inlineinherited

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

## ◆ addTile()

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.

## ◆ clear()

void clear | ( |  | ) |
| inlineoverridevirtualinherited

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

Implements ValueAccessorBase< TreeType, IsSafe >.

## ◆ eraseNode()

void eraseNode | ( |  | ) |
| inlineinherited

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

NodeT * getNode | ( |  | ) |
| inlineinherited

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

## ◆ getTree()

template<typename TreeType , bool IsSafe>

TreeType * getTree | ( |  | ) | const
| inlineinherited

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
| inlineinherited

Return the value of the voxel at the given coordinates.

## ◆ getValueDepth()

int getValueDepth | ( | const Coord & | xyz | ) | const
| inlineinherited

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

void insertNode | ( | const Coord & | xyz,
|  | NodeT & | node
| ) |  |
| 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]

## ◆ isCached()

bool isCached | ( | const Coord & | xyz | ) | const
| inlineinherited

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

## ◆ isSafe()

template<typename TreeType , bool IsSafe>

static bool isSafe | ( |  | ) |
| inlinestaticinherited

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
| inlineinherited

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

## ◆ isVoxel()

bool isVoxel | ( | const Coord & | xyz | ) | const
| inlineinherited

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

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

Apply a functor to the voxel at the given coordinates.

See Tree::modifyValueAndActiveState() for details.

## ◆ numCacheLevels()

static Index numCacheLevels | ( |  | ) |
| inlinestaticinherited

Return the number of cache levels employed by this ValueAccessor.

## ◆ operator=()

template<typename TreeType , bool IsSafe>

ValueAccessor & operator= | ( | const ValueAccessor< TreeType, IsSafe, 3, tbb::null_mutex > & |  | ) |
| default

## ◆ probeConstLeaf()

const LeafNodeT * probeConstLeaf | ( | const Coord & | xyz | ) | const
| inlineinherited

Returns
  a const pointer to the leaf node that contains voxel (x, y, z) and if it doesn't exist, return `nullptr`.

## ◆ probeConstNode()

const NodeT * probeConstNode | ( | const Coord & | xyz | ) | const
| inlineinherited

Returns
  a const pointer to the node of the specified type that contains voxel (x, y, z) and if it doesn't exist, return `nullptr`.

## ◆ probeLeaf() [1/2]

LeafNodeT * probeLeaf | ( | const Coord & | xyz | ) |
| inlineinherited

Returns
  a pointer to the leaf node that contains voxel (x, y, z) and if it doesn't exist, return `nullptr`.

## ◆ probeLeaf() [2/2]

const LeafNodeT * probeLeaf | ( | const Coord & | xyz | ) | const
| inlineinherited

## ◆ probeNode()

NodeT * probeNode | ( | const Coord & | xyz | ) |
| inlineinherited

Returns
  a pointer to the node of the specified type that contains voxel (x, y, z) and if it doesn't exist, return `nullptr`.

## ◆ probeValue()

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

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

## ◆ setActiveState()

void setActiveState | ( | const Coord & | xyz,
|  | bool | on = `true`
| ) |  |
| inlineinherited

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

## ◆ setValue()

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.

## ◆ setValueOff() [1/2]

void setValueOff | ( | const Coord & | xyz | ) |
| inlineinherited

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

## ◆ setValueOff() [2/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.

## ◆ setValueOn() [1/2]

void setValueOn | ( | const Coord & | xyz | ) |
| inlineinherited

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

## ◆ setValueOn() [2/2]

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

## ◆ setValueOnly()

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

Set the value of the voxel at the given coordinate but preserves its active state.

## ◆ touchLeaf()

LeafNodeT * touchLeaf | ( | const Coord & | xyz | ) |
| inlineinherited

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 all voxels.

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

## ◆ tree()

template<typename TreeType , bool IsSafe>

TreeType & tree | ( |  | ) | const
| inlineinherited

Return a reference to the tree associated with this accessor.

## Member Data Documentation

## ◆ BypassLeafAPI

constexpr bool BypassLeafAPI
| staticconstexprinherited

## ◆ IsConstTree

template<typename TreeType , bool IsSafe>

const bool IsConstTree = std::is_const<TreeType>::value
| staticinherited

## ◆ mTree

template<typename TreeType , bool IsSafe>

TreeType* mTree
| protectedinherited