125 #ifndef NANOVDB_NANOVDB_H_HAS_BEEN_INCLUDED 126 #define NANOVDB_NANOVDB_H_HAS_BEEN_INCLUDED 130 #include <nanovdb/math/Math.h> 133 #define NANOVDB_DATA_ALIGNMENT 32 139 #define NANOVDB_MAGIC_NUMB 0x304244566f6e614eUL // "NanoVDB0" in hex - little endian (uint64_t) 140 #define NANOVDB_MAGIC_GRID 0x314244566f6e614eUL // "NanoVDB1" in hex - little endian (uint64_t) 141 #define NANOVDB_MAGIC_FILE 0x324244566f6e614eUL // "NanoVDB2" in hex - little endian (uint64_t) 142 #define NANOVDB_MAGIC_MASK 0x00FFFFFFFFFFFFFFUL // use this mask to remove the number 144 #define NANOVDB_USE_NEW_MAGIC_NUMBERS// enables use of the new magic numbers described above 146 #define NANOVDB_MAJOR_VERSION_NUMBER 32 // reflects changes to the ABI and hence also the file format 147 #define NANOVDB_MINOR_VERSION_NUMBER 9 // reflects changes to the API but not ABI 148 #define NANOVDB_PATCH_VERSION_NUMBER 0 // reflects changes that does not affect the ABI or API 150 #define TBB_SUPPRESS_DEPRECATED_MESSAGES 1 153 #define NANOVDB_USE_SINGLE_ROOT_KEY 161 #define NANOVDB_FPN_BRANCHLESS 163 #if !defined(NANOVDB_ALIGN) 164 #define NANOVDB_ALIGN(n) alignas(n) 165 #endif // !defined(NANOVDB_ALIGN) 203 template <
class EnumT>
476 return defaultSemantic;
589 template <
typename T>
672 switch (blindClass) {
724 : mData(major << 21 | minor << 10 | patch)
763 static const int Rank = 0;
764 static const bool IsScalar =
true;
765 static const bool IsVector =
false;
766 static const int Size = 1;
768 static T
scalar(
const T& s) {
return s; }
774 static const int Rank = 1;
775 static const bool IsScalar =
false;
776 static const bool IsVector =
true;
777 static const int Size = T::SIZE;
784 template<typename T, int = sizeof(typename TensorTraits<T>::ElementType)>
829 template<
typename BuildT>
884 template<
typename BuildT>
885 [[deprecated(
"Use toGridType<T>() instead.")]]
891 template<
typename BuildT>
906 template<
typename BuildT>
907 [[deprecated(
"Use toGridClass<T>() instead.")]]
910 return toGridClass<BuildT>();
948 BitFlags(std::initializer_list<uint8_t> list)
950 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
952 template<
typename MaskT>
953 BitFlags(std::initializer_list<MaskT> list)
955 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
959 __hostdev__ void initBit(std::initializer_list<uint8_t> list)
962 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
964 template<
typename MaskT>
965 __hostdev__ void initMask(std::initializer_list<MaskT> list)
968 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
975 __hostdev__ void setBitOn(uint8_t bit) { mFlags |=
static_cast<Type>(1 << bit); }
976 __hostdev__ void setBitOff(uint8_t bit) { mFlags &= ~static_cast<
Type>(1 << bit); }
978 __hostdev__ void setBitOn(std::initializer_list<uint8_t> list)
980 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
982 __hostdev__ void setBitOff(std::initializer_list<uint8_t> list)
984 for (
auto bit : list) mFlags &= ~static_cast<
Type>(1 << bit);
987 template<
typename MaskT>
988 __hostdev__ void setMaskOn(MaskT mask) { mFlags |=
static_cast<Type>(mask); }
989 template<
typename MaskT>
990 __hostdev__ void setMaskOff(MaskT mask) { mFlags &= ~static_cast<
Type>(mask); }
992 template<
typename MaskT>
993 __hostdev__ void setMaskOn(std::initializer_list<MaskT> list)
995 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
997 template<
typename MaskT>
998 __hostdev__ void setMaskOff(std::initializer_list<MaskT> list)
1000 for (
auto mask : list) mFlags &= ~static_cast<
Type>(mask);
1003 __hostdev__ void setBit(uint8_t bit,
bool on) { on ? this->setBitOn(bit) : this->setBitOff(bit); }
1004 template<
typename MaskT>
1005 __hostdev__ void setMask(MaskT mask,
bool on) { on ? this->setMaskOn(mask) : this->setMaskOff(mask); }
1009 __hostdev__ bool isBitOn(uint8_t bit)
const {
return 0 != (mFlags &
static_cast<Type>(1 << bit)); }
1010 __hostdev__ bool isBitOff(uint8_t bit)
const {
return 0 == (mFlags &
static_cast<Type>(1 << bit)); }
1011 template<
typename MaskT>
1012 __hostdev__ bool isMaskOn(MaskT mask)
const {
return 0 != (mFlags &
static_cast<Type>(mask)); }
1013 template<
typename MaskT>
1014 __hostdev__ bool isMaskOff(MaskT mask)
const {
return 0 == (mFlags &
static_cast<Type>(mask)); }
1016 template<
typename MaskT>
1017 __hostdev__ bool isMaskOn(std::initializer_list<MaskT> list)
const 1019 for (
auto mask : list) {
1020 if (0 != (mFlags & static_cast<Type>(mask)))
return true;
1025 template<
typename MaskT>
1026 __hostdev__ bool isMaskOff(std::initializer_list<MaskT> list)
const 1028 for (
auto mask : list) {
1029 if (0 == (mFlags & static_cast<Type>(mask)))
return true;
1045 template<u
int32_t LOG2DIM>
1049 static constexpr uint32_t SIZE = 1U << (3 * LOG2DIM);
1050 static constexpr uint32_t WORD_COUNT = SIZE >> 6;
1065 for (
const uint64_t *w = mWords, *q = w + WORD_COUNT; w != q; ++w)
1073 uint32_t n = i >> 6, sum =
util::countOn(mWords[n] & ((uint64_t(1) << (i & 63u)) - 1u));
1074 for (
const uint64_t* w = mWords; n--; ++w)
1099 mPos = mParent->findNext<On>(mPos + 1);
1111 const Mask* mParent;
1153 for (uint32_t i = 0; i < WORD_COUNT; ++i)
1158 const uint64_t v = on ? ~uint64_t(0) : uint64_t(0);
1159 for (uint32_t i = 0; i < WORD_COUNT; ++i)
1166 for (uint32_t i = 0; i < WORD_COUNT; ++i)
1167 mWords[i] = other.mWords[i];
1174 template<
typename WordT>
1179 return reinterpret_cast<WordT*
>(mWords)[n];
1181 template<
typename WordT>
1186 reinterpret_cast<WordT*
>(mWords)[n] = w;
1190 template<
typename MaskT = Mask>
1193 static_assert(
sizeof(
Mask) ==
sizeof(MaskT),
"Mismatching sizeof");
1194 static_assert(WORD_COUNT == MaskT::WORD_COUNT,
"Mismatching word count");
1195 static_assert(LOG2DIM == MaskT::LOG2DIM,
"Mismatching LOG2DIM");
1196 auto* src =
reinterpret_cast<const uint64_t*
>(&other);
1197 for (uint64_t *dst = mWords, *end = dst + WORD_COUNT; dst != end; ++dst)
1203 Mask& operator=(
const Mask&) =
default;
1207 for (uint32_t i = 0; i < WORD_COUNT; ++i) {
1208 if (mWords[i] != other.mWords[i])
1217 __hostdev__ bool isOn(uint32_t n)
const {
return 0 != (mWords[n >> 6] & (uint64_t(1) << (n & 63))); }
1220 __hostdev__ bool isOff(uint32_t n)
const {
return 0 == (mWords[n >> 6] & (uint64_t(1) << (n & 63))); }
1225 for (uint32_t i = 0; i < WORD_COUNT; ++i)
1226 if (mWords[i] != ~uint64_t(0))
1234 for (uint32_t i = 0; i < WORD_COUNT; ++i)
1235 if (mWords[i] != uint64_t(0))
1245 #if defined(__CUDACC__) // the following functions only run on the GPU! 1246 __device__ inline void setOnAtomic(uint32_t n)
1248 atomicOr(reinterpret_cast<unsigned long long int*>(
this) + (n >> 6), 1ull << (n & 63));
1250 __device__ inline void setOffAtomic(uint32_t n)
1252 atomicAnd(reinterpret_cast<unsigned long long int*>(
this) + (n >> 6), ~(1ull << (n & 63)));
1254 __device__ inline void setAtomic(uint32_t n,
bool on)
1256 on ? this->setOnAtomic(n) : this->setOffAtomic(n);
1281 #if 1 // switch between branchless 1282 auto& word = mWords[n >> 6];
1284 word &= ~(uint64_t(1) << n);
1285 word |= uint64_t(on) << n;
1287 on ? this->setOn(n) : this->setOff(n);
1294 for (uint32_t i = 0; i < WORD_COUNT; ++i)mWords[i] = ~uint64_t(0);
1300 for (uint32_t i = 0; i < WORD_COUNT; ++i) mWords[i] = uint64_t(0);
1306 const uint64_t v = on ? ~uint64_t(0) : uint64_t(0);
1307 for (uint32_t i = 0; i < WORD_COUNT; ++i) mWords[i] = v;
1312 uint32_t n = WORD_COUNT;
1313 for (
auto* w = mWords; n--; ++w) *w = ~*w;
1320 uint64_t* w1 = mWords;
1321 const uint64_t* w2 = other.mWords;
1322 for (uint32_t n = WORD_COUNT; n--; ++w1, ++w2) *w1 &= *w2;
1328 uint64_t* w1 = mWords;
1329 const uint64_t* w2 = other.mWords;
1330 for (uint32_t n = WORD_COUNT; n--; ++w1, ++w2) *w1 |= *w2;
1336 uint64_t* w1 = mWords;
1337 const uint64_t* w2 = other.mWords;
1338 for (uint32_t n = WORD_COUNT; n--; ++w1, ++w2) *w1 &= ~*w2;
1344 uint64_t* w1 = mWords;
1345 const uint64_t* w2 = other.mWords;
1346 for (uint32_t n = WORD_COUNT; n--; ++w1, ++w2) *w1 ^= *w2;
1355 const uint64_t* w = mWords;
1356 for (; n < WORD_COUNT && !(ON ? *w : ~*w); ++w, ++n);
1364 uint32_t n = start >> 6;
1365 if (n >= WORD_COUNT)
return SIZE;
1366 uint32_t m = start & 63u;
1367 uint64_t b = ON ? mWords[n] : ~mWords[n];
1368 if (b & (uint64_t(1u) << m))
return start;
1369 b &= ~uint64_t(0u) << m;
1370 while (!b && ++n < WORD_COUNT) b = ON ? mWords[n] : ~mWords[n];
1378 uint32_t n = start >> 6;
1379 if (n >= WORD_COUNT)
return SIZE;
1380 uint32_t m = start & 63u;
1381 uint64_t b = ON ? mWords[n] : ~mWords[n];
1382 if (b & (uint64_t(1u) << m))
return start;
1383 b &= (uint64_t(1u) << m) - 1u;
1384 while (!b && n) b = ON ? mWords[--n] : ~mWords[--n];
1389 uint64_t mWords[WORD_COUNT];
1408 : mMatF{ 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}
1409 , mInvMatF{1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}
1410 , mVecF{0.0f, 0.0f, 0.0f}
1412 , mMatD{ 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}
1413 , mInvMatD{1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}
1414 , mVecD{0.0, 0.0, 0.0}
1419 : mMatF{float(s), 0.0f, 0.0f, 0.0f, float(s), 0.0f, 0.0f, 0.0f, float(s)}
1420 , 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)}
1421 , mVecF{float(t[0]), float(t[1]), float(t[2])}
1423 , mMatD{s, 0.0, 0.0, 0.0, s, 0.0, 0.0, 0.0, s}
1424 , mInvMatD{1.0 / s, 0.0, 0.0, 0.0, 1.0 / s, 0.0, 0.0, 0.0, 1.0 / s}
1425 , mVecD{t[0], t[1], t[2]}
1432 template<
typename MatT,
typename Vec3T>
1433 void set(
const MatT& mat,
const MatT& invMat,
const Vec3T& translate,
double taper = 1.0);
1438 template<
typename Mat4T>
1439 void set(
const Mat4T& mat,
const Mat4T& invMat,
double taper = 1.0) { this->
set(mat, invMat, mat[3], taper); }
1441 template<
typename Vec3T>
1442 void set(
double scale,
const Vec3T& translation,
double taper = 1.0);
1449 template<
typename Vec3T>
1457 template<
typename Vec3T>
1466 template<
typename Vec3T>
1475 template<
typename Vec3T>
1483 template<
typename Vec3T>
1486 return math::matMult(mInvMatD, Vec3T(xyz[0] - mVecD[0], xyz[1] - mVecD[1], xyz[2] - mVecD[2]));
1494 template<
typename Vec3T>
1497 return math::matMult(mInvMatF, Vec3T(xyz[0] - mVecF[0], xyz[1] - mVecF[1], xyz[2] - mVecF[2]));
1506 template<
typename Vec3T>
1515 template<
typename Vec3T>
1524 template<
typename Vec3T>
1526 template<
typename Vec3T>
1533 template<
typename MatT,
typename Vec3T>
1534 inline void Map::set(
const MatT& mat,
const MatT& invMat,
const Vec3T& translate,
double taper)
1536 float * mf = mMatF, *vf = mVecF, *mif = mInvMatF;
1537 double *md = mMatD, *vd = mVecD, *mid = mInvMatD;
1538 mTaperF =
static_cast<float>(taper);
1540 for (
int i = 0; i < 3; ++i) {
1541 *vd++ = translate[i];
1542 *vf++ =
static_cast<float>(translate[i]);
1543 for (
int j = 0; j < 3; ++j) {
1545 *mid++ = invMat[j][i];
1546 *mf++ =
static_cast<float>(mat[j][i]);
1547 *mif++ =
static_cast<float>(invMat[j][i]);
1552 template<
typename Vec3T>
1553 inline void Map::set(
double dx,
const Vec3T& trans,
double taper)
1556 const double mat[3][3] = { {dx, 0.0, 0.0},
1559 const double idx = 1.0 / dx;
1560 const double invMat[3][3] = { {idx, 0.0, 0.0},
1563 this->
set(mat, invMat, trans, taper);
1570 static const int MaxNameSize = 256;
1577 char mName[MaxNameSize];
1593 : mDataOffset(dataOffset)
1594 , mValueCount(valueCount)
1595 , mValueSize(valueSize)
1596 , mSemantic(semantic)
1597 , mDataClass(dataClass)
1598 , mDataType(dataType)
1605 : mDataOffset(util::
PtrDiff(util::
PtrAdd(&other, other.mDataOffset), this))
1606 , mValueCount(other.mValueCount)
1607 , mValueSize(other.mValueSize)
1608 , mSemantic(other.mSemantic)
1609 , mDataClass(other.mDataClass)
1610 , mDataType(other.mDataType)
1622 mValueSize = rhs. mValueSize;
1652 template<
typename BlindDataT>
1655 return mDataOffset && (mDataType == toGridType<BlindDataT>()) ? util::PtrAdd<BlindDataT>(
this, mDataOffset) :
nullptr;
1663 auto check = [&]()->
bool{
1681 default:
return true;}
1695 return math::AlignUp<NANOVDB_DATA_ALIGNMENT>(mValueCount * mValueSize);
1703 template<
typename Gr
idOrTreeOrRootT,
int LEVEL>
1707 template<
typename Gr
idOrTreeOrRootT>
1710 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1711 using Type =
typename GridOrTreeOrRootT::LeafNodeType;
1712 using type =
typename GridOrTreeOrRootT::LeafNodeType;
1714 template<
typename Gr
idOrTreeOrRootT>
1717 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1718 using Type =
const typename GridOrTreeOrRootT::LeafNodeType;
1719 using type =
const typename GridOrTreeOrRootT::LeafNodeType;
1722 template<
typename Gr
idOrTreeOrRootT>
1725 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1726 using Type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1727 using type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1729 template<
typename Gr
idOrTreeOrRootT>
1732 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1733 using Type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1734 using type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1736 template<
typename Gr
idOrTreeOrRootT>
1739 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1740 using Type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1741 using type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1743 template<
typename Gr
idOrTreeOrRootT>
1746 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1747 using Type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1748 using type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1750 template<
typename Gr
idOrTreeOrRootT>
1753 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1754 using Type =
typename GridOrTreeOrRootT::RootNodeType;
1755 using type =
typename GridOrTreeOrRootT::RootNodeType;
1758 template<
typename Gr
idOrTreeOrRootT>
1761 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1762 using Type =
const typename GridOrTreeOrRootT::RootNodeType;
1763 using type =
const typename GridOrTreeOrRootT::RootNodeType;
1766 template<
typename Gr
idOrTreeOrRootT,
int LEVEL>
1771 template<
typename BuildT>
1773 template<
typename BuildT>
1775 template<
typename BuildT>
1777 template<
typename BuildT>
1779 template<
typename BuildT>
1781 template<
typename BuildT>
1783 template<
typename BuildT>
1785 template<
typename BuildT>
1823 union { uint32_t mCRC32[2]; uint64_t
mCRC64; };
1827 static constexpr uint32_t EMPTY32 = ~uint32_t{0};
1828 static constexpr uint64_t EMPTY64 = ~uint64_t(0);
1847 [[deprecated(
"Use Checksum::data instead.")]]
1849 [[deprecated(
"Use Checksum::head and Ckecksum::tail instead.")]]
1851 [[deprecated(
"Use Checksum::head and Ckecksum::tail instead.")]]
1862 [[deprecated(
"Use Checksum::isHalf instead.")]]
1923 static const int MaxNameSize = 256;
1931 char mGridName[MaxNameSize];
1946 uint64_t gridSize = 0u,
1951 #ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS 1958 mFlags.initMask(list);
1961 mGridSize = gridSize;
1962 mGridName[0] =
'\0';
1964 mWorldBBox = Vec3dBBox();
1965 mVoxelSize = map.getVoxelSize();
1966 mGridClass = gridClass;
1967 mGridType = gridType;
1968 mBlindMetadataOffset = mGridSize;
1969 mBlindMetadataCount = 0u;
1972 #ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS 1987 if (test) test = mGridCount > 0u && mGridIndex < mGridCount;
1999 const bool success = (
util::strncpy(mGridName, src, MaxNameSize)[MaxNameSize-1] ==
'\0');
2000 if (!success) mGridName[MaxNameSize-1] =
'\0';
2004 template<
typename Vec3T>
2006 template<
typename Vec3T>
2008 template<
typename Vec3T>
2010 template<
typename Vec3T>
2012 template<
typename Vec3T>
2015 template<
typename Vec3T>
2017 template<
typename Vec3T>
2019 template<
typename Vec3T>
2021 template<
typename Vec3T>
2023 template<
typename Vec3T>
2034 template <u
int32_t LEVEL>
2037 static_assert(LEVEL >= 0 && LEVEL <= 3,
"invalid LEVEL template parameter");
2038 const void *treeData =
this + 1;
2039 const uint64_t nodeOffset = *util::PtrAdd<uint64_t>(treeData, 8*LEVEL);
2040 return nodeOffset ?
util::PtrAdd(treeData, nodeOffset) :
nullptr;
2046 template <u
int32_t LEVEL>
2049 static_assert(LEVEL >= 0 && LEVEL <= 3,
"invalid LEVEL template parameter");
2050 void *treeData =
this + 1;
2051 const uint64_t nodeOffset = *util::PtrAdd<uint64_t>(treeData, 8*LEVEL);
2052 return nodeOffset ?
util::PtrAdd(treeData, nodeOffset) :
nullptr;
2057 template <u
int32_t LEVEL>
2060 static_assert(LEVEL >= 0 && LEVEL < 3,
"invalid LEVEL template parameter");
2061 return *util::PtrAdd<uint32_t>(
this + 1, 4*(8 + LEVEL));
2070 return util::PtrAdd<GridBlindMetaData>(
this, mBlindMetadataOffset) + n;
2077 for (uint32_t i = 0; i < mBlindMetadataCount; ++i) {
2078 const auto* metaData = this->blindMetaData(i);
2081 return metaData->template getBlindData<const char>();
2101 const void *root = this->nodePtr<3>();
2102 return root ? *util::PtrAdd<uint32_t>(root,
sizeof(CoordBBox)) : 0u;
2115 template<
typename BuildT,
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1>
2118 template<
typename BuildT>
2125 template<
typename TreeT>
2145 Grid& operator=(
const Grid&) =
delete;
2169 template<
typename T = BuildType>
2176 template<
typename T = BuildType>
2181 __hostdev__ const TreeT&
tree()
const {
return *
reinterpret_cast<const TreeT*
>(this->treePtr()); }
2196 template<
typename Vec3T>
2200 template<
typename Vec3T>
2205 template<
typename Vec3T>
2210 template<
typename Vec3T>
2215 template<
typename Vec3T>
2219 template<
typename Vec3T>
2223 template<
typename Vec3T>
2228 template<
typename Vec3T>
2233 template<
typename Vec3T>
2238 template<
typename Vec3T>
2274 template<
typename NodeT>
2283 __hostdev__ bool isSequential()
const {
return UpperNodeType::FIXED_SIZE && LowerNodeType::FIXED_SIZE && LeafNodeType::FIXED_SIZE && this->isBreadthFirst(); }
2301 __hostdev__ int findBlindData(
const char* name)
const;
2310 [[deprecated(
"Use Grid::getBlindData<T>() instead.")]]
2313 printf(
"\nnanovdb::Grid::blindData is unsafe and hence deprecated! Please use nanovdb::Grid::getBlindData instead.\n\n");
2315 return this->blindMetaData(n).blindData();
2318 template <
typename BlindDataT>
2321 if (n >= DataType::mBlindMetadataCount)
return nullptr;
2322 return this->blindMetaData(n).template getBlindData<BlindDataT>();
2325 template <
typename BlindDataT>
2328 if (n >= DataType::mBlindMetadataCount)
return nullptr;
2329 return const_cast<BlindDataT*
>(this->blindMetaData(n).template getBlindData<BlindDataT>());
2338 template<
typename TreeT>
2341 for (uint32_t i = 0, n = this->blindDataCount(); i < n; ++i) {
2342 if (this->blindMetaData(i).mSemantic == semantic)
2348 template<
typename TreeT>
2351 auto test = [&](
int n) {
2352 const char* str = this->blindMetaData(n).mName;
2354 if (name[i] != str[i])
2356 if (name[i] ==
'\0' && str[i] ==
'\0')
2361 for (
int i = 0, n = this->blindDataCount(); i < n; ++i)
2371 int64_t mNodeOffset[4];
2372 uint32_t mNodeCount[3];
2373 uint32_t mTileCount[3];
2388 template<
typename NodeT>
2392 __hostdev__ bool isEmpty()
const {
return mNodeOffset[3] ? *util::PtrAdd<uint32_t>(
this, mNodeOffset[3] +
sizeof(CoordBBox)) == 0 :
true;}
2395 __hostdev__ CoordBBox
bbox()
const {
return mNodeOffset[3] ? *util::PtrAdd<CoordBBox>(
this, mNodeOffset[3]) : CoordBBox();}
2404 template<
typename Gr
idT>
2407 using Type =
typename GridT::TreeType;
2408 using type =
typename GridT::TreeType;
2410 template<
typename Gr
idT>
2413 using Type =
const typename GridT::TreeType;
2414 using type =
const typename GridT::TreeType;
2417 template<
typename Gr
idT>
2423 template<
typename RootT>
2426 static_assert(RootT::LEVEL == 3,
"Tree depth is not supported");
2427 static_assert(RootT::ChildNodeType::LOG2DIM == 5,
"Tree configuration is not supported");
2428 static_assert(RootT::ChildNodeType::ChildNodeType::LOG2DIM == 4,
"Tree configuration is not supported");
2429 static_assert(RootT::LeafNodeType::LOG2DIM == 3,
"Tree configuration is not supported");
2444 using Node2 =
typename RootT::ChildNodeType;
2445 using Node1 =
typename Node2::ChildNodeType;
2451 Tree& operator=(
const Tree&) =
delete;
2463 __hostdev__ const RootT&
root()
const {
return *
reinterpret_cast<const RootT*
>(DataType::getRoot());}
2500 return DataType::mTileCount[level - 1];
2503 template<
typename NodeT>
2506 static_assert(NodeT::LEVEL < 3,
"Invalid NodeT");
2507 return DataType::mNodeCount[NodeT::LEVEL];
2513 return DataType::mNodeCount[level];
2518 return DataType::mNodeCount[0] + DataType::mNodeCount[1] + DataType::mNodeCount[2];
2524 template<
typename NodeT>
2527 const int64_t nodeOffset = DataType::mNodeOffset[NodeT::LEVEL];
2528 return nodeOffset ? util::PtrAdd<NodeT>(
this, nodeOffset) :
nullptr;
2534 template<
typename NodeT>
2537 const int64_t nodeOffset = DataType::mNodeOffset[NodeT::LEVEL];
2538 return nodeOffset ? util::PtrAdd<NodeT>(
this, nodeOffset) :
nullptr;
2547 return this->
template getFirstNode<typename NodeTrait<RootT, LEVEL>::type>();
2556 return this->
template getFirstNode<typename NodeTrait<RootT, LEVEL>::type>();
2567 template<
typename OpT,
typename... ArgsT>
2570 return this->root().template get<OpT>(ijk, args...);
2573 template<
typename OpT,
typename... ArgsT>
2576 return this->root().template set<OpT>(ijk, args...);
2584 template<
typename RootT>
2587 min = this->root().minimum();
2588 max = this->root().maximum();
2596 template<
typename ChildT>
2603 static constexpr
bool FIXED_SIZE =
false;
2606 #ifdef NANOVDB_USE_SINGLE_ROOT_KEY 2608 template<
typename CoordType>
2611 static_assert(
sizeof(
CoordT) ==
sizeof(CoordType),
"Mismatching sizeof");
2612 static_assert(32 - ChildT::TOTAL <= 21,
"Cannot use 64 bit root keys");
2613 return (
KeyT(uint32_t(ijk[2]) >> ChildT::TOTAL)) |
2614 (
KeyT(uint32_t(ijk[1]) >> ChildT::TOTAL) << 21) |
2615 (
KeyT(uint32_t(ijk[0]) >> ChildT::TOTAL) << 42);
2619 static constexpr uint64_t MASK = (1u << 21) - 1;
2620 return CoordT(((key >> 42) & MASK) << ChildT::TOTAL,
2621 ((key >> 21) & MASK) << ChildT::TOTAL,
2622 ( key & MASK) << ChildT::TOTAL);
2646 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
Tile 2648 template<
typename CoordType>
2651 key = CoordToKey(k);
2655 template<
typename CoordType,
typename ValueType>
2658 key = CoordToKey(k);
2679 return reinterpret_cast<const Tile*
>(
this + 1) + n;
2684 return reinterpret_cast<Tile*
>(
this + 1) + n;
2687 template<
typename DataT>
2698 : mBegin(reinterpret_cast<
TileT*>(data + 1))
2699 , mPos(mBegin + pos)
2700 , mEnd(mBegin + data->mTableSize)
2726 return reinterpret_cast<DataT*
>(mBegin) - 1;
2731 return mPos->child != 0;
2736 return mPos->child == 0;
2741 return mPos->child == 0 && mPos->state != 0;
2746 return util::PtrAdd<NodeT>(this->data(), mPos->child);
2763 const auto key = CoordToKey(ijk);
2765 for(; iter; ++iter)
if (iter->key == key)
break;
2771 const auto key = CoordToKey(ijk);
2773 for(; iter; ++iter)
if (iter->key == key)
break;
2779 auto iter = this->probe(ijk);
2780 return iter ? iter.operator->() :
nullptr;
2785 return const_cast<RootData*
>(
this)->probeTile(ijk);
2790 auto iter = this->probe(ijk);
2791 return iter && iter.isChild() ? iter.child() :
nullptr;
2796 return const_cast<RootData*
>(
this)->probeChild(ijk);
2805 return util::PtrAdd<ChildT>(
this, tile->
child);
2810 return util::PtrAdd<ChildT>(
this, tile->
child);
2833 template<
typename ChildT>
2852 static constexpr
bool FIXED_SIZE = DataType::FIXED_SIZE;
2854 static constexpr uint32_t LEVEL = 1 + ChildT::LEVEL;
2856 template<
typename RootT>
2874 template<
typename RootT>
2880 using BaseT::mTileIter;
2886 while (mTileIter && mTileIter.isValue()) ++mTileIter;
2893 while (mTileIter && mTileIter.isValue()) ++mTileIter;
2910 template<
typename RootT>
2914 using BaseT::mTileIter;
2920 while (mTileIter && mTileIter.isChild()) ++mTileIter;
2927 while (mTileIter && mTileIter.isChild()) ++mTileIter;
2944 template<
typename RootT>
2948 using BaseT::mTileIter;
2954 while (mTileIter && !mTileIter.isValueOn()) ++mTileIter;
2960 while (mTileIter && !mTileIter.isValueOn()) ++mTileIter;
2977 template<
typename RootT>
2982 using BaseT::mTileIter;
2989 if (mTileIter.isChild())
return mTileIter.child();
2990 value = mTileIter.value();
3071 template<
typename OpT,
typename... ArgsT>
3074 if (
const Tile* tile = this->probeTile(ijk)) {
3075 if constexpr(OpT::LEVEL < LEVEL)
if (tile->isChild())
return this->getChild(tile)->template get<OpT>(ijk, args...);
3076 return OpT::get(*tile, args...);
3078 return OpT::get(*
this, args...);
3081 template<
typename OpT,
typename... ArgsT>
3084 if (
Tile* tile = DataType::probeTile(ijk)) {
3085 if constexpr(OpT::LEVEL < LEVEL)
if (tile->isChild())
return this->getChild(tile)->template set<OpT>(ijk, args...);
3086 return OpT::set(*tile, args...);
3088 return OpT::set(*
this, args...);
3095 template<
typename,
int,
int,
int>
3101 template<
typename RayT,
typename AccT>
3102 __hostdev__ uint32_t getDimAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const 3104 if (
const Tile* tile = this->probeTile(ijk)) {
3105 if (tile->isChild()) {
3106 const auto* child = this->getChild(tile);
3107 acc.insert(ijk, child);
3108 return child->getDimAndCache(ijk, ray, acc);
3110 return 1 << ChildT::TOTAL;
3112 return ChildNodeType::dim();
3115 template<
typename OpT,
typename AccT,
typename... ArgsT>
3116 __hostdev__ typename OpT::Type getAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
const 3118 if (
const Tile* tile = this->probeTile(ijk)) {
3119 if constexpr(OpT::LEVEL < LEVEL) {
3120 if (tile->isChild()) {
3121 const ChildT* child = this->getChild(tile);
3122 acc.insert(ijk, child);
3123 return child->template getAndCache<OpT>(ijk, acc, args...);
3126 return OpT::get(*tile, args...);
3128 return OpT::get(*
this, args...);
3131 template<
typename OpT,
typename AccT,
typename... ArgsT>
3134 if (
Tile* tile = DataType::probeTile(ijk)) {
3135 if constexpr(OpT::LEVEL < LEVEL) {
3136 if (tile->isChild()) {
3137 ChildT* child = this->getChild(tile);
3138 acc.insert(ijk, child);
3139 return child->template setAndCache<OpT>(ijk, acc, args...);
3142 return OpT::set(*tile, args...);
3144 return OpT::set(*
this, args...);
3156 template<
typename ChildT, u
int32_t LOG2DIM>
3163 using MaskT =
typename ChildT::template MaskType<LOG2DIM>;
3164 static constexpr
bool FIXED_SIZE =
true;
3173 Tile& operator=(
const Tile&) =
delete;
3195 alignas(32) Tile mTable[1u << (3 * LOG2DIM)];
3205 template<
typename ValueT>
3209 mTable[n].value = v;
3216 return util::PtrAdd<ChildT>(
this, mTable[n].child);
3221 return util::PtrAdd<ChildT>(
this, mTable[n].child);
3227 return mTable[n].value;
3233 return mValueMask.isOn(n);
3238 template<
typename T>
3250 #if defined(__GNUC__) && (__GNUC__ < 14) && !defined(__APPLE__) && !defined(__llvm__) 3251 #pragma GCC diagnostic push 3252 #pragma GCC diagnostic ignored "-Wstringop-overflow" 3258 #if defined(__GNUC__) && (__GNUC__ < 14) && !defined(__APPLE__) && !defined(__llvm__) 3259 #pragma GCC diagnostic pop 3270 template<
typename ChildT, u
int32_t Log2Dim = ChildT::LOG2DIM + 1>
3281 static constexpr
bool FIXED_SIZE = DataType::FIXED_SIZE;
3282 template<u
int32_t LOG2>
3287 static constexpr uint32_t LOG2DIM = Log2Dim;
3288 static constexpr uint32_t TOTAL = LOG2DIM + ChildT::TOTAL;
3289 static constexpr uint32_t DIM = 1u << TOTAL;
3290 static constexpr uint32_t SIZE = 1u << (3 * LOG2DIM);
3291 static constexpr uint32_t MASK = (1u << TOTAL) - 1u;
3292 static constexpr uint32_t LEVEL = 1 + ChildT::LEVEL;
3293 static constexpr uint64_t NUM_VALUES = uint64_t(1) << (3 * TOTAL);
3296 template <
typename ParentT>
3311 : BaseT(parent->mChildMask.beginOn())
3319 return *mParent->getChild(BaseT::pos());
3324 return mParent->getChild(BaseT::pos());
3329 return (*this)->origin();
3353 : BaseT(parent->data()->mChildMask.beginOff())
3392 : BaseT(parent->data()->mValueMask.beginOn())
3427 , mParent(parent->data())
3434 const ChildT* child =
nullptr;
3435 if (mParent->
mChildMask.isOn(BaseT::pos())) {
3436 child = mParent->
getChild(BaseT::pos());
3438 value = mParent->
getValue(BaseT::pos());
3445 return mParent->
isActive(BaseT::pos());
3450 return mParent->offsetToGlobalCoord(BaseT::pos());
3507 return DataType::mChildMask.isOn(0) ? this->getChild(0)->getFirstValue() : DataType::getValue(0);
3514 return DataType::mChildMask.isOn(SIZE - 1) ? this->getChild(SIZE - 1)->getLastValue() : DataType::getValue(SIZE - 1);
3526 const uint32_t n = CoordToOffset(ijk);
3527 return DataType::mChildMask.isOn(n) ? this->getChild(n) :
nullptr;
3531 const uint32_t n = CoordToOffset(ijk);
3532 return DataType::mChildMask.isOn(n) ? this->getChild(n) :
nullptr;
3538 return (((ijk[0] & MASK) >> ChildT::TOTAL) << (2 * LOG2DIM)) |
3539 (((ijk[1] & MASK) >> ChildT::TOTAL) << (LOG2DIM)) |
3540 ((ijk[2] & MASK) >> ChildT::TOTAL);
3547 const uint32_t m = n & ((1 << 2 * LOG2DIM) - 1);
3548 return Coord(n >> 2 * LOG2DIM, m >> LOG2DIM, m & ((1 << LOG2DIM) - 1));
3554 ijk <<= ChildT::TOTAL;
3555 ijk += this->origin();
3561 this->localToGlobalCoord(ijk);
3568 template<
typename OpT,
typename... ArgsT>
3571 const uint32_t n = CoordToOffset(ijk);
3572 if constexpr(OpT::LEVEL < LEVEL)
if (this->isChild(n))
return this->getChild(n)->template get<OpT>(ijk, args...);
3573 return OpT::get(*
this, n, args...);
3576 template<
typename OpT,
typename... ArgsT>
3579 const uint32_t n = CoordToOffset(ijk);
3580 if constexpr(OpT::LEVEL < LEVEL)
if (this->isChild(n))
return this->getChild(n)->template set<OpT>(ijk, args...);
3581 return OpT::set(*
this, n, args...);
3587 template<
typename,
int,
int,
int>
3592 template<
typename, u
int32_t>
3595 template<
typename RayT,
typename AccT>
3596 __hostdev__ uint32_t getDimAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const 3598 if (DataType::mFlags & uint32_t(1u))
3602 const uint32_t n = CoordToOffset(ijk);
3603 if (DataType::mChildMask.isOn(n)) {
3604 const ChildT* child = this->getChild(n);
3605 acc.insert(ijk, child);
3606 return child->getDimAndCache(ijk, ray, acc);
3608 return ChildNodeType::dim();
3611 template<
typename OpT,
typename AccT,
typename... ArgsT>
3612 __hostdev__ typename OpT::Type getAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
const 3614 const uint32_t n = CoordToOffset(ijk);
3615 if constexpr(OpT::LEVEL < LEVEL) {
3616 if (this->isChild(n)) {
3617 const ChildT* child = this->getChild(n);
3618 acc.insert(ijk, child);
3619 return child->template getAndCache<OpT>(ijk, acc, args...);
3622 return OpT::get(*
this, n, args...);
3625 template<
typename OpT,
typename AccT,
typename... ArgsT>
3628 const uint32_t n = CoordToOffset(ijk);
3629 if constexpr(OpT::LEVEL < LEVEL) {
3630 if (this->isChild(n)) {
3631 ChildT* child = this->getChild(n);
3632 acc.insert(ijk, child);
3633 return child->template setAndCache<OpT>(ijk, acc, args...);
3636 return OpT::set(*
this, n, args...);
3646 template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3649 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3650 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3655 static constexpr
bool FIXED_SIZE =
true;
3658 uint8_t mBBoxDif[3];
3673 return sizeof(
LeafData) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>) + 2 * (
sizeof(ValueT) +
sizeof(
FloatType)) + (1u << (3 * LOG2DIM)) *
sizeof(ValueT));
3683 mValueMask.setOn(offset);
3684 mValues[offset] = value;
3696 #if defined(__GNUC__) && (__GNUC__ < 12) && !defined(__APPLE__) && !defined(__llvm__) 3697 #pragma GCC diagnostic push 3698 #pragma GCC diagnostic ignored "-Wstringop-overflow" 3704 #if defined(__GNUC__) && (__GNUC__ < 12) && !defined(__APPLE__) && !defined(__llvm__) 3705 #pragma GCC diagnostic pop 3708 template<
typename T>
3713 for (
auto *p = mValues, *q = p + 512; p != q; ++p)
3727 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3730 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3731 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3736 uint8_t mBBoxDif[3];
3753 return sizeof(
LeafFnBase) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>) + 2 * 4 + 4 * 2);
3758 mQuantum = (max -
min) /
float((1 << bitWidth) - 1);
3788 template<
typename T>
3797 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3798 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp4, CoordT, MaskT, LOG2DIM>
3804 static constexpr
bool FIXED_SIZE =
true;
3805 alignas(32) uint8_t mCode[1u << (3 * LOG2DIM - 1)];
3810 static_assert(BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3811 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << (3 * LOG2DIM - 1));
3818 const uint8_t c = mCode[i>>1];
3819 return ( (i&1) ? c >> 4 : c & uint8_t(15) )*BaseT::mQuantum + BaseT::mMinimum;
3821 return ((mCode[i >> 1] >> ((i & 1) << 2)) & uint8_t(15)) * BaseT::mQuantum + BaseT::mMinimum;
3834 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3835 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp8, CoordT, MaskT, LOG2DIM>
3841 static constexpr
bool FIXED_SIZE =
true;
3842 alignas(32) uint8_t mCode[1u << 3 * LOG2DIM];
3846 static_assert(BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3847 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << 3 * LOG2DIM);
3853 return mCode[i] * BaseT::mQuantum + BaseT::mMinimum;
3864 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3865 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp16, CoordT, MaskT, LOG2DIM>
3871 static constexpr
bool FIXED_SIZE =
true;
3872 alignas(32) uint16_t mCode[1u << 3 * LOG2DIM];
3877 static_assert(BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3878 return sizeof(
LeafData) -
sizeof(
BaseT) - 2 * (1u << 3 * LOG2DIM);
3884 return mCode[i] * BaseT::mQuantum + BaseT::mMinimum;
3896 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3897 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
FpN, CoordT, MaskT, LOG2DIM>
3903 static constexpr
bool FIXED_SIZE =
false;
3906 static_assert(BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3915 #ifdef NANOVDB_FPN_BRANCHLESS // faster 3916 const int b = BaseT::mFlags >> 5;
3918 uint16_t code =
reinterpret_cast<const uint16_t*
>(
this + 1)[i >> (4 - b)];
3919 const static uint8_t shift[5] = {15, 7, 3, 1, 0};
3920 const static uint16_t mask[5] = {1, 3, 15, 255, 65535};
3921 code >>= (i & shift[b]) << b;
3924 uint32_t code =
reinterpret_cast<const uint32_t*
>(
this + 1)[i >> (5 - b)];
3925 code >>= (i & ((32 >> b) - 1)) << b;
3926 code &= (1 << (1 << b)) - 1;
3928 #else // use branched version (slow) 3930 auto* values =
reinterpret_cast<const uint8_t*
>(
this + 1);
3931 switch (BaseT::mFlags >> 5) {
3933 code = float((values[i >> 3] >> (i & 7)) & uint8_t(1));
3936 code = float((values[i >> 2] >> ((i & 3) << 1)) & uint8_t(3));
3939 code = float((values[i >> 1] >> ((i & 1) << 2)) & uint8_t(15));
3942 code = float(values[i]);
3945 code = float(reinterpret_cast<const uint16_t*>(values)[i]);
3948 return float(code) * BaseT::mQuantum + BaseT::mMinimum;
3961 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3962 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
bool, CoordT, MaskT, LOG2DIM>
3964 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3965 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3970 static constexpr
bool FIXED_SIZE =
true;
3973 uint8_t mBBoxDif[3];
3977 uint64_t mPadding[2];
3989 mValueMask.setOn(offset);
3990 mValues.set(offset, v);
3998 template<
typename T>
4011 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4014 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4015 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4020 static constexpr
bool FIXED_SIZE =
true;
4023 uint8_t mBBoxDif[3];
4026 uint64_t mPadding[2];
4032 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u);
4047 template<
typename T>
4060 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4063 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4064 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4068 static constexpr
bool FIXED_SIZE =
true;
4071 uint8_t mBBoxDif[3];
4077 return sizeof(
LeafIndexBase) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u);
4088 template<
typename T>
4102 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4122 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4130 return util::countOn(BaseT::mValueMask.words()[7]) + (BaseT::mPrefixSum >> 54u & 511u);
4140 uint32_t n = i >> 6;
4141 const uint64_t w = BaseT::mValueMask.words()[n], mask = uint64_t(1) << (i & 63u);
4142 if (!(w & mask))
return uint64_t(0);
4143 uint64_t sum = BaseT::mOffset +
util::countOn(w & (mask - 1u));
4144 if (n--) sum += BaseT::mPrefixSum >> (9u * n) & 511u;
4151 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4152 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Point, CoordT, MaskT, LOG2DIM>
4154 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4155 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4160 static constexpr
bool FIXED_SIZE =
true;
4163 uint8_t mBBoxDif[3];
4169 alignas(32) uint16_t mValues[1u << 3 * LOG2DIM];
4177 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u + (1u << 3 * LOG2DIM) * 2u);
4183 __hostdev__ uint64_t
first(uint32_t i)
const {
return i ? uint64_t(mValues[i - 1u]) + mOffset : mOffset; }
4189 mValueMask.setOn(offset);
4190 mValues[offset] = value;
4204 template<
typename T>
4217 template<
typename BuildT,
4218 typename CoordT = Coord,
4219 template<u
int32_t>
class MaskT =
Mask,
4220 uint32_t Log2Dim = 3>
4226 static constexpr uint32_t TOTAL = 0;
4227 static constexpr uint32_t DIM = 1;
4236 static constexpr
bool FIXED_SIZE = DataType::FIXED_SIZE;
4237 template<u
int32_t LOG2>
4255 : BaseT(parent->data()->mValueMask.beginOn())
4263 return mParent->
getValue(BaseT::pos());
4288 : BaseT(parent->data()->mValueMask.beginOff())
4296 return mParent->
getValue(BaseT::pos());
4317 , mPos(1u << 3 * Log2Dim)
4360 static constexpr uint32_t LOG2DIM = Log2Dim;
4361 static constexpr uint32_t TOTAL = LOG2DIM;
4362 static constexpr uint32_t DIM = 1u << TOTAL;
4363 static constexpr uint32_t SIZE = 1u << 3 * LOG2DIM;
4364 static constexpr uint32_t MASK = (1u << LOG2DIM) - 1u;
4365 static constexpr uint32_t LEVEL = 0;
4366 static constexpr uint64_t NUM_VALUES = uint64_t(1) << (3 * TOTAL);
4402 const uint32_t m = n & ((1 << 2 * LOG2DIM) - 1);
4403 return CoordT(n >> 2 * LOG2DIM, m >> LOG2DIM, m & MASK);
4411 return OffsetToLocalCoord(n) + this->origin();
4420 math::BBox<CoordT> bbox(DataType::mBBoxMin, DataType::mBBoxMin);
4421 if (this->hasBBox()) {
4422 bbox.max()[0] += DataType::mBBoxDif[0];
4423 bbox.max()[1] += DataType::mBBoxDif[1];
4424 bbox.max()[2] += DataType::mBBoxDif[2];
4426 bbox = math::BBox<CoordT>();
4476 return !DataType::mValueMask.isOff();
4484 const uint32_t n = CoordToOffset(ijk);
4485 v = DataType::getValue(n);
4486 return DataType::mValueMask.isOn(n);
4494 return ((ijk[0] & MASK) << (2 * LOG2DIM)) | ((ijk[1] & MASK) << LOG2DIM) | (ijk[2] & MASK);
4506 template<
typename OpT,
typename... ArgsT>
4509 return OpT::get(*
this, CoordToOffset(ijk), args...);
4512 template<
typename OpT,
typename... ArgsT>
4515 return OpT::get(*
this, n, args...);
4518 template<
typename OpT,
typename... ArgsT>
4521 return OpT::set(*
this, CoordToOffset(ijk), args...);
4524 template<
typename OpT,
typename... ArgsT>
4527 return OpT::set(*
this, n, args...);
4533 template<
typename,
int,
int,
int>
4538 template<
typename, u
int32_t>
4541 template<
typename RayT,
typename AccT>
4542 __hostdev__ uint32_t getDimAndCache(
const CoordT&,
const RayT& ,
const AccT&)
const 4544 if (DataType::mFlags & uint8_t(1u))
4548 return ChildNodeType::dim();
4551 template<
typename OpT,
typename AccT,
typename... ArgsT>
4554 getAndCache(
const CoordType& ijk,
const AccT&, ArgsT&&... args)
const 4556 return OpT::get(*
this, CoordToOffset(ijk), args...);
4559 template<
typename OpT,
typename AccT,
typename... ArgsT>
4561 __hostdev__ decltype(OpT::set(util::declval<LeafNode&>(), util::declval<uint32_t>(), util::declval<ArgsT>()...))
4562 setAndCache(const
CoordType& ijk, const AccT&, ArgsT&&... args)
4564 return OpT::set(*
this, CoordToOffset(ijk), args...);
4571 template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4574 static_assert(LOG2DIM == 3,
"LeafNode::updateBBox: only supports LOGDIM = 3!");
4575 if (DataType::mValueMask.isOff()) {
4576 DataType::mFlags &= ~uint8_t(2);
4579 auto update = [&](uint32_t
min, uint32_t
max,
int axis) {
4581 DataType::mBBoxMin[axis] = (DataType::mBBoxMin[axis] & ~MASK) +
int(min);
4582 DataType::mBBoxDif[axis] = uint8_t(max - min);
4584 uint64_t *w = DataType::mValueMask.words(), word64 = *w;
4585 uint32_t Xmin = word64 ? 0u : 8u, Xmax = Xmin;
4586 for (
int i = 1; i < 8; ++i) {
4595 update(Xmin, Xmax, 0);
4597 const uint32_t *p =
reinterpret_cast<const uint32_t*
>(&word64), word32 = p[0] | p[1];
4598 const uint16_t *q =
reinterpret_cast<const uint16_t*
>(&word32), word16 = q[0] | q[1];
4599 const uint8_t *b =
reinterpret_cast<const uint8_t*
>(&word16), byte = b[0] | b[1];
4602 DataType::mFlags |= uint8_t(2);
4610 template<
typename BuildT>
4612 template<
typename BuildT>
4614 template<
typename BuildT>
4616 template<
typename BuildT>
4618 template<
typename BuildT>
4620 template<
typename BuildT>
4624 template<
typename BuildT,
int LEVEL>
4628 template<
typename BuildT>
4634 template<
typename BuildT>
4640 template<
typename BuildT>
4646 template<
typename BuildT>
4653 template<
typename BuildT,
int LEVEL>
4724 template<
typename OpT,
typename GridDataT,
typename... ArgsT>
4728 switch (gridData->mGridType){
4730 return OpT::template known<float>(gridData, args...);
4732 return OpT::template known<double>(gridData, args...);
4734 return OpT::template known<int16_t>(gridData, args...);
4736 return OpT::template known<int32_t>(gridData, args...);
4738 return OpT::template known<int64_t>(gridData, args...);
4740 return OpT::template known<Vec3f>(gridData, args...);
4742 return OpT::template known<Vec3d>(gridData, args...);
4744 return OpT::template known<uint32_t>(gridData, args...);
4746 return OpT::template known<ValueMask>(gridData, args...);
4748 return OpT::template known<ValueIndex>(gridData, args...);
4750 return OpT::template known<ValueOnIndex>(gridData, args...);
4752 return OpT::template known<bool>(gridData, args...);
4754 return OpT::template known<math::Rgba8>(gridData, args...);
4756 return OpT::template known<Fp4>(gridData, args...);
4758 return OpT::template known<Fp8>(gridData, args...);
4760 return OpT::template known<Fp16>(gridData, args...);
4762 return OpT::template known<FpN>(gridData, args...);
4764 return OpT::template known<Vec4f>(gridData, args...);
4766 return OpT::template known<Vec4d>(gridData, args...);
4768 return OpT::template known<uint8_t>(gridData, args...);
4770 return OpT::unknown(gridData, args...);
4795 template<
typename BuildT>
4805 mutable const RootT* mRoot;
4811 static const int CacheLevels = 0;
4821 : ReadAccessor(grid.tree().root())
4827 : ReadAccessor(tree.root())
4843 return this->
template get<GetValue<BuildT>>(ijk);
4852 template<
typename RayT>
4855 return mRoot->getDimAndCache(ijk, ray, *
this);
4857 template<
typename OpT,
typename... ArgsT>
4860 return mRoot->template get<OpT>(ijk, args...);
4863 template<
typename OpT,
typename... ArgsT>
4866 return const_cast<RootT*
>(mRoot)->
template set<OpT>(ijk, args...);
4873 template<
typename, u
int32_t>
4875 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
4879 template<
typename NodeT>
4884 template<
typename BuildT,
int LEVEL0>
4887 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 should be 0, 1, or 2");
4901 mutable CoordT mKey;
4902 mutable const RootT* mRoot;
4903 mutable const NodeT* mNode;
4910 static const int CacheLevels = 1;
4922 : ReadAccessor(grid.tree().root())
4928 : ReadAccessor(tree.root())
4948 return (ijk[0] & int32_t(~NodeT::MASK)) == mKey[0] &&
4949 (ijk[1] & int32_t(~NodeT::MASK)) == mKey[1] &&
4950 (ijk[2] & int32_t(~NodeT::MASK)) == mKey[2];
4955 return this->
template get<GetValue<BuildT>>(ijk);
4965 template<
typename RayT>
4968 if (this->isCached(ijk))
return mNode->getDimAndCache(ijk, ray, *
this);
4969 return mRoot->getDimAndCache(ijk, ray, *
this);
4972 template<
typename OpT,
typename... ArgsT>
4975 if constexpr(OpT::LEVEL <= LEVEL0)
if (this->isCached(ijk))
return mNode->template getAndCache<OpT>(ijk, *
this, args...);
4976 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
4979 template<
typename OpT,
typename... ArgsT>
4982 if constexpr(OpT::LEVEL <= LEVEL0)
if (this->isCached(ijk))
return const_cast<NodeT*
>(mNode)->
template setAndCache<OpT>(ijk, *
this, args...);
4983 return const_cast<RootT*
>(mRoot)->
template setAndCache<OpT>(ijk, *
this, args...);
4990 template<
typename, u
int32_t>
4992 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
4998 mKey = ijk & ~NodeT::MASK;
5003 template<
typename OtherNodeT>
5008 template<
typename BuildT,
int LEVEL0,
int LEVEL1>
5011 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 must be 0, 1, 2");
5012 static_assert(LEVEL1 >= 0 && LEVEL1 <= 2,
"LEVEL1 must be 0, 1, 2");
5013 static_assert(LEVEL0 < LEVEL1,
"Level 0 must be lower than level 1");
5026 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY // 44 bytes total 5027 mutable CoordT mKey;
5028 #else // 68 bytes total 5029 mutable CoordT mKeys[2];
5031 mutable const RootT* mRoot;
5032 mutable const Node1T* mNode1;
5033 mutable const Node2T* mNode2;
5040 static const int CacheLevels = 2;
5044 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5057 : ReadAccessor(grid.tree().root())
5063 : ReadAccessor(tree.root())
5070 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5086 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5087 __hostdev__ bool isCached1(CoordValueType dirty)
const 5091 if (dirty & int32_t(~Node1T::MASK)) {
5097 __hostdev__ bool isCached2(CoordValueType dirty)
const 5101 if (dirty & int32_t(~Node2T::MASK)) {
5109 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
5114 return (ijk[0] & int32_t(~Node1T::MASK)) == mKeys[0][0] &&
5115 (ijk[1] & int32_t(~Node1T::MASK)) == mKeys[0][1] &&
5116 (ijk[2] & int32_t(~Node1T::MASK)) == mKeys[0][2];
5120 return (ijk[0] & int32_t(~Node2T::MASK)) == mKeys[1][0] &&
5121 (ijk[1] & int32_t(~Node2T::MASK)) == mKeys[1][1] &&
5122 (ijk[2] & int32_t(~Node2T::MASK)) == mKeys[1][2];
5128 return this->
template get<GetValue<BuildT>>(ijk);
5138 template<
typename RayT>
5141 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5142 const CoordValueType dirty = this->computeDirty(ijk);
5146 if (this->isCached1(dirty)) {
5147 return mNode1->getDimAndCache(ijk, ray, *
this);
5148 }
else if (this->isCached2(dirty)) {
5149 return mNode2->getDimAndCache(ijk, ray, *
this);
5151 return mRoot->getDimAndCache(ijk, ray, *
this);
5154 template<
typename OpT,
typename... ArgsT>
5157 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5158 const CoordValueType dirty = this->computeDirty(ijk);
5162 if constexpr(OpT::LEVEL <= LEVEL0) {
5163 if (this->isCached1(dirty))
return mNode1->template getAndCache<OpT>(ijk, *
this, args...);
5164 }
else if constexpr(OpT::LEVEL <= LEVEL1) {
5165 if (this->isCached2(dirty))
return mNode2->template getAndCache<OpT>(ijk, *
this, args...);
5167 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5170 template<
typename OpT,
typename... ArgsT>
5173 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5174 const CoordValueType dirty = this->computeDirty(ijk);
5178 if constexpr(OpT::LEVEL <= LEVEL0) {
5179 if (this->isCached1(dirty))
return const_cast<Node1T*
>(mNode1)->
template setAndCache<OpT>(ijk, *
this, args...);
5180 }
else if constexpr(OpT::LEVEL <= LEVEL1) {
5181 if (this->isCached2(dirty))
return const_cast<Node2T*
>(mNode2)->
template setAndCache<OpT>(ijk, *
this, args...);
5183 return const_cast<RootT*
>(mRoot)->
template setAndCache<OpT>(ijk, *
this, args...);
5190 template<
typename, u
int32_t>
5192 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5198 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5201 mKeys[0] = ijk & ~Node1T::MASK;
5207 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5210 mKeys[1] = ijk & ~Node2T::MASK;
5214 template<
typename OtherNodeT>
5219 template<
typename BuildT>
5235 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY // 44 bytes total 5236 mutable CoordT mKey;
5237 #else // 68 bytes total 5238 mutable CoordT mKeys[3];
5240 mutable const RootT* mRoot;
5241 mutable const void* mNode[3];
5248 static const int CacheLevels = 3;
5252 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5258 , mNode{
nullptr,
nullptr,
nullptr}
5264 : ReadAccessor(grid.tree().root())
5270 : ReadAccessor(tree.root())
5284 template<
typename NodeT>
5289 return reinterpret_cast<const T*
>(mNode[NodeT::LEVEL]);
5296 static_assert(LEVEL >= 0 && LEVEL <= 2,
"ReadAccessor::getNode: Invalid node type");
5297 return reinterpret_cast<const T*
>(mNode[LEVEL]);
5303 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5308 mNode[0] = mNode[1] = mNode[2] =
nullptr;
5311 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5312 template<
typename NodeT>
5313 __hostdev__ bool isCached(CoordValueType dirty)
const 5315 if (!mNode[NodeT::LEVEL])
5317 if (dirty & int32_t(~NodeT::MASK)) {
5318 mNode[NodeT::LEVEL] =
nullptr;
5326 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
5329 template<
typename NodeT>
5332 return (ijk[0] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][0] &&
5333 (ijk[1] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][1] &&
5334 (ijk[2] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][2];
5347 template<
typename OpT,
typename... ArgsT>
5350 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5351 const CoordValueType dirty = this->computeDirty(ijk);
5355 if constexpr(OpT::LEVEL <=0) {
5356 if (this->isCached<LeafT>(dirty))
return ((
const LeafT*)mNode[0])->template getAndCache<OpT>(ijk, *
this, args...);
5357 }
else if constexpr(OpT::LEVEL <= 1) {
5358 if (this->isCached<NodeT1>(dirty))
return ((
const NodeT1*)mNode[1])->template getAndCache<OpT>(ijk, *
this, args...);
5359 }
else if constexpr(OpT::LEVEL <= 2) {
5360 if (this->isCached<NodeT2>(dirty))
return ((
const NodeT2*)mNode[2])->template getAndCache<OpT>(ijk, *
this, args...);
5362 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5365 template<
typename OpT,
typename... ArgsT>
5368 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5369 const CoordValueType dirty = this->computeDirty(ijk);
5373 if constexpr(OpT::LEVEL <= 0) {
5374 if (this->isCached<LeafT>(dirty))
return ((
LeafT*)mNode[0])->template setAndCache<OpT>(ijk, *
this, args...);
5375 }
else if constexpr(OpT::LEVEL <= 1) {
5376 if (this->isCached<NodeT1>(dirty))
return ((
NodeT1*)mNode[1])->template setAndCache<OpT>(ijk, *
this, args...);
5377 }
else if constexpr(OpT::LEVEL <= 2) {
5378 if (this->isCached<NodeT2>(dirty))
return ((
NodeT2*)mNode[2])->template setAndCache<OpT>(ijk, *
this, args...);
5380 return ((
RootT*)mRoot)->template setAndCache<OpT>(ijk, *
this, args...);
5383 template<
typename RayT>
5386 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5387 const CoordValueType dirty = this->computeDirty(ijk);
5391 if (this->isCached<LeafT>(dirty)) {
5392 return ((
LeafT*)mNode[0])->getDimAndCache(ijk, ray, *
this);
5393 }
else if (this->isCached<NodeT1>(dirty)) {
5394 return ((
NodeT1*)mNode[1])->getDimAndCache(ijk, ray, *
this);
5395 }
else if (this->isCached<NodeT2>(dirty)) {
5396 return ((
NodeT2*)mNode[2])->getDimAndCache(ijk, ray, *
this);
5398 return mRoot->getDimAndCache(ijk, ray, *
this);
5405 template<
typename, u
int32_t>
5407 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5411 template<
typename NodeT>
5414 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5417 mKeys[NodeT::LEVEL] = ijk & ~NodeT::MASK;
5419 mNode[NodeT::LEVEL] = node;
5437 template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5443 template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5449 template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5465 CoordBBox mIndexBBox;
5466 uint32_t mRootTableSize, mPadding{0};
5469 template<
typename T>
5472 mGridData = *grid.
data();
5473 mTreeData = *grid.
tree().data();
5475 mRootTableSize = grid.
tree().root().getTableSize();
5480 *
this = *
reinterpret_cast<const GridMetaData*
>(gridData);
5483 mGridData = *gridData;
5503 template<
typename T>
5543 template<
typename AttT,
typename BuildT = u
int32_t>
5552 : AccT(grid.tree().root())
5554 , mData(grid.template getBlindData<AttT>(0))
5572 end = begin + count;
5580 auto* leaf = this->probeLeaf(ijk);
5581 if (leaf ==
nullptr) {
5584 begin = mData + leaf->minimum();
5585 end = begin + leaf->maximum();
5586 return leaf->maximum();
5592 begin = end =
nullptr;
5593 if (
auto* leaf = this->probeLeaf(ijk)) {
5595 if (leaf->isActive(offset)) {
5596 begin = mData + leaf->minimum();
5597 end = begin + leaf->getValue(offset);
5599 begin += leaf->getValue(offset - 1);
5606 template<
typename AttT>
5615 : AccT(grid.tree().root())
5617 , mData(grid.template getBlindData<AttT>(0))
5639 end = begin + count;
5647 auto* leaf = this->probeLeaf(ijk);
5648 if (leaf ==
nullptr)
5650 begin = mData + leaf->offset();
5651 end = begin + leaf->pointCount();
5652 return leaf->pointCount();
5658 if (
auto* leaf = this->probeLeaf(ijk)) {
5660 if (leaf->isActive(n)) {
5661 begin = mData + leaf->first(n);
5662 end = mData + leaf->last(n);
5666 begin = end =
nullptr;
5674 template<
typename ChannelT,
typename IndexT = ValueIndex>
5691 :
BaseT(grid.tree().root())
5697 this->setChannel(channelID);
5702 :
BaseT(grid.tree().root())
5704 , mChannel(channelPtr)
5735 return mChannel =
const_cast<ChannelT*
>(mGrid.template getBlindData<ChannelT>(channelID));
5740 __hostdev__ uint64_t
idx(
int i,
int j,
int k)
const {
return BaseT::getValue(math::Coord(i, j, k)); }
5751 const bool isActive = BaseT::probeValue(ijk, idx);
5758 template<
typename T>
5759 __hostdev__ T&
getValue(
const math::Coord& ijk, T* channelPtr)
const {
return channelPtr[BaseT::getValue(ijk)]; }
5767 struct MiniGridHandle {
5772 BufferType(BufferType &&other) : data(other.data), size(other.size) {other.data=
nullptr; other.size=0;}
5773 ~BufferType() {std::free(data);}
5774 BufferType& operator=(
const BufferType &other) =
delete;
5775 BufferType& operator=(BufferType &&other){data=other.data; size=other.size; other.data=
nullptr; other.size=0;
return *
this;}
5776 static BufferType create(
size_t n, BufferType* dummy =
nullptr) {
return BufferType(n);}
5778 MiniGridHandle(BufferType &&buf) : buffer(std::move(buf)) {}
5779 const uint8_t* data()
const {
return buffer.data;}
5811 if (
util::streq(str,
"blosc"))
return Codec::BLOSC;
5853 uint32_t nodeCount[4];
5854 uint32_t tileCount[3];
5861 #if !defined(__CUDA_ARCH__) && !defined(__HIP__) 5884 template<
typename StreamT>
5890 #ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS 5895 const char* gridName = gridData->
gridName();
5905 os.write((
const char*)&head,
sizeof(
FileHeader));
5907 os.write(gridName, nameSize);
5914 os.write((
const char*)&data,
sizeof(
GridData));
5917 os.write((
const char*)gridData, gridData->
mGridSize);
5929 template<
typename StreamT,
typename ValueT>
5939 fprintf(stderr,
"nanovdb::writeUncompressedGrid: expected an IndexGrid but got \"%s\"\n",
toStr(str, gridData->
mGridClass));
5942 fprintf(stderr,
"nanovdb::writeUncompressedGrid: index grid already has \"%i\" blind data\n", gridData->
mBlindMetadataCount);
5947 #ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS 5952 const char* gridName = gridData->
gridName();
5961 os.write((
const char*)&head,
sizeof(
FileHeader));
5963 os.write(gridName, nameSize);
5972 os.write((
const char*)&data,
sizeof(
GridData));
5978 os.write((
const char*)blindData, gridData->
mData1*
sizeof(ValueT));
5983 template<
typename GridHandleT,
template<
typename...>
class VecT>
5986 #ifdef NANOVDB_USE_IOSTREAMS // use this to switch between std::ofstream or FILE implementations 5987 std::ofstream os(fileName, std::ios::out | std::ios::binary | std::ios::trunc);
5991 StreamT(
const char* name) { fptr = fopen(name,
"wb"); }
5992 ~StreamT() { fclose(fptr); }
5993 void write(
const char* data,
size_t n) { fwrite(data, 1, n, fptr); }
5994 bool is_open()
const {
return fptr != NULL; }
5997 if (!os.is_open()) {
5998 fprintf(stderr,
"nanovdb::writeUncompressedGrids: Unable to open file \"%s\"for output\n", fileName);
6001 for (
auto& h : handles) {
6011 template<
typename GridHandleT,
typename StreamT,
template<
typename...>
class VecT>
6012 VecT<GridHandleT>
readUncompressedGrids(StreamT& is,
const typename GridHandleT::BufferType& pool =
typename GridHandleT::BufferType())
6014 VecT<GridHandleT> handles;
6016 is.read((
char*)&data,
sizeof(
GridData));
6018 uint64_t size = data.
mGridSize, sum = 0u;
6021 is.read((
char*)&data,
sizeof(
GridData));
6024 is.skip(-int64_t(sum +
sizeof(
GridData)));
6025 auto buffer = GridHandleT::BufferType::create(size + sum, &pool);
6026 is.read((
char*)(buffer.data()), buffer.size());
6027 handles.emplace_back(std::move(buffer));
6031 while(is.read((
char*)&head,
sizeof(
FileHeader))) {
6033 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid magic number = \"%s\"\n", (
const char*)&(head.
magic));
6037 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid major version = \"%s\"\n",
toStr(str, head.
version));
6041 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid codec = \"%s\"\n",
toStr(str, head.
codec));
6045 for (uint16_t i = 0; i < head.
gridCount; ++i) {
6048 auto buffer = GridHandleT::BufferType::create(meta.
gridSize, &pool);
6049 is.read((
char*)buffer.data(), meta.
gridSize);
6050 handles.emplace_back(std::move(buffer));
6058 template<
typename GridHandleT,
template<
typename...>
class VecT>
6059 VecT<GridHandleT>
readUncompressedGrids(
const char* fileName,
const typename GridHandleT::BufferType& buffer =
typename GridHandleT::BufferType())
6061 #ifdef NANOVDB_USE_IOSTREAMS // use this to switch between std::ifstream or FILE implementations 6062 struct StreamT :
public std::ifstream {
6063 StreamT(
const char* name) : std::ifstream(name, std::ios::in | std::ios::binary){}
6064 void skip(int64_t off) { this->seekg(off, std::ios_base::cur); }
6069 StreamT(
const char* name) { fptr = fopen(name,
"rb"); }
6070 ~StreamT() { fclose(fptr); }
6071 bool read(
char* data,
size_t n) {
6072 size_t m = fread(data, 1, n, fptr);
6075 void skip(int64_t off) { fseek(fptr, (
long int)off, SEEK_CUR); }
6076 bool is_open()
const {
return fptr != NULL; }
6079 StreamT is(fileName);
6080 if (!is.is_open()) {
6081 fprintf(stderr,
"nanovdb::readUncompressedGrids: Unable to open file \"%s\"for input\n", fileName);
6084 return readUncompressedGrids<GridHandleT, StreamT, VecT>(is, buffer);
6087 #endif // if !defined(__CUDA_ARCH__) && !defined(__HIP__) 6127 template<
typename BuildT>
6131 static constexpr
int LEVEL = 0;
6139 template<
typename BuildT>
6144 static constexpr
int LEVEL = 0;
6152 template<
typename BuildT>
6157 static constexpr
int LEVEL = 0;
6167 template<
typename BuildT>
6171 static constexpr
int LEVEL = 0;
6181 template<
typename BuildT>
6185 static constexpr
int LEVEL = 0;
6195 template<
typename BuildT>
6199 static constexpr
int LEVEL = 0;
6209 template<
typename BuildT>
6213 static constexpr
int LEVEL = 1;
6222 template<
typename BuildT>
6226 static constexpr
int LEVEL = 2;
6234 template<
typename BuildT>
6238 static constexpr
int LEVEL = 3;
6245 template<
typename BuildT>
6249 static constexpr
int LEVEL = 0;
6253 v = root.mBackground;
6259 return tile.state > 0u;
6263 v = node.mTable[n].value;
6264 return node.mValueMask.isOn(n);
6268 v = node.mTable[n].value;
6269 return node.mValueMask.isOn(n);
6273 v = leaf.getValue(n);
6274 return leaf.mValueMask.isOn(n);
6280 template<
typename BuildT>
6292 static constexpr
int LEVEL = 0;
6304 return NodeInfo{2u, node.
dim(), node.minimum(), node.maximum(), node.average(), node.stdDeviation(), node.bbox()};
6308 return NodeInfo{1u, node.
dim(), node.minimum(), node.maximum(), node.average(), node.stdDeviation(), node.bbox()};
6312 return NodeInfo{0u, leaf.
dim(), leaf.minimum(), leaf.maximum(), leaf.average(), leaf.stdDeviation(), leaf.bbox()};
6318 #endif // end of NANOVDB_NANOVDB_H_HAS_BEEN_INCLUDED typename FloatTraits< BuildT >::FloatType FloatType
Definition: NanoVDB.h:3653
__hostdev__ ValueType getMin() const
Definition: NanoVDB.h:3688
__hostdev__ ValueOffIterator beginValueOff() const
Definition: NanoVDB.h:4305
__hostdev__ DenseIter()
Definition: NanoVDB.h:2985
__hostdev__ const GridType & gridType() const
Definition: NanoVDB.h:2255
__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:5748
__hostdev__ ValueT value() const
Definition: NanoVDB.h:2748
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:3808
typename BuildT::RootType RootType
Definition: NanoVDB.h:2130
__hostdev__ const Vec3d & voxelSize() const
Return a const reference to the size of a voxel in world units.
Definition: NanoVDB.h:2190
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition: NanoVDB.h:5338
__hostdev__ uint32_t operator*() const
Definition: NanoVDB.h:1094
ValueT ValueType
Definition: NanoVDB.h:4907
__hostdev__ uint64_t full() const
Definition: NanoVDB.h:1854
__hostdev__ const char * shortGridName() const
Return a c-string with the name of this grid, truncated to 255 characters.
Definition: NanoVDB.h:2289
__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:1191
__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:3040
bool type
Definition: NanoVDB.h:528
Visits all tile values in this node, i.e. both inactive and active tiles.
Definition: NanoVDB.h:3341
__hostdev__ math::BBox< CoordT > bbox() const
Return the bounding box in index space of active values in this leaf node.
Definition: NanoVDB.h:4418
__hostdev__ CoordT getCoord() const
Definition: NanoVDB.h:4332
uint16_t ArrayType
Definition: NanoVDB.h:4159
__hostdev__ CheckMode toCheckMode(const Checksum &checksum)
Maps 64 bit checksum to CheckMode enum.
Definition: NanoVDB.h:1893
C++11 implementation of std::enable_if.
Definition: Util.h:341
FloatType mStdDevi
Definition: NanoVDB.h:3665
float type
Definition: NanoVDB.h:535
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:3904
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition: NanoVDB.h:5344
__hostdev__ CoordT offsetToGlobalCoord(uint32_t n) const
Definition: NanoVDB.h:4409
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:4028
__hostdev__ bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:4849
__hostdev__ const MaskType< LOG2DIM > & getValueMask() const
Definition: NanoVDB.h:4374
typename util::match_const< DataType, RootT >::type DataT
Definition: NanoVDB.h:2860
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:5984
typename RootType::LeafNodeType LeafNodeType
Definition: NanoVDB.h:2437
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition: NanoVDB.h:3065
__hostdev__ Vec3d getVoxelSize() const
Return a voxels size in each coordinate direction, measured at the origin.
Definition: NanoVDB.h:1530
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition: NanoVDB.h:4820
StatsT mStdDevi
Definition: NanoVDB.h:3185
__hostdev__ bool hasStdDeviation() const
Definition: NanoVDB.h:2269
__hostdev__ Vec3T applyMap(const Vec3T &xyz) const
Definition: NanoVDB.h:2005
NANOVDB_HOSTDEV_DISABLE_WARNING __hostdev__ uint32_t findFirst() const
Definition: NanoVDB.h:1352
__hostdev__ TileT * tile() const
Definition: NanoVDB.h:2869
__hostdev__ bool isOff(uint32_t n) const
Return true if the given bit is NOT set.
Definition: NanoVDB.h:1220
DataType::template TileIter< DataT > mTileIter
Definition: NanoVDB.h:2862
__hostdev__ Vec3T applyMapF(const Vec3T &xyz) const
Definition: NanoVDB.h:2016
__hostdev__ const char * gridName() const
Definition: NanoVDB.h:2073
__hostdev__ ChannelT * setChannel(ChannelT *channelPtr)
Change to an external channel.
Definition: NanoVDB.h:5727
typename util::match_const< Tile, RootT >::type TileT
Definition: NanoVDB.h:2861
__hostdev__ ChildT * getChild(uint32_t n)
Returns a pointer to the child node at the specifed linear offset.
Definition: NanoVDB.h:3213
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition: NanoVDB.h:5340
__hostdev__ Vec3T applyIJTF(const Vec3T &xyz) const
Definition: NanoVDB.h:1527
VDB Tree, which is a thin wrapper around a RootNode.
Definition: NanoVDB.h:2424
__hostdev__ Vec3T applyMapF(const Vec3T &ijk) const
Apply the forward affine transformation to a vector using 32bit floating point arithmetics.
Definition: NanoVDB.h:1458
decltype(mFlags) Type
Definition: NanoVDB.h:945
__hostdev__ Vec3T indexToWorld(const Vec3T &xyz) const
index to world space transformation
Definition: NanoVDB.h:2201
math::BBox< CoordType > BBoxType
Definition: NanoVDB.h:2849
__hostdev__ Tile * tile(uint32_t n)
Definition: NanoVDB.h:2681
__hostdev__ DenseIter operator++(int)
Definition: NanoVDB.h:2999
__hostdev__ bool isActive() const
Definition: NanoVDB.h:2923
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition: NanoVDB.h:5341
__hostdev__ GridClass mapToGridClass(GridClass defaultClass=GridClass::Unknown)
Definition: NanoVDB.h:908
__hostdev__ bool isChild() const
Definition: NanoVDB.h:2663
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition: NanoVDB.h:2469
__hostdev__ ValueIterator()
Definition: NanoVDB.h:4315
float Type
Definition: NanoVDB.h:555
float FloatType
Definition: NanoVDB.h:3733
__hostdev__ CoordT origin() const
Return the origin in index space of this leaf node.
Definition: NanoVDB.h:4394
Highest level of the data structure. Contains a tree and a world->index transform (that currently onl...
Definition: NanoVDB.h:2126
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition: NanoVDB.h:4826
__hostdev__ ValueOnIter(RootT *parent)
Definition: NanoVDB.h:2952
Vec3dBBox mWorldBBox
Definition: NanoVDB.h:1933
__hostdev__ CoordType getOrigin() const
Definition: NanoVDB.h:3326
__hostdev__ const NodeTrait< RootT, 1 >::type * getFirstLower() const
Definition: NanoVDB.h:2563
__hostdev__ Vec3T applyIJTF(const Vec3T &xyz) const
Definition: NanoVDB.h:2024
FloatType stdDevi
Definition: NanoVDB.h:6289
__hostdev__ char * toStr(char *dst, GridType gridType)
Maps a GridType to a c-string.
Definition: NanoVDB.h:248
__hostdev__ ValueType maximum() const
Return a const reference to the maximum active value encoded in this leaf node.
Definition: NanoVDB.h:4380
__hostdev__ DenseIterator(const InternalNode *parent)
Definition: NanoVDB.h:3425
__hostdev__ const DataType * data() const
Definition: NanoVDB.h:3024
__hostdev__ const MaskType< LOG2DIM > & valueMask() const
Return a const reference to the bit mask of active voxels in this internal node.
Definition: NanoVDB.h:3475
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:5136
#define NANOVDB_PATCH_VERSION_NUMBER
Definition: NanoVDB.h:148
__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:1945
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition: NanoVDB.h:4958
static __hostdev__ constexpr uint64_t memUsage()
Definition: NanoVDB.h:3807
__hostdev__ bool getValue(uint32_t i) const
Definition: NanoVDB.h:4035
__hostdev__ bool isValue() const
Definition: NanoVDB.h:2733
__hostdev__ void setValueOnly(uint32_t offset, const ValueType &v)
Sets the value at the specified location but leaves its state unchanged.
Definition: NanoVDB.h:4464
__hostdev__ Vec3T applyInverseMap(const Vec3T &xyz) const
Apply the inverse affine mapping to a vector using 64bit floating point arithmetics.
Definition: NanoVDB.h:1484
__hostdev__ ValueOnIter()
Definition: NanoVDB.h:2951
Class to access values in channels at a specific voxel location.
Definition: NanoVDB.h:5675
__hostdev__ void setOn(uint32_t offset)
Definition: NanoVDB.h:3686
Definition: NanoVDB.h:2688
static __hostdev__ uint32_t padding()
Definition: NanoVDB.h:4434
typename GridT::TreeType Type
Definition: NanoVDB.h:2407
__hostdev__ NodeT * operator->() const
Definition: NanoVDB.h:2889
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition: NanoVDB.h:5339
char mGridName[MaxNameSize]
Definition: NanoVDB.h:1931
__hostdev__ bool operator>(const Version &rhs) const
Definition: NanoVDB.h:733
static __hostdev__ size_t memUsage(uint32_t bitWidth)
Definition: NanoVDB.h:3912
__hostdev__ void setChild(const CoordType &k, const void *ptr, const RootData *data)
Definition: NanoVDB.h:2649
__hostdev__ Version version() const
Definition: NanoVDB.h:2148
PointAccessor(const NanoGrid< Point > &grid)
Definition: NanoVDB.h:5614
__hostdev__ const ValueT & getMax() const
Definition: NanoVDB.h:2814
__hostdev__ ValueType getValue(uint32_t i) const
Definition: NanoVDB.h:3679
__hostdev__ Map(double s, const Vec3d &t=Vec3d(0.0, 0.0, 0.0))
Definition: NanoVDB.h:1418
__hostdev__ ChildNodeType * probeChild(const CoordType &ijk)
Definition: NanoVDB.h:3524
typename ChildT::CoordType CoordType
Definition: NanoVDB.h:3280
__hostdev__ void setLongGridNameOn(bool on=true)
Definition: NanoVDB.h:1994
__hostdev__ Mask(const Mask &other)
Copy constructor.
Definition: NanoVDB.h:1164
static __hostdev__ uint32_t CoordToOffset(const CoordT &ijk)
Return the linear offset corresponding to the given coordinate.
Definition: NanoVDB.h:4492
__hostdev__ uint64_t lastOffset() const
Definition: NanoVDB.h:4132
__hostdev__ const BlindDataT * getBlindData(uint32_t n) const
Definition: NanoVDB.h:2319
#define NANOVDB_MAGIC_NUMB
Definition: NanoVDB.h:139
__hostdev__ void setWord(WordT w, uint32_t n)
Definition: NanoVDB.h:1182
GridClass
Classes (superset of OpenVDB) that are currently supported by NanoVDB.
Definition: NanoVDB.h:283
typename DataType::ValueT ValueType
Definition: NanoVDB.h:2844
__hostdev__ bool isPartial() const
return true if the 64 bit checksum is partial, i.e. of head only
Definition: NanoVDB.h:1863
static T scalar(const T &s)
Definition: NanoVDB.h:768
Type Pow2(Type x)
Return x2.
Definition: Math.h:573
typename RootT::BuildType BuildType
Definition: NanoVDB.h:2439
__hostdev__ void setDev(const FloatType &)
Definition: NanoVDB.h:4045
Definition: NanoVDB.h:2911
__hostdev__ void * treePtr()
Definition: NanoVDB.h:2027
uint32_t state
Definition: NanoVDB.h:2669
BuildT BuildType
Definition: NanoVDB.h:3652
CoordT mBBoxMin
Definition: NanoVDB.h:4022
__hostdev__ void setDev(const FloatType &v)
Definition: NanoVDB.h:3703
__hostdev__ ConstTileIterator cbeginTile() const
Definition: NanoVDB.h:2759
typename UpperNodeType::ChildNodeType LowerNodeType
Definition: NanoVDB.h:2436
Return the pointer to the leaf node that contains math::Coord. Implements Tree::probeLeaf(math::Coord...
Definition: NanoVDB.h:1782
__hostdev__ bool getDev() const
Definition: NanoVDB.h:4039
__hostdev__ bool isValid(GridType gridType, GridClass gridClass)
return true if the combination of GridType and GridClass is valid.
Definition: NanoVDB.h:643
static __hostdev__ bool isAligned(const void *p)
return true if the specified pointer is 32 byte aligned
Definition: NanoVDB.h:579
__hostdev__ void * getRoot()
Get a non-const void pointer to the root node (never NULL)
Definition: NanoVDB.h:2383
__hostdev__ ChildIterator beginChild()
Definition: NanoVDB.h:3337
uint8_t mFlags
Definition: NanoVDB.h:3659
__hostdev__ TileT * operator->() const
Definition: NanoVDB.h:2718
__hostdev__ LeafNodeType * getFirstLeaf()
Template specializations of getFirstNode.
Definition: NanoVDB.h:2560
uint64_t mOffset
Definition: NanoVDB.h:4167
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:3709
__hostdev__ ValueIter(RootT *parent)
Definition: NanoVDB.h:2918
__hostdev__ GridBlindDataSemantic toSemantic(GridClass gridClass, GridBlindDataSemantic defaultSemantic=GridBlindDataSemantic::Unknown)
Maps from GridClass to GridBlindDataSemantic.
Definition: NanoVDB.h:463
static int64_t PtrDiff(const void *p, const void *q)
Compute the distance, in bytes, between two pointers, dist = p - q.
Definition: Util.h:498
__hostdev__ uint32_t gridIndex() const
Return index of this grid in the buffer.
Definition: NanoVDB.h:2161
__hostdev__ const RootT & root() const
Definition: NanoVDB.h:2463
__hostdev__ bool isEmpty() const
Return true if the root is empty, i.e. has not child nodes or constant tiles.
Definition: NanoVDB.h:2392
Definition: NanoVDB.h:2116
__hostdev__ const StatsT & stdDeviation() const
Definition: NanoVDB.h:2816
LeafNodeType Node0
Definition: NanoVDB.h:2446
__hostdev__ ValueType getValue(const CoordType &ijk) const
Return the value of the given voxel.
Definition: NanoVDB.h:3064
Checksum mChecksum
Definition: NanoVDB.h:1925
Return point to the upper internal node where math::Coord maps to one of its values, i.e. terminates.
Definition: NanoVDB.h:6223
__hostdev__ const GridClass & gridClass() const
Definition: NanoVDB.h:2256
__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:5578
typename DataType::StatsT FloatType
Definition: NanoVDB.h:2845
__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:3049
Below is an example of a struct used for random get methods.
Definition: NanoVDB.h:1772
BitFlags()
Definition: NanoVDB.h:946
__hostdev__ FloatType getAvg() const
Definition: NanoVDB.h:3690
__hostdev__ ChildIterator beginChild()
Definition: NanoVDB.h:2907
__hostdev__ bool isActive(const CoordT &ijk) const
Return true if the voxel value at the given coordinate is active.
Definition: NanoVDB.h:4468
__hostdev__ ConstDenseIterator cbeginDense() const
Definition: NanoVDB.h:3011
__hostdev__ uint64_t getValue(uint32_t i) const
Definition: NanoVDB.h:4137
ChildT ChildNodeType
Definition: NanoVDB.h:2838
#define NANOVDB_MAGIC_GRID
Definition: NanoVDB.h:140
__hostdev__ void setAvg(const FloatType &)
Definition: NanoVDB.h:4044
__hostdev__ ValueOnIterator beginValueOn() const
Definition: NanoVDB.h:3410
typename BuildToValueMap< T >::type BuildToValueMapT
Definition: NanoVDB.h:574
__hostdev__ const MaskType< LOG2DIM > & valueMask() const
Return a const reference to the bit mask of active voxels in this leaf node.
Definition: NanoVDB.h:4373
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:1534
static __hostdev__ KeyT CoordToKey(const CoordType &ijk)
Definition: NanoVDB.h:2609
__hostdev__ void setAvg(float avg)
Definition: NanoVDB.h:3783
MaskT< LOG2DIM > ArrayType
Definition: NanoVDB.h:3969
T Type
Definition: NanoVDB.h:506
__hostdev__ bool isActive() const
Definition: NanoVDB.h:3369
uint64_t mMagic
Definition: NanoVDB.h:1924
__hostdev__ ChannelT * setChannel(uint32_t channelID)
Change to an internal channel, assuming it exists as as blind data in the IndexGrid.
Definition: NanoVDB.h:5733
__hostdev__ void setMax(const ValueType &)
Definition: NanoVDB.h:4043
__hostdev__ bool isOff() const
Return true if none of the bits are set in this Mask.
Definition: NanoVDB.h:1232
__hostdev__ uint32_t valueCount() const
Definition: NanoVDB.h:4128
uint64_t mGridSize
Definition: NanoVDB.h:1930
__hostdev__ NodeT * probeChild(ValueType &value) const
Definition: NanoVDB.h:2987
RootT Node3
Definition: NanoVDB.h:2443
PointType
Definition: NanoVDB.h:388
__hostdev__ void toggle(uint32_t n)
Definition: NanoVDB.h:1315
Trait to map from LEVEL to node type.
Definition: NanoVDB.h:4625
__hostdev__ void setDev(const FloatType &)
Definition: NanoVDB.h:4086
__hostdev__ void setMax(const ValueT &v)
Definition: NanoVDB.h:2819
__hostdev__ void setOn(uint32_t offset)
Definition: NanoVDB.h:4087
__hostdev__ bool isFogVolume() const
Definition: NanoVDB.h:2258
__hostdev__ ValueIter()
Definition: NanoVDB.h:2917
#define NANOVDB_MINOR_VERSION_NUMBER
Definition: NanoVDB.h:147
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition: NanoVDB.h:4927
__hostdev__ WordT getWord(uint32_t n) const
Definition: NanoVDB.h:1175
__hostdev__ FloatType variance() const
Return the variance of all the active values encoded in this leaf node.
Definition: NanoVDB.h:4386
uint64_t KeyT
Return a key based on the coordinates of a voxel.
Definition: NanoVDB.h:2607
Vec3d mVoxelSize
Definition: NanoVDB.h:1934
BuildT ValueType
Definition: NanoVDB.h:3651
uint64_t mFlags
Definition: NanoVDB.h:3178
__hostdev__ const uint32_t & getTableSize() const
Definition: NanoVDB.h:3037
__hostdev__ ValueIterator()
Definition: NanoVDB.h:3347
__hostdev__ Checksum(uint32_t head, uint32_t tail)
Constructor that allows the two 32bit checksums to be initiated explicitly.
Definition: NanoVDB.h:1836
__hostdev__ uint32_t pos() const
Definition: NanoVDB.h:1123
__hostdev__ Mask()
Initialize all bits to zero.
Definition: NanoVDB.h:1151
__hostdev__ bool isCached2(const CoordType &ijk) const
Definition: NanoVDB.h:5118
__hostdev__ bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:3519
Implements Tree::getNodeInfo(math::Coord)
Definition: NanoVDB.h:1786
__hostdev__ uint64_t getMax() const
Definition: NanoVDB.h:4134
__hostdev__ void setStdDeviationOn(bool on=true)
Definition: NanoVDB.h:1996
__hostdev__ uint32_t gridCount() const
Return total number of grids in the buffer.
Definition: NanoVDB.h:2164
__hostdev__ bool isRootConnected() const
return true if RootData follows TreeData in memory without any extra padding
Definition: NanoVDB.h:2111
__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:5590
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition: NanoVDB.h:4847
__hostdev__ bool isValid() const
Methods related to the classification of this grid.
Definition: NanoVDB.h:2254
__hostdev__ void setValue(uint32_t n, const ValueT &v)
Definition: NanoVDB.h:3206
ValueType minimum
Definition: NanoVDB.h:6288
__hostdev__ AccessorType getAccessor() const
Definition: NanoVDB.h:3020
ChildT UpperNodeType
Definition: NanoVDB.h:2841
uint32_t mGridCount
Definition: NanoVDB.h:1929
CoordT mBBoxMin
Definition: NanoVDB.h:3657
__hostdev__ bool isActive() const
Definition: NanoVDB.h:4337
__hostdev__ const void * nodePtr() const
Return a non-const void pointer to the first node at LEVEL.
Definition: NanoVDB.h:2035
typename NanoLeaf< BuildT >::ValueType ValueT
Definition: NanoVDB.h:6143
__hostdev__ FloatType getDev() const
Definition: NanoVDB.h:3691
__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:4389
Definition: NanoVDB.h:6285
__hostdev__ bool isValid() const
return true if the magic number and the version are both valid
Definition: NanoVDB.h:1979
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType type
Definition: NanoVDB.h:1727
uint64_t FloatType
Definition: NanoVDB.h:805
__hostdev__ RootT & root()
Definition: NanoVDB.h:2461
float mQuantum
Definition: NanoVDB.h:3741
char * strcpy(char *dst, const char *src)
Copy characters from src to dst.
Definition: Util.h:166
double FloatType
Definition: NanoVDB.h:823
__hostdev__ bool isIndex(GridType gridType)
Return true if the GridType maps to a special index type (not a POD integer type).
Definition: NanoVDB.h:634
Map mMap
Definition: NanoVDB.h:1932
#define NANOVDB_MAGIC_FILE
Definition: NanoVDB.h:141
__hostdev__ ValueType minimum() const
Return a const reference to the minimum active value encoded in this leaf node.
Definition: NanoVDB.h:4377
float type
Definition: NanoVDB.h:549
__hostdev__ const uint32_t & tileCount() const
Return the number of tiles encoded in this root node.
Definition: NanoVDB.h:3036
__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:1467
typename ChildT::LeafNodeType LeafNodeType
Definition: NanoVDB.h:2843
Bit-compacted representation of all three version numbers.
Definition: NanoVDB.h:708
__hostdev__ uint64_t lastOffset() const
Definition: NanoVDB.h:4111
__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:2171
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition: NanoVDB.h:4841
__hostdev__ ChannelAccessor(const NanoGrid< IndexT > &grid, ChannelT *channelPtr)
Ctor from an IndexGrid and an external channel.
Definition: NanoVDB.h:5701
__hostdev__ bool operator>=(const Version &rhs) const
Definition: NanoVDB.h:734
typename DataType::ValueT ValueType
Definition: NanoVDB.h:3275
typename GridOrTreeOrRootT::LeafNodeType Type
Definition: NanoVDB.h:1711
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:4415
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition: NanoVDB.h:5269
typename NanoLeaf< BuildT >::ValueType Type
Definition: NanoVDB.h:6130
Definition: NanoVDB.h:3166
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:3469
__hostdev__ bool operator==(const Mask &other) const
Definition: NanoVDB.h:1205
__hostdev__ ChildIter & operator++()
Definition: NanoVDB.h:2890
__hostdev__ bool isValueOn() const
Definition: NanoVDB.h:2738
__hostdev__ void setDev(const FloatType &)
Definition: NanoVDB.h:4202
__hostdev__ TileIterator probe(const CoordT &ijk)
Definition: NanoVDB.h:2761
__hostdev__ void setOn(uint32_t offset)
Definition: NanoVDB.h:4041
__hostdev__ const ChildT * probeChild(ValueType &value) const
Definition: NanoVDB.h:3431
__hostdev__ bool operator==(const Checksum &rhs) const
return true if the checksums are identical
Definition: NanoVDB.h:1883
__hostdev__ const NanoGrid< BuildT > & grid() const
Definition: NanoVDB.h:5564
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:1148
__hostdev__ ConstValueIterator cbeginValueAll() const
Definition: NanoVDB.h:2942
__hostdev__ void disable()
Definition: NanoVDB.h:1872
__hostdev__ const NanoGrid< IndexT > & grid() const
Return a const reference to the IndexGrid.
Definition: NanoVDB.h:5714
static constexpr uint32_t SIZE
Definition: NanoVDB.h:1049
uint32_t mNodeCount[3]
Definition: NanoVDB.h:2372
ValueType mMaximum
Definition: NanoVDB.h:3663
typename GridOrTreeOrRootT::LeafNodeType type
Definition: NanoVDB.h:1712
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:4025
static __hostdev__ CoordT KeyToCoord(const KeyT &key)
Definition: NanoVDB.h:2617
__hostdev__ const Map & map() const
Return a const reference to the Map for this grid.
Definition: NanoVDB.h:2193
__hostdev__ ValueIterator cbeginValueAll() const
Definition: NanoVDB.h:4357
__hostdev__ void setRoot(const void *root)
Definition: NanoVDB.h:2377
__hostdev__ BaseIter()
Definition: NanoVDB.h:2863
static __hostdev__ uint32_t wordCount()
Return the number of machine words used by this Mask.
Definition: NanoVDB.h:1059
__hostdev__ uint32_t operator*() const
Definition: NanoVDB.h:1122
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:3999
typename DataType::BuildT BuildType
Definition: NanoVDB.h:2846
__hostdev__ void setMin(const bool &)
Definition: NanoVDB.h:3993
__hostdev__ const StatsT & average() const
Definition: NanoVDB.h:2815
__hostdev__ void setMin(const ValueType &)
Definition: NanoVDB.h:4083
__hostdev__ uint32_t tail() const
Definition: NanoVDB.h:1858
__hostdev__ bool getAvg() const
Definition: NanoVDB.h:3985
__hostdev__ bool updateBBox()
Updates the local bounding box of active voxels in this node. Return true if bbox was updated...
Definition: NanoVDB.h:4572
__hostdev__ DenseIter & operator++()
Definition: NanoVDB.h:2994
Return point to the root Tile where math::Coord maps to one of its values, i.e. terminates.
Definition: NanoVDB.h:6235
__hostdev__ bool isBreadthFirst() const
Definition: NanoVDB.h:2270
__hostdev__ bool isPointData() const
Definition: NanoVDB.h:2262
__hostdev__ uint64_t last(uint32_t i) const
Definition: NanoVDB.h:4184
bool FloatType
Definition: NanoVDB.h:799
__hostdev__ TileT & operator*() const
Definition: NanoVDB.h:2713
__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:3492
__hostdev__ Iterator & operator++()
Definition: NanoVDB.h:1097
Definition: NanoVDB.h:785
#define __hostdev__
Definition: Util.h:73
typename DataType::FloatType FloatType
Definition: NanoVDB.h:4233
#define NANOVDB_DATA_ALIGNMENT
Definition: NanoVDB.h:133
typename DataType::Tile Tile
Definition: NanoVDB.h:2851
__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:667
__hostdev__ DenseIterator operator++(int)
Definition: NanoVDB.h:1130
__hostdev__ uint64_t getValue(uint32_t i) const
Definition: NanoVDB.h:4117
__hostdev__ void setMax(const ValueT &v)
Definition: NanoVDB.h:3255
Definition: NanoVDB.h:939
Coord CoordType
Definition: NanoVDB.h:4235
Dummy type for a 16bit quantization of float point values.
Definition: NanoVDB.h:190
uint8_t ArrayType
Definition: NanoVDB.h:3840
typename Mask< Log2Dim >::template Iterator< On > MaskIterT
Definition: NanoVDB.h:3285
__hostdev__ bool hasLongGridName() const
Definition: NanoVDB.h:2267
__hostdev__ TreeT & tree()
Return a non-const reference to the tree.
Definition: NanoVDB.h:2184
CoordT mBBoxMin
Definition: NanoVDB.h:4162
__hostdev__ void setFirstNode(const NodeT *node)
Definition: NanoVDB.h:2389
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType Type
Definition: NanoVDB.h:1747
__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:3489
__hostdev__ float getValue(uint32_t i) const
Definition: NanoVDB.h:3815
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:3197
__hostdev__ void setMin(float min)
Definition: NanoVDB.h:3777
__hostdev__ void setValue(uint32_t offset, bool)
Definition: NanoVDB.h:4040
__hostdev__ void setMax(const ValueType &v)
Definition: NanoVDB.h:3701
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:4048
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition: NanoVDB.h:3671
__hostdev__ uint32_t pos() const
Definition: NanoVDB.h:2868
__hostdev__ ChildIter()
Definition: NanoVDB.h:3305
__hostdev__ void setMin(const ValueType &)
Definition: NanoVDB.h:4199
__hostdev__ BlindDataT * getBlindData(uint32_t n)
Definition: NanoVDB.h:2326
__hostdev__ void setDev(const StatsT &v)
Definition: NanoVDB.h:3257
__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:3512
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition: NanoVDB.h:5068
__hostdev__ bool isOn(uint32_t n) const
Return true if the given bit is set.
Definition: NanoVDB.h:1217
__hostdev__ float getValue(uint32_t i) const
Definition: NanoVDB.h:3913
__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:1507
uint64_t ValueType
Definition: NanoVDB.h:4065
uint16_t ArrayType
Definition: NanoVDB.h:3870
__hostdev__ const MaskType< LOG2DIM > & childMask() const
Return a const reference to the bit mask of child nodes in this internal node.
Definition: NanoVDB.h:3479
MatType scale(const Vec3< typename MatType::value_type > &s)
Return a matrix that scales by s.
Definition: Mat.h:615
__hostdev__ void setMax(const ValueType &)
Definition: NanoVDB.h:4084
__hostdev__ void setAvg(const FloatType &)
Definition: NanoVDB.h:4085
ValueT value
Definition: NanoVDB.h:2670
__hostdev__ void setDev(float dev)
Definition: NanoVDB.h:3786
Node caching at all (three) tree levels.
Definition: NanoVDB.h:5220
__hostdev__ void setDev(const StatsT &v)
Definition: NanoVDB.h:2821
__hostdev__ OnIterator beginOn() const
Definition: NanoVDB.h:1144
Definition: NanoVDB.h:1774
__hostdev__ void setAvg(const FloatType &)
Definition: NanoVDB.h:4201
__hostdev__ bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:5343
__hostdev__ void setOn(uint32_t offset)
Definition: NanoVDB.h:4192
bool Type
Definition: NanoVDB.h:6170
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType Type
Definition: NanoVDB.h:1726
BuildT BuildType
Definition: NanoVDB.h:5244
Stuct with all the member data of the LeafNode (useful during serialization of an openvdb LeafNode) ...
Definition: NanoVDB.h:3647
__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:3027
GridBlindDataSemantic
Blind-data Semantics that are currently understood by NanoVDB.
Definition: NanoVDB.h:411
Version mVersion
Definition: NanoVDB.h:1926
__hostdev__ void setAverageOn(bool on=true)
Definition: NanoVDB.h:1995
__hostdev__ bool isSequential() const
return true if nodes at all levels can safely be accessed with simple linear offsets ...
Definition: NanoVDB.h:2283
__hostdev__ Map()
Default constructor for the identity map.
Definition: NanoVDB.h:1407
GridFlags
Grid flags which indicate what extra information is present in the grid buffer.
Definition: NanoVDB.h:320
Metafunction used to determine if the first template parameter is a specialization of the class templ...
Definition: Util.h:484
static __hostdev__ constexpr uint8_t bitWidth()
Definition: NanoVDB.h:3881
__hostdev__ uint32_t & checksum(int i)
Definition: NanoVDB.h:1850
__hostdev__ DenseIterator()
Definition: NanoVDB.h:3420
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:5438
RootT RootType
Definition: NanoVDB.h:2433
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition: NanoVDB.h:3751
Definition: GridHandle.h:27
float type
Definition: NanoVDB.h:542
CoordBBox bbox
Definition: NanoVDB.h:6290
float Type
Definition: NanoVDB.h:548
__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:2478
Visits all tile values and child nodes of this node.
Definition: NanoVDB.h:3414
GridType mGridType
Definition: NanoVDB.h:1936
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition: NanoVDB.h:4933
Definition: NanoVDB.h:1080
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
return the state and updates the value of the specified voxel
Definition: NanoVDB.h:3521
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:4075
Define static boolean tests for template build types.
Definition: NanoVDB.h:484
__hostdev__ bool isFull() const
return true if the 64 bit checksum is fill, i.e. of both had and nodes
Definition: NanoVDB.h:1867
__hostdev__ bool hasMinMax() const
Definition: NanoVDB.h:2265
__hostdev__ ConstChildIterator cbeginChild() const
Definition: NanoVDB.h:2908
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:1046
CoordT CoordType
Definition: NanoVDB.h:4908
__hostdev__ const GridBlindMetaData * blindMetaData(uint32_t n) const
Returns a const reference to the blindMetaData at the specified linear offset.
Definition: NanoVDB.h:2067
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition: NanoVDB.h:4953
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:3239
static ElementType scalar(const T &v)
Definition: NanoVDB.h:779
__hostdev__ ValueIterator beginValue() const
Definition: NanoVDB.h:3376
__hostdev__ void setMax(float max)
Definition: NanoVDB.h:3780
__hostdev__ TileIter()
Definition: NanoVDB.h:2696
static __hostdev__ constexpr uint8_t bitWidth()
Definition: NanoVDB.h:3814
__hostdev__ bool getMax() const
Definition: NanoVDB.h:3984
uint64_t mData2
Definition: NanoVDB.h:1941
typename ChildT::ValueType ValueT
Definition: NanoVDB.h:2599
float mMinimum
Definition: NanoVDB.h:3740
__hostdev__ uint64_t offset() const
Definition: NanoVDB.h:4181
static __hostdev__ Coord OffsetToLocalCoord(uint32_t n)
Definition: NanoVDB.h:3544
__hostdev__ const Vec3d & voxelSize() const
Return a vector of the axial voxel sizes.
Definition: NanoVDB.h:5720
__hostdev__ constexpr uint32_t strlen()
return the number of characters (including null termination) required to convert enum type to a strin...
Definition: NanoVDB.h:204
typename NanoLeaf< BuildT >::FloatType FloatType
Definition: NanoVDB.h:6284
Definition: NanoVDB.h:4061
KeyT key
Definition: NanoVDB.h:2667
__hostdev__ bool isChild() const
Definition: NanoVDB.h:2728
uint64_t FloatType
Definition: NanoVDB.h:811
__hostdev__ uint64_t pointCount() const
Definition: NanoVDB.h:4182
typename DataType::StatsT FloatType
Definition: NanoVDB.h:3276
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition: NanoVDB.h:5130
__hostdev__ uint32_t & tail()
Definition: NanoVDB.h:1859
bool ValueType
Definition: NanoVDB.h:3966
__hostdev__ Tile * probeTile(const CoordT &ijk)
Definition: NanoVDB.h:2777
__hostdev__ uint64_t getAvg() const
Definition: NanoVDB.h:4115
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition: NanoVDB.h:4853
__hostdev__ uint64_t checksum() const
return the 64 bit checksum of this instance
Definition: NanoVDB.h:1848
Dummy type for a voxel whose value equals an offset into an external value array of active values...
Definition: NanoVDB.h:175
__hostdev__ ValueOnIterator beginValueOn() const
Definition: NanoVDB.h:4272
Top-most node of the VDB tree structure.
Definition: NanoVDB.h:2834
int64_t child
Definition: NanoVDB.h:3169
#define NANOVDB_MAJOR_VERSION_NUMBER
Definition: NanoVDB.h:146
__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:1476
uint8_t ArrayType
Definition: NanoVDB.h:3803
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:3675
Struct to derive node type from its level in a given grid, tree or root while preserving constness...
Definition: NanoVDB.h:1704
typename GridT::TreeType type
Definition: NanoVDB.h:2408
__hostdev__ Codec toCodec(const char *str)
Definition: NanoVDB.h:5807
Definition: NanoVDB.h:2875
uint32_t level
Definition: NanoVDB.h:6287
__hostdev__ float getValue(uint32_t i) const
Definition: NanoVDB.h:3851
uint32_t mTileCount[3]
Definition: NanoVDB.h:2373
typename RootT::ChildNodeType Node2
Definition: NanoVDB.h:2444
__hostdev__ CoordType getOrigin() const
Definition: NanoVDB.h:3402
__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:3486
ValueType mMinimum
Definition: NanoVDB.h:3662
__hostdev__ const void * blindData(uint32_t n) const
Returns a const pointer to the blindData at the specified linear offset.
Definition: NanoVDB.h:2311
__hostdev__ GridType toGridType()
Maps from a templated build type to a GridType enum.
Definition: NanoVDB.h:830
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:4228
__hostdev__ bool isCached(const CoordType &ijk) const
Definition: NanoVDB.h:5330
uint64_t Type
Definition: NanoVDB.h:513
uint64_t type
Definition: NanoVDB.h:521
const typename NanoRoot< BuildT >::Tile * Type
Definition: NanoVDB.h:6237
__hostdev__ float getDev() const
return the quantized standard deviation of the active values in this node
Definition: NanoVDB.h:3774
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:3397
ValueT mMaximum
Definition: NanoVDB.h:3183
__hostdev__ uint64_t idx(int i, int j, int k) const
Definition: NanoVDB.h:5740
static __hostdev__ CoordT OffsetToLocalCoord(uint32_t n)
Compute the local coordinates from a linear offset.
Definition: NanoVDB.h:4399
__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:3501
__hostdev__ ValueType getValue(const CoordType &ijk) const
Return the value of the given voxel.
Definition: NanoVDB.h:3518
__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:3052
__hostdev__ uint64_t getValue(uint32_t i) const
Definition: NanoVDB.h:4185
__hostdev__ bool operator<=(const Version &rhs) const
Definition: NanoVDB.h:732
__hostdev__ bool getValue(uint32_t i) const
Definition: NanoVDB.h:3982
T ElementType
Definition: NanoVDB.h:767
bool Type
Definition: NanoVDB.h:6248
typename RootType::LeafNodeType LeafNodeType
Definition: NanoVDB.h:2134
float Type
Definition: NanoVDB.h:562
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition: NanoVDB.h:4966
__hostdev__ auto pos() const
Definition: NanoVDB.h:2707
uint64_t Type
Definition: NanoVDB.h:520
__hostdev__ uint32_t getMinor() const
Definition: NanoVDB.h:737
Struct with all the member data of the RootNode (useful during serialization of an openvdb RootNode) ...
Definition: NanoVDB.h:2597
__hostdev__ CoordType getCoord() const
Definition: NanoVDB.h:3331
__hostdev__ ValueIterator operator++(int)
Definition: NanoVDB.h:4348
__hostdev__ int findBlindDataForSemantic(GridBlindDataSemantic semantic) const
Return the index of the first blind data with specified semantic if found, otherwise -1...
Definition: NanoVDB.h:2339
static __hostdev__ bool hasStats()
Definition: NanoVDB.h:3746
__hostdev__ ValueOffIterator(const LeafNode *parent)
Definition: NanoVDB.h:4287
openvdb::GridBase Grid
Definition: Utils.h:43
__hostdev__ Mask(bool on)
Definition: NanoVDB.h:1156
__hostdev__ void setOff(uint32_t n)
Set the specified bit off.
Definition: NanoVDB.h:1243
__hostdev__ const char * gridName() const
Return a c-string with the name of this grid.
Definition: NanoVDB.h:2286
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:4293
typename RootNodeType::ChildNodeType UpperNodeType
Definition: NanoVDB.h:2435
double FloatType
Definition: NanoVDB.h:793
__hostdev__ ChildT * getChild(const Tile *tile)
Returns a const reference to the child node in the specified tile.
Definition: NanoVDB.h:2802
__hostdev__ const Checksum & checksum() const
Return checksum of the grid buffer.
Definition: NanoVDB.h:2292
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition: NanoVDB.h:5056
GridClass mGridClass
Definition: NanoVDB.h:1935
__hostdev__ Version(uint32_t data)
Constructor from a raw uint32_t data representation.
Definition: NanoVDB.h:721
Dummy type for a voxel whose value equals an offset into an external value array. ...
Definition: NanoVDB.h:172
Maps one type (e.g. the build types above) to other (actual) types.
Definition: NanoVDB.h:504
__hostdev__ const DataType * data() const
Definition: NanoVDB.h:2456
__hostdev__ GridClass toGridClass(GridBlindDataSemantic semantics, GridClass defaultClass=GridClass::Unknown)
Maps from GridBlindDataSemantic to GridClass.
Definition: NanoVDB.h:431
__hostdev__ ValueType getLastValue() const
Return the last value in this leaf node.
Definition: NanoVDB.h:4454
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:3789
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition: NanoVDB.h:4962
__hostdev__ bool isHalf() const
Definition: NanoVDB.h:1864
__hostdev__ uint64_t getDev() const
Definition: NanoVDB.h:4116
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:3980
math::BBox< CoordT > mBBox
Definition: NanoVDB.h:2629
__hostdev__ ValueIterator(const LeafNode *parent)
Definition: NanoVDB.h:4320
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition: NanoVDB.h:4814
typename RootT::ValueType ValueType
Definition: NanoVDB.h:4808
__hostdev__ DataT * data() const
Definition: NanoVDB.h:2723
__hostdev__ uint32_t id() const
Definition: NanoVDB.h:735
__hostdev__ size_t memUsage() const
Definition: NanoVDB.h:3911
__hostdev__ ValueType getMin() const
Definition: NanoVDB.h:4194
__hostdev__ const NodeT * getFirstNode() const
return a const pointer to the first node of the specified type
Definition: NanoVDB.h:2535
typename ChildT::CoordType CoordType
Definition: NanoVDB.h:2848
__hostdev__ uint32_t getPatch() const
Definition: NanoVDB.h:738
Definition: NanoVDB.h:2945
__hostdev__ DenseIter(RootT *parent)
Definition: NanoVDB.h:2986
__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:3498
__hostdev__ void setOn(uint32_t n)
Set the specified bit on.
Definition: NanoVDB.h:1241
__hostdev__ const uint64_t & firstOffset() const
Definition: NanoVDB.h:4082
__hostdev__ CoordT getCoord() const
Definition: NanoVDB.h:4265
__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:1516
__hostdev__ bool isCompatible() const
Definition: NanoVDB.h:739
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition: NanoVDB.h:4957
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition: NanoVDB.h:5126
static __hostdev__ constexpr uint8_t bitWidth()
Definition: NanoVDB.h:3850
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition: NanoVDB.h:5133
__hostdev__ const ValueType & background() const
Return a const reference to the background value.
Definition: NanoVDB.h:2481
const typename GridOrTreeOrRootT::LeafNodeType type
Definition: NanoVDB.h:1719
__hostdev__ int age() const
Returns the difference between major version of this instance and NANOVDB_MAJOR_VERSION_NUMBER.
Definition: NanoVDB.h:743
__hostdev__ bool isRootNext() const
return true if RootData is layout out immediately after TreeData in memory
Definition: NanoVDB.h:2398
__hostdev__ NodeT * getFirstNode()
return a pointer to the first node of the specified type
Definition: NanoVDB.h:2525
__hostdev__ const NodeTrait< RootT, 2 >::type * getFirstUpper() const
Definition: NanoVDB.h:2565
CheckMode
List of different modes for computing for a checksum.
Definition: NanoVDB.h:1791
__hostdev__ void setAvg(const FloatType &v)
Definition: NanoVDB.h:3702
__hostdev__ uint8_t bitWidth() const
Definition: NanoVDB.h:3910
__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:3046
__hostdev__ ValueIter operator++(int)
Definition: NanoVDB.h:2930
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition: NanoVDB.h:3191
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:4327
__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:2585
__hostdev__ uint32_t pos() const
Definition: NanoVDB.h:1095
__hostdev__ void setOn(uint32_t offset)
Definition: NanoVDB.h:3761
__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:5759
typename Node2::ChildNodeType Node1
Definition: NanoVDB.h:2445
Dummy type for a 16 bit floating point values (placeholder for IEEE 754 Half)
Definition: NanoVDB.h:181
static __hostdev__ uint64_t memUsage()
return memory usage in bytes for the class
Definition: NanoVDB.h:2459
RootT RootNodeType
Definition: NanoVDB.h:2434
__hostdev__ Vec3T applyInverseMapF(const Vec3T &xyz) const
Definition: NanoVDB.h:2018
__hostdev__ uint64_t first(uint32_t i) const
Definition: NanoVDB.h:4183
__hostdev__ bool isGridIndex() const
Definition: NanoVDB.h:2261
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition: NanoVDB.h:5062
__hostdev__ NodeT * child() const
Definition: NanoVDB.h:2743
uint32_t countOn(uint64_t v)
Definition: Util.h:656
__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:5690
__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:5568
void ArrayType
Definition: NanoVDB.h:4067
__hostdev__ ChannelT & operator()(const math::Coord &ijk) const
Definition: NanoVDB.h:5744
__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:1071
__hostdev__ ChildIter()
Definition: NanoVDB.h:2883
__hostdev__ bool hasStats() const
Definition: NanoVDB.h:4080
__hostdev__ uint64_t memUsage() const
Return the actual memory footprint of this root node.
Definition: NanoVDB.h:3058
int64_t child
Definition: NanoVDB.h:2668
__hostdev__ void fill(const ValueType &v)
Definition: NanoVDB.h:3711
__hostdev__ bool getAvg() const
Definition: NanoVDB.h:4038
BuildT ArrayType
Definition: NanoVDB.h:3654
uint32_t mBlindMetadataCount
Definition: NanoVDB.h:1938
__hostdev__ OffIterator beginOff() const
Definition: NanoVDB.h:1146
__hostdev__ DenseIterator beginDense()
Definition: NanoVDB.h:3010
BuildT BuildType
Definition: NanoVDB.h:4906
__hostdev__ bool getMin() const
Definition: NanoVDB.h:3983
__hostdev__ const DataType * data() const
Definition: NanoVDB.h:4370
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:4851
__hostdev__ bool getMax() const
Definition: NanoVDB.h:4037
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:2956
bool BuildType
Definition: NanoVDB.h:3967
__hostdev__ CoordT origin() const
Definition: NanoVDB.h:2666
__hostdev__ bool operator<(const Version &rhs) const
Definition: NanoVDB.h:731
__hostdev__ bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:5134
__hostdev__ const Vec3dBBox & worldBBox() const
return AABB of active values in world space
Definition: NanoVDB.h:2093
__hostdev__ void setOn(uint32_t offset)
Definition: NanoVDB.h:3992
__hostdev__ uint8_t flags() const
Definition: NanoVDB.h:4391
__hostdev__ const ValueT & getMax() const
Definition: NanoVDB.h:3242
typename UpperNodeType::ChildNodeType LowerNodeType
Definition: NanoVDB.h:2133
__hostdev__ bool isEmpty() const
Return true if this RootNode is empty, i.e. contains no values or nodes.
Definition: NanoVDB.h:3061
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:6059
uint64_t Type
Definition: NanoVDB.h:569
CoordT mBBoxMin
Definition: NanoVDB.h:4070
__hostdev__ uint32_t checksum(int i) const
Definition: NanoVDB.h:1852
__hostdev__ bool operator!=(const Mask &other) const
Definition: NanoVDB.h:1214
CoordT CoordType
Definition: NanoVDB.h:5038
Dummy type for a variable bit quantization of floating point values.
Definition: NanoVDB.h:193
__hostdev__ Vec3T indexToWorldF(const Vec3T &xyz) const
index to world space transformation
Definition: NanoVDB.h:2224
__hostdev__ const MaskType< LOG2DIM > & getChildMask() const
Definition: NanoVDB.h:3480
StatsT mAverage
Definition: NanoVDB.h:2635
Visits all values in a leaf node, i.e. both active and inactive values.
Definition: NanoVDB.h:4309
__hostdev__ void setMin(const ValueT &v)
Definition: NanoVDB.h:3254
__hostdev__ bool hasAverage() const
Definition: NanoVDB.h:2268
__hostdev__ CoordType getCoord() const
Definition: NanoVDB.h:3368
__hostdev__ bool isActive() const
Definition: NanoVDB.h:2665
Visits active tile values of this node only.
Definition: NanoVDB.h:3380
__hostdev__ const NodeTrait< RootT, LEVEL >::type * getFirstNode() const
return a const pointer to the first node of the specified level
Definition: NanoVDB.h:2554
#define NANOVDB_HOSTDEV_DISABLE_WARNING
Definition: Util.h:94
__hostdev__ void setValueOnly(uint32_t offset, const ValueType &value)
Definition: NanoVDB.h:3680
Visits all inactive values in a leaf node.
Definition: NanoVDB.h:4276
__hostdev__ const TreeType & tree() const
Return a const reference to the tree of the IndexGrid.
Definition: NanoVDB.h:5717
typename RootT::ValueType ValueType
Definition: NanoVDB.h:2438
typename NodeTrait< GridOrTreeOrRootT, LEVEL >::type NodeTraitT
Definition: NanoVDB.h:1767
static __hostdev__ uint64_t memUsage(uint32_t tableSize)
Return the expected memory footprint in bytes with the specified number of tiles. ...
Definition: NanoVDB.h:3055
Definition: NanoVDB.h:1776
__hostdev__ ValueIterator beginValue() const
Definition: NanoVDB.h:4356
static __hostdev__ bool hasStats()
Definition: NanoVDB.h:4029
float FloatType
Definition: NanoVDB.h:787
__hostdev__ CheckMode mode() const
return the mode of the 64 bit checksum
Definition: NanoVDB.h:1875
__hostdev__ bool isMask() const
Definition: NanoVDB.h:2263
__hostdev__ Vec3T applyJacobianF(const Vec3T &xyz) const
Definition: NanoVDB.h:2020
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition: NanoVDB.h:4960
__hostdev__ void setMax(const bool &)
Definition: NanoVDB.h:3994
typename RootNodeType::ChildNodeType UpperNodeType
Definition: NanoVDB.h:2132
typename ChildT::BuildType BuildT
Definition: NanoVDB.h:2600
typename BuildT::ValueType ValueType
Definition: NanoVDB.h:2136
__hostdev__ uint32_t nodeCount() const
Return number of nodes at LEVEL.
Definition: NanoVDB.h:2058
float ValueType
Definition: NanoVDB.h:3732
__hostdev__ Mask & operator&=(const Mask &other)
Bitwise intersection.
Definition: NanoVDB.h:1318
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition: NanoVDB.h:5139
__hostdev__ const TreeT & tree() const
Return a const reference to the tree.
Definition: NanoVDB.h:2181
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:536
__hostdev__ ChannelT & getValue(const math::Coord &ijk) const
Return the value from a cached channel that maps to the specified coordinate.
Definition: NanoVDB.h:5743
uint64_t mData1
Definition: NanoVDB.h:1940
BitFlags(Type mask)
Definition: NanoVDB.h:947
__hostdev__ bool isValueOn() const
Definition: NanoVDB.h:3442
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:2234
__hostdev__ BaseIter(DataT *data)
Definition: NanoVDB.h:2864
__hostdev__ Iterator()
Definition: NanoVDB.h:1083
typename ChildT::template MaskType< LOG2DIM > MaskT
Definition: NanoVDB.h:3163
__hostdev__ uint64_t getDev() const
Definition: NanoVDB.h:4136
BitFlags< 32 > mFlags
Definition: NanoVDB.h:1927
__hostdev__ Vec3T applyInverseJacobianF(const Vec3T &xyz) const
Definition: NanoVDB.h:2022
__hostdev__ ValueOnIter operator++(int)
Definition: NanoVDB.h:2963
uint8_t mFlags
Definition: NanoVDB.h:4164
__hostdev__ void setAvg(const bool &)
Definition: NanoVDB.h:3995
__hostdev__ void setMin(const ValueType &v)
Definition: NanoVDB.h:3700
__hostdev__ bool getMin() const
Definition: NanoVDB.h:4036
__hostdev__ bool isStaggered() const
Definition: NanoVDB.h:2259
__hostdev__ ConstChildIterator cbeginChild() const
Definition: NanoVDB.h:3338
uint8_t mFlags
Definition: NanoVDB.h:4024
__hostdev__ bool isEmpty() const
test if the grid is empty, e.i the root table has size 0
Definition: NanoVDB.h:2107
__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:5635
__hostdev__ NodeT * operator->() const
Definition: NanoVDB.h:3321
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:3738
#define __device__
Definition: Util.h:79
__hostdev__ Vec3T applyInverseMap(const Vec3T &xyz) const
Definition: NanoVDB.h:2007
int64_t mBlindMetadataOffset
Definition: NanoVDB.h:1937
float mTaperF
Definition: NanoVDB.h:1400
Implements Tree::probeLeaf(math::Coord)
Definition: NanoVDB.h:1784
__hostdev__ ChildIter(RootT *parent)
Definition: NanoVDB.h:2884
__hostdev__ void setValue(uint32_t offset, const ValueType &value)
Definition: NanoVDB.h:3681
__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:2395
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:4073
typename RootT::CoordType CoordType
Definition: NanoVDB.h:4809
__hostdev__ MagicType toMagic(uint64_t magic)
maps 64 bits of magic number to enum
Definition: NanoVDB.h:359
__hostdev__ const DataType * data() const
Definition: NanoVDB.h:3466
__hostdev__ bool isLevelSet() const
Definition: NanoVDB.h:2257
__hostdev__ ChildT * probeChild(const CoordT &ijk)
Definition: NanoVDB.h:2788
RootType RootNodeType
Definition: NanoVDB.h:2131
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition: NanoVDB.h:5301
static __hostdev__ uint64_t memUsage()
Return memory usage in bytes for this class only.
Definition: NanoVDB.h:2090
__hostdev__ void setValueOnly(const CoordT &ijk, const ValueType &v)
Definition: NanoVDB.h:4465
__hostdev__ const NodeT * getNode() const
Return a const point to the cached node of the specified type.
Definition: NanoVDB.h:5285
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:3875
__hostdev__ bool isFloatingPoint(GridType gridType)
return true if the GridType maps to a floating point type
Definition: NanoVDB.h:595
CoordT mBBoxMin
Definition: NanoVDB.h:3972
__hostdev__ void setOff()
Set all bits off.
Definition: NanoVDB.h:1298
__hostdev__ void localToGlobalCoord(Coord &ijk) const
modifies local coordinates to global coordinates of a tile or child node
Definition: NanoVDB.h:3552
__hostdev__ void setAvg(const StatsT &v)
Definition: NanoVDB.h:2820
__hostdev__ CoordType getOrigin() const
Definition: NanoVDB.h:3363
__hostdev__ const LeafNodeType * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:3522
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
return the state and updates the value of the specified voxel
Definition: NanoVDB.h:3068
__hostdev__ Vec3T indexToWorldGrad(const Vec3T &grad) const
transform the gradient from index space to world space.
Definition: NanoVDB.h:2216
__hostdev__ uint64_t activeVoxelCount() const
Computes a AABB of active values in world space.
Definition: NanoVDB.h:2251
__hostdev__ const LeafNode * probeLeaf(const CoordT &) const
Definition: NanoVDB.h:4489
__hostdev__ uint64_t * words()
Return a pointer to the list of words of the bit mask.
Definition: NanoVDB.h:1171
__hostdev__ void init(float min, float max, uint8_t bitWidth)
Definition: NanoVDB.h:3755
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition: NanoVDB.h:4850
__hostdev__ Version(uint32_t major, uint32_t minor, uint32_t patch)
Constructor from major.minor.patch version numbers.
Definition: NanoVDB.h:723
__hostdev__ Mask & operator|=(const Mask &other)
Bitwise union.
Definition: NanoVDB.h:1326
static __hostdev__ uint32_t voxelCount()
Return the total number of voxels (e.g. values) encoded in this leaf node.
Definition: NanoVDB.h:4432
typename ChildT::BuildType BuildT
Definition: NanoVDB.h:3160
__hostdev__ DataType * data()
Definition: NanoVDB.h:4368
__hostdev__ Mask & operator-=(const Mask &other)
Bitwise difference.
Definition: NanoVDB.h:1334
__hostdev__ Checksum(uint64_t checksum, CheckMode mode=CheckMode::Full)
Definition: NanoVDB.h:1841
__hostdev__ ValueIterator beginValue()
Definition: NanoVDB.h:2941
__hostdev__ const RootT & root() const
Definition: NanoVDB.h:5274
uint64_t mPointCount
Definition: NanoVDB.h:4168
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition: NanoVDB.h:4848
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:4079
__hostdev__ CoordType origin() const
Return the origin in index space of this leaf node.
Definition: NanoVDB.h:3483
__hostdev__ DenseIterator(uint32_t pos=Mask::SIZE)
Definition: NanoVDB.h:1117
__hostdev__ CoordT getCoord() const
Definition: NanoVDB.h:4298
PointAccessor(const NanoGrid< BuildT > &grid)
Definition: NanoVDB.h:5551
__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:1525
__hostdev__ void setValueOnly(uint32_t offset, uint16_t value)
Definition: NanoVDB.h:4186
__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:5739
ValueT mMinimum
Definition: NanoVDB.h:3182
__hostdev__ bool setGridName(const char *src)
Definition: NanoVDB.h:1997
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:3975
__hostdev__ void localToGlobalCoord(Coord &ijk) const
Converts (in place) a local index coordinate to a global index coordinate.
Definition: NanoVDB.h:4407
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition: NanoVDB.h:5251
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:4205
uint64_t ValueType
Definition: NanoVDB.h:4156
Dummy type for a 8bit quantization of float point values.
Definition: NanoVDB.h:187
__hostdev__ DataType * data()
Definition: NanoVDB.h:2454
typename NanoLeaf< BuildT >::ValueType ValueType
Definition: NanoVDB.h:6283
MagicType
Enums used to identify magic numbers recognized by NanoVDB.
Definition: NanoVDB.h:350
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition: NanoVDB.h:5384
__hostdev__ bool isValueOn() const
Definition: NanoVDB.h:2993
Dummy type for a voxel whose value equals its binary active state.
Definition: NanoVDB.h:178
uint8_t mFlags
Definition: NanoVDB.h:4072
uint64_t mPrefixSum
Definition: NanoVDB.h:4074
__hostdev__ CoordType getCoord() const
Definition: NanoVDB.h:2871
__hostdev__ Vec3T applyJacobian(const Vec3T &xyz) const
Definition: NanoVDB.h:2009
__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:2178
__hostdev__ const RootT & root() const
Definition: NanoVDB.h:5079
typename util::match_const< ChildT, DataT >::type NodeT
Definition: NanoVDB.h:2692
Definition: IndexIterator.h:43
__hostdev__ ChildIter(ParentT *parent)
Definition: NanoVDB.h:3310
uint32_t mGridIndex
Definition: NanoVDB.h:1928
__hostdev__ ValueOnIterator(const LeafNode *parent)
Definition: NanoVDB.h:4254
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition: NanoVDB.h:5132
uint64_t mVoxelCount
Definition: NanoVDB.h:2374
static __hostdev__ uint32_t CoordToOffset(const CoordType &ijk)
Return the linear offset corresponding to the given coordinate.
Definition: NanoVDB.h:3536
__hostdev__ uint32_t nodeCount() const
Definition: NanoVDB.h:2504
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition: NanoVDB.h:5131
uint64_t type
Definition: NanoVDB.h:514
__hostdev__ Vec3T applyMap(const Vec3T &ijk) const
Apply the forward affine transformation to a vector using 64bit floating point arithmetics.
Definition: NanoVDB.h:1450
CoordT CoordType
Definition: NanoVDB.h:5246
__hostdev__ CoordType getCoord() const
Definition: NanoVDB.h:3407
static __hostdev__ bool hasStats()
Definition: NanoVDB.h:3677
__hostdev__ const CoordBBox & indexBBox() const
return AABB of active values in index space
Definition: NanoVDB.h:2096
__hostdev__ bool isFloatingPointVector(GridType gridType)
return true if the GridType maps to a floating point vec3.
Definition: NanoVDB.h:609
ValueT mBackground
Definition: NanoVDB.h:2632
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType type
Definition: NanoVDB.h:1748
__hostdev__ ValueOnIterator()
Definition: NanoVDB.h:3386
__hostdev__ bool isInteger(GridType gridType)
Return true if the GridType maps to a POD integer type.
Definition: NanoVDB.h:621
__hostdev__ AccessorType getAccessor() const
Definition: NanoVDB.h:2465
__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:5645
NANOVDB_HOSTDEV_DISABLE_WARNING __hostdev__ uint32_t findPrev(uint32_t start) const
Definition: NanoVDB.h:1376
__hostdev__ bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:3066
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:2922
__hostdev__ const RootT & root() const
Definition: NanoVDB.h:4939
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType type
Definition: NanoVDB.h:1734
void ArrayType
Definition: NanoVDB.h:4019
Defines an affine transform and its inverse represented as a 3x3 matrix and a vec3 translation...
Definition: NanoVDB.h:1395
uint64_t FloatType
Definition: NanoVDB.h:4066
float Type
Definition: NanoVDB.h:541
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache Noop since this template specializa...
Definition: NanoVDB.h:4833
__hostdev__ const Tile * probeTile(const CoordT &ijk) const
Definition: NanoVDB.h:2783
#define NANOVDB_ASSERT(x)
Definition: Util.h:50
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType type
Definition: NanoVDB.h:1741
GridType
List of types that are currently supported by NanoVDB.
Definition: NanoVDB.h:214
typename BuildT::CoordType CoordType
Definition: NanoVDB.h:2138
__hostdev__ ValueOnIterator cbeginValueOn() const
Definition: NanoVDB.h:4273
__hostdev__ DenseIterator & operator++()
Definition: NanoVDB.h:1125
__hostdev__ void setOn()
Set all bits on.
Definition: NanoVDB.h:1292
__hostdev__ FloatType average() const
Return a const reference to the average of all the active values encoded in this leaf node...
Definition: NanoVDB.h:4383
Class to access points at a specific voxel location.
Definition: NanoVDB.h:5544
__hostdev__ Mask & operator^=(const Mask &other)
Bitwise XOR.
Definition: NanoVDB.h:1342
ValueT mMaximum
Definition: NanoVDB.h:2634
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:582
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition: NanoVDB.h:4913
__hostdev__ Iterator operator++(int)
Definition: NanoVDB.h:1102
ValueT mMinimum
Definition: NanoVDB.h:2633
__hostdev__ ChildIter operator++(int)
Definition: NanoVDB.h:2896
bool FloatType
Definition: NanoVDB.h:817
__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:2497
C++11 implementation of std::is_floating_point.
Definition: Util.h:332
__hostdev__ FloatType getDev() const
Definition: NanoVDB.h:4197
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:3358
__hostdev__ const RootT & root() const
Definition: NanoVDB.h:4835
static void * memzero(void *dst, size_t byteCount)
Zero initialization of memory.
Definition: Util.h:297
__hostdev__ DataType * data()
Definition: NanoVDB.h:3464
const typename GridOrTreeOrRootT::RootNodeType type
Definition: NanoVDB.h:1763
__hostdev__ void setAvg(const StatsT &v)
Definition: NanoVDB.h:3256
__hostdev__ ValueT getValue(uint32_t n) const
Definition: NanoVDB.h:3224
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:512
__hostdev__ void setValue(const CoordT &ijk, const ValueType &v)
Sets the value at the specified location and activate its state.
Definition: NanoVDB.h:4459
__hostdev__ ValueOnIter & operator++()
Definition: NanoVDB.h:2957
__hostdev__ float getAvg() const
return the quantized average of the active values in this node
Definition: NanoVDB.h:3770
Class that encapsulates two CRC32 checksums, one for the Grid, Tree and Root node meta data and one f...
Definition: NanoVDB.h:1817
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:5345
__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:2490
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition: NanoVDB.h:4846
__hostdev__ float getMax() const
return the quantized maximum of the active values in this node
Definition: NanoVDB.h:3767
typename ChildT::ValueType ValueT
Definition: NanoVDB.h:3159
__hostdev__ bool getDev() const
Definition: NanoVDB.h:3986
Implements Tree::getDim(math::Coord)
Definition: NanoVDB.h:1780
Definition: NanoVDB.h:2857
__hostdev__ const ValueType & background() const
Return the total number of active voxels in the root and all its child nodes.
Definition: NanoVDB.h:3033
__hostdev__ DenseIterator beginDense() const
Definition: NanoVDB.h:3455
Codec
Define compression codecs.
Definition: NanoVDB.h:5791
__hostdev__ Vec3T applyIJT(const Vec3T &xyz) const
Definition: NanoVDB.h:2013
__hostdev__ uint32_t countOn() const
Return the total number of set bits in this Mask.
Definition: NanoVDB.h:1062
uint8_t mFlags
Definition: NanoVDB.h:3737
__hostdev__ bool isChild(uint32_t n) const
Definition: NanoVDB.h:3236
Internal nodes of a VDB tree.
Definition: NanoVDB.h:3271
__hostdev__ ValueOnIterator()
Definition: NanoVDB.h:4249
__hostdev__ ValueType getMax() const
Definition: NanoVDB.h:4195
__hostdev__ ConstDenseIterator cbeginChildAll() const
Definition: NanoVDB.h:3012
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:590
__hostdev__ bool isOn() const
Return true if all the bits are set in this Mask.
Definition: NanoVDB.h:1223
__hostdev__ ConstTileIterator probe(const CoordT &ijk) const
Definition: NanoVDB.h:2769
ValueT ValueType
Definition: NanoVDB.h:5245
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition: NanoVDB.h:4845
BuildT TreeType
Definition: NanoVDB.h:2129
Base-class for quantized float leaf nodes.
Definition: NanoVDB.h:3728
math::BBox< CoordT > mBBox
Definition: NanoVDB.h:3177
__hostdev__ const LeafNodeType * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:3069
__hostdev__ void setMin(const ValueT &v)
Definition: NanoVDB.h:2818
__hostdev__ Vec3T worldToIndexF(const Vec3T &xyz) const
world to index space transformation
Definition: NanoVDB.h:2220
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:3979
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType Type
Definition: NanoVDB.h:1733
__hostdev__ uint64_t getMin() const
Definition: NanoVDB.h:4133
__hostdev__ CoordType getOrigin() const
Definition: NanoVDB.h:3447
__hostdev__ bool isCached(const CoordType &ijk) const
Definition: NanoVDB.h:4946
__hostdev__ Vec3T worldToIndex(const Vec3T &xyz) const
world to index space transformation
Definition: NanoVDB.h:2197
Definition: NanoVDB.h:2369
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:4179
C++11 implementation of std::is_same.
Definition: Util.h:314
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition: NanoVDB.h:5263
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:3744
__hostdev__ void setValue(uint32_t offset, bool v)
Definition: NanoVDB.h:3987
__hostdev__ bool isActive() const
Return true if this node or any of its child nodes contain active values.
Definition: NanoVDB.h:3566
__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:2468
__hostdev__ uint64_t getMin() const
Definition: NanoVDB.h:4113
Struct with all the member data of the InternalNode (useful during serialization of an openvdb Intern...
Definition: NanoVDB.h:3157
static __hostdev__ constexpr int64_t memUsage()
Definition: NanoVDB.h:3843
__hostdev__ const NanoGrid< Point > & grid() const
Definition: NanoVDB.h:5631
TileT * mPos
Definition: NanoVDB.h:2693
static __hostdev__ constexpr uint64_t memUsage()
Definition: NanoVDB.h:3874
const typename GridT::TreeType Type
Definition: NanoVDB.h:2413
Dummy type for a 4bit quantization of float point values.
Definition: NanoVDB.h:184
__hostdev__ bool operator!=(const Checksum &rhs) const
return true if the checksums are not identical
Definition: NanoVDB.h:1887
uint32_t Type
Definition: NanoVDB.h:6184
__hostdev__ uint64_t gridSize() const
Return memory usage in bytes for this class only.
Definition: NanoVDB.h:2158
typename ChildT::CoordType CoordT
Definition: NanoVDB.h:3162
uint64_t mCRC64
Definition: NanoVDB.h:1823
__hostdev__ uint64_t & full()
Definition: NanoVDB.h:1855
__hostdev__ void setMin(const ValueType &)
Definition: NanoVDB.h:4042
Return point to the lower internal node where math::Coord maps to one of its values, i.e. terminates.
Definition: NanoVDB.h:6210
static __hostdev__ bool hasStats()
Definition: NanoVDB.h:3981
const typename GridT::TreeType type
Definition: NanoVDB.h:2414
__hostdev__ NodeTrait< RootT, 1 >::type * getFirstLower()
Definition: NanoVDB.h:2562
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition: NanoVDB.h:4959
__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:3495
__hostdev__ const ValueT & getMin() const
Definition: NanoVDB.h:3241
__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:5656
uint8_t mFlags
Definition: NanoVDB.h:3974
T type
Definition: Util.h:408
__hostdev__ uint64_t getAvg() const
Definition: NanoVDB.h:4135
__hostdev__ void setBBoxOn(bool on=true)
Definition: NanoVDB.h:1993
__hostdev__ bool isUnknown() const
Definition: NanoVDB.h:2264
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition: NanoVDB.h:2641
__hostdev__ uint32_t head() const
Definition: NanoVDB.h:1856
T type
Definition: NanoVDB.h:507
__hostdev__ ValueIterator & operator++()
Definition: NanoVDB.h:4343
__hostdev__ uint32_t blindDataCount() const
Return true if this grid is empty, i.e. contains no values or nodes.
Definition: NanoVDB.h:2298
__hostdev__ void setChild(uint32_t n, const void *ptr)
Definition: NanoVDB.h:3199
__hostdev__ Vec3T applyInverseJacobian(const Vec3T &xyz) const
Definition: NanoVDB.h:2011
__hostdev__ bool operator==(const Version &rhs) const
Definition: NanoVDB.h:730
Struct with all the member data of the Grid (useful during serialization of an openvdb grid) ...
Definition: NanoVDB.h:1921
bool ValueType
Definition: NanoVDB.h:4016
typename ChildT::template MaskType< LOG2 > MaskType
Definition: NanoVDB.h:3283
auto callNanoGrid(GridDataT *gridData, ArgsT &&...args)
Below is an example of the struct used for generic programming with callNanoGrid. ...
Definition: NanoVDB.h:4725
Implements Tree::isActive(math::Coord)
Definition: NanoVDB.h:1778
__hostdev__ Vec3T applyInverseMapF(const Vec3T &xyz) const
Apply the inverse affine mapping to a vector using 32bit floating point arithmetics.
Definition: NanoVDB.h:1495
Definition: NanoVDB.h:758
bool FloatType
Definition: NanoVDB.h:4018
__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:4482
__hostdev__ NodeTrait< RootT, 2 >::type * getFirstUpper()
Definition: NanoVDB.h:2564
__hostdev__ void toggle()
brief Toggle the state of all bits in the mask
Definition: NanoVDB.h:1310
__hostdev__ bool isPointIndex() const
Definition: NanoVDB.h:2260
__hostdev__ void setMax(const ValueType &)
Definition: NanoVDB.h:4200
uint32_t mData0
Definition: NanoVDB.h:1939
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:4260
Dummy type for indexing points into voxels.
Definition: NanoVDB.h:196
__hostdev__ const MaskType< LOG2DIM > & getValueMask() const
Definition: NanoVDB.h:3476
__hostdev__ ValueType getValue(const CoordT &ijk) const
Return the voxel value at the given coordinate.
Definition: NanoVDB.h:4449
static __hostdev__ size_t memUsage()
Return memory usage in bytes for the class.
Definition: NanoVDB.h:3472
__hostdev__ NodeT & operator*() const
Definition: NanoVDB.h:3316
typename ChildT::FloatType StatsT
Definition: NanoVDB.h:3161
Definition: NanoVDB.h:916
__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:2472
__hostdev__ const ChildT * getChild(uint32_t n) const
Definition: NanoVDB.h:3218
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:606
bool Type
Definition: NanoVDB.h:527
__hostdev__ const ChildT * probeChild(const CoordT &ijk) const
Definition: NanoVDB.h:2794
Definition: NanoVDB.h:1114
__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:3505
StatsT mAverage
Definition: NanoVDB.h:3184
__hostdev__ float getValue(uint32_t i) const
Definition: NanoVDB.h:3882
Definition: NanoVDB.h:2978
__hostdev__ ValueIterator cbeginValueAll() const
Definition: NanoVDB.h:3377
CoordT mBBoxMin
Definition: NanoVDB.h:3735
__hostdev__ NodeT & operator*() const
Definition: NanoVDB.h:2888
typename ChildT::CoordType CoordT
Definition: NanoVDB.h:2601
__hostdev__ uint64_t getMax() const
Definition: NanoVDB.h:4114
__hostdev__ ValueType getValue(uint32_t offset) const
Return the voxel value at the given offset.
Definition: NanoVDB.h:4446
__hostdev__ ValueIter & operator++()
Definition: NanoVDB.h:2924
typename GridTree< GridT >::type GridTreeT
Definition: NanoVDB.h:2418
MaskT mValueMask
Definition: NanoVDB.h:3179
NANOVDB_HOSTDEV_DISABLE_WARNING __hostdev__ uint32_t findNext(uint32_t start) const
Definition: NanoVDB.h:1362
__hostdev__ CoordType getOrigin() const
Definition: NanoVDB.h:2870
__hostdev__ uint32_t totalNodeCount() const
Definition: NanoVDB.h:2516
uint16_t mMin
Definition: NanoVDB.h:3742
typename ChildT::FloatType StatsT
Definition: NanoVDB.h:2602
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType Type
Definition: NanoVDB.h:1740
typename FloatTraits< ValueType >::FloatType FloatType
Definition: NanoVDB.h:4158
__hostdev__ const ValueT & getMin() const
Definition: NanoVDB.h:2813
const typename GridOrTreeOrRootT::LeafNodeType Type
Definition: NanoVDB.h:1718
__hostdev__ DataType * data()
Definition: NanoVDB.h:2150
MaskT< LOG2DIM > mValues
Definition: NanoVDB.h:3976
__hostdev__ TileIterator beginTile()
Definition: NanoVDB.h:2758
__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:2349
void writeUncompressedGrid(StreamT &os, const GridData *gridData, const ValueT *blindData, GridBlindDataSemantic semantic=GridBlindDataSemantic::Unknown, bool raw=false)
Write an IndexGrid to a stream and append blind data.
Definition: NanoVDB.h:5930
uint32_t mTableSize
Definition: NanoVDB.h:2630
typename BuildT::BuildType BuildType
Definition: NanoVDB.h:2137
typename T::ValueType ElementType
Definition: NanoVDB.h:778
__hostdev__ uint64_t memUsage() const
return memory usage in bytes for the leaf node
Definition: NanoVDB.h:4437
__hostdev__ bool isSequential() const
return true if the specified node type is laid out breadth-first in memory and has a fixed size...
Definition: NanoVDB.h:2275
Definition: NanoVDB.h:4224
typename RootT::CoordType CoordType
Definition: NanoVDB.h:2440
float type
Definition: NanoVDB.h:563
defines a tree type from a grid type while preserving constness
Definition: NanoVDB.h:2405
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition: NanoVDB.h:5135
__hostdev__ GridType mapToGridType()
Definition: NanoVDB.h:886
__hostdev__ uint32_t nodeCount(int level) const
Definition: NanoVDB.h:2510
__hostdev__ ChannelT & operator()(int i, int j, int k) const
Definition: NanoVDB.h:5745
__hostdev__ AccessorType getAccessor() const
Return a new instance of a ReadAccessor used to access values in this grid.
Definition: NanoVDB.h:2187
Visits child nodes of this node only.
Definition: NanoVDB.h:3297
__hostdev__ Coord offsetToGlobalCoord(uint32_t n) const
Definition: NanoVDB.h:3558
typename remove_const< T >::type type
Definition: Util.h:461
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:4030
__hostdev__ void setValue(uint32_t offset, uint16_t value)
Definition: NanoVDB.h:4187
__hostdev__ Checksum()
default constructor initiates checksum to EMPTY
Definition: NanoVDB.h:1831
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:3844
__hostdev__ ValueIterator(const InternalNode *parent)
Definition: NanoVDB.h:3352
typename Mask< 3 >::template Iterator< ON > MaskIterT
Definition: NanoVDB.h:4240
Leaf nodes of the VDB tree. (defaults to 8x8x8 = 512 voxels)
Definition: NanoVDB.h:4221
__hostdev__ bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:4961
__hostdev__ DataType * data()
Definition: NanoVDB.h:3022
__hostdev__ const uint64_t & valueCount() const
Return total number of values indexed by the IndexGrid.
Definition: NanoVDB.h:5723
__hostdev__ NodeTrait< RootT, LEVEL >::type * getFirstNode()
return a pointer to the first node at the specified level
Definition: NanoVDB.h:2545
typename util::match_const< Tile, DataT >::type TileT
Definition: NanoVDB.h:2691
__hostdev__ bool isValue() const
Definition: NanoVDB.h:2664
__hostdev__ Vec3T worldToIndexDir(const Vec3T &dir) const
transformation from world space direction to index space direction
Definition: NanoVDB.h:2211
__hostdev__ DenseIterator cbeginChildAll() const
Definition: NanoVDB.h:3456
BuildT BuildType
Definition: NanoVDB.h:5036
__hostdev__ uint32_t rootTableSize() const
return the root table has size
Definition: NanoVDB.h:2099
bool FloatType
Definition: NanoVDB.h:3968
__hostdev__ bool hasBBox() const
Definition: NanoVDB.h:4479
double mTaperD
Definition: NanoVDB.h:1404
__hostdev__ CoordType getCoord() const
Definition: NanoVDB.h:3452
uint32_t dim
Definition: NanoVDB.h:6287
__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:3043
MaskT mChildMask
Definition: NanoVDB.h:3180
__hostdev__ bool isActive(uint32_t n) const
Definition: NanoVDB.h:4469
__hostdev__ Version()
Default constructor.
Definition: NanoVDB.h:714
__hostdev__ void setMinMaxOn(bool on=true)
Definition: NanoVDB.h:1992
static __hostdev__ uint32_t valueCount()
Definition: NanoVDB.h:4109
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:3660
__hostdev__ const Tile * tile(uint32_t n) const
Returns a pointer to the tile at the specified linear offset.
Definition: NanoVDB.h:2676
__hostdev__ const StatsT & average() const
Definition: NanoVDB.h:3243
__hostdev__ ValueType getFirstValue() const
Return the first value in this leaf node.
Definition: NanoVDB.h:4452
__hostdev__ ValueOnIterator cbeginValueOn() const
Definition: NanoVDB.h:3411
typename GridOrTreeOrRootT::RootNodeType Type
Definition: NanoVDB.h:1754
typename NanoLeaf< BuildT >::ValueType ValueT
Definition: NanoVDB.h:6156
__hostdev__ ValueOnIterator(const InternalNode *parent)
Definition: NanoVDB.h:3391
__hostdev__ ConstValueOnIterator cbeginValueOn() const
Definition: NanoVDB.h:2975
Definition: NanoVDB.h:2646
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition: NanoVDB.h:4921
typename BuildToValueMap< BuildT >::Type ValueT
Definition: NanoVDB.h:6250
FloatType mAverage
Definition: NanoVDB.h:3664
__hostdev__ TileIter(DataT *data, uint32_t pos=0)
Definition: NanoVDB.h:2697
BuildT BuildType
Definition: NanoVDB.h:4807
ValueT ValueType
Definition: NanoVDB.h:5037
__hostdev__ const ChildNodeType * probeChild(const CoordType &ijk) const
Definition: NanoVDB.h:3529
float Type
Definition: NanoVDB.h:534
typename UpperNodeType::ChildNodeType LowerNodeType
Definition: NanoVDB.h:2842
StatsT mStdDevi
Definition: NanoVDB.h:2636
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:4089
__hostdev__ const DataType * data() const
Definition: NanoVDB.h:2152
__hostdev__ uint32_t & head()
Definition: NanoVDB.h:1857
ValueT value
Definition: NanoVDB.h:3168
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition: NanoVDB.h:4175
__hostdev__ TileIter & operator++()
Definition: NanoVDB.h:2708
__hostdev__ bool isCached1(const CoordType &ijk) const
Definition: NanoVDB.h:5112
__hostdev__ bool isActive(uint32_t n) const
Definition: NanoVDB.h:3230
__hostdev__ ValueOnIterator beginValueOn()
Definition: NanoVDB.h:2974
__hostdev__ const ChildT * getChild(const Tile *tile) const
Definition: NanoVDB.h:2807
__hostdev__ bool isEmpty() const
return true if the 64 bit checksum is disables (unset)
Definition: NanoVDB.h:1870
__hostdev__ Iterator(uint32_t pos, const Mask *parent)
Definition: NanoVDB.h:1088
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition: NanoVDB.h:5043
__hostdev__ ValueType getMax() const
Definition: NanoVDB.h:3689
typename GridOrTreeOrRootT::RootNodeType type
Definition: NanoVDB.h:1755
__hostdev__ void * nodePtr()
Return a non-const void pointer to the first node at LEVEL.
Definition: NanoVDB.h:2047
__hostdev__ float getMin() const
return the quantized minimum of the active values in this node
Definition: NanoVDB.h:3764
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:4963
__hostdev__ ValueOffIterator()
Definition: NanoVDB.h:4282
ChildT ChildNodeType
Definition: NanoVDB.h:3279
typename DataType::BuildT BuildType
Definition: NanoVDB.h:3277
__hostdev__ ValueOffIterator cbeginValueOff() const
Definition: NanoVDB.h:4306
typename DataType::ValueType ValueType
Definition: NanoVDB.h:4232
float type
Definition: NanoVDB.h:556
__hostdev__ uint32_t getMajor() const
Definition: NanoVDB.h:736
__hostdev__ Vec3T indexToWorldGradF(const Vec3T &grad) const
Transforms the gradient from index space to world space.
Definition: NanoVDB.h:2239
__hostdev__ const NodeTrait< TreeT, LEVEL >::type * getNode() const
Definition: NanoVDB.h:5293
__hostdev__ bool hasBBox() const
Definition: NanoVDB.h:2266
uint64_t type
Definition: NanoVDB.h:570
__hostdev__ FloatType getAvg() const
Definition: NanoVDB.h:4196
typename ChildT::LeafNodeType LeafNodeType
Definition: NanoVDB.h:3278
typename NanoNode< BuildT, LEVEL >::type NanoNodeT
Definition: NanoVDB.h:4654
__hostdev__ void setValue(const CoordType &k, bool s, const ValueType &v)
Definition: NanoVDB.h:2656
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition: NanoVDB.h:5342
__hostdev__ const uint64_t * words() const
Definition: NanoVDB.h:1172
__hostdev__ const GridBlindMetaData & blindMetaData(uint32_t n) const
Definition: NanoVDB.h:2332
static __hostdev__ uint32_t bitCount()
Return the number of bits available in this Mask.
Definition: NanoVDB.h:1056
__hostdev__ void setDev(const bool &)
Definition: NanoVDB.h:3996
__hostdev__ Vec3T indexToWorldDir(const Vec3T &dir) const
transformation from index space direction to world space direction
Definition: NanoVDB.h:2206
__hostdev__ const void * getRoot() const
Get a const void pointer to the root node (never NULL)
Definition: NanoVDB.h:2386
__hostdev__ const StatsT & stdDeviation() const
Definition: NanoVDB.h:3244
__hostdev__ bool isActive() const
Return true if any of the voxel value are active in this leaf node.
Definition: NanoVDB.h:4472
GridBlindDataClass
Blind-data Classes that are currently supported by NanoVDB.
Definition: NanoVDB.h:403
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:4165
__hostdev__ const void * treePtr() const
Definition: NanoVDB.h:2030
static __hostdev__ size_t memUsage()
Return the memory footprint in bytes of this Mask.
Definition: NanoVDB.h:1053
const typename GridOrTreeOrRootT::RootNodeType Type
Definition: NanoVDB.h:1762
Visits all active values in a leaf node.
Definition: NanoVDB.h:4243
__hostdev__ const LeafNodeType * getFirstLeaf() const
Definition: NanoVDB.h:2561
__hostdev__ Vec3T indexToWorldDirF(const Vec3T &dir) const
transformation from index space direction to world space direction
Definition: NanoVDB.h:2229