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>
3219 #if defined(__GNUC__) && (__GNUC__ < 12) && !defined(__APPLE__) && !defined(__llvm__) 3220 #pragma GCC diagnostic push 3221 #pragma GCC diagnostic ignored "-Wstringop-overflow" 3227 #if defined(__GNUC__) && (__GNUC__ < 12) && !defined(__APPLE__) && !defined(__llvm__) 3228 #pragma GCC diagnostic pop 3239 template<
typename ChildT, u
int32_t Log2Dim = ChildT::LOG2DIM + 1>
3250 static constexpr
bool FIXED_SIZE = DataType::FIXED_SIZE;
3251 template<u
int32_t LOG2>
3256 static constexpr uint32_t LOG2DIM = Log2Dim;
3257 static constexpr uint32_t TOTAL = LOG2DIM + ChildT::TOTAL;
3258 static constexpr uint32_t DIM = 1u << TOTAL;
3259 static constexpr uint32_t SIZE = 1u << (3 * LOG2DIM);
3260 static constexpr uint32_t MASK = (1u << TOTAL) - 1u;
3261 static constexpr uint32_t LEVEL = 1 + ChildT::LEVEL;
3262 static constexpr uint64_t NUM_VALUES = uint64_t(1) << (3 * TOTAL);
3265 template <
typename ParentT>
3280 : BaseT(parent->mChildMask.beginOn())
3288 return *mParent->getChild(BaseT::pos());
3293 return mParent->getChild(BaseT::pos());
3298 return (*this)->origin();
3322 : BaseT(parent->data()->mChildMask.beginOff())
3361 : BaseT(parent->data()->mValueMask.beginOn())
3396 , mParent(parent->data())
3403 const ChildT* child =
nullptr;
3404 if (mParent->
mChildMask.isOn(BaseT::pos())) {
3405 child = mParent->
getChild(BaseT::pos());
3407 value = mParent->
getValue(BaseT::pos());
3414 return mParent->
isActive(BaseT::pos());
3419 return mParent->offsetToGlobalCoord(BaseT::pos());
3476 return DataType::mChildMask.isOn(0) ? this->getChild(0)->getFirstValue() : DataType::getValue(0);
3483 return DataType::mChildMask.isOn(SIZE - 1) ? this->getChild(SIZE - 1)->getLastValue() : DataType::getValue(SIZE - 1);
3495 const uint32_t n = CoordToOffset(ijk);
3496 return DataType::mChildMask.isOn(n) ? this->getChild(n) :
nullptr;
3500 const uint32_t n = CoordToOffset(ijk);
3501 return DataType::mChildMask.isOn(n) ? this->getChild(n) :
nullptr;
3507 return (((ijk[0] & MASK) >> ChildT::TOTAL) << (2 * LOG2DIM)) |
3508 (((ijk[1] & MASK) >> ChildT::TOTAL) << (LOG2DIM)) |
3509 ((ijk[2] & MASK) >> ChildT::TOTAL);
3516 const uint32_t m = n & ((1 << 2 * LOG2DIM) - 1);
3517 return Coord(n >> 2 * LOG2DIM, m >> LOG2DIM, m & ((1 << LOG2DIM) - 1));
3523 ijk <<= ChildT::TOTAL;
3524 ijk += this->origin();
3530 this->localToGlobalCoord(ijk);
3537 template<
typename OpT,
typename... ArgsT>
3540 const uint32_t n = CoordToOffset(ijk);
3541 if constexpr(OpT::LEVEL < LEVEL)
if (this->isChild(n))
return this->getChild(n)->template get<OpT>(ijk, args...);
3542 return OpT::get(*
this, n, args...);
3545 template<
typename OpT,
typename... ArgsT>
3548 const uint32_t n = CoordToOffset(ijk);
3549 if constexpr(OpT::LEVEL < LEVEL)
if (this->isChild(n))
return this->getChild(n)->template set<OpT>(ijk, args...);
3550 return OpT::set(*
this, n, args...);
3556 template<
typename,
int,
int,
int>
3561 template<
typename, u
int32_t>
3564 template<
typename RayT,
typename AccT>
3565 __hostdev__ uint32_t getDimAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const 3567 if (DataType::mFlags & uint32_t(1u))
3571 const uint32_t n = CoordToOffset(ijk);
3572 if (DataType::mChildMask.isOn(n)) {
3573 const ChildT* child = this->getChild(n);
3574 acc.insert(ijk, child);
3575 return child->getDimAndCache(ijk, ray, acc);
3577 return ChildNodeType::dim();
3580 template<
typename OpT,
typename AccT,
typename... ArgsT>
3581 __hostdev__ typename OpT::Type getAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
const 3583 const uint32_t n = CoordToOffset(ijk);
3584 if constexpr(OpT::LEVEL < LEVEL) {
3585 if (this->isChild(n)) {
3586 const ChildT* child = this->getChild(n);
3587 acc.insert(ijk, child);
3588 return child->template getAndCache<OpT>(ijk, acc, args...);
3591 return OpT::get(*
this, n, args...);
3594 template<
typename OpT,
typename AccT,
typename... ArgsT>
3597 const uint32_t n = CoordToOffset(ijk);
3598 if constexpr(OpT::LEVEL < LEVEL) {
3599 if (this->isChild(n)) {
3600 ChildT* child = this->getChild(n);
3601 acc.insert(ijk, child);
3602 return child->template setAndCache<OpT>(ijk, acc, args...);
3605 return OpT::set(*
this, n, args...);
3615 template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3618 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3619 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3624 static constexpr
bool FIXED_SIZE =
true;
3627 uint8_t mBBoxDif[3];
3642 return sizeof(
LeafData) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>) + 2 * (
sizeof(ValueT) +
sizeof(
FloatType)) + (1u << (3 * LOG2DIM)) *
sizeof(ValueT));
3652 mValueMask.setOn(offset);
3653 mValues[offset] = value;
3665 #if defined(__GNUC__) && (__GNUC__ < 12) && !defined(__APPLE__) && !defined(__llvm__) 3666 #pragma GCC diagnostic push 3667 #pragma GCC diagnostic ignored "-Wstringop-overflow" 3673 #if defined(__GNUC__) && (__GNUC__ < 12) && !defined(__APPLE__) && !defined(__llvm__) 3674 #pragma GCC diagnostic pop 3677 template<
typename T>
3682 for (
auto *p = mValues, *q = p + 512; p != q; ++p)
3696 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3699 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3700 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3705 uint8_t mBBoxDif[3];
3722 return sizeof(
LeafFnBase) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>) + 2 * 4 + 4 * 2);
3727 mQuantum = (max -
min) /
float((1 << bitWidth) - 1);
3757 template<
typename T>
3766 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3767 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp4, CoordT, MaskT, LOG2DIM>
3773 static constexpr
bool FIXED_SIZE =
true;
3774 alignas(32) uint8_t mCode[1u << (3 * LOG2DIM - 1)];
3779 static_assert(BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3780 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << (3 * LOG2DIM - 1));
3787 const uint8_t c = mCode[i>>1];
3788 return ( (i&1) ? c >> 4 : c & uint8_t(15) )*BaseT::mQuantum + BaseT::mMinimum;
3790 return ((mCode[i >> 1] >> ((i & 1) << 2)) & uint8_t(15)) * BaseT::mQuantum + BaseT::mMinimum;
3803 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3804 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp8, CoordT, MaskT, LOG2DIM>
3810 static constexpr
bool FIXED_SIZE =
true;
3811 alignas(32) uint8_t mCode[1u << 3 * LOG2DIM];
3815 static_assert(BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3816 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << 3 * LOG2DIM);
3822 return mCode[i] * BaseT::mQuantum + BaseT::mMinimum;
3833 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3834 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp16, CoordT, MaskT, LOG2DIM>
3840 static constexpr
bool FIXED_SIZE =
true;
3841 alignas(32) uint16_t mCode[1u << 3 * LOG2DIM];
3846 static_assert(BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3847 return sizeof(
LeafData) -
sizeof(
BaseT) - 2 * (1u << 3 * LOG2DIM);
3853 return mCode[i] * BaseT::mQuantum + BaseT::mMinimum;
3865 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3866 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
FpN, CoordT, MaskT, LOG2DIM>
3872 static constexpr
bool FIXED_SIZE =
false;
3875 static_assert(BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3884 #ifdef NANOVDB_FPN_BRANCHLESS // faster 3885 const int b = BaseT::mFlags >> 5;
3887 uint16_t code =
reinterpret_cast<const uint16_t*
>(
this + 1)[i >> (4 - b)];
3888 const static uint8_t shift[5] = {15, 7, 3, 1, 0};
3889 const static uint16_t mask[5] = {1, 3, 15, 255, 65535};
3890 code >>= (i & shift[b]) << b;
3893 uint32_t code =
reinterpret_cast<const uint32_t*
>(
this + 1)[i >> (5 - b)];
3894 code >>= (i & ((32 >> b) - 1)) << b;
3895 code &= (1 << (1 << b)) - 1;
3897 #else // use branched version (slow) 3899 auto* values =
reinterpret_cast<const uint8_t*
>(
this + 1);
3900 switch (BaseT::mFlags >> 5) {
3902 code = float((values[i >> 3] >> (i & 7)) & uint8_t(1));
3905 code = float((values[i >> 2] >> ((i & 3) << 1)) & uint8_t(3));
3908 code = float((values[i >> 1] >> ((i & 1) << 2)) & uint8_t(15));
3911 code = float(values[i]);
3914 code = float(reinterpret_cast<const uint16_t*>(values)[i]);
3917 return float(code) * BaseT::mQuantum + BaseT::mMinimum;
3930 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3931 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
bool, CoordT, MaskT, LOG2DIM>
3933 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3934 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3939 static constexpr
bool FIXED_SIZE =
true;
3942 uint8_t mBBoxDif[3];
3946 uint64_t mPadding[2];
3958 mValueMask.setOn(offset);
3959 mValues.set(offset, v);
3967 template<
typename T>
3980 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3983 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3984 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3989 static constexpr
bool FIXED_SIZE =
true;
3992 uint8_t mBBoxDif[3];
3995 uint64_t mPadding[2];
4001 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u);
4016 template<
typename T>
4029 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4032 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4033 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4037 static constexpr
bool FIXED_SIZE =
true;
4040 uint8_t mBBoxDif[3];
4046 return sizeof(
LeafIndexBase) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u);
4057 template<
typename T>
4071 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4091 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4099 return util::countOn(BaseT::mValueMask.words()[7]) + (BaseT::mPrefixSum >> 54u & 511u);
4109 uint32_t n = i >> 6;
4110 const uint64_t w = BaseT::mValueMask.words()[n], mask = uint64_t(1) << (i & 63u);
4111 if (!(w & mask))
return uint64_t(0);
4112 uint64_t sum = BaseT::mOffset +
util::countOn(w & (mask - 1u));
4113 if (n--) sum += BaseT::mPrefixSum >> (9u * n) & 511u;
4120 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4122 :
public LeafData<ValueIndex, CoordT, MaskT, LOG2DIM>
4131 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4133 :
public LeafData<ValueOnIndex, CoordT, MaskT, LOG2DIM>
4144 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4145 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Point, CoordT, MaskT, LOG2DIM>
4147 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4148 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4153 static constexpr
bool FIXED_SIZE =
true;
4156 uint8_t mBBoxDif[3];
4162 alignas(32) uint16_t mValues[1u << 3 * LOG2DIM];
4170 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u + (1u << 3 * LOG2DIM) * 2u);
4176 __hostdev__ uint64_t
first(uint32_t i)
const {
return i ? uint64_t(mValues[i - 1u]) + mOffset : mOffset; }
4182 mValueMask.setOn(offset);
4183 mValues[offset] = value;
4197 template<
typename T>
4210 template<
typename BuildT,
4211 typename CoordT = Coord,
4212 template<u
int32_t>
class MaskT =
Mask,
4213 uint32_t Log2Dim = 3>
4219 static constexpr uint32_t TOTAL = 0;
4220 static constexpr uint32_t DIM = 1;
4229 static constexpr
bool FIXED_SIZE = DataType::FIXED_SIZE;
4230 template<u
int32_t LOG2>
4248 : BaseT(parent->data()->mValueMask.beginOn())
4256 return mParent->
getValue(BaseT::pos());
4281 : BaseT(parent->data()->mValueMask.beginOff())
4289 return mParent->
getValue(BaseT::pos());
4310 , mPos(1u << 3 * Log2Dim)
4353 static constexpr uint32_t LOG2DIM = Log2Dim;
4354 static constexpr uint32_t TOTAL = LOG2DIM;
4355 static constexpr uint32_t DIM = 1u << TOTAL;
4356 static constexpr uint32_t SIZE = 1u << 3 * LOG2DIM;
4357 static constexpr uint32_t MASK = (1u << LOG2DIM) - 1u;
4358 static constexpr uint32_t LEVEL = 0;
4359 static constexpr uint64_t NUM_VALUES = uint64_t(1) << (3 * TOTAL);
4395 const uint32_t m = n & ((1 << 2 * LOG2DIM) - 1);
4396 return CoordT(n >> 2 * LOG2DIM, m >> LOG2DIM, m & MASK);
4404 return OffsetToLocalCoord(n) + this->origin();
4413 math::BBox<CoordT> bbox(DataType::mBBoxMin, DataType::mBBoxMin);
4414 if (this->hasBBox()) {
4415 bbox.max()[0] += DataType::mBBoxDif[0];
4416 bbox.max()[1] += DataType::mBBoxDif[1];
4417 bbox.max()[2] += DataType::mBBoxDif[2];
4419 bbox = math::BBox<CoordT>();
4469 return !DataType::mValueMask.isOff();
4477 const uint32_t n = CoordToOffset(ijk);
4478 v = DataType::getValue(n);
4479 return DataType::mValueMask.isOn(n);
4487 return ((ijk[0] & MASK) << (2 * LOG2DIM)) | ((ijk[1] & MASK) << LOG2DIM) | (ijk[2] & MASK);
4499 template<
typename OpT,
typename... ArgsT>
4502 return OpT::get(*
this, CoordToOffset(ijk), args...);
4505 template<
typename OpT,
typename... ArgsT>
4508 return OpT::get(*
this, n, args...);
4511 template<
typename OpT,
typename... ArgsT>
4514 return OpT::set(*
this, CoordToOffset(ijk), args...);
4517 template<
typename OpT,
typename... ArgsT>
4520 return OpT::set(*
this, n, args...);
4526 template<
typename,
int,
int,
int>
4531 template<
typename, u
int32_t>
4534 template<
typename RayT,
typename AccT>
4535 __hostdev__ uint32_t getDimAndCache(
const CoordT&,
const RayT& ,
const AccT&)
const 4537 if (DataType::mFlags & uint8_t(1u))
4541 return ChildNodeType::dim();
4544 template<
typename OpT,
typename AccT,
typename... ArgsT>
4547 getAndCache(
const CoordType& ijk,
const AccT&, ArgsT&&... args)
const 4549 return OpT::get(*
this, CoordToOffset(ijk), args...);
4552 template<
typename OpT,
typename AccT,
typename... ArgsT>
4554 __hostdev__ decltype(OpT::set(util::declval<LeafNode&>(), util::declval<uint32_t>(), util::declval<ArgsT>()...))
4555 setAndCache(const
CoordType& ijk, const AccT&, ArgsT&&... args)
4557 return OpT::set(*
this, CoordToOffset(ijk), args...);
4564 template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4567 static_assert(LOG2DIM == 3,
"LeafNode::updateBBox: only supports LOGDIM = 3!");
4568 if (DataType::mValueMask.isOff()) {
4569 DataType::mFlags &= ~uint8_t(2);
4572 auto update = [&](uint32_t
min, uint32_t
max,
int axis) {
4574 DataType::mBBoxMin[axis] = (DataType::mBBoxMin[axis] & ~MASK) +
int(min);
4575 DataType::mBBoxDif[axis] = uint8_t(max - min);
4577 uint64_t *w = DataType::mValueMask.words(), word64 = *w;
4578 uint32_t Xmin = word64 ? 0u : 8u, Xmax = Xmin;
4579 for (
int i = 1; i < 8; ++i) {
4588 update(Xmin, Xmax, 0);
4590 const uint32_t *p =
reinterpret_cast<const uint32_t*
>(&word64), word32 = p[0] | p[1];
4591 const uint16_t *q =
reinterpret_cast<const uint16_t*
>(&word32), word16 = q[0] | q[1];
4592 const uint8_t *b =
reinterpret_cast<const uint8_t*
>(&word16), byte = b[0] | b[1];
4595 DataType::mFlags |= uint8_t(2);
4603 template<
typename BuildT>
4605 template<
typename BuildT>
4607 template<
typename BuildT>
4609 template<
typename BuildT>
4611 template<
typename BuildT>
4613 template<
typename BuildT>
4617 template<
typename BuildT,
int LEVEL>
4621 template<
typename BuildT>
4627 template<
typename BuildT>
4633 template<
typename BuildT>
4639 template<
typename BuildT>
4718 template<
typename OpT,
typename GridDataT,
typename... ArgsT>
4722 switch (gridData->mGridType){
4724 return OpT::template known<float>(gridData, args...);
4726 return OpT::template known<double>(gridData, args...);
4728 return OpT::template known<int16_t>(gridData, args...);
4730 return OpT::template known<int32_t>(gridData, args...);
4732 return OpT::template known<int64_t>(gridData, args...);
4734 return OpT::template known<Vec3f>(gridData, args...);
4736 return OpT::template known<Vec3d>(gridData, args...);
4738 return OpT::template known<uint32_t>(gridData, args...);
4740 return OpT::template known<ValueMask>(gridData, args...);
4742 return OpT::template known<ValueIndex>(gridData, args...);
4744 return OpT::template known<ValueOnIndex>(gridData, args...);
4746 return OpT::template known<ValueIndexMask>(gridData, args...);
4748 return OpT::template known<ValueOnIndexMask>(gridData, args...);
4750 return OpT::template known<bool>(gridData, args...);
4752 return OpT::template known<math::Rgba8>(gridData, args...);
4754 return OpT::template known<Fp4>(gridData, args...);
4756 return OpT::template known<Fp8>(gridData, args...);
4758 return OpT::template known<Fp16>(gridData, args...);
4760 return OpT::template known<FpN>(gridData, args...);
4762 return OpT::template known<Vec4f>(gridData, args...);
4764 return OpT::template known<Vec4d>(gridData, args...);
4766 return OpT::template known<uint8_t>(gridData, args...);
4768 return OpT::unknown(gridData, args...);
4793 template<
typename BuildT>
4803 mutable const RootT* mRoot;
4809 static const int CacheLevels = 0;
4819 : ReadAccessor(grid.tree().root())
4825 : ReadAccessor(tree.root())
4841 return this->
template get<GetValue<BuildT>>(ijk);
4850 template<
typename RayT>
4853 return mRoot->getDimAndCache(ijk, ray, *
this);
4855 template<
typename OpT,
typename... ArgsT>
4858 return mRoot->template get<OpT>(ijk, args...);
4861 template<
typename OpT,
typename... ArgsT>
4864 return const_cast<RootT*
>(mRoot)->
template set<OpT>(ijk, args...);
4871 template<
typename, u
int32_t>
4873 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
4877 template<
typename NodeT>
4882 template<
typename BuildT,
int LEVEL0>
4885 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 should be 0, 1, or 2");
4899 mutable CoordT mKey;
4900 mutable const RootT* mRoot;
4901 mutable const NodeT* mNode;
4908 static const int CacheLevels = 1;
4920 : ReadAccessor(grid.tree().root())
4926 : ReadAccessor(tree.root())
4946 return (ijk[0] & int32_t(~NodeT::MASK)) == mKey[0] &&
4947 (ijk[1] & int32_t(~NodeT::MASK)) == mKey[1] &&
4948 (ijk[2] & int32_t(~NodeT::MASK)) == mKey[2];
4953 return this->
template get<GetValue<BuildT>>(ijk);
4963 template<
typename RayT>
4966 if (this->isCached(ijk))
return mNode->getDimAndCache(ijk, ray, *
this);
4967 return mRoot->getDimAndCache(ijk, ray, *
this);
4970 template<
typename OpT,
typename... ArgsT>
4973 if constexpr(OpT::LEVEL <= LEVEL0)
if (this->isCached(ijk))
return mNode->template getAndCache<OpT>(ijk, *
this, args...);
4974 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
4977 template<
typename OpT,
typename... ArgsT>
4980 if constexpr(OpT::LEVEL <= LEVEL0)
if (this->isCached(ijk))
return const_cast<NodeT*
>(mNode)->
template setAndCache<OpT>(ijk, *
this, args...);
4981 return const_cast<RootT*
>(mRoot)->
template setAndCache<OpT>(ijk, *
this, args...);
4988 template<
typename, u
int32_t>
4990 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
4996 mKey = ijk & ~NodeT::MASK;
5001 template<
typename OtherNodeT>
5006 template<
typename BuildT,
int LEVEL0,
int LEVEL1>
5009 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 must be 0, 1, 2");
5010 static_assert(LEVEL1 >= 0 && LEVEL1 <= 2,
"LEVEL1 must be 0, 1, 2");
5011 static_assert(LEVEL0 < LEVEL1,
"Level 0 must be lower than level 1");
5024 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY // 44 bytes total 5025 mutable CoordT mKey;
5026 #else // 68 bytes total 5027 mutable CoordT mKeys[2];
5029 mutable const RootT* mRoot;
5030 mutable const Node1T* mNode1;
5031 mutable const Node2T* mNode2;
5038 static const int CacheLevels = 2;
5042 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5055 : ReadAccessor(grid.tree().root())
5061 : ReadAccessor(tree.root())
5068 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5084 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5085 __hostdev__ bool isCached1(CoordValueType dirty)
const 5089 if (dirty & int32_t(~Node1T::MASK)) {
5095 __hostdev__ bool isCached2(CoordValueType dirty)
const 5099 if (dirty & int32_t(~Node2T::MASK)) {
5107 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
5112 return (ijk[0] & int32_t(~Node1T::MASK)) == mKeys[0][0] &&
5113 (ijk[1] & int32_t(~Node1T::MASK)) == mKeys[0][1] &&
5114 (ijk[2] & int32_t(~Node1T::MASK)) == mKeys[0][2];
5118 return (ijk[0] & int32_t(~Node2T::MASK)) == mKeys[1][0] &&
5119 (ijk[1] & int32_t(~Node2T::MASK)) == mKeys[1][1] &&
5120 (ijk[2] & int32_t(~Node2T::MASK)) == mKeys[1][2];
5126 return this->
template get<GetValue<BuildT>>(ijk);
5136 template<
typename RayT>
5139 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5140 const CoordValueType dirty = this->computeDirty(ijk);
5144 if (this->isCached1(dirty)) {
5145 return mNode1->getDimAndCache(ijk, ray, *
this);
5146 }
else if (this->isCached2(dirty)) {
5147 return mNode2->getDimAndCache(ijk, ray, *
this);
5149 return mRoot->getDimAndCache(ijk, ray, *
this);
5152 template<
typename OpT,
typename... ArgsT>
5155 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5156 const CoordValueType dirty = this->computeDirty(ijk);
5160 if constexpr(OpT::LEVEL <= LEVEL0) {
5161 if (this->isCached1(dirty))
return mNode1->template getAndCache<OpT>(ijk, *
this, args...);
5162 }
else if constexpr(OpT::LEVEL <= LEVEL1) {
5163 if (this->isCached2(dirty))
return mNode2->template getAndCache<OpT>(ijk, *
this, args...);
5165 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5168 template<
typename OpT,
typename... ArgsT>
5171 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5172 const CoordValueType dirty = this->computeDirty(ijk);
5176 if constexpr(OpT::LEVEL <= LEVEL0) {
5177 if (this->isCached1(dirty))
return const_cast<Node1T*
>(mNode1)->
template setAndCache<OpT>(ijk, *
this, args...);
5178 }
else if constexpr(OpT::LEVEL <= LEVEL1) {
5179 if (this->isCached2(dirty))
return const_cast<Node2T*
>(mNode2)->
template setAndCache<OpT>(ijk, *
this, args...);
5181 return const_cast<RootT*
>(mRoot)->
template setAndCache<OpT>(ijk, *
this, args...);
5188 template<
typename, u
int32_t>
5190 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5196 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5199 mKeys[0] = ijk & ~Node1T::MASK;
5205 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5208 mKeys[1] = ijk & ~Node2T::MASK;
5212 template<
typename OtherNodeT>
5217 template<
typename BuildT>
5233 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY // 44 bytes total 5234 mutable CoordT mKey;
5235 #else // 68 bytes total 5236 mutable CoordT mKeys[3];
5238 mutable const RootT* mRoot;
5239 mutable const void* mNode[3];
5246 static const int CacheLevels = 3;
5250 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5256 , mNode{
nullptr,
nullptr,
nullptr}
5262 : ReadAccessor(grid.tree().root())
5268 : ReadAccessor(tree.root())
5282 template<
typename NodeT>
5287 return reinterpret_cast<const T*
>(mNode[NodeT::LEVEL]);
5294 static_assert(LEVEL >= 0 && LEVEL <= 2,
"ReadAccessor::getNode: Invalid node type");
5295 return reinterpret_cast<const T*
>(mNode[LEVEL]);
5301 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5306 mNode[0] = mNode[1] = mNode[2] =
nullptr;
5309 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5310 template<
typename NodeT>
5311 __hostdev__ bool isCached(CoordValueType dirty)
const 5313 if (!mNode[NodeT::LEVEL])
5315 if (dirty & int32_t(~NodeT::MASK)) {
5316 mNode[NodeT::LEVEL] =
nullptr;
5324 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
5327 template<
typename NodeT>
5330 return (ijk[0] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][0] &&
5331 (ijk[1] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][1] &&
5332 (ijk[2] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][2];
5345 template<
typename OpT,
typename... ArgsT>
5348 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5349 const CoordValueType dirty = this->computeDirty(ijk);
5353 if constexpr(OpT::LEVEL <=0) {
5354 if (this->isCached<LeafT>(dirty))
return ((
const LeafT*)mNode[0])->template getAndCache<OpT>(ijk, *
this, args...);
5355 }
else if constexpr(OpT::LEVEL <= 1) {
5356 if (this->isCached<NodeT1>(dirty))
return ((
const NodeT1*)mNode[1])->template getAndCache<OpT>(ijk, *
this, args...);
5357 }
else if constexpr(OpT::LEVEL <= 2) {
5358 if (this->isCached<NodeT2>(dirty))
return ((
const NodeT2*)mNode[2])->template getAndCache<OpT>(ijk, *
this, args...);
5360 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5363 template<
typename OpT,
typename... ArgsT>
5366 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5367 const CoordValueType dirty = this->computeDirty(ijk);
5371 if constexpr(OpT::LEVEL <= 0) {
5372 if (this->isCached<LeafT>(dirty))
return ((
LeafT*)mNode[0])->template setAndCache<OpT>(ijk, *
this, args...);
5373 }
else if constexpr(OpT::LEVEL <= 1) {
5374 if (this->isCached<NodeT1>(dirty))
return ((
NodeT1*)mNode[1])->template setAndCache<OpT>(ijk, *
this, args...);
5375 }
else if constexpr(OpT::LEVEL <= 2) {
5376 if (this->isCached<NodeT2>(dirty))
return ((
NodeT2*)mNode[2])->template setAndCache<OpT>(ijk, *
this, args...);
5378 return ((
RootT*)mRoot)->template setAndCache<OpT>(ijk, *
this, args...);
5381 template<
typename RayT>
5384 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5385 const CoordValueType dirty = this->computeDirty(ijk);
5389 if (this->isCached<LeafT>(dirty)) {
5390 return ((
LeafT*)mNode[0])->getDimAndCache(ijk, ray, *
this);
5391 }
else if (this->isCached<NodeT1>(dirty)) {
5392 return ((
NodeT1*)mNode[1])->getDimAndCache(ijk, ray, *
this);
5393 }
else if (this->isCached<NodeT2>(dirty)) {
5394 return ((
NodeT2*)mNode[2])->getDimAndCache(ijk, ray, *
this);
5396 return mRoot->getDimAndCache(ijk, ray, *
this);
5403 template<
typename, u
int32_t>
5405 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5409 template<
typename NodeT>
5412 #ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY 5415 mKeys[NodeT::LEVEL] = ijk & ~NodeT::MASK;
5417 mNode[NodeT::LEVEL] = node;
5435 template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5441 template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5447 template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5463 CoordBBox mIndexBBox;
5464 uint32_t mRootTableSize, mPadding{0};
5467 template<
typename T>
5470 mGridData = *grid.
data();
5471 mTreeData = *grid.
tree().data();
5473 mRootTableSize = grid.
tree().root().getTableSize();
5478 *
this = *
reinterpret_cast<const GridMetaData*
>(gridData);
5481 mGridData = *gridData;
5501 template<
typename T>
5541 template<
typename AttT,
typename BuildT = u
int32_t>
5550 : AccT(grid.tree().root())
5552 , mData(grid.template getBlindData<AttT>(0))
5570 end = begin + count;
5578 auto* leaf = this->probeLeaf(ijk);
5579 if (leaf ==
nullptr) {
5582 begin = mData + leaf->minimum();
5583 end = begin + leaf->maximum();
5584 return leaf->maximum();
5590 begin = end =
nullptr;
5591 if (
auto* leaf = this->probeLeaf(ijk)) {
5593 if (leaf->isActive(offset)) {
5594 begin = mData + leaf->minimum();
5595 end = begin + leaf->getValue(offset);
5597 begin += leaf->getValue(offset - 1);
5604 template<
typename AttT>
5613 : AccT(grid.tree().root())
5615 , mData(grid.template getBlindData<AttT>(0))
5637 end = begin + count;
5645 auto* leaf = this->probeLeaf(ijk);
5646 if (leaf ==
nullptr)
5648 begin = mData + leaf->offset();
5649 end = begin + leaf->pointCount();
5650 return leaf->pointCount();
5656 if (
auto* leaf = this->probeLeaf(ijk)) {
5658 if (leaf->isActive(n)) {
5659 begin = mData + leaf->first(n);
5660 end = mData + leaf->last(n);
5664 begin = end =
nullptr;
5672 template<
typename ChannelT,
typename IndexT = ValueIndex>
5689 :
BaseT(grid.tree().root())
5695 this->setChannel(channelID);
5700 :
BaseT(grid.tree().root())
5702 , mChannel(channelPtr)
5733 return mChannel =
const_cast<ChannelT*
>(mGrid.template getBlindData<ChannelT>(channelID));
5738 __hostdev__ uint64_t
idx(
int i,
int j,
int k)
const {
return BaseT::getValue(math::Coord(i, j, k)); }
5749 const bool isActive = BaseT::probeValue(ijk, idx);
5756 template<
typename T>
5757 __hostdev__ T&
getValue(
const math::Coord& ijk, T* channelPtr)
const {
return channelPtr[BaseT::getValue(ijk)]; }
5765 struct MiniGridHandle {
5770 BufferType(BufferType &&other) : data(other.data), size(other.size) {other.data=
nullptr; other.size=0;}
5771 ~BufferType() {std::free(data);}
5772 BufferType& operator=(
const BufferType &other) =
delete;
5773 BufferType& operator=(BufferType &&other){data=other.data; size=other.size; other.data=
nullptr; other.size=0;
return *
this;}
5774 static BufferType create(
size_t n, BufferType* dummy =
nullptr) {
return BufferType(n);}
5776 MiniGridHandle(BufferType &&buf) : buffer(std::move(buf)) {}
5777 const uint8_t* data()
const {
return buffer.data;}
5809 if (
util::streq(str,
"blosc"))
return Codec::BLOSC;
5851 uint32_t nodeCount[4];
5852 uint32_t tileCount[3];
5859 #if !defined(__CUDA_ARCH__) && !defined(__HIP__) 5882 template<
typename StreamT>
5888 #ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS 5893 const char* gridName = gridData->
gridName();
5902 os.write((
const char*)&head,
sizeof(
FileHeader));
5904 os.write(gridName, nameSize);
5906 os.write((
const char*)gridData, gridData->
mGridSize);
5911 template<
typename GridHandleT,
template<
typename...>
class VecT>
5914 #ifdef NANOVDB_USE_IOSTREAMS // use this to switch between std::ofstream or FILE implementations 5915 std::ofstream os(fileName, std::ios::out | std::ios::binary | std::ios::trunc);
5919 StreamT(
const char* name) { fptr = fopen(name,
"wb"); }
5920 ~StreamT() { fclose(fptr); }
5921 void write(
const char* data,
size_t n) { fwrite(data, 1, n, fptr); }
5922 bool is_open()
const {
return fptr != NULL; }
5925 if (!os.is_open()) {
5926 fprintf(stderr,
"nanovdb::writeUncompressedGrids: Unable to open file \"%s\"for output\n", fileName);
5929 for (
auto& h : handles) {
5939 template<
typename GridHandleT,
typename StreamT,
template<
typename...>
class VecT>
5940 VecT<GridHandleT>
readUncompressedGrids(StreamT& is,
const typename GridHandleT::BufferType& pool =
typename GridHandleT::BufferType())
5942 VecT<GridHandleT> handles;
5944 is.read((
char*)&data,
sizeof(
GridData));
5946 uint64_t size = data.
mGridSize, sum = 0u;
5949 is.read((
char*)&data,
sizeof(
GridData));
5952 is.skip(-int64_t(sum +
sizeof(
GridData)));
5953 auto buffer = GridHandleT::BufferType::create(size + sum, &pool);
5954 is.read((
char*)(buffer.data()), buffer.size());
5955 handles.emplace_back(std::move(buffer));
5959 while(is.read((
char*)&head,
sizeof(
FileHeader))) {
5961 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid magic number = \"%s\"\n", (
const char*)&(head.
magic));
5965 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid major version = \"%s\"\n",
toStr(str, head.
version));
5969 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid codec = \"%s\"\n",
toStr(str, head.
codec));
5973 for (uint16_t i = 0; i < head.
gridCount; ++i) {
5976 auto buffer = GridHandleT::BufferType::create(meta.
gridSize, &pool);
5977 is.read((
char*)buffer.data(), meta.
gridSize);
5978 handles.emplace_back(std::move(buffer));
5986 template<
typename GridHandleT,
template<
typename...>
class VecT>
5987 VecT<GridHandleT>
readUncompressedGrids(
const char* fileName,
const typename GridHandleT::BufferType& buffer =
typename GridHandleT::BufferType())
5989 #ifdef NANOVDB_USE_IOSTREAMS // use this to switch between std::ifstream or FILE implementations 5990 struct StreamT :
public std::ifstream {
5991 StreamT(
const char* name) : std::ifstream(name, std::ios::in | std::ios::binary){}
5992 void skip(int64_t off) { this->seekg(off, std::ios_base::cur); }
5997 StreamT(
const char* name) { fptr = fopen(name,
"rb"); }
5998 ~StreamT() { fclose(fptr); }
5999 bool read(
char* data,
size_t n) {
6000 size_t m = fread(data, 1, n, fptr);
6003 void skip(int64_t off) { fseek(fptr, (
long int)off, SEEK_CUR); }
6004 bool is_open()
const {
return fptr != NULL; }
6007 StreamT is(fileName);
6008 if (!is.is_open()) {
6009 fprintf(stderr,
"nanovdb::readUncompressedGrids: Unable to open file \"%s\"for input\n", fileName);
6012 return readUncompressedGrids<GridHandleT, StreamT, VecT>(is, buffer);
6015 #endif // if !defined(__CUDA_ARCH__) && !defined(__HIP__) 6055 template<
typename BuildT>
6059 static constexpr
int LEVEL = 0;
6067 template<
typename BuildT>
6072 static constexpr
int LEVEL = 0;
6080 template<
typename BuildT>
6085 static constexpr
int LEVEL = 0;
6095 template<
typename BuildT>
6099 static constexpr
int LEVEL = 0;
6109 template<
typename BuildT>
6113 static constexpr
int LEVEL = 0;
6123 template<
typename BuildT>
6127 static constexpr
int LEVEL = 0;
6137 template<
typename BuildT>
6141 static constexpr
int LEVEL = 1;
6150 template<
typename BuildT>
6154 static constexpr
int LEVEL = 2;
6162 template<
typename BuildT>
6166 static constexpr
int LEVEL = 3;
6173 template<
typename BuildT>
6177 static constexpr
int LEVEL = 0;
6181 v = root.mBackground;
6187 return tile.state > 0u;
6191 v = node.mTable[n].value;
6192 return node.mValueMask.isOn(n);
6196 v = node.mTable[n].value;
6197 return node.mValueMask.isOn(n);
6201 v = leaf.getValue(n);
6202 return leaf.mValueMask.isOn(n);
6208 template<
typename BuildT>
6220 static constexpr
int LEVEL = 0;
6232 return NodeInfo{2u, node.
dim(), node.minimum(), node.maximum(), node.average(), node.stdDeviation(), node.bbox()};
6236 return NodeInfo{1u, node.
dim(), node.minimum(), node.maximum(), node.average(), node.stdDeviation(), node.bbox()};
6240 return NodeInfo{0u, leaf.
dim(), leaf.minimum(), leaf.maximum(), leaf.average(), leaf.stdDeviation(), leaf.bbox()};
6246 #endif // end of NANOVDB_NANOVDB_H_HAS_BEEN_INCLUDED typename FloatTraits< BuildT >::FloatType FloatType
Definition: NanoVDB.h:3622
__hostdev__ ValueType getMin() const
Definition: NanoVDB.h:3657
__hostdev__ ValueOffIterator beginValueOff() const
Definition: NanoVDB.h:4298
__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:5746
__hostdev__ ValueT value() const
Definition: NanoVDB.h:2718
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:3777
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:5336
__hostdev__ uint32_t operator*() const
Definition: NanoVDB.h:1075
ValueT ValueType
Definition: NanoVDB.h:4905
__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:3310
__hostdev__ math::BBox< CoordT > bbox() const
Return the bounding box in index space of active values in this leaf node.
Definition: NanoVDB.h:4411
__hostdev__ CoordT getCoord() const
Definition: NanoVDB.h:4325
uint16_t ArrayType
Definition: NanoVDB.h:4152
__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:3634
float type
Definition: NanoVDB.h:501
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:3873
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition: NanoVDB.h:5342
__hostdev__ CoordT offsetToGlobalCoord(uint32_t n) const
Definition: NanoVDB.h:4402
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:3997
__hostdev__ bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:4847
__hostdev__ const MaskType< LOG2DIM > & getValueMask() const
Definition: NanoVDB.h:4367
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:5912
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:4818
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:5725
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:5338
__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:5339
__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:4308
float Type
Definition: NanoVDB.h:521
float FloatType
Definition: NanoVDB.h:3702
__hostdev__ CoordT origin() const
Return the origin in index space of this leaf node.
Definition: NanoVDB.h:4387
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:4824
__hostdev__ ValueOnIter(RootT *parent)
Definition: NanoVDB.h:2922
Vec3dBBox mWorldBBox
Definition: NanoVDB.h:1906
__hostdev__ CoordType getOrigin() const
Definition: NanoVDB.h:3295
__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:6217
__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:4373
__hostdev__ DenseIterator(const InternalNode *parent)
Definition: NanoVDB.h:3394
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:4126
__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:3444
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:5134
#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:4956
static __hostdev__ constexpr uint64_t memUsage()
Definition: NanoVDB.h:3776
__hostdev__ bool getValue(uint32_t i) const
Definition: NanoVDB.h:4004
__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:4457
__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:5673
__hostdev__ void setMask(uint32_t offset, bool v)
Definition: NanoVDB.h:4139
__hostdev__ void setOn(uint32_t offset)
Definition: NanoVDB.h:3655
Definition: NanoVDB.h:2658
static __hostdev__ uint32_t padding()
Definition: NanoVDB.h:4427
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:5337
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:3881
__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:5612
__hostdev__ const ValueT & getMax() const
Definition: NanoVDB.h:2784
__hostdev__ ValueType getValue(uint32_t i) const
Definition: NanoVDB.h:3648
__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:3493
typename ChildT::CoordType CoordType
Definition: NanoVDB.h:3249
__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:4485
__hostdev__ uint64_t lastOffset() const
Definition: NanoVDB.h:4101
MaskT< LOG2DIM > mMask
Definition: NanoVDB.h:4125
__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:4014
Definition: NanoVDB.h:2881
__hostdev__ void * treePtr()
Definition: NanoVDB.h:2000
uint32_t state
Definition: NanoVDB.h:2639
BuildT BuildType
Definition: NanoVDB.h:3621
CoordT mBBoxMin
Definition: NanoVDB.h:3991
__hostdev__ void setDev(const FloatType &v)
Definition: NanoVDB.h:3672
__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:4008
__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:3306
uint8_t mFlags
Definition: NanoVDB.h:3628
__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:4160
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:3678
__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:6151
__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:5576
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:3659
__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:4461
__hostdev__ ConstDenseIterator cbeginDense() const
Definition: NanoVDB.h:2981
__hostdev__ uint64_t getValue(uint32_t i) const
Definition: NanoVDB.h:4106
ChildT ChildNodeType
Definition: NanoVDB.h:2808
#define NANOVDB_MAGIC_GRID
Definition: NanoVDB.h:140
__hostdev__ void setAvg(const FloatType &)
Definition: NanoVDB.h:4013
__hostdev__ ValueOnIterator beginValueOn() const
Definition: NanoVDB.h:3379
__hostdev__ const MaskType< LOG2DIM > & valueMask() const
Return a const reference to the bit mask of active voxels in this leaf node.
Definition: NanoVDB.h:4366
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:3752
MaskT< LOG2DIM > ArrayType
Definition: NanoVDB.h:3938
T Type
Definition: NanoVDB.h:458
__hostdev__ bool isActive() const
Definition: NanoVDB.h:3338
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:5731
__hostdev__ void setMax(const ValueType &)
Definition: NanoVDB.h:4012
__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:4097
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:4618
__hostdev__ void setDev(const FloatType &)
Definition: NanoVDB.h:4055
__hostdev__ void setMax(const ValueT &v)
Definition: NanoVDB.h:2789
__hostdev__ void setOn(uint32_t offset)
Definition: NanoVDB.h:4056
__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:4925
__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:4379
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:3620
uint64_t mFlags
Definition: NanoVDB.h:3148
__hostdev__ const uint32_t & getTableSize() const
Definition: NanoVDB.h:3007
__hostdev__ ValueIterator()
Definition: NanoVDB.h:3316
__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:5116
__hostdev__ bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:3488
Implements Tree::getNodeInfo(math::Coord)
Definition: NanoVDB.h:1759
__hostdev__ uint64_t getMax() const
Definition: NanoVDB.h:4103
__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:5588
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition: NanoVDB.h:4845
__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:6216
__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:3626
__hostdev__ bool isActive() const
Definition: NanoVDB.h:4330
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:6071
__hostdev__ FloatType getDev() const
Definition: NanoVDB.h:3660
__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:4382
Definition: NanoVDB.h:6213
__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:3710
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:4370
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:4080
__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:4839
__hostdev__ ChannelAccessor(const NanoGrid< IndexT > &grid, ChannelT *channelPtr)
Ctor from an IndexGrid and an external channel.
Definition: NanoVDB.h:5699
__hostdev__ bool operator>=(const Version &rhs) const
Definition: NanoVDB.h:699
typename DataType::ValueT ValueType
Definition: NanoVDB.h:3244
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:4408
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition: NanoVDB.h:5267
typename NanoLeaf< BuildT >::ValueType Type
Definition: NanoVDB.h:6058
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:3438
__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:4195
__hostdev__ TileIterator probe(const CoordT &ijk)
Definition: NanoVDB.h:2731
__hostdev__ void setOn(uint32_t offset)
Definition: NanoVDB.h:4010
__hostdev__ const ChildT * probeChild(ValueType &value) const
Definition: NanoVDB.h:3400
__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:5562
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:5712
static constexpr uint32_t SIZE
Definition: NanoVDB.h:1030
uint32_t mNodeCount[3]
Definition: NanoVDB.h:2345
ValueType mMaximum
Definition: NanoVDB.h:3632
typename GridOrTreeOrRootT::LeafNodeType type
Definition: NanoVDB.h:1688
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:3994
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:4350
__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:3968
typename DataType::BuildT BuildType
Definition: NanoVDB.h:2816
__hostdev__ void setMin(const bool &)
Definition: NanoVDB.h:3962
__hostdev__ const StatsT & average() const
Definition: NanoVDB.h:2785
__hostdev__ void setMin(const ValueType &)
Definition: NanoVDB.h:4052
__hostdev__ uint32_t tail() const
Definition: NanoVDB.h:1831
__hostdev__ bool getAvg() const
Definition: NanoVDB.h:3954
__hostdev__ bool updateBBox()
Updates the local bounding box of active voxels in this node. Return true if bbox was updated...
Definition: NanoVDB.h:4565
__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:6163
__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:4177
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:3461
__hostdev__ Iterator & operator++()
Definition: NanoVDB.h:1078
Definition: NanoVDB.h:750
#define __hostdev__
Definition: Util.h:73
typename DataType::FloatType FloatType
Definition: NanoVDB.h:4226
#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:4086
__hostdev__ void setMax(const ValueT &v)
Definition: NanoVDB.h:3224
Definition: NanoVDB.h:920
Coord CoordType
Definition: NanoVDB.h:4228
Dummy type for a 16bit quantization of float point values.
Definition: NanoVDB.h:196
uint8_t ArrayType
Definition: NanoVDB.h:3809
typename Mask< Log2Dim >::template Iterator< On > MaskIterT
Definition: NanoVDB.h:3254
__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:4155
__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:3458
__hostdev__ float getValue(uint32_t i) const
Definition: NanoVDB.h:3784
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:3167
__hostdev__ void setMin(float min)
Definition: NanoVDB.h:3746
__hostdev__ void setValue(uint32_t offset, bool)
Definition: NanoVDB.h:4009
__hostdev__ void setMax(const ValueType &v)
Definition: NanoVDB.h:3670
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:4017
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition: NanoVDB.h:3640
__hostdev__ uint32_t pos() const
Definition: NanoVDB.h:2838
__hostdev__ ChildIter()
Definition: NanoVDB.h:3274
__hostdev__ void setMin(const ValueType &)
Definition: NanoVDB.h:4192
__hostdev__ BlindDataT * getBlindData(uint32_t n)
Definition: NanoVDB.h:2299
__hostdev__ void setDev(const StatsT &v)
Definition: NanoVDB.h:3226
__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:3481
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition: NanoVDB.h:5066
__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:3882
__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:4034
uint16_t ArrayType
Definition: NanoVDB.h:3839
__hostdev__ const MaskType< LOG2DIM > & childMask() const
Return a const reference to the bit mask of child nodes in this internal node.
Definition: NanoVDB.h:3448
__hostdev__ void setMax(const ValueType &)
Definition: NanoVDB.h:4053
__hostdev__ void setAvg(const FloatType &)
Definition: NanoVDB.h:4054
ValueT value
Definition: NanoVDB.h:2640
__hostdev__ void setDev(float dev)
Definition: NanoVDB.h:3755
Node caching at all (three) tree levels.
Definition: NanoVDB.h:5218
__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:4194
__hostdev__ bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:5341
__hostdev__ void setOn(uint32_t offset)
Definition: NanoVDB.h:4185
bool Type
Definition: NanoVDB.h:6098
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType Type
Definition: NanoVDB.h:1702
__hostdev__ bool isMaskOn(uint32_t offset) const
Definition: NanoVDB.h:4138
BuildT BuildType
Definition: NanoVDB.h:5242
Stuct with all the member data of the LeafNode (useful during serialization of an openvdb LeafNode) ...
Definition: NanoVDB.h:3616
__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:3850
__hostdev__ uint32_t & checksum(int i)
Definition: NanoVDB.h:1823
__hostdev__ DenseIterator()
Definition: NanoVDB.h:3389
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:5436
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:3720
Definition: GridHandle.h:27
float type
Definition: NanoVDB.h:508
CoordBBox bbox
Definition: NanoVDB.h:6218
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:3383
GridType mGridType
Definition: NanoVDB.h:1909
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:4137
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition: NanoVDB.h:4931
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:3490
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:4044
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:4906
__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:4951
__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:3345
__hostdev__ void setMax(float max)
Definition: NanoVDB.h:3749
__hostdev__ TileIter()
Definition: NanoVDB.h:2666
static __hostdev__ constexpr uint8_t bitWidth()
Definition: NanoVDB.h:3783
__hostdev__ bool getMax() const
Definition: NanoVDB.h:3953
uint64_t mData2
Definition: NanoVDB.h:1914
typename ChildT::ValueType ValueT
Definition: NanoVDB.h:2569
float mMinimum
Definition: NanoVDB.h:3709
__hostdev__ uint64_t offset() const
Definition: NanoVDB.h:4174
static __hostdev__ Coord OffsetToLocalCoord(uint32_t n)
Definition: NanoVDB.h:3513
__hostdev__ const Vec3d & voxelSize() const
Return a vector of the axial voxel sizes.
Definition: NanoVDB.h:5718
__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:6212
Definition: NanoVDB.h:4030
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:4175
typename DataType::StatsT FloatType
Definition: NanoVDB.h:3245
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition: NanoVDB.h:5128
__hostdev__ uint32_t & tail()
Definition: NanoVDB.h:1832
bool ValueType
Definition: NanoVDB.h:3935
__hostdev__ Tile * probeTile(const CoordT &ijk)
Definition: NanoVDB.h:2747
__hostdev__ uint64_t getAvg() const
Definition: NanoVDB.h:4084
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition: NanoVDB.h:4851
__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:4265
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:3772
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:3644
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:5805
Definition: IndexIterator.h:43
Definition: NanoVDB.h:2845
uint32_t level
Definition: NanoVDB.h:6215
__hostdev__ float getValue(uint32_t i) const
Definition: NanoVDB.h:3820
uint32_t mTileCount[3]
Definition: NanoVDB.h:2346
typename RootT::ChildNodeType Node2
Definition: NanoVDB.h:2414
__hostdev__ CoordType getOrigin() const
Definition: NanoVDB.h:3371
__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:3455
ValueType mMinimum
Definition: NanoVDB.h:3631
__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:4221
__hostdev__ bool isCached(const CoordType &ijk) const
Definition: NanoVDB.h:5328
uint64_t Type
Definition: NanoVDB.h:465
uint64_t type
Definition: NanoVDB.h:473
const typename NanoRoot< BuildT >::Tile * Type
Definition: NanoVDB.h:6165
__hostdev__ float getDev() const
return the quantized standard deviation of the active values in this node
Definition: NanoVDB.h:3743
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:3366
ValueT mMaximum
Definition: NanoVDB.h:3153
__hostdev__ uint64_t idx(int i, int j, int k) const
Definition: NanoVDB.h:5738
static __hostdev__ CoordT OffsetToLocalCoord(uint32_t n)
Compute the local coordinates from a linear offset.
Definition: NanoVDB.h:4392
__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:3470
__hostdev__ ValueType getValue(const CoordType &ijk) const
Return the value of the given voxel.
Definition: NanoVDB.h:3487
__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:4178
__hostdev__ bool operator<=(const Version &rhs) const
Definition: NanoVDB.h:697
__hostdev__ bool getValue(uint32_t i) const
Definition: NanoVDB.h:3951
T ElementType
Definition: NanoVDB.h:732
bool Type
Definition: NanoVDB.h:6176
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:4964
__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:3300
__hostdev__ ValueIterator operator++(int)
Definition: NanoVDB.h:4341
__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:3715
__hostdev__ ValueOffIterator(const LeafNode *parent)
Definition: NanoVDB.h:4280
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:4286
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:5054
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:4447
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:3758
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition: NanoVDB.h:4960
__hostdev__ bool isHalf() const
Definition: NanoVDB.h:1837
__hostdev__ uint64_t getDev() const
Definition: NanoVDB.h:4085
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:3949
math::BBox< CoordT > mBBox
Definition: NanoVDB.h:2599
__hostdev__ ValueIterator(const LeafNode *parent)
Definition: NanoVDB.h:4313
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition: NanoVDB.h:4812
typename RootT::ValueType ValueType
Definition: NanoVDB.h:4806
__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:3880
__hostdev__ ValueType getMin() const
Definition: NanoVDB.h:4187
__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:3467
__hostdev__ void setOn(uint32_t n)
Set the specified bit on.
Definition: NanoVDB.h:1222
__hostdev__ const uint64_t & firstOffset() const
Definition: NanoVDB.h:4051
__hostdev__ CoordT getCoord() const
Definition: NanoVDB.h:4258
__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:4955
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition: NanoVDB.h:5124
static __hostdev__ constexpr uint8_t bitWidth()
Definition: NanoVDB.h:3819
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition: NanoVDB.h:5131
__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:3671
__hostdev__ uint8_t bitWidth() const
Definition: NanoVDB.h:3879
__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:4320
__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:3730
__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:5757
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:4176
__hostdev__ bool isMaskOn(uint32_t offset) const
Definition: NanoVDB.h:4127
__hostdev__ bool isGridIndex() const
Definition: NanoVDB.h:2234
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition: NanoVDB.h:5060
__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:5688
__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:5566
void ArrayType
Definition: NanoVDB.h:4036
__hostdev__ ChannelT & operator()(const math::Coord &ijk) const
Definition: NanoVDB.h:5742
__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:4049
__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:3680
__hostdev__ bool getAvg() const
Definition: NanoVDB.h:4007
BuildT ArrayType
Definition: NanoVDB.h:3623
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:4904
__hostdev__ bool getMin() const
Definition: NanoVDB.h:3952
__hostdev__ const DataType * data() const
Definition: NanoVDB.h:4363
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:4849
__hostdev__ bool getMax() const
Definition: NanoVDB.h:4006
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:2926
bool BuildType
Definition: NanoVDB.h:3936
__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:5132
__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:3961
__hostdev__ uint8_t flags() const
Definition: NanoVDB.h:4384
__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:5987
uint64_t Type
Definition: NanoVDB.h:535
CoordT mBBoxMin
Definition: NanoVDB.h:4039
__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:5036
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:3449
StatsT mAverage
Definition: NanoVDB.h:2605
Visits all values in a leaf node, i.e. both active and inactive values.
Definition: NanoVDB.h:4302
__hostdev__ void setMin(const ValueT &v)
Definition: NanoVDB.h:3223
__hostdev__ bool hasAverage() const
Definition: NanoVDB.h:2241
__hostdev__ CoordType getCoord() const
Definition: NanoVDB.h:3337
__hostdev__ bool isActive() const
Definition: NanoVDB.h:2635
Visits active tile values of this node only.
Definition: NanoVDB.h:3349
__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:3649
Visits all inactive values in a leaf node.
Definition: NanoVDB.h:4269
__hostdev__ const TreeType & tree() const
Return a const reference to the tree of the IndexGrid.
Definition: NanoVDB.h:5715
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:4349
static __hostdev__ bool hasStats()
Definition: NanoVDB.h:3998
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:4958
__hostdev__ void setMax(const bool &)
Definition: NanoVDB.h:3963
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:3701
__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:5137
__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:5741
uint64_t mData1
Definition: NanoVDB.h:1913
BitFlags(Type mask)
Definition: NanoVDB.h:928
__hostdev__ bool isValueOn() const
Definition: NanoVDB.h:3411
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:4105
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:4157
__hostdev__ void setAvg(const bool &)
Definition: NanoVDB.h:3964
__hostdev__ void setMin(const ValueType &v)
Definition: NanoVDB.h:3669
__hostdev__ bool getMin() const
Definition: NanoVDB.h:4005
__hostdev__ bool isStaggered() const
Definition: NanoVDB.h:2232
__hostdev__ ConstChildIterator cbeginChild() const
Definition: NanoVDB.h:3307
uint8_t mFlags
Definition: NanoVDB.h:3993
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:5883
__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:5633
__hostdev__ NodeT * operator->() const
Definition: NanoVDB.h:3290
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:3707
#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:3650
__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:4042
typename RootT::CoordType CoordType
Definition: NanoVDB.h:4807
__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:3435
__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:5299
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:4458
__hostdev__ const NodeT * getNode() const
Return a const point to the cached node of the specified type.
Definition: NanoVDB.h:5283
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:3844
__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:3941
__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:3521
__hostdev__ void setAvg(const StatsT &v)
Definition: NanoVDB.h:2790
__hostdev__ CoordType getOrigin() const
Definition: NanoVDB.h:3332
__hostdev__ const LeafNodeType * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:3491
__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:4482
__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:3724
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition: NanoVDB.h:4848
__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:4425
typename ChildT::BuildType BuildT
Definition: NanoVDB.h:3130
__hostdev__ DataType * data()
Definition: NanoVDB.h:4361
__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:5272
uint64_t mPointCount
Definition: NanoVDB.h:4161
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition: NanoVDB.h:4846
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:4048
__hostdev__ CoordType origin() const
Return the origin in index space of this leaf node.
Definition: NanoVDB.h:3452
__hostdev__ DenseIterator(uint32_t pos=Mask::SIZE)
Definition: NanoVDB.h:1098
__hostdev__ CoordT getCoord() const
Definition: NanoVDB.h:4291
MaskT< LOG2DIM > mMask
Definition: NanoVDB.h:4136
PointAccessor(const NanoGrid< BuildT > &grid)
Definition: NanoVDB.h:5549
__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:4179
__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:5737
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:4128
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:3944
__hostdev__ void localToGlobalCoord(Coord &ijk) const
Converts (in place) a local index coordinate to a global index coordinate.
Definition: NanoVDB.h:4400
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition: NanoVDB.h:5249
__hostdev__ void setOrigin(const T &ijk)
Definition: NanoVDB.h:4198
uint64_t ValueType
Definition: NanoVDB.h:4149
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:6211
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:5382
__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:4041
uint64_t mPrefixSum
Definition: NanoVDB.h:4043
__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:5077
typename util::match_const< ChildT, DataT >::type NodeT
Definition: NanoVDB.h:2662
__hostdev__ ChildIter(ParentT *parent)
Definition: NanoVDB.h:3279
uint32_t mGridIndex
Definition: NanoVDB.h:1901
__hostdev__ ValueOnIterator(const LeafNode *parent)
Definition: NanoVDB.h:4247
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition: NanoVDB.h:5130
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:3505
__hostdev__ uint32_t nodeCount() const
Definition: NanoVDB.h:2474
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition: NanoVDB.h:5129
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:5244
__hostdev__ CoordType getCoord() const
Definition: NanoVDB.h:3376
static __hostdev__ bool hasStats()
Definition: NanoVDB.h:3646
__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:3355
__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:5643
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:4937
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType type
Definition: NanoVDB.h:1710
void ArrayType
Definition: NanoVDB.h:3988
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:4035
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:4831
__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:4266
__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:4376
Class to access points at a specific voxel location.
Definition: NanoVDB.h:5542
__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:4911
__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:4190
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:3327
__hostdev__ const RootT & root() const
Definition: NanoVDB.h:4833
static void * memzero(void *dst, size_t byteCount)
Zero initialization of memory.
Definition: Util.h:297
__hostdev__ DataType * data()
Definition: NanoVDB.h:3433
const typename GridOrTreeOrRootT::RootNodeType type
Definition: NanoVDB.h:1739
__hostdev__ void setAvg(const StatsT &v)
Definition: NanoVDB.h:3225
__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:4452
__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:3739
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:5343
__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:4844
__hostdev__ float getMax() const
return the quantized maximum of the active values in this node
Definition: NanoVDB.h:3736
typename ChildT::ValueType ValueT
Definition: NanoVDB.h:3129
__hostdev__ bool getDev() const
Definition: NanoVDB.h:3955
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:3424
Codec
Define compression codecs.
Definition: NanoVDB.h:5789
__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:3706
__hostdev__ bool isChild(uint32_t n) const
Definition: NanoVDB.h:3206
Internal nodes of a VDB tree.
Definition: NanoVDB.h:3240
__hostdev__ ValueOnIterator()
Definition: NanoVDB.h:4242
__hostdev__ ValueType getMax() const
Definition: NanoVDB.h:4188
__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:5243
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition: NanoVDB.h:4843
BuildT TreeType
Definition: NanoVDB.h:2102
Base-class for quantized float leaf nodes.
Definition: NanoVDB.h:3697
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:3948
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType Type
Definition: NanoVDB.h:1709
__hostdev__ uint64_t getMin() const
Definition: NanoVDB.h:4102
__hostdev__ CoordType getOrigin() const
Definition: NanoVDB.h:3416
__hostdev__ bool isCached(const CoordType &ijk) const
Definition: NanoVDB.h:4944
__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:4172
C++11 implementation of std::is_same.
Definition: Util.h:314
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition: NanoVDB.h:5261
static __hostdev__ uint64_t memUsage()
Definition: NanoVDB.h:3713
__hostdev__ void setValue(uint32_t offset, bool v)
Definition: NanoVDB.h:3956
__hostdev__ bool isActive() const
Return true if this node or any of its child nodes contain active values.
Definition: NanoVDB.h:3535
__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:4082
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:3812
__hostdev__ const NanoGrid< Point > & grid() const
Definition: NanoVDB.h:5629
TileT * mPos
Definition: NanoVDB.h:2663
static __hostdev__ constexpr uint64_t memUsage()
Definition: NanoVDB.h:3843
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:6112
__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:4011
Return point to the lower internal node where math::Coord maps to one of its values, i.e. terminates.
Definition: NanoVDB.h:6138
uint64_t type
Definition: NanoVDB.h:487
static __hostdev__ bool hasStats()
Definition: NanoVDB.h:3950
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:4957
__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:3464
__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:5654
uint8_t mFlags
Definition: NanoVDB.h:3943
T type
Definition: Util.h:387
__hostdev__ uint64_t getAvg() const
Definition: NanoVDB.h:4104
__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:4336
__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:3985
typename ChildT::template MaskType< LOG2 > MaskType
Definition: NanoVDB.h:3252
auto callNanoGrid(GridDataT *gridData, ArgsT &&...args)
Below is an example of the struct used for generic programming with callNanoGrid. ...
Definition: NanoVDB.h:4719
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:3987
__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:4475
__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:4193
uint32_t mData0
Definition: NanoVDB.h:1912
__hostdev__ ValueType operator*() const
Definition: NanoVDB.h:4253
Dummy type for indexing points into voxels.
Definition: NanoVDB.h:202
__hostdev__ const MaskType< LOG2DIM > & getValueMask() const
Definition: NanoVDB.h:3445
__hostdev__ ValueType getValue(const CoordT &ijk) const
Return the voxel value at the given coordinate.
Definition: NanoVDB.h:4442
static __hostdev__ size_t memUsage()
Return memory usage in bytes for the class.
Definition: NanoVDB.h:3441
__hostdev__ NodeT & operator*() const
Definition: NanoVDB.h:3285
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:3474
StatsT mAverage
Definition: NanoVDB.h:3154
__hostdev__ float getValue(uint32_t i) const
Definition: NanoVDB.h:3851
Definition: NanoVDB.h:2948
__hostdev__ ValueIterator cbeginValueAll() const
Definition: NanoVDB.h:3346
CoordT mBBoxMin
Definition: NanoVDB.h:3704
__hostdev__ NodeT & operator*() const
Definition: NanoVDB.h:2858
typename ChildT::CoordType CoordT
Definition: NanoVDB.h:2571
__hostdev__ uint64_t getMax() const
Definition: NanoVDB.h:4083
__hostdev__ ValueType getValue(uint32_t offset) const
Return the voxel value at the given offset.
Definition: NanoVDB.h:4439
__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:3711
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:4151
__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:3945
__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:4430
__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:4217
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:5133
__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:5743
__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:3266
__hostdev__ Coord offsetToGlobalCoord(uint32_t n) const
Definition: NanoVDB.h:3527
typename remove_const< T >::type type
Definition: Util.h:431
static __hostdev__ constexpr uint32_t padding()
Definition: NanoVDB.h:3999
__hostdev__ void setValue(uint32_t offset, uint16_t value)
Definition: NanoVDB.h:4180
__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:3813
__hostdev__ ValueIterator(const InternalNode *parent)
Definition: NanoVDB.h:3321
typename Mask< 3 >::template Iterator< ON > MaskIterT
Definition: NanoVDB.h:4233
Leaf nodes of the VDB tree. (defaults to 8x8x8 = 512 voxels)
Definition: NanoVDB.h:4214
__hostdev__ bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:4959
__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:5721
__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:3425
BuildT BuildType
Definition: NanoVDB.h:5034
__hostdev__ uint32_t rootTableSize() const
return the root table has size
Definition: NanoVDB.h:2072
bool FloatType
Definition: NanoVDB.h:3937
__hostdev__ bool hasBBox() const
Definition: NanoVDB.h:4472
double mTaperD
Definition: NanoVDB.h:1385
__hostdev__ CoordType getCoord() const
Definition: NanoVDB.h:3421
uint32_t dim
Definition: NanoVDB.h:6215
__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:4462
__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:4078
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:3629
__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:4445
__hostdev__ ValueOnIterator cbeginValueOn() const
Definition: NanoVDB.h:3380
typename GridOrTreeOrRootT::RootNodeType Type
Definition: NanoVDB.h:1730
typename NanoLeaf< BuildT >::ValueType ValueT
Definition: NanoVDB.h:6084
__hostdev__ ValueOnIterator(const InternalNode *parent)
Definition: NanoVDB.h:3360
__hostdev__ ConstValueOnIterator cbeginValueOn() const
Definition: NanoVDB.h:2945
Definition: NanoVDB.h:2616
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition: NanoVDB.h:4919
typename BuildToValueMap< BuildT >::Type ValueT
Definition: NanoVDB.h:6178
FloatType mAverage
Definition: NanoVDB.h:3633
__hostdev__ TileIter(DataT *data, uint32_t pos=0)
Definition: NanoVDB.h:2667
BuildT BuildType
Definition: NanoVDB.h:4805
ValueT ValueType
Definition: NanoVDB.h:5035
__hostdev__ const ChildNodeType * probeChild(const CoordType &ijk) const
Definition: NanoVDB.h:3498
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:4058
__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:4168
__hostdev__ TileIter & operator++()
Definition: NanoVDB.h:2678
__hostdev__ bool isCached1(const CoordType &ijk) const
Definition: NanoVDB.h:5110
__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:5041
__hostdev__ ValueType getMax() const
Definition: NanoVDB.h:3658
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:3733
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:4961
__hostdev__ ValueOffIterator()
Definition: NanoVDB.h:4275
ChildT ChildNodeType
Definition: NanoVDB.h:3248
typename DataType::BuildT BuildType
Definition: NanoVDB.h:3246
__hostdev__ ValueOffIterator cbeginValueOff() const
Definition: NanoVDB.h:4299
__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:4225
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:5291
__hostdev__ bool hasBBox() const
Definition: NanoVDB.h:2239
uint64_t type
Definition: NanoVDB.h:536
__hostdev__ FloatType getAvg() const
Definition: NanoVDB.h:4189
typename ChildT::LeafNodeType LeafNodeType
Definition: NanoVDB.h:3247
__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:5340
__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:3965
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:4465
GridBlindDataClass
Blind-data Classes that are currently supported by NanoVDB.
Definition: NanoVDB.h:411
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:4158
__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:4236
__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