Closed ghurstunither closed 2 weeks ago
Needs a change for the log
Is that something I add in this PR?
would be ideal if we could add a simple unit test that exceeds 32-bit integer.
I'm not sure how to do that without making a gigantic tree.
I think there's actually more to talk about here. The Tree and RootNode also make assumptions that the number of leaf nodes cannot exceed 2^32:
https://github.com/AcademySoftwareFoundation/openvdb/blob/master/openvdb/openvdb/tree/Tree.h#L116
The tree ones in particular are actually virtual functions, so if we want to bump this arbitrary limit, we should also change those methods as an ABI change.
I think there's actually more to talk about here. The Tree and RootNode also make assumptions that the number of leaf nodes cannot exceed 2^32:
https://github.com/AcademySoftwareFoundation/openvdb/blob/master/openvdb/openvdb/tree/Tree.h#L116
The tree ones in particular are actually virtual functions, so if we want to bump this arbitrary limit, we should also change those methods as an ABI change.
Thanks for pointing this out. I think the following should return Index64
:
unallocatedLeafCount
leafCount
nodeCount
The other methods seem fine to return Index32
if we assume we'll never exceed 2^32 for other nodes, which I think is reasonable.
For large enough grids,
leafCounts
ininitLeafArray()
andnodeCounts
ininitNodeChildren()
can overflow asstd::vector<Index32>
.