41 #ifndef OPENVDB_TREE_NODEMANAGER_HAS_BEEN_INCLUDED 42 #define OPENVDB_TREE_NODEMANAGER_HAS_BEEN_INCLUDED 44 #include <tbb/parallel_for.h> 45 #include <tbb/parallel_reduce.h> 56 template<
typename TreeOrLeafManagerT, Index LEVELS = TreeOrLeafManagerT::RootNodeType::LEVEL>
66 template<
typename NodeT>
71 typedef std::deque<value_type>
ListT;
75 void push_back(NodeT* node) { mList.push_back(node); }
77 NodeT&
operator()(
size_t n)
const { assert(n<mList.size());
return *(mList[n]); }
79 NodeT*&
operator[](
size_t n) { assert(n<mList.size());
return mList[n]; }
85 void resize(
size_t n) { mList.resize(n); }
92 mEnd(end), mBegin(begin), mGrainSize(grainSize), mNodeList(nodeList) {}
95 mEnd(r.mEnd), mBegin(doSplit(r)), mGrainSize(r.mGrainSize),
96 mNodeList(r.mNodeList) {}
98 size_t size()
const {
return mEnd - mBegin; }
104 bool empty()
const {
return !(mBegin < mEnd);}
113 assert(this->isValid());
120 NodeT&
operator*()
const {
return mRange.mNodeList(mPos); }
124 size_t pos()
const {
return mPos; }
125 bool isValid()
const {
return mPos>=mRange.mBegin && mPos<=mRange.mEnd; }
127 bool test()
const {
return mPos < mRange.mEnd; }
129 operator bool()
const {
return this->test(); }
131 bool empty()
const {
return !this->test(); }
134 return (mPos != other.mPos) || (&mRange != &other.mRange);
149 size_t mEnd, mBegin, mGrainSize;
155 size_t middle = r.mBegin + (r.mEnd - r.mBegin) / 2u;
164 return NodeRange(0, this->nodeCount(), *
this, grainsize);
167 template<
typename NodeOp>
168 void foreach(
const NodeOp& op,
bool threaded =
true,
size_t grainSize=1)
170 NodeTransformer<NodeOp> transform(op);
171 transform.run(this->nodeRange(grainSize), threaded);
174 template<
typename NodeOp>
175 void reduce(NodeOp& op,
bool threaded =
true,
size_t grainSize=1)
177 NodeReducer<NodeOp> transform(op);
178 transform.run(this->nodeRange(grainSize), threaded);
184 template<
typename NodeOp>
185 struct NodeTransformer
187 NodeTransformer(
const NodeOp& nodeOp) : mNodeOp(nodeOp)
190 void run(
const NodeRange& range,
bool threaded =
true)
192 threaded ? tbb::parallel_for(range, *
this) : (*this)(range);
194 void operator()(
const NodeRange& range)
const 196 for (
typename NodeRange::Iterator it = range.begin(); it; ++it) mNodeOp(*it);
198 const NodeOp mNodeOp;
202 template<
typename NodeOp>
205 NodeReducer(NodeOp& nodeOp) : mNodeOp(&nodeOp), mOwnsOp(
false)
208 NodeReducer(
const NodeReducer& other, tbb::split) :
209 mNodeOp(
new NodeOp(*(other.mNodeOp), tbb::split())), mOwnsOp(
true)
212 ~NodeReducer() {
if (mOwnsOp)
delete mNodeOp; }
213 void run(
const NodeRange& range,
bool threaded =
true)
215 threaded ? tbb::parallel_reduce(range, *
this) : (*this)(range);
217 void operator()(
const NodeRange& range)
219 NodeOp &op = *mNodeOp;
220 for (
typename NodeRange::Iterator it = range.begin(); it; ++it) op(*it);
222 void join(
const NodeReducer& other)
224 mNodeOp->join(*(other.mNodeOp));
243 template<
typename NodeT, Index LEVEL>
251 void clear() { mList.clear(); mNext.clear(); }
253 template<
typename ParentT,
typename TreeOrLeafManagerT>
254 void init(ParentT& parent, TreeOrLeafManagerT& tree)
256 parent.getNodes(mList);
257 for (
size_t i=0, n=mList.nodeCount(); i<n; ++i) mNext.init(mList(i), tree);
260 template<
typename ParentT>
264 parent.getNodes(mList);
265 for (
size_t i=0, n=mList.nodeCount(); i<n; ++i) mNext.rebuild(mList(i));
272 return i==NodeT::LEVEL ? mList.nodeCount() : mNext.nodeCount(i);
275 template<
typename NodeOp>
278 mNext.foreachBottomUp(op, threaded, grainSize);
279 mList.foreach(op, threaded, grainSize);
282 template<
typename NodeOp>
285 mList.foreach(op, threaded, grainSize);
286 mNext.foreachTopDown(op, threaded, grainSize);
289 template<
typename NodeOp>
292 this->foreachBottomUp<NodeOp>(op, threaded, grainSize);
295 template<
typename NodeOp>
298 this->foreachTopDown<NodeOp>(op, threaded, grainSize);
301 template<
typename NodeOp>
304 mNext.reduceBottomUp(op, threaded, grainSize);
305 mList.reduce(op, threaded, grainSize);
308 template<
typename NodeOp>
311 mList.reduce(op, threaded, grainSize);
312 mNext.reduceTopDown(op, threaded, grainSize);
327 template<
typename NodeT>
338 template<
typename ParentT>
339 void rebuild(ParentT& parent) { mList.clear(); parent.getNodes(mList); }
345 template<
typename NodeOp>
348 mList.foreach(op, threaded, grainSize);
351 template<
typename NodeOp>
354 mList.foreach(op, threaded, grainSize);
357 template<
typename NodeOp>
360 this->foreachBottomUp<NodeOp>(op, threaded, grainSize);
363 template<
typename NodeOp>
366 this->foreachTopDown<NodeOp>(op, threaded, grainSize);
369 template<
typename NodeOp>
372 mList.reduce(op, threaded, grainSize);
375 template<
typename NodeOp>
378 mList.reduce(op, threaded, grainSize);
381 template<
typename ParentT,
typename TreeOrLeafManagerT>
382 void init(ParentT& parent, TreeOrLeafManagerT& tree)
385 if (TreeOrLeafManagerT::DEPTH == 2 && NodeT::LEVEL == 0) {
386 tree.getNodes(mList);
388 parent.getNodes(mList);
405 template<
typename TreeOrLeafManagerT, Index _LEVELS>
409 static const Index LEVELS = _LEVELS;
410 BOOST_STATIC_ASSERT(LEVELS > 0);
412 BOOST_STATIC_ASSERT(RootNodeType::LEVEL >= LEVELS);
414 NodeManager(TreeOrLeafManagerT& tree) : mRoot(tree.root()) { mChain.init(mRoot, tree); }
426 const RootNodeType&
root()
const {
return mRoot; }
436 template<
typename NodeOp>
494 mChain.foreachBottomUp(op, threaded, grainSize);
497 template<
typename NodeOp>
501 mChain.foreachTopDown(op, threaded, grainSize);
503 template<
typename NodeOp>
506 this->foreachBottomUp<NodeOp>(op, threaded, grainSize);
508 template<
typename NodeOp>
511 this->foreachTopDown<NodeOp>(op, threaded, grainSize);
516 template<
typename NodeOp>
576 mChain.reduceBottomUp(op, threaded, grainSize);
580 template<
typename NodeOp>
584 mChain.reduceTopDown(op, threaded, grainSize);
601 template<
typename TreeOrLeafManagerT>
620 const RootNodeType&
root()
const {
return mRoot; }
627 template<
typename NodeOp>
630 template<
typename NodeOp>
633 template<
typename NodeOp>
636 template<
typename NodeOp>
639 template<
typename NodeOp>
642 template<
typename NodeOp>
657 template<
typename TreeOrLeafManagerT>
662 BOOST_STATIC_ASSERT(RootNodeType::LEVEL > 0);
668 if (TreeOrLeafManagerT::DEPTH == 2 && NodeT0::LEVEL == 0) {
669 tree.getNodes(mList0);
671 mRoot.getNodes(mList0);
683 void rebuild() { mList0.clear(); mRoot.getNodes(mList0); }
686 const RootNodeType&
root()
const {
return mRoot; }
695 template<
typename NodeOp>
698 mList0.foreach(op, threaded, grainSize);
702 template<
typename NodeOp>
706 mList0.foreach(op, threaded, grainSize);
708 template<
typename NodeOp>
711 this->foreachBottomUp<NodeOp>(op, threaded, grainSize);
714 template<
typename NodeOp>
717 this->foreachTopDown<NodeOp>(op, threaded, grainSize);
720 template<
typename NodeOp>
723 mList0.reduce(op, threaded, grainSize);
727 template<
typename NodeOp>
731 mList0.reduce(op, threaded, grainSize);
736 typedef typename NodeT1::ChildNodeType
NodeT0;
751 template<
typename TreeOrLeafManagerT>
756 BOOST_STATIC_ASSERT(RootNodeType::LEVEL > 1);
761 mRoot.getNodes(mList1);
764 if (TreeOrLeafManagerT::DEPTH == 2 && NodeT0::LEVEL == 0) {
765 tree.getNodes(mList0);
767 for (
size_t i=0, n=mList1.nodeCount(); i<n; ++i) mList1(i).getNodes(mList0);
775 void clear() { mList0.clear(); mList1.clear(); }
782 mRoot.getNodes(mList1);
783 for (
size_t i=0, n=mList1.nodeCount(); i<n; ++i) mList1(i).getNodes(mList0);
787 const RootNodeType&
root()
const {
return mRoot; }
796 return i==0 ? mList0.nodeCount() : i==1 ? mList1.nodeCount() : 0;
799 template<
typename NodeOp>
802 mList0.foreach(op, threaded, grainSize);
803 mList1.foreach(op, threaded, grainSize);
807 template<
typename NodeOp>
811 mList1.foreach(op, threaded, grainSize);
812 mList0.foreach(op, threaded, grainSize);
815 template<
typename NodeOp>
818 this->foreachBottomUp<NodeOp>(op, threaded, grainSize);
821 template<
typename NodeOp>
824 this->foreachTopDown<NodeOp>(op, threaded, grainSize);
827 template<
typename NodeOp>
830 mList0.reduce(op, threaded, grainSize);
831 mList1.reduce(op, threaded, grainSize);
835 template<
typename NodeOp>
839 mList1.reduce(op, threaded, grainSize);
840 mList0.reduce(op, threaded, grainSize);
845 typedef typename NodeT2::ChildNodeType
NodeT1;
846 typedef typename NodeT1::ChildNodeType
NodeT0;
864 template<
typename TreeOrLeafManagerT>
869 BOOST_STATIC_ASSERT(RootNodeType::LEVEL > 2);
874 mRoot.getNodes(mList2);
875 for (
size_t i=0, n=mList2.nodeCount(); i<n; ++i) mList2(i).getNodes(mList1);
878 if (TreeOrLeafManagerT::DEPTH == 2 && NodeT0::LEVEL == 0) {
879 tree.getNodes(mList0);
881 for (
size_t i=0, n=mList1.nodeCount(); i<n; ++i) mList1(i).getNodes(mList0);
889 void clear() { mList0.clear(); mList1.clear(); mList2.clear(); }
896 mRoot.getNodes(mList2);
897 for (
size_t i=0, n=mList2.nodeCount(); i<n; ++i) mList2(i).getNodes(mList1);
898 for (
size_t i=0, n=mList1.nodeCount(); i<n; ++i) mList1(i).getNodes(mList0);
902 const RootNodeType&
root()
const {
return mRoot; }
905 Index64 nodeCount()
const {
return mList0.nodeCount()+mList1.nodeCount()+mList2.nodeCount(); }
911 return i==0 ? mList0.nodeCount() : i==1 ? mList1.nodeCount()
912 : i==2 ? mList2.nodeCount() : 0;
915 template<
typename NodeOp>
918 mList0.foreach(op, threaded, grainSize);
919 mList1.foreach(op, threaded, grainSize);
920 mList2.foreach(op, threaded, grainSize);
924 template<
typename NodeOp>
928 mList2.foreach(op, threaded, grainSize);
929 mList1.foreach(op, threaded, grainSize);
930 mList0.foreach(op, threaded, grainSize);
933 template<
typename NodeOp>
936 this->foreachBottomUp<NodeOp>(op, threaded, grainSize);
939 template<
typename NodeOp>
942 this->foreachTopDown<NodeOp>(op, threaded, grainSize);
945 template<
typename NodeOp>
948 mList0.reduce(op, threaded, grainSize);
949 mList1.reduce(op, threaded, grainSize);
950 mList2.reduce(op, threaded, grainSize);
954 template<
typename NodeOp>
958 mList2.reduce(op, threaded, grainSize);
959 mList1.reduce(op, threaded, grainSize);
960 mList0.reduce(op, threaded, grainSize);
965 typedef typename NodeT3::ChildNodeType
NodeT2;
966 typedef typename NodeT2::ChildNodeType
NodeT1;
967 typedef typename NodeT1::ChildNodeType
NodeT0;
987 template<
typename TreeOrLeafManagerT>
992 BOOST_STATIC_ASSERT(RootNodeType::LEVEL > 3);
997 mRoot.getNodes(mList3);
998 for (
size_t i=0, n=mList3.nodeCount(); i<n; ++i) mList3(i).getNodes(mList2);
999 for (
size_t i=0, n=mList2.nodeCount(); i<n; ++i) mList2(i).getNodes(mList1);
1002 if (TreeOrLeafManagerT::DEPTH == 2 && NodeT0::LEVEL == 0) {
1003 tree.getNodes(mList0);
1005 for (
size_t i=0, n=mList1.nodeCount(); i<n; ++i) mList1(i).getNodes(mList0);
1013 void clear() { mList0.clear(); mList1.clear(); mList2.clear(); mList3.clear; }
1020 mRoot.getNodes(mList3);
1021 for (
size_t i=0, n=mList3.nodeCount(); i<n; ++i) mList3(i).getNodes(mList2);
1022 for (
size_t i=0, n=mList2.nodeCount(); i<n; ++i) mList2(i).getNodes(mList1);
1023 for (
size_t i=0, n=mList1.nodeCount(); i<n; ++i) mList1(i).getNodes(mList0);
1027 const RootNodeType&
root()
const {
return mRoot; }
1032 return mList0.nodeCount() + mList1.nodeCount()
1033 + mList2.nodeCount() + mList3.nodeCount();
1040 return i==0 ? mList0.nodeCount() : i==1 ? mList1.nodeCount() :
1041 i==2 ? mList2.nodeCount() : i==3 ? mList3.nodeCount() : 0;
1044 template<
typename NodeOp>
1047 mList0.foreach(op, threaded, grainSize);
1048 mList1.foreach(op, threaded, grainSize);
1049 mList2.foreach(op, threaded, grainSize);
1050 mList3.foreach(op, threaded, grainSize);
1054 template<
typename NodeOp>
1058 mList3.foreach(op, threaded, grainSize);
1059 mList2.foreach(op, threaded, grainSize);
1060 mList1.foreach(op, threaded, grainSize);
1061 mList0.foreach(op, threaded, grainSize);
1064 template<
typename NodeOp>
1067 this->foreachBottomUp<NodeOp>(op, threaded, grainSize);
1070 template<
typename NodeOp>
1073 this->foreachTopDown<NodeOp>(op, threaded, grainSize);
1076 template<
typename NodeOp>
1079 mList0.reduce(op, threaded, grainSize);
1080 mList1.reduce(op, threaded, grainSize);
1081 mList2.reduce(op, threaded, grainSize);
1082 mList3.reduce(op, threaded, grainSize);
1086 template<
typename NodeOp>
1090 mList3.reduce(op, threaded, grainSize);
1091 mList2.reduce(op, threaded, grainSize);
1092 mList1.reduce(op, threaded, grainSize);
1093 mList0.reduce(op, threaded, grainSize);
1098 typedef typename NodeT4::ChildNodeType
NodeT3;
1099 typedef typename NodeT3::ChildNodeType
NodeT2;
1100 typedef typename NodeT2::ChildNodeType
NodeT1;
1101 typedef typename NodeT1::ChildNodeType
NodeT0;
1122 #endif // OPENVDB_TREE_NODEMANAGER_HAS_BEEN_INCLUDED RootNodeType NodeT4
Definition: NodeManager.h:1097
std::deque< value_type > ListT
Definition: NodeManager.h:71
void reduce(NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:175
TreeOrLeafManagerT::RootNodeType RootNodeType
Definition: NodeManager.h:991
bool empty() const
Return true if this iterator is exhausted.
Definition: NodeManager.h:131
void reduceTopDown(NodeOp &op, bool, size_t)
Definition: NodeManager.h:643
void foreachTopDown(const NodeOp &op, bool, size_t)
Definition: NodeManager.h:637
void rebuild(ParentT &parent)
Definition: NodeManager.h:339
void rebuild()
Clear and recache all the tree nodes from the tree. This is required if tree nodes have been added or...
Definition: NodeManager.h:779
OPENVDB_DEPRECATED void processTopDown(const NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:715
void foreachTopDown(const NodeOp &op, bool threaded, size_t grainSize)
Definition: NodeManager.h:283
OPENVDB_DEPRECATED void processTopDown(const NodeOp &op, bool threaded, size_t grainSize)
Definition: NodeManager.h:364
NodeList< NodeT0 > ListT0
Definition: NodeManager.h:737
bool empty() const
Definition: NodeManager.h:104
OPENVDB_DEPRECATED void processTopDown(const NodeOp &op, bool threaded, size_t grainSize)
Definition: NodeManager.h:296
NodeT *& operator[](size_t n)
Definition: NodeManager.h:79
Index64 nodeCount(Index i) const
Return the number of cached nodes at level i, where 0 corresponds to the lowest level.
Definition: NodeManager.h:794
void foreachBottomUp(const NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:696
ListT3 mList3
Definition: NodeManager.h:1109
TreeOrLeafManagerT::RootNodeType RootNodeType
Definition: NodeManager.h:868
void reduceBottomUp(NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:1077
NodeT & operator()(size_t n) const
Definition: NodeManager.h:77
OPENVDB_DEPRECATED void processTopDown(const NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:940
TreeOrLeafManagerT::RootNodeType RootNodeType
Definition: NodeManager.h:605
bool is_divisible() const
Definition: NodeManager.h:106
void reduceBottomUp(NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:946
Iterator begin() const
Definition: NodeManager.h:144
TreeOrLeafManagerT::RootNodeType RootNodeType
Definition: NodeManager.h:661
Mat3< typename promote< T0, T1 >::type > operator*(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Matrix multiplication.
Definition: Mat3.h:654
Definition: NodeManager.h:87
void foreachBottomUp(const NodeOp &op, bool threaded=true, size_t grainSize=1)
Threaded method that applies a user-supplied functor to all the nodes in the tree.
Definition: NodeManager.h:492
void foreachBottomUp(const NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:1045
void reduceBottomUp(NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:721
OPENVDB_DEPRECATED void processTopDown(const NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:822
OPENVDB_DEPRECATED void processTopDown(const NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:1071
NodeList< NodeT > mList
Definition: NodeManager.h:393
void clear()
Clear all the cached tree nodes.
Definition: NodeManager.h:679
NodeT4 & mRoot
Definition: NodeManager.h:1108
size_t size() const
Definition: NodeManager.h:98
Index64 nodeCount() const
Return the total number of cached nodes (excluding the root node)
Definition: NodeManager.h:1030
const NodeList & nodeList() const
Definition: NodeManager.h:102
void clear()
Clear all the cached tree nodes.
Definition: NodeManager.h:613
void foreachTopDown(const NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:925
RootNodeType NodeT3
Definition: NodeManager.h:964
void foreachBottomUp(const NodeOp &op, bool threaded, size_t grainSize)
Definition: NodeManager.h:276
Index64 nodeCount(Index i) const
Definition: NodeManager.h:270
void foreachBottomUp(const NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:916
ListT2 mList2
Definition: NodeManager.h:1110
void foreachTopDown(const NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:1055
NodeManagerLink< typename RootNodeType::ChildNodeType, LEVELS-1 > mChain
Definition: NodeManager.h:590
NodeManager(TreeOrLeafManagerT &tree)
Definition: NodeManager.h:414
ListT2 mList2
Definition: NodeManager.h:974
OPENVDB_DEPRECATED void processBottomUp(const NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:816
Index64 nodeCount() const
Return the total number of cached nodes (excluding the root node)
Definition: NodeManager.h:905
NodeT2::ChildNodeType NodeT1
Definition: NodeManager.h:845
void reduceTopDown(NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:728
void reduceBottomUp(NodeOp &op, bool, size_t)
Definition: NodeManager.h:640
ListT0 mList0
Definition: NodeManager.h:853
const RootNodeType & root() const
Return a reference to the root node.
Definition: NodeManager.h:787
NodeList< NodeT > mList
Definition: NodeManager.h:316
NodeList< NodeT0 > ListT0
Definition: NodeManager.h:971
RootNodeType NodeT2
Definition: NodeManager.h:844
OPENVDB_DEPRECATED void processBottomUp(const NodeOp &op, bool threaded=true, size_t grainSize=1)
Threaded method that applies a user-supplied functor to all the nodes in the tree.
Definition: NodeManager.h:504
NodeList< NodeT0 > ListT0
Definition: NodeManager.h:849
NodeList< NodeT0 > ListT0
Definition: NodeManager.h:1106
RootNodeType NodeT1
Definition: NodeManager.h:735
Index64 nodeCount(Index i) const
Return the number of cached nodes at level i, where 0 corresponds to the lowest level.
Definition: NodeManager.h:1038
ListT1 mList1
Definition: NodeManager.h:852
void foreachTopDown(const NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:703
ListT0 mList0
Definition: NodeManager.h:976
Index64 nodeCount(Index i) const
Return the number of cached nodes at level i, where 0 corresponds to the lowest level.
Definition: NodeManager.h:433
This class caches tree nodes of a specific type in a linear array.
Definition: NodeManager.h:67
ListT0 mList0
Definition: NodeManager.h:1112
void clear()
Clear all the cached tree nodes.
Definition: NodeManager.h:419
OPENVDB_DEPRECATED void processBottomUp(const NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:709
#define OPENVDB_VERSION_NAME
Definition: version.h:43
Index64 nodeCount(Index i) const
Return the number of cached nodes at level i, where 0 corresponds to the lowest level.
Definition: NodeManager.h:909
bool operator==(const Iterator &other) const
Definition: NodeManager.h:136
void rebuild()
Clear and recache all the tree nodes from the tree. This is required if tree nodes have been added or...
Definition: NodeManager.h:683
NodeRange(NodeRange &r, tbb::split)
Definition: NodeManager.h:94
size_t pos() const
Return the index into the list of the current node.
Definition: NodeManager.h:124
Index64 nodeCount() const
Definition: NodeManager.h:268
void foreachBottomUp(const NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:800
const RootNodeType & root() const
Return a reference to the root node.
Definition: NodeManager.h:620
void rebuild()
Clear and recache all the tree nodes from the tree. This is required if tree nodes have been added or...
Definition: NodeManager.h:617
NodeRange(size_t begin, size_t end, const NodeList &nodeList, size_t grainSize=1)
Definition: NodeManager.h:91
Definition: NodeManager.h:108
NodeT3::ChildNodeType NodeT2
Definition: NodeManager.h:1099
const RootNodeType & root() const
Return a reference to the root node.
Definition: NodeManager.h:686
void foreachBottomUp(const NodeOp &op, bool, size_t)
Definition: NodeManager.h:634
Index64 nodeCount() const
Return the total number of cached nodes (excluding the root node)
Definition: NodeManager.h:790
OPENVDB_DEPRECATED void processTopDown(const NodeOp &op, bool threaded=true, size_t grainSize=1)
Threaded method that applies a user-supplied functor to all the nodes in the tree.
Definition: NodeManager.h:509
size_t grainsize() const
Definition: NodeManager.h:100
NodeRange nodeRange(size_t grainsize=1) const
Return a TBB-compatible NodeRange.
Definition: NodeManager.h:162
Index64 nodeCount() const
Definition: NodeManager.h:81
Index64 nodeCount() const
Return the total number of cached nodes (excluding the root node)
Definition: NodeManager.h:623
const NodeRange & nodeRange() const
Definition: NodeManager.h:137
void clear()
Clear all the cached tree nodes.
Definition: NodeManager.h:1013
NodeT3 & mRoot
Definition: NodeManager.h:973
virtual ~NodeManagerLink()
Definition: NodeManager.h:333
Definition: Exceptions.h:39
Index64 nodeCount() const
Return the total number of cached nodes (excluding the root node)
Definition: NodeManager.h:689
OPENVDB_DEPRECATED void processBottomUp(const NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:1065
NodeT3::ChildNodeType NodeT2
Definition: NodeManager.h:965
void clear()
Clear all the cached tree nodes.
Definition: NodeManager.h:889
void init(ParentT &parent, TreeOrLeafManagerT &tree)
Definition: NodeManager.h:382
void clear()
Clear all the cached tree nodes.
Definition: NodeManager.h:336
OPENVDB_DEPRECATED void processBottomUp(const NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:934
NodeT * value_type
Definition: NodeManager.h:70
NodeT4::ChildNodeType NodeT3
Definition: NodeManager.h:1098
void reduceTopDown(NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:1087
NodeManager(TreeOrLeafManagerT &tree)
Definition: NodeManager.h:872
NodeT1::ChildNodeType NodeT0
Definition: NodeManager.h:846
void foreachTopDown(const NodeOp &op, bool threaded=true, size_t grainSize=1)
Threaded method that applies a user-supplied functor to all the nodes in the tree.
Definition: NodeManager.h:498
void reduceTopDown(NodeOp &op, bool threaded=true, size_t grainSize=1)
Threaded method that processes nodes with a user supplied functor.
Definition: NodeManager.h:581
void clear()
Clear all the cached tree nodes.
Definition: NodeManager.h:775
virtual ~NodeManagerLink()
Definition: NodeManager.h:249
NodeManagerLink()
Definition: NodeManager.h:247
virtual ~NodeManager()
Definition: NodeManager.h:610
NodeManagerLink()
Definition: NodeManager.h:331
void reduceTopDown(NodeOp &op, bool threaded, size_t grainSize)
Definition: NodeManager.h:309
RootNodeType & mRoot
Definition: NodeManager.h:589
void reduceBottomUp(NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:828
void reduceTopDown(NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:955
void reduceBottomUp(NodeOp &op, bool threaded, size_t grainSize)
Definition: NodeManager.h:302
virtual ~NodeManager()
Definition: NodeManager.h:676
NodeManager(TreeOrLeafManagerT &tree)
Definition: NodeManager.h:995
NodeList()
Definition: NodeManager.h:73
const RootNodeType & root() const
Return a reference to the root node.
Definition: NodeManager.h:426
void reduceTopDown(NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:836
Index64 nodeCount() const
Return the total number of cached nodes (excluding the root node)
Definition: NodeManager.h:429
Index64 nodeCount(Index i) const
Return the number of cached nodes at level i, where 0 corresponds to the lowest level.
Definition: NodeManager.h:693
bool test() const
Return true if this iterator is not yet exhausted.
Definition: NodeManager.h:127
bool operator!=(const Iterator &other) const
Definition: NodeManager.h:132
void rebuild()
Clear and recache all the tree nodes from the tree. This is required if tree nodes have been added or...
Definition: NodeManager.h:893
uint64_t Index64
Definition: Types.h:56
void foreachTopDown(const NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition: NodeManager.h:808
NodeT2 & mRoot
Definition: NodeManager.h:851
void reduceTopDown(NodeOp &op, bool threaded, size_t grainSize)
Definition: NodeManager.h:376
Index64 nodeCount() const
Definition: NodeManager.h:341
ListT1 mList1
Definition: NodeManager.h:975
To facilitate threading over the nodes of a tree, cache node pointers in linear arrays, one for each level of the tree.
Definition: NodeManager.h:57
void clear()
Definition: NodeManager.h:251
void init(ParentT &parent, TreeOrLeafManagerT &tree)
Definition: NodeManager.h:254
ListT0 mList0
Definition: NodeManager.h:740
Iterator & operator++()
Advance to the next node.
Definition: NodeManager.h:118
virtual ~NodeManager()
Definition: NodeManager.h:1010
NodeManager(TreeOrLeafManagerT &tree)
Definition: NodeManager.h:665
void foreachTopDown(const NodeOp &op, bool threaded, size_t grainSize)
Definition: NodeManager.h:352
OPENVDB_DEPRECATED void processBottomUp(const NodeOp &op, bool, size_t)
Definition: NodeManager.h:628
ListT1 mList1
Definition: NodeManager.h:1111
TreeOrLeafManagerT::RootNodeType RootNodeType
Definition: NodeManager.h:755
NodeManagerLink< typename NodeT::ChildNodeType, LEVEL-1 > mNext
Definition: NodeManager.h:317
const RootNodeType & root() const
Return a reference to the root node.
Definition: NodeManager.h:1027
ListT mList
Definition: NodeManager.h:232
NodeManager(TreeOrLeafManagerT &tree)
Definition: NodeManager.h:608
NodeT2::ChildNodeType NodeT1
Definition: NodeManager.h:966
void rebuild()
Clear and recache all the tree nodes from the tree. This is required if tree nodes have been added or...
Definition: NodeManager.h:1017
void rebuild()
Clear and recache all the tree nodes from the tree. This is required if tree nodes have been added or...
Definition: NodeManager.h:423
OPENVDB_DEPRECATED void processTopDown(const NodeOp &op, bool, size_t)
Definition: NodeManager.h:631
bool isValid() const
Definition: NodeManager.h:125
virtual ~NodeManager()
Definition: NodeManager.h:886
NodeList< NodeT2 > ListT2
Definition: NodeManager.h:969
NodeT & operator*() const
Return a reference to the node to which this iterator is pointing.
Definition: NodeManager.h:120
virtual ~NodeManager()
Definition: NodeManager.h:772
const RootNodeType & root() const
Return a reference to the root node.
Definition: NodeManager.h:902
TreeOrLeafManagerT::RootNodeType RootNodeType
Definition: NodeManager.h:411
NodeManager(TreeOrLeafManagerT &tree)
Definition: NodeManager.h:759
Iterator end() const
Definition: NodeManager.h:146
NodeT2::ChildNodeType NodeT1
Definition: NodeManager.h:1100
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:71
void reduceBottomUp(NodeOp &op, bool threaded, size_t grainSize)
Definition: NodeManager.h:370
NodeList< NodeT2 > ListT2
Definition: NodeManager.h:1104
void rebuild(ParentT &parent)
Definition: NodeManager.h:261
OPENVDB_DEPRECATED void processBottomUp(const NodeOp &op, bool threaded, size_t grainSize)
Definition: NodeManager.h:290
NodeList< NodeT3 > ListT3
Definition: NodeManager.h:1103
Index32 Index
Definition: Types.h:57
Index64 nodeCount(Index) const
Definition: NodeManager.h:343
NodeList< NodeT1 > ListT1
Definition: NodeManager.h:1105
void reduceBottomUp(NodeOp &op, bool threaded=true, size_t grainSize=1)
Threaded method that processes nodes with a user supplied functor.
Definition: NodeManager.h:574
NodeT1::ChildNodeType NodeT0
Definition: NodeManager.h:736
void foreachBottomUp(const NodeOp &op, bool threaded, size_t grainSize)
Definition: NodeManager.h:346
RootNodeType & mRoot
Definition: NodeManager.h:646
virtual ~NodeManager()
Definition: NodeManager.h:416
void clear()
Definition: NodeManager.h:83
NodeList< NodeT1 > ListT1
Definition: NodeManager.h:970
void resize(size_t n)
Definition: NodeManager.h:85
NodeT1::ChildNodeType NodeT0
Definition: NodeManager.h:967
OPENVDB_DEPRECATED void processBottomUp(const NodeOp &op, bool threaded, size_t grainSize)
Definition: NodeManager.h:358
Iterator(const NodeRange &range, size_t pos)
Definition: NodeManager.h:111
NodeT1 & mRoot
Definition: NodeManager.h:739
NodeT * operator->() const
Return a pointer to the node to which this iterator is pointing.
Definition: NodeManager.h:122
Index64 nodeCount(Index) const
Definition: NodeManager.h:625
This class is a link in a chain that each caches tree nodes of a specific type in a linear array...
Definition: NodeManager.h:244
void push_back(NodeT *node)
Definition: NodeManager.h:75
NodeT1::ChildNodeType NodeT0
Definition: NodeManager.h:1101
NodeList< NodeT1 > ListT1
Definition: NodeManager.h:848