OpenVDB 11.0.0
Loading...
Searching...
No Matches
GridChecksum.h
Go to the documentation of this file.
1// Copyright Contributors to the OpenVDB Project
2// SPDX-License-Identifier: MPL-2.0
3
4/*!
5 \file GridChecksum.h
6
7 \author Ken Museth
8
9 \brief Computes a pair of 32bit checksums, of a Grid, by means of Cyclic Redundancy Check (CRC)
10
11 \details A CRC32 is the 32 bit remainder, or residue, of binary division of a message, by a polynomial.
12*/
13
14#ifndef NANOVDB_GRIDCHECKSUM_H_HAS_BEEN_INCLUDED
15#define NANOVDB_GRIDCHECKSUM_H_HAS_BEEN_INCLUDED
16
17#include <algorithm>// for std::generate
18#include <array>
19#include <vector>
20#include <cstdint>
21#include <cstddef>// offsetof macro
22#include <numeric>
23#include <type_traits>
24#include <memory>// for std::unique_ptr
25
26#include <nanovdb/NanoVDB.h>
27#include "ForEach.h"
28#include "NodeManager.h"
29
30// Define log of block size for FULL CRC32 computation.
31// A value of 12 corresponds to a block size of 4KB (2^12 = 4096).
32// Undefine to use old checksum computation
33#define NANOVDB_CRC32_LOG2_BLOCK_SIZE 12
34
35namespace nanovdb {
36
37/// @brief List of different modes for computing for a checksum
38enum class ChecksumMode : uint32_t { Disable = 0,// no computation
39 Partial = 1,// fast but approximate
40 Full = 2,// slow but accurate
41 Default = 1,// defaults to Partial
42 End = 3 };// marks the end of the enum list
43
44/// @brief Return the (2 x CRC32) checksum of the specified @a grid
45/// @tparam BuildT Template parameter used to build NanoVDB grid.
46/// @param grid Grid from which the checksum is computed.
47/// @param mode Defines the mode of computation for the checksum.
48/// @return Return the (2 x CRC32) checksum of the specified @a grid
49template <typename BuildT>
51
52/// @brief Return true if the checksum of the @a grid matches the expected
53/// value already encoded into the grid's meta data.
54/// @tparam BuildT Template parameter used to build NanoVDB grid.
55/// @param grid Grid whose checksum is validated.
56/// @param mode Defines the mode of computation for the checksum.
57template <typename BuildT>
59
60/// @brief Updates the checksum of a grid
61///
62/// @param grid Grid whose checksum will be updated.
63/// @param mode Defines the mode of computation for the checksum.
64template <typename BuildT>
66
67namespace crc32 {
68
69/// @brief Initiate single entry in look-up-table for CRC32 computations
70/// @param lut pointer of size 256 for look-up-table
71/// @param n entry in table (assumed n < 256)
72inline __hostdev__ void initLut(uint32_t lut[256], uint32_t n)
73{
74 uint32_t &cs = lut[n] = n;
75 for (int i = 0; i < 8; ++i) cs = (cs >> 1) ^ ((cs & 1) ? 0xEDB88320 : 0);
76}
77
78/// @brief Initiate entire look-up-table for CRC32 computations
79/// @param lut pointer of size 256 for look-up-table
80inline __hostdev__ void initLut(uint32_t lut[256]){for (uint32_t n = 0u; n < 256u; ++n) initLut(lut, n);}
81
82/// @brief Create and initiate entire look-up-table for CRC32 computations
83/// @return returns a unique pointer to the lookup table of size 256.
84inline std::unique_ptr<uint32_t[]> createLut()
85{
86 std::unique_ptr<uint32_t[]> lut(new uint32_t[256]);
87 initLut(lut.get());
88 return lut;
89}
90
91/// @brief Compute crc32 checksum of @c data of @c size bytes (without a lookup table))
92/// @param data pointer to beginning of data
93/// @param size byte size of data
94/// @param crc initial value of crc32 checksum
95/// @return return crc32 checksum of @c data
96inline __hostdev__ uint32_t checksum(const void* data, size_t size, uint32_t crc = 0)
97{
98 crc = ~crc;
99 for (auto *p = (const uint8_t*)data, *q = p + size; p != q; ++p) {
100 crc ^= *p;
101 for (int j = 0; j < 8; ++j) crc = (crc >> 1) ^ (0xEDB88320 & (-(crc & 1)));
102 }
103 return ~crc;
104}
105
106/// @brief Compute crc32 checksum of data between @c begin and @c end
107/// @param begin points to beginning of data
108/// @param end points to end of @data, (exclusive)
109/// @param crc initial value of crc32 checksum
110/// @return return crc32 checksum
111inline __hostdev__ uint32_t checksum(const void *begin, const void *end, uint32_t crc = 0)
112{
113 NANOVDB_ASSERT(begin && end);
114 NANOVDB_ASSERT(end >= begin);
115 return checksum(begin, (const char*)end - (const char*)begin, crc);
116}
117
118/// @brief Compute crc32 checksum of @c data with @c size bytes using a lookup table
119/// @param data pointer to begenning of data
120/// @param size byte size
121/// @param lut pointer to loopup table for accelerated crc32 computation
122/// @param crc initial value of the checksum
123/// @return crc32 checksum of @c data with @c size bytes
124inline __hostdev__ uint32_t checksum(const void *data, size_t size, const uint32_t lut[256], uint32_t crc = 0)
125{
126 crc = ~crc;
127 for (auto *p = (const uint8_t*)data, *q = p + size; p != q; ++p) crc = lut[(crc ^ *p) & 0xFF] ^ (crc >> 8);
128 return ~crc;
129}
130
131/// @brief Compute crc32 checksum of data between @c begin and @c end using a lookup table
132/// @param begin points to beginning of data
133/// @param end points to end of @data, (exclusive)
134/// @param lut pointer to loopup table for accelerated crc32 computation
135/// @param crc initial value of crc32 checksum
136/// @return return crc32 checksum
137inline __hostdev__ uint32_t checksum(const void *begin, const void *end, const uint32_t lut[256], uint32_t crc = 0)
138{
139 NANOVDB_ASSERT(begin && end);
140 NANOVDB_ASSERT(end >= begin);
141 return checksum(begin, (const char*)end - (const char*)begin, lut, crc);
142}
143
144}// namespace crc32
145
146/// @brief Class that encapsulates two CRC32 checksums, one for the Grid, Tree and Root node meta data
147/// and one for the remaining grid nodes.
149{
150 /// Three types of checksums:
151 /// 1) Empty: all 64 bits are on (used to signify no checksum)
152 /// 2) Partial: Upper 32 bits are on and not all of lower 32 bits are on (lower 32 bits checksum head of grid)
153 /// 3) Full: Not all of the 64 bits are one (lower 32 bits checksum head of grid and upper 32 bits checksum tail of grid)
154 union {uint32_t mCRC[2]; uint64_t mChecksum; };// mCRC[0] is checksum of Grid, Tree and Root, and mCRC[1] is checksum of nodes
155 static constexpr uint32_t EMPTY32 = ~uint32_t{0};
156
157public:
158
159 static constexpr uint64_t EMPTY = ~uint64_t(0);
160
161 /// @brief default constructor initiates checksum to EMPTY
162 GridChecksum() : mCRC{EMPTY32, EMPTY32} {}
163
164 /// @brief Constructor that allows the two 32bit checksums to be initiated explicitly
165 /// @param head Initial 32bit CRC checksum of grid, tree and root data
166 /// @param tail Initial 32bit CRC checksum of all the nodes and blind data
167 GridChecksum(uint32_t head, uint32_t tail) : mCRC{head, tail} {}
168
169 /// @brief
170 /// @param checksum
171 /// @param mode
176
177 /// @brief return the 64 bit checksum of this instance
178 uint64_t checksum() const { return mChecksum; }
179
180 /// @brief return 32 bit (crc32) checksum of this instance
181 /// @param i index of value 0 or 1 indicated the 32 bit checksum of the head or nodes
182 /// @return non-const reference of the i'th 32bit checksum
183 uint32_t& checksum(int i) {NANOVDB_ASSERT(i==0 || i==1); return mCRC[i]; }
184
185 /// @brief return 32 bit (crc32) checksum of this instance
186 /// @param i index of value 0 or 1 indicated the 32 bit checksum of the head or nodes
187 /// @return copy of the i'th 32bit checksum
188 uint32_t checksum(int i) const {NANOVDB_ASSERT(i==0 || i==1); return mCRC[i]; }
189
190 /// @brief return true if the 64 bit checksum is partial, i.e. of head only
191 bool isPartial() const { return mCRC[0] != EMPTY32 && mCRC[1] == EMPTY32; }
192
193 /// @brief return true if the 64 bit checksum is fill, i.e. of both had and nodes
194 bool isFull() const { return mCRC[0] != EMPTY32 && mCRC[1] != EMPTY32; }
195
196 /// @brief return true if the 64 bit checksum is disables (unset)
197 bool isEmpty() const { return mChecksum == EMPTY; }
198
199 /// @brief return the mode of the 64 bit checksum
201 {
204 }
205#ifdef NANOVDB_CRC32_LOG2_BLOCK_SIZE
206 /// @brief compute checksum of @c gridData using a 4KB blocked approach
207 /// @param gridData Reference to GridData
208 /// @param mode Mode of the checksum computation
210#else
211 /// @brief Compute checksum using old (node-based) approach
212 /// @tparam ValueT Build type of the grid
213 /// @param grid Reference to Grid
214 /// @param mode Mode of the checksum computation
215 template <typename ValueT>
217#endif
218 /// @brief return true if the checksums are identical
219 /// @param rhs other GridChecksum
220 bool operator==(const GridChecksum &rhs) const {return mChecksum == rhs.mChecksum;}
221
222 /// @brief return true if the checksums are not identical
223 /// @param rhs other GridChecksum
224 bool operator!=(const GridChecksum &rhs) const {return mChecksum != rhs.mChecksum;}
225};// GridChecksum
226
227// [GridData][TreeData]---[RootData][ROOT TILES...]---[NodeData<5>]---[NodeData<4>]---[LeafData<3>]---[BLINDMETA...]---[BLIND0]---[BLIND1]---etc.
228
229#ifdef NANOVDB_CRC32_LOG2_BLOCK_SIZE
230
232{
234
236
237 auto lut = crc32::createLut();
238 const uint8_t *begin = (const uint8_t*)(&gridData), *mid = gridData.template nodePtr<2>(), *end = begin + gridData.mGridSize;// what about empty grids?
239 if (mid == nullptr) {// no (upper) nodes
240 if (gridData.mBlindMetadataCount) {
241 mid = begin + gridData.mBlindMetadataOffset;// exclude blind data from Partial checksum
242 } else {
243 mid = end;// no nodes or blind data, so Partial checksum is computed on the entire grid buffer
244 }
245 }
246 mCRC[0] = crc32::checksum(begin + 16, mid, lut.get());// GridData, TreeData. RootData but exclude GridData::mMagic and GridData::mChecksum
247
248 if (mode != ChecksumMode::Full || mid == end) return ChecksumMode::Partial;
249
250 uint64_t size = end - mid;// includes blind data
251 const uint64_t blockCount = size >> NANOVDB_CRC32_LOG2_BLOCK_SIZE;// number of 4 KB (4096 byte) blocks
252 std::unique_ptr<uint32_t[]> checksums(new uint32_t[blockCount]);
253 forEach(0, blockCount, 64, [&](const Range1D &r) {
254 uint32_t blockSize = 1 << NANOVDB_CRC32_LOG2_BLOCK_SIZE;
255 uint32_t *p = checksums.get() + r.begin();
256 for (auto i = r.begin(); i != r.end(); ++i) {
257 if (i+1 == blockCount) blockSize += size - (blockCount<<NANOVDB_CRC32_LOG2_BLOCK_SIZE);
258 *p++ = crc32::checksum(mid + (i<<NANOVDB_CRC32_LOG2_BLOCK_SIZE), blockSize, lut.get());
259 }
260 });
261 mCRC[1] = crc32::checksum(checksums.get(), sizeof(uint32_t)*blockCount, lut.get());
262
263 return ChecksumMode::Full;
264}// GridChecksum::operator(const GridData&, ChecksumMode)
265
266#else// NANOVDB_CRC32_LOG2_BLOCK_SIZE
267
268template <typename ValueT>
270{
271 // Validate the assumed memory layout
272 static_assert(offsetof(GridData, mMagic) == 0, "Unexpected offset to magic number");
273 static_assert(offsetof(GridData, mChecksum) == 8, "Unexpected offset to checksum");
274 static_assert(offsetof(GridData, mVersion) == 16, "Unexpected offset to version number");
275
277
278 if (mode == ChecksumMode::Disable) return;
279
280 auto lut = crc32::createLut();
281 const uint8_t *begin = reinterpret_cast<const uint8_t*>(&grid), *mid = grid.template nodePtr<2>();
282
283 mCRC[0] = crc32::checksum(begin + 16, mid, lut.get());// process Grid + Tree + Root but exclude mMagic and mChecksum
284
285 if (mode != ChecksumMode::Full || grid.isEmpty()) return;
286
287 const auto &tree = grid.tree();
288 const auto &root = tree.root();
289 auto nodeMgrHandle = createNodeManager(grid);
290 auto *nodeMgr = nodeMgrHandle.template mgr<ValueT>();
291 assert(isValid(nodeMgr));
292 const auto nodeCount = tree.nodeCount(0) + tree.nodeCount(1) + tree.nodeCount(2);
293 std::vector<uint32_t> checksums(nodeCount, 0);
294 // process upper internal nodes
295 auto kernel2 = [&](const Range1D &r) {
296 uint32_t *p = checksums.data() + r.begin();
297 for (auto i = r.begin(); i != r.end(); ++i) {
298 const auto &node = nodeMgr->upper(static_cast<uint32_t>(i));
299 *p++ = crc32::checksum(&node, node.memUsage(), lut.get());
300 }
301 };
302 // process lower internal nodes
303 auto kernel1 = [&](const Range1D &r) {
304 uint32_t *p = checksums.data() + r.begin() + tree.nodeCount(2);
305 for (auto i = r.begin(); i != r.end(); ++i) {
306 const auto &node = nodeMgr->lower(static_cast<uint32_t>(i));
307 *p++ = crc32::checksum(&node, node.memUsage(), lut.get());
308 }
309 };
310 // process leaf nodes
311 auto kernel0 = [&](const Range1D &r) {
312 uint32_t *p = checksums.data() + r.begin() + tree.nodeCount(1) + tree.nodeCount(2);
313 for (auto i = r.begin(); i != r.end(); ++i) {
314 const auto &leaf = nodeMgr->leaf(static_cast<uint32_t>(i));
315 *p++ = crc32::checksum(&leaf, leaf.memUsage(), lut.get());
316 }
317 };
318 forEach(0, tree.nodeCount(2), 1, kernel2);
319 forEach(0, tree.nodeCount(1), 1, kernel1);
320 forEach(0, tree.nodeCount(0), 8, kernel0);
321 mCRC[1] = crc32::checksum(checksums.data(), sizeof(uint32_t)*checksums.size(), lut.get());
322}// GridChecksum::operator()
323
324#endif// NANOVDB_CRC32_LOG2_BLOCK_SIZE
325
326template <typename ValueT>
327uint64_t checksum(const NanoGrid<ValueT> &grid, ChecksumMode mode)
328{
329 GridChecksum cs;
330 cs(grid, mode);
331 return cs.checksum();
332}
333
334template <typename ValueT>
336{
337 GridChecksum cs1(grid.checksum(), mode), cs2;
338 cs2(grid, cs1.mode() );
339 return cs1 == cs2;
340}
341
342template <typename ValueT>
344{
345 GridChecksum cs;
346 cs(grid, mode);
347 grid.data()->mChecksum = cs.checksum();
348}
349
350inline bool updateChecksum(GridData &gridData, ChecksumMode mode)
351{
352#ifdef NANOVDB_CRC32_LOG2_BLOCK_SIZE
353 GridChecksum cs;
354 cs(gridData, mode);
355 gridData.mChecksum = cs.checksum();
356#else
357 if (mode == ChecksumMode::Disable) return false;
358 switch (data->mGridType){
359 case GridType::Float:
360 updateChecksum(*reinterpret_cast<NanoGrid<float>*>(data), mode);
361 break;
362 case GridType::Double:
363 updateChecksum(*reinterpret_cast<NanoGrid<double>*>(data), mode);
364 break;
365 case GridType::Int16:
366 updateChecksum(*reinterpret_cast<NanoGrid<int16_t>*>(data), mode);
367 break;
368 case GridType::Int32:
369 updateChecksum(*reinterpret_cast<NanoGrid<int32_t>*>(data), mode);
370 break;
371 case GridType::Int64:
372 updateChecksum(*reinterpret_cast<NanoGrid<int64_t>*>(data), mode);
373 break;
374 case GridType::Vec3f:
375 updateChecksum(*reinterpret_cast<NanoGrid<Vec3f>*>(data), mode);
376 break;
377 case GridType::Vec3d:
378 updateChecksum(*reinterpret_cast<NanoGrid<Vec3d>*>(data), mode);
379 break;
380 case GridType::UInt32:
381 updateChecksum(*reinterpret_cast<NanoGrid<uint32_t>*>(data), mode);
382 break;
383 case GridType::Mask:
384 updateChecksum(*reinterpret_cast<NanoGrid<ValueMask>*>(data), mode);
385 break;
386 case GridType::Index:
387 updateChecksum(*reinterpret_cast<NanoGrid<ValueIndex>*>(data), mode);
388 break;
390 updateChecksum(*reinterpret_cast<NanoGrid<ValueOnIndex>*>(data), mode);
391 break;
393 updateChecksum(*reinterpret_cast<NanoGrid<ValueIndexMask>*>(data), mode);
394 break;
396 updateChecksum(*reinterpret_cast<NanoGrid<ValueOnIndexMask>*>(data), mode);
397 break;
399 updateChecksum(*reinterpret_cast<NanoGrid<bool>*>(data), mode);
400 break;
401 case GridType::RGBA8:
402 updateChecksum(*reinterpret_cast<NanoGrid<Rgba8>*>(data), mode);
403 break;
404 case GridType::Fp4:
405 updateChecksum(*reinterpret_cast<NanoGrid<Fp4>*>(data), mode);
406 break;
407 case GridType::Fp8:
408 updateChecksum(*reinterpret_cast<NanoGrid<Fp8>*>(data), mode);
409 break;
410 case GridType::Fp16:
411 updateChecksum(*reinterpret_cast<NanoGrid<Fp16>*>(data), mode);
412 break;
413 case GridType::FpN:
414 updateChecksum(*reinterpret_cast<NanoGrid<FpN>*>(data), mode);
415 break;
416 case GridType::Vec4f:
417 updateChecksum(*reinterpret_cast<NanoGrid<Vec4f>*>(data), mode);
418 break;
419 case GridType::Vec4d:
420 updateChecksum(*reinterpret_cast<NanoGrid<Vec4d>*>(data), mode);
421 break;
422 default: {
423 std::stringstream ss;
424 ss << "Cannot update checksum for grid of unknown type \"" << toStr(data->mGridType);
425 throw std::runtime_error(ss.str() + "\"");
426 }
427 }// switch
428#endif
429 return true;
430}// updateChecksum(GridData *data, ChecksumMode mode)
431
432/// @brief Preserve the existing mode of the checksum and update it if it's not disabled
433/// @param data
434/// @return
435inline bool updateChecksum(GridData *data)
436{
437 GridChecksum cs(data->mChecksum);
438 const auto mode = cs.mode();
439 return updateChecksum(*data, mode);
440}// updateChecksum(GridData *data)
441
442/// @brief Updates the ground index and count, as well as the partial checksum if needed
443/// @param data Pointer to grid data
444/// @param gridIndex New value of the index
445/// @param gridCount New value of the grid count
446/// @return returns true if the checksum was updated
447inline bool updateGridCount(GridData *data, uint32_t gridIndex, uint32_t gridCount)
448{
449 NANOVDB_ASSERT(gridIndex < gridCount);
450 if (data->mGridIndex == gridIndex && data->mGridCount == gridCount) return false;// nothing to update
451 data->mGridIndex = gridIndex;
452 data->mGridCount = gridCount;
453 GridChecksum cs(data->mChecksum);
454 if (cs.isEmpty()) return false;// no checksum to update
455 updateChecksum(*data, ChecksumMode::Partial);// only update the checksum of the grid since we only modified the GridData
456 reinterpret_cast<GridChecksum*>(&(data->mChecksum))->checksum(1) = cs.checksum(1);// copy the old checksum of the tree nodes since it was set to EMPTY during the update
457 return true;
458}
459
460} // namespace nanovdb
461
462#endif // NANOVDB_GRIDCHECKSUM_H_HAS_BEEN_INCLUDED
A unified wrapper for tbb::parallel_for and a naive std::thread fallback.
#define NANOVDB_CRC32_LOG2_BLOCK_SIZE
Definition GridChecksum.h:33
Implements a light-weight self-contained VDB data-structure in a single file! In other words,...
#define __hostdev__
Definition NanoVDB.h:213
#define NANOVDB_ASSERT(x)
Definition NanoVDB.h:190
Class that encapsulates two CRC32 checksums, one for the Grid, Tree and Root node meta data and one f...
Definition GridChecksum.h:149
ChecksumMode mode() const
return the mode of the 64 bit checksum
Definition GridChecksum.h:200
uint32_t mCRC[2]
Definition GridChecksum.h:154
bool isPartial() const
return true if the 64 bit checksum is partial, i.e. of head only
Definition GridChecksum.h:191
GridChecksum(uint64_t checksum, ChecksumMode mode=ChecksumMode::Full)
Definition GridChecksum.h:172
ChecksumMode operator()(const GridData &gridData, ChecksumMode mode=ChecksumMode::Full)
compute checksum of gridData using a 4KB blocked approach
Definition GridChecksum.h:231
GridChecksum(uint32_t head, uint32_t tail)
Constructor that allows the two 32bit checksums to be initiated explicitly.
Definition GridChecksum.h:167
GridChecksum()
default constructor initiates checksum to EMPTY
Definition GridChecksum.h:162
static constexpr uint64_t EMPTY
Definition GridChecksum.h:159
uint64_t checksum() const
return the 64 bit checksum of this instance
Definition GridChecksum.h:178
uint64_t mChecksum
Definition GridChecksum.h:154
bool operator==(const GridChecksum &rhs) const
return true if the checksums are identical
Definition GridChecksum.h:220
uint32_t checksum(int i) const
return 32 bit (crc32) checksum of this instance
Definition GridChecksum.h:188
bool isEmpty() const
return true if the 64 bit checksum is disables (unset)
Definition GridChecksum.h:197
bool operator!=(const GridChecksum &rhs) const
return true if the checksums are not identical
Definition GridChecksum.h:224
bool isFull() const
return true if the 64 bit checksum is fill, i.e. of both had and nodes
Definition GridChecksum.h:194
uint32_t & checksum(int i)
return 32 bit (crc32) checksum of this instance
Definition GridChecksum.h:183
Highest level of the data structure. Contains a tree and a world->index transform (that currently onl...
Definition NanoVDB.h:3699
DataType * data()
Definition NanoVDB.h:3722
uint64_t checksum() const
Return checksum of the grid buffer.
Definition NanoVDB.h:3864
const TreeT & tree() const
Return a const reference to the tree.
Definition NanoVDB.h:3753
Definition Range.h:28
__hostdev__ void initLut(uint32_t lut[256], uint32_t n)
Initiate single entry in look-up-table for CRC32 computations.
Definition GridChecksum.h:72
std::unique_ptr< uint32_t[]> createLut()
Create and initiate entire look-up-table for CRC32 computations.
Definition GridChecksum.h:84
__hostdev__ uint32_t checksum(const void *data, size_t size, uint32_t crc=0)
Compute crc32 checksum of data of size bytes (without a lookup table))
Definition GridChecksum.h:96
Definition NanoVDB.h:247
const char * toStr(GridType gridType)
Maps a GridType to a c-string.
Definition NanoVDB.h:349
uint64_t checksum(const NanoGrid< BuildT > &grid, ChecksumMode mode=ChecksumMode::Default)
Return the (2 x CRC32) checksum of the specified grid.
bool updateGridCount(GridData *data, uint32_t gridIndex, uint32_t gridCount)
Updates the ground index and count, as well as the partial checksum if needed.
Definition GridChecksum.h:447
bool validateChecksum(const NanoGrid< BuildT > &grid, ChecksumMode mode=ChecksumMode::Default)
Return true if the checksum of the grid matches the expected value already encoded into the grid's me...
ChecksumMode
List of different modes for computing for a checksum.
Definition GridChecksum.h:38
void updateChecksum(NanoGrid< BuildT > &grid, ChecksumMode mode=ChecksumMode::Default)
Updates the checksum of a grid.
void forEach(RangeT range, const FuncT &func)
simple wrapper for tbb::parallel_for with a naive std fallback
Definition ForEach.h:40
NodeManagerHandle< BufferT > createNodeManager(const NanoGrid< BuildT > &grid, const BufferT &buffer=BufferT())
brief Construct a NodeManager and return its handle
Definition NodeManager.h:284
Range< 1, size_t > Range1D
Definition Range.h:30
static bool isValid(const void *p)
return true if the specified pointer is aligned and not NULL
Definition NanoVDB.h:743
This class allows for sequential access to nodes in a NanoVDB tree on both the host and device.
Struct with all the member data of the Grid (useful during serialization of an openvdb grid)
Definition NanoVDB.h:3512
uint32_t mBlindMetadataCount
Definition NanoVDB.h:3528
uint64_t mGridSize
Definition NanoVDB.h:3520
uint64_t mChecksum
Definition NanoVDB.h:3515
uint32_t mGridCount
Definition NanoVDB.h:3519
bool isEmpty() const
test if the grid is empty, e.i the root table has size 0
Definition NanoVDB.h:3679
int64_t mBlindMetadataOffset
Definition NanoVDB.h:3527
uint32_t mGridIndex
Definition NanoVDB.h:3518