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 8 // 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) 209 template <
class EnumT>
552 template <
typename T>
637 switch (blindClass) {
689 : mData(major << 21 | minor << 10 | patch)
728 static const int Rank = 0;
729 static const bool IsScalar =
true;
730 static const bool IsVector =
false;
731 static const int Size = 1;
733 static T
scalar(
const T& s) {
return s; }
739 static const int Rank = 1;
740 static const bool IsScalar =
false;
741 static const bool IsVector =
true;
742 static const int Size = T::SIZE;
749 template<typename T, int = sizeof(typename TensorTraits<T>::ElementType)>
806 template<
typename BuildT>
865 template<
typename BuildT>
866 [[deprecated(
"Use toGridType<T>() instead.")]]
872 template<
typename BuildT>
887 template<
typename BuildT>
888 [[deprecated(
"Use toGridClass<T>() instead.")]]
891 return toGridClass<BuildT>();
929 BitFlags(std::initializer_list<uint8_t> list)
931 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
933 template<
typename MaskT>
934 BitFlags(std::initializer_list<MaskT> list)
936 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
940 __hostdev__ void initBit(std::initializer_list<uint8_t> list)
943 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
945 template<
typename MaskT>
946 __hostdev__ void initMask(std::initializer_list<MaskT> list)
949 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
956 __hostdev__ void setBitOn(uint8_t bit) { mFlags |=
static_cast<Type>(1 << bit); }
957 __hostdev__ void setBitOff(uint8_t bit) { mFlags &= ~static_cast<
Type>(1 << bit); }
959 __hostdev__ void setBitOn(std::initializer_list<uint8_t> list)
961 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
963 __hostdev__ void setBitOff(std::initializer_list<uint8_t> list)
965 for (
auto bit : list) mFlags &= ~static_cast<
Type>(1 << bit);
968 template<
typename MaskT>
969 __hostdev__ void setMaskOn(MaskT mask) { mFlags |=
static_cast<Type>(mask); }
970 template<
typename MaskT>
971 __hostdev__ void setMaskOff(MaskT mask) { mFlags &= ~static_cast<
Type>(mask); }
973 template<
typename MaskT>
974 __hostdev__ void setMaskOn(std::initializer_list<MaskT> list)
976 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
978 template<
typename MaskT>
979 __hostdev__ void setMaskOff(std::initializer_list<MaskT> list)
981 for (
auto mask : list) mFlags &= ~static_cast<
Type>(mask);
984 __hostdev__ void setBit(uint8_t bit,
bool on) { on ? this->setBitOn(bit) : this->setBitOff(bit); }
985 template<
typename MaskT>
986 __hostdev__ void setMask(MaskT mask,
bool on) { on ? this->setMaskOn(mask) : this->setMaskOff(mask); }
990 __hostdev__ bool isBitOn(uint8_t bit)
const {
return 0 != (mFlags &
static_cast<Type>(1 << bit)); }
991 __hostdev__ bool isBitOff(uint8_t bit)
const {
return 0 == (mFlags &
static_cast<Type>(1 << bit)); }
992 template<
typename MaskT>
993 __hostdev__ bool isMaskOn(MaskT mask)
const {
return 0 != (mFlags &
static_cast<Type>(mask)); }
994 template<
typename MaskT>
995 __hostdev__ bool isMaskOff(MaskT mask)
const {
return 0 == (mFlags &
static_cast<Type>(mask)); }
997 template<
typename MaskT>
998 __hostdev__ bool isMaskOn(std::initializer_list<MaskT> list)
const 1000 for (
auto mask : list) {
1001 if (0 != (mFlags & static_cast<Type>(mask)))
return true;
1006 template<
typename MaskT>
1007 __hostdev__ bool isMaskOff(std::initializer_list<MaskT> list)
const 1009 for (
auto mask : list) {
1010 if (0 == (mFlags & static_cast<Type>(mask)))
return true;
1026 template<u
int32_t LOG2DIM>
1030 static constexpr uint32_t SIZE = 1U << (3 * LOG2DIM);
1031 static constexpr uint32_t WORD_COUNT = SIZE >> 6;
1046 for (
const uint64_t *w = mWords, *q = w + WORD_COUNT; w != q; ++w)
1054 uint32_t n = i >> 6, sum =
util::countOn(mWords[n] & ((uint64_t(1) << (i & 63u)) - 1u));
1055 for (
const uint64_t* w = mWords; n--; ++w)
1080 mPos = mParent->findNext<On>(mPos + 1);
1092 const Mask* mParent;
1134 for (uint32_t i = 0; i < WORD_COUNT; ++i)
1139 const uint64_t v = on ? ~uint64_t(0) : uint64_t(0);
1140 for (uint32_t i = 0; i < WORD_COUNT; ++i)
1147 for (uint32_t i = 0; i < WORD_COUNT; ++i)
1148 mWords[i] = other.mWords[i];
1155 template<
typename WordT>
1160 return reinterpret_cast<WordT*
>(mWords)[n];
1162 template<
typename WordT>
1167 reinterpret_cast<WordT*
>(mWords)[n] = w;
1171 template<
typename MaskT = Mask>
1174 static_assert(
sizeof(
Mask) ==
sizeof(MaskT),
"Mismatching sizeof");
1175 static_assert(WORD_COUNT == MaskT::WORD_COUNT,
"Mismatching word count");
1176 static_assert(LOG2DIM == MaskT::LOG2DIM,
"Mismatching LOG2DIM");
1177 auto* src =
reinterpret_cast<const uint64_t*
>(&other);
1178 for (uint64_t *dst = mWords, *end = dst + WORD_COUNT; dst != end; ++dst)
1184 Mask& operator=(
const Mask&) =
default;
1188 for (uint32_t i = 0; i < WORD_COUNT; ++i) {
1189 if (mWords[i] != other.mWords[i])
1198 __hostdev__ bool isOn(uint32_t n)
const {
return 0 != (mWords[n >> 6] & (uint64_t(1) << (n & 63))); }
1201 __hostdev__ bool isOff(uint32_t n)
const {
return 0 == (mWords[n >> 6] & (uint64_t(1) << (n & 63))); }
1206 for (uint32_t i = 0; i < WORD_COUNT; ++i)
1207 if (mWords[i] != ~uint64_t(0))
1215 for (uint32_t i = 0; i < WORD_COUNT; ++i)
1216 if (mWords[i] != uint64_t(0))
1226 #if defined(__CUDACC__) // the following functions only run on the GPU! 1227 __device__ inline void setOnAtomic(uint32_t n)
1229 atomicOr(reinterpret_cast<unsigned long long int*>(
this) + (n >> 6), 1ull << (n & 63));
1231 __device__ inline void setOffAtomic(uint32_t n)
1233 atomicAnd(reinterpret_cast<unsigned long long int*>(
this) + (n >> 6), ~(1ull << (n & 63)));
1235 __device__ inline void setAtomic(uint32_t n,
bool on)
1237 on ? this->setOnAtomic(n) : this->setOffAtomic(n);
1262 #if 1 // switch between branchless 1263 auto& word = mWords[n >> 6];
1265 word &= ~(uint64_t(1) << n);
1266 word |= uint64_t(on) << n;
1268 on ? this->setOn(n) : this->setOff(n);
1275 for (uint32_t i = 0; i < WORD_COUNT; ++i)mWords[i] = ~uint64_t(0);
1281 for (uint32_t i = 0; i < WORD_COUNT; ++i) mWords[i] = uint64_t(0);
1287 const uint64_t v = on ? ~uint64_t(0) : uint64_t(0);
1288 for (uint32_t i = 0; i < WORD_COUNT; ++i) mWords[i] = v;
1293 uint32_t n = WORD_COUNT;
1294 for (
auto* w = mWords; n--; ++w) *w = ~*w;
1301 uint64_t* w1 = mWords;
1302 const uint64_t* w2 = other.mWords;
1303 for (uint32_t n = WORD_COUNT; n--; ++w1, ++w2) *w1 &= *w2;
1309 uint64_t* w1 = mWords;
1310 const uint64_t* w2 = other.mWords;
1311 for (uint32_t n = WORD_COUNT; n--; ++w1, ++w2) *w1 |= *w2;
1317 uint64_t* w1 = mWords;
1318 const uint64_t* w2 = other.mWords;
1319 for (uint32_t n = WORD_COUNT; n--; ++w1, ++w2) *w1 &= ~*w2;
1325 uint64_t* w1 = mWords;
1326 const uint64_t* w2 = other.mWords;
1327 for (uint32_t n = WORD_COUNT; n--; ++w1, ++w2) *w1 ^= *w2;
1336 const uint64_t* w = mWords;
1337 for (; n < WORD_COUNT && !(ON ? *w : ~*w); ++w, ++n);
1345 uint32_t n = start >> 6;
1346 if (n >= WORD_COUNT)
return SIZE;
1347 uint32_t m = start & 63u;
1348 uint64_t b = ON ? mWords[n] : ~mWords[n];
1349 if (b & (uint64_t(1u) << m))
return start;
1350 b &= ~uint64_t(0u) << m;
1351 while (!b && ++n < WORD_COUNT) b = ON ? mWords[n] : ~mWords[n];
1359 uint32_t n = start >> 6;
1360 if (n >= WORD_COUNT)
return SIZE;
1361 uint32_t m = start & 63u;
1362 uint64_t b = ON ? mWords[n] : ~mWords[n];
1363 if (b & (uint64_t(1u) << m))
return start;
1364 b &= (uint64_t(1u) << m) - 1u;
1365 while (!b && n) b = ON ? mWords[--n] : ~mWords[--n];
1370 uint64_t mWords[WORD_COUNT];
1389 : mMatF{ 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}
1390 , mInvMatF{1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}
1391 , mVecF{0.0f, 0.0f, 0.0f}
1393 , mMatD{ 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}
1394 , mInvMatD{1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}
1395 , mVecD{0.0, 0.0, 0.0}
1400 : mMatF{float(s), 0.0f, 0.0f, 0.0f, float(s), 0.0f, 0.0f, 0.0f, float(s)}
1401 , 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)}
1402 , mVecF{float(t[0]), float(t[1]), float(t[2])}
1404 , mMatD{s, 0.0, 0.0, 0.0, s, 0.0, 0.0, 0.0, s}
1405 , mInvMatD{1.0 / s, 0.0, 0.0, 0.0, 1.0 / s, 0.0, 0.0, 0.0, 1.0 / s}
1406 , mVecD{t[0], t[1], t[2]}
1413 template<
typename MatT,
typename Vec3T>
1414 void set(
const MatT& mat,
const MatT& invMat,
const Vec3T& translate,
double taper = 1.0);
1419 template<
typename Mat4T>
1420 void set(
const Mat4T& mat,
const Mat4T& invMat,
double taper = 1.0) { this->
set(mat, invMat, mat[3], taper); }
1422 template<
typename Vec3T>
1423 void set(
double scale,
const Vec3T& translation,
double taper = 1.0);
1430 template<
typename Vec3T>
1438 template<
typename Vec3T>
1447 template<
typename Vec3T>
1456 template<
typename Vec3T>
1464 template<
typename Vec3T>
1467 return math::matMult(mInvMatD, Vec3T(xyz[0] - mVecD[0], xyz[1] - mVecD[1], xyz[2] - mVecD[2]));
1475 template<
typename Vec3T>
1478 return math::matMult(mInvMatF, Vec3T(xyz[0] - mVecF[0], xyz[1] - mVecF[1], xyz[2] - mVecF[2]));
1487 template<
typename Vec3T>
1496 template<
typename Vec3T>
1505 template<
typename Vec3T>
1507 template<
typename Vec3T>
1514 template<
typename MatT,
typename Vec3T>
1515 inline void Map::set(
const MatT& mat,
const MatT& invMat,
const Vec3T& translate,
double taper)
1517 float * mf = mMatF, *vf = mVecF, *mif = mInvMatF;
1518 double *md = mMatD, *vd = mVecD, *mid = mInvMatD;
1519 mTaperF =
static_cast<float>(taper);
1521 for (
int i = 0; i < 3; ++i) {
1522 *vd++ = translate[i];
1523 *vf++ =
static_cast<float>(translate[i]);
1524 for (
int j = 0; j < 3; ++j) {
1526 *mid++ = invMat[j][i];
1527 *mf++ =
static_cast<float>(mat[j][i]);
1528 *mif++ =
static_cast<float>(invMat[j][i]);
1533 template<
typename Vec3T>
1534 inline void Map::set(
double dx,
const Vec3T& trans,
double taper)
1537 const double mat[3][3] = { {dx, 0.0, 0.0},
1540 const double idx = 1.0 / dx;
1541 const double invMat[3][3] = { {idx, 0.0, 0.0},
1544 this->
set(mat, invMat, trans, taper);
1551 static const int MaxNameSize = 256;
1558 char mName[MaxNameSize];
1574 : mDataOffset(dataOffset)
1575 , mValueCount(valueCount)
1576 , mValueSize(valueSize)
1577 , mSemantic(semantic)
1578 , mDataClass(dataClass)
1579 , mDataType(dataType)
1586 : mDataOffset(util::
PtrDiff(util::
PtrAdd(&other, other.mDataOffset), this))
1587 , mValueCount(other.mValueCount)
1588 , mValueSize(other.mValueSize)
1589 , mSemantic(other.mSemantic)
1590 , mDataClass(other.mDataClass)
1591 , mDataType(other.mDataType)
1603 mValueSize = rhs. mValueSize;
1633 template<
typename BlindDataT>
1636 return mDataOffset && (mDataType == toGridType<BlindDataT>()) ? util::PtrAdd<BlindDataT>(
this, mDataOffset) :
nullptr;
1643 auto check = [&]()->
bool{
1661 default:
return true;}
1671 return math::AlignUp<NANOVDB_DATA_ALIGNMENT>(mValueCount * mValueSize);
1679 template<
typename Gr
idOrTreeOrRootT,
int LEVEL>
1683 template<
typename Gr
idOrTreeOrRootT>
1686 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1687 using Type =
typename GridOrTreeOrRootT::LeafNodeType;
1688 using type =
typename GridOrTreeOrRootT::LeafNodeType;
1690 template<
typename Gr
idOrTreeOrRootT>
1693 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1694 using Type =
const typename GridOrTreeOrRootT::LeafNodeType;
1695 using type =
const typename GridOrTreeOrRootT::LeafNodeType;
1698 template<
typename Gr
idOrTreeOrRootT>
1701 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1702 using Type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1703 using type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1705 template<
typename Gr
idOrTreeOrRootT>
1708 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1709 using Type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1710 using type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1712 template<
typename Gr
idOrTreeOrRootT>
1715 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1716 using Type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1717 using type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1719 template<
typename Gr
idOrTreeOrRootT>
1722 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1723 using Type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1724 using type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1726 template<
typename Gr
idOrTreeOrRootT>
1729 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1730 using Type =
typename GridOrTreeOrRootT::RootNodeType;
1731 using type =
typename GridOrTreeOrRootT::RootNodeType;
1734 template<
typename Gr
idOrTreeOrRootT>
1737 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1738 using Type =
const typename GridOrTreeOrRootT::RootNodeType;
1739 using type =
const typename GridOrTreeOrRootT::RootNodeType;
1744 template<
typename BuildT>
1746 template<
typename BuildT>
1748 template<
typename BuildT>
1750 template<
typename BuildT>
1752 template<
typename BuildT>
1754 template<
typename BuildT>
1756 template<
typename BuildT>
1758 template<
typename BuildT>
1796 union { uint32_t mCRC32[2]; uint64_t
mCRC64; };
1800 static constexpr uint32_t EMPTY32 = ~uint32_t{0};
1801 static constexpr uint64_t EMPTY64 = ~uint64_t(0);
1820 [[deprecated(
"Use Checksum::data instead.")]]
1822 [[deprecated(
"Use Checksum::head and Ckecksum::tail instead.")]]
1824 [[deprecated(
"Use Checksum::head and Ckecksum::tail instead.")]]
1835 [[deprecated(
"Use Checksum::isHalf instead.")]]
1896 static const int MaxNameSize = 256;
1904 char mGridName[MaxNameSize];
1919 uint64_t gridSize = 0u,
1924 #ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS 1931 mFlags.initMask(list);
1934 mGridSize = gridSize;
1935 mGridName[0] =
'\0';
1937 mWorldBBox = Vec3dBBox();
1938 mVoxelSize = map.getVoxelSize();
1939 mGridClass = gridClass;
1940 mGridType = gridType;
1941 mBlindMetadataOffset = mGridSize;
1942 mBlindMetadataCount = 0u;
1945 #ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS 1960 if (test) test = mGridCount > 0u && mGridIndex < mGridCount;
1972 const bool success = (
util::strncpy(mGridName, src, MaxNameSize)[MaxNameSize-1] ==
'\0');
1973 if (!success) mGridName[MaxNameSize-1] =
'\0';
1977 template<
typename Vec3T>
1979 template<
typename Vec3T>
1981 template<
typename Vec3T>
1983 template<
typename Vec3T>
1985 template<
typename Vec3T>
1988 template<
typename Vec3T>
1990 template<
typename Vec3T>
1992 template<
typename Vec3T>
1994 template<
typename Vec3T>
1996 template<
typename Vec3T>
2007 template <u
int32_t LEVEL>
2010 static_assert(LEVEL >= 0 && LEVEL <= 3,
"invalid LEVEL template parameter");
2011 const void *treeData =
this + 1;
2012 const uint64_t nodeOffset = *util::PtrAdd<uint64_t>(treeData, 8*LEVEL);
2013 return nodeOffset ?
util::PtrAdd(treeData, nodeOffset) :
nullptr;
2019 template <u
int32_t LEVEL>
2022 static_assert(LEVEL >= 0 && LEVEL <= 3,
"invalid LEVEL template parameter");
2023 void *treeData =
this + 1;
2024 const uint64_t nodeOffset = *util::PtrAdd<uint64_t>(treeData, 8*LEVEL);
2025 return nodeOffset ?
util::PtrAdd(treeData, nodeOffset) :
nullptr;
2030 template <u
int32_t LEVEL>
2033 static_assert(LEVEL >= 0 && LEVEL < 3,
"invalid LEVEL template parameter");
2034 return *util::PtrAdd<uint32_t>(
this + 1, 4*(8 + LEVEL));
2043 return util::PtrAdd<GridBlindMetaData>(
this, mBlindMetadataOffset) + n;
2050 for (uint32_t i = 0; i < mBlindMetadataCount; ++i) {
2051 const auto* metaData = this->blindMetaData(i);
2054 return metaData->template getBlindData<const char>();
2074 const void *root = this->nodePtr<3>();
2075 return root ? *util::PtrAdd<uint32_t>(root,
sizeof(CoordBBox)) : 0u;
2088 template<
typename BuildT,
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1>
2091 template<
typename BuildT>
2098 template<
typename TreeT>
2118 Grid& operator=(
const Grid&) =
delete;
2142 template<
typename T = BuildType>
2149 template<
typename T = BuildType>
2154 __hostdev__ const TreeT&
tree()
const {
return *
reinterpret_cast<const TreeT*
>(this->treePtr()); }
2169 template<
typename Vec3T>
2173 template<
typename Vec3T>
2178 template<
typename Vec3T>
2183 template<
typename Vec3T>
2188 template<
typename Vec3T>
2192 template<
typename Vec3T>
2196 template<
typename Vec3T>
2201 template<
typename Vec3T>
2206 template<
typename Vec3T>
2211 template<
typename Vec3T>
2247 template<
typename NodeT>
2256 __hostdev__ bool isSequential()
const {
return UpperNodeType::FIXED_SIZE && LowerNodeType::FIXED_SIZE && LeafNodeType::FIXED_SIZE && this->isBreadthFirst(); }
2274 __hostdev__ int findBlindData(
const char* name)
const;
2283 [[deprecated(
"Use Grid::getBlindData<T>() instead.")]]
2286 printf(
"\nnanovdb::Grid::blindData is unsafe and hence deprecated! Please use nanovdb::Grid::getBlindData instead.\n\n");
2288 return this->blindMetaData(n).blindData();
2291 template <
typename BlindDataT>
2294 if (n >= DataType::mBlindMetadataCount)
return nullptr;
2295 return this->blindMetaData(n).template getBlindData<BlindDataT>();
2298 template <
typename BlindDataT>
2301 if (n >= DataType::mBlindMetadataCount)
return nullptr;
2302 return const_cast<BlindDataT*
>(this->blindMetaData(n).template getBlindData<BlindDataT>());
2311 template<
typename TreeT>
2314 for (uint32_t i = 0, n = this->blindDataCount(); i < n; ++i) {
2315 if (this->blindMetaData(i).mSemantic == semantic)
2321 template<
typename TreeT>
2324 auto test = [&](
int n) {
2325 const char* str = this->blindMetaData(n).mName;
2327 if (name[i] != str[i])
2329 if (name[i] ==
'\0' && str[i] ==
'\0')
2334 for (
int i = 0, n = this->blindDataCount(); i < n; ++i)
2344 int64_t mNodeOffset[4];
2345 uint32_t mNodeCount[3];
2346 uint32_t mTileCount[3];
2361 template<
typename NodeT>
2365 __hostdev__ bool isEmpty()
const {
return mNodeOffset[3] ? *util::PtrAdd<uint32_t>(
this, mNodeOffset[3] +
sizeof(CoordBBox)) == 0 :
true;}
2368 __hostdev__ CoordBBox
bbox()
const {
return mNodeOffset[3] ? *util::PtrAdd<CoordBBox>(
this, mNodeOffset[3]) : CoordBBox();}
2377 template<
typename Gr
idT>
2380 using Type =
typename GridT::TreeType;
2381 using type =
typename GridT::TreeType;
2383 template<
typename Gr
idT>
2386 using Type =
const typename GridT::TreeType;
2387 using type =
const typename GridT::TreeType;
2393 template<
typename RootT>
2396 static_assert(RootT::LEVEL == 3,
"Tree depth is not supported");
2397 static_assert(RootT::ChildNodeType::LOG2DIM == 5,
"Tree configuration is not supported");
2398 static_assert(RootT::ChildNodeType::ChildNodeType::LOG2DIM == 4,
"Tree configuration is not supported");
2399 static_assert(RootT::LeafNodeType::LOG2DIM == 3,
"Tree configuration is not supported");
2414 using Node2 =
typename RootT::ChildNodeType;
2415 using Node1 =
typename Node2::ChildNodeType;
2421 Tree& operator=(
const Tree&) =
delete;
2433 __hostdev__ const RootT&
root()
const {
return *
reinterpret_cast<const RootT*
>(DataType::getRoot());}
2470 return DataType::mTileCount[level - 1];
2473 template<
typename NodeT>
2476 static_assert(NodeT::LEVEL < 3,
"Invalid NodeT");
2477 return DataType::mNodeCount[NodeT::LEVEL];
2483 return DataType::mNodeCount[level];
2488 return DataType::mNodeCount[0] + DataType::mNodeCount[1] + DataType::mNodeCount[2];
2494 template<
typename NodeT>
2497 const int64_t nodeOffset = DataType::mNodeOffset[NodeT::LEVEL];
2498 return nodeOffset ? util::PtrAdd<NodeT>(
this, nodeOffset) :
nullptr;
2504 template<
typename NodeT>
2507 const int64_t nodeOffset = DataType::mNodeOffset[NodeT::LEVEL];
2508 return nodeOffset ? util::PtrAdd<NodeT>(
this, nodeOffset) :
nullptr;
2517 return this->
template getFirstNode<typename NodeTrait<RootT, LEVEL>::type>();
2526 return this->
template getFirstNode<typename NodeTrait<RootT, LEVEL>::type>();
2537 template<
typename OpT,
typename... ArgsT>
2540 return this->root().template get<OpT>(ijk, args...);
2543 template<
typename OpT,
typename... ArgsT>
2546 return this->root().template set<OpT>(ijk, args...);
2554 template<
typename RootT>
2557 min = this->root().minimum();
2558 max = this->root().maximum();
2566 template<
typename ChildT>
2573 static constexpr
bool FIXED_SIZE =
false;
2576 #ifdef NANOVDB_USE_SINGLE_ROOT_KEY 2578 template<
typename CoordType>
2581 static_assert(
sizeof(
CoordT) ==
sizeof(CoordType),
"Mismatching sizeof");
2582 static_assert(32 - ChildT::TOTAL <= 21,
"Cannot use 64 bit root keys");
2583 return (
KeyT(uint32_t(ijk[2]) >> ChildT::TOTAL)) |
2584 (
KeyT(uint32_t(ijk[1]) >> ChildT::TOTAL) << 21) |
2585 (
KeyT(uint32_t(ijk[0]) >> ChildT::TOTAL) << 42);
2589 static constexpr uint64_t MASK = (1u << 21) - 1;
2590 return CoordT(((key >> 42) & MASK) << ChildT::TOTAL,
2591 ((key >> 21) & MASK) << ChildT::TOTAL,
2592 (key & MASK) << ChildT::TOTAL);
2616 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
Tile 2618 template<
typename CoordType>
2621 key = CoordToKey(k);
2625 template<
typename CoordType,
typename ValueType>
2628 key = CoordToKey(k);
2649 return reinterpret_cast<const Tile*
>(
this + 1) + n;
2654 return reinterpret_cast<Tile*
>(
this + 1) + n;
2657 template<
typename DataT>
2668 : mBegin(reinterpret_cast<
TileT*>(data + 1))
2669 , mPos(mBegin + pos)
2670 , mEnd(mBegin + data->mTableSize)
2696 return reinterpret_cast<DataT*
>(mBegin) - 1;
2701 return mPos->child != 0;
2706 return mPos->child == 0;
2711 return mPos->child == 0 && mPos->state != 0;
2716 return util::PtrAdd<NodeT>(this->data(), mPos->child);
2733 const auto key = CoordToKey(ijk);
2735 for(; iter; ++iter)
if (iter->key == key)
break;
2741 const auto key = CoordToKey(ijk);
2743 for(; iter; ++iter)
if (iter->key == key)
break;
2749 auto iter = this->probe(ijk);
2750 return iter ? iter.operator->() :
nullptr;
2755 return const_cast<RootData*
>(
this)->probeTile(ijk);
2760 auto iter = this->probe(ijk);
2761 return iter && iter.isChild() ? iter.child() :
nullptr;
2766 return const_cast<RootData*
>(
this)->probeChild(ijk);
2775 return util::PtrAdd<ChildT>(
this, tile->
child);
2780 return util::PtrAdd<ChildT>(
this, tile->
child);
2803 template<
typename ChildT>
2822 static constexpr
bool FIXED_SIZE = DataType::FIXED_SIZE;
2824 static constexpr uint32_t LEVEL = 1 + ChildT::LEVEL;
2826 template<
typename RootT>
2844 template<
typename RootT>
2850 using BaseT::mTileIter;
2856 while (mTileIter && mTileIter.isValue()) ++mTileIter;
2863 while (mTileIter && mTileIter.isValue()) ++mTileIter;
2880 template<
typename RootT>
2884 using BaseT::mTileIter;
2890 while (mTileIter && mTileIter.isChild()) ++mTileIter;
2897 while (mTileIter && mTileIter.isChild()) ++mTileIter;
2914 template<
typename RootT>
2918 using BaseT::mTileIter;
2924 while (mTileIter && !mTileIter.isValueOn()) ++mTileIter;
2930 while (mTileIter && !mTileIter.isValueOn()) ++mTileIter;
2947 template<
typename RootT>
2952 using BaseT::mTileIter;
2959 if (mTileIter.isChild())
return mTileIter.child();
2960 value = mTileIter.value();
3041 template<
typename OpT,
typename... ArgsT>
3044 if (
const Tile* tile = this->probeTile(ijk)) {
3045 if constexpr(OpT::LEVEL < LEVEL)
if (tile->isChild())
return this->getChild(tile)->template get<OpT>(ijk, args...);
3046 return OpT::get(*tile, args...);
3048 return OpT::get(*
this, args...);
3051 template<
typename OpT,
typename... ArgsT>
3054 if (
Tile* tile = DataType::probeTile(ijk)) {
3055 if constexpr(OpT::LEVEL < LEVEL)
if (tile->isChild())
return this->getChild(tile)->template set<OpT>(ijk, args...);
3056 return OpT::set(*tile, args...);
3058 return OpT::set(*
this, args...);
3065 template<
typename,
int,
int,
int>
3071 template<
typename RayT,
typename AccT>
3072 __hostdev__ uint32_t getDimAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const 3074 if (
const Tile* tile = this->probeTile(ijk)) {
3075 if (tile->isChild()) {
3076 const auto* child = this->getChild(tile);
3077 acc.insert(ijk, child);
3078 return child->getDimAndCache(ijk, ray, acc);
3080 return 1 << ChildT::TOTAL;
3082 return ChildNodeType::dim();
3085 template<
typename OpT,
typename AccT,
typename... ArgsT>
3086 __hostdev__ typename OpT::Type getAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
const 3088 if (
const Tile* tile = this->probeTile(ijk)) {
3089 if constexpr(OpT::LEVEL < LEVEL) {
3090 if (tile->isChild()) {
3091 const ChildT* child = this->getChild(tile);
3092 acc.insert(ijk, child);
3093 return child->template getAndCache<OpT>(ijk, acc, args...);
3096 return OpT::get(*tile, args...);
3098 return OpT::get(*
this, args...);
3101 template<
typename OpT,
typename AccT,
typename... ArgsT>
3104 if (
Tile* tile = DataType::probeTile(ijk)) {
3105 if constexpr(OpT::LEVEL < LEVEL) {
3106 if (tile->isChild()) {
3107 ChildT* child = this->getChild(tile);
3108 acc.insert(ijk, child);
3109 return child->template setAndCache<OpT>(ijk, acc, args...);
3112 return OpT::set(*tile, args...);
3114 return OpT::set(*
this, args...);
3126 template<
typename ChildT, u
int32_t LOG2DIM>
3133 using MaskT =
typename ChildT::template MaskType<LOG2DIM>;
3134 static constexpr
bool FIXED_SIZE =
true;
3143 Tile& operator=(
const Tile&) =
delete;
3165 alignas(32) Tile mTable[1u << (3 * LOG2DIM)];
3175 template<
typename ValueT>
3179 mTable[n].value = v;
3186 return util::PtrAdd<ChildT>(
this, mTable[n].child);
3191 return util::PtrAdd<ChildT>(
this, mTable[n].child);
3197 return mTable[n].value;
3203 return mValueMask.isOn(n);
3208 template<
typename T>
3220 #if defined(__GNUC__) && (__GNUC__ < 14) && !defined(__APPLE__) && !defined(__llvm__) 3221 #pragma GCC diagnostic push 3222 #pragma GCC diagnostic ignored "-Wstringop-overflow" 3228 #if defined(__GNUC__) && (__GNUC__ < 14) && !defined(__APPLE__) && !defined(__llvm__) 3229 #pragma GCC diagnostic pop 3240 template<
typename ChildT, u
int32_t Log2Dim = ChildT::LOG2DIM + 1>
3251 static constexpr
bool FIXED_SIZE = DataType::FIXED_SIZE;
3252 template<u
int32_t LOG2>
3257 static constexpr uint32_t LOG2DIM = Log2Dim;
3258 static constexpr uint32_t TOTAL = LOG2DIM + ChildT::TOTAL;
3259 static constexpr uint32_t DIM = 1u << TOTAL;
3260 static constexpr uint32_t SIZE = 1u << (3 * LOG2DIM);
3261 static constexpr uint32_t MASK = (1u << TOTAL) - 1u;
3262 static constexpr uint32_t LEVEL = 1 + ChildT::LEVEL;
3263 static constexpr uint64_t NUM_VALUES = uint64_t(1) << (3 * TOTAL);
3266 template <
typename ParentT>
3281 : BaseT(parent->mChildMask.beginOn())
3289 return *mParent->getChild(BaseT::pos());
3294 return mParent->getChild(BaseT::pos());
3299 return (*this)->origin();
3323 : BaseT(parent->data()->mChildMask.beginOff())
3362 : BaseT(parent->data()->mValueMask.beginOn())
3397 , mParent(parent->data())
3404 const ChildT* child =
nullptr;
3405 if (mParent->
mChildMask.isOn(BaseT::pos())) {
3406 child = mParent->
getChild(BaseT::pos());
3408 value = mParent->
getValue(BaseT::pos());
3415 return mParent->
isActive(BaseT::pos());
3420 return mParent->offsetToGlobalCoord(BaseT::pos());
3477 return DataType::mChildMask.isOn(0) ? this->getChild(0)->getFirstValue() : DataType::getValue(0);
3484 return DataType::mChildMask.isOn(SIZE - 1) ? this->getChild(SIZE - 1)->getLastValue() : DataType::getValue(SIZE - 1);
3496 const uint32_t n = CoordToOffset(ijk);
3497 return DataType::mChildMask.isOn(n) ? this->getChild(n) :
nullptr;
3501 const uint32_t n = CoordToOffset(ijk);
3502 return DataType::mChildMask.isOn(n) ? this->getChild(n) :
nullptr;
3508 return (((ijk[0] & MASK) >> ChildT::TOTAL) << (2 * LOG2DIM)) |
3509 (((ijk[1] & MASK) >> ChildT::TOTAL) << (LOG2DIM)) |
3510 ((ijk[2] & MASK) >> ChildT::TOTAL);
3517 const uint32_t m = n & ((1 << 2 * LOG2DIM) - 1);
3518 return Coord(n >> 2 * LOG2DIM, m >> LOG2DIM, m & ((1 << LOG2DIM) - 1));
3524 ijk <<= ChildT::TOTAL;
3525 ijk += this->origin();
3531 this->localToGlobalCoord(ijk);
3538 template<
typename OpT,
typename... ArgsT>
3541 const uint32_t n = CoordToOffset(ijk);
3542 if constexpr(OpT::LEVEL < LEVEL)
if (this->isChild(n))
return this->getChild(n)->template get<OpT>(ijk, args...);
3543 return OpT::get(*
this, n, args...);
3546 template<
typename OpT,
typename... ArgsT>
3549 const uint32_t n = CoordToOffset(ijk);
3550 if constexpr(OpT::LEVEL < LEVEL)
if (this->isChild(n))
return this->getChild(n)->template set<OpT>(ijk, args...);
3551 return OpT::set(*
this, n, args...);
3557 template<
typename,
int,
int,
int>
3562 template<
typename, u
int32_t>
3565 template<
typename RayT,
typename AccT>
3566 __hostdev__ uint32_t getDimAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const 3568 if (DataType::mFlags & uint32_t(1u))
3572 const uint32_t n = CoordToOffset(ijk);
3573 if (DataType::mChildMask.isOn(n)) {
3574 const ChildT* child = this->getChild(n);
3575 acc.insert(ijk, child);
3576 return child->getDimAndCache(ijk, ray, acc);
3578 return ChildNodeType::dim();
3581 template<
typename OpT,
typename AccT,
typename... ArgsT>
3582 __hostdev__ typename OpT::Type getAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
const 3584 const uint32_t n = CoordToOffset(ijk);
3585 if constexpr(OpT::LEVEL < LEVEL) {
3586 if (this->isChild(n)) {
3587 const ChildT* child = this->getChild(n);
3588 acc.insert(ijk, child);
3589 return child->template getAndCache<OpT>(ijk, acc, args...);
3592 return OpT::get(*
this, n, args...);
3595 template<
typename OpT,
typename AccT,
typename... ArgsT>
3598 const uint32_t n = CoordToOffset(ijk);
3599 if constexpr(OpT::LEVEL < LEVEL) {
3600 if (this->isChild(n)) {
3601 ChildT* child = this->getChild(n);
3602 acc.insert(ijk, child);
3603 return child->template setAndCache<OpT>(ijk, acc, args...);
3606 return OpT::set(*
this, n, args...);
3616 template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3619 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3620 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3625 static constexpr
bool FIXED_SIZE =
true;
3628 uint8_t mBBoxDif[3];
3643 return sizeof(
LeafData) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>) + 2 * (
sizeof(ValueT) +
sizeof(
FloatType)) + (1u << (3 * LOG2DIM)) *
sizeof(ValueT));
3653 mValueMask.setOn(offset);
3654 mValues[offset] = value;
3666 #if defined(__GNUC__) && (__GNUC__ < 12) && !defined(__APPLE__) && !defined(__llvm__) 3667 #pragma GCC diagnostic push 3668 #pragma GCC diagnostic ignored "-Wstringop-overflow" 3674 #if defined(__GNUC__) && (__GNUC__ < 12) && !defined(__APPLE__) && !defined(__llvm__) 3675 #pragma GCC diagnostic pop 3678 template<
typename T>
3683 for (
auto *p = mValues, *q = p + 512; p != q; ++p)
3697 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3700 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3701 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3706 uint8_t mBBoxDif[3];
3723 return sizeof(
LeafFnBase) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>) + 2 * 4 + 4 * 2);
3728 mQuantum = (max -
min) /
float((1 << bitWidth) - 1);
3758 template<
typename T>
3767 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3768 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp4, CoordT, MaskT, LOG2DIM>
3774 static constexpr
bool FIXED_SIZE =
true;
3775 alignas(32) uint8_t mCode[1u << (3 * LOG2DIM - 1)];
3780 static_assert(BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3781 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << (3 * LOG2DIM - 1));
3788 const uint8_t c = mCode[i>>1];
3789 return ( (i&1) ? c >> 4 : c & uint8_t(15) )*BaseT::mQuantum + BaseT::mMinimum;
3791 return ((mCode[i >> 1] >> ((i & 1) << 2)) & uint8_t(15)) * BaseT::mQuantum + BaseT::mMinimum;
3804 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3805 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp8, CoordT, MaskT, LOG2DIM>
3811 static constexpr
bool FIXED_SIZE =
true;
3812 alignas(32) uint8_t mCode[1u << 3 * LOG2DIM];
3816 static_assert(BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3817 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << 3 * LOG2DIM);
3823 return mCode[i] * 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<
Fp16, CoordT, MaskT, LOG2DIM>
3841 static constexpr
bool FIXED_SIZE =
true;
3842 alignas(32) uint16_t mCode[1u << 3 * LOG2DIM];
3847 static_assert(BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3848 return sizeof(
LeafData) -
sizeof(
BaseT) - 2 * (1u << 3 * LOG2DIM);
3854 return mCode[i] * BaseT::mQuantum + BaseT::mMinimum;
3866 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3867 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
FpN, CoordT, MaskT, LOG2DIM>
3873 static constexpr
bool FIXED_SIZE =
false;
3876 static_assert(BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3885 #ifdef NANOVDB_FPN_BRANCHLESS // faster 3886 const int b = BaseT::mFlags >> 5;
3888 uint16_t code =
reinterpret_cast<const uint16_t*
>(
this + 1)[i >> (4 - b)];
3889 const static uint8_t shift[5] = {15, 7, 3, 1, 0};
3890 const static uint16_t mask[5] = {1, 3, 15, 255, 65535};
3891 code >>= (i & shift[b]) << b;
3894 uint32_t code =
reinterpret_cast<const uint32_t*
>(
this + 1)[i >> (5 - b)];
3895 code >>= (i & ((32 >> b) - 1)) << b;
3896 code &= (1 << (1 << b)) - 1;
3898 #else // use branched version (slow) 3900 auto* values =
reinterpret_cast<const uint8_t*
>(
this + 1);
3901 switch (BaseT::mFlags >> 5) {
3903 code = float((values[i >> 3] >> (i & 7)) & uint8_t(1));
3906 code = float((values[i >> 2] >> ((i & 3) << 1)) & uint8_t(3));
3909 code = float((values[i >> 1] >> ((i & 1) << 2)) & uint8_t(15));
3912 code = float(values[i]);
3915 code = float(reinterpret_cast<const uint16_t*>(values)[i]);
3918 return float(code) * BaseT::mQuantum + BaseT::mMinimum;
3931 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3932 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
bool, CoordT, MaskT, LOG2DIM>
3934 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3935 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3940 static constexpr
bool FIXED_SIZE =
true;
3943 uint8_t mBBoxDif[3];
3947 uint64_t mPadding[2];
3959 mValueMask.setOn(offset);
3960 mValues.set(offset, v);
3968 template<
typename T>
3981 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3984 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3985 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3990 static constexpr
bool FIXED_SIZE =
true;
3993 uint8_t mBBoxDif[3];
3996 uint64_t mPadding[2];
4002 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u);
4017 template<
typename T>
4030 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4033 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4034 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4038 static constexpr
bool FIXED_SIZE =
true;
4041 uint8_t mBBoxDif[3];
4047 return sizeof(
LeafIndexBase) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u);
4058 template<
typename T>
4072 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4092 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4100 return util::countOn(BaseT::mValueMask.words()[7]) + (BaseT::mPrefixSum >> 54u & 511u);
4110 uint32_t n = i >> 6;
4111 const uint64_t w = BaseT::mValueMask.words()[n], mask = uint64_t(1) << (i & 63u);
4112 if (!(w & mask))
return uint64_t(0);
4113 uint64_t sum = BaseT::mOffset +
util::countOn(w & (mask - 1u));
4114 if (n--) sum += BaseT::mPrefixSum >> (9u * n) & 511u;
4121 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4123 :
public LeafData<ValueIndex, CoordT, MaskT, LOG2DIM>
4132 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4134 :
public LeafData<ValueOnIndex, CoordT, MaskT, LOG2DIM>
4145 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4146 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Point, CoordT, MaskT, LOG2DIM>
4148 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4149 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4154 static constexpr
bool FIXED_SIZE =
true;
4157 uint8_t mBBoxDif[3];
4163 alignas(32) uint16_t mValues[1u << 3 * LOG2DIM];
4171 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u + (1u << 3 * LOG2DIM) * 2u);
4177 __hostdev__ uint64_t
first(uint32_t i)
const {
return i ? uint64_t(mValues[i - 1u]) + mOffset : mOffset; }
4183 mValueMask.setOn(offset);
4184 mValues[offset] = value;
4198 template<
typename T>
4211 template<
typename BuildT,
4212 typename CoordT = Coord,
4213 template<u
int32_t>
class MaskT =
Mask,
4214 uint32_t Log2Dim = 3>
4220 static constexpr uint32_t TOTAL = 0;
4221 static constexpr uint32_t DIM = 1;
4230 static constexpr
bool FIXED_SIZE = DataType::FIXED_SIZE;
4231 template<u
int32_t LOG2>
4249 : BaseT(parent->data()->mValueMask.beginOn())
4257 return mParent->
getValue(BaseT::pos());
4282 : BaseT(parent->data()->mValueMask.beginOff())
4290 return mParent->
getValue(BaseT::pos());
4311 , mPos(1u << 3 * Log2Dim)
4354 static constexpr uint32_t LOG2DIM = Log2Dim;
4355 static constexpr uint32_t TOTAL = LOG2DIM;
4356 static constexpr uint32_t DIM = 1u << TOTAL;
4357 static constexpr uint32_t SIZE = 1u << 3 * LOG2DIM;
4358 static constexpr uint32_t MASK = (1u << LOG2DIM) - 1u;
4359 static constexpr uint32_t LEVEL = 0;
4360 static constexpr uint64_t NUM_VALUES = uint64_t(1) << (3 * TOTAL);
4396 const uint32_t m = n & ((1 << 2 * LOG2DIM) - 1);
4397 return CoordT(n >> 2 * LOG2DIM, m >> LOG2DIM, m & MASK);
4405 return OffsetToLocalCoord(n) + this->origin();
4414 math::BBox<CoordT> bbox(DataType::mBBoxMin, DataType::mBBoxMin);
4415 if (this->hasBBox()) {
4416 bbox.max()[0] += DataType::mBBoxDif[0];
4417 bbox.max()[1] += DataType::mBBoxDif[1];
4418 bbox.max()[2] += DataType::mBBoxDif[2];
4420 bbox = math::BBox<CoordT>();
4470 return !DataType::mValueMask.isOff();
4478 const uint32_t n = CoordToOffset(ijk);
4479 v = DataType::getValue(n);
4480 return DataType::mValueMask.isOn(n);
4488 return ((ijk[0] & MASK) << (2 * LOG2DIM)) | ((ijk[1] & MASK) << LOG2DIM) | (ijk[2] & MASK);
4500 template<
typename OpT,
typename... ArgsT>
4503 return OpT::get(*
this, CoordToOffset(ijk), args...);
4506 template<
typename OpT,
typename... ArgsT>
4509 return OpT::get(*
this, n, args...);
4512 template<
typename OpT,
typename... ArgsT>
4515 return OpT::set(*
this, CoordToOffset(ijk), args...);
4518 template<
typename OpT,
typename... ArgsT>
4521 return OpT::set(*
this, n, args...);
4527 template<
typename,
int,
int,
int>
4532 template<
typename, u
int32_t>
4535 template<
typename RayT,
typename AccT>
4536 __hostdev__ uint32_t getDimAndCache(
const CoordT&,
const RayT& ,
const AccT&)
const 4538 if (DataType::mFlags & uint8_t(1u))
4542 return ChildNodeType::dim();
4545 template<
typename OpT,
typename AccT,
typename... ArgsT>
4548 getAndCache(
const CoordType& ijk,
const AccT&, ArgsT&&... args)
const 4550 return OpT::get(*
this, CoordToOffset(ijk), args...);
4553 template<
typename OpT,
typename AccT,
typename... ArgsT>
4555 __hostdev__ decltype(OpT::set(util::declval<LeafNode&>(), util::declval<uint32_t>(), util::declval<ArgsT>()...))
4556 setAndCache(const
CoordType& ijk, const AccT&, ArgsT&&... args)
4558 return OpT::set(*
this, CoordToOffset(ijk), args...);
4565 template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4568 static_assert(LOG2DIM == 3,
"LeafNode::updateBBox: only supports LOGDIM = 3!");
4569 if (DataType::mValueMask.isOff()) {
4570 DataType::mFlags &= ~uint8_t(2);
4573 auto update = [&](uint32_t
min, uint32_t
max,
int axis) {
4575 DataType::mBBoxMin[axis] = (DataType::mBBoxMin[axis] & ~MASK) +
int(min);
4576 DataType::mBBoxDif[axis] = uint8_t(max - min);
4578 uint64_t *w = DataType::mValueMask.words(), word64 = *w;
4579 uint32_t Xmin = word64 ? 0u : 8u, Xmax = Xmin;
4580 for (
int i = 1; i < 8; ++i) {
4589 update(Xmin, Xmax, 0);
4591 const uint32_t *p =
reinterpret_cast<const uint32_t*
>(&word64), word32 = p[0] | p[1];
4592 const uint16_t *q =
reinterpret_cast<const uint16_t*
>(&word32), word16 = q[0] | q[1];
4593 const uint8_t *b =
reinterpret_cast<const uint8_t*
>(&word16), byte = b[0] | b[1];
4596 DataType::mFlags |= uint8_t(2);
4604 template<
typename BuildT>
4606 template<
typename BuildT>
4608 template<
typename BuildT>
4610 template<
typename BuildT>
4612 template<
typename BuildT>
4614 template<
typename BuildT>
4618 template<
typename BuildT,
int LEVEL>
4622 template<
typename BuildT>
4628 template<
typename BuildT>
4634 template<
typename BuildT>
4640 template<
typename BuildT>
4719 template<
typename OpT,
typename GridDataT,
typename... ArgsT>
4723 switch (gridData->mGridType){
4725 return OpT::template known<float>(gridData, args...);
4727 return OpT::template known<double>(gridData, args...);
4729 return OpT::template known<int16_t>(gridData, args...);
4731 return OpT::template known<int32_t>(gridData, args...);
4733 return OpT::template known<int64_t>(gridData, args...);
4735 return OpT::template known<Vec3f>(gridData, args...);
4737 return OpT::template known<Vec3d>(gridData, args...);
4739 return OpT::template known<uint32_t>(gridData, args...);
4741 return OpT::template known<ValueMask>(gridData, args...);
4743 return OpT::template known<ValueIndex>(gridData, args...);
4745 return OpT::template known<ValueOnIndex>(gridData, args...);
4747 return OpT::template known<ValueIndexMask>(gridData, args...);
4749 return OpT::template known<ValueOnIndexMask>(gridData, args...);
4751 return OpT::template known<bool>(gridData, args...);
4753 return OpT::template known<math::Rgba8>(gridData, args...);
4755 return OpT::template known<Fp4>(gridData, args...);
4757 return OpT::template known<Fp8>(gridData, args...);
4759 return OpT::template known<Fp16>(gridData, args...);
4761 return OpT::template known<FpN>(gridData, args...);
4763 return OpT::template known<Vec4f>(gridData, args...);
4765 return OpT::template known<Vec4d>(gridData, args...);
4767 return OpT::template known<uint8_t>(gridData, args...);
4769 return OpT::unknown(gridData, args...);
4794 template<
typename BuildT>
4804 mutable const RootT* mRoot;
4810 static const int CacheLevels = 0;
4820 : ReadAccessor(grid.tree().root())
4826 : ReadAccessor(tree.root())
4842 return this->
template get<GetValue<BuildT>>(ijk);
4851 template<
typename RayT>
4854 return mRoot->getDimAndCache(ijk, ray, *
this);
4856 template<
typename OpT,
typename... ArgsT>
4859 return mRoot->template get<OpT>(ijk, args...);
4862 template<
typename OpT,
typename... ArgsT>
4865 return const_cast<RootT*
>(mRoot)->
template set<OpT>(ijk, args...);
4872 template<
typename, u
int32_t>
4874 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
4878 template<
typename NodeT>
4883 template<
typename BuildT,
int LEVEL0>
4886 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 should be 0, 1, or 2");
4900 mutable CoordT mKey;
4901 mutable const RootT* mRoot;
4902 mutable const NodeT* mNode;
4909 static const int CacheLevels = 1;
4921 : ReadAccessor(grid.tree().root())
4927 : ReadAccessor(tree.root())
4947 return (ijk[0] & int32_t(~NodeT::MASK)) == mKey[0] &&
4948 (ijk[1] & int32_t(~NodeT::MASK)) == mKey[1] &&
4949 (ijk[2] & int32_t(~NodeT::MASK)) == mKey[2];
4954 return this->
template get<GetValue<BuildT>>(ijk);
4964 template<
typename RayT>
4967 if (this->isCached(ijk))
return mNode->getDimAndCache(ijk, ray, *
this);
4968 return mRoot->getDimAndCache(ijk, ray, *
this);
4971 template<
typename OpT,
typename... ArgsT>
4974 if constexpr(OpT::LEVEL <= LEVEL0)
if (this->isCached(ijk))
return mNode->template getAndCache<OpT>(ijk, *
this, args...);
4975 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
4978 template<
typename OpT,
typename... ArgsT>
4981 if constexpr(OpT::LEVEL <= LEVEL0)
if (this->isCached(ijk))
return const_cast<NodeT*
>(mNode)->
template setAndCache<OpT>(ijk, *
this, args...);
4982 return const_cast<RootT*
>(mRoot)->
template setAndCache<OpT>(ijk, *
this, args...);
4989 template<
typename, u
int32_t>
4991 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
4997 mKey = ijk & ~NodeT::MASK;
5002 template<
typename OtherNodeT>
5007 template<
typename BuildT,
int LEVEL0,
int LEVEL1>
5010 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 must be 0, 1, 2");
5011 static_assert(LEVEL1 >= 0 && LEVEL1 <= 2,
"LEVEL1 must be 0, 1, 2");
5012 static_assert(LEVEL0 < LEVEL1,
"Level 0 must be lower than level 1");
5025 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY // 44 bytes total 5026 mutable CoordT mKey;
5027 #else // 68 bytes total 5028 mutable CoordT mKeys[2];
5030 mutable const RootT* mRoot;
5031 mutable const Node1T* mNode1;
5032 mutable const Node2T* mNode2;
5039 static const int CacheLevels = 2;
5043 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5056 : ReadAccessor(grid.tree().root())
5062 : ReadAccessor(tree.root())
5069 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5085 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5086 __hostdev__ bool isCached1(CoordValueType dirty)
const 5090 if (dirty & int32_t(~Node1T::MASK)) {
5096 __hostdev__ bool isCached2(CoordValueType dirty)
const 5100 if (dirty & int32_t(~Node2T::MASK)) {
5108 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
5113 return (ijk[0] & int32_t(~Node1T::MASK)) == mKeys[0][0] &&
5114 (ijk[1] & int32_t(~Node1T::MASK)) == mKeys[0][1] &&
5115 (ijk[2] & int32_t(~Node1T::MASK)) == mKeys[0][2];
5119 return (ijk[0] & int32_t(~Node2T::MASK)) == mKeys[1][0] &&
5120 (ijk[1] & int32_t(~Node2T::MASK)) == mKeys[1][1] &&
5121 (ijk[2] & int32_t(~Node2T::MASK)) == mKeys[1][2];
5127 return this->
template get<GetValue<BuildT>>(ijk);
5137 template<
typename RayT>
5140 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5141 const CoordValueType dirty = this->computeDirty(ijk);
5145 if (this->isCached1(dirty)) {
5146 return mNode1->getDimAndCache(ijk, ray, *
this);
5147 }
else if (this->isCached2(dirty)) {
5148 return mNode2->getDimAndCache(ijk, ray, *
this);
5150 return mRoot->getDimAndCache(ijk, ray, *
this);
5153 template<
typename OpT,
typename... ArgsT>
5156 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5157 const CoordValueType dirty = this->computeDirty(ijk);
5161 if constexpr(OpT::LEVEL <= LEVEL0) {
5162 if (this->isCached1(dirty))
return mNode1->template getAndCache<OpT>(ijk, *
this, args...);
5163 }
else if constexpr(OpT::LEVEL <= LEVEL1) {
5164 if (this->isCached2(dirty))
return mNode2->template getAndCache<OpT>(ijk, *
this, args...);
5166 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5169 template<
typename OpT,
typename... ArgsT>
5172 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5173 const CoordValueType dirty = this->computeDirty(ijk);
5177 if constexpr(OpT::LEVEL <= LEVEL0) {
5178 if (this->isCached1(dirty))
return const_cast<Node1T*
>(mNode1)->
template setAndCache<OpT>(ijk, *
this, args...);
5179 }
else if constexpr(OpT::LEVEL <= LEVEL1) {
5180 if (this->isCached2(dirty))
return const_cast<Node2T*
>(mNode2)->
template setAndCache<OpT>(ijk, *
this, args...);
5182 return const_cast<RootT*
>(mRoot)->
template setAndCache<OpT>(ijk, *
this, args...);
5189 template<
typename, u
int32_t>
5191 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5197 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5200 mKeys[0] = ijk & ~Node1T::MASK;
5206 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5209 mKeys[1] = ijk & ~Node2T::MASK;
5213 template<
typename OtherNodeT>
5218 template<
typename BuildT>
5234 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY // 44 bytes total 5235 mutable CoordT mKey;
5236 #else // 68 bytes total 5237 mutable CoordT mKeys[3];
5239 mutable const RootT* mRoot;
5240 mutable const void* mNode[3];
5247 static const int CacheLevels = 3;
5251 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5257 , mNode{
nullptr,
nullptr,
nullptr}
5263 : ReadAccessor(grid.tree().root())
5269 : ReadAccessor(tree.root())
5283 template<
typename NodeT>
5288 return reinterpret_cast<const T*
>(mNode[NodeT::LEVEL]);
5295 static_assert(LEVEL >= 0 && LEVEL <= 2,
"ReadAccessor::getNode: Invalid node type");
5296 return reinterpret_cast<const T*
>(mNode[LEVEL]);
5302 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5307 mNode[0] = mNode[1] = mNode[2] =
nullptr;
5310 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5311 template<
typename NodeT>
5312 __hostdev__ bool isCached(CoordValueType dirty)
const 5314 if (!mNode[NodeT::LEVEL])
5316 if (dirty & int32_t(~NodeT::MASK)) {
5317 mNode[NodeT::LEVEL] =
nullptr;
5325 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
5328 template<
typename NodeT>
5331 return (ijk[0] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][0] &&
5332 (ijk[1] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][1] &&
5333 (ijk[2] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][2];
5346 template<
typename OpT,
typename... ArgsT>
5349 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5350 const CoordValueType dirty = this->computeDirty(ijk);
5354 if constexpr(OpT::LEVEL <=0) {
5355 if (this->isCached<LeafT>(dirty))
return ((
const LeafT*)mNode[0])->template getAndCache<OpT>(ijk, *
this, args...);
5356 }
else if constexpr(OpT::LEVEL <= 1) {
5357 if (this->isCached<NodeT1>(dirty))
return ((
const NodeT1*)mNode[1])->template getAndCache<OpT>(ijk, *
this, args...);
5358 }
else if constexpr(OpT::LEVEL <= 2) {
5359 if (this->isCached<NodeT2>(dirty))
return ((
const NodeT2*)mNode[2])->template getAndCache<OpT>(ijk, *
this, args...);
5361 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5364 template<
typename OpT,
typename... ArgsT>
5367 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5368 const CoordValueType dirty = this->computeDirty(ijk);
5372 if constexpr(OpT::LEVEL <= 0) {
5373 if (this->isCached<LeafT>(dirty))
return ((
LeafT*)mNode[0])->template setAndCache<OpT>(ijk, *
this, args...);
5374 }
else if constexpr(OpT::LEVEL <= 1) {
5375 if (this->isCached<NodeT1>(dirty))
return ((
NodeT1*)mNode[1])->template setAndCache<OpT>(ijk, *
this, args...);
5376 }
else if constexpr(OpT::LEVEL <= 2) {
5377 if (this->isCached<NodeT2>(dirty))
return ((
NodeT2*)mNode[2])->template setAndCache<OpT>(ijk, *
this, args...);
5379 return ((
RootT*)mRoot)->template setAndCache<OpT>(ijk, *
this, args...);
5382 template<
typename RayT>
5385 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5386 const CoordValueType dirty = this->computeDirty(ijk);
5390 if (this->isCached<LeafT>(dirty)) {
5391 return ((
LeafT*)mNode[0])->getDimAndCache(ijk, ray, *
this);
5392 }
else if (this->isCached<NodeT1>(dirty)) {
5393 return ((
NodeT1*)mNode[1])->getDimAndCache(ijk, ray, *
this);
5394 }
else if (this->isCached<NodeT2>(dirty)) {
5395 return ((
NodeT2*)mNode[2])->getDimAndCache(ijk, ray, *
this);
5397 return mRoot->getDimAndCache(ijk, ray, *
this);
5404 template<
typename, u
int32_t>
5406 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5410 template<
typename NodeT>
5413 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5416 mKeys[NodeT::LEVEL] = ijk & ~NodeT::MASK;
5418 mNode[NodeT::LEVEL] = node;
5436 template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5442 template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5448 template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5464 CoordBBox mIndexBBox;
5465 uint32_t mRootTableSize, mPadding{0};
5468 template<
typename T>
5471 mGridData = *grid.
data();
5472 mTreeData = *grid.
tree().data();
5474 mRootTableSize = grid.
tree().root().getTableSize();
5479 *
this = *
reinterpret_cast<const GridMetaData*
>(gridData);
5482 mGridData = *gridData;
5502 template<
typename T>
5542 template<
typename AttT,
typename BuildT = u
int32_t>
5551 : AccT(grid.tree().root())
5553 , mData(grid.template getBlindData<AttT>(0))
5571 end = begin + count;
5579 auto* leaf = this->probeLeaf(ijk);
5580 if (leaf ==
nullptr) {
5583 begin = mData + leaf->minimum();
5584 end = begin + leaf->maximum();
5585 return leaf->maximum();
5591 begin = end =
nullptr;
5592 if (
auto* leaf = this->probeLeaf(ijk)) {
5594 if (leaf->isActive(offset)) {
5595 begin = mData + leaf->minimum();
5596 end = begin + leaf->getValue(offset);
5598 begin += leaf->getValue(offset - 1);
5605 template<
typename AttT>
5614 : AccT(grid.tree().root())
5616 , mData(grid.template getBlindData<AttT>(0))
5638 end = begin + count;
5646 auto* leaf = this->probeLeaf(ijk);
5647 if (leaf ==
nullptr)
5649 begin = mData + leaf->offset();
5650 end = begin + leaf->pointCount();
5651 return leaf->pointCount();
5657 if (
auto* leaf = this->probeLeaf(ijk)) {
5659 if (leaf->isActive(n)) {
5660 begin = mData + leaf->first(n);
5661 end = mData + leaf->last(n);
5665 begin = end =
nullptr;
5673 template<
typename ChannelT,
typename IndexT = ValueIndex>
5690 :
BaseT(grid.tree().root())
5696 this->setChannel(channelID);
5701 :
BaseT(grid.tree().root())
5703 , mChannel(channelPtr)
5734 return mChannel =
const_cast<ChannelT*
>(mGrid.template getBlindData<ChannelT>(channelID));
5739 __hostdev__ uint64_t
idx(
int i,
int j,
int k)
const {
return BaseT::getValue(math::Coord(i, j, k)); }
5750 const bool isActive = BaseT::probeValue(ijk, idx);
5757 template<
typename T>
5758 __hostdev__ T&
getValue(
const math::Coord& ijk, T* channelPtr)
const {
return channelPtr[BaseT::getValue(ijk)]; }
5766 struct MiniGridHandle {
5771 BufferType(BufferType &&other) : data(other.data), size(other.size) {other.data=
nullptr; other.size=0;}
5772 ~BufferType() {std::free(data);}
5773 BufferType& operator=(
const BufferType &other) =
delete;
5774 BufferType& operator=(BufferType &&other){data=other.data; size=other.size; other.data=
nullptr; other.size=0;
return *
this;}
5775 static BufferType create(
size_t n, BufferType* dummy =
nullptr) {
return BufferType(n);}
5777 MiniGridHandle(BufferType &&buf) : buffer(std::move(buf)) {}
5778 const uint8_t* data()
const {
return buffer.data;}
5810 if (
util::streq(str,
"blosc"))
return Codec::BLOSC;
5852 uint32_t nodeCount[4];
5853 uint32_t tileCount[3];
5860 #if !defined(__CUDA_ARCH__) && !defined(__HIP__) 5883 template<
typename StreamT>
5889 #ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS 5894 const char* gridName = gridData->
gridName();
5903 os.write((
const char*)&head,
sizeof(
FileHeader));
5905 os.write(gridName, nameSize);
5907 os.write((
const char*)gridData, gridData->
mGridSize);
5912 template<
typename GridHandleT,
template<
typename...>
class VecT>
5915 #ifdef NANOVDB_USE_IOSTREAMS // use this to switch between std::ofstream or FILE implementations 5916 std::ofstream os(fileName, std::ios::out | std::ios::binary | std::ios::trunc);
5920 StreamT(
const char* name) { fptr = fopen(name,
"wb"); }
5921 ~StreamT() { fclose(fptr); }
5922 void write(
const char* data,
size_t n) { fwrite(data, 1, n, fptr); }
5923 bool is_open()
const {
return fptr != NULL; }
5926 if (!os.is_open()) {
5927 fprintf(stderr,
"nanovdb::writeUncompressedGrids: Unable to open file \"%s\"for output\n", fileName);
5930 for (
auto& h : handles) {
5940 template<
typename GridHandleT,
typename StreamT,
template<
typename...>
class VecT>
5941 VecT<GridHandleT>
readUncompressedGrids(StreamT& is,
const typename GridHandleT::BufferType& pool =
typename GridHandleT::BufferType())
5943 VecT<GridHandleT> handles;
5945 is.read((
char*)&data,
sizeof(
GridData));
5947 uint64_t size = data.
mGridSize, sum = 0u;
5950 is.read((
char*)&data,
sizeof(
GridData));
5953 is.skip(-int64_t(sum +
sizeof(
GridData)));
5954 auto buffer = GridHandleT::BufferType::create(size + sum, &pool);
5955 is.read((
char*)(buffer.data()), buffer.size());
5956 handles.emplace_back(std::move(buffer));
5960 while(is.read((
char*)&head,
sizeof(
FileHeader))) {
5962 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid magic number = \"%s\"\n", (
const char*)&(head.
magic));
5966 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid major version = \"%s\"\n",
toStr(str, head.
version));
5970 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid codec = \"%s\"\n",
toStr(str, head.
codec));
5974 for (uint16_t i = 0; i < head.
gridCount; ++i) {
5977 auto buffer = GridHandleT::BufferType::create(meta.
gridSize, &pool);
5978 is.read((
char*)buffer.data(), meta.
gridSize);
5979 handles.emplace_back(std::move(buffer));
5987 template<
typename GridHandleT,
template<
typename...>
class VecT>
5988 VecT<GridHandleT>
readUncompressedGrids(
const char* fileName,
const typename GridHandleT::BufferType& buffer =
typename GridHandleT::BufferType())
5990 #ifdef NANOVDB_USE_IOSTREAMS // use this to switch between std::ifstream or FILE implementations 5991 struct StreamT :
public std::ifstream {
5992 StreamT(
const char* name) : std::ifstream(name, std::ios::in | std::ios::binary){}
5993 void skip(int64_t off) { this->seekg(off, std::ios_base::cur); }
5998 StreamT(
const char* name) { fptr = fopen(name,
"rb"); }
5999 ~StreamT() { fclose(fptr); }
6000 bool read(
char* data,
size_t n) {
6001 size_t m = fread(data, 1, n, fptr);
6004 void skip(int64_t off) { fseek(fptr, (
long int)off, SEEK_CUR); }
6005 bool is_open()
const {
return fptr != NULL; }
6008 StreamT is(fileName);
6009 if (!is.is_open()) {
6010 fprintf(stderr,
"nanovdb::readUncompressedGrids: Unable to open file \"%s\"for input\n", fileName);
6013 return readUncompressedGrids<GridHandleT, StreamT, VecT>(is, buffer);
6016 #endif // if !defined(__CUDA_ARCH__) && !defined(__HIP__) 6056 template<
typename BuildT>
6060 static constexpr
int LEVEL = 0;
6068 template<
typename BuildT>
6073 static constexpr
int LEVEL = 0;
6081 template<
typename BuildT>
6086 static constexpr
int LEVEL = 0;
6096 template<
typename BuildT>
6100 static constexpr
int LEVEL = 0;
6110 template<
typename BuildT>
6114 static constexpr
int LEVEL = 0;
6124 template<
typename BuildT>
6128 static constexpr
int LEVEL = 0;
6138 template<
typename BuildT>
6142 static constexpr
int LEVEL = 1;
6151 template<
typename BuildT>
6155 static constexpr
int LEVEL = 2;
6163 template<
typename BuildT>
6167 static constexpr
int LEVEL = 3;
6174 template<
typename BuildT>
6178 static constexpr
int LEVEL = 0;
6182 v = root.mBackground;
6188 return tile.state > 0u;
6192 v = node.mTable[n].value;
6193 return node.mValueMask.isOn(n);
6197 v = node.mTable[n].value;
6198 return node.mValueMask.isOn(n);
6202 v = leaf.getValue(n);
6203 return leaf.mValueMask.isOn(n);
6209 template<
typename BuildT>
6221 static constexpr
int LEVEL = 0;
6233 return NodeInfo{2u, node.
dim(), node.minimum(), node.maximum(), node.average(), node.stdDeviation(), node.bbox()};
6237 return NodeInfo{1u, node.
dim(), node.minimum(), node.maximum(), node.average(), node.stdDeviation(), node.bbox()};
6241 return NodeInfo{0u, leaf.
dim(), leaf.minimum(), leaf.maximum(), leaf.average(), leaf.stdDeviation(), leaf.bbox()};
6247 #endif // end of NANOVDB_NANOVDB_H_HAS_BEEN_INCLUDED typename FloatTraits< BuildT >::FloatType FloatType
Definition: NanoVDB.h:3623
__hostdev__ ValueType getMin() const
Definition: NanoVDB.h:3658
__hostdev__ ValueOffIterator beginValueOff() const
Definition: NanoVDB.h:4299
__hostdev__ DenseIter()
Definition: NanoVDB.h:2955
__hostdev__ const GridType & gridType() const
Definition: NanoVDB.h:2228
__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:5747
__hostdev__ ValueT value() const
Definition: NanoVDB.h:2718
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:3778
typename BuildT::RootType RootType
Definition: NanoVDB.h:2103
__hostdev__ const Vec3d & voxelSize() const
Return a const reference to the size of a voxel in world units.
Definition: NanoVDB.h:2163
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition: NanoVDB.h:5337
__hostdev__ uint32_t operator*() const
Definition: NanoVDB.h:1075
ValueT ValueType
Definition: NanoVDB.h:4906
__hostdev__ uint64_t full() const
Definition: NanoVDB.h:1827
__hostdev__ const char * shortGridName() const
Return a c-string with the name of this grid, truncated to 255 characters.
Definition: NanoVDB.h:2262
__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:1172
__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:3010
bool type
Definition: NanoVDB.h:494
Visits all tile values in this node, i.e. both inactive and active tiles.
Definition: NanoVDB.h:3311
__hostdev__ math::BBox< CoordT > bbox() const
Return the bounding box in index space of active values in this leaf node.
Definition: NanoVDB.h:4412
__hostdev__ CoordT getCoord() const
Definition: NanoVDB.h:4326
uint16_t ArrayType
Definition: NanoVDB.h:4153
__hostdev__ CheckMode toCheckMode(const Checksum &checksum)
Maps 64 bit checksum to CheckMode enum.
Definition: NanoVDB.h:1866
C++11 implementation of std::enable_if.
Definition: Util.h:335
FloatType mStdDevi
Definition: NanoVDB.h:3635
float type
Definition: NanoVDB.h:501
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:3874
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition: NanoVDB.h:5343
__hostdev__ CoordT offsetToGlobalCoord(uint32_t n) const
Definition: NanoVDB.h:4403
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:3998
__hostdev__ bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:4848
__hostdev__ const MaskType< LOG2DIM > & getValueMask() const
Definition: NanoVDB.h:4368
typename util::match_const< DataType, RootT >::type DataT
Definition: NanoVDB.h:2830
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:5913
typename RootType::LeafNodeType LeafNodeType
Definition: NanoVDB.h:2407
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition: NanoVDB.h:3035
__hostdev__ Vec3d getVoxelSize() const
Return a voxels size in each coordinate direction, measured at the origin.
Definition: NanoVDB.h:1511
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition: NanoVDB.h:4819
StatsT mStdDevi
Definition: NanoVDB.h:3155
__hostdev__ bool hasStdDeviation() const
Definition: NanoVDB.h:2242
__hostdev__ Vec3T applyMap(const Vec3T &xyz) const
Definition: NanoVDB.h:1978
NANOVDB_HOSTDEV_DISABLE_WARNING __hostdev__ uint32_t findFirst() const
Definition: NanoVDB.h:1333
__hostdev__ TileT * tile() const
Definition: NanoVDB.h:2839
__hostdev__ bool isOff(uint32_t n) const
Return true if the given bit is NOT set.
Definition: NanoVDB.h:1201
DataType::template TileIter< DataT > mTileIter
Definition: NanoVDB.h:2832
__hostdev__ Vec3T applyMapF(const Vec3T &xyz) const
Definition: NanoVDB.h:1989
__hostdev__ const char * gridName() const
Definition: NanoVDB.h:2046
__hostdev__ ChannelT * setChannel(ChannelT *channelPtr)
Change to an external channel.
Definition: NanoVDB.h:5726
typename util::match_const< Tile, RootT >::type TileT
Definition: NanoVDB.h:2831
__hostdev__ ChildT * getChild(uint32_t n)
Returns a pointer to the child node at the specifed linear offset.
Definition: NanoVDB.h:3183
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition: NanoVDB.h:5339
__hostdev__ Vec3T applyIJTF(const Vec3T &xyz) const
Definition: NanoVDB.h:1508
VDB Tree, which is a thin wrapper around a RootNode.
Definition: NanoVDB.h:2394
__hostdev__ Vec3T applyMapF(const Vec3T &ijk) const
Apply the forward affine transformation to a vector using 32bit floating point arithmetics.
Definition: NanoVDB.h:1439
decltype(mFlags) Type
Definition: NanoVDB.h:926
__hostdev__ Vec3T indexToWorld(const Vec3T &xyz) const
index to world space transformation
Definition: NanoVDB.h:2174
math::BBox< CoordType > BBoxType
Definition: NanoVDB.h:2819
__hostdev__ Tile * tile(uint32_t n)
Definition: NanoVDB.h:2651
__hostdev__ DenseIter operator++(int)
Definition: NanoVDB.h:2969
__hostdev__ bool isActive() const
Definition: NanoVDB.h:2893
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition: NanoVDB.h:5340
__hostdev__ GridClass mapToGridClass(GridClass defaultClass=GridClass::Unknown)
Definition: NanoVDB.h:889
__hostdev__ bool isChild() const
Definition: NanoVDB.h:2633
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition: NanoVDB.h:2439
__hostdev__ ValueIterator()
Definition: NanoVDB.h:4309
float Type
Definition: NanoVDB.h:521
float FloatType
Definition: NanoVDB.h:3703
__hostdev__ CoordT origin() const
Return the origin in index space of this leaf node.
Definition: NanoVDB.h:4388
Highest level of the data structure. Contains a tree and a world->index transform (that currently onl...
Definition: NanoVDB.h:2099
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition: NanoVDB.h:4825
__hostdev__ ValueOnIter(RootT *parent)
Definition: NanoVDB.h:2922
Vec3dBBox mWorldBBox
Definition: NanoVDB.h:1906
__hostdev__ CoordType getOrigin() const
Definition: NanoVDB.h:3296
__hostdev__ const NodeTrait< RootT, 1 >::type * getFirstLower() const
Definition: NanoVDB.h:2533
__hostdev__ Vec3T applyIJTF(const Vec3T &xyz) const
Definition: NanoVDB.h:1997
FloatType stdDevi
Definition: NanoVDB.h:6218
__hostdev__ char * toStr(char *dst, GridType gridType)
Maps a GridType to a c-string.
Definition: NanoVDB.h:254
__hostdev__ ValueType maximum() const
Return a const reference to the maximum active value encoded in this leaf node.
Definition: NanoVDB.h:4374
__hostdev__ DenseIterator(const InternalNode *parent)
Definition: NanoVDB.h:3395
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:4127
__hostdev__ const DataType * data() const
Definition: NanoVDB.h:2994
__hostdev__ const MaskType< LOG2DIM > & valueMask() const
Return a const reference to the bit mask of active voxels in this internal node.
Definition: NanoVDB.h:3445
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:5135
#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:1918
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition: NanoVDB.h:4957
static __hostdev__ constexpr uint64_t memUsage()
Definition: NanoVDB.h:3777
__hostdev__ bool getValue(uint32_t i) const
Definition: NanoVDB.h:4005
__hostdev__ bool isValue() const
Definition: NanoVDB.h:2703
__hostdev__ void setValueOnly(uint32_t offset, const ValueType &v)
Sets the value at the specified location but leaves its state unchanged.
Definition: NanoVDB.h:4458
__hostdev__ Vec3T applyInverseMap(const Vec3T &xyz) const
Apply the inverse affine mapping to a vector using 64bit floating point arithmetics.
Definition: NanoVDB.h:1465
__hostdev__ ValueOnIter()
Definition: NanoVDB.h:2921
Class to access values in channels at a specific voxel location.
Definition: NanoVDB.h:5674
__hostdev__ void setMask(uint32_t offset, bool v)
Definition: NanoVDB.h:4140
__hostdev__ void setOn(uint32_t offset)
Definition: NanoVDB.h:3656
Definition: NanoVDB.h:2658
static __hostdev__ uint32_t padding()
Definition: NanoVDB.h:4428
typename GridT::TreeType Type
Definition: NanoVDB.h:2380
__hostdev__ NodeT * operator->() const
Definition: NanoVDB.h:2859
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition: NanoVDB.h:5338
char mGridName[MaxNameSize]
Definition: NanoVDB.h:1904
__hostdev__ bool operator>(const Version &rhs) const
Definition: NanoVDB.h:698
static __hostdev__ size_t memUsage(uint32_t bitWidth)
Definition: NanoVDB.h:3882
__hostdev__ void setChild(const CoordType &k, const void *ptr, const RootData *data)
Definition: NanoVDB.h:2619
__hostdev__ Version version() const
Definition: NanoVDB.h:2121
PointAccessor(const NanoGrid< Point > &grid)
Definition: NanoVDB.h:5613
__hostdev__ const ValueT & getMax() const
Definition: NanoVDB.h:2784
__hostdev__ ValueType getValue(uint32_t i) const
Definition: NanoVDB.h:3649
__hostdev__ Map(double s, const Vec3d &t=Vec3d(0.0, 0.0, 0.0))
Definition: NanoVDB.h:1399
__hostdev__ ChildNodeType * probeChild(const CoordType &ijk)
Definition: NanoVDB.h:3494
typename ChildT::CoordType CoordType
Definition: NanoVDB.h:3250
__hostdev__ void setLongGridNameOn(bool on=true)
Definition: NanoVDB.h:1967
__hostdev__ Mask(const Mask &other)
Copy constructor.
Definition: NanoVDB.h:1145
static __hostdev__ uint32_t CoordToOffset(const CoordT &ijk)
Return the linear offset corresponding to the given coordinate.
Definition: NanoVDB.h:4486
__hostdev__ uint64_t lastOffset() const
Definition: NanoVDB.h:4102
MaskT< LOG2DIM > mMask
Definition: NanoVDB.h:4126
__hostdev__ const BlindDataT * getBlindData(uint32_t n) const
Definition: NanoVDB.h:2292
#define NANOVDB_MAGIC_NUMB
Definition: NanoVDB.h:139
__hostdev__ void setWord(WordT w, uint32_t n)
Definition: NanoVDB.h:1163
GridClass
Classes (superset of OpenVDB) that are currently supported by NanoVDB.
Definition: NanoVDB.h:291
typename DataType::ValueT ValueType
Definition: NanoVDB.h:2814
__hostdev__ bool isPartial() const
return true if the 64 bit checksum is partial, i.e. of head only
Definition: NanoVDB.h:1836
static T scalar(const T &s)
Definition: NanoVDB.h:733
typename RootT::BuildType BuildType
Definition: NanoVDB.h:2409
__hostdev__ void setDev(const FloatType &)
Definition: NanoVDB.h:4015
Definition: NanoVDB.h:2881
__hostdev__ void * treePtr()
Definition: NanoVDB.h:2000
uint32_t state
Definition: NanoVDB.h:2639
BuildT BuildType
Definition: NanoVDB.h:3622
CoordT mBBoxMin
Definition: NanoVDB.h:3992
__hostdev__ void setDev(const FloatType &v)
Definition: NanoVDB.h:3673
__hostdev__ ConstTileIterator cbeginTile() const
Definition: NanoVDB.h:2729
typename UpperNodeType::ChildNodeType LowerNodeType
Definition: NanoVDB.h:2406
Return the pointer to the leaf node that contains math::Coord. Implements Tree::probeLeaf(math::Coord...
Definition: NanoVDB.h:1755
__hostdev__ bool getDev() const
Definition: NanoVDB.h:4009
__hostdev__ bool isValid(GridType gridType, GridClass gridClass)
return true if the combination of GridType and GridClass is valid.
Definition: NanoVDB.h:608
static __hostdev__ bool isAligned(const void *p)
return true if the specified pointer is 32 byte aligned
Definition: NanoVDB.h:542
__hostdev__ void * getRoot()
Get a non-const void pointer to the root node (never NULL)
Definition: NanoVDB.h:2356
__hostdev__ ChildIterator beginChild()
Definition: NanoVDB.h:3307
uint8_t mFlags
Definition: NanoVDB.h:3629
__hostdev__ TileT * operator->() const
Definition: NanoVDB.h:2688
__hostdev__ LeafNodeType * getFirstLeaf()
Template specializations of getFirstNode.
Definition: NanoVDB.h:2530
uint64_t mOffset
Definition: NanoVDB.h:4161
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:3679
__hostdev__ ValueIter(RootT *parent)
Definition: NanoVDB.h:2888
static int64_t PtrDiff(const void *p, const void *q)
Compute the distance, in bytes, between two pointers, dist = p - q.
Definition: Util.h:464
__hostdev__ uint32_t gridIndex() const
Return index of this grid in the buffer.
Definition: NanoVDB.h:2134
__hostdev__ const RootT & root() const
Definition: NanoVDB.h:2433
__hostdev__ bool isEmpty() const
Return true if the root is empty, i.e. has not child nodes or constant tiles.
Definition: NanoVDB.h:2365
Definition: NanoVDB.h:2089
__hostdev__ const StatsT & stdDeviation() const
Definition: NanoVDB.h:2786
LeafNodeType Node0
Definition: NanoVDB.h:2416
__hostdev__ ValueType getValue(const CoordType &ijk) const
Return the value of the given voxel.
Definition: NanoVDB.h:3034
Checksum mChecksum
Definition: NanoVDB.h:1898
Return point to the upper internal node where math::Coord maps to one of its values, i.e. terminates.
Definition: NanoVDB.h:6152
__hostdev__ const GridClass & gridClass() const
Definition: NanoVDB.h:2229
__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:5577
typename DataType::StatsT FloatType
Definition: NanoVDB.h:2815
__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:3019
Below is an example of a struct used for random get methods.
Definition: NanoVDB.h:1745
BitFlags()
Definition: NanoVDB.h:927
__hostdev__ FloatType getAvg() const
Definition: NanoVDB.h:3660
__hostdev__ ChildIterator beginChild()
Definition: NanoVDB.h:2877
__hostdev__ bool isActive(const CoordT &ijk) const
Return true if the voxel value at the given coordinate is active.
Definition: NanoVDB.h:4462
__hostdev__ ConstDenseIterator cbeginDense() const
Definition: NanoVDB.h:2981
__hostdev__ uint64_t getValue(uint32_t i) const
Definition: NanoVDB.h:4107
ChildT ChildNodeType
Definition: NanoVDB.h:2808
#define NANOVDB_MAGIC_GRID
Definition: NanoVDB.h:140
__hostdev__ void setAvg(const FloatType &)
Definition: NanoVDB.h:4014
__hostdev__ ValueOnIterator beginValueOn() const
Definition: NanoVDB.h:3380
__hostdev__ const MaskType< LOG2DIM > & valueMask() const
Return a const reference to the bit mask of active voxels in this leaf node.
Definition: NanoVDB.h:4367
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:1515
static __hostdev__ KeyT CoordToKey(const CoordType &ijk)
Definition: NanoVDB.h:2579
__hostdev__ void setAvg(float avg)
Definition: NanoVDB.h:3753
MaskT< LOG2DIM > ArrayType
Definition: NanoVDB.h:3939
T Type
Definition: NanoVDB.h:458
__hostdev__ bool isActive() const
Definition: NanoVDB.h:3339
uint64_t mMagic
Definition: NanoVDB.h:1897
__hostdev__ ChannelT * setChannel(uint32_t channelID)
Change to an internal channel, assuming it exists as as blind data in the IndexGrid.
Definition: NanoVDB.h:5732
__hostdev__ void setMax(const ValueType &)
Definition: NanoVDB.h:4013
__hostdev__ bool isOff() const
Return true if none of the bits are set in this Mask.
Definition: NanoVDB.h:1213
__hostdev__ uint32_t valueCount() const
Definition: NanoVDB.h:4098
uint64_t mGridSize
Definition: NanoVDB.h:1903
__hostdev__ NodeT * probeChild(ValueType &value) const
Definition: NanoVDB.h:2957
RootT Node3
Definition: NanoVDB.h:2413
PointType
Definition: NanoVDB.h:396
__hostdev__ void toggle(uint32_t n)
Definition: NanoVDB.h:1296
Trait to map from LEVEL to node type.
Definition: NanoVDB.h:4619
__hostdev__ void setDev(const FloatType &)
Definition: NanoVDB.h:4056
__hostdev__ void setMax(const ValueT &v)
Definition: NanoVDB.h:2789
__hostdev__ void setOn(uint32_t offset)
Definition: NanoVDB.h:4057
__hostdev__ bool isFogVolume() const
Definition: NanoVDB.h:2231
__hostdev__ ValueIter()
Definition: NanoVDB.h:2887
#define NANOVDB_MINOR_VERSION_NUMBER
Definition: NanoVDB.h:147
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition: NanoVDB.h:4926
__hostdev__ WordT getWord(uint32_t n) const
Definition: NanoVDB.h:1156
__hostdev__ FloatType variance() const
Return the variance of all the active values encoded in this leaf node.
Definition: NanoVDB.h:4380
uint64_t KeyT
Return a key based on the coordinates of a voxel.
Definition: NanoVDB.h:2577
Vec3d mVoxelSize
Definition: NanoVDB.h:1907
BuildT ValueType
Definition: NanoVDB.h:3621
uint64_t mFlags
Definition: NanoVDB.h:3148
__hostdev__ const uint32_t & getTableSize() const
Definition: NanoVDB.h:3007
__hostdev__ ValueIterator()
Definition: NanoVDB.h:3317
__hostdev__ Checksum(uint32_t head, uint32_t tail)
Constructor that allows the two 32bit checksums to be initiated explicitly.
Definition: NanoVDB.h:1809
__hostdev__ uint32_t pos() const
Definition: NanoVDB.h:1104
__hostdev__ Mask()
Initialize all bits to zero.
Definition: NanoVDB.h:1132
__hostdev__ bool isCached2(const CoordType &ijk) const
Definition: NanoVDB.h:5117
__hostdev__ bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:3489
Implements Tree::getNodeInfo(math::Coord)
Definition: NanoVDB.h:1759
__hostdev__ uint64_t getMax() const
Definition: NanoVDB.h:4104
__hostdev__ void setStdDeviationOn(bool on=true)
Definition: NanoVDB.h:1969
__hostdev__ uint32_t gridCount() const
Return total number of grids in the buffer.
Definition: NanoVDB.h:2137
__hostdev__ bool isRootConnected() const
return true if RootData follows TreeData in memory without any extra padding
Definition: NanoVDB.h:2084
__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:5589
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition: NanoVDB.h:4846
__hostdev__ bool isValid() const
Methods related to the classification of this grid.
Definition: NanoVDB.h:2227
__hostdev__ void setValue(uint32_t n, const ValueT &v)
Definition: NanoVDB.h:3176
ValueType minimum
Definition: NanoVDB.h:6217
__hostdev__ AccessorType getAccessor() const
Definition: NanoVDB.h:2990
ChildT UpperNodeType
Definition: NanoVDB.h:2811
uint32_t mGridCount
Definition: NanoVDB.h:1902
CoordT mBBoxMin
Definition: NanoVDB.h:3627
__hostdev__ bool isActive() const
Definition: NanoVDB.h:4331
uint64_t FloatType
Definition: NanoVDB.h:776
__hostdev__ const void * nodePtr() const
Return a non-const void pointer to the first node at LEVEL.
Definition: NanoVDB.h:2008
typename NanoLeaf< BuildT >::ValueType ValueT
Definition: NanoVDB.h:6072
__hostdev__ FloatType getDev() const
Definition: NanoVDB.h:3661
__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:4383
Definition: NanoVDB.h:6214
__hostdev__ bool isValid() const
return true if the magic number and the version are both valid
Definition: NanoVDB.h:1952
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType type
Definition: NanoVDB.h:1703
uint64_t FloatType
Definition: NanoVDB.h:770
__hostdev__ RootT & root()
Definition: NanoVDB.h:2431
float mQuantum
Definition: NanoVDB.h:3711
char * strcpy(char *dst, const char *src)
Copy characters from src to dst.
Definition: Util.h:166
double FloatType
Definition: NanoVDB.h:800
__hostdev__ bool isIndex(GridType gridType)
Return true if the GridType maps to a special index type (not a POD integer type).
Definition: NanoVDB.h:597
Map mMap
Definition: NanoVDB.h:1905
#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:4371
float type
Definition: NanoVDB.h:515
__hostdev__ const uint32_t & tileCount() const
Return the number of tiles encoded in this root node.
Definition: NanoVDB.h:3006
__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:1448
typename ChildT::LeafNodeType LeafNodeType
Definition: NanoVDB.h:2813
Bit-compacted representation of all three version numbers.
Definition: NanoVDB.h:673
__hostdev__ uint64_t lastOffset() const
Definition: NanoVDB.h:4081
__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:2144
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition: NanoVDB.h:4840
__hostdev__ ChannelAccessor(const NanoGrid< IndexT > &grid, ChannelT *channelPtr)
Ctor from an IndexGrid and an external channel.
Definition: NanoVDB.h:5700
__hostdev__ bool operator>=(const Version &rhs) const
Definition: NanoVDB.h:699
typename DataType::ValueT ValueType
Definition: NanoVDB.h:3245
typename GridOrTreeOrRootT::LeafNodeType Type
Definition: NanoVDB.h:1687
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:4409
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition: NanoVDB.h:5268
typename NanoLeaf< BuildT >::ValueType Type
Definition: NanoVDB.h:6059
Definition: NanoVDB.h:3136
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:3439
__hostdev__ bool operator==(const Mask &other) const
Definition: NanoVDB.h:1186
__hostdev__ ChildIter & operator++()
Definition: NanoVDB.h:2860
__hostdev__ bool isValueOn() const
Definition: NanoVDB.h:2708
__hostdev__ void setDev(const FloatType &)
Definition: NanoVDB.h:4196
__hostdev__ TileIterator probe(const CoordT &ijk)
Definition: NanoVDB.h:2731
__hostdev__ void setOn(uint32_t offset)
Definition: NanoVDB.h:4011
__hostdev__ const ChildT * probeChild(ValueType &value) const
Definition: NanoVDB.h:3401
__hostdev__ bool operator==(const Checksum &rhs) const
return true if the checksums are identical
Definition: NanoVDB.h:1856
__hostdev__ const NanoGrid< BuildT > & grid() const
Definition: NanoVDB.h:5563
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:1129
__hostdev__ ConstValueIterator cbeginValueAll() const
Definition: NanoVDB.h:2912
__hostdev__ void disable()
Definition: NanoVDB.h:1845
__hostdev__ const NanoGrid< IndexT > & grid() const
Return a const reference to the IndexGrid.
Definition: NanoVDB.h:5713
static constexpr uint32_t SIZE
Definition: NanoVDB.h:1030
uint32_t mNodeCount[3]
Definition: NanoVDB.h:2345
ValueType mMaximum
Definition: NanoVDB.h:3633
typename GridOrTreeOrRootT::LeafNodeType type
Definition: NanoVDB.h:1688
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:3995
static __hostdev__ CoordT KeyToCoord(const KeyT &key)
Definition: NanoVDB.h:2587
__hostdev__ const Map & map() const
Return a const reference to the Map for this grid.
Definition: NanoVDB.h:2166
__hostdev__ ValueIterator cbeginValueAll() const
Definition: NanoVDB.h:4351
__hostdev__ void setRoot(const void *root)
Definition: NanoVDB.h:2350
__hostdev__ BaseIter()
Definition: NanoVDB.h:2833
static __hostdev__ uint32_t wordCount()
Return the number of machine words used by this Mask.
Definition: NanoVDB.h:1040
__hostdev__ uint32_t operator*() const
Definition: NanoVDB.h:1103
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:3969
typename DataType::BuildT BuildType
Definition: NanoVDB.h:2816
__hostdev__ void setMin(const bool &)
Definition: NanoVDB.h:3963
__hostdev__ const StatsT & average() const
Definition: NanoVDB.h:2785
__hostdev__ void setMin(const ValueType &)
Definition: NanoVDB.h:4053
__hostdev__ uint32_t tail() const
Definition: NanoVDB.h:1831
__hostdev__ bool getAvg() const
Definition: NanoVDB.h:3955
__hostdev__ bool updateBBox()
Updates the local bounding box of active voxels in this node. Return true if bbox was updated...
Definition: NanoVDB.h:4566
__hostdev__ DenseIter & operator++()
Definition: NanoVDB.h:2964
Return point to the root Tile where math::Coord maps to one of its values, i.e. terminates.
Definition: NanoVDB.h:6164
__hostdev__ bool isBreadthFirst() const
Definition: NanoVDB.h:2243
__hostdev__ bool isPointData() const
Definition: NanoVDB.h:2235
__hostdev__ uint64_t last(uint32_t i) const
Definition: NanoVDB.h:4178
bool FloatType
Definition: NanoVDB.h:764
__hostdev__ TileT & operator*() const
Definition: NanoVDB.h:2683
__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:3462
__hostdev__ Iterator & operator++()
Definition: NanoVDB.h:1078
Definition: NanoVDB.h:750
#define __hostdev__
Definition: Util.h:73
typename DataType::FloatType FloatType
Definition: NanoVDB.h:4227
#define NANOVDB_DATA_ALIGNMENT
Definition: NanoVDB.h:133
typename DataType::Tile Tile
Definition: NanoVDB.h:2821
__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:632
__hostdev__ DenseIterator operator++(int)
Definition: NanoVDB.h:1111
__hostdev__ uint64_t getValue(uint32_t i) const
Definition: NanoVDB.h:4087
__hostdev__ void setMax(const ValueT &v)
Definition: NanoVDB.h:3225
Definition: NanoVDB.h:920
Coord CoordType
Definition: NanoVDB.h:4229
Dummy type for a 16bit quantization of float point values.
Definition: NanoVDB.h:196
uint8_t ArrayType
Definition: NanoVDB.h:3810
typename Mask< Log2Dim >::template Iterator< On > MaskIterT
Definition: NanoVDB.h:3255
__hostdev__ bool hasLongGridName() const
Definition: NanoVDB.h:2240
__hostdev__ TreeT & tree()
Return a non-const reference to the tree.
Definition: NanoVDB.h:2157
CoordT mBBoxMin
Definition: NanoVDB.h:4156
__hostdev__ void setFirstNode(const NodeT *node)
Definition: NanoVDB.h:2362
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType Type
Definition: NanoVDB.h:1723
__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:3459
__hostdev__ float getValue(uint32_t i) const
Definition: NanoVDB.h:3785
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:3167
__hostdev__ void setMin(float min)
Definition: NanoVDB.h:3747
__hostdev__ void setValue(uint32_t offset, bool)
Definition: NanoVDB.h:4010
__hostdev__ void setMax(const ValueType &v)
Definition: NanoVDB.h:3671
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:4018
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition: NanoVDB.h:3641
__hostdev__ uint32_t pos() const
Definition: NanoVDB.h:2838
__hostdev__ ChildIter()
Definition: NanoVDB.h:3275
__hostdev__ void setMin(const ValueType &)
Definition: NanoVDB.h:4193
__hostdev__ BlindDataT * getBlindData(uint32_t n)
Definition: NanoVDB.h:2299
__hostdev__ void setDev(const StatsT &v)
Definition: NanoVDB.h:3227
__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:3482
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition: NanoVDB.h:5067
__hostdev__ bool isOn(uint32_t n) const
Return true if the given bit is set.
Definition: NanoVDB.h:1198
__hostdev__ float getValue(uint32_t i) const
Definition: NanoVDB.h:3883
__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:1488
uint64_t ValueType
Definition: NanoVDB.h:4035
uint16_t ArrayType
Definition: NanoVDB.h:3840
__hostdev__ const MaskType< LOG2DIM > & childMask() const
Return a const reference to the bit mask of child nodes in this internal node.
Definition: NanoVDB.h:3449
__hostdev__ void setMax(const ValueType &)
Definition: NanoVDB.h:4054
__hostdev__ void setAvg(const FloatType &)
Definition: NanoVDB.h:4055
ValueT value
Definition: NanoVDB.h:2640
__hostdev__ void setDev(float dev)
Definition: NanoVDB.h:3756
Node caching at all (three) tree levels.
Definition: NanoVDB.h:5219
__hostdev__ void setDev(const StatsT &v)
Definition: NanoVDB.h:2791
__hostdev__ OnIterator beginOn() const
Definition: NanoVDB.h:1125
Definition: NanoVDB.h:1747
__hostdev__ void setAvg(const FloatType &)
Definition: NanoVDB.h:4195
__hostdev__ bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:5342
__hostdev__ void setOn(uint32_t offset)
Definition: NanoVDB.h:4186
bool Type
Definition: NanoVDB.h:6099
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType Type
Definition: NanoVDB.h:1702
__hostdev__ bool isMaskOn(uint32_t offset) const
Definition: NanoVDB.h:4139
BuildT BuildType
Definition: NanoVDB.h:5243
Stuct with all the member data of the LeafNode (useful during serialization of an openvdb LeafNode) ...
Definition: NanoVDB.h:3617
__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:2997
GridBlindDataSemantic
Blind-data Semantics that are currently understood by NanoVDB.
Definition: NanoVDB.h:419
Version mVersion
Definition: NanoVDB.h:1899
__hostdev__ void setAverageOn(bool on=true)
Definition: NanoVDB.h:1968
__hostdev__ bool isSequential() const
return true if nodes at all levels can safely be accessed with simple linear offsets ...
Definition: NanoVDB.h:2256
__hostdev__ Map()
Default constructor for the identity map.
Definition: NanoVDB.h:1388
GridFlags
Grid flags which indicate what extra information is present in the grid buffer.
Definition: NanoVDB.h:328
Metafunction used to determine if the first template parameter is a specialization of the class templ...
Definition: Util.h:451
static __hostdev__ constexpr uint8_t bitWidth()
Definition: NanoVDB.h:3851
__hostdev__ uint32_t & checksum(int i)
Definition: NanoVDB.h:1823
__hostdev__ DenseIterator()
Definition: NanoVDB.h:3390
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:5437
RootT RootType
Definition: NanoVDB.h:2403
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition: NanoVDB.h:3721
Definition: GridHandle.h:27
float type
Definition: NanoVDB.h:508
CoordBBox bbox
Definition: NanoVDB.h:6219
float Type
Definition: NanoVDB.h:514
__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:2448
Visits all tile values and child nodes of this node.
Definition: NanoVDB.h:3384
GridType mGridType
Definition: NanoVDB.h:1909
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:4138
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition: NanoVDB.h:4932
Definition: NanoVDB.h:1061
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
return the state and updates the value of the specified voxel
Definition: NanoVDB.h:3491
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:4045
Define static boolean tests for template build types.
Definition: NanoVDB.h:435
__hostdev__ bool isFull() const
return true if the 64 bit checksum is fill, i.e. of both had and nodes
Definition: NanoVDB.h:1840
__hostdev__ bool hasMinMax() const
Definition: NanoVDB.h:2238
__hostdev__ ConstChildIterator cbeginChild() const
Definition: NanoVDB.h:2878
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:1027
CoordT CoordType
Definition: NanoVDB.h:4907
__hostdev__ const GridBlindMetaData * blindMetaData(uint32_t n) const
Returns a const reference to the blindMetaData at the specified linear offset.
Definition: NanoVDB.h:2040
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition: NanoVDB.h:4952
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:3209
static ElementType scalar(const T &v)
Definition: NanoVDB.h:744
__hostdev__ ValueIterator beginValue() const
Definition: NanoVDB.h:3346
__hostdev__ void setMax(float max)
Definition: NanoVDB.h:3750
__hostdev__ TileIter()
Definition: NanoVDB.h:2666
static __hostdev__ constexpr uint8_t bitWidth()
Definition: NanoVDB.h:3784
__hostdev__ bool getMax() const
Definition: NanoVDB.h:3954
uint64_t mData2
Definition: NanoVDB.h:1914
typename ChildT::ValueType ValueT
Definition: NanoVDB.h:2569
float mMinimum
Definition: NanoVDB.h:3710
__hostdev__ uint64_t offset() const
Definition: NanoVDB.h:4175
static __hostdev__ Coord OffsetToLocalCoord(uint32_t n)
Definition: NanoVDB.h:3514
__hostdev__ const Vec3d & voxelSize() const
Return a vector of the axial voxel sizes.
Definition: NanoVDB.h:5719
__hostdev__ constexpr uint32_t strlen()
return the number of characters (including null termination) required to convert enum type to a strin...
Definition: NanoVDB.h:210
typename NanoLeaf< BuildT >::FloatType FloatType
Definition: NanoVDB.h:6213
Definition: NanoVDB.h:4031
KeyT key
Definition: NanoVDB.h:2637
__hostdev__ bool isChild() const
Definition: NanoVDB.h:2698
uint64_t FloatType
Definition: NanoVDB.h:782
__hostdev__ uint64_t pointCount() const
Definition: NanoVDB.h:4176
typename DataType::StatsT FloatType
Definition: NanoVDB.h:3246
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition: NanoVDB.h:5129
__hostdev__ uint32_t & tail()
Definition: NanoVDB.h:1832
bool ValueType
Definition: NanoVDB.h:3936
__hostdev__ Tile * probeTile(const CoordT &ijk)
Definition: NanoVDB.h:2747
__hostdev__ uint64_t getAvg() const
Definition: NanoVDB.h:4085
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition: NanoVDB.h:4852
__hostdev__ uint64_t checksum() const
return the 64 bit checksum of this instance
Definition: NanoVDB.h:1821
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:4266
Top-most node of the VDB tree structure.
Definition: NanoVDB.h:2804
int64_t child
Definition: NanoVDB.h:3139
#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:1457
uint8_t ArrayType
Definition: NanoVDB.h:3773
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:3645
Struct to derive node type from its level in a given grid, tree or root while preserving constness...
Definition: NanoVDB.h:1680
typename GridT::TreeType type
Definition: NanoVDB.h:2381
__hostdev__ Codec toCodec(const char *str)
Definition: NanoVDB.h:5806
Definition: IndexIterator.h:43
Definition: NanoVDB.h:2845
uint32_t level
Definition: NanoVDB.h:6216
__hostdev__ float getValue(uint32_t i) const
Definition: NanoVDB.h:3821
uint32_t mTileCount[3]
Definition: NanoVDB.h:2346
typename RootT::ChildNodeType Node2
Definition: NanoVDB.h:2414
__hostdev__ CoordType getOrigin() const
Definition: NanoVDB.h:3372
__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:3456
ValueType mMinimum
Definition: NanoVDB.h:3632
__hostdev__ const void * blindData(uint32_t n) const
Returns a const pointer to the blindData at the specified linear offset.
Definition: NanoVDB.h:2284
__hostdev__ GridType toGridType()
Maps from a templated build type to a GridType enum.
Definition: NanoVDB.h:807
size_t strlen(const char *str)
length of a c-sting, excluding '\0'.
Definition: Util.h:153
MatType scale(const Vec3< typename MatType::value_type > &s)
Return a matrix that scales by s.
Definition: Mat.h:615
static __hostdev__ uint32_t dim()
Definition: NanoVDB.h:4222
__hostdev__ bool isCached(const CoordType &ijk) const
Definition: NanoVDB.h:5329
uint64_t Type
Definition: NanoVDB.h:465
uint64_t type
Definition: NanoVDB.h:473
const typename NanoRoot< BuildT >::Tile * Type
Definition: NanoVDB.h:6166
__hostdev__ float getDev() const
return the quantized standard deviation of the active values in this node
Definition: NanoVDB.h:3744
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:3367
ValueT mMaximum
Definition: NanoVDB.h:3153
__hostdev__ uint64_t idx(int i, int j, int k) const
Definition: NanoVDB.h:5739
static __hostdev__ CoordT OffsetToLocalCoord(uint32_t n)
Compute the local coordinates from a linear offset.
Definition: NanoVDB.h:4393
__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:3471
__hostdev__ ValueType getValue(const CoordType &ijk) const
Return the value of the given voxel.
Definition: NanoVDB.h:3488
__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:3022
__hostdev__ uint64_t getValue(uint32_t i) const
Definition: NanoVDB.h:4179
__hostdev__ bool operator<=(const Version &rhs) const
Definition: NanoVDB.h:697
__hostdev__ bool getValue(uint32_t i) const
Definition: NanoVDB.h:3952
T ElementType
Definition: NanoVDB.h:732
bool Type
Definition: NanoVDB.h:6177
typename RootType::LeafNodeType LeafNodeType
Definition: NanoVDB.h:2107
float Type
Definition: NanoVDB.h:528
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition: NanoVDB.h:4965
__hostdev__ auto pos() const
Definition: NanoVDB.h:2677
uint64_t Type
Definition: NanoVDB.h:472
__hostdev__ uint32_t getMinor() const
Definition: NanoVDB.h:702
Struct with all the member data of the RootNode (useful during serialization of an openvdb RootNode) ...
Definition: NanoVDB.h:2567
__hostdev__ CoordType getCoord() const
Definition: NanoVDB.h:3301
__hostdev__ ValueIterator operator++(int)
Definition: NanoVDB.h:4342
__hostdev__ int findBlindDataForSemantic(GridBlindDataSemantic semantic) const
Return the index of the first blind data with specified semantic if found, otherwise -1...
Definition: NanoVDB.h:2312
static __hostdev__ bool hasStats()
Definition: NanoVDB.h:3716
__hostdev__ ValueOffIterator(const LeafNode *parent)
Definition: NanoVDB.h:4281
openvdb::GridBase Grid
Definition: Utils.h:43
__hostdev__ Mask(bool on)
Definition: NanoVDB.h:1137
__hostdev__ void setOff(uint32_t n)
Set the specified bit off.
Definition: NanoVDB.h:1224
__hostdev__ const char * gridName() const
Return a c-string with the name of this grid.
Definition: NanoVDB.h:2259
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:4287
typename RootNodeType::ChildNodeType UpperNodeType
Definition: NanoVDB.h:2405
double FloatType
Definition: NanoVDB.h:758
uint64_t type
Definition: NanoVDB.h:480
__hostdev__ ChildT * getChild(const Tile *tile)
Returns a const reference to the child node in the specified tile.
Definition: NanoVDB.h:2772
__hostdev__ const Checksum & checksum() const
Return checksum of the grid buffer.
Definition: NanoVDB.h:2265
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition: NanoVDB.h:5055
GridClass mGridClass
Definition: NanoVDB.h:1908
__hostdev__ Version(uint32_t data)
Constructor from a raw uint32_t data representation.
Definition: NanoVDB.h:686
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:456
__hostdev__ const DataType * data() const
Definition: NanoVDB.h:2426
__hostdev__ ValueType getLastValue() const
Return the last value in this leaf node.
Definition: NanoVDB.h:4448
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:3759
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition: NanoVDB.h:4961
__hostdev__ bool isHalf() const
Definition: NanoVDB.h:1837
__hostdev__ uint64_t getDev() const
Definition: NanoVDB.h:4086
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:3950
math::BBox< CoordT > mBBox
Definition: NanoVDB.h:2599
__hostdev__ ValueIterator(const LeafNode *parent)
Definition: NanoVDB.h:4314
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition: NanoVDB.h:4813
typename RootT::ValueType ValueType
Definition: NanoVDB.h:4807
__hostdev__ DataT * data() const
Definition: NanoVDB.h:2693
__hostdev__ uint32_t id() const
Definition: NanoVDB.h:700
__hostdev__ size_t memUsage() const
Definition: NanoVDB.h:3881
__hostdev__ ValueType getMin() const
Definition: NanoVDB.h:4188
__hostdev__ const NodeT * getFirstNode() const
return a const pointer to the first node of the specified type
Definition: NanoVDB.h:2505
typename ChildT::CoordType CoordType
Definition: NanoVDB.h:2818
__hostdev__ uint32_t getPatch() const
Definition: NanoVDB.h:703
Definition: NanoVDB.h:2915
__hostdev__ DenseIter(RootT *parent)
Definition: NanoVDB.h:2956
__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:3468
__hostdev__ void setOn(uint32_t n)
Set the specified bit on.
Definition: NanoVDB.h:1222
__hostdev__ const uint64_t & firstOffset() const
Definition: NanoVDB.h:4052
__hostdev__ CoordT getCoord() const
Definition: NanoVDB.h:4259
__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:1497
__hostdev__ bool isCompatible() const
Definition: NanoVDB.h:704
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition: NanoVDB.h:4956
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition: NanoVDB.h:5125
static __hostdev__ constexpr uint8_t bitWidth()
Definition: NanoVDB.h:3820
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition: NanoVDB.h:5132
__hostdev__ const ValueType & background() const
Return a const reference to the background value.
Definition: NanoVDB.h:2451
const typename GridOrTreeOrRootT::LeafNodeType type
Definition: NanoVDB.h:1695
__hostdev__ int age() const
Returns the difference between major version of this instance and NANOVDB_MAJOR_VERSION_NUMBER.
Definition: NanoVDB.h:708
__hostdev__ bool isRootNext() const
return true if RootData is layout out immediately after TreeData in memory
Definition: NanoVDB.h:2371
__hostdev__ NodeT * getFirstNode()
return a pointer to the first node of the specified type
Definition: NanoVDB.h:2495
__hostdev__ const NodeTrait< RootT, 2 >::type * getFirstUpper() const
Definition: NanoVDB.h:2535
CheckMode
List of different modes for computing for a checksum.
Definition: NanoVDB.h:1764
__hostdev__ void setAvg(const FloatType &v)
Definition: NanoVDB.h:3672
__hostdev__ uint8_t bitWidth() const
Definition: NanoVDB.h:3880
__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:3016
__hostdev__ ValueIter operator++(int)
Definition: NanoVDB.h:2900
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition: NanoVDB.h:3161
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:4321
__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:2555
__hostdev__ uint32_t pos() const
Definition: NanoVDB.h:1076
__hostdev__ void setOn(uint32_t offset)
Definition: NanoVDB.h:3731
__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:5758
typename Node2::ChildNodeType Node1
Definition: NanoVDB.h:2415
Dummy type for a 16 bit floating point values (placeholder for IEEE 754 Half)
Definition: NanoVDB.h:187
static __hostdev__ uint64_t memUsage()
return memory usage in bytes for the class
Definition: NanoVDB.h:2429
RootT RootNodeType
Definition: NanoVDB.h:2404
__hostdev__ Vec3T applyInverseMapF(const Vec3T &xyz) const
Definition: NanoVDB.h:1991
__hostdev__ uint64_t first(uint32_t i) const
Definition: NanoVDB.h:4177
__hostdev__ bool isMaskOn(uint32_t offset) const
Definition: NanoVDB.h:4128
__hostdev__ bool isGridIndex() const
Definition: NanoVDB.h:2234
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition: NanoVDB.h:5061
__hostdev__ NodeT * child() const
Definition: NanoVDB.h:2713
uint32_t countOn(uint64_t v)
Definition: Util.h:622
__hostdev__ ChannelAccessor(const NanoGrid< IndexT > &grid, uint32_t channelID=0u)
Ctor from an IndexGrid and an integer ID of an internal channel that is assumed to exist as blind dat...
Definition: NanoVDB.h:5689
__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:5567
void ArrayType
Definition: NanoVDB.h:4037
__hostdev__ ChannelT & operator()(const math::Coord &ijk) const
Definition: NanoVDB.h:5743
__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:1052
__hostdev__ ChildIter()
Definition: NanoVDB.h:2853
__hostdev__ bool hasStats() const
Definition: NanoVDB.h:4050
__hostdev__ uint64_t memUsage() const
Return the actual memory footprint of this root node.
Definition: NanoVDB.h:3028
int64_t child
Definition: NanoVDB.h:2638
__hostdev__ void fill(const ValueType &v)
Definition: NanoVDB.h:3681
__hostdev__ bool getAvg() const
Definition: NanoVDB.h:4008
BuildT ArrayType
Definition: NanoVDB.h:3624
uint32_t mBlindMetadataCount
Definition: NanoVDB.h:1911
Type Pow2(Type x)
Return x2.
Definition: Math.h:548
__hostdev__ OffIterator beginOff() const
Definition: NanoVDB.h:1127
__hostdev__ DenseIterator beginDense()
Definition: NanoVDB.h:2980
BuildT BuildType
Definition: NanoVDB.h:4905
__hostdev__ bool getMin() const
Definition: NanoVDB.h:3953
__hostdev__ const DataType * data() const
Definition: NanoVDB.h:4364
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:4850
__hostdev__ bool getMax() const
Definition: NanoVDB.h:4007
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:2926
bool BuildType
Definition: NanoVDB.h:3937
__hostdev__ CoordT origin() const
Definition: NanoVDB.h:2636
__hostdev__ bool operator<(const Version &rhs) const
Definition: NanoVDB.h:696
__hostdev__ bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:5133
__hostdev__ const Vec3dBBox & worldBBox() const
return AABB of active values in world space
Definition: NanoVDB.h:2066
__hostdev__ void setOn(uint32_t offset)
Definition: NanoVDB.h:3962
__hostdev__ uint8_t flags() const
Definition: NanoVDB.h:4385
__hostdev__ const ValueT & getMax() const
Definition: NanoVDB.h:3212
typename UpperNodeType::ChildNodeType LowerNodeType
Definition: NanoVDB.h:2106
__hostdev__ bool isEmpty() const
Return true if this RootNode is empty, i.e. contains no values or nodes.
Definition: NanoVDB.h:3031
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:5988
uint64_t Type
Definition: NanoVDB.h:535
CoordT mBBoxMin
Definition: NanoVDB.h:4040
__hostdev__ uint32_t checksum(int i) const
Definition: NanoVDB.h:1825
__hostdev__ bool operator!=(const Mask &other) const
Definition: NanoVDB.h:1195
CoordT CoordType
Definition: NanoVDB.h:5037
Dummy type for a variable bit quantization of floating point values.
Definition: NanoVDB.h:199
__hostdev__ Vec3T indexToWorldF(const Vec3T &xyz) const
index to world space transformation
Definition: NanoVDB.h:2197
__hostdev__ const MaskType< LOG2DIM > & getChildMask() const
Definition: NanoVDB.h:3450
StatsT mAverage
Definition: NanoVDB.h:2605
Visits all values in a leaf node, i.e. both active and inactive values.
Definition: NanoVDB.h:4303
__hostdev__ void setMin(const ValueT &v)
Definition: NanoVDB.h:3224
__hostdev__ bool hasAverage() const
Definition: NanoVDB.h:2241
__hostdev__ CoordType getCoord() const
Definition: NanoVDB.h:3338
__hostdev__ bool isActive() const
Definition: NanoVDB.h:2635
Visits active tile values of this node only.
Definition: NanoVDB.h:3350
__hostdev__ const NodeTrait< RootT, LEVEL >::type * getFirstNode() const
return a const pointer to the first node of the specified level
Definition: NanoVDB.h:2524
#define NANOVDB_HOSTDEV_DISABLE_WARNING
Definition: Util.h:94
__hostdev__ void setValueOnly(uint32_t offset, const ValueType &value)
Definition: NanoVDB.h:3650
Visits all inactive values in a leaf node.
Definition: NanoVDB.h:4270
__hostdev__ const TreeType & tree() const
Return a const reference to the tree of the IndexGrid.
Definition: NanoVDB.h:5716
Like ValueIndex but with a mutable mask.
Definition: NanoVDB.h:178
typename RootT::ValueType ValueType
Definition: NanoVDB.h:2408
static __hostdev__ uint64_t memUsage(uint32_t tableSize)
Return the expected memory footprint in bytes with the specified number of tiles. ...
Definition: NanoVDB.h:3025
Definition: NanoVDB.h:1749
__hostdev__ ValueIterator beginValue() const
Definition: NanoVDB.h:4350
static __hostdev__ bool hasStats()
Definition: NanoVDB.h:3999
float FloatType
Definition: NanoVDB.h:752
__hostdev__ CheckMode mode() const
return the mode of the 64 bit checksum
Definition: NanoVDB.h:1848
__hostdev__ bool isMask() const
Definition: NanoVDB.h:2236
__hostdev__ Vec3T applyJacobianF(const Vec3T &xyz) const
Definition: NanoVDB.h:1993
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition: NanoVDB.h:4959
__hostdev__ void setMax(const bool &)
Definition: NanoVDB.h:3964
typename RootNodeType::ChildNodeType UpperNodeType
Definition: NanoVDB.h:2105
typename ChildT::BuildType BuildT
Definition: NanoVDB.h:2570
typename BuildT::ValueType ValueType
Definition: NanoVDB.h:2109
__hostdev__ uint32_t nodeCount() const
Return number of nodes at LEVEL.
Definition: NanoVDB.h:2031
float ValueType
Definition: NanoVDB.h:3702
__hostdev__ Mask & operator&=(const Mask &other)
Bitwise intersection.
Definition: NanoVDB.h:1299
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition: NanoVDB.h:5138
__hostdev__ const TreeT & tree() const
Return a const reference to the tree.
Definition: NanoVDB.h:2154
uint32_t findLowestOn(uint32_t v)
Returns the index of the lowest, i.e. least significant, on bit in the specified 32 bit word...
Definition: Util.h:502
__hostdev__ ChannelT & getValue(const math::Coord &ijk) const
Return the value from a cached channel that maps to the specified coordinate.
Definition: NanoVDB.h:5742
uint64_t mData1
Definition: NanoVDB.h:1913
BitFlags(Type mask)
Definition: NanoVDB.h:928
__hostdev__ bool isValueOn() const
Definition: NanoVDB.h:3412
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:2207
__hostdev__ BaseIter(DataT *data)
Definition: NanoVDB.h:2834
__hostdev__ Iterator()
Definition: NanoVDB.h:1064
typename ChildT::template MaskType< LOG2DIM > MaskT
Definition: NanoVDB.h:3133
__hostdev__ uint64_t getDev() const
Definition: NanoVDB.h:4106
BitFlags< 32 > mFlags
Definition: NanoVDB.h:1900
__hostdev__ Vec3T applyInverseJacobianF(const Vec3T &xyz) const
Definition: NanoVDB.h:1995
__hostdev__ ValueOnIter operator++(int)
Definition: NanoVDB.h:2933
uint8_t mFlags
Definition: NanoVDB.h:4158
__hostdev__ void setAvg(const bool &)
Definition: NanoVDB.h:3965
__hostdev__ void setMin(const ValueType &v)
Definition: NanoVDB.h:3670
__hostdev__ bool getMin() const
Definition: NanoVDB.h:4006
__hostdev__ bool isStaggered() const
Definition: NanoVDB.h:2232
__hostdev__ ConstChildIterator cbeginChild() const
Definition: NanoVDB.h:3308
uint8_t mFlags
Definition: NanoVDB.h:3994
void writeUncompressedGrid(StreamT &os, const GridData *gridData, bool raw=false)
This is a standalone alternative to io::writeGrid(...,Codec::NONE) defined in util/IO.h Unlike the latter this function has no dependencies at all, not even NanoVDB.h, so it also works if client code only includes PNanoVDB.h!
Definition: NanoVDB.h:5884
__hostdev__ bool isEmpty() const
test if the grid is empty, e.i the root table has size 0
Definition: NanoVDB.h:2080
__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:5634
__hostdev__ NodeT * operator->() const
Definition: NanoVDB.h:3291
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:3708
#define __device__
Definition: Util.h:79
__hostdev__ Vec3T applyInverseMap(const Vec3T &xyz) const
Definition: NanoVDB.h:1980
int64_t mBlindMetadataOffset
Definition: NanoVDB.h:1910
float mTaperF
Definition: NanoVDB.h:1381
Implements Tree::probeLeaf(math::Coord)
Definition: NanoVDB.h:1757
__hostdev__ ChildIter(RootT *parent)
Definition: NanoVDB.h:2854
__hostdev__ void setValue(uint32_t offset, const ValueType &value)
Definition: NanoVDB.h:3651
__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:2368
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:4043
typename RootT::CoordType CoordType
Definition: NanoVDB.h:4808
__hostdev__ MagicType toMagic(uint64_t magic)
maps 64 bits of magic number to enum
Definition: NanoVDB.h:367
__hostdev__ const DataType * data() const
Definition: NanoVDB.h:3436
__hostdev__ bool isLevelSet() const
Definition: NanoVDB.h:2230
__hostdev__ ChildT * probeChild(const CoordT &ijk)
Definition: NanoVDB.h:2758
RootType RootNodeType
Definition: NanoVDB.h:2104
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition: NanoVDB.h:5300
static __hostdev__ uint64_t memUsage()
Return memory usage in bytes for this class only.
Definition: NanoVDB.h:2063
__hostdev__ void setValueOnly(const CoordT &ijk, const ValueType &v)
Definition: NanoVDB.h:4459
__hostdev__ const NodeT * getNode() const
Return a const point to the cached node of the specified type.
Definition: NanoVDB.h:5284
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:3845
__hostdev__ bool isFloatingPoint(GridType gridType)
return true if the GridType maps to a floating point type
Definition: NanoVDB.h:558
CoordT mBBoxMin
Definition: NanoVDB.h:3942
__hostdev__ void setOff()
Set all bits off.
Definition: NanoVDB.h:1279
__hostdev__ void localToGlobalCoord(Coord &ijk) const
modifies local coordinates to global coordinates of a tile or child node
Definition: NanoVDB.h:3522
__hostdev__ void setAvg(const StatsT &v)
Definition: NanoVDB.h:2790
__hostdev__ CoordType getOrigin() const
Definition: NanoVDB.h:3333
__hostdev__ const LeafNodeType * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:3492
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
return the state and updates the value of the specified voxel
Definition: NanoVDB.h:3038
__hostdev__ Vec3T indexToWorldGrad(const Vec3T &grad) const
transform the gradient from index space to world space.
Definition: NanoVDB.h:2189
__hostdev__ uint64_t activeVoxelCount() const
Computes a AABB of active values in world space.
Definition: NanoVDB.h:2224
__hostdev__ const LeafNode * probeLeaf(const CoordT &) const
Definition: NanoVDB.h:4483
__hostdev__ uint64_t * words()
Return a pointer to the list of words of the bit mask.
Definition: NanoVDB.h:1152
__hostdev__ void init(float min, float max, uint8_t bitWidth)
Definition: NanoVDB.h:3725
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition: NanoVDB.h:4849
__hostdev__ Version(uint32_t major, uint32_t minor, uint32_t patch)
Constructor from major.minor.patch version numbers.
Definition: NanoVDB.h:688
__hostdev__ Mask & operator|=(const Mask &other)
Bitwise union.
Definition: NanoVDB.h:1307
static __hostdev__ uint32_t voxelCount()
Return the total number of voxels (e.g. values) encoded in this leaf node.
Definition: NanoVDB.h:4426
typename ChildT::BuildType BuildT
Definition: NanoVDB.h:3130
__hostdev__ DataType * data()
Definition: NanoVDB.h:4362
__hostdev__ Mask & operator-=(const Mask &other)
Bitwise difference.
Definition: NanoVDB.h:1315
__hostdev__ Checksum(uint64_t checksum, CheckMode mode=CheckMode::Full)
Definition: NanoVDB.h:1814
__hostdev__ ValueIterator beginValue()
Definition: NanoVDB.h:2911
__hostdev__ const RootT & root() const
Definition: NanoVDB.h:5273
uint64_t mPointCount
Definition: NanoVDB.h:4162
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition: NanoVDB.h:4847
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:4049
__hostdev__ CoordType origin() const
Return the origin in index space of this leaf node.
Definition: NanoVDB.h:3453
__hostdev__ DenseIterator(uint32_t pos=Mask::SIZE)
Definition: NanoVDB.h:1098
__hostdev__ CoordT getCoord() const
Definition: NanoVDB.h:4292
MaskT< LOG2DIM > mMask
Definition: NanoVDB.h:4137
PointAccessor(const NanoGrid< BuildT > &grid)
Definition: NanoVDB.h:5550
__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:1506
__hostdev__ void setValueOnly(uint32_t offset, uint16_t value)
Definition: NanoVDB.h:4180
__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:5738
ValueT mMinimum
Definition: NanoVDB.h:3152
__hostdev__ bool setGridName(const char *src)
Definition: NanoVDB.h:1970
__hostdev__ void setMask(uint32_t offset, bool v)
Definition: NanoVDB.h:4129
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:3945
__hostdev__ void localToGlobalCoord(Coord &ijk) const
Converts (in place) a local index coordinate to a global index coordinate.
Definition: NanoVDB.h:4401
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition: NanoVDB.h:5250
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:4199
uint64_t ValueType
Definition: NanoVDB.h:4150
Dummy type for a 8bit quantization of float point values.
Definition: NanoVDB.h:193
__hostdev__ DataType * data()
Definition: NanoVDB.h:2424
typename NanoLeaf< BuildT >::ValueType ValueType
Definition: NanoVDB.h:6212
MagicType
Enums used to identify magic numbers recognized by NanoVDB.
Definition: NanoVDB.h:358
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition: NanoVDB.h:5383
__hostdev__ bool isValueOn() const
Definition: NanoVDB.h:2963
Dummy type for a voxel whose value equals its binary active state.
Definition: NanoVDB.h:184
uint8_t mFlags
Definition: NanoVDB.h:4042
uint64_t mPrefixSum
Definition: NanoVDB.h:4044
__hostdev__ CoordType getCoord() const
Definition: NanoVDB.h:2841
__hostdev__ Vec3T applyJacobian(const Vec3T &xyz) const
Definition: NanoVDB.h:1982
__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:2151
__hostdev__ const RootT & root() const
Definition: NanoVDB.h:5078
typename util::match_const< ChildT, DataT >::type NodeT
Definition: NanoVDB.h:2662
__hostdev__ ChildIter(ParentT *parent)
Definition: NanoVDB.h:3280
uint32_t mGridIndex
Definition: NanoVDB.h:1901
__hostdev__ ValueOnIterator(const LeafNode *parent)
Definition: NanoVDB.h:4248
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition: NanoVDB.h:5131
uint64_t mVoxelCount
Definition: NanoVDB.h:2347
static __hostdev__ uint32_t CoordToOffset(const CoordType &ijk)
Return the linear offset corresponding to the given coordinate.
Definition: NanoVDB.h:3506
__hostdev__ uint32_t nodeCount() const
Definition: NanoVDB.h:2474
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition: NanoVDB.h:5130
uint64_t type
Definition: NanoVDB.h:466
__hostdev__ Vec3T applyMap(const Vec3T &ijk) const
Apply the forward affine transformation to a vector using 64bit floating point arithmetics.
Definition: NanoVDB.h:1431
CoordT CoordType
Definition: NanoVDB.h:5245
__hostdev__ CoordType getCoord() const
Definition: NanoVDB.h:3377
static __hostdev__ bool hasStats()
Definition: NanoVDB.h:3647
__hostdev__ const CoordBBox & indexBBox() const
return AABB of active values in index space
Definition: NanoVDB.h:2069
__hostdev__ bool isFloatingPointVector(GridType gridType)
return true if the GridType maps to a floating point vec3.
Definition: NanoVDB.h:572
ValueT mBackground
Definition: NanoVDB.h:2602
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType type
Definition: NanoVDB.h:1724
__hostdev__ ValueOnIterator()
Definition: NanoVDB.h:3356
__hostdev__ bool isInteger(GridType gridType)
Return true if the GridType maps to a POD integer type.
Definition: NanoVDB.h:584
__hostdev__ AccessorType getAccessor() const
Definition: NanoVDB.h:2435
__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:5644
NANOVDB_HOSTDEV_DISABLE_WARNING __hostdev__ uint32_t findPrev(uint32_t start) const
Definition: NanoVDB.h:1357
__hostdev__ bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:3036
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:2892
__hostdev__ const RootT & root() const
Definition: NanoVDB.h:4938
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType type
Definition: NanoVDB.h:1710
void ArrayType
Definition: NanoVDB.h:3989
Defines an affine transform and its inverse represented as a 3x3 matrix and a vec3 translation...
Definition: NanoVDB.h:1376
uint64_t FloatType
Definition: NanoVDB.h:4036
float Type
Definition: NanoVDB.h:507
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache Noop since this template specializa...
Definition: NanoVDB.h:4832
__hostdev__ const Tile * probeTile(const CoordT &ijk) const
Definition: NanoVDB.h:2753
#define NANOVDB_ASSERT(x)
Definition: Util.h:50
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType type
Definition: NanoVDB.h:1717
GridType
List of types that are currently supported by NanoVDB.
Definition: NanoVDB.h:220
typename BuildT::CoordType CoordType
Definition: NanoVDB.h:2111
__hostdev__ ValueOnIterator cbeginValueOn() const
Definition: NanoVDB.h:4267
__hostdev__ DenseIterator & operator++()
Definition: NanoVDB.h:1106
__hostdev__ void setOn()
Set all bits on.
Definition: NanoVDB.h:1273
__hostdev__ FloatType average() const
Return a const reference to the average of all the active values encoded in this leaf node...
Definition: NanoVDB.h:4377
Class to access points at a specific voxel location.
Definition: NanoVDB.h:5543
__hostdev__ Mask & operator^=(const Mask &other)
Bitwise XOR.
Definition: NanoVDB.h:1323
ValueT mMaximum
Definition: NanoVDB.h:2604
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:545
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition: NanoVDB.h:4912
__hostdev__ Iterator operator++(int)
Definition: NanoVDB.h:1083
ValueT mMinimum
Definition: NanoVDB.h:2603
__hostdev__ ChildIter operator++(int)
Definition: NanoVDB.h:2866
bool FloatType
Definition: NanoVDB.h:794
__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:2467
C++11 implementation of std::is_floating_point.
Definition: Util.h:329
__hostdev__ FloatType getDev() const
Definition: NanoVDB.h:4191
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:3328
__hostdev__ const RootT & root() const
Definition: NanoVDB.h:4834
static void * memzero(void *dst, size_t byteCount)
Zero initialization of memory.
Definition: Util.h:297
__hostdev__ DataType * data()
Definition: NanoVDB.h:3434
const typename GridOrTreeOrRootT::RootNodeType type
Definition: NanoVDB.h:1739
__hostdev__ void setAvg(const StatsT &v)
Definition: NanoVDB.h:3226
__hostdev__ ValueT getValue(uint32_t n) const
Definition: NanoVDB.h:3194
static DstT * PtrAdd(void *p, int64_t offset)
Adds a byte offset to a non-const pointer to produce another non-const pointer.
Definition: Util.h:478
__hostdev__ void setValue(const CoordT &ijk, const ValueType &v)
Sets the value at the specified location and activate its state.
Definition: NanoVDB.h:4453
__hostdev__ ValueOnIter & operator++()
Definition: NanoVDB.h:2927
__hostdev__ float getAvg() const
return the quantized average of the active values in this node
Definition: NanoVDB.h:3740
Class that encapsulates two CRC32 checksums, one for the Grid, Tree and Root node meta data and one f...
Definition: NanoVDB.h:1790
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:5344
__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:2460
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition: NanoVDB.h:4845
__hostdev__ float getMax() const
return the quantized maximum of the active values in this node
Definition: NanoVDB.h:3737
typename ChildT::ValueType ValueT
Definition: NanoVDB.h:3129
__hostdev__ bool getDev() const
Definition: NanoVDB.h:3956
Implements Tree::getDim(math::Coord)
Definition: NanoVDB.h:1753
Definition: NanoVDB.h:2827
__hostdev__ const ValueType & background() const
Return the total number of active voxels in the root and all its child nodes.
Definition: NanoVDB.h:3003
__hostdev__ DenseIterator beginDense() const
Definition: NanoVDB.h:3425
Codec
Define compression codecs.
Definition: NanoVDB.h:5790
__hostdev__ Vec3T applyIJT(const Vec3T &xyz) const
Definition: NanoVDB.h:1986
__hostdev__ uint32_t countOn() const
Return the total number of set bits in this Mask.
Definition: NanoVDB.h:1043
uint8_t mFlags
Definition: NanoVDB.h:3707
__hostdev__ bool isChild(uint32_t n) const
Definition: NanoVDB.h:3206
Internal nodes of a VDB tree.
Definition: NanoVDB.h:3241
__hostdev__ ValueOnIterator()
Definition: NanoVDB.h:4243
__hostdev__ ValueType getMax() const
Definition: NanoVDB.h:4189
__hostdev__ ConstDenseIterator cbeginChildAll() const
Definition: NanoVDB.h:2982
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:553
__hostdev__ bool isOn() const
Return true if all the bits are set in this Mask.
Definition: NanoVDB.h:1204
__hostdev__ ConstTileIterator probe(const CoordT &ijk) const
Definition: NanoVDB.h:2739
ValueT ValueType
Definition: NanoVDB.h:5244
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition: NanoVDB.h:4844
BuildT TreeType
Definition: NanoVDB.h:2102
Base-class for quantized float leaf nodes.
Definition: NanoVDB.h:3698
uint64_t FloatType
Definition: NanoVDB.h:788
math::BBox< CoordT > mBBox
Definition: NanoVDB.h:3147
__hostdev__ const LeafNodeType * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:3039
__hostdev__ void setMin(const ValueT &v)
Definition: NanoVDB.h:2788
__hostdev__ Vec3T worldToIndexF(const Vec3T &xyz) const
world to index space transformation
Definition: NanoVDB.h:2193
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:3949
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType Type
Definition: NanoVDB.h:1709
__hostdev__ uint64_t getMin() const
Definition: NanoVDB.h:4103
__hostdev__ CoordType getOrigin() const
Definition: NanoVDB.h:3417
__hostdev__ bool isCached(const CoordType &ijk) const
Definition: NanoVDB.h:4945
__hostdev__ Vec3T worldToIndex(const Vec3T &xyz) const
world to index space transformation
Definition: NanoVDB.h:2170
Definition: NanoVDB.h:2342
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:4173
C++11 implementation of std::is_same.
Definition: Util.h:314
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition: NanoVDB.h:5262
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:3714
__hostdev__ void setValue(uint32_t offset, bool v)
Definition: NanoVDB.h:3957
__hostdev__ bool isActive() const
Return true if this node or any of its child nodes contain active values.
Definition: NanoVDB.h:3536
__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:2438
__hostdev__ uint64_t getMin() const
Definition: NanoVDB.h:4083
Struct with all the member data of the InternalNode (useful during serialization of an openvdb Intern...
Definition: NanoVDB.h:3127
static __hostdev__ constexpr int64_t memUsage()
Definition: NanoVDB.h:3813
__hostdev__ const NanoGrid< Point > & grid() const
Definition: NanoVDB.h:5630
TileT * mPos
Definition: NanoVDB.h:2663
static __hostdev__ constexpr uint64_t memUsage()
Definition: NanoVDB.h:3844
const typename GridT::TreeType Type
Definition: NanoVDB.h:2386
Dummy type for a 4bit quantization of float point values.
Definition: NanoVDB.h:190
__hostdev__ bool operator!=(const Checksum &rhs) const
return true if the checksums are not identical
Definition: NanoVDB.h:1860
uint32_t Type
Definition: NanoVDB.h:6113
__hostdev__ uint64_t gridSize() const
Return memory usage in bytes for this class only.
Definition: NanoVDB.h:2131
typename ChildT::CoordType CoordT
Definition: NanoVDB.h:3132
uint64_t mCRC64
Definition: NanoVDB.h:1796
__hostdev__ uint64_t & full()
Definition: NanoVDB.h:1828
__hostdev__ void setMin(const ValueType &)
Definition: NanoVDB.h:4012
Return point to the lower internal node where math::Coord maps to one of its values, i.e. terminates.
Definition: NanoVDB.h:6139
uint64_t type
Definition: NanoVDB.h:487
static __hostdev__ bool hasStats()
Definition: NanoVDB.h:3951
const typename GridT::TreeType type
Definition: NanoVDB.h:2387
__hostdev__ NodeTrait< RootT, 1 >::type * getFirstLower()
Definition: NanoVDB.h:2532
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition: NanoVDB.h:4958
__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:3465
__hostdev__ const ValueT & getMin() const
Definition: NanoVDB.h:3211
__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:5655
uint8_t mFlags
Definition: NanoVDB.h:3944
T type
Definition: Util.h:387
__hostdev__ uint64_t getAvg() const
Definition: NanoVDB.h:4105
__hostdev__ void setBBoxOn(bool on=true)
Definition: NanoVDB.h:1966
__hostdev__ bool isUnknown() const
Definition: NanoVDB.h:2237
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition: NanoVDB.h:2611
__hostdev__ uint32_t head() const
Definition: NanoVDB.h:1829
T type
Definition: NanoVDB.h:459
__hostdev__ ValueIterator & operator++()
Definition: NanoVDB.h:4337
__hostdev__ uint32_t blindDataCount() const
Return true if this grid is empty, i.e. contains no values or nodes.
Definition: NanoVDB.h:2271
__hostdev__ void setChild(uint32_t n, const void *ptr)
Definition: NanoVDB.h:3169
__hostdev__ Vec3T applyInverseJacobian(const Vec3T &xyz) const
Definition: NanoVDB.h:1984
__hostdev__ bool operator==(const Version &rhs) const
Definition: NanoVDB.h:695
Struct with all the member data of the Grid (useful during serialization of an openvdb grid) ...
Definition: NanoVDB.h:1894
bool ValueType
Definition: NanoVDB.h:3986
typename ChildT::template MaskType< LOG2 > MaskType
Definition: NanoVDB.h:3253
auto callNanoGrid(GridDataT *gridData, ArgsT &&...args)
Below is an example of the struct used for generic programming with callNanoGrid. ...
Definition: NanoVDB.h:4720
Implements Tree::isActive(math::Coord)
Definition: NanoVDB.h:1751
__hostdev__ Vec3T applyInverseMapF(const Vec3T &xyz) const
Apply the inverse affine mapping to a vector using 32bit floating point arithmetics.
Definition: NanoVDB.h:1476
Definition: NanoVDB.h:723
bool FloatType
Definition: NanoVDB.h:3988
__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:4476
__hostdev__ NodeTrait< RootT, 2 >::type * getFirstUpper()
Definition: NanoVDB.h:2534
__hostdev__ void toggle()
brief Toggle the state of all bits in the mask
Definition: NanoVDB.h:1291
__hostdev__ bool isPointIndex() const
Definition: NanoVDB.h:2233
__hostdev__ void setMax(const ValueType &)
Definition: NanoVDB.h:4194
uint32_t mData0
Definition: NanoVDB.h:1912
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:4254
Dummy type for indexing points into voxels.
Definition: NanoVDB.h:202
__hostdev__ const MaskType< LOG2DIM > & getValueMask() const
Definition: NanoVDB.h:3446
__hostdev__ ValueType getValue(const CoordT &ijk) const
Return the voxel value at the given coordinate.
Definition: NanoVDB.h:4443
static __hostdev__ size_t memUsage()
Return memory usage in bytes for the class.
Definition: NanoVDB.h:3442
__hostdev__ NodeT & operator*() const
Definition: NanoVDB.h:3286
typename ChildT::FloatType StatsT
Definition: NanoVDB.h:3131
Definition: NanoVDB.h:897
__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:2442
__hostdev__ const ChildT * getChild(uint32_t n) const
Definition: NanoVDB.h:3188
uint32_t findHighestOn(uint32_t v)
Returns the index of the highest, i.e. most significant, on bit in the specified 32 bit word...
Definition: Util.h:572
bool Type
Definition: NanoVDB.h:493
__hostdev__ const ChildT * probeChild(const CoordT &ijk) const
Definition: NanoVDB.h:2764
Definition: NanoVDB.h:1095
__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:3475
StatsT mAverage
Definition: NanoVDB.h:3154
__hostdev__ float getValue(uint32_t i) const
Definition: NanoVDB.h:3852
Definition: NanoVDB.h:2948
__hostdev__ ValueIterator cbeginValueAll() const
Definition: NanoVDB.h:3347
CoordT mBBoxMin
Definition: NanoVDB.h:3705
__hostdev__ NodeT & operator*() const
Definition: NanoVDB.h:2858
typename ChildT::CoordType CoordT
Definition: NanoVDB.h:2571
__hostdev__ uint64_t getMax() const
Definition: NanoVDB.h:4084
__hostdev__ ValueType getValue(uint32_t offset) const
Return the voxel value at the given offset.
Definition: NanoVDB.h:4440
__hostdev__ ValueIter & operator++()
Definition: NanoVDB.h:2894
MaskT mValueMask
Definition: NanoVDB.h:3149
NANOVDB_HOSTDEV_DISABLE_WARNING __hostdev__ uint32_t findNext(uint32_t start) const
Definition: NanoVDB.h:1343
__hostdev__ CoordType getOrigin() const
Definition: NanoVDB.h:2840
__hostdev__ uint32_t totalNodeCount() const
Definition: NanoVDB.h:2486
uint16_t mMin
Definition: NanoVDB.h:3712
typename ChildT::FloatType StatsT
Definition: NanoVDB.h:2572
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType Type
Definition: NanoVDB.h:1716
typename FloatTraits< ValueType >::FloatType FloatType
Definition: NanoVDB.h:4152
__hostdev__ const ValueT & getMin() const
Definition: NanoVDB.h:2783
Like ValueOnIndex but with a mutable mask.
Definition: NanoVDB.h:181
const typename GridOrTreeOrRootT::LeafNodeType Type
Definition: NanoVDB.h:1694
__hostdev__ DataType * data()
Definition: NanoVDB.h:2123
MaskT< LOG2DIM > mValues
Definition: NanoVDB.h:3946
__hostdev__ TileIterator beginTile()
Definition: NanoVDB.h:2728
__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:2322
uint32_t mTableSize
Definition: NanoVDB.h:2600
typename BuildT::BuildType BuildType
Definition: NanoVDB.h:2110
typename T::ValueType ElementType
Definition: NanoVDB.h:743
__hostdev__ uint64_t memUsage() const
return memory usage in bytes for the leaf node
Definition: NanoVDB.h:4431
__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:2248
Definition: NanoVDB.h:4218
typename RootT::CoordType CoordType
Definition: NanoVDB.h:2410
float type
Definition: NanoVDB.h:529
defines a tree type from a grid type while preserving constness
Definition: NanoVDB.h:2378
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition: NanoVDB.h:5134
__hostdev__ GridType mapToGridType()
Definition: NanoVDB.h:867
__hostdev__ uint32_t nodeCount(int level) const
Definition: NanoVDB.h:2480
__hostdev__ ChannelT & operator()(int i, int j, int k) const
Definition: NanoVDB.h:5744
__hostdev__ AccessorType getAccessor() const
Return a new instance of a ReadAccessor used to access values in this grid.
Definition: NanoVDB.h:2160
Visits child nodes of this node only.
Definition: NanoVDB.h:3267
__hostdev__ Coord offsetToGlobalCoord(uint32_t n) const
Definition: NanoVDB.h:3528
typename remove_const< T >::type type
Definition: Util.h:431
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:4000
__hostdev__ void setValue(uint32_t offset, uint16_t value)
Definition: NanoVDB.h:4181
__hostdev__ Checksum()
default constructor initiates checksum to EMPTY
Definition: NanoVDB.h:1804
uint64_t Type
Definition: NanoVDB.h:486
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:3814
__hostdev__ ValueIterator(const InternalNode *parent)
Definition: NanoVDB.h:3322
typename Mask< 3 >::template Iterator< ON > MaskIterT
Definition: NanoVDB.h:4234
Leaf nodes of the VDB tree. (defaults to 8x8x8 = 512 voxels)
Definition: NanoVDB.h:4215
__hostdev__ bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:4960
__hostdev__ DataType * data()
Definition: NanoVDB.h:2992
__hostdev__ const uint64_t & valueCount() const
Return total number of values indexed by the IndexGrid.
Definition: NanoVDB.h:5722
__hostdev__ NodeTrait< RootT, LEVEL >::type * getFirstNode()
return a pointer to the first node at the specified level
Definition: NanoVDB.h:2515
typename util::match_const< Tile, DataT >::type TileT
Definition: NanoVDB.h:2661
__hostdev__ bool isValue() const
Definition: NanoVDB.h:2634
__hostdev__ Vec3T worldToIndexDir(const Vec3T &dir) const
transformation from world space direction to index space direction
Definition: NanoVDB.h:2184
__hostdev__ DenseIterator cbeginChildAll() const
Definition: NanoVDB.h:3426
BuildT BuildType
Definition: NanoVDB.h:5035
__hostdev__ uint32_t rootTableSize() const
return the root table has size
Definition: NanoVDB.h:2072
bool FloatType
Definition: NanoVDB.h:3938
__hostdev__ bool hasBBox() const
Definition: NanoVDB.h:4473
double mTaperD
Definition: NanoVDB.h:1385
__hostdev__ CoordType getCoord() const
Definition: NanoVDB.h:3422
uint32_t dim
Definition: NanoVDB.h:6216
__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:3013
MaskT mChildMask
Definition: NanoVDB.h:3150
__hostdev__ bool isActive(uint32_t n) const
Definition: NanoVDB.h:4463
__hostdev__ Version()
Default constructor.
Definition: NanoVDB.h:679
__hostdev__ void setMinMaxOn(bool on=true)
Definition: NanoVDB.h:1965
static __hostdev__ uint32_t valueCount()
Definition: NanoVDB.h:4079
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:3630
__hostdev__ const Tile * tile(uint32_t n) const
Returns a pointer to the tile at the specified linear offset.
Definition: NanoVDB.h:2646
__hostdev__ const StatsT & average() const
Definition: NanoVDB.h:3213
__hostdev__ ValueType getFirstValue() const
Return the first value in this leaf node.
Definition: NanoVDB.h:4446
__hostdev__ ValueOnIterator cbeginValueOn() const
Definition: NanoVDB.h:3381
typename GridOrTreeOrRootT::RootNodeType Type
Definition: NanoVDB.h:1730
typename NanoLeaf< BuildT >::ValueType ValueT
Definition: NanoVDB.h:6085
__hostdev__ ValueOnIterator(const InternalNode *parent)
Definition: NanoVDB.h:3361
__hostdev__ ConstValueOnIterator cbeginValueOn() const
Definition: NanoVDB.h:2945
Definition: NanoVDB.h:2616
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition: NanoVDB.h:4920
typename BuildToValueMap< BuildT >::Type ValueT
Definition: NanoVDB.h:6179
FloatType mAverage
Definition: NanoVDB.h:3634
__hostdev__ TileIter(DataT *data, uint32_t pos=0)
Definition: NanoVDB.h:2667
BuildT BuildType
Definition: NanoVDB.h:4806
ValueT ValueType
Definition: NanoVDB.h:5036
__hostdev__ const ChildNodeType * probeChild(const CoordType &ijk) const
Definition: NanoVDB.h:3499
float Type
Definition: NanoVDB.h:500
typename UpperNodeType::ChildNodeType LowerNodeType
Definition: NanoVDB.h:2812
StatsT mStdDevi
Definition: NanoVDB.h:2606
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:4059
__hostdev__ const DataType * data() const
Definition: NanoVDB.h:2125
__hostdev__ uint32_t & head()
Definition: NanoVDB.h:1830
ValueT value
Definition: NanoVDB.h:3138
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition: NanoVDB.h:4169
__hostdev__ TileIter & operator++()
Definition: NanoVDB.h:2678
__hostdev__ bool isCached1(const CoordType &ijk) const
Definition: NanoVDB.h:5111
__hostdev__ bool isActive(uint32_t n) const
Definition: NanoVDB.h:3200
__hostdev__ ValueOnIterator beginValueOn()
Definition: NanoVDB.h:2944
__hostdev__ const ChildT * getChild(const Tile *tile) const
Definition: NanoVDB.h:2777
__hostdev__ bool isEmpty() const
return true if the 64 bit checksum is disables (unset)
Definition: NanoVDB.h:1843
__hostdev__ Iterator(uint32_t pos, const Mask *parent)
Definition: NanoVDB.h:1069
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition: NanoVDB.h:5042
__hostdev__ ValueType getMax() const
Definition: NanoVDB.h:3659
typename GridOrTreeOrRootT::RootNodeType type
Definition: NanoVDB.h:1731
__hostdev__ void * nodePtr()
Return a non-const void pointer to the first node at LEVEL.
Definition: NanoVDB.h:2020
__hostdev__ float getMin() const
return the quantized minimum of the active values in this node
Definition: NanoVDB.h:3734
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:4962
__hostdev__ ValueOffIterator()
Definition: NanoVDB.h:4276
ChildT ChildNodeType
Definition: NanoVDB.h:3249
typename DataType::BuildT BuildType
Definition: NanoVDB.h:3247
__hostdev__ ValueOffIterator cbeginValueOff() const
Definition: NanoVDB.h:4300
__hostdev__ GridClass toGridClass(GridClass defaultClass=GridClass::Unknown)
Maps from a templated build type to a GridClass enum.
Definition: NanoVDB.h:873
typename DataType::ValueType ValueType
Definition: NanoVDB.h:4226
float type
Definition: NanoVDB.h:522
__hostdev__ uint32_t getMajor() const
Definition: NanoVDB.h:701
__hostdev__ Vec3T indexToWorldGradF(const Vec3T &grad) const
Transforms the gradient from index space to world space.
Definition: NanoVDB.h:2212
__hostdev__ const NodeTrait< TreeT, LEVEL >::type * getNode() const
Definition: NanoVDB.h:5292
__hostdev__ bool hasBBox() const
Definition: NanoVDB.h:2239
uint64_t type
Definition: NanoVDB.h:536
__hostdev__ FloatType getAvg() const
Definition: NanoVDB.h:4190
typename ChildT::LeafNodeType LeafNodeType
Definition: NanoVDB.h:3248
__hostdev__ void setValue(const CoordType &k, bool s, const ValueType &v)
Definition: NanoVDB.h:2626
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition: NanoVDB.h:5341
__hostdev__ const uint64_t * words() const
Definition: NanoVDB.h:1153
__hostdev__ const GridBlindMetaData & blindMetaData(uint32_t n) const
Definition: NanoVDB.h:2305
static __hostdev__ uint32_t bitCount()
Return the number of bits available in this Mask.
Definition: NanoVDB.h:1037
__hostdev__ void setDev(const bool &)
Definition: NanoVDB.h:3966
uint64_t Type
Definition: NanoVDB.h:479
__hostdev__ Vec3T indexToWorldDir(const Vec3T &dir) const
transformation from index space direction to world space direction
Definition: NanoVDB.h:2179
__hostdev__ const void * getRoot() const
Get a const void pointer to the root node (never NULL)
Definition: NanoVDB.h:2359
__hostdev__ const StatsT & stdDeviation() const
Definition: NanoVDB.h:3214
__hostdev__ bool isActive() const
Return true if any of the voxel value are active in this leaf node.
Definition: NanoVDB.h:4466
GridBlindDataClass
Blind-data Classes that are currently supported by NanoVDB.
Definition: NanoVDB.h:411
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:4159
__hostdev__ const void * treePtr() const
Definition: NanoVDB.h:2003
static __hostdev__ size_t memUsage()
Return the memory footprint in bytes of this Mask.
Definition: NanoVDB.h:1034
const typename GridOrTreeOrRootT::RootNodeType Type
Definition: NanoVDB.h:1738
Visits all active values in a leaf node.
Definition: NanoVDB.h:4237
__hostdev__ const LeafNodeType * getFirstLeaf() const
Definition: NanoVDB.h:2531
__hostdev__ Vec3T indexToWorldDirF(const Vec3T &dir) const
transformation from index space direction to world space direction
Definition: NanoVDB.h:2202