|
| BOOST_STATIC_ASSERT (CacheLevels<=_TreeType::DEPTH-1) |
|
| ValueAccessor (TreeType &tree) |
|
| ValueAccessor (const ValueAccessor &other) |
|
ValueAccessor & | operator= (const ValueAccessor &other) |
|
virtual | ~ValueAccessor () |
|
bool | isCached (const Coord &xyz) const |
| Return true if nodes along the path to the given voxel have been cached. More...
|
|
const ValueType & | getValue (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 voxel as well as its value. More...
|
|
int | getValueDepth (const Coord &xyz) const |
|
bool | isVoxel (const Coord &xyz) const |
|
void | setValueOnly (const Coord &xyz, const ValueType &value) |
| Set the value of the voxel at the given coordinate but preserves its active state. More...
|
|
void | newSetValue (const Coord &xyz, const ValueType &value) |
|
void | setValueOff (const Coord &xyz, const ValueType &value) |
| Set the value of the voxel at the given coordinates and mark the voxel as inactive. More...
|
|
void | setValueOnSum (const Coord &xyz, const ValueType &value) |
|
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...
|
|
template<typename NodeType > |
NodeType * | getNode () |
| Return the cached node of type NodeType. [Mainly for internal use]. More...
|
|
template<typename NodeType > |
void | insertNode (const Coord &xyz, NodeType &node) |
|
template<typename NodeType > |
void | eraseNode () |
|
LeafNodeT * | touchLeaf (const Coord &xyz) |
|
LeafNodeT * | probeLeaf (const Coord &xyz) |
|
const LeafNodeT * | probeConstLeaf (const Coord &xyz) |
|
virtual void | clear () |
| Remove all nodes from this cache, then reinsert the root node. More...
|
|
_TreeType * | getTree () 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. More...
|
|
void | setValueOn (const Coord &xyz, const ValueType &value) |
| Set the value of the voxel at the given coordinates and mark the voxel as active. More...
|
|
template<typename _TreeType, Index CacheLevels = _TreeType::DEPTH-1, typename MutexType = tbb::null_mutex>
class openvdb::v0_104_0::tree::ValueAccessor< _TreeType, CacheLevels, MutexType >
When traversing a grid in a spatially coherent pattern (e.g., iterating over neighboring voxels), request a ValueAccessor
from the grid (with Grid::getAccessor()) and use the accessor's getValue()
and setValue()
methods. These will typically be significantly faster than accessing voxels directly in the grid's tree.
- Note
- If
MutexType
is a TBB-compatible mutex, then multiple threads may safely access a single, shared accessor. However, it is highly recommended that, instead, each thread be assigned its own, non-mutex-protected accessor.
Conceptually this ValueAccessor is a node-cache with accessor methods. Specefically the tree nodes from a previous access are cached and re-used starting with the LeafNode and moving up throug the node levels of the tree. Thus this node caching essentiall leads to acceleration of spatially coherent access by means of inverted tree traversal!
- Parameters
-
_TreeType | This is the only template paramter that always has to be specified. |
CacheLevels | Used to specify the number of bottom nodes that are cached. The default caches all (non-root) nodes. The maximum allowed number of CacheLevels correspond to the number of non-root nodes, i.e. CacheLevels <= DEPTH-1! |
MutexType | This defines the type of mutex-lock and should almost always be left untouched (unless you're and expert!) |