OpenVDB: TreeIterator.h Source File

OpenVDB 7.1.0

TreeIterator.h
Go to the documentation of this file.
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3 //
5
6 #ifndef OPENVDB_TREE_TREEITERATOR_HAS_BEEN_INCLUDED
7 #define OPENVDB_TREE_TREEITERATOR_HAS_BEEN_INCLUDED
8
9 #include <tbb/blocked_range.h>
10 #include <tbb/parallel_for.h>
11 #include <openvdb/version.h>
12 #include <openvdb/Types.h>
13 #include <algorithm>
14 #include <sstream>
15 #include <string>
16 #include <type_traits>
17
18 // Prior to 0.96.1, depth-bounded value iterators always descended to the leaf level
19 // and iterated past leaf nodes. Now, they never descend past the maximum depth.
20 // Comment out the following line to restore the older, less-efficient behavior:
21 #define ENABLE_TREE_VALUE_DEPTH_BOUND_OPTIMIZATION
22
23
24 namespace openvdb {
25 OPENVDB_USE_VERSION_NAMESPACE
26 namespace OPENVDB_VERSION_NAME {
27 namespace tree {
28
29 namespace iter {
30
31 template<typename HeadT, int HeadLevel>
32 struct InvertedTree {
33 using SubtreeT = typename InvertedTree<typename HeadT::ChildNodeType, HeadLevel-1>::Type;
34 using Type = typename SubtreeT::template Append<HeadT>;
35 };
36 template<typename HeadT>
37 struct InvertedTree<HeadT, /*HeadLevel=*/1> {
38 using Type = TypeList<typename HeadT::ChildNodeType, HeadT>;
39 };
40
41 } // namespace iter
42
43
45
46
58 template<typename NodeT, typename IterT>
59 struct IterTraits
60 {
61 template<typename ChildT> static ChildT* getChild(const IterT&) { return nullptr; }
62 };
63
64 template<typename NodeT>
65 struct IterTraits<NodeT, typename NodeT::ChildOnIter>
66 {
67 using IterT = typename NodeT::ChildOnIter;
68 static IterT begin(NodeT& node) { return node.beginChildOn(); }
69 template<typename ChildT> static ChildT* getChild(const IterT& iter) {
70 return &iter.getValue();
71 }
72 template<typename OtherNodeT> struct NodeConverter {
73 using Type = typename OtherNodeT::ChildOnIter;
74 };
75 };
76
77 template<typename NodeT>
78 struct IterTraits<NodeT, typename NodeT::ChildOnCIter>
79 {
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();
84 }
85 template<typename OtherNodeT> struct NodeConverter {
86 using Type = typename OtherNodeT::ChildOnCIter;
87 };
88 };
89
90 template<typename NodeT>
91 struct IterTraits<NodeT, typename NodeT::ChildOffIter>
92 {
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;
97 };
98 };
99
100 template<typename NodeT>
101 struct IterTraits<NodeT, typename NodeT::ChildOffCIter>
102 {
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;
107 };
108 };
109
110 template<typename NodeT>
111 struct IterTraits<NodeT, typename NodeT::ChildAllIter>
112 {
113 using IterT = typename NodeT::ChildAllIter;
114 static IterT begin(NodeT& node) { return node.beginChildAll(); }
115 template<typename ChildT> static ChildT* getChild(const IterT& iter) {
116 typename IterT::NonConstValueType val;
117 return iter.probeChild(val);
118 }
119 template<typename OtherNodeT> struct NodeConverter {
120 using Type = typename OtherNodeT::ChildAllIter;
121 };
122 };
123
124 template<typename NodeT>
125 struct IterTraits<NodeT, typename NodeT::ChildAllCIter>
126 {
127 using IterT = typename NodeT::ChildAllCIter;
128 static IterT begin(const NodeT& node) { return node.cbeginChildAll(); }
129 template<typename ChildT> static ChildT* getChild(const IterT& iter) {
130 typename IterT::NonConstValueType val;
131 return iter.probeChild(val);
132 }
133 template<typename OtherNodeT> struct NodeConverter {
134 using Type = typename OtherNodeT::ChildAllCIter;
135 };
136 };
137
138 template<typename NodeT>
139 struct IterTraits<NodeT, typename NodeT::ValueOnIter>
140 {
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;
145 };
146 };
147
148 template<typename NodeT>
149 struct IterTraits<NodeT, typename NodeT::ValueOnCIter>
150 {
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;
155 };
156 };
157
158 template<typename NodeT>
159 struct IterTraits<NodeT, typename NodeT::ValueOffIter>
160 {
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;
165 };
166 };
167
168 template<typename NodeT>
169 struct IterTraits<NodeT, typename NodeT::ValueOffCIter>
170 {
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;
175 };
176 };
177
178 template<typename NodeT>
179 struct IterTraits<NodeT, typename NodeT::ValueAllIter>
180 {
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;
185 };
186 };
187
188 template<typename NodeT>
189 struct IterTraits<NodeT, typename NodeT::ValueAllCIter>
190 {
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;
195 };
196 };
197
198
200
201
212 template<typename PrevItemT, typename NodeVecT, size_t VecSize, Index _Level>
213 class IterListItem
214 {
215 public:
217 using PrevIterT = typename PrevItemT::IterT;
219 using _NodeT = typename NodeVecT::Front;
221 using IterT = typename IterTraits<typename PrevIterT::NonConstNodeType, PrevIterT>::template
222 NodeConverter<_NodeT>::Type;
223
225 using NodeT = typename IterT::NodeType;
227 using NCNodeT = typename IterT::NonConstNodeType;
229 using NCValueT = typename IterT::NonConstValueType;
231 using ChildT = typename CopyConstness<NodeT, typename NodeT::ChildNodeType>::Type;
233 using NCChildT = typename CopyConstness<NCNodeT, typename NCNodeT::ChildNodeType>::Type;
234 using ITraits = IterTraits<NCNodeT, IterT>;
236 static const Index Level = _Level;
237
238 IterListItem(PrevItemT* prev): mNext(this), mPrev(prev) {}
239
240 IterListItem(const IterListItem& other):
241 mIter(other.mIter), mNext(other.mNext), mPrev(nullptr) {}
242 IterListItem& operator=(const IterListItem& other)
243 {
244 if (&other != this) {
245 mIter = other.mIter;
246 mNext = other.mNext;
247 mPrev = nullptr;
248 }
249 return *this;
250 }
251
252 void updateBackPointers(PrevItemT* prev) { mPrev = prev; mNext.updateBackPointers(this); }
253
254 void setIter(const IterT& iter) { mIter = iter; }
255 template<typename OtherIterT>
256 void setIter(const OtherIterT& iter) { mNext.setIter(iter); }
257
259 void getNode(Index lvl, NodeT*& node) const
260 {
261 node = (lvl <= Level) ? mIter.getParentNode() : nullptr;
262 }
264 template<typename OtherNodeT>
265 void getNode(Index lvl, OtherNodeT*& node) const { mNext.getNode(lvl, node); }
266
272 template<typename OtherIterListItemT>
273 void initLevel(Index lvl, OtherIterListItemT& otherListItem)
274 {
275 if (lvl == Level) {
276 const NodeT* node = nullptr;
277 otherListItem.getNode(lvl, node);
278 mIter = (node == nullptr) ? IterT() : ITraits::begin(*const_cast<NodeT*>(node));
279 } else {
280 // Forward to one of the following list elements.
281 mNext.initLevel(lvl, otherListItem);
282 }
283 }
284
286 Index pos(Index lvl) const { return (lvl == Level) ? mIter.pos() : mNext.pos(lvl); }
287
289 bool test(Index lvl) const { return (lvl == Level) ? mIter.test() : mNext.test(lvl); }
290
292 bool next(Index lvl) { return (lvl == Level) ? mIter.next() : mNext.next(lvl); }
293
296 bool down(Index lvl)
297 {
298 if (lvl == Level && mPrev != nullptr && mIter) {
299 if (ChildT* child = ITraits::template getChild<ChildT>(mIter)) {
300 mPrev->setIter(PrevItemT::ITraits::begin(*child));
301 return true;
302 }
303 }
304 return (lvl > Level) ? mNext.down(lvl) : false;
305 }
306
309 Coord getCoord(Index lvl) const
310 {
311 return (lvl == Level) ? mIter.getCoord() : mNext.getCoord(lvl);
312 }
313 Index getChildDim(Index lvl) const
314 {
315 return (lvl == Level) ? NodeT::getChildDim() : mNext.getChildDim(lvl);
316 }
318 Index64 getVoxelCount(Index lvl) const
319 {
320 return (lvl == Level) ? ChildT::NUM_VOXELS : mNext.getVoxelCount(lvl);
321 }
322
324 bool isValueOn(Index lvl) const
325 {
326 return (lvl == Level) ? mIter.isValueOn() : mNext.isValueOn(lvl);
327 }
328
330 const NCValueT& getValue(Index lvl) const
331 {
332 if (lvl == Level) return mIter.getValue();
333 return mNext.getValue(lvl);
334 }
335
339 void setValue(Index lvl, const NCValueT& val) const
340 {
341 if (lvl == Level) mIter.setValue(val); else mNext.setValue(lvl, val);
342 }
346 void setValueOn(Index lvl, bool on = true) const
347 {
348 if (lvl == Level) mIter.setValueOn(on); else mNext.setValueOn(lvl, on);
349 }
353 void setValueOff(Index lvl) const
354 {
355 if (lvl == Level) mIter.setValueOff(); else mNext.setValueOff(lvl);
356 }
357
360 template<typename ModifyOp>
361 void modifyValue(Index lvl, const ModifyOp& op) const
362 {
363 if (lvl == Level) mIter.modifyValue(op); else mNext.modifyValue(lvl, op);
364 }
365
366 private:
367 using RestT = typename NodeVecT::PopFront; // NodeVecT minus its first item
368 using NextItem = IterListItem<IterListItem, RestT, VecSize - 1, Level + 1>;
369
370 IterT mIter;
371 NextItem mNext;
372 PrevItemT* mPrev;
373 };
374
375
377 template<typename PrevItemT, typename NodeVecT, size_t VecSize>
378 class IterListItem<PrevItemT, NodeVecT, VecSize, /*Level=*/0U>
379 {
380 public:
382 using PrevIterT = typename PrevItemT::IterT;
384 using _NodeT = typename NodeVecT::Front;
386 using IterT = typename IterTraits<typename PrevIterT::NonConstNodeType, PrevIterT>::template
387 NodeConverter<_NodeT>::Type;
388
390 using NodeT = typename IterT::NodeType;
392 using NCNodeT = typename IterT::NonConstNodeType;
394 using NCValueT = typename IterT::NonConstValueType;
395 using ITraits = IterTraits<NCNodeT, IterT>;
397 static const Index Level = 0;
398
399 IterListItem(PrevItemT*): mNext(this), mPrev(nullptr) {}
400
401 IterListItem(const IterListItem& other):
402 mIter(other.mIter), mNext(other.mNext), mPrev(nullptr) {}
403 IterListItem& operator=(const IterListItem& other)
404 {
405 if (&other != this) {
406 mIter = other.mIter;
407 mNext = other.mNext;
408 mPrev = nullptr;
409 }
410 return *this;
411 }
412
413 void updateBackPointers(PrevItemT* = nullptr)
414 {
415 mPrev = nullptr; mNext.updateBackPointers(this);
416 }
417
418 void setIter(const IterT& iter) { mIter = iter; }
419 template<typename OtherIterT>
420 void setIter(const OtherIterT& iter) { mNext.setIter(iter); }
421
422 void getNode(Index lvl, NodeT*& node) const
423 {
424 node = (lvl == 0) ? mIter.getParentNode() : nullptr;
425 }
426 template<typename OtherNodeT>
427 void getNode(Index lvl, OtherNodeT*& node) const { mNext.getNode(lvl, node); }
428
429 template<typename OtherIterListItemT>
430 void initLevel(Index lvl, OtherIterListItemT& otherListItem)
431 {
432 if (lvl == 0) {
433 const NodeT* node = nullptr;
434 otherListItem.getNode(lvl, node);
435 mIter = (node == nullptr) ? IterT() : ITraits::begin(*const_cast<NodeT*>(node));
436 } else {
437 mNext.initLevel(lvl, otherListItem);
438 }
439 }
440
441 Index pos(Index lvl) const { return (lvl == 0) ? mIter.pos() : mNext.pos(lvl); }
442
443 bool test(Index lvl) const { return (lvl == 0) ? mIter.test() : mNext.test(lvl); }
444
445 bool next(Index lvl) { return (lvl == 0) ? mIter.next() : mNext.next(lvl); }
446
447 bool down(Index lvl) { return (lvl == 0) ? false : mNext.down(lvl); }
448
449 Coord getCoord(Index lvl) const
450 {
451 return (lvl == 0) ? mIter.getCoord() : mNext.getCoord(lvl);
452 }
453 Index getChildDim(Index lvl) const
454 {
455 return (lvl == 0) ? NodeT::getChildDim() : mNext.getChildDim(lvl);
456 }
457
458 Index64 getVoxelCount(Index lvl) const
459 {
460 return (lvl == 0) ? 1 : mNext.getVoxelCount(lvl);
461 }
462
463 bool isValueOn(Index lvl) const
464 {
465 return (lvl == 0) ? mIter.isValueOn() : mNext.isValueOn(lvl);
466 }
467
468 const NCValueT& getValue(Index lvl) const
469 {
470 if (lvl == 0) return mIter.getValue();
471 return mNext.getValue(lvl);
472 }
473
474 void setValue(Index lvl, const NCValueT& val) const
475 {
476 if (lvl == 0) mIter.setValue(val); else mNext.setValue(lvl, val);
477 }
478 void setValueOn(Index lvl, bool on = true) const
479 {
480 if (lvl == 0) mIter.setValueOn(on); else mNext.setValueOn(lvl, on);
481 }
482 void setValueOff(Index lvl) const
483 {
484 if (lvl == 0) mIter.setValueOff(); else mNext.setValueOff(lvl);
485 }
486
487 template<typename ModifyOp>
488 void modifyValue(Index lvl, const ModifyOp& op) const
489 {
490 if (lvl == 0) mIter.modifyValue(op); else mNext.modifyValue(lvl, op);
491 }
492
493 private:
494 using RestT = typename NodeVecT::PopFront; // NodeVecT minus its first item
495 using NextItem = IterListItem<IterListItem, RestT, VecSize - 1, /*Level=*/1>;
496
497 IterT mIter;
498 NextItem mNext;
499 PrevItemT* mPrev;
500 };
501
502
504 template<typename PrevItemT, typename NodeVecT, Index _Level>
505 class IterListItem<PrevItemT, NodeVecT, /*VecSize=*/1, _Level>
506 {
507 public:
508 using _NodeT = typename NodeVecT::Front;
510 using PrevIterT = typename PrevItemT::IterT;
512 using IterT = typename IterTraits<typename PrevIterT::NonConstNodeType, PrevIterT>::template
513 NodeConverter<_NodeT>::Type;
514
516 using NodeT = typename IterT::NodeType;
518 using NCNodeT = typename IterT::NonConstNodeType;
520 using NCValueT = typename IterT::NonConstValueType;
522 using ChildT = typename CopyConstness<NodeT, typename NodeT::ChildNodeType>::Type;
524 using NCChildT = typename CopyConstness<NCNodeT, typename NCNodeT::ChildNodeType>::Type;
525 using ITraits = IterTraits<NCNodeT, IterT>;
527 static const Index Level = _Level;
528
529 IterListItem(PrevItemT* prev): mPrev(prev) {}
530
531 IterListItem(const IterListItem& other): mIter(other.mIter), mPrev(nullptr) {}
532 IterListItem& operator=(const IterListItem& other)
533 {
534 if (&other != this) {
535 mIter = other.mIter;
536 mPrev = nullptr;
537 }
538 return *this;
539 }
540
541 void updateBackPointers(PrevItemT* prev) { mPrev = prev; }
542
543 // The following method specializations differ from the default template
544 // implementations mainly in that they don't forward.
545
546 void setIter(const IterT& iter) { mIter = iter; }
547
548 void getNode(Index lvl, NodeT*& node) const
549 {
550 node = (lvl <= Level) ? mIter.getParentNode() : nullptr;
551 }
552
553 template<typename OtherIterListItemT>
554 void initLevel(Index lvl, OtherIterListItemT& otherListItem)
555 {
556 if (lvl == Level) {
557 const NodeT* node = nullptr;
558 otherListItem.getNode(lvl, node);
559 mIter = (node == nullptr) ? IterT() : ITraits::begin(*const_cast<NodeT*>(node));
560 }
561 }
562
563 Index pos(Index lvl) const { return (lvl == Level) ? mIter.pos() : Index(-1); }
564
565 bool test(Index lvl) const { return (lvl == Level) ? mIter.test() : false; }
566
567 bool next(Index lvl) { return (lvl == Level) ? mIter.next() : false; }
568
569 bool down(Index lvl)
570 {
571 if (lvl == Level && mPrev != nullptr && mIter) {
572 if (ChildT* child = ITraits::template getChild<ChildT>(mIter)) {
573 mPrev->setIter(PrevItemT::ITraits::begin(*child));
574 return true;
575 }
576 }
577 return false;
578 }
579
580 Coord getCoord(Index lvl) const { return (lvl == Level) ? mIter.getCoord() : Coord(); }
581 Index getChildDim(Index lvl) const { return (lvl == Level) ? NodeT::getChildDim() : 0; }
582 Index64 getVoxelCount(Index lvl) const { return (lvl == Level) ? ChildT::NUM_VOXELS : 0; }
583
584 bool isValueOn(Index lvl) const { return (lvl == Level) ? mIter.isValueOn() : false; }
585
586 const NCValueT& getValue(Index lvl) const
587 {
588 assert(lvl == Level);
589 (void)lvl; // avoid unused variable warning in optimized builds
590 return mIter.getValue();
591 }
592
593 void setValue(Index lvl, const NCValueT& val) const { if (lvl == Level) mIter.setValue(val); }
594 void setValueOn(Index lvl, bool on = true) const { if (lvl == Level) mIter.setValueOn(on); }
595 void setValueOff(Index lvl) const { if (lvl == Level) mIter.setValueOff(); }
596
597 template<typename ModifyOp>
598 void modifyValue(Index lvl, const ModifyOp& op) const
599 {
600 if (lvl == Level) mIter.modifyValue(op);
601 }
602
603 private:
604 IterT mIter;
605 PrevItemT* mPrev;
606 };
607
608
610
611
612 //#define DEBUG_TREE_VALUE_ITERATOR
613
615 template<typename _TreeT, typename _ValueIterT>
616 class TreeValueIteratorBase
617 {
618 public:
619 using TreeT = _TreeT;
620 using ValueIterT = _ValueIterT;
621 using NodeT = typename ValueIterT::NodeType;
622 using ValueT = typename ValueIterT::NonConstValueType;
623 using ChildOnIterT = typename NodeT::ChildOnCIter;
624 static const Index ROOT_LEVEL = NodeT::LEVEL;
625 static_assert(ValueIterT::NodeType::LEVEL == ROOT_LEVEL, "invalid value iterator node type");
626 static const Index LEAF_LEVEL = 0, ROOT_DEPTH = 0, LEAF_DEPTH = ROOT_LEVEL;
627
628 TreeValueIteratorBase(TreeT&);
629
630 TreeValueIteratorBase(const TreeValueIteratorBase& other);
631 TreeValueIteratorBase& operator=(const TreeValueIteratorBase& other);
632
634 void setMinDepth(Index minDepth);
636 Index getMinDepth() const { return ROOT_LEVEL - Index(mMaxLevel); }
638 void setMaxDepth(Index maxDepth);
640 Index getMaxDepth() const { return ROOT_LEVEL - Index(mMinLevel); }
641
643 bool test() const { return mValueIterList.test(mLevel); }
645 operator bool() const { return this->test(); }
647
650 bool next();
652 TreeValueIteratorBase& operator++() { this->next(); return *this; }
653
656 Index getLevel() const { return mLevel; }
659 Index getDepth() const { return ROOT_LEVEL - mLevel; }
660 static Index getLeafDepth() { return LEAF_DEPTH; }
661
666 template<typename NodeType>
667 void getNode(NodeType*& node) const { mValueIterList.getNode(mLevel, node); }
668
671 Coord getCoord() const { return mValueIterList.getCoord(mLevel); }
675 bool getBoundingBox(CoordBBox&) const;
678 CoordBBox getBoundingBox() const { CoordBBox b; this->getBoundingBox(b); return b; }
679
681 Index64 getVoxelCount() const { return mValueIterList.getVoxelCount(mLevel);}
682
684 bool isTileValue() const { return mLevel != 0 && this->test(); }
686 bool isVoxelValue() const { return mLevel == 0 && this->test(); }
688 bool isValueOn() const { return mValueIterList.isValueOn(mLevel); }
689
691 const ValueT& getValue() const { return mValueIterList.getValue(mLevel); }
693 const ValueT& operator*() const { return this->getValue(); }
694 const ValueT* operator->() const { return &(this->operator*()); }
696
699 void setValue(const ValueT& val) const { mValueIterList.setValue(mLevel, val); }
702 void setActiveState(bool on) const { mValueIterList.setValueOn(mLevel, on); }
704 void setValueOff() const { mValueIterList.setValueOff(mLevel); }
705
711 template<typename ModifyOp>
712 void modifyValue(const ModifyOp& op) const { mValueIterList.modifyValue(mLevel, op); }
713
715 TreeT* getTree() const { return mTree; }
716
718 std::string summary() const;
719
720 private:
721 bool advance(bool dontIncrement = false);
722
723 using InvTreeT = typename iter::InvertedTree<NodeT, NodeT::LEVEL>::Type;
724 struct PrevChildItem { using IterT = ChildOnIterT; };
725 struct PrevValueItem { using IterT = ValueIterT; };
726
727 IterListItem<PrevChildItem, InvTreeT, /*VecSize=*/ROOT_LEVEL+1, /*Level=*/0> mChildIterList;
728 IterListItem<PrevValueItem, InvTreeT, /*VecSize=*/ROOT_LEVEL+1, /*Level=*/0> mValueIterList;
729 Index mLevel;
730 int mMinLevel, mMaxLevel;
731 TreeT* mTree;
732 }; // class TreeValueIteratorBase
733
734
735 template<typename TreeT, typename ValueIterT>
736 inline
737 TreeValueIteratorBase<TreeT, ValueIterT>::TreeValueIteratorBase(TreeT& tree):
738 mChildIterList(nullptr),
739 mValueIterList(nullptr),
740 mLevel(ROOT_LEVEL),
741 mMinLevel(int(LEAF_LEVEL)),
742 mMaxLevel(int(ROOT_LEVEL)),
743 mTree(&tree)
744 {
745 mChildIterList.setIter(IterTraits<NodeT, ChildOnIterT>::begin(tree.root()));
746 mValueIterList.setIter(IterTraits<NodeT, ValueIterT>::begin(tree.root()));
747 this->advance(/*dontIncrement=*/true);
748 }
749
750
751 template<typename TreeT, typename ValueIterT>
752 inline
753 TreeValueIteratorBase<TreeT, ValueIterT>::TreeValueIteratorBase(const TreeValueIteratorBase& other):
754 mChildIterList(other.mChildIterList),
755 mValueIterList(other.mValueIterList),
756 mLevel(other.mLevel),
757 mMinLevel(other.mMinLevel),
758 mMaxLevel(other.mMaxLevel),
759 mTree(other.mTree)
760 {
761 mChildIterList.updateBackPointers();
762 mValueIterList.updateBackPointers();
763 }
764
765
766 template<typename TreeT, typename ValueIterT>
767 inline TreeValueIteratorBase<TreeT, ValueIterT>&
768 TreeValueIteratorBase<TreeT, ValueIterT>::operator=(const TreeValueIteratorBase& other)
769 {
770 if (&other != this) {
771 mChildIterList = other.mChildIterList;
772 mValueIterList = other.mValueIterList;
773 mLevel = other.mLevel;
774 mMinLevel = other.mMinLevel;
775 mMaxLevel = other.mMaxLevel;
776 mTree = other.mTree;
777 mChildIterList.updateBackPointers();
778 mValueIterList.updateBackPointers();
779 }
780 return *this;
781 }
782
783
784 template<typename TreeT, typename ValueIterT>
785 inline void
786 TreeValueIteratorBase<TreeT, ValueIterT>::setMinDepth(Index minDepth)
787 {
788 mMaxLevel = int(ROOT_LEVEL - minDepth); // level = ROOT_LEVEL - depth
789 if (int(mLevel) > mMaxLevel) this->next();
790 }
791
792
793 template<typename TreeT, typename ValueIterT>
794 inline void
795 TreeValueIteratorBase<TreeT, ValueIterT>::setMaxDepth(Index maxDepth)
796 {
797 // level = ROOT_LEVEL - depth
798 mMinLevel = int(ROOT_LEVEL - std::min(maxDepth, this->getLeafDepth()));
799 if (int(mLevel) < mMinLevel) this->next();
800 }
801
802
803 template<typename TreeT, typename ValueIterT>
804 inline bool
805 TreeValueIteratorBase<TreeT, ValueIterT>::next()
806 {
807 do {
808 if (!this->advance()) return false;
809 } while (int(mLevel) < mMinLevel || int(mLevel) > mMaxLevel);
810 return true;
811 }
812
813
814 template<typename TreeT, typename ValueIterT>
815 inline bool
816 TreeValueIteratorBase<TreeT, ValueIterT>::advance(bool dontIncrement)
817 {
818 bool recurse = false;
819 do {
820 recurse = false;
821 Index
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);
828 }
829 if (vPos < cPos) {
830 if (dontIncrement) return true;
831 if (mValueIterList.next(mLevel)) {
832 if (mValueIterList.pos(mLevel) == cPos && mChildIterList.test(mLevel)) {
835 mValueIterList.next(mLevel);
836 }
837 // If there is a next value and it precedes the next child, return.
838 if (mValueIterList.pos(mLevel) < cPos) return true;
839 }
840 } else {
841 // Advance to the next child, which may or may not precede the next value.
842 if (!dontIncrement) mChildIterList.next(mLevel);
843 }
844 #ifdef DEBUG_TREE_VALUE_ITERATOR
845 std::cout << "\n" << this->summary() << std::flush;
846 #endif
847
848 // Descend to the lowest level at which the next value precedes the next child.
849 while (mChildIterList.pos(mLevel) < mValueIterList.pos(mLevel)) {
850 #ifdef ENABLE_TREE_VALUE_DEPTH_BOUND_OPTIMIZATION
851 if (int(mLevel) == mMinLevel) {
852 // If the current node lies at the lowest allowed level, none of its
853 // children can be visited, so just advance its child iterator.
854 mChildIterList.next(mLevel);
855 if (mValueIterList.pos(mLevel) == mChildIterList.pos(mLevel)
856 && mChildIterList.test(mLevel))
857 {
860 mValueIterList.next(mLevel);
861 }
862 } else
863 #endif
864 if (mChildIterList.down(mLevel)) {
865 --mLevel; // descend one level
866 mValueIterList.initLevel(mLevel, mChildIterList);
867 if (mValueIterList.pos(mLevel) == mChildIterList.pos(mLevel)
868 && mChildIterList.test(mLevel))
869 {
872 mValueIterList.next(mLevel);
873 }
874 } else break;
875 #ifdef DEBUG_TREE_VALUE_ITERATOR
876 std::cout << "\n" << this->summary() << std::flush;
877 #endif
878 }
879 // Ascend to the nearest level at which one of the iterators is not yet exhausted.
880 while (!mChildIterList.test(mLevel) && !mValueIterList.test(mLevel)) {
881 if (mLevel == ROOT_LEVEL) return false;
882 ++mLevel;
883 mChildIterList.next(mLevel);
884 dontIncrement = true;
885 recurse = true;
886 }
887 } while (recurse);
888 return true;
889 }
890
891
892 template<typename TreeT, typename ValueIterT>
893 inline bool
894 TreeValueIteratorBase<TreeT, ValueIterT>::getBoundingBox(CoordBBox& bbox) const
895 {
896 if (!this->test()) {
897 bbox = CoordBBox();
898 return false;
899 }
900 bbox.min() = mValueIterList.getCoord(mLevel);
901 bbox.max() = bbox.min().offsetBy(mValueIterList.getChildDim(mLevel) - 1);
902 return true;
903 }
904
905
906 template<typename TreeT, typename ValueIterT>
907 inline std::string
908 TreeValueIteratorBase<TreeT, ValueIterT>::summary() const
909 {
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";
914 else ostr << "int" << (ROOT_LEVEL - lvl);
915 ostr << " v" << mValueIterList.pos(lvl)
916 << " c" << mChildIterList.pos(lvl);
917 if (lvl > int(mLevel)) ostr << " / ";
918 }
919 if (this->test() && mValueIterList.pos(mLevel) < mChildIterList.pos(mLevel)) {
920 if (mLevel == 0) {
921 ostr << " " << this->getCoord();
922 } else {
923 ostr << " " << this->getBoundingBox();
924 }
925 }
926 return ostr.str();
927 }
928
929
931
932
934 template<typename _TreeT, typename RootChildOnIterT>
935 class NodeIteratorBase
936 {
937 public:
938 using TreeT = _TreeT;
939 using RootIterT = RootChildOnIterT;
940 using RootNodeT = typename RootIterT::NodeType;
941 using NCRootNodeT = typename RootIterT::NonConstNodeType;
942 static const Index ROOT_LEVEL = RootNodeT::LEVEL;
943 using InvTreeT = typename iter::InvertedTree<NCRootNodeT, ROOT_LEVEL>::Type;
944 static const Index LEAF_LEVEL = 0, ROOT_DEPTH = 0, LEAF_DEPTH = ROOT_LEVEL;
945
946 using RootIterTraits = IterTraits<NCRootNodeT, RootIterT>;
947
948 NodeIteratorBase();
949 NodeIteratorBase(TreeT&);
950
951 NodeIteratorBase(const NodeIteratorBase& other);
952 NodeIteratorBase& operator=(const NodeIteratorBase& other);
953
955 void setMinDepth(Index minDepth);
957 Index getMinDepth() const { return ROOT_LEVEL - Index(mMaxLevel); }
959 void setMaxDepth(Index maxDepth);
961 Index getMaxDepth() const { return ROOT_LEVEL - Index(mMinLevel); }
962
964 bool test() const { return !mDone; }
966 operator bool() const { return this->test(); }
968
971 bool next();
973 void increment() { this->next(); }
974 NodeIteratorBase& operator++() { this->increment(); return *this; }
976 void increment(Index n) { for (Index i = 0; i < n && this->next(); ++i) {} }
977
980 Index getLevel() const { return mLevel; }
983 Index getDepth() const { return ROOT_LEVEL - mLevel; }
984 static Index getLeafDepth() { return LEAF_DEPTH; }
985
988 Coord getCoord() const;
992 bool getBoundingBox(CoordBBox& bbox) const;
995 CoordBBox getBoundingBox() const { CoordBBox b; this->getBoundingBox(b); return b; }
996
998 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); }
1006
1007 TreeT* getTree() const { return mTree; }
1008
1009 std::string summary() const;
1010
1011 private:
1012 struct PrevItem { using IterT = RootIterT; };
1013
1014 IterListItem<PrevItem, InvTreeT, /*VecSize=*/ROOT_LEVEL+1, LEAF_LEVEL> mIterList;
1015 Index mLevel;
1016 int mMinLevel, mMaxLevel;
1017 bool mDone;
1018 TreeT* mTree;
1019 }; // class NodeIteratorBase
1020
1021
1022 template<typename TreeT, typename RootChildOnIterT>
1023 inline
1024 NodeIteratorBase<TreeT, RootChildOnIterT>::NodeIteratorBase():
1025 mIterList(nullptr),
1026 mLevel(ROOT_LEVEL),
1027 mMinLevel(int(LEAF_LEVEL)),
1028 mMaxLevel(int(ROOT_LEVEL)),
1029 mDone(true),
1030 mTree(nullptr)
1031 {
1032 }
1033
1034
1035 template<typename TreeT, typename RootChildOnIterT>
1036 inline
1037 NodeIteratorBase<TreeT, RootChildOnIterT>::NodeIteratorBase(TreeT& tree):
1038 mIterList(nullptr),
1039 mLevel(ROOT_LEVEL),
1040 mMinLevel(int(LEAF_LEVEL)),
1041 mMaxLevel(int(ROOT_LEVEL)),
1042 mDone(false),
1043 mTree(&tree)
1044 {
1045 mIterList.setIter(RootIterTraits::begin(tree.root()));
1046 }
1047
1048
1049 template<typename TreeT, typename RootChildOnIterT>
1050 inline
1051 NodeIteratorBase<TreeT, RootChildOnIterT>::NodeIteratorBase(const NodeIteratorBase& other):
1052 mIterList(other.mIterList),
1053 mLevel(other.mLevel),
1054 mMinLevel(other.mMinLevel),
1055 mMaxLevel(other.mMaxLevel),
1056 mDone(other.mDone),
1057 mTree(other.mTree)
1058 {
1059 mIterList.updateBackPointers();
1060 }
1061
1062
1063 template<typename TreeT, typename RootChildOnIterT>
1064 inline NodeIteratorBase<TreeT, RootChildOnIterT>&
1065 NodeIteratorBase<TreeT, RootChildOnIterT>::operator=(const NodeIteratorBase& other)
1066 {
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;
1074 mIterList.updateBackPointers();
1075 }
1076 return *this;
1077 }
1078
1079
1080 template<typename TreeT, typename RootChildOnIterT>
1081 inline void
1082 NodeIteratorBase<TreeT, RootChildOnIterT>::setMinDepth(Index minDepth)
1083 {
1084 mMaxLevel = int(ROOT_LEVEL - minDepth); // level = ROOT_LEVEL - depth
1085 if (int(mLevel) > mMaxLevel) this->next();
1086 }
1087
1088
1089 template<typename TreeT, typename RootChildOnIterT>
1090 inline void
1091 NodeIteratorBase<TreeT, RootChildOnIterT>::setMaxDepth(Index maxDepth)
1092 {
1093 // level = ROOT_LEVEL - depth
1094 mMinLevel = int(ROOT_LEVEL - std::min(maxDepth, this->getLeafDepth()));
1095 if (int(mLevel) < mMinLevel) this->next();
1096 }
1097
1098
1099 template<typename TreeT, typename RootChildOnIterT>
1100 inline bool
1101 NodeIteratorBase<TreeT, RootChildOnIterT>::next()
1102 {
1103 do {
1104 if (mDone) return false;
1105
1106 // If the iterator over the current node points to a child,
1107 // descend to the child (depth-first traversal).
1108 if (int(mLevel) > mMinLevel && mIterList.test(mLevel)) {
1109 if (!mIterList.down(mLevel)) return false;
1110 --mLevel;
1111 } else {
1112 // Ascend to the nearest ancestor that has other children.
1113 while (!mIterList.test(mLevel)) {
1114 if (mLevel == ROOT_LEVEL) {
1115 // Can't ascend higher than the root.
1116 mDone = true;
1117 return false;
1118 }
1119 ++mLevel; // ascend one level
1120 mIterList.next(mLevel); // advance to the next child, if there is one
1121 }
1122 // Descend to the child.
1123 if (!mIterList.down(mLevel)) return false;
1124 --mLevel;
1125 }
1126 } while (int(mLevel) < mMinLevel || int(mLevel) > mMaxLevel);
1127 return true;
1128 }
1129
1130
1131 template<typename TreeT, typename RootChildOnIterT>
1132 inline Coord
1133 NodeIteratorBase<TreeT, RootChildOnIterT>::getCoord() const
1134 {
1135 if (mLevel != ROOT_LEVEL) return mIterList.getCoord(mLevel + 1);
1136 RootNodeT* root = nullptr;
1137 this->getNode(root);
1138 return root ? root->getMinIndex() : Coord::min();
1139 }
1140
1141
1142 template<typename TreeT, typename RootChildOnIterT>
1143 inline bool
1144 NodeIteratorBase<TreeT, RootChildOnIterT>::getBoundingBox(CoordBBox& bbox) const
1145 {
1146 if (mLevel == ROOT_LEVEL) {
1147 RootNodeT* root = nullptr;
1148 this->getNode(root);
1149 if (root == nullptr) {
1150 bbox = CoordBBox();
1151 return false;
1152 }
1153 root->getIndexRange(bbox);
1154 return true;
1155 }
1156 bbox.min() = mIterList.getCoord(mLevel + 1);
1157 bbox.max() = bbox.min().offsetBy(mIterList.getChildDim(mLevel + 1) - 1);
1158 return true;
1159 }
1160
1161
1162 template<typename TreeT, typename RootChildOnIterT>
1163 inline std::string
1164 NodeIteratorBase<TreeT, RootChildOnIterT>::summary() const
1165 {
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";
1170 else ostr << "int" << (ROOT_LEVEL - lvl);
1171 ostr << " c" << mIterList.pos(lvl);
1172 if (lvl > int(mLevel)) ostr << " / ";
1173 }
1174 CoordBBox bbox;
1175 this->getBoundingBox(bbox);
1176 ostr << " " << bbox;
1177 return ostr.str();
1178 }
1179
1180
1182
1183
1185 template<typename TreeT, typename RootChildOnIterT>
1186 class LeafIteratorBase
1187 {
1188 public:
1189 using RootIterT = RootChildOnIterT;
1190 using RootNodeT = typename RootIterT::NodeType;
1191 using NCRootNodeT = typename RootIterT::NonConstNodeType;
1192 static const Index ROOT_LEVEL = RootNodeT::LEVEL;
1193 using InvTreeT = typename iter::InvertedTree<NCRootNodeT, ROOT_LEVEL>::Type;
1194 using NCLeafNodeT = typename InvTreeT::Front;
1195 using LeafNodeT = typename CopyConstness<RootNodeT, NCLeafNodeT>::Type;
1196 static const Index LEAF_LEVEL = 0, LEAF_PARENT_LEVEL = LEAF_LEVEL + 1;
1197
1198 using RootIterTraits = IterTraits<NCRootNodeT, RootIterT>;
1199
1200 LeafIteratorBase(): mIterList(nullptr), mTree(nullptr) {}
1201
1202 LeafIteratorBase(TreeT& tree): mIterList(nullptr), mTree(&tree)
1203 {
1204 // Initialize the iterator list with a root node iterator.
1205 mIterList.setIter(RootIterTraits::begin(tree.root()));
1206 // Descend along the first branch, initializing the node iterator at each level.
1207 Index lvl = ROOT_LEVEL;
1208 for ( ; lvl > 0 && mIterList.down(lvl); --lvl) {}
1209 // If the first branch terminated above the leaf level, backtrack to the next branch.
1210 if (lvl > 0) this->next();
1211 }
1212
1213 LeafIteratorBase(const LeafIteratorBase& other): mIterList(other.mIterList), mTree(other.mTree)
1214 {
1215 mIterList.updateBackPointers();
1216 }
1217 LeafIteratorBase& operator=(const LeafIteratorBase& other)
1218 {
1219 if (&other != this) {
1220 mTree = other.mTree;
1221 mIterList = other.mIterList;
1222 mIterList.updateBackPointers();
1223 }
1224 return *this;
1225 }
1226
1228 LeafNodeT* getLeaf() const
1230 {
1231 LeafNodeT* n = nullptr;
1232 mIterList.getNode(LEAF_LEVEL, n);
1233 return n;
1234 }
1235 LeafNodeT& operator*() const { return *this->getLeaf(); }
1236 LeafNodeT* operator->() const { return this->getLeaf(); }
1238
1239 bool test() const { return mIterList.test(LEAF_PARENT_LEVEL); }
1240 operator bool() const { return this->test(); }
1241
1243 bool next();
1245 void increment() { this->next(); }
1246 LeafIteratorBase& operator++() { this->increment(); return *this; }
1248 void increment(Index n) { for (Index i = 0; i < n && this->next(); ++i) {} }
1250
1251 TreeT* getTree() const { return mTree; }
1252
1253 private:
1254 struct PrevItem { using IterT = RootIterT; };
1255
1259 IterListItem<PrevItem, InvTreeT, /*VecSize=*/ROOT_LEVEL+1, LEAF_LEVEL> mIterList;
1260 TreeT* mTree;
1261 }; // class LeafIteratorBase
1262
1263
1264 template<typename TreeT, typename RootChildOnIterT>
1265 inline bool
1266 LeafIteratorBase<TreeT, RootChildOnIterT>::next()
1267 {
1268 // If the iterator is valid for the current node one level above the leaf level,
1269 // advance the iterator to the node's next child.
1270 if (mIterList.test(LEAF_PARENT_LEVEL) && mIterList.next(LEAF_PARENT_LEVEL)) {
1271 mIterList.down(LEAF_PARENT_LEVEL); // initialize the leaf iterator
1272 return true;
1273 }
1274
1275 Index lvl = LEAF_PARENT_LEVEL;
1276 while (!mIterList.test(LEAF_PARENT_LEVEL)) {
1277 if (mIterList.test(lvl)) {
1278 mIterList.next(lvl);
1279 } else {
1280 do {
1281 // Ascend to the nearest level at which
1282 // one of the iterators is not yet exhausted.
1283 if (lvl == ROOT_LEVEL) return false;
1284 ++lvl;
1285 if (mIterList.test(lvl)) mIterList.next(lvl);
1286 } while (!mIterList.test(lvl));
1287 }
1288 // Descend to the lowest child, but not as far as the leaf iterator.
1289 while (lvl > LEAF_PARENT_LEVEL && mIterList.down(lvl)) --lvl;
1290 }
1291 mIterList.down(LEAF_PARENT_LEVEL); // initialize the leaf iterator
1292 return true;
1293 }
1294
1295
1297
1298
1301 template<typename IterT>
1302 class IteratorRange
1303 {
1304 public:
1305 IteratorRange(const IterT& iter, size_t grainSize = 8):
1306 mIter(iter),
1307 mGrainSize(grainSize),
1308 mSize(0)
1309 {
1310 mSize = this->size();
1311 }
1312 IteratorRange(IteratorRange& other, tbb::split):
1313 mIter(other.mIter),
1314 mGrainSize(other.mGrainSize),
1315 mSize(other.mSize >> 1)
1316 {
1317 other.increment(mSize);
1318 }
1319
1323 const IterT& iterator() const { return mIter; }
1324
1325 bool empty() const { return mSize == 0 || !mIter.test(); }
1326 bool test() const { return !this->empty(); }
1327 operator bool() const { return !this->empty(); }
1328
1331 bool is_divisible() const { return mSize > mGrainSize; }
1332
1334 void increment(Index n = 1) { for ( ; n > 0 && mSize > 0; --n, --mSize, ++mIter) {} }
1336 IteratorRange& operator++() { this->increment(); return *this; }
1339 bool next() { this->increment(); return this->test(); }
1340
1341 private:
1342 Index size() const { Index n = 0; for (IterT it(mIter); it.test(); ++n, ++it) {} return n; }
1343
1344 IterT mIter;
1345 size_t mGrainSize;
1350 Index mSize;
1351 };
1352
1353
1355
1356
1359
1360 } // namespace tree
1361 } // namespace OPENVDB_VERSION_NAME
1362 } // namespace openvdb
1363
1364 #endif // OPENVDB_TREE_TREEITERATOR_HAS_BEEN_INCLUDED
openvdb::v7_1::tree::NodeIteratorBase::getCoord
Coord getCoord() const
Return the global coordinates of the voxel or tile to which this iterator is currently pointing.
Definition: TreeIterator.h:1133
openvdb::v7_1::tree::NodeIteratorBase::getLevel
Index getLevel() const
Return the level in the tree (0 = leaf) of the node to which this iterator is currently pointing.
Definition: TreeIterator.h:980
openvdb::v7_1::tree::NodeIteratorBase::increment
void increment()
Advance the iterator to the next leaf node.
Definition: TreeIterator.h:973
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ChildAllCIter >::begin
static IterT begin(const NodeT &node)
Definition: TreeIterator.h:128
openvdb::v7_1::tree::NodeIteratorBase::getNode
void getNode(const NodeT *&node) const
Definition: TreeIterator.h:1004
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::getNode
void getNode(Index lvl, OtherNodeT *&node) const
Definition: TreeIterator.h:427
openvdb::v7_1::TypeList
A list of types (not necessarily unique)
Definition: Types.h:653
openvdb::v7_1::tree::IteratorRange::is_divisible
bool is_divisible() const
Return true if this range is splittable (i.e., if the iterator can be advanced more than mGrainSize t...
Definition: TreeIterator.h:1331
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ChildAllCIter >::IterT
typename NodeT::ChildAllCIter IterT
Definition: TreeIterator.h:127
openvdb::v7_1::tree::NodeIteratorBase::getBoundingBox
CoordBBox getBoundingBox() const
Return the axis-aligned bounding box of the voxel or tile to which this iterator is currently pointin...
Definition: TreeIterator.h:995
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::initLevel
void initLevel(Index lvl, OtherIterListItemT &otherListItem)
Definition: TreeIterator.h:430
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::_NodeT
typename NodeVecT::Front _NodeT
Definition: TreeIterator.h:508
openvdb::v7_1::tree::TreeValueIteratorBase::operator=
TreeValueIteratorBase & operator=(const TreeValueIteratorBase &other)
Definition: TreeIterator.h:768
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ValueAllCIter >::IterT
typename NodeT::ValueAllCIter IterT
Definition: TreeIterator.h:191
openvdb::v7_1::tree::IteratorRange::IteratorRange
IteratorRange(IteratorRange &other, tbb::split)
Definition: TreeIterator.h:1312
openvdb::v7_1::tree::IterListItem::test
bool test(Index lvl) const
Return true if the iterator at level lvl of the tree has not yet reached its end.
Definition: TreeIterator.h:289
openvdb::v7_1::tree::TreeValueIteratorBase::operator->
const ValueT * operator->() const
Definition: TreeIterator.h:694
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ChildOffCIter >::IterT
typename NodeT::ChildOffCIter IterT
Definition: TreeIterator.h:103
openvdb::v7_1::tree::IterListItem::initLevel
void initLevel(Index lvl, OtherIterListItemT &otherListItem)
Initialize the iterator for level lvl of the tree with the node over which the corresponding iterator...
Definition: TreeIterator.h:273
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ValueOnIter >::begin
static IterT begin(NodeT &node)
Definition: TreeIterator.h:142
openvdb::v7_1::tree::NodeIteratorBase::getLeafDepth
static Index getLeafDepth()
Definition: TreeIterator.h:984
openvdb::v7_1::tree::LeafIteratorBase::operator++
LeafIteratorBase & operator++()
Definition: TreeIterator.h:1246
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ValueAllIter >::IterT
typename NodeT::ValueAllIter IterT
Definition: TreeIterator.h:181
openvdb::v7_1::tree::NodeIteratorBase::RootIterT
RootChildOnIterT RootIterT
Definition: TreeIterator.h:939
openvdb::v7_1::tree::IterListItem< PrevItem, InvTreeT, ROOT_LEVEL+1, LEAF_LEVEL >::NCChildT
typename CopyConstness< NCNodeT, typename NCNodeT::ChildNodeType >::Type NCChildT
NodeT's child node type with const qualifiers removed.
Definition: TreeIterator.h:233
openvdb::v7_1::tree::LeafIteratorBase::test
bool test() const
Definition: TreeIterator.h:1239
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ChildOnIter >::begin
static IterT begin(NodeT &node)
Definition: TreeIterator.h:68
openvdb::v7_1::tree::LeafIteratorBase::LEAF_PARENT_LEVEL
static const Index LEAF_PARENT_LEVEL
Definition: TreeIterator.h:1196
openvdb::v7_1::tree::NodeIteratorBase::ROOT_LEVEL
static const Index ROOT_LEVEL
Definition: TreeIterator.h:942
Types.h
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ValueOffIter >::NodeConverter::Type
typename OtherNodeT::ValueOffIter Type
Definition: TreeIterator.h:164
openvdb::v7_1::tree::LeafIteratorBase::NCLeafNodeT
typename InvTreeT::Front NCLeafNodeT
Definition: TreeIterator.h:1194
openvdb::v7_1::tree::TreeValueIteratorBase::NodeT
typename ValueIterT::NodeType NodeT
Definition: TreeIterator.h:621
openvdb::v7_1::tree::IterListItem::getValue
const NCValueT & getValue(Index lvl) const
Return the value to which the iterator at level lvl of the tree points.
Definition: TreeIterator.h:330
openvdb::v7_1::tree::NodeIteratorBase::setMaxDepth
void setMaxDepth(Index maxDepth)
Specify the depth of the lowest level of the tree to which to descend (depth 0 = root).
Definition: TreeIterator.h:1091
openvdb::v7_1::tree::IterListItem::IterListItem
IterListItem(const IterListItem &other)
Definition: TreeIterator.h:240
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ValueOffCIter >::IterT
typename NodeT::ValueOffCIter IterT
Definition: TreeIterator.h:171
openvdb::v7_1::tree::LeafIteratorBase::RootNodeT
typename RootIterT::NodeType RootNodeT
Definition: TreeIterator.h:1190
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::setValue
void setValue(Index lvl, const NCValueT &val) const
Definition: TreeIterator.h:474
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ChildOnCIter >::IterT
typename NodeT::ChildOnCIter IterT
Definition: TreeIterator.h:80
openvdb::v7_1::tree::IteratorRange::increment
void increment(Index n=1)
Advance the iterator n times.
Definition: TreeIterator.h:1334
openvdb::v7_1::tree::IterListItem::IterListItem
IterListItem(PrevItemT *prev)
Definition: TreeIterator.h:238
openvdb::v7_1::tree::IteratorRange::operator++
IteratorRange & operator++()
Advance the iterator to the next item.
Definition: TreeIterator.h:1336
openvdb::v7_1::Index
Index32 Index
Definition: Types.h:31
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::setValueOff
void setValueOff(Index lvl) const
Definition: TreeIterator.h:482
openvdb::v7_1::tree::LeafIteratorBase::increment
void increment()
Definition: TreeIterator.h:1245
openvdb::v7_1::tree::IterListItem< PrevItem, InvTreeT, ROOT_LEVEL+1, LEAF_LEVEL >::IterT
typename IterTraits< typename PrevIterT::NonConstNodeType, PrevIterT >::template NodeConverter< _NodeT >::Type IterT
The type of iterator stored in this list item (e.g., InternalNode::ValueOnCIter)
Definition: TreeIterator.h:222
openvdb::v7_1::tree::NodeIteratorBase::increment
void increment(Index n)
Increment the iterator n times.
Definition: TreeIterator.h:976
openvdb::v7_1::tree::TreeValueIteratorBase::setMaxDepth
void setMaxDepth(Index maxDepth)
Specify the depth of the lowest level of the tree to which to descend (depth 0 = root).
Definition: TreeIterator.h:795
openvdb::v7_1::tree::NodeIteratorBase::LEAF_LEVEL
static const Index LEAF_LEVEL
Definition: TreeIterator.h:944
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::NCNodeT
typename IterT::NonConstNodeType NCNodeT
The type of the node with const qualifiers removed ("Non-Const")
Definition: TreeIterator.h:392
openvdb::v7_1::tree::IterListItem< PrevItem, InvTreeT, ROOT_LEVEL+1, LEAF_LEVEL >::_NodeT
typename NodeVecT::Front _NodeT
The type of node (non-const) whose iterator is stored in this list item.
Definition: TreeIterator.h:219
openvdb::v7_1::tree::LeafIteratorBase::operator->
LeafNodeT * operator->() const
Definition: TreeIterator.h:1236
openvdb::v7_1::tree::NodeIteratorBase::test
bool test() const
Return true if this iterator is not yet exhausted.
Definition: TreeIterator.h:965
openvdb::v7_1::tree::TreeValueIteratorBase::getTree
TreeT * getTree() const
Return a pointer to the tree over which this iterator is iterating.
Definition: TreeIterator.h:715
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::NCValueT
typename IterT::NonConstValueType NCValueT
The type of value (with const qualifiers removed) to which the iterator points.
Definition: TreeIterator.h:520
openvdb::v7_1::tree::NodeIteratorBase::getMinDepth
Index getMinDepth() const
Return the depth of the highest level of the tree to which this iterator ascends.
Definition: TreeIterator.h:957
openvdb::v7_1::tree::TreeValueIteratorBase::isVoxelValue
bool isVoxelValue() const
Return true if this iterator is currently pointing to a (leaf) voxel value.
Definition: TreeIterator.h:686
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::PrevIterT
typename PrevItemT::IterT PrevIterT
The type of iterator stored in the previous list item.
Definition: TreeIterator.h:510
openvdb::v7_1::tools::composite::min
const std::enable_if<!VecTraits< T >::IsVec, T >::type & min(const T &a, const T &b)
Definition: Composite.h:102
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::setIter
void setIter(const IterT &iter)
Definition: TreeIterator.h:418
openvdb::v7_1::tree::TreeValueIteratorBase::summary
std::string summary() const
Return a string (for debugging, mainly) describing this iterator's current state.
Definition: TreeIterator.h:908
openvdb::v7_1::tree::TreeValueIteratorBase::operator++
TreeValueIteratorBase & operator++()
Advance to the next tile or voxel value.
Definition: TreeIterator.h:652
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::setValueOn
void setValueOn(Index lvl, bool on=true) const
Definition: TreeIterator.h:478
openvdb::v7_1::tree::LeafIteratorBase::InvTreeT
typename iter::InvertedTree< NCRootNodeT, ROOT_LEVEL >::Type InvTreeT
Definition: TreeIterator.h:1193
openvdb::v7_1::tree::LeafIteratorBase::LEAF_LEVEL
static const Index LEAF_LEVEL
Definition: TreeIterator.h:1196
openvdb::v7_1::tree::LeafIteratorBase::RootIterT
RootChildOnIterT RootIterT
Definition: TreeIterator.h:1189
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ChildAllIter >::NodeConverter::Type
typename OtherNodeT::ChildAllIter Type
Definition: TreeIterator.h:120
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ChildOffIter >::IterT
typename NodeT::ChildOffIter IterT
Definition: TreeIterator.h:93
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::pos
Index pos(Index lvl) const
Definition: TreeIterator.h:563
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::updateBackPointers
void updateBackPointers(PrevItemT *prev)
Definition: TreeIterator.h:541
openvdb::v7_1::tree::NodeIteratorBase::operator++
NodeIteratorBase & operator++()
Definition: TreeIterator.h:974
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ValueAllCIter >::begin
static IterT begin(const NodeT &node)
Definition: TreeIterator.h:192
openvdb::v7_1::tree::TreeValueIteratorBase::getMaxDepth
Index getMaxDepth() const
Return the depth of the lowest level of the tree to which this iterator ascends.
Definition: TreeIterator.h:640
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ValueAllCIter >::NodeConverter::Type
typename OtherNodeT::ValueAllCIter Type
Definition: TreeIterator.h:194
version.h
Library and file format version numbers.
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ChildOnCIter >::NodeConverter::Type
typename OtherNodeT::ChildOnCIter Type
Definition: TreeIterator.h:86
openvdb::v7_1::tree::TreeValueIteratorBase::getDepth
Index getDepth() const
Return the depth in the tree (0 = root) of the node to which this iterator is currently pointing.
Definition: TreeIterator.h:659
openvdb::v7_1::tree::TreeValueIteratorBase::setActiveState
void setActiveState(bool on) const
Change the active/inactive state of the tile or voxel value to which this iterator is currently point...
Definition: TreeIterator.h:702
openvdb::v7_1::tree::IterListItem::getVoxelCount
Index64 getVoxelCount(Index lvl) const
Return the number of (virtual) voxels spanned by a tile value or child node.
Definition: TreeIterator.h:318
openvdb::v7_1::tree::LeafIteratorBase::ROOT_LEVEL
static const Index ROOT_LEVEL
Definition: TreeIterator.h:1192
openvdb::v7_1::tree::NodeIteratorBase::InvTreeT
typename iter::InvertedTree< NCRootNodeT, ROOT_LEVEL >::Type InvTreeT
Definition: TreeIterator.h:943
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::getVoxelCount
Index64 getVoxelCount(Index lvl) const
Definition: TreeIterator.h:582
openvdb::v7_1::Index64
uint64_t Index64
Definition: Types.h:30
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::IterListItem
IterListItem(const IterListItem &other)
Definition: TreeIterator.h:531
openvdb::v7_1::tree::NodeIteratorBase::ROOT_DEPTH
static const Index ROOT_DEPTH
Definition: TreeIterator.h:944
openvdb::v7_1::math::Coord::offsetBy
Coord offsetBy(Int32 dx, Int32 dy, Int32 dz) const
Definition: Coord.h:92
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::operator=
IterListItem & operator=(const IterListItem &other)
Definition: TreeIterator.h:532
openvdb::v7_1::tree::NodeIteratorBase::setMinDepth
void setMinDepth(Index minDepth)
Specify the depth of the highest level of the tree to which to ascend (depth 0 = root).
Definition: TreeIterator.h:1082
openvdb::v7_1::tree::LeafIteratorBase::LeafIteratorBase
LeafIteratorBase()
Definition: TreeIterator.h:1200
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ChildOnCIter >::getChild
static const ChildT * getChild(const IterT &iter)
Definition: TreeIterator.h:82
openvdb::v7_1::tree::TreeValueIteratorBase::ValueIterT
_ValueIterT ValueIterT
Definition: TreeIterator.h:620
openvdb::v7_1::tree::TreeValueIteratorBase::getLevel
Index getLevel() const
Return the level in the tree (0 = leaf) of the node to which this iterator is currently pointing.
Definition: TreeIterator.h:656
openvdb::v7_1::tree::IteratorRange::test
bool test() const
Definition: TreeIterator.h:1326
openvdb::v7_1::tree::LeafIteratorBase
Base class for tree-traversal iterators over all leaf nodes (but not leaf voxels)
Definition: TreeIterator.h:1187
openvdb::v7_1::tree::TreeValueIteratorBase::setMinDepth
void setMinDepth(Index minDepth)
Specify the depth of the highest level of the tree to which to ascend (depth 0 = root).
Definition: TreeIterator.h:786
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::getCoord
Coord getCoord(Index lvl) const
Definition: TreeIterator.h:449
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ValueOnCIter >::IterT
typename NodeT::ValueOnCIter IterT
Definition: TreeIterator.h:151
openvdb::v7_1::tree::TreeValueIteratorBase::next
bool next()
Advance to the next tile or voxel value. Return true if this iterator is not yet exhausted.
Definition: TreeIterator.h:805
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::NodeT
typename IterT::NodeType NodeT
The type of node (const or non-const) over which IterT iterates (e.g., const RootNode<....
Definition: TreeIterator.h:390
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::IterListItem
IterListItem(PrevItemT *prev)
Definition: TreeIterator.h:529
openvdb::v7_1::tree::iter::InvertedTree::Type
typename SubtreeT::template Append< HeadT > Type
Definition: TreeIterator.h:34
openvdb::v7_1::tree::NodeIteratorBase::getMaxDepth
Index getMaxDepth() const
Return the depth of the lowest level of the tree to which this iterator ascends.
Definition: TreeIterator.h:961
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::IterT
typename IterTraits< typename PrevIterT::NonConstNodeType, PrevIterT >::template NodeConverter< _NodeT >::Type IterT
The type of iterator stored in this list item (e.g., RootNode::ValueOnCIter)
Definition: TreeIterator.h:513
openvdb::v7_1::math::CoordBBox
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:249
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ValueOnCIter >::NodeConverter::Type
typename OtherNodeT::ValueOnCIter Type
Definition: TreeIterator.h:154
openvdb::v7_1::tree::LeafIteratorBase::operator=
LeafIteratorBase & operator=(const LeafIteratorBase &other)
Definition: TreeIterator.h:1217
openvdb::v7_1::tree::TreeValueIteratorBase::getNode
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...
Definition: TreeIterator.h:667
openvdb::v7_1::tree::NodeIteratorBase::LEAF_DEPTH
static const Index LEAF_DEPTH
Definition: TreeIterator.h:944
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::modifyValue
void modifyValue(Index lvl, const ModifyOp &op) const
Definition: TreeIterator.h:598
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::isValueOn
bool isValueOn(Index lvl) const
Definition: TreeIterator.h:584
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::PrevIterT
typename PrevItemT::IterT PrevIterT
The type of iterator stored in the previous list item.
Definition: TreeIterator.h:382
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::setValueOff
void setValueOff(Index lvl) const
Definition: TreeIterator.h:595
openvdb::v7_1::tree::TreeValueIteratorBase::TreeValueIteratorBase
TreeValueIteratorBase(TreeT &)
Definition: TreeIterator.h:737
openvdb::v7_1::tree::IterListItem::getCoord
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 ...
Definition: TreeIterator.h:309
openvdb::v7_1::tree::NodeIteratorBase
Base class for tree-traversal iterators over all nodes.
Definition: TreeIterator.h:936
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ValueOffCIter >::begin
static IterT begin(const NodeT &node)
Definition: TreeIterator.h:172
openvdb::v7_1::tree::IterTraits
Definition: TreeIterator.h:60
openvdb::v7_1::tree::IterListItem::setValue
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...
Definition: TreeIterator.h:339
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ChildOffIter >::NodeConverter::Type
typename OtherNodeT::ChildOffIter Type
Definition: TreeIterator.h:96
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ValueOffIter >::begin
static IterT begin(NodeT &node)
Definition: TreeIterator.h:162
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ValueAllIter >::NodeConverter::Type
typename OtherNodeT::ValueAllIter Type
Definition: TreeIterator.h:184
openvdb::v7_1::tree::LeafIteratorBase::LeafNodeT
typename CopyConstness< RootNodeT, NCLeafNodeT >::Type LeafNodeT
Definition: TreeIterator.h:1195
openvdb::v7_1::tree::IterListItem::setIter
void setIter(const IterT &iter)
Definition: TreeIterator.h:254
openvdb::v7_1::tree::IterListItem::setValueOff
void setValueOff(Index lvl) const
Mark the value to which the iterator at level lvl of the tree points as inactive.
Definition: TreeIterator.h:353
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ChildOnIter >::NodeConverter::Type
typename OtherNodeT::ChildOnIter Type
Definition: TreeIterator.h:73
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ChildOnIter >::getChild
static ChildT * getChild(const IterT &iter)
Definition: TreeIterator.h:69
openvdb::v7_1::tree::LeafIteratorBase::next
bool next()
Advance the iterator to the next leaf node.
Definition: TreeIterator.h:1266
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::IterListItem
IterListItem(PrevItemT *)
Definition: TreeIterator.h:399
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ChildOffCIter >::NodeConverter::Type
typename OtherNodeT::ChildOffCIter Type
Definition: TreeIterator.h:106
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ValueOnIter >::IterT
typename NodeT::ValueOnIter IterT
Definition: TreeIterator.h:141
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::updateBackPointers
void updateBackPointers(PrevItemT *=nullptr)
Definition: TreeIterator.h:413
openvdb::v7_1::tree::IterTraits::getChild
static ChildT * getChild(const IterT &)
Definition: TreeIterator.h:61
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ChildAllIter >::IterT
typename NodeT::ChildAllIter IterT
Definition: TreeIterator.h:113
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::setIter
void setIter(const OtherIterT &iter)
Definition: TreeIterator.h:420
openvdb::v7_1::tree::TreeValueIteratorBase::operator*
const ValueT & operator*() const
Definition: TreeIterator.h:693
openvdb::v7_1::tree::IterListItem::getChildDim
Index getChildDim(Index lvl) const
Definition: TreeIterator.h:313
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::NCChildT
typename CopyConstness< NCNodeT, typename NCNodeT::ChildNodeType >::Type NCChildT
NodeT's child node type with const qualifiers removed.
Definition: TreeIterator.h:524
openvdb::v7_1::tree::IterListItem::next
bool next(Index lvl)
Increment the iterator at level lvl of the tree.
Definition: TreeIterator.h:292
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::modifyValue
void modifyValue(Index lvl, const ModifyOp &op) const
Definition: TreeIterator.h:488
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ValueOffCIter >::NodeConverter::Type
typename OtherNodeT::ValueOffCIter Type
Definition: TreeIterator.h:174
openvdb::v7_1::math::Coord
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:26
openvdb::v7_1::tree::IterListItem::updateBackPointers
void updateBackPointers(PrevItemT *prev)
Definition: TreeIterator.h:252
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ChildAllIter >::getChild
static ChildT * getChild(const IterT &iter)
Definition: TreeIterator.h:115
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::_NodeT
typename NodeVecT::Front _NodeT
The type of node (non-const) whose iterator is stored in this list item.
Definition: TreeIterator.h:384
openvdb::v7_1::tree::NodeIteratorBase::TreeT
_TreeT TreeT
Definition: TreeIterator.h:938
openvdb::v7_1::tree::IterListItem::setValueOn
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...
Definition: TreeIterator.h:346
openvdb::v7_1::tree::TreeValueIteratorBase::setValueOff
void setValueOff() const
Mark the tile or voxel value to which this iterator is currently pointing as inactive.
Definition: TreeIterator.h:704
openvdb::v7_1::tree::IterListItem::modifyValue
void modifyValue(Index lvl, const ModifyOp &op) const
Apply a functor to the item to which this iterator is pointing.
Definition: TreeIterator.h:361
openvdb::v7_1::tree::LeafIteratorBase::getTree
TreeT * getTree() const
Definition: TreeIterator.h:1251
openvdb::v7_1::tree::TreeValueIteratorBase::isTileValue
bool isTileValue() const
Return true if this iterator is currently pointing to a (non-leaf) tile value.
Definition: TreeIterator.h:684
openvdb::v7_1::tree::TreeValueIteratorBase
Base class for tree-traversal iterators over tile and voxel values.
Definition: TreeIterator.h:617
openvdb::v7_1::tree::IterListItem::operator=
IterListItem & operator=(const IterListItem &other)
Definition: TreeIterator.h:242
openvdb::v7_1::logging::Level
Level
Message severity level.
Definition: logging.h:31
openvdb::v7_1::tree::TreeValueIteratorBase::isValueOn
bool isValueOn() const
Return true if the value to which this iterator is currently pointing is active.
Definition: TreeIterator.h:688
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::NCValueT
typename IterT::NonConstValueType NCValueT
The type of value (with const qualifiers removed) to which the iterator points.
Definition: TreeIterator.h:394
openvdb::v7_1::tree::NodeIteratorBase::NodeIteratorBase
NodeIteratorBase()
Definition: TreeIterator.h:1024
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ChildOnIter >::IterT
typename NodeT::ChildOnIter IterT
Definition: TreeIterator.h:67
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:146
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ValueOffIter >::IterT
typename NodeT::ValueOffIter IterT
Definition: TreeIterator.h:161
openvdb::v7_1::tree::IterListItem< PrevItem, InvTreeT, ROOT_LEVEL+1, LEAF_LEVEL >::PrevIterT
typename PrevItemT::IterT PrevIterT
The type of iterator stored in the previous list item.
Definition: TreeIterator.h:217
openvdb::v7_1::tree::IterListItem
An IterListItem is an element of a compile-time linked list of iterators to nodes of different types.
Definition: TreeIterator.h:214
openvdb::v7_1::tree::IterListItem< PrevItem, InvTreeT, ROOT_LEVEL+1, LEAF_LEVEL >::NCNodeT
typename IterT::NonConstNodeType NCNodeT
The type of the node with const qualifiers removed ("Non-Const")
Definition: TreeIterator.h:227
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ChildOffIter >::begin
static IterT begin(NodeT &node)
Definition: TreeIterator.h:94
openvdb::v7_1::math::Coord::min
static Coord min()
Return the smallest possible coordinate.
Definition: Coord.h:44
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::getChildDim
Index getChildDim(Index lvl) const
Definition: TreeIterator.h:581
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::IterT
typename IterTraits< typename PrevIterT::NonConstNodeType, PrevIterT >::template NodeConverter< _NodeT >::Type IterT
The type of iterator stored in this list item (e.g., InternalNode::ValueOnCIter)
Definition: TreeIterator.h:387
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ChildOffCIter >::begin
static IterT begin(const NodeT &node)
Definition: TreeIterator.h:104
openvdb::v7_1::tree::IterListItem::setIter
void setIter(const OtherIterT &iter)
Definition: TreeIterator.h:256
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::test
bool test(Index lvl) const
Definition: TreeIterator.h:443
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::isValueOn
bool isValueOn(Index lvl) const
Definition: TreeIterator.h:463
openvdb::v7_1::tree::NodeIteratorBase::next
bool next()
Advance to the next tile or voxel value.
Definition: TreeIterator.h:1101
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::getValue
const NCValueT & getValue(Index lvl) const
Definition: TreeIterator.h:586
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ChildAllCIter >::NodeConverter::Type
typename OtherNodeT::ChildAllCIter Type
Definition: TreeIterator.h:134
openvdb::v7_1::tree::IterListItem::isValueOn
bool isValueOn(Index lvl) const
Return true if the iterator at level lvl of the tree points to an active value.
Definition: TreeIterator.h:324
openvdb::v7_1::tree::NodeIteratorBase::RootNodeT
typename RootIterT::NodeType RootNodeT
Definition: TreeIterator.h:940
openvdb::v7_1::tree::LeafIteratorBase::LeafIteratorBase
LeafIteratorBase(const LeafIteratorBase &other)
Definition: TreeIterator.h:1213
openvdb::v7_1::tree::IterListItem< PrevItem, InvTreeT, ROOT_LEVEL+1, LEAF_LEVEL >::ChildT
typename CopyConstness< NodeT, typename NodeT::ChildNodeType >::Type ChildT
NodeT's child node type, with the same constness (e.g., const InternalNode<...>)
Definition: TreeIterator.h:231
openvdb::v7_1::tree::IteratorRange::next
bool next()
Advance the iterator to the next item.
Definition: TreeIterator.h:1339
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::next
bool next(Index lvl)
Definition: TreeIterator.h:445
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::test
bool test(Index lvl) const
Definition: TreeIterator.h:565
openvdb::v7_1::math::CoordBBox::max
const Coord & max() const
Definition: Coord.h:322
openvdb::v7_1::tree::TreeValueIteratorBase::modifyValue
void modifyValue(const ModifyOp &op) const
Apply a functor to the item to which this iterator is pointing. (Not valid for const iterators....
Definition: TreeIterator.h:712
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::getChildDim
Index getChildDim(Index lvl) const
Definition: TreeIterator.h:453
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ChildAllCIter >::getChild
static ChildT * getChild(const IterT &iter)
Definition: TreeIterator.h:129
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ChildOnCIter >::begin
static IterT begin(const NodeT &node)
Definition: TreeIterator.h:81
openvdb::v7_1::tree::TreeValueIteratorBase::getMinDepth
Index getMinDepth() const
Return the depth of the highest level of the tree to which this iterator ascends.
Definition: TreeIterator.h:636
openvdb::v7_1::math::CoordBBox::min
const Coord & min() const
Definition: Coord.h:321
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::down
bool down(Index lvl)
Definition: TreeIterator.h:569
openvdb::v7_1::CopyConstness::Type
typename std::remove_const< ToType >::type Type
Definition: Types.h:298
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::getNode
void getNode(Index lvl, NodeT *&node) const
Definition: TreeIterator.h:548
openvdb::v7_1::tree::TreeValueIteratorBase::TreeT
_TreeT TreeT
Definition: TreeIterator.h:619
openvdb::v7_1::tree::IterListItem< PrevItem, InvTreeT, ROOT_LEVEL+1, LEAF_LEVEL >::NCValueT
typename IterT::NonConstValueType NCValueT
The type of value (with const qualifiers removed) to which the iterator points.
Definition: TreeIterator.h:229
openvdb::v7_1::tree::iter::InvertedTree
Definition: TreeIterator.h:32
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::getValue
const NCValueT & getValue(Index lvl) const
Definition: TreeIterator.h:468
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::next
bool next(Index lvl)
Definition: TreeIterator.h:567
openvdb::v7_1::tree::NodeIteratorBase::operator=
NodeIteratorBase & operator=(const NodeIteratorBase &other)
Definition: TreeIterator.h:1065
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::IterListItem
IterListItem(const IterListItem &other)
Definition: TreeIterator.h:401
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::setValueOn
void setValueOn(Index lvl, bool on=true) const
Definition: TreeIterator.h:594
openvdb::v7_1::tree::NodeIteratorBase::NCRootNodeT
typename RootIterT::NonConstNodeType NCRootNodeT
Definition: TreeIterator.h:941
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:94
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::setValue
void setValue(Index lvl, const NCValueT &val) const
Definition: TreeIterator.h:593
openvdb::v7_1::tree::NodeIteratorBase::getDepth
Index getDepth() const
Return the depth in the tree (0 = root) of the node to which this iterator is currently pointing.
Definition: TreeIterator.h:983
openvdb::v7_1::tree::IteratorRange::IteratorRange
IteratorRange(const IterT &iter, size_t grainSize=8)
Definition: TreeIterator.h:1305
openvdb::v7_1::tree::IteratorRange::empty
bool empty() const
Definition: TreeIterator.h:1325
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ChildAllIter >::begin
static IterT begin(NodeT &node)
Definition: TreeIterator.h:114
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ValueOnIter >::NodeConverter::Type
typename OtherNodeT::ValueOnIter Type
Definition: TreeIterator.h:144
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::getVoxelCount
Index64 getVoxelCount(Index lvl) const
Definition: TreeIterator.h:458
openvdb::v7_1::tree::LeafIteratorBase::operator*
LeafNodeT & operator*() const
Definition: TreeIterator.h:1235
openvdb::v7_1::tree::TreeValueIteratorBase::getCoord
Coord getCoord() const
Return the global coordinates of the voxel or tile to which this iterator is currently pointing.
Definition: TreeIterator.h:671
openvdb::v7_1::tree::IterListItem::pos
Index pos(Index lvl) const
Return The table offset of the iterator at level lvl of the tree.
Definition: TreeIterator.h:286
openvdb::v7_1::tree::LeafIteratorBase::getLeaf
LeafNodeT * getLeaf() const
Return the leaf node to which the iterator is pointing.
Definition: TreeIterator.h:1229
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::setIter
void setIter(const IterT &iter)
Definition: TreeIterator.h:546
openvdb::v7_1::tree::IterListItem::getNode
void getNode(Index lvl, OtherNodeT *&node) const
Return the node over which one of the following list elements' iterator iterates.
Definition: TreeIterator.h:265
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::NCNodeT
typename IterT::NonConstNodeType NCNodeT
The type of the node with const qualifiers removed ("Non-Const")
Definition: TreeIterator.h:518
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::ChildT
typename CopyConstness< NodeT, typename NodeT::ChildNodeType >::Type ChildT
NodeT's child node type, with the same constness (e.g., const InternalNode<...>)
Definition: TreeIterator.h:522
openvdb::v7_1::tree::IterListItem::down
bool down(Index lvl)
If the iterator at level lvl of the tree points to a child node, initialize the next iterator in this...
Definition: TreeIterator.h:296
openvdb::v7_1::tree::TreeValueIteratorBase::ValueT
typename ValueIterT::NonConstValueType ValueT
Definition: TreeIterator.h:622
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::getNode
void getNode(Index lvl, NodeT *&node) const
Definition: TreeIterator.h:422
openvdb::v7_1::tree::TreeValueIteratorBase::setValue
void setValue(const ValueT &val) const
Change the tile or voxel value to which this iterator is currently pointing and mark it as active.
Definition: TreeIterator.h:699
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::initLevel
void initLevel(Index lvl, OtherIterListItemT &otherListItem)
Definition: TreeIterator.h:554
openvdb::v7_1::tree::NodeIteratorBase::getTree
TreeT * getTree() const
Definition: TreeIterator.h:1007
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ValueAllIter >::begin
static IterT begin(NodeT &node)
Definition: TreeIterator.h:182
openvdb::v7_1::tree::LeafIteratorBase::LeafIteratorBase
LeafIteratorBase(TreeT &tree)
Definition: TreeIterator.h:1202
openvdb::v7_1::tree::TreeValueIteratorBase::ChildOnIterT
typename NodeT::ChildOnCIter ChildOnIterT
Definition: TreeIterator.h:623
openvdb::v7_1::tree::NodeIteratorBase::getNode
void getNode(NodeT *&node) const
Return the node to which the iterator is pointing.
Definition: TreeIterator.h:1002
openvdb::v7_1::tree::TreeValueIteratorBase::getBoundingBox
CoordBBox getBoundingBox() const
Return the axis-aligned bounding box of the voxel or tile to which this iterator is currently pointin...
Definition: TreeIterator.h:678
openvdb
Definition: Exceptions.h:13
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::operator=
IterListItem & operator=(const IterListItem &other)
Definition: TreeIterator.h:403
openvdb::v7_1::tree::LeafIteratorBase::NCRootNodeT
typename RootIterT::NonConstNodeType NCRootNodeT
Definition: TreeIterator.h:1191
openvdb::v7_1::tree::IteratorRange::iterator
const IterT & iterator() const
Return a reference to this range's iterator.
Definition: TreeIterator.h:1323
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::pos
Index pos(Index lvl) const
Definition: TreeIterator.h:441
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::NodeT
typename IterT::NodeType NodeT
The type of node over which IterT iterates (e.g., const RootNode<...>)
Definition: TreeIterator.h:516
openvdb::v7_1::tree::IterListItem< PrevItem, InvTreeT, ROOT_LEVEL+1, LEAF_LEVEL >::NodeT
typename IterT::NodeType NodeT
The type of node (const or non-const) over which IterT iterates (e.g., const RootNode<....
Definition: TreeIterator.h:225
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, 1, _Level >::getCoord
Coord getCoord(Index lvl) const
Definition: TreeIterator.h:580
openvdb::v7_1::tree::IteratorRange
Definition: TreeIterator.h:1303
openvdb::v7_1::tree::IterListItem::getNode
void getNode(Index lvl, NodeT *&node) const
Return the node over which this list element's iterator iterates.
Definition: TreeIterator.h:259
openvdb::v7_1::tree::iter::InvertedTree::SubtreeT
typename InvertedTree< typename HeadT::ChildNodeType, HeadLevel-1 >::Type SubtreeT
Definition: TreeIterator.h:33
openvdb::v7_1::math::operator*
Mat3< typename promote< T0, T1 >::type > operator*(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Multiply m0 by m1 and return the resulting matrix.
Definition: Mat3.h:618
openvdb::v7_1::tree::TreeValueIteratorBase::getVoxelCount
Index64 getVoxelCount() const
Return the number of (virtual) voxels corresponding to the value.
Definition: TreeIterator.h:681
openvdb::v7_1::tree::TreeValueIteratorBase::getLeafDepth
static Index getLeafDepth()
Definition: TreeIterator.h:660
openvdb::v7_1::tree::NodeIteratorBase::summary
std::string summary() const
Definition: TreeIterator.h:1164
openvdb::v7_1::tree::IterTraits< NodeT, typename NodeT::ValueOnCIter >::begin
static IterT begin(const NodeT &node)
Definition: TreeIterator.h:152
openvdb::v7_1::tree::IterListItem< PrevItemT, NodeVecT, VecSize, 0U >::down
bool down(Index lvl)
Definition: TreeIterator.h:447