6 #ifndef OPENVDB_TREE_TREEITERATOR_HAS_BEEN_INCLUDED
7 #define OPENVDB_TREE_TREEITERATOR_HAS_BEEN_INCLUDED
9 #include <tbb/blocked_range.h>
10 #include <tbb/parallel_for.h>
16 #include <type_traits>
21 #define ENABLE_TREE_VALUE_DEPTH_BOUND_OPTIMIZATION
31 template<
typename HeadT,
int HeadLevel>
34 using Type =
typename SubtreeT::template Append<HeadT>;
36 template<
typename HeadT>
58 template<
typename NodeT,
typename IterT>
61 template<
typename ChildT>
static ChildT*
getChild(
const IterT&) {
return nullptr; }
64 template<
typename NodeT>
67 using IterT =
typename NodeT::ChildOnIter;
68 static IterT begin(NodeT& node) {
return node.beginChildOn(); }
70 return &iter.getValue();
72 template<
typename OtherNodeT>
struct NodeConverter {
73 using Type =
typename OtherNodeT::ChildOnIter;
77 template<
typename NodeT>
80 using IterT =
typename NodeT::ChildOnCIter;
81 static IterT begin(
const NodeT& node) {
return node.cbeginChildOn(); }
82 template<
typename ChildT>
static const ChildT*
getChild(
const IterT& iter) {
83 return &iter.getValue();
85 template<
typename OtherNodeT>
struct NodeConverter {
86 using Type =
typename OtherNodeT::ChildOnCIter;
90 template<
typename NodeT>
93 using IterT =
typename NodeT::ChildOffIter;
94 static IterT begin(NodeT& node) {
return node.beginChildOff(); }
95 template<
typename OtherNodeT>
struct NodeConverter {
96 using Type =
typename OtherNodeT::ChildOffIter;
100 template<
typename NodeT>
103 using IterT =
typename NodeT::ChildOffCIter;
104 static IterT begin(
const NodeT& node) {
return node.cbeginChildOff(); }
105 template<
typename OtherNodeT>
struct NodeConverter {
106 using Type =
typename OtherNodeT::ChildOffCIter;
110 template<
typename NodeT>
113 using IterT =
typename NodeT::ChildAllIter;
114 static IterT begin(NodeT& node) {
return node.beginChildAll(); }
116 typename IterT::NonConstValueType
val;
117 return iter.probeChild(val);
119 template<
typename OtherNodeT>
struct NodeConverter {
120 using Type =
typename OtherNodeT::ChildAllIter;
124 template<
typename NodeT>
127 using IterT =
typename NodeT::ChildAllCIter;
128 static IterT begin(
const NodeT& node) {
return node.cbeginChildAll(); }
130 typename IterT::NonConstValueType
val;
131 return iter.probeChild(val);
133 template<
typename OtherNodeT>
struct NodeConverter {
134 using Type =
typename OtherNodeT::ChildAllCIter;
138 template<
typename NodeT>
141 using IterT =
typename NodeT::ValueOnIter;
142 static IterT begin(NodeT& node) {
return node.beginValueOn(); }
143 template<
typename OtherNodeT>
struct NodeConverter {
144 using Type =
typename OtherNodeT::ValueOnIter;
148 template<
typename NodeT>
151 using IterT =
typename NodeT::ValueOnCIter;
152 static IterT begin(
const NodeT& node) {
return node.cbeginValueOn(); }
153 template<
typename OtherNodeT>
struct NodeConverter {
154 using Type =
typename OtherNodeT::ValueOnCIter;
158 template<
typename NodeT>
161 using IterT =
typename NodeT::ValueOffIter;
162 static IterT begin(NodeT& node) {
return node.beginValueOff(); }
163 template<
typename OtherNodeT>
struct NodeConverter {
164 using Type =
typename OtherNodeT::ValueOffIter;
168 template<
typename NodeT>
171 using IterT =
typename NodeT::ValueOffCIter;
172 static IterT begin(
const NodeT& node) {
return node.cbeginValueOff(); }
173 template<
typename OtherNodeT>
struct NodeConverter {
174 using Type =
typename OtherNodeT::ValueOffCIter;
178 template<
typename NodeT>
181 using IterT =
typename NodeT::ValueAllIter;
182 static IterT begin(NodeT& node) {
return node.beginValueAll(); }
183 template<
typename OtherNodeT>
struct NodeConverter {
184 using Type =
typename OtherNodeT::ValueAllIter;
188 template<
typename NodeT>
191 using IterT =
typename NodeT::ValueAllCIter;
192 static IterT begin(
const NodeT& node) {
return node.cbeginValueAll(); }
193 template<
typename OtherNodeT>
struct NodeConverter {
194 using Type =
typename OtherNodeT::ValueAllCIter;
212 template<
typename PrevItemT,
typename NodeVecT,
size_t VecSize, Index _Level>
225 using NodeT =
typename IterT::NodeType;
227 using NCNodeT =
typename IterT::NonConstNodeType;
229 using NCValueT =
typename IterT::NonConstValueType;
241 mIter(other.mIter), mNext(other.mNext), mPrev(nullptr) {}
244 if (&other !=
this) {
255 template<
typename OtherIterT>
261 node = (lvl <=
Level) ? mIter.getParentNode() :
nullptr;
264 template<
typename OtherNodeT>
272 template<
typename OtherIterListItemT>
276 const NodeT* node =
nullptr;
277 otherListItem.getNode(lvl, node);
298 if (lvl ==
Level && mPrev !=
nullptr && mIter) {
299 if (
ChildT* child = ITraits::template getChild<ChildT>(mIter)) {
304 return (lvl >
Level) ? mNext.
down(lvl) :
false;
311 return (lvl ==
Level) ? mIter.getCoord() : mNext.
getCoord(lvl);
332 if (lvl ==
Level)
return mIter.getValue();
341 if (lvl ==
Level) mIter.setValue(val);
else mNext.
setValue(lvl, val);
348 if (lvl ==
Level) mIter.setValueOn(on);
else mNext.
setValueOn(lvl, on);
360 template<
typename ModifyOp>
367 using RestT =
typename NodeVecT::PopFront;
377 template<
typename PrevItemT,
typename NodeVecT,
size_t VecSize>
390 using NodeT =
typename IterT::NodeType;
392 using NCNodeT =
typename IterT::NonConstNodeType;
394 using NCValueT =
typename IterT::NonConstValueType;
402 mIter(other.mIter), mNext(other.mNext), mPrev(nullptr) {}
405 if (&other !=
this) {
419 template<
typename OtherIterT>
424 node = (lvl == 0) ? mIter.getParentNode() :
nullptr;
426 template<
typename OtherNodeT>
429 template<
typename OtherIterListItemT>
433 const NodeT* node =
nullptr;
434 otherListItem.getNode(lvl, node);
443 bool test(
Index lvl)
const {
return (lvl == 0) ? mIter.test() : mNext.
test(lvl); }
445 bool next(
Index lvl) {
return (lvl == 0) ? mIter.next() : mNext.
next(lvl); }
451 return (lvl == 0) ? mIter.getCoord() : mNext.
getCoord(lvl);
455 return (lvl == 0) ? NodeT::getChildDim() : mNext.
getChildDim(lvl);
465 return (lvl == 0) ? mIter.isValueOn() : mNext.
isValueOn(lvl);
470 if (lvl == 0)
return mIter.getValue();
476 if (lvl == 0) mIter.setValue(val);
else mNext.
setValue(lvl, val);
480 if (lvl == 0) mIter.setValueOn(on);
else mNext.
setValueOn(lvl, on);
484 if (lvl == 0) mIter.setValueOff();
else mNext.
setValueOff(lvl);
487 template<
typename ModifyOp>
490 if (lvl == 0) mIter.modifyValue(op);
else mNext.
modifyValue(lvl, op);
494 using RestT =
typename NodeVecT::PopFront;
504 template<
typename PrevItemT,
typename NodeVecT, Index _Level>
516 using NodeT =
typename IterT::NodeType;
518 using NCNodeT =
typename IterT::NonConstNodeType;
520 using NCValueT =
typename IterT::NonConstValueType;
534 if (&other !=
this) {
550 node = (lvl <=
Level) ? mIter.getParentNode() :
nullptr;
553 template<
typename OtherIterListItemT>
557 const NodeT* node =
nullptr;
558 otherListItem.getNode(lvl, node);
571 if (lvl ==
Level && mPrev !=
nullptr && mIter) {
572 if (
ChildT* child = ITraits::template getChild<ChildT>(mIter)) {
588 assert(lvl ==
Level);
590 return mIter.getValue();
597 template<
typename ModifyOp>
600 if (lvl ==
Level) mIter.modifyValue(op);
615 template<
typename _TreeT,
typename _ValueIterT>
621 using NodeT =
typename ValueIterT::NodeType;
622 using ValueT =
typename ValueIterT::NonConstValueType;
625 static_assert(ValueIterT::NodeType::LEVEL ==
ROOT_LEVEL,
"invalid value iterator node type");
644 bool test()
const {
return mValueIterList.
test(mLevel); }
645 operator bool()
const {
return this->
test(); }
666 template<
typename NodeType>
711 template<
typename ModifyOp>
721 bool advance(
bool dontIncrement =
false);
725 struct PrevValueItem {
using IterT =
ValueIterT; };
727 IterListItem<PrevChildItem, InvTreeT,
ROOT_LEVEL+1, 0> mChildIterList;
728 IterListItem<PrevValueItem, InvTreeT,
ROOT_LEVEL+1, 0> mValueIterList;
730 int mMinLevel, mMaxLevel;
735 template<
typename TreeT,
typename ValueIterT>
738 mChildIterList(nullptr),
739 mValueIterList(nullptr),
741 mMinLevel(
int(LEAF_LEVEL)),
751 template<
typename TreeT,
typename ValueIterT>
754 mChildIterList(other.mChildIterList),
755 mValueIterList(other.mValueIterList),
756 mLevel(other.mLevel),
757 mMinLevel(other.mMinLevel),
758 mMaxLevel(other.mMaxLevel),
766 template<
typename TreeT,
typename ValueIterT>
770 if (&other !=
this) {
771 mChildIterList = other.mChildIterList;
772 mValueIterList = other.mValueIterList;
773 mLevel = other.mLevel;
774 mMinLevel = other.mMinLevel;
775 mMaxLevel = other.mMaxLevel;
777 mChildIterList.updateBackPointers();
778 mValueIterList.updateBackPointers();
784 template<
typename TreeT,
typename ValueIterT>
789 if (
int(mLevel) > mMaxLevel) this->next();
793 template<
typename TreeT,
typename ValueIterT>
799 if (
int(mLevel) < mMinLevel) this->next();
803 template<
typename TreeT,
typename ValueIterT>
808 if (!this->advance())
return false;
809 }
while (
int(mLevel) < mMinLevel ||
int(mLevel) > mMaxLevel);
814 template<
typename TreeT,
typename ValueIterT>
818 bool recurse =
false;
822 vPos = mValueIterList.pos(mLevel),
823 cPos = mChildIterList.pos(mLevel);
824 if (vPos == cPos && mChildIterList.test(mLevel)) {
826 mValueIterList.
next(mLevel);
827 vPos = mValueIterList.pos(mLevel);
830 if (dontIncrement)
return true;
831 if (mValueIterList.next(mLevel)) {
832 if (mValueIterList.pos(mLevel) == cPos && mChildIterList.test(mLevel)) {
835 mValueIterList.next(mLevel);
838 if (mValueIterList.pos(mLevel) < cPos)
return true;
842 if (!dontIncrement) mChildIterList.next(mLevel);
844 #ifdef DEBUG_TREE_VALUE_ITERATOR
845 std::cout <<
"\n" << this->summary() << std::flush;
849 while (mChildIterList.pos(mLevel) < mValueIterList.pos(mLevel)) {
850 #ifdef ENABLE_TREE_VALUE_DEPTH_BOUND_OPTIMIZATION
851 if (
int(mLevel) == mMinLevel) {
854 mChildIterList.next(mLevel);
855 if (mValueIterList.pos(mLevel) == mChildIterList.pos(mLevel)
856 && mChildIterList.test(mLevel))
860 mValueIterList.next(mLevel);
864 if (mChildIterList.down(mLevel)) {
866 mValueIterList.initLevel(mLevel, mChildIterList);
867 if (mValueIterList.pos(mLevel) == mChildIterList.pos(mLevel)
868 && mChildIterList.test(mLevel))
872 mValueIterList.next(mLevel);
875 #ifdef DEBUG_TREE_VALUE_ITERATOR
876 std::cout <<
"\n" << this->summary() << std::flush;
880 while (!mChildIterList.test(mLevel) && !mValueIterList.test(mLevel)) {
883 mChildIterList.next(mLevel);
884 dontIncrement =
true;
892 template<
typename TreeT,
typename ValueIterT>
900 bbox.min() = mValueIterList.getCoord(mLevel);
901 bbox.max() = bbox.min().offsetBy(mValueIterList.getChildDim(mLevel) - 1);
906 template<
typename TreeT,
typename ValueIterT>
910 std::ostringstream ostr;
911 for (
int lvl =
int(
ROOT_LEVEL); lvl >= 0 && lvl >=
int(mLevel); --lvl) {
912 if (lvl == 0) ostr <<
"leaf";
913 else if (lvl ==
int(
ROOT_LEVEL)) ostr <<
"root";
915 ostr <<
" v" << mValueIterList.pos(lvl)
916 <<
" c" << mChildIterList.pos(lvl);
917 if (lvl >
int(mLevel)) ostr <<
" / ";
919 if (this->
test() && mValueIterList.pos(mLevel) < mChildIterList.pos(mLevel)) {
921 ostr <<
" " << this->getCoord();
923 ostr <<
" " << this->getBoundingBox();
934 template<
typename _TreeT,
typename RootChildOnIterT>
965 bool test()
const {
return !mDone; }
966 operator bool()
const {
return this->
test(); }
1001 template<
typename NodeT>
1002 void getNode(NodeT*& node)
const { node =
nullptr; mIterList.
getNode(mLevel, node); }
1003 template<
typename NodeT>
1004 void getNode(
const NodeT*& node)
const { node =
nullptr; mIterList.
getNode(mLevel, node); }
1012 struct PrevItem {
using IterT =
RootIterT; };
1016 int mMinLevel, mMaxLevel;
1022 template<
typename TreeT,
typename RootChildOnIterT>
1027 mMinLevel(
int(LEAF_LEVEL)),
1035 template<
typename TreeT,
typename RootChildOnIterT>
1040 mMinLevel(
int(LEAF_LEVEL)),
1049 template<
typename TreeT,
typename RootChildOnIterT>
1052 mIterList(other.mIterList),
1053 mLevel(other.mLevel),
1054 mMinLevel(other.mMinLevel),
1055 mMaxLevel(other.mMaxLevel),
1063 template<
typename TreeT,
typename RootChildOnIterT>
1067 if (&other !=
this) {
1068 mLevel = other.mLevel;
1069 mMinLevel = other.mMinLevel;
1070 mMaxLevel = other.mMaxLevel;
1071 mDone = other.mDone;
1072 mTree = other.mTree;
1073 mIterList = other.mIterList;
1080 template<
typename TreeT,
typename RootChildOnIterT>
1085 if (
int(mLevel) > mMaxLevel) this->next();
1089 template<
typename TreeT,
typename RootChildOnIterT>
1095 if (
int(mLevel) < mMinLevel) this->next();
1099 template<
typename TreeT,
typename RootChildOnIterT>
1104 if (mDone)
return false;
1108 if (
int(mLevel) > mMinLevel && mIterList.test(mLevel)) {
1109 if (!mIterList.down(mLevel))
return false;
1113 while (!mIterList.test(mLevel)) {
1120 mIterList.next(mLevel);
1123 if (!mIterList.down(mLevel))
return false;
1126 }
while (
int(mLevel) < mMinLevel ||
int(mLevel) > mMaxLevel);
1131 template<
typename TreeT,
typename RootChildOnIterT>
1135 if (mLevel !=
ROOT_LEVEL)
return mIterList.getCoord(mLevel + 1);
1137 this->getNode(root);
1138 return root ? root->getMinIndex() :
Coord::min();
1142 template<
typename TreeT,
typename RootChildOnIterT>
1148 this->getNode(root);
1149 if (root ==
nullptr) {
1153 root->getIndexRange(bbox);
1156 bbox.min() = mIterList.getCoord(mLevel + 1);
1157 bbox.max() = bbox.min().offsetBy(mIterList.getChildDim(mLevel + 1) - 1);
1162 template<
typename TreeT,
typename RootChildOnIterT>
1166 std::ostringstream ostr;
1167 for (
int lvl =
int(
ROOT_LEVEL); lvl >= 0 && lvl >=
int(mLevel); --lvl) {
1168 if (lvl == 0) ostr <<
"leaf";
1169 else if (lvl ==
int(
ROOT_LEVEL)) ostr <<
"root";
1171 ostr <<
" c" << mIterList.pos(lvl);
1172 if (lvl >
int(mLevel)) ostr <<
" / ";
1175 this->getBoundingBox(bbox);
1176 ostr <<
" " << bbox;
1185 template<
typename TreeT,
typename RootChildOnIterT>
1208 for ( ; lvl > 0 && mIterList.
down(lvl); --lvl) {}
1210 if (lvl > 0) this->
next();
1219 if (&other !=
this) {
1220 mTree = other.mTree;
1221 mIterList = other.mIterList;
1240 operator bool()
const {
return this->
test(); }
1254 struct PrevItem {
using IterT =
RootIterT; };
1264 template<
typename TreeT,
typename RootChildOnIterT>
1270 if (mIterList.test(LEAF_PARENT_LEVEL) && mIterList.next(LEAF_PARENT_LEVEL)) {
1271 mIterList.down(LEAF_PARENT_LEVEL);
1275 Index lvl = LEAF_PARENT_LEVEL;
1276 while (!mIterList.test(LEAF_PARENT_LEVEL)) {
1277 if (mIterList.test(lvl)) {
1278 mIterList.next(lvl);
1285 if (mIterList.test(lvl)) mIterList.next(lvl);
1286 }
while (!mIterList.test(lvl));
1289 while (lvl > LEAF_PARENT_LEVEL && mIterList.down(lvl)) --lvl;
1291 mIterList.down(LEAF_PARENT_LEVEL);
1301 template<
typename IterT>
1310 mGrainSize(grainSize),
1313 mSize = this->
size();
1321 mGrainSize(other.mGrainSize),
1322 mSize(other.mSize >> 1)
1332 bool empty()
const {
return mSize == 0 || !mIter.test(); }
1334 operator bool()
const {
return !this->
empty(); }
1341 void increment(
size_t n = 1) {
for ( ;
n > 0 && mSize > 0; --
n, --mSize, ++mIter) {} }
1349 size_t size()
const {
size_t n = 0;
for (IterT it(mIter); it.test(); ++
n, ++it) {}
return n; }
1352 size_t mGrainSize, mSize;
1370 #endif // OPENVDB_TREE_TREEITERATOR_HAS_BEEN_INCLUDED
Index getMaxDepth() const
Return the depth of the lowest level of the tree to which this iterator ascends.
Coord getCoord() const
Return the global coordinates of the voxel or tile to which this iterator is currently pointing...
std::string summary() const
Return a string (for debugging, mainly) describing this iterator's current state. ...
const NCValueT & getValue(Index lvl) const
Return the value to which the iterator at level lvl of the tree points.
Index getMinDepth() const
Return the depth of the highest level of the tree to which this iterator ascends. ...
IterListItem & operator=(const IterListItem &other)
Index getDepth() const
Return the depth in the tree (0 = root) of the node to which this iterator is currently pointing...
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
typename OtherNodeT::ChildOffIter Type
cvex test(vector P=0;int unbound=3;export float s=0;export vector Cf=0;)
NodeIteratorBase & operator++()
static IterT begin(NodeT &node)
const IterT & iterator() const
Return a reference to this range's iterator.
bool down(Index lvl)
If the iterator at level lvl of the tree points to a child node, initialize the next iterator in this...
IterListItem & operator=(const IterListItem &other)
void setIter(const OtherIterT &iter)
static Index getLeafDepth()
typename ValueIterT::NodeType NodeT
static IterT begin(const NodeT &node)
void initLevel(Index lvl, OtherIterListItemT &otherListItem)
typename iter::InvertedTree< NCRootNodeT, ROOT_LEVEL >::Type InvTreeT
bool is_divisible() const
Return true if this range is splittable (i.e., if the iterator can be advanced more than mGrainSize t...
static const Index ROOT_LEVEL
bool next()
Advance to the next tile or voxel value. Return true if this iterator is not yet exhausted.
void getNode(Index lvl, NodeT *&node) const
typename OtherNodeT::ChildOffCIter Type
void getNode(const NodeT *&node) const
Return the node to which the iterator is pointing.
Index getLevel() const
Return the level in the tree (0 = leaf) of the node to which this iterator is currently pointing...
LeafNodeT & operator*() const
Return the leaf node to which the iterator is pointing.
GLsizei const GLchar *const * string
typename SubtreeT::template Append< HeadT > Type
void setValueOff() const
Mark the tile or voxel value to which this iterator is currently pointing as inactive.
Index getMinDepth() const
Return the depth of the highest level of the tree to which this iterator ascends. ...
typename CopyConstness< NCNodeT, typename NCNodeT::ChildNodeType >::Type NCChildT
NodeT's child node type with const qualifiers removed.
void updateBackPointers(PrevItemT *prev)
Base class for tree-traversal iterators over all nodes.
static const Index ROOT_LEVEL
void setValueOn(Index lvl, bool on=true) const
static Index getLeafDepth()
static ChildT * getChild(const IterT &iter)
typename RootIterT::NodeType RootNodeT
#define OPENVDB_USE_VERSION_NAMESPACE
typename OtherNodeT::ValueOnCIter Type
bool isValueOn(Index lvl) const
IterListItem(const IterListItem &other)
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
**But if you need a or simply need to know when the task has note that the like this
LeafIteratorBase(TreeT &tree)
IterListItem(PrevItemT *prev)
Coord getCoord() const
Return the global coordinates of the voxel or tile to which this iterator is currently pointing...
void updateBackPointers(PrevItemT *prev)
typename CopyConstness< NCNodeT, typename NCNodeT::ChildNodeType >::Type NCChildT
NodeT's child node type with const qualifiers removed.
bool isValueOn(Index lvl) const
Return true if the iterator at level lvl of the tree points to an active value.
void increment()
Advance the iterator to the next leaf node.
static const Index LEAF_LEVEL
void getNode(Index lvl, NodeT *&node) const
Return the node over which this list element's iterator iterates.
Coord getCoord(Index lvl) const
Return the global coordinates of the voxel or tile to which the iterator at level lvl of the tree is ...
LeafIteratorBase(const LeafIteratorBase &other)
typename OtherNodeT::ChildAllIter Type
bool isValueOn() const
Return true if the value to which this iterator is currently pointing is active.
bool test(Index lvl) const
typename IterT::NonConstNodeType NCNodeT
The type of the node with const qualifiers removed ("Non-Const")
typename IterT::NonConstNodeType NCNodeT
The type of the node with const qualifiers removed ("Non-Const")
void setActiveState(bool on) const
Change the active/inactive state of the tile or voxel value to which this iterator is currently point...
std::string summary() const
void updateBackPointers(PrevItemT *=nullptr)
static IterT begin(const NodeT &node)
void setIter(const IterT &iter)
void setIter(const IterT &iter)
bool test(Index lvl) const
Return true if the iterator at level lvl of the tree has not yet reached its end. ...
void modifyValue(Index lvl, const ModifyOp &op) const
static ChildT * getChild(const IterT &iter)
typename NodeT::ValueAllIter IterT
TreeValueIteratorBase & operator++()
Advance to the next tile or voxel value.
typename IterT::NonConstValueType NCValueT
The type of value (with const qualifiers removed) to which the iterator points.
static IterT begin(NodeT &node)
const NCValueT & getValue(Index lvl) const
typename IterT::NodeType NodeT
The type of node (const or non-const) over which IterT iterates (e.g., const RootNode<...>)
void setMinDepth(Index minDepth)
Specify the depth of the highest level of the tree to which to ascend (depth 0 = root).
static const Index ROOT_LEVEL
typename InvTreeT::Front NCLeafNodeT
typename IterT::NonConstNodeType NCNodeT
The type of the node with const qualifiers removed ("Non-Const")
void initLevel(Index lvl, OtherIterListItemT &otherListItem)
Initialize the iterator for level lvl of the tree with the node over which the corresponding iterator...
typename OtherNodeT::ValueOnIter Type
typename OtherNodeT::ValueAllCIter Type
typename NodeT::ChildOnCIter ChildOnIterT
const ValueT & operator*() const
Return the tile or voxel value to which this iterator is currently pointing.
void increment(Index n)
Increment the iterator n times.
NodeIteratorBase & operator=(const NodeIteratorBase &other)
Index pos(Index lvl) const
Coord getCoord(Index lvl) const
void setIter(const OtherIterT &iter)
Index64 getVoxelCount(Index lvl) const
Index64 getVoxelCount(Index lvl) const
Return the number of (virtual) voxels spanned by a tile value or child node.
bool next()
Advance the iterator to the next item.
typename iter::InvertedTree< NCRootNodeT, ROOT_LEVEL >::Type InvTreeT
typename RootIterT::NonConstNodeType NCRootNodeT
typename NodeT::ChildOnIter IterT
CoordBBox getBoundingBox() const
Return the axis-aligned bounding box of the voxel or tile to which this iterator is currently pointin...
bool isValueOn(Index lvl) const
typename NodeT::ChildOnCIter IterT
void setValueOn(Index lvl, bool on=true) const
typename NodeT::ChildAllCIter IterT
static IterT begin(NodeT &node)
const ValueT & getValue() const
Return the tile or voxel value to which this iterator is currently pointing.
void getNode(Index lvl, NodeT *&node) const
RootChildOnIterT RootIterT
void setValue(Index lvl, const NCValueT &val) const
TreeValueIteratorBase & operator=(const TreeValueIteratorBase &other)
typename OtherNodeT::ChildAllCIter Type
static IterT begin(const NodeT &node)
bool test() const
Return true if this iterator is not yet exhausted.
typename std::remove_const< ToType >::type Type
void setValueOff(Index lvl) const
const ValueT * operator->() const
Return the tile or voxel value to which this iterator is currently pointing.
typename NodeT::ValueOffIter IterT
typename OtherNodeT::ChildOnIter Type
static ChildT * getChild(const IterT &iter)
typename OtherNodeT::ValueOffCIter Type
bool test() const
Return true if this iterator is not yet exhausted.
static const Index LEAF_LEVEL
Coord getCoord(Index lvl) const
typename IterTraits< typename PrevIterT::NonConstNodeType, PrevIterT >::template NodeConverter< _NodeT >::Type IterT
The type of iterator stored in this list item (e.g., InternalNode::ValueOnCIter)
typename IterT::NodeType NodeT
The type of node over which IterT iterates (e.g., const RootNode<...>)
typename IterT::NodeType NodeT
The type of node (const or non-const) over which IterT iterates (e.g., const RootNode<...>)
Index getChildDim(Index lvl) const
static const Index ROOT_DEPTH
typename CopyConstness< NodeT, typename NodeT::ChildNodeType >::Type ChildT
NodeT's child node type, with the same constness (e.g., const InternalNode<...>)
static IterT begin(NodeT &node)
Index pos(Index lvl) const
void getNode(NodeType *&node) const
Return in node a pointer to the node over which this iterator is currently iterating or one of that n...
void setMaxDepth(Index maxDepth)
Specify the depth of the lowest level of the tree to which to descend (depth 0 = root).
typename OtherNodeT::ValueOffIter Type
typename InvertedTree< typename HeadT::ChildNodeType, HeadLevel-1 >::Type SubtreeT
void setValue(Index lvl, const NCValueT &val) const
Set the value (to val) to which the iterator at level lvl of the tree points and mark the value as ac...
static const Index LEAF_LEVEL
GLboolean GLboolean GLboolean b
void setValueOn(Index lvl, bool on=true) const
Set the value (to val) to which the iterator at level lvl of the tree points and mark the value as ac...
static const Index LEAF_PARENT_LEVEL
typename PrevItemT::IterT PrevIterT
The type of iterator stored in the previous list item.
typename ValueIterT::NonConstValueType ValueT
typename OtherNodeT::ValueAllIter Type
IterListItem & operator=(const IterListItem &other)
typename NodeT::ChildOffIter IterT
typename NodeVecT::Front _NodeT
The type of node (non-const) whose iterator is stored in this list item.
void getNode(NodeT *&node) const
Return the node to which the iterator is pointing.
TreeValueIteratorBase(TreeT &)
Index64 getVoxelCount() const
Return the number of (virtual) voxels corresponding to the value.
typename IterTraits< typename PrevIterT::NonConstNodeType, PrevIterT >::template NodeConverter< _NodeT >::Type IterT
The type of iterator stored in this list item (e.g., RootNode::ValueOnCIter)
LeafNodeT * operator->() const
Return the leaf node to which the iterator is pointing.
bool isVoxelValue() const
Return true if this iterator is currently pointing to a (leaf) voxel value.
void getNode(Index lvl, OtherNodeT *&node) const
Return the node over which one of the following list elements' iterator iterates. ...
typename NodeVecT::Front _NodeT
LeafIteratorBase & operator++()
Advance the iterator to the next leaf node.
typename PrevItemT::IterT PrevIterT
The type of iterator stored in the previous list item.
LeafIteratorBase & operator=(const LeafIteratorBase &other)
typename NodeT::ChildAllIter IterT
typename IterT::NonConstValueType NCValueT
The type of value (with const qualifiers removed) to which the iterator points.
Index getChildDim(Index lvl) const
Library and file format version numbers.
typename IterTraits< typename PrevIterT::NonConstNodeType, PrevIterT >::template NodeConverter< _NodeT >::Type IterT
The type of iterator stored in this list item (e.g., InternalNode::ValueOnCIter)
static IterT begin(NodeT &node)
Index pos(Index lvl) const
Return The table offset of the iterator at level lvl of the tree.
bool next(Index lvl)
Increment the iterator at level lvl of the tree.
static const Index ROOT_DEPTH
IteratorRange(const IterT &iter, size_t grainSize=8)
Constructor from iterator and grain size.
void increment()
Advance the iterator to the next leaf node.
void getNode(Index lvl, OtherNodeT *&node) const
void setMaxDepth(Index maxDepth)
Specify the depth of the lowest level of the tree to which to descend (depth 0 = root).
RootChildOnIterT RootIterT
bool next()
Advance to the next tile or voxel value.
typename RootIterT::NodeType RootNodeT
void initLevel(Index lvl, OtherIterListItemT &otherListItem)
Index getChildDim(Index lvl) const
Base class for tree-traversal iterators over tile and voxel values.
bool isTileValue() const
Return true if this iterator is currently pointing to a (non-leaf) tile value.
bool next()
Advance the iterator to the next leaf node.
IterListItem(const IterListItem &other)
void modifyValue(const ModifyOp &op) const
Apply a functor to the item to which this iterator is pointing. (Not valid for const iterators...
void setValue(Index lvl, const NCValueT &val) const
IteratorRange & operator++()
Advance the iterator to the next item.
typename PrevItem::IterT PrevIterT
The type of iterator stored in the previous list item.
IterListItem(PrevItemT *)
Index64 getVoxelCount(Index lvl) const
static const Index LEAF_DEPTH
typename NodeT::ChildOffCIter IterT
typename CopyConstness< RootNodeT, NCLeafNodeT >::Type LeafNodeT
CoordBBox getBoundingBox() const
Return the axis-aligned bounding box of the voxel or tile to which this iterator is currently pointin...
static IterT begin(const NodeT &node)
static const Index LEAF_DEPTH
typename NodeT::ValueOnIter IterT
static IterT begin(const NodeT &node)
IterListItem(const IterListItem &other)
IteratorRange(IteratorRange &other, tbb::split)
Split constructor used by tbb (should rarely be called directly)
IterListItem(PrevItemT *prev)
void setValue(const ValueT &val) const
Change the tile or voxel value to which this iterator is currently pointing and mark it as active...
void increment(size_t n=1)
Advance the iterator n times.
void modifyValue(Index lvl, const ModifyOp &op) const
Apply a functor to the item to which this iterator is pointing.
static IterT begin(const NodeT &node)
static const ChildT * getChild(const IterT &iter)
typename IterT::NonConstValueType NCValueT
The type of value (with const qualifiers removed) to which the iterator points.
void OIIO_UTIL_API split(string_view str, std::vector< string_view > &result, string_view sep=string_view(), int maxsplit=-1)
typename OtherNodeT::ChildOnCIter Type
void increment(Index n)
Increment the iterator n times.
typename NodeT::ValueOffCIter IterT
const NCValueT & getValue(Index lvl) const
An IterListItem is an element of a compile-time linked list of iterators to nodes of different types...
typename RootIterT::NonConstNodeType NCRootNodeT
typename CopyConstness< NodeT, typename NodeT::ChildNodeType >::Type ChildT
NodeT's child node type, with the same constness (e.g., const InternalNode<...>)
LeafNodeT * getLeaf() const
Return the leaf node to which the iterator is pointing.
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
TreeT * getTree() const
Return a pointer to the tree over which this iterator is iterating.
A list of types (not necessarily unique)
static const Index Level
NodeT's level in its tree (0 = LeafNode)
void setIter(const IterT &iter)
typename InvTreeT::Front _NodeT
The type of node (non-const) whose iterator is stored in this list item.
bool test(Index lvl) const
static ChildT * getChild(const IterT &)
void setMinDepth(Index minDepth)
Specify the depth of the highest level of the tree to which to ascend (depth 0 = root).
static IterT begin(NodeT &node)
Index getLevel() const
Return the level in the tree (0 = leaf) of the node to which this iterator is currently pointing...
void modifyValue(Index lvl, const ModifyOp &op) const
typename NodeT::ValueOnCIter IterT
typename NodeT::ValueAllCIter IterT
Base class for tree-traversal iterators over all leaf nodes (but not leaf voxels) ...
void setValueOff(Index lvl) const
Mark the value to which the iterator at level lvl of the tree points as inactive. ...
Index getDepth() const
Return the depth in the tree (0 = root) of the node to which this iterator is currently pointing...
Index getMaxDepth() const
Return the depth of the lowest level of the tree to which this iterator ascends.
void setValueOff(Index lvl) const
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.