118 #ifndef NANOVDB_NANOVDB_H_HAS_BEEN_INCLUDED 119 #define NANOVDB_NANOVDB_H_HAS_BEEN_INCLUDED 123 #include <nanovdb/math/Math.h> 126 #define NANOVDB_DATA_ALIGNMENT 32 134 #define NANOVDB_MAGIC_NUMB 0x304244566f6e614eUL // "NanoVDB0" in hex - little endian (uint64_t) 135 #define NANOVDB_MAGIC_GRID 0x314244566f6e614eUL // "NanoVDB1" in hex - little endian (uint64_t) 136 #define NANOVDB_MAGIC_FILE 0x324244566f6e614eUL // "NanoVDB2" in hex - little endian (uint64_t) 137 #define NANOVDB_MAGIC_NODE 0x334244566f6e614eUL // "NanoVDB3" in hex - little endian (uint64_t) 138 #define NANOVDB_MAGIC_FRAG 0x344244566f6e614eUL // "NanoVDB4" in hex - little endian (uint64_t) 139 #define NANOVDB_MAGIC_MASK 0x00FFFFFFFFFFFFFFUL // use this mask to remove the number 144 #define NANOVDB_MAJOR_VERSION_NUMBER 32 // reflects changes to the ABI and hence also the file format 145 #define NANOVDB_MINOR_VERSION_NUMBER 7 // reflects changes to the API but not ABI 146 #define NANOVDB_PATCH_VERSION_NUMBER 0 // reflects changes that does not affect the ABI or API 148 #define TBB_SUPPRESS_DEPRECATED_MESSAGES 1 151 #define NANOVDB_USE_SINGLE_ROOT_KEY 160 #define NANOVDB_NEW_ACCESSOR_METHODS 162 #define NANOVDB_FPN_BRANCHLESS 164 #if !defined(NANOVDB_ALIGN) 165 #define NANOVDB_ALIGN(n) alignas(n) 166 #endif // !defined(NANOVDB_ALIGN) 208 template <
class EnumT>
557 template <
typename T>
642 switch (blindClass) {
694 : mData(major << 21 | minor << 10 | patch)
733 static const int Rank = 0;
734 static const bool IsScalar =
true;
735 static const bool IsVector =
false;
736 static const int Size = 1;
738 static T
scalar(
const T& s) {
return s; }
744 static const int Rank = 1;
745 static const bool IsScalar =
false;
746 static const bool IsVector =
true;
747 static const int Size = T::SIZE;
754 template<typename T, int = sizeof(typename TensorTraits<T>::ElementType)>
811 template<
typename BuildT>
870 template<
typename BuildT>
871 [[deprecated(
"Use toGridType<T>() instead.")]]
877 template<
typename BuildT>
892 template<
typename BuildT>
893 [[deprecated(
"Use toGridClass<T>() instead.")]]
896 return toGridClass<BuildT>();
934 BitFlags(std::initializer_list<uint8_t> list)
936 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
938 template<
typename MaskT>
939 BitFlags(std::initializer_list<MaskT> list)
941 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
945 __hostdev__ void initBit(std::initializer_list<uint8_t> list)
948 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
950 template<
typename MaskT>
951 __hostdev__ void initMask(std::initializer_list<MaskT> list)
954 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
963 __hostdev__ void setBitOn(uint8_t bit) { mFlags |=
static_cast<Type>(1 << bit); }
964 __hostdev__ void setBitOff(uint8_t bit) { mFlags &= ~static_cast<
Type>(1 << bit); }
966 __hostdev__ void setBitOn(std::initializer_list<uint8_t> list)
968 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
970 __hostdev__ void setBitOff(std::initializer_list<uint8_t> list)
972 for (
auto bit : list) mFlags &= ~static_cast<
Type>(1 << bit);
975 template<
typename MaskT>
976 __hostdev__ void setMaskOn(MaskT mask) { mFlags |=
static_cast<Type>(mask); }
977 template<
typename MaskT>
978 __hostdev__ void setMaskOff(MaskT mask) { mFlags &= ~static_cast<
Type>(mask); }
980 template<
typename MaskT>
981 __hostdev__ void setMaskOn(std::initializer_list<MaskT> list)
983 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
985 template<
typename MaskT>
986 __hostdev__ void setMaskOff(std::initializer_list<MaskT> list)
988 for (
auto mask : list) mFlags &= ~static_cast<
Type>(mask);
991 __hostdev__ void setBit(uint8_t bit,
bool on) { on ? this->setBitOn(bit) : this->setBitOff(bit); }
992 template<
typename MaskT>
993 __hostdev__ void setMask(MaskT mask,
bool on) { on ? this->setMaskOn(mask) : this->setMaskOff(mask); }
997 __hostdev__ bool isBitOn(uint8_t bit)
const {
return 0 != (mFlags &
static_cast<Type>(1 << bit)); }
998 __hostdev__ bool isBitOff(uint8_t bit)
const {
return 0 == (mFlags &
static_cast<Type>(1 << bit)); }
999 template<
typename MaskT>
1000 __hostdev__ bool isMaskOn(MaskT mask)
const {
return 0 != (mFlags &
static_cast<Type>(mask)); }
1001 template<
typename MaskT>
1002 __hostdev__ bool isMaskOff(MaskT mask)
const {
return 0 == (mFlags &
static_cast<Type>(mask)); }
1004 template<
typename MaskT>
1005 __hostdev__ bool isMaskOn(std::initializer_list<MaskT> list)
const 1007 for (
auto mask : list) {
1008 if (0 != (mFlags & static_cast<Type>(mask)))
return true;
1013 template<
typename MaskT>
1014 __hostdev__ bool isMaskOff(std::initializer_list<MaskT> list)
const 1016 for (
auto mask : list) {
1017 if (0 == (mFlags & static_cast<Type>(mask)))
return true;
1033 template<u
int32_t LOG2DIM>
1037 static constexpr uint32_t SIZE = 1U << (3 * LOG2DIM);
1038 static constexpr uint32_t WORD_COUNT = SIZE >> 6;
1053 for (
const uint64_t *w = mWords, *q = w + WORD_COUNT; w != q; ++w)
1061 uint32_t n = i >> 6, sum =
util::countOn(mWords[n] & ((uint64_t(1) << (i & 63u)) - 1u));
1062 for (
const uint64_t* w = mWords; n--; ++w)
1087 mPos = mParent->findNext<On>(mPos + 1);
1099 const Mask* mParent;
1141 for (uint32_t i = 0; i < WORD_COUNT; ++i)
1146 const uint64_t v = on ? ~uint64_t(0) : uint64_t(0);
1147 for (uint32_t i = 0; i < WORD_COUNT; ++i)
1154 for (uint32_t i = 0; i < WORD_COUNT; ++i)
1155 mWords[i] = other.mWords[i];
1163 template<
typename MaskT = Mask>
1166 static_assert(
sizeof(
Mask) ==
sizeof(MaskT),
"Mismatching sizeof");
1167 static_assert(WORD_COUNT == MaskT::WORD_COUNT,
"Mismatching word count");
1168 static_assert(LOG2DIM == MaskT::LOG2DIM,
"Mismatching LOG2DIM");
1169 auto* src =
reinterpret_cast<const uint64_t*
>(&other);
1170 for (uint64_t *dst = mWords, *end = dst + WORD_COUNT; dst != end; ++dst)
1176 Mask& operator=(
const Mask&) =
default;
1180 for (uint32_t i = 0; i < WORD_COUNT; ++i) {
1181 if (mWords[i] != other.mWords[i])
1190 __hostdev__ bool isOn(uint32_t n)
const {
return 0 != (mWords[n >> 6] & (uint64_t(1) << (n & 63))); }
1193 __hostdev__ bool isOff(uint32_t n)
const {
return 0 == (mWords[n >> 6] & (uint64_t(1) << (n & 63))); }
1198 for (uint32_t i = 0; i < WORD_COUNT; ++i)
1199 if (mWords[i] != ~uint64_t(0))
1207 for (uint32_t i = 0; i < WORD_COUNT; ++i)
1208 if (mWords[i] != uint64_t(0))
1218 #if defined(__CUDACC__) // the following functions only run on the GPU! 1219 __device__ inline void setOnAtomic(uint32_t n)
1221 atomicOr(reinterpret_cast<unsigned long long int*>(
this) + (n >> 6), 1ull << (n & 63));
1223 __device__ inline void setOffAtomic(uint32_t n)
1225 atomicAnd(reinterpret_cast<unsigned long long int*>(
this) + (n >> 6), ~(1ull << (n & 63)));
1227 __device__ inline void setAtomic(uint32_t n,
bool on)
1229 on ? this->setOnAtomic(n) : this->setOffAtomic(n);
1235 #if 1 // switch between branchless 1236 auto& word = mWords[n >> 6];
1238 word &= ~(uint64_t(1) << n);
1239 word |= uint64_t(on) << n;
1241 on ? this->setOn(n) : this->setOff(n);
1248 for (uint32_t i = 0; i < WORD_COUNT; ++i)mWords[i] = ~uint64_t(0);
1254 for (uint32_t i = 0; i < WORD_COUNT; ++i) mWords[i] = uint64_t(0);
1260 const uint64_t v = on ? ~uint64_t(0) : uint64_t(0);
1261 for (uint32_t i = 0; i < WORD_COUNT; ++i) mWords[i] = v;
1266 uint32_t n = WORD_COUNT;
1267 for (
auto* w = mWords; n--; ++w) *w = ~*w;
1274 uint64_t* w1 = mWords;
1275 const uint64_t* w2 = other.mWords;
1276 for (uint32_t n = WORD_COUNT; n--; ++w1, ++w2) *w1 &= *w2;
1282 uint64_t* w1 = mWords;
1283 const uint64_t* w2 = other.mWords;
1284 for (uint32_t n = WORD_COUNT; n--; ++w1, ++w2) *w1 |= *w2;
1290 uint64_t* w1 = mWords;
1291 const uint64_t* w2 = other.mWords;
1292 for (uint32_t n = WORD_COUNT; n--; ++w1, ++w2) *w1 &= ~*w2;
1298 uint64_t* w1 = mWords;
1299 const uint64_t* w2 = other.mWords;
1300 for (uint32_t n = WORD_COUNT; n--; ++w1, ++w2) *w1 ^= *w2;
1309 const uint64_t* w = mWords;
1310 for (; n < WORD_COUNT && !(ON ? *w : ~*w); ++w, ++n);
1318 uint32_t n = start >> 6;
1319 if (n >= WORD_COUNT)
return SIZE;
1320 uint32_t m = start & 63u;
1321 uint64_t b = ON ? mWords[n] : ~mWords[n];
1322 if (b & (uint64_t(1u) << m))
return start;
1323 b &= ~uint64_t(0u) << m;
1324 while (!b && ++n < WORD_COUNT) b = ON ? mWords[n] : ~mWords[n];
1332 uint32_t n = start >> 6;
1333 if (n >= WORD_COUNT)
return SIZE;
1334 uint32_t m = start & 63u;
1335 uint64_t b = ON ? mWords[n] : ~mWords[n];
1336 if (b & (uint64_t(1u) << m))
return start;
1337 b &= (uint64_t(1u) << m) - 1u;
1338 while (!b && n) b = ON ? mWords[--n] : ~mWords[--n];
1343 uint64_t mWords[WORD_COUNT];
1362 : mMatF{ 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}
1363 , mInvMatF{1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}
1364 , mVecF{0.0f, 0.0f, 0.0f}
1366 , mMatD{ 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}
1367 , mInvMatD{1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}
1368 , mVecD{0.0, 0.0, 0.0}
1373 : mMatF{float(s), 0.0f, 0.0f, 0.0f, float(s), 0.0f, 0.0f, 0.0f, float(s)}
1374 , mInvMatF{1.0f / float(s), 0.0f, 0.0f, 0.0f, 1.0f / float(s), 0.0f, 0.0f, 0.0f, 1.0f / float(s)}
1375 , mVecF{float(t[0]), float(t[1]), float(t[2])}
1377 , mMatD{s, 0.0, 0.0, 0.0, s, 0.0, 0.0, 0.0, s}
1378 , mInvMatD{1.0 / s, 0.0, 0.0, 0.0, 1.0 / s, 0.0, 0.0, 0.0, 1.0 / s}
1379 , mVecD{t[0], t[1], t[2]}
1386 template<
typename MatT,
typename Vec3T>
1387 void set(
const MatT& mat,
const MatT& invMat,
const Vec3T& translate,
double taper = 1.0);
1392 template<
typename Mat4T>
1393 void set(
const Mat4T& mat,
const Mat4T& invMat,
double taper = 1.0) { this->
set(mat, invMat, mat[3], taper); }
1395 template<
typename Vec3T>
1396 void set(
double scale,
const Vec3T& translation,
double taper = 1.0);
1403 template<
typename Vec3T>
1411 template<
typename Vec3T>
1420 template<
typename Vec3T>
1429 template<
typename Vec3T>
1437 template<
typename Vec3T>
1440 return math::matMult(mInvMatD, Vec3T(xyz[0] - mVecD[0], xyz[1] - mVecD[1], xyz[2] - mVecD[2]));
1448 template<
typename Vec3T>
1451 return math::matMult(mInvMatF, Vec3T(xyz[0] - mVecF[0], xyz[1] - mVecF[1], xyz[2] - mVecF[2]));
1460 template<
typename Vec3T>
1469 template<
typename Vec3T>
1478 template<
typename Vec3T>
1480 template<
typename Vec3T>
1487 template<
typename MatT,
typename Vec3T>
1488 inline void Map::set(
const MatT& mat,
const MatT& invMat,
const Vec3T& translate,
double taper)
1490 float * mf = mMatF, *vf = mVecF, *mif = mInvMatF;
1491 double *md = mMatD, *vd = mVecD, *mid = mInvMatD;
1492 mTaperF =
static_cast<float>(taper);
1494 for (
int i = 0; i < 3; ++i) {
1495 *vd++ = translate[i];
1496 *vf++ =
static_cast<float>(translate[i]);
1497 for (
int j = 0; j < 3; ++j) {
1499 *mid++ = invMat[j][i];
1500 *mf++ =
static_cast<float>(mat[j][i]);
1501 *mif++ =
static_cast<float>(invMat[j][i]);
1506 template<
typename Vec3T>
1507 inline void Map::set(
double dx,
const Vec3T& trans,
double taper)
1510 const double mat[3][3] = { {dx, 0.0, 0.0},
1513 const double idx = 1.0 / dx;
1514 const double invMat[3][3] = { {idx, 0.0, 0.0},
1517 this->
set(mat, invMat, trans, taper);
1524 static const int MaxNameSize = 256;
1531 char mName[MaxNameSize];
1549 template<
typename BlindDataT>
1553 return mDataType == toGridType<BlindDataT>() ? util::PtrAdd<BlindDataT>(
this, mDataOffset) :
nullptr;
1559 auto check = [&]()->
bool{
1577 default:
return true;}
1587 return math::AlignUp<NANOVDB_DATA_ALIGNMENT>(mValueCount * mValueSize);
1595 template<
typename Gr
idOrTreeOrRootT,
int LEVEL>
1599 template<
typename Gr
idOrTreeOrRootT>
1602 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1603 using Type =
typename GridOrTreeOrRootT::LeafNodeType;
1604 using type =
typename GridOrTreeOrRootT::LeafNodeType;
1606 template<
typename Gr
idOrTreeOrRootT>
1609 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1610 using Type =
const typename GridOrTreeOrRootT::LeafNodeType;
1611 using type =
const typename GridOrTreeOrRootT::LeafNodeType;
1614 template<
typename Gr
idOrTreeOrRootT>
1617 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1618 using Type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1619 using type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1621 template<
typename Gr
idOrTreeOrRootT>
1624 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1625 using Type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1626 using type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1628 template<
typename Gr
idOrTreeOrRootT>
1631 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1632 using Type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1633 using type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1635 template<
typename Gr
idOrTreeOrRootT>
1638 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1639 using Type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1640 using type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1642 template<
typename Gr
idOrTreeOrRootT>
1645 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1646 using Type =
typename GridOrTreeOrRootT::RootNodeType;
1647 using type =
typename GridOrTreeOrRootT::RootNodeType;
1650 template<
typename Gr
idOrTreeOrRootT>
1653 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1654 using Type =
const typename GridOrTreeOrRootT::RootNodeType;
1655 using type =
const typename GridOrTreeOrRootT::RootNodeType;
1660 template<
typename BuildT>
1662 template<
typename BuildT>
1664 template<
typename BuildT>
1666 template<
typename BuildT>
1668 template<
typename BuildT>
1670 template<
typename BuildT>
1672 template<
typename BuildT>
1674 template<
typename BuildT>
1712 union { uint32_t mCRC32[2]; uint64_t
mCRC64; };
1716 static constexpr uint32_t EMPTY32 = ~uint32_t{0};
1717 static constexpr uint64_t EMPTY64 = ~uint64_t(0);
1736 [[deprecated(
"Use Checksum::data instead.")]]
1738 [[deprecated(
"Use Checksum::head and Ckecksum::tail instead.")]]
1740 [[deprecated(
"Use Checksum::head and Ckecksum::tail instead.")]]
1751 [[deprecated(
"Use Checksum::isHalf instead.")]]
1812 static const int MaxNameSize = 256;
1820 char mGridName[MaxNameSize];
1835 uint64_t gridSize = 0u,
1840 #ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS 1847 mFlags.initMask(list);
1850 mGridSize = gridSize;
1851 mGridName[0] =
'\0';
1853 mWorldBBox = Vec3dBBox();
1854 mVoxelSize = map.getVoxelSize();
1855 mGridClass = gridClass;
1856 mGridType = gridType;
1857 mBlindMetadataOffset = mGridSize;
1858 mBlindMetadataCount = 0u;
1872 if (test) test = mGridCount > 0u && mGridIndex < mGridCount;
1884 const bool success = (
util::strncpy(mGridName, src, MaxNameSize)[MaxNameSize-1] ==
'\0');
1885 if (!success) mGridName[MaxNameSize-1] =
'\0';
1889 template<
typename Vec3T>
1891 template<
typename Vec3T>
1893 template<
typename Vec3T>
1895 template<
typename Vec3T>
1897 template<
typename Vec3T>
1900 template<
typename Vec3T>
1902 template<
typename Vec3T>
1904 template<
typename Vec3T>
1906 template<
typename Vec3T>
1908 template<
typename Vec3T>
1919 template <u
int32_t LEVEL>
1922 static_assert(LEVEL >= 0 && LEVEL <= 3,
"invalid LEVEL template parameter");
1923 const void *treeData =
this + 1;
1924 const uint64_t nodeOffset = *util::PtrAdd<uint64_t>(treeData, 8*LEVEL);
1925 return nodeOffset ?
util::PtrAdd(treeData, nodeOffset) :
nullptr;
1931 template <u
int32_t LEVEL>
1934 static_assert(LEVEL >= 0 && LEVEL <= 3,
"invalid LEVEL template parameter");
1935 void *treeData =
this + 1;
1936 const uint64_t nodeOffset = *util::PtrAdd<uint64_t>(treeData, 8*LEVEL);
1937 return nodeOffset ?
util::PtrAdd(treeData, nodeOffset) :
nullptr;
1942 template <u
int32_t LEVEL>
1945 static_assert(LEVEL >= 0 && LEVEL < 3,
"invalid LEVEL template parameter");
1946 return *util::PtrAdd<uint32_t>(
this + 1, 4*(8 + LEVEL));
1955 return util::PtrAdd<GridBlindMetaData>(
this, mBlindMetadataOffset) + n;
1962 for (uint32_t i = 0; i < mBlindMetadataCount; ++i) {
1963 const auto* metaData = this->blindMetaData(i);
1966 return metaData->template getBlindData<const char>();
1986 const void *root = this->nodePtr<3>();
1987 return root ? *util::PtrAdd<uint32_t>(root,
sizeof(CoordBBox)) : 0u;
2000 template<
typename BuildT,
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1>
2003 template<
typename BuildT>
2010 template<
typename TreeT>
2030 Grid& operator=(
const Grid&) =
delete;
2054 template<
typename T = BuildType>
2061 template<
typename T = BuildType>
2066 __hostdev__ const TreeT&
tree()
const {
return *
reinterpret_cast<const TreeT*
>(this->treePtr()); }
2081 template<
typename Vec3T>
2085 template<
typename Vec3T>
2090 template<
typename Vec3T>
2095 template<
typename Vec3T>
2100 template<
typename Vec3T>
2104 template<
typename Vec3T>
2108 template<
typename Vec3T>
2113 template<
typename Vec3T>
2118 template<
typename Vec3T>
2123 template<
typename Vec3T>
2159 template<
typename NodeT>
2168 __hostdev__ bool isSequential()
const {
return UpperNodeType::FIXED_SIZE && LowerNodeType::FIXED_SIZE && LeafNodeType::FIXED_SIZE && this->isBreadthFirst(); }
2186 __hostdev__ int findBlindData(
const char* name)
const;
2195 [[deprecated(
"Use Grid::getBlindData<T>() instead.")]]
2198 printf(
"\nnanovdb::Grid::blindData is unsafe and hence deprecated! Please use nanovdb::Grid::getBlindData instead.\n\n");
2200 return this->blindMetaData(n).blindData();
2203 template <
typename BlindDataT>
2206 if (n >= DataType::mBlindMetadataCount)
return nullptr;
2207 return this->blindMetaData(n).template getBlindData<BlindDataT>();
2210 template <
typename BlindDataT>
2213 if (n >= DataType::mBlindMetadataCount)
return nullptr;
2214 return const_cast<BlindDataT*
>(this->blindMetaData(n).template getBlindData<BlindDataT>());
2223 template<
typename TreeT>
2226 for (uint32_t i = 0, n = this->blindDataCount(); i < n; ++i) {
2227 if (this->blindMetaData(i).mSemantic == semantic)
2233 template<
typename TreeT>
2236 auto test = [&](
int n) {
2237 const char* str = this->blindMetaData(n).mName;
2239 if (name[i] != str[i])
2241 if (name[i] ==
'\0' && str[i] ==
'\0')
2246 for (
int i = 0, n = this->blindDataCount(); i < n; ++i)
2256 int64_t mNodeOffset[4];
2257 uint32_t mNodeCount[3];
2258 uint32_t mTileCount[3];
2274 template<
typename NodeT>
2278 __hostdev__ bool isEmpty()
const {
return mNodeOffset[3] ? *util::PtrAdd<uint32_t>(
this, mNodeOffset[3] +
sizeof(CoordBBox)) == 0 :
true;}
2281 __hostdev__ CoordBBox
bbox()
const {
return mNodeOffset[3] ? *util::PtrAdd<CoordBBox>(
this, mNodeOffset[3]) : CoordBBox();}
2290 template<
typename Gr
idT>
2293 using Type =
typename GridT::TreeType;
2294 using type =
typename GridT::TreeType;
2296 template<
typename Gr
idT>
2299 using Type =
const typename GridT::TreeType;
2300 using type =
const typename GridT::TreeType;
2306 template<
typename RootT>
2309 static_assert(RootT::LEVEL == 3,
"Tree depth is not supported");
2310 static_assert(RootT::ChildNodeType::LOG2DIM == 5,
"Tree configuration is not supported");
2311 static_assert(RootT::ChildNodeType::ChildNodeType::LOG2DIM == 4,
"Tree configuration is not supported");
2312 static_assert(RootT::LeafNodeType::LOG2DIM == 3,
"Tree configuration is not supported");
2327 using Node2 =
typename RootT::ChildNodeType;
2328 using Node1 =
typename Node2::ChildNodeType;
2334 Tree& operator=(
const Tree&) =
delete;
2346 __hostdev__ const RootT&
root()
const {
return *
reinterpret_cast<const RootT*
>(DataType::getRoot());}
2383 return DataType::mTileCount[level - 1];
2386 template<
typename NodeT>
2389 static_assert(NodeT::LEVEL < 3,
"Invalid NodeT");
2390 return DataType::mNodeCount[NodeT::LEVEL];
2396 return DataType::mNodeCount[level];
2401 return DataType::mNodeCount[0] + DataType::mNodeCount[1] + DataType::mNodeCount[2];
2407 template<
typename NodeT>
2410 const int64_t nodeOffset = DataType::mNodeOffset[NodeT::LEVEL];
2411 return nodeOffset ? util::PtrAdd<NodeT>(
this, nodeOffset) :
nullptr;
2417 template<
typename NodeT>
2420 const int64_t nodeOffset = DataType::mNodeOffset[NodeT::LEVEL];
2421 return nodeOffset ? util::PtrAdd<NodeT>(
this, nodeOffset) :
nullptr;
2430 return this->
template getFirstNode<typename NodeTrait<RootT, LEVEL>::type>();
2439 return this->
template getFirstNode<typename NodeTrait<RootT, LEVEL>::type>();
2450 template<
typename OpT,
typename... ArgsT>
2453 return this->root().template get<OpT>(ijk, args...);
2456 template<
typename OpT,
typename... ArgsT>
2459 return this->root().template set<OpT>(ijk, args...);
2467 template<
typename RootT>
2470 min = this->root().minimum();
2471 max = this->root().maximum();
2479 template<
typename ChildT>
2486 static constexpr
bool FIXED_SIZE =
false;
2489 #ifdef NANOVDB_USE_SINGLE_ROOT_KEY 2491 template<
typename CoordType>
2494 static_assert(
sizeof(
CoordT) ==
sizeof(CoordType),
"Mismatching sizeof");
2495 static_assert(32 - ChildT::TOTAL <= 21,
"Cannot use 64 bit root keys");
2496 return (
KeyT(uint32_t(ijk[2]) >> ChildT::TOTAL)) |
2497 (
KeyT(uint32_t(ijk[1]) >> ChildT::TOTAL) << 21) |
2498 (
KeyT(uint32_t(ijk[0]) >> ChildT::TOTAL) << 42);
2502 static constexpr uint64_t MASK = (1u << 21) - 1;
2503 return CoordT(((key >> 42) & MASK) << ChildT::TOTAL,
2504 ((key >> 21) & MASK) << ChildT::TOTAL,
2505 (key & MASK) << ChildT::TOTAL);
2529 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
Tile 2531 template<
typename CoordType>
2534 key = CoordToKey(k);
2538 template<
typename CoordType,
typename ValueType>
2541 key = CoordToKey(k);
2562 return reinterpret_cast<const Tile*
>(
this + 1) + n;
2567 return reinterpret_cast<Tile*
>(
this + 1) + n;
2572 #if 1 // switch between linear and binary seach 2573 const auto key = CoordToKey(ijk);
2574 for (
Tile *p = reinterpret_cast<Tile*>(
this + 1), *q = p + mTableSize; p < q; ++p)
2578 #else // do not enable binary search if tiles are not guaranteed to be sorted!!!!!! 2579 int32_t low = 0, high = mTableSize;
2580 while (low != high) {
2581 int mid = low + ((high - low) >> 1);
2582 const Tile* tile = &tiles[mid];
2583 if (tile->
key == key) {
2585 }
else if (tile->
key < key) {
2597 return const_cast<RootData*
>(
this)->probeTile(ijk);
2606 return util::PtrAdd<ChildT>(
this, tile->
child);
2611 return util::PtrAdd<ChildT>(
this, tile->
child);
2634 template<
typename ChildT>
2653 static constexpr
bool FIXED_SIZE = DataType::FIXED_SIZE;
2655 static constexpr uint32_t LEVEL = 1 + ChildT::LEVEL;
2657 template<
typename RootT>
2680 return this->tile()->origin();
2685 return this->tile()->origin();
2689 template<
typename RootT>
2702 :
BaseT(parent->data(), parent->tileCount())
2705 while (*
this && !this->tile()->isChild())
2711 return *BaseT::mData->getChild(this->tile());
2716 return BaseT::mData->getChild(this->tile());
2722 while (*
this && this->tile()->isValue())
2740 template<
typename RootT>
2751 :
BaseT(parent->data(), parent->tileCount())
2754 while (*
this && this->tile()->isChild())
2760 return this->tile()->value;
2765 return this->tile()->state;
2771 while (*
this && this->tile()->isChild())
2789 template<
typename RootT>
2800 :
BaseT(parent->data(), parent->tileCount())
2803 while (*
this && !this->tile()->isActive())
2809 return this->tile()->value;
2815 while (*
this && !this->tile()->isActive())
2833 template<
typename RootT>
2845 :
BaseT(parent->data(), parent->tileCount())
2852 NodeT* child =
nullptr;
2853 auto* t = this->tile();
2855 child = BaseT::mData->getChild(t);
2864 return this->tile()->state;
2936 #ifdef NANOVDB_NEW_ACCESSOR_METHODS 2944 #else // NANOVDB_NEW_ACCESSOR_METHODS 2949 if (
const Tile* tile = DataType::probeTile(ijk)) {
2950 return tile->isChild() ? this->getChild(tile)->getValue(ijk) : tile->value;
2952 return DataType::mBackground;
2958 if (
const Tile* tile = DataType::probeTile(ijk)) {
2959 return tile->isChild() ? this->getChild(tile)->isActive(ijk) : tile->state;
2966 if (
const Tile* tile = DataType::probeTile(ijk)) {
2967 if (tile->isChild()) {
2968 const auto* child = this->getChild(tile);
2969 return child->probeValue(ijk, v);
2974 v = DataType::mBackground;
2980 const Tile* tile = DataType::probeTile(ijk);
2981 if (tile && tile->isChild()) {
2982 const auto* child = this->getChild(tile);
2983 return child->probeLeaf(ijk);
2988 #endif // NANOVDB_NEW_ACCESSOR_METHODS 2992 const Tile* tile = DataType::probeTile(ijk);
2993 return tile && tile->isChild() ? this->getChild(tile) :
nullptr;
2998 const Tile* tile = DataType::probeTile(ijk);
2999 return tile && tile->isChild() ? this->getChild(tile) :
nullptr;
3002 template<
typename OpT,
typename... ArgsT>
3005 if (
const Tile* tile = this->probeTile(ijk)) {
3006 if (tile->isChild())
3007 return this->getChild(tile)->template get<OpT>(ijk, args...);
3008 return OpT::get(*tile, args...);
3010 return OpT::get(*
this, args...);
3013 template<
typename OpT,
typename... ArgsT>
3015 __hostdev__ decltype(OpT::set(util::declval<Tile&>(), util::declval<ArgsT>()...))
3018 if (
Tile* tile = DataType::probeTile(ijk)) {
3019 if (tile->isChild())
3020 return this->getChild(tile)->template set<OpT>(ijk, args...);
3021 return OpT::set(*tile, args...);
3023 return OpT::set(*
this, args...);
3030 template<
typename,
int,
int,
int>
3035 #ifndef NANOVDB_NEW_ACCESSOR_METHODS 3037 template<
typename AccT>
3038 __hostdev__ typename AccT::NodeInfo getNodeInfoAndCache(
const CoordType& ijk,
const AccT& acc)
const 3040 using NodeInfoT =
typename AccT::NodeInfo;
3041 if (
const Tile* tile = this->probeTile(ijk)) {
3042 if (tile->isChild()) {
3043 const auto* child = this->getChild(tile);
3044 acc.insert(ijk, child);
3045 return child->getNodeInfoAndCache(ijk, acc);
3047 return NodeInfoT{LEVEL, ChildT::dim(), tile->value, tile->value, tile->value, 0, tile->origin(), tile->origin() +
CoordType(ChildT::DIM)};
3049 return NodeInfoT{LEVEL, ChildT::dim(), this->minimum(), this->maximum(), this->average(), this->stdDeviation(), this->bbox()[0], this->bbox()[1]};
3053 template<
typename AccT>
3056 if (
const Tile* tile = this->probeTile(ijk)) {
3057 if (tile->isChild()) {
3058 const auto* child = this->getChild(tile);
3059 acc.insert(ijk, child);
3060 return child->getValueAndCache(ijk, acc);
3064 return DataType::mBackground;
3067 template<
typename AccT>
3070 const Tile* tile = this->probeTile(ijk);
3071 if (tile && tile->isChild()) {
3072 const auto* child = this->getChild(tile);
3073 acc.insert(ijk, child);
3074 return child->isActiveAndCache(ijk, acc);
3079 template<
typename AccT>
3082 if (
const Tile* tile = this->probeTile(ijk)) {
3083 if (tile->isChild()) {
3084 const auto* child = this->getChild(tile);
3085 acc.insert(ijk, child);
3086 return child->probeValueAndCache(ijk, v, acc);
3091 v = DataType::mBackground;
3095 template<
typename AccT>
3098 const Tile* tile = this->probeTile(ijk);
3099 if (tile && tile->isChild()) {
3100 const auto* child = this->getChild(tile);
3101 acc.insert(ijk, child);
3102 return child->probeLeafAndCache(ijk, acc);
3106 #endif // NANOVDB_NEW_ACCESSOR_METHODS 3108 template<
typename RayT,
typename AccT>
3109 __hostdev__ uint32_t getDimAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const 3111 if (
const Tile* tile = this->probeTile(ijk)) {
3112 if (tile->isChild()) {
3113 const auto* child = this->getChild(tile);
3114 acc.insert(ijk, child);
3115 return child->getDimAndCache(ijk, ray, acc);
3117 return 1 << ChildT::TOTAL;
3119 return ChildNodeType::dim();
3122 template<
typename OpT,
typename AccT,
typename... ArgsT>
3125 getAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
const 3127 if (
const Tile* tile = this->probeTile(ijk)) {
3128 if (tile->isChild()) {
3129 const ChildT* child = this->getChild(tile);
3130 acc.insert(ijk, child);
3131 return child->template getAndCache<OpT>(ijk, acc, args...);
3133 return OpT::get(*tile, args...);
3135 return OpT::get(*
this, args...);
3138 template<
typename OpT,
typename AccT,
typename... ArgsT>
3140 __hostdev__ decltype(OpT::set(util::declval<Tile&>(), util::declval<ArgsT>()...))
3141 setAndCache(const
CoordType& ijk, const AccT& acc, ArgsT&&... args)
3143 if (
Tile* tile = DataType::probeTile(ijk)) {
3144 if (tile->isChild()) {
3145 ChildT* child = this->getChild(tile);
3146 acc.insert(ijk, child);
3147 return child->template setAndCache<OpT>(ijk, acc, args...);
3149 return OpT::set(*tile, args...);
3151 return OpT::set(*
this, args...);
3163 template<
typename ChildT, u
int32_t LOG2DIM>
3170 using MaskT =
typename ChildT::template MaskType<LOG2DIM>;
3171 static constexpr
bool FIXED_SIZE =
true;
3180 Tile& operator=(
const Tile&) =
delete;
3202 alignas(32) Tile mTable[1u << (3 * LOG2DIM)];
3212 template<
typename ValueT>
3216 mTable[n].value = v;
3223 return util::PtrAdd<ChildT>(
this, mTable[n].child);
3228 return util::PtrAdd<ChildT>(
this, mTable[n].child);
3234 return mTable[n].value;
3240 return mValueMask.isOn(n);
3245 template<
typename T>
3253 #if defined(__GNUC__) && !defined(__APPLE__) && !defined(__llvm__) 3254 #pragma GCC diagnostic push 3255 #pragma GCC diagnostic ignored "-Wstringop-overflow" 3261 #if defined(__GNUC__) && !defined(__APPLE__) && !defined(__llvm__) 3262 #pragma GCC diagnostic pop 3273 template<
typename ChildT, u
int32_t Log2Dim = ChildT::LOG2DIM + 1>
3284 static constexpr
bool FIXED_SIZE = DataType::FIXED_SIZE;
3285 template<u
int32_t LOG2>
3290 static constexpr uint32_t LOG2DIM = Log2Dim;
3291 static constexpr uint32_t TOTAL = LOG2DIM + ChildT::TOTAL;
3292 static constexpr uint32_t DIM = 1u << TOTAL;
3293 static constexpr uint32_t SIZE = 1u << (3 * LOG2DIM);
3294 static constexpr uint32_t MASK = (1u << TOTAL) - 1u;
3295 static constexpr uint32_t LEVEL = 1 + ChildT::LEVEL;
3296 static constexpr uint64_t NUM_VALUES = uint64_t(1) << (3 * TOTAL);
3299 template <
typename ParentT>
3314 : BaseT(parent->mChildMask.beginOn())
3322 return *mParent->getChild(BaseT::pos());
3327 return mParent->getChild(BaseT::pos());
3332 return (*this)->origin();
3356 : BaseT(parent->data()->mChildMask.beginOff())
3395 : BaseT(parent->data()->mValueMask.beginOn())
3430 , mParent(parent->data())
3437 const ChildT* child =
nullptr;
3438 if (mParent->
mChildMask.isOn(BaseT::pos())) {
3439 child = mParent->
getChild(BaseT::pos());
3441 value = mParent->
getValue(BaseT::pos());
3448 return mParent->
isActive(BaseT::pos());
3453 return mParent->offsetToGlobalCoord(BaseT::pos());
3510 return DataType::mChildMask.isOn(0) ? this->getChild(0)->getFirstValue() : DataType::getValue(0);
3517 return DataType::mChildMask.isOn(SIZE - 1) ? this->getChild(SIZE - 1)->getLastValue() : DataType::getValue(SIZE - 1);
3520 #ifdef NANOVDB_NEW_ACCESSOR_METHODS 3527 #else // NANOVDB_NEW_ACCESSOR_METHODS 3530 const uint32_t n = CoordToOffset(ijk);
3531 return DataType::mChildMask.isOn(n) ? this->getChild(n)->getValue(ijk) : DataType::getValue(n);
3535 const uint32_t n = CoordToOffset(ijk);
3536 return DataType::mChildMask.isOn(n) ? this->getChild(n)->isActive(ijk) : DataType::isActive(n);
3540 const uint32_t n = CoordToOffset(ijk);
3541 if (DataType::mChildMask.isOn(n))
3542 return this->getChild(n)->probeValue(ijk, v);
3543 v = DataType::getValue(n);
3544 return DataType::isActive(n);
3548 const uint32_t n = CoordToOffset(ijk);
3549 if (DataType::mChildMask.isOn(n))
3550 return this->getChild(n)->probeLeaf(ijk);
3554 #endif // NANOVDB_NEW_ACCESSOR_METHODS 3558 const uint32_t n = CoordToOffset(ijk);
3559 return DataType::mChildMask.isOn(n) ? this->getChild(n) :
nullptr;
3563 const uint32_t n = CoordToOffset(ijk);
3564 return DataType::mChildMask.isOn(n) ? this->getChild(n) :
nullptr;
3570 return (((ijk[0] & MASK) >> ChildT::TOTAL) << (2 * LOG2DIM)) |
3571 (((ijk[1] & MASK) >> ChildT::TOTAL) << (LOG2DIM)) |
3572 ((ijk[2] & MASK) >> ChildT::TOTAL);
3579 const uint32_t m = n & ((1 << 2 * LOG2DIM) - 1);
3580 return Coord(n >> 2 * LOG2DIM, m >> LOG2DIM, m & ((1 << LOG2DIM) - 1));
3586 ijk <<= ChildT::TOTAL;
3587 ijk += this->origin();
3593 this->localToGlobalCoord(ijk);
3600 template<
typename OpT,
typename... ArgsT>
3603 const uint32_t n = CoordToOffset(ijk);
3604 if (this->isChild(n))
3605 return this->getChild(n)->template get<OpT>(ijk, args...);
3606 return OpT::get(*
this, n, args...);
3609 template<
typename OpT,
typename... ArgsT>
3611 __hostdev__ decltype(OpT::set(util::declval<InternalNode&>(), util::declval<uint32_t>(), util::declval<ArgsT>()...))
3614 const uint32_t n = CoordToOffset(ijk);
3615 if (this->isChild(n))
3616 return this->getChild(n)->template set<OpT>(ijk, args...);
3617 return OpT::set(*
this, n, args...);
3623 template<
typename,
int,
int,
int>
3628 template<
typename, u
int32_t>
3631 #ifndef NANOVDB_NEW_ACCESSOR_METHODS 3633 template<
typename AccT>
3636 const uint32_t n = CoordToOffset(ijk);
3637 if (DataType::mChildMask.isOff(n))
3638 return DataType::getValue(n);
3639 const ChildT* child = this->getChild(n);
3640 acc.insert(ijk, child);
3641 return child->getValueAndCache(ijk, acc);
3643 template<
typename AccT>
3646 const uint32_t n = CoordToOffset(ijk);
3647 if (DataType::mChildMask.isOff(n))
3648 return DataType::isActive(n);
3649 const ChildT* child = this->getChild(n);
3650 acc.insert(ijk, child);
3651 return child->isActiveAndCache(ijk, acc);
3653 template<
typename AccT>
3656 const uint32_t n = CoordToOffset(ijk);
3657 if (DataType::mChildMask.isOff(n)) {
3658 v = DataType::getValue(n);
3659 return DataType::isActive(n);
3661 const ChildT* child = this->getChild(n);
3662 acc.insert(ijk, child);
3663 return child->probeValueAndCache(ijk, v, acc);
3665 template<
typename AccT>
3668 const uint32_t n = CoordToOffset(ijk);
3669 if (DataType::mChildMask.isOff(n))
3671 const ChildT* child = this->getChild(n);
3672 acc.insert(ijk, child);
3673 return child->probeLeafAndCache(ijk, acc);
3675 template<
typename AccT>
3676 __hostdev__ typename AccT::NodeInfo getNodeInfoAndCache(
const CoordType& ijk,
const AccT& acc)
const 3678 using NodeInfoT =
typename AccT::NodeInfo;
3679 const uint32_t n = CoordToOffset(ijk);
3680 if (DataType::mChildMask.isOff(n)) {
3681 return NodeInfoT{LEVEL, this->dim(), this->minimum(), this->maximum(), this->average(), this->stdDeviation(), this->bbox()[0], this->bbox()[1]};
3683 const ChildT* child = this->getChild(n);
3684 acc.insert(ijk, child);
3685 return child->getNodeInfoAndCache(ijk, acc);
3687 #endif // NANOVDB_NEW_ACCESSOR_METHODS 3689 template<
typename RayT,
typename AccT>
3690 __hostdev__ uint32_t getDimAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const 3692 if (DataType::mFlags & uint32_t(1u))
3696 const uint32_t n = CoordToOffset(ijk);
3697 if (DataType::mChildMask.isOn(n)) {
3698 const ChildT* child = this->getChild(n);
3699 acc.insert(ijk, child);
3700 return child->getDimAndCache(ijk, ray, acc);
3702 return ChildNodeType::dim();
3705 template<
typename OpT,
typename AccT,
typename... ArgsT>
3708 getAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
const 3710 const uint32_t n = CoordToOffset(ijk);
3711 if (DataType::mChildMask.isOff(n))
3712 return OpT::get(*
this, n, args...);
3713 const ChildT* child = this->getChild(n);
3714 acc.insert(ijk, child);
3715 return child->template getAndCache<OpT>(ijk, acc, args...);
3718 template<
typename OpT,
typename AccT,
typename... ArgsT>
3720 __hostdev__ decltype(OpT::set(util::declval<InternalNode&>(), util::declval<uint32_t>(), util::declval<ArgsT>()...))
3721 setAndCache(const
CoordType& ijk, const AccT& acc, ArgsT&&... args)
3723 const uint32_t n = CoordToOffset(ijk);
3724 if (DataType::mChildMask.isOff(n))
3725 return OpT::set(*
this, n, args...);
3726 ChildT* child = this->getChild(n);
3727 acc.insert(ijk, child);
3728 return child->template setAndCache<OpT>(ijk, acc, args...);
3738 template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3741 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3742 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3747 static constexpr
bool FIXED_SIZE =
true;
3750 uint8_t mBBoxDif[3];
3765 return sizeof(
LeafData) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>) + 2 * (
sizeof(ValueT) +
sizeof(
FloatType)) + (1u << (3 * LOG2DIM)) *
sizeof(ValueT));
3775 mValueMask.setOn(offset);
3776 mValues[offset] = value;
3790 template<
typename T>
3795 for (
auto *p = mValues, *q = p + 512; p != q; ++p)
3809 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3812 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3813 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3818 uint8_t mBBoxDif[3];
3835 return sizeof(
LeafFnBase) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>) + 2 * 4 + 4 * 2);
3840 mQuantum = (max -
min) /
float((1 << bitWidth) - 1);
3870 template<
typename T>
3879 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3880 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp4, CoordT, MaskT, LOG2DIM>
3886 static constexpr
bool FIXED_SIZE =
true;
3887 alignas(32) uint8_t mCode[1u << (3 * LOG2DIM - 1)];
3892 static_assert(BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3893 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << (3 * LOG2DIM - 1));
3900 const uint8_t c = mCode[i>>1];
3901 return ( (i&1) ? c >> 4 : c & uint8_t(15) )*BaseT::mQuantum + BaseT::mMinimum;
3903 return ((mCode[i >> 1] >> ((i & 1) << 2)) & uint8_t(15)) * BaseT::mQuantum + BaseT::mMinimum;
3916 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3917 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp8, CoordT, MaskT, LOG2DIM>
3923 static constexpr
bool FIXED_SIZE =
true;
3924 alignas(32) uint8_t mCode[1u << 3 * LOG2DIM];
3928 static_assert(BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3929 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << 3 * LOG2DIM);
3935 return mCode[i] * BaseT::mQuantum + BaseT::mMinimum;
3946 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3947 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp16, CoordT, MaskT, LOG2DIM>
3953 static constexpr
bool FIXED_SIZE =
true;
3954 alignas(32) uint16_t mCode[1u << 3 * LOG2DIM];
3959 static_assert(BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3960 return sizeof(
LeafData) -
sizeof(
BaseT) - 2 * (1u << 3 * LOG2DIM);
3966 return mCode[i] * BaseT::mQuantum + BaseT::mMinimum;
3978 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3979 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
FpN, CoordT, MaskT, LOG2DIM>
3985 static constexpr
bool FIXED_SIZE =
false;
3988 static_assert(BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3997 #ifdef NANOVDB_FPN_BRANCHLESS // faster 3998 const int b = BaseT::mFlags >> 5;
4000 uint16_t code =
reinterpret_cast<const uint16_t*
>(
this + 1)[i >> (4 - b)];
4001 const static uint8_t shift[5] = {15, 7, 3, 1, 0};
4002 const static uint16_t mask[5] = {1, 3, 15, 255, 65535};
4003 code >>= (i & shift[b]) << b;
4006 uint32_t code =
reinterpret_cast<const uint32_t*
>(
this + 1)[i >> (5 - b)];
4007 code >>= (i & ((32 >> b) - 1)) << b;
4008 code &= (1 << (1 << b)) - 1;
4010 #else // use branched version (slow) 4012 auto* values =
reinterpret_cast<const uint8_t*
>(
this + 1);
4013 switch (BaseT::mFlags >> 5) {
4015 code = float((values[i >> 3] >> (i & 7)) & uint8_t(1));
4018 code = float((values[i >> 2] >> ((i & 3) << 1)) & uint8_t(3));
4021 code = float((values[i >> 1] >> ((i & 1) << 2)) & uint8_t(15));
4024 code = float(values[i]);
4027 code = float(reinterpret_cast<const uint16_t*>(values)[i]);
4030 return float(code) * BaseT::mQuantum + BaseT::mMinimum;
4043 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4044 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
bool, CoordT, MaskT, LOG2DIM>
4046 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4047 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4052 static constexpr
bool FIXED_SIZE =
true;
4055 uint8_t mBBoxDif[3];
4059 uint64_t mPadding[2];
4071 mValueMask.setOn(offset);
4072 mValues.set(offset, v);
4080 template<
typename T>
4093 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4096 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4097 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4102 static constexpr
bool FIXED_SIZE =
true;
4105 uint8_t mBBoxDif[3];
4108 uint64_t mPadding[2];
4114 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u);
4129 template<
typename T>
4142 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4145 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4146 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4150 static constexpr
bool FIXED_SIZE =
true;
4153 uint8_t mBBoxDif[3];
4159 return sizeof(
LeafIndexBase) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u);
4170 template<
typename T>
4184 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4204 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4212 return util::countOn(BaseT::mValueMask.words()[7]) + (BaseT::mPrefixSum >> 54u & 511u);
4222 uint32_t n = i >> 6;
4223 const uint64_t w = BaseT::mValueMask.words()[n], mask = uint64_t(1) << (i & 63u);
4224 if (!(w & mask))
return uint64_t(0);
4225 uint64_t sum = BaseT::mOffset +
util::countOn(w & (mask - 1u));
4226 if (n--) sum += BaseT::mPrefixSum >> (9u * n) & 511u;
4233 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4235 :
public LeafData<ValueIndex, CoordT, MaskT, LOG2DIM>
4244 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4246 :
public LeafData<ValueOnIndex, CoordT, MaskT, LOG2DIM>
4257 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4258 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Point, CoordT, MaskT, LOG2DIM>
4260 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4261 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4266 static constexpr
bool FIXED_SIZE =
true;
4269 uint8_t mBBoxDif[3];
4275 alignas(32) uint16_t mValues[1u << 3 * LOG2DIM];
4283 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u + (1u << 3 * LOG2DIM) * 2u);
4289 __hostdev__ uint64_t
first(uint32_t i)
const {
return i ? uint64_t(mValues[i - 1u]) + mOffset : mOffset; }
4295 mValueMask.setOn(offset);
4296 mValues[offset] = value;
4310 template<
typename T>
4323 template<
typename BuildT,
4324 typename CoordT = Coord,
4325 template<u
int32_t>
class MaskT =
Mask,
4326 uint32_t Log2Dim = 3>
4332 static constexpr uint32_t TOTAL = 0;
4333 static constexpr uint32_t DIM = 1;
4342 static constexpr
bool FIXED_SIZE = DataType::FIXED_SIZE;
4343 template<u
int32_t LOG2>
4361 : BaseT(parent->data()->mValueMask.beginOn())
4369 return mParent->
getValue(BaseT::pos());
4394 : BaseT(parent->data()->mValueMask.beginOff())
4402 return mParent->
getValue(BaseT::pos());
4423 , mPos(1u << 3 * Log2Dim)
4466 static constexpr uint32_t LOG2DIM = Log2Dim;
4467 static constexpr uint32_t TOTAL = LOG2DIM;
4468 static constexpr uint32_t DIM = 1u << TOTAL;
4469 static constexpr uint32_t SIZE = 1u << 3 * LOG2DIM;
4470 static constexpr uint32_t MASK = (1u << LOG2DIM) - 1u;
4471 static constexpr uint32_t LEVEL = 0;
4472 static constexpr uint64_t NUM_VALUES = uint64_t(1) << (3 * TOTAL);
4508 const uint32_t m = n & ((1 << 2 * LOG2DIM) - 1);
4509 return CoordT(n >> 2 * LOG2DIM, m >> LOG2DIM, m & MASK);
4517 return OffsetToLocalCoord(n) + this->origin();
4526 math::BBox<CoordT> bbox(DataType::mBBoxMin, DataType::mBBoxMin);
4527 if (this->hasBBox()) {
4528 bbox.max()[0] += DataType::mBBoxDif[0];
4529 bbox.max()[1] += DataType::mBBoxDif[1];
4530 bbox.max()[2] += DataType::mBBoxDif[2];
4532 bbox = math::BBox<CoordT>();
4582 return !DataType::mValueMask.isOff();
4590 const uint32_t n = CoordToOffset(ijk);
4591 v = DataType::getValue(n);
4592 return DataType::mValueMask.isOn(n);
4600 return ((ijk[0] & MASK) << (2 * LOG2DIM)) | ((ijk[1] & MASK) << LOG2DIM) | (ijk[2] & MASK);
4612 template<
typename OpT,
typename... ArgsT>
4615 return OpT::get(*
this, CoordToOffset(ijk), args...);
4618 template<
typename OpT,
typename... ArgsT>
4621 return OpT::get(*
this, n, args...);
4624 template<
typename OpT,
typename... ArgsT>
4627 return OpT::set(*
this, CoordToOffset(ijk), args...);
4630 template<
typename OpT,
typename... ArgsT>
4633 return OpT::set(*
this, n, args...);
4639 template<
typename,
int,
int,
int>
4644 template<
typename, u
int32_t>
4647 #ifndef NANOVDB_NEW_ACCESSOR_METHODS 4649 template<
typename AccT>
4650 __hostdev__ ValueType getValueAndCache(
const CoordT& ijk,
const AccT&)
const {
return this->getValue(ijk); }
4653 template<
typename AccT>
4656 using NodeInfoT =
typename AccT::NodeInfo;
4657 return NodeInfoT{LEVEL, this->dim(), this->minimum(), this->maximum(), this->average(), this->stdDeviation(), this->bbox()[0], this->bbox()[1]};
4660 template<
typename AccT>
4661 __hostdev__ bool isActiveAndCache(
const CoordT& ijk,
const AccT&)
const {
return this->isActive(ijk); }
4663 template<
typename AccT>
4664 __hostdev__ bool probeValueAndCache(
const CoordT& ijk,
ValueType& v,
const AccT&)
const {
return this->probeValue(ijk, v); }
4666 template<
typename AccT>
4667 __hostdev__ const LeafNode* probeLeafAndCache(
const CoordT&,
const AccT&)
const {
return this; }
4670 template<
typename RayT,
typename AccT>
4671 __hostdev__ uint32_t getDimAndCache(
const CoordT&,
const RayT& ,
const AccT&)
const 4673 if (DataType::mFlags & uint8_t(1u))
4677 return ChildNodeType::dim();
4680 template<
typename OpT,
typename AccT,
typename... ArgsT>
4683 getAndCache(
const CoordType& ijk,
const AccT&, ArgsT&&... args)
const 4685 return OpT::get(*
this, CoordToOffset(ijk), args...);
4688 template<
typename OpT,
typename AccT,
typename... ArgsT>
4690 __hostdev__ decltype(OpT::set(util::declval<LeafNode&>(), util::declval<uint32_t>(), util::declval<ArgsT>()...))
4691 setAndCache(const
CoordType& ijk, const AccT&, ArgsT&&... args)
4693 return OpT::set(*
this, CoordToOffset(ijk), args...);
4700 template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4703 static_assert(LOG2DIM == 3,
"LeafNode::updateBBox: only supports LOGDIM = 3!");
4704 if (DataType::mValueMask.isOff()) {
4705 DataType::mFlags &= ~uint8_t(2);
4708 auto update = [&](uint32_t
min, uint32_t
max,
int axis) {
4710 DataType::mBBoxMin[axis] = (DataType::mBBoxMin[axis] & ~MASK) +
int(min);
4711 DataType::mBBoxDif[axis] = uint8_t(max - min);
4713 uint64_t *w = DataType::mValueMask.words(), word64 = *w;
4714 uint32_t Xmin = word64 ? 0u : 8u, Xmax = Xmin;
4715 for (
int i = 1; i < 8; ++i) {
4724 update(Xmin, Xmax, 0);
4726 const uint32_t *p =
reinterpret_cast<const uint32_t*
>(&word64), word32 = p[0] | p[1];
4727 const uint16_t *q =
reinterpret_cast<const uint16_t*
>(&word32), word16 = q[0] | q[1];
4728 const uint8_t *b =
reinterpret_cast<const uint8_t*
>(&word16), byte = b[0] | b[1];
4731 DataType::mFlags |= uint8_t(2);
4739 template<
typename BuildT>
4741 template<
typename BuildT>
4743 template<
typename BuildT>
4745 template<
typename BuildT>
4747 template<
typename BuildT>
4749 template<
typename BuildT>
4753 template<
typename BuildT,
int LEVEL>
4757 template<
typename BuildT>
4763 template<
typename BuildT>
4769 template<
typename BuildT>
4775 template<
typename BuildT>
4854 template<
typename OpT,
typename GridDataT,
typename... ArgsT>
4858 switch (gridData->mGridType){
4860 return OpT::template known<float>(gridData, args...);
4862 return OpT::template known<double>(gridData, args...);
4864 return OpT::template known<int16_t>(gridData, args...);
4866 return OpT::template known<int32_t>(gridData, args...);
4868 return OpT::template known<int64_t>(gridData, args...);
4870 return OpT::template known<Vec3f>(gridData, args...);
4872 return OpT::template known<Vec3d>(gridData, args...);
4874 return OpT::template known<uint32_t>(gridData, args...);
4876 return OpT::template known<ValueMask>(gridData, args...);
4878 return OpT::template known<ValueIndex>(gridData, args...);
4880 return OpT::template known<ValueOnIndex>(gridData, args...);
4882 return OpT::template known<ValueIndexMask>(gridData, args...);
4884 return OpT::template known<ValueOnIndexMask>(gridData, args...);
4886 return OpT::template known<bool>(gridData, args...);
4888 return OpT::template known<math::Rgba8>(gridData, args...);
4890 return OpT::template known<Fp4>(gridData, args...);
4892 return OpT::template known<Fp8>(gridData, args...);
4894 return OpT::template known<Fp16>(gridData, args...);
4896 return OpT::template known<FpN>(gridData, args...);
4898 return OpT::template known<Vec4f>(gridData, args...);
4900 return OpT::template known<Vec4d>(gridData, args...);
4902 return OpT::template known<uint8_t>(gridData, args...);
4904 return OpT::unknown(gridData, args...);
4929 template<
typename BuildT>
4939 mutable const RootT* mRoot;
4945 static const int CacheLevels = 0;
4946 #ifndef NANOVDB_NEW_ACCESSOR_METHODS 4967 : ReadAccessor(grid.tree().root())
4973 : ReadAccessor(tree.root())
4987 #ifdef NANOVDB_NEW_ACCESSOR_METHODS 4990 return this->
template get<GetValue<BuildT>>(ijk);
4999 #else // NANOVDB_NEW_ACCESSOR_METHODS 5002 return mRoot->getValueAndCache(ijk, *
this);
5006 return this->getValue(
CoordType(i, j, k));
5010 return this->getValue(ijk);
5014 return this->getValue(
CoordType(i, j, k));
5019 return mRoot->getNodeInfoAndCache(ijk, *
this);
5024 return mRoot->isActiveAndCache(ijk, *
this);
5029 return mRoot->probeValueAndCache(ijk, v, *
this);
5034 return mRoot->probeLeafAndCache(ijk, *
this);
5036 #endif // NANOVDB_NEW_ACCESSOR_METHODS 5037 template<
typename RayT>
5040 return mRoot->getDimAndCache(ijk, ray, *
this);
5042 template<
typename OpT,
typename... ArgsT>
5045 return mRoot->template get<OpT>(ijk, args...);
5048 template<
typename OpT,
typename... ArgsT>
5051 return const_cast<RootT*
>(mRoot)->
template set<OpT>(ijk, args...);
5058 template<
typename, u
int32_t>
5060 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5064 template<
typename NodeT>
5069 template<
typename BuildT,
int LEVEL0>
5072 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 should be 0, 1, or 2");
5086 mutable CoordT mKey;
5087 mutable const RootT* mRoot;
5088 mutable const NodeT* mNode;
5095 static const int CacheLevels = 1;
5096 #ifndef NANOVDB_NEW_ACCESSOR_METHODS 5097 using NodeInfo =
typename ReadAccessor<ValueT, -1, -1, -1>::NodeInfo;
5109 : ReadAccessor(grid.tree().root())
5115 : ReadAccessor(tree.root())
5135 return (ijk[0] & int32_t(~NodeT::MASK)) == mKey[0] &&
5136 (ijk[1] & int32_t(~NodeT::MASK)) == mKey[1] &&
5137 (ijk[2] & int32_t(~NodeT::MASK)) == mKey[2];
5140 #ifdef NANOVDB_NEW_ACCESSOR_METHODS 5143 return this->
template get<GetValue<BuildT>>(ijk);
5152 #else // NANOVDB_NEW_ACCESSOR_METHODS 5155 if (this->isCached(ijk))
5156 return mNode->getValueAndCache(ijk, *
this);
5157 return mRoot->getValueAndCache(ijk, *
this);
5161 return this->getValue(
CoordType(i, j, k));
5165 return this->getValue(ijk);
5169 return this->getValue(
CoordType(i, j, k));
5174 if (this->isCached(ijk))
5175 return mNode->getNodeInfoAndCache(ijk, *
this);
5176 return mRoot->getNodeInfoAndCache(ijk, *
this);
5181 if (this->isCached(ijk))
5182 return mNode->isActiveAndCache(ijk, *
this);
5183 return mRoot->isActiveAndCache(ijk, *
this);
5188 if (this->isCached(ijk))
5189 return mNode->probeValueAndCache(ijk, v, *
this);
5190 return mRoot->probeValueAndCache(ijk, v, *
this);
5195 if (this->isCached(ijk))
5196 return mNode->probeLeafAndCache(ijk, *
this);
5197 return mRoot->probeLeafAndCache(ijk, *
this);
5199 #endif // NANOVDB_NEW_ACCESSOR_METHODS 5200 template<
typename RayT>
5203 if (this->isCached(ijk))
5204 return mNode->getDimAndCache(ijk, ray, *
this);
5205 return mRoot->getDimAndCache(ijk, ray, *
this);
5208 template<
typename OpT,
typename... ArgsT>
5211 if (this->isCached(ijk))
5212 return mNode->template getAndCache<OpT>(ijk, *
this, args...);
5213 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5216 template<
typename OpT,
typename... ArgsT>
5219 if (this->isCached(ijk))
5220 return const_cast<NodeT*>(mNode)->template setAndCache<OpT>(ijk, *
this, args...);
5221 return const_cast<RootT*
>(mRoot)->
template setAndCache<OpT>(ijk, *
this, args...);
5228 template<
typename, u
int32_t>
5230 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5236 mKey = ijk & ~NodeT::MASK;
5241 template<
typename OtherNodeT>
5246 template<
typename BuildT,
int LEVEL0,
int LEVEL1>
5249 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 must be 0, 1, 2");
5250 static_assert(LEVEL1 >= 0 && LEVEL1 <= 2,
"LEVEL1 must be 0, 1, 2");
5251 static_assert(LEVEL0 < LEVEL1,
"Level 0 must be lower than level 1");
5264 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY // 44 bytes total 5265 mutable CoordT mKey;
5266 #else // 68 bytes total 5267 mutable CoordT mKeys[2];
5269 mutable const RootT* mRoot;
5270 mutable const Node1T* mNode1;
5271 mutable const Node2T* mNode2;
5278 static const int CacheLevels = 2;
5279 #ifndef NANOVDB_NEW_ACCESSOR_METHODS 5280 using NodeInfo =
typename ReadAccessor<ValueT, -1, -1, -1>::NodeInfo;
5284 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5297 : ReadAccessor(grid.tree().root())
5303 : ReadAccessor(tree.root())
5310 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5326 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5327 __hostdev__ bool isCached1(CoordValueType dirty)
const 5331 if (dirty & int32_t(~Node1T::MASK)) {
5337 __hostdev__ bool isCached2(CoordValueType dirty)
const 5341 if (dirty & int32_t(~Node2T::MASK)) {
5349 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
5354 return (ijk[0] & int32_t(~Node1T::MASK)) == mKeys[0][0] &&
5355 (ijk[1] & int32_t(~Node1T::MASK)) == mKeys[0][1] &&
5356 (ijk[2] & int32_t(~Node1T::MASK)) == mKeys[0][2];
5360 return (ijk[0] & int32_t(~Node2T::MASK)) == mKeys[1][0] &&
5361 (ijk[1] & int32_t(~Node2T::MASK)) == mKeys[1][1] &&
5362 (ijk[2] & int32_t(~Node2T::MASK)) == mKeys[1][2];
5366 #ifdef NANOVDB_NEW_ACCESSOR_METHODS 5369 return this->
template get<GetValue<BuildT>>(ijk);
5378 #else // NANOVDB_NEW_ACCESSOR_METHODS 5382 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5383 const CoordValueType dirty = this->computeDirty(ijk);
5387 if (this->isCached1(dirty)) {
5388 return mNode1->getValueAndCache(ijk, *
this);
5389 }
else if (this->isCached2(dirty)) {
5390 return mNode2->getValueAndCache(ijk, *
this);
5392 return mRoot->getValueAndCache(ijk, *
this);
5396 return this->getValue(ijk);
5400 return this->getValue(
CoordType(i, j, k));
5404 return this->getValue(
CoordType(i, j, k));
5408 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5409 const CoordValueType dirty = this->computeDirty(ijk);
5413 if (this->isCached1(dirty)) {
5414 return mNode1->getNodeInfoAndCache(ijk, *
this);
5415 }
else if (this->isCached2(dirty)) {
5416 return mNode2->getNodeInfoAndCache(ijk, *
this);
5418 return mRoot->getNodeInfoAndCache(ijk, *
this);
5423 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5424 const CoordValueType dirty = this->computeDirty(ijk);
5428 if (this->isCached1(dirty)) {
5429 return mNode1->isActiveAndCache(ijk, *
this);
5430 }
else if (this->isCached2(dirty)) {
5431 return mNode2->isActiveAndCache(ijk, *
this);
5433 return mRoot->isActiveAndCache(ijk, *
this);
5438 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5439 const CoordValueType dirty = this->computeDirty(ijk);
5443 if (this->isCached1(dirty)) {
5444 return mNode1->probeValueAndCache(ijk, v, *
this);
5445 }
else if (this->isCached2(dirty)) {
5446 return mNode2->probeValueAndCache(ijk, v, *
this);
5448 return mRoot->probeValueAndCache(ijk, v, *
this);
5453 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5454 const CoordValueType dirty = this->computeDirty(ijk);
5458 if (this->isCached1(dirty)) {
5459 return mNode1->probeLeafAndCache(ijk, *
this);
5460 }
else if (this->isCached2(dirty)) {
5461 return mNode2->probeLeafAndCache(ijk, *
this);
5463 return mRoot->probeLeafAndCache(ijk, *
this);
5465 #endif // NANOVDB_NEW_ACCESSOR_METHODS 5467 template<
typename RayT>
5470 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5471 const CoordValueType dirty = this->computeDirty(ijk);
5475 if (this->isCached1(dirty)) {
5476 return mNode1->getDimAndCache(ijk, ray, *
this);
5477 }
else if (this->isCached2(dirty)) {
5478 return mNode2->getDimAndCache(ijk, ray, *
this);
5480 return mRoot->getDimAndCache(ijk, ray, *
this);
5483 template<
typename OpT,
typename... ArgsT>
5486 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5487 const CoordValueType dirty = this->computeDirty(ijk);
5491 if (this->isCached1(dirty)) {
5492 return mNode1->template getAndCache<OpT>(ijk, *
this, args...);
5493 }
else if (this->isCached2(dirty)) {
5494 return mNode2->template getAndCache<OpT>(ijk, *
this, args...);
5496 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5499 template<
typename OpT,
typename... ArgsT>
5502 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5503 const CoordValueType dirty = this->computeDirty(ijk);
5507 if (this->isCached1(dirty)) {
5508 return const_cast<Node1T*
>(mNode1)->
template setAndCache<OpT>(ijk, *
this, args...);
5509 }
else if (this->isCached2(dirty)) {
5510 return const_cast<Node2T*
>(mNode2)->
template setAndCache<OpT>(ijk, *
this, args...);
5512 return const_cast<RootT*
>(mRoot)->
template setAndCache<OpT>(ijk, *
this, args...);
5519 template<
typename, u
int32_t>
5521 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5527 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5530 mKeys[0] = ijk & ~Node1T::MASK;
5536 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5539 mKeys[1] = ijk & ~Node2T::MASK;
5543 template<
typename OtherNodeT>
5548 template<
typename BuildT>
5564 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY // 44 bytes total 5565 mutable CoordT mKey;
5566 #else // 68 bytes total 5567 mutable CoordT mKeys[3];
5569 mutable const RootT* mRoot;
5570 mutable const void* mNode[3];
5577 static const int CacheLevels = 3;
5578 #ifndef NANOVDB_NEW_ACCESSOR_METHODS 5579 using NodeInfo =
typename ReadAccessor<ValueT, -1, -1, -1>::NodeInfo;
5583 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5589 , mNode{
nullptr,
nullptr,
nullptr}
5595 : ReadAccessor(grid.tree().root())
5601 : ReadAccessor(tree.root())
5615 template<
typename NodeT>
5620 return reinterpret_cast<const T*
>(mNode[NodeT::LEVEL]);
5627 static_assert(LEVEL >= 0 && LEVEL <= 2,
"ReadAccessor::getNode: Invalid node type");
5628 return reinterpret_cast<const T*
>(mNode[LEVEL]);
5634 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5639 mNode[0] = mNode[1] = mNode[2] =
nullptr;
5642 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5643 template<
typename NodeT>
5644 __hostdev__ bool isCached(CoordValueType dirty)
const 5646 if (!mNode[NodeT::LEVEL])
5648 if (dirty & int32_t(~NodeT::MASK)) {
5649 mNode[NodeT::LEVEL] =
nullptr;
5657 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
5660 template<
typename NodeT>
5663 return (ijk[0] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][0] &&
5664 (ijk[1] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][1] &&
5665 (ijk[2] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][2];
5669 #ifdef NANOVDB_NEW_ACCESSOR_METHODS 5672 return this->
template get<GetValue<BuildT>>(ijk);
5681 #else // NANOVDB_NEW_ACCESSOR_METHODS 5685 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5686 const CoordValueType dirty = this->computeDirty(ijk);
5690 if (this->isCached<LeafT>(dirty)) {
5691 return ((
LeafT*)mNode[0])->getValue(ijk);
5692 }
else if (this->isCached<NodeT1>(dirty)) {
5693 return ((
NodeT1*)mNode[1])->getValueAndCache(ijk, *
this);
5694 }
else if (this->isCached<NodeT2>(dirty)) {
5695 return ((
NodeT2*)mNode[2])->getValueAndCache(ijk, *
this);
5697 return mRoot->getValueAndCache(ijk, *
this);
5701 return this->getValue(ijk);
5705 return this->getValue(
CoordType(i, j, k));
5709 return this->getValue(
CoordType(i, j, k));
5714 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5715 const CoordValueType dirty = this->computeDirty(ijk);
5719 if (this->isCached<LeafT>(dirty)) {
5720 return ((
LeafT*)mNode[0])->getNodeInfoAndCache(ijk, *
this);
5721 }
else if (this->isCached<NodeT1>(dirty)) {
5722 return ((
NodeT1*)mNode[1])->getNodeInfoAndCache(ijk, *
this);
5723 }
else if (this->isCached<NodeT2>(dirty)) {
5724 return ((
NodeT2*)mNode[2])->getNodeInfoAndCache(ijk, *
this);
5726 return mRoot->getNodeInfoAndCache(ijk, *
this);
5731 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5732 const CoordValueType dirty = this->computeDirty(ijk);
5736 if (this->isCached<LeafT>(dirty)) {
5737 return ((
LeafT*)mNode[0])->isActive(ijk);
5738 }
else if (this->isCached<NodeT1>(dirty)) {
5739 return ((
NodeT1*)mNode[1])->isActiveAndCache(ijk, *
this);
5740 }
else if (this->isCached<NodeT2>(dirty)) {
5741 return ((
NodeT2*)mNode[2])->isActiveAndCache(ijk, *
this);
5743 return mRoot->isActiveAndCache(ijk, *
this);
5748 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5749 const CoordValueType dirty = this->computeDirty(ijk);
5753 if (this->isCached<LeafT>(dirty)) {
5754 return ((
LeafT*)mNode[0])->probeValue(ijk, v);
5755 }
else if (this->isCached<NodeT1>(dirty)) {
5756 return ((
NodeT1*)mNode[1])->probeValueAndCache(ijk, v, *
this);
5757 }
else if (this->isCached<NodeT2>(dirty)) {
5758 return ((
NodeT2*)mNode[2])->probeValueAndCache(ijk, v, *
this);
5760 return mRoot->probeValueAndCache(ijk, v, *
this);
5764 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5765 const CoordValueType dirty = this->computeDirty(ijk);
5769 if (this->isCached<LeafT>(dirty)) {
5770 return ((
LeafT*)mNode[0]);
5771 }
else if (this->isCached<NodeT1>(dirty)) {
5772 return ((
NodeT1*)mNode[1])->probeLeafAndCache(ijk, *
this);
5773 }
else if (this->isCached<NodeT2>(dirty)) {
5774 return ((
NodeT2*)mNode[2])->probeLeafAndCache(ijk, *
this);
5776 return mRoot->probeLeafAndCache(ijk, *
this);
5778 #endif // NANOVDB_NEW_ACCESSOR_METHODS 5780 template<
typename OpT,
typename... ArgsT>
5783 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5784 const CoordValueType dirty = this->computeDirty(ijk);
5788 if (this->isCached<LeafT>(dirty)) {
5789 return ((
const LeafT*)mNode[0])->template getAndCache<OpT>(ijk, *
this, args...);
5790 }
else if (this->isCached<NodeT1>(dirty)) {
5791 return ((
const NodeT1*)mNode[1])->template getAndCache<OpT>(ijk, *
this, args...);
5792 }
else if (this->isCached<NodeT2>(dirty)) {
5793 return ((
const NodeT2*)mNode[2])->template getAndCache<OpT>(ijk, *
this, args...);
5795 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5798 template<
typename OpT,
typename... ArgsT>
5801 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5802 const CoordValueType dirty = this->computeDirty(ijk);
5806 if (this->isCached<LeafT>(dirty)) {
5807 return ((
LeafT*)mNode[0])->template setAndCache<OpT>(ijk, *
this, args...);
5808 }
else if (this->isCached<NodeT1>(dirty)) {
5809 return ((
NodeT1*)mNode[1])->template setAndCache<OpT>(ijk, *
this, args...);
5810 }
else if (this->isCached<NodeT2>(dirty)) {
5811 return ((
NodeT2*)mNode[2])->template setAndCache<OpT>(ijk, *
this, args...);
5813 return ((
RootT*)mRoot)->template setAndCache<OpT>(ijk, *
this, args...);
5816 template<
typename RayT>
5819 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5820 const CoordValueType dirty = this->computeDirty(ijk);
5824 if (this->isCached<LeafT>(dirty)) {
5825 return ((
LeafT*)mNode[0])->getDimAndCache(ijk, ray, *
this);
5826 }
else if (this->isCached<NodeT1>(dirty)) {
5827 return ((
NodeT1*)mNode[1])->getDimAndCache(ijk, ray, *
this);
5828 }
else if (this->isCached<NodeT2>(dirty)) {
5829 return ((
NodeT2*)mNode[2])->getDimAndCache(ijk, ray, *
this);
5831 return mRoot->getDimAndCache(ijk, ray, *
this);
5838 template<
typename, u
int32_t>
5840 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5844 template<
typename NodeT>
5847 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5850 mKeys[NodeT::LEVEL] = ijk & ~NodeT::MASK;
5852 mNode[NodeT::LEVEL] = node;
5870 template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5876 template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5882 template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5898 CoordBBox mIndexBBox;
5899 uint32_t mRootTableSize, mPadding{0};
5902 template<
typename T>
5905 mGridData = *grid.
data();
5906 mTreeData = *grid.
tree().data();
5908 mRootTableSize = grid.
tree().root().getTableSize();
5913 *
this = *
reinterpret_cast<const GridMetaData*
>(gridData);
5916 mGridData = *gridData;
5936 template<
typename T>
5976 template<
typename AttT,
typename BuildT = u
int32_t>
5985 : AccT(grid.tree().root())
5987 , mData(grid.template getBlindData<AttT>(0))
6005 end = begin + count;
6013 auto* leaf = this->probeLeaf(ijk);
6014 if (leaf ==
nullptr) {
6017 begin = mData + leaf->minimum();
6018 end = begin + leaf->maximum();
6019 return leaf->maximum();
6025 begin = end =
nullptr;
6026 if (
auto* leaf = this->probeLeaf(ijk)) {
6028 if (leaf->isActive(offset)) {
6029 begin = mData + leaf->minimum();
6030 end = begin + leaf->getValue(offset);
6032 begin += leaf->getValue(offset - 1);
6039 template<
typename AttT>
6048 : AccT(grid.tree().root())
6050 , mData(grid.template getBlindData<AttT>(0))
6072 end = begin + count;
6080 auto* leaf = this->probeLeaf(ijk);
6081 if (leaf ==
nullptr)
6083 begin = mData + leaf->offset();
6084 end = begin + leaf->pointCount();
6085 return leaf->pointCount();
6091 if (
auto* leaf = this->probeLeaf(ijk)) {
6093 if (leaf->isActive(n)) {
6094 begin = mData + leaf->first(n);
6095 end = mData + leaf->last(n);
6099 begin = end =
nullptr;
6107 template<
typename ChannelT,
typename IndexT = ValueIndex>
6124 :
BaseT(grid.tree().root())
6130 this->setChannel(channelID);
6135 :
BaseT(grid.tree().root())
6137 , mChannel(channelPtr)
6168 return mChannel =
const_cast<ChannelT*
>(mGrid.template getBlindData<ChannelT>(channelID));
6173 __hostdev__ uint64_t
idx(
int i,
int j,
int k)
const {
return BaseT::getValue(math::Coord(i, j, k)); }
6184 const bool isActive = BaseT::probeValue(ijk, idx);
6191 template<
typename T>
6192 __hostdev__ T&
getValue(
const math::Coord& ijk, T* channelPtr)
const {
return channelPtr[BaseT::getValue(ijk)]; }
6200 struct MiniGridHandle {
6205 BufferType(BufferType &&other) : data(other.data), size(other.size) {other.data=
nullptr; other.size=0;}
6206 ~BufferType() {std::free(data);}
6207 BufferType& operator=(
const BufferType &other) =
delete;
6208 BufferType& operator=(BufferType &&other){data=other.data; size=other.size; other.data=
nullptr; other.size=0;
return *
this;}
6209 static BufferType create(
size_t n, BufferType* dummy =
nullptr) {
return BufferType(n);}
6211 MiniGridHandle(BufferType &&buf) : buffer(std::move(buf)) {}
6212 const uint8_t* data()
const {
return buffer.data;}
6244 if (
util::streq(str,
"blosc"))
return Codec::BLOSC;
6286 uint32_t nodeCount[4];
6287 uint32_t tileCount[3];
6294 #if !defined(__CUDA_ARCH__) && !defined(__HIP__) 6317 template<
typename StreamT>
6323 #ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS 6328 const char* gridName = gridData->
gridName();
6337 os.write((
const char*)&head,
sizeof(
FileHeader));
6339 os.write(gridName, nameSize);
6341 os.write((
const char*)gridData, gridData->
mGridSize);
6346 template<
typename GridHandleT,
template<
typename...>
class VecT>
6349 #ifdef NANOVDB_USE_IOSTREAMS // use this to switch between std::ofstream or FILE implementations 6350 std::ofstream os(fileName, std::ios::out | std::ios::binary | std::ios::trunc);
6354 StreamT(
const char* name) { fptr = fopen(name,
"wb"); }
6355 ~StreamT() { fclose(fptr); }
6356 void write(
const char* data,
size_t n) { fwrite(data, 1, n, fptr); }
6357 bool is_open()
const {
return fptr != NULL; }
6360 if (!os.is_open()) {
6361 fprintf(stderr,
"nanovdb::writeUncompressedGrids: Unable to open file \"%s\"for output\n", fileName);
6364 for (
auto& h : handles) {
6374 template<
typename GridHandleT,
typename StreamT,
template<
typename...>
class VecT>
6375 VecT<GridHandleT>
readUncompressedGrids(StreamT& is,
const typename GridHandleT::BufferType& pool =
typename GridHandleT::BufferType())
6377 VecT<GridHandleT> handles;
6379 is.read((
char*)&data,
sizeof(
GridData));
6381 uint64_t size = data.
mGridSize, sum = 0u;
6384 is.read((
char*)&data,
sizeof(
GridData));
6387 is.skip(-int64_t(sum +
sizeof(
GridData)));
6388 auto buffer = GridHandleT::BufferType::create(size + sum, &pool);
6389 is.read((
char*)(buffer.data()), buffer.size());
6390 handles.emplace_back(std::move(buffer));
6394 while(is.read((
char*)&head,
sizeof(
FileHeader))) {
6396 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid magic number = \"%s\"\n", (
const char*)&(head.
magic));
6400 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid major version = \"%s\"\n",
toStr(str, head.
version));
6404 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid codec = \"%s\"\n",
toStr(str, head.
codec));
6408 for (uint16_t i = 0; i < head.
gridCount; ++i) {
6411 auto buffer = GridHandleT::BufferType::create(meta.
gridSize, &pool);
6412 is.read((
char*)buffer.data(), meta.
gridSize);
6413 handles.emplace_back(std::move(buffer));
6421 template<
typename GridHandleT,
template<
typename...>
class VecT>
6422 VecT<GridHandleT>
readUncompressedGrids(
const char* fileName,
const typename GridHandleT::BufferType& buffer =
typename GridHandleT::BufferType())
6424 #ifdef NANOVDB_USE_IOSTREAMS // use this to switch between std::ifstream or FILE implementations 6425 struct StreamT :
public std::ifstream {
6426 StreamT(
const char* name) : std::ifstream(name, std::ios::in | std::ios::binary){}
6427 void skip(int64_t off) { this->seekg(off, std::ios_base::cur); }
6432 StreamT(
const char* name) { fptr = fopen(name,
"rb"); }
6433 ~StreamT() { fclose(fptr); }
6434 bool read(
char* data,
size_t n) {
6435 size_t m = fread(data, 1, n, fptr);
6438 void skip(int64_t off) { fseek(fptr, (
long int)off, SEEK_CUR); }
6439 bool is_open()
const {
return fptr != NULL; }
6442 StreamT is(fileName);
6443 if (!is.is_open()) {
6444 fprintf(stderr,
"nanovdb::readUncompressedGrids: Unable to open file \"%s\"for input\n", fileName);
6447 return readUncompressedGrids<GridHandleT, StreamT, VecT>(is, buffer);
6450 #endif // if !defined(__CUDA_ARCH__) && !defined(__HIP__) 6459 template<
typename BuildT>
6469 template<
typename BuildT>
6481 template<
typename BuildT>
6495 template<
typename BuildT>
6507 template<
typename BuildT>
6519 template<
typename BuildT>
6531 template<
typename BuildT>
6543 template<
typename BuildT>
6555 template<
typename BuildT>
6561 v = root.mBackground;
6567 return tile.state > 0u;
6571 v = node.mTable[n].value;
6572 return node.mValueMask.isOn(n);
6576 v = node.mTable[n].value;
6577 return node.mValueMask.isOn(n);
6581 v = leaf.getValue(n);
6582 return leaf.mValueMask.isOn(n);
6588 template<
typename BuildT>
6610 return NodeInfo{2u, node.
dim(), node.minimum(), node.maximum(), node.average(), node.stdDeviation(), node.bbox()};
6614 return NodeInfo{1u, node.
dim(), node.minimum(), node.maximum(), node.average(), node.stdDeviation(), node.bbox()};
6618 return NodeInfo{0u, leaf.
dim(), leaf.minimum(), leaf.maximum(), leaf.average(), leaf.stdDeviation(), leaf.bbox()};
6624 #endif // end of NANOVDB_NANOVDB_H_HAS_BEEN_INCLUDED typename FloatTraits< BuildT >::FloatType FloatType
Definition: NanoVDB.h:3745
__hostdev__ ValueType getMin() const
Definition: NanoVDB.h:3780
__hostdev__ ValueOffIterator beginValueOff() const
Definition: NanoVDB.h:4411
__hostdev__ DenseIter()
Definition: NanoVDB.h:2840
__hostdev__ const GridType & gridType() const
Definition: NanoVDB.h:2140
__hostdev__ bool probeValue(const math::Coord &ijk, typename util::remove_const< ChannelT >::type &v) const
return the state and updates the value of the specified voxel
Definition: NanoVDB.h:6181
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:3890
typename BuildT::RootType RootType
Definition: NanoVDB.h:2015
__hostdev__ const Vec3d & voxelSize() const
Return a const reference to the size of a voxel in world units.
Definition: NanoVDB.h:2075
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition: NanoVDB.h:5670
__hostdev__ uint32_t operator*() const
Definition: NanoVDB.h:1082
ValueT ValueType
Definition: NanoVDB.h:5092
__hostdev__ uint64_t full() const
Definition: NanoVDB.h:1743
__hostdev__ const char * shortGridName() const
Return a c-string with the name of this grid, truncated to 255 characters.
Definition: NanoVDB.h:2174
__hostdev__ util::enable_if<!util::is_same< MaskT, Mask >::value, Mask & >::type operator=(const MaskT &other)
Assignment operator that works with openvdb::util::NodeMask.
Definition: NanoVDB.h:1164
__hostdev__ const ValueType & minimum() const
Return a const reference to the minimum active value encoded in this root node and any of its child n...
Definition: NanoVDB.h:2913
bool type
Definition: NanoVDB.h:499
Visits all tile values in this node, i.e. both inactive and active tiles.
Definition: NanoVDB.h:3344
__hostdev__ math::BBox< CoordT > bbox() const
Return the bounding box in index space of active values in this leaf node.
Definition: NanoVDB.h:4524
__hostdev__ CoordT getCoord() const
Definition: NanoVDB.h:4438
uint16_t ArrayType
Definition: NanoVDB.h:4265
__hostdev__ void next()
Definition: NanoVDB.h:2675
__hostdev__ CheckMode toCheckMode(const Checksum &checksum)
Maps 64 bit checksum to CheckMode enum.
Definition: NanoVDB.h:1782
C++11 implementation of std::enable_if.
Definition: Util.h:335
FloatType mStdDevi
Definition: NanoVDB.h:3757
float type
Definition: NanoVDB.h:506
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:3986
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition: NanoVDB.h:5679
__hostdev__ CoordT offsetToGlobalCoord(uint32_t n) const
Definition: NanoVDB.h:4515
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:4110
__hostdev__ bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:4996
Type Pow2(Type x)
Return x2.
Definition: Math.h:548
__hostdev__ const MaskType< LOG2DIM > & getValueMask() const
Definition: NanoVDB.h:4480
typename util::match_const< DataType, RootT >::type DataT
Definition: NanoVDB.h:2661
void writeUncompressedGrids(const char *fileName, const VecT< GridHandleT > &handles, bool raw=false)
write multiple NanoVDB grids to a single file, without compression.
Definition: NanoVDB.h:6347
typename RootType::LeafNodeType LeafNodeType
Definition: NanoVDB.h:2320
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition: NanoVDB.h:2939
__hostdev__ Vec3d getVoxelSize() const
Return a voxels size in each coordinate direction, measured at the origin.
Definition: NanoVDB.h:1484
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition: NanoVDB.h:4966
StatsT mStdDevi
Definition: NanoVDB.h:3192
__hostdev__ bool hasStdDeviation() const
Definition: NanoVDB.h:2154
__hostdev__ Vec3T applyMap(const Vec3T &xyz) const
Definition: NanoVDB.h:1890
NANOVDB_HOSTDEV_DISABLE_WARNING __hostdev__ uint32_t findFirst() const
Definition: NanoVDB.h:1306
__hostdev__ TileT * tile() const
Definition: NanoVDB.h:2676
__hostdev__ bool isOff(uint32_t n) const
Return true if the given bit is NOT set.
Definition: NanoVDB.h:1193
__hostdev__ Vec3T applyMapF(const Vec3T &xyz) const
Definition: NanoVDB.h:1901
__hostdev__ const char * gridName() const
Definition: NanoVDB.h:1958
__hostdev__ ChannelT * setChannel(ChannelT *channelPtr)
Change to an external channel.
Definition: NanoVDB.h:6160
typename util::match_const< Tile, RootT >::type TileT
Definition: NanoVDB.h:2662
__hostdev__ ChildT * getChild(uint32_t n)
Returns a pointer to the child node at the specifed linear offset.
Definition: NanoVDB.h:3220
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition: NanoVDB.h:5675
__hostdev__ Vec3T applyIJTF(const Vec3T &xyz) const
Definition: NanoVDB.h:1481
VDB Tree, which is a thin wrapper around a RootNode.
Definition: NanoVDB.h:2307
__hostdev__ Vec3T applyMapF(const Vec3T &ijk) const
Apply the forward affine transformation to a vector using 32bit floating point arithmetics.
Definition: NanoVDB.h:1412
decltype(mFlags) Type
Definition: NanoVDB.h:931
__hostdev__ Vec3T indexToWorld(const Vec3T &xyz) const
index to world space transformation
Definition: NanoVDB.h:2086
math::BBox< CoordType > BBoxType
Definition: NanoVDB.h:2650
__hostdev__ Tile * tile(uint32_t n)
Definition: NanoVDB.h:2564
__hostdev__ DenseIter operator++(int)
Definition: NanoVDB.h:2872
__hostdev__ bool isActive() const
Definition: NanoVDB.h:2762
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition: NanoVDB.h:5676
__hostdev__ GridClass mapToGridClass(GridClass defaultClass=GridClass::Unknown)
Definition: NanoVDB.h:894
__hostdev__ bool isChild() const
Definition: NanoVDB.h:2546
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition: NanoVDB.h:2352
__hostdev__ ValueIterator()
Definition: NanoVDB.h:4421
float Type
Definition: NanoVDB.h:526
float FloatType
Definition: NanoVDB.h:3815
__hostdev__ CoordT origin() const
Return the origin in index space of this leaf node.
Definition: NanoVDB.h:4500
Highest level of the data structure. Contains a tree and a world->index transform (that currently onl...
Definition: NanoVDB.h:2011
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition: NanoVDB.h:4972
__hostdev__ ValueOnIter(RootT *parent)
Definition: NanoVDB.h:2799
Vec3dBBox mWorldBBox
Definition: NanoVDB.h:1822
__hostdev__ CoordType getOrigin() const
Definition: NanoVDB.h:3329
__hostdev__ const NodeTrait< RootT, 1 >::type * getFirstLower() const
Definition: NanoVDB.h:2446
__hostdev__ Vec3T applyIJTF(const Vec3T &xyz) const
Definition: NanoVDB.h:1909
FloatType stdDevi
Definition: NanoVDB.h:6597
__hostdev__ char * toStr(char *dst, GridType gridType)
Maps a GridType to a c-string.
Definition: NanoVDB.h:253
__hostdev__ ValueType maximum() const
Return a const reference to the maximum active value encoded in this leaf node.
Definition: NanoVDB.h:4486
__hostdev__ DenseIterator(const InternalNode *parent)
Definition: NanoVDB.h:3428
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:4239
__hostdev__ const DataType * data() const
Definition: NanoVDB.h:2897
__hostdev__ const MaskType< LOG2DIM > & valueMask() const
Return a const reference to the bit mask of active voxels in this internal node.
Definition: NanoVDB.h:3478
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:5377
#define NANOVDB_PATCH_VERSION_NUMBER
Definition: NanoVDB.h:146
__hostdev__ void init(std::initializer_list< GridFlags > list={GridFlags::IsBreadthFirst}, uint64_t gridSize=0u, const Map &map=Map(), GridType gridType=GridType::Unknown, GridClass gridClass=GridClass::Unknown)
Definition: NanoVDB.h:1834
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition: NanoVDB.h:5146
static __hostdev__ constexpr uint64_t memUsage()
Definition: NanoVDB.h:3889
__hostdev__ bool getValue(uint32_t i) const
Definition: NanoVDB.h:4117
__hostdev__ void setValueOnly(uint32_t offset, const ValueType &v)
Sets the value at the specified location but leaves its state unchanged.
Definition: NanoVDB.h:4570
__hostdev__ Vec3T applyInverseMap(const Vec3T &xyz) const
Apply the inverse affine mapping to a vector using 64bit floating point arithmetics.
Definition: NanoVDB.h:1438
__hostdev__ ValueOnIter()
Definition: NanoVDB.h:2795
Class to access values in channels at a specific voxel location.
Definition: NanoVDB.h:6108
__hostdev__ void setMask(uint32_t offset, bool v)
Definition: NanoVDB.h:4252
__hostdev__ void setOn(uint32_t offset)
Definition: NanoVDB.h:3778
static __hostdev__ uint32_t padding()
Definition: NanoVDB.h:4540
typename GridT::TreeType Type
Definition: NanoVDB.h:2293
__hostdev__ NodeT * operator->() const
Definition: NanoVDB.h:2713
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition: NanoVDB.h:5674
char mGridName[MaxNameSize]
Definition: NanoVDB.h:1820
__hostdev__ bool operator>(const Version &rhs) const
Definition: NanoVDB.h:703
static __hostdev__ size_t memUsage(uint32_t bitWidth)
Definition: NanoVDB.h:3994
__hostdev__ void setChild(const CoordType &k, const void *ptr, const RootData *data)
Definition: NanoVDB.h:2532
__hostdev__ Version version() const
Definition: NanoVDB.h:2033
PointAccessor(const NanoGrid< Point > &grid)
Definition: NanoVDB.h:6047
__hostdev__ const ValueT & getMax() const
Definition: NanoVDB.h:2615
__hostdev__ ValueType getValue(uint32_t i) const
Definition: NanoVDB.h:3771
__hostdev__ Map(double s, const Vec3d &t=Vec3d(0.0, 0.0, 0.0))
Definition: NanoVDB.h:1372
__hostdev__ ChildNodeType * probeChild(const CoordType &ijk)
Definition: NanoVDB.h:3556
typename ChildT::CoordType CoordType
Definition: NanoVDB.h:3283
__hostdev__ void setLongGridNameOn(bool on=true)
Definition: NanoVDB.h:1879
__hostdev__ Mask(const Mask &other)
Copy constructor.
Definition: NanoVDB.h:1152
static __hostdev__ uint32_t CoordToOffset(const CoordT &ijk)
Return the linear offset corresponding to the given coordinate.
Definition: NanoVDB.h:4598
__hostdev__ uint64_t lastOffset() const
Definition: NanoVDB.h:4214
MaskT< LOG2DIM > mMask
Definition: NanoVDB.h:4238
__hostdev__ const BlindDataT * getBlindData(uint32_t n) const
Definition: NanoVDB.h:2204
#define NANOVDB_MAGIC_NUMB
Definition: NanoVDB.h:134
GridClass
Classes (superset of OpenVDB) that are currently supported by NanoVDB.
Definition: NanoVDB.h:290
typename DataType::ValueT ValueType
Definition: NanoVDB.h:2645
__hostdev__ bool isPartial() const
return true if the 64 bit checksum is partial, i.e. of head only
Definition: NanoVDB.h:1752
static T scalar(const T &s)
Definition: NanoVDB.h:738
typename RootT::BuildType BuildType
Definition: NanoVDB.h:2322
__hostdev__ void setDev(const FloatType &)
Definition: NanoVDB.h:4127
Definition: NanoVDB.h:2741
__hostdev__ void * treePtr()
Definition: NanoVDB.h:1912
uint32_t state
Definition: NanoVDB.h:2552
BuildT BuildType
Definition: NanoVDB.h:3744
CoordT mBBoxMin
Definition: NanoVDB.h:4104
__hostdev__ void setDev(const FloatType &v)
Definition: NanoVDB.h:3788
typename UpperNodeType::ChildNodeType LowerNodeType
Definition: NanoVDB.h:2319
Return the pointer to the leaf node that contains math::Coord. Implements Tree::probeLeaf(math::Coord...
Definition: NanoVDB.h:1671
__hostdev__ bool getDev() const
Definition: NanoVDB.h:4121
#define NANOVDB_MAGIC_FRAG
Definition: NanoVDB.h:138
__hostdev__ bool isValid(GridType gridType, GridClass gridClass)
return true if the combination of GridType and GridClass is valid.
Definition: NanoVDB.h:613
static __hostdev__ bool isAligned(const void *p)
return true if the specified pointer is 32 byte aligned
Definition: NanoVDB.h:547
__hostdev__ void * getRoot()
Get a non-const void pointer to the root node (never NULL)
Definition: NanoVDB.h:2269
__hostdev__ ChildIterator beginChild()
Definition: NanoVDB.h:3340
uint8_t mFlags
Definition: NanoVDB.h:3751
__hostdev__ LeafNodeType * getFirstLeaf()
Template specializations of getFirstNode.
Definition: NanoVDB.h:2443
uint64_t mOffset
Definition: NanoVDB.h:4273
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:3791
__hostdev__ ValueIter(RootT *parent)
Definition: NanoVDB.h:2750
static int64_t PtrDiff(const void *p, const void *q)
Compute the distance, in bytes, between two pointers, dist = p - q.
Definition: Util.h:464
__hostdev__ uint32_t gridIndex() const
Return index of this grid in the buffer.
Definition: NanoVDB.h:2046
__hostdev__ const RootT & root() const
Definition: NanoVDB.h:2346
__hostdev__ bool isEmpty() const
Return true if the root is empty, i.e. has not child nodes or constant tiles.
Definition: NanoVDB.h:2278
Definition: NanoVDB.h:2001
__hostdev__ const StatsT & stdDeviation() const
Definition: NanoVDB.h:2617
LeafNodeType Node0
Definition: NanoVDB.h:2329
__hostdev__ ValueType getValue(const CoordType &ijk) const
Return the value of the given voxel.
Definition: NanoVDB.h:2938
Checksum mChecksum
Definition: NanoVDB.h:1814
Return point to the upper internal node where math::Coord maps to one of its values, i.e. terminates.
Definition: NanoVDB.h:6544
__hostdev__ const GridClass & gridClass() const
Definition: NanoVDB.h:2141
__hostdev__ uint64_t leafPoints(const Coord &ijk, const AttT *&begin, const AttT *&end) const
Return the number of points in the leaf node containing the coordinate ijk. If this return value is l...
Definition: NanoVDB.h:6011
typename DataType::StatsT FloatType
Definition: NanoVDB.h:2646
__hostdev__ FloatType variance() const
Return the variance of all the active values encoded in this root node and any of its child nodes...
Definition: NanoVDB.h:2922
Implements Tree::getValue(math::Coord), i.e. return the value associated with a specific coordinate i...
Definition: NanoVDB.h:1661
BitFlags()
Definition: NanoVDB.h:932
__hostdev__ FloatType getAvg() const
Definition: NanoVDB.h:3782
__hostdev__ ChildIterator beginChild()
Definition: NanoVDB.h:2737
__hostdev__ bool isActive(const CoordT &ijk) const
Return true if the voxel value at the given coordinate is active.
Definition: NanoVDB.h:4574
__hostdev__ ConstDenseIterator cbeginDense() const
Definition: NanoVDB.h:2884
__hostdev__ uint64_t getValue(uint32_t i) const
Definition: NanoVDB.h:4219
ChildT ChildNodeType
Definition: NanoVDB.h:2639
#define NANOVDB_MAGIC_GRID
Definition: NanoVDB.h:135
__hostdev__ void setAvg(const FloatType &)
Definition: NanoVDB.h:4126
__hostdev__ ValueOnIterator beginValueOn() const
Definition: NanoVDB.h:3413
__hostdev__ const MaskType< LOG2DIM > & valueMask() const
Return a const reference to the bit mask of active voxels in this leaf node.
Definition: NanoVDB.h:4479
void set(const MatT &mat, const MatT &invMat, const Vec3T &translate, double taper=1.0)
Initialize the member data from 3x3 or 4x4 matrices.
Definition: NanoVDB.h:1488
static __hostdev__ KeyT CoordToKey(const CoordType &ijk)
Definition: NanoVDB.h:2492
__hostdev__ void setAvg(float avg)
Definition: NanoVDB.h:3865
MaskT< LOG2DIM > ArrayType
Definition: NanoVDB.h:4051
T Type
Definition: NanoVDB.h:463
__hostdev__ bool isActive() const
Definition: NanoVDB.h:3372
uint64_t mMagic
Definition: NanoVDB.h:1813
__hostdev__ ChannelT * setChannel(uint32_t channelID)
Change to an internal channel, assuming it exists as as blind data in the IndexGrid.
Definition: NanoVDB.h:6166
__hostdev__ void setMax(const ValueType &)
Definition: NanoVDB.h:4125
__hostdev__ bool isOff() const
Return true if none of the bits are set in this Mask.
Definition: NanoVDB.h:1205
__hostdev__ uint32_t valueCount() const
Definition: NanoVDB.h:4210
uint64_t mGridSize
Definition: NanoVDB.h:1819
__hostdev__ NodeT * probeChild(ValueType &value) const
Definition: NanoVDB.h:2849
RootT Node3
Definition: NanoVDB.h:2326
PointType
Definition: NanoVDB.h:401
__hostdev__ void toggle(uint32_t n)
Definition: NanoVDB.h:1269
Trait to map from LEVEL to node type.
Definition: NanoVDB.h:4754
__hostdev__ void setDev(const FloatType &)
Definition: NanoVDB.h:4168
__hostdev__ void setMax(const ValueT &v)
Definition: NanoVDB.h:2620
__hostdev__ void setOn(uint32_t offset)
Definition: NanoVDB.h:4169
__hostdev__ bool isFogVolume() const
Definition: NanoVDB.h:2143
__hostdev__ ValueIter()
Definition: NanoVDB.h:2746
#define NANOVDB_MINOR_VERSION_NUMBER
Definition: NanoVDB.h:145
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition: NanoVDB.h:5114
__hostdev__ FloatType variance() const
Return the variance of all the active values encoded in this leaf node.
Definition: NanoVDB.h:4492
uint64_t KeyT
Return a key based on the coordinates of a voxel.
Definition: NanoVDB.h:2490
Vec3d mVoxelSize
Definition: NanoVDB.h:1823
BuildT ValueType
Definition: NanoVDB.h:3743
uint64_t mFlags
Definition: NanoVDB.h:3185
__hostdev__ const uint32_t & getTableSize() const
Definition: NanoVDB.h:2910
__hostdev__ ValueIterator()
Definition: NanoVDB.h:3350
__hostdev__ Checksum(uint32_t head, uint32_t tail)
Constructor that allows the two 32bit checksums to be initiated explicitly.
Definition: NanoVDB.h:1725
__hostdev__ uint32_t pos() const
Definition: NanoVDB.h:1111
__hostdev__ Mask()
Initialize all bits to zero.
Definition: NanoVDB.h:1139
__hostdev__ bool isCached2(const CoordType &ijk) const
Definition: NanoVDB.h:5358
__hostdev__ bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:3523
Implements Tree::getNodeInfo(math::Coord)
Definition: NanoVDB.h:1675
__hostdev__ uint64_t getMax() const
Definition: NanoVDB.h:4216
__hostdev__ void setStdDeviationOn(bool on=true)
Definition: NanoVDB.h:1881
__hostdev__ uint32_t gridCount() const
Return total number of grids in the buffer.
Definition: NanoVDB.h:2049
__hostdev__ bool isRootConnected() const
return true if RootData follows TreeData in memory without any extra padding
Definition: NanoVDB.h:1996
__hostdev__ uint64_t voxelPoints(const Coord &ijk, const AttT *&begin, const AttT *&end) const
get iterators over attributes to points at a specific voxel location
Definition: NanoVDB.h:6023
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition: NanoVDB.h:4994
__hostdev__ bool isValid() const
Methods related to the classification of this grid.
Definition: NanoVDB.h:2139
__hostdev__ void setValue(uint32_t n, const ValueT &v)
Definition: NanoVDB.h:3213
ValueType minimum
Definition: NanoVDB.h:6596
__hostdev__ AccessorType getAccessor() const
Definition: NanoVDB.h:2893
ChildT UpperNodeType
Definition: NanoVDB.h:2642
uint32_t mGridCount
Definition: NanoVDB.h:1818
CoordT mBBoxMin
Definition: NanoVDB.h:3749
__hostdev__ bool isActive() const
Definition: NanoVDB.h:4443
uint64_t FloatType
Definition: NanoVDB.h:781
__hostdev__ const void * nodePtr() const
Return a non-const void pointer to the first node at LEVEL.
Definition: NanoVDB.h:1920
__hostdev__ FloatType getDev() const
Definition: NanoVDB.h:3783
__hostdev__ FloatType stdDeviation() const
Return a const reference to the standard deviation of all the active values encoded in this leaf node...
Definition: NanoVDB.h:4495
Definition: NanoVDB.h:6593
__hostdev__ bool isValid() const
return true if the magic number and the version are both valid
Definition: NanoVDB.h:1864
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType type
Definition: NanoVDB.h:1619
uint64_t FloatType
Definition: NanoVDB.h:775
__hostdev__ RootT & root()
Definition: NanoVDB.h:2344
float mQuantum
Definition: NanoVDB.h:3823
char * strcpy(char *dst, const char *src)
Copy characters from src to dst.
Definition: Util.h:166
double FloatType
Definition: NanoVDB.h:805
__hostdev__ bool isIndex(GridType gridType)
Return true if the GridType maps to a special index type (not a POD integer type).
Definition: NanoVDB.h:602
Map mMap
Definition: NanoVDB.h:1821
#define NANOVDB_MAGIC_FILE
Definition: NanoVDB.h:136
__hostdev__ ValueType minimum() const
Return a const reference to the minimum active value encoded in this leaf node.
Definition: NanoVDB.h:4483
float type
Definition: NanoVDB.h:520
__hostdev__ const uint32_t & tileCount() const
Return the number of tiles encoded in this root node.
Definition: NanoVDB.h:2909
__hostdev__ Vec3T applyJacobian(const Vec3T &ijk) const
Apply the linear forward 3x3 transformation to an input 3d vector using 64bit floating point arithmet...
Definition: NanoVDB.h:1421
typename ChildT::LeafNodeType LeafNodeType
Definition: NanoVDB.h:2644
Bit-compacted representation of all three version numbers.
Definition: NanoVDB.h:678
__hostdev__ uint64_t lastOffset() const
Definition: NanoVDB.h:4193
__hostdev__ util::enable_if< BuildTraits< T >::is_index, const uint64_t & >::type valueCount() const
Return the total number of values indexed by this IndexGrid.
Definition: NanoVDB.h:2056
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition: NanoVDB.h:4988
__hostdev__ ChannelAccessor(const NanoGrid< IndexT > &grid, ChannelT *channelPtr)
Ctor from an IndexGrid and an external channel.
Definition: NanoVDB.h:6134
__hostdev__ bool operator>=(const Version &rhs) const
Definition: NanoVDB.h:704
typename DataType::ValueT ValueType
Definition: NanoVDB.h:3278
typename GridOrTreeOrRootT::LeafNodeType Type
Definition: NanoVDB.h:1603
static __hostdev__ uint32_t dim()
Return the dimension, in index space, of this leaf node (typically 8 as for openvdb leaf nodes!) ...
Definition: NanoVDB.h:4521
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition: NanoVDB.h:5600
Definition: NanoVDB.h:3173
static __hostdev__ uint32_t dim()
Return the dimension, in voxel units, of this internal node (typically 8*16 or 8*16*32) ...
Definition: NanoVDB.h:3472
__hostdev__ bool operator==(const Mask &other) const
Definition: NanoVDB.h:1178
__hostdev__ ChildIter & operator++()
Definition: NanoVDB.h:2718
__hostdev__ void setDev(const FloatType &)
Definition: NanoVDB.h:4308
__hostdev__ void setOn(uint32_t offset)
Definition: NanoVDB.h:4123
__hostdev__ const ChildT * probeChild(ValueType &value) const
Definition: NanoVDB.h:3434
__hostdev__ bool operator==(const Checksum &rhs) const
return true if the checksums are identical
Definition: NanoVDB.h:1772
__hostdev__ const NanoGrid< BuildT > & grid() const
Definition: NanoVDB.h:5997
char * strncpy(char *dst, const char *src, size_t max)
Copies the first num characters of src to dst. If the end of the source C string (which is signaled b...
Definition: Util.h:185
__hostdev__ DenseIterator beginAll() const
Definition: NanoVDB.h:1136
__hostdev__ ConstValueIterator cbeginValueAll() const
Definition: NanoVDB.h:2787
__hostdev__ void disable()
Definition: NanoVDB.h:1761
__hostdev__ const NanoGrid< IndexT > & grid() const
Return a const reference to the IndexGrid.
Definition: NanoVDB.h:6147
static constexpr uint32_t SIZE
Definition: NanoVDB.h:1037
uint32_t mNodeCount[3]
Definition: NanoVDB.h:2257
ValueType mMaximum
Definition: NanoVDB.h:3755
typename GridOrTreeOrRootT::LeafNodeType type
Definition: NanoVDB.h:1604
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:4107
static __hostdev__ CoordT KeyToCoord(const KeyT &key)
Definition: NanoVDB.h:2500
__hostdev__ const Map & map() const
Return a const reference to the Map for this grid.
Definition: NanoVDB.h:2078
__hostdev__ ValueIterator cbeginValueAll() const
Definition: NanoVDB.h:4463
__hostdev__ void setRoot(const void *root)
Definition: NanoVDB.h:2263
static __hostdev__ uint32_t wordCount()
Return the number of machine words used by this Mask.
Definition: NanoVDB.h:1047
__hostdev__ uint32_t operator*() const
Definition: NanoVDB.h:1110
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:4081
typename DataType::BuildT BuildType
Definition: NanoVDB.h:2647
__hostdev__ void setMin(const bool &)
Definition: NanoVDB.h:4075
__hostdev__ const StatsT & average() const
Definition: NanoVDB.h:2616
__hostdev__ void setMin(const ValueType &)
Definition: NanoVDB.h:4165
__hostdev__ uint32_t tail() const
Definition: NanoVDB.h:1747
__hostdev__ bool getAvg() const
Definition: NanoVDB.h:4067
__hostdev__ bool updateBBox()
Updates the local bounding box of active voxels in this node. Return true if bbox was updated...
Definition: NanoVDB.h:4701
__hostdev__ DenseIter & operator++()
Definition: NanoVDB.h:2866
__hostdev__ bool isBreadthFirst() const
Definition: NanoVDB.h:2155
__hostdev__ bool isPointData() const
Definition: NanoVDB.h:2147
__hostdev__ uint64_t last(uint32_t i) const
Definition: NanoVDB.h:4290
bool FloatType
Definition: NanoVDB.h:769
__hostdev__ const FloatType & average() const
Return a const reference to the average of all the active values encoded in this internal node and an...
Definition: NanoVDB.h:3495
__hostdev__ Iterator & operator++()
Definition: NanoVDB.h:1085
Definition: NanoVDB.h:755
#define __hostdev__
Definition: Util.h:73
typename DataType::FloatType FloatType
Definition: NanoVDB.h:4339
#define NANOVDB_DATA_ALIGNMENT
Definition: NanoVDB.h:126
typename DataType::Tile Tile
Definition: NanoVDB.h:2652
__hostdev__ bool isValid(const GridBlindDataClass &blindClass, const GridBlindDataSemantic &blindSemantics, const GridType &blindType)
return true if the combination of GridBlindDataClass, GridBlindDataSemantic and GridType is valid...
Definition: NanoVDB.h:637
__hostdev__ DenseIterator operator++(int)
Definition: NanoVDB.h:1118
__hostdev__ uint64_t getValue(uint32_t i) const
Definition: NanoVDB.h:4199
__hostdev__ void setMax(const ValueT &v)
Definition: NanoVDB.h:3258
Definition: NanoVDB.h:925
Coord CoordType
Definition: NanoVDB.h:4341
Dummy type for a 16bit quantization of float point values.
Definition: NanoVDB.h:197
uint8_t ArrayType
Definition: NanoVDB.h:3922
typename Mask< Log2Dim >::template Iterator< On > MaskIterT
Definition: NanoVDB.h:3288
__hostdev__ bool hasLongGridName() const
Definition: NanoVDB.h:2152
__hostdev__ TreeT & tree()
Return a non-const reference to the tree.
Definition: NanoVDB.h:2069
CoordT mBBoxMin
Definition: NanoVDB.h:4268
__hostdev__ void setFirstNode(const NodeT *node)
Definition: NanoVDB.h:2275
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType Type
Definition: NanoVDB.h:1639
__hostdev__ const ValueType & maximum() const
Return a const reference to the maximum active value encoded in this internal node and any of its chi...
Definition: NanoVDB.h:3492
__hostdev__ float getValue(uint32_t i) const
Definition: NanoVDB.h:3897
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:3204
__hostdev__ void setMin(float min)
Definition: NanoVDB.h:3859
__hostdev__ void setValue(uint32_t offset, bool)
Definition: NanoVDB.h:4122
__hostdev__ void setMax(const ValueType &v)
Definition: NanoVDB.h:3786
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:4130
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition: NanoVDB.h:3763
__hostdev__ uint32_t pos() const
Definition: NanoVDB.h:2674
__hostdev__ ChildIter()
Definition: NanoVDB.h:3308
__hostdev__ void setMin(const ValueType &)
Definition: NanoVDB.h:4305
__hostdev__ BlindDataT * getBlindData(uint32_t n)
Definition: NanoVDB.h:2211
__hostdev__ void setDev(const StatsT &v)
Definition: NanoVDB.h:3260
__hostdev__ ValueType getLastValue() const
If the last entry in this node's table is a tile, return the tile's value. Otherwise, return the result of calling getLastValue() on the child.
Definition: NanoVDB.h:3515
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition: NanoVDB.h:5308
__hostdev__ bool isOn(uint32_t n) const
Return true if the given bit is set.
Definition: NanoVDB.h:1190
__hostdev__ float getValue(uint32_t i) const
Definition: NanoVDB.h:3995
__hostdev__ Vec3T applyInverseJacobian(const Vec3T &xyz) const
Apply the linear inverse 3x3 transformation to an input 3d vector using 64bit floating point arithmet...
Definition: NanoVDB.h:1461
uint64_t ValueType
Definition: NanoVDB.h:4147
uint16_t ArrayType
Definition: NanoVDB.h:3952
__hostdev__ const MaskType< LOG2DIM > & childMask() const
Return a const reference to the bit mask of child nodes in this internal node.
Definition: NanoVDB.h:3482
__hostdev__ void setMax(const ValueType &)
Definition: NanoVDB.h:4166
__hostdev__ void setAvg(const FloatType &)
Definition: NanoVDB.h:4167
ValueT value
Definition: NanoVDB.h:2553
__hostdev__ void setDev(float dev)
Definition: NanoVDB.h:3868
Node caching at all (three) tree levels.
Definition: NanoVDB.h:5549
__hostdev__ void setDev(const StatsT &v)
Definition: NanoVDB.h:2622
__hostdev__ OnIterator beginOn() const
Definition: NanoVDB.h:1132
Definition: NanoVDB.h:1663
__hostdev__ void setAvg(const FloatType &)
Definition: NanoVDB.h:4307
__hostdev__ bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:5678
__hostdev__ void setOn(uint32_t offset)
Definition: NanoVDB.h:4298
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType Type
Definition: NanoVDB.h:1618
__hostdev__ bool isMaskOn(uint32_t offset) const
Definition: NanoVDB.h:4251
BuildT BuildType
Definition: NanoVDB.h:5573
Stuct with all the member data of the LeafNode (useful during serialization of an openvdb LeafNode) ...
Definition: NanoVDB.h:3739
__hostdev__ const BBoxType & bbox() const
Return a const reference to the index bounding box of all the active values in this tree...
Definition: NanoVDB.h:2900
GridBlindDataSemantic
Blind-data Semantics that are currently understood by NanoVDB.
Definition: NanoVDB.h:424
Version mVersion
Definition: NanoVDB.h:1815
__hostdev__ void setAverageOn(bool on=true)
Definition: NanoVDB.h:1880
__hostdev__ bool isSequential() const
return true if nodes at all levels can safely be accessed with simple linear offsets ...
Definition: NanoVDB.h:2168
__hostdev__ Map()
Default constructor for the identity map.
Definition: NanoVDB.h:1361
GridFlags
Grid flags which indicate what extra information is present in the grid buffer.
Definition: NanoVDB.h:327
Metafunction used to determine if the first template parameter is a specialization of the class templ...
Definition: Util.h:451
static __hostdev__ constexpr uint8_t bitWidth()
Definition: NanoVDB.h:3963
__hostdev__ uint32_t & checksum(int i)
Definition: NanoVDB.h:1739
__hostdev__ DenseIterator()
Definition: NanoVDB.h:3423
ReadAccessor< ValueT, LEVEL0, LEVEL1, LEVEL2 > createAccessor(const NanoGrid< ValueT > &grid)
Free-standing function for convenient creation of a ReadAccessor with optional and customizable node ...
Definition: NanoVDB.h:5871
RootT RootType
Definition: NanoVDB.h:2316
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition: NanoVDB.h:3833
Definition: GridHandle.h:27
float type
Definition: NanoVDB.h:513
CoordBBox bbox
Definition: NanoVDB.h:6598
float Type
Definition: NanoVDB.h:519
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Return true if this tree is empty, i.e. contains no values or nodes.
Definition: NanoVDB.h:2361
Visits all tile values and child nodes of this node.
Definition: NanoVDB.h:3417
GridType mGridType
Definition: NanoVDB.h:1825
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:4250
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition: NanoVDB.h:5120
Definition: NanoVDB.h:1068
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
return the state and updates the value of the specified voxel
Definition: NanoVDB.h:3525
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:4157
Define static boolean tests for template build types.
Definition: NanoVDB.h:440
__hostdev__ bool isFull() const
return true if the 64 bit checksum is fill, i.e. of both had and nodes
Definition: NanoVDB.h:1756
__hostdev__ bool hasMinMax() const
Definition: NanoVDB.h:2150
__hostdev__ ConstChildIterator cbeginChild() const
Definition: NanoVDB.h:2738
char * sprint(char *dst, T var1, Types...var2)
prints a variable number of string and/or numbers to a destination string
Definition: Util.h:286
Bit-mask to encode active states and facilitate sequential iterators and a fast codec for I/O compres...
Definition: NanoVDB.h:1034
CoordT CoordType
Definition: NanoVDB.h:5093
__hostdev__ const GridBlindMetaData * blindMetaData(uint32_t n) const
Returns a const reference to the blindMetaData at the specified linear offset.
Definition: NanoVDB.h:1952
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition: NanoVDB.h:5141
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:3246
static ElementType scalar(const T &v)
Definition: NanoVDB.h:749
__hostdev__ ValueIterator beginValue() const
Definition: NanoVDB.h:3379
__hostdev__ void setMax(float max)
Definition: NanoVDB.h:3862
static __hostdev__ constexpr uint8_t bitWidth()
Definition: NanoVDB.h:3896
__hostdev__ bool getMax() const
Definition: NanoVDB.h:4066
uint64_t mData2
Definition: NanoVDB.h:1830
typename ChildT::ValueType ValueT
Definition: NanoVDB.h:2482
float mMinimum
Definition: NanoVDB.h:3822
__hostdev__ uint64_t offset() const
Definition: NanoVDB.h:4287
static __hostdev__ Coord OffsetToLocalCoord(uint32_t n)
Definition: NanoVDB.h:3576
__hostdev__ const Vec3d & voxelSize() const
Return a vector of the axial voxel sizes.
Definition: NanoVDB.h:6153
__hostdev__ constexpr uint32_t strlen()
return the number of characters (including null termination) required to convert enum type to a strin...
Definition: NanoVDB.h:209
typename NanoLeaf< BuildT >::FloatType FloatType
Definition: NanoVDB.h:6592
Definition: NanoVDB.h:4143
KeyT key
Definition: NanoVDB.h:2550
uint64_t FloatType
Definition: NanoVDB.h:787
__hostdev__ uint64_t pointCount() const
Definition: NanoVDB.h:4288
typename DataType::StatsT FloatType
Definition: NanoVDB.h:3279
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition: NanoVDB.h:5371
__hostdev__ uint32_t & tail()
Definition: NanoVDB.h:1748
bool ValueType
Definition: NanoVDB.h:4048
__hostdev__ Tile * probeTile(const CoordT &ijk)
Definition: NanoVDB.h:2570
__hostdev__ uint64_t getAvg() const
Definition: NanoVDB.h:4197
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition: NanoVDB.h:5038
__hostdev__ uint64_t checksum() const
return the 64 bit checksum of this instance
Definition: NanoVDB.h:1737
Dummy type for a voxel whose value equals an offset into an external value array of active values...
Definition: NanoVDB.h:176
__hostdev__ ValueOnIterator beginValueOn() const
Definition: NanoVDB.h:4378
Top-most node of the VDB tree structure.
Definition: NanoVDB.h:2635
int64_t child
Definition: NanoVDB.h:3176
#define NANOVDB_MAJOR_VERSION_NUMBER
Definition: NanoVDB.h:144
__hostdev__ Vec3T applyJacobianF(const Vec3T &ijk) const
Apply the linear forward 3x3 transformation to an input 3d vector using 32bit floating point arithmet...
Definition: NanoVDB.h:1430
uint8_t ArrayType
Definition: NanoVDB.h:3885
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:3767
Struct to derive node type from its level in a given grid, tree or root while preserving constness...
Definition: NanoVDB.h:1596
typename GridT::TreeType type
Definition: NanoVDB.h:2294
__hostdev__ Codec toCodec(const char *str)
Definition: NanoVDB.h:6240
Definition: NanoVDB.h:2690
uint32_t level
Definition: NanoVDB.h:6595
__hostdev__ float getValue(uint32_t i) const
Definition: NanoVDB.h:3933
uint32_t mTileCount[3]
Definition: NanoVDB.h:2258
typename RootT::ChildNodeType Node2
Definition: NanoVDB.h:2327
__hostdev__ CoordType getOrigin() const
Definition: NanoVDB.h:3405
__hostdev__ const ValueType & minimum() const
Return a const reference to the minimum active value encoded in this internal node and any of its chi...
Definition: NanoVDB.h:3489
ValueType mMinimum
Definition: NanoVDB.h:3754
__hostdev__ const void * blindData(uint32_t n) const
Returns a const pointer to the blindData at the specified linear offset.
Definition: NanoVDB.h:2196
__hostdev__ GridType toGridType()
Maps from a templated build type to a GridType enum.
Definition: NanoVDB.h:812
size_t strlen(const char *str)
length of a c-sting, excluding '\0'.
Definition: Util.h:153
static __hostdev__ uint32_t dim()
Definition: NanoVDB.h:4334
__hostdev__ bool isCached(const CoordType &ijk) const
Definition: NanoVDB.h:5661
uint64_t Type
Definition: NanoVDB.h:470
uint64_t type
Definition: NanoVDB.h:478
Definition: IndexIterator.h:43
__hostdev__ float getDev() const
return the quantized standard deviation of the active values in this node
Definition: NanoVDB.h:3856
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:3400
ValueT mMaximum
Definition: NanoVDB.h:3190
__hostdev__ uint64_t idx(int i, int j, int k) const
Definition: NanoVDB.h:6173
static __hostdev__ CoordT OffsetToLocalCoord(uint32_t n)
Compute the local coordinates from a linear offset.
Definition: NanoVDB.h:4505
__hostdev__ const math::BBox< CoordType > & bbox() const
Return a const reference to the bounding box in index space of active values in this internal node an...
Definition: NanoVDB.h:3504
__hostdev__ ValueType getValue(const CoordType &ijk) const
Return the value of the given voxel.
Definition: NanoVDB.h:3522
__hostdev__ const FloatType & stdDeviation() const
Return a const reference to the standard deviation of all the active values encoded in this root node...
Definition: NanoVDB.h:2925
__hostdev__ uint64_t getValue(uint32_t i) const
Definition: NanoVDB.h:4291
__hostdev__ bool operator<=(const Version &rhs) const
Definition: NanoVDB.h:702
__hostdev__ bool getValue(uint32_t i) const
Definition: NanoVDB.h:4064
T ElementType
Definition: NanoVDB.h:737
typename RootType::LeafNodeType LeafNodeType
Definition: NanoVDB.h:2019
float Type
Definition: NanoVDB.h:533
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition: NanoVDB.h:5201
uint64_t Type
Definition: NanoVDB.h:477
__hostdev__ uint32_t getMinor() const
Definition: NanoVDB.h:707
Struct with all the member data of the RootNode (useful during serialization of an openvdb RootNode) ...
Definition: NanoVDB.h:2480
__hostdev__ CoordType getCoord() const
Definition: NanoVDB.h:3334
__hostdev__ ValueIterator operator++(int)
Definition: NanoVDB.h:4454
__hostdev__ int findBlindDataForSemantic(GridBlindDataSemantic semantic) const
Return the index of the first blind data with specified semantic if found, otherwise -1...
Definition: NanoVDB.h:2224
static __hostdev__ bool hasStats()
Definition: NanoVDB.h:3828
__hostdev__ ValueOffIterator(const LeafNode *parent)
Definition: NanoVDB.h:4393
openvdb::GridBase Grid
Definition: Utils.h:34
__hostdev__ Mask(bool on)
Definition: NanoVDB.h:1144
__hostdev__ void setOff(uint32_t n)
Set the specified bit off.
Definition: NanoVDB.h:1216
__hostdev__ const char * gridName() const
Return a c-string with the name of this grid.
Definition: NanoVDB.h:2171
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:4399
typename RootNodeType::ChildNodeType UpperNodeType
Definition: NanoVDB.h:2318
double FloatType
Definition: NanoVDB.h:763
uint64_t type
Definition: NanoVDB.h:485
__hostdev__ ChildT * getChild(const Tile *tile)
Returns a const reference to the child node in the specified tile.
Definition: NanoVDB.h:2603
__hostdev__ const Checksum & checksum() const
Return checksum of the grid buffer.
Definition: NanoVDB.h:2177
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition: NanoVDB.h:5296
GridClass mGridClass
Definition: NanoVDB.h:1824
__hostdev__ Version(uint32_t data)
Constructor from a raw uint32_t data representation.
Definition: NanoVDB.h:691
Dummy type for a voxel whose value equals an offset into an external value array. ...
Definition: NanoVDB.h:173
Maps one type (e.g. the build types above) to other (actual) types.
Definition: NanoVDB.h:461
__hostdev__ const DataType * data() const
Definition: NanoVDB.h:2339
__hostdev__ ValueType getLastValue() const
Return the last value in this leaf node.
Definition: NanoVDB.h:4560
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:3871
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition: NanoVDB.h:5150
__hostdev__ bool isHalf() const
Definition: NanoVDB.h:1753
__hostdev__ uint64_t getDev() const
Definition: NanoVDB.h:4198
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:4062
math::BBox< CoordT > mBBox
Definition: NanoVDB.h:2512
__hostdev__ ValueIterator(const LeafNode *parent)
Definition: NanoVDB.h:4426
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition: NanoVDB.h:4960
typename RootT::ValueType ValueType
Definition: NanoVDB.h:4942
__hostdev__ uint32_t id() const
Definition: NanoVDB.h:705
__hostdev__ size_t memUsage() const
Definition: NanoVDB.h:3993
__hostdev__ ValueType getMin() const
Definition: NanoVDB.h:4300
__hostdev__ const NodeT * getFirstNode() const
return a const pointer to the first node of the specified type
Definition: NanoVDB.h:2418
typename ChildT::CoordType CoordType
Definition: NanoVDB.h:2649
__hostdev__ uint32_t getPatch() const
Definition: NanoVDB.h:708
Definition: NanoVDB.h:2790
__hostdev__ DenseIter(RootT *parent)
Definition: NanoVDB.h:2844
__hostdev__ const FloatType & stdDeviation() const
Return a const reference to the standard deviation of all the active values encoded in this internal ...
Definition: NanoVDB.h:3501
__hostdev__ void setOn(uint32_t n)
Set the specified bit on.
Definition: NanoVDB.h:1214
__hostdev__ const uint64_t & firstOffset() const
Definition: NanoVDB.h:4164
__hostdev__ CoordT getCoord() const
Definition: NanoVDB.h:4371
__hostdev__ Vec3T applyInverseJacobianF(const Vec3T &xyz) const
Apply the linear inverse 3x3 transformation to an input 3d vector using 32bit floating point arithmet...
Definition: NanoVDB.h:1470
__hostdev__ bool isCompatible() const
Definition: NanoVDB.h:709
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition: NanoVDB.h:5145
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition: NanoVDB.h:5367
static __hostdev__ constexpr uint8_t bitWidth()
Definition: NanoVDB.h:3932
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition: NanoVDB.h:5374
__hostdev__ const ValueType & background() const
Return a const reference to the background value.
Definition: NanoVDB.h:2364
const typename GridOrTreeOrRootT::LeafNodeType type
Definition: NanoVDB.h:1611
__hostdev__ int age() const
Returns the difference between major version of this instance and NANOVDB_MAJOR_VERSION_NUMBER.
Definition: NanoVDB.h:713
__hostdev__ bool isRootNext() const
return true if RootData is layout out immediately after TreeData in memory
Definition: NanoVDB.h:2284
__hostdev__ NodeT * getFirstNode()
return a pointer to the first node of the specified type
Definition: NanoVDB.h:2408
__hostdev__ const NodeTrait< RootT, 2 >::type * getFirstUpper() const
Definition: NanoVDB.h:2448
#define NANOVDB_MAGIC_NODE
Definition: NanoVDB.h:137
CheckMode
List of different modes for computing for a checksum.
Definition: NanoVDB.h:1680
__hostdev__ void setAvg(const FloatType &v)
Definition: NanoVDB.h:3787
__hostdev__ uint8_t bitWidth() const
Definition: NanoVDB.h:3992
__hostdev__ const FloatType & average() const
Return a const reference to the average of all the active values encoded in this root node and any of...
Definition: NanoVDB.h:2919
MatType scale(const Vec3< typename MatType::value_type > &s)
Return a matrix that scales by s.
Definition: Mat.h:615
__hostdev__ ValueIter operator++(int)
Definition: NanoVDB.h:2775
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition: NanoVDB.h:3198
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:4433
__hostdev__ void extrema(ValueType &min, ValueType &max) const
Sets the extrema values of all the active values in this tree, i.e. in all nodes of the tree...
Definition: NanoVDB.h:2468
__hostdev__ uint32_t pos() const
Definition: NanoVDB.h:1083
__hostdev__ void setOn(uint32_t offset)
Definition: NanoVDB.h:3843
__hostdev__ T & getValue(const math::Coord &ijk, T *channelPtr) const
Return the value from a specified channel that maps to the specified coordinate.
Definition: NanoVDB.h:6192
typename Node2::ChildNodeType Node1
Definition: NanoVDB.h:2328
Dummy type for a 16 bit floating point values (placeholder for IEEE 754 Half)
Definition: NanoVDB.h:188
static __hostdev__ uint64_t memUsage()
return memory usage in bytes for the class
Definition: NanoVDB.h:2342
RootT RootNodeType
Definition: NanoVDB.h:2317
__hostdev__ Vec3T applyInverseMapF(const Vec3T &xyz) const
Definition: NanoVDB.h:1903
__hostdev__ uint64_t first(uint32_t i) const
Definition: NanoVDB.h:4289
__hostdev__ bool isMaskOn(uint32_t offset) const
Definition: NanoVDB.h:4240
__hostdev__ bool isGridIndex() const
Definition: NanoVDB.h:2146
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition: NanoVDB.h:5302
uint32_t countOn(uint64_t v)
Definition: Util.h:622
__hostdev__ ChannelAccessor(const NanoGrid< IndexT > &grid, uint32_t channelID=0u)
Ctor from an IndexGrid and an integer ID of an internal channel that is assumed to exist as blind dat...
Definition: NanoVDB.h:6123
__hostdev__ uint64_t gridPoints(const AttT *&begin, const AttT *&end) const
Return the total number of point in the grid and set the iterators to the complete range of points...
Definition: NanoVDB.h:6001
void ArrayType
Definition: NanoVDB.h:4149
__hostdev__ ChannelT & operator()(const math::Coord &ijk) const
Definition: NanoVDB.h:6177
__hostdev__ uint32_t countOn(uint32_t i) const
Return the number of lower set bits in mask up to but excluding the i'th bit.
Definition: NanoVDB.h:1059
__hostdev__ ChildIter()
Definition: NanoVDB.h:2697
__hostdev__ bool hasStats() const
Definition: NanoVDB.h:4162
__hostdev__ uint64_t memUsage() const
Return the actual memory footprint of this root node.
Definition: NanoVDB.h:2931
int64_t child
Definition: NanoVDB.h:2551
__hostdev__ void fill(const ValueType &v)
Definition: NanoVDB.h:3793
__hostdev__ bool getAvg() const
Definition: NanoVDB.h:4120
BuildT ArrayType
Definition: NanoVDB.h:3746
uint32_t mBlindMetadataCount
Definition: NanoVDB.h:1827
__hostdev__ OffIterator beginOff() const
Definition: NanoVDB.h:1134
__hostdev__ DenseIterator beginDense()
Definition: NanoVDB.h:2883
BuildT BuildType
Definition: NanoVDB.h:5091
__hostdev__ bool getMin() const
Definition: NanoVDB.h:4065
__hostdev__ const DataType * data() const
Definition: NanoVDB.h:4476
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:4998
__hostdev__ bool getMax() const
Definition: NanoVDB.h:4119
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:2806
bool BuildType
Definition: NanoVDB.h:4049
__hostdev__ CoordT origin() const
Definition: NanoVDB.h:2549
__hostdev__ bool operator<(const Version &rhs) const
Definition: NanoVDB.h:701
__hostdev__ bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:5375
__hostdev__ const Vec3dBBox & worldBBox() const
return AABB of active values in world space
Definition: NanoVDB.h:1978
__hostdev__ void setOn(uint32_t offset)
Definition: NanoVDB.h:4074
__hostdev__ uint8_t flags() const
Definition: NanoVDB.h:4497
__hostdev__ const ValueT & getMax() const
Definition: NanoVDB.h:3249
typename UpperNodeType::ChildNodeType LowerNodeType
Definition: NanoVDB.h:2018
__hostdev__ bool isEmpty() const
Return true if this RootNode is empty, i.e. contains no values or nodes.
Definition: NanoVDB.h:2934
VecT< GridHandleT > readUncompressedGrids(const char *fileName, const typename GridHandleT::BufferType &buffer=typename GridHandleT::BufferType())
Read a multiple un-compressed NanoVDB grids from a file and return them as a vector.
Definition: NanoVDB.h:6422
uint64_t Type
Definition: NanoVDB.h:540
CoordT mBBoxMin
Definition: NanoVDB.h:4152
__hostdev__ uint32_t checksum(int i) const
Definition: NanoVDB.h:1741
__hostdev__ bool operator!=(const Mask &other) const
Definition: NanoVDB.h:1187
CoordT CoordType
Definition: NanoVDB.h:5276
Dummy type for a variable bit quantization of floating point values.
Definition: NanoVDB.h:200
__hostdev__ Vec3T indexToWorldF(const Vec3T &xyz) const
index to world space transformation
Definition: NanoVDB.h:2109
__hostdev__ const MaskType< LOG2DIM > & getChildMask() const
Definition: NanoVDB.h:3483
StatsT mAverage
Definition: NanoVDB.h:2518
Visits all values in a leaf node, i.e. both active and inactive values.
Definition: NanoVDB.h:4415
__hostdev__ void setMin(const ValueT &v)
Definition: NanoVDB.h:3257
__hostdev__ bool hasAverage() const
Definition: NanoVDB.h:2153
__hostdev__ CoordType getCoord() const
Definition: NanoVDB.h:3371
__hostdev__ bool isActive() const
Definition: NanoVDB.h:2548
Visits active tile values of this node only.
Definition: NanoVDB.h:3383
__hostdev__ const NodeTrait< RootT, LEVEL >::type * getFirstNode() const
return a const pointer to the first node of the specified level
Definition: NanoVDB.h:2437
#define NANOVDB_HOSTDEV_DISABLE_WARNING
Definition: Util.h:94
__hostdev__ void setValueOnly(uint32_t offset, const ValueType &value)
Definition: NanoVDB.h:3772
Visits all inactive values in a leaf node.
Definition: NanoVDB.h:4382
__hostdev__ const TreeType & tree() const
Return a const reference to the tree of the IndexGrid.
Definition: NanoVDB.h:6150
Like ValueIndex but with a mutable mask.
Definition: NanoVDB.h:179
typename RootT::ValueType ValueType
Definition: NanoVDB.h:2321
static __hostdev__ uint64_t memUsage(uint32_t tableSize)
Return the expected memory footprint in bytes with the specified number of tiles. ...
Definition: NanoVDB.h:2928
Definition: NanoVDB.h:1665
__hostdev__ ValueIterator beginValue() const
Definition: NanoVDB.h:4462
static __hostdev__ bool hasStats()
Definition: NanoVDB.h:4111
float FloatType
Definition: NanoVDB.h:757
__hostdev__ CheckMode mode() const
return the mode of the 64 bit checksum
Definition: NanoVDB.h:1764
__hostdev__ bool isMask() const
Definition: NanoVDB.h:2148
__hostdev__ Vec3T applyJacobianF(const Vec3T &xyz) const
Definition: NanoVDB.h:1905
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition: NanoVDB.h:5148
__hostdev__ void setMax(const bool &)
Definition: NanoVDB.h:4076
typename RootNodeType::ChildNodeType UpperNodeType
Definition: NanoVDB.h:2017
typename ChildT::BuildType BuildT
Definition: NanoVDB.h:2483
typename BuildT::ValueType ValueType
Definition: NanoVDB.h:2021
__hostdev__ uint32_t nodeCount() const
Return number of nodes at LEVEL.
Definition: NanoVDB.h:1943
float ValueType
Definition: NanoVDB.h:3814
__hostdev__ Mask & operator&=(const Mask &other)
Bitwise intersection.
Definition: NanoVDB.h:1272
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition: NanoVDB.h:5468
__hostdev__ const TreeT & tree() const
Return a const reference to the tree.
Definition: NanoVDB.h:2066
uint32_t findLowestOn(uint32_t v)
Returns the index of the lowest, i.e. least significant, on bit in the specified 32 bit word...
Definition: Util.h:502
__hostdev__ ChannelT & getValue(const math::Coord &ijk) const
Return the value from a cached channel that maps to the specified coordinate.
Definition: NanoVDB.h:6176
uint64_t mData1
Definition: NanoVDB.h:1829
BitFlags(Type mask)
Definition: NanoVDB.h:933
__hostdev__ ChildNodeType * probeChild(const CoordType &ijk)
Definition: NanoVDB.h:2996
__hostdev__ bool isValueOn() const
Definition: NanoVDB.h:3445
bool streq(const char *lhs, const char *rhs)
Test if two null-terminated byte strings are the same.
Definition: Util.h:268
__hostdev__ Vec3T worldToIndexDirF(const Vec3T &dir) const
transformation from world space direction to index space direction
Definition: NanoVDB.h:2119
__hostdev__ Iterator()
Definition: NanoVDB.h:1071
typename ChildT::template MaskType< LOG2DIM > MaskT
Definition: NanoVDB.h:3170
__hostdev__ uint64_t getDev() const
Definition: NanoVDB.h:4218
BitFlags< 32 > mFlags
Definition: NanoVDB.h:1816
__hostdev__ Vec3T applyInverseJacobianF(const Vec3T &xyz) const
Definition: NanoVDB.h:1907
__hostdev__ ValueOnIter operator++(int)
Definition: NanoVDB.h:2819
uint8_t mFlags
Definition: NanoVDB.h:4270
__hostdev__ void setAvg(const bool &)
Definition: NanoVDB.h:4077
__hostdev__ void setMin(const ValueType &v)
Definition: NanoVDB.h:3785
__hostdev__ bool getMin() const
Definition: NanoVDB.h:4118
__hostdev__ bool isStaggered() const
Definition: NanoVDB.h:2144
__hostdev__ ConstChildIterator cbeginChild() const
Definition: NanoVDB.h:3341
uint8_t mFlags
Definition: NanoVDB.h:4106
void writeUncompressedGrid(StreamT &os, const GridData *gridData, bool raw=false)
This is a standalone alternative to io::writeGrid(...,Codec::NONE) defined in util/IO.h Unlike the latter this function has no dependencies at all, not even NanoVDB.h, so it also works if client code only includes PNanoVDB.h!
Definition: NanoVDB.h:6318
__hostdev__ bool isEmpty() const
test if the grid is empty, e.i the root table has size 0
Definition: NanoVDB.h:1992
__hostdev__ uint64_t gridPoints(const AttT *&begin, const AttT *&end) const
Return the total number of point in the grid and set the iterators to the complete range of points...
Definition: NanoVDB.h:6068
__hostdev__ NodeT * operator->() const
Definition: NanoVDB.h:3324
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:3820
#define __device__
Definition: Util.h:79
__hostdev__ Vec3T applyInverseMap(const Vec3T &xyz) const
Definition: NanoVDB.h:1892
int64_t mBlindMetadataOffset
Definition: NanoVDB.h:1826
float mTaperF
Definition: NanoVDB.h:1354
Implements Tree::probeLeaf(math::Coord)
Definition: NanoVDB.h:1673
__hostdev__ ChildIter(RootT *parent)
Definition: NanoVDB.h:2701
__hostdev__ void setValue(uint32_t offset, const ValueType &value)
Definition: NanoVDB.h:3773
__hostdev__ CoordBBox bbox() const
Return the index bounding box of all the active values in this tree, i.e. in all nodes of the tree...
Definition: NanoVDB.h:2281
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:4155
typename RootT::CoordType CoordType
Definition: NanoVDB.h:4943
__hostdev__ MagicType toMagic(uint64_t magic)
maps 64 bits of magic number to enum
Definition: NanoVDB.h:368
__hostdev__ const DataType * data() const
Definition: NanoVDB.h:3469
__hostdev__ bool isLevelSet() const
Definition: NanoVDB.h:2142
RootType RootNodeType
Definition: NanoVDB.h:2016
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition: NanoVDB.h:5632
static __hostdev__ uint64_t memUsage()
Return memory usage in bytes for this class only.
Definition: NanoVDB.h:1975
__hostdev__ void setValueOnly(const CoordT &ijk, const ValueType &v)
Definition: NanoVDB.h:4571
__hostdev__ const NodeT * getNode() const
Return a const point to the cached node of the specified type.
Definition: NanoVDB.h:5616
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:3957
__hostdev__ bool isFloatingPoint(GridType gridType)
return true if the GridType maps to a floating point type
Definition: NanoVDB.h:563
CoordT mBBoxMin
Definition: NanoVDB.h:4054
__hostdev__ void setOff()
Set all bits off.
Definition: NanoVDB.h:1252
__hostdev__ void localToGlobalCoord(Coord &ijk) const
modifies local coordinates to global coordinates of a tile or child node
Definition: NanoVDB.h:3584
__hostdev__ void setAvg(const StatsT &v)
Definition: NanoVDB.h:2621
__hostdev__ CoordType getOrigin() const
Definition: NanoVDB.h:3366
__hostdev__ const LeafNodeType * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:3526
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
return the state and updates the value of the specified voxel
Definition: NanoVDB.h:2942
__hostdev__ Vec3T indexToWorldGrad(const Vec3T &grad) const
transform the gradient from index space to world space.
Definition: NanoVDB.h:2101
__hostdev__ uint64_t activeVoxelCount() const
Computes a AABB of active values in world space.
Definition: NanoVDB.h:2136
__hostdev__ const LeafNode * probeLeaf(const CoordT &) const
Definition: NanoVDB.h:4595
__hostdev__ uint64_t * words()
Return a pointer to the list of words of the bit mask.
Definition: NanoVDB.h:1159
__hostdev__ void init(float min, float max, uint8_t bitWidth)
Definition: NanoVDB.h:3837
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition: NanoVDB.h:4997
__hostdev__ Version(uint32_t major, uint32_t minor, uint32_t patch)
Constructor from major.minor.patch version numbers.
Definition: NanoVDB.h:693
__hostdev__ Mask & operator|=(const Mask &other)
Bitwise union.
Definition: NanoVDB.h:1280
static __hostdev__ uint32_t voxelCount()
Return the total number of voxels (e.g. values) encoded in this leaf node.
Definition: NanoVDB.h:4538
typename ChildT::BuildType BuildT
Definition: NanoVDB.h:3167
__hostdev__ DataType * data()
Definition: NanoVDB.h:4474
__hostdev__ Mask & operator-=(const Mask &other)
Bitwise difference.
Definition: NanoVDB.h:1288
__hostdev__ Checksum(uint64_t checksum, CheckMode mode=CheckMode::Full)
Definition: NanoVDB.h:1730
__hostdev__ ValueIterator beginValue()
Definition: NanoVDB.h:2786
__hostdev__ const RootT & root() const
Definition: NanoVDB.h:5605
uint64_t mPointCount
Definition: NanoVDB.h:4274
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition: NanoVDB.h:4995
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:4161
__hostdev__ CoordType origin() const
Return the origin in index space of this leaf node.
Definition: NanoVDB.h:3486
__hostdev__ DenseIterator(uint32_t pos=Mask::SIZE)
Definition: NanoVDB.h:1105
__hostdev__ CoordT getCoord() const
Definition: NanoVDB.h:4404
MaskT< LOG2DIM > mMask
Definition: NanoVDB.h:4249
PointAccessor(const NanoGrid< BuildT > &grid)
Definition: NanoVDB.h:5984
__hostdev__ Vec3T applyIJT(const Vec3T &xyz) const
Apply the transposed inverse 3x3 transformation to an input 3d vector using 64bit floating point arit...
Definition: NanoVDB.h:1479
__hostdev__ void setValueOnly(uint32_t offset, uint16_t value)
Definition: NanoVDB.h:4292
__hostdev__ uint64_t getIndex(const math::Coord &ijk) const
Return the linear offset into a channel that maps to the specified coordinate.
Definition: NanoVDB.h:6172
ValueT mMinimum
Definition: NanoVDB.h:3189
__hostdev__ bool setGridName(const char *src)
Definition: NanoVDB.h:1882
__hostdev__ void setMask(uint32_t offset, bool v)
Definition: NanoVDB.h:4241
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:4057
__hostdev__ void localToGlobalCoord(Coord &ijk) const
Converts (in place) a local index coordinate to a global index coordinate.
Definition: NanoVDB.h:4513
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition: NanoVDB.h:5582
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:4311
uint64_t ValueType
Definition: NanoVDB.h:4262
Dummy type for a 8bit quantization of float point values.
Definition: NanoVDB.h:194
__hostdev__ DataType * data()
Definition: NanoVDB.h:2337
typename NanoLeaf< BuildT >::ValueType ValueType
Definition: NanoVDB.h:6591
MagicType
Enums used to identify magic numbers recognized by NanoVDB.
Definition: NanoVDB.h:357
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition: NanoVDB.h:5817
__hostdev__ bool isValueOn() const
Definition: NanoVDB.h:2861
Dummy type for a voxel whose value equals its binary active state.
Definition: NanoVDB.h:185
uint8_t mFlags
Definition: NanoVDB.h:4154
uint64_t mPrefixSum
Definition: NanoVDB.h:4156
__hostdev__ CoordType getCoord() const
Definition: NanoVDB.h:2682
__hostdev__ Vec3T applyJacobian(const Vec3T &xyz) const
Definition: NanoVDB.h:1894
__hostdev__ util::enable_if< util::is_same< T, Point >::value, const uint64_t & >::type pointCount() const
Return the total number of points indexed by this PointGrid.
Definition: NanoVDB.h:2063
__hostdev__ const RootT & root() const
Definition: NanoVDB.h:5319
__hostdev__ ChildIter(ParentT *parent)
Definition: NanoVDB.h:3313
uint32_t mGridIndex
Definition: NanoVDB.h:1817
__hostdev__ ValueOnIterator(const LeafNode *parent)
Definition: NanoVDB.h:4360
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition: NanoVDB.h:5373
uint64_t mVoxelCount
Definition: NanoVDB.h:2259
static __hostdev__ uint32_t CoordToOffset(const CoordType &ijk)
Return the linear offset corresponding to the given coordinate.
Definition: NanoVDB.h:3568
__hostdev__ uint32_t nodeCount() const
Definition: NanoVDB.h:2387
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition: NanoVDB.h:5372
uint64_t type
Definition: NanoVDB.h:471
__hostdev__ Vec3T applyMap(const Vec3T &ijk) const
Apply the forward affine transformation to a vector using 64bit floating point arithmetics.
Definition: NanoVDB.h:1404
CoordT CoordType
Definition: NanoVDB.h:5575
__hostdev__ CoordType getCoord() const
Definition: NanoVDB.h:3410
static __hostdev__ bool hasStats()
Definition: NanoVDB.h:3769
__hostdev__ const CoordBBox & indexBBox() const
return AABB of active values in index space
Definition: NanoVDB.h:1981
__hostdev__ bool isFloatingPointVector(GridType gridType)
return true if the GridType maps to a floating point vec3.
Definition: NanoVDB.h:577
ValueT mBackground
Definition: NanoVDB.h:2515
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType type
Definition: NanoVDB.h:1640
__hostdev__ ValueOnIterator()
Definition: NanoVDB.h:3389
__hostdev__ bool isInteger(GridType gridType)
Return true if the GridType maps to a POD integer type.
Definition: NanoVDB.h:589
__hostdev__ AccessorType getAccessor() const
Definition: NanoVDB.h:2348
__hostdev__ uint64_t leafPoints(const Coord &ijk, const AttT *&begin, const AttT *&end) const
Return the number of points in the leaf node containing the coordinate ijk. If this return value is l...
Definition: NanoVDB.h:6078
NANOVDB_HOSTDEV_DISABLE_WARNING __hostdev__ uint32_t findPrev(uint32_t start) const
Definition: NanoVDB.h:1330
__hostdev__ bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:2940
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:2757
__hostdev__ const RootT & root() const
Definition: NanoVDB.h:5126
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType type
Definition: NanoVDB.h:1626
void ArrayType
Definition: NanoVDB.h:4101
Defines an affine transform and its inverse represented as a 3x3 matrix and a vec3 translation...
Definition: NanoVDB.h:1349
uint64_t FloatType
Definition: NanoVDB.h:4148
float Type
Definition: NanoVDB.h:512
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache Noop since this template specializa...
Definition: NanoVDB.h:4979
__hostdev__ const Tile * probeTile(const CoordT &ijk) const
Definition: NanoVDB.h:2595
#define NANOVDB_ASSERT(x)
Definition: Util.h:50
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType type
Definition: NanoVDB.h:1633
GridType
List of types that are currently supported by NanoVDB.
Definition: NanoVDB.h:219
typename BuildT::CoordType CoordType
Definition: NanoVDB.h:2023
__hostdev__ ValueOnIterator cbeginValueOn() const
Definition: NanoVDB.h:4379
__hostdev__ DenseIterator & operator++()
Definition: NanoVDB.h:1113
__hostdev__ void setOn()
Set all bits on.
Definition: NanoVDB.h:1246
__hostdev__ FloatType average() const
Return a const reference to the average of all the active values encoded in this leaf node...
Definition: NanoVDB.h:4489
Class to access points at a specific voxel location.
Definition: NanoVDB.h:5977
__hostdev__ Mask & operator^=(const Mask &other)
Bitwise XOR.
Definition: NanoVDB.h:1296
ValueT mMaximum
Definition: NanoVDB.h:2517
static __hostdev__ uint64_t alignmentPadding(const void *p)
return the smallest number of bytes that when added to the specified pointer results in a 32 byte ali...
Definition: NanoVDB.h:550
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition: NanoVDB.h:5100
__hostdev__ Iterator operator++(int)
Definition: NanoVDB.h:1090
ValueT mMinimum
Definition: NanoVDB.h:2516
__hostdev__ ChildIter operator++(int)
Definition: NanoVDB.h:2726
bool FloatType
Definition: NanoVDB.h:799
__hostdev__ const uint32_t & activeTileCount(uint32_t level) const
Return the total number of active tiles at the specified level of the tree.
Definition: NanoVDB.h:2380
C++11 implementation of std::is_floating_point.
Definition: Util.h:329
__hostdev__ FloatType getDev() const
Definition: NanoVDB.h:4303
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:3361
__hostdev__ const RootT & root() const
Definition: NanoVDB.h:4981
__hostdev__ DataType * data()
Definition: NanoVDB.h:3467
const typename GridOrTreeOrRootT::RootNodeType type
Definition: NanoVDB.h:1655
__hostdev__ void setAvg(const StatsT &v)
Definition: NanoVDB.h:3259
__hostdev__ ValueT getValue(uint32_t n) const
Definition: NanoVDB.h:3231
static DstT * PtrAdd(void *p, int64_t offset)
Adds a byte offset to a non-const pointer to produce another non-const pointer.
Definition: Util.h:478
__hostdev__ void setValue(const CoordT &ijk, const ValueType &v)
Sets the value at the specified location and activate its state.
Definition: NanoVDB.h:4565
__hostdev__ ValueOnIter & operator++()
Definition: NanoVDB.h:2811
__hostdev__ float getAvg() const
return the quantized average of the active values in this node
Definition: NanoVDB.h:3852
Class that encapsulates two CRC32 checksums, one for the Grid, Tree and Root node meta data and one f...
Definition: NanoVDB.h:1706
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:5680
__hostdev__ BaseIter(DataT *data=nullptr, uint32_t n=0)
Definition: NanoVDB.h:2665
__hostdev__ uint64_t activeVoxelCount() const
Return a const reference to the index bounding box of all the active values in this tree...
Definition: NanoVDB.h:2373
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition: NanoVDB.h:4993
__hostdev__ float getMax() const
return the quantized maximum of the active values in this node
Definition: NanoVDB.h:3849
typename ChildT::ValueType ValueT
Definition: NanoVDB.h:3166
__hostdev__ bool getDev() const
Definition: NanoVDB.h:4068
Implements Tree::getDim(math::Coord)
Definition: NanoVDB.h:1669
Definition: NanoVDB.h:2658
__hostdev__ const ValueType & background() const
Return the total number of active voxels in the root and all its child nodes.
Definition: NanoVDB.h:2906
__hostdev__ DenseIterator beginDense() const
Definition: NanoVDB.h:3458
Codec
Define compression codecs.
Definition: NanoVDB.h:6224
__hostdev__ Vec3T applyIJT(const Vec3T &xyz) const
Definition: NanoVDB.h:1898
__hostdev__ uint32_t countOn() const
Return the total number of set bits in this Mask.
Definition: NanoVDB.h:1050
uint8_t mFlags
Definition: NanoVDB.h:3819
__hostdev__ bool isChild(uint32_t n) const
Definition: NanoVDB.h:3243
Internal nodes of a VDB tree.
Definition: NanoVDB.h:3274
__hostdev__ ValueOnIterator()
Definition: NanoVDB.h:4355
__hostdev__ ValueType getMax() const
Definition: NanoVDB.h:4301
__hostdev__ ConstDenseIterator cbeginChildAll() const
Definition: NanoVDB.h:2885
static __hostdev__ T * alignPtr(T *p)
offset the specified pointer so it is 32 byte aligned. Works with both const and non-const pointers...
Definition: NanoVDB.h:558
__hostdev__ bool isOn() const
Return true if all the bits are set in this Mask.
Definition: NanoVDB.h:1196
ValueT ValueType
Definition: NanoVDB.h:5574
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition: NanoVDB.h:4992
BuildT TreeType
Definition: NanoVDB.h:2014
Base-class for quantized float leaf nodes.
Definition: NanoVDB.h:3810
uint64_t FloatType
Definition: NanoVDB.h:793
math::BBox< CoordT > mBBox
Definition: NanoVDB.h:3184
__hostdev__ const LeafNodeType * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:2943
__hostdev__ void setMin(const ValueT &v)
Definition: NanoVDB.h:2619
__hostdev__ Vec3T worldToIndexF(const Vec3T &xyz) const
world to index space transformation
Definition: NanoVDB.h:2105
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:4061
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType Type
Definition: NanoVDB.h:1625
__hostdev__ uint64_t getMin() const
Definition: NanoVDB.h:4215
__hostdev__ CoordType getOrigin() const
Definition: NanoVDB.h:3450
__hostdev__ bool isCached(const CoordType &ijk) const
Definition: NanoVDB.h:5133
__hostdev__ Vec3T worldToIndex(const Vec3T &xyz) const
world to index space transformation
Definition: NanoVDB.h:2082
Definition: NanoVDB.h:2254
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:4285
C++11 implementation of std::is_same.
Definition: Util.h:314
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition: NanoVDB.h:5594
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:3826
__hostdev__ void setValue(uint32_t offset, bool v)
Definition: NanoVDB.h:4069
__hostdev__ bool isActive() const
Return true if this node or any of its child nodes contain active values.
Definition: NanoVDB.h:3598
__hostdev__ ValueType getValue(const CoordType &ijk) const
Return the value of the given voxel (regardless of state or location in the tree.) ...
Definition: NanoVDB.h:2351
__hostdev__ uint64_t getMin() const
Definition: NanoVDB.h:4195
Struct with all the member data of the InternalNode (useful during serialization of an openvdb Intern...
Definition: NanoVDB.h:3164
static __hostdev__ constexpr int64_t memUsage()
Definition: NanoVDB.h:3925
__hostdev__ const ChildNodeType * probeChild(const CoordType &ijk) const
Definition: NanoVDB.h:2990
__hostdev__ const NanoGrid< Point > & grid() const
Definition: NanoVDB.h:6064
static __hostdev__ constexpr uint64_t memUsage()
Definition: NanoVDB.h:3956
const typename GridT::TreeType Type
Definition: NanoVDB.h:2299
Dummy type for a 4bit quantization of float point values.
Definition: NanoVDB.h:191
__hostdev__ bool operator!=(const Checksum &rhs) const
return true if the checksums are not identical
Definition: NanoVDB.h:1776
__hostdev__ uint64_t gridSize() const
Return memory usage in bytes for this class only.
Definition: NanoVDB.h:2043
typename ChildT::CoordType CoordT
Definition: NanoVDB.h:3169
uint64_t mCRC64
Definition: NanoVDB.h:1712
__hostdev__ uint64_t & full()
Definition: NanoVDB.h:1744
__hostdev__ void setMin(const ValueType &)
Definition: NanoVDB.h:4124
Return point to the lower internal node where math::Coord maps to one of its values, i.e. terminates.
Definition: NanoVDB.h:6532
uint64_t type
Definition: NanoVDB.h:492
static __hostdev__ bool hasStats()
Definition: NanoVDB.h:4063
const typename GridT::TreeType type
Definition: NanoVDB.h:2300
__hostdev__ NodeTrait< RootT, 1 >::type * getFirstLower()
Definition: NanoVDB.h:2445
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition: NanoVDB.h:5147
__hostdev__ FloatType variance() const
Return the variance of all the active values encoded in this internal node and any of its child nodes...
Definition: NanoVDB.h:3498
__hostdev__ const ValueT & getMin() const
Definition: NanoVDB.h:3248
__hostdev__ uint64_t voxelPoints(const Coord &ijk, const AttT *&begin, const AttT *&end) const
get iterators over attributes to points at a specific voxel location
Definition: NanoVDB.h:6089
uint8_t mFlags
Definition: NanoVDB.h:4056
T type
Definition: Util.h:387
__hostdev__ uint64_t getAvg() const
Definition: NanoVDB.h:4217
__hostdev__ void setBBoxOn(bool on=true)
Definition: NanoVDB.h:1878
__hostdev__ bool isUnknown() const
Definition: NanoVDB.h:2149
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition: NanoVDB.h:2524
__hostdev__ uint32_t head() const
Definition: NanoVDB.h:1745
T type
Definition: NanoVDB.h:464
__hostdev__ ValueIterator & operator++()
Definition: NanoVDB.h:4449
__hostdev__ uint32_t blindDataCount() const
Return true if this grid is empty, i.e. contains no values or nodes.
Definition: NanoVDB.h:2183
__hostdev__ void setChild(uint32_t n, const void *ptr)
Definition: NanoVDB.h:3206
__hostdev__ Vec3T applyInverseJacobian(const Vec3T &xyz) const
Definition: NanoVDB.h:1896
__hostdev__ bool operator==(const Version &rhs) const
Definition: NanoVDB.h:700
Struct with all the member data of the Grid (useful during serialization of an openvdb grid) ...
Definition: NanoVDB.h:1810
bool ValueType
Definition: NanoVDB.h:4098
typename ChildT::template MaskType< LOG2 > MaskType
Definition: NanoVDB.h:3286
auto callNanoGrid(GridDataT *gridData, ArgsT &&...args)
Below is an example of the struct used for generic programming with callNanoGrid. ...
Definition: NanoVDB.h:4855
Implements Tree::isActive(math::Coord)
Definition: NanoVDB.h:1667
__hostdev__ Vec3T applyInverseMapF(const Vec3T &xyz) const
Apply the inverse affine mapping to a vector using 32bit floating point arithmetics.
Definition: NanoVDB.h:1449
Definition: NanoVDB.h:728
bool FloatType
Definition: NanoVDB.h:4100
__hostdev__ bool probeValue(const CoordT &ijk, ValueType &v) const
Return true if the voxel value at the given coordinate is active and updates v with the value...
Definition: NanoVDB.h:4588
__hostdev__ NodeTrait< RootT, 2 >::type * getFirstUpper()
Definition: NanoVDB.h:2447
__hostdev__ void toggle()
brief Toggle the state of all bits in the mask
Definition: NanoVDB.h:1264
__hostdev__ bool isPointIndex() const
Definition: NanoVDB.h:2145
__hostdev__ void setMax(const ValueType &)
Definition: NanoVDB.h:4306
uint32_t mData0
Definition: NanoVDB.h:1828
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:4366
Dummy type for indexing points into voxels.
Definition: NanoVDB.h:203
__hostdev__ const MaskType< LOG2DIM > & getValueMask() const
Definition: NanoVDB.h:3479
__hostdev__ ValueType getValue(const CoordT &ijk) const
Return the voxel value at the given coordinate.
Definition: NanoVDB.h:4555
static __hostdev__ size_t memUsage()
Return memory usage in bytes for the class.
Definition: NanoVDB.h:3475
__hostdev__ NodeT & operator*() const
Definition: NanoVDB.h:3319
typename ChildT::FloatType StatsT
Definition: NanoVDB.h:3168
Definition: NanoVDB.h:902
__hostdev__ bool isActive(const CoordType &ijk) const
Return the active state of the given voxel (regardless of state or location in the tree...
Definition: NanoVDB.h:2355
__hostdev__ const ChildT * getChild(uint32_t n) const
Definition: NanoVDB.h:3225
uint32_t findHighestOn(uint32_t v)
Returns the index of the highest, i.e. most significant, on bit in the specified 32 bit word...
Definition: Util.h:572
DataT * mData
Definition: NanoVDB.h:2663
bool Type
Definition: NanoVDB.h:498
Definition: NanoVDB.h:1102
__hostdev__ ValueType getFirstValue() const
If the first entry in this node's table is a tile, return the tile's value. Otherwise, return the result of calling getFirstValue() on the child.
Definition: NanoVDB.h:3508
StatsT mAverage
Definition: NanoVDB.h:3191
__hostdev__ float getValue(uint32_t i) const
Definition: NanoVDB.h:3964
Definition: NanoVDB.h:2834
__hostdev__ ValueIterator cbeginValueAll() const
Definition: NanoVDB.h:3380
CoordT mBBoxMin
Definition: NanoVDB.h:3817
__hostdev__ NodeT & operator*() const
Definition: NanoVDB.h:2708
typename ChildT::CoordType CoordT
Definition: NanoVDB.h:2484
__hostdev__ uint64_t getMax() const
Definition: NanoVDB.h:4196
__hostdev__ ValueType getValue(uint32_t offset) const
Return the voxel value at the given offset.
Definition: NanoVDB.h:4552
__hostdev__ ValueIter & operator++()
Definition: NanoVDB.h:2767
MaskT mValueMask
Definition: NanoVDB.h:3186
NANOVDB_HOSTDEV_DISABLE_WARNING __hostdev__ uint32_t findNext(uint32_t start) const
Definition: NanoVDB.h:1316
__hostdev__ CoordType getOrigin() const
Definition: NanoVDB.h:2677
__hostdev__ uint32_t totalNodeCount() const
Definition: NanoVDB.h:2399
uint16_t mMin
Definition: NanoVDB.h:3824
typename ChildT::FloatType StatsT
Definition: NanoVDB.h:2485
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType Type
Definition: NanoVDB.h:1632
typename FloatTraits< ValueType >::FloatType FloatType
Definition: NanoVDB.h:4264
__hostdev__ const ValueT & getMin() const
Definition: NanoVDB.h:2614
Like ValueOnIndex but with a mutable mask.
Definition: NanoVDB.h:182
const typename GridOrTreeOrRootT::LeafNodeType Type
Definition: NanoVDB.h:1610
__hostdev__ DataType * data()
Definition: NanoVDB.h:2035
MaskT< LOG2DIM > mValues
Definition: NanoVDB.h:4058
__hostdev__ int findBlindData(const char *name) const
Return the index of the first blind data with specified name if found, otherwise -1.
Definition: NanoVDB.h:2234
uint32_t mTableSize
Definition: NanoVDB.h:2513
typename BuildT::BuildType BuildType
Definition: NanoVDB.h:2022
typename T::ValueType ElementType
Definition: NanoVDB.h:748
__hostdev__ uint64_t memUsage() const
return memory usage in bytes for the leaf node
Definition: NanoVDB.h:4543
__hostdev__ bool isSequential() const
return true if the specified node type is layed out breadth-first in memory and has a fixed size...
Definition: NanoVDB.h:2160
Definition: NanoVDB.h:4330
typename RootT::CoordType CoordType
Definition: NanoVDB.h:2323
float type
Definition: NanoVDB.h:534
defines a tree type from a grid type while preserving constness
Definition: NanoVDB.h:2291
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition: NanoVDB.h:5376
__hostdev__ GridType mapToGridType()
Definition: NanoVDB.h:872
__hostdev__ uint32_t nodeCount(int level) const
Definition: NanoVDB.h:2393
__hostdev__ ChannelT & operator()(int i, int j, int k) const
Definition: NanoVDB.h:6178
__hostdev__ AccessorType getAccessor() const
Return a new instance of a ReadAccessor used to access values in this grid.
Definition: NanoVDB.h:2072
Visits child nodes of this node only.
Definition: NanoVDB.h:3300
__hostdev__ Coord offsetToGlobalCoord(uint32_t n) const
Definition: NanoVDB.h:3590
typename remove_const< T >::type type
Definition: Util.h:431
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:4112
__hostdev__ void setValue(uint32_t offset, uint16_t value)
Definition: NanoVDB.h:4293
__hostdev__ Checksum()
default constructor initiates checksum to EMPTY
Definition: NanoVDB.h:1720
uint64_t Type
Definition: NanoVDB.h:491
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:3926
__hostdev__ ValueIterator(const InternalNode *parent)
Definition: NanoVDB.h:3355
typename Mask< 3 >::template Iterator< ON > MaskIterT
Definition: NanoVDB.h:4346
Leaf nodes of the VDB tree. (defaults to 8x8x8 = 512 voxels)
Definition: NanoVDB.h:4327
__hostdev__ bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:5149
__hostdev__ DataType * data()
Definition: NanoVDB.h:2895
__hostdev__ const uint64_t & valueCount() const
Return total number of values indexed by the IndexGrid.
Definition: NanoVDB.h:6156
__hostdev__ NodeTrait< RootT, LEVEL >::type * getFirstNode()
return a pointer to the first node at the specified level
Definition: NanoVDB.h:2428
__hostdev__ bool isValue() const
Definition: NanoVDB.h:2547
__hostdev__ Vec3T worldToIndexDir(const Vec3T &dir) const
transformation from world space direction to index space direction
Definition: NanoVDB.h:2096
__hostdev__ DenseIterator cbeginChildAll() const
Definition: NanoVDB.h:3459
BuildT BuildType
Definition: NanoVDB.h:5274
__hostdev__ uint32_t rootTableSize() const
return the root table has size
Definition: NanoVDB.h:1984
bool FloatType
Definition: NanoVDB.h:4050
__hostdev__ bool hasBBox() const
Definition: NanoVDB.h:4585
double mTaperD
Definition: NanoVDB.h:1358
__hostdev__ CoordType getCoord() const
Definition: NanoVDB.h:3455
uint32_t dim
Definition: NanoVDB.h:6595
__hostdev__ const ValueType & maximum() const
Return a const reference to the maximum active value encoded in this root node and any of its child n...
Definition: NanoVDB.h:2916
MaskT mChildMask
Definition: NanoVDB.h:3187
__hostdev__ bool isActive(uint32_t n) const
Definition: NanoVDB.h:4575
__hostdev__ Version()
Default constructor.
Definition: NanoVDB.h:684
__hostdev__ void setMinMaxOn(bool on=true)
Definition: NanoVDB.h:1877
static __hostdev__ uint32_t valueCount()
Definition: NanoVDB.h:4191
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:3752
__hostdev__ const Tile * tile(uint32_t n) const
Returns a non-const reference to the tile at the specified linear offset.
Definition: NanoVDB.h:2559
__hostdev__ const StatsT & average() const
Definition: NanoVDB.h:3250
__hostdev__ ValueType getFirstValue() const
Return the first value in this leaf node.
Definition: NanoVDB.h:4558
__hostdev__ ValueOnIterator cbeginValueOn() const
Definition: NanoVDB.h:3414
typename GridOrTreeOrRootT::RootNodeType Type
Definition: NanoVDB.h:1646
__hostdev__ ValueOnIterator(const InternalNode *parent)
Definition: NanoVDB.h:3394
__hostdev__ ConstValueOnIterator cbeginValueOn() const
Definition: NanoVDB.h:2831
Definition: NanoVDB.h:2529
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition: NanoVDB.h:5108
FloatType mAverage
Definition: NanoVDB.h:3756
BuildT BuildType
Definition: NanoVDB.h:4941
ValueT ValueType
Definition: NanoVDB.h:5275
__hostdev__ const ChildNodeType * probeChild(const CoordType &ijk) const
Definition: NanoVDB.h:3561
float Type
Definition: NanoVDB.h:505
typename UpperNodeType::ChildNodeType LowerNodeType
Definition: NanoVDB.h:2643
StatsT mStdDevi
Definition: NanoVDB.h:2519
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:4171
__hostdev__ const DataType * data() const
Definition: NanoVDB.h:2037
__hostdev__ uint32_t & head()
Definition: NanoVDB.h:1746
ValueT value
Definition: NanoVDB.h:3175
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition: NanoVDB.h:4281
__hostdev__ bool isCached1(const CoordType &ijk) const
Definition: NanoVDB.h:5352
__hostdev__ bool isActive(uint32_t n) const
Definition: NanoVDB.h:3237
__hostdev__ ValueOnIterator beginValueOn()
Definition: NanoVDB.h:2830
__hostdev__ const ChildT * getChild(const Tile *tile) const
Definition: NanoVDB.h:2608
__hostdev__ bool isEmpty() const
return true if the 64 bit checksum is disables (unset)
Definition: NanoVDB.h:1759
__hostdev__ Iterator(uint32_t pos, const Mask *parent)
Definition: NanoVDB.h:1076
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition: NanoVDB.h:5283
__hostdev__ ValueType getMax() const
Definition: NanoVDB.h:3781
typename GridOrTreeOrRootT::RootNodeType type
Definition: NanoVDB.h:1647
__hostdev__ void * nodePtr()
Return a non-const void pointer to the first node at LEVEL.
Definition: NanoVDB.h:1932
__hostdev__ float getMin() const
return the quantized minimum of the active values in this node
Definition: NanoVDB.h:3846
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:5151
__hostdev__ ValueOffIterator()
Definition: NanoVDB.h:4388
ChildT ChildNodeType
Definition: NanoVDB.h:3282
typename DataType::BuildT BuildType
Definition: NanoVDB.h:3280
__hostdev__ ValueOffIterator cbeginValueOff() const
Definition: NanoVDB.h:4412
uint32_t mSize
Definition: NanoVDB.h:2664
__hostdev__ GridClass toGridClass(GridClass defaultClass=GridClass::Unknown)
Maps from a templated build type to a GridClass enum.
Definition: NanoVDB.h:878
typename DataType::ValueType ValueType
Definition: NanoVDB.h:4338
float type
Definition: NanoVDB.h:527
__hostdev__ uint32_t getMajor() const
Definition: NanoVDB.h:706
__hostdev__ Vec3T indexToWorldGradF(const Vec3T &grad) const
Transforms the gradient from index space to world space.
Definition: NanoVDB.h:2124
__hostdev__ const NodeTrait< TreeT, LEVEL >::type * getNode() const
Definition: NanoVDB.h:5624
__hostdev__ bool hasBBox() const
Definition: NanoVDB.h:2151
uint64_t type
Definition: NanoVDB.h:541
__hostdev__ FloatType getAvg() const
Definition: NanoVDB.h:4302
typename ChildT::LeafNodeType LeafNodeType
Definition: NanoVDB.h:3281
__hostdev__ void setValue(const CoordType &k, bool s, const ValueType &v)
Definition: NanoVDB.h:2539
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition: NanoVDB.h:5677
__hostdev__ const uint64_t * words() const
Definition: NanoVDB.h:1160
__hostdev__ const GridBlindMetaData & blindMetaData(uint32_t n) const
Definition: NanoVDB.h:2217
static __hostdev__ uint32_t bitCount()
Return the number of bits available in this Mask.
Definition: NanoVDB.h:1044
__hostdev__ void setDev(const bool &)
Definition: NanoVDB.h:4078
uint64_t Type
Definition: NanoVDB.h:484
__hostdev__ Vec3T indexToWorldDir(const Vec3T &dir) const
transformation from index space direction to world space direction
Definition: NanoVDB.h:2091
__hostdev__ const void * getRoot() const
Get a const void pointer to the root node (never NULL)
Definition: NanoVDB.h:2272
__hostdev__ const StatsT & stdDeviation() const
Definition: NanoVDB.h:3251
__hostdev__ bool isActive() const
Return true if any of the voxel value are active in this leaf node.
Definition: NanoVDB.h:4578
GridBlindDataClass
Blind-data Classes that are currently supported by NanoVDB.
Definition: NanoVDB.h:416
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:4271
__hostdev__ const void * treePtr() const
Definition: NanoVDB.h:1915
static __hostdev__ size_t memUsage()
Return the memory footprint in bytes of this Mask.
Definition: NanoVDB.h:1041
const typename GridOrTreeOrRootT::RootNodeType Type
Definition: NanoVDB.h:1654
Visits all active values in a leaf node.
Definition: NanoVDB.h:4349
__hostdev__ const LeafNodeType * getFirstLeaf() const
Definition: NanoVDB.h:2444
__hostdev__ Vec3T indexToWorldDirF(const Vec3T &dir) const
transformation from index space direction to world space direction
Definition: NanoVDB.h:2114