125#ifndef NANOVDB_NANOVDB_H_HAS_BEEN_INCLUDED
126#define NANOVDB_NANOVDB_H_HAS_BEEN_INCLUDED
133#define NANOVDB_DATA_ALIGNMENT 32
139#define NANOVDB_MAGIC_NUMB 0x304244566f6e614eUL
140#define NANOVDB_MAGIC_GRID 0x314244566f6e614eUL
141#define NANOVDB_MAGIC_FILE 0x324244566f6e614eUL
142#define NANOVDB_MAGIC_MASK 0x00FFFFFFFFFFFFFFUL
144#define NANOVDB_USE_NEW_MAGIC_NUMBERS
146#define NANOVDB_MAJOR_VERSION_NUMBER 32
147#define NANOVDB_MINOR_VERSION_NUMBER 11
148#define NANOVDB_PATCH_VERSION_NUMBER 0
150#define TBB_SUPPRESS_DEPRECATED_MESSAGES 1
153#define NANOVDB_USE_SINGLE_ROOT_KEY
166#define NANOVDB_FPN_BRANCHLESS
168#if !defined(NANOVDB_ALIGN)
169#define NANOVDB_ALIGN(n) alignas(n)
212template <
class EnumT>
213__hostdev__ inline constexpr uint32_t
strlen(){
return (uint32_t)EnumT::StrLen - (uint32_t)EnumT::End;}
501 return defaultSemantic;
690 switch (blindClass) {
742 : mData(major << 21 | minor << 10 | patch)
775template<
typename T,
int Rank = (util::is_specialization<T, math::Vec3>::value || util::is_specialization<T, math::Vec4>::value || util::is_same<T, math::Rgba8>::value) ? 1 : 0>
786 static T
scalar(
const T& s) {
return s; }
795 static const int Size = T::SIZE;
802template<
typename T,
int = sizeof(
typename TensorTraits<T>::ElementType)>
847template<
typename BuildT>
905template<
typename BuildT>
957 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
959 template<
typename MaskT>
962 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
969 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
971 template<
typename MaskT>
975 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
987 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
991 for (
auto bit : list) mFlags &= ~static_cast<Type>(1 << bit);
994 template<
typename MaskT>
996 template<
typename MaskT>
999 template<
typename MaskT>
1002 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
1004 template<
typename MaskT>
1007 for (
auto mask : list) mFlags &= ~static_cast<Type>(mask);
1011 template<
typename MaskT>
1018 template<
typename MaskT>
1020 template<
typename MaskT>
1023 template<
typename MaskT>
1026 for (
auto mask : list) {
1027 if (0 != (mFlags &
static_cast<Type>(mask)))
return true;
1032 template<
typename MaskT>
1035 for (
auto mask : list) {
1036 if (0 == (mFlags &
static_cast<Type>(mask)))
return true;
1052template<u
int32_t LOG2DIM>
1056 static constexpr uint32_t
SIZE = 1U << (3 * LOG2DIM);
1072 for (
const uint64_t *w = mWords, *q = w +
WORD_COUNT; w != q; ++w)
1080 uint32_t n = i >> 6, sum =
util::countOn(mWords[n] & ((uint64_t(1) << (i & 63u)) - 1u));
1081 for (
const uint64_t* w = mWords; n--; ++w)
1105 mPos = mParent->findNext<On>(mPos + 1);
1117 const Mask* mParent;
1163 const uint64_t v = on ? ~uint64_t(0) : uint64_t(0);
1175 template<
typename WordT>
1180 return reinterpret_cast<WordT*
>(mWords)[n];
1182 template<
typename WordT>
1187 reinterpret_cast<WordT*
>(mWords)[n] = w;
1191 template<
typename MaskT = Mask>
1194 static_assert(
sizeof(
Mask) ==
sizeof(MaskT),
"Mismatching sizeof");
1195 static_assert(
WORD_COUNT == MaskT::WORD_COUNT,
"Mismatching word count");
1196 static_assert(LOG2DIM == MaskT::LOG2DIM,
"Mismatching LOG2DIM");
1197 auto* src =
reinterpret_cast<const uint64_t*
>(&other);
1198 for (uint64_t *dst = mWords, *end = dst +
WORD_COUNT; dst != end; ++dst)
1209 if (mWords[i] != other.mWords[i])
1218 __hostdev__ bool isOn(uint32_t n)
const {
return 0 != (mWords[n >> 6] & (uint64_t(1) << (n & 63))); }
1221 __hostdev__ bool isOff(uint32_t n)
const {
return 0 == (mWords[n >> 6] & (uint64_t(1) << (n & 63))); }
1227 if (mWords[i] != ~uint64_t(0))
1236 if (mWords[i] != uint64_t(0))
1258#if defined(__CUDACC__)
1285 auto& word = mWords[n >> 6];
1287 word &= ~(uint64_t(1) << n);
1288 word |= uint64_t(on) << n;
1297 for (uint32_t i = 0; i <
WORD_COUNT; ++i)mWords[i] = ~uint64_t(0);
1303 for (uint32_t i = 0; i <
WORD_COUNT; ++i) mWords[i] = uint64_t(0);
1309 const uint64_t v = on ? ~uint64_t(0) : uint64_t(0);
1310 for (uint32_t i = 0; i <
WORD_COUNT; ++i) mWords[i] = v;
1316 for (
auto* w = mWords; n--; ++w) *w = ~*w;
1323 uint64_t* w1 = mWords;
1324 const uint64_t* w2 = other.mWords;
1325 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 &= *w2;
1331 uint64_t* w1 = mWords;
1332 const uint64_t* w2 = other.mWords;
1333 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 |= *w2;
1339 uint64_t* w1 = mWords;
1340 const uint64_t* w2 = other.mWords;
1341 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 &= ~*w2;
1347 uint64_t* w1 = mWords;
1348 const uint64_t* w2 = other.mWords;
1349 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 ^= *w2;
1358 const uint64_t* w = mWords;
1359 for (; n <
WORD_COUNT && !(ON ? *w : ~*w); ++w, ++n);
1367 uint32_t n = start >> 6;
1369 uint32_t m = start & 63u;
1370 uint64_t b = ON ? mWords[n] : ~mWords[n];
1371 if (b & (uint64_t(1u) << m))
return start;
1372 b &= ~uint64_t(0u) << m;
1373 while (!b && ++n <
WORD_COUNT) b = ON ? mWords[n] : ~mWords[n];
1381 uint32_t n = start >> 6;
1383 uint32_t m = start & 63u;
1384 uint64_t b = ON ? mWords[n] : ~mWords[n];
1385 if (b & (uint64_t(1u) << m))
return start;
1386 b &= (uint64_t(1u) << m) - 1u;
1387 while (!b && n) b = ON ? mWords[--n] : ~mWords[--n];
1411 :
mMatF{ 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}
1412 ,
mInvMatF{1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}
1413 ,
mVecF{0.0f, 0.0f, 0.0f}
1415 ,
mMatD{ 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}
1416 ,
mInvMatD{1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}
1417 ,
mVecD{0.0, 0.0, 0.0}
1422 :
mMatF{float(s), 0.0f, 0.0f, 0.0f, float(s), 0.0f, 0.0f, 0.0f, float(s)}
1423 ,
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)}
1424 ,
mVecF{float(t[0]), float(t[1]), float(t[2])}
1426 ,
mMatD{s, 0.0, 0.0, 0.0, s, 0.0, 0.0, 0.0, s}
1427 ,
mInvMatD{1.0 / s, 0.0, 0.0, 0.0, 1.0 / s, 0.0, 0.0, 0.0, 1.0 / s}
1428 ,
mVecD{t[0], t[1], t[2]}
1435 template<
typename MatT,
typename Vec3T>
1436 void set(
const MatT& mat,
const MatT& invMat,
const Vec3T& translate,
double taper = 1.0);
1441 template<
typename Mat4T>
1442 void set(
const Mat4T& mat,
const Mat4T& invMat,
double taper = 1.0) { this->
set(mat, invMat, mat[3], taper); }
1444 template<
typename Vec3T>
1445 void set(
double scale,
const Vec3T& translation,
double taper = 1.0);
1452 template<
typename Vec3T>
1460 template<
typename Vec3T>
1469 template<
typename Vec3T>
1478 template<
typename Vec3T>
1486 template<
typename Vec3T>
1489 using ValueT = std::decay_t<
decltype(xyz[0])>;
1498 template<
typename Vec3T>
1510 template<
typename Vec3T>
1519 template<
typename Vec3T>
1528 template<
typename Vec3T>
1530 template<
typename Vec3T>
1537template<
typename MatT,
typename Vec3T>
1538inline void Map::set(
const MatT& mat,
const MatT& invMat,
const Vec3T& translate,
double taper)
1542 mTaperF =
static_cast<float>(taper);
1544 for (
int i = 0; i < 3; ++i) {
1545 *vd++ = translate[i];
1546 *vf++ =
static_cast<float>(translate[i]);
1547 for (
int j = 0; j < 3; ++j) {
1549 *mid++ = invMat[j][i];
1550 *mf++ =
static_cast<float>(mat[j][i]);
1551 *mif++ =
static_cast<float>(invMat[j][i]);
1556template<
typename Vec3T>
1557inline void Map::set(
double dx,
const Vec3T& trans,
double taper)
1560 const double mat[3][3] = { {dx, 0.0, 0.0},
1563 const double idx = 1.0 / dx;
1564 const double invMat[3][3] = { {idx, 0.0, 0.0},
1567 this->
set(mat, invMat, trans, taper);
1656 template<
typename BlindDataT>
1667 auto check = [&]()->
bool{
1685 default:
return true;}
1707template<
typename Gr
idOrTreeOrRootT,
int LEVEL>
1711template<
typename Gr
idOrTreeOrRootT>
1714 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1715 using Type =
typename GridOrTreeOrRootT::LeafNodeType;
1716 using type =
typename GridOrTreeOrRootT::LeafNodeType;
1718template<
typename Gr
idOrTreeOrRootT>
1721 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1722 using Type =
const typename GridOrTreeOrRootT::LeafNodeType;
1723 using type =
const typename GridOrTreeOrRootT::LeafNodeType;
1726template<
typename Gr
idOrTreeOrRootT>
1729 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1730 using Type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1731 using type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1733template<
typename Gr
idOrTreeOrRootT>
1736 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1737 using Type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1738 using type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1740template<
typename Gr
idOrTreeOrRootT>
1743 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1744 using Type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1745 using type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1747template<
typename Gr
idOrTreeOrRootT>
1750 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1751 using Type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1752 using type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1754template<
typename Gr
idOrTreeOrRootT>
1757 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1758 using Type =
typename GridOrTreeOrRootT::RootNodeType;
1759 using type =
typename GridOrTreeOrRootT::RootNodeType;
1762template<
typename Gr
idOrTreeOrRootT>
1765 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1766 using Type =
const typename GridOrTreeOrRootT::RootNodeType;
1767 using type =
const typename GridOrTreeOrRootT::RootNodeType;
1770template<
typename Gr
idOrTreeOrRootT,
int LEVEL>
1775template<
typename BuildT>
1777template<
typename BuildT>
1779template<
typename BuildT>
1781template<
typename BuildT>
1783template<
typename BuildT>
1785template<
typename BuildT>
1787template<
typename BuildT>
1789template<
typename BuildT>
1805 :
packed((d & 0x7FFFFFFFu) | (uint32_t(a) << 31))
1976 uint64_t gridSize = 0u,
1981#ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS
1991 mGridSize = gridSize;
1992 mGridName[0] =
'\0';
1995 mVoxelSize = map.getVoxelSize();
1996 mGridClass = gridClass;
1997 mGridType = gridType;
1998 mBlindMetadataOffset = mGridSize;
1999 mBlindMetadataCount = 0u;
2002#ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS
2016 if (test) test =
mVersion.isCompatible();
2034 template<
typename Vec3T>
2036 template<
typename Vec3T>
2038 template<
typename Vec3T>
2040 template<
typename Vec3T>
2042 template<
typename Vec3T>
2045 template<
typename Vec3T>
2047 template<
typename Vec3T>
2049 template<
typename Vec3T>
2051 template<
typename Vec3T>
2053 template<
typename Vec3T>
2064 template <u
int32_t LEVEL>
2067 static_assert(LEVEL >= 0 && LEVEL <= 3,
"invalid LEVEL template parameter");
2068 const void *treeData =
this + 1;
2070 return nodeOffset ?
util::PtrAdd(treeData, nodeOffset) :
nullptr;
2076 template <u
int32_t LEVEL>
2079 static_assert(LEVEL >= 0 && LEVEL <= 3,
"invalid LEVEL template parameter");
2080 void *treeData =
this + 1;
2082 return nodeOffset ?
util::PtrAdd(treeData, nodeOffset) :
nullptr;
2087 template <u
int32_t LEVEL>
2090 static_assert(LEVEL >= 0 && LEVEL < 3,
"invalid LEVEL template parameter");
2111 return metaData->template getBlindData<const char>();
2145template<
typename BuildT,
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1>
2148template<
typename BuildT>
2155template<
typename TreeT>
2199 template<
typename T = BuildType>
2206 template<
typename T = BuildType>
2226 template<
typename Vec3T>
2230 template<
typename Vec3T>
2235 template<
typename Vec3T>
2240 template<
typename Vec3T>
2245 template<
typename Vec3T>
2249 template<
typename Vec3T>
2253 template<
typename Vec3T>
2258 template<
typename Vec3T>
2263 template<
typename Vec3T>
2268 template<
typename Vec3T>
2305 template<
typename NodeT>
2337 template <
typename BlindDataT>
2344 template <
typename BlindDataT>
2357template<
typename TreeT>
2367template<
typename TreeT>
2370 auto test = [&](
int n) {
2373 if (name[i] != str[i])
2375 if (name[i] ==
'\0' && str[i] ==
'\0')
2407 template<
typename NodeT>
2423template<
typename Gr
idT>
2426 using Type =
typename GridT::TreeType;
2427 using type =
typename GridT::TreeType;
2429template<
typename Gr
idT>
2432 using Type =
const typename GridT::TreeType;
2433 using type =
const typename GridT::TreeType;
2436template<
typename Gr
idT>
2442template<
typename RootT>
2445 static_assert(RootT::LEVEL == 3,
"Tree depth is not supported");
2446 static_assert(RootT::ChildNodeType::LOG2DIM == 5,
"Tree configuration is not supported");
2447 static_assert(RootT::ChildNodeType::ChildNodeType::LOG2DIM == 4,
"Tree configuration is not supported");
2448 static_assert(RootT::LeafNodeType::LOG2DIM == 3,
"Tree configuration is not supported");
2463 using Node2 =
typename RootT::ChildNodeType;
2464 using Node1 =
typename Node2::ChildNodeType;
2522 template<
typename NodeT>
2525 static_assert(NodeT::LEVEL < 3,
"Invalid NodeT");
2543 template<
typename NodeT>
2553 template<
typename NodeT>
2586 template<
typename OpT,
typename... ArgsT>
2592 template<
typename OpT,
typename... ArgsT>
2603template<
typename RootT>
2606 min = this->
root().minimum();
2607 max = this->
root().maximum();
2615template<
typename ChildT>
2625#ifdef NANOVDB_USE_SINGLE_ROOT_KEY
2627 template<
typename CoordType>
2630 static_assert(
sizeof(
CoordT) ==
sizeof(CoordType),
"Mismatching sizeof");
2631 static_assert(32 - ChildT::TOTAL <= 21,
"Cannot use 64 bit root keys");
2632 return (
KeyT(uint32_t(ijk[2]) >> ChildT::TOTAL)) |
2633 (
KeyT(uint32_t(ijk[1]) >> ChildT::TOTAL) << 21) |
2634 (
KeyT(uint32_t(ijk[0]) >> ChildT::TOTAL) << 42);
2638 static constexpr uint64_t MASK = (1u << 21) - 1;
2639 using CoordValueT =
typename CoordT::ValueType;
2640 return CoordT(
static_cast<CoordValueT
>(((key >> 42) & MASK) << ChildT::TOTAL),
2641 static_cast<CoordValueT
>(((key >> 21) & MASK) << ChildT::TOTAL),
2642 static_cast<CoordValueT
>(( key & MASK) << ChildT::TOTAL));
2645 using KeyT = CoordT;
2646 __hostdev__ static KeyT CoordToKey(
const CoordT& ijk) {
return ijk & ~ChildT::MASK; }
2647 __hostdev__ static CoordT KeyToCoord(
const KeyT& key) {
return key; }
2666 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
Tile
2668 template<
typename CoordType>
2675 template<
typename CoordType,
typename ValueType>
2699 return reinterpret_cast<const Tile*
>(
this + 1) + n;
2704 return reinterpret_cast<Tile*
>(
this + 1) + n;
2707 template<
typename DataT>
2746 return reinterpret_cast<DataT*
>(
mBegin) - 1;
2751 return mPos->child != 0;
2756 return mPos->child == 0;
2761 return mPos->child == 0 &&
mPos->state != 0;
2785 for(; iter; ++iter)
if (iter->key == key)
break;
2793 for(; iter; ++iter)
if (iter->key == key)
break;
2799 auto iter = this->
probe(ijk);
2800 return iter ? iter.operator->() :
nullptr;
2810 auto iter = this->
probe(ijk);
2811 return iter && iter.isChild() ? iter.child() :
nullptr;
2853template<
typename ChildT>
2874 static constexpr uint32_t
LEVEL = 1 + ChildT::LEVEL;
2876 template<
typename RootT>
2894 template<
typename RootT>
2906 while (mTileIter && mTileIter.isValue()) ++mTileIter;
2913 while (mTileIter && mTileIter.isValue()) ++mTileIter;
2930 template<
typename RootT>
2940 while (mTileIter && mTileIter.isChild()) ++mTileIter;
2947 while (mTileIter && mTileIter.isChild()) ++mTileIter;
2964 template<
typename RootT>
2974 while (mTileIter && !mTileIter.isValueOn()) ++mTileIter;
2980 while (mTileIter && !mTileIter.isValueOn()) ++mTileIter;
2997 template<
typename RootT>
3009 if (mTileIter.isChild())
return mTileIter.child();
3010 value = mTileIter.value();
3091 template<
typename OpT,
typename... ArgsT>
3096 return OpT::get(*
tile, args...);
3098 return OpT::get(*
this, args...);
3101 template<
typename OpT,
typename... ArgsT>
3106 return OpT::set(*
tile, args...);
3108 return OpT::set(*
this, args...);
3113 static_assert(
sizeof(
typename DataType::Tile) %
NANOVDB_DATA_ALIGNMENT == 0,
"sizeof(RootData::Tile) is misaligned");
3115 template<
typename,
int,
int,
int>
3121 template<
typename RayT,
typename AccT>
3122 __hostdev__ uint32_t getDimAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const
3125 if (
tile->isChild()) {
3127 acc.insert(ijk, child);
3128 return child->getDimAndCache(ijk, ray, acc);
3130 return 1 << ChildT::TOTAL;
3132 return ChildNodeType::dim();
3138 template<
typename Policy = ActiveExact,
typename RayT,
typename AccT>
3139 __hostdev__ DimAndActive getDimAndActiveAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const
3141 if (
const Tile* tile = this->probeTile(ijk)) {
3142 if (tile->isChild()) {
3143 const auto* child = this->getChild(tile);
3144 acc.insert(ijk, child);
3145 return child->template getDimAndActiveAndCache<Policy>(ijk, ray, acc);
3147 return {uint32_t(1) << ChildT::TOTAL, tile->state > 0u};
3149 return {ChildNodeType::dim(),
false};
3152 template<
typename OpT,
typename AccT,
typename... ArgsT>
3153 __hostdev__ typename OpT::Type getAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
const
3155 if (
const Tile* tile = this->probeTile(ijk)) {
3156 if constexpr(OpT::LEVEL < LEVEL) {
3157 if (tile->isChild()) {
3158 const ChildT* child = this->getChild(tile);
3159 acc.insert(ijk, child);
3160 return child->template getAndCache<OpT>(ijk, acc, args...);
3163 return OpT::get(*tile, args...);
3165 return OpT::get(*
this, args...);
3168 template<
typename OpT,
typename AccT,
typename... ArgsT>
3169 __hostdev__ void setAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
3171 if (Tile* tile = DataType::probeTile(ijk)) {
3172 if constexpr(OpT::LEVEL < LEVEL) {
3173 if (tile->isChild()) {
3174 ChildT* child = this->getChild(tile);
3175 acc.insert(ijk, child);
3176 return child->template setAndCache<OpT>(ijk, acc, args...);
3179 return OpT::set(*tile, args...);
3181 return OpT::set(*
this, args...);
3193template<
typename ChildT, u
int32_t LOG2DIM>
3200 using MaskT =
typename ChildT::template MaskType<LOG2DIM>;
3232 alignas(32) Tile
mTable[1u << (3 * LOG2DIM)];
3242 template<
typename ValueT>
3275 template<
typename T>
3287#if defined(__GNUC__) && (__GNUC__ < 14) && !defined(__APPLE__) && !defined(__llvm__)
3288#pragma GCC diagnostic push
3289#pragma GCC diagnostic ignored "-Wstringop-overflow"
3295#if defined(__GNUC__) && (__GNUC__ < 14) && !defined(__APPLE__) && !defined(__llvm__)
3296#pragma GCC diagnostic pop
3307template<
typename ChildT, u
int32_t Log2Dim = ChildT::LOG2DIM + 1>
3319 template<u
int32_t LOG2>
3329 static constexpr uint32_t
LEVEL = 1 + ChildT::LEVEL;
3333 template <
typename ParentT>
3355 return *mParent->getChild(BaseT::pos());
3360 return mParent->getChild(BaseT::pos());
3365 return (*this)->origin();
3396 return mParent->data()->getValue(BaseT::pos());
3401 return mParent->offsetToGlobalCoord(BaseT::pos());
3407 return mParent->data()->isActive(BaseT::mPos);
3434 return mParent->data()->getValue(BaseT::pos());
3439 return mParent->offsetToGlobalCoord(BaseT::pos());
3461 , mParent(parent->
data())
3467 const ChildT* child =
nullptr;
3468 if (mParent->mChildMask.isOn(BaseT::pos())) {
3469 child = mParent->getChild(BaseT::pos());
3471 value = mParent->getValue(BaseT::pos());
3478 return mParent->isActive(BaseT::pos());
3483 return mParent->offsetToGlobalCoord(BaseT::pos());
3571 return (((ijk[0] &
MASK) >> ChildT::TOTAL) << (2 *
LOG2DIM)) |
3572 (((ijk[1] &
MASK) >> ChildT::TOTAL) << (
LOG2DIM)) |
3573 ((ijk[2] &
MASK) >> ChildT::TOTAL);
3580 const uint32_t m = n & ((1 << 2 *
LOG2DIM) - 1);
3587 ijk <<= ChildT::TOTAL;
3601 template<
typename OpT,
typename... ArgsT>
3606 return OpT::get(*
this, n, args...);
3609 template<
typename OpT,
typename... ArgsT>
3614 return OpT::set(*
this, n, args...);
3620 template<
typename,
int,
int,
int>
3625 template<
typename, u
int32_t>
3628 template<
typename RayT,
typename AccT>
3629 __hostdev__ uint32_t getDimAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const
3637 const ChildT* child = this->
getChild(n);
3638 acc.insert(ijk, child);
3639 return child->getDimAndCache(ijk, ray, acc);
3641 return ChildNodeType::dim();
3648 template<
typename Policy = ActiveExact,
typename RayT,
typename AccT>
3649 __hostdev__ DimAndActive getDimAndActiveAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const
3654 if constexpr (util::is_same<Policy, ActiveOnLeafOnly>::value) {
3655 if (DataType::mFlags & uint32_t(1u))
3656 return {this->dim(),
false};
3657 const uint32_t n = CoordToOffset(ijk);
3658 if (DataType::mChildMask.isOn(n)) {
3659 const ChildT* child = this->getChild(n);
3660 acc.insert(ijk, child);
3661 return child->template getDimAndActiveAndCache<Policy>(ijk, ray, acc);
3663 return {ChildNodeType::dim(), DataType::mValueMask.isOn(n)};
3665 const bool skip = (DataType::mFlags & uint32_t(1u));
3666 const uint32_t n = CoordToOffset(ijk);
3667 if (DataType::mChildMask.isOn(n)) {
3668 const ChildT* child = this->getChild(n);
3669 acc.insert(ijk, child);
3670 const auto r = child->template getDimAndActiveAndCache<Policy>(ijk, ray, acc);
3671 return {skip ? this->dim() : r.dim(), r.active()};
3673 return {skip ? this->dim() : ChildNodeType::dim(), DataType::mValueMask.isOn(n)};
3677 template<
typename OpT,
typename AccT,
typename... ArgsT>
3678 __hostdev__ typename OpT::Type getAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
const
3680 const uint32_t n = CoordToOffset(ijk);
3681 if constexpr(OpT::LEVEL < LEVEL) {
3682 if (this->isChild(n)) {
3683 const ChildT* child = this->getChild(n);
3684 acc.insert(ijk, child);
3685 return child->template getAndCache<OpT>(ijk, acc, args...);
3688 return OpT::get(*
this, n, args...);
3691 template<
typename OpT,
typename AccT,
typename... ArgsT>
3692 __hostdev__ void setAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
3694 const uint32_t n = CoordToOffset(ijk);
3695 if constexpr(OpT::LEVEL < LEVEL) {
3696 if (this->isChild(n)) {
3697 ChildT* child = this->getChild(n);
3698 acc.insert(ijk, child);
3699 return child->template setAndCache<OpT>(ijk, acc, args...);
3702 return OpT::set(*
this, n, args...);
3712template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3715 static_assert(
sizeof(CoordT) ==
sizeof(
Coord),
"Mismatching sizeof");
3716 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3739 return sizeof(
LeafData) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>) + 2 * (
sizeof(ValueT) +
sizeof(
FloatType)) + (1u << (3 * LOG2DIM)) *
sizeof(ValueT));
3762#if defined(__GNUC__) && (__GNUC__ < 12) && !defined(__APPLE__) && !defined(__llvm__)
3763#pragma GCC diagnostic push
3764#pragma GCC diagnostic ignored "-Wstringop-overflow"
3770#if defined(__GNUC__) && (__GNUC__ < 12) && !defined(__APPLE__) && !defined(__llvm__)
3771#pragma GCC diagnostic pop
3774 template<
typename T>
3779 for (
auto *p =
mValues, *q = p + 512; p != q; ++p)
3793template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3796 static_assert(
sizeof(CoordT) ==
sizeof(
Coord),
"Mismatching sizeof");
3797 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3819 return sizeof(
LeafFnBase) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>) + 2 * 4 + 4 * 2);
3824 mQuantum = (max - min) /
float((1 << bitWidth) - 1);
3854 template<
typename T>
3863template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3864struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp4, CoordT, MaskT, LOG2DIM>
3871 alignas(32) uint8_t
mCode[1u << (3 * LOG2DIM - 1)];
3876 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3877 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << (3 * LOG2DIM - 1));
3884 const uint8_t c =
mCode[i>>1];
3900template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3901struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp8, CoordT, MaskT, LOG2DIM>
3908 alignas(32) uint8_t
mCode[1u << 3 * LOG2DIM];
3912 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3913 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << 3 * LOG2DIM);
3930template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3931struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp16, CoordT, MaskT, LOG2DIM>
3938 alignas(32) uint16_t
mCode[1u << 3 * LOG2DIM];
3943 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3944 return sizeof(
LeafData) -
sizeof(
BaseT) - 2 * (1u << 3 * LOG2DIM);
3962template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3963struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
FpN, CoordT, MaskT, LOG2DIM>
3972 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3981#ifdef NANOVDB_FPN_BRANCHLESS
3984 uint16_t code =
reinterpret_cast<const uint16_t*
>(
this + 1)[i >> (4 - b)];
3985 const static uint8_t shift[5] = {15, 7, 3, 1, 0};
3986 const static uint16_t mask[5] = {1, 3, 15, 255, 65535};
3987 code >>= (i & shift[b]) << b;
3990 uint32_t code =
reinterpret_cast<const uint32_t*
>(
this + 1)[i >> (5 - b)];
3991 code >>= (i & ((32 >> b) - 1)) << b;
3992 code &= (1 << (1 << b)) - 1;
3996 auto* values =
reinterpret_cast<const uint8_t*
>(
this + 1);
3999 code = float((values[i >> 3] >> (i & 7)) & uint8_t(1));
4002 code = float((values[i >> 2] >> ((i & 3) << 1)) & uint8_t(3));
4005 code = float((values[i >> 1] >> ((i & 1) << 2)) & uint8_t(15));
4008 code = float(values[i]);
4011 code = float(
reinterpret_cast<const uint16_t*
>(values)[i]);
4027template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4028struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<bool, CoordT, MaskT, LOG2DIM>
4030 static_assert(
sizeof(CoordT) ==
sizeof(
Coord),
"Mismatching sizeof");
4031 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4064 template<
typename T>
4077template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4080 static_assert(
sizeof(CoordT) ==
sizeof(
Coord),
"Mismatching sizeof");
4081 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4098 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u);
4113 template<
typename T>
4126template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4129 static_assert(
sizeof(CoordT) ==
sizeof(
Coord),
"Mismatching sizeof");
4130 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4143 return sizeof(
LeafIndexBase) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u);
4154 template<
typename T>
4168template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4188template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4206 uint32_t n = i >> 6;
4207 const uint64_t w =
BaseT::mValueMask.words()[n], mask = uint64_t(1) << (i & 63u);
4208 if (!(w & mask))
return uint64_t(0);
4217template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4218struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Point, CoordT, MaskT, LOG2DIM>
4220 static_assert(
sizeof(CoordT) ==
sizeof(
Coord),
"Mismatching sizeof");
4221 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4243 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u + (1u << 3 * LOG2DIM) * 2u);
4270 template<
typename T>
4283template<
typename BuildT,
4284 typename CoordT =
Coord,
4285 template<u
int32_t>
class MaskT =
Mask,
4286 uint32_t Log2Dim = 3>
4293 static constexpr uint32_t
DIM = 1;
4303 template<u
int32_t LOG2>
4328 return mParent->getValue(BaseT::pos());
4333 return mParent->offsetToGlobalCoord(BaseT::pos());
4360 return mParent->getValue(BaseT::pos());
4365 return mParent->offsetToGlobalCoord(BaseT::pos());
4381 , mPos(1u << 3 * Log2Dim)
4393 return mParent->getValue(mPos);
4398 return mParent->offsetToGlobalCoord(mPos);
4403 return mParent->isActive(mPos);
4405 __hostdev__ operator bool()
const {
return mPos < (1u << 3 * Log2Dim); }
4465 const uint32_t m = n & ((1 << 2 *
LOG2DIM) - 1);
4569 template<
typename OpT,
typename... ArgsT>
4575 template<
typename OpT,
typename... ArgsT>
4578 return OpT::get(*
this, n, args...);
4581 template<
typename OpT,
typename... ArgsT>
4587 template<
typename OpT,
typename... ArgsT>
4590 return OpT::set(*
this, n, args...);
4596 template<
typename,
int,
int,
int>
4601 template<
typename, u
int32_t>
4604 template<
typename RayT,
typename AccT>
4605 __hostdev__ uint32_t getDimAndCache(
const CoordT&,
const RayT& ,
const AccT&)
const
4620 template<
typename Policy = ActiveExact,
typename RayT,
typename AccT>
4624 const uint32_t n = CoordToOffset(ijk);
4625 const uint32_t dimOut = (DataType::mFlags & uint8_t(1u)) ? this->dim() : ChildNodeType::dim();
4626 return {dimOut, DataType::mValueMask.isOn(n)};
4629 template<
typename OpT,
typename AccT,
typename... ArgsT>
4632 getAndCache(
const CoordType& ijk,
const AccT&, ArgsT&&... args)
const
4634 return OpT::get(*
this, CoordToOffset(ijk), args...);
4637 template<
typename OpT,
typename AccT,
typename... ArgsT>
4639 __hostdev__ decltype(OpT::set(util::declval<LeafNode&>(), util::declval<uint32_t>(), util::declval<ArgsT>()...))
4640 setAndCache(
const CoordType& ijk,
const AccT&, ArgsT&&... args)
4642 return OpT::set(*
this, CoordToOffset(ijk), args...);
4649template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4652 static_assert(
LOG2DIM == 3,
"LeafNode::updateBBox: only supports LOGDIM = 3!");
4657 auto update = [&](uint32_t min, uint32_t max,
int axis) {
4663 uint32_t Xmin = word64 ? 0u : 8u, Xmax = Xmin;
4664 for (
int i = 1; i < 8; ++i) {
4673 update(Xmin, Xmax, 0);
4675 const uint32_t *p =
reinterpret_cast<const uint32_t*
>(&word64), word32 = p[0] | p[1];
4676 const uint16_t *q =
reinterpret_cast<const uint16_t*
>(&word32), word16 = q[0] | q[1];
4677 const uint8_t *b =
reinterpret_cast<const uint8_t*
>(&word16),
byte = b[0] | b[1];
4688template<
typename BuildT>
4690template<
typename BuildT>
4692template<
typename BuildT>
4694template<
typename BuildT>
4696template<
typename BuildT>
4698template<
typename BuildT>
4702template<
typename BuildT,
int LEVEL>
4706template<
typename BuildT>
4712template<
typename BuildT>
4718template<
typename BuildT>
4724template<
typename BuildT>
4731template<
typename BuildT,
int LEVEL>
4804template<
typename OpT,
typename GridDataT,
typename... ArgsT>
4808 switch (gridData->mGridType){
4810 return OpT::template known<float>(gridData, args...);
4812 return OpT::template known<double>(gridData, args...);
4814 return OpT::template known<int16_t>(gridData, args...);
4816 return OpT::template known<int32_t>(gridData, args...);
4818 return OpT::template known<int64_t>(gridData, args...);
4820 return OpT::template known<Vec3f>(gridData, args...);
4822 return OpT::template known<Vec3d>(gridData, args...);
4824 return OpT::template known<uint32_t>(gridData, args...);
4826 return OpT::template known<ValueMask>(gridData, args...);
4828 return OpT::template known<ValueIndex>(gridData, args...);
4830 return OpT::template known<ValueOnIndex>(gridData, args...);
4832 return OpT::template known<bool>(gridData, args...);
4834 return OpT::template known<math::Rgba8>(gridData, args...);
4836 return OpT::template known<Fp4>(gridData, args...);
4838 return OpT::template known<Fp8>(gridData, args...);
4840 return OpT::template known<Fp16>(gridData, args...);
4842 return OpT::template known<FpN>(gridData, args...);
4844 return OpT::template known<Vec4f>(gridData, args...);
4846 return OpT::template known<Vec4d>(gridData, args...);
4848 return OpT::template known<uint8_t>(gridData, args...);
4850 return OpT::template known<Half>(gridData, args...);
4852 return OpT::unknown(gridData, args...);
4877template<
typename BuildT>
4887 mutable const RootT* mRoot;
4934 template<
typename RayT>
4937 return mRoot->getDimAndCache(ijk, ray, *
this);
4943 template<
typename Policy = ActiveExact,
typename RayT>
4946 return mRoot->template getDimAndActiveAndCache<Policy>(ijk, ray, *
this);
4948 template<
typename OpT,
typename... ArgsT>
4951 return mRoot->template
get<OpT>(ijk, args...);
4954 template<
typename OpT,
typename... ArgsT>
4957 return const_cast<RootT*
>(mRoot)->
template set<OpT>(ijk, args...);
4964 template<
typename, u
int32_t>
4966 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
4970 template<
typename NodeT>
4975template<
typename BuildT,
int LEVEL0>
4978 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 should be 0, 1, or 2");
4992 mutable CoordT mKey;
4993 mutable const RootT* mRoot;
4994 mutable const NodeT* mNode;
5026 mKey = CoordType::max();
5039 return (ijk[0] & int32_t(~NodeT::MASK)) == mKey[0] &&
5040 (ijk[1] & int32_t(~NodeT::MASK)) == mKey[1] &&
5041 (ijk[2] & int32_t(~NodeT::MASK)) == mKey[2];
5056 template<
typename RayT>
5059 if (this->
isCached(ijk))
return mNode->getDimAndCache(ijk, ray, *
this);
5060 return mRoot->getDimAndCache(ijk, ray, *
this);
5067 template<
typename Policy = ActiveExact,
typename RayT>
5070 if (this->
isCached(ijk))
return mNode->template getDimAndActiveAndCache<Policy>(ijk, ray, *
this);
5071 return mRoot->template getDimAndActiveAndCache<Policy>(ijk, ray, *
this);
5074 template<
typename OpT,
typename... ArgsT>
5077 if constexpr(OpT::LEVEL <= LEVEL0)
if (this->
isCached(ijk))
return mNode->template getAndCache<OpT>(ijk, *
this, args...);
5078 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5081 template<
typename OpT,
typename... ArgsT>
5084 if constexpr(OpT::LEVEL <= LEVEL0)
if (this->
isCached(ijk))
return const_cast<NodeT*
>(mNode)->
template setAndCache<OpT>(ijk, *
this, args...);
5085 return const_cast<RootT*
>(mRoot)->
template setAndCache<OpT>(ijk, *
this, args...);
5092 template<
typename, u
int32_t>
5094 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5100 mKey = ijk & ~NodeT::MASK;
5105 template<
typename OtherNodeT>
5106 __hostdev__ void insert(
const CoordType&,
const OtherNodeT*)
const {}
5110template<
typename BuildT,
int LEVEL0,
int LEVEL1>
5113 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 must be 0, 1, 2");
5114 static_assert(LEVEL1 >= 0 && LEVEL1 <= 2,
"LEVEL1 must be 0, 1, 2");
5115 static_assert(LEVEL0 < LEVEL1,
"Level 0 must be lower than level 1");
5128#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5129 mutable CoordT mKey;
5131 mutable CoordT mKeys[2];
5133 mutable const RootT* mRoot;
5134 mutable const Node1T* mNode1;
5135 mutable const Node2T* mNode2;
5146#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5147 : mKey(CoordType::max())
5149 : mKeys{CoordType::max(), CoordType::max()}
5172#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5173 mKey = CoordType::max();
5175 mKeys[0] = mKeys[1] = CoordType::max();
5188#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5193 if (dirty & int32_t(~Node1T::MASK)) {
5199 __hostdev__ bool isCached2(CoordValueType dirty)
const
5203 if (dirty & int32_t(~Node2T::MASK)) {
5209 __hostdev__ CoordValueType computeDirty(
const CoordType& ijk)
const
5211 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
5216 return (ijk[0] & int32_t(~Node1T::MASK)) == mKeys[0][0] &&
5217 (ijk[1] & int32_t(~Node1T::MASK)) == mKeys[0][1] &&
5218 (ijk[2] & int32_t(~Node1T::MASK)) == mKeys[0][2];
5222 return (ijk[0] & int32_t(~Node2T::MASK)) == mKeys[1][0] &&
5223 (ijk[1] & int32_t(~Node2T::MASK)) == mKeys[1][1] &&
5224 (ijk[2] & int32_t(~Node2T::MASK)) == mKeys[1][2];
5240 template<
typename RayT>
5243#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5244 const CoordValueType dirty = this->computeDirty(ijk);
5249 return mNode1->getDimAndCache(ijk, ray, *
this);
5251 return mNode2->getDimAndCache(ijk, ray, *
this);
5253 return mRoot->getDimAndCache(ijk, ray, *
this);
5260 template<
typename Policy = ActiveExact,
typename RayT>
5263#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5264 const CoordValueType dirty = this->computeDirty(ijk);
5269 return mNode1->template getDimAndActiveAndCache<Policy>(ijk, ray, *
this);
5271 return mNode2->template getDimAndActiveAndCache<Policy>(ijk, ray, *
this);
5273 return mRoot->template getDimAndActiveAndCache<Policy>(ijk, ray, *
this);
5276 template<
typename OpT,
typename... ArgsT>
5279#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5280 const CoordValueType dirty = this->computeDirty(ijk);
5284 if constexpr(OpT::LEVEL <= LEVEL0) {
5285 if (this->
isCached1(dirty))
return mNode1->template getAndCache<OpT>(ijk, *
this, args...);
5287#ifdef NANOVDB_USE_OLD_ACCESSOR
5290 if constexpr(OpT::LEVEL <= LEVEL1) {
5291 if (this->
isCached2(dirty))
return mNode2->template getAndCache<OpT>(ijk, *
this, args...);
5293 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5296 template<
typename OpT,
typename... ArgsT>
5299#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5300 const CoordValueType dirty = this->computeDirty(ijk);
5304 if constexpr(OpT::LEVEL <= LEVEL0) {
5305 if (this->
isCached1(dirty))
return const_cast<Node1T*
>(mNode1)->
template setAndCache<OpT>(ijk, *
this, args...);
5307#ifdef NANOVDB_USE_OLD_ACCESSOR
5310 if constexpr(OpT::LEVEL <= LEVEL1) {
5311 if (this->
isCached2(dirty))
return const_cast<Node2T*
>(mNode2)->
template setAndCache<OpT>(ijk, *
this, args...);
5313 return const_cast<RootT*
>(mRoot)->
template setAndCache<OpT>(ijk, *
this, args...);
5320 template<
typename, u
int32_t>
5322 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5328#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5331 mKeys[0] = ijk & ~Node1T::MASK;
5335 __hostdev__ void insert(
const CoordType& ijk,
const Node2T* node)
const
5337#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5340 mKeys[1] = ijk & ~Node2T::MASK;
5344 template<
typename OtherNodeT>
5345 __hostdev__ void insert(
const CoordType&,
const OtherNodeT*)
const {}
5349template<
typename BuildT>
5350class ReadAccessor<BuildT, 0, 1, 2>
5352 using GridT = NanoGrid<BuildT>;
5353 using TreeT = NanoTree<BuildT>;
5354 using RootT = NanoRoot<BuildT>;
5355 using NodeT2 = NanoUpper<BuildT>;
5356 using NodeT1 = NanoLower<BuildT>;
5357 using LeafT = NanoLeaf<BuildT>;
5358 using CoordT =
typename RootT::CoordType;
5359 using ValueT =
typename RootT::ValueType;
5361 using FloatType =
typename RootT::FloatType;
5362 using CoordValueType =
typename RootT::CoordT::ValueType;
5365#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5366 mutable CoordT mKey;
5368 mutable CoordT mKeys[3];
5370 mutable const RootT* mRoot;
5371 mutable const void* mNode[3];
5374 using BuildType = BuildT;
5375 using ValueType = ValueT;
5376 using CoordType = CoordT;
5378 static const int CacheLevels = 3;
5382#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5383 : mKey(CoordType::max())
5385 : mKeys{CoordType::max(), CoordType::max(), CoordType::max()}
5388 , mNode{
nullptr,
nullptr,
nullptr}
5394 : ReadAccessor(grid.tree().root())
5400 : ReadAccessor(tree.root())
5404 __hostdev__ const RootT& root()
const {
return *mRoot; }
5407 ReadAccessor(
const ReadAccessor&) =
default;
5408 ~ReadAccessor() =
default;
5409 ReadAccessor& operator=(
const ReadAccessor&) =
default;
5414 template<
typename NodeT>
5417 using T =
typename NodeTrait<TreeT, NodeT::LEVEL>::type;
5418 static_assert(util::is_same<T, NodeT>::value,
"ReadAccessor::getNode: Invalid node type");
5419 return reinterpret_cast<const T*
>(mNode[NodeT::LEVEL]);
5423 __hostdev__ const typename NodeTrait<TreeT, LEVEL>::type* getNode()
const
5425 using T =
typename NodeTrait<TreeT, LEVEL>::type;
5426 static_assert(LEVEL >= 0 && LEVEL <= 2,
"ReadAccessor::getNode: Invalid node type");
5427 return reinterpret_cast<const T*
>(mNode[LEVEL]);
5433#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5434 mKey = CoordType::max();
5436 mKeys[0] = mKeys[1] = mKeys[2] = CoordType::max();
5438 mNode[0] = mNode[1] = mNode[2] =
nullptr;
5441#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5442 template<
typename NodeT>
5443 __hostdev__ bool isCached(CoordValueType dirty)
const
5445 if (!mNode[NodeT::LEVEL])
5447 if (dirty & int32_t(~NodeT::MASK)) {
5448 mNode[NodeT::LEVEL] =
nullptr;
5454 __hostdev__ CoordValueType computeDirty(
const CoordType& ijk)
const
5456 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
5459 template<
typename NodeT>
5460 __hostdev__ bool isCached(
const CoordType& ijk)
const
5462 return (ijk[0] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][0] &&
5463 (ijk[1] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][1] &&
5464 (ijk[2] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][2];
5468 __hostdev__ ValueType getValue(
const CoordType& ijk)
const {
return this->
template get<GetValue<BuildT>>(ijk);}
5469 __hostdev__ ValueType getValue(
int i,
int j,
int k)
const {
return this->
template get<GetValue<BuildT>>(CoordType(i, j, k)); }
5470 __hostdev__ ValueType operator()(
const CoordType& ijk)
const {
return this->
template get<GetValue<BuildT>>(ijk); }
5471 __hostdev__ ValueType operator()(
int i,
int j,
int k)
const {
return this->
template get<GetValue<BuildT>>(CoordType(i, j, k)); }
5472 __hostdev__ auto getNodeInfo(
const CoordType& ijk)
const {
return this->
template get<GetNodeInfo<BuildT>>(ijk); }
5473 __hostdev__ bool isActive(
const CoordType& ijk)
const {
return this->
template get<GetState<BuildT>>(ijk); }
5474 __hostdev__ bool probeValue(
const CoordType& ijk, ValueType& v)
const {
return this->
template get<ProbeValue<BuildT>>(ijk, v); }
5475 __hostdev__ const LeafT* probeLeaf(
const CoordType& ijk)
const {
return this->
template get<GetLeaf<BuildT>>(ijk); }
5477 template<
typename OpT,
typename... ArgsT>
5478 __hostdev__ typename OpT::Type get(
const CoordType& ijk, ArgsT&&... args)
const
5480#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5481 const CoordValueType dirty = this->computeDirty(ijk);
5485 if constexpr(OpT::LEVEL <=0) {
5486 if (this->isCached<LeafT>(dirty))
return ((
const LeafT*)mNode[0])->template getAndCache<OpT>(ijk, *
this, args...);
5488#ifdef NANOVDB_USE_OLD_ACCESSOR
5491 if constexpr(OpT::LEVEL <= 1) {
5492 if (this->isCached<NodeT1>(dirty))
return ((
const NodeT1*)mNode[1])->template getAndCache<OpT>(ijk, *
this, args...);
5494#ifdef NANOVDB_USE_OLD_ACCESSOR
5497 if constexpr(OpT::LEVEL <= 2) {
5498 if (this->isCached<NodeT2>(dirty))
return ((
const NodeT2*)mNode[2])->template getAndCache<OpT>(ijk, *
this, args...);
5500 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5503 template<
typename OpT,
typename... ArgsT>
5504 __hostdev__ void set(
const CoordType& ijk, ArgsT&&... args)
const
5506#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5507 const CoordValueType dirty = this->computeDirty(ijk);
5511 if constexpr(OpT::LEVEL <= 0) {
5512 if (this->isCached<LeafT>(dirty))
return ((LeafT*)mNode[0])->template setAndCache<OpT>(ijk, *
this, args...);
5514#ifdef NANOVDB_USE_OLD_ACCESSOR
5517 if constexpr(OpT::LEVEL <= 1) {
5518 if (this->isCached<NodeT1>(dirty))
return ((NodeT1*)mNode[1])->template setAndCache<OpT>(ijk, *
this, args...);
5520#ifdef NANOVDB_USE_OLD_ACCESSOR
5523 if constexpr(OpT::LEVEL <= 2) {
5524 if (this->isCached<NodeT2>(dirty))
return ((NodeT2*)mNode[2])->template setAndCache<OpT>(ijk, *
this, args...);
5526 return ((RootT*)mRoot)->template setAndCache<OpT>(ijk, *
this, args...);
5529 template<
typename RayT>
5530 __hostdev__ uint32_t getDim(
const CoordType& ijk,
const RayT& ray)
const
5532#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5533 const CoordValueType dirty = this->computeDirty(ijk);
5537 if (this->isCached<LeafT>(dirty)) {
5538 return ((LeafT*)mNode[0])->getDimAndCache(ijk, ray, *
this);
5539 }
else if (this->isCached<NodeT1>(dirty)) {
5540 return ((NodeT1*)mNode[1])->getDimAndCache(ijk, ray, *
this);
5541 }
else if (this->isCached<NodeT2>(dirty)) {
5542 return ((NodeT2*)mNode[2])->getDimAndCache(ijk, ray, *
this);
5544 return mRoot->getDimAndCache(ijk, ray, *
this);
5551 template<
typename Policy = ActiveExact,
typename RayT>
5552 __hostdev__ DimAndActive getDimAndActive(
const CoordType& ijk,
const RayT& ray)
const
5554#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5555 const CoordValueType dirty = this->computeDirty(ijk);
5559 if (this->isCached<LeafT>(dirty)) {
5560 return ((LeafT*)mNode[0])->template getDimAndActiveAndCache<Policy>(ijk, ray, *
this);
5561 }
else if (this->isCached<NodeT1>(dirty)) {
5562 return ((NodeT1*)mNode[1])->template getDimAndActiveAndCache<Policy>(ijk, ray, *
this);
5563 }
else if (this->isCached<NodeT2>(dirty)) {
5564 return ((NodeT2*)mNode[2])->template getDimAndActiveAndCache<Policy>(ijk, ray, *
this);
5566 return mRoot->template getDimAndActiveAndCache<Policy>(ijk, ray, *
this);
5572 friend class RootNode;
5573 template<
typename, u
int32_t>
5574 friend class InternalNode;
5575 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5576 friend class LeafNode;
5579 template<
typename NodeT>
5580 __hostdev__ void insert(
const CoordType& ijk,
const NodeT* node)
const
5582#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5585 mKeys[NodeT::LEVEL] = ijk & ~NodeT::MASK;
5587 mNode[NodeT::LEVEL] = node;
5605template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5611template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5617template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5634 uint32_t mRootTableSize;
5635 [[maybe_unused]] uint32_t mPadding{0};
5638 template<
typename T>
5641 mGridData = *grid.
data();
5642 mTreeData = *grid.
tree().data();
5644 mRootTableSize = grid.
tree().root().getTableSize();
5649 *
this = *
reinterpret_cast<const GridMetaData*
>(gridData);
5652 mGridData = *gridData;
5672 template<
typename T>
5713template<
typename AttT,
typename BuildT = u
int32_t>
5722 : AccT(
grid.tree().root())
5724 , mData(
grid.template getBlindData<AttT>(0))
5740 const uint64_t count = mGrid.blindMetaData(0u).mValueCount;
5742 end = begin + count;
5750 auto* leaf = this->probeLeaf(ijk);
5751 if (leaf ==
nullptr) {
5754 begin = mData + leaf->minimum();
5755 end = begin + leaf->maximum();
5756 return leaf->maximum();
5762 begin = end =
nullptr;
5763 if (
auto* leaf = this->probeLeaf(ijk)) {
5765 if (leaf->isActive(offset)) {
5766 begin = mData + leaf->minimum();
5767 end = begin + leaf->getValue(offset);
5769 begin += leaf->getValue(offset - 1);
5776template<
typename AttT>
5785 : AccT(
grid.tree().root())
5787 , mData(
grid.template getBlindData<AttT>(0))
5807 const uint64_t count = mGrid.blindMetaData(0u).mValueCount;
5809 end = begin + count;
5817 auto* leaf = this->probeLeaf(ijk);
5818 if (leaf ==
nullptr)
5820 begin = mData + leaf->offset();
5821 end = begin + leaf->pointCount();
5822 return leaf->pointCount();
5828 if (
auto* leaf = this->probeLeaf(ijk)) {
5830 if (leaf->isActive(n)) {
5831 begin = mData + leaf->first(n);
5832 end = mData + leaf->last(n);
5836 begin = end =
nullptr;
5844template<
typename ChannelT,
typename IndexT = ValueIndex>
5874 , mChannel(channelPtr)
5905 return mChannel =
const_cast<ChannelT*
>(mGrid.template getBlindData<ChannelT>(channelID));
5921 const bool isActive = BaseT::probeValue(ijk,
idx);
5928 template<
typename T>
5936template <
typename BuildT,
typename ValueT>
5941template <
typename Gr
idT,
typename ValueT>
5944 using BuildT =
typename GridT::BuildType;
5957struct MiniGridHandle {
5962 BufferType(BufferType &&other) : data(other.data), size(other.size) {other.data=
nullptr; other.size=0;}
5963 ~BufferType() {std::free(data);}
5964 BufferType& operator=(
const BufferType &other) =
delete;
5965 BufferType& operator=(BufferType &&other){data=other.data; size=other.size; other.data=
nullptr; other.size=0;
return *
this;}
5966 static BufferType create(
size_t n, BufferType* dummy =
nullptr) {
return BufferType(n);}
5968 MiniGridHandle(BufferType &&buf) : buffer(std::move(buf)) {}
5969 const uint8_t* data()
const {
return buffer.data;}
6051#if !defined(__CUDA_ARCH__) && !defined(__HIP__)
6074template<
typename StreamT>
6080#ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS
6085 const char* gridName = gridData->
gridName();
6086 const uint32_t nameSize = uint32_t(
util::strlen(gridName) + 1);
6095 os.write((
const char*)&head,
sizeof(
FileHeader));
6097 os.write(gridName, nameSize);
6104 os.write((
const char*)&data,
sizeof(
GridData));
6107 os.write((
const char*)gridData, gridData->
mGridSize);
6119template<
typename StreamT,
typename ValueT>
6129 fprintf(stderr,
"nanovdb::writeUncompressedGrid: expected an IndexGrid but got \"%s\"\n",
toStr(str, gridData->
mGridClass));
6132 fprintf(stderr,
"nanovdb::writeUncompressedGrid: index grid already has \"%i\" blind data\n", gridData->
mBlindMetadataCount);
6137#ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS
6142 const char* gridName = gridData->
gridName();
6143 const uint32_t nameSize = uint32_t(
util::strlen(gridName) + 1);
6151 os.write((
const char*)&head,
sizeof(
FileHeader));
6153 os.write(gridName, nameSize);
6162 os.write((
const char*)&data,
sizeof(
GridData));
6168 os.write((
const char*)blindData, gridData->
mData1*
sizeof(ValueT));
6173template<
typename GridHandleT,
template<
typename...>
class VecT>
6176#ifdef NANOVDB_USE_IOSTREAMS
6177 std::ofstream os(fileName, std::ios::out | std::ios::binary | std::ios::trunc);
6181 StreamT(
const char* name) { fptr = fopen(name,
"wb"); }
6182 ~StreamT() { fclose(fptr); }
6183 void write(
const char* data,
size_t n) { fwrite(data, 1, n, fptr); }
6184 bool is_open()
const {
return fptr != NULL; }
6187 if (!os.is_open()) {
6188 fprintf(stderr,
"nanovdb::writeUncompressedGrids: Unable to open file \"%s\"for output\n", fileName);
6191 for (
auto& h : handles) {
6201template<
typename GridHandleT,
typename StreamT,
template<
typename...>
class VecT>
6202VecT<GridHandleT>
readUncompressedGrids(StreamT& is,
const typename GridHandleT::BufferType& pool =
typename GridHandleT::BufferType())
6204 VecT<GridHandleT> handles;
6206 is.read((
char*)&data,
sizeof(
GridData));
6208 uint64_t size = data.
mGridSize, sum = 0u;
6211 is.read((
char*)&data,
sizeof(
GridData));
6212 sum += data.mGridSize;
6214 is.skip(-int64_t(sum +
sizeof(
GridData)));
6215 auto buffer = GridHandleT::BufferType::create(size + sum, &pool);
6216 is.read((
char*)(buffer.data()), buffer.size());
6217 handles.emplace_back(std::move(buffer));
6221 while(is.read((
char*)&head,
sizeof(
FileHeader))) {
6223 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid magic number = \"%s\"\n", (
const char*)&(head.
magic));
6227 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid major version = \"%s\"\n",
toStr(str, head.
version));
6231 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid codec = \"%s\"\n",
toStr(str, head.
codec));
6235 for (uint16_t i = 0; i < head.
gridCount; ++i) {
6237 is.skip(meta.nameSize);
6238 auto buffer = GridHandleT::BufferType::create(meta.gridSize, &pool);
6239 is.read((
char*)buffer.data(), meta.gridSize);
6240 handles.emplace_back(std::move(buffer));
6248template<
typename GridHandleT,
template<
typename...>
class VecT>
6249VecT<GridHandleT>
readUncompressedGrids(
const char* fileName,
const typename GridHandleT::BufferType& buffer =
typename GridHandleT::BufferType())
6251#ifdef NANOVDB_USE_IOSTREAMS
6252 struct StreamT :
public std::ifstream {
6253 StreamT(
const char* name) : std::ifstream(name, std::ios::in | std::ios::binary){}
6254 void skip(int64_t off) { this->seekg(off, std::ios_base::cur); }
6259 StreamT(
const char* name) { fptr = fopen(name,
"rb"); }
6260 ~StreamT() { fclose(fptr); }
6261 bool read(
char* data,
size_t n) {
6262 size_t m = fread(data, 1, n, fptr);
6265 void skip(int64_t off) { fseek(fptr, (
long int)off, SEEK_CUR); }
6266 bool is_open()
const {
return fptr != NULL; }
6269 StreamT is(fileName);
6270 if (!is.is_open()) {
6271 fprintf(stderr,
"nanovdb::readUncompressedGrids: Unable to open file \"%s\"for input\n", fileName);
6317template<
typename BuildT>
6329template<
typename BuildT>
6342template<
typename BuildT>
6357template<
typename BuildT>
6371template<
typename BuildT>
6385template<
typename BuildT>
6399template<
typename BuildT>
6412template<
typename BuildT>
6424template<
typename BuildT>
6435template<
typename BuildT>
6449 return tile.state > 0u;
6470template<
typename BuildT>
#define NANOVDB_MAGIC_FILE
Definition NanoVDB.h:141
#define NANOVDB_MAGIC_GRID
Definition NanoVDB.h:140
#define NANOVDB_MINOR_VERSION_NUMBER
Definition NanoVDB.h:147
#define NANOVDB_DATA_ALIGNMENT
Definition NanoVDB.h:133
#define NANOVDB_MAJOR_VERSION_NUMBER
Definition NanoVDB.h:146
#define NANOVDB_MAGIC_NUMB
Definition NanoVDB.h:139
#define NANOVDB_PATCH_VERSION_NUMBER
Definition NanoVDB.h:148
#define __hostdev__
Definition SampleFromVoxels.h:29
bool isBitOff(uint8_t bit) const
Definition NanoVDB.h:1017
BitFlags(std::initializer_list< uint8_t > list)
Definition NanoVDB.h:955
Type data() const
Definition NanoVDB.h:964
void setBitOn(std::initializer_list< uint8_t > list)
Definition NanoVDB.h:985
void initMask(std::initializer_list< MaskT > list)
Definition NanoVDB.h:972
void setBit(uint8_t bit, bool on)
Definition NanoVDB.h:1010
BitFlags(Type mask)
Definition NanoVDB.h:954
void setMaskOff(std::initializer_list< MaskT > list)
Definition NanoVDB.h:1005
void initBit(std::initializer_list< uint8_t > list)
Definition NanoVDB.h:966
void setOn()
Definition NanoVDB.h:979
BitFlags()
Definition NanoVDB.h:953
void setMaskOff(MaskT mask)
Definition NanoVDB.h:997
Type & data()
Definition NanoVDB.h:965
void setBitOn(uint8_t bit)
Definition NanoVDB.h:982
bool isMaskOff(std::initializer_list< MaskT > list) const
return true if any of the masks in the list are off
Definition NanoVDB.h:1033
bool isMaskOn(MaskT mask) const
Definition NanoVDB.h:1019
void setMaskOn(std::initializer_list< MaskT > list)
Definition NanoVDB.h:1000
bool isMaskOn(std::initializer_list< MaskT > list) const
return true if any of the masks in the list are on
Definition NanoVDB.h:1024
BitFlags(std::initializer_list< MaskT > list)
Definition NanoVDB.h:960
void setBitOff(std::initializer_list< uint8_t > list)
Definition NanoVDB.h:989
void setOff()
Definition NanoVDB.h:980
void setMaskOn(MaskT mask)
Definition NanoVDB.h:995
void setBitOff(uint8_t bit)
Definition NanoVDB.h:983
BitFlags & operator=(Type n)
required for backwards compatibility
Definition NanoVDB.h:1041
bool isOff() const
Definition NanoVDB.h:1015
bool isBitOn(uint8_t bit) const
Definition NanoVDB.h:1016
void setMask(MaskT mask, bool on)
Definition NanoVDB.h:1012
Type getFlags() const
Definition NanoVDB.h:977
decltype(mFlags) Type
Definition NanoVDB.h:952
bool isMaskOff(MaskT mask) const
Definition NanoVDB.h:1021
bool isOn() const
Definition NanoVDB.h:1014
Class to access values in channels at a specific voxel location.
Definition NanoVDB.h:5846
const TreeType & tree() const
Definition NanoVDB.h:5887
ChannelT * setChannel(uint32_t channelID)
Change to an internal channel, assuming it exists as as blind data in the IndexGrid.
Definition NanoVDB.h:5903
const Vec3d & voxelSize() const
Return a vector of the axial voxel sizes.
Definition NanoVDB.h:5890
NanoTree< IndexT > TreeType
Definition NanoVDB.h:5855
const NanoGrid< IndexT > & grid() const
Definition NanoVDB.h:5884
const uint64_t & valueCount() const
Return total number of values indexed by the IndexGrid.
Definition NanoVDB.h:5893
ChannelT & getValue(const math::Coord &ijk) const
Return the value from a cached channel that maps to the specified coordinate.
Definition NanoVDB.h:5913
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:5929
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:5918
ChannelT & operator()(int i, int j, int k) const
Definition NanoVDB.h:5915
uint64_t idx(int i, int j, int k) const
Definition NanoVDB.h:5910
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:5860
ChannelT & operator()(const math::Coord &ijk) const
Definition NanoVDB.h:5914
ChannelAccessor(const NanoGrid< IndexT > &grid, ChannelT *channelPtr)
Ctor from an IndexGrid and an external channel.
Definition NanoVDB.h:5871
ChannelT * setChannel(ChannelT *channelPtr)
Definition NanoVDB.h:5897
ChannelT ValueType
Definition NanoVDB.h:5854
ChannelAccessor< ChannelT, IndexT > AccessorType
Definition NanoVDB.h:5856
uint64_t getIndex(const math::Coord &ijk) const
Return the linear offset into a channel that maps to the specified coordinate.
Definition NanoVDB.h:5909
Class that encapsulates two CRC32 checksums, one for the Grid, Tree and Root node meta data and one f...
Definition NanoVDB.h:1858
Checksum(uint64_t checksum, CheckMode mode=CheckMode::Full)
Definition NanoVDB.h:1881
uint64_t & full()
Definition NanoVDB.h:1887
Checksum(uint32_t head, uint32_t tail)
Constructor that allows the two 32bit checksums to be initiated explicitly.
Definition NanoVDB.h:1876
uint32_t tail() const
Definition NanoVDB.h:1890
bool operator==(const Checksum &rhs) const
return true if the checksums are identical
Definition NanoVDB.h:1913
uint64_t full() const
Definition NanoVDB.h:1886
bool isHalf() const
return true if the 64 bit checksum is half, i.e. of head only
Definition NanoVDB.h:1894
uint64_t mCRC64
Definition NanoVDB.h:1863
uint32_t mCRC32[2]
Definition NanoVDB.h:1863
static constexpr uint32_t EMPTY32
Definition NanoVDB.h:1867
Checksum()
default constructor initiates checksum to EMPTY
Definition NanoVDB.h:1871
void disable()
Definition NanoVDB.h:1902
uint32_t & tail()
Definition NanoVDB.h:1891
CheckMode mode() const
return the mode of the 64 bit checksum
Definition NanoVDB.h:1905
static constexpr uint64_t EMPTY64
Definition NanoVDB.h:1868
bool operator!=(const Checksum &rhs) const
return true if the checksums are not identical
Definition NanoVDB.h:1917
bool isEmpty() const
return true if the 64 bit checksum is disables (unset)
Definition NanoVDB.h:1900
uint32_t & head()
Definition NanoVDB.h:1889
bool isFull() const
return true if the 64 bit checksum is fill, i.e. of both had and nodes
Definition NanoVDB.h:1897
uint32_t head() const
Definition NanoVDB.h:1888
Dummy type for a 16bit quantization of float point values.
Definition NanoVDB.h:199
Dummy type for a 4bit quantization of float point values.
Definition NanoVDB.h:193
Dummy type for a 8bit quantization of float point values.
Definition NanoVDB.h:196
Dummy type for a variable bit quantization of floating point values.
Definition NanoVDB.h:202
Highest level of the data structure. Contains a tree and a world->index transform (that currently onl...
Definition NanoVDB.h:2157
Vec3T indexToWorld(const Vec3T &xyz) const
Definition NanoVDB.h:2231
int findBlindData(const char *name) const
const Vec3d & voxelSize() const
Definition NanoVDB.h:2220
BlindDataT * getBlindData(uint32_t n)
Definition NanoVDB.h:2345
Vec3T indexToWorldF(const Vec3T &xyz) const
Definition NanoVDB.h:2254
const GridType & gridType() const
Definition NanoVDB.h:2285
typename RootType::LeafNodeType LeafNodeType
Definition NanoVDB.h:2164
uint32_t blindDataCount() const
Definition NanoVDB.h:2329
typename TreeT::ValueType ValueType
Definition NanoVDB.h:2166
int findBlindDataForSemantic(GridBlindDataSemantic semantic) const
typename TreeT::RootType RootType
Definition NanoVDB.h:2160
bool isSequential() const
Definition NanoVDB.h:2306
bool isPointData() const
Definition NanoVDB.h:2292
uint32_t gridIndex() const
Definition NanoVDB.h:2191
const char * shortGridName() const
Definition NanoVDB.h:2320
bool isBreadthFirst() const
Definition NanoVDB.h:2301
uint64_t activeVoxelCount() const
Definition NanoVDB.h:2281
bool isSequential() const
Definition NanoVDB.h:2314
Vec3T indexToWorldDirF(const Vec3T &dir) const
Definition NanoVDB.h:2259
typename TreeT::CoordType CoordType
Definition NanoVDB.h:2168
typename RootNodeType::ChildNodeType UpperNodeType
Definition NanoVDB.h:2162
Vec3T worldToIndexF(const Vec3T &xyz) const
Definition NanoVDB.h:2250
Vec3T worldToIndexDirF(const Vec3T &dir) const
Definition NanoVDB.h:2264
bool isStaggered() const
Definition NanoVDB.h:2289
const GridClass & gridClass() const
Definition NanoVDB.h:2286
bool isValid() const
Definition NanoVDB.h:2284
DataType * data()
Definition NanoVDB.h:2180
bool hasAverage() const
Definition NanoVDB.h:2299
bool hasMinMax() const
Definition NanoVDB.h:2296
const BlindDataT * getBlindData(uint32_t n) const
Definition NanoVDB.h:2338
const char * gridName() const
Definition NanoVDB.h:2317
AccessorType getAccessor() const
Definition NanoVDB.h:2217
bool isVoxelBVH() const
Definition NanoVDB.h:2293
uint64_t gridSize() const
Definition NanoVDB.h:2188
const GridBlindMetaData & blindMetaData(uint32_t n) const
Definition NanoVDB.h:2351
Vec3T indexToWorldDir(const Vec3T &dir) const
Definition NanoVDB.h:2236
GridData DataType
Definition NanoVDB.h:2165
RootType RootNodeType
Definition NanoVDB.h:2161
util::enable_if< util::is_same< T, Point >::value, constuint64_t & >::type pointCount() const
Definition NanoVDB.h:2208
Vec3T indexToWorldGradF(const Vec3T &grad) const
Definition NanoVDB.h:2269
bool isFogVolume() const
Definition NanoVDB.h:2288
const NanoTree< BuildT > & tree() const
Definition NanoVDB.h:2211
DefaultReadAccessor< BuildType > AccessorType
Definition NanoVDB.h:2169
bool isMask() const
Definition NanoVDB.h:2294
bool hasLongGridName() const
Definition NanoVDB.h:2298
const Checksum & checksum() const
Definition NanoVDB.h:2323
NanoTree< BuildT > & tree()
Definition NanoVDB.h:2214
Vec3T worldToIndex(const Vec3T &xyz) const
Definition NanoVDB.h:2227
uint32_t gridCount() const
Definition NanoVDB.h:2194
Vec3T worldToIndexDir(const Vec3T &dir) const
Definition NanoVDB.h:2241
Version version() const
Definition NanoVDB.h:2178
typename UpperNodeType::ChildNodeType LowerNodeType
Definition NanoVDB.h:2163
const Map & map() const
Definition NanoVDB.h:2223
util::enable_if< BuildTraits< T >::is_index, constuint64_t & >::type valueCount() const
Definition NanoVDB.h:2201
bool hasStdDeviation() const
Definition NanoVDB.h:2300
bool hasBBox() const
Definition NanoVDB.h:2297
bool isLevelSet() const
Definition NanoVDB.h:2287
bool isGridIndex() const
Definition NanoVDB.h:2291
TreeT TreeType
Definition NanoVDB.h:2159
Grid(const Grid &)=delete
Disallow constructions, copy and assignment.
typename TreeT::BuildType BuildType
Definition NanoVDB.h:2167
Grid & operator=(const Grid &)=delete
Vec3T indexToWorldGrad(const Vec3T &grad) const
Definition NanoVDB.h:2246
const DataType * data() const
Definition NanoVDB.h:2182
bool isPointIndex() const
Definition NanoVDB.h:2290
bool isUnknown() const
Definition NanoVDB.h:2295
Type containing raw 16 bits for half precision floating point values (IEEE 754 Half)
Definition NanoVDB.h:187
uint16_t raw
Definition NanoVDB.h:189
Visits child nodes of this node only.
Definition NanoVDB.h:3335
NodeT & operator*() const
Definition NanoVDB.h:3352
CoordType getOrigin() const
Definition NanoVDB.h:3362
ChildIter()
Definition NanoVDB.h:3342
NodeT * operator->() const
Definition NanoVDB.h:3357
ChildIter(ParentT *parent)
Definition NanoVDB.h:3347
CoordType getCoord() const
Definition NanoVDB.h:3367
DenseIterator()
Definition NanoVDB.h:3454
bool isValueOn() const
Definition NanoVDB.h:3475
const ChildT * probeChild(ValueType &value) const
Definition NanoVDB.h:3464
CoordType getOrigin() const
Definition NanoVDB.h:3480
DenseIterator(const InternalNode *parent)
Definition NanoVDB.h:3459
CoordType getCoord() const
Definition NanoVDB.h:3485
ValueIterator(const InternalNode *parent)
Definition NanoVDB.h:3388
bool isActive() const
Definition NanoVDB.h:3404
ValueIterator()
Definition NanoVDB.h:3383
CoordType getOrigin() const
Definition NanoVDB.h:3398
ValueType operator*() const
Definition NanoVDB.h:3393
CoordType getCoord() const
Definition NanoVDB.h:3403
ValueOnIterator(const InternalNode *parent)
Definition NanoVDB.h:3426
CoordType getOrigin() const
Definition NanoVDB.h:3436
ValueType operator*() const
Definition NanoVDB.h:3431
ValueOnIterator()
Definition NanoVDB.h:3421
CoordType getCoord() const
Definition NanoVDB.h:3441
Internal nodes of a VDB tree.
Definition NanoVDB.h:3309
Coord offsetToGlobalCoord(uint32_t n) const
Definition NanoVDB.h:3591
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3318
ValueType getLastValue() const
Definition NanoVDB.h:3545
ChildNodeType * probeChild(const CoordType &ijk)
Definition NanoVDB.h:3557
ChildIter< const InternalNode > ConstChildIterator
Definition NanoVDB.h:3371
const MaskType< LOG2DIM > & valueMask() const
Definition NanoVDB.h:3508
InternalData< ChildT, Log2Dim > DataType
Definition NanoVDB.h:3311
ValueIterator beginValue() const
Definition NanoVDB.h:3411
bool isActive() const
Definition NanoVDB.h:3599
static uint32_t dim()
Definition NanoVDB.h:3502
friend class ReadAccessor
Definition NanoVDB.h:3621
static constexpr uint32_t MASK
Definition NanoVDB.h:3328
static size_t memUsage()
Definition NanoVDB.h:3505
DenseIterator beginDense() const
Definition NanoVDB.h:3488
CoordType origin() const
Definition NanoVDB.h:3516
typename ChildT::CoordType CoordType
Definition NanoVDB.h:3317
static constexpr uint32_t LEVEL
Definition NanoVDB.h:3329
FloatType variance() const
Definition NanoVDB.h:3528
const MaskType< LOG2DIM > & childMask() const
Definition NanoVDB.h:3512
const FloatType & average() const
Definition NanoVDB.h:3525
DataType * data()
Definition NanoVDB.h:3497
friend class InternalNode
Definition NanoVDB.h:3626
static constexpr uint32_t DIM
Definition NanoVDB.h:3326
void localToGlobalCoord(Coord &ijk) const
Definition NanoVDB.h:3585
typename DataType::BuildT BuildType
Definition NanoVDB.h:3314
const MaskType< LOG2DIM > & getValueMask() const
Definition NanoVDB.h:3509
typename Mask< Log2Dim >::template Iterator< On > MaskIterT
Definition NanoVDB.h:3322
ChildT ChildNodeType
Definition NanoVDB.h:3316
const LeafNodeType * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:3555
bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:3552
typename DataType::ValueT ValueType
Definition NanoVDB.h:3312
static uint32_t CoordToOffset(const CoordType &ijk)
Definition NanoVDB.h:3569
const math::BBox< CoordType > & bbox() const
Definition NanoVDB.h:3534
typename DataType::StatsT FloatType
Definition NanoVDB.h:3313
ChildIterator beginChild()
Definition NanoVDB.h:3373
void set(const CoordType &ijk, ArgsT &&... args)
Definition NanoVDB.h:3610
DenseIterator cbeginChildAll() const
Definition NanoVDB.h:3489
static Coord OffsetToLocalCoord(uint32_t n)
Definition NanoVDB.h:3577
bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:3554
typename ChildT::LeafNodeType LeafNodeType
Definition NanoVDB.h:3315
OpT::Type get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:3602
static constexpr uint32_t TOTAL
Definition NanoVDB.h:3325
ValueType getFirstValue() const
Definition NanoVDB.h:3538
const ChildNodeType * probeChild(const CoordType &ijk) const
Definition NanoVDB.h:3562
ChildIter< InternalNode > ChildIterator
Definition NanoVDB.h:3370
const FloatType & stdDeviation() const
Definition NanoVDB.h:3531
static constexpr uint32_t LOG2DIM
Definition NanoVDB.h:3324
const ValueType & maximum() const
Definition NanoVDB.h:3522
ValueIterator cbeginValueAll() const
Definition NanoVDB.h:3412
ValueOnIterator cbeginValueOn() const
Definition NanoVDB.h:3445
ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:3551
const MaskType< LOG2DIM > & getChildMask() const
Definition NanoVDB.h:3513
static constexpr uint32_t SIZE
Definition NanoVDB.h:3327
typename ChildT::template MaskType< LOG2 > MaskType
Definition NanoVDB.h:3320
static constexpr uint64_t NUM_VALUES
Definition NanoVDB.h:3330
const ValueType & minimum() const
Definition NanoVDB.h:3519
const DataType * data() const
Definition NanoVDB.h:3499
InternalNode & operator=(const InternalNode &)=delete
ConstChildIterator cbeginChild() const
Definition NanoVDB.h:3374
InternalNode(const InternalNode &)=delete
ValueOnIterator beginValueOn() const
Definition NanoVDB.h:3444
friend class RootNode
Definition NanoVDB.h:3624
ValueIterator & operator++()
Definition NanoVDB.h:4406
ValueIterator operator++(int)
Definition NanoVDB.h:4411
ValueIterator(const LeafNode *parent)
Definition NanoVDB.h:4384
bool isActive() const
Definition NanoVDB.h:4400
CoordT getCoord() const
Definition NanoVDB.h:4395
ValueIterator()
Definition NanoVDB.h:4379
ValueType operator*() const
Definition NanoVDB.h:4390
ValueOffIterator()
Definition NanoVDB.h:4347
CoordT getCoord() const
Definition NanoVDB.h:4362
ValueType operator*() const
Definition NanoVDB.h:4357
ValueOffIterator(const LeafNode *parent)
Definition NanoVDB.h:4352
CoordT getCoord() const
Definition NanoVDB.h:4330
ValueOnIterator(const LeafNode *parent)
Definition NanoVDB.h:4320
ValueType operator*() const
Definition NanoVDB.h:4325
ValueOnIterator()
Definition NanoVDB.h:4315
Leaf nodes of the VDB tree. (defaults to 8x8x8 = 512 voxels)
Definition NanoVDB.h:4288
void setValue(const CoordT &ijk, const ValueType &v)
Sets the value at the specified location and activate its state.
Definition NanoVDB.h:4522
auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:4570
void setValueOnly(uint32_t offset, const ValueType &v)
Sets the value at the specified location but leaves its state unchanged.
Definition NanoVDB.h:4527
bool isActive(const CoordT &ijk) const
Return true if the voxel value at the given coordinate is active.
Definition NanoVDB.h:4531
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4302
ValueType getLastValue() const
Return the last value in this leaf node.
Definition NanoVDB.h:4517
typename DataType::BuildType BuildType
Definition NanoVDB.h:4300
const MaskType< LOG2DIM > & valueMask() const
Return a const reference to the bit mask of active voxels in this leaf node.
Definition NanoVDB.h:4436
ValueIterator beginValue() const
Definition NanoVDB.h:4419
bool isActive() const
Return true if any of the voxel value are active in this leaf node.
Definition NanoVDB.h:4535
LeafData< BuildT, CoordT, MaskT, Log2Dim > DataType
Definition NanoVDB.h:4297
CoordT CoordType
Definition NanoVDB.h:4301
static uint32_t dim()
Return the dimension, in index space, of this leaf node (typically 8 as for openvdb leaf nodes!...
Definition NanoVDB.h:4478
friend class ReadAccessor
Definition NanoVDB.h:4597
static constexpr uint32_t MASK
Definition NanoVDB.h:4427
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:4545
LeafNode< BuildT, CoordT, MaskT, Log2Dim > LeafNodeType
Definition NanoVDB.h:4296
static constexpr uint32_t LEVEL
Definition NanoVDB.h:4428
FloatType variance() const
Return the variance of all the active values encoded in this leaf node.
Definition NanoVDB.h:4449
ValueOffIterator cbeginValueOff() const
Definition NanoVDB.h:4370
LeafNode & operator=(const LeafNode &)=delete
auto set(const CoordType &ijk, ArgsT &&... args)
Definition NanoVDB.h:4582
bool isActive(uint32_t n) const
Definition NanoVDB.h:4532
DataType * data()
Definition NanoVDB.h:4431
uint8_t flags() const
Definition NanoVDB.h:4454
friend class InternalNode
Definition NanoVDB.h:4602
static constexpr uint32_t DIM
Definition NanoVDB.h:4425
void localToGlobalCoord(Coord &ijk) const
Converts (in place) a local index coordinate to a global index coordinate.
Definition NanoVDB.h:4470
ValueType maximum() const
Return a const reference to the maximum active value encoded in this leaf node.
Definition NanoVDB.h:4443
const MaskType< LOG2DIM > & getValueMask() const
Definition NanoVDB.h:4437
typename DataType::FloatType FloatType
Definition NanoVDB.h:4299
CoordT origin() const
Return the origin in index space of this leaf node.
Definition NanoVDB.h:4457
typename Mask< Log2Dim >::template Iterator< ON > MaskIterT
Definition NanoVDB.h:4306
auto get(const uint32_t n, ArgsT &&... args) const
Definition NanoVDB.h:4576
static uint32_t CoordToOffset(const CoordT &ijk)
Definition NanoVDB.h:4555
CoordT offsetToGlobalCoord(uint32_t n) const
Definition NanoVDB.h:4472
bool updateBBox()
Updates the local bounding box of active voxels in this node. Return true if bbox was updated.
Definition NanoVDB.h:4650
void setValueOnly(const CoordT &ijk, const ValueType &v)
Definition NanoVDB.h:4528
ValueType getValue(uint32_t offset) const
Return the voxel value at the given offset.
Definition NanoVDB.h:4509
uint64_t memUsage() const
return memory usage in bytes for the leaf node
Definition NanoVDB.h:4500
FloatType average() const
Return a const reference to the average of all the active values encoded in this leaf node.
Definition NanoVDB.h:4446
static constexpr uint32_t TOTAL
Definition NanoVDB.h:4424
const LeafNode * probeLeaf(const CoordT &) const
Definition NanoVDB.h:4552
ValueType getFirstValue() const
Return the first value in this leaf node.
Definition NanoVDB.h:4515
ValueType getValue(const CoordT &ijk) const
Return the voxel value at the given coordinate.
Definition NanoVDB.h:4512
MaskT< LOG2 > MaskType
Definition NanoVDB.h:4304
static constexpr uint32_t LOG2DIM
Definition NanoVDB.h:4423
static uint32_t voxelCount()
Return the total number of voxels (e.g. values) encoded in this leaf node.
Definition NanoVDB.h:4495
auto set(const uint32_t n, ArgsT &&... args)
Definition NanoVDB.h:4588
LeafNode(const LeafNode &)=delete
ValueOffIterator beginValueOff() const
Definition NanoVDB.h:4369
math::BBox< CoordT > bbox() const
Return the bounding box in index space of active values in this leaf node.
Definition NanoVDB.h:4481
LeafNode()=delete
This class cannot be constructed or deleted.
ValueIterator cbeginValueAll() const
Definition NanoVDB.h:4420
ValueOnIterator cbeginValueOn() const
Definition NanoVDB.h:4338
ValueType minimum() const
Return a const reference to the minimum active value encoded in this leaf node.
Definition NanoVDB.h:4440
static constexpr uint32_t SIZE
Definition NanoVDB.h:4426
typename DataType::ValueType ValueType
Definition NanoVDB.h:4298
static uint32_t padding()
Definition NanoVDB.h:4497
static CoordT OffsetToLocalCoord(uint32_t n)
Compute the local coordinates from a linear offset.
Definition NanoVDB.h:4462
static constexpr uint64_t NUM_VALUES
Definition NanoVDB.h:4429
bool hasBBox() const
Definition NanoVDB.h:4542
const DataType * data() const
Definition NanoVDB.h:4433
ValueOnIterator beginValueOn() const
Definition NanoVDB.h:4337
FloatType stdDeviation() const
Return a const reference to the standard deviation of all the active values encoded in this leaf node...
Definition NanoVDB.h:4452
friend class RootNode
Definition NanoVDB.h:4600
Definition NanoVDB.h:1121
DenseIterator & operator++()
Definition NanoVDB.h:1130
DenseIterator(uint32_t pos=Mask::SIZE)
Definition NanoVDB.h:1123
uint32_t operator*() const
Definition NanoVDB.h:1127
DenseIterator operator++(int)
Definition NanoVDB.h:1135
uint32_t pos() const
Definition NanoVDB.h:1128
Definition NanoVDB.h:1088
Iterator()
Definition NanoVDB.h:1090
uint32_t operator*() const
Definition NanoVDB.h:1100
Iterator operator++(int)
Definition NanoVDB.h:1108
uint32_t pos() const
Definition NanoVDB.h:1101
Iterator(uint32_t pos, const Mask *parent)
Definition NanoVDB.h:1095
Iterator & operator++()
Definition NanoVDB.h:1103
Bit-mask to encode active states and facilitate sequential iterators and a fast codec for I/O compres...
Definition NanoVDB.h:1054
void setAtomic(uint32_t n, bool on)
Definition NanoVDB.h:1254
uint32_t findPrev(uint32_t start) const
Definition NanoVDB.h:1379
DenseIterator beginAll() const
Definition NanoVDB.h:1153
OnIterator beginOn() const
Definition NanoVDB.h:1149
bool isOff(uint32_t n) const
Return true if the given bit is NOT set.
Definition NanoVDB.h:1221
bool operator==(const Mask &other) const
Definition NanoVDB.h:1206
uint32_t findFirst() const
Definition NanoVDB.h:1355
static size_t memUsage()
Return the memory footprint in bytes of this Mask.
Definition NanoVDB.h:1060
OffIterator beginOff() const
Definition NanoVDB.h:1151
void setOn()
Set all bits on.
Definition NanoVDB.h:1295
void setOffAtomic(uint32_t n)
Definition NanoVDB.h:1250
void toggle(uint32_t n)
Definition NanoVDB.h:1318
void set(uint32_t n, bool on)
Set the specified bit on or off.
Definition NanoVDB.h:1282
Iterator< false > OffIterator
Definition NanoVDB.h:1147
uint32_t countOn() const
Return the total number of set bits in this Mask.
Definition NanoVDB.h:1069
Mask & operator=(const Mask &)=default
Mask & operator^=(const Mask &other)
Bitwise XOR.
Definition NanoVDB.h:1345
void setOff(uint32_t n)
Set the specified bit off.
Definition NanoVDB.h:1244
Iterator< true > OnIterator
Definition NanoVDB.h:1146
Mask(bool on)
Definition NanoVDB.h:1161
bool isOn(uint32_t n) const
Return true if the given bit is set.
Definition NanoVDB.h:1218
void set(bool on)
Set all bits off.
Definition NanoVDB.h:1307
Mask & operator|=(const Mask &other)
Bitwise union.
Definition NanoVDB.h:1329
void setWord(WordT w, uint32_t n)
Definition NanoVDB.h:1183
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:1192
void setOnAtomic(uint32_t n)
Definition NanoVDB.h:1246
uint32_t findNext(uint32_t start) const
Definition NanoVDB.h:1365
const uint64_t * words() const
Definition NanoVDB.h:1173
uint64_t * words()
Return a pointer to the list of words of the bit mask.
Definition NanoVDB.h:1172
void setOff()
Set all bits off.
Definition NanoVDB.h:1301
static constexpr uint32_t WORD_COUNT
Definition NanoVDB.h:1057
Mask & operator&=(const Mask &other)
Bitwise intersection.
Definition NanoVDB.h:1321
static uint32_t bitCount()
Return the number of bits available in this Mask.
Definition NanoVDB.h:1063
bool isOff() const
Return true if none of the bits are set in this Mask.
Definition NanoVDB.h:1233
Mask(const Mask &)=default
Copy constructor.
bool operator!=(const Mask &other) const
Definition NanoVDB.h:1215
void toggle()
brief Toggle the state of all bits in the mask
Definition NanoVDB.h:1313
static constexpr uint32_t SIZE
Definition NanoVDB.h:1056
Mask & operator-=(const Mask &other)
Bitwise difference.
Definition NanoVDB.h:1337
WordT getWord(uint32_t n) const
Definition NanoVDB.h:1176
static uint32_t wordCount()
Return the number of machine words used by this Mask.
Definition NanoVDB.h:1066
bool isOn() const
Return true if all the bits are set in this Mask.
Definition NanoVDB.h:1224
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:1078
Mask()
Initialize all bits to zero.
Definition NanoVDB.h:1156
void setOn(uint32_t n)
Set the specified bit on.
Definition NanoVDB.h:1242
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:5805
PointAccessor(const NanoGrid< Point > &grid)
Definition NanoVDB.h:5784
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:5815
const NanoGrid< Point > & grid() const
Definition NanoVDB.h:5801
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:5826
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:5738
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:5748
const NanoGrid< BuildT > & grid() const
Definition NanoVDB.h:5734
PointAccessor(const NanoGrid< BuildT > &grid)
Definition NanoVDB.h:5721
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:5760
Dummy type for indexing points into voxels.
Definition NanoVDB.h:205
ReadAccessor & operator=(const ReadAccessor &)=default
auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:4949
ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:4927
ValueType operator()(int i, int j, int k) const
Definition NanoVDB.h:4929
ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition NanoVDB.h:4902
friend class InternalNode
Definition NanoVDB.h:4965
ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition NanoVDB.h:4908
ValueType operator()(const CoordType &ijk) const
Definition NanoVDB.h:4928
bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:4931
auto getNodeInfo(const CoordType &ijk) const
Definition NanoVDB.h:4930
bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:4932
typename RootT::CoordType CoordType
Definition NanoVDB.h:4891
friend class LeafNode
Definition NanoVDB.h:4967
ReadAccessor(const ReadAccessor &)=default
Defaults constructors.
const RootT & root() const
Definition NanoVDB.h:4917
void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition NanoVDB.h:4915
DimAndActive getDimAndActive(const CoordType &ijk, const RayT &ray) const
Fused getDim + isActive: one tree walk returns both the HDDA step size and the active state of ijk,...
Definition NanoVDB.h:4944
ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:4923
typename RootT::ValueType ValueType
Definition NanoVDB.h:4890
const LeafT * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:4933
static const int CacheLevels
Definition NanoVDB.h:4893
uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition NanoVDB.h:4935
ReadAccessor(const RootT &root)
Constructor from a root node.
Definition NanoVDB.h:4896
BuildT BuildType
Definition NanoVDB.h:4889
auto set(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:4955
friend class RootNode
Allow nodes to insert themselves into the cache.
Definition NanoVDB.h:4963
ReadAccessor & operator=(const ReadAccessor &)=default
ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:5048
CoordT CoordType
Definition NanoVDB.h:4999
ValueType operator()(int i, int j, int k) const
Definition NanoVDB.h:5050
ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition NanoVDB.h:5012
bool isCached(const CoordType &ijk) const
Definition NanoVDB.h:5037
friend class InternalNode
Definition NanoVDB.h:5093
ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition NanoVDB.h:5018
ValueType operator()(const CoordType &ijk) const
Definition NanoVDB.h:5049
void set(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:5082
ValueT ValueType
Definition NanoVDB.h:4998
bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:5052
auto getNodeInfo(const CoordType &ijk) const
Definition NanoVDB.h:5051
bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:5053
OpT::Type get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:5075
friend class LeafNode
Definition NanoVDB.h:5095
ReadAccessor(const ReadAccessor &)=default
Defaults constructors.
const RootT & root() const
Definition NanoVDB.h:5030
void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition NanoVDB.h:5024
DimAndActive getDimAndActive(const CoordType &ijk, const RayT &ray) const
Fused getDim + isActive: one tree walk returns both the HDDA step size and the active state of ijk,...
Definition NanoVDB.h:5068
ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:5044
const LeafT * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:5054
static const int CacheLevels
Definition NanoVDB.h:5001
uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition NanoVDB.h:5057
ReadAccessor(const RootT &root)
Constructor from a root node.
Definition NanoVDB.h:5004
BuildT BuildType
Definition NanoVDB.h:4997
friend class RootNode
Allow nodes to insert themselves into the cache.
Definition NanoVDB.h:5091
ReadAccessor & operator=(const ReadAccessor &)=default
ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:5232
CoordT CoordType
Definition NanoVDB.h:5140
ValueType operator()(int i, int j, int k) const
Definition NanoVDB.h:5234
ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition NanoVDB.h:5158
friend class InternalNode
Definition NanoVDB.h:5321
ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition NanoVDB.h:5164
ValueType operator()(const CoordType &ijk) const
Definition NanoVDB.h:5233
void set(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:5297
ValueT ValueType
Definition NanoVDB.h:5139
bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:5236
auto getNodeInfo(const CoordType &ijk) const
Definition NanoVDB.h:5235
bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:5237
OpT::Type get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:5277
bool isCached1(const CoordType &ijk) const
Definition NanoVDB.h:5214
friend class LeafNode
Definition NanoVDB.h:5323
ReadAccessor(const ReadAccessor &)=default
Defaults constructors.
const RootT & root() const
Definition NanoVDB.h:5181
void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition NanoVDB.h:5170
DimAndActive getDimAndActive(const CoordType &ijk, const RayT &ray) const
Fused getDim + isActive: one tree walk returns both the HDDA step size and the active state of ijk,...
Definition NanoVDB.h:5261
ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:5228
bool isCached2(const CoordType &ijk) const
Definition NanoVDB.h:5220
const LeafT * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:5238
static const int CacheLevels
Definition NanoVDB.h:5142
uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition NanoVDB.h:5241
ReadAccessor(const RootT &root)
Constructor from a root node.
Definition NanoVDB.h:5145
BuildT BuildType
Definition NanoVDB.h:5138
friend class RootNode
Allow nodes to insert themselves into the cache.
Definition NanoVDB.h:5319
Definition NanoVDB.h:2146
Definition NanoVDB.h:2709
TileT * mPos
Definition NanoVDB.h:2713
bool isValueOn() const
Definition NanoVDB.h:2758
TileT * mBegin
Definition NanoVDB.h:2713
auto pos() const
Definition NanoVDB.h:2727
NodeT * child() const
Definition NanoVDB.h:2763
typename util::match_const< ChildT, DataT >::type NodeT
Definition NanoVDB.h:2712
TileT * operator->() const
Definition NanoVDB.h:2738
typename util::match_const< Tile, DataT >::type TileT
Definition NanoVDB.h:2711
TileIter & operator++()
Definition NanoVDB.h:2728
TileIter(DataT *data, uint32_t pos=0)
Definition NanoVDB.h:2717
TileT * mEnd
Definition NanoVDB.h:2713
TileT & operator*() const
Definition NanoVDB.h:2733
TileIter()
Definition NanoVDB.h:2716
bool isValue() const
Definition NanoVDB.h:2753
RootData * data() const
Definition NanoVDB.h:2743
bool isChild() const
Definition NanoVDB.h:2748
ValueT value() const
Definition NanoVDB.h:2768
BaseIter()
Definition NanoVDB.h:2883
typename util::match_const< Tile, RootT >::type TileT
Definition NanoVDB.h:2881
DataType::template TileIter< DataT > mTileIter
Definition NanoVDB.h:2882
TileT * tile() const
Definition NanoVDB.h:2889
CoordType getOrigin() const
Definition NanoVDB.h:2890
typename util::match_const< DataType, RootT >::type DataT
Definition NanoVDB.h:2880
uint32_t pos() const
Definition NanoVDB.h:2888
BaseIter(DataT *data)
Definition NanoVDB.h:2884
CoordType getCoord() const
Definition NanoVDB.h:2891
Definition NanoVDB.h:2896
ChildIter operator++(int)
Definition NanoVDB.h:2916
ChildIter & operator++()
Definition NanoVDB.h:2910
NodeT & operator*() const
Definition NanoVDB.h:2908
ChildIter()
Definition NanoVDB.h:2903
ChildIter(RootT *parent)
Definition NanoVDB.h:2904
NodeT * operator->() const
Definition NanoVDB.h:2909
Definition NanoVDB.h:2999
DenseIter(RootT *parent)
Definition NanoVDB.h:3006
bool isValueOn() const
Definition NanoVDB.h:3013
DenseIter & operator++()
Definition NanoVDB.h:3014
DenseIter operator++(int)
Definition NanoVDB.h:3019
DenseIter()
Definition NanoVDB.h:3005
NodeT * probeChild(ValueType &value) const
Definition NanoVDB.h:3007
Definition NanoVDB.h:2932
bool isActive() const
Definition NanoVDB.h:2943
ValueIter(RootT *parent)
Definition NanoVDB.h:2938
ValueIter operator++(int)
Definition NanoVDB.h:2950
ValueType operator*() const
Definition NanoVDB.h:2942
ValueIter()
Definition NanoVDB.h:2937
ValueIter & operator++()
Definition NanoVDB.h:2944
Definition NanoVDB.h:2966
ValueOnIter()
Definition NanoVDB.h:2971
ValueOnIter & operator++()
Definition NanoVDB.h:2977
ValueType operator*() const
Definition NanoVDB.h:2976
ValueOnIter operator++(int)
Definition NanoVDB.h:2983
ValueOnIter(RootT *parent)
Definition NanoVDB.h:2972
Top-most node of the VDB tree structure.
Definition NanoVDB.h:2855
const uint32_t & getTableSize() const
Definition NanoVDB.h:3057
const uint32_t & tileCount() const
Definition NanoVDB.h:3056
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:2872
ChildIter< const RootNode > ConstChildIterator
Definition NanoVDB.h:2925
static uint64_t memUsage(uint32_t tableSize)
Definition NanoVDB.h:3075
ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:3085
ValueOnIterator beginValueOn()
Definition NanoVDB.h:2994
friend class ReadAccessor
Definition NanoVDB.h:3116
ChildT UpperNodeType
Definition NanoVDB.h:2861
typename ChildT::CoordType CoordType
Definition NanoVDB.h:2868
static constexpr uint32_t LEVEL
Definition NanoVDB.h:2874
ConstValueIterator cbeginValueAll() const
Definition NanoVDB.h:2962
FloatType variance() const
Definition NanoVDB.h:3069
ConstValueOnIterator cbeginValueOn() const
Definition NanoVDB.h:2995
const FloatType & average() const
Definition NanoVDB.h:3066
RootNode & operator=(const RootNode &)=delete
DataType * data()
Definition NanoVDB.h:3042
ValueOnIter< RootNode > ValueOnIterator
Definition NanoVDB.h:2991
ValueIter< const RootNode > ConstValueIterator
Definition NanoVDB.h:2959
RootData< ChildT > DataType
Definition NanoVDB.h:2857
AccessorType getAccessor() const
Definition NanoVDB.h:3040
typename DataType::BuildT BuildType
Definition NanoVDB.h:2866
const BBoxType & bbox() const
Definition NanoVDB.h:3047
ValueIter< RootNode > ValueIterator
Definition NanoVDB.h:2958
DenseIterator beginDense()
Definition NanoVDB.h:3030
RootNode(const RootNode &)=delete
ChildT ChildNodeType
Definition NanoVDB.h:2858
const LeafNodeType * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:3089
bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:3086
typename DataType::ValueT ValueType
Definition NanoVDB.h:2864
RootType RootNodeType
Definition NanoVDB.h:2860
RootNode< ChildT > RootType
Definition NanoVDB.h:2859
typename DataType::StatsT FloatType
Definition NanoVDB.h:2865
ValueIterator beginValue()
Definition NanoVDB.h:2961
ChildIter< RootNode > ChildIterator
Definition NanoVDB.h:2924
ChildIterator beginChild()
Definition NanoVDB.h:2927
void set(const CoordType &ijk, ArgsT &&... args)
Definition NanoVDB.h:3102
uint64_t memUsage() const
Definition NanoVDB.h:3078
bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:3088
friend class Tree
Definition NanoVDB.h:3119
typename ChildT::LeafNodeType LeafNodeType
Definition NanoVDB.h:2863
OpT::Type get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:3092
DefaultReadAccessor< BuildType > AccessorType
Definition NanoVDB.h:2870
ConstDenseIterator cbeginDense() const
Definition NanoVDB.h:3031
ConstDenseIterator cbeginChildAll() const
Definition NanoVDB.h:3032
math::BBox< CoordType > BBoxType
Definition NanoVDB.h:2869
const FloatType & stdDeviation() const
Definition NanoVDB.h:3072
ValueOnIter< const RootNode > ConstValueOnIterator
Definition NanoVDB.h:2992
const ValueType & maximum() const
Definition NanoVDB.h:3063
typename DataType::Tile Tile
Definition NanoVDB.h:2871
ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:3084
const ValueType & background() const
Definition NanoVDB.h:3053
bool isEmpty() const
Definition NanoVDB.h:3081
typename UpperNodeType::ChildNodeType LowerNodeType
Definition NanoVDB.h:2862
RootNode()=delete
This class cannot be constructed or deleted.
const ValueType & minimum() const
Definition NanoVDB.h:3060
DenseIter< const RootNode > ConstDenseIterator
Definition NanoVDB.h:3028
DenseIter< RootNode > DenseIterator
Definition NanoVDB.h:3027
const DataType * data() const
Definition NanoVDB.h:3044
ConstChildIterator cbeginChild() const
Definition NanoVDB.h:2928
VDB Tree, which is a thin wrapper around a RootNode.
Definition NanoVDB.h:2444
typename RootT::ChildNodeType Node2
Definition NanoVDB.h:2463
auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:2587
typename RootType::LeafNodeType LeafNodeType
Definition NanoVDB.h:2456
const NodeTrait< NanoRoot< BuildT >, 1 >::type * getFirstLower() const
Definition NanoVDB.h:2582
RootT Node3
Definition NanoVDB.h:2462
const uint32_t & activeTileCount(uint32_t level) const
Definition NanoVDB.h:2516
ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:2488
const NodeT * getFirstNode() const
Definition NanoVDB.h:2554
uint64_t activeVoxelCount() const
Definition NanoVDB.h:2509
typename RootNodeType::ChildNodeType UpperNodeType
Definition NanoVDB.h:2454
auto set(const CoordType &ijk, ArgsT &&... args)
Definition NanoVDB.h:2593
const NodeTrait< NanoRoot< BuildT >, 2 >::type * getFirstUpper() const
Definition NanoVDB.h:2584
DataType * data()
Definition NanoVDB.h:2473
uint32_t nodeCount() const
Definition NanoVDB.h:2523
NodeTrait< NanoRoot< BuildT >, 1 >::type * getFirstLower()
Definition NanoVDB.h:2581
Tree()=delete
This class cannot be constructed or deleted.
AccessorType getAccessor() const
Definition NanoVDB.h:2484
NodeTrait< NanoRoot< BuildT >, 2 >::type * getFirstUpper()
Definition NanoVDB.h:2583
bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:2491
const LeafNodeType * getFirstLeaf() const
Definition NanoVDB.h:2580
NodeTrait< NanoRoot< BuildT >, LEVEL >::type * getFirstNode()
Definition NanoVDB.h:2564
void extrema(ValueType &min, ValueType &max) const
bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:2497
RootT RootNodeType
Definition NanoVDB.h:2453
typename RootT::CoordType CoordType
Definition NanoVDB.h:2459
NanoRoot< BuildT > & root()
Definition NanoVDB.h:2480
DefaultReadAccessor< BuildType > AccessorType
Definition NanoVDB.h:2460
LeafNodeType * getFirstLeaf()
Definition NanoVDB.h:2579
Tree(const Tree &)=delete
static uint64_t memUsage()
Definition NanoVDB.h:2478
LeafNodeType Node0
Definition NanoVDB.h:2465
NodeT * getFirstNode()
Definition NanoVDB.h:2544
uint32_t nodeCount(int level) const
Definition NanoVDB.h:2529
typename Node2::ChildNodeType Node1
Definition NanoVDB.h:2464
const NodeTrait< NanoRoot< BuildT >, LEVEL >::type * getFirstNode() const
Definition NanoVDB.h:2573
const NanoRoot< BuildT > & root() const
Definition NanoVDB.h:2482
ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:2487
RootT RootType
Definition NanoVDB.h:2452
const ValueType & background() const
Definition NanoVDB.h:2500
Tree & operator=(const Tree &)=delete
typename UpperNodeType::ChildNodeType LowerNodeType
Definition NanoVDB.h:2455
typename RootT::ValueType ValueType
Definition NanoVDB.h:2457
TreeData DataType
Definition NanoVDB.h:2451
uint32_t totalNodeCount() const
Definition NanoVDB.h:2535
const DataType * data() const
Definition NanoVDB.h:2475
typename RootT::BuildType BuildType
Definition NanoVDB.h:2458
Dummy type for a voxel whose value equals an offset into an external value array.
Definition NanoVDB.h:177
Dummy type for a voxel whose value equals its binary active state.
Definition NanoVDB.h:183
Dummy type for a voxel whose value equals an offset into an external value array of active values.
Definition NanoVDB.h:180
Bit-compacted representation of all three version numbers.
Definition NanoVDB.h:727
bool operator<(const Version &rhs) const
Definition NanoVDB.h:749
uint32_t getPatch() const
Definition NanoVDB.h:756
bool operator<=(const Version &rhs) const
Definition NanoVDB.h:750
static constexpr uint32_t End
Definition NanoVDB.h:730
Version(uint32_t data)
Constructor from a raw uint32_t data representation.
Definition NanoVDB.h:739
Version()
Default constructor.
Definition NanoVDB.h:732
bool operator==(const Version &rhs) const
Definition NanoVDB.h:748
Version(uint32_t major, uint32_t minor, uint32_t patch)
Constructor from major.minor.patch version numbers.
Definition NanoVDB.h:741
uint32_t getMajor() const
Definition NanoVDB.h:754
bool isCompatible() const
Definition NanoVDB.h:757
bool operator>=(const Version &rhs) const
Definition NanoVDB.h:752
int age() const
Returns the difference between major version of this instance and NANOVDB_MAJOR_VERSION_NUMBER.
Definition NanoVDB.h:761
uint32_t getMinor() const
Definition NanoVDB.h:755
uint32_t id() const
Definition NanoVDB.h:753
static constexpr uint32_t StrLen
Definition NanoVDB.h:730
bool operator>(const Version &rhs) const
Definition NanoVDB.h:751
Signed (i, j, k) 32-bit integer coordinate class, similar to openvdb::math::Coord.
Definition Math.h:425
Definition NanoVDB.h:5973
Codec toCodec(const char *str)
Definition NanoVDB.h:5997
void writeUncompressedGrid(StreamT &os, const GridData *gridData, bool raw=false)
This is a standalone alternative to io::writeGrid(...,Codec::NONE) defined in io/IO....
Definition NanoVDB.h:6075
VecT< GridHandleT > readUncompressedGrids(StreamT &is, const typename GridHandleT::BufferType &pool=typename GridHandleT::BufferType())
read all uncompressed grids from a stream and return their handles.
Definition NanoVDB.h:6202
const char * toStr(char *dst, Codec codec)
Definition NanoVDB.h:5987
Codec
Define compression codecs.
Definition NanoVDB.h:5981
@ StrLen
Definition NanoVDB.h:5985
@ ZIP
Definition NanoVDB.h:5982
@ End
Definition NanoVDB.h:5984
@ BLOSC
Definition NanoVDB.h:5983
@ NONE
Definition NanoVDB.h:5981
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:6174
__hostdev__ constexpr T Pow2(T x) noexcept
Return x * x.
Definition Math.h:258
__hostdev__ constexpr Vec3T matMult(const float *mat, const Vec3T &xyz) noexcept
Multiply a 3x3 matrix and a 3d vector using 32bit floating point arithmetics.
Definition Math.h:2201
__hostdev__ constexpr uint64_t AlignUp(uint64_t byteCount) noexcept
round up byteSize to the nearest wordSize, e.g. to align to machine word: AlignUp<sizeof(size_t)(n)
Definition Math.h:411
__hostdev__ constexpr Vec3T matMultT(const float *mat, const Vec3T &xyz) noexcept
Multiply the transposed of a 3x3 matrix and a 3d vector using 32bit floating point arithmetics.
Definition Math.h:2273
Definition GridChecksum.h:86
size_t strlen(const char *str)
length of a c-sting, excluding '\0'.
Definition Util.h:196
uint32_t countOn(uint64_t v)
Definition Util.h:699
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:649
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:228
bool streq(const char *lhs, const char *rhs)
Test if two null-terminated byte strings are the same.
Definition Util.h:311
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:555
static void * memzero(void *dst, size_t byteCount)
Zero initialization of memory.
Definition Util.h:340
char * strcpy(char *dst, const char *src)
Copy characters from src to dst.
Definition Util.h:209
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:579
static int64_t PtrDiff(const void *p, const void *q)
Compute the distance, in bytes, between two pointers, dist = p - q.
Definition Util.h:541
uint64_t atomicOr(uint64_t *target, uint64_t mask)
Atomically ORs mask into the 64-bit word at target (relaxed ordering). Returns the old value....
Definition Util.h:724
char * sprint(char *dst, T var1, Types... var2)
prints a variable number of string and/or numbers to a destination string
Definition Util.h:329
uint64_t atomicAnd(uint64_t *target, uint64_t mask)
Atomically ANDs mask into the 64-bit word at target (relaxed ordering). Returns the old value....
Definition Util.h:748
Defines a simple memory pool used to call cub functions that use dynamic temporary storage.
Definition GridHandle.h:34
math::Vec4< float > Vec4f
Definition Math.h:2835
Grid< Fp4Tree > Fp4Grid
Definition NanoVDB.h:4755
ReadAccessor< BuildT, 0, 1, 2 > DefaultReadAccessor
Definition NanoVDB.h:2149
PointType
Definition NanoVDB.h:399
@ Voxel32
Definition NanoVDB.h:405
@ Grid32
Definition NanoVDB.h:404
@ Voxel8
Definition NanoVDB.h:407
@ Default
Definition NanoVDB.h:408
@ PointID
Definition NanoVDB.h:400
@ World32
Definition NanoVDB.h:402
@ Disable
Definition NanoVDB.h:399
@ Voxel16
Definition NanoVDB.h:406
@ World64
Definition NanoVDB.h:401
@ Grid64
Definition NanoVDB.h:403
auto callNanoGrid(GridDataT *gridData, ArgsT &&... args)
Below is an example of the struct used for generic programming with callNanoGrid.
Definition NanoVDB.h:4805
GridType toGridType()
Maps from a templated build type to a GridType enum.
Definition NanoVDB.h:848
Grid< Vec4fTree > Vec4fGrid
Definition NanoVDB.h:4765
Grid< NanoTree< BuildT > > NanoGrid
Definition NanoVDB.h:4699
typename NodeTrait< GridOrTreeOrRootT, LEVEL >::type NodeTraitT
Definition NanoVDB.h:1771
GridBlindDataSemantic toSemantic(GridClass gridClass, GridBlindDataSemantic defaultSemantic=GridBlindDataSemantic::Unknown)
Maps from GridClass to GridBlindDataSemantic.
Definition NanoVDB.h:486
NanoTree< Vec3i > Vec3ITree
Definition NanoVDB.h:4747
Grid< Fp16Tree > Fp16Grid
Definition NanoVDB.h:4757
Grid< FloatTree > FloatGrid
Definition NanoVDB.h:4754
constexpr uint32_t strlen()
return the number of characters (including null termination) required to convert enum type to a strin...
Definition NanoVDB.h:213
math::Vec3< uint16_t > Vec3u16
Definition Math.h:2831
math::Vec3< uint8_t > Vec3u8
Definition Math.h:2830
Grid< Vec3fTree > Vec3fGrid
Definition NanoVDB.h:4763
InternalNode< NanoLeaf< BuildT >, 4 > NanoLower
Definition NanoVDB.h:4691
Grid< Vec4dTree > Vec4dGrid
Definition NanoVDB.h:4766
static 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:600
typename GridTree< GridT >::type GridTreeT
Definition NanoVDB.h:2437
Grid< BoolTree > BoolGrid
Definition NanoVDB.h:4769
math::Vec3< float > Vec3f
Definition Math.h:2827
bool isFloatingPointVector(GridType gridType)
return true if the GridType maps to a floating point vec3.
Definition NanoVDB.h:627
InternalNode< NanoLower< BuildT >, 5 > NanoUpper
Definition NanoVDB.h:4693
GridClass
Classes (superset of OpenVDB) that are currently supported by NanoVDB.
Definition NanoVDB.h:292
@ FogVolume
Definition NanoVDB.h:294
@ TensorGrid
Definition NanoVDB.h:301
@ VoxelVolume
Definition NanoVDB.h:299
@ End
Definition NanoVDB.h:303
@ Unknown
Definition NanoVDB.h:292
@ Topology
Definition NanoVDB.h:298
@ VoxelBVH
Definition NanoVDB.h:302
@ PointIndex
Definition NanoVDB.h:296
@ IndexGrid
Definition NanoVDB.h:300
@ PointData
Definition NanoVDB.h:297
@ Staggered
Definition NanoVDB.h:295
@ LevelSet
Definition NanoVDB.h:293
GridType
List of types that are currently supported by NanoVDB.
Definition NanoVDB.h:223
@ Vec3u8
Definition NanoVDB.h:247
@ Float
Definition NanoVDB.h:224
@ Boolean
Definition NanoVDB.h:234
@ Vec4f
Definition NanoVDB.h:240
@ Int16
Definition NanoVDB.h:226
@ StrLen
Definition NanoVDB.h:251
@ Fp4
Definition NanoVDB.h:236
@ Mask
Definition NanoVDB.h:231
@ Vec3u16
Definition NanoVDB.h:248
@ Vec4d
Definition NanoVDB.h:241
@ Fp8
Definition NanoVDB.h:237
@ End
Definition NanoVDB.h:250
@ Unknown
Definition NanoVDB.h:223
@ Index
Definition NanoVDB.h:242
@ FpN
Definition NanoVDB.h:239
@ UInt8
Definition NanoVDB.h:249
@ RGBA8
Definition NanoVDB.h:235
@ Int32
Definition NanoVDB.h:227
@ OnIndex
Definition NanoVDB.h:243
@ Half
Definition NanoVDB.h:232
@ PointIndex
Definition NanoVDB.h:246
@ Vec3d
Definition NanoVDB.h:230
@ Double
Definition NanoVDB.h:225
@ UInt32
Definition NanoVDB.h:233
@ Vec3f
Definition NanoVDB.h:229
@ Int64
Definition NanoVDB.h:228
@ Fp16
Definition NanoVDB.h:238
CheckMode toCheckMode(const Checksum &checksum)
Maps 64 bit checksum to CheckMode enum.
Definition NanoVDB.h:1923
CheckMode
List of different modes for computing for a checksum.
Definition NanoVDB.h:1831
@ Partial
Definition NanoVDB.h:1834
@ Full
Definition NanoVDB.h:1836
@ Disable
Definition NanoVDB.h:1831
@ Half
Definition NanoVDB.h:1833
@ Empty
Definition NanoVDB.h:1832
Grid< Vec3dTree > Vec3dGrid
Definition NanoVDB.h:4764
typename NanoNode< BuildT, LEVEL >::type NanoNodeT
Definition NanoVDB.h:4732
Grid< Point > PointGrid
Definition NanoVDB.h:4770
RootNode< NanoUpper< BuildT > > NanoRoot
Definition NanoVDB.h:4695
typename util::conditional< BuildTraits< BuildT >::is_index, ChannelAccessor< ValueT, BuildT >, DefaultReadAccessor< BuildT > >::type AccType
Generic Accessor type that maps to either a ReadAccessor or ChannelAccessor.
Definition NanoVDB.h:5937
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:5606
NanoTree< ValueMask > MaskTree
Definition NanoVDB.h:4748
static 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:608
MagicType toMagic(uint64_t magic)
maps 64 bits of magic number to enum
Definition NanoVDB.h:370
GridFlags
Grid flags which indicate what extra information is present in the grid buffer.
Definition NanoVDB.h:331
@ HasAverage
Definition NanoVDB.h:335
@ HasStdDeviation
Definition NanoVDB.h:336
@ HasLongGridName
Definition NanoVDB.h:332
@ HasMinMax
Definition NanoVDB.h:334
@ End
Definition NanoVDB.h:338
@ HasBBox
Definition NanoVDB.h:333
@ IsBreadthFirst
Definition NanoVDB.h:337
Grid< OnIndexTree > OnIndexGrid
Definition NanoVDB.h:4772
Grid< Vec3ITree > Vec3IGrid
Definition NanoVDB.h:4767
Grid< Fp8Tree > Fp8Grid
Definition NanoVDB.h:4756
Grid< Int64Tree > Int64Grid
Definition NanoVDB.h:4762
Tree< NanoRoot< BuildT > > NanoTree
Definition NanoVDB.h:4697
NanoTree< int32_t > Int32Tree
Definition NanoVDB.h:4740
LeafNode< BuildT, Coord, Mask, 3 > NanoLeaf
Template specializations to the default configuration used in OpenVDB: Root -> 32^3 -> 16^3 -> 8^3.
Definition NanoVDB.h:4689
NanoTree< ValueOnIndex > OnIndexTree
Definition NanoVDB.h:4751
NanoTree< Half > HalfTree
Definition NanoVDB.h:4752
GridBlindDataClass
Blind-data Classes that are currently supported by NanoVDB.
Definition NanoVDB.h:414
@ ChannelArray
Definition NanoVDB.h:418
@ End
Definition NanoVDB.h:419
@ IndexArray
Definition NanoVDB.h:415
@ AttributeArray
Definition NanoVDB.h:416
@ GridName
Definition NanoVDB.h:417
NanoTree< double > DoubleTree
Definition NanoVDB.h:4739
NanoTree< ValueIndex > IndexTree
Definition NanoVDB.h:4750
NanoTree< Vec4d > Vec4dTree
Definition NanoVDB.h:4746
Grid< UInt32Tree > UInt32Grid
Definition NanoVDB.h:4761
NanoTree< Fp8 > Fp8Tree
Definition NanoVDB.h:4736
math::BBox< Vec3d > Vec3dBBox
Definition Math.h:2839
MagicType
Enums used to identify magic numbers recognized by NanoVDB.
Definition NanoVDB.h:361
@ OpenVDB
Definition NanoVDB.h:362
@ NanoGrid
Definition NanoVDB.h:364
@ Unknown
Definition NanoVDB.h:361
@ NanoVDB
Definition NanoVDB.h:363
@ NanoFile
Definition NanoVDB.h:365
typename BuildToValueMap< T >::type BuildToValueMapT
Definition NanoVDB.h:592
NanoTree< int64_t > Int64Tree
Definition NanoVDB.h:4742
NanoTree< Vec4f > Vec4fTree
Definition NanoVDB.h:4745
NanoTree< Vec3d > Vec3dTree
Definition NanoVDB.h:4744
NanoTree< Fp16 > Fp16Tree
Definition NanoVDB.h:4737
Grid< MaskTree > MaskGrid
Definition NanoVDB.h:4768
char * toStr(char *dst, GridType gridType)
Maps a GridType to a c-string.
Definition NanoVDB.h:257
NanoTree< FpN > FpNTree
Definition NanoVDB.h:4738
math::Vec3< double > Vec3d
Definition Math.h:2826
math::BBox< Coord > CoordBBox
Definition Math.h:2838
Grid< HalfTree > HalfGrid
Definition NanoVDB.h:4773
auto getAccessor(const GridT &grid, ValueT *sideCar=nullptr)
Generic template functions that return an Accessor to either an index grid or a regular grid.
Definition NanoVDB.h:5942
static bool isAligned(const void *p)
return true if the specified pointer is 32 byte aligned
Definition NanoVDB.h:597
math::Vec4< double > Vec4d
Definition Math.h:2834
bool isInteger(GridType gridType)
Return true if the GridType maps to a POD integer type.
Definition NanoVDB.h:639
Grid< IndexTree > IndexGrid
Definition NanoVDB.h:4771
GridBlindDataSemantic
Blind-data Semantics that are currently understood by NanoVDB.
Definition NanoVDB.h:422
@ GaussianId
Definition NanoVDB.h:442
@ PointQuat
Definition NanoVDB.h:436
@ TriangleId
Definition NanoVDB.h:441
@ FogVolume
Definition NanoVDB.h:433
@ PointRadius
Definition NanoVDB.h:426
@ LineId
Definition NanoVDB.h:440
@ PointOpacity
Definition NanoVDB.h:435
@ PointPosition
Definition NanoVDB.h:423
@ PointColor
Definition NanoVDB.h:424
@ VoxelCoords
Definition NanoVDB.h:431
@ PointVelocity
Definition NanoVDB.h:427
@ End
Definition NanoVDB.h:445
@ Range
Definition NanoVDB.h:443
@ Unknown
Definition NanoVDB.h:422
@ GridCoords
Definition NanoVDB.h:430
@ WorldCoords
Definition NanoVDB.h:429
@ VoxelBVH
Definition NanoVDB.h:444
@ PointNormal
Definition NanoVDB.h:425
@ PointSH0
Definition NanoVDB.h:438
@ PointSHN
Definition NanoVDB.h:439
@ Staggered
Definition NanoVDB.h:434
@ LevelSet
Definition NanoVDB.h:432
@ PointScale
Definition NanoVDB.h:437
@ PointId
Definition NanoVDB.h:428
bool isFloatingPoint(GridType gridType)
return true if the GridType maps to a floating point type
Definition NanoVDB.h:613
Grid< Int32Tree > Int32Grid
Definition NanoVDB.h:4760
NanoTree< Vec3f > Vec3fTree
Definition NanoVDB.h:4743
NanoTree< bool > BoolTree
Definition NanoVDB.h:4749
NanoTree< uint32_t > UInt32Tree
Definition NanoVDB.h:4741
bool isIndex(GridType gridType)
Return true if the GridType maps to a special index type (not a POD integer type).
Definition NanoVDB.h:652
Grid< DoubleTree > DoubleGrid
Definition NanoVDB.h:4759
bool isValid(GridType gridType, GridClass gridClass)
return true if the combination of GridType and GridClass is valid.
Definition NanoVDB.h:661
Grid< FpNTree > FpNGrid
Definition NanoVDB.h:4758
NanoTree< float > FloatTree
Definition NanoVDB.h:4734
NanoTree< Fp4 > Fp4Tree
Definition NanoVDB.h:4735
GridClass toGridClass(GridBlindDataSemantic semantics, GridClass defaultClass=GridClass::Unknown)
Maps from GridBlindDataSemantic to GridClass.
Definition NanoVDB.h:452
Math functions and classes.
#define NANOVDB_HOSTDEV_DISABLE_WARNING
Definition Util.h:106
#define NANOVDB_ASSERT(x)
Definition Util.h:53
Policy that exactly matches separate getDim and isActive calls. A skip flag still controls dim but ca...
Definition NanoVDB.h:1819
Policy that preserves getDim's skip-flag fast path. If an InternalNode short-circuits,...
Definition NanoVDB.h:1826
uint16_t mFlags
Definition NanoVDB.h:932
uint32_t mFlags
Definition NanoVDB.h:937
uint64_t mFlags
Definition NanoVDB.h:942
uint8_t mFlags
Definition NanoVDB.h:927
float type
Definition NanoVDB.h:574
float Type
Definition NanoVDB.h:573
float type
Definition NanoVDB.h:560
float Type
Definition NanoVDB.h:559
float type
Definition NanoVDB.h:567
float Type
Definition NanoVDB.h:566
float type
Definition NanoVDB.h:581
float Type
Definition NanoVDB.h:580
uint64_t Type
Definition NanoVDB.h:587
uint64_t type
Definition NanoVDB.h:588
uint64_t Type
Definition NanoVDB.h:538
uint64_t type
Definition NanoVDB.h:539
bool Type
Definition NanoVDB.h:552
bool type
Definition NanoVDB.h:553
uint64_t Type
Definition NanoVDB.h:545
uint64_t type
Definition NanoVDB.h:546
Maps one type (e.g. the build types above) to other (actual) types.
Definition NanoVDB.h:530
T Type
Definition NanoVDB.h:531
T type
Definition NanoVDB.h:532
Define static boolean tests for template build types.
Definition NanoVDB.h:510
static constexpr bool is_offindex
Definition NanoVDB.h:514
static constexpr bool is_onindex
Definition NanoVDB.h:513
static constexpr bool is_index
Definition NanoVDB.h:512
static constexpr bool is_Fp
Definition NanoVDB.h:518
static constexpr bool is_float
Definition NanoVDB.h:520
static constexpr bool is_special
Definition NanoVDB.h:522
static constexpr bool is_FpX
Definition NanoVDB.h:516
Result of a fused ReadAccessor::getDimAndActive traversal: the getDim(ijk, ray) step size and the pol...
Definition NanoVDB.h:1800
uint32_t packed
Definition NanoVDB.h:1801
DimAndActive()
Definition NanoVDB.h:1803
uint32_t dim() const
Definition NanoVDB.h:1810
DimAndActive(uint32_t d, bool a)
Definition NanoVDB.h:1804
bool active() const
Definition NanoVDB.h:1811
double FloatType
Definition NanoVDB.h:841
double FloatType
Definition NanoVDB.h:811
uint64_t FloatType
Definition NanoVDB.h:823
bool FloatType
Definition NanoVDB.h:835
uint64_t FloatType
Definition NanoVDB.h:829
bool FloatType
Definition NanoVDB.h:817
float FloatType
Definition NanoVDB.h:805
Implements Tree::getDim(math::Coord)
Definition NanoVDB.h:6373
static Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6376
static Type get(const NanoUpper< BuildT > &, uint32_t)
Definition NanoVDB.h:6378
uint32_t Type
Definition NanoVDB.h:6374
static constexpr int LEVEL
Definition NanoVDB.h:6375
static Type get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6377
static Type get(const NanoLeaf< BuildT > &, uint32_t)
Definition NanoVDB.h:6380
static Type get(const NanoLower< BuildT > &, uint32_t)
Definition NanoVDB.h:6379
Return the pointer to the leaf node that contains math::Coord. Implements Tree::probeLeaf(math::Coord...
Definition NanoVDB.h:6387
static Type get(const NanoLeaf< BuildT > &leaf, uint32_t)
Definition NanoVDB.h:6394
static Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6390
static Type get(const NanoUpper< BuildT > &, uint32_t)
Definition NanoVDB.h:6392
static constexpr int LEVEL
Definition NanoVDB.h:6389
static Type get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6391
const NanoLeaf< BuildT > * Type
Definition NanoVDB.h:6388
static Type get(const NanoLower< BuildT > &, uint32_t)
Definition NanoVDB.h:6393
Return point to the lower internal node where math::Coord maps to one of its values,...
Definition NanoVDB.h:6401
static Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6404
const NanoLower< BuildT > * Type
Definition NanoVDB.h:6402
static Type get(const NanoUpper< BuildT > &, uint32_t)
Definition NanoVDB.h:6406
static constexpr int LEVEL
Definition NanoVDB.h:6403
static Type get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6405
static Type get(const NanoLower< BuildT > &node, uint32_t)
Definition NanoVDB.h:6407
Definition NanoVDB.h:6476
uint32_t level
Definition NanoVDB.h:6477
FloatType average
Definition NanoVDB.h:6479
ValueType maximum
Definition NanoVDB.h:6478
CoordBBox bbox
Definition NanoVDB.h:6480
ValueType minimum
Definition NanoVDB.h:6478
uint32_t dim
Definition NanoVDB.h:6477
FloatType stdDevi
Definition NanoVDB.h:6479
Implements Tree::getNodeInfo(math::Coord)
Definition NanoVDB.h:6472
static Type get(const NanoLeaf< BuildT > &leaf, uint32_t)
Definition NanoVDB.h:6500
static Type get(const NanoUpper< BuildT > &node, uint32_t)
Definition NanoVDB.h:6492
typename NanoLeaf< BuildT >::ValueType ValueType
Definition NanoVDB.h:6473
static Type get(const typename NanoRoot< BuildT >::Tile &tile)
Definition NanoVDB.h:6488
static constexpr int LEVEL
Definition NanoVDB.h:6482
NodeInfo Type
Definition NanoVDB.h:6483
static Type get(const NanoLower< BuildT > &node, uint32_t)
Definition NanoVDB.h:6496
typename NanoLeaf< BuildT >::FloatType FloatType
Definition NanoVDB.h:6474
static Type get(const NanoRoot< BuildT > &root)
Definition NanoVDB.h:6484
Implements Tree::isActive(math::Coord)
Definition NanoVDB.h:6359
static Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6362
static Type get(const NanoLower< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6365
bool Type
Definition NanoVDB.h:6360
static Type get(const typename NanoRoot< BuildT >::Tile &tile)
Definition NanoVDB.h:6363
static Type get(const NanoUpper< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6364
static constexpr int LEVEL
Definition NanoVDB.h:6361
static Type get(const NanoLeaf< BuildT > &leaf, uint32_t n)
Definition NanoVDB.h:6366
Return point to the root Tile where math::Coord maps to one of its values, i.e. terminates.
Definition NanoVDB.h:6426
static Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6429
static Type get(const typename NanoRoot< BuildT >::Tile &tile)
Definition NanoVDB.h:6430
static constexpr int LEVEL
Definition NanoVDB.h:6428
const typename NanoRoot< BuildT >::Tile * Type
Definition NanoVDB.h:6427
Return point to the upper internal node where math::Coord maps to one of its values,...
Definition NanoVDB.h:6414
static Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6417
static Type get(const NanoUpper< BuildT > &node, uint32_t)
Definition NanoVDB.h:6419
static constexpr int LEVEL
Definition NanoVDB.h:6416
static Type get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6418
const NanoUpper< BuildT > * Type
Definition NanoVDB.h:6415
Below is an example of a struct used for random get methods.
Definition NanoVDB.h:6319
static Type get(const NanoLower< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6325
static Type get(const typename NanoRoot< BuildT >::Tile &tile)
Definition NanoVDB.h:6323
static Type get(const NanoUpper< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6324
static constexpr int LEVEL
Definition NanoVDB.h:6321
static Type get(const NanoRoot< BuildT > &root)
Definition NanoVDB.h:6322
static Type get(const NanoLeaf< BuildT > &leaf, uint32_t n)
Definition NanoVDB.h:6326
typename NanoLeaf< BuildT >::ValueType Type
Definition NanoVDB.h:6320
Struct with all the member data of the Grid (useful during serialization of an openvdb grid)
Definition NanoVDB.h:1952
const void * treePtr() const
Definition NanoVDB.h:2060
const CoordBBox & indexBBox() const
return AABB of active values in index space
Definition NanoVDB.h:2126
void setMinMaxOn(bool on=true)
Definition NanoVDB.h:2022
void setAverageOn(bool on=true)
Definition NanoVDB.h:2025
Vec3T applyInverseJacobianF(const Vec3T &xyz) const
Definition NanoVDB.h:2052
Vec3T applyIJTF(const Vec3T &xyz) const
Definition NanoVDB.h:2054
uint32_t mBlindMetadataCount
Definition NanoVDB.h:1968
Version mVersion
Definition NanoVDB.h:1956
uint32_t mData0
Definition NanoVDB.h:1969
GridType mGridType
Definition NanoVDB.h:1966
uint64_t mMagic
Definition NanoVDB.h:1954
void setStdDeviationOn(bool on=true)
Definition NanoVDB.h:2026
bool isValid() const
return true if the magic number and the version are both valid
Definition NanoVDB.h:2009
Vec3T applyIJT(const Vec3T &xyz) const
Definition NanoVDB.h:2043
GridClass mGridClass
Definition NanoVDB.h:1965
void setBBoxOn(bool on=true)
Definition NanoVDB.h:2023
const char * gridName() const
Definition NanoVDB.h:2103
uint32_t nodeCount() const
Return number of nodes at LEVEL.
Definition NanoVDB.h:2088
void setLongGridNameOn(bool on=true)
Definition NanoVDB.h:2024
Vec3T applyJacobianF(const Vec3T &xyz) const
Definition NanoVDB.h:2050
void * nodePtr()
Return a non-const void pointer to the first node at LEVEL.
Definition NanoVDB.h:2077
bool setGridName(const char *src)
Definition NanoVDB.h:2027
const Vec3dBBox & worldBBox() const
return AABB of active values in world space
Definition NanoVDB.h:2123
uint64_t mGridSize
Definition NanoVDB.h:1960
Vec3T applyInverseJacobian(const Vec3T &xyz) const
Definition NanoVDB.h:2041
void * treePtr()
Definition NanoVDB.h:2057
const GridBlindMetaData * blindMetaData(uint32_t n) const
Returns a const reference to the blindMetaData at the specified linear offset.
Definition NanoVDB.h:2097
GridData & operator=(const GridData &)=default
Use this method to initiate most member data.
Checksum mChecksum
Definition NanoVDB.h:1955
Vec3dBBox mWorldBBox
Definition NanoVDB.h:1963
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:1975
Vec3T applyMapF(const Vec3T &xyz) const
Definition NanoVDB.h:2046
uint64_t mData1
Definition NanoVDB.h:1970
uint32_t mGridCount
Definition NanoVDB.h:1959
uint64_t mData2
Definition NanoVDB.h:1971
Vec3T applyInverseMap(const Vec3T &xyz) const
Definition NanoVDB.h:2037
static uint64_t memUsage()
Return memory usage in bytes for this class only.
Definition NanoVDB.h:2120
Map mMap
Definition NanoVDB.h:1962
const void * nodePtr() const
Return a non-const void pointer to the first node at LEVEL.
Definition NanoVDB.h:2065
bool isEmpty() const
test if the grid is empty, e.i the root table has size 0
Definition NanoVDB.h:2137
Vec3d mVoxelSize
Definition NanoVDB.h:1964
BitFlags< 32 > mFlags
Definition NanoVDB.h:1957
char mGridName[MaxNameSize]
Definition NanoVDB.h:1961
uint32_t rootTableSize() const
return the root table has size
Definition NanoVDB.h:2129
Vec3T applyJacobian(const Vec3T &xyz) const
Definition NanoVDB.h:2039
int64_t mBlindMetadataOffset
Definition NanoVDB.h:1967
uint32_t mGridIndex
Definition NanoVDB.h:1958
static const int MaxNameSize
Definition NanoVDB.h:1953
bool isRootConnected() const
return true if RootData follows TreeData in memory without any extra padding
Definition NanoVDB.h:2141
Vec3T applyMap(const Vec3T &xyz) const
Definition NanoVDB.h:2035
Vec3T applyInverseMapF(const Vec3T &xyz) const
Definition NanoVDB.h:2048
const typename GridT::TreeType Type
Definition NanoVDB.h:2432
const typename GridT::TreeType type
Definition NanoVDB.h:2433
defines a tree type from a grid type while preserving constness
Definition NanoVDB.h:2425
typename GridT::TreeType Type
Definition NanoVDB.h:2426
typename GridT::TreeType type
Definition NanoVDB.h:2427
void setOrigin(const T &ijk)
Definition NanoVDB.h:3276
StatsT mAverage
Definition NanoVDB.h:3221
typename ChildT::CoordType CoordT
Definition NanoVDB.h:3199
void setChild(uint32_t n, const void *ptr)
Definition NanoVDB.h:3236
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3201
MaskT mChildMask
Definition NanoVDB.h:3217
void setValue(uint32_t n, const ValueT &v)
Definition NanoVDB.h:3243
math::BBox< CoordT > mBBox
Definition NanoVDB.h:3214
InternalData(const InternalData &)=delete
const ValueT & getMax() const
Definition NanoVDB.h:3279
void setDev(const StatsT &v)
Definition NanoVDB.h:3294
const ChildT * getChild(uint32_t n) const
Definition NanoVDB.h:3255
bool isActive(uint32_t n) const
Definition NanoVDB.h:3267
void setMin(const ValueT &v)
Definition NanoVDB.h:3291
typename ChildT::FloatType StatsT
Definition NanoVDB.h:3198
bool isChild(uint32_t n) const
Definition NanoVDB.h:3273
typename ChildT::BuildType BuildT
Definition NanoVDB.h:3197
ValueT getValue(uint32_t n) const
Definition NanoVDB.h:3261
static constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:3228
const ValueT & getMin() const
Definition NanoVDB.h:3278
void setMax(const ValueT &v)
Definition NanoVDB.h:3292
StatsT mStdDevi
Definition NanoVDB.h:3222
Tile mTable[1u<<(3 *LOG2DIM)]
Definition NanoVDB.h:3232
ChildT * getChild(uint32_t n)
Returns a pointer to the child node at the specifed linear offset.
Definition NanoVDB.h:3250
ValueT mMaximum
Definition NanoVDB.h:3220
const StatsT & stdDeviation() const
Definition NanoVDB.h:3281
static uint64_t memUsage()
Definition NanoVDB.h:3234
const StatsT & average() const
Definition NanoVDB.h:3280
MaskT mValueMask
Definition NanoVDB.h:3216
typename ChildT::template MaskType< LOG2DIM > MaskT
Definition NanoVDB.h:3200
InternalData & operator=(const InternalData &)=delete
void setAvg(const StatsT &v)
Definition NanoVDB.h:3293
typename ChildT::ValueType ValueT
Definition NanoVDB.h:3196
ValueT mMinimum
Definition NanoVDB.h:3219
InternalData()=delete
This class cannot be constructed or deleted.
uint64_t mFlags
Definition NanoVDB.h:3215
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3937
static constexpr uint8_t bitWidth()
Definition NanoVDB.h:3947
Fp16 BuildType
Definition NanoVDB.h:3935
float getValue(uint32_t i) const
Definition NanoVDB.h:3948
uint16_t mCode[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:3938
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static constexpr uint32_t padding()
Definition NanoVDB.h:3941
uint16_t ArrayType
Definition NanoVDB.h:3936
LeafData()=delete
This class cannot be constructed or deleted.
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:3934
static constexpr uint64_t memUsage()
Definition NanoVDB.h:3940
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3870
static constexpr uint8_t bitWidth()
Definition NanoVDB.h:3880
float getValue(uint32_t i) const
Definition NanoVDB.h:3881
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
uint8_t mCode[1u<<(3 *LOG2DIM - 1)]
Definition NanoVDB.h:3871
static constexpr uint32_t padding()
Definition NanoVDB.h:3874
LeafData()=delete
This class cannot be constructed or deleted.
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:3867
uint8_t ArrayType
Definition NanoVDB.h:3869
static constexpr uint64_t memUsage()
Definition NanoVDB.h:3873
Fp4 BuildType
Definition NanoVDB.h:3868
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3907
static constexpr uint8_t bitWidth()
Definition NanoVDB.h:3916
float getValue(uint32_t i) const
Definition NanoVDB.h:3917
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static constexpr uint32_t padding()
Definition NanoVDB.h:3910
static constexpr int64_t memUsage()
Definition NanoVDB.h:3909
LeafData()=delete
This class cannot be constructed or deleted.
Fp8 BuildType
Definition NanoVDB.h:3905
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:3904
uint8_t ArrayType
Definition NanoVDB.h:3906
uint8_t mCode[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:3908
FpN BuildType
Definition NanoVDB.h:3968
size_t memUsage() const
Definition NanoVDB.h:3977
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3969
float getValue(uint32_t i) const
Definition NanoVDB.h:3979
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
uint8_t bitWidth() const
Definition NanoVDB.h:3976
static constexpr uint32_t padding()
Definition NanoVDB.h:3970
LeafData()=delete
This class cannot be constructed or deleted.
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:3967
static size_t memUsage(uint32_t bitWidth)
Definition NanoVDB.h:3978
void setOrigin(const T &ijk)
Definition NanoVDB.h:4271
FloatType getDev() const
Definition NanoVDB.h:4263
uint64_t mOffset
Definition NanoVDB.h:4233
uint16_t mValues[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:4235
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4226
uint64_t ValueType
Definition NanoVDB.h:4222
void setMax(const ValueType &)
Definition NanoVDB.h:4266
uint8_t mFlags
Definition NanoVDB.h:4230
void setOn(uint32_t offset)
Definition NanoVDB.h:4258
LeafData & operator=(const LeafData &)=delete
void setDev(const FloatType &)
Definition NanoVDB.h:4268
LeafData(const LeafData &)=delete
uint64_t offset() const
Definition NanoVDB.h:4247
void setValue(uint32_t offset, uint16_t value)
Definition NanoVDB.h:4253
ValueType getMin() const
Definition NanoVDB.h:4260
uint64_t getValue(uint32_t i) const
Definition NanoVDB.h:4251
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:4231
void setValueOnly(uint32_t offset, uint16_t value)
Definition NanoVDB.h:4252
CoordT mBBoxMin
Definition NanoVDB.h:4228
static constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:4241
uint8_t mBBoxDif[3]
Definition NanoVDB.h:4229
Point BuildType
Definition NanoVDB.h:4223
uint64_t pointCount() const
Definition NanoVDB.h:4248
uint64_t first(uint32_t i) const
Definition NanoVDB.h:4249
uint16_t ArrayType
Definition NanoVDB.h:4225
ValueType getMax() const
Definition NanoVDB.h:4261
typename FloatTraits< ValueType >::FloatType FloatType
Definition NanoVDB.h:4224
LeafData()=delete
This class cannot be constructed or deleted.
FloatType getAvg() const
Definition NanoVDB.h:4262
void setAvg(const FloatType &)
Definition NanoVDB.h:4267
uint64_t last(uint32_t i) const
Definition NanoVDB.h:4250
static uint64_t memUsage()
Definition NanoVDB.h:4245
void setMin(const ValueType &)
Definition NanoVDB.h:4265
uint64_t mPointCount
Definition NanoVDB.h:4234
uint64_t lastOffset() const
Definition NanoVDB.h:4177
uint64_t getMax() const
Definition NanoVDB.h:4180
static uint32_t valueCount()
Definition NanoVDB.h:4175
uint64_t getValue(uint32_t i) const
Definition NanoVDB.h:4183
ValueIndex BuildType
Definition NanoVDB.h:4173
LeafIndexBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:4172
uint64_t getAvg() const
Definition NanoVDB.h:4181
uint64_t getDev() const
Definition NanoVDB.h:4182
uint64_t getMin() const
Definition NanoVDB.h:4179
void setOrigin(const T &ijk)
Definition NanoVDB.h:4114
bool getDev() const
Definition NanoVDB.h:4105
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4086
bool getMin() const
Definition NanoVDB.h:4102
static bool hasStats()
Definition NanoVDB.h:4095
void setMax(const ValueType &)
Definition NanoVDB.h:4109
ValueMask BuildType
Definition NanoVDB.h:4083
bool getValue(uint32_t i) const
Definition NanoVDB.h:4101
uint8_t mFlags
Definition NanoVDB.h:4090
void setOn(uint32_t offset)
Definition NanoVDB.h:4107
LeafData & operator=(const LeafData &)=delete
bool getMax() const
Definition NanoVDB.h:4103
void setDev(const FloatType &)
Definition NanoVDB.h:4111
LeafData(const LeafData &)=delete
bool getAvg() const
Definition NanoVDB.h:4104
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:4091
void setValue(uint32_t offset, bool)
Definition NanoVDB.h:4106
CoordT mBBoxMin
Definition NanoVDB.h:4088
static constexpr uint32_t padding()
Definition NanoVDB.h:4096
bool ValueType
Definition NanoVDB.h:4082
uint8_t mBBoxDif[3]
Definition NanoVDB.h:4089
LeafData()=delete
This class cannot be constructed or deleted.
void setAvg(const FloatType &)
Definition NanoVDB.h:4110
uint64_t mPadding[2]
Definition NanoVDB.h:4092
static uint64_t memUsage()
Definition NanoVDB.h:4094
void setMin(const ValueType &)
Definition NanoVDB.h:4108
bool FloatType
Definition NanoVDB.h:4084
void ArrayType
Definition NanoVDB.h:4085
uint64_t lastOffset() const
Definition NanoVDB.h:4198
uint64_t getMax() const
Definition NanoVDB.h:4200
uint64_t getValue(uint32_t i) const
Definition NanoVDB.h:4203
uint32_t valueCount() const
Definition NanoVDB.h:4194
LeafIndexBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:4192
uint64_t getAvg() const
Definition NanoVDB.h:4201
uint64_t getDev() const
Definition NanoVDB.h:4202
ValueOnIndex BuildType
Definition NanoVDB.h:4193
uint64_t getMin() const
Definition NanoVDB.h:4199
void setOrigin(const T &ijk)
Definition NanoVDB.h:4065
bool getDev() const
Definition NanoVDB.h:4052
bool BuildType
Definition NanoVDB.h:4033
void setMin(const bool &)
Definition NanoVDB.h:4059
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4036
bool getMin() const
Definition NanoVDB.h:4049
void setMax(const bool &)
Definition NanoVDB.h:4060
void setValue(uint32_t offset, bool v)
Definition NanoVDB.h:4053
static bool hasStats()
Definition NanoVDB.h:4047
bool getValue(uint32_t i) const
Definition NanoVDB.h:4048
uint8_t mFlags
Definition NanoVDB.h:4040
void setOn(uint32_t offset)
Definition NanoVDB.h:4058
LeafData & operator=(const LeafData &)=delete
bool getMax() const
Definition NanoVDB.h:4050
LeafData(const LeafData &)=delete
MaskT< LOG2DIM > ArrayType
Definition NanoVDB.h:4035
bool getAvg() const
Definition NanoVDB.h:4051
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:4041
MaskT< LOG2DIM > mValues
Definition NanoVDB.h:4042
CoordT mBBoxMin
Definition NanoVDB.h:4038
static constexpr uint32_t padding()
Definition NanoVDB.h:4045
bool ValueType
Definition NanoVDB.h:4032
uint8_t mBBoxDif[3]
Definition NanoVDB.h:4039
void setDev(const bool &)
Definition NanoVDB.h:4062
LeafData()=delete
This class cannot be constructed or deleted.
uint64_t mPadding[2]
Definition NanoVDB.h:4043
static uint64_t memUsage()
Definition NanoVDB.h:4046
void setAvg(const bool &)
Definition NanoVDB.h:4061
bool FloatType
Definition NanoVDB.h:4034
void setOrigin(const T &ijk)
Definition NanoVDB.h:3775
ValueType mMaximum
Definition NanoVDB.h:3729
FloatType getDev() const
Definition NanoVDB.h:3757
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3721
typename FloatTraits< ValueT >::FloatType FloatType
Definition NanoVDB.h:3719
void setMin(const ValueType &v)
Definition NanoVDB.h:3766
void setMax(const ValueType &v)
Definition NanoVDB.h:3767
static bool hasStats()
Definition NanoVDB.h:3743
FloatType mAverage
Definition NanoVDB.h:3730
void setDev(const FloatType &v)
Definition NanoVDB.h:3769
uint8_t mFlags
Definition NanoVDB.h:3725
void setOn(uint32_t offset)
Definition NanoVDB.h:3752
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
ValueType getMin() const
Definition NanoVDB.h:3754
void fill(const ValueType &v)
Definition NanoVDB.h:3777
ValueType getValue(uint32_t i) const
Definition NanoVDB.h:3745
void setValue(uint32_t offset, const ValueType &value)
Definition NanoVDB.h:3747
ValueT ValueType
Definition NanoVDB.h:3717
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:3726
void setValueOnly(uint32_t offset, const ValueType &value)
Definition NanoVDB.h:3746
CoordT mBBoxMin
Definition NanoVDB.h:3723
static constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:3737
uint8_t mBBoxDif[3]
Definition NanoVDB.h:3724
ValueType getMax() const
Definition NanoVDB.h:3755
LeafData()=delete
This class cannot be constructed or deleted.
ValueT ArrayType
Definition NanoVDB.h:3720
FloatType getAvg() const
Definition NanoVDB.h:3756
static uint64_t memUsage()
Definition NanoVDB.h:3741
ValueType mMinimum
Definition NanoVDB.h:3728
void setAvg(const FloatType &v)
Definition NanoVDB.h:3768
ValueT BuildType
Definition NanoVDB.h:3718
ValueType mValues[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:3732
FloatType mStdDevi
Definition NanoVDB.h:3731
Base-class for quantized float leaf nodes.
Definition NanoVDB.h:3795
void setOrigin(const T &ijk)
Definition NanoVDB.h:3855
float ValueType
Definition NanoVDB.h:3798
static bool hasStats()
Definition NanoVDB.h:3812
float getMin() const
return the quantized minimum of the active values in this node
Definition NanoVDB.h:3830
void setDev(float dev)
Definition NanoVDB.h:3852
void setMin(float min)
Definition NanoVDB.h:3843
uint16_t mMax
Definition NanoVDB.h:3808
float getAvg() const
return the quantized average of the active values in this node
Definition NanoVDB.h:3836
uint8_t mFlags
Definition NanoVDB.h:3803
void setOn(uint32_t offset)
Definition NanoVDB.h:3827
uint16_t mMin
Definition NanoVDB.h:3808
float mQuantum
Definition NanoVDB.h:3807
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:3804
void init(float min, float max, uint8_t bitWidth)
Definition NanoVDB.h:3821
uint16_t mAvg
Definition NanoVDB.h:3808
CoordT mBBoxMin
Definition NanoVDB.h:3801
static constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:3817
uint8_t mBBoxDif[3]
Definition NanoVDB.h:3802
float mMinimum
Definition NanoVDB.h:3806
float FloatType
Definition NanoVDB.h:3799
void setMax(float max)
Definition NanoVDB.h:3846
uint16_t mDev
Definition NanoVDB.h:3808
void setAvg(float avg)
Definition NanoVDB.h:3849
static uint64_t memUsage()
Definition NanoVDB.h:3810
float getDev() const
return the quantized standard deviation of the active values in this node
Definition NanoVDB.h:3840
float getMax() const
return the quantized maximum of the active values in this node
Definition NanoVDB.h:3833
void setOrigin(const T &ijk)
Definition NanoVDB.h:4155
uint64_t mOffset
Definition NanoVDB.h:4140
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4134
uint64_t ValueType
Definition NanoVDB.h:4131
uint64_t FloatType
Definition NanoVDB.h:4132
void setMax(const ValueType &)
Definition NanoVDB.h:4150
uint8_t mFlags
Definition NanoVDB.h:4138
void setOn(uint32_t offset)
Definition NanoVDB.h:4153
void setDev(const FloatType &)
Definition NanoVDB.h:4152
uint64_t mPrefixSum
Definition NanoVDB.h:4140
LeafIndexBase & operator=(const LeafIndexBase &)=default
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:4139
LeafIndexBase(const LeafIndexBase &)=default
const uint64_t & firstOffset() const
Definition NanoVDB.h:4148
CoordT mBBoxMin
Definition NanoVDB.h:4136
static constexpr uint32_t padding()
Definition NanoVDB.h:4141
uint8_t mBBoxDif[3]
Definition NanoVDB.h:4137
void setAvg(const FloatType &)
Definition NanoVDB.h:4151
static uint64_t memUsage()
Definition NanoVDB.h:4145
LeafIndexBase()=default
This class should be used as an abstract class and only constructed or deleted via child classes.
void setMin(const ValueType &)
Definition NanoVDB.h:4149
void ArrayType
Definition NanoVDB.h:4133
bool hasStats() const
Definition NanoVDB.h:4146
Definition NanoVDB.h:4291
static uint32_t dim()
Definition NanoVDB.h:4294
static constexpr uint32_t DIM
Definition NanoVDB.h:4293
static constexpr uint32_t TOTAL
Definition NanoVDB.h:4292
Defines an affine transform and its inverse represented as a 3x3 matrix and a vec3 translation.
Definition NanoVDB.h:1399
double mTaperD
Definition NanoVDB.h:1407
void set(const Mat4T &mat, const Mat4T &invMat, double taper=1.0)
Initialize the member data from 4x4 matrices.
Definition NanoVDB.h:1442
constexpr Map()
Default constructor for the identity map.
Definition NanoVDB.h:1410
constexpr Vec3d getVoxelSize() const
Return a voxels size in each coordinate direction, measured at the origin.
Definition NanoVDB.h:1534
constexpr Vec3T applyIJTF(const Vec3T &xyz) const
Definition NanoVDB.h:1531
double mVecD[3]
Definition NanoVDB.h:1406
float mInvMatF[9]
Definition NanoVDB.h:1401
constexpr 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:1529
constexpr 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:1511
constexpr 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:1470
constexpr Vec3T applyMapF(const Vec3T &ijk) const
Apply the forward affine transformation to a vector using 32bit floating point arithmetics.
Definition NanoVDB.h:1461
constexpr 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:1520
constexpr Vec3T applyMap(const Vec3T &ijk) const
Apply the forward affine transformation to a vector using 64bit floating point arithmetics.
Definition NanoVDB.h:1453
double mInvMatD[9]
Definition NanoVDB.h:1405
float mMatF[9]
Definition NanoVDB.h:1400
constexpr Map(double s, const Vec3d &t=Vec3d(0.0, 0.0, 0.0))
Definition NanoVDB.h:1421
double mMatD[9]
Definition NanoVDB.h:1404
constexpr Vec3T applyInverseMapF(const Vec3T &xyz) const
Apply the inverse affine mapping to a vector using 32bit floating point arithmetics.
Definition NanoVDB.h:1499
constexpr 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:1479
float mTaperF
Definition NanoVDB.h:1403
float mVecF[3]
Definition NanoVDB.h:1402
constexpr Vec3T applyInverseMap(const Vec3T &xyz) const
Apply the inverse affine mapping to a vector using 64bit floating point arithmetics.
Definition NanoVDB.h:1487
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:1538
NanoLeaf< BuildT > type
Definition NanoVDB.h:4710
NanoLeaf< BuildT > Type
Definition NanoVDB.h:4709
NanoLower< BuildT > Type
Definition NanoVDB.h:4715
NanoLower< BuildT > type
Definition NanoVDB.h:4716
NanoUpper< BuildT > type
Definition NanoVDB.h:4722
NanoUpper< BuildT > Type
Definition NanoVDB.h:4721
NanoRoot< BuildT > type
Definition NanoVDB.h:4728
NanoRoot< BuildT > Type
Definition NanoVDB.h:4727
Trait to map from LEVEL to node type.
Definition NanoVDB.h:4703
typename GridOrTreeOrRootT::LeafNodeType type
Definition NanoVDB.h:1716
typename GridOrTreeOrRootT::LeafNodeType Type
Definition NanoVDB.h:1715
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType Type
Definition NanoVDB.h:1730
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType type
Definition NanoVDB.h:1731
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType type
Definition NanoVDB.h:1745
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType Type
Definition NanoVDB.h:1744
typename GridOrTreeOrRootT::RootNodeType type
Definition NanoVDB.h:1759
typename GridOrTreeOrRootT::RootNodeType Type
Definition NanoVDB.h:1758
const typename GridOrTreeOrRootT::LeafNodeType Type
Definition NanoVDB.h:1722
const typename GridOrTreeOrRootT::LeafNodeType type
Definition NanoVDB.h:1723
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType type
Definition NanoVDB.h:1738
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType Type
Definition NanoVDB.h:1737
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType Type
Definition NanoVDB.h:1751
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType type
Definition NanoVDB.h:1752
const typename GridOrTreeOrRootT::RootNodeType type
Definition NanoVDB.h:1767
const typename GridOrTreeOrRootT::RootNodeType Type
Definition NanoVDB.h:1766
Struct to derive node type from its level in a given grid, tree or root while preserving constness.
Definition NanoVDB.h:1708
Implements Tree::probeLeaf(math::Coord)
Definition NanoVDB.h:6437
static Type get(const NanoUpper< BuildT > &node, uint32_t n, ValueT &v)
Definition NanoVDB.h:6451
bool Type
Definition NanoVDB.h:6438
static Type get(const NanoLower< BuildT > &node, uint32_t n, ValueT &v)
Definition NanoVDB.h:6456
static Type get(const NanoLeaf< BuildT > &leaf, uint32_t n, ValueT &v)
Definition NanoVDB.h:6461
typename BuildToValueMap< BuildT >::Type ValueT
Definition NanoVDB.h:6440
static constexpr int LEVEL
Definition NanoVDB.h:6439
static Type get(const NanoRoot< BuildT > &root, ValueT &v)
Definition NanoVDB.h:6441
static Type get(const typename NanoRoot< BuildT >::Tile &tile, ValueT &v)
Definition NanoVDB.h:6446
Definition NanoVDB.h:2667
ValueT value
Definition NanoVDB.h:2690
uint32_t state
Definition NanoVDB.h:2689
bool isActive() const
Definition NanoVDB.h:2685
KeyT key
Definition NanoVDB.h:2687
void setValue(const CoordType &k, bool s, const ValueType &v)
Definition NanoVDB.h:2676
CoordT origin() const
Definition NanoVDB.h:2686
bool isValue() const
Definition NanoVDB.h:2684
bool isChild() const
Definition NanoVDB.h:2683
void setChild(const CoordType &k, const void *ptr, const RootData *data)
Definition NanoVDB.h:2669
int64_t child
Definition NanoVDB.h:2688
StatsT mAverage
Definition NanoVDB.h:2655
typename ChildT::CoordType CoordT
Definition NanoVDB.h:2620
static CoordT KeyToCoord(const KeyT &key)
Definition NanoVDB.h:2636
const ChildT * getChild(const Tile *tile) const
Definition NanoVDB.h:2827
RootData()=delete
This class cannot be constructed or deleted.
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:2622
ConstTileIterator cbeginTile() const
Definition NanoVDB.h:2779
ValueT mBackground
Definition NanoVDB.h:2652
Tile * tile(uint32_t n)
Definition NanoVDB.h:2701
const Tile * tile(uint32_t n) const
Returns a pointer to the tile at the specified linear offset.
Definition NanoVDB.h:2696
uint32_t mTableSize
Definition NanoVDB.h:2650
math::BBox< CoordT > mBBox
Definition NanoVDB.h:2649
Tile * probeTile(const CoordT &ijk)
Definition NanoVDB.h:2797
const ValueT & getMax() const
Definition NanoVDB.h:2834
void setDev(const StatsT &v)
Definition NanoVDB.h:2841
uint64_t KeyT
Return a key based on the coordinates of a voxel.
Definition NanoVDB.h:2626
void setMin(const ValueT &v)
Definition NanoVDB.h:2838
typename ChildT::FloatType StatsT
Definition NanoVDB.h:2621
TileIterator probe(const CoordT &ijk)
Definition NanoVDB.h:2781
typename ChildT::BuildType BuildT
Definition NanoVDB.h:2619
ChildT * getChild(const Tile *tile)
Returns a const reference to the child node in the specified tile.
Definition NanoVDB.h:2822
ConstTileIterator probe(const CoordT &ijk) const
Definition NanoVDB.h:2789
static constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:2661
const ValueT & getMin() const
Definition NanoVDB.h:2833
void setMax(const ValueT &v)
Definition NanoVDB.h:2839
StatsT mStdDevi
Definition NanoVDB.h:2656
RootData(const RootData &)=delete
static KeyT CoordToKey(const CoordType &ijk)
Definition NanoVDB.h:2628
RootData & operator=(const RootData &)=delete
ChildT * probeChild(const CoordT &ijk)
Definition NanoVDB.h:2808
ValueT mMaximum
Definition NanoVDB.h:2654
const StatsT & stdDeviation() const
Definition NanoVDB.h:2836
const StatsT & average() const
Definition NanoVDB.h:2835
TileIterator beginTile()
Definition NanoVDB.h:2778
const ChildT * probeChild(const CoordT &ijk) const
Definition NanoVDB.h:2814
const Tile * probeTile(const CoordT &ijk) const
Definition NanoVDB.h:2803
void setAvg(const StatsT &v)
Definition NanoVDB.h:2840
typename ChildT::ValueType ValueT
Definition NanoVDB.h:2618
TileIter< const RootData > ConstTileIterator
Definition NanoVDB.h:2776
TileIter< RootData > TileIterator
Definition NanoVDB.h:2775
ValueT mMinimum
Definition NanoVDB.h:2653
Definition NanoVDB.h:6331
static void set(NanoRoot< BuildT > &, const ValueT &)
Definition NanoVDB.h:6335
static constexpr int LEVEL
Definition NanoVDB.h:6334
static void set(NanoLeaf< BuildT > &leaf, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6339
typename NanoLeaf< BuildT >::ValueType ValueT
Definition NanoVDB.h:6333
static void set(NanoLower< BuildT > &node, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6338
static void set(typename NanoRoot< BuildT >::Tile &tile, const ValueT &v)
Definition NanoVDB.h:6336
static void set(NanoUpper< BuildT > &node, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6337
Definition NanoVDB.h:6344
static void set(NanoRoot< BuildT > &, const ValueT &)
Definition NanoVDB.h:6348
static constexpr int LEVEL
Definition NanoVDB.h:6347
static void set(NanoLeaf< BuildT > &leaf, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6352
typename NanoLeaf< BuildT >::ValueType ValueT
Definition NanoVDB.h:6346
static void set(NanoUpper< BuildT > &, uint32_t, const ValueT &)
Definition NanoVDB.h:6350
static void set(typename NanoRoot< BuildT >::Tile &, const ValueT &)
Definition NanoVDB.h:6349
static void set(NanoLower< BuildT > &, uint32_t, const ValueT &)
Definition NanoVDB.h:6351
T ElementType
Definition NanoVDB.h:785
static const int Rank
Definition NanoVDB.h:781
static const int Size
Definition NanoVDB.h:784
static T scalar(const T &s)
Definition NanoVDB.h:786
static const bool IsVector
Definition NanoVDB.h:783
static const bool IsScalar
Definition NanoVDB.h:782
static ElementType scalar(const T &v)
Definition NanoVDB.h:797
static const int Rank
Definition NanoVDB.h:792
static const int Size
Definition NanoVDB.h:795
typename T::ValueType ElementType
Definition NanoVDB.h:796
static const bool IsVector
Definition NanoVDB.h:794
static const bool IsScalar
Definition NanoVDB.h:793
Definition NanoVDB.h:2389
bool isRootNext() const
return true if RootData is layout out immediately after TreeData in memory
Definition NanoVDB.h:2417
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:2414
void setFirstNode(const NodeT *node)
Definition NanoVDB.h:2408
int64_t mNodeOffset[4]
Definition NanoVDB.h:2390
void setRoot(const void *root)
Definition NanoVDB.h:2396
TreeData & operator=(const TreeData &)=default
uint32_t mNodeCount[3]
Definition NanoVDB.h:2391
void * getRoot()
Get a non-const void pointer to the root node (never NULL)
Definition NanoVDB.h:2402
const void * getRoot() const
Get a const void pointer to the root node (never NULL)
Definition NanoVDB.h:2405
bool isEmpty() const
Return true if the root is empty, i.e. has not child nodes or constant tiles.
Definition NanoVDB.h:2411
uint32_t mTileCount[3]
Definition NanoVDB.h:2392
uint64_t mVoxelCount
Definition NanoVDB.h:2393
C++11 implementation of std::conditional.
Definition Util.h:434
C++11 implementation of std::enable_if.
Definition Util.h:384
static constexpr bool value
Definition Util.h:375
C++11 implementation of std::is_same.
Definition Util.h:358
static constexpr bool value
Definition Util.h:359
typename remove_const< T >::type type
Definition Util.h:504
T type
Definition Util.h:451
ValueT value
Definition NanoVDB.h:3205
Tile(const Tile &)=delete
Tile & operator=(const Tile &)=delete
Tile()=delete
This class cannot be constructed or deleted.
int64_t child
Definition NanoVDB.h:3206