125#ifndef NANOVDB_NANOVDB_H_HAS_BEEN_INCLUDED
126#define NANOVDB_NANOVDB_H_HAS_BEEN_INCLUDED
130#include <nanovdb/math/Math.h>
133#define NANOVDB_DATA_ALIGNMENT 32
139#define NANOVDB_MAGIC_NUMB 0x304244566f6e614eUL
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 9
148#define NANOVDB_PATCH_VERSION_NUMBER 0
150#define TBB_SUPPRESS_DEPRECATED_MESSAGES 1
153#define NANOVDB_USE_SINGLE_ROOT_KEY
161#define NANOVDB_FPN_BRANCHLESS
163#if !defined(NANOVDB_ALIGN)
164#define NANOVDB_ALIGN(n) alignas(n)
203template <
class EnumT>
204__hostdev__ inline constexpr uint32_t
strlen(){
return (uint32_t)EnumT::StrLen - (uint32_t)EnumT::End;}
476 return defaultSemantic;
672 switch (blindClass) {
724 : mData(major << 21 | minor << 10 | patch)
757template<
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>
768 static T
scalar(
const T& s) {
return s; }
777 static const int Size = T::SIZE;
784template<
typename T,
int = sizeof(
typename TensorTraits<T>::ElementType)>
829template<
typename BuildT>
884template<
typename BuildT>
885[[deprecated(
"Use toGridType<T>() instead.")]]
891template<
typename BuildT>
906template<
typename BuildT>
907[[deprecated(
"Use toGridClass<T>() instead.")]]
950 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
952 template<
typename MaskT>
955 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
962 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
964 template<
typename MaskT>
968 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
980 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
984 for (
auto bit : list) mFlags &= ~static_cast<Type>(1 << bit);
987 template<
typename MaskT>
989 template<
typename MaskT>
992 template<
typename MaskT>
995 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
997 template<
typename MaskT>
1000 for (
auto mask : list) mFlags &= ~static_cast<Type>(mask);
1004 template<
typename MaskT>
1011 template<
typename MaskT>
1013 template<
typename MaskT>
1016 template<
typename MaskT>
1019 for (
auto mask : list) {
1020 if (0 != (mFlags &
static_cast<Type>(mask)))
return true;
1025 template<
typename MaskT>
1028 for (
auto mask : list) {
1029 if (0 == (mFlags &
static_cast<Type>(mask)))
return true;
1045template<u
int32_t LOG2DIM>
1049 static constexpr uint32_t
SIZE = 1U << (3 * LOG2DIM);
1065 for (
const uint64_t *w = mWords, *q = w +
WORD_COUNT; w != q; ++w)
1073 uint32_t n = i >> 6, sum =
util::countOn(mWords[n] & ((uint64_t(1) << (i & 63u)) - 1u));
1074 for (
const uint64_t* w = mWords; n--; ++w)
1099 mPos = mParent->findNext<On>(mPos + 1);
1111 const Mask* mParent;
1158 const uint64_t v = on ? ~uint64_t(0) : uint64_t(0);
1167 mWords[i] = other.mWords[i];
1174 template<
typename WordT>
1179 return reinterpret_cast<WordT*
>(mWords)[n];
1181 template<
typename WordT>
1186 reinterpret_cast<WordT*
>(mWords)[n] = w;
1190 template<
typename MaskT = Mask>
1193 static_assert(
sizeof(
Mask) ==
sizeof(MaskT),
"Mismatching sizeof");
1194 static_assert(
WORD_COUNT == MaskT::WORD_COUNT,
"Mismatching word count");
1195 static_assert(LOG2DIM == MaskT::LOG2DIM,
"Mismatching LOG2DIM");
1196 auto* src =
reinterpret_cast<const uint64_t*
>(&other);
1197 for (uint64_t *dst = mWords, *end = dst +
WORD_COUNT; dst != end; ++dst)
1208 if (mWords[i] != other.mWords[i])
1217 __hostdev__ bool isOn(uint32_t n)
const {
return 0 != (mWords[n >> 6] & (uint64_t(1) << (n & 63))); }
1220 __hostdev__ bool isOff(uint32_t n)
const {
return 0 == (mWords[n >> 6] & (uint64_t(1) << (n & 63))); }
1226 if (mWords[i] != ~uint64_t(0))
1235 if (mWords[i] != uint64_t(0))
1245#if defined(__CUDACC__)
1246 __device__ inline void setOnAtomic(uint32_t n)
1248 atomicOr(
reinterpret_cast<unsigned long long int*
>(
this) + (n >> 6), 1ull << (n & 63));
1250 __device__ inline void setOffAtomic(uint32_t n)
1252 atomicAnd(
reinterpret_cast<unsigned long long int*
>(
this) + (n >> 6), ~(1ull << (n & 63)));
1254 __device__ inline void setAtomic(uint32_t n,
bool on)
1256 on ? this->setOnAtomic(n) : this->setOffAtomic(n);
1282 auto& word = mWords[n >> 6];
1284 word &= ~(uint64_t(1) << n);
1285 word |= uint64_t(on) << n;
1294 for (uint32_t i = 0; i <
WORD_COUNT; ++i)mWords[i] = ~uint64_t(0);
1300 for (uint32_t i = 0; i <
WORD_COUNT; ++i) mWords[i] = uint64_t(0);
1306 const uint64_t v = on ? ~uint64_t(0) : uint64_t(0);
1307 for (uint32_t i = 0; i <
WORD_COUNT; ++i) mWords[i] = v;
1313 for (
auto* w = mWords; n--; ++w) *w = ~*w;
1320 uint64_t* w1 = mWords;
1321 const uint64_t* w2 = other.mWords;
1322 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 &= *w2;
1328 uint64_t* w1 = mWords;
1329 const uint64_t* w2 = other.mWords;
1330 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 |= *w2;
1336 uint64_t* w1 = mWords;
1337 const uint64_t* w2 = other.mWords;
1338 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 &= ~*w2;
1344 uint64_t* w1 = mWords;
1345 const uint64_t* w2 = other.mWords;
1346 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 ^= *w2;
1355 const uint64_t* w = mWords;
1356 for (; n <
WORD_COUNT && !(ON ? *w : ~*w); ++w, ++n);
1364 uint32_t n = start >> 6;
1366 uint32_t m = start & 63u;
1367 uint64_t b = ON ? mWords[n] : ~mWords[n];
1368 if (b & (uint64_t(1u) << m))
return start;
1369 b &= ~uint64_t(0u) << m;
1370 while (!b && ++n <
WORD_COUNT) b = ON ? mWords[n] : ~mWords[n];
1378 uint32_t n = start >> 6;
1380 uint32_t m = start & 63u;
1381 uint64_t b = ON ? mWords[n] : ~mWords[n];
1382 if (b & (uint64_t(1u) << m))
return start;
1383 b &= (uint64_t(1u) << m) - 1u;
1384 while (!b && n) b = ON ? mWords[--n] : ~mWords[--n];
1408 :
mMatF{ 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}
1409 ,
mInvMatF{1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}
1410 ,
mVecF{0.0f, 0.0f, 0.0f}
1412 ,
mMatD{ 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}
1413 ,
mInvMatD{1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}
1414 ,
mVecD{0.0, 0.0, 0.0}
1419 :
mMatF{float(s), 0.0f, 0.0f, 0.0f, float(s), 0.0f, 0.0f, 0.0f, float(s)}
1420 ,
mInvMatF{1.0f / float(s), 0.0f, 0.0f, 0.0f, 1.0f / float(s), 0.0f, 0.0f, 0.0f, 1.0f / float(s)}
1421 ,
mVecF{float(t[0]), float(t[1]), float(t[2])}
1423 ,
mMatD{s, 0.0, 0.0, 0.0, s, 0.0, 0.0, 0.0, s}
1424 ,
mInvMatD{1.0 / s, 0.0, 0.0, 0.0, 1.0 / s, 0.0, 0.0, 0.0, 1.0 / s}
1425 ,
mVecD{t[0], t[1], t[2]}
1432 template<
typename MatT,
typename Vec3T>
1433 void set(
const MatT& mat,
const MatT& invMat,
const Vec3T& translate,
double taper = 1.0);
1438 template<
typename Mat4T>
1439 void set(
const Mat4T& mat,
const Mat4T& invMat,
double taper = 1.0) { this->
set(mat, invMat, mat[3], taper); }
1441 template<
typename Vec3T>
1442 void set(
double scale,
const Vec3T& translation,
double taper = 1.0);
1449 template<
typename Vec3T>
1457 template<
typename Vec3T>
1466 template<
typename Vec3T>
1475 template<
typename Vec3T>
1483 template<
typename Vec3T>
1494 template<
typename Vec3T>
1506 template<
typename Vec3T>
1515 template<
typename Vec3T>
1524 template<
typename Vec3T>
1526 template<
typename Vec3T>
1533template<
typename MatT,
typename Vec3T>
1534inline void Map::set(
const MatT& mat,
const MatT& invMat,
const Vec3T& translate,
double taper)
1538 mTaperF =
static_cast<float>(taper);
1540 for (
int i = 0; i < 3; ++i) {
1541 *vd++ = translate[i];
1542 *vf++ =
static_cast<float>(translate[i]);
1543 for (
int j = 0; j < 3; ++j) {
1545 *mid++ = invMat[j][i];
1546 *mf++ =
static_cast<float>(mat[j][i]);
1547 *mif++ =
static_cast<float>(invMat[j][i]);
1552template<
typename Vec3T>
1553inline void Map::set(
double dx,
const Vec3T& trans,
double taper)
1556 const double mat[3][3] = { {dx, 0.0, 0.0},
1559 const double idx = 1.0 / dx;
1560 const double invMat[3][3] = { {idx, 0.0, 0.0},
1563 this->
set(mat, invMat, trans, taper);
1652 template<
typename BlindDataT>
1663 auto check = [&]()->
bool{
1681 default:
return true;}
1703template<
typename Gr
idOrTreeOrRootT,
int LEVEL>
1707template<
typename Gr
idOrTreeOrRootT>
1710 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1711 using Type =
typename GridOrTreeOrRootT::LeafNodeType;
1712 using type =
typename GridOrTreeOrRootT::LeafNodeType;
1714template<
typename Gr
idOrTreeOrRootT>
1717 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1718 using Type =
const typename GridOrTreeOrRootT::LeafNodeType;
1719 using type =
const typename GridOrTreeOrRootT::LeafNodeType;
1722template<
typename Gr
idOrTreeOrRootT>
1725 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1726 using Type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1727 using type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1729template<
typename Gr
idOrTreeOrRootT>
1732 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1733 using Type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1734 using type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1736template<
typename Gr
idOrTreeOrRootT>
1739 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1740 using Type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1741 using type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1743template<
typename Gr
idOrTreeOrRootT>
1746 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1747 using Type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1748 using type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1750template<
typename Gr
idOrTreeOrRootT>
1753 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1754 using Type =
typename GridOrTreeOrRootT::RootNodeType;
1755 using type =
typename GridOrTreeOrRootT::RootNodeType;
1758template<
typename Gr
idOrTreeOrRootT>
1761 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1762 using Type =
const typename GridOrTreeOrRootT::RootNodeType;
1763 using type =
const typename GridOrTreeOrRootT::RootNodeType;
1766template<
typename Gr
idOrTreeOrRootT,
int LEVEL>
1771template<
typename BuildT>
1773template<
typename BuildT>
1775template<
typename BuildT>
1777template<
typename BuildT>
1779template<
typename BuildT>
1781template<
typename BuildT>
1783template<
typename BuildT>
1785template<
typename BuildT>
1847 [[deprecated(
"Use Checksum::data instead.")]]
1849 [[deprecated(
"Use Checksum::head and Ckecksum::tail instead.")]]
1851 [[deprecated(
"Use Checksum::head and Ckecksum::tail instead.")]]
1862 [[deprecated(
"Use Checksum::isHalf instead.")]]
1946 uint64_t gridSize = 0u,
1951#ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS
1961 mGridSize = gridSize;
1962 mGridName[0] =
'\0';
1964 mWorldBBox = Vec3dBBox();
1965 mVoxelSize = map.getVoxelSize();
1966 mGridClass = gridClass;
1967 mGridType = gridType;
1968 mBlindMetadataOffset = mGridSize;
1969 mBlindMetadataCount = 0u;
1972#ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS
1986 if (test) test =
mVersion.isCompatible();
2004 template<
typename Vec3T>
2006 template<
typename Vec3T>
2008 template<
typename Vec3T>
2010 template<
typename Vec3T>
2012 template<
typename Vec3T>
2015 template<
typename Vec3T>
2017 template<
typename Vec3T>
2019 template<
typename Vec3T>
2021 template<
typename Vec3T>
2023 template<
typename Vec3T>
2034 template <u
int32_t LEVEL>
2037 static_assert(LEVEL >= 0 && LEVEL <= 3,
"invalid LEVEL template parameter");
2038 const void *treeData =
this + 1;
2040 return nodeOffset ?
util::PtrAdd(treeData, nodeOffset) :
nullptr;
2046 template <u
int32_t LEVEL>
2049 static_assert(LEVEL >= 0 && LEVEL <= 3,
"invalid LEVEL template parameter");
2050 void *treeData =
this + 1;
2052 return nodeOffset ?
util::PtrAdd(treeData, nodeOffset) :
nullptr;
2057 template <u
int32_t LEVEL>
2060 static_assert(LEVEL >= 0 && LEVEL < 3,
"invalid LEVEL template parameter");
2081 return metaData->template getBlindData<const char>();
2115template<
typename BuildT,
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1>
2118template<
typename BuildT>
2125template<
typename TreeT>
2169 template<
typename T = BuildType>
2176 template<
typename T = BuildType>
2196 template<
typename Vec3T>
2200 template<
typename Vec3T>
2205 template<
typename Vec3T>
2210 template<
typename Vec3T>
2215 template<
typename Vec3T>
2219 template<
typename Vec3T>
2223 template<
typename Vec3T>
2228 template<
typename Vec3T>
2233 template<
typename Vec3T>
2238 template<
typename Vec3T>
2274 template<
typename NodeT>
2310 [[deprecated(
"Use Grid::getBlindData<T>() instead.")]]
2313 printf(
"\nnanovdb::Grid::blindData is unsafe and hence deprecated! Please use nanovdb::Grid::getBlindData instead.\n\n");
2318 template <
typename BlindDataT>
2325 template <
typename BlindDataT>
2338template<
typename TreeT>
2348template<
typename TreeT>
2351 auto test = [&](
int n) {
2354 if (name[i] != str[i])
2356 if (name[i] ==
'\0' && str[i] ==
'\0')
2388 template<
typename NodeT>
2404template<
typename Gr
idT>
2407 using Type =
typename GridT::TreeType;
2408 using type =
typename GridT::TreeType;
2410template<
typename Gr
idT>
2413 using Type =
const typename GridT::TreeType;
2414 using type =
const typename GridT::TreeType;
2417template<
typename Gr
idT>
2423template<
typename RootT>
2426 static_assert(RootT::LEVEL == 3,
"Tree depth is not supported");
2427 static_assert(RootT::ChildNodeType::LOG2DIM == 5,
"Tree configuration is not supported");
2428 static_assert(RootT::ChildNodeType::ChildNodeType::LOG2DIM == 4,
"Tree configuration is not supported");
2429 static_assert(RootT::LeafNodeType::LOG2DIM == 3,
"Tree configuration is not supported");
2444 using Node2 =
typename RootT::ChildNodeType;
2445 using Node1 =
typename Node2::ChildNodeType;
2503 template<
typename NodeT>
2506 static_assert(NodeT::LEVEL < 3,
"Invalid NodeT");
2524 template<
typename NodeT>
2534 template<
typename NodeT>
2567 template<
typename OpT,
typename... ArgsT>
2573 template<
typename OpT,
typename... ArgsT>
2584template<
typename RootT>
2587 min = this->
root().minimum();
2588 max = this->
root().maximum();
2596template<
typename ChildT>
2606#ifdef NANOVDB_USE_SINGLE_ROOT_KEY
2608 template<
typename CoordType>
2611 static_assert(
sizeof(
CoordT) ==
sizeof(CoordType),
"Mismatching sizeof");
2612 static_assert(32 - ChildT::TOTAL <= 21,
"Cannot use 64 bit root keys");
2613 return (
KeyT(uint32_t(ijk[2]) >> ChildT::TOTAL)) |
2614 (
KeyT(uint32_t(ijk[1]) >> ChildT::TOTAL) << 21) |
2615 (
KeyT(uint32_t(ijk[0]) >> ChildT::TOTAL) << 42);
2619 static constexpr uint64_t MASK = (1u << 21) - 1;
2620 return CoordT(((key >> 42) & MASK) << ChildT::TOTAL,
2621 ((key >> 21) & MASK) << ChildT::TOTAL,
2622 ( key & MASK) << ChildT::TOTAL);
2625 using KeyT = CoordT;
2626 __hostdev__ static KeyT CoordToKey(
const CoordT& ijk) {
return ijk & ~ChildT::MASK; }
2627 __hostdev__ static CoordT KeyToCoord(
const KeyT& key) {
return key; }
2646 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
Tile
2648 template<
typename CoordType>
2655 template<
typename CoordType,
typename ValueType>
2679 return reinterpret_cast<const Tile*
>(
this + 1) + n;
2684 return reinterpret_cast<Tile*
>(
this + 1) + n;
2687 template<
typename DataT>
2726 return reinterpret_cast<DataT*
>(
mBegin) - 1;
2731 return mPos->child != 0;
2736 return mPos->child == 0;
2741 return mPos->child == 0 &&
mPos->state != 0;
2765 for(; iter; ++iter)
if (iter->key == key)
break;
2773 for(; iter; ++iter)
if (iter->key == key)
break;
2779 auto iter = this->
probe(ijk);
2780 return iter ? iter.operator->() :
nullptr;
2790 auto iter = this->
probe(ijk);
2791 return iter && iter.isChild() ? iter.child() :
nullptr;
2833template<
typename ChildT>
2854 static constexpr uint32_t
LEVEL = 1 + ChildT::LEVEL;
2856 template<
typename RootT>
2874 template<
typename RootT>
2886 while (mTileIter && mTileIter.isValue()) ++mTileIter;
2893 while (mTileIter && mTileIter.isValue()) ++mTileIter;
2910 template<
typename RootT>
2920 while (mTileIter && mTileIter.isChild()) ++mTileIter;
2927 while (mTileIter && mTileIter.isChild()) ++mTileIter;
2944 template<
typename RootT>
2954 while (mTileIter && !mTileIter.isValueOn()) ++mTileIter;
2960 while (mTileIter && !mTileIter.isValueOn()) ++mTileIter;
2977 template<
typename RootT>
2989 if (mTileIter.isChild())
return mTileIter.child();
2990 value = mTileIter.value();
3071 template<
typename OpT,
typename... ArgsT>
3076 return OpT::get(*
tile, args...);
3078 return OpT::get(*
this, args...);
3081 template<
typename OpT,
typename... ArgsT>
3086 return OpT::set(*
tile, args...);
3088 return OpT::set(*
this, args...);
3093 static_assert(
sizeof(
typename DataType::Tile) %
NANOVDB_DATA_ALIGNMENT == 0,
"sizeof(RootData::Tile) is misaligned");
3095 template<
typename,
int,
int,
int>
3101 template<
typename RayT,
typename AccT>
3102 __hostdev__ uint32_t getDimAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const
3105 if (
tile->isChild()) {
3107 acc.insert(ijk, child);
3108 return child->getDimAndCache(ijk, ray, acc);
3110 return 1 << ChildT::TOTAL;
3112 return ChildNodeType::dim();
3115 template<
typename OpT,
typename AccT,
typename... ArgsT>
3116 __hostdev__ typename OpT::Type getAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
const
3118 if (
const Tile* tile = this->probeTile(ijk)) {
3119 if constexpr(OpT::LEVEL < LEVEL) {
3120 if (tile->isChild()) {
3121 const ChildT* child = this->getChild(tile);
3122 acc.insert(ijk, child);
3123 return child->template getAndCache<OpT>(ijk, acc, args...);
3126 return OpT::get(*tile, args...);
3128 return OpT::get(*
this, args...);
3131 template<
typename OpT,
typename AccT,
typename... ArgsT>
3132 __hostdev__ void setAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
3134 if (Tile* tile = DataType::probeTile(ijk)) {
3135 if constexpr(OpT::LEVEL < LEVEL) {
3136 if (tile->isChild()) {
3137 ChildT* child = this->getChild(tile);
3138 acc.insert(ijk, child);
3139 return child->template setAndCache<OpT>(ijk, acc, args...);
3142 return OpT::set(*tile, args...);
3144 return OpT::set(*
this, args...);
3156template<
typename ChildT, u
int32_t LOG2DIM>
3157struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT) InternalData
3159 using ValueT =
typename ChildT::ValueType;
3160 using BuildT =
typename ChildT::BuildType;
3161 using StatsT =
typename ChildT::FloatType;
3162 using CoordT =
typename ChildT::CoordType;
3163 using MaskT =
typename ChildT::template MaskType<LOG2DIM>;
3164 static constexpr bool FIXED_SIZE =
true;
3172 Tile(
const Tile&) =
delete;
3173 Tile& operator=(
const Tile&) =
delete;
3177 math::BBox<CoordT> mBBox;
3193 return sizeof(InternalData) - (24u + 8u + 2 * (
sizeof(MaskT) +
sizeof(ValueT) +
sizeof(StatsT)) + (1u << (3 * LOG2DIM)) * (
sizeof(ValueT) > 8u ?
sizeof(ValueT) : 8u));
3195 alignas(32) Tile mTable[1u << (3 * LOG2DIM)];
3199 __hostdev__ void setChild(uint32_t n,
const void* ptr)
3202 mTable[n].child = util::PtrDiff(ptr,
this);
3205 template<
typename ValueT>
3206 __hostdev__ void setValue(uint32_t n,
const ValueT& v)
3209 mTable[n].value = v;
3216 return util::PtrAdd<ChildT>(
this, mTable[n].child);
3218 __hostdev__ const ChildT* getChild(uint32_t n)
const
3221 return util::PtrAdd<ChildT>(
this, mTable[n].child);
3227 return mTable[n].value;
3233 return mValueMask.isOn(n);
3236 __hostdev__ bool isChild(uint32_t n)
const {
return mChildMask.isOn(n); }
3238 template<
typename T>
3239 __hostdev__ void setOrigin(
const T& ijk) { mBBox[0] = ijk; }
3241 __hostdev__ const ValueT& getMin()
const {
return mMinimum; }
3242 __hostdev__ const ValueT& getMax()
const {
return mMaximum; }
3243 __hostdev__ const StatsT& average()
const {
return mAverage; }
3244 __hostdev__ const StatsT& stdDeviation()
const {
return mStdDevi; }
3250#if defined(__GNUC__) && (__GNUC__ < 14) && !defined(__APPLE__) && !defined(__llvm__)
3251#pragma GCC diagnostic push
3252#pragma GCC diagnostic ignored "-Wstringop-overflow"
3254 __hostdev__ void setMin(
const ValueT& v) { mMinimum = v; }
3255 __hostdev__ void setMax(
const ValueT& v) { mMaximum = v; }
3256 __hostdev__ void setAvg(
const StatsT& v) { mAverage = v; }
3257 __hostdev__ void setDev(
const StatsT& v) { mStdDevi = v; }
3258#if defined(__GNUC__) && (__GNUC__ < 14) && !defined(__APPLE__) && !defined(__llvm__)
3259#pragma GCC diagnostic pop
3263 InternalData() =
delete;
3264 InternalData(
const InternalData&) =
delete;
3265 InternalData& operator=(
const InternalData&) =
delete;
3266 ~InternalData() =
delete;
3270template<
typename ChildT, u
int32_t Log2Dim = ChildT::LOG2DIM + 1>
3271class InternalNode :
public InternalData<ChildT, Log2Dim>
3274 using DataType = InternalData<ChildT, Log2Dim>;
3275 using ValueType =
typename DataType::ValueT;
3276 using FloatType =
typename DataType::StatsT;
3277 using BuildType =
typename DataType::BuildT;
3278 using LeafNodeType =
typename ChildT::LeafNodeType;
3279 using ChildNodeType = ChildT;
3280 using CoordType =
typename ChildT::CoordType;
3281 static constexpr bool FIXED_SIZE = DataType::FIXED_SIZE;
3282 template<u
int32_t LOG2>
3283 using MaskType =
typename ChildT::template MaskType<LOG2>;
3285 using MaskIterT =
typename Mask<Log2Dim>::template Iterator<On>;
3287 static constexpr uint32_t LOG2DIM = Log2Dim;
3288 static constexpr uint32_t TOTAL = LOG2DIM + ChildT::TOTAL;
3289 static constexpr uint32_t DIM = 1u << TOTAL;
3290 static constexpr uint32_t SIZE = 1u << (3 * LOG2DIM);
3291 static constexpr uint32_t MASK = (1u << TOTAL) - 1u;
3292 static constexpr uint32_t LEVEL = 1 + ChildT::LEVEL;
3293 static constexpr uint64_t NUM_VALUES = uint64_t(1) << (3 * TOTAL);
3296 template <
typename ParentT>
3297 class ChildIter :
public MaskIterT<true>
3299 static_assert(util::is_same<typename util::remove_const<ParentT>::type, InternalNode>::value,
"Invalid ParentT");
3300 using BaseT = MaskIterT<true>;
3301 using NodeT =
typename util::match_const<ChildT, ParentT>::type;
3311 : BaseT(parent->mChildMask.beginOn())
3315 ChildIter& operator=(
const ChildIter&) =
default;
3319 return *mParent->getChild(BaseT::pos());
3324 return mParent->getChild(BaseT::pos());
3329 return (*this)->origin();
3331 __hostdev__ CoordType getCoord()
const {
return this->getOrigin();}
3334 using ChildIterator = ChildIter<InternalNode>;
3335 using ConstChildIterator = ChildIter<const InternalNode>;
3337 __hostdev__ ChildIterator beginChild() {
return ChildIterator(
this); }
3338 __hostdev__ ConstChildIterator cbeginChild()
const {
return ConstChildIterator(
this); }
3341 class ValueIterator :
public MaskIterT<false>
3343 using BaseT = MaskIterT<false>;
3344 const InternalNode* mParent;
3352 __hostdev__ ValueIterator(
const InternalNode* parent)
3353 : BaseT(parent->data()->mChildMask.beginOff())
3357 ValueIterator& operator=(
const ValueIterator&) =
default;
3361 return mParent->data()->getValue(BaseT::pos());
3366 return mParent->offsetToGlobalCoord(BaseT::pos());
3368 __hostdev__ CoordType getCoord()
const {
return this->getOrigin();}
3372 return mParent->data()->isActive(BaseT::mPos);
3376 __hostdev__ ValueIterator beginValue()
const {
return ValueIterator(
this); }
3377 __hostdev__ ValueIterator cbeginValueAll()
const {
return ValueIterator(
this); }
3380 class ValueOnIterator :
public MaskIterT<true>
3382 using BaseT = MaskIterT<true>;
3383 const InternalNode* mParent;
3391 __hostdev__ ValueOnIterator(
const InternalNode* parent)
3392 : BaseT(parent->data()->mValueMask.beginOn())
3396 ValueOnIterator& operator=(
const ValueOnIterator&) =
default;
3400 return mParent->data()->getValue(BaseT::pos());
3405 return mParent->offsetToGlobalCoord(BaseT::pos());
3407 __hostdev__ CoordType getCoord()
const {
return this->getOrigin();}
3410 __hostdev__ ValueOnIterator beginValueOn()
const {
return ValueOnIterator(
this); }
3411 __hostdev__ ValueOnIterator cbeginValueOn()
const {
return ValueOnIterator(
this); }
3414 class DenseIterator :
public Mask<Log2Dim>::DenseIterator
3416 using BaseT =
typename Mask<Log2Dim>::DenseIterator;
3417 const DataType* mParent;
3425 __hostdev__ DenseIterator(
const InternalNode* parent)
3427 , mParent(parent->data())
3430 DenseIterator& operator=(
const DenseIterator&) =
default;
3431 __hostdev__ const ChildT* probeChild(ValueType& value)
const
3434 const ChildT* child =
nullptr;
3435 if (mParent->mChildMask.isOn(BaseT::pos())) {
3436 child = mParent->getChild(BaseT::pos());
3438 value = mParent->getValue(BaseT::pos());
3445 return mParent->isActive(BaseT::pos());
3450 return mParent->offsetToGlobalCoord(BaseT::pos());
3452 __hostdev__ CoordType getCoord()
const {
return this->getOrigin();}
3455 __hostdev__ DenseIterator beginDense()
const {
return DenseIterator(
this); }
3456 __hostdev__ DenseIterator cbeginChildAll()
const {
return DenseIterator(
this); }
3459 InternalNode() =
delete;
3460 InternalNode(
const InternalNode&) =
delete;
3461 InternalNode& operator=(
const InternalNode&) =
delete;
3462 ~InternalNode() =
delete;
3464 __hostdev__ DataType* data() {
return reinterpret_cast<DataType*
>(
this); }
3466 __hostdev__ const DataType* data()
const {
return reinterpret_cast<const DataType*
>(
this); }
3469 __hostdev__ static uint32_t dim() {
return 1u << TOTAL; }
3475 __hostdev__ const MaskType<LOG2DIM>& valueMask()
const {
return DataType::mValueMask; }
3476 __hostdev__ const MaskType<LOG2DIM>& getValueMask()
const {
return DataType::mValueMask; }
3479 __hostdev__ const MaskType<LOG2DIM>& childMask()
const {
return DataType::mChildMask; }
3480 __hostdev__ const MaskType<LOG2DIM>& getChildMask()
const {
return DataType::mChildMask; }
3483 __hostdev__ CoordType origin()
const {
return DataType::mBBox.min() & ~MASK; }
3486 __hostdev__ const ValueType& minimum()
const {
return this->getMin(); }
3489 __hostdev__ const ValueType& maximum()
const {
return this->getMax(); }
3492 __hostdev__ const FloatType& average()
const {
return DataType::mAverage; }
3495 __hostdev__ FloatType variance()
const {
return DataType::mStdDevi * DataType::mStdDevi; }
3498 __hostdev__ const FloatType& stdDeviation()
const {
return DataType::mStdDevi; }
3501 __hostdev__ const math::BBox<CoordType>& bbox()
const {
return DataType::mBBox; }
3507 return DataType::mChildMask.isOn(0) ? this->getChild(0)->getFirstValue() : DataType::getValue(0);
3514 return DataType::mChildMask.isOn(SIZE - 1) ? this->getChild(SIZE - 1)->getLastValue() : DataType::getValue(SIZE - 1);
3518 __hostdev__ ValueType getValue(
const CoordType& ijk)
const {
return this->
template get<GetValue<BuildType>>(ijk); }
3519 __hostdev__ bool isActive(
const CoordType& ijk)
const {
return this->
template get<GetState<BuildType>>(ijk); }
3521 __hostdev__ bool probeValue(
const CoordType& ijk, ValueType& v)
const {
return this->
template get<ProbeValue<BuildType>>(ijk, v); }
3522 __hostdev__ const LeafNodeType* probeLeaf(
const CoordType& ijk)
const {
return this->
template get<GetLeaf<BuildType>>(ijk); }
3524 __hostdev__ ChildNodeType* probeChild(
const CoordType& ijk)
3526 const uint32_t n = CoordToOffset(ijk);
3527 return DataType::mChildMask.isOn(n) ? this->getChild(n) : nullptr;
3529 __hostdev__ const ChildNodeType* probeChild(
const CoordType& ijk)
const
3531 const uint32_t n = CoordToOffset(ijk);
3532 return DataType::mChildMask.isOn(n) ? this->getChild(n) : nullptr;
3536 __hostdev__ static uint32_t CoordToOffset(
const CoordType& ijk)
3538 return (((ijk[0] & MASK) >> ChildT::TOTAL) << (2 * LOG2DIM)) |
3539 (((ijk[1] & MASK) >> ChildT::TOTAL) << (LOG2DIM)) |
3540 ((ijk[2] & MASK) >> ChildT::TOTAL);
3544 __hostdev__ static Coord OffsetToLocalCoord(uint32_t n)
3547 const uint32_t m = n & ((1 << 2 * LOG2DIM) - 1);
3548 return Coord(n >> 2 * LOG2DIM, m >> LOG2DIM, m & ((1 << LOG2DIM) - 1));
3552 __hostdev__ void localToGlobalCoord(Coord& ijk)
const
3554 ijk <<= ChildT::TOTAL;
3555 ijk += this->origin();
3558 __hostdev__ Coord offsetToGlobalCoord(uint32_t n)
const
3560 Coord ijk = InternalNode::OffsetToLocalCoord(n);
3561 this->localToGlobalCoord(ijk);
3566 __hostdev__ bool isActive()
const {
return DataType::mFlags & uint32_t(2); }
3568 template<
typename OpT,
typename... ArgsT>
3569 __hostdev__ typename OpT::Type get(
const CoordType& ijk, ArgsT&&... args)
const
3571 const uint32_t n = CoordToOffset(ijk);
3572 if constexpr(OpT::LEVEL < LEVEL)
if (this->isChild(n))
return this->getChild(n)->template get<OpT>(ijk, args...);
3573 return OpT::get(*
this, n, args...);
3576 template<
typename OpT,
typename... ArgsT>
3577 __hostdev__ void set(
const CoordType& ijk, ArgsT&&... args)
3579 const uint32_t n = CoordToOffset(ijk);
3580 if constexpr(OpT::LEVEL < LEVEL)
if (this->isChild(n))
return this->getChild(n)->template set<OpT>(ijk, args...);
3581 return OpT::set(*
this, n, args...);
3587 template<
typename,
int,
int,
int>
3588 friend class ReadAccessor;
3591 friend class RootNode;
3592 template<
typename, u
int32_t>
3593 friend class InternalNode;
3595 template<
typename RayT,
typename AccT>
3596 __hostdev__ uint32_t getDimAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const
3598 if (DataType::mFlags & uint32_t(1u))
3602 const uint32_t n = CoordToOffset(ijk);
3603 if (DataType::mChildMask.isOn(n)) {
3604 const ChildT* child = this->getChild(n);
3605 acc.insert(ijk, child);
3606 return child->getDimAndCache(ijk, ray, acc);
3608 return ChildNodeType::dim();
3611 template<
typename OpT,
typename AccT,
typename... ArgsT>
3612 __hostdev__ typename OpT::Type getAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
const
3614 const uint32_t n = CoordToOffset(ijk);
3615 if constexpr(OpT::LEVEL < LEVEL) {
3616 if (this->isChild(n)) {
3617 const ChildT* child = this->getChild(n);
3618 acc.insert(ijk, child);
3619 return child->template getAndCache<OpT>(ijk, acc, args...);
3622 return OpT::get(*
this, n, args...);
3625 template<
typename OpT,
typename AccT,
typename... ArgsT>
3626 __hostdev__ void setAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
3628 const uint32_t n = CoordToOffset(ijk);
3629 if constexpr(OpT::LEVEL < LEVEL) {
3630 if (this->isChild(n)) {
3631 ChildT* child = this->getChild(n);
3632 acc.insert(ijk, child);
3633 return child->template setAndCache<OpT>(ijk, acc, args...);
3636 return OpT::set(*
this, n, args...);
3646template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3649 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3650 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3673 return sizeof(
LeafData) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>) + 2 * (
sizeof(ValueT) +
sizeof(
FloatType)) + (1u << (3 * LOG2DIM)) *
sizeof(ValueT));
3696#if defined(__GNUC__) && (__GNUC__ < 12) && !defined(__APPLE__) && !defined(__llvm__)
3697#pragma GCC diagnostic push
3698#pragma GCC diagnostic ignored "-Wstringop-overflow"
3704#if defined(__GNUC__) && (__GNUC__ < 12) && !defined(__APPLE__) && !defined(__llvm__)
3705#pragma GCC diagnostic pop
3708 template<
typename T>
3713 for (
auto *p =
mValues, *q = p + 512; p != q; ++p)
3727template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3730 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3731 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3753 return sizeof(
LeafFnBase) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>) + 2 * 4 + 4 * 2);
3758 mQuantum = (max - min) /
float((1 << bitWidth) - 1);
3788 template<
typename T>
3797template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3798struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp4, CoordT, MaskT, LOG2DIM>
3805 alignas(32) uint8_t
mCode[1u << (3 * LOG2DIM - 1)];
3810 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3811 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << (3 * LOG2DIM - 1));
3818 const uint8_t c =
mCode[i>>1];
3834template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3835struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp8, CoordT, MaskT, LOG2DIM>
3842 alignas(32) uint8_t
mCode[1u << 3 * LOG2DIM];
3846 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3847 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << 3 * LOG2DIM);
3864template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3865struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp16, CoordT, MaskT, LOG2DIM>
3872 alignas(32) uint16_t
mCode[1u << 3 * LOG2DIM];
3877 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3878 return sizeof(
LeafData) -
sizeof(
BaseT) - 2 * (1u << 3 * LOG2DIM);
3896template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3897struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
FpN, CoordT, MaskT, LOG2DIM>
3906 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3915#ifdef NANOVDB_FPN_BRANCHLESS
3918 uint16_t code =
reinterpret_cast<const uint16_t*
>(
this + 1)[i >> (4 - b)];
3919 const static uint8_t shift[5] = {15, 7, 3, 1, 0};
3920 const static uint16_t mask[5] = {1, 3, 15, 255, 65535};
3921 code >>= (i & shift[b]) << b;
3924 uint32_t code =
reinterpret_cast<const uint32_t*
>(
this + 1)[i >> (5 - b)];
3925 code >>= (i & ((32 >> b) - 1)) << b;
3926 code &= (1 << (1 << b)) - 1;
3930 auto* values =
reinterpret_cast<const uint8_t*
>(
this + 1);
3933 code = float((values[i >> 3] >> (i & 7)) & uint8_t(1));
3936 code = float((values[i >> 2] >> ((i & 3) << 1)) & uint8_t(3));
3939 code = float((values[i >> 1] >> ((i & 1) << 2)) & uint8_t(15));
3942 code = float(values[i]);
3945 code = float(
reinterpret_cast<const uint16_t*
>(values)[i]);
3961template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3962struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<bool, CoordT, MaskT, LOG2DIM>
3964 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3965 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3998 template<
typename T>
4011template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4014 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4015 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4032 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u);
4047 template<
typename T>
4060template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4063 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4064 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4077 return sizeof(
LeafIndexBase) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u);
4088 template<
typename T>
4102template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4122template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4140 uint32_t n = i >> 6;
4141 const uint64_t w =
BaseT::mValueMask.words()[n], mask = uint64_t(1) << (i & 63u);
4142 if (!(w & mask))
return uint64_t(0);
4151template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4152struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Point, CoordT, MaskT, LOG2DIM>
4154 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4155 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4177 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u + (1u << 3 * LOG2DIM) * 2u);
4204 template<
typename T>
4217template<
typename BuildT,
4218 typename CoordT = Coord,
4219 template<u
int32_t>
class MaskT =
Mask,
4220 uint32_t Log2Dim = 3>
4227 static constexpr uint32_t
DIM = 1;
4237 template<u
int32_t LOG2>
4263 return mParent->getValue(BaseT::pos());
4268 return mParent->offsetToGlobalCoord(BaseT::pos());
4296 return mParent->getValue(BaseT::pos());
4301 return mParent->offsetToGlobalCoord(BaseT::pos());
4317 , mPos(1u << 3 * Log2Dim)
4330 return mParent->getValue(mPos);
4335 return mParent->offsetToGlobalCoord(mPos);
4340 return mParent->isActive(mPos);
4342 __hostdev__ operator bool()
const {
return mPos < (1u << 3 * Log2Dim); }
4402 const uint32_t m = n & ((1 << 2 *
LOG2DIM) - 1);
4426 bbox = math::BBox<CoordT>();
4506 template<
typename OpT,
typename... ArgsT>
4512 template<
typename OpT,
typename... ArgsT>
4515 return OpT::get(*
this, n, args...);
4518 template<
typename OpT,
typename... ArgsT>
4524 template<
typename OpT,
typename... ArgsT>
4527 return OpT::set(*
this, n, args...);
4533 template<
typename,
int,
int,
int>
4538 template<
typename, u
int32_t>
4539 friend class InternalNode;
4541 template<
typename RayT,
typename AccT>
4542 __hostdev__ uint32_t getDimAndCache(
const CoordT&,
const RayT& ,
const AccT&)
const
4551 template<
typename OpT,
typename AccT,
typename... ArgsT>
4554 getAndCache(
const CoordType& ijk,
const AccT&, ArgsT&&... args)
const
4556 return OpT::get(*
this, CoordToOffset(ijk), args...);
4559 template<
typename OpT,
typename AccT,
typename... ArgsT>
4561 __hostdev__ decltype(OpT::set(util::declval<LeafNode&>(), util::declval<uint32_t>(), util::declval<ArgsT>()...))
4562 setAndCache(
const CoordType& ijk,
const AccT&, ArgsT&&... args)
4564 return OpT::set(*
this, CoordToOffset(ijk), args...);
4571template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4574 static_assert(
LOG2DIM == 3,
"LeafNode::updateBBox: only supports LOGDIM = 3!");
4579 auto update = [&](uint32_t min, uint32_t max,
int axis) {
4585 uint32_t Xmin = word64 ? 0u : 8u, Xmax = Xmin;
4586 for (
int i = 1; i < 8; ++i) {
4595 update(Xmin, Xmax, 0);
4597 const uint32_t *p =
reinterpret_cast<const uint32_t*
>(&word64), word32 = p[0] | p[1];
4598 const uint16_t *q =
reinterpret_cast<const uint16_t*
>(&word32), word16 = q[0] | q[1];
4599 const uint8_t *b =
reinterpret_cast<const uint8_t*
>(&word16),
byte = b[0] | b[1];
4610template<
typename BuildT>
4612template<
typename BuildT>
4614template<
typename BuildT>
4616template<
typename BuildT>
4618template<
typename BuildT>
4620template<
typename BuildT>
4624template<
typename BuildT,
int LEVEL>
4628template<
typename BuildT>
4634template<
typename BuildT>
4640template<
typename BuildT>
4646template<
typename BuildT>
4653template<
typename BuildT,
int LEVEL>
4724template<
typename OpT,
typename GridDataT,
typename... ArgsT>
4728 switch (gridData->mGridType){
4730 return OpT::template known<float>(gridData, args...);
4732 return OpT::template known<double>(gridData, args...);
4734 return OpT::template known<int16_t>(gridData, args...);
4736 return OpT::template known<int32_t>(gridData, args...);
4738 return OpT::template known<int64_t>(gridData, args...);
4740 return OpT::template known<Vec3f>(gridData, args...);
4742 return OpT::template known<Vec3d>(gridData, args...);
4744 return OpT::template known<uint32_t>(gridData, args...);
4746 return OpT::template known<ValueMask>(gridData, args...);
4748 return OpT::template known<ValueIndex>(gridData, args...);
4750 return OpT::template known<ValueOnIndex>(gridData, args...);
4752 return OpT::template known<bool>(gridData, args...);
4754 return OpT::template known<math::Rgba8>(gridData, args...);
4756 return OpT::template known<Fp4>(gridData, args...);
4758 return OpT::template known<Fp8>(gridData, args...);
4760 return OpT::template known<Fp16>(gridData, args...);
4762 return OpT::template known<FpN>(gridData, args...);
4764 return OpT::template known<Vec4f>(gridData, args...);
4766 return OpT::template known<Vec4d>(gridData, args...);
4768 return OpT::template known<uint8_t>(gridData, args...);
4770 return OpT::unknown(gridData, args...);
4795template<
typename BuildT>
4805 mutable const RootT* mRoot;
4852 template<
typename RayT>
4855 return mRoot->getDimAndCache(ijk, ray, *
this);
4857 template<
typename OpT,
typename... ArgsT>
4860 return mRoot->template
get<OpT>(ijk, args...);
4863 template<
typename OpT,
typename... ArgsT>
4866 return const_cast<RootT*
>(mRoot)->
template set<OpT>(ijk, args...);
4873 template<
typename, u
int32_t>
4874 friend class InternalNode;
4875 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
4879 template<
typename NodeT>
4884template<
typename BuildT,
int LEVEL0>
4887 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 should be 0, 1, or 2");
4901 mutable CoordT mKey;
4902 mutable const RootT* mRoot;
4903 mutable const NodeT* mNode;
4935 mKey = CoordType::max();
4948 return (ijk[0] & int32_t(~NodeT::MASK)) == mKey[0] &&
4949 (ijk[1] & int32_t(~NodeT::MASK)) == mKey[1] &&
4950 (ijk[2] & int32_t(~NodeT::MASK)) == mKey[2];
4965 template<
typename RayT>
4968 if (this->
isCached(ijk))
return mNode->getDimAndCache(ijk, ray, *
this);
4969 return mRoot->getDimAndCache(ijk, ray, *
this);
4972 template<
typename OpT,
typename... ArgsT>
4975 if constexpr(OpT::LEVEL <= LEVEL0)
if (this->
isCached(ijk))
return mNode->template getAndCache<OpT>(ijk, *
this, args...);
4976 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
4979 template<
typename OpT,
typename... ArgsT>
4982 if constexpr(OpT::LEVEL <= LEVEL0)
if (this->
isCached(ijk))
return const_cast<NodeT*
>(mNode)->
template setAndCache<OpT>(ijk, *
this, args...);
4983 return const_cast<RootT*
>(mRoot)->
template setAndCache<OpT>(ijk, *
this, args...);
4990 template<
typename, u
int32_t>
4991 friend class InternalNode;
4992 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
4998 mKey = ijk & ~NodeT::MASK;
5003 template<
typename OtherNodeT>
5004 __hostdev__ void insert(
const CoordType&,
const OtherNodeT*)
const {}
5008template<
typename BuildT,
int LEVEL0,
int LEVEL1>
5011 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 must be 0, 1, 2");
5012 static_assert(LEVEL1 >= 0 && LEVEL1 <= 2,
"LEVEL1 must be 0, 1, 2");
5013 static_assert(LEVEL0 < LEVEL1,
"Level 0 must be lower than level 1");
5026#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5027 mutable CoordT mKey;
5029 mutable CoordT mKeys[2];
5031 mutable const RootT* mRoot;
5032 mutable const Node1T* mNode1;
5033 mutable const Node2T* mNode2;
5044#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5045 : mKey(CoordType::max())
5047 : mKeys{CoordType::max(), CoordType::max()}
5070#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5071 mKey = CoordType::max();
5073 mKeys[0] = mKeys[1] = CoordType::max();
5086#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5091 if (dirty & int32_t(~Node1T::MASK)) {
5097 __hostdev__ bool isCached2(CoordValueType dirty)
const
5101 if (dirty & int32_t(~Node2T::MASK)) {
5107 __hostdev__ CoordValueType computeDirty(
const CoordType& ijk)
const
5109 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
5114 return (ijk[0] & int32_t(~Node1T::MASK)) == mKeys[0][0] &&
5115 (ijk[1] & int32_t(~Node1T::MASK)) == mKeys[0][1] &&
5116 (ijk[2] & int32_t(~Node1T::MASK)) == mKeys[0][2];
5120 return (ijk[0] & int32_t(~Node2T::MASK)) == mKeys[1][0] &&
5121 (ijk[1] & int32_t(~Node2T::MASK)) == mKeys[1][1] &&
5122 (ijk[2] & int32_t(~Node2T::MASK)) == mKeys[1][2];
5138 template<
typename RayT>
5141#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5142 const CoordValueType dirty = this->computeDirty(ijk);
5147 return mNode1->getDimAndCache(ijk, ray, *
this);
5149 return mNode2->getDimAndCache(ijk, ray, *
this);
5151 return mRoot->getDimAndCache(ijk, ray, *
this);
5154 template<
typename OpT,
typename... ArgsT>
5157#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5158 const CoordValueType dirty = this->computeDirty(ijk);
5162 if constexpr(OpT::LEVEL <= LEVEL0) {
5163 if (this->
isCached1(dirty))
return mNode1->template getAndCache<OpT>(ijk, *
this, args...);
5164 }
else if constexpr(OpT::LEVEL <= LEVEL1) {
5165 if (this->
isCached2(dirty))
return mNode2->template getAndCache<OpT>(ijk, *
this, args...);
5167 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5170 template<
typename OpT,
typename... ArgsT>
5173#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5174 const CoordValueType dirty = this->computeDirty(ijk);
5178 if constexpr(OpT::LEVEL <= LEVEL0) {
5179 if (this->
isCached1(dirty))
return const_cast<Node1T*
>(mNode1)->
template setAndCache<OpT>(ijk, *
this, args...);
5180 }
else if constexpr(OpT::LEVEL <= LEVEL1) {
5181 if (this->
isCached2(dirty))
return const_cast<Node2T*
>(mNode2)->
template setAndCache<OpT>(ijk, *
this, args...);
5183 return const_cast<RootT*
>(mRoot)->
template setAndCache<OpT>(ijk, *
this, args...);
5190 template<
typename, u
int32_t>
5191 friend class InternalNode;
5192 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5198#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5201 mKeys[0] = ijk & ~Node1T::MASK;
5205 __hostdev__ void insert(
const CoordType& ijk,
const Node2T* node)
const
5207#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5210 mKeys[1] = ijk & ~Node2T::MASK;
5214 template<
typename OtherNodeT>
5215 __hostdev__ void insert(
const CoordType&,
const OtherNodeT*)
const {}
5219template<
typename BuildT>
5220class ReadAccessor<BuildT, 0, 1, 2>
5222 using GridT = NanoGrid<BuildT>;
5223 using TreeT = NanoTree<BuildT>;
5224 using RootT = NanoRoot<BuildT>;
5225 using NodeT2 = NanoUpper<BuildT>;
5226 using NodeT1 = NanoLower<BuildT>;
5227 using LeafT = NanoLeaf<BuildT>;
5228 using CoordT =
typename RootT::CoordType;
5229 using ValueT =
typename RootT::ValueType;
5231 using FloatType =
typename RootT::FloatType;
5232 using CoordValueType =
typename RootT::CoordT::ValueType;
5235#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5236 mutable CoordT mKey;
5238 mutable CoordT mKeys[3];
5240 mutable const RootT* mRoot;
5241 mutable const void* mNode[3];
5244 using BuildType = BuildT;
5245 using ValueType = ValueT;
5246 using CoordType = CoordT;
5248 static const int CacheLevels = 3;
5252#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5253 : mKey(CoordType::max())
5255 : mKeys{CoordType::max(), CoordType::max(), CoordType::max()}
5258 , mNode{
nullptr,
nullptr,
nullptr}
5264 : ReadAccessor(grid.tree().root())
5270 : ReadAccessor(tree.root())
5274 __hostdev__ const RootT& root()
const {
return *mRoot; }
5277 ReadAccessor(
const ReadAccessor&) =
default;
5278 ~ReadAccessor() =
default;
5279 ReadAccessor& operator=(
const ReadAccessor&) =
default;
5284 template<
typename NodeT>
5287 using T =
typename NodeTrait<TreeT, NodeT::LEVEL>::type;
5288 static_assert(util::is_same<T, NodeT>::value,
"ReadAccessor::getNode: Invalid node type");
5289 return reinterpret_cast<const T*
>(mNode[NodeT::LEVEL]);
5293 __hostdev__ const typename NodeTrait<TreeT, LEVEL>::type* getNode()
const
5295 using T =
typename NodeTrait<TreeT, LEVEL>::type;
5296 static_assert(LEVEL >= 0 && LEVEL <= 2,
"ReadAccessor::getNode: Invalid node type");
5297 return reinterpret_cast<const T*
>(mNode[LEVEL]);
5303#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5304 mKey = CoordType::max();
5306 mKeys[0] = mKeys[1] = mKeys[2] = CoordType::max();
5308 mNode[0] = mNode[1] = mNode[2] =
nullptr;
5311#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5312 template<
typename NodeT>
5313 __hostdev__ bool isCached(CoordValueType dirty)
const
5315 if (!mNode[NodeT::LEVEL])
5317 if (dirty & int32_t(~NodeT::MASK)) {
5318 mNode[NodeT::LEVEL] =
nullptr;
5324 __hostdev__ CoordValueType computeDirty(
const CoordType& ijk)
const
5326 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
5329 template<
typename NodeT>
5330 __hostdev__ bool isCached(
const CoordType& ijk)
const
5332 return (ijk[0] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][0] &&
5333 (ijk[1] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][1] &&
5334 (ijk[2] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][2];
5338 __hostdev__ ValueType getValue(
const CoordType& ijk)
const {
return this->
template get<GetValue<BuildT>>(ijk);}
5339 __hostdev__ ValueType getValue(
int i,
int j,
int k)
const {
return this->
template get<GetValue<BuildT>>(CoordType(i, j, k)); }
5340 __hostdev__ ValueType operator()(
const CoordType& ijk)
const {
return this->
template get<GetValue<BuildT>>(ijk); }
5341 __hostdev__ ValueType operator()(
int i,
int j,
int k)
const {
return this->
template get<GetValue<BuildT>>(CoordType(i, j, k)); }
5342 __hostdev__ auto getNodeInfo(
const CoordType& ijk)
const {
return this->
template get<GetNodeInfo<BuildT>>(ijk); }
5343 __hostdev__ bool isActive(
const CoordType& ijk)
const {
return this->
template get<GetState<BuildT>>(ijk); }
5344 __hostdev__ bool probeValue(
const CoordType& ijk, ValueType& v)
const {
return this->
template get<ProbeValue<BuildT>>(ijk, v); }
5345 __hostdev__ const LeafT* probeLeaf(
const CoordType& ijk)
const {
return this->
template get<GetLeaf<BuildT>>(ijk); }
5347 template<
typename OpT,
typename... ArgsT>
5348 __hostdev__ typename OpT::Type get(
const CoordType& ijk, ArgsT&&... args)
const
5350#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5351 const CoordValueType dirty = this->computeDirty(ijk);
5355 if constexpr(OpT::LEVEL <=0) {
5356 if (this->isCached<LeafT>(dirty))
return ((
const LeafT*)mNode[0])->template getAndCache<OpT>(ijk, *
this, args...);
5357 }
else if constexpr(OpT::LEVEL <= 1) {
5358 if (this->isCached<NodeT1>(dirty))
return ((
const NodeT1*)mNode[1])->template getAndCache<OpT>(ijk, *
this, args...);
5359 }
else if constexpr(OpT::LEVEL <= 2) {
5360 if (this->isCached<NodeT2>(dirty))
return ((
const NodeT2*)mNode[2])->template getAndCache<OpT>(ijk, *
this, args...);
5362 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5365 template<
typename OpT,
typename... ArgsT>
5366 __hostdev__ void set(
const CoordType& ijk, ArgsT&&... args)
const
5368#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5369 const CoordValueType dirty = this->computeDirty(ijk);
5373 if constexpr(OpT::LEVEL <= 0) {
5374 if (this->isCached<LeafT>(dirty))
return ((LeafT*)mNode[0])->template setAndCache<OpT>(ijk, *
this, args...);
5375 }
else if constexpr(OpT::LEVEL <= 1) {
5376 if (this->isCached<NodeT1>(dirty))
return ((NodeT1*)mNode[1])->template setAndCache<OpT>(ijk, *
this, args...);
5377 }
else if constexpr(OpT::LEVEL <= 2) {
5378 if (this->isCached<NodeT2>(dirty))
return ((NodeT2*)mNode[2])->template setAndCache<OpT>(ijk, *
this, args...);
5380 return ((RootT*)mRoot)->template setAndCache<OpT>(ijk, *
this, args...);
5383 template<
typename RayT>
5384 __hostdev__ uint32_t getDim(
const CoordType& ijk,
const RayT& ray)
const
5386#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5387 const CoordValueType dirty = this->computeDirty(ijk);
5391 if (this->isCached<LeafT>(dirty)) {
5392 return ((LeafT*)mNode[0])->getDimAndCache(ijk, ray, *
this);
5393 }
else if (this->isCached<NodeT1>(dirty)) {
5394 return ((NodeT1*)mNode[1])->getDimAndCache(ijk, ray, *
this);
5395 }
else if (this->isCached<NodeT2>(dirty)) {
5396 return ((NodeT2*)mNode[2])->getDimAndCache(ijk, ray, *
this);
5398 return mRoot->getDimAndCache(ijk, ray, *
this);
5404 friend class RootNode;
5405 template<
typename, u
int32_t>
5406 friend class InternalNode;
5407 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5408 friend class LeafNode;
5411 template<
typename NodeT>
5412 __hostdev__ void insert(
const CoordType& ijk,
const NodeT* node)
const
5414#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5417 mKeys[NodeT::LEVEL] = ijk & ~NodeT::MASK;
5419 mNode[NodeT::LEVEL] = node;
5437template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5443template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5449template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5465 CoordBBox mIndexBBox;
5466 uint32_t mRootTableSize, mPadding{0};
5469 template<
typename T>
5472 mGridData = *grid.
data();
5473 mTreeData = *grid.
tree().data();
5475 mRootTableSize = grid.
tree().root().getTableSize();
5480 *
this = *
reinterpret_cast<const GridMetaData*
>(gridData);
5483 mGridData = *gridData;
5503 template<
typename T>
5543template<
typename AttT,
typename BuildT = u
int32_t>
5552 : AccT(
grid.tree().root())
5554 , mData(
grid.template getBlindData<AttT>(0))
5570 const uint64_t count = mGrid.blindMetaData(0u).mValueCount;
5572 end = begin + count;
5580 auto* leaf = this->probeLeaf(ijk);
5581 if (leaf ==
nullptr) {
5584 begin = mData + leaf->minimum();
5585 end = begin + leaf->maximum();
5586 return leaf->maximum();
5592 begin = end =
nullptr;
5593 if (
auto* leaf = this->probeLeaf(ijk)) {
5595 if (leaf->isActive(offset)) {
5596 begin = mData + leaf->minimum();
5597 end = begin + leaf->getValue(offset);
5599 begin += leaf->getValue(offset - 1);
5606template<
typename AttT>
5615 : AccT(
grid.tree().root())
5617 , mData(
grid.template getBlindData<AttT>(0))
5637 const uint64_t count = mGrid.blindMetaData(0u).mValueCount;
5639 end = begin + count;
5647 auto* leaf = this->probeLeaf(ijk);
5648 if (leaf ==
nullptr)
5650 begin = mData + leaf->offset();
5651 end = begin + leaf->pointCount();
5652 return leaf->pointCount();
5658 if (
auto* leaf = this->probeLeaf(ijk)) {
5660 if (leaf->isActive(n)) {
5661 begin = mData + leaf->first(n);
5662 end = mData + leaf->last(n);
5666 begin = end =
nullptr;
5674template<
typename ChannelT,
typename IndexT = ValueIndex>
5704 , mChannel(channelPtr)
5735 return mChannel =
const_cast<ChannelT*
>(mGrid.template getBlindData<ChannelT>(channelID));
5740 __hostdev__ uint64_t
idx(
int i,
int j,
int k)
const {
return BaseT::getValue(math::Coord(i, j, k)); }
5751 const bool isActive = BaseT::probeValue(ijk,
idx);
5758 template<
typename T>
5759 __hostdev__ T&
getValue(
const math::Coord& ijk, T* channelPtr)
const {
return channelPtr[BaseT::getValue(ijk)]; }
5767struct MiniGridHandle {
5772 BufferType(BufferType &&other) : data(other.data), size(other.size) {other.data=
nullptr; other.size=0;}
5773 ~BufferType() {std::free(data);}
5774 BufferType& operator=(
const BufferType &other) =
delete;
5775 BufferType& operator=(BufferType &&other){data=other.data; size=other.size; other.data=
nullptr; other.size=0;
return *
this;}
5776 static BufferType create(
size_t n, BufferType* dummy =
nullptr) {
return BufferType(n);}
5778 MiniGridHandle(BufferType &&buf) : buffer(std::move(buf)) {}
5779 const uint8_t* data()
const {
return buffer.data;}
5861#if !defined(__CUDA_ARCH__) && !defined(__HIP__)
5884template<
typename StreamT>
5890#ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS
5895 const char* gridName = gridData->
gridName();
5905 os.write((
const char*)&head,
sizeof(
FileHeader));
5907 os.write(gridName, nameSize);
5914 os.write((
const char*)&data,
sizeof(
GridData));
5917 os.write((
const char*)gridData, gridData->
mGridSize);
5929template<
typename StreamT,
typename ValueT>
5939 fprintf(stderr,
"nanovdb::writeUncompressedGrid: expected an IndexGrid but got \"%s\"\n",
toStr(str, gridData->
mGridClass));
5942 fprintf(stderr,
"nanovdb::writeUncompressedGrid: index grid already has \"%i\" blind data\n", gridData->
mBlindMetadataCount);
5947#ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS
5952 const char* gridName = gridData->
gridName();
5961 os.write((
const char*)&head,
sizeof(
FileHeader));
5963 os.write(gridName, nameSize);
5972 os.write((
const char*)&data,
sizeof(
GridData));
5978 os.write((
const char*)blindData, gridData->
mData1*
sizeof(ValueT));
5983template<
typename GridHandleT,
template<
typename...>
class VecT>
5986#ifdef NANOVDB_USE_IOSTREAMS
5987 std::ofstream os(fileName, std::ios::out | std::ios::binary | std::ios::trunc);
5991 StreamT(
const char* name) { fptr = fopen(name,
"wb"); }
5992 ~StreamT() { fclose(fptr); }
5993 void write(
const char* data,
size_t n) { fwrite(data, 1, n, fptr); }
5994 bool is_open()
const {
return fptr != NULL; }
5997 if (!os.is_open()) {
5998 fprintf(stderr,
"nanovdb::writeUncompressedGrids: Unable to open file \"%s\"for output\n", fileName);
6001 for (
auto& h : handles) {
6011template<
typename GridHandleT,
typename StreamT,
template<
typename...>
class VecT>
6012VecT<GridHandleT>
readUncompressedGrids(StreamT& is,
const typename GridHandleT::BufferType& pool =
typename GridHandleT::BufferType())
6014 VecT<GridHandleT> handles;
6016 is.read((
char*)&data,
sizeof(
GridData));
6018 uint64_t size = data.
mGridSize, sum = 0u;
6021 is.read((
char*)&data,
sizeof(
GridData));
6022 sum += data.mGridSize;
6024 is.skip(-int64_t(sum +
sizeof(
GridData)));
6025 auto buffer = GridHandleT::BufferType::create(size + sum, &pool);
6026 is.read((
char*)(buffer.data()), buffer.size());
6027 handles.emplace_back(std::move(buffer));
6031 while(is.read((
char*)&head,
sizeof(
FileHeader))) {
6033 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid magic number = \"%s\"\n", (
const char*)&(head.
magic));
6037 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid major version = \"%s\"\n",
toStr(str, head.
version));
6041 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid codec = \"%s\"\n",
toStr(str, head.
codec));
6045 for (uint16_t i = 0; i < head.
gridCount; ++i) {
6047 is.skip(meta.nameSize);
6048 auto buffer = GridHandleT::BufferType::create(meta.gridSize, &pool);
6049 is.read((
char*)buffer.data(), meta.gridSize);
6050 handles.emplace_back(std::move(buffer));
6058template<
typename GridHandleT,
template<
typename...>
class VecT>
6059VecT<GridHandleT>
readUncompressedGrids(
const char* fileName,
const typename GridHandleT::BufferType& buffer =
typename GridHandleT::BufferType())
6061#ifdef NANOVDB_USE_IOSTREAMS
6062 struct StreamT :
public std::ifstream {
6063 StreamT(
const char* name) : std::ifstream(name, std::ios::in | std::ios::binary){}
6064 void skip(int64_t off) { this->seekg(off, std::ios_base::cur); }
6069 StreamT(
const char* name) { fptr = fopen(name,
"rb"); }
6070 ~StreamT() { fclose(fptr); }
6071 bool read(
char* data,
size_t n) {
6072 size_t m = fread(data, 1, n, fptr);
6075 void skip(int64_t off) { fseek(fptr, (
long int)off, SEEK_CUR); }
6076 bool is_open()
const {
return fptr != NULL; }
6079 StreamT is(fileName);
6080 if (!is.is_open()) {
6081 fprintf(stderr,
"nanovdb::readUncompressedGrids: Unable to open file \"%s\"for input\n", fileName);
6127template<
typename BuildT>
6139template<
typename BuildT>
6152template<
typename BuildT>
6167template<
typename BuildT>
6181template<
typename BuildT>
6195template<
typename BuildT>
6209template<
typename BuildT>
6222template<
typename BuildT>
6234template<
typename BuildT>
6245template<
typename BuildT>
6259 return tile.state > 0u;
6263 v = node.mTable[n].value;
6264 return node.mValueMask.isOn(n);
6268 v = node.mTable[n].value;
6269 return node.mValueMask.isOn(n);
6280template<
typename BuildT>
6304 return NodeInfo{2u, node.dim(), node.minimum(), node.maximum(), node.average(), node.stdDeviation(), node.bbox()};
6308 return NodeInfo{1u, node.dim(), node.minimum(), node.maximum(), node.average(), node.stdDeviation(), node.bbox()};
#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
BitFlags(std::initializer_list< uint8_t > list)
Definition NanoVDB.h:948
__hostdev__ void setBitOn(std::initializer_list< uint8_t > list)
Definition NanoVDB.h:978
__hostdev__ Type getFlags() const
Definition NanoVDB.h:970
__hostdev__ void setOn()
Definition NanoVDB.h:972
BitFlags(Type mask)
Definition NanoVDB.h:947
__hostdev__ bool isMaskOn(MaskT mask) const
Definition NanoVDB.h:1012
__hostdev__ void setBitOff(uint8_t bit)
Definition NanoVDB.h:976
__hostdev__ void setOff()
Definition NanoVDB.h:973
__hostdev__ bool isBitOn(uint8_t bit) const
Definition NanoVDB.h:1009
BitFlags()
Definition NanoVDB.h:946
__hostdev__ void setMaskOff(MaskT mask)
Definition NanoVDB.h:990
__hostdev__ void initBit(std::initializer_list< uint8_t > list)
Definition NanoVDB.h:959
__hostdev__ bool isMaskOff(std::initializer_list< MaskT > list) const
return true if any of the masks in the list are off
Definition NanoVDB.h:1026
__hostdev__ void initMask(std::initializer_list< MaskT > list)
Definition NanoVDB.h:965
__hostdev__ void setBit(uint8_t bit, bool on)
Definition NanoVDB.h:1003
__hostdev__ void setBitOn(uint8_t bit)
Definition NanoVDB.h:975
__hostdev__ Type & data()
Definition NanoVDB.h:958
BitFlags(std::initializer_list< MaskT > list)
Definition NanoVDB.h:953
__hostdev__ void setMask(MaskT mask, bool on)
Definition NanoVDB.h:1005
__hostdev__ bool isOff() const
Definition NanoVDB.h:1008
__hostdev__ bool isBitOff(uint8_t bit) const
Definition NanoVDB.h:1010
__hostdev__ void setBitOff(std::initializer_list< uint8_t > list)
Definition NanoVDB.h:982
__hostdev__ void setMaskOff(std::initializer_list< MaskT > list)
Definition NanoVDB.h:998
__hostdev__ bool isMaskOn(std::initializer_list< MaskT > list) const
return true if any of the masks in the list are on
Definition NanoVDB.h:1017
__hostdev__ Type data() const
Definition NanoVDB.h:957
__hostdev__ bool isOn() const
Definition NanoVDB.h:1007
__hostdev__ void setMaskOn(std::initializer_list< MaskT > list)
Definition NanoVDB.h:993
__hostdev__ bool isMaskOff(MaskT mask) const
Definition NanoVDB.h:1014
__hostdev__ void setMaskOn(MaskT mask)
Definition NanoVDB.h:988
decltype(mFlags) Type
Definition NanoVDB.h:945
__hostdev__ BitFlags & operator=(Type n)
required for backwards compatibility
Definition NanoVDB.h:1034
__hostdev__ ChannelT & operator()(int i, int j, int k) const
Definition NanoVDB.h:5745
__hostdev__ ChannelT * setChannel(uint32_t channelID)
Change to an internal channel, assuming it exists as as blind data in the IndexGrid.
Definition NanoVDB.h:5733
NanoTree< IndexT > TreeType
Definition NanoVDB.h:5685
__hostdev__ uint64_t getIndex(const math::Coord &ijk) const
Return the linear offset into a channel that maps to the specified coordinate.
Definition NanoVDB.h:5739
__hostdev__ ChannelAccessor(const NanoGrid< IndexT > &grid, ChannelT *channelPtr)
Ctor from an IndexGrid and an external channel.
Definition NanoVDB.h:5701
__hostdev__ bool probeValue(const math::Coord &ijk, typename util::remove_const< ChannelT >::type &v) const
return the state and updates the value of the specified voxel
Definition NanoVDB.h:5748
__hostdev__ const uint64_t & valueCount() const
Return total number of values indexed by the IndexGrid.
Definition NanoVDB.h:5723
__hostdev__ ChannelT & operator()(const math::Coord &ijk) const
Definition NanoVDB.h:5744
__hostdev__ uint64_t idx(int i, int j, int k) const
Definition NanoVDB.h:5740
__hostdev__ const TreeType & tree() const
Definition NanoVDB.h:5717
__hostdev__ ChannelAccessor(const NanoGrid< IndexT > &grid, uint32_t channelID=0u)
Ctor from an IndexGrid and an integer ID of an internal channel that is assumed to exist as blind dat...
Definition NanoVDB.h:5690
__hostdev__ const NanoGrid< IndexT > & grid() const
Definition NanoVDB.h:5714
ChannelT ValueType
Definition NanoVDB.h:5684
ChannelAccessor< ChannelT, IndexT > AccessorType
Definition NanoVDB.h:5686
__hostdev__ const Vec3d & voxelSize() const
Return a vector of the axial voxel sizes.
Definition NanoVDB.h:5720
__hostdev__ T & getValue(const math::Coord &ijk, T *channelPtr) const
Return the value from a specified channel that maps to the specified coordinate.
Definition NanoVDB.h:5759
__hostdev__ ChannelT * setChannel(ChannelT *channelPtr)
Definition NanoVDB.h:5727
__hostdev__ ChannelT & getValue(const math::Coord &ijk) const
Return the value from a cached channel that maps to the specified coordinate.
Definition NanoVDB.h:5743
Class that encapsulates two CRC32 checksums, one for the Grid, Tree and Root node meta data and one f...
Definition NanoVDB.h:1818
__hostdev__ Checksum(uint64_t checksum, CheckMode mode=CheckMode::Full)
Definition NanoVDB.h:1841
__hostdev__ bool isFull() const
return true if the 64 bit checksum is fill, i.e. of both had and nodes
Definition NanoVDB.h:1867
__hostdev__ Checksum(uint32_t head, uint32_t tail)
Constructor that allows the two 32bit checksums to be initiated explicitly.
Definition NanoVDB.h:1836
__hostdev__ uint64_t checksum() const
return the 64 bit checksum of this instance
Definition NanoVDB.h:1848
__hostdev__ uint64_t full() const
Definition NanoVDB.h:1854
__hostdev__ uint64_t & full()
Definition NanoVDB.h:1855
__hostdev__ bool isEmpty() const
return true if the 64 bit checksum is disables (unset)
Definition NanoVDB.h:1870
__hostdev__ bool operator==(const Checksum &rhs) const
return true if the checksums are identical
Definition NanoVDB.h:1883
__hostdev__ Checksum()
default constructor initiates checksum to EMPTY
Definition NanoVDB.h:1831
__hostdev__ bool isHalf() const
Definition NanoVDB.h:1864
__hostdev__ uint32_t head() const
Definition NanoVDB.h:1856
__hostdev__ uint32_t & head()
Definition NanoVDB.h:1857
uint64_t mCRC64
Definition NanoVDB.h:1823
uint32_t mCRC32[2]
Definition NanoVDB.h:1823
static constexpr uint32_t EMPTY32
Definition NanoVDB.h:1827
__hostdev__ uint32_t tail() const
Definition NanoVDB.h:1858
__hostdev__ uint32_t checksum(int i) const
Definition NanoVDB.h:1852
__hostdev__ uint32_t & checksum(int i)
Definition NanoVDB.h:1850
__hostdev__ bool operator!=(const Checksum &rhs) const
return true if the checksums are not identical
Definition NanoVDB.h:1887
static constexpr uint64_t EMPTY64
Definition NanoVDB.h:1828
__hostdev__ bool isPartial() const
return true if the 64 bit checksum is partial, i.e. of head only
Definition NanoVDB.h:1863
__hostdev__ CheckMode mode() const
return the mode of the 64 bit checksum
Definition NanoVDB.h:1875
__hostdev__ uint32_t & tail()
Definition NanoVDB.h:1859
__hostdev__ void disable()
Definition NanoVDB.h:1872
Dummy type for a 16bit quantization of float point values.
Definition NanoVDB.h:190
Dummy type for a 4bit quantization of float point values.
Definition NanoVDB.h:184
Dummy type for a 8bit quantization of float point values.
Definition NanoVDB.h:187
Dummy type for a variable bit quantization of floating point values.
Definition NanoVDB.h:193
Highest level of the data structure. Contains a tree and a world->index transform (that currently onl...
Definition NanoVDB.h:2127
__hostdev__ const NanoTree< BuildT > & tree() const
Definition NanoVDB.h:2181
typename RootType::LeafNodeType LeafNodeType
Definition NanoVDB.h:2134
__hostdev__ const GridClass & gridClass() const
Definition NanoVDB.h:2256
typename TreeT::ValueType ValueType
Definition NanoVDB.h:2136
__hostdev__ DataType * data()
Definition NanoVDB.h:2150
__hostdev__ Vec3T worldToIndexF(const Vec3T &xyz) const
Definition NanoVDB.h:2220
typename TreeT::RootType RootType
Definition NanoVDB.h:2130
__hostdev__ bool hasMinMax() const
Definition NanoVDB.h:2265
__hostdev__ util::enable_if< util::is_same< T, Point >::value, constuint64_t & >::type pointCount() const
Definition NanoVDB.h:2178
__hostdev__ int findBlindData(const char *name) const
__hostdev__ const Map & map() const
Definition NanoVDB.h:2193
typename TreeT::CoordType CoordType
Definition NanoVDB.h:2138
typename RootNodeType::ChildNodeType UpperNodeType
Definition NanoVDB.h:2132
__hostdev__ const GridBlindMetaData & blindMetaData(uint32_t n) const
Definition NanoVDB.h:2332
__hostdev__ uint32_t blindDataCount() const
Definition NanoVDB.h:2298
__hostdev__ bool hasStdDeviation() const
Definition NanoVDB.h:2269
__hostdev__ BlindDataT * getBlindData(uint32_t n)
Definition NanoVDB.h:2326
__hostdev__ uint32_t gridIndex() const
Definition NanoVDB.h:2161
__hostdev__ bool isUnknown() const
Definition NanoVDB.h:2264
__hostdev__ Vec3T worldToIndexDir(const Vec3T &dir) const
Definition NanoVDB.h:2211
__hostdev__ const GridType & gridType() const
Definition NanoVDB.h:2255
__hostdev__ bool isSequential() const
Definition NanoVDB.h:2283
__hostdev__ const Checksum & checksum() const
Definition NanoVDB.h:2292
GridData DataType
Definition NanoVDB.h:2135
RootType RootNodeType
Definition NanoVDB.h:2131
__hostdev__ bool isValid() const
Definition NanoVDB.h:2254
__hostdev__ uint64_t gridSize() const
Definition NanoVDB.h:2158
__hostdev__ Version version() const
Definition NanoVDB.h:2148
__hostdev__ Vec3T indexToWorldGrad(const Vec3T &grad) const
Definition NanoVDB.h:2216
__hostdev__ bool hasLongGridName() const
Definition NanoVDB.h:2267
__hostdev__ Vec3T indexToWorldGradF(const Vec3T &grad) const
Definition NanoVDB.h:2239
__hostdev__ bool hasBBox() const
Definition NanoVDB.h:2266
__hostdev__ util::enable_if< BuildTraits< T >::is_index, constuint64_t & >::type valueCount() const
Definition NanoVDB.h:2171
__hostdev__ Vec3T indexToWorldDirF(const Vec3T &dir) const
Definition NanoVDB.h:2229
__hostdev__ const char * shortGridName() const
Definition NanoVDB.h:2289
__hostdev__ const char * gridName() const
Definition NanoVDB.h:2286
__hostdev__ bool isMask() const
Definition NanoVDB.h:2263
__hostdev__ const BlindDataT * getBlindData(uint32_t n) const
Definition NanoVDB.h:2319
__hostdev__ uint64_t activeVoxelCount() const
Definition NanoVDB.h:2251
DefaultReadAccessor< BuildType > AccessorType
Definition NanoVDB.h:2139
__hostdev__ bool isBreadthFirst() const
Definition NanoVDB.h:2270
__hostdev__ bool isPointIndex() const
Definition NanoVDB.h:2260
__hostdev__ bool hasAverage() const
Definition NanoVDB.h:2268
__hostdev__ bool isGridIndex() const
Definition NanoVDB.h:2261
__hostdev__ Vec3T indexToWorldDir(const Vec3T &dir) const
Definition NanoVDB.h:2206
__hostdev__ Vec3T indexToWorld(const Vec3T &xyz) const
Definition NanoVDB.h:2201
__hostdev__ bool isLevelSet() const
Definition NanoVDB.h:2257
__hostdev__ uint32_t gridCount() const
Definition NanoVDB.h:2164
__hostdev__ bool isPointData() const
Definition NanoVDB.h:2262
typename UpperNodeType::ChildNodeType LowerNodeType
Definition NanoVDB.h:2133
__hostdev__ AccessorType getAccessor() const
Definition NanoVDB.h:2187
__hostdev__ Vec3T worldToIndex(const Vec3T &xyz) const
Definition NanoVDB.h:2197
__hostdev__ const void * blindData(uint32_t n) const
Definition NanoVDB.h:2311
__hostdev__ const DataType * data() const
Definition NanoVDB.h:2152
__hostdev__ bool isStaggered() const
Definition NanoVDB.h:2259
__hostdev__ Vec3T worldToIndexDirF(const Vec3T &dir) const
Definition NanoVDB.h:2234
__hostdev__ Vec3T indexToWorldF(const Vec3T &xyz) const
Definition NanoVDB.h:2224
__hostdev__ const Vec3d & voxelSize() const
Definition NanoVDB.h:2190
TreeT TreeType
Definition NanoVDB.h:2129
Grid(const Grid &)=delete
Disallow constructions, copy and assignment.
typename TreeT::BuildType BuildType
Definition NanoVDB.h:2137
Grid & operator=(const Grid &)=delete
__hostdev__ bool isFogVolume() const
Definition NanoVDB.h:2258
__hostdev__ bool isSequential() const
Definition NanoVDB.h:2275
__hostdev__ int findBlindDataForSemantic(GridBlindDataSemantic semantic) const
__hostdev__ NanoTree< BuildT > & tree()
Definition NanoVDB.h:2184
Dummy type for a 16 bit floating point values (placeholder for IEEE 754 Half)
Definition NanoVDB.h:181
ValueIterator & operator=(const ValueIterator &)=default
__hostdev__ CoordT getCoord() const
Definition NanoVDB.h:4332
__hostdev__ ValueIterator(const LeafNode *parent)
Definition NanoVDB.h:4320
__hostdev__ ValueIterator()
Definition NanoVDB.h:4315
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:4327
__hostdev__ ValueIterator & operator++()
Definition NanoVDB.h:4343
__hostdev__ ValueIterator operator++(int)
Definition NanoVDB.h:4348
__hostdev__ bool isActive() const
Definition NanoVDB.h:4337
__hostdev__ CoordT getCoord() const
Definition NanoVDB.h:4298
__hostdev__ ValueOffIterator()
Definition NanoVDB.h:4282
ValueOffIterator & operator=(const ValueOffIterator &)=default
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:4293
__hostdev__ ValueOffIterator(const LeafNode *parent)
Definition NanoVDB.h:4287
__hostdev__ ValueOnIterator()
Definition NanoVDB.h:4249
__hostdev__ CoordT getCoord() const
Definition NanoVDB.h:4265
__hostdev__ ValueOnIterator(const LeafNode *parent)
Definition NanoVDB.h:4254
ValueOnIterator & operator=(const ValueOnIterator &)=default
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:4260
Leaf nodes of the VDB tree. (defaults to 8x8x8 = 512 voxels)
Definition NanoVDB.h:4222
__hostdev__ void setValueOnly(uint32_t offset, const ValueType &v)
Sets the value at the specified location but leaves its state unchanged.
Definition NanoVDB.h:4464
__hostdev__ FloatType stdDeviation() const
Return a const reference to the standard deviation of all the active values encoded in this leaf node...
Definition NanoVDB.h:4389
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4236
__hostdev__ DataType * data()
Definition NanoVDB.h:4368
typename DataType::BuildType BuildType
Definition NanoVDB.h:4234
static __hostdev__ CoordT OffsetToLocalCoord(uint32_t n)
Compute the local coordinates from a linear offset.
Definition NanoVDB.h:4399
static __hostdev__ uint32_t padding()
Definition NanoVDB.h:4434
LeafData< BuildT, CoordT, MaskT, Log2Dim > DataType
Definition NanoVDB.h:4231
CoordT CoordType
Definition NanoVDB.h:4235
friend class ReadAccessor
Definition NanoVDB.h:4534
static constexpr uint32_t MASK
Definition NanoVDB.h:4364
__hostdev__ CoordT offsetToGlobalCoord(uint32_t n) const
Definition NanoVDB.h:4409
static __hostdev__ uint32_t dim()
Return the dimension, in index space, of this leaf node (typically 8 as for openvdb leaf nodes!...
Definition NanoVDB.h:4415
LeafNode< BuildT, CoordT, MaskT, Log2Dim > LeafNodeType
Definition NanoVDB.h:4230
static constexpr uint32_t LEVEL
Definition NanoVDB.h:4365
__hostdev__ const MaskType< LOG2DIM > & getValueMask() const
Definition NanoVDB.h:4374
__hostdev__ FloatType variance() const
Return the variance of all the active values encoded in this leaf node.
Definition NanoVDB.h:4386
__hostdev__ auto set(const uint32_t n, ArgsT &&... args)
Definition NanoVDB.h:4525
LeafNode & operator=(const LeafNode &)=delete
__hostdev__ CoordT origin() const
Return the origin in index space of this leaf node.
Definition NanoVDB.h:4394
__hostdev__ ValueIterator cbeginValueAll() const
Definition NanoVDB.h:4357
static constexpr uint32_t DIM
Definition NanoVDB.h:4362
__hostdev__ const LeafNode * probeLeaf(const CoordT &) const
Definition NanoVDB.h:4489
__hostdev__ ValueOffIterator cbeginValueOff() const
Definition NanoVDB.h:4306
__hostdev__ void localToGlobalCoord(Coord &ijk) const
Converts (in place) a local index coordinate to a global index coordinate.
Definition NanoVDB.h:4407
typename DataType::FloatType FloatType
Definition NanoVDB.h:4233
__hostdev__ ValueType getFirstValue() const
Return the first value in this leaf node.
Definition NanoVDB.h:4452
static __hostdev__ uint32_t CoordToOffset(const CoordT &ijk)
Definition NanoVDB.h:4492
typename Mask< Log2Dim >::template Iterator< ON > MaskIterT
Definition NanoVDB.h:4240
__hostdev__ void setValueOnly(const CoordT &ijk, const ValueType &v)
Definition NanoVDB.h:4465
__hostdev__ FloatType average() const
Return a const reference to the average of all the active values encoded in this leaf node.
Definition NanoVDB.h:4383
__hostdev__ math::BBox< CoordT > bbox() const
Return the bounding box in index space of active values in this leaf node.
Definition NanoVDB.h:4418
__hostdev__ bool probeValue(const CoordT &ijk, ValueType &v) const
Return true if the voxel value at the given coordinate is active and updates v with the value.
Definition NanoVDB.h:4482
__hostdev__ uint8_t flags() const
Definition NanoVDB.h:4391
__hostdev__ bool hasBBox() const
Definition NanoVDB.h:4479
__hostdev__ auto set(const CoordType &ijk, ArgsT &&... args)
Definition NanoVDB.h:4519
__hostdev__ ValueOffIterator beginValueOff() const
Definition NanoVDB.h:4305
__hostdev__ ValueOnIterator beginValueOn() const
Definition NanoVDB.h:4272
static constexpr uint32_t TOTAL
Definition NanoVDB.h:4361
__hostdev__ void setValue(const CoordT &ijk, const ValueType &v)
Sets the value at the specified location and activate its state.
Definition NanoVDB.h:4459
__hostdev__ bool isActive(const CoordT &ijk) const
Return true if the voxel value at the given coordinate is active.
Definition NanoVDB.h:4468
__hostdev__ ValueType minimum() const
Return a const reference to the minimum active value encoded in this leaf node.
Definition NanoVDB.h:4377
__hostdev__ auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:4507
__hostdev__ ValueOnIterator cbeginValueOn() const
Definition NanoVDB.h:4273
MaskT< LOG2 > MaskType
Definition NanoVDB.h:4238
__hostdev__ ValueType maximum() const
Return a const reference to the maximum active value encoded in this leaf node.
Definition NanoVDB.h:4380
static constexpr uint32_t LOG2DIM
Definition NanoVDB.h:4360
__hostdev__ ValueType getLastValue() const
Return the last value in this leaf node.
Definition NanoVDB.h:4454
__hostdev__ bool isActive(uint32_t n) const
Definition NanoVDB.h:4469
LeafNode(const LeafNode &)=delete
__hostdev__ ValueType getValue(const CoordT &ijk) const
Return the voxel value at the given coordinate.
Definition NanoVDB.h:4449
LeafNode()=delete
This class cannot be constructed or deleted.
__hostdev__ bool updateBBox()
Updates the local bounding box of active voxels in this node. Return true if bbox was updated.
Definition NanoVDB.h:4572
__hostdev__ ValueIterator beginValue() const
Definition NanoVDB.h:4356
__hostdev__ uint64_t memUsage() const
return memory usage in bytes for the leaf node
Definition NanoVDB.h:4437
static constexpr uint32_t SIZE
Definition NanoVDB.h:4363
typename DataType::ValueType ValueType
Definition NanoVDB.h:4232
__hostdev__ auto get(const uint32_t n, ArgsT &&... args) const
Definition NanoVDB.h:4513
__hostdev__ ValueType getValue(uint32_t offset) const
Return the voxel value at the given offset.
Definition NanoVDB.h:4446
__hostdev__ const MaskType< LOG2DIM > & valueMask() const
Return a const reference to the bit mask of active voxels in this leaf node.
Definition NanoVDB.h:4373
__hostdev__ const DataType * data() const
Definition NanoVDB.h:4370
static constexpr uint64_t NUM_VALUES
Definition NanoVDB.h:4366
static __hostdev__ uint32_t voxelCount()
Return the total number of voxels (e.g. values) encoded in this leaf node.
Definition NanoVDB.h:4432
__hostdev__ bool isActive() const
Return true if any of the voxel value are active in this leaf node.
Definition NanoVDB.h:4472
friend class RootNode
Definition NanoVDB.h:4537
Definition NanoVDB.h:1115
DenseIterator & operator=(const DenseIterator &)=default
__hostdev__ DenseIterator & operator++()
Definition NanoVDB.h:1125
__hostdev__ DenseIterator operator++(int)
Definition NanoVDB.h:1130
__hostdev__ uint32_t pos() const
Definition NanoVDB.h:1123
__hostdev__ uint32_t operator*() const
Definition NanoVDB.h:1122
__hostdev__ DenseIterator(uint32_t pos=Mask::SIZE)
Definition NanoVDB.h:1117
Definition NanoVDB.h:1081
__hostdev__ Iterator operator++(int)
Definition NanoVDB.h:1102
__hostdev__ Iterator()
Definition NanoVDB.h:1083
Iterator & operator=(const Iterator &)=default
__hostdev__ uint32_t pos() const
Definition NanoVDB.h:1095
__hostdev__ uint32_t operator*() const
Definition NanoVDB.h:1094
__hostdev__ Iterator & operator++()
Definition NanoVDB.h:1097
__hostdev__ Iterator(uint32_t pos, const Mask *parent)
Definition NanoVDB.h:1088
Bit-mask to encode active states and facilitate sequential iterators and a fast codec for I/O compres...
Definition NanoVDB.h:1047
__hostdev__ Mask(const Mask &other)
Copy constructor.
Definition NanoVDB.h:1164
__hostdev__ bool isOff(uint32_t n) const
Return true if the given bit is NOT set.
Definition NanoVDB.h:1220
__hostdev__ void set(uint32_t n, bool on)
Set the specified bit on or off.
Definition NanoVDB.h:1279
__hostdev__ void setOn()
Set all bits on.
Definition NanoVDB.h:1292
__hostdev__ uint32_t countOn(uint32_t i) const
Return the number of lower set bits in mask up to but excluding the i'th bit.
Definition NanoVDB.h:1071
NANOVDB_HOSTDEV_DISABLE_WARNING __hostdev__ uint32_t findNext(uint32_t start) const
Definition NanoVDB.h:1362
__hostdev__ uint32_t countOn() const
Return the total number of set bits in this Mask.
Definition NanoVDB.h:1062
__hostdev__ uint64_t * words()
Return a pointer to the list of words of the bit mask.
Definition NanoVDB.h:1171
__hostdev__ Mask(bool on)
Definition NanoVDB.h:1156
__hostdev__ DenseIterator beginAll() const
Definition NanoVDB.h:1148
__hostdev__ void setOff(uint32_t n)
Set the specified bit off.
Definition NanoVDB.h:1243
__hostdev__ void setOff()
Set all bits off.
Definition NanoVDB.h:1298
Iterator< false > OffIterator
Definition NanoVDB.h:1142
Mask & operator=(const Mask &)=default
__hostdev__ Mask()
Initialize all bits to zero.
Definition NanoVDB.h:1151
__hostdev__ Mask & operator&=(const Mask &other)
Bitwise intersection.
Definition NanoVDB.h:1318
Iterator< true > OnIterator
Definition NanoVDB.h:1141
__hostdev__ util::enable_if<!util::is_same< MaskT, Mask >::value, Mask & >::type operator=(const MaskT &other)
Assignment operator that works with openvdb::util::NodeMask.
Definition NanoVDB.h:1191
__hostdev__ void toggle(uint32_t n)
Definition NanoVDB.h:1315
__hostdev__ bool operator!=(const Mask &other) const
Definition NanoVDB.h:1214
__hostdev__ bool isOff() const
Return true if none of the bits are set in this Mask.
Definition NanoVDB.h:1232
static constexpr uint32_t WORD_COUNT
Definition NanoVDB.h:1050
__hostdev__ OffIterator beginOff() const
Definition NanoVDB.h:1146
__hostdev__ void toggle()
brief Toggle the state of all bits in the mask
Definition NanoVDB.h:1310
__hostdev__ const uint64_t * words() const
Definition NanoVDB.h:1172
__hostdev__ void set(bool on)
Set all bits off.
Definition NanoVDB.h:1304
__hostdev__ OnIterator beginOn() const
Definition NanoVDB.h:1144
static __hostdev__ uint32_t wordCount()
Return the number of machine words used by this Mask.
Definition NanoVDB.h:1059
static __hostdev__ uint32_t bitCount()
Return the number of bits available in this Mask.
Definition NanoVDB.h:1056
__hostdev__ Mask & operator|=(const Mask &other)
Bitwise union.
Definition NanoVDB.h:1326
__hostdev__ bool operator==(const Mask &other) const
Definition NanoVDB.h:1205
NANOVDB_HOSTDEV_DISABLE_WARNING __hostdev__ uint32_t findPrev(uint32_t start) const
Definition NanoVDB.h:1376
__hostdev__ bool isOn(uint32_t n) const
Return true if the given bit is set.
Definition NanoVDB.h:1217
static constexpr uint32_t SIZE
Definition NanoVDB.h:1049
__hostdev__ bool isOn() const
Return true if all the bits are set in this Mask.
Definition NanoVDB.h:1223
__hostdev__ void setWord(WordT w, uint32_t n)
Definition NanoVDB.h:1182
NANOVDB_HOSTDEV_DISABLE_WARNING __hostdev__ uint32_t findFirst() const
Definition NanoVDB.h:1352
__hostdev__ Mask & operator-=(const Mask &other)
Bitwise difference.
Definition NanoVDB.h:1334
__hostdev__ Mask & operator^=(const Mask &other)
Bitwise XOR.
Definition NanoVDB.h:1342
__hostdev__ WordT getWord(uint32_t n) const
Definition NanoVDB.h:1175
__hostdev__ void setOn(uint32_t n)
Set the specified bit on.
Definition NanoVDB.h:1241
static __hostdev__ size_t memUsage()
Return the memory footprint in bytes of this Mask.
Definition NanoVDB.h:1053
__hostdev__ uint64_t voxelPoints(const Coord &ijk, const AttT *&begin, const AttT *&end) const
get iterators over attributes to points at a specific voxel location
Definition NanoVDB.h:5656
PointAccessor(const NanoGrid< Point > &grid)
Definition NanoVDB.h:5614
__hostdev__ uint64_t leafPoints(const Coord &ijk, const AttT *&begin, const AttT *&end) const
Return the number of points in the leaf node containing the coordinate ijk. If this return value is l...
Definition NanoVDB.h:5645
__hostdev__ uint64_t gridPoints(const AttT *&begin, const AttT *&end) const
Return the total number of point in the grid and set the iterators to the complete range of points.
Definition NanoVDB.h:5635
__hostdev__ const NanoGrid< Point > & grid() const
Definition NanoVDB.h:5631
__hostdev__ uint64_t voxelPoints(const Coord &ijk, const AttT *&begin, const AttT *&end) const
get iterators over attributes to points at a specific voxel location
Definition NanoVDB.h:5590
__hostdev__ uint64_t leafPoints(const Coord &ijk, const AttT *&begin, const AttT *&end) const
Return the number of points in the leaf node containing the coordinate ijk. If this return value is l...
Definition NanoVDB.h:5578
__hostdev__ uint64_t gridPoints(const AttT *&begin, const AttT *&end) const
Return the total number of point in the grid and set the iterators to the complete range of points.
Definition NanoVDB.h:5568
__hostdev__ const NanoGrid< BuildT > & grid() const
Definition NanoVDB.h:5564
PointAccessor(const NanoGrid< BuildT > &grid)
Definition NanoVDB.h:5551
Dummy type for indexing points into voxels.
Definition NanoVDB.h:196
__hostdev__ auto set(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:4864
ReadAccessor & operator=(const ReadAccessor &)=default
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:4849
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition NanoVDB.h:4814
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition NanoVDB.h:4853
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:4851
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:4850
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition NanoVDB.h:4847
typename RootT::CoordType CoordType
Definition NanoVDB.h:4809
__hostdev__ auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:4858
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition NanoVDB.h:4848
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition NanoVDB.h:4826
friend class LeafNode
Definition NanoVDB.h:4876
ReadAccessor(const ReadAccessor &)=default
Defaults constructors.
typename RootT::ValueType ValueType
Definition NanoVDB.h:4808
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition NanoVDB.h:4820
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache @node Noop since this template speci...
Definition NanoVDB.h:4833
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:4841
static const int CacheLevels
Definition NanoVDB.h:4811
BuildT BuildType
Definition NanoVDB.h:4807
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition NanoVDB.h:4846
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:4845
__hostdev__ const RootT & root() const
Definition NanoVDB.h:4835
friend class RootNode
Allow nodes to insert themselves into the cache.
Definition NanoVDB.h:4872
ReadAccessor & operator=(const ReadAccessor &)=default
__hostdev__ void set(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:4980
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:4961
CoordT CoordType
Definition NanoVDB.h:4908
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition NanoVDB.h:4913
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition NanoVDB.h:4966
__hostdev__ OpT::Type get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:4973
ValueT ValueType
Definition NanoVDB.h:4907
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:4963
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:4962
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition NanoVDB.h:4959
__hostdev__ bool isCached(const CoordType &ijk) const
Definition NanoVDB.h:4946
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition NanoVDB.h:4960
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition NanoVDB.h:4927
friend class LeafNode
Definition NanoVDB.h:4993
ReadAccessor(const ReadAccessor &)=default
Defaults constructors.
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition NanoVDB.h:4921
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition NanoVDB.h:4933
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:4953
static const int CacheLevels
Definition NanoVDB.h:4910
BuildT BuildType
Definition NanoVDB.h:4906
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition NanoVDB.h:4958
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:4957
__hostdev__ const RootT & root() const
Definition NanoVDB.h:4939
friend class RootNode
Allow nodes to insert themselves into the cache.
Definition NanoVDB.h:4989
ReadAccessor & operator=(const ReadAccessor &)=default
__hostdev__ bool isCached1(const CoordType &ijk) const
Definition NanoVDB.h:5112
__hostdev__ void set(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:5171
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:5134
CoordT CoordType
Definition NanoVDB.h:5038
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition NanoVDB.h:5043
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition NanoVDB.h:5139
__hostdev__ OpT::Type get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:5155
ValueT ValueType
Definition NanoVDB.h:5037
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:5136
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:5135
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition NanoVDB.h:5132
__hostdev__ bool isCached2(const CoordType &ijk) const
Definition NanoVDB.h:5118
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition NanoVDB.h:5133
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition NanoVDB.h:5062
friend class LeafNode
Definition NanoVDB.h:5193
ReadAccessor(const ReadAccessor &)=default
Defaults constructors.
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition NanoVDB.h:5056
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition NanoVDB.h:5068
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:5126
static const int CacheLevels
Definition NanoVDB.h:5040
BuildT BuildType
Definition NanoVDB.h:5036
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition NanoVDB.h:5131
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:5130
__hostdev__ const RootT & root() const
Definition NanoVDB.h:5079
friend class RootNode
Allow nodes to insert themselves into the cache.
Definition NanoVDB.h:5189
Definition NanoVDB.h:2116
Definition NanoVDB.h:2689
__hostdev__ TileT & operator*() const
Definition NanoVDB.h:2713
TileT * mPos
Definition NanoVDB.h:2693
__hostdev__ TileIter()
Definition NanoVDB.h:2696
TileT * mBegin
Definition NanoVDB.h:2693
__hostdev__ TileIter(DataT *data, uint32_t pos=0)
Definition NanoVDB.h:2697
typename util::match_const< ChildT, DataT >::type NodeT
Definition NanoVDB.h:2692
__hostdev__ bool isChild() const
Definition NanoVDB.h:2728
typename util::match_const< Tile, DataT >::type TileT
Definition NanoVDB.h:2691
TileT * mEnd
Definition NanoVDB.h:2693
__hostdev__ ValueT value() const
Definition NanoVDB.h:2748
__hostdev__ RootData * data() const
Definition NanoVDB.h:2723
__hostdev__ bool isValueOn() const
Definition NanoVDB.h:2738
__hostdev__ bool isValue() const
Definition NanoVDB.h:2733
__hostdev__ NodeT * child() const
Definition NanoVDB.h:2743
__hostdev__ auto pos() const
Definition NanoVDB.h:2707
__hostdev__ TileIter & operator++()
Definition NanoVDB.h:2708
__hostdev__ TileT * operator->() const
Definition NanoVDB.h:2718
__hostdev__ BaseIter(DataT *data)
Definition NanoVDB.h:2864
__hostdev__ BaseIter()
Definition NanoVDB.h:2863
typename util::match_const< Tile, RootT >::type TileT
Definition NanoVDB.h:2861
DataType::template TileIter< DataT > mTileIter
Definition NanoVDB.h:2862
__hostdev__ CoordType getOrigin() const
Definition NanoVDB.h:2870
typename util::match_const< DataType, RootT >::type DataT
Definition NanoVDB.h:2860
__hostdev__ uint32_t pos() const
Definition NanoVDB.h:2868
__hostdev__ TileT * tile() const
Definition NanoVDB.h:2869
__hostdev__ CoordType getCoord() const
Definition NanoVDB.h:2871
Definition NanoVDB.h:2876
__hostdev__ NodeT & operator*() const
Definition NanoVDB.h:2888
__hostdev__ ChildIter operator++(int)
Definition NanoVDB.h:2896
__hostdev__ ChildIter(RootT *parent)
Definition NanoVDB.h:2884
__hostdev__ ChildIter & operator++()
Definition NanoVDB.h:2890
__hostdev__ NodeT * operator->() const
Definition NanoVDB.h:2889
__hostdev__ ChildIter()
Definition NanoVDB.h:2883
Definition NanoVDB.h:2979
__hostdev__ NodeT * probeChild(ValueType &value) const
Definition NanoVDB.h:2987
__hostdev__ DenseIter operator++(int)
Definition NanoVDB.h:2999
__hostdev__ DenseIter & operator++()
Definition NanoVDB.h:2994
__hostdev__ DenseIter()
Definition NanoVDB.h:2985
__hostdev__ DenseIter(RootT *parent)
Definition NanoVDB.h:2986
__hostdev__ bool isValueOn() const
Definition NanoVDB.h:2993
Definition NanoVDB.h:2912
__hostdev__ ValueIter & operator++()
Definition NanoVDB.h:2924
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:2922
__hostdev__ ValueIter operator++(int)
Definition NanoVDB.h:2930
__hostdev__ ValueIter()
Definition NanoVDB.h:2917
__hostdev__ ValueIter(RootT *parent)
Definition NanoVDB.h:2918
__hostdev__ bool isActive() const
Definition NanoVDB.h:2923
Definition NanoVDB.h:2946
__hostdev__ ValueOnIter(RootT *parent)
Definition NanoVDB.h:2952
__hostdev__ ValueOnIter()
Definition NanoVDB.h:2951
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:2956
__hostdev__ ValueOnIter operator++(int)
Definition NanoVDB.h:2963
__hostdev__ ValueOnIter & operator++()
Definition NanoVDB.h:2957
Top-most node of the VDB tree structure.
Definition NanoVDB.h:2835
__hostdev__ const FloatType & stdDeviation() const
Definition NanoVDB.h:3052
__hostdev__ const ValueType & minimum() const
Definition NanoVDB.h:3040
__hostdev__ ConstChildIterator cbeginChild() const
Definition NanoVDB.h:2908
__hostdev__ DenseIterator beginDense()
Definition NanoVDB.h:3010
__hostdev__ const ValueType & maximum() const
Definition NanoVDB.h:3043
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:2852
ChildIter< const RootNode > ConstChildIterator
Definition NanoVDB.h:2905
__hostdev__ DataType * data()
Definition NanoVDB.h:3022
__hostdev__ bool isEmpty() const
Definition NanoVDB.h:3061
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:3066
__hostdev__ ConstValueOnIterator cbeginValueOn() const
Definition NanoVDB.h:2975
__hostdev__ ValueIterator beginValue()
Definition NanoVDB.h:2941
friend class ReadAccessor
Definition NanoVDB.h:3096
ChildT UpperNodeType
Definition NanoVDB.h:2841
typename ChildT::CoordType CoordType
Definition NanoVDB.h:2848
static constexpr uint32_t LEVEL
Definition NanoVDB.h:2854
__hostdev__ FloatType variance() const
Definition NanoVDB.h:3049
RootNode & operator=(const RootNode &)=delete
ValueOnIter< RootNode > ValueOnIterator
Definition NanoVDB.h:2971
ValueIter< const RootNode > ConstValueIterator
Definition NanoVDB.h:2939
__hostdev__ OpT::Type get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:3072
RootData< ChildT > DataType
Definition NanoVDB.h:2837
__hostdev__ const uint32_t & tileCount() const
Definition NanoVDB.h:3036
typename DataType::BuildT BuildType
Definition NanoVDB.h:2846
ValueIter< RootNode > ValueIterator
Definition NanoVDB.h:2938
RootNode(const RootNode &)=delete
ChildT ChildNodeType
Definition NanoVDB.h:2838
typename DataType::ValueT ValueType
Definition NanoVDB.h:2844
__hostdev__ ConstDenseIterator cbeginDense() const
Definition NanoVDB.h:3011
RootType RootNodeType
Definition NanoVDB.h:2840
__hostdev__ ConstValueIterator cbeginValueAll() const
Definition NanoVDB.h:2942
RootNode< ChildT > RootType
Definition NanoVDB.h:2839
typename DataType::StatsT FloatType
Definition NanoVDB.h:2845
__hostdev__ const ValueType & background() const
Definition NanoVDB.h:3033
ChildIter< RootNode > ChildIterator
Definition NanoVDB.h:2904
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:3068
__hostdev__ ValueOnIterator beginValueOn()
Definition NanoVDB.h:2974
__hostdev__ void set(const CoordType &ijk, ArgsT &&... args)
Definition NanoVDB.h:3082
friend class Tree
Definition NanoVDB.h:3099
typename ChildT::LeafNodeType LeafNodeType
Definition NanoVDB.h:2843
DefaultReadAccessor< BuildType > AccessorType
Definition NanoVDB.h:2850
math::BBox< CoordType > BBoxType
Definition NanoVDB.h:2849
ValueOnIter< const RootNode > ConstValueOnIterator
Definition NanoVDB.h:2972
__hostdev__ ConstDenseIterator cbeginChildAll() const
Definition NanoVDB.h:3012
__hostdev__ const BBoxType & bbox() const
Definition NanoVDB.h:3027
typename DataType::Tile Tile
Definition NanoVDB.h:2851
__hostdev__ uint64_t memUsage() const
Definition NanoVDB.h:3058
typename UpperNodeType::ChildNodeType LowerNodeType
Definition NanoVDB.h:2842
__hostdev__ AccessorType getAccessor() const
Definition NanoVDB.h:3020
__hostdev__ const LeafNodeType * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:3069
static __hostdev__ uint64_t memUsage(uint32_t tableSize)
Definition NanoVDB.h:3055
__hostdev__ ChildIterator beginChild()
Definition NanoVDB.h:2907
__hostdev__ const DataType * data() const
Definition NanoVDB.h:3024
RootNode()=delete
This class cannot be constructed or deleted.
__hostdev__ const uint32_t & getTableSize() const
Definition NanoVDB.h:3037
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:3064
__hostdev__ const FloatType & average() const
Definition NanoVDB.h:3046
DenseIter< const RootNode > ConstDenseIterator
Definition NanoVDB.h:3008
DenseIter< RootNode > DenseIterator
Definition NanoVDB.h:3007
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:3065
VDB Tree, which is a thin wrapper around a RootNode.
Definition NanoVDB.h:2425
typename RootT::ChildNodeType Node2
Definition NanoVDB.h:2444
__hostdev__ const NodeT * getFirstNode() const
Definition NanoVDB.h:2535
typename RootType::LeafNodeType LeafNodeType
Definition NanoVDB.h:2437
__hostdev__ DataType * data()
Definition NanoVDB.h:2454
RootT Node3
Definition NanoVDB.h:2443
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:2472
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:2459
__hostdev__ const NodeTrait< NanoRoot< BuildT >, 2 >::type * getFirstUpper() const
Definition NanoVDB.h:2565
__hostdev__ NanoRoot< BuildT > & root()
Definition NanoVDB.h:2461
__hostdev__ NodeTrait< NanoRoot< BuildT >, 1 >::type * getFirstLower()
Definition NanoVDB.h:2562
__hostdev__ uint32_t nodeCount() const
Definition NanoVDB.h:2504
typename RootNodeType::ChildNodeType UpperNodeType
Definition NanoVDB.h:2435
__hostdev__ LeafNodeType * getFirstLeaf()
Definition NanoVDB.h:2560
Tree()=delete
This class cannot be constructed or deleted.
__hostdev__ const LeafNodeType * getFirstLeaf() const
Definition NanoVDB.h:2561
__hostdev__ const ValueType & background() const
Definition NanoVDB.h:2481
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:2478
__hostdev__ auto set(const CoordType &ijk, ArgsT &&... args)
Definition NanoVDB.h:2574
RootT RootNodeType
Definition NanoVDB.h:2434
typename RootT::CoordType CoordType
Definition NanoVDB.h:2440
__hostdev__ uint64_t activeVoxelCount() const
Definition NanoVDB.h:2490
DefaultReadAccessor< BuildType > AccessorType
Definition NanoVDB.h:2441
__hostdev__ auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:2568
Tree(const Tree &)=delete
LeafNodeType Node0
Definition NanoVDB.h:2446
__hostdev__ NodeTrait< NanoRoot< BuildT >, LEVEL >::type * getFirstNode()
Definition NanoVDB.h:2545
__hostdev__ NodeT * getFirstNode()
Definition NanoVDB.h:2525
typename Node2::ChildNodeType Node1
Definition NanoVDB.h:2445
__hostdev__ uint32_t totalNodeCount() const
Definition NanoVDB.h:2516
RootT RootType
Definition NanoVDB.h:2433
__hostdev__ void extrema(ValueType &min, ValueType &max) const
Tree & operator=(const Tree &)=delete
__hostdev__ const NodeTrait< NanoRoot< BuildT >, 1 >::type * getFirstLower() const
Definition NanoVDB.h:2563
typename UpperNodeType::ChildNodeType LowerNodeType
Definition NanoVDB.h:2436
__hostdev__ AccessorType getAccessor() const
Definition NanoVDB.h:2465
typename RootT::ValueType ValueType
Definition NanoVDB.h:2438
__hostdev__ const NodeTrait< NanoRoot< BuildT >, LEVEL >::type * getFirstNode() const
Definition NanoVDB.h:2554
__hostdev__ uint32_t nodeCount(int level) const
Definition NanoVDB.h:2510
__hostdev__ const uint32_t & activeTileCount(uint32_t level) const
Definition NanoVDB.h:2497
TreeData DataType
Definition NanoVDB.h:2432
__hostdev__ const DataType * data() const
Definition NanoVDB.h:2456
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:2468
__hostdev__ NodeTrait< NanoRoot< BuildT >, 2 >::type * getFirstUpper()
Definition NanoVDB.h:2564
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:2469
__hostdev__ const NanoRoot< BuildT > & root() const
Definition NanoVDB.h:2463
typename RootT::BuildType BuildType
Definition NanoVDB.h:2439
Dummy type for a voxel whose value equals an offset into an external value array.
Definition NanoVDB.h:172
Dummy type for a voxel whose value equals its binary active state.
Definition NanoVDB.h:178
Dummy type for a voxel whose value equals an offset into an external value array of active values.
Definition NanoVDB.h:175
Bit-compacted representation of all three version numbers.
Definition NanoVDB.h:709
__hostdev__ Version(uint32_t major, uint32_t minor, uint32_t patch)
Constructor from major.minor.patch version numbers.
Definition NanoVDB.h:723
__hostdev__ uint32_t getMajor() const
Definition NanoVDB.h:736
__hostdev__ Version()
Default constructor.
Definition NanoVDB.h:714
static constexpr uint32_t End
Definition NanoVDB.h:712
__hostdev__ bool operator<=(const Version &rhs) const
Definition NanoVDB.h:732
__hostdev__ bool operator==(const Version &rhs) const
Definition NanoVDB.h:730
__hostdev__ Version(uint32_t data)
Constructor from a raw uint32_t data representation.
Definition NanoVDB.h:721
__hostdev__ int age() const
Returns the difference between major version of this instance and NANOVDB_MAJOR_VERSION_NUMBER.
Definition NanoVDB.h:743
__hostdev__ bool isCompatible() const
Definition NanoVDB.h:739
__hostdev__ bool operator>(const Version &rhs) const
Definition NanoVDB.h:733
__hostdev__ uint32_t getMinor() const
Definition NanoVDB.h:737
__hostdev__ bool operator>=(const Version &rhs) const
Definition NanoVDB.h:734
__hostdev__ bool operator<(const Version &rhs) const
Definition NanoVDB.h:731
__hostdev__ uint32_t id() const
Definition NanoVDB.h:735
__hostdev__ uint32_t getPatch() const
Definition NanoVDB.h:738
static constexpr uint32_t StrLen
Definition NanoVDB.h:712
Definition NanoVDB.h:5783
void writeUncompressedGrid(StreamT &os, const GridData *gridData, bool raw=false)
This is a standalone alternative to io::writeGrid(...,Codec::NONE) defined in util/IO....
Definition NanoVDB.h:5885
__hostdev__ Codec toCodec(const char *str)
Definition NanoVDB.h:5807
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:6012
__hostdev__ const char * toStr(char *dst, Codec codec)
Definition NanoVDB.h:5797
Codec
Define compression codecs.
Definition NanoVDB.h:5791
@ StrLen
Definition NanoVDB.h:5795
@ ZIP
Definition NanoVDB.h:5792
@ End
Definition NanoVDB.h:5794
@ BLOSC
Definition NanoVDB.h:5793
@ NONE
Definition NanoVDB.h:5791
void writeUncompressedGrids(const char *fileName, const VecT< GridHandleT > &handles, bool raw=false)
write multiple NanoVDB grids to a single file, without compression.
Definition NanoVDB.h:5984
size_t strlen(const char *str)
length of a c-sting, excluding '\0'.
Definition Util.h:153
uint32_t countOn(uint64_t v)
Definition Util.h:656
uint32_t findHighestOn(uint32_t v)
Returns the index of the highest, i.e. most significant, on bit in the specified 32 bit word.
Definition Util.h:606
char * strncpy(char *dst, const char *src, size_t max)
Copies the first num characters of src to dst. If the end of the source C string (which is signaled b...
Definition Util.h:185
bool streq(const char *lhs, const char *rhs)
Test if two null-terminated byte strings are the same.
Definition Util.h:268
static DstT * PtrAdd(void *p, int64_t offset)
Adds a byte offset to a non-const pointer to produce another non-const pointer.
Definition Util.h:512
static void * memzero(void *dst, size_t byteCount)
Zero initialization of memory.
Definition Util.h:297
char * strcpy(char *dst, const char *src)
Copy characters from src to dst.
Definition Util.h:166
uint32_t findLowestOn(uint32_t v)
Returns the index of the lowest, i.e. least significant, on bit in the specified 32 bit word.
Definition Util.h:536
static int64_t PtrDiff(const void *p, const void *q)
Compute the distance, in bytes, between two pointers, dist = p - q.
Definition Util.h:498
char * sprint(char *dst, T var1, Types... var2)
prints a variable number of string and/or numbers to a destination string
Definition Util.h:286
Definition GridHandle.h:27
__hostdev__ bool isFloatingPoint(GridType gridType)
return true if the GridType maps to a floating point type
Definition NanoVDB.h:595
Grid< Fp4Tree > Fp4Grid
Definition NanoVDB.h:4676
ReadAccessor< BuildT, 0, 1, 2 > DefaultReadAccessor
Definition NanoVDB.h:2119
PointType
Definition NanoVDB.h:388
@ Voxel32
Definition NanoVDB.h:394
@ Grid32
Definition NanoVDB.h:393
@ Voxel8
Definition NanoVDB.h:396
@ Default
Definition NanoVDB.h:397
@ PointID
Definition NanoVDB.h:389
@ World32
Definition NanoVDB.h:391
@ Disable
Definition NanoVDB.h:388
@ Voxel16
Definition NanoVDB.h:395
@ World64
Definition NanoVDB.h:390
@ Grid64
Definition NanoVDB.h:392
auto callNanoGrid(GridDataT *gridData, ArgsT &&... args)
Below is an example of the struct used for generic programming with callNanoGrid.
Definition NanoVDB.h:4725
__hostdev__ constexpr uint32_t strlen()
return the number of characters (including null termination) required to convert enum type to a strin...
Definition NanoVDB.h:204
Grid< Vec4fTree > Vec4fGrid
Definition NanoVDB.h:4686
Grid< NanoTree< BuildT > > NanoGrid
Definition NanoVDB.h:4621
__hostdev__ CheckMode toCheckMode(const Checksum &checksum)
Maps 64 bit checksum to CheckMode enum.
Definition NanoVDB.h:1893
__hostdev__ GridType toGridType()
Maps from a templated build type to a GridType enum.
Definition NanoVDB.h:830
typename NodeTrait< GridOrTreeOrRootT, LEVEL >::type NodeTraitT
Definition NanoVDB.h:1767
__hostdev__ char * toStr(char *dst, GridType gridType)
Maps a GridType to a c-string.
Definition NanoVDB.h:248
NanoTree< Vec3i > Vec3ITree
Definition NanoVDB.h:4669
Grid< Fp16Tree > Fp16Grid
Definition NanoVDB.h:4678
Grid< FloatTree > FloatGrid
Definition NanoVDB.h:4675
Grid< Vec3fTree > Vec3fGrid
Definition NanoVDB.h:4684
__hostdev__ bool isInteger(GridType gridType)
Return true if the GridType maps to a POD integer type.
Definition NanoVDB.h:621
__hostdev__ GridClass toGridClass(GridBlindDataSemantic semantics, GridClass defaultClass=GridClass::Unknown)
Maps from GridBlindDataSemantic to GridClass.
Definition NanoVDB.h:431
InternalNode< NanoLeaf< BuildT >, 4 > NanoLower
Definition NanoVDB.h:4613
Grid< Vec4dTree > Vec4dGrid
Definition NanoVDB.h:4687
typename GridTree< GridT >::type GridTreeT
Definition NanoVDB.h:2418
__hostdev__ MagicType toMagic(uint64_t magic)
maps 64 bits of magic number to enum
Definition NanoVDB.h:359
Grid< BoolTree > BoolGrid
Definition NanoVDB.h:4690
InternalNode< NanoLower< BuildT >, 5 > NanoUpper
Definition NanoVDB.h:4615
GridClass
Classes (superset of OpenVDB) that are currently supported by NanoVDB.
Definition NanoVDB.h:283
@ FogVolume
Definition NanoVDB.h:285
@ TensorGrid
Definition NanoVDB.h:292
@ VoxelVolume
Definition NanoVDB.h:290
@ End
Definition NanoVDB.h:293
@ Unknown
Definition NanoVDB.h:283
@ Topology
Definition NanoVDB.h:289
@ PointIndex
Definition NanoVDB.h:287
@ IndexGrid
Definition NanoVDB.h:291
@ PointData
Definition NanoVDB.h:288
@ Staggered
Definition NanoVDB.h:286
@ LevelSet
Definition NanoVDB.h:284
GridType
List of types that are currently supported by NanoVDB.
Definition NanoVDB.h:214
@ Vec3u8
Definition NanoVDB.h:238
@ Float
Definition NanoVDB.h:215
@ Boolean
Definition NanoVDB.h:225
@ Vec4f
Definition NanoVDB.h:231
@ Int16
Definition NanoVDB.h:217
@ StrLen
Definition NanoVDB.h:242
@ Fp4
Definition NanoVDB.h:227
@ Mask
Definition NanoVDB.h:222
@ Vec3u16
Definition NanoVDB.h:239
@ Vec4d
Definition NanoVDB.h:232
@ Fp8
Definition NanoVDB.h:228
@ End
Definition NanoVDB.h:241
@ Unknown
Definition NanoVDB.h:214
@ Index
Definition NanoVDB.h:233
@ FpN
Definition NanoVDB.h:230
@ UInt8
Definition NanoVDB.h:240
@ RGBA8
Definition NanoVDB.h:226
@ Int32
Definition NanoVDB.h:218
@ OnIndex
Definition NanoVDB.h:234
@ Half
Definition NanoVDB.h:223
@ PointIndex
Definition NanoVDB.h:237
@ Vec3d
Definition NanoVDB.h:221
@ Double
Definition NanoVDB.h:216
@ UInt32
Definition NanoVDB.h:224
@ Vec3f
Definition NanoVDB.h:220
@ Int64
Definition NanoVDB.h:219
@ Fp16
Definition NanoVDB.h:229
CheckMode
List of different modes for computing for a checksum.
Definition NanoVDB.h:1791
@ Partial
Definition NanoVDB.h:1794
@ Full
Definition NanoVDB.h:1796
@ Disable
Definition NanoVDB.h:1791
@ Half
Definition NanoVDB.h:1793
@ Empty
Definition NanoVDB.h:1792
Grid< Vec3dTree > Vec3dGrid
Definition NanoVDB.h:4685
typename NanoNode< BuildT, LEVEL >::type NanoNodeT
Definition NanoVDB.h:4654
Grid< Point > PointGrid
Definition NanoVDB.h:4691
RootNode< NanoUpper< BuildT > > NanoRoot
Definition NanoVDB.h:4617
ReadAccessor< ValueT, LEVEL0, LEVEL1, LEVEL2 > createAccessor(const NanoGrid< ValueT > &grid)
Free-standing function for convenient creation of a ReadAccessor with optional and customizable node ...
Definition NanoVDB.h:5438
NanoTree< ValueMask > MaskTree
Definition NanoVDB.h:4670
GridFlags
Grid flags which indicate what extra information is present in the grid buffer.
Definition NanoVDB.h:320
@ HasAverage
Definition NanoVDB.h:324
@ HasStdDeviation
Definition NanoVDB.h:325
@ HasLongGridName
Definition NanoVDB.h:321
@ HasMinMax
Definition NanoVDB.h:323
@ End
Definition NanoVDB.h:327
@ HasBBox
Definition NanoVDB.h:322
@ IsBreadthFirst
Definition NanoVDB.h:326
Grid< OnIndexTree > OnIndexGrid
Definition NanoVDB.h:4693
Grid< Vec3ITree > Vec3IGrid
Definition NanoVDB.h:4688
Grid< Fp8Tree > Fp8Grid
Definition NanoVDB.h:4677
__hostdev__ GridBlindDataSemantic toSemantic(GridClass gridClass, GridBlindDataSemantic defaultSemantic=GridBlindDataSemantic::Unknown)
Maps from GridClass to GridBlindDataSemantic.
Definition NanoVDB.h:463
Grid< Int64Tree > Int64Grid
Definition NanoVDB.h:4683
Tree< NanoRoot< BuildT > > NanoTree
Definition NanoVDB.h:4619
__hostdev__ GridType mapToGridType()
Definition NanoVDB.h:886
NanoTree< int32_t > Int32Tree
Definition NanoVDB.h:4662
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:4611
NanoTree< ValueOnIndex > OnIndexTree
Definition NanoVDB.h:4673
GridBlindDataClass
Blind-data Classes that are currently supported by NanoVDB.
Definition NanoVDB.h:403
@ ChannelArray
Definition NanoVDB.h:407
@ End
Definition NanoVDB.h:408
@ IndexArray
Definition NanoVDB.h:404
@ AttributeArray
Definition NanoVDB.h:405
@ GridName
Definition NanoVDB.h:406
NanoTree< double > DoubleTree
Definition NanoVDB.h:4661
NanoTree< ValueIndex > IndexTree
Definition NanoVDB.h:4672
__hostdev__ bool isFloatingPointVector(GridType gridType)
return true if the GridType maps to a floating point vec3.
Definition NanoVDB.h:609
NanoTree< Vec4d > Vec4dTree
Definition NanoVDB.h:4668
Grid< UInt32Tree > UInt32Grid
Definition NanoVDB.h:4682
NanoTree< Fp8 > Fp8Tree
Definition NanoVDB.h:4658
static __hostdev__ bool isAligned(const void *p)
return true if the specified pointer is 32 byte aligned
Definition NanoVDB.h:579
MagicType
Enums used to identify magic numbers recognized by NanoVDB.
Definition NanoVDB.h:350
@ OpenVDB
Definition NanoVDB.h:351
@ NanoGrid
Definition NanoVDB.h:353
@ Unknown
Definition NanoVDB.h:350
@ NanoVDB
Definition NanoVDB.h:352
@ NanoFile
Definition NanoVDB.h:354
typename BuildToValueMap< T >::type BuildToValueMapT
Definition NanoVDB.h:574
NanoTree< int64_t > Int64Tree
Definition NanoVDB.h:4664
__hostdev__ bool isValid(GridType gridType, GridClass gridClass)
return true if the combination of GridType and GridClass is valid.
Definition NanoVDB.h:643
NanoTree< Vec4f > Vec4fTree
Definition NanoVDB.h:4667
NanoTree< Vec3d > Vec3dTree
Definition NanoVDB.h:4666
NanoTree< Fp16 > Fp16Tree
Definition NanoVDB.h:4659
Grid< MaskTree > MaskGrid
Definition NanoVDB.h:4689
static __hostdev__ uint64_t alignmentPadding(const void *p)
return the smallest number of bytes that when added to the specified pointer results in a 32 byte ali...
Definition NanoVDB.h:582
NanoTree< FpN > FpNTree
Definition NanoVDB.h:4660
__hostdev__ bool isIndex(GridType gridType)
Return true if the GridType maps to a special index type (not a POD integer type).
Definition NanoVDB.h:634
static __hostdev__ T * alignPtr(T *p)
offset the specified pointer so it is 32 byte aligned. Works with both const and non-const pointers.
Definition NanoVDB.h:590
Grid< IndexTree > IndexGrid
Definition NanoVDB.h:4692
GridBlindDataSemantic
Blind-data Semantics that are currently understood by NanoVDB.
Definition NanoVDB.h:411
@ FogVolume
Definition NanoVDB.h:422
@ PointRadius
Definition NanoVDB.h:415
@ PointPosition
Definition NanoVDB.h:412
@ PointColor
Definition NanoVDB.h:413
@ VoxelCoords
Definition NanoVDB.h:420
@ PointVelocity
Definition NanoVDB.h:416
@ End
Definition NanoVDB.h:424
@ Unknown
Definition NanoVDB.h:411
@ GridCoords
Definition NanoVDB.h:419
@ WorldCoords
Definition NanoVDB.h:418
@ PointNormal
Definition NanoVDB.h:414
@ Staggered
Definition NanoVDB.h:423
@ LevelSet
Definition NanoVDB.h:421
@ PointId
Definition NanoVDB.h:417
Grid< Int32Tree > Int32Grid
Definition NanoVDB.h:4681
NanoTree< Vec3f > Vec3fTree
Definition NanoVDB.h:4665
NanoTree< bool > BoolTree
Definition NanoVDB.h:4671
NanoTree< uint32_t > UInt32Tree
Definition NanoVDB.h:4663
__hostdev__ GridClass mapToGridClass(GridClass defaultClass=GridClass::Unknown)
Definition NanoVDB.h:908
Grid< DoubleTree > DoubleGrid
Definition NanoVDB.h:4680
Grid< FpNTree > FpNGrid
Definition NanoVDB.h:4679
NanoTree< float > FloatTree
Definition NanoVDB.h:4656
NanoTree< Fp4 > Fp4Tree
Definition NanoVDB.h:4657
Mat3< typename promote< T0, T1 >::type > operator*(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Multiply m0 by m1 and return the resulting matrix.
Definition Mat3.h:597
#define NANOVDB_HOSTDEV_DISABLE_WARNING
Definition Util.h:94
#define __hostdev__
Definition Util.h:73
#define NANOVDB_ASSERT(x)
Definition Util.h:50
#define __device__
Definition Util.h:79
uint16_t mFlags
Definition NanoVDB.h:925
uint32_t mFlags
Definition NanoVDB.h:930
uint64_t mFlags
Definition NanoVDB.h:935
uint8_t mFlags
Definition NanoVDB.h:920
float type
Definition NanoVDB.h:556
float Type
Definition NanoVDB.h:555
float type
Definition NanoVDB.h:542
float Type
Definition NanoVDB.h:541
float type
Definition NanoVDB.h:549
float Type
Definition NanoVDB.h:548
float type
Definition NanoVDB.h:563
float Type
Definition NanoVDB.h:562
float type
Definition NanoVDB.h:535
float Type
Definition NanoVDB.h:534
uint64_t Type
Definition NanoVDB.h:569
uint64_t type
Definition NanoVDB.h:570
uint64_t Type
Definition NanoVDB.h:513
uint64_t type
Definition NanoVDB.h:514
bool Type
Definition NanoVDB.h:527
bool type
Definition NanoVDB.h:528
uint64_t Type
Definition NanoVDB.h:520
uint64_t type
Definition NanoVDB.h:521
Maps one type (e.g. the build types above) to other (actual) types.
Definition NanoVDB.h:505
T Type
Definition NanoVDB.h:506
T type
Definition NanoVDB.h:507
Define static boolean tests for template build types.
Definition NanoVDB.h:485
static constexpr bool is_offindex
Definition NanoVDB.h:489
static constexpr bool is_onindex
Definition NanoVDB.h:488
static constexpr bool is_index
Definition NanoVDB.h:487
static constexpr bool is_Fp
Definition NanoVDB.h:493
static constexpr bool is_float
Definition NanoVDB.h:495
static constexpr bool is_special
Definition NanoVDB.h:497
static constexpr bool is_FpX
Definition NanoVDB.h:491
double FloatType
Definition NanoVDB.h:823
double FloatType
Definition NanoVDB.h:793
uint64_t FloatType
Definition NanoVDB.h:805
bool FloatType
Definition NanoVDB.h:817
uint64_t FloatType
Definition NanoVDB.h:811
bool FloatType
Definition NanoVDB.h:799
float FloatType
Definition NanoVDB.h:787
Implements Tree::getDim(math::Coord)
Definition NanoVDB.h:6183
static __hostdev__ Type get(const NanoUpper< BuildT > &, uint32_t)
Definition NanoVDB.h:6188
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6187
uint32_t Type
Definition NanoVDB.h:6184
static __hostdev__ Type get(const NanoLower< BuildT > &, uint32_t)
Definition NanoVDB.h:6189
static constexpr int LEVEL
Definition NanoVDB.h:6185
static __hostdev__ Type get(const NanoLeaf< BuildT > &, uint32_t)
Definition NanoVDB.h:6190
static __hostdev__ Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6186
Return the pointer to the leaf node that contains math::Coord. Implements Tree::probeLeaf(math::Coord...
Definition NanoVDB.h:6197
static __hostdev__ Type get(const NanoUpper< BuildT > &, uint32_t)
Definition NanoVDB.h:6202
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6201
static __hostdev__ Type get(const NanoLower< BuildT > &, uint32_t)
Definition NanoVDB.h:6203
static constexpr int LEVEL
Definition NanoVDB.h:6199
const NanoLeaf< BuildT > * Type
Definition NanoVDB.h:6198
static __hostdev__ Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6200
static __hostdev__ Type get(const NanoLeaf< BuildT > &leaf, uint32_t)
Definition NanoVDB.h:6204
Return point to the lower internal node where math::Coord maps to one of its values,...
Definition NanoVDB.h:6211
const NanoLower< BuildT > * Type
Definition NanoVDB.h:6212
static __hostdev__ Type get(const NanoUpper< BuildT > &, uint32_t)
Definition NanoVDB.h:6216
static __hostdev__ Type get(const NanoLower< BuildT > &node, uint32_t)
Definition NanoVDB.h:6217
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6215
static constexpr int LEVEL
Definition NanoVDB.h:6213
static __hostdev__ Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6214
Definition NanoVDB.h:6286
uint32_t level
Definition NanoVDB.h:6287
FloatType average
Definition NanoVDB.h:6289
ValueType maximum
Definition NanoVDB.h:6288
CoordBBox bbox
Definition NanoVDB.h:6290
ValueType minimum
Definition NanoVDB.h:6288
uint32_t dim
Definition NanoVDB.h:6287
FloatType stdDevi
Definition NanoVDB.h:6289
Implements Tree::getNodeInfo(math::Coord)
Definition NanoVDB.h:6282
static __hostdev__ Type get(const NanoUpper< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6302
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &tile)
Definition NanoVDB.h:6298
static __hostdev__ Type get(const NanoLeaf< BuildT > &leaf, uint32_t n)
Definition NanoVDB.h:6310
typename NanoLeaf< BuildT >::ValueType ValueType
Definition NanoVDB.h:6283
static constexpr int LEVEL
Definition NanoVDB.h:6292
NodeInfo Type
Definition NanoVDB.h:6293
typename NanoLeaf< BuildT >::FloatType FloatType
Definition NanoVDB.h:6284
static __hostdev__ Type get(const NanoRoot< BuildT > &root)
Definition NanoVDB.h:6294
static __hostdev__ Type get(const NanoLower< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6306
Implements Tree::isActive(math::Coord)
Definition NanoVDB.h:6169
static __hostdev__ Type get(const NanoUpper< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6174
bool Type
Definition NanoVDB.h:6170
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &tile)
Definition NanoVDB.h:6173
static __hostdev__ Type get(const NanoLeaf< BuildT > &leaf, uint32_t n)
Definition NanoVDB.h:6176
static constexpr int LEVEL
Definition NanoVDB.h:6171
static __hostdev__ Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6172
static __hostdev__ Type get(const NanoLower< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6175
Return point to the root Tile where math::Coord maps to one of its values, i.e. terminates.
Definition NanoVDB.h:6236
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &tile)
Definition NanoVDB.h:6240
static constexpr int LEVEL
Definition NanoVDB.h:6238
static __hostdev__ Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6239
const typename NanoRoot< BuildT >::Tile * Type
Definition NanoVDB.h:6237
Return point to the upper internal node where math::Coord maps to one of its values,...
Definition NanoVDB.h:6224
static __hostdev__ Type get(const NanoUpper< BuildT > &node, uint32_t)
Definition NanoVDB.h:6229
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6228
static constexpr int LEVEL
Definition NanoVDB.h:6226
const NanoUpper< BuildT > * Type
Definition NanoVDB.h:6225
static __hostdev__ Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6227
Below is an example of a struct used for random get methods.
Definition NanoVDB.h:6129
static __hostdev__ Type get(const NanoUpper< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6134
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &tile)
Definition NanoVDB.h:6133
static __hostdev__ Type get(const NanoLeaf< BuildT > &leaf, uint32_t n)
Definition NanoVDB.h:6136
static constexpr int LEVEL
Definition NanoVDB.h:6131
static __hostdev__ Type get(const NanoRoot< BuildT > &root)
Definition NanoVDB.h:6132
static __hostdev__ Type get(const NanoLower< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6135
typename NanoLeaf< BuildT >::ValueType Type
Definition NanoVDB.h:6130
Struct with all the member data of the Grid (useful during serialization of an openvdb grid)
Definition NanoVDB.h:1922
__hostdev__ Vec3T applyInverseJacobian(const Vec3T &xyz) const
Definition NanoVDB.h:2011
__hostdev__ bool isEmpty() const
test if the grid is empty, e.i the root table has size 0
Definition NanoVDB.h:2107
__hostdev__ bool isRootConnected() const
return true if RootData follows TreeData in memory without any extra padding
Definition NanoVDB.h:2111
static __hostdev__ uint64_t memUsage()
Return memory usage in bytes for this class only.
Definition NanoVDB.h:2090
uint32_t mBlindMetadataCount
Definition NanoVDB.h:1938
__hostdev__ const void * treePtr() const
Definition NanoVDB.h:2030
Version mVersion
Definition NanoVDB.h:1926
uint32_t mData0
Definition NanoVDB.h:1939
__hostdev__ uint32_t nodeCount() const
Return number of nodes at LEVEL.
Definition NanoVDB.h:2058
GridType mGridType
Definition NanoVDB.h:1936
__hostdev__ void setMinMaxOn(bool on=true)
Definition NanoVDB.h:1992
uint64_t mMagic
Definition NanoVDB.h:1924
__hostdev__ void * nodePtr()
Return a non-const void pointer to the first node at LEVEL.
Definition NanoVDB.h:2047
__hostdev__ Vec3T applyIJTF(const Vec3T &xyz) const
Definition NanoVDB.h:2024
GridClass mGridClass
Definition NanoVDB.h:1935
__hostdev__ void setBBoxOn(bool on=true)
Definition NanoVDB.h:1993
__hostdev__ void setLongGridNameOn(bool on=true)
Definition NanoVDB.h:1994
uint64_t mGridSize
Definition NanoVDB.h:1930
__hostdev__ const GridBlindMetaData * blindMetaData(uint32_t n) const
Returns a const reference to the blindMetaData at the specified linear offset.
Definition NanoVDB.h:2067
__hostdev__ Vec3T applyInverseJacobianF(const Vec3T &xyz) const
Definition NanoVDB.h:2022
__hostdev__ bool isValid() const
return true if the magic number and the version are both valid
Definition NanoVDB.h:1979
__hostdev__ Vec3T applyInverseMapF(const Vec3T &xyz) const
Definition NanoVDB.h:2018
__hostdev__ void init(std::initializer_list< GridFlags > list={GridFlags::IsBreadthFirst}, uint64_t gridSize=0u, const Map &map=Map(), GridType gridType=GridType::Unknown, GridClass gridClass=GridClass::Unknown)
Definition NanoVDB.h:1945
GridData & operator=(const GridData &)=default
Use this method to initiate most member data.
__hostdev__ const CoordBBox & indexBBox() const
return AABB of active values in index space
Definition NanoVDB.h:2096
Checksum mChecksum
Definition NanoVDB.h:1925
Vec3dBBox mWorldBBox
Definition NanoVDB.h:1933
__hostdev__ uint32_t rootTableSize() const
return the root table has size
Definition NanoVDB.h:2099
__hostdev__ const char * gridName() const
Definition NanoVDB.h:2073
__hostdev__ Vec3T applyIJT(const Vec3T &xyz) const
Definition NanoVDB.h:2013
uint64_t mData1
Definition NanoVDB.h:1940
uint32_t mGridCount
Definition NanoVDB.h:1929
__hostdev__ const void * nodePtr() const
Return a non-const void pointer to the first node at LEVEL.
Definition NanoVDB.h:2035
__hostdev__ void setStdDeviationOn(bool on=true)
Definition NanoVDB.h:1996
__hostdev__ Vec3T applyMap(const Vec3T &xyz) const
Definition NanoVDB.h:2005
uint64_t mData2
Definition NanoVDB.h:1941
__hostdev__ Vec3T applyJacobianF(const Vec3T &xyz) const
Definition NanoVDB.h:2020
__hostdev__ Vec3T applyInverseMap(const Vec3T &xyz) const
Definition NanoVDB.h:2007
Map mMap
Definition NanoVDB.h:1932
__hostdev__ const Vec3dBBox & worldBBox() const
return AABB of active values in world space
Definition NanoVDB.h:2093
__hostdev__ Vec3T applyJacobian(const Vec3T &xyz) const
Definition NanoVDB.h:2009
Vec3d mVoxelSize
Definition NanoVDB.h:1934
BitFlags< 32 > mFlags
Definition NanoVDB.h:1927
char mGridName[MaxNameSize]
Definition NanoVDB.h:1931
int64_t mBlindMetadataOffset
Definition NanoVDB.h:1937
uint32_t mGridIndex
Definition NanoVDB.h:1928
static const int MaxNameSize
Definition NanoVDB.h:1923
__hostdev__ void * treePtr()
Definition NanoVDB.h:2027
__hostdev__ Vec3T applyMapF(const Vec3T &xyz) const
Definition NanoVDB.h:2016
__hostdev__ bool setGridName(const char *src)
Definition NanoVDB.h:1997
__hostdev__ void setAverageOn(bool on=true)
Definition NanoVDB.h:1995
const typename GridT::TreeType Type
Definition NanoVDB.h:2413
const typename GridT::TreeType type
Definition NanoVDB.h:2414
defines a tree type from a grid type while preserving constness
Definition NanoVDB.h:2406
typename GridT::TreeType Type
Definition NanoVDB.h:2407
typename GridT::TreeType type
Definition NanoVDB.h:2408
static __hostdev__ constexpr uint64_t memUsage()
Definition NanoVDB.h:3874
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3871
__hostdev__ float getValue(uint32_t i) const
Definition NanoVDB.h:3882
Fp16 BuildType
Definition NanoVDB.h:3869
uint16_t mCode[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:3872
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:3875
uint16_t ArrayType
Definition NanoVDB.h:3870
LeafData()=delete
This class cannot be constructed or deleted.
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:3868
static __hostdev__ constexpr uint8_t bitWidth()
Definition NanoVDB.h:3881
static __hostdev__ constexpr uint64_t memUsage()
Definition NanoVDB.h:3807
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3804
__hostdev__ float getValue(uint32_t i) const
Definition NanoVDB.h:3815
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
uint8_t mCode[1u<<(3 *LOG2DIM - 1)]
Definition NanoVDB.h:3805
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:3808
LeafData()=delete
This class cannot be constructed or deleted.
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:3801
uint8_t ArrayType
Definition NanoVDB.h:3803
Fp4 BuildType
Definition NanoVDB.h:3802
static __hostdev__ constexpr uint8_t bitWidth()
Definition NanoVDB.h:3814
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3841
__hostdev__ float getValue(uint32_t i) const
Definition NanoVDB.h:3851
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:3844
LeafData()=delete
This class cannot be constructed or deleted.
Fp8 BuildType
Definition NanoVDB.h:3839
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:3838
uint8_t ArrayType
Definition NanoVDB.h:3840
static __hostdev__ constexpr int64_t memUsage()
Definition NanoVDB.h:3843
uint8_t mCode[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:3842
static __hostdev__ constexpr uint8_t bitWidth()
Definition NanoVDB.h:3850
FpN BuildType
Definition NanoVDB.h:3902
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3903
__hostdev__ float getValue(uint32_t i) const
Definition NanoVDB.h:3913
static __hostdev__ size_t memUsage(uint32_t bitWidth)
Definition NanoVDB.h:3912
__hostdev__ uint8_t bitWidth() const
Definition NanoVDB.h:3910
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:3904
LeafData()=delete
This class cannot be constructed or deleted.
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:3901
__hostdev__ size_t memUsage() const
Definition NanoVDB.h:3911
uint64_t mOffset
Definition NanoVDB.h:4167
uint16_t mValues[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:4169
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4160
__hostdev__ void setMin(const ValueType &)
Definition NanoVDB.h:4199
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:4179
__hostdev__ void setDev(const FloatType &)
Definition NanoVDB.h:4202
__hostdev__ void setValueOnly(uint32_t offset, uint16_t value)
Definition NanoVDB.h:4186
uint64_t ValueType
Definition NanoVDB.h:4156
__hostdev__ uint64_t last(uint32_t i) const
Definition NanoVDB.h:4184
uint8_t mFlags
Definition NanoVDB.h:4164
LeafData & operator=(const LeafData &)=delete
__hostdev__ void setValue(uint32_t offset, uint16_t value)
Definition NanoVDB.h:4187
LeafData(const LeafData &)=delete
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:4165
CoordT mBBoxMin
Definition NanoVDB.h:4162
uint8_t mBBoxDif[3]
Definition NanoVDB.h:4163
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:4192
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:4175
Point BuildType
Definition NanoVDB.h:4157
__hostdev__ void setAvg(const FloatType &)
Definition NanoVDB.h:4201
uint16_t ArrayType
Definition NanoVDB.h:4159
__hostdev__ ValueType getMax() const
Definition NanoVDB.h:4195
typename FloatTraits< ValueType >::FloatType FloatType
Definition NanoVDB.h:4158
__hostdev__ uint64_t offset() const
Definition NanoVDB.h:4181
LeafData()=delete
This class cannot be constructed or deleted.
__hostdev__ uint64_t first(uint32_t i) const
Definition NanoVDB.h:4183
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:4205
__hostdev__ FloatType getDev() const
Definition NanoVDB.h:4197
__hostdev__ uint64_t getValue(uint32_t i) const
Definition NanoVDB.h:4185
uint64_t mPointCount
Definition NanoVDB.h:4168
__hostdev__ FloatType getAvg() const
Definition NanoVDB.h:4196
__hostdev__ void setMax(const ValueType &)
Definition NanoVDB.h:4200
__hostdev__ ValueType getMin() const
Definition NanoVDB.h:4194
__hostdev__ uint64_t pointCount() const
Definition NanoVDB.h:4182
static __hostdev__ uint32_t valueCount()
Definition NanoVDB.h:4109
__hostdev__ uint64_t getMax() const
Definition NanoVDB.h:4114
ValueIndex BuildType
Definition NanoVDB.h:4107
LeafIndexBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:4106
__hostdev__ uint64_t getAvg() const
Definition NanoVDB.h:4115
__hostdev__ uint64_t getValue(uint32_t i) const
Definition NanoVDB.h:4117
__hostdev__ uint64_t lastOffset() const
Definition NanoVDB.h:4111
__hostdev__ uint64_t getDev() const
Definition NanoVDB.h:4116
__hostdev__ uint64_t getMin() const
Definition NanoVDB.h:4113
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4020
__hostdev__ void setMin(const ValueType &)
Definition NanoVDB.h:4042
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:4028
__hostdev__ bool getDev() const
Definition NanoVDB.h:4039
__hostdev__ bool getValue(uint32_t i) const
Definition NanoVDB.h:4035
__hostdev__ void setDev(const FloatType &)
Definition NanoVDB.h:4045
ValueMask BuildType
Definition NanoVDB.h:4017
uint8_t mFlags
Definition NanoVDB.h:4024
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
__hostdev__ void setValue(uint32_t offset, bool)
Definition NanoVDB.h:4040
static __hostdev__ bool hasStats()
Definition NanoVDB.h:4029
__hostdev__ bool getMax() const
Definition NanoVDB.h:4037
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:4025
CoordT mBBoxMin
Definition NanoVDB.h:4022
bool ValueType
Definition NanoVDB.h:4016
uint8_t mBBoxDif[3]
Definition NanoVDB.h:4023
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:4041
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:4030
__hostdev__ void setAvg(const FloatType &)
Definition NanoVDB.h:4044
LeafData()=delete
This class cannot be constructed or deleted.
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:4048
uint64_t mPadding[2]
Definition NanoVDB.h:4026
__hostdev__ bool getMin() const
Definition NanoVDB.h:4036
bool FloatType
Definition NanoVDB.h:4018
__hostdev__ void setMax(const ValueType &)
Definition NanoVDB.h:4043
__hostdev__ bool getAvg() const
Definition NanoVDB.h:4038
void ArrayType
Definition NanoVDB.h:4019
__hostdev__ uint64_t getMax() const
Definition NanoVDB.h:4134
LeafIndexBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:4126
__hostdev__ uint64_t getAvg() const
Definition NanoVDB.h:4135
__hostdev__ uint64_t getValue(uint32_t i) const
Definition NanoVDB.h:4137
__hostdev__ uint64_t lastOffset() const
Definition NanoVDB.h:4132
__hostdev__ uint64_t getDev() const
Definition NanoVDB.h:4136
__hostdev__ uint64_t getMin() const
Definition NanoVDB.h:4133
__hostdev__ uint32_t valueCount() const
Definition NanoVDB.h:4128
ValueOnIndex BuildType
Definition NanoVDB.h:4127
bool BuildType
Definition NanoVDB.h:3967
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3970
__hostdev__ void setMax(const bool &)
Definition NanoVDB.h:3994
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:3980
__hostdev__ bool getDev() const
Definition NanoVDB.h:3986
__hostdev__ bool getValue(uint32_t i) const
Definition NanoVDB.h:3982
uint8_t mFlags
Definition NanoVDB.h:3974
LeafData & operator=(const LeafData &)=delete
__hostdev__ void setAvg(const bool &)
Definition NanoVDB.h:3995
LeafData(const LeafData &)=delete
MaskT< LOG2DIM > ArrayType
Definition NanoVDB.h:3969
static __hostdev__ bool hasStats()
Definition NanoVDB.h:3981
__hostdev__ void setMin(const bool &)
Definition NanoVDB.h:3993
__hostdev__ bool getMax() const
Definition NanoVDB.h:3984
__hostdev__ void setDev(const bool &)
Definition NanoVDB.h:3996
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:3975
MaskT< LOG2DIM > mValues
Definition NanoVDB.h:3976
CoordT mBBoxMin
Definition NanoVDB.h:3972
bool ValueType
Definition NanoVDB.h:3966
uint8_t mBBoxDif[3]
Definition NanoVDB.h:3973
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:3992
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:3979
LeafData()=delete
This class cannot be constructed or deleted.
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:3999
__hostdev__ void setValue(uint32_t offset, bool v)
Definition NanoVDB.h:3987
uint64_t mPadding[2]
Definition NanoVDB.h:3977
__hostdev__ bool getMin() const
Definition NanoVDB.h:3983
bool FloatType
Definition NanoVDB.h:3968
__hostdev__ bool getAvg() const
Definition NanoVDB.h:3985
ValueType mMaximum
Definition NanoVDB.h:3663
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3655
typename FloatTraits< ValueT >::FloatType FloatType
Definition NanoVDB.h:3653
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:3675
FloatType mAverage
Definition NanoVDB.h:3664
__hostdev__ void setAvg(const FloatType &v)
Definition NanoVDB.h:3702
uint8_t mFlags
Definition NanoVDB.h:3659
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static __hostdev__ bool hasStats()
Definition NanoVDB.h:3677
ValueT ValueType
Definition NanoVDB.h:3651
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:3660
CoordT mBBoxMin
Definition NanoVDB.h:3657
uint8_t mBBoxDif[3]
Definition NanoVDB.h:3658
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:3686
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:3671
__hostdev__ ValueType getValue(uint32_t i) const
Definition NanoVDB.h:3679
__hostdev__ void fill(const ValueType &v)
Definition NanoVDB.h:3711
__hostdev__ ValueType getMax() const
Definition NanoVDB.h:3689
LeafData()=delete
This class cannot be constructed or deleted.
ValueT ArrayType
Definition NanoVDB.h:3654
__hostdev__ void setMin(const ValueType &v)
Definition NanoVDB.h:3700
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:3709
__hostdev__ void setValueOnly(uint32_t offset, const ValueType &value)
Definition NanoVDB.h:3680
__hostdev__ FloatType getDev() const
Definition NanoVDB.h:3691
ValueType mMinimum
Definition NanoVDB.h:3662
__hostdev__ FloatType getAvg() const
Definition NanoVDB.h:3690
__hostdev__ void setValue(uint32_t offset, const ValueType &value)
Definition NanoVDB.h:3681
ValueT BuildType
Definition NanoVDB.h:3652
ValueType mValues[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:3666
FloatType mStdDevi
Definition NanoVDB.h:3665
__hostdev__ ValueType getMin() const
Definition NanoVDB.h:3688
__hostdev__ void setMax(const ValueType &v)
Definition NanoVDB.h:3701
__hostdev__ void setDev(const FloatType &v)
Definition NanoVDB.h:3703
Base-class for quantized float leaf nodes.
Definition NanoVDB.h:3729
__hostdev__ float getAvg() const
return the quantized average of the active values in this node
Definition NanoVDB.h:3770
float ValueType
Definition NanoVDB.h:3732
__hostdev__ float getMax() const
return the quantized maximum of the active values in this node
Definition NanoVDB.h:3767
__hostdev__ float getDev() const
return the quantized standard deviation of the active values in this node
Definition NanoVDB.h:3774
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:3744
__hostdev__ void setDev(float dev)
Definition NanoVDB.h:3786
uint16_t mMax
Definition NanoVDB.h:3742
uint8_t mFlags
Definition NanoVDB.h:3737
uint16_t mMin
Definition NanoVDB.h:3742
static __hostdev__ bool hasStats()
Definition NanoVDB.h:3746
__hostdev__ void setAvg(float avg)
Definition NanoVDB.h:3783
float mQuantum
Definition NanoVDB.h:3741
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:3738
uint16_t mAvg
Definition NanoVDB.h:3742
CoordT mBBoxMin
Definition NanoVDB.h:3735
uint8_t mBBoxDif[3]
Definition NanoVDB.h:3736
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:3761
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:3751
float mMinimum
Definition NanoVDB.h:3740
float FloatType
Definition NanoVDB.h:3733
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:3789
uint16_t mDev
Definition NanoVDB.h:3742
__hostdev__ void init(float min, float max, uint8_t bitWidth)
Definition NanoVDB.h:3755
__hostdev__ void setMin(float min)
Definition NanoVDB.h:3777
__hostdev__ void setMax(float max)
Definition NanoVDB.h:3780
__hostdev__ float getMin() const
return the quantized minimum of the active values in this node
Definition NanoVDB.h:3764
uint64_t mOffset
Definition NanoVDB.h:4074
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4068
__hostdev__ const uint64_t & firstOffset() const
Definition NanoVDB.h:4082
__hostdev__ void setMin(const ValueType &)
Definition NanoVDB.h:4083
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:4079
__hostdev__ void setDev(const FloatType &)
Definition NanoVDB.h:4086
uint64_t ValueType
Definition NanoVDB.h:4065
uint64_t FloatType
Definition NanoVDB.h:4066
uint8_t mFlags
Definition NanoVDB.h:4072
uint64_t mPrefixSum
Definition NanoVDB.h:4074
LeafIndexBase & operator=(const LeafIndexBase &)=default
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:4073
LeafIndexBase(const LeafIndexBase &)=default
CoordT mBBoxMin
Definition NanoVDB.h:4070
uint8_t mBBoxDif[3]
Definition NanoVDB.h:4071
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:4087
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:4075
__hostdev__ void setAvg(const FloatType &)
Definition NanoVDB.h:4085
__hostdev__ bool hasStats() const
Definition NanoVDB.h:4080
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:4089
LeafIndexBase()=default
This class should be used as an abstract class and only constructed or deleted via child classes.
__hostdev__ void setMax(const ValueType &)
Definition NanoVDB.h:4084
void ArrayType
Definition NanoVDB.h:4067
Definition NanoVDB.h:4225
static __hostdev__ uint32_t dim()
Definition NanoVDB.h:4228
static constexpr uint32_t DIM
Definition NanoVDB.h:4227
static constexpr uint32_t TOTAL
Definition NanoVDB.h:4226
Defines an affine transform and its inverse represented as a 3x3 matrix and a vec3 translation.
Definition NanoVDB.h:1396
double mTaperD
Definition NanoVDB.h:1404
__hostdev__ Map()
Default constructor for the identity map.
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:1439
__hostdev__ Vec3d getVoxelSize() const
Return a voxels size in each coordinate direction, measured at the origin.
Definition NanoVDB.h:1530
__hostdev__ Vec3T applyInverseJacobian(const Vec3T &xyz) const
Apply the linear inverse 3x3 transformation to an input 3d vector using 64bit floating point arithmet...
Definition NanoVDB.h:1507
double mVecD[3]
Definition NanoVDB.h:1403
float mInvMatF[9]
Definition NanoVDB.h:1398
__hostdev__ Vec3T applyIJTF(const Vec3T &xyz) const
Definition NanoVDB.h:1527
__hostdev__ Vec3T applyMap(const Vec3T &ijk) const
Apply the forward affine transformation to a vector using 64bit floating point arithmetics.
Definition NanoVDB.h:1450
__hostdev__ Vec3T applyInverseJacobianF(const Vec3T &xyz) const
Apply the linear inverse 3x3 transformation to an input 3d vector using 32bit floating point arithmet...
Definition NanoVDB.h:1516
__hostdev__ Vec3T applyJacobian(const Vec3T &ijk) const
Apply the linear forward 3x3 transformation to an input 3d vector using 64bit floating point arithmet...
Definition NanoVDB.h:1467
__hostdev__ Vec3T applyInverseMapF(const Vec3T &xyz) const
Apply the inverse affine mapping to a vector using 32bit floating point arithmetics.
Definition NanoVDB.h:1495
double mInvMatD[9]
Definition NanoVDB.h:1402
__hostdev__ Vec3T applyIJT(const Vec3T &xyz) const
Apply the transposed inverse 3x3 transformation to an input 3d vector using 64bit floating point arit...
Definition NanoVDB.h:1525
float mMatF[9]
Definition NanoVDB.h:1397
__hostdev__ Vec3T applyInverseMap(const Vec3T &xyz) const
Apply the inverse affine mapping to a vector using 64bit floating point arithmetics.
Definition NanoVDB.h:1484
double mMatD[9]
Definition NanoVDB.h:1401
__hostdev__ Map(double s, const Vec3d &t=Vec3d(0.0, 0.0, 0.0))
Definition NanoVDB.h:1418
__hostdev__ Vec3T applyMapF(const Vec3T &ijk) const
Apply the forward affine transformation to a vector using 32bit floating point arithmetics.
Definition NanoVDB.h:1458
__hostdev__ Vec3T applyJacobianF(const Vec3T &ijk) const
Apply the linear forward 3x3 transformation to an input 3d vector using 32bit floating point arithmet...
Definition NanoVDB.h:1476
float mTaperF
Definition NanoVDB.h:1400
float mVecF[3]
Definition NanoVDB.h:1399
void set(const MatT &mat, const MatT &invMat, const Vec3T &translate, double taper=1.0)
Initialize the member data from 3x3 or 4x4 matrices.
Definition NanoVDB.h:1534
NanoLeaf< BuildT > type
Definition NanoVDB.h:4632
NanoLeaf< BuildT > Type
Definition NanoVDB.h:4631
NanoLower< BuildT > Type
Definition NanoVDB.h:4637
NanoLower< BuildT > type
Definition NanoVDB.h:4638
NanoUpper< BuildT > type
Definition NanoVDB.h:4644
NanoUpper< BuildT > Type
Definition NanoVDB.h:4643
NanoRoot< BuildT > type
Definition NanoVDB.h:4650
NanoRoot< BuildT > Type
Definition NanoVDB.h:4649
Trait to map from LEVEL to node type.
Definition NanoVDB.h:4625
typename GridOrTreeOrRootT::LeafNodeType type
Definition NanoVDB.h:1712
typename GridOrTreeOrRootT::LeafNodeType Type
Definition NanoVDB.h:1711
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType Type
Definition NanoVDB.h:1726
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType type
Definition NanoVDB.h:1727
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType type
Definition NanoVDB.h:1741
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType Type
Definition NanoVDB.h:1740
typename GridOrTreeOrRootT::RootNodeType type
Definition NanoVDB.h:1755
typename GridOrTreeOrRootT::RootNodeType Type
Definition NanoVDB.h:1754
const typename GridOrTreeOrRootT::LeafNodeType Type
Definition NanoVDB.h:1718
const typename GridOrTreeOrRootT::LeafNodeType type
Definition NanoVDB.h:1719
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType type
Definition NanoVDB.h:1734
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType Type
Definition NanoVDB.h:1733
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType Type
Definition NanoVDB.h:1747
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType type
Definition NanoVDB.h:1748
const typename GridOrTreeOrRootT::RootNodeType type
Definition NanoVDB.h:1763
const typename GridOrTreeOrRootT::RootNodeType Type
Definition NanoVDB.h:1762
Struct to derive node type from its level in a given grid, tree or root while preserving constness.
Definition NanoVDB.h:1704
Implements Tree::probeLeaf(math::Coord)
Definition NanoVDB.h:6247
static __hostdev__ Type get(const NanoLeaf< BuildT > &leaf, uint32_t n, ValueT &v)
Definition NanoVDB.h:6271
bool Type
Definition NanoVDB.h:6248
static __hostdev__ Type get(const NanoLower< BuildT > &node, uint32_t n, ValueT &v)
Definition NanoVDB.h:6266
typename BuildToValueMap< BuildT >::Type ValueT
Definition NanoVDB.h:6250
static constexpr int LEVEL
Definition NanoVDB.h:6249
static __hostdev__ Type get(const NanoUpper< BuildT > &node, uint32_t n, ValueT &v)
Definition NanoVDB.h:6261
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &tile, ValueT &v)
Definition NanoVDB.h:6256
static __hostdev__ Type get(const NanoRoot< BuildT > &root, ValueT &v)
Definition NanoVDB.h:6251
Definition NanoVDB.h:2647
ValueT value
Definition NanoVDB.h:2670
uint32_t state
Definition NanoVDB.h:2669
__hostdev__ bool isChild() const
Definition NanoVDB.h:2663
KeyT key
Definition NanoVDB.h:2667
__hostdev__ CoordT origin() const
Definition NanoVDB.h:2666
__hostdev__ bool isValue() const
Definition NanoVDB.h:2664
int64_t child
Definition NanoVDB.h:2668
__hostdev__ void setChild(const CoordType &k, const void *ptr, const RootData *data)
Definition NanoVDB.h:2649
__hostdev__ void setValue(const CoordType &k, bool s, const ValueType &v)
Definition NanoVDB.h:2656
__hostdev__ bool isActive() const
Definition NanoVDB.h:2665
StatsT mAverage
Definition NanoVDB.h:2635
typename ChildT::CoordType CoordT
Definition NanoVDB.h:2601
RootData()=delete
This class cannot be constructed or deleted.
__hostdev__ void setMin(const ValueT &v)
Definition NanoVDB.h:2818
__hostdev__ const StatsT & average() const
Definition NanoVDB.h:2815
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:2603
__hostdev__ const ValueT & getMin() const
Definition NanoVDB.h:2813
__hostdev__ Tile * probeTile(const CoordT &ijk)
Definition NanoVDB.h:2777
__hostdev__ TileIterator beginTile()
Definition NanoVDB.h:2758
ValueT mBackground
Definition NanoVDB.h:2632
__hostdev__ ConstTileIterator probe(const CoordT &ijk) const
Definition NanoVDB.h:2769
__hostdev__ const ValueT & getMax() const
Definition NanoVDB.h:2814
__hostdev__ ChildT * getChild(const Tile *tile)
Returns a const reference to the child node in the specified tile.
Definition NanoVDB.h:2802
__hostdev__ void setDev(const StatsT &v)
Definition NanoVDB.h:2821
uint32_t mTableSize
Definition NanoVDB.h:2630
math::BBox< CoordT > mBBox
Definition NanoVDB.h:2629
uint64_t KeyT
Return a key based on the coordinates of a voxel.
Definition NanoVDB.h:2607
__hostdev__ ConstTileIterator cbeginTile() const
Definition NanoVDB.h:2759
__hostdev__ ChildT * probeChild(const CoordT &ijk)
Definition NanoVDB.h:2788
typename ChildT::FloatType StatsT
Definition NanoVDB.h:2602
__hostdev__ void setAvg(const StatsT &v)
Definition NanoVDB.h:2820
__hostdev__ const Tile * tile(uint32_t n) const
Returns a pointer to the tile at the specified linear offset.
Definition NanoVDB.h:2676
__hostdev__ const Tile * probeTile(const CoordT &ijk) const
Definition NanoVDB.h:2783
typename ChildT::BuildType BuildT
Definition NanoVDB.h:2600
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:2641
StatsT mStdDevi
Definition NanoVDB.h:2636
RootData(const RootData &)=delete
static __hostdev__ CoordT KeyToCoord(const KeyT &key)
Definition NanoVDB.h:2617
RootData & operator=(const RootData &)=delete
static __hostdev__ KeyT CoordToKey(const CoordType &ijk)
Definition NanoVDB.h:2609
__hostdev__ void setMax(const ValueT &v)
Definition NanoVDB.h:2819
ValueT mMaximum
Definition NanoVDB.h:2634
__hostdev__ TileIterator probe(const CoordT &ijk)
Definition NanoVDB.h:2761
__hostdev__ const StatsT & stdDeviation() const
Definition NanoVDB.h:2816
__hostdev__ Tile * tile(uint32_t n)
Definition NanoVDB.h:2681
typename ChildT::ValueType ValueT
Definition NanoVDB.h:2599
TileIter< const RootData > ConstTileIterator
Definition NanoVDB.h:2756
__hostdev__ const ChildT * probeChild(const CoordT &ijk) const
Definition NanoVDB.h:2794
__hostdev__ const ChildT * getChild(const Tile *tile) const
Definition NanoVDB.h:2807
TileIter< RootData > TileIterator
Definition NanoVDB.h:2755
ValueT mMinimum
Definition NanoVDB.h:2633
Definition NanoVDB.h:6141
static __hostdev__ void set(NanoLower< BuildT > &node, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6148
static __hostdev__ void set(NanoRoot< BuildT > &, const ValueT &)
Definition NanoVDB.h:6145
static __hostdev__ void set(NanoUpper< BuildT > &node, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6147
static constexpr int LEVEL
Definition NanoVDB.h:6144
static __hostdev__ void set(NanoLeaf< BuildT > &leaf, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6149
typename NanoLeaf< BuildT >::ValueType ValueT
Definition NanoVDB.h:6143
static __hostdev__ void set(typename NanoRoot< BuildT >::Tile &tile, const ValueT &v)
Definition NanoVDB.h:6146
Definition NanoVDB.h:6154
static __hostdev__ void set(NanoLower< BuildT > &, uint32_t, const ValueT &)
Definition NanoVDB.h:6161
static __hostdev__ void set(NanoRoot< BuildT > &, const ValueT &)
Definition NanoVDB.h:6158
static __hostdev__ void set(NanoUpper< BuildT > &, uint32_t, const ValueT &)
Definition NanoVDB.h:6160
static constexpr int LEVEL
Definition NanoVDB.h:6157
static __hostdev__ void set(NanoLeaf< BuildT > &leaf, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6162
static __hostdev__ void set(typename NanoRoot< BuildT >::Tile &, const ValueT &)
Definition NanoVDB.h:6159
typename NanoLeaf< BuildT >::ValueType ValueT
Definition NanoVDB.h:6156
T ElementType
Definition NanoVDB.h:767
static const int Rank
Definition NanoVDB.h:763
static const int Size
Definition NanoVDB.h:766
static T scalar(const T &s)
Definition NanoVDB.h:768
static const bool IsVector
Definition NanoVDB.h:765
static const bool IsScalar
Definition NanoVDB.h:764
static ElementType scalar(const T &v)
Definition NanoVDB.h:779
static const int Rank
Definition NanoVDB.h:774
static const int Size
Definition NanoVDB.h:777
typename T::ValueType ElementType
Definition NanoVDB.h:778
static const bool IsVector
Definition NanoVDB.h:776
static const bool IsScalar
Definition NanoVDB.h:775
Definition NanoVDB.h:2370
__hostdev__ const void * getRoot() const
Get a const void pointer to the root node (never NULL)
Definition NanoVDB.h:2386
__hostdev__ bool isEmpty() const
Return true if the root is empty, i.e. has not child nodes or constant tiles.
Definition NanoVDB.h:2392
int64_t mNodeOffset[4]
Definition NanoVDB.h:2371
__hostdev__ bool isRootNext() const
return true if RootData is layout out immediately after TreeData in memory
Definition NanoVDB.h:2398
TreeData & operator=(const TreeData &)=default
__hostdev__ void setRoot(const void *root)
Definition NanoVDB.h:2377
uint32_t mNodeCount[3]
Definition NanoVDB.h:2372
__hostdev__ void * getRoot()
Get a non-const void pointer to the root node (never NULL)
Definition NanoVDB.h:2383
uint32_t mTileCount[3]
Definition NanoVDB.h:2373
__hostdev__ void setFirstNode(const NodeT *node)
Definition NanoVDB.h:2389
__hostdev__ CoordBBox bbox() const
Return the index bounding box of all the active values in this tree, i.e. in all nodes of the tree.
Definition NanoVDB.h:2395
uint64_t mVoxelCount
Definition NanoVDB.h:2374
C++11 implementation of std::enable_if.
Definition Util.h:341
static constexpr bool value
Definition Util.h:332
C++11 implementation of std::is_same.
Definition Util.h:315
static constexpr bool value
Definition Util.h:316
typename remove_const< T >::type type
Definition Util.h:461
T type
Definition Util.h:408