diff --git a/openvdb/openvdb/io/Archive.cc b/openvdb/openvdb/io/Archive.cc index 39e79c86ca..8f99565f20 100644 --- a/openvdb/openvdb/io/Archive.cc +++ b/openvdb/openvdb/io/Archive.cc @@ -357,10 +357,10 @@ struct PopulateDelayedLoadMetadataOp using MaskT = typename LeafT::NodeMaskType; const TreeT& tree = grid.constTree(); - const Index32 leafCount = tree.leafCount(); + const Index64 leafCount = tree.leafCount(); // early exit if not leaf nodes - if (leafCount == Index32(0)) return; + if (leafCount == Index64(0)) return; metadata.resizeMask(leafCount); diff --git a/openvdb/openvdb/points/IndexFilter.h b/openvdb/openvdb/points/IndexFilter.h index 28e2dc9c47..9f0e57d708 100644 --- a/openvdb/openvdb/points/IndexFilter.h +++ b/openvdb/openvdb/points/IndexFilter.h @@ -245,7 +245,7 @@ class RandomLeafFilter std::mt19937 generator(seed); std::uniform_int_distribution dist(0, std::numeric_limits::max() - 1); - Index32 leafCounter = 0; + Index64 leafCounter = 0; float totalPointsFloat = 0.0f; int totalPoints = 0; for (auto iter = tree.cbeginLeaf(); iter; ++iter) { diff --git a/openvdb/openvdb/python/pyGrid.h b/openvdb/openvdb/python/pyGrid.h index c7d9b2d205..a8948064a6 100644 --- a/openvdb/openvdb/python/pyGrid.h +++ b/openvdb/openvdb/python/pyGrid.h @@ -210,7 +210,7 @@ getNodeLog2Dims(const GridType& grid) template -inline Index +inline Index64 treeDepth(const GridType& grid) { return grid.tree().treeDepth(); @@ -218,7 +218,7 @@ treeDepth(const GridType& grid) template -inline Index32 +inline Index64 leafCount(const GridType& grid) { return grid.tree().leafCount(); @@ -226,7 +226,7 @@ leafCount(const GridType& grid) template -inline Index32 +inline Index64 nonLeafCount(const GridType& grid) { return grid.tree().nonLeafCount(); diff --git a/openvdb/openvdb/tree/InternalNode.h b/openvdb/openvdb/tree/InternalNode.h index 59fe1ed9ba..534fc9553d 100644 --- a/openvdb/openvdb/tree/InternalNode.h +++ b/openvdb/openvdb/tree/InternalNode.h @@ -274,9 +274,11 @@ class InternalNode /// Set the transient data value. void setTransientData(Index32 transientData) { mTransientData = transientData; } - Index32 leafCount() const; + Index64 leafCount() const; + Index64 nonLeafCount() const; + void nodeCount(std::vector &vec) const; + OPENVDB_DEPRECATED_MESSAGE("Use input type std::vector for nodeCount.") void nodeCount(std::vector &vec) const; - Index32 nonLeafCount() const; Index32 childCount() const; Index64 onVoxelCount() const; Index64 offVoxelCount() const; @@ -1102,11 +1104,11 @@ InternalNode::~InternalNode() template -inline Index32 +inline Index64 InternalNode::leafCount() const { if (ChildNodeType::getLevel() == 0) return mChildMask.countOn(); - Index32 sum = 0; + Index64 sum = 0; for (ChildOnCIter iter = this->cbeginChildOn(); iter; ++iter) { sum += iter->leafCount(); } @@ -1115,7 +1117,7 @@ InternalNode::leafCount() const template inline void -InternalNode::nodeCount(std::vector &vec) const +InternalNode::nodeCount(std::vector &vec) const { OPENVDB_ASSERT(vec.size() > ChildNodeType::LEVEL); const auto count = mChildMask.countOn(); @@ -1125,12 +1127,28 @@ InternalNode::nodeCount(std::vector &vec) const vec[ChildNodeType::LEVEL] += count; } +template +inline void +InternalNode::nodeCount(std::vector &vec) const +{ + OPENVDB_ASSERT(vec.size() > ChildNodeType::LEVEL); + const auto count = mChildMask.countOn(); + if (ChildNodeType::LEVEL > 0 && count > 0) { + for (auto iter = this->cbeginChildOn(); iter; ++iter) { + OPENVDB_NO_DEPRECATION_WARNING_BEGIN + iter->nodeCount(vec); + OPENVDB_NO_DEPRECATION_WARNING_END + } + } + vec[ChildNodeType::LEVEL] += count; +} + template -inline Index32 +inline Index64 InternalNode::nonLeafCount() const { - Index32 sum = 1; + Index64 sum = 1; if (ChildNodeType::getLevel() == 0) return sum; for (ChildOnCIter iter = this->cbeginChildOn(); iter; ++iter) { sum += iter->nonLeafCount(); diff --git a/openvdb/openvdb/tree/LeafManager.h b/openvdb/openvdb/tree/LeafManager.h index 05667c6b02..e8d427d025 100644 --- a/openvdb/openvdb/tree/LeafManager.h +++ b/openvdb/openvdb/tree/LeafManager.h @@ -596,7 +596,7 @@ class LeafManager // Compute the leaf counts for each node - std::vector leafCounts; + std::vector leafCounts; if (serial) { leafCounts.reserve(leafParents.size()); for (LeafParentT* leafParent : leafParents) { diff --git a/openvdb/openvdb/tree/LeafNode.h b/openvdb/openvdb/tree/LeafNode.h index 41a33470fa..c47bac7ed6 100644 --- a/openvdb/openvdb/tree/LeafNode.h +++ b/openvdb/openvdb/tree/LeafNode.h @@ -129,11 +129,13 @@ class LeafNode /// Return the dimension of child nodes of this LeafNode, which is one for voxels. static Index getChildDim() { return 1; } /// Return the leaf count for this node, which is one. - static Index32 leafCount() { return 1; } + static Index64 leafCount() { return 1; } /// no-op + void nodeCount(std::vector &) const {} + OPENVDB_DEPRECATED_MESSAGE("Use input type std::vector for nodeCount.") void nodeCount(std::vector &) const {} /// Return the non-leaf count for this node, which is zero. - static Index32 nonLeafCount() { return 0; } + static Index64 nonLeafCount() { return 0; } /// Return the child count for this node, which is zero. static Index32 childCount() { return 0; } diff --git a/openvdb/openvdb/tree/LeafNodeBool.h b/openvdb/openvdb/tree/LeafNodeBool.h index 1e06abd54c..15145ae874 100644 --- a/openvdb/openvdb/tree/LeafNodeBool.h +++ b/openvdb/openvdb/tree/LeafNodeBool.h @@ -131,10 +131,12 @@ class LeafNode static void getNodeLog2Dims(std::vector& dims) { dims.push_back(Log2Dim); } static Index getChildDim() { return 1; } - static Index32 leafCount() { return 1; } + static Index64 leafCount() { return 1; } /// no-op + void nodeCount(std::vector &) const {} + OPENVDB_DEPRECATED_MESSAGE("Use input type std::vector for nodeCount.") void nodeCount(std::vector &) const {} - static Index32 nonLeafCount() { return 0; } + static Index64 nonLeafCount() { return 0; } /// Return the number of active voxels. Index64 onVoxelCount() const { return mValueMask.countOn(); } diff --git a/openvdb/openvdb/tree/LeafNodeMask.h b/openvdb/openvdb/tree/LeafNodeMask.h index 8ff37310b7..b861685f5b 100644 --- a/openvdb/openvdb/tree/LeafNodeMask.h +++ b/openvdb/openvdb/tree/LeafNodeMask.h @@ -112,11 +112,13 @@ class LeafNode /// Return the dimension of child nodes of this LeafNode, which is one for voxels. static Index getChildDim() { return 1; } /// Return the leaf count for this node, which is one. - static Index32 leafCount() { return 1; } + static Index64 leafCount() { return 1; } /// no-op + void nodeCount(std::vector &) const {} + OPENVDB_DEPRECATED_MESSAGE("Use input type std::vector for nodeCount.") void nodeCount(std::vector &) const {} /// Return the non-leaf count for this node, which is zero. - static Index32 nonLeafCount() { return 0; } + static Index64 nonLeafCount() { return 0; } /// Return the number of active voxels. Index64 onVoxelCount() const { return mBuffer.mData.countOn(); } diff --git a/openvdb/openvdb/tree/NodeManager.h b/openvdb/openvdb/tree/NodeManager.h index 850589e231..27a3f82012 100644 --- a/openvdb/openvdb/tree/NodeManager.h +++ b/openvdb/openvdb/tree/NodeManager.h @@ -107,7 +107,7 @@ class NodeList { // Compute the node counts for each node - std::vector nodeCounts; + std::vector nodeCounts; if (serial) { nodeCounts.reserve(parents.nodeCount()); for (size_t i = 0; i < parents.nodeCount(); i++) { diff --git a/openvdb/openvdb/tree/RootNode.h b/openvdb/openvdb/tree/RootNode.h index f135db1bb8..88a9dfa6f8 100644 --- a/openvdb/openvdb/tree/RootNode.h +++ b/openvdb/openvdb/tree/RootNode.h @@ -484,8 +484,8 @@ class RootNode template static bool hasCompatibleValueType(const RootNode& other); - Index32 leafCount() const; - Index32 nonLeafCount() const; + Index64 leafCount() const; + Index64 nonLeafCount() const; Index32 childCount() const; Index32 tileCount() const; Index32 activeTileCount() const; @@ -495,6 +495,8 @@ class RootNode Index64 onLeafVoxelCount() const; Index64 offLeafVoxelCount() const; Index64 onTileCount() const; + void nodeCount(std::vector &vec) const; + OPENVDB_DEPRECATED_MESSAGE("Use input type std::vector for nodeCount.") void nodeCount(std::vector &vec) const; bool isValueOn(const Coord& xyz) const; @@ -1539,10 +1541,10 @@ RootNode::evalActiveBoundingBox(CoordBBox& bbox, bool visitVoxels) const template -inline Index32 +inline Index64 RootNode::leafCount() const { - Index32 sum = 0; + Index64 sum = 0; for (MapCIter i = mTable.begin(), e = mTable.end(); i != e; ++i) { if (isChild(i)) sum += getChild(i).leafCount(); } @@ -1551,10 +1553,10 @@ RootNode::leafCount() const template -inline Index32 +inline Index64 RootNode::nonLeafCount() const { - Index32 sum = 1; + Index64 sum = 1; if (ChildT::LEVEL != 0) { for (MapCIter i = mTable.begin(), e = mTable.end(); i != e; ++i) { if (isChild(i)) sum += getChild(i).nonLeafCount(); @@ -1682,6 +1684,22 @@ RootNode::onTileCount() const return sum; } +template +inline void +RootNode::nodeCount(std::vector &vec) const +{ + OPENVDB_ASSERT(vec.size() > LEVEL); + Index64 sum = 0; + for (MapCIter i = mTable.begin(), e = mTable.end(); i != e; ++i) { + if (isChild(i)) { + ++sum; + getChild(i).nodeCount(vec); + } + } + vec[LEVEL] = 1;// one root node + vec[ChildNodeType::LEVEL] = sum; +} + template inline void RootNode::nodeCount(std::vector &vec) const @@ -1691,7 +1709,9 @@ RootNode::nodeCount(std::vector &vec) const for (MapCIter i = mTable.begin(), e = mTable.end(); i != e; ++i) { if (isChild(i)) { ++sum; + OPENVDB_NO_DEPRECATION_WARNING_BEGIN getChild(i).nodeCount(vec); + OPENVDB_NO_DEPRECATION_WARNING_END } } vec[LEVEL] = 1;// one root node diff --git a/openvdb/openvdb/tree/Tree.h b/openvdb/openvdb/tree/Tree.h index 06f8278827..9db13edcc2 100644 --- a/openvdb/openvdb/tree/Tree.h +++ b/openvdb/openvdb/tree/Tree.h @@ -102,7 +102,11 @@ class OPENVDB_API TreeBase /// @sa readNonresidentBuffers, io::File::open virtual void clipUnallocatedNodes() = 0; /// Return the total number of unallocated leaf nodes residing in this tree. +#if OPENVDB_ABI_VERSION_NUMBER >= 12 + virtual Index64 unallocatedLeafCount() const = 0; +#else virtual Index32 unallocatedLeafCount() const = 0; +#endif // @@ -113,13 +117,25 @@ class OPENVDB_API TreeBase /// A tree with only a root node and leaf nodes has depth 2, for example. virtual Index treeDepth() const = 0; /// Return the number of leaf nodes. +#if OPENVDB_ABI_VERSION_NUMBER >= 12 + virtual Index64 leafCount() const = 0; +#else virtual Index32 leafCount() const = 0; +#endif /// Return a vector with node counts. The number of nodes of type NodeType /// is given as element NodeType::LEVEL in the return vector. Thus, the size /// of this vector corresponds to the height (or depth) of this tree. +#if OPENVDB_ABI_VERSION_NUMBER >= 12 + virtual std::vector nodeCount() const = 0; +#else virtual std::vector nodeCount() const = 0; +#endif /// Return the number of non-leaf nodes. +#if OPENVDB_ABI_VERSION_NUMBER >= 12 + virtual Index64 nonLeafCount() const = 0; +#else virtual Index32 nonLeafCount() const = 0; +#endif /// Return the number of active voxels stored in leaf nodes. virtual Index64 activeLeafVoxelCount() const = 0; /// Return the number of inactive voxels stored in leaf nodes. @@ -343,18 +359,37 @@ class Tree: public TreeBase /// A tree with only a root node and leaf nodes has depth 2, for example. Index treeDepth() const override { return DEPTH; } /// Return the number of leaf nodes. - Index32 leafCount() const override { return mRoot.leafCount(); } +#if OPENVDB_ABI_VERSION_NUMBER >= 12 + Index64 leafCount() const override { return mRoot.leafCount(); } +#else + Index32 leafCount() const override { return static_cast(mRoot.leafCount()); } +#endif /// Return a vector with node counts. The number of nodes of type NodeType /// is given as element NodeType::LEVEL in the return vector. Thus, the size /// of this vector corresponds to the height (or depth) of this tree. +#if OPENVDB_ABI_VERSION_NUMBER >= 12 + std::vector nodeCount() const override + { + std::vector vec(DEPTH, 0); + mRoot.nodeCount( vec ); + return vec;// Named Return Value Optimization + } +#else std::vector nodeCount() const override { std::vector vec(DEPTH, 0); + OPENVDB_NO_DEPRECATION_WARNING_BEGIN mRoot.nodeCount( vec ); + OPENVDB_NO_DEPRECATION_WARNING_END return vec;// Named Return Value Optimization } +#endif /// Return the number of non-leaf nodes. - Index32 nonLeafCount() const override { return mRoot.nonLeafCount(); } +#if OPENVDB_ABI_VERSION_NUMBER >= 12 + Index64 nonLeafCount() const override { return mRoot.nonLeafCount(); } +#else + Index32 nonLeafCount() const override { return static_cast(mRoot.nonLeafCount()); } +#endif /// Return the number of active voxels stored in leaf nodes. Index64 activeLeafVoxelCount() const override { return tools::countActiveLeafVoxels(*this); } /// Return the number of inactive voxels stored in leaf nodes. @@ -469,7 +504,11 @@ class Tree: public TreeBase void clipUnallocatedNodes() override; /// Return the total number of unallocated leaf nodes residing in this tree. +#if OPENVDB_ABI_VERSION_NUMBER >= 12 + Index64 unallocatedLeafCount() const override; +#else Index32 unallocatedLeafCount() const override; +#endif //@{ /// @brief Set all voxels within a given axis-aligned box to a constant value. @@ -1673,6 +1712,16 @@ Tree::clipUnallocatedNodes() } } +#if OPENVDB_ABI_VERSION_NUMBER >= 12 +template +inline Index64 +Tree::unallocatedLeafCount() const +{ + Index64 sum = 0; + for (auto it = this->cbeginLeaf(); it; ++it) if (!it->isAllocated()) ++sum; + return sum; +} +#else template inline Index32 Tree::unallocatedLeafCount() const @@ -1681,6 +1730,7 @@ Tree::unallocatedLeafCount() const for (auto it = this->cbeginLeaf(); it; ++it) if (!it->isAllocated()) ++sum; return sum; } +#endif template @@ -2036,7 +2086,7 @@ Tree::print(std::ostream& os, int verboseLevel) const } const auto nodeCount = this->nodeCount();//fast - const Index32 leafCount = nodeCount.front();// leaf is the first element + const Index64 leafCount = nodeCount.front();// leaf is the first element OPENVDB_ASSERT(dims.size() == nodeCount.size()); Index64 totalNodeCount = 0; diff --git a/openvdb/openvdb/unittest/TestFile.cc b/openvdb/openvdb/unittest/TestFile.cc index c5d4d85d9a..dd344cb515 100644 --- a/openvdb/openvdb/unittest/TestFile.cc +++ b/openvdb/openvdb/unittest/TestFile.cc @@ -1866,7 +1866,7 @@ TEST_F(TestFile, testMultiPassIO) file.open(); const auto newGrid = GridBase::grid( file.readGrid("test", BBoxd(Vec3d(0), Vec3d(1)))); - EXPECT_EQ(Index32(1), newGrid->tree().leafCount()); + EXPECT_EQ(Index64(1), newGrid->tree().leafCount()); auto leafIter = newGrid->tree().beginLeaf(); EXPECT_EQ(3, int(leafIter->mReadPasses.size())); diff --git a/openvdb/openvdb/unittest/TestFilter.cc b/openvdb/openvdb/unittest/TestFilter.cc index 0d3006f56c..12f9cdedd6 100644 --- a/openvdb/openvdb/unittest/TestFilter.cc +++ b/openvdb/openvdb/unittest/TestFilter.cc @@ -245,7 +245,7 @@ TEST_F(TestFilter, testFilterTiles) openvdb::FloatGrid::Ptr ref = openvdb::FloatGrid::create(0.0f); auto& tree = ref->tree(); tree.addTile(test.mLevel, Coord(0), 1.0f, true); - EXPECT_EQ(Index32(0), tree.leafCount()); + EXPECT_EQ(Index64(0), tree.leafCount()); EXPECT_EQ(Index64(1), tree.activeTileCount()); EXPECT_EQ(test.mVoxels, tree.activeVoxelCount()); EXPECT_EQ(1.0f, tree.getValue(Coord(0))); @@ -262,7 +262,7 @@ TEST_F(TestFilter, testFilterTiles) // disable tile processing, do nothing filter.setProcessTiles(false); filter.offset(1.0f); - EXPECT_EQ(Index32(0), tree.leafCount()); + EXPECT_EQ(Index64(0), tree.leafCount()); EXPECT_EQ(Index64(1), tree.activeTileCount()); EXPECT_EQ(test.mVoxels, tree.activeVoxelCount()); EXPECT_EQ(1.0f, tree.getValue(Coord(0))); @@ -271,7 +271,7 @@ TEST_F(TestFilter, testFilterTiles) // enable filter.setProcessTiles(true); filter.offset(1.0f); - EXPECT_EQ(Index32(0), tree.leafCount()); + EXPECT_EQ(Index64(0), tree.leafCount()); EXPECT_EQ(Index64(1), tree.activeTileCount()); EXPECT_EQ(test.mVoxels, tree.activeVoxelCount()); EXPECT_EQ(2.0f, tree.getValue(Coord(0))); @@ -285,7 +285,7 @@ TEST_F(TestFilter, testFilterTiles) // disable tile processing, do nothing filter.setProcessTiles(false); filter.mean(width, iter); - EXPECT_EQ(Index32(0), tree.leafCount()); + EXPECT_EQ(Index64(0), tree.leafCount()); EXPECT_EQ(Index64(1), tree.activeTileCount()); EXPECT_EQ(test.mVoxels, tree.activeVoxelCount()); EXPECT_EQ(1.0f, tree.getValue(Coord(0))); @@ -308,7 +308,7 @@ TEST_F(TestFilter, testFilterTiles) // disable tile processing, do nothing filter.setProcessTiles(false); filter.median(width, iter); - EXPECT_EQ(Index32(0), tree.leafCount()); + EXPECT_EQ(Index64(0), tree.leafCount()); EXPECT_EQ(Index64(1), tree.activeTileCount()); EXPECT_EQ(test.mVoxels, tree.activeVoxelCount()); EXPECT_EQ(1.0f, tree.getValue(Coord(0))); @@ -339,7 +339,7 @@ TEST_F(TestFilter, testFilterTiles) openvdb::FloatGrid::Ptr ref = openvdb::FloatGrid::create(1.0f); auto& tree = ref->tree(); tree.addTile(test.mLevel, Coord(0), 1.0f, true); - EXPECT_EQ(Index32(0), tree.leafCount()); + EXPECT_EQ(Index64(0), tree.leafCount()); EXPECT_EQ(Index64(1), tree.activeTileCount()); EXPECT_EQ(test.mVoxels, tree.activeVoxelCount()); EXPECT_EQ(1.0f, tree.getValue(Coord(0))); @@ -355,7 +355,7 @@ TEST_F(TestFilter, testFilterTiles) openvdb::tools::Filter filter(*grid); filter.setProcessTiles(true); filter.mean(width, iter); - EXPECT_EQ(Index32(0), tree.leafCount()); + EXPECT_EQ(Index64(0), tree.leafCount()); EXPECT_EQ(Index64(1), tree.activeTileCount()); EXPECT_EQ(test.mVoxels, tree.activeVoxelCount()); EXPECT_EQ(1.0f, tree.getValue(Coord(0))); @@ -368,7 +368,7 @@ TEST_F(TestFilter, testFilterTiles) openvdb::tools::Filter filter(*grid); filter.setProcessTiles(true); filter.median(width, iter); - EXPECT_EQ(Index32(0), tree.leafCount()); + EXPECT_EQ(Index64(0), tree.leafCount()); EXPECT_EQ(Index64(1), tree.activeTileCount()); EXPECT_EQ(test.mVoxels, tree.activeVoxelCount()); EXPECT_EQ(1.0f, tree.getValue(Coord(0))); @@ -387,7 +387,7 @@ TEST_F(TestFilter, testFilterTiles) openvdb::FloatGrid::Ptr ref = openvdb::FloatGrid::create(1.0f); auto& tree = ref->tree(); tree.addTile(1, Coord(0), 1.0f, true); - EXPECT_EQ(Index32(0), tree.leafCount()); + EXPECT_EQ(Index64(0), tree.leafCount()); EXPECT_EQ(Index64(1), tree.activeTileCount()); EXPECT_EQ(Index64(LeafT::NUM_VALUES), tree.activeVoxelCount()); EXPECT_EQ(1.0f, tree.getValue(Coord(0))); @@ -402,7 +402,7 @@ TEST_F(TestFilter, testFilterTiles) // filter.setProcessTiles(true); filter.mean(1, 1); - EXPECT_EQ(Index32(0), tree.leafCount()); + EXPECT_EQ(Index64(0), tree.leafCount()); EXPECT_EQ(Index64(1), tree.activeTileCount()); EXPECT_EQ(Index64(LeafT::NUM_VALUES), tree.activeVoxelCount()); EXPECT_EQ(1.0f, tree.getValue(Coord(0))); @@ -410,11 +410,11 @@ TEST_F(TestFilter, testFilterTiles) // create leaf neighbour tree.touchLeaf(Coord(-1,0,0)); - EXPECT_EQ(Index32(1), tree.leafCount()); + EXPECT_EQ(Index64(1), tree.leafCount()); EXPECT_EQ(Index64(1), tree.activeTileCount()); filter.mean(1, 1); - EXPECT_EQ(Index32(2), tree.leafCount()); + EXPECT_EQ(Index64(2), tree.leafCount()); EXPECT_EQ(Index64(0), tree.activeTileCount()); EXPECT_EQ(Index64(LeafT::NUM_VALUES), tree.activeVoxelCount()); } @@ -426,18 +426,18 @@ TEST_F(TestFilter, testFilterTiles) openvdb::FloatGrid::Ptr ref = openvdb::FloatGrid::create(1.0f); auto& tree = ref->tree(); tree.addTile(level, Coord(0), 1.0f, true); - EXPECT_EQ(Index32(0), tree.leafCount()); + EXPECT_EQ(Index64(0), tree.leafCount()); EXPECT_EQ(Index64(1), tree.activeTileCount()); EXPECT_EQ(1.0f, tree.getValue(Coord(0))); EXPECT_TRUE(tree.isValueOn(Coord(0))); // create a leaf and tile neighbour tree.touchLeaf(Coord(-int(LeafT::DIM),0,0)); - EXPECT_EQ(Index32(1), tree.leafCount()); + EXPECT_EQ(Index64(1), tree.leafCount()); EXPECT_EQ(Index64(1), tree.activeTileCount()); // create tile level 1 neighbour with a different value tree.addTile(1, Coord(-int(LeafT::DIM),0,LeafT::DIM*3), 2.0f, true); - EXPECT_EQ(Index32(1), tree.leafCount()); + EXPECT_EQ(Index64(1), tree.leafCount()); EXPECT_EQ(Index64(2), tree.activeTileCount()); return ref; }; @@ -453,7 +453,7 @@ TEST_F(TestFilter, testFilterTiles) // (+ itself becomes a leaf) filter.mean(/*width*/LeafT::DIM+1, /*iter*/1); // 2 leaf nodes from the tile/leaf neighbours + their neighbours - EXPECT_EQ(Index32(2+4+5), tree.leafCount()); + EXPECT_EQ(Index64(2+4+5), tree.leafCount()); EXPECT_EQ((Index64(InternalNode1::NUM_VALUES) - 1) + (Index64(InternalNode2::NUM_VALUES) - (4+5)), tree.activeTileCount()); EXPECT_EQ(Index64(InternalNode1::NUM_VOXELS) + @@ -467,7 +467,7 @@ TEST_F(TestFilter, testFilterTiles) filter.setProcessTiles(true); // with width = 2 and iter = 2, edge/vertex neighbours should also be voxelized filter.mean(/*width*/2, /*iter*/2); - EXPECT_EQ(Index32(2+4+6), tree.leafCount()); + EXPECT_EQ(Index64(2+4+6), tree.leafCount()); EXPECT_EQ((Index64(InternalNode1::NUM_VALUES) - 1) + (Index64(InternalNode2::NUM_VALUES) - (4+6)), tree.activeTileCount()); EXPECT_EQ(Index64(InternalNode1::NUM_VOXELS) + @@ -481,7 +481,7 @@ TEST_F(TestFilter, testFilterTiles) filter.setProcessTiles(true); // with width = 1 and iter = 9 - checks an iter count > LeafT::DIM filter.mean(/*width*/1, /*iter*/LeafT::DIM+1); - EXPECT_EQ(Index32(38), tree.leafCount()); + EXPECT_EQ(Index64(38), tree.leafCount()); EXPECT_EQ((Index64(InternalNode2::NUM_VALUES) - 36), tree.activeTileCount()); EXPECT_EQ(Index64(InternalNode2::NUM_VOXELS) + Index64(LeafT::NUM_VOXELS), tree.activeVoxelCount()); diff --git a/openvdb/openvdb/unittest/TestGrid.cc b/openvdb/openvdb/unittest/TestGrid.cc index d7d6056bb5..27c76ec0f6 100644 --- a/openvdb/openvdb/unittest/TestGrid.cc +++ b/openvdb/openvdb/unittest/TestGrid.cc @@ -75,7 +75,11 @@ class ProxyTree: public openvdb::TreeBase void prune(const ValueType& = 0) {} void clip(const openvdb::CoordBBox&) {} void clipUnallocatedNodes() override {} +#if OPENVDB_ABI_VERSION_NUMBER >= 12 + openvdb::Index64 unallocatedLeafCount() const override { return 0; } +#else openvdb::Index32 unallocatedLeafCount() const override { return 0; } +#endif void getIndexRange(openvdb::CoordBBox&) const override {} bool evalLeafBoundingBox(openvdb::CoordBBox& bbox) const override @@ -88,10 +92,17 @@ class ProxyTree: public openvdb::TreeBase { dim = openvdb::Coord(0, 0, 0); return false; } openvdb::Index treeDepth() const override { return 0; } - openvdb::Index leafCount() const override { return 0; } +#if OPENVDB_ABI_VERSION_NUMBER >= 12 + openvdb::Index64 leafCount() const override { return 0; } + std::vector nodeCount() const override + { return std::vector(DEPTH, 0); } + openvdb::Index64 nonLeafCount() const override { return 0; } +#else + openvdb::Index32 leafCount() const override { return 0; } std::vector nodeCount() const override { return std::vector(DEPTH, 0); } - openvdb::Index nonLeafCount() const override { return 0; } + openvdb::Index32 nonLeafCount() const override { return 0; } +#endif openvdb::Index64 activeVoxelCount() const override { return 0UL; } openvdb::Index64 inactiveVoxelCount() const override { return 0UL; } openvdb::Index64 activeLeafVoxelCount() const override { return 0UL; } @@ -270,7 +281,7 @@ TEST_F(TestGrid, testCopyGrid) // shallow-copy a const grid but supply a new transform and meta map EXPECT_EQ(1.0, grid1->transform().voxelSize().x()); EXPECT_EQ(size_t(0), grid1->metaCount()); - EXPECT_EQ(Index(2), grid1->tree().leafCount()); + EXPECT_EQ(Index64(2), grid1->tree().leafCount()); math::Transform::Ptr xform(math::Transform::createLinearTransform(/*voxelSize=*/0.25)); MetaMap meta; @@ -283,7 +294,7 @@ TEST_F(TestGrid, testCopyGrid) EXPECT_EQ(0.25, grid3->transform().voxelSize().x()); EXPECT_EQ(size_t(1), grid3->metaCount()); - EXPECT_EQ(Index(2), tree3.leafCount()); + EXPECT_EQ(Index64(2), tree3.leafCount()); EXPECT_EQ(long(3), constGrid1->constTreePtr().use_count()); } diff --git a/openvdb/openvdb/unittest/TestIndexFilter.cc b/openvdb/openvdb/unittest/TestIndexFilter.cc index a9aff3f378..3389511d85 100644 --- a/openvdb/openvdb/unittest/TestIndexFilter.cc +++ b/openvdb/openvdb/unittest/TestIndexFilter.cc @@ -157,7 +157,7 @@ TEST_F(TestIndexFilter, testActiveFilter) // check there are two leafs - EXPECT_EQ(Index32(2), points->tree().leafCount()); + EXPECT_EQ(Index64(2), points->tree().leafCount()); ActiveFilter activeFilter; InactiveFilter inActiveFilter; @@ -551,7 +551,7 @@ TEST_F(TestIndexFilter, testAttributeHashFilter) // four points, two leafs - EXPECT_EQ(tree.leafCount(), Index32(2)); + EXPECT_EQ(tree.leafCount(), Index64(2)); appendAttribute(tree, "id"); @@ -846,7 +846,7 @@ TEST_F(TestIndexFilter, testBBoxFilter) PointDataTree& tree = grid->tree(); // check one leaf per point - EXPECT_EQ(tree.leafCount(), Index32(2)); + EXPECT_EQ(tree.leafCount(), Index64(2)); // build some bounding box filters to test diff --git a/openvdb/openvdb/unittest/TestLeaf.cc b/openvdb/openvdb/unittest/TestLeaf.cc index 5176f70d93..ee6f6324ad 100644 --- a/openvdb/openvdb/unittest/TestLeaf.cc +++ b/openvdb/openvdb/unittest/TestLeaf.cc @@ -508,8 +508,8 @@ TEST_F(TestLeaf, testCount) EXPECT_EQ(Index(512), leaf.numValues()); EXPECT_EQ(Index(0), leaf.getLevel()); EXPECT_EQ(Index(1), leaf.getChildDim()); - EXPECT_EQ(Index(1), leaf.leafCount()); - EXPECT_EQ(Index(0), leaf.nonLeafCount()); + EXPECT_EQ(Index64(1), leaf.leafCount()); + EXPECT_EQ(Index64(0), leaf.nonLeafCount()); EXPECT_EQ(Index(0), leaf.childCount()); std::vector dims; diff --git a/openvdb/openvdb/unittest/TestLevelSetUtil.cc b/openvdb/openvdb/unittest/TestLevelSetUtil.cc index 165a960e5c..78e14ac9fa 100644 --- a/openvdb/openvdb/unittest/TestLevelSetUtil.cc +++ b/openvdb/openvdb/unittest/TestLevelSetUtil.cc @@ -146,7 +146,7 @@ TEST_F(TestLevelSetUtil, testSegmentationTools) openvdb::tools::segmentSDF(*sdfGrid, segments); EXPECT_EQ(size_t(1), segments.size()); - EXPECT_EQ(openvdb::Index32(0), segments[0]->tree().leafCount()); + EXPECT_EQ(openvdb::Index64(0), segments[0]->tree().leafCount()); EXPECT_EQ(10.2f, segments[0]->background()); } @@ -173,7 +173,7 @@ TEST_F(TestLevelSetUtil, testSegmentationTools) openvdb::tools::segmentSDF(*sdfGrid, segments); EXPECT_EQ(size_t(1), segments.size()); - EXPECT_EQ(openvdb::Index32(0), segments[0]->tree().leafCount()); + EXPECT_EQ(openvdb::Index64(0), segments[0]->tree().leafCount()); EXPECT_EQ(sdfGrid->background(), segments[0]->background()); } @@ -195,14 +195,14 @@ TEST_F(TestLevelSetUtil, testSegmentationTools) openvdb::FloatGrid::Ptr grid = openvdb::FloatGrid::create(/*background=*/3.1f); - EXPECT_EQ(openvdb::Index32(0), grid->tree().leafCount()); + EXPECT_EQ(openvdb::Index64(0), grid->tree().leafCount()); std::vector segments; openvdb::tools::segmentActiveVoxels(*grid, segments); // note that an empty volume should segment into an empty volume EXPECT_EQ(size_t(1), segments.size()); - EXPECT_EQ(openvdb::Index32(0), segments[0]->tree().leafCount()); + EXPECT_EQ(openvdb::Index64(0), segments[0]->tree().leafCount()); EXPECT_EQ(3.1f, segments[0]->background()); } @@ -213,14 +213,14 @@ TEST_F(TestLevelSetUtil, testSegmentationTools) grid->tree().touchLeaf(openvdb::Coord(0,0,0)); grid->tree().touchLeaf(openvdb::Coord(100,100,100)); - EXPECT_EQ(openvdb::Index32(2), grid->tree().leafCount()); + EXPECT_EQ(openvdb::Index64(2), grid->tree().leafCount()); EXPECT_EQ(openvdb::Index64(0), grid->tree().activeVoxelCount()); std::vector segments; openvdb::tools::segmentActiveVoxels(*grid, segments); EXPECT_EQ(size_t(1), segments.size()); - EXPECT_EQ(openvdb::Index32(0), segments[0]->tree().leafCount()); + EXPECT_EQ(openvdb::Index64(0), segments[0]->tree().leafCount()); } } diff --git a/openvdb/openvdb/unittest/TestMerge.cc b/openvdb/openvdb/unittest/TestMerge.cc index 519a75f2a9..3a98d58479 100644 --- a/openvdb/openvdb/unittest/TestMerge.cc +++ b/openvdb/openvdb/unittest/TestMerge.cc @@ -82,7 +82,7 @@ TEST_F(TestMerge, testTreeToMerge) { // non-const tree FloatGrid::Ptr grid = createLevelSet(); grid->tree().touchLeaf(Coord(8)); - EXPECT_EQ(Index(1), grid->tree().leafCount()); + EXPECT_EQ(Index64(1), grid->tree().leafCount()); tools::TreeToMerge treeToMerge{grid->tree(), Steal()}; EXPECT_EQ(&grid->constTree().root(), treeToMerge.rootPtr()); @@ -98,14 +98,14 @@ TEST_F(TestMerge, testTreeToMerge) const LeafNode* leafNode = treeToMerge.probeConstNode(Coord(8)); EXPECT_TRUE(leafNode); EXPECT_EQ(grid->constTree().probeConstLeaf(Coord(8)), leafNode); - EXPECT_EQ(Index(1), grid->tree().leafCount()); + EXPECT_EQ(Index64(1), grid->tree().leafCount()); EXPECT_EQ(Index(1), grid->tree().root().childCount()); // steal leaf node std::unique_ptr leafNodePtr = treeToMerge.stealOrDeepCopyNode(Coord(8)); EXPECT_TRUE(leafNodePtr); - EXPECT_EQ(Index(0), grid->tree().leafCount()); + EXPECT_EQ(Index64(0), grid->tree().leafCount()); EXPECT_EQ(leafNodePtr->origin(), Coord(8)); EXPECT_EQ(Index(1), grid->tree().root().childCount()); @@ -139,7 +139,7 @@ TEST_F(TestMerge, testTreeToMerge) { // const tree FloatGrid::Ptr grid = createLevelSet(); grid->tree().touchLeaf(Coord(8)); - EXPECT_EQ(Index(1), grid->tree().leafCount()); + EXPECT_EQ(Index64(1), grid->tree().leafCount()); tools::TreeToMerge treeToMerge{grid->constTree(), DeepCopy(), /*initialize=*/false}; EXPECT_TRUE(!treeToMerge.hasMask()); @@ -158,14 +158,14 @@ TEST_F(TestMerge, testTreeToMerge) const LeafNode* leafNode = treeToMerge.probeConstNode(Coord(8)); EXPECT_TRUE(leafNode); EXPECT_EQ(grid->constTree().probeConstLeaf(Coord(8)), leafNode); - EXPECT_EQ(Index(1), grid->tree().leafCount()); + EXPECT_EQ(Index64(1), grid->tree().leafCount()); EXPECT_EQ(Index(1), grid->tree().root().childCount()); { // deep copy leaf node tools::TreeToMerge treeToMerge2{grid->constTree(), DeepCopy()}; std::unique_ptr leafNodePtr = treeToMerge2.stealOrDeepCopyNode(Coord(8)); EXPECT_TRUE(leafNodePtr); - EXPECT_EQ(Index(1), grid->tree().leafCount()); // leaf has not been stolen + EXPECT_EQ(Index64(1), grid->tree().leafCount()); // leaf has not been stolen EXPECT_EQ(leafNodePtr->origin(), Coord(8)); EXPECT_EQ(Index(1), grid->tree().root().childCount()); } @@ -221,7 +221,7 @@ TEST_F(TestMerge, testTreeToMerge) FloatGrid::Ptr grid = createLevelSet(); grid->tree().touchLeaf(Coord(8)); - EXPECT_EQ(Index(1), grid->tree().leafCount()); + EXPECT_EQ(Index64(1), grid->tree().leafCount()); treeToMerge.reset(grid->treePtr(), Steal()); } @@ -241,7 +241,7 @@ TEST_F(TestMerge, testTreeToMerge) EXPECT_TRUE(!treeToMerge2.treeToSteal()); EXPECT_TRUE(treeToMerge2.treeToDeepCopy()); - EXPECT_EQ(Index(0), treeToMerge2.treeToDeepCopy()->leafCount()); + EXPECT_EQ(Index64(0), treeToMerge2.treeToDeepCopy()->leafCount()); FloatGrid::Ptr grid = createLevelSet(); grid->tree().touchLeaf(Coord(8)); @@ -249,7 +249,7 @@ TEST_F(TestMerge, testTreeToMerge) EXPECT_TRUE(treeToMerge2.treeToSteal()); EXPECT_TRUE(!treeToMerge2.treeToDeepCopy()); - EXPECT_EQ(Index(1), treeToMerge2.treeToSteal()->leafCount()); + EXPECT_EQ(Index64(1), treeToMerge2.treeToSteal()->leafCount()); } } @@ -908,7 +908,7 @@ TEST_F(TestMerge, testCsgUnion) tree::DynamicNodeManager nodeManager(grid->tree()); nodeManager.foreachTopDown(mergeOp); - EXPECT_EQ(Index32(1), grid->tree().leafCount()); + EXPECT_EQ(Index64(1), grid->tree().leafCount()); } { // merge a leaf node into a grid with an outside tile @@ -955,8 +955,8 @@ TEST_F(TestMerge, testCsgUnion) tree::DynamicNodeManager nodeManager(grid->tree()); nodeManager.foreachTopDown(mergeOp); - EXPECT_EQ(Index32(1), grid->tree().leafCount()); - EXPECT_EQ(Index32(0), grid2->tree().leafCount()); + EXPECT_EQ(Index64(1), grid->tree().leafCount()); + EXPECT_EQ(Index64(0), grid2->tree().leafCount()); // test background values are remapped @@ -1027,8 +1027,8 @@ TEST_F(TestMerge, testCsgUnion) FloatGrid::Ptr grid2 = createLevelSet(); grid2->tree().touchLeaf(Coord(0, 0, 0)); - EXPECT_EQ(Index32(0), grid->tree().leafCount()); - EXPECT_EQ(Index32(1), grid2->tree().leafCount()); + EXPECT_EQ(Index64(0), grid->tree().leafCount()); + EXPECT_EQ(Index64(1), grid2->tree().leafCount()); // merge from a const tree @@ -1038,9 +1038,9 @@ TEST_F(TestMerge, testCsgUnion) tree::DynamicNodeManager nodeManager(grid->tree()); nodeManager.foreachTopDown(mergeOp); - EXPECT_EQ(Index32(1), grid->tree().leafCount()); + EXPECT_EQ(Index64(1), grid->tree().leafCount()); // leaf has been deep copied not stolen - EXPECT_EQ(Index32(1), grid2->tree().leafCount()); + EXPECT_EQ(Index64(1), grid2->tree().leafCount()); } } @@ -1772,7 +1772,7 @@ TEST_F(TestMerge, testCsgIntersection) tree::DynamicNodeManager nodeManager(grid->tree()); nodeManager.foreachTopDown(mergeOp); - EXPECT_EQ(Index32(0), grid->tree().leafCount()); + EXPECT_EQ(Index64(0), grid->tree().leafCount()); } { // merge a leaf node into a grid with a background tile @@ -1785,7 +1785,7 @@ TEST_F(TestMerge, testCsgIntersection) tree::DynamicNodeManager nodeManager(grid->tree()); nodeManager.foreachTopDown(mergeOp); - EXPECT_EQ(Index32(0), grid->tree().leafCount()); + EXPECT_EQ(Index64(0), grid->tree().leafCount()); } { // merge a leaf node into a grid with an outside tile @@ -1828,8 +1828,8 @@ TEST_F(TestMerge, testCsgIntersection) tree::DynamicNodeManager nodeManager(grid->tree()); nodeManager.foreachTopDown(mergeOp); - EXPECT_EQ(Index32(1), grid->tree().leafCount()); - EXPECT_EQ(Index32(0), grid2->tree().leafCount()); + EXPECT_EQ(Index64(1), grid->tree().leafCount()); + EXPECT_EQ(Index64(0), grid2->tree().leafCount()); // test background values are remapped @@ -1901,8 +1901,8 @@ TEST_F(TestMerge, testCsgIntersection) FloatGrid::Ptr grid2 = createLevelSet(); grid2->tree().touchLeaf(Coord(0, 0, 0)); - EXPECT_EQ(Index32(0), grid->tree().leafCount()); - EXPECT_EQ(Index32(1), grid2->tree().leafCount()); + EXPECT_EQ(Index64(0), grid->tree().leafCount()); + EXPECT_EQ(Index64(1), grid2->tree().leafCount()); // merge from a const tree @@ -1912,9 +1912,9 @@ TEST_F(TestMerge, testCsgIntersection) tree::DynamicNodeManager nodeManager(grid->tree()); nodeManager.foreachTopDown(mergeOp); - EXPECT_EQ(Index32(1), grid->tree().leafCount()); + EXPECT_EQ(Index64(1), grid->tree().leafCount()); // leaf has been deep copied not stolen - EXPECT_EQ(Index32(1), grid2->tree().leafCount()); + EXPECT_EQ(Index64(1), grid2->tree().leafCount()); } { // merge three leaf nodes from four grids @@ -2472,15 +2472,15 @@ TEST_F(TestMerge, testCsgDifference) FloatGrid::Ptr grid2 = createLevelSet(); grid2->tree().touchLeaf(Coord(0, 0, 0)); - EXPECT_EQ(Index32(0), grid->tree().leafCount()); - EXPECT_EQ(Index32(1), grid2->tree().leafCount()); + EXPECT_EQ(Index64(0), grid->tree().leafCount()); + EXPECT_EQ(Index64(1), grid2->tree().leafCount()); tools::CsgDifferenceOp mergeOp(grid2->tree(), Steal()); tree::DynamicNodeManager nodeManager(grid->tree()); nodeManager.foreachTopDown(mergeOp); - EXPECT_EQ(Index32(1), grid->tree().leafCount()); - EXPECT_EQ(Index32(0), grid2->tree().leafCount()); + EXPECT_EQ(Index64(1), grid->tree().leafCount()); + EXPECT_EQ(Index64(0), grid2->tree().leafCount()); } { // merge two leaf nodes into a grid @@ -2489,8 +2489,8 @@ TEST_F(TestMerge, testCsgDifference) FloatGrid::Ptr grid2 = createLevelSet(); grid2->tree().touchLeaf(Coord(0, 0, 0)); - EXPECT_EQ(Index32(1), grid->tree().leafCount()); - EXPECT_EQ(Index32(1), grid2->tree().leafCount()); + EXPECT_EQ(Index64(1), grid->tree().leafCount()); + EXPECT_EQ(Index64(1), grid2->tree().leafCount()); tools::CsgDifferenceOp mergeOp(grid2->tree(), Steal()); tree::DynamicNodeManager nodeManager(grid->tree()); @@ -2556,15 +2556,15 @@ TEST_F(TestMerge, testCsgDifference) FloatGrid::Ptr grid2 = createLevelSet(); grid2->tree().touchLeaf(Coord(0, 0, 0)); - EXPECT_EQ(Index32(0), grid->tree().leafCount()); - EXPECT_EQ(Index32(1), grid2->tree().leafCount()); + EXPECT_EQ(Index64(0), grid->tree().leafCount()); + EXPECT_EQ(Index64(1), grid2->tree().leafCount()); tools::CsgDifferenceOp mergeOp(grid2->constTree(), DeepCopy()); tree::DynamicNodeManager nodeManager(grid->tree()); nodeManager.foreachTopDown(mergeOp); - EXPECT_EQ(Index32(1), grid->tree().leafCount()); - EXPECT_EQ(Index32(1), grid2->tree().leafCount()); + EXPECT_EQ(Index64(1), grid->tree().leafCount()); + EXPECT_EQ(Index64(1), grid2->tree().leafCount()); } } @@ -2887,7 +2887,7 @@ TEST_F(TestMerge, testSum) tree::DynamicNodeManager nodeManager(tree); nodeManager.foreachTopDown(mergeOp); - EXPECT_EQ(Index32(1), tree.leafCount()); + EXPECT_EQ(Index64(1), tree.leafCount()); EXPECT_EQ(tree.cbeginLeaf()->getFirstValue(), 0.0f); } @@ -2902,7 +2902,7 @@ TEST_F(TestMerge, testSum) tree::DynamicNodeManager nodeManager(tree); nodeManager.foreachTopDown(mergeOp); - EXPECT_EQ(Index32(1), tree.leafCount()); + EXPECT_EQ(Index64(1), tree.leafCount()); EXPECT_EQ(Index(0), getTileCount(tree.root())); auto iter = tree.cbeginLeaf(); EXPECT_EQ(iter->getValue(0), 10.0f); @@ -2924,7 +2924,7 @@ TEST_F(TestMerge, testSum) tree::DynamicNodeManager nodeManager(tree); nodeManager.foreachTopDown(mergeOp); - EXPECT_EQ(Index32(1), tree.leafCount()); + EXPECT_EQ(Index64(1), tree.leafCount()); EXPECT_EQ(Index(0), getTileCount(tree.root())); auto iter = tree.cbeginLeaf(); EXPECT_EQ(iter->getValue(0), 210.0f); @@ -2949,7 +2949,7 @@ TEST_F(TestMerge, testSum) tree::DynamicNodeManager nodeManager(tree); nodeManager.foreachTopDown(mergeOp); - EXPECT_EQ(Index32(1), tree.leafCount()); + EXPECT_EQ(Index64(1), tree.leafCount()); EXPECT_EQ(Index(0), getTileCount(tree.root())); auto iter = tree.cbeginLeaf(); EXPECT_EQ(iter->getValue(0), 210.0f); @@ -2973,7 +2973,7 @@ TEST_F(TestMerge, testSum) tree::DynamicNodeManager nodeManager(tree); nodeManager.foreachTopDown(mergeOp); - EXPECT_EQ(Index32(1), tree.leafCount()); + EXPECT_EQ(Index64(1), tree.leafCount()); EXPECT_EQ(Index(0), getTileCount(tree.root())); auto iter = tree.cbeginLeaf(); EXPECT_EQ(iter->getValue(0), 15.0f); @@ -2995,7 +2995,7 @@ TEST_F(TestMerge, testSum) tree::DynamicNodeManager nodeManager(tree); nodeManager.foreachTopDown(mergeOp); - EXPECT_EQ(Index32(1), tree.leafCount()); + EXPECT_EQ(Index64(1), tree.leafCount()); EXPECT_EQ(Index(0), getTileCount(tree.root())); auto iter = tree.cbeginLeaf(); EXPECT_EQ(iter->getValue(0), 10.0f); @@ -3017,7 +3017,7 @@ TEST_F(TestMerge, testSum) tree::DynamicNodeManager nodeManager(tree); nodeManager.foreachTopDown(mergeOp); - EXPECT_EQ(Index32(1), tree.leafCount()); + EXPECT_EQ(Index64(1), tree.leafCount()); EXPECT_EQ(Index(0), getTileCount(tree.root())); auto iter = tree.cbeginLeaf(); EXPECT_EQ(iter->getValue(0), 10.0f); @@ -3039,7 +3039,7 @@ TEST_F(TestMerge, testSum) tree::DynamicNodeManager nodeManager(tree); nodeManager.foreachTopDown(mergeOp); - EXPECT_EQ(Index32(1), tree.leafCount()); + EXPECT_EQ(Index64(1), tree.leafCount()); EXPECT_EQ(Index(0), getTileCount(tree.root())); auto iter = tree.cbeginLeaf(); EXPECT_EQ(iter->getValue(0), 10.0f); @@ -3155,8 +3155,8 @@ TEST_F(TestMerge, testSum) FloatGrid::Ptr grid2 = createLevelSet(); tree2.touchLeaf(Coord(0, 0, 0)); - EXPECT_EQ(Index32(0), tree.leafCount()); - EXPECT_EQ(Index32(1), tree2.leafCount()); + EXPECT_EQ(Index64(0), tree.leafCount()); + EXPECT_EQ(Index64(1), tree2.leafCount()); // merge from a const tree @@ -3168,9 +3168,9 @@ TEST_F(TestMerge, testSum) tree::DynamicNodeManager nodeManager(tree); nodeManager.foreachTopDown(mergeOp); - EXPECT_EQ(Index32(1), tree.leafCount()); + EXPECT_EQ(Index64(1), tree.leafCount()); // leaf has been deep copied not stolen - EXPECT_EQ(Index32(1), tree2.leafCount()); + EXPECT_EQ(Index64(1), tree2.leafCount()); } } @@ -3185,7 +3185,7 @@ TEST_F(TestMerge, testSum) tree::DynamicNodeManager nodeManager(tree); nodeManager.foreachTopDown(mergeOp); - EXPECT_EQ(Index32(1), tree.leafCount()); + EXPECT_EQ(Index64(1), tree.leafCount()); EXPECT_EQ(Index(0), getTileCount(tree.root())); auto iter = tree.cbeginLeaf(); EXPECT_EQ(iter->getValue(0), Vec3s(1.0f, 2.0f, 3.0f)); @@ -3206,7 +3206,7 @@ TEST_F(TestMerge, testSum) tree::DynamicNodeManager nodeManager(tree); nodeManager.foreachTopDown(mergeOp); - EXPECT_EQ(Index32(1), tree.leafCount()); + EXPECT_EQ(Index64(1), tree.leafCount()); EXPECT_EQ(Index(0), getTileCount(tree.root())); auto iter = tree.cbeginLeaf(); EXPECT_FALSE(iter->isValueOn(0)); diff --git a/openvdb/openvdb/unittest/TestMorphology.cc b/openvdb/openvdb/unittest/TestMorphology.cc index c7498996b9..a03e1db857 100644 --- a/openvdb/openvdb/unittest/TestMorphology.cc +++ b/openvdb/openvdb/unittest/TestMorphology.cc @@ -113,7 +113,7 @@ TestMorphologyInternal::testMorphActiveLeafValues() EXPECT_EQ(Index64(1), tree.activeVoxelCount()); openvdb::tools::erodeActiveValues(tree, 1, NN, openvdb::tools::IGNORE_TILES); EXPECT_EQ(Index64(0), tree.activeVoxelCount()); - EXPECT_EQ(Index32(1), tree.leafCount()); + EXPECT_EQ(Index64(1), tree.leafCount()); // check values if (!IsMask) { EXPECT_EQ(tree.getValue(xyz), ValueType(1.0)); @@ -124,7 +124,7 @@ TestMorphologyInternal::testMorphActiveLeafValues() { // Create an active, leaf node-sized tile and a single edge/corner voxel tree.clear(); tree.addTile(/*level*/1, Coord(0), ValueType(1.0), true); - EXPECT_EQ(Index32(0), tree.leafCount()); + EXPECT_EQ(Index64(0), tree.leafCount()); EXPECT_EQ(Index64(leafDim * leafDim * leafDim), tree.activeVoxelCount()); EXPECT_EQ(Index64(1), tree.activeTileCount()); @@ -143,7 +143,7 @@ TestMorphologyInternal::testMorphActiveLeafValues() if (NN == openvdb::tools::NN_FACE_EDGE_VERTEX) expected += 22; // 4 overlapping EXPECT_EQ(expected, tree.activeVoxelCount()); EXPECT_EQ(Index64(1), tree.activeTileCount()); - Index32 leafs; + Index64 leafs; if (NN == openvdb::tools::NN_FACE) leafs = 3; if (NN == openvdb::tools::NN_FACE_EDGE) leafs = 6; if (NN == openvdb::tools::NN_FACE_EDGE_VERTEX) leafs = 7; @@ -434,7 +434,7 @@ TestMorphologyInternal::testMorphActiveValues() { // Test behaviour with an existing active tile at (0,0,0) tree.clear(); tree.addTile(/*level*/1, Coord(0), ValueType(1.0), true); - EXPECT_EQ(Index32(0), tree.leafCount()); + EXPECT_EQ(Index64(0), tree.leafCount()); EXPECT_EQ(Index64(leafDim * leafDim * leafDim), tree.activeVoxelCount()); EXPECT_EQ(Index64(1), tree.activeTileCount()); @@ -450,7 +450,7 @@ TestMorphologyInternal::testMorphActiveValues() TreeT erodeexp(tree), erodepres(tree); openvdb::tools::erodeActiveValues(erodeexp, 1, NN, openvdb::tools::EXPAND_TILES); Index64 expected = (leafDim-2) * (leafDim-2) * (leafDim-2); - EXPECT_EQ(Index32(1), erodeexp.leafCount()); + EXPECT_EQ(Index64(1), erodeexp.leafCount()); EXPECT_EQ(expected, erodeexp.activeVoxelCount()); EXPECT_EQ(Index64(0), erodeexp.activeTileCount()); EXPECT_TRUE(erodeexp.probeConstLeaf(Coord(0))); @@ -465,7 +465,7 @@ TestMorphologyInternal::testMorphActiveValues() if (NN == openvdb::tools::NN_FACE) expected += (leafDim * leafDim) * 6; // faces if (NN == openvdb::tools::NN_FACE_EDGE) expected += ((leafDim * leafDim) * 6) + (leafDim) * 12; // edges if (NN == openvdb::tools::NN_FACE_EDGE_VERTEX) expected += ((leafDim * leafDim) * 6) + ((leafDim) * 12) + 8; // edges - EXPECT_EQ(Index32(1+offsets), tree.leafCount()); + EXPECT_EQ(Index64(1+offsets), tree.leafCount()); EXPECT_EQ(expected, tree.activeVoxelCount()); EXPECT_EQ(Index64(0), tree.activeTileCount()); // Check actual values around center node faces @@ -492,7 +492,7 @@ TestMorphologyInternal::testMorphActiveValues() TreeT erode(tree); openvdb::tools::erodeActiveValues(erode, 1, NN, openvdb::tools::IGNORE_TILES); Index64 expected = leafDim * leafDim * leafDim; - EXPECT_EQ(Index32(1+offsets), erode.leafCount()); + EXPECT_EQ(Index64(1+offsets), erode.leafCount()); EXPECT_EQ(expected, erode.activeVoxelCount()); EXPECT_EQ(Index64(0), erode.activeTileCount()); EXPECT_TRUE(erode.probeConstLeaf(Coord(0))); @@ -514,7 +514,7 @@ TestMorphologyInternal::testMorphActiveValues() if (NN == openvdb::tools::NN_FACE_EDGE) expected += ((leafDim * leafDim) * 6) + (leafDim) * 12; // edges if (NN == openvdb::tools::NN_FACE_EDGE_VERTEX) expected += ((leafDim * leafDim) * 6) + ((leafDim) * 12) + 8; // edges - EXPECT_EQ(Index32(offsets), tree.leafCount()); + EXPECT_EQ(Index64(offsets), tree.leafCount()); EXPECT_EQ(expected, tree.activeVoxelCount()); EXPECT_EQ(Index64(1), tree.activeTileCount()); EXPECT_TRUE(copy.hasSameTopology(tree)); @@ -539,7 +539,7 @@ TestMorphologyInternal::testMorphActiveValues() openvdb::tools::erodeActiveValues(erode, 1, NN, openvdb::tools::PRESERVE_TILES); // PRESERVE_TILES will prune the result Index64 expected = leafDim * leafDim * leafDim; - EXPECT_EQ(Index32(0), erode.leafCount()); + EXPECT_EQ(Index64(0), erode.leafCount()); EXPECT_EQ(expected, erode.activeVoxelCount()); EXPECT_EQ(Index64(1), erode.activeTileCount()); EXPECT_TRUE(!erode.probeConstLeaf(Coord(0))); @@ -549,7 +549,7 @@ TestMorphologyInternal::testMorphActiveValues() { // Test tile preservation with voxel topology - create an active, leaf node-sized tile and a single edge voxel tree.clear(); tree.addTile(/*level*/1, Coord(0), ValueType(1.0), true); - EXPECT_EQ(Index32(0), tree.leafCount()); + EXPECT_EQ(Index64(0), tree.leafCount()); EXPECT_EQ(Index64(leafDim * leafDim * leafDim), tree.activeVoxelCount()); EXPECT_EQ(Index64(1), tree.activeTileCount()); @@ -575,7 +575,7 @@ TestMorphologyInternal::testMorphActiveValues() // Check actual values around center node faces EXPECT_EQ(Index64(1), tree.activeTileCount()); - EXPECT_EQ(Index32(offsets), tree.leafCount()); + EXPECT_EQ(Index64(offsets), tree.leafCount()); EXPECT_TRUE(!tree.probeConstLeaf(Coord(0))); EXPECT_TRUE(tree.isValueOn(Coord(0))); for (int i = 0; i < int(leafDim); ++i) { @@ -592,7 +592,7 @@ TestMorphologyInternal::testMorphActiveValues() { // Test tile is preserved with erosions IGNORE_TILES, irrespective of iterations openvdb::tools::erodeActiveValues(tree, 10, NN, openvdb::tools::IGNORE_TILES); EXPECT_EQ(Index64(1), tree.activeTileCount()); - EXPECT_EQ(Index32(offsets), tree.leafCount()); + EXPECT_EQ(Index64(offsets), tree.leafCount()); EXPECT_EQ(Index64(leafDim * leafDim * leafDim), tree.activeVoxelCount()); EXPECT_TRUE(!tree.probeConstLeaf(Coord(0))); EXPECT_TRUE(tree.isValueOn(Coord(0))); @@ -613,7 +613,7 @@ TestMorphologyInternal::testMorphActiveValues() tree.touchLeaf(Coord(leafDim*6, 0, 0))->setValuesOn(); Index64 expected = (leafDim * leafDim * leafDim) + ((leafDim * leafDim * leafDim) - (leafDim * leafDim)) * 2; - EXPECT_EQ(Index32(3), tree.leafCount()); + EXPECT_EQ(Index64(3), tree.leafCount()); EXPECT_EQ(expected, tree.activeVoxelCount()); EXPECT_EQ(Index64(0), tree.activeTileCount()); @@ -631,7 +631,7 @@ TestMorphologyInternal::testMorphActiveValues() if (NN == openvdb::tools::NN_FACE_EDGE) expected = offsets*3 -10; if (NN == openvdb::tools::NN_FACE_EDGE_VERTEX) expected = offsets*3 -18; if (!IsMask) expected += 1; - EXPECT_EQ(Index32(expected), tree.leafCount()); + EXPECT_EQ(Index64(expected), tree.leafCount()); // first if (IsMask) { // should have been pruned @@ -654,7 +654,7 @@ TestMorphologyInternal::testMorphActiveValues() openvdb::tools::PRESERVE_TILES); expected = (leafDim * leafDim * leafDim) + ((leafDim * leafDim * leafDim) - (leafDim * leafDim)) * 2; - EXPECT_EQ(Index32(2), tree.leafCount()); + EXPECT_EQ(Index64(2), tree.leafCount()); EXPECT_EQ(expected, tree.activeVoxelCount()); EXPECT_EQ(Index64(1), tree.activeTileCount()); } diff --git a/openvdb/openvdb/unittest/TestNodeManager.cc b/openvdb/openvdb/unittest/TestNodeManager.cc index d5a45fa587..6bd4759b3e 100644 --- a/openvdb/openvdb/unittest/TestNodeManager.cc +++ b/openvdb/openvdb/unittest/TestNodeManager.cc @@ -294,8 +294,8 @@ TEST_F(TestNodeManager, testDynamic) std::make_unique(Coord(0, 0, 0), /*value=*/1.0f); EXPECT_TRUE(sourceTree.root().addChild(child.release())); - EXPECT_EQ(Index32(0), sourceTree.leafCount()); - EXPECT_EQ(Index32(2), sourceTree.nonLeafCount()); + EXPECT_EQ(Index64(0), sourceTree.leafCount()); + EXPECT_EQ(Index64(2), sourceTree.nonLeafCount()); ExpandOp expandOp; @@ -304,7 +304,7 @@ TEST_F(TestNodeManager, testDynamic) openvdb::tree::NodeManager manager(tree); EXPECT_EQ(Index64(1), manager.nodeCount()); manager.foreachTopDown(expandOp); - EXPECT_EQ(Index32(0), tree.leafCount()); + EXPECT_EQ(Index64(0), tree.leafCount()); // first level has been expanded, but node manager cache does not include the new nodes SumOp sumOp; @@ -324,7 +324,7 @@ TEST_F(TestNodeManager, testDynamic) Int32Tree tree(sourceTree); openvdb::tree::DynamicNodeManager manager(tree); manager.foreachTopDown(expandOp, /*threaded=*/true, /*leafGrainSize=*/32, /*nonLeafGrainSize=*/8); - EXPECT_EQ(Index32(32768), tree.leafCount()); + EXPECT_EQ(Index64(32768), tree.leafCount()); SumOp sumOp; manager.reduceTopDown(sumOp); @@ -340,7 +340,7 @@ TEST_F(TestNodeManager, testDynamic) openvdb::tree::DynamicNodeManager manager(tree); ExpandOp zeroExpandOp(true); manager.foreachTopDown(zeroExpandOp); - EXPECT_EQ(Index32(32768), tree.leafCount()); + EXPECT_EQ(Index64(32768), tree.leafCount()); SumOp sumOp; manager.reduceTopDown(sumOp); diff --git a/openvdb/openvdb/unittest/TestNodeVisitor.cc b/openvdb/openvdb/unittest/TestNodeVisitor.cc index 19732621f3..e24bf72bb2 100644 --- a/openvdb/openvdb/unittest/TestNodeVisitor.cc +++ b/openvdb/openvdb/unittest/TestNodeVisitor.cc @@ -22,7 +22,7 @@ struct NodeCountOp counts[level]++; } - std::vector counts; + std::vector counts; }; // struct NodeCountOp @@ -35,10 +35,14 @@ TEST_F(TestNodeVisitor, testNodeCount) NodeCountOp nodeCountOp; tools::visitNodesDepthFirst(grid->tree(), nodeCountOp); - std::vector nodeCount1 = nodeCountOp.counts; + std::vector nodeCount1 = nodeCountOp.counts; +#if OPENVDB_ABI_VERSION_NUMBER >= 12 + std::vector nodeCount2 = grid->tree().nodeCount(); +#else std::vector nodeCount2 = grid->tree().nodeCount(); +#endif - EXPECT_EQ(nodeCount1.size(), nodeCount2.size()); + EXPECT_EQ(nodeCount1.size(), Index64(nodeCount2.size())); for (size_t i = 0; i < nodeCount1.size(); i++) { EXPECT_EQ(nodeCount1[i], nodeCount2[i]); @@ -55,7 +59,7 @@ struct LeafCountOp void operator()(const NodeT&, size_t) { } void operator()(const LeafT&, size_t) { count++; } - openvdb::Index32 count{0}; + openvdb::Index64 count{0}; }; // struct LeafCountOp @@ -94,7 +98,7 @@ struct DescendOp } openvdb::Index32 previousLevel{0}; - openvdb::Index32 count{0}; + openvdb::Index64 count{0}; }; // struct DescendOp @@ -142,9 +146,14 @@ TEST_F(TestNodeVisitor, testOriginArray) FloatGrid::Ptr grid = tools::createLevelSetCube(/*scale=*/10.0f); + Index64 totalNodeCount(0); +#if OPENVDB_ABI_VERSION_NUMBER >= 12 + std::vector nodeCount = grid->tree().nodeCount(); + for (Index64 count : nodeCount) totalNodeCount += count; +#else std::vector nodeCount = grid->tree().nodeCount(); - Index32 totalNodeCount(0); - for (Index32 count : nodeCount) totalNodeCount += count; + for (Index32 count : nodeCount) totalNodeCount += Index64(count); +#endif // use an offset size_t offset = 10; @@ -203,12 +212,12 @@ TEST_F(TestNodeVisitor, testPartialDeactivate) DeactivateOp deactivateOp; tools::DepthFirstNodeVisitor::visit(*iter, deactivateOp); - EXPECT_EQ(Index32(1413), grid->tree().leafCount()); + EXPECT_EQ(Index64(1413), grid->tree().leafCount()); tools::pruneInactive(grid->tree()); // a subset of the leaf nodes have now been deactivated and removed - EXPECT_EQ(Index32(1195), grid->tree().leafCount()); + EXPECT_EQ(Index64(1195), grid->tree().leafCount()); } diff --git a/openvdb/openvdb/unittest/TestPointAttribute.cc b/openvdb/openvdb/unittest/TestPointAttribute.cc index 19b66213b4..4fff63f23e 100644 --- a/openvdb/openvdb/unittest/TestPointAttribute.cc +++ b/openvdb/openvdb/unittest/TestPointAttribute.cc @@ -36,7 +36,7 @@ TEST_F(TestPointAttribute, testAppendDrop) PointDataTree& tree = grid->tree(); // check one leaf per point - EXPECT_EQ(tree.leafCount(), Index32(4)); + EXPECT_EQ(tree.leafCount(), Index64(4)); // retrieve first and last leaf attribute sets @@ -298,7 +298,7 @@ TEST_F(TestPointAttribute, testRename) PointDataTree& tree = grid->tree(); // check one leaf per point - EXPECT_EQ(tree.leafCount(), Index32(4)); + EXPECT_EQ(tree.leafCount(), Index64(4)); const openvdb::TypedMetadata defaultValue(5.0f); @@ -373,7 +373,7 @@ TEST_F(TestPointAttribute, testBloscCompress) PointDataTree& tree = grid->tree(); // check two leaves - EXPECT_EQ(tree.leafCount(), Index32(2)); + EXPECT_EQ(tree.leafCount(), Index64(2)); // retrieve first and last leaf attribute sets diff --git a/openvdb/openvdb/unittest/TestPointCount.cc b/openvdb/openvdb/unittest/TestPointCount.cc index 350aa888ae..58ea887907 100644 --- a/openvdb/openvdb/unittest/TestPointCount.cc +++ b/openvdb/openvdb/unittest/TestPointCount.cc @@ -186,7 +186,7 @@ TEST_F(TestPointCount, testGroup) PointDataTree& tree = grid->tree(); // check one leaf - EXPECT_EQ(tree.leafCount(), Index32(1)); + EXPECT_EQ(tree.leafCount(), Index64(1)); // retrieve first and last leaf attribute sets @@ -371,7 +371,7 @@ TEST_F(TestPointCount, testGroup) grid = createPointDataGrid(positions, *transform); PointDataTree& tree2 = grid->tree(); - EXPECT_EQ(tree2.leafCount(), Index32(4)); + EXPECT_EQ(tree2.leafCount(), Index64(4)); leafIter = tree2.beginLeaf(); diff --git a/openvdb/openvdb/unittest/TestPointDataLeaf.cc b/openvdb/openvdb/unittest/TestPointDataLeaf.cc index 70a37166c7..b22153e05a 100644 --- a/openvdb/openvdb/unittest/TestPointDataLeaf.cc +++ b/openvdb/openvdb/unittest/TestPointDataLeaf.cc @@ -1523,7 +1523,7 @@ TEST_F(TestPointDataLeaf, testCopyDescriptor) PointDataTree tree2(tree); - EXPECT_EQ(tree2.leafCount(), openvdb::Index32(2)); + EXPECT_EQ(tree2.leafCount(), openvdb::Index64(2)); descrA->setGroup("test", size_t(1)); diff --git a/openvdb/openvdb/unittest/TestPointGroup.cc b/openvdb/openvdb/unittest/TestPointGroup.cc index 04c2df33bb..8133956c2b 100644 --- a/openvdb/openvdb/unittest/TestPointGroup.cc +++ b/openvdb/openvdb/unittest/TestPointGroup.cc @@ -137,7 +137,7 @@ TEST_F(TestPointGroup, testAppendDrop) PointDataTree& tree = grid->tree(); // check one leaf per point - EXPECT_EQ(tree.leafCount(), Index32(4)); + EXPECT_EQ(tree.leafCount(), Index64(4)); // retrieve first and last leaf attribute sets @@ -312,7 +312,7 @@ TEST_F(TestPointGroup, testCompact) PointDataTree& tree = grid->tree(); // check one leaf - EXPECT_EQ(tree.leafCount(), Index32(1)); + EXPECT_EQ(tree.leafCount(), Index64(1)); // retrieve first and last leaf attribute sets diff --git a/openvdb/openvdb/unittest/TestPointMove.cc b/openvdb/openvdb/unittest/TestPointMove.cc index 3331fa2a27..cf165a9998 100644 --- a/openvdb/openvdb/unittest/TestPointMove.cc +++ b/openvdb/openvdb/unittest/TestPointMove.cc @@ -766,7 +766,7 @@ TEST_F(TestPointMove, testCustomDeformer) PointDataGrid::Ptr points = positionsToGrid(positions, voxelSize); PointDataGrid::Ptr cachedPoints = points->deepCopy(); - const int leafCount = points->tree().leafCount(); + const int leafCount = int(points->tree().leafCount()); const int pointCount = int(positions.size()); std::atomic resetCalls, applyCalls; diff --git a/openvdb/openvdb/unittest/TestPointRasterizeSDF.cc b/openvdb/openvdb/unittest/TestPointRasterizeSDF.cc index 9540f25a99..3af09c8288 100644 --- a/openvdb/openvdb/unittest/TestPointRasterizeSDF.cc +++ b/openvdb/openvdb/unittest/TestPointRasterizeSDF.cc @@ -135,7 +135,7 @@ TEST_F(TestPointRasterizeSDF, testRasterizeSpheres) EXPECT_EQ(GRID_LEVEL_SET, sdf->getGridClass()); EXPECT_EQ(float(s.halfband * s.points->voxelSize()[0]), sdf->background()); - EXPECT_EQ(Index32(8), sdf->tree().leafCount()); + EXPECT_EQ(Index64(8), sdf->tree().leafCount()); EXPECT_EQ(Index64(0), sdf->tree().activeTileCount()); EXPECT_EQ(Index64(485), sdf->tree().activeVoxelCount()); @@ -163,7 +163,7 @@ TEST_F(TestPointRasterizeSDF, testRasterizeSpheres) EXPECT_EQ(GRID_LEVEL_SET, sdf->getGridClass()); EXPECT_EQ(float(s.halfband * s.points->voxelSize()[0]), sdf->background()); - EXPECT_EQ(Index32(8), sdf->tree().leafCount()); + EXPECT_EQ(Index64(8), sdf->tree().leafCount()); EXPECT_EQ(Index64(0), sdf->tree().activeTileCount()); EXPECT_EQ(Index64(739), sdf->tree().activeVoxelCount()); @@ -192,7 +192,7 @@ TEST_F(TestPointRasterizeSDF, testRasterizeSpheres) EXPECT_EQ(GRID_LEVEL_SET, sdf->getGridClass()); EXPECT_EQ(float(s.halfband * s.transform->voxelSize()[0]), sdf->background()); - EXPECT_EQ(Index32(27), sdf->tree().leafCount()); + EXPECT_EQ(Index64(27), sdf->tree().leafCount()); EXPECT_EQ(Index64(0), sdf->tree().activeTileCount()); EXPECT_EQ(Index64(5005), sdf->tree().activeVoxelCount()); @@ -236,7 +236,7 @@ TEST_F(TestPointRasterizeSDF, testRasterizeSpheres) EXPECT_EQ(GRID_LEVEL_SET, sdf->getGridClass()); EXPECT_EQ(float(s.halfband * s.points->voxelSize()[0]), sdf->background()); - EXPECT_EQ(Index32(8), sdf->tree().leafCount()); + EXPECT_EQ(Index64(8), sdf->tree().leafCount()); EXPECT_EQ(Index64(0), sdf->tree().activeTileCount()); EXPECT_EQ(Index64(485), sdf->tree().activeVoxelCount()); @@ -265,7 +265,7 @@ TEST_F(TestPointRasterizeSDF, testRasterizeSpheres) EXPECT_EQ(GRID_LEVEL_SET, sdf->getGridClass()); EXPECT_EQ(float(s.halfband * s.points->voxelSize()[0]), sdf->background()); - EXPECT_EQ(Index32(38), sdf->tree().leafCount()); + EXPECT_EQ(Index64(38), sdf->tree().leafCount()); EXPECT_EQ(Index64(0), sdf->tree().activeTileCount()); EXPECT_EQ(Index64(485*8), sdf->tree().activeVoxelCount()); // 485 per sphere @@ -306,7 +306,7 @@ TEST_F(TestPointRasterizeSDF, testRasterizeSpheres) EXPECT_EQ(GRID_LEVEL_SET, sdf->getGridClass()); EXPECT_EQ(float(s.halfband * s.transform->voxelSize()[0]), sdf->background()); - EXPECT_EQ(Index32(46), sdf->tree().leafCount()); + EXPECT_EQ(Index64(46), sdf->tree().leafCount()); EXPECT_EQ(Index64(0), sdf->tree().activeTileCount()); EXPECT_EQ(Index64(7198), sdf->tree().activeVoxelCount()); @@ -359,7 +359,7 @@ TEST_F(TestPointRasterizeSDF, testRasterizeSpheres) EXPECT_EQ(GRID_LEVEL_SET, sdf->getGridClass()); EXPECT_EQ(float(s.halfband * s.points->voxelSize()[0]), sdf->background()); - EXPECT_EQ(Index32(17), sdf->tree().leafCount()); // less leaf nodes, active points are on a single face + EXPECT_EQ(Index64(17), sdf->tree().leafCount()); // less leaf nodes, active points are on a single face EXPECT_EQ(Index64(0), sdf->tree().activeTileCount()); EXPECT_EQ(Index64(485*4), sdf->tree().activeVoxelCount()); // 485 per sphere @@ -568,7 +568,7 @@ TEST_F(TestPointRasterizeSDF, testRasterizeVariableSpheres) EXPECT_EQ(GRID_LEVEL_SET, sdf->getGridClass()); EXPECT_EQ(float(s.halfband * s.points->voxelSize()[0]), sdf->background()); - EXPECT_EQ(Index32(8), sdf->tree().leafCount()); // less leaf nodes, active points are on a single face + EXPECT_EQ(Index64(8), sdf->tree().leafCount()); // less leaf nodes, active points are on a single face EXPECT_EQ(Index64(0), sdf->tree().activeTileCount()); EXPECT_EQ(Index64(1454), sdf->tree().activeVoxelCount()); // 485 per sphere @@ -732,7 +732,7 @@ TEST_F(TestPointRasterizeSDF, testRasterizeSmoothSpheres) EXPECT_EQ(GRID_LEVEL_SET, sdf->getGridClass()); EXPECT_EQ(float(s.halfband * s.points->voxelSize()[0]), sdf->background()); - EXPECT_EQ(Index32(44), sdf->tree().leafCount()); + EXPECT_EQ(Index64(44), sdf->tree().leafCount()); EXPECT_EQ(Index64(0), sdf->tree().activeTileCount()); EXPECT_EQ(Index64(6303), sdf->tree().activeVoxelCount()); const CoordBBox bounds(Coord(-7), Coord(7)); @@ -874,7 +874,7 @@ TEST_F(TestPointRasterizeSDF, testRasterizeVariableSmoothSpheres) EXPECT_TRUE(sdf->transform() == s.points->transform()); EXPECT_EQ(GRID_LEVEL_SET, sdf->getGridClass()); EXPECT_EQ(float(s.halfband * s.points->voxelSize()[0]), sdf->background()); - EXPECT_EQ(Index32(64), sdf->tree().leafCount()); + EXPECT_EQ(Index64(64), sdf->tree().leafCount()); EXPECT_EQ(Index64(0), sdf->tree().activeTileCount()); EXPECT_EQ(Index64(15011), sdf->tree().activeVoxelCount()); for (auto iter = sdf->cbeginValueOn(); iter; ++iter) { diff --git a/openvdb/openvdb/unittest/TestPointScatter.cc b/openvdb/openvdb/unittest/TestPointScatter.cc index ca8d92b070..58bf459ab6 100644 --- a/openvdb/openvdb/unittest/TestPointScatter.cc +++ b/openvdb/openvdb/unittest/TestPointScatter.cc @@ -36,7 +36,7 @@ TEST_F(TestPointScatter, testUniformPointScatter) BoolGrid grid; grid.sparseFill(boxBounds, false, /*active*/true); auto points = points::uniformPointScatter(grid, total); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(total, pointCount(points->tree())); } @@ -44,7 +44,7 @@ TEST_F(TestPointScatter, testUniformPointScatter) DoubleGrid grid; grid.sparseFill(boxBounds, 0.0, /*active*/true); auto points = points::uniformPointScatter(grid, total); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(total, pointCount(points->tree())); } @@ -52,7 +52,7 @@ TEST_F(TestPointScatter, testUniformPointScatter) FloatGrid grid; grid.sparseFill(boxBounds, 0.0f, /*active*/true); auto points = points::uniformPointScatter(grid, total); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(total, pointCount(points->tree())); } @@ -60,7 +60,7 @@ TEST_F(TestPointScatter, testUniformPointScatter) Int32Grid grid; grid.sparseFill(boxBounds, 0, /*active*/true); auto points = points::uniformPointScatter(grid, total); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(total, pointCount(points->tree())); } @@ -68,7 +68,7 @@ TEST_F(TestPointScatter, testUniformPointScatter) Int64Grid grid; grid.sparseFill(boxBounds, 0, /*active*/true); auto points = points::uniformPointScatter(grid, total); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(total, pointCount(points->tree())); } @@ -76,7 +76,7 @@ TEST_F(TestPointScatter, testUniformPointScatter) MaskGrid grid; grid.sparseFill(boxBounds, /*maskBuffer*/true); auto points = points::uniformPointScatter(grid, total); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(total, pointCount(points->tree())); } @@ -84,7 +84,7 @@ TEST_F(TestPointScatter, testUniformPointScatter) Vec3DGrid grid; grid.sparseFill(boxBounds, Vec3d(), /*active*/true); auto points = points::uniformPointScatter(grid, total); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(total, pointCount(points->tree())); } @@ -92,7 +92,7 @@ TEST_F(TestPointScatter, testUniformPointScatter) Vec3IGrid grid; grid.sparseFill(boxBounds, Vec3i(), /*active*/true); auto points = points::uniformPointScatter(grid, total); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(total, pointCount(points->tree())); } @@ -100,7 +100,7 @@ TEST_F(TestPointScatter, testUniformPointScatter) Vec3SGrid grid; grid.sparseFill(boxBounds, Vec3f(), /*active*/true); auto points = points::uniformPointScatter(grid, total); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(total, pointCount(points->tree())); } @@ -108,7 +108,7 @@ TEST_F(TestPointScatter, testUniformPointScatter) PointDataGrid grid; grid.sparseFill(boxBounds, 0, /*active*/true); auto points = points::uniformPointScatter(grid, total); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(total, pointCount(points->tree())); } @@ -128,7 +128,7 @@ TEST_F(TestPointScatter, testUniformPointScatter) BoolGrid grid; grid.sparseFill(boxBounds, false, /*active*/true); auto points = points::uniformPointScatter(grid, 1); - EXPECT_EQ(Index32(1), points->tree().leafCount()); + EXPECT_EQ(Index64(1), points->tree().leafCount()); EXPECT_EQ(Index64(1), points->activeVoxelCount()); EXPECT_EQ(Index64(1), pointCount(points->tree())); } @@ -145,7 +145,7 @@ TEST_F(TestPointScatter, testUniformPointScatter) auto points = points::uniformPointScatter(grid, total); EXPECT_EQ(Index64(0), points->tree().activeTileCount()); - EXPECT_EQ(Index32(1), points->tree().leafCount()); + EXPECT_EQ(Index64(1), points->tree().leafCount()); EXPECT_TRUE(Index64(NUM_VALUES) > points->tree().activeVoxelCount()); EXPECT_EQ(total, pointCount(points->tree())); @@ -226,7 +226,7 @@ TEST_F(TestPointScatter, testUniformPointScatter) points = points::uniformPointScatter(grid, total); - EXPECT_EQ(Index32(1), points->tree().leafCount()); + EXPECT_EQ(Index64(1), points->tree().leafCount()); EXPECT_TRUE(Index64(NUM_VALUES) > points->tree().activeVoxelCount()); EXPECT_EQ(total, pointCount(points->tree())); @@ -234,7 +234,7 @@ TEST_F(TestPointScatter, testUniformPointScatter) points = points::uniformPointScatter(grid, Index64(NUM_VALUES)); - EXPECT_EQ(Index32(1), points->tree().leafCount()); + EXPECT_EQ(Index64(1), points->tree().leafCount()); EXPECT_EQ(Index64(NUM_VALUES), points->activeVoxelCount()); EXPECT_EQ(Index64(NUM_VALUES), pointCount(points->tree())); @@ -262,7 +262,7 @@ TEST_F(TestPointScatter, testDenseUniformPointScatter) BoolGrid grid; grid.sparseFill(boxBounds, false, /*active*/true); auto points = points::denseUniformPointScatter(grid, pointsPerVoxel); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(Index64(pointsPerVoxel * 27), pointCount(points->tree())); } @@ -270,7 +270,7 @@ TEST_F(TestPointScatter, testDenseUniformPointScatter) DoubleGrid grid; grid.sparseFill(boxBounds, 0.0, /*active*/true); auto points = points::denseUniformPointScatter(grid, pointsPerVoxel); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(Index64(pointsPerVoxel * 27), pointCount(points->tree())); } @@ -278,7 +278,7 @@ TEST_F(TestPointScatter, testDenseUniformPointScatter) FloatGrid grid; grid.sparseFill(boxBounds, 0.0f, /*active*/true); auto points = points::denseUniformPointScatter(grid, pointsPerVoxel); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(Index64(pointsPerVoxel * 27), pointCount(points->tree())); } @@ -286,7 +286,7 @@ TEST_F(TestPointScatter, testDenseUniformPointScatter) Int32Grid grid; grid.sparseFill(boxBounds, 0, /*active*/true); auto points = points::denseUniformPointScatter(grid, pointsPerVoxel); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(Index64(pointsPerVoxel * 27), pointCount(points->tree())); } @@ -294,7 +294,7 @@ TEST_F(TestPointScatter, testDenseUniformPointScatter) Int64Grid grid; grid.sparseFill(boxBounds, 0, /*active*/true); auto points = points::denseUniformPointScatter(grid, pointsPerVoxel); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(Index64(pointsPerVoxel * 27), pointCount(points->tree())); } @@ -302,7 +302,7 @@ TEST_F(TestPointScatter, testDenseUniformPointScatter) MaskGrid grid; grid.sparseFill(boxBounds, /*maskBuffer*/true); auto points = points::denseUniformPointScatter(grid, pointsPerVoxel); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(Index64(pointsPerVoxel * 27), pointCount(points->tree())); } @@ -310,7 +310,7 @@ TEST_F(TestPointScatter, testDenseUniformPointScatter) Vec3DGrid grid; grid.sparseFill(boxBounds, Vec3d(), /*active*/true); auto points = points::denseUniformPointScatter(grid, pointsPerVoxel); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(Index64(pointsPerVoxel * 27), pointCount(points->tree())); } @@ -318,7 +318,7 @@ TEST_F(TestPointScatter, testDenseUniformPointScatter) Vec3IGrid grid; grid.sparseFill(boxBounds, Vec3i(), /*active*/true); auto points = points::denseUniformPointScatter(grid, pointsPerVoxel); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(Index64(pointsPerVoxel * 27), pointCount(points->tree())); } @@ -326,7 +326,7 @@ TEST_F(TestPointScatter, testDenseUniformPointScatter) Vec3SGrid grid; grid.sparseFill(boxBounds, Vec3f(), /*active*/true); auto points = points::denseUniformPointScatter(grid, pointsPerVoxel); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(Index64(pointsPerVoxel * 27), pointCount(points->tree())); } @@ -334,7 +334,7 @@ TEST_F(TestPointScatter, testDenseUniformPointScatter) PointDataGrid grid; grid.sparseFill(boxBounds, 0, /*active*/true); auto points = points::denseUniformPointScatter(grid, pointsPerVoxel); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(Index64(pointsPerVoxel * 27), pointCount(points->tree())); } @@ -354,7 +354,7 @@ TEST_F(TestPointScatter, testDenseUniformPointScatter) BoolGrid grid; grid.sparseFill(boxBounds, false, /*active*/true); auto points = points::denseUniformPointScatter(grid, 0.8f); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); // Note that a value of 22 is precomputed as the number of active // voxels/points produced by a value of 0.8 EXPECT_EQ(Index64(22), points->activeVoxelCount()); @@ -373,7 +373,7 @@ TEST_F(TestPointScatter, testDenseUniformPointScatter) const Index32 NUM_VALUES = BoolGrid::TreeType::LeafNodeType::NUM_VALUES; - EXPECT_EQ(Index32(1), grid.tree().leafCount()); + EXPECT_EQ(Index64(1), grid.tree().leafCount()); EXPECT_EQ(Index64(NUM_VALUES + 1), grid.activeVoxelCount()); auto points = points::denseUniformPointScatter(grid, pointsPerVoxel); @@ -381,7 +381,7 @@ TEST_F(TestPointScatter, testDenseUniformPointScatter) const Index64 expectedCount = Index64(pointsPerVoxel * (NUM_VALUES + 1)); EXPECT_EQ(Index64(0), points->tree().activeTileCount()); - EXPECT_EQ(Index32(2), points->tree().leafCount()); + EXPECT_EQ(Index64(2), points->tree().leafCount()); EXPECT_EQ(Index64(NUM_VALUES + 1), points->activeVoxelCount()); EXPECT_EQ(expectedCount, pointCount(points->tree())); @@ -462,7 +462,7 @@ TEST_F(TestPointScatter, testDenseUniformPointScatter) points = points::denseUniformPointScatter(grid, pointsPerVoxel); - EXPECT_EQ(Index32(2), points->tree().leafCount()); + EXPECT_EQ(Index64(2), points->tree().leafCount()); EXPECT_EQ(Index64(NUM_VALUES + 1), points->activeVoxelCount()); EXPECT_EQ(expectedCount, pointCount(points->tree())); } @@ -480,7 +480,7 @@ TEST_F(TestPointScatter, testNonUniformPointScatter) grid.sparseFill(totalBoxBounds, false, /*active*/true); grid.sparseFill(activeBoxBounds, true, /*active*/true); auto points = points::nonUniformPointScatter(grid, pointsPerVoxel); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(Index64(pointsPerVoxel * 27), pointCount(points->tree())); } @@ -489,7 +489,7 @@ TEST_F(TestPointScatter, testNonUniformPointScatter) grid.sparseFill(totalBoxBounds, 0.0, /*active*/true); grid.sparseFill(activeBoxBounds, 1.0, /*active*/true); auto points = points::nonUniformPointScatter(grid, pointsPerVoxel); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(Index64(pointsPerVoxel * 27), pointCount(points->tree())); } @@ -498,7 +498,7 @@ TEST_F(TestPointScatter, testNonUniformPointScatter) grid.sparseFill(totalBoxBounds, 0.0f, /*active*/true); grid.sparseFill(activeBoxBounds, 1.0f, /*active*/true); auto points = points::nonUniformPointScatter(grid, pointsPerVoxel); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(Index64(pointsPerVoxel * 27), pointCount(points->tree())); } @@ -507,7 +507,7 @@ TEST_F(TestPointScatter, testNonUniformPointScatter) grid.sparseFill(totalBoxBounds, 0, /*active*/true); grid.sparseFill(activeBoxBounds, 1, /*active*/true); auto points = points::nonUniformPointScatter(grid, pointsPerVoxel); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(Index64(pointsPerVoxel * 27), pointCount(points->tree())); } @@ -516,7 +516,7 @@ TEST_F(TestPointScatter, testNonUniformPointScatter) grid.sparseFill(totalBoxBounds, 0, /*active*/true); grid.sparseFill(activeBoxBounds, 1, /*active*/true); auto points = points::nonUniformPointScatter(grid, pointsPerVoxel); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(Index64(pointsPerVoxel * 27), pointCount(points->tree())); } @@ -525,7 +525,7 @@ TEST_F(TestPointScatter, testNonUniformPointScatter) grid.sparseFill(totalBoxBounds, /*maskBuffer*/0); grid.sparseFill(activeBoxBounds, /*maskBuffer*/1); auto points = points::nonUniformPointScatter(grid, pointsPerVoxel); - EXPECT_EQ(Index32(8), points->tree().leafCount()); + EXPECT_EQ(Index64(8), points->tree().leafCount()); EXPECT_EQ(Index64(27), points->activeVoxelCount()); EXPECT_EQ(Index64(pointsPerVoxel * 27), pointCount(points->tree())); } @@ -543,7 +543,7 @@ TEST_F(TestPointScatter, testNonUniformPointScatter) const Index32 NUM_VALUES = BoolGrid::TreeType::LeafNodeType::NUM_VALUES; - EXPECT_EQ(Index32(1), grid.tree().leafCount()); + EXPECT_EQ(Index64(1), grid.tree().leafCount()); EXPECT_EQ(Index64(NUM_VALUES + 1), grid.activeVoxelCount()); auto points = points::nonUniformPointScatter(grid, pointsPerVoxel); @@ -551,7 +551,7 @@ TEST_F(TestPointScatter, testNonUniformPointScatter) const Index64 expectedCount = Index64(pointsPerVoxel * (NUM_VALUES + 1)); EXPECT_EQ(Index64(0), points->tree().activeTileCount()); - EXPECT_EQ(Index32(2), points->tree().leafCount()); + EXPECT_EQ(Index64(2), points->tree().leafCount()); EXPECT_EQ(Index64(NUM_VALUES + 1), points->activeVoxelCount()); EXPECT_EQ(expectedCount, pointCount(points->tree())); @@ -637,7 +637,7 @@ TEST_F(TestPointScatter, testNonUniformPointScatter) points = points::nonUniformPointScatter(countGrid, pointsPerVoxel); - EXPECT_EQ(Index32(1), points->tree().leafCount()); + EXPECT_EQ(Index64(1), points->tree().leafCount()); EXPECT_EQ(Index64(7), points->activeVoxelCount()); EXPECT_EQ(Index64(pointsPerVoxel * 28), pointCount(points->tree())); @@ -656,7 +656,7 @@ TEST_F(TestPointScatter, testNonUniformPointScatter) points = points::nonUniformPointScatter(grid, pointsPerVoxel); - EXPECT_EQ(Index32(2), points->tree().leafCount()); + EXPECT_EQ(Index64(2), points->tree().leafCount()); EXPECT_EQ(Index64(NUM_VALUES + 1), points->activeVoxelCount()); EXPECT_EQ(expectedCount, pointCount(points->tree())); } diff --git a/openvdb/openvdb/unittest/TestTools.cc b/openvdb/openvdb/unittest/TestTools.cc index d8780dba1c..df17050a06 100644 --- a/openvdb/openvdb/unittest/TestTools.cc +++ b/openvdb/openvdb/unittest/TestTools.cc @@ -1706,8 +1706,8 @@ TEST_F(TestTools, testPrune) const float value = 5.345f; FloatTree tree(value); - EXPECT_EQ(Index32(0), tree.leafCount()); - EXPECT_EQ(Index32(1), tree.nonLeafCount()); // root node + EXPECT_EQ(Index64(0), tree.leafCount()); + EXPECT_EQ(Index64(1), tree.nonLeafCount()); // root node EXPECT_TRUE(tree.empty()); tree.fill(CoordBBox(Coord(-10), Coord(10)), value, /*active=*/false); @@ -1715,8 +1715,8 @@ TEST_F(TestTools, testPrune) tools::prune(tree); - EXPECT_EQ(Index32(0), tree.leafCount()); - EXPECT_EQ(Index32(1), tree.nonLeafCount()); // root node + EXPECT_EQ(Index64(0), tree.leafCount()); + EXPECT_EQ(Index64(1), tree.nonLeafCount()); // root node EXPECT_TRUE(tree.empty()); } @@ -1738,18 +1738,18 @@ TEST_F(TestTools, testPrune) FloatTree tree(val); tree.addLeaf(leaf); - EXPECT_EQ(Index32(1), tree.leafCount()); - EXPECT_EQ(Index32(3), tree.nonLeafCount()); // root+2*internal + EXPECT_EQ(Index64(1), tree.leafCount()); + EXPECT_EQ(Index64(3), tree.nonLeafCount()); // root+2*internal tools::prune(tree);// tolerance is zero - EXPECT_EQ(Index32(1), tree.leafCount()); - EXPECT_EQ(Index32(3), tree.nonLeafCount()); // root+2*internal + EXPECT_EQ(Index64(1), tree.leafCount()); + EXPECT_EQ(Index64(3), tree.nonLeafCount()); // root+2*internal tools::prune(tree, tol); - EXPECT_EQ(Index32(0), tree.leafCount()); - EXPECT_EQ(Index32(3), tree.nonLeafCount()); // root+2*internal + EXPECT_EQ(Index64(0), tree.leafCount()); + EXPECT_EQ(Index64(3), tree.nonLeafCount()); // root+2*internal std::sort(data.begin(), data.end()); const float median = data[(LeafNodeT::NUM_VALUES-1)>>1]; @@ -1764,7 +1764,7 @@ TEST_F(TestTools, testPrune) io::File sourceFile("/usr/pic1/Data/OpenVDB/LevelSetModels/crawler.vdb"); sourceFile.open(false);//disable delayed loading FloatGrid::Ptr grid = gridPtrCast(sourceFile.getGrids()->at(0)); - const Index32 leafCount = grid->tree().leafCount(); + const Index64 leafCount = grid->tree().leafCount(); timer.start("\nSerial tolerance prune"); grid->tree().prune(); @@ -1777,7 +1777,7 @@ TEST_F(TestTools, testPrune) io::File sourceFile("/usr/pic1/Data/OpenVDB/LevelSetModels/crawler.vdb"); sourceFile.open(false);//disable delayed loading FloatGrid::Ptr grid = gridPtrCast(sourceFile.getGrids()->at(0)); - const Index32 leafCount = grid->tree().leafCount(); + const Index64 leafCount = grid->tree().leafCount(); timer.start("\nParallel tolerance prune"); tools::prune(grid->tree()); diff --git a/openvdb/openvdb/unittest/TestTree.cc b/openvdb/openvdb/unittest/TestTree.cc index e1aebcdc58..a5ac2afade 100644 --- a/openvdb/openvdb/unittest/TestTree.cc +++ b/openvdb/openvdb/unittest/TestTree.cc @@ -1343,15 +1343,15 @@ TEST_F(TestTree, testTopologyUnion) tree0.addTile(1, xyz, true, true); // leaf level tile tree1.touchLeaf(xyz)->setValueOn(0); // single leaf tree0.topologyUnion(tree1, true); // single tile - EXPECT_EQ(openvdb::Index32(0), tree0.leafCount()); - EXPECT_EQ(openvdb::Index32(3), tree0.nonLeafCount()); + EXPECT_EQ(openvdb::Index64(0), tree0.leafCount()); + EXPECT_EQ(openvdb::Index64(3), tree0.nonLeafCount()); EXPECT_EQ(openvdb::Index64(1), tree0.activeTileCount()); EXPECT_EQ(openvdb::Index64(LeafT::NUM_VOXELS), tree0.activeVoxelCount()); tree1.addTile(1, xyz + openvdb::Coord(8), true, true); // leaf + tile tree0.topologyUnion(tree1, true); // two tiles - EXPECT_EQ(openvdb::Index32(0), tree0.leafCount()); - EXPECT_EQ(openvdb::Index32(3), tree0.nonLeafCount()); + EXPECT_EQ(openvdb::Index64(0), tree0.leafCount()); + EXPECT_EQ(openvdb::Index64(3), tree0.nonLeafCount()); EXPECT_EQ(openvdb::Index64(2), tree0.activeTileCount()); EXPECT_EQ(openvdb::Index64(LeafT::NUM_VOXELS*2), tree0.activeVoxelCount()); @@ -1359,8 +1359,8 @@ TEST_F(TestTree, testTopologyUnion) tree0.clear(); tree0.addTile(2, xyz, true, true); tree0.topologyUnion(tree1, true); // all topology in tree1 is already active. no change - EXPECT_EQ(openvdb::Index32(0), tree0.leafCount()); - EXPECT_EQ(openvdb::Index32(2), tree0.nonLeafCount()); + EXPECT_EQ(openvdb::Index64(0), tree0.leafCount()); + EXPECT_EQ(openvdb::Index64(2), tree0.nonLeafCount()); EXPECT_EQ(openvdb::Index64(1), tree0.activeTileCount()); EXPECT_EQ(openvdb::Index64(InternalT1::NUM_VOXELS), tree0.activeVoxelCount()); @@ -1368,8 +1368,8 @@ TEST_F(TestTree, testTopologyUnion) tree0.clear(); tree0.addTile(3, xyz, true, true); tree0.topologyUnion(tree1, true); - EXPECT_EQ(openvdb::Index32(0), tree0.leafCount()); - EXPECT_EQ(openvdb::Index32(1), tree0.nonLeafCount()); + EXPECT_EQ(openvdb::Index64(0), tree0.leafCount()); + EXPECT_EQ(openvdb::Index64(1), tree0.nonLeafCount()); EXPECT_EQ(openvdb::Index64(1), tree0.activeTileCount()); EXPECT_EQ(openvdb::Index64(InternalT2::NUM_VOXELS), tree0.activeVoxelCount()); @@ -1379,8 +1379,8 @@ TEST_F(TestTree, testTopologyUnion) tree0.addTile(1, xyz, true, true); tree1.addTile(2, xyz, true, true); tree0.topologyUnion(tree1, true); - EXPECT_EQ(openvdb::Index32(0), tree0.leafCount()); - EXPECT_EQ(openvdb::Index32(3), tree0.nonLeafCount()); + EXPECT_EQ(openvdb::Index64(0), tree0.leafCount()); + EXPECT_EQ(openvdb::Index64(3), tree0.nonLeafCount()); openvdb::Index64 tiles = openvdb::Index64(InternalT1::DIM) / InternalT1::getChildDim(); tiles = tiles * tiles * tiles; EXPECT_EQ(tiles, tree0.activeTileCount()); @@ -1429,22 +1429,22 @@ TEST_F(TestTree, testTopologyIntersection) tree0.setValue(openvdb::Coord( 400, 30, 20), 2.0f); tree0.setValue(openvdb::Coord( 8, 11, 11), 3.0f); EXPECT_EQ(openvdb::Index64(3), tree0.activeVoxelCount()); - EXPECT_EQ(openvdb::Index32(3), tree0.leafCount() ); + EXPECT_EQ(openvdb::Index64(3), tree0.leafCount() ); tree1.setValue(openvdb::Coord( 500, 301, 200), 4.0f); tree1.setValue(openvdb::Coord( 400, 30, 20), 5.0f); tree1.setValue(openvdb::Coord( 8, 11, 11), 6.0f); EXPECT_EQ(openvdb::Index64(3), tree1.activeVoxelCount()); - EXPECT_EQ(openvdb::Index32(3), tree1.leafCount() ); + EXPECT_EQ(openvdb::Index64(3), tree1.leafCount() ); tree1.topologyIntersection(tree0); - EXPECT_EQ( openvdb::Index32(3), tree1.leafCount() ); + EXPECT_EQ( openvdb::Index64(3), tree1.leafCount() ); EXPECT_EQ( openvdb::Index64(2), tree1.activeVoxelCount() ); EXPECT_TRUE(!tree1.empty()); openvdb::tools::pruneInactive(tree1); EXPECT_TRUE(!tree1.empty()); - EXPECT_EQ( openvdb::Index32(2), tree1.leafCount() ); + EXPECT_EQ( openvdb::Index64(2), tree1.leafCount() ); EXPECT_EQ( openvdb::Index64(2), tree1.activeVoxelCount() ); } {//passive tile @@ -1453,17 +1453,17 @@ TEST_F(TestTree, testTopologyIntersection) openvdb::FloatTree tree0(background), tree1(background); tree0.fill(openvdb::CoordBBox(openvdb::Coord(0),openvdb::Coord(dim-1)),2.0f, false); EXPECT_EQ(openvdb::Index64(0), tree0.activeVoxelCount()); - EXPECT_EQ(openvdb::Index32(0), tree0.leafCount() ); + EXPECT_EQ(openvdb::Index64(0), tree0.leafCount() ); tree1.setValue(openvdb::Coord( 500, 301, 200), 4.0f); tree1.setValue(openvdb::Coord( 400, 30, 20), 5.0f); tree1.setValue(openvdb::Coord( dim, 11, 11), 6.0f); - EXPECT_EQ(openvdb::Index32(3), tree1.leafCount() ); + EXPECT_EQ(openvdb::Index64(3), tree1.leafCount() ); EXPECT_EQ(openvdb::Index64(3), tree1.activeVoxelCount()); tree1.topologyIntersection(tree0); - EXPECT_EQ( openvdb::Index32(0), tree1.leafCount() ); + EXPECT_EQ( openvdb::Index64(0), tree1.leafCount() ); EXPECT_EQ( openvdb::Index64(0), tree1.activeVoxelCount() ); EXPECT_TRUE(tree1.empty()); } @@ -1473,17 +1473,17 @@ TEST_F(TestTree, testTopologyIntersection) openvdb::FloatTree tree0(background), tree1(background); tree1.fill(openvdb::CoordBBox(openvdb::Coord(0),openvdb::Coord(dim-1)),2.0f, true); EXPECT_EQ(dim*dim*dim, tree1.activeVoxelCount()); - EXPECT_EQ(openvdb::Index32(0), tree1.leafCount() ); + EXPECT_EQ(openvdb::Index64(0), tree1.leafCount() ); tree0.setValue(openvdb::Coord( 500, 301, 200), 4.0f); tree0.setValue(openvdb::Coord( 400, 30, 20), 5.0f); tree0.setValue(openvdb::Coord( dim, 11, 11), 6.0f); EXPECT_EQ(openvdb::Index64(3), tree0.activeVoxelCount()); - EXPECT_EQ(openvdb::Index32(3), tree0.leafCount() ); + EXPECT_EQ(openvdb::Index64(3), tree0.leafCount() ); tree1.topologyIntersection(tree0); - EXPECT_EQ( openvdb::Index32(2), tree1.leafCount() ); + EXPECT_EQ( openvdb::Index64(2), tree1.leafCount() ); EXPECT_EQ( openvdb::Index64(2), tree1.activeVoxelCount() ); EXPECT_TRUE(!tree1.empty()); openvdb::tools::pruneInactive(tree1); @@ -1522,10 +1522,10 @@ TEST_F(TestTree, testTopologyIntersection) tree3.setValue(iter.getCoord(), vec_val); } - EXPECT_EQ(openvdb::Index32(4), tree0.leafCount()); - EXPECT_EQ(openvdb::Index32(4), tree1.leafCount()); - EXPECT_EQ(openvdb::Index32(7), tree2.leafCount()); - EXPECT_EQ(openvdb::Index32(7), tree3.leafCount()); + EXPECT_EQ(openvdb::Index64(4), tree0.leafCount()); + EXPECT_EQ(openvdb::Index64(4), tree1.leafCount()); + EXPECT_EQ(openvdb::Index64(7), tree2.leafCount()); + EXPECT_EQ(openvdb::Index64(7), tree3.leafCount()); //tree1.topologyInterection(tree2);//should make tree1 = tree0 @@ -1673,22 +1673,22 @@ TEST_F(TestTree, testTopologyDifference) tree0.setValue(openvdb::Coord( 400, 30, 20), 2.0f); tree0.setValue(openvdb::Coord( 8, 11, 11), 3.0f); EXPECT_EQ(openvdb::Index64(3), tree0.activeVoxelCount()); - EXPECT_EQ(openvdb::Index32(3), tree0.leafCount() ); + EXPECT_EQ(openvdb::Index64(3), tree0.leafCount() ); tree1.setValue(openvdb::Coord( 500, 301, 200), 4.0f); tree1.setValue(openvdb::Coord( 400, 30, 20), 5.0f); tree1.setValue(openvdb::Coord( 8, 11, 11), 6.0f); EXPECT_EQ(openvdb::Index64(3), tree1.activeVoxelCount()); - EXPECT_EQ(openvdb::Index32(3), tree1.leafCount() ); + EXPECT_EQ(openvdb::Index64(3), tree1.leafCount() ); tree1.topologyDifference(tree0); - EXPECT_EQ( openvdb::Index32(3), tree1.leafCount() ); + EXPECT_EQ( openvdb::Index64(3), tree1.leafCount() ); EXPECT_EQ( openvdb::Index64(1), tree1.activeVoxelCount() ); EXPECT_TRUE(!tree1.empty()); openvdb::tools::pruneInactive(tree1); EXPECT_TRUE(!tree1.empty()); - EXPECT_EQ( openvdb::Index32(1), tree1.leafCount() ); + EXPECT_EQ( openvdb::Index64(1), tree1.leafCount() ); EXPECT_EQ( openvdb::Index64(1), tree1.activeVoxelCount() ); } {//passive tile @@ -1699,22 +1699,22 @@ TEST_F(TestTree, testTopologyDifference) EXPECT_EQ(openvdb::Index64(0), tree0.activeVoxelCount()); EXPECT_TRUE(!tree0.hasActiveTiles()); EXPECT_EQ(openvdb::Index64(0), tree0.root().onTileCount()); - EXPECT_EQ(openvdb::Index32(0), tree0.leafCount() ); + EXPECT_EQ(openvdb::Index64(0), tree0.leafCount() ); tree1.setValue(openvdb::Coord( 500, 301, 200), 4.0f); tree1.setValue(openvdb::Coord( 400, 30, 20), 5.0f); tree1.setValue(openvdb::Coord( dim, 11, 11), 6.0f); EXPECT_EQ(openvdb::Index64(3), tree1.activeVoxelCount()); EXPECT_TRUE(!tree1.hasActiveTiles()); - EXPECT_EQ(openvdb::Index32(3), tree1.leafCount() ); + EXPECT_EQ(openvdb::Index64(3), tree1.leafCount() ); tree1.topologyDifference(tree0); - EXPECT_EQ( openvdb::Index32(3), tree1.leafCount() ); + EXPECT_EQ( openvdb::Index64(3), tree1.leafCount() ); EXPECT_EQ( openvdb::Index64(3), tree1.activeVoxelCount() ); EXPECT_TRUE(!tree1.empty()); openvdb::tools::pruneInactive(tree1); - EXPECT_EQ( openvdb::Index32(3), tree1.leafCount() ); + EXPECT_EQ( openvdb::Index64(3), tree1.leafCount() ); EXPECT_EQ( openvdb::Index64(3), tree1.activeVoxelCount() ); EXPECT_TRUE(!tree1.empty()); } @@ -1726,14 +1726,14 @@ TEST_F(TestTree, testTopologyDifference) EXPECT_EQ(dim*dim*dim, tree1.activeVoxelCount()); EXPECT_TRUE(tree1.hasActiveTiles()); EXPECT_EQ(openvdb::Index64(1), tree1.root().onTileCount()); - EXPECT_EQ(openvdb::Index32(0), tree0.leafCount() ); + EXPECT_EQ(openvdb::Index64(0), tree0.leafCount() ); tree0.setValue(openvdb::Coord( 500, 301, 200), 4.0f); tree0.setValue(openvdb::Coord( 400, 30, 20), 5.0f); tree0.setValue(openvdb::Coord( int(dim), 11, 11), 6.0f); EXPECT_TRUE(!tree0.hasActiveTiles()); EXPECT_EQ(openvdb::Index64(3), tree0.activeVoxelCount()); - EXPECT_EQ(openvdb::Index32(3), tree0.leafCount() ); + EXPECT_EQ(openvdb::Index64(3), tree0.leafCount() ); EXPECT_TRUE( tree0.isValueOn(openvdb::Coord( int(dim), 11, 11))); EXPECT_TRUE(!tree1.isValueOn(openvdb::Coord( int(dim), 11, 11))); @@ -1754,22 +1754,22 @@ TEST_F(TestTree, testTopologyDifference) EXPECT_EQ(dim*dim*dim, tree1.activeVoxelCount()); EXPECT_TRUE(tree1.hasActiveTiles()); EXPECT_EQ(openvdb::Index64(1), tree1.root().onTileCount()); - EXPECT_EQ(openvdb::Index32(0), tree0.leafCount() ); + EXPECT_EQ(openvdb::Index64(0), tree0.leafCount() ); tree0.setValue(openvdb::Coord( 500, 301, 200), 4.0f); tree0.setValue(openvdb::Coord( 400, 30, 20), 5.0f); tree0.setValue(openvdb::Coord( dim, 11, 11), 6.0f); EXPECT_TRUE(!tree0.hasActiveTiles()); EXPECT_EQ(openvdb::Index64(3), tree0.activeVoxelCount()); - EXPECT_EQ(openvdb::Index32(3), tree0.leafCount() ); + EXPECT_EQ(openvdb::Index64(3), tree0.leafCount() ); tree0.topologyDifference(tree1); - EXPECT_EQ( openvdb::Index32(1), tree0.leafCount() ); + EXPECT_EQ( openvdb::Index64(1), tree0.leafCount() ); EXPECT_EQ( openvdb::Index64(1), tree0.activeVoxelCount() ); EXPECT_TRUE(!tree0.empty()); openvdb::tools::pruneInactive(tree0); - EXPECT_EQ( openvdb::Index32(1), tree0.leafCount() ); + EXPECT_EQ( openvdb::Index64(1), tree0.leafCount() ); EXPECT_EQ( openvdb::Index64(1), tree0.activeVoxelCount() ); EXPECT_TRUE(!tree1.empty()); } @@ -1806,10 +1806,10 @@ TEST_F(TestTree, testTopologyDifference) tree3.setValue(iter.getCoord(), vec_val); } - EXPECT_EQ(openvdb::Index32(4), tree0.leafCount()); - EXPECT_EQ(openvdb::Index32(4), tree1.leafCount()); - EXPECT_EQ(openvdb::Index32(7), tree2.leafCount()); - EXPECT_EQ(openvdb::Index32(7), tree3.leafCount()); + EXPECT_EQ(openvdb::Index64(4), tree0.leafCount()); + EXPECT_EQ(openvdb::Index64(4), tree1.leafCount()); + EXPECT_EQ(openvdb::Index64(7), tree2.leafCount()); + EXPECT_EQ(openvdb::Index64(7), tree3.leafCount()); //tree1.topologyInterection(tree2);//should make tree1 = tree0 @@ -2094,16 +2094,16 @@ TEST_F(TestTree, testPruneInactive) tree.setValue(Coord( 5, 10,-20), 0.3f); // Verify that the tree has the expected numbers of active voxels and leaf nodes. EXPECT_EQ(Index64(8), tree.activeVoxelCount()); - EXPECT_EQ(Index32(8), tree.leafCount()); + EXPECT_EQ(Index64(8), tree.leafCount()); // Verify that prune() has no effect, since the values are all different. openvdb::tools::prune(tree); EXPECT_EQ(Index64(8), tree.activeVoxelCount()); - EXPECT_EQ(Index32(8), tree.leafCount()); + EXPECT_EQ(Index64(8), tree.leafCount()); // Verify that pruneInactive() has no effect, since the values are active. openvdb::tools::pruneInactive(tree); EXPECT_EQ(Index64(8), tree.activeVoxelCount()); - EXPECT_EQ(Index32(8), tree.leafCount()); + EXPECT_EQ(Index64(8), tree.leafCount()); // Make some of the active values inactive, without changing their values. tree.setValueOff(Coord(-5, 10, 20)); @@ -2111,15 +2111,15 @@ TEST_F(TestTree, testPruneInactive) tree.setValueOff(Coord(-5, 10,-20)); tree.setValueOff(Coord(-5,-10,-20)); EXPECT_EQ(Index64(4), tree.activeVoxelCount()); - EXPECT_EQ(Index32(8), tree.leafCount()); + EXPECT_EQ(Index64(8), tree.leafCount()); // Verify that prune() has no effect, since the values are still different. openvdb::tools::prune(tree); EXPECT_EQ(Index64(4), tree.activeVoxelCount()); - EXPECT_EQ(Index32(8), tree.leafCount()); + EXPECT_EQ(Index64(8), tree.leafCount()); // Verify that pruneInactive() prunes the nodes containing only inactive voxels. openvdb::tools::pruneInactive(tree); EXPECT_EQ(Index64(4), tree.activeVoxelCount()); - EXPECT_EQ(Index32(4), tree.leafCount()); + EXPECT_EQ(Index64(4), tree.leafCount()); // Make all of the active values inactive, without changing their values. tree.setValueOff(Coord( 5, 10, 20)); @@ -2127,11 +2127,11 @@ TEST_F(TestTree, testPruneInactive) tree.setValueOff(Coord( 5,-10,-20)); tree.setValueOff(Coord( 5, 10,-20)); EXPECT_EQ(Index64(0), tree.activeVoxelCount()); - EXPECT_EQ(Index32(4), tree.leafCount()); + EXPECT_EQ(Index64(4), tree.leafCount()); // Verify that prune() has no effect, since the values are still different. openvdb::tools::prune(tree); EXPECT_EQ(Index64(0), tree.activeVoxelCount()); - EXPECT_EQ(Index32(4), tree.leafCount()); + EXPECT_EQ(Index64(4), tree.leafCount()); // Verify that pruneInactive() prunes all of the remaining leaf nodes. openvdb::tools::pruneInactive(tree); EXPECT_TRUE(tree.empty()); @@ -2158,7 +2158,7 @@ TEST_F(TestTree, testPruneLevelSet) } } - const openvdb::Index32 leafCount = tree.leafCount(); + const openvdb::Index64 leafCount = tree.leafCount(); EXPECT_EQ(tree.activeVoxelCount(), count); EXPECT_EQ(tree.activeLeafVoxelCount(), count); @@ -2646,6 +2646,7 @@ TEST_F(TestTree, testStealNodes) TEST_F(TestTree, testStealNode) { using openvdb::Index; + using openvdb::Index64; using openvdb::FloatTree; const float background=0.0f, value = 5.6f, epsilon=0.000001f; @@ -2656,19 +2657,19 @@ TEST_F(TestTree, testStealNode) EXPECT_EQ(Index(0), NodeT::getLevel()); FloatTree tree(background); - EXPECT_EQ(Index(0), tree.leafCount()); + EXPECT_EQ(Index64(0), tree.leafCount()); EXPECT_TRUE(!tree.isValueOn(xyz)); EXPECT_NEAR(background, tree.getValue(xyz), epsilon); EXPECT_TRUE(tree.root().stealNode(xyz, value, false) == nullptr); tree.setValue(xyz, value); - EXPECT_EQ(Index(1), tree.leafCount()); + EXPECT_EQ(Index64(1), tree.leafCount()); EXPECT_TRUE(tree.isValueOn(xyz)); EXPECT_NEAR(value, tree.getValue(xyz), epsilon); NodeT* node = tree.root().stealNode(xyz, background, false); EXPECT_TRUE(node != nullptr); - EXPECT_EQ(Index(0), tree.leafCount()); + EXPECT_EQ(Index64(0), tree.leafCount()); EXPECT_TRUE(!tree.isValueOn(xyz)); EXPECT_NEAR(background, tree.getValue(xyz), epsilon); EXPECT_TRUE(tree.root().stealNode(xyz, value, false) == nullptr); @@ -2681,19 +2682,19 @@ TEST_F(TestTree, testStealNode) EXPECT_EQ(Index(1), NodeT::getLevel()); FloatTree tree(background); - EXPECT_EQ(Index(0), tree.leafCount()); + EXPECT_EQ(Index64(0), tree.leafCount()); EXPECT_TRUE(!tree.isValueOn(xyz)); EXPECT_NEAR(background, tree.getValue(xyz), epsilon); EXPECT_TRUE(tree.root().stealNode(xyz, value, false) == nullptr); tree.setValue(xyz, value); - EXPECT_EQ(Index(1), tree.leafCount()); + EXPECT_EQ(Index64(1), tree.leafCount()); EXPECT_TRUE(tree.isValueOn(xyz)); EXPECT_NEAR(value, tree.getValue(xyz), epsilon); NodeT* node = tree.root().stealNode(xyz, background, false); EXPECT_TRUE(node != nullptr); - EXPECT_EQ(Index(0), tree.leafCount()); + EXPECT_EQ(Index64(0), tree.leafCount()); EXPECT_TRUE(!tree.isValueOn(xyz)); EXPECT_NEAR(background, tree.getValue(xyz), epsilon); EXPECT_TRUE(tree.root().stealNode(xyz, value, false) == nullptr); @@ -2706,19 +2707,19 @@ TEST_F(TestTree, testStealNode) EXPECT_EQ(Index(2), NodeT::getLevel()); FloatTree tree(background); - EXPECT_EQ(Index(0), tree.leafCount()); + EXPECT_EQ(Index64(0), tree.leafCount()); EXPECT_TRUE(!tree.isValueOn(xyz)); EXPECT_NEAR(background, tree.getValue(xyz), epsilon); EXPECT_TRUE(tree.root().stealNode(xyz, value, false) == nullptr); tree.setValue(xyz, value); - EXPECT_EQ(Index(1), tree.leafCount()); + EXPECT_EQ(Index64(1), tree.leafCount()); EXPECT_TRUE(tree.isValueOn(xyz)); EXPECT_NEAR(value, tree.getValue(xyz), epsilon); NodeT* node = tree.root().stealNode(xyz, background, false); EXPECT_TRUE(node != nullptr); - EXPECT_EQ(Index(0), tree.leafCount()); + EXPECT_EQ(Index64(0), tree.leafCount()); EXPECT_TRUE(!tree.isValueOn(xyz)); EXPECT_NEAR(background, tree.getValue(xyz), epsilon); EXPECT_TRUE(tree.root().stealNode(xyz, value, false) == nullptr); @@ -2743,7 +2744,7 @@ TEST_F(TestTree, testNodeCount) std::vector dims; tree.getNodeLog2Dims(dims); - std::vector nodeCount1(dims.size()); + std::vector nodeCount1(dims.size()); //timer.start("Old technique");// use for benchmark test for (auto it = tree.cbeginNode(); it; ++it) ++(nodeCount1[dims.size()-1-it.getDepth()]); //timer.restart("New technique");// use for benchmark test diff --git a/openvdb/openvdb/unittest/TestTreeGetSetValues.cc b/openvdb/openvdb/unittest/TestTreeGetSetValues.cc index 27dcf9e89d..ea5ce6e9f8 100644 --- a/openvdb/openvdb/unittest/TestTreeGetSetValues.cc +++ b/openvdb/openvdb/unittest/TestTreeGetSetValues.cc @@ -224,108 +224,108 @@ TEST_F(TestTreeGetSetValues, testFill) // The following tests assume a [3,2,3] tree configuration. tree.clear(); - EXPECT_EQ(openvdb::Index32(0), tree.leafCount()); - EXPECT_EQ(openvdb::Index32(1), tree.nonLeafCount()); // root node + EXPECT_EQ(openvdb::Index64(0), tree.leafCount()); + EXPECT_EQ(openvdb::Index64(1), tree.nonLeafCount()); // root node // Partially fill a single leaf node. tree.fill(CoordBBox(Coord(8), Coord(14)), 0.0); - EXPECT_EQ(openvdb::Index32(1), tree.leafCount()); - EXPECT_EQ(openvdb::Index32(3), tree.nonLeafCount()); + EXPECT_EQ(openvdb::Index64(1), tree.leafCount()); + EXPECT_EQ(openvdb::Index64(3), tree.nonLeafCount()); // Completely fill the leaf node, replacing it with a tile. tree.fill(CoordBBox(Coord(8), Coord(15)), 0.0); - EXPECT_EQ(openvdb::Index32(0), tree.leafCount()); - EXPECT_EQ(openvdb::Index32(3), tree.nonLeafCount()); + EXPECT_EQ(openvdb::Index64(0), tree.leafCount()); + EXPECT_EQ(openvdb::Index64(3), tree.nonLeafCount()); { const int activeVoxelCount = int(tree.activeVoxelCount()); // Fill a single voxel of the tile with a different (active) value. tree.fill(CoordBBox(Coord(10), Coord(10)), 1.0); - EXPECT_EQ(openvdb::Index32(1), tree.leafCount()); - EXPECT_EQ(openvdb::Index32(3), tree.nonLeafCount()); + EXPECT_EQ(openvdb::Index64(1), tree.leafCount()); + EXPECT_EQ(openvdb::Index64(3), tree.nonLeafCount()); EXPECT_EQ(activeVoxelCount, int(tree.activeVoxelCount())); // Fill the voxel with an inactive value. tree.fill(CoordBBox(Coord(10), Coord(10)), 1.0, /*active=*/false); - EXPECT_EQ(openvdb::Index32(1), tree.leafCount()); - EXPECT_EQ(openvdb::Index32(3), tree.nonLeafCount()); + EXPECT_EQ(openvdb::Index64(1), tree.leafCount()); + EXPECT_EQ(openvdb::Index64(3), tree.nonLeafCount()); EXPECT_EQ(activeVoxelCount - 1, int(tree.activeVoxelCount())); // Completely fill the leaf node, replacing it with a tile again. tree.fill(CoordBBox(Coord(8), Coord(15)), 0.0); - EXPECT_EQ(openvdb::Index32(0), tree.leafCount()); - EXPECT_EQ(openvdb::Index32(3), tree.nonLeafCount()); + EXPECT_EQ(openvdb::Index64(0), tree.leafCount()); + EXPECT_EQ(openvdb::Index64(3), tree.nonLeafCount()); } // Expand by one voxel, creating seven neighboring leaf nodes. tree.fill(CoordBBox(Coord(8), Coord(16)), 0.0); - EXPECT_EQ(openvdb::Index32(7), tree.leafCount()); - EXPECT_EQ(openvdb::Index32(3), tree.nonLeafCount()); + EXPECT_EQ(openvdb::Index64(7), tree.leafCount()); + EXPECT_EQ(openvdb::Index64(3), tree.nonLeafCount()); // Completely fill the internal node containing the tile, replacing it with // a tile at the next level of the tree. tree.fill(CoordBBox(Coord(0), Coord(31)), 0.0); - EXPECT_EQ(openvdb::Index32(0), tree.leafCount()); - EXPECT_EQ(openvdb::Index32(2), tree.nonLeafCount()); + EXPECT_EQ(openvdb::Index64(0), tree.leafCount()); + EXPECT_EQ(openvdb::Index64(2), tree.nonLeafCount()); // Expand by one voxel, creating a layer of leaf nodes on three faces. tree.fill(CoordBBox(Coord(0), Coord(32)), 0.0); - EXPECT_EQ(openvdb::Index32(5*5 + 4*5 + 4*4), tree.leafCount()); - EXPECT_EQ(openvdb::Index32(2 + 7), tree.nonLeafCount()); // +7 internal nodes + EXPECT_EQ(openvdb::Index64(5*5 + 4*5 + 4*4), tree.leafCount()); + EXPECT_EQ(openvdb::Index64(2 + 7), tree.nonLeafCount()); // +7 internal nodes // Completely fill the second-level internal node, replacing it with a root-level tile. tree.fill(CoordBBox(Coord(0), Coord(255)), 0.0); - EXPECT_EQ(openvdb::Index32(0), tree.leafCount()); - EXPECT_EQ(openvdb::Index32(1), tree.nonLeafCount()); + EXPECT_EQ(openvdb::Index64(0), tree.leafCount()); + EXPECT_EQ(openvdb::Index64(1), tree.nonLeafCount()); // Repeat, filling with an inactive value. tree.clear(); - EXPECT_EQ(openvdb::Index32(0), tree.leafCount()); - EXPECT_EQ(openvdb::Index32(1), tree.nonLeafCount()); // root node + EXPECT_EQ(openvdb::Index64(0), tree.leafCount()); + EXPECT_EQ(openvdb::Index64(1), tree.nonLeafCount()); // root node // Partially fill a single leaf node. tree.fill(CoordBBox(Coord(8), Coord(14)), 0.0, /*active=*/false); - EXPECT_EQ(openvdb::Index32(1), tree.leafCount()); - EXPECT_EQ(openvdb::Index32(3), tree.nonLeafCount()); + EXPECT_EQ(openvdb::Index64(1), tree.leafCount()); + EXPECT_EQ(openvdb::Index64(3), tree.nonLeafCount()); // Completely fill the leaf node, replacing it with a tile. tree.fill(CoordBBox(Coord(8), Coord(15)), 0.0, /*active=*/false); - EXPECT_EQ(openvdb::Index32(0), tree.leafCount()); - EXPECT_EQ(openvdb::Index32(3), tree.nonLeafCount()); + EXPECT_EQ(openvdb::Index64(0), tree.leafCount()); + EXPECT_EQ(openvdb::Index64(3), tree.nonLeafCount()); // Expand by one voxel, creating seven neighboring leaf nodes. tree.fill(CoordBBox(Coord(8), Coord(16)), 0.0, /*active=*/false); - EXPECT_EQ(openvdb::Index32(7), tree.leafCount()); - EXPECT_EQ(openvdb::Index32(3), tree.nonLeafCount()); + EXPECT_EQ(openvdb::Index64(7), tree.leafCount()); + EXPECT_EQ(openvdb::Index64(3), tree.nonLeafCount()); // Completely fill the internal node containing the tile, replacing it with // a tile at the next level of the tree. tree.fill(CoordBBox(Coord(0), Coord(31)), 0.0, /*active=*/false); - EXPECT_EQ(openvdb::Index32(0), tree.leafCount()); - EXPECT_EQ(openvdb::Index32(2), tree.nonLeafCount()); + EXPECT_EQ(openvdb::Index64(0), tree.leafCount()); + EXPECT_EQ(openvdb::Index64(2), tree.nonLeafCount()); // Expand by one voxel, creating a layer of leaf nodes on three faces. tree.fill(CoordBBox(Coord(0), Coord(32)), 0.0, /*active=*/false); - EXPECT_EQ(openvdb::Index32(5*5 + 4*5 + 4*4), tree.leafCount()); - EXPECT_EQ(openvdb::Index32(2 + 7), tree.nonLeafCount()); // +7 internal nodes + EXPECT_EQ(openvdb::Index64(5*5 + 4*5 + 4*4), tree.leafCount()); + EXPECT_EQ(openvdb::Index64(2 + 7), tree.nonLeafCount()); // +7 internal nodes // Completely fill the second-level internal node, replacing it with a root-level tile. tree.fill(CoordBBox(Coord(0), Coord(255)), 0.0, /*active=*/false); - EXPECT_EQ(openvdb::Index32(0), tree.leafCount()); - EXPECT_EQ(openvdb::Index32(1), tree.nonLeafCount()); + EXPECT_EQ(openvdb::Index64(0), tree.leafCount()); + EXPECT_EQ(openvdb::Index64(1), tree.nonLeafCount()); tree.clear(); - EXPECT_EQ(openvdb::Index32(0), tree.leafCount()); - EXPECT_EQ(openvdb::Index32(1), tree.nonLeafCount()); // root node + EXPECT_EQ(openvdb::Index64(0), tree.leafCount()); + EXPECT_EQ(openvdb::Index64(1), tree.nonLeafCount()); // root node EXPECT_TRUE(tree.empty()); // Partially fill a region with inactive background values. tree.fill(CoordBBox(Coord(27), Coord(254)), background, /*active=*/false); // Confirm that after pruning, the tree is empty. openvdb::tools::prune(tree); - EXPECT_EQ(openvdb::Index32(0), tree.leafCount()); - EXPECT_EQ(openvdb::Index32(1), tree.nonLeafCount()); // root node + EXPECT_EQ(openvdb::Index64(0), tree.leafCount()); + EXPECT_EQ(openvdb::Index64(1), tree.nonLeafCount()); // root node EXPECT_TRUE(tree.empty()); } diff --git a/openvdb/openvdb/unittest/TestValueAccessor.cc b/openvdb/openvdb/unittest/TestValueAccessor.cc index d76c83174f..947552e37a 100644 --- a/openvdb/openvdb/unittest/TestValueAccessor.cc +++ b/openvdb/openvdb/unittest/TestValueAccessor.cc @@ -587,6 +587,7 @@ TEST_F(TestValueAccessor, testMultiThreadedRWAccessors) TEST_F(TestValueAccessor, testAccessorRegistration) { using openvdb::Index; + using openvdb::Index64; const float background = 5.0f, value = -9.345f; const openvdb::Coord c0(5, 10, 20); @@ -597,29 +598,29 @@ TEST_F(TestValueAccessor, testAccessorRegistration) // Set a single leaf voxel via the accessor and verify that // the cache is populated. acc.setValue(c0, value); - EXPECT_EQ(Index(1), tree->leafCount()); - EXPECT_EQ(tree->root().getLevel(), tree->nonLeafCount()); + EXPECT_EQ(Index64(1), tree->leafCount()); + EXPECT_EQ(Index64(tree->root().getLevel()), tree->nonLeafCount()); EXPECT_TRUE(acc.getNode() != nullptr); // Reset the voxel to the background value and verify that no nodes // have been deleted and that the cache is still populated. tree->setValueOff(c0, background); - EXPECT_EQ(Index(1), tree->leafCount()); - EXPECT_EQ(tree->root().getLevel(), tree->nonLeafCount()); + EXPECT_EQ(Index64(1), tree->leafCount()); + EXPECT_EQ(Index64(tree->root().getLevel()), tree->nonLeafCount()); EXPECT_TRUE(acc.getNode() != nullptr); // Prune the tree and verify that only the root node remains and that // the cache has been cleared. openvdb::tools::prune(*tree); //tree->prune(); - EXPECT_EQ(Index(0), tree->leafCount()); - EXPECT_EQ(Index(1), tree->nonLeafCount()); // root node only + EXPECT_EQ(Index64(0), tree->leafCount()); + EXPECT_EQ(Index64(1), tree->nonLeafCount()); // root node only EXPECT_TRUE(acc.getNode() == nullptr); // Set the leaf voxel again and verify that the cache is repopulated. acc.setValue(c0, value); - EXPECT_EQ(Index(1), tree->leafCount()); - EXPECT_EQ(tree->root().getLevel(), tree->nonLeafCount()); + EXPECT_EQ(Index64(1), tree->leafCount()); + EXPECT_EQ(Index64(tree->root().getLevel()), tree->nonLeafCount()); EXPECT_TRUE(acc.getNode() != nullptr); // Delete the tree and verify that the cache has been cleared. diff --git a/openvdb_ax/openvdb_ax/test/compiler/TestPointExecutable.cc b/openvdb_ax/openvdb_ax/test/compiler/TestPointExecutable.cc index 2e5ad4fdcc..a619856140 100644 --- a/openvdb_ax/openvdb_ax/test/compiler/TestPointExecutable.cc +++ b/openvdb_ax/openvdb_ax/test/compiler/TestPointExecutable.cc @@ -20,6 +20,12 @@ class TestPointExecutable : public CppUnit::TestCase { public: +#if OPENVDB_ABI_VERSION_NUMBER >= 12 + using LeafIndexType = openvdb::Index64; +#else + using LeafIndexType = openvdb::Index32; +#endif + CPPUNIT_TEST_SUITE(TestPointExecutable); CPPUNIT_TEST(testConstructionDestruction); CPPUNIT_TEST(testCreateMissingAttributes); @@ -545,7 +551,7 @@ TestPointExecutable::testAttributeCodecs() points = points::createPointDataGrid (twoPoints, *defaultTransform); - CPPUNIT_ASSERT_EQUAL(points->tree().leafCount(), Index32(1)); + CPPUNIT_ASSERT_EQUAL(points->tree().leafCount(), LeafIndexType(1)); // collapsed uniform 0 attributes points::appendAttribute(points->tree(), "f"); @@ -641,7 +647,7 @@ TestPointExecutable::testAttributeCodecs() points = points::createPointDataGrid (twoPoints, *defaultTransform); - CPPUNIT_ASSERT_EQUAL(points->tree().leafCount(), Index32(1)); + CPPUNIT_ASSERT_EQUAL(points->tree().leafCount(), LeafIndexType(1)); // collapsed uniform 0 attributes points::appendAttribute>(points->tree(), "fpu8"); @@ -728,7 +734,7 @@ TestPointExecutable::testAttributeCodecs() points = points::createPointDataGrid , points::PointDataGrid> (twoPoints, *defaultTransform); - CPPUNIT_ASSERT_EQUAL(points->tree().leafCount(), Index32(1)); + CPPUNIT_ASSERT_EQUAL(points->tree().leafCount(), LeafIndexType(1)); points::appendAttribute(points->tree(), "t"); points::appendAttribute>(points->tree(), "f"); diff --git a/openvdb_ax/openvdb_ax/test/compiler/TestVolumeExecutable.cc b/openvdb_ax/openvdb_ax/test/compiler/TestVolumeExecutable.cc index 2a00ae6703..f0b9eeef8f 100644 --- a/openvdb_ax/openvdb_ax/test/compiler/TestVolumeExecutable.cc +++ b/openvdb_ax/openvdb_ax/test/compiler/TestVolumeExecutable.cc @@ -13,6 +13,12 @@ class TestVolumeExecutable : public CppUnit::TestCase { public: +#if OPENVDB_ABI_VERSION_NUMBER >= 12 + using LeafIndexType = openvdb::Index64; +#else + using LeafIndexType = openvdb::Index32; +#endif + CPPUNIT_TEST_SUITE(TestVolumeExecutable); CPPUNIT_TEST(testConstructionDestruction); CPPUNIT_TEST(testCreateMissingGrids); @@ -155,7 +161,7 @@ TestVolumeExecutable::testTreeExecutionLevel() const openvdb::FloatTree copy = tree; // check config auto CHECK_CONFIG = [&]() { - CPPUNIT_ASSERT_EQUAL(openvdb::Index32(1), tree.leafCount()); + CPPUNIT_ASSERT_EQUAL(LeafIndexType(1), tree.leafCount()); CPPUNIT_ASSERT_EQUAL(openvdb::Index64(3), tree.activeTileCount()); CPPUNIT_ASSERT_EQUAL(int(openvdb::FloatTree::DEPTH-4), tree.getValueDepth(openvdb::Coord(0))); CPPUNIT_ASSERT_EQUAL(int(openvdb::FloatTree::DEPTH-3), tree.getValueDepth(openvdb::Coord(NodeT2::DIM))); @@ -357,7 +363,7 @@ TestVolumeExecutable::testActiveTileStreaming() CPPUNIT_ASSERT_EQUAL(openvdb::Index(openvdb::FloatTree::DEPTH-1), max); executable->execute(grid); - CPPUNIT_ASSERT_EQUAL(openvdb::Index32(1), tree.leafCount()); + CPPUNIT_ASSERT_EQUAL(LeafIndexType(1), tree.leafCount()); CPPUNIT_ASSERT_EQUAL(openvdb::Index64(3), tree.activeTileCount()); CPPUNIT_ASSERT_EQUAL(int(openvdb::FloatTree::DEPTH-4), tree.getValueDepth(openvdb::Coord(0))); CPPUNIT_ASSERT_EQUAL(int(openvdb::FloatTree::DEPTH-3), tree.getValueDepth(openvdb::Coord(NodeT2::DIM))); @@ -404,7 +410,7 @@ TestVolumeExecutable::testActiveTileStreaming() openvdb::Index64(NodeT1::NUM_VOXELS) + openvdb::Index64(NodeT0::NUM_VOXELS); - CPPUNIT_ASSERT_EQUAL(openvdb::Index32(voxels / openvdb::FloatTree::LeafNodeType::NUM_VOXELS), tree.leafCount()); + CPPUNIT_ASSERT_EQUAL(LeafIndexType(voxels / openvdb::FloatTree::LeafNodeType::NUM_VOXELS), tree.leafCount()); CPPUNIT_ASSERT_EQUAL(openvdb::Index64(0), tree.activeTileCount()); CPPUNIT_ASSERT_EQUAL(int(openvdb::FloatTree::DEPTH-1), tree.getValueDepth(openvdb::Coord(0))); CPPUNIT_ASSERT_EQUAL(int(openvdb::FloatTree::DEPTH-1), tree.getValueDepth(openvdb::Coord(NodeT1::DIM))); @@ -463,7 +469,7 @@ TestVolumeExecutable::testActiveTileStreaming() ((n1ChildCount * (n2ChildAxisCount * n2ChildAxisCount)) - leafs) // NodeT1 face tiles (NodeT0) - leafs + 1 /*NodeT1*/ + 1 /*NodeT0*/; - CPPUNIT_ASSERT_EQUAL(openvdb::Index32(leafs), tree.leafCount()); + CPPUNIT_ASSERT_EQUAL(LeafIndexType(leafs), tree.leafCount()); CPPUNIT_ASSERT_EQUAL(openvdb::Index64(tiles), tree.activeTileCount()); CPPUNIT_ASSERT_EQUAL(int(openvdb::FloatTree::DEPTH-3), tree.getValueDepth(openvdb::Coord(NodeT2::DIM))); CPPUNIT_ASSERT_EQUAL(int(openvdb::FloatTree::DEPTH-2), tree.getValueDepth(openvdb::Coord(NodeT2::DIM+NodeT1::DIM))); @@ -512,7 +518,7 @@ TestVolumeExecutable::testActiveTileStreaming() executable->execute(grid); - CPPUNIT_ASSERT_EQUAL(openvdb::Index32(0), tree.leafCount()); + CPPUNIT_ASSERT_EQUAL(LeafIndexType(0), tree.leafCount()); CPPUNIT_ASSERT_EQUAL(openvdb::Index64(5), tree.activeTileCount()); CPPUNIT_ASSERT_EQUAL(int(openvdb::FloatTree::DEPTH-3), tree.getValueDepth(openvdb::Coord(NodeT1::DIM*0, 0, 0))); CPPUNIT_ASSERT_EQUAL(int(openvdb::FloatTree::DEPTH-3), tree.getValueDepth(openvdb::Coord(NodeT1::DIM*1, 0, 0))); @@ -567,7 +573,7 @@ TestVolumeExecutable::testActiveTileStreaming() (n1ChildCount - leafs) // NodeT1 face tiles (NodeT0) - leafs + 3 /*NodeT1*/ + 1 /*NodeT0*/; - CPPUNIT_ASSERT_EQUAL(openvdb::Index32(leafs), tree.leafCount()); + CPPUNIT_ASSERT_EQUAL(LeafIndexType(leafs), tree.leafCount()); CPPUNIT_ASSERT_EQUAL(openvdb::Index64(tiles), tree.activeTileCount()); CPPUNIT_ASSERT_EQUAL(int(openvdb::BoolTree::DEPTH-3), tree.getValueDepth(openvdb::Coord(NodeT1::DIM*1, 0, 0))); CPPUNIT_ASSERT_EQUAL(int(openvdb::BoolTree::DEPTH-3), tree.getValueDepth(openvdb::Coord(NodeT1::DIM*2, 0, 0))); @@ -624,7 +630,7 @@ TestVolumeExecutable::testActiveTileStreaming() (n1ChildCount - leafs) // NodeT1 face tiles (NodeT0) - leafs + 3 /*NodeT1*/ + 1 /*NodeT0*/; - CPPUNIT_ASSERT_EQUAL(openvdb::Index32(leafs), tree.leafCount()); + CPPUNIT_ASSERT_EQUAL(LeafIndexType(leafs), tree.leafCount()); CPPUNIT_ASSERT_EQUAL(openvdb::Index64(tiles), tree.activeTileCount()); CPPUNIT_ASSERT_EQUAL(int(StringTree::DEPTH-3), tree.getValueDepth(openvdb::Coord(NodeT1::DIM*1, 0, 0))); CPPUNIT_ASSERT_EQUAL(int(StringTree::DEPTH-3), tree.getValueDepth(openvdb::Coord(NodeT1::DIM*2, 0, 0))); @@ -668,7 +674,7 @@ TestVolumeExecutable::testActiveTileStreaming() executable->execute(grid); - CPPUNIT_ASSERT_EQUAL(openvdb::Index32(1), tree.leafCount()); + CPPUNIT_ASSERT_EQUAL(LeafIndexType(1), tree.leafCount()); CPPUNIT_ASSERT_EQUAL(openvdb::Index64(2), tree.activeTileCount()); CPPUNIT_ASSERT(tree.hasSameTopology(copy)); CPPUNIT_ASSERT_EQUAL(int(openvdb::FloatTree::DEPTH-3), tree.getValueDepth(openvdb::Coord(0))); @@ -715,7 +721,7 @@ TestVolumeExecutable::testActiveTileStreaming() openvdb::Index64(NodeT1::NUM_VOXELS) + openvdb::Index64(NodeT0::NUM_VOXELS); - CPPUNIT_ASSERT_EQUAL(openvdb::Index32(voxels / openvdb::FloatTree::LeafNodeType::NUM_VOXELS) + 1, tree.leafCount()); + CPPUNIT_ASSERT_EQUAL(LeafIndexType(voxels / openvdb::FloatTree::LeafNodeType::NUM_VOXELS) + 1, tree.leafCount()); CPPUNIT_ASSERT_EQUAL(openvdb::Index64(0), tree.activeTileCount()); CPPUNIT_ASSERT_EQUAL(voxels, tree.activeVoxelCount()); CPPUNIT_ASSERT_EQUAL(leaf, tree.probeLeaf(openvdb::Coord(NodeT1::DIM + NodeT0::DIM)));