OpenVDB: ValueAccessor.h File Reference

OpenVDB 6.0.0

Classes | Namespaces
ValueAccessor.h File Reference
`#include <boost/mpl/front.hpp>`
`#include <boost/mpl/pop_front.hpp>`
`#include <boost/mpl/push_back.hpp>`
`#include <boost/mpl/size.hpp>`
`#include <boost/mpl/at.hpp>`
`#include <boost/mpl/equal_to.hpp>`
`#include <boost/mpl/comparison.hpp>`
`#include <boost/mpl/vector.hpp>`
`#include <boost/mpl/assert.hpp>`
`#include <boost/mpl/erase.hpp>`
`#include <boost/mpl/find.hpp>`
`#include <tbb/null_mutex.h>`
`#include <tbb/spin_mutex.h>`
`#include <openvdb/version.h>`
`#include <openvdb/Types.h>`
`#include <cassert>`
`#include <limits>`
`#include <type_traits>`

Go to the source code of this file.

## Classes
class | ValueAccessor0< _TreeType, IsSafe >
| ValueAccessor with no mutex and no node caching. More...
class | ValueAccessor1< _TreeType, IsSafe, L0 >
| Value accessor with one level of node caching. More...
class | ValueAccessor2< _TreeType, IsSafe, L0, L1 >
| Value accessor with two levels of node caching. More...
class | ValueAccessor3< _TreeType, IsSafe, L0, L1, L2 >
| Value accessor with three levels of node caching. More...
class | CacheItem< TreeCacheT, NodeVecT, AtRoot >
class | ValueAccessorBase< TreeType, IsSafe >
| This base class for ValueAccessors manages registration of an accessor with a tree so that the tree can automatically clear the accessor whenever one of its nodes is deleted. More...
class | ValueAccessor< _TreeType, IsSafe, CacheLevels, MutexType >
class | ValueAccessor< TreeType, IsSafe, 0, tbb::null_mutex >
| Template specialization of the ValueAccessor with no mutex and no cache levels. More...
class | ValueAccessor< TreeType, IsSafe, 1, tbb::null_mutex >
| Template specialization of the ValueAccessor with no mutex and one cache level. More...
class | ValueAccessor< TreeType, IsSafe, 2, tbb::null_mutex >
| Template specialization of the ValueAccessor with no mutex and two cache levels. More...
class | ValueAccessor< TreeType, IsSafe, 3, tbb::null_mutex >
| Template specialization of the ValueAccessor with no mutex and three cache levels. More...
class | ValueAccessorRW< TreeType, IsSafe >
| This accessor is thread-safe (at the cost of speed) for both reading and writing to a tree. That is, multiple threads may safely access a single, shared ValueAccessorRW. More...
class | CacheItem< TreeCacheT, NodeVecT, AtRoot >
class | CacheItem< TreeCacheT, NodeVecT, true >
| The tail of a compile-time list of cached node pointers, ordered from LeafNode to RootNode. More...
class | ValueAccessor0< _TreeType, IsSafe >
| ValueAccessor with no mutex and no node caching. More...
class | ValueAccessor1< _TreeType, IsSafe, L0 >
| Value accessor with one level of node caching. More...
class | ValueAccessor2< _TreeType, IsSafe, L0, L1 >
| Value accessor with two levels of node caching. More...
class | ValueAccessor3< _TreeType, IsSafe, L0, L1, L2 >
| Value accessor with three levels of node caching. More...

## Namespaces
| openvdb
| openvdb::v6_0
| openvdb::v6_0::tree

## Detailed Description

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.

Example:

FloatGrid grid;
FloatGrid::Accessor acc = grid.getAccessor();
// First access is slow:
acc.setValue(Coord(0, 0, 0), 100);
// Subsequent nearby accesses are fast, since the accessor now holds pointers
// to nodes that contain (0, 0, 0) along the path from the root of the grid's
// tree to the leaf:
acc.setValue(Coord(0, 0, 1), 100);
acc.getValue(Coord(0, 2, 0), 100);
// Slow, because the accessor must be repopulated:
acc.getValue(Coord(-1, -1, -1));
// Fast:
acc.getValue(Coord(-1, -1, -2));
acc.setValue(Coord(-1, -2, 0), -100);