45#ifndef OPENVDB_TREE_VALUEACCESSOR_HAS_BEEN_INCLUDED
46#define OPENVDB_TREE_VALUEACCESSOR_HAS_BEEN_INCLUDED
48#include <openvdb/version.h>
51#include <tbb/spin_mutex.h>
64template<
typename TreeType,
66 typename MutexT = void,
68class ValueAccessorImpl;
84template<
typename TreeType,
bool IsSafe =
true,
85 size_t CacheLevels = std::max(
Index(1),TreeType::DEPTH)-1,
typename MutexType =
void>
92template <
typename TreeType,
bool IsSafe>
98template <
typename TreeType,
bool IsSafe,
size_t L0 = 0>
106template <
typename TreeType,
bool IsSafe,
size_t L0 = 0,
size_t L1 = 1>
114template <
typename TreeType,
bool IsSafe,
size_t L0 = 0,
size_t L1 = 1,
size_t L2 = 2>
119template<
typename TreeType,
bool IsSafe =
true,
120 size_t CacheLevels = std::max(
Index(1),TreeType::DEPTH)-1>
150template<
typename TreeType,
bool IsSafe>
155 static constexpr bool IsConstTree = std::is_const<TreeType>::value;
163 static constexpr bool isSafe() {
return IsSafe; }
171 if (IsSafe) tree.attachAccessor(*
this);
181 if (IsSafe && mTree) mTree->attachAccessor(*
this);
186 if (&other !=
this) {
187 if (IsSafe && mTree) mTree->releaseAccessor(*
this);
189 if (IsSafe && mTree) mTree->attachAccessor(*
this);
201 TreeType&
tree()
const { assert(mTree);
return *mTree; }
208 template<
typename>
friend class Tree;
217namespace value_accessor_internal
220template<
typename ListT,
size_t... Ts>
struct NodeListBuilderImpl;
222template <
typename NodeChainT>
223struct NodeListBuilderImpl<NodeChainT>
228template <
typename NodeChainT,
size_t Idx>
229struct NodeListBuilderImpl<NodeChainT, Idx>
231 using NodeT =
typename NodeChainT::template Get<Idx>;
235template <
typename NodeChainT,
size_t ThisIdx,
size_t NextIdx,
size_t... Idxs>
236struct NodeListBuilderImpl<NodeChainT, ThisIdx, NextIdx, Idxs...>
238 static_assert(ThisIdx < NextIdx,
239 "Invalid cache level - Cache levels must be in increasing ascending order");
240 static_assert(ThisIdx < NodeChainT::Size,
241 "Invalid cache level - Cache level is larger than the number of tree nodes");
242 static_assert(ThisIdx < NodeChainT::Back::LEVEL,
243 "Invalid cache level - Cache level is larger than the number of tree nodes");
245 using NodeT =
typename NodeChainT::template Get<ThisIdx>;
247 typename NodeListBuilderImpl<NodeChainT, NextIdx, Idxs...>::ListT>;
250template<
typename NodeChainT,
size_t RootLevel,
typename IntegerSequence>
251struct NodeListBuilder;
253template<
typename NodeChainT,
size_t RootLevel,
size_t... Is>
254struct NodeListBuilder<NodeChainT, RootLevel,
std::integer_sequence<size_t, Is...>>
256 using ListT =
typename NodeListBuilderImpl<NodeChainT, Is..., RootLevel>::ListT;
259template<
typename NodeChainT,
size_t RootLevel,
size_t... Is>
260struct NodeListBuilder<NodeChainT, RootLevel,
openvdb::index_sequence<Is...>>
262 using ListT =
typename NodeListBuilderImpl<NodeChainT, Is..., RootLevel>::ListT;
266template<
typename TreeTypeT,
typename NodeT>
267struct EnableLeafBuffer
269 using LeafNodeT =
typename TreeTypeT::LeafNodeType;
270 static constexpr bool value =
271 std::is_same<NodeT, LeafNodeT>::value &&
272 std::is_same<
typename LeafNodeT::Buffer::StorageType,
273 typename LeafNodeT::ValueType>::value;
276template<
typename TreeTypeT,
size_t... Is>
277struct EnableLeafBuffer<TreeTypeT,
openvdb::index_sequence<Is...>>
280 static constexpr bool value =
false;
283template<
typename TreeTypeT,
size_t First,
size_t... Is>
284struct EnableLeafBuffer<TreeTypeT,
openvdb::index_sequence<First, Is...>>
287 using NodeChainT =
typename TreeTypeT::RootNodeType::NodeChainType;
288 using FirstNodeT =
typename NodeChainT::template Get<First>;
290 static constexpr bool value = EnableLeafBuffer<TreeTypeT, FirstNodeT>::value;
310template <
typename MutexT>
313 inline auto lock()
const {
return std::scoped_lock(m); }
322 inline constexpr auto lock()
const {
return 0; }
331template<
typename TreeTypeT,
typename IntegerSequence,
typename Enable =
void>
334 template <
typename NodeT>
335 static constexpr bool BypassLeafAPI =
336 std::is_same<NodeT, typename TreeTypeT::LeafNodeType>::value;
337 inline const typename TreeTypeT::ValueType*
buffer() { assert(mBuffer);
return mBuffer; }
338 inline const typename TreeTypeT::ValueType*
buffer()
const { assert(mBuffer);
return mBuffer; }
339 inline void setBuffer(
const typename TreeTypeT::ValueType* b)
const { mBuffer = b; }
341 mutable const typename TreeTypeT::ValueType* mBuffer;
346template<
typename TreeTypeT,
typename IntegerSequence>
348 typename
std::enable_if<
349 !value_accessor_internal::EnableLeafBuffer<TreeTypeT, IntegerSequence>::value
352 template <
typename>
static constexpr bool BypassLeafAPI =
false;
353 inline constexpr typename TreeTypeT::ValueType*
buffer() { assert(
false);
return nullptr; }
354 inline constexpr typename TreeTypeT::ValueType*
buffer()
const { assert(
false);
return nullptr; }
355 inline constexpr void setBuffer(
const typename TreeTypeT::ValueType*)
const { assert(
false); }
362template<
typename _TreeType,
bool IsSafe,
typename MutexT,
typename IntegerSequence>
385 typename value_accessor_internal::NodeListBuilder
386 <
NodeChainT, RootNodeT::LEVEL, IntegerSequence>::ListT;
387 using NodePtrList =
typename NodeLevelList::template Transform<std::add_pointer_t>;
401 template <
size_t Level>
409 template <
typename NodeT>
410 static constexpr bool IsLeafAndBypassLeafAPI =
411 LeafCacheT::template BypassLeafAPI<NodeT>;
415 static constexpr bool BypassLeafAPI =
416 IsLeafAndBypassLeafAPI<NodeTypeAtLevel<0>>;
420 static constexpr size_t NumCacheLevels = NodeLevelList::Size-1;
421 static_assert(TreeType::DEPTH >= NodeLevelList::Size-1,
"cache size exceeds tree depth");
422 static_assert(NodeLevelList::Size > 0,
"unexpected cache size");
441 bool isCached(const
Coord& xyz)
const
445 using NodeType =
typename NodeLevelList::template Get<Idx>;
447 constexpr bool IsRoot = std::is_same<RootNodeT, NodeType>::value;
448 if constexpr(IsRoot)
return false;
449 else return (this->isHashed<NodeType>(xyz));
461 using NodeType =
typename NodeLevelList::template Get<Idx>;
465 if (!this->isHashed<NodeType>(xyz))
return nullptr;
467 if constexpr(IsLeafAndBypassLeafAPI<NodeType>) {
468 return &(LeafCacheT::buffer()[LeafNodeT::coordToOffset(xyz)]);
471 auto node = mNodes.template get<Idx>();
473 return &(node->getValueAndCache(xyz, *
this));
482 return this->evalFirstCached(xyz, [&](
const auto node) ->
bool {
484 return node->isValueOnAndCache(xyz, *
this);
494 return this->evalFirstCached(xyz, [&](
const auto node) ->
bool
496 using NodeType = std::remove_pointer_t<
decltype(node)>;
499 if constexpr(IsLeafAndBypassLeafAPI<NodeType>) {
500 const auto offset = LeafNodeT::coordToOffset(xyz);
501 value = LeafCacheT::buffer()[offset];
502 return node->isValueOn(offset);
505 return node->probeValueAndCache(xyz, value, *
this);
518 return this->evalFirstCached(xyz, [&](
const auto node) ->
int
520 using NodeType = std::remove_pointer_t<
decltype(node)>;
523 if constexpr(std::is_same<RootNodeT, NodeType>::value) {
524 return node->getValueDepthAndCache(xyz, *
this);
527 return int(RootNodeT::LEVEL - node->getValueLevelAndCache(xyz, *
this));
537 assert(BaseT::mTree);
538 return this->getValueDepth(xyz) ==
539 static_cast<int>(RootNodeT::LEVEL);
552 static_assert(!BaseT::IsConstTree,
"can't modify a const tree's values");
553 this->evalFirstCached(xyz, [&](
const auto node) ->
void
555 using NodeType = std::remove_pointer_t<
decltype(node)>;
558 if constexpr(IsLeafAndBypassLeafAPI<NodeType>) {
559 const auto offset = LeafNodeT::coordToOffset(xyz);
560 const_cast<ValueType&
>(LeafCacheT::buffer()[offset]) = value;
561 const_cast<NodeType*
>(node)->setValueOn(offset);
564 const_cast<NodeType*
>(node)->setValueAndCache(xyz, value, *
this);
580 static_assert(!BaseT::IsConstTree,
"can't modify a const tree's values");
585 using NodeType =
typename NodeLevelList::template Get<Idx>;
586 if (!this->isHashed<NodeType>(xyz))
return false;
588 if constexpr(IsLeafAndBypassLeafAPI<NodeType>) {
589 const_cast<ValueType&
>(LeafCacheT::buffer()[LeafNodeT::coordToOffset(xyz)]) = value;
592 auto node = mNodes.template get<Idx>();
594 const_cast<NodeType*
>(node)->setValueOnlyAndCache(xyz, value, *
this);
609 static_assert(!BaseT::IsConstTree,
"can't modify a const tree's values");
610 this->evalFirstCached(xyz, [&](
const auto node) ->
void
612 using NodeType = std::remove_pointer_t<
decltype(node)>;
615 if constexpr(IsLeafAndBypassLeafAPI<NodeType>) {
616 const auto offset = LeafNodeT::coordToOffset(xyz);
617 const_cast<ValueType&
>(LeafCacheT::buffer()[offset]) = value;
618 const_cast<NodeType*
>(node)->setValueOff(offset);
621 const_cast<NodeType*
>(node)->setValueOffAndCache(xyz, value, *
this);
631 template<
typename ModifyOp>
634 static_assert(!BaseT::IsConstTree,
"can't modify a const tree's values");
635 this->evalFirstCached(xyz, [&](
const auto node) ->
void
637 using NodeType = std::remove_pointer_t<
decltype(node)>;
640 if constexpr(IsLeafAndBypassLeafAPI<NodeType>) {
641 const auto offset = LeafNodeT::coordToOffset(xyz);
642 op(
const_cast<ValueType&
>(LeafCacheT::buffer()[offset]));
643 const_cast<NodeType*
>(node)->setActiveState(offset,
true);
646 const_cast<NodeType*
>(node)->modifyValueAndCache(xyz, op, *
this);
655 template<
typename ModifyOp>
658 static_assert(!BaseT::IsConstTree,
"can't modify a const tree's values");
659 this->evalFirstCached(xyz, [&](
const auto node) ->
void
661 using NodeType = std::remove_pointer_t<
decltype(node)>;
664 if constexpr(IsLeafAndBypassLeafAPI<NodeType>) {
665 const auto offset = LeafNodeT::coordToOffset(xyz);
666 bool state = node->isValueOn(offset);
667 op(
const_cast<ValueType&
>(LeafCacheT::buffer()[offset]), state);
668 const_cast<NodeType*
>(node)->setActiveState(offset, state);
671 const_cast<NodeType*
>(node)->modifyValueAndActiveStateAndCache(xyz, op, *
this);
685 static_assert(!BaseT::IsConstTree,
"can't modify a const tree's values");
686 this->evalFirstCached(xyz, [&](
const auto node) ->
void
688 using NodeType = std::remove_pointer_t<
decltype(node)>;
690 const_cast<NodeType*
>(node)->setActiveStateAndCache(xyz, on, *
this);
717 static_assert(!BaseT::IsConstTree,
"can't get a non-const node from a const tree");
718 return this->evalFirstCached(xyz, [&](
const auto node) ->
LeafNodeT*
720 using NodeType = std::remove_pointer_t<
decltype(node)>;
722 return const_cast<NodeType*
>(node)->touchLeafAndCache(xyz, *
this);
732 static_assert(!BaseT::IsConstTree,
"can't add a node to a const tree");
733 static_assert(Start >= 0);
735 this->evalFirstCached<Start>(leaf->origin(), [&](
const auto node) ->
void
737 using NodeType = std::remove_pointer_t<decltype(node)>;
739 const_cast<NodeType*>(node)->addLeafAndCache(leaf, *this);
757 static_assert(!BaseT::IsConstTree,
"can't add a tile to a const tree");
758 static_assert(Start >= 0);
759 this->evalFirstCached<Start>(xyz, [&](
const auto node) ->
void
761 using NodeType = std::remove_pointer_t<
decltype(node)>;
763 const_cast<NodeType*
>(node)->addTileAndCache(level, xyz, value, state, *
this);
776 template<
typename NodeT>
779 static_assert(!BaseT::IsConstTree,
"can't get a non-const node from a const tree");
780 return this->evalFirstPred([&](
const auto Idx) ->
bool
782 using NodeType =
typename NodeLevelList::template Get<Idx>;
784 constexpr bool NodeMayBeCached =
785 std::is_same<NodeT, NodeType>::value || NodeT::LEVEL < NodeType::LEVEL;
787 if constexpr(NodeMayBeCached)
return this->isHashed<NodeType>(xyz);
790 [&](
const auto node) -> NodeT*
792 using NodeType = std::remove_pointer_t<
decltype(node)>;
794 if constexpr(std::is_same<NodeT, NodeType>::value) {
795 return const_cast<NodeT*
>(node);
798 assert(NodeT::LEVEL < NodeType::LEVEL);
799 return const_cast<NodeType*
>(node)->
template probeNodeAndCache<NodeT>(xyz, *
this);
804 template<
typename NodeT>
807 return this->evalFirstPred([&](
const auto Idx) ->
bool
809 using NodeType =
typename NodeLevelList::template Get<Idx>;
811 constexpr bool NodeMayBeCached =
812 std::is_same<NodeT, NodeType>::value || NodeT::LEVEL < NodeType::LEVEL;
814 if constexpr(NodeMayBeCached)
return this->isHashed<NodeType>(xyz);
817 [&](
const auto node) ->
const NodeT*
819 using NodeType = std::remove_pointer_t<
decltype(node)>;
821 if constexpr(std::is_same<NodeT, NodeType>::value) {
825 assert(NodeT::LEVEL < NodeType::LEVEL);
826 return const_cast<NodeType*
>(node)->
template probeConstNodeAndCache<NodeT>(xyz, *
this);
840 return this->
template probeConstNode<LeafNodeT>(xyz);
847 template<
typename NodeT>
850 using NodeType =
typename std::decay<NodeT>::type;
851 static constexpr int64_t Idx = NodeLevelList::template
Index<NodeType>;
852 if constexpr (Idx >= 0)
return mNodes.template get<Idx>();
859 template<
typename NodeT>
862 this->insert(xyz, &node);
868 template<
typename NodeT>
871 static constexpr int64_t Idx = NodeLevelList::template
Index<NodeT>;
872 if constexpr (Idx >= 0) {
873 mKeys[Idx] = Coord::max();
874 mNodes.template get<Idx>() =
nullptr;
882 mKeys.fill(Coord::max());
883 mNodes.foreach([](
auto& node) { node =
nullptr; });
884 if constexpr (BypassLeafAPI) {
885 LeafCacheT::setBuffer(
nullptr);
889 mNodes.template get<Idx>() =
const_cast<RootNodeT*
>(&(BaseT::mTree->root()));
896 typename std::conditional<(NumCacheLevels > 0), NodeTypeAtLevel<0>,
void>::type;
898 typename std::conditional<(NumCacheLevels > 1), NodeTypeAtLevel<1>,
void>::type;
900 typename std::conditional<(NumCacheLevels > 2), NodeTypeAtLevel<2>,
void>::type;
903 static constexpr
Index numCacheLevels() {
return NumCacheLevels; }
911 template<
typename>
friend class Tree;
918 this->BaseT::release();
929 template<
typename NodeT>
931 [[maybe_unused]]
const Coord& xyz,
932 [[maybe_unused]]
const NodeT* node)
const
935 if constexpr(!NodeLevelList::template Contains<NodeT>)
return;
937 constexpr uint64_t Idx = uint64_t(NodeLevelList::template
Index<NodeT>);
938 static_assert(NodeLevelList::template Contains<NodeT>);
939 static_assert(Idx < NumCacheLevels);
940 mKeys[Idx] = xyz & ~(NodeT::DIM-1);
941 mNodes.template get<Idx>() =
const_cast<NodeT*
>(node);
942 if constexpr(IsLeafAndBypassLeafAPI<NodeT>) {
943 LeafCacheT::setBuffer(node->buffer().data());
948 template<
typename NodeT>
951 if constexpr(!NodeLevelList::template Contains<NodeT>)
return false;
952 if constexpr(std::is_same<NodeT, RootNodeT>::value) {
956 constexpr uint64_t Idx = uint64_t(NodeLevelList::template
Index<NodeT>);
957 static_assert(NodeLevelList::template Contains<NodeT>);
958 static_assert(Idx < NumCacheLevels + 1);
969 template <
typename OpT>
972 assert(BaseT::mTree);
974 [[maybe_unused]]
const auto lock = this->lock();
976 using IndexT = std::integral_constant<std::size_t, 0>;
977 using RetT =
typename std::invoke_result<OpT, IndexT>::type;
986 template <
typename PredT,
typename OpT>
989 assert(BaseT::mTree);
991 [[maybe_unused]]
const auto lock = this->lock();
992 using RetT =
typename std::invoke_result<OpT, RootNodeT*>::type;
993 if constexpr(!std::is_same<RetT, void>::value) {
994 return mNodes.evalFirstPred(pred, op, RetT(
false));
997 return mNodes.evalFirstPred(pred, op);
1006 template <
size_t Start = 0,
typename OpT =
void>
1009 return this->evalFirstPred([&](
const auto Idx) ->
bool
1011 if constexpr(Idx < Start)
return false;
1012 if constexpr(Idx > NumCacheLevels+1)
return false;
1013 using NodeType =
typename NodeLevelList::template Get<Idx>;
1014 return this->isHashed<NodeType>(xyz);
1019 mutable std::array<Coord, NumCacheLevels> mKeys;
1020 mutable typename NodePtrList::AsTupleList mNodes;
Signed (x, y, z) 32-bit integer coordinates.
Definition Coord.h:25
Int32 ValueType
Definition Coord.h:32
Definition InternalNode.h:34
Templated block class to hold specific data types and a fixed number of values determined by Log2Dim....
Definition LeafNode.h:38
This base class for ValueAccessors manages registration of an accessor with a tree so that the tree c...
Definition ValueAccessor.h:152
static constexpr bool isSafe()
Return true if this accessor is safe, i.e. registered by the tree from which it is constructed....
Definition ValueAccessor.h:163
TreeType * getTree() const
Return a pointer to the tree associated with this accessor.
Definition ValueAccessor.h:198
ValueAccessorBase(const ValueAccessorBase &other)
Copy constructor - if IsSafe, then the copy also registers itself against the tree it is accessing.
Definition ValueAccessor.h:178
ValueAccessorBase & operator=(const ValueAccessorBase &other)
Definition ValueAccessor.h:184
TreeType * mTree
Definition ValueAccessor.h:210
virtual ~ValueAccessorBase()
Definition ValueAccessor.h:174
virtual void clear()=0
Pure virtual method, clears the derived accessor.
ValueAccessorBase(TreeType &tree)
Construct from a tree. Should rarely be invoked directly, the drived implementation class calls this....
Definition ValueAccessor.h:168
TreeType & tree() const
Return a reference to the tree associated with this accessor.
Definition ValueAccessor.h:201
virtual void release()
Definition ValueAccessor.h:209
The Value Accessor Implementation and API methods. The majoirty of the API matches the API of a compa...
Definition ValueAccessor.h:367
int getValueDepth(const Coord &xyz) const
Return the tree depth (0 = root) at which the value of voxel (x, y, z) resides, or -1 if (x,...
Definition ValueAccessor.h:516
typename value_accessor_internal::NodeListBuilder< NodeChainT, RootNodeT::LEVEL, IntegerSequence >::ListT NodeLevelList
A resolved, flattened TypeList of node types which this accessor is caching. The nodes index in this ...
Definition ValueAccessor.h:384
typename RootNodeT::NodeChainType NodeChainT
Definition ValueAccessor.h:379
void clear() override final
Remove all the cached nodes and invalidate the corresponding hash-keys.
Definition ValueAccessor.h:880
bool isValueOn(const Coord &xyz) const
Return the active state of the voxel at the given coordinates.
Definition ValueAccessor.h:480
void setActiveState(const Coord &xyz, bool on=true)
Set the active state of the voxel at the given coordinates without changing its value.
Definition ValueAccessor.h:683
bool isVoxel(const Coord &xyz) const
Return true if the value of voxel (x, y, z) resides at the leaf level of the tree,...
Definition ValueAccessor.h:535
LeafNodeT * touchLeaf(const Coord &xyz)
Returns the leaf node that contains voxel (x, y, z) and if it doesn't exist, create it,...
Definition ValueAccessor.h:715
typename TreeType::ValueType ValueType
Definition ValueAccessor.h:376
OPENVDB_FORCE_INLINE void insert(const Coord &xyz, const NodeT *node) const
Insert a node into this ValueAccessor's cache.
Definition ValueAccessor.h:930
void addLeaf(LeafNodeT *leaf)
Add the specified leaf to this tree, possibly creating a child branch in the process....
Definition ValueAccessor.h:729
typename NodeLevelList::template Get< Level > NodeTypeAtLevel
Return a node type at a particular cache level in the Value accessor. The node type at a given cache ...
Definition ValueAccessor.h:402
OPENVDB_FORCE_INLINE bool isHashed(const Coord &xyz) const
Definition ValueAccessor.h:949
LeafNodeT * probeLeaf(const Coord &xyz)
Return a pointer to the leaf node that contains the voxel coordinate xyz. If no LeafNode exists,...
Definition ValueAccessor.h:836
void addTile(Index level, const Coord &xyz, const ValueType &value, bool state)
Add a tile at the specified tree level that contains the coordinate xyz, possibly deleting existing n...
Definition ValueAccessor.h:754
const LeafNodeT * probeConstLeaf(const Coord &xyz) const
Return a pointer to the leaf node that contains the voxel coordinate xyz. If no LeafNode exists,...
Definition ValueAccessor.h:838
void modifyValueAndActiveState(const Coord &xyz, const ModifyOp &op)
Apply a functor to the voxel at the given coordinates.
Definition ValueAccessor.h:656
void setValueOnly(const Coord &xyz, const ValueType &value)
Set a particular value at the given coordinate but preserve its active state.
Definition ValueAccessor.h:578
typename TreeType::RootNodeType RootNodeT
Definition ValueAccessor.h:377
void setValueOff(const Coord &xyz, const ValueType &value)
Set a particular value at the given coordinate and mark the coordinate as inactive.
Definition ValueAccessor.h:607
bool probeValue(const Coord &xyz, ValueType &value) const
Return the active state of the value at a given coordinate as well as its value.
Definition ValueAccessor.h:492
typename TreeType::LeafNodeType LeafNodeT
Definition ValueAccessor.h:378
void setValue(const Coord &xyz, const ValueType &value)
Set a particular value at the given coordinate and mark the coordinate as active.
Definition ValueAccessor.h:550
typename NodeLevelList::template Transform< std::add_pointer_t > NodePtrList
Definition ValueAccessor.h:387
void eraseNode()
Explicitly remove this Value Accessors cached node of the given NodeT. If this Value Accessor does no...
Definition ValueAccessor.h:869
void setValueOff(const Coord &xyz)
Mark the voxel at the given coordinates as inactive without changing its value.
Definition ValueAccessor.h:704
NodeT * getNode()
Return the node of type NodeT that has been cached on this accessor. If this accessor does not cache ...
Definition ValueAccessor.h:848
void modifyValue(const Coord &xyz, const ModifyOp &op)
Apply a functor to the value at the given coordinate and mark mark the coordinate as active.
Definition ValueAccessor.h:632
ValueAccessorImpl(TreeType &tree)
Constructor from a tree.
Definition ValueAccessor.h:425
const LeafNodeT * probeLeaf(const Coord &xyz) const
Return a pointer to the leaf node that contains the voxel coordinate xyz. If no LeafNode exists,...
Definition ValueAccessor.h:837
void insertNode(const Coord &xyz, NodeT &node)
Explicitly insert a node of the type NodeT into this Value Accessors cache.
Definition ValueAccessor.h:860
const NodeT * probeConstNode(const Coord &xyz) const
Return a pointer to the node of the specified type that contains the value located at xyz....
Definition ValueAccessor.h:805
~ValueAccessorImpl() override final=default
void setValueOn(const Coord &xyz)
Mark the voxel at the given coordinates as active without changing its value.
Definition ValueAccessor.h:698
void setValueOn(const Coord &xyz, const ValueType &value)
Definition ValueAccessor.h:569
_TreeType TreeType
Definition ValueAccessor.h:375
NodeT * probeNode(const Coord &xyz)
Return a pointer to the node of the specified type that contains the value located at xyz....
Definition ValueAccessor.h:777
const ValueType & getValue(const Coord &xyz) const
Return the value of the voxel at the given coordinates.
Definition ValueAccessor.h:455
void release() override final
Release this accessor from the tree, set the tree to null and clear the accessor cache....
Definition ValueAccessor.h:916
Index32 Index
Definition Types.h:54
std::decay_t< decltype(make_index_sequence_impl< N >())> make_index_sequence
Definition Types.h:233
OPENVDB_FORCE_INLINE RetT evalFirstIndex(OpT op, const RetT def=RetT())
Definition TypeList.h:566
Definition Exceptions.h:13
A list of types (not necessarily unique)
Definition TypeList.h:578
constexpr void setBuffer(const typename TreeTypeT::ValueType *) const
Definition ValueAccessor.h:355
constexpr TreeTypeT::ValueType * buffer()
Definition ValueAccessor.h:353
constexpr TreeTypeT::ValueType * buffer() const
Definition ValueAccessor.h:354
A small class that contains a cached pointer to a LeafNode data buffer which is derived from by the i...
Definition ValueAccessor.h:333
const TreeTypeT::ValueType * buffer()
Definition ValueAccessor.h:337
const TreeTypeT::ValueType * buffer() const
Definition ValueAccessor.h:338
void setBuffer(const typename TreeTypeT::ValueType *b) const
Definition ValueAccessor.h:339
constexpr auto lock() const
Definition ValueAccessor.h:322
A small class that contains a Mutex which is derived from by the internal Value Accessor Implementati...
Definition ValueAccessor.h:312
auto lock() const
Definition ValueAccessor.h:313
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:212