HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ValueAccessor.h File Reference
#include <hboost/mpl/front.hpp>
#include <hboost/mpl/pop_front.hpp>
#include <hboost/mpl/push_back.hpp>
#include <hboost/mpl/size.hpp>
#include <hboost/mpl/at.hpp>
#include <hboost/mpl/equal_to.hpp>
#include <hboost/mpl/comparison.hpp>
#include <hboost/mpl/vector.hpp>
#include <hboost/mpl/assert.hpp>
#include <hboost/mpl/erase.hpp>
#include <hboost/mpl/find.hpp>
#include <hboost/static_assert.hpp>
#include <hboost/type_traits/is_const.hpp>
#include <tbb/null_mutex.h>
#include <tbb/spin_mutex.h>
#include <openvdb/version.h>
#include <openvdb/Types.h>
+ Include dependency graph for ValueAccessor.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessor0< TreeType, IsSafe >
 ValueAccessor with no mutex and no node caching. More...
 
class  openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessor1< TreeType, IsSafe, L0 >
 Value accessor with one level of node caching. More...
 
class  openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessor2< TreeType, IsSafe, L0, L1 >
 Value accessor with two levels of node caching. More...
 
class  openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessor3< TreeType, IsSafe, L0, L1, L2 >
 Value accessor with three levels of node caching. More...
 
class  openvdb::OPENVDB_VERSION_NAME::tree::CacheItem< TreeCacheT, NodeVecT, AtRoot >
 
class  openvdb::OPENVDB_VERSION_NAME::tree::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  openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessor< _TreeType, IsSafe, CacheLevels, MutexType >
 
class  openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessor< TreeType, IsSafe, 0, tbb::null_mutex >
 Template specialization of the ValueAccessor with no mutex and no cache levels. More...
 
class  openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessor< TreeType, IsSafe, 1, tbb::null_mutex >
 Template specialization of the ValueAccessor with no mutex and one cache level. More...
 
class  openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessor< TreeType, IsSafe, 2, tbb::null_mutex >
 Template specialization of the ValueAccessor with no mutex and two cache levels. More...
 
class  openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessor< TreeType, IsSafe, 3, tbb::null_mutex >
 Template specialization of the ValueAccessor with no mutex and three cache levels. More...
 
class  openvdb::OPENVDB_VERSION_NAME::tree::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  openvdb::OPENVDB_VERSION_NAME::tree::CacheItem< TreeCacheT, NodeVecT, AtRoot >
 
class  openvdb::OPENVDB_VERSION_NAME::tree::CacheItem< TreeCacheT, NodeVecT, true >
 The tail of a compile-time list of cached node pointers, ordered from LeafNode to RootNode. More...
 
class  openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessor0< TreeType, IsSafe >
 ValueAccessor with no mutex and no node caching. More...
 
class  openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessor1< TreeType, IsSafe, L0 >
 Value accessor with one level of node caching. More...
 
class  openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessor2< TreeType, IsSafe, L0, L1 >
 Value accessor with two levels of node caching. More...
 
class  openvdb::OPENVDB_VERSION_NAME::tree::ValueAccessor3< TreeType, IsSafe, L0, L1, L2 >
 Value accessor with three levels of node caching. More...
 

Namespaces

 openvdb
 
 openvdb::OPENVDB_VERSION_NAME
 
 openvdb::OPENVDB_VERSION_NAME::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);

Definition in file ValueAccessor.h.