Go to the documentation of this file.
11 #ifndef OPENVDB_TOOLS_COUNT_HAS_BEEN_INCLUDED
12 #define OPENVDB_TOOLS_COUNT_HAS_BEEN_INCLUDED
14 #include <openvdb/version.h>
24 template <
typename TreeT>
30 template <
typename TreeT>
35 template <
typename TreeT>
42 namespace count_internal {
45 template<
typename TreeType>
48 using LeafT =
typename TreeType::LeafNodeType;
54 template<
typename NodeT>
57 for (
auto iter = node.cbeginValueOn(); iter; ++iter) {
58 count += NodeT::ChildNodeType::NUM_VOXELS;
66 count += leaf.onVoxelCount();
80 template<
typename TreeType>
83 using LeafT =
typename TreeType::LeafNodeType;
88 : mBBox(other.mBBox) { }
91 template<
typename NodeT>
94 if (!mBBox.hasOverlap(node.getNodeBoundingBox()))
return false;
97 for (
auto iter = node.cbeginValueOn(); iter; ++iter) {
98 CoordBBox bbox(CoordBBox::createCube(iter.getCoord(), NodeT::ChildNodeType::DIM));
105 count += mBBox.volume();
106 }
else if (mBBox.isInside(bbox)) {
117 for (
auto iter = node.cbeginChildOn(); iter; ++iter) {
118 if (mBBox.hasOverlap(iter->getNodeBoundingBox()))
return true;
130 CoordBBox bbox = leaf.getNodeBoundingBox();
132 if (mBBox.isInside(bbox)) {
134 count += leaf.onVoxelCount();
138 }
else if (leaf.isDense()) {
144 for (
auto i = leaf.cbeginValueOn(); i; ++i) {
145 if (mBBox.isInside(i.getCoord())) ++count;
153 count += other.
count;
162 template<
typename TreeType>
165 using RootT =
typename TreeType::RootNodeType;
166 using LeafT =
typename TreeType::LeafNodeType;
174 count +=
sizeof(root);
179 template<
typename NodeT>
182 count += NodeT::NUM_VALUES *
sizeof(
typename NodeT::UnionType) +
183 node.getChildMask().memUsage() + node.getValueMask().memUsage() +
191 count += leaf.memUsage();
197 count += other.
count;
209 template <
typename TreeT>
219 template <
typename TreeT>
232 template <
typename TreeT>
238 return op.
count +
sizeof(tree);
246 #endif // OPENVDB_TOOLS_COUNT_HAS_BEEN_INCLUDED
NodeManager produces linear arrays of all tree nodes allowing for efficient threading and bottom-up p...
bool hasOverlap(const CoordBBox &b) const
Return true if the given bounding box overlaps with this bounding box.
Definition: Coord.h:412
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:116
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:178
void reduceTopDown(NodeOp &op, bool threaded=true, size_t grainSize=1)
Threaded method that processes nodes with a user supplied functor.
Definition: NodeManager.h:1032
bool empty() const
Return true if this bounding box is empty (i.e., encloses no coordinates).
Definition: Coord.h:356
Definition: NodeManager.h:36
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:25
uint64_t Index64
Definition: openvdb/Types.h:49
bool isInside(const Coord &xyz) const
Return true if point (x, y, z) is inside this bounding box.
Definition: Coord.h:400
Index64 volume() const
Return the integer volume of coordinates spanned by this bounding box.
Definition: Coord.h:385
void intersect(const CoordBBox &bbox)
Intersect this bounding box with the given bounding box.
Definition: Coord.h:444
Definition: openvdb/Exceptions.h:13
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:248