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 8
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)
209template <
class EnumT>
210__hostdev__ inline constexpr uint32_t
strlen(){
return (uint32_t)EnumT::StrLen - (uint32_t)EnumT::End;}
637 switch (blindClass) {
689 : mData(major << 21 | minor << 10 | patch)
722template<
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>
733 static T
scalar(
const T& s) {
return s; }
742 static const int Size = T::SIZE;
749template<
typename T,
int = sizeof(
typename TensorTraits<T>::ElementType)>
806template<
typename BuildT>
865template<
typename BuildT>
866[[deprecated(
"Use toGridType<T>() instead.")]]
872template<
typename BuildT>
887template<
typename BuildT>
888[[deprecated(
"Use toGridClass<T>() instead.")]]
931 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
933 template<
typename MaskT>
936 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
943 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
945 template<
typename MaskT>
949 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
961 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
965 for (
auto bit : list) mFlags &= ~static_cast<Type>(1 << bit);
968 template<
typename MaskT>
970 template<
typename MaskT>
973 template<
typename MaskT>
976 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
978 template<
typename MaskT>
981 for (
auto mask : list) mFlags &= ~static_cast<Type>(mask);
985 template<
typename MaskT>
992 template<
typename MaskT>
994 template<
typename MaskT>
997 template<
typename MaskT>
1000 for (
auto mask : list) {
1001 if (0 != (mFlags &
static_cast<Type>(mask)))
return true;
1006 template<
typename MaskT>
1009 for (
auto mask : list) {
1010 if (0 == (mFlags &
static_cast<Type>(mask)))
return true;
1026template<u
int32_t LOG2DIM>
1030 static constexpr uint32_t
SIZE = 1U << (3 * LOG2DIM);
1046 for (
const uint64_t *w = mWords, *q = w +
WORD_COUNT; w != q; ++w)
1054 uint32_t n = i >> 6, sum =
util::countOn(mWords[n] & ((uint64_t(1) << (i & 63u)) - 1u));
1055 for (
const uint64_t* w = mWords; n--; ++w)
1080 mPos = mParent->findNext<On>(mPos + 1);
1092 const Mask* mParent;
1139 const uint64_t v = on ? ~uint64_t(0) : uint64_t(0);
1148 mWords[i] = other.mWords[i];
1155 template<
typename WordT>
1160 return reinterpret_cast<WordT*
>(mWords)[n];
1162 template<
typename WordT>
1167 reinterpret_cast<WordT*
>(mWords)[n] = w;
1171 template<
typename MaskT = Mask>
1174 static_assert(
sizeof(
Mask) ==
sizeof(MaskT),
"Mismatching sizeof");
1175 static_assert(
WORD_COUNT == MaskT::WORD_COUNT,
"Mismatching word count");
1176 static_assert(LOG2DIM == MaskT::LOG2DIM,
"Mismatching LOG2DIM");
1177 auto* src =
reinterpret_cast<const uint64_t*
>(&other);
1178 for (uint64_t *dst = mWords, *end = dst +
WORD_COUNT; dst != end; ++dst)
1189 if (mWords[i] != other.mWords[i])
1198 __hostdev__ bool isOn(uint32_t n)
const {
return 0 != (mWords[n >> 6] & (uint64_t(1) << (n & 63))); }
1201 __hostdev__ bool isOff(uint32_t n)
const {
return 0 == (mWords[n >> 6] & (uint64_t(1) << (n & 63))); }
1207 if (mWords[i] != ~uint64_t(0))
1216 if (mWords[i] != uint64_t(0))
1226#if defined(__CUDACC__)
1227 __device__ inline void setOnAtomic(uint32_t n)
1229 atomicOr(
reinterpret_cast<unsigned long long int*
>(
this) + (n >> 6), 1ull << (n & 63));
1231 __device__ inline void setOffAtomic(uint32_t n)
1233 atomicAnd(
reinterpret_cast<unsigned long long int*
>(
this) + (n >> 6), ~(1ull << (n & 63)));
1235 __device__ inline void setAtomic(uint32_t n,
bool on)
1237 on ? this->setOnAtomic(n) : this->setOffAtomic(n);
1263 auto& word = mWords[n >> 6];
1265 word &= ~(uint64_t(1) << n);
1266 word |= uint64_t(on) << n;
1275 for (uint32_t i = 0; i <
WORD_COUNT; ++i)mWords[i] = ~uint64_t(0);
1281 for (uint32_t i = 0; i <
WORD_COUNT; ++i) mWords[i] = uint64_t(0);
1287 const uint64_t v = on ? ~uint64_t(0) : uint64_t(0);
1288 for (uint32_t i = 0; i <
WORD_COUNT; ++i) mWords[i] = v;
1294 for (
auto* w = mWords; n--; ++w) *w = ~*w;
1301 uint64_t* w1 = mWords;
1302 const uint64_t* w2 = other.mWords;
1303 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 &= *w2;
1309 uint64_t* w1 = mWords;
1310 const uint64_t* w2 = other.mWords;
1311 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 |= *w2;
1317 uint64_t* w1 = mWords;
1318 const uint64_t* w2 = other.mWords;
1319 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 &= ~*w2;
1325 uint64_t* w1 = mWords;
1326 const uint64_t* w2 = other.mWords;
1327 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 ^= *w2;
1336 const uint64_t* w = mWords;
1337 for (; n <
WORD_COUNT && !(ON ? *w : ~*w); ++w, ++n);
1345 uint32_t n = start >> 6;
1347 uint32_t m = start & 63u;
1348 uint64_t b = ON ? mWords[n] : ~mWords[n];
1349 if (b & (uint64_t(1u) << m))
return start;
1350 b &= ~uint64_t(0u) << m;
1351 while (!b && ++n <
WORD_COUNT) b = ON ? mWords[n] : ~mWords[n];
1359 uint32_t n = start >> 6;
1361 uint32_t m = start & 63u;
1362 uint64_t b = ON ? mWords[n] : ~mWords[n];
1363 if (b & (uint64_t(1u) << m))
return start;
1364 b &= (uint64_t(1u) << m) - 1u;
1365 while (!b && n) b = ON ? mWords[--n] : ~mWords[--n];
1389 :
mMatF{ 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}
1390 ,
mInvMatF{1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}
1391 ,
mVecF{0.0f, 0.0f, 0.0f}
1393 ,
mMatD{ 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}
1394 ,
mInvMatD{1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}
1395 ,
mVecD{0.0, 0.0, 0.0}
1400 :
mMatF{float(s), 0.0f, 0.0f, 0.0f, float(s), 0.0f, 0.0f, 0.0f, float(s)}
1401 ,
mInvMatF{1.0f / float(s), 0.0f, 0.0f, 0.0f, 1.0f / float(s), 0.0f, 0.0f, 0.0f, 1.0f / float(s)}
1402 ,
mVecF{float(t[0]), float(t[1]), float(t[2])}
1404 ,
mMatD{s, 0.0, 0.0, 0.0, s, 0.0, 0.0, 0.0, s}
1405 ,
mInvMatD{1.0 / s, 0.0, 0.0, 0.0, 1.0 / s, 0.0, 0.0, 0.0, 1.0 / s}
1406 ,
mVecD{t[0], t[1], t[2]}
1413 template<
typename MatT,
typename Vec3T>
1414 void set(
const MatT& mat,
const MatT& invMat,
const Vec3T& translate,
double taper = 1.0);
1419 template<
typename Mat4T>
1420 void set(
const Mat4T& mat,
const Mat4T& invMat,
double taper = 1.0) { this->
set(mat, invMat, mat[3], taper); }
1422 template<
typename Vec3T>
1423 void set(
double scale,
const Vec3T& translation,
double taper = 1.0);
1430 template<
typename Vec3T>
1438 template<
typename Vec3T>
1447 template<
typename Vec3T>
1456 template<
typename Vec3T>
1464 template<
typename Vec3T>
1475 template<
typename Vec3T>
1487 template<
typename Vec3T>
1496 template<
typename Vec3T>
1505 template<
typename Vec3T>
1507 template<
typename Vec3T>
1514template<
typename MatT,
typename Vec3T>
1515inline void Map::set(
const MatT& mat,
const MatT& invMat,
const Vec3T& translate,
double taper)
1519 mTaperF =
static_cast<float>(taper);
1521 for (
int i = 0; i < 3; ++i) {
1522 *vd++ = translate[i];
1523 *vf++ =
static_cast<float>(translate[i]);
1524 for (
int j = 0; j < 3; ++j) {
1526 *mid++ = invMat[j][i];
1527 *mf++ =
static_cast<float>(mat[j][i]);
1528 *mif++ =
static_cast<float>(invMat[j][i]);
1533template<
typename Vec3T>
1534inline void Map::set(
double dx,
const Vec3T& trans,
double taper)
1537 const double mat[3][3] = { {dx, 0.0, 0.0},
1540 const double idx = 1.0 / dx;
1541 const double invMat[3][3] = { {idx, 0.0, 0.0},
1544 this->
set(mat, invMat, trans, taper);
1633 template<
typename BlindDataT>
1643 auto check = [&]()->
bool{
1661 default:
return true;}
1679template<
typename Gr
idOrTreeOrRootT,
int LEVEL>
1683template<
typename Gr
idOrTreeOrRootT>
1686 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1687 using Type =
typename GridOrTreeOrRootT::LeafNodeType;
1688 using type =
typename GridOrTreeOrRootT::LeafNodeType;
1690template<
typename Gr
idOrTreeOrRootT>
1693 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1694 using Type =
const typename GridOrTreeOrRootT::LeafNodeType;
1695 using type =
const typename GridOrTreeOrRootT::LeafNodeType;
1698template<
typename Gr
idOrTreeOrRootT>
1701 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1702 using Type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1703 using type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1705template<
typename Gr
idOrTreeOrRootT>
1708 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1709 using Type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1710 using type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1712template<
typename Gr
idOrTreeOrRootT>
1715 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1716 using Type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1717 using type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1719template<
typename Gr
idOrTreeOrRootT>
1722 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1723 using Type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1724 using type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1726template<
typename Gr
idOrTreeOrRootT>
1729 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1730 using Type =
typename GridOrTreeOrRootT::RootNodeType;
1731 using type =
typename GridOrTreeOrRootT::RootNodeType;
1734template<
typename Gr
idOrTreeOrRootT>
1737 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1738 using Type =
const typename GridOrTreeOrRootT::RootNodeType;
1739 using type =
const typename GridOrTreeOrRootT::RootNodeType;
1744template<
typename BuildT>
1746template<
typename BuildT>
1748template<
typename BuildT>
1750template<
typename BuildT>
1752template<
typename BuildT>
1754template<
typename BuildT>
1756template<
typename BuildT>
1758template<
typename BuildT>
1820 [[deprecated(
"Use Checksum::data instead.")]]
1822 [[deprecated(
"Use Checksum::head and Ckecksum::tail instead.")]]
1824 [[deprecated(
"Use Checksum::head and Ckecksum::tail instead.")]]
1835 [[deprecated(
"Use Checksum::isHalf instead.")]]
1919 uint64_t gridSize = 0u,
1924#ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS
1934 mGridSize = gridSize;
1935 mGridName[0] =
'\0';
1937 mWorldBBox = Vec3dBBox();
1938 mVoxelSize = map.getVoxelSize();
1939 mGridClass = gridClass;
1940 mGridType = gridType;
1941 mBlindMetadataOffset = mGridSize;
1942 mBlindMetadataCount = 0u;
1945#ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS
1959 if (test) test =
mVersion.isCompatible();
1977 template<
typename Vec3T>
1979 template<
typename Vec3T>
1981 template<
typename Vec3T>
1983 template<
typename Vec3T>
1985 template<
typename Vec3T>
1988 template<
typename Vec3T>
1990 template<
typename Vec3T>
1992 template<
typename Vec3T>
1994 template<
typename Vec3T>
1996 template<
typename Vec3T>
2007 template <u
int32_t LEVEL>
2010 static_assert(LEVEL >= 0 && LEVEL <= 3,
"invalid LEVEL template parameter");
2011 const void *treeData =
this + 1;
2013 return nodeOffset ?
util::PtrAdd(treeData, nodeOffset) :
nullptr;
2019 template <u
int32_t LEVEL>
2022 static_assert(LEVEL >= 0 && LEVEL <= 3,
"invalid LEVEL template parameter");
2023 void *treeData =
this + 1;
2025 return nodeOffset ?
util::PtrAdd(treeData, nodeOffset) :
nullptr;
2030 template <u
int32_t LEVEL>
2033 static_assert(LEVEL >= 0 && LEVEL < 3,
"invalid LEVEL template parameter");
2054 return metaData->template getBlindData<const char>();
2088template<
typename BuildT,
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1>
2091template<
typename BuildT>
2098template<
typename TreeT>
2142 template<
typename T = BuildType>
2149 template<
typename T = BuildType>
2169 template<
typename Vec3T>
2173 template<
typename Vec3T>
2178 template<
typename Vec3T>
2183 template<
typename Vec3T>
2188 template<
typename Vec3T>
2192 template<
typename Vec3T>
2196 template<
typename Vec3T>
2201 template<
typename Vec3T>
2206 template<
typename Vec3T>
2211 template<
typename Vec3T>
2247 template<
typename NodeT>
2283 [[deprecated(
"Use Grid::getBlindData<T>() instead.")]]
2286 printf(
"\nnanovdb::Grid::blindData is unsafe and hence deprecated! Please use nanovdb::Grid::getBlindData instead.\n\n");
2291 template <
typename BlindDataT>
2298 template <
typename BlindDataT>
2311template<
typename TreeT>
2321template<
typename TreeT>
2324 auto test = [&](
int n) {
2327 if (name[i] != str[i])
2329 if (name[i] ==
'\0' && str[i] ==
'\0')
2361 template<
typename NodeT>
2377template<
typename Gr
idT>
2380 using Type =
typename GridT::TreeType;
2381 using type =
typename GridT::TreeType;
2383template<
typename Gr
idT>
2386 using Type =
const typename GridT::TreeType;
2387 using type =
const typename GridT::TreeType;
2393template<
typename RootT>
2396 static_assert(RootT::LEVEL == 3,
"Tree depth is not supported");
2397 static_assert(RootT::ChildNodeType::LOG2DIM == 5,
"Tree configuration is not supported");
2398 static_assert(RootT::ChildNodeType::ChildNodeType::LOG2DIM == 4,
"Tree configuration is not supported");
2399 static_assert(RootT::LeafNodeType::LOG2DIM == 3,
"Tree configuration is not supported");
2414 using Node2 =
typename RootT::ChildNodeType;
2415 using Node1 =
typename Node2::ChildNodeType;
2473 template<
typename NodeT>
2476 static_assert(NodeT::LEVEL < 3,
"Invalid NodeT");
2494 template<
typename NodeT>
2504 template<
typename NodeT>
2537 template<
typename OpT,
typename... ArgsT>
2543 template<
typename OpT,
typename... ArgsT>
2554template<
typename RootT>
2557 min = this->
root().minimum();
2558 max = this->
root().maximum();
2566template<
typename ChildT>
2576#ifdef NANOVDB_USE_SINGLE_ROOT_KEY
2578 template<
typename CoordType>
2581 static_assert(
sizeof(
CoordT) ==
sizeof(CoordType),
"Mismatching sizeof");
2582 static_assert(32 - ChildT::TOTAL <= 21,
"Cannot use 64 bit root keys");
2583 return (
KeyT(uint32_t(ijk[2]) >> ChildT::TOTAL)) |
2584 (
KeyT(uint32_t(ijk[1]) >> ChildT::TOTAL) << 21) |
2585 (
KeyT(uint32_t(ijk[0]) >> ChildT::TOTAL) << 42);
2589 static constexpr uint64_t MASK = (1u << 21) - 1;
2590 return CoordT(((key >> 42) & MASK) << ChildT::TOTAL,
2591 ((key >> 21) & MASK) << ChildT::TOTAL,
2592 (key & MASK) << ChildT::TOTAL);
2595 using KeyT = CoordT;
2596 __hostdev__ static KeyT CoordToKey(
const CoordT& ijk) {
return ijk & ~ChildT::MASK; }
2597 __hostdev__ static CoordT KeyToCoord(
const KeyT& key) {
return key; }
2616 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
Tile
2618 template<
typename CoordType>
2625 template<
typename CoordType,
typename ValueType>
2649 return reinterpret_cast<const Tile*
>(
this + 1) + n;
2654 return reinterpret_cast<Tile*
>(
this + 1) + n;
2657 template<
typename DataT>
2696 return reinterpret_cast<DataT*
>(
mBegin) - 1;
2701 return mPos->child != 0;
2706 return mPos->child == 0;
2711 return mPos->child == 0 &&
mPos->state != 0;
2735 for(; iter; ++iter)
if (iter->key == key)
break;
2743 for(; iter; ++iter)
if (iter->key == key)
break;
2749 auto iter = this->
probe(ijk);
2750 return iter ? iter.operator->() :
nullptr;
2760 auto iter = this->
probe(ijk);
2761 return iter && iter.isChild() ? iter.child() :
nullptr;
2803template<
typename ChildT>
2824 static constexpr uint32_t
LEVEL = 1 + ChildT::LEVEL;
2826 template<
typename RootT>
2844 template<
typename RootT>
2856 while (mTileIter && mTileIter.isValue()) ++mTileIter;
2863 while (mTileIter && mTileIter.isValue()) ++mTileIter;
2880 template<
typename RootT>
2890 while (mTileIter && mTileIter.isChild()) ++mTileIter;
2897 while (mTileIter && mTileIter.isChild()) ++mTileIter;
2914 template<
typename RootT>
2924 while (mTileIter && !mTileIter.isValueOn()) ++mTileIter;
2930 while (mTileIter && !mTileIter.isValueOn()) ++mTileIter;
2947 template<
typename RootT>
2959 if (mTileIter.isChild())
return mTileIter.child();
2960 value = mTileIter.value();
3041 template<
typename OpT,
typename... ArgsT>
3046 return OpT::get(*
tile, args...);
3048 return OpT::get(*
this, args...);
3051 template<
typename OpT,
typename... ArgsT>
3056 return OpT::set(*
tile, args...);
3058 return OpT::set(*
this, args...);
3063 static_assert(
sizeof(
typename DataType::Tile) %
NANOVDB_DATA_ALIGNMENT == 0,
"sizeof(RootData::Tile) is misaligned");
3065 template<
typename,
int,
int,
int>
3071 template<
typename RayT,
typename AccT>
3072 __hostdev__ uint32_t getDimAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const
3075 if (
tile->isChild()) {
3077 acc.insert(ijk, child);
3078 return child->getDimAndCache(ijk, ray, acc);
3080 return 1 << ChildT::TOTAL;
3082 return ChildNodeType::dim();
3085 template<
typename OpT,
typename AccT,
typename... ArgsT>
3086 __hostdev__ typename OpT::Type getAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
const
3088 if (
const Tile* tile = this->probeTile(ijk)) {
3089 if constexpr(OpT::LEVEL < LEVEL) {
3090 if (tile->isChild()) {
3091 const ChildT* child = this->getChild(tile);
3092 acc.insert(ijk, child);
3093 return child->template getAndCache<OpT>(ijk, acc, args...);
3096 return OpT::get(*tile, args...);
3098 return OpT::get(*
this, args...);
3101 template<
typename OpT,
typename AccT,
typename... ArgsT>
3102 __hostdev__ void setAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
3104 if (Tile* tile = DataType::probeTile(ijk)) {
3105 if constexpr(OpT::LEVEL < LEVEL) {
3106 if (tile->isChild()) {
3107 ChildT* child = this->getChild(tile);
3108 acc.insert(ijk, child);
3109 return child->template setAndCache<OpT>(ijk, acc, args...);
3112 return OpT::set(*tile, args...);
3114 return OpT::set(*
this, args...);
3126template<
typename ChildT, u
int32_t LOG2DIM>
3133 using MaskT =
typename ChildT::template MaskType<LOG2DIM>;
3165 alignas(32) Tile
mTable[1u << (3 * LOG2DIM)];
3175 template<
typename ValueT>
3208 template<
typename T>
3219#if defined(__GNUC__) && (__GNUC__ < 12) && !defined(__APPLE__) && !defined(__llvm__)
3220#pragma GCC diagnostic push
3221#pragma GCC diagnostic ignored "-Wstringop-overflow"
3227#if defined(__GNUC__) && (__GNUC__ < 12) && !defined(__APPLE__) && !defined(__llvm__)
3228#pragma GCC diagnostic pop
3239template<
typename ChildT, u
int32_t Log2Dim = ChildT::LOG2DIM + 1>
3251 template<u
int32_t LOG2>
3261 static constexpr uint32_t
LEVEL = 1 + ChildT::LEVEL;
3265 template <
typename ParentT>
3288 return *mParent->getChild(BaseT::pos());
3293 return mParent->getChild(BaseT::pos());
3298 return (*this)->origin();
3330 return mParent->data()->getValue(BaseT::pos());
3335 return mParent->offsetToGlobalCoord(BaseT::pos());
3341 return mParent->data()->isActive(BaseT::mPos);
3369 return mParent->data()->getValue(BaseT::pos());
3374 return mParent->offsetToGlobalCoord(BaseT::pos());
3396 , mParent(parent->
data())
3403 const ChildT* child =
nullptr;
3404 if (mParent->mChildMask.isOn(BaseT::pos())) {
3405 child = mParent->getChild(BaseT::pos());
3407 value = mParent->getValue(BaseT::pos());
3414 return mParent->isActive(BaseT::pos());
3419 return mParent->offsetToGlobalCoord(BaseT::pos());
3507 return (((ijk[0] &
MASK) >> ChildT::TOTAL) << (2 *
LOG2DIM)) |
3508 (((ijk[1] &
MASK) >> ChildT::TOTAL) << (
LOG2DIM)) |
3509 ((ijk[2] &
MASK) >> ChildT::TOTAL);
3516 const uint32_t m = n & ((1 << 2 *
LOG2DIM) - 1);
3523 ijk <<= ChildT::TOTAL;
3537 template<
typename OpT,
typename... ArgsT>
3542 return OpT::get(*
this, n, args...);
3545 template<
typename OpT,
typename... ArgsT>
3550 return OpT::set(*
this, n, args...);
3556 template<
typename,
int,
int,
int>
3561 template<
typename, u
int32_t>
3564 template<
typename RayT,
typename AccT>
3565 __hostdev__ uint32_t getDimAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const
3573 const ChildT* child = this->
getChild(n);
3574 acc.insert(ijk, child);
3575 return child->getDimAndCache(ijk, ray, acc);
3577 return ChildNodeType::dim();
3580 template<
typename OpT,
typename AccT,
typename... ArgsT>
3581 __hostdev__ typename OpT::Type getAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
const
3583 const uint32_t n = CoordToOffset(ijk);
3584 if constexpr(OpT::LEVEL < LEVEL) {
3585 if (this->isChild(n)) {
3586 const ChildT* child = this->getChild(n);
3587 acc.insert(ijk, child);
3588 return child->template getAndCache<OpT>(ijk, acc, args...);
3591 return OpT::get(*
this, n, args...);
3594 template<
typename OpT,
typename AccT,
typename... ArgsT>
3595 __hostdev__ void setAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
3597 const uint32_t n = CoordToOffset(ijk);
3598 if constexpr(OpT::LEVEL < LEVEL) {
3599 if (this->isChild(n)) {
3600 ChildT* child = this->getChild(n);
3601 acc.insert(ijk, child);
3602 return child->template setAndCache<OpT>(ijk, acc, args...);
3605 return OpT::set(*
this, n, args...);
3615template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3618 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3619 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3642 return sizeof(
LeafData) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>) + 2 * (
sizeof(ValueT) +
sizeof(
FloatType)) + (1u << (3 * LOG2DIM)) *
sizeof(ValueT));
3665#if defined(__GNUC__) && (__GNUC__ < 12) && !defined(__APPLE__) && !defined(__llvm__)
3666#pragma GCC diagnostic push
3667#pragma GCC diagnostic ignored "-Wstringop-overflow"
3673#if defined(__GNUC__) && (__GNUC__ < 12) && !defined(__APPLE__) && !defined(__llvm__)
3674#pragma GCC diagnostic pop
3677 template<
typename T>
3682 for (
auto *p =
mValues, *q = p + 512; p != q; ++p)
3696template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3699 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3700 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3722 return sizeof(
LeafFnBase) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>) + 2 * 4 + 4 * 2);
3727 mQuantum = (max - min) /
float((1 << bitWidth) - 1);
3757 template<
typename T>
3766template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3767struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp4, CoordT, MaskT, LOG2DIM>
3774 alignas(32) uint8_t
mCode[1u << (3 * LOG2DIM - 1)];
3779 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3780 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << (3 * LOG2DIM - 1));
3787 const uint8_t c =
mCode[i>>1];
3803template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3804struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp8, CoordT, MaskT, LOG2DIM>
3811 alignas(32) uint8_t
mCode[1u << 3 * LOG2DIM];
3815 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3816 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << 3 * LOG2DIM);
3833template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3834struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp16, CoordT, MaskT, LOG2DIM>
3841 alignas(32) uint16_t
mCode[1u << 3 * LOG2DIM];
3846 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3847 return sizeof(
LeafData) -
sizeof(
BaseT) - 2 * (1u << 3 * LOG2DIM);
3865template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3866struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
FpN, CoordT, MaskT, LOG2DIM>
3875 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3884#ifdef NANOVDB_FPN_BRANCHLESS
3887 uint16_t code =
reinterpret_cast<const uint16_t*
>(
this + 1)[i >> (4 - b)];
3888 const static uint8_t shift[5] = {15, 7, 3, 1, 0};
3889 const static uint16_t mask[5] = {1, 3, 15, 255, 65535};
3890 code >>= (i & shift[b]) << b;
3893 uint32_t code =
reinterpret_cast<const uint32_t*
>(
this + 1)[i >> (5 - b)];
3894 code >>= (i & ((32 >> b) - 1)) << b;
3895 code &= (1 << (1 << b)) - 1;
3899 auto* values =
reinterpret_cast<const uint8_t*
>(
this + 1);
3902 code = float((values[i >> 3] >> (i & 7)) & uint8_t(1));
3905 code = float((values[i >> 2] >> ((i & 3) << 1)) & uint8_t(3));
3908 code = float((values[i >> 1] >> ((i & 1) << 2)) & uint8_t(15));
3911 code = float(values[i]);
3914 code = float(
reinterpret_cast<const uint16_t*
>(values)[i]);
3930template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3931struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<bool, CoordT, MaskT, LOG2DIM>
3933 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3934 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3967 template<
typename T>
3980template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3983 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3984 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4001 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u);
4016 template<
typename T>
4029template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4032 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4033 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4046 return sizeof(
LeafIndexBase) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u);
4057 template<
typename T>
4071template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4091template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4109 uint32_t n = i >> 6;
4110 const uint64_t w =
BaseT::mValueMask.words()[n], mask = uint64_t(1) << (i & 63u);
4111 if (!(w & mask))
return uint64_t(0);
4120template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4122 :
public LeafData<ValueIndex, CoordT, MaskT, LOG2DIM>
4131template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4133 :
public LeafData<ValueOnIndex, CoordT, MaskT, LOG2DIM>
4144template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4145struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Point, CoordT, MaskT, LOG2DIM>
4147 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4148 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4170 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u + (1u << 3 * LOG2DIM) * 2u);
4197 template<
typename T>
4210template<
typename BuildT,
4211 typename CoordT = Coord,
4212 template<u
int32_t>
class MaskT =
Mask,
4213 uint32_t Log2Dim = 3>
4220 static constexpr uint32_t
DIM = 1;
4230 template<u
int32_t LOG2>
4256 return mParent->getValue(BaseT::pos());
4261 return mParent->offsetToGlobalCoord(BaseT::pos());
4289 return mParent->getValue(BaseT::pos());
4294 return mParent->offsetToGlobalCoord(BaseT::pos());
4310 , mPos(1u << 3 * Log2Dim)
4323 return mParent->getValue(mPos);
4328 return mParent->offsetToGlobalCoord(mPos);
4333 return mParent->isActive(mPos);
4335 __hostdev__ operator bool()
const {
return mPos < (1u << 3 * Log2Dim); }
4395 const uint32_t m = n & ((1 << 2 *
LOG2DIM) - 1);
4419 bbox = math::BBox<CoordT>();
4499 template<
typename OpT,
typename... ArgsT>
4505 template<
typename OpT,
typename... ArgsT>
4508 return OpT::get(*
this, n, args...);
4511 template<
typename OpT,
typename... ArgsT>
4517 template<
typename OpT,
typename... ArgsT>
4520 return OpT::set(*
this, n, args...);
4526 template<
typename,
int,
int,
int>
4531 template<
typename, u
int32_t>
4534 template<
typename RayT,
typename AccT>
4535 __hostdev__ uint32_t getDimAndCache(
const CoordT&,
const RayT& ,
const AccT&)
const
4544 template<
typename OpT,
typename AccT,
typename... ArgsT>
4547 getAndCache(
const CoordType& ijk,
const AccT&, ArgsT&&... args)
const
4549 return OpT::get(*
this, CoordToOffset(ijk), args...);
4552 template<
typename OpT,
typename AccT,
typename... ArgsT>
4554 __hostdev__ decltype(OpT::set(util::declval<LeafNode&>(), util::declval<uint32_t>(), util::declval<ArgsT>()...))
4555 setAndCache(
const CoordType& ijk,
const AccT&, ArgsT&&... args)
4557 return OpT::set(*
this, CoordToOffset(ijk), args...);
4564template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4567 static_assert(
LOG2DIM == 3,
"LeafNode::updateBBox: only supports LOGDIM = 3!");
4572 auto update = [&](uint32_t min, uint32_t max,
int axis) {
4578 uint32_t Xmin = word64 ? 0u : 8u, Xmax = Xmin;
4579 for (
int i = 1; i < 8; ++i) {
4588 update(Xmin, Xmax, 0);
4590 const uint32_t *p =
reinterpret_cast<const uint32_t*
>(&word64), word32 = p[0] | p[1];
4591 const uint16_t *q =
reinterpret_cast<const uint16_t*
>(&word32), word16 = q[0] | q[1];
4592 const uint8_t *b =
reinterpret_cast<const uint8_t*
>(&word16),
byte = b[0] | b[1];
4603template<
typename BuildT>
4605template<
typename BuildT>
4607template<
typename BuildT>
4609template<
typename BuildT>
4611template<
typename BuildT>
4613template<
typename BuildT>
4617template<
typename BuildT,
int LEVEL>
4621template<
typename BuildT>
4627template<
typename BuildT>
4633template<
typename BuildT>
4639template<
typename BuildT>
4718template<
typename OpT,
typename GridDataT,
typename... ArgsT>
4722 switch (gridData->mGridType){
4724 return OpT::template known<float>(gridData, args...);
4726 return OpT::template known<double>(gridData, args...);
4728 return OpT::template known<int16_t>(gridData, args...);
4730 return OpT::template known<int32_t>(gridData, args...);
4732 return OpT::template known<int64_t>(gridData, args...);
4734 return OpT::template known<Vec3f>(gridData, args...);
4736 return OpT::template known<Vec3d>(gridData, args...);
4738 return OpT::template known<uint32_t>(gridData, args...);
4740 return OpT::template known<ValueMask>(gridData, args...);
4742 return OpT::template known<ValueIndex>(gridData, args...);
4744 return OpT::template known<ValueOnIndex>(gridData, args...);
4746 return OpT::template known<ValueIndexMask>(gridData, args...);
4748 return OpT::template known<ValueOnIndexMask>(gridData, args...);
4750 return OpT::template known<bool>(gridData, args...);
4752 return OpT::template known<math::Rgba8>(gridData, args...);
4754 return OpT::template known<Fp4>(gridData, args...);
4756 return OpT::template known<Fp8>(gridData, args...);
4758 return OpT::template known<Fp16>(gridData, args...);
4760 return OpT::template known<FpN>(gridData, args...);
4762 return OpT::template known<Vec4f>(gridData, args...);
4764 return OpT::template known<Vec4d>(gridData, args...);
4766 return OpT::template known<uint8_t>(gridData, args...);
4768 return OpT::unknown(gridData, args...);
4793template<
typename BuildT>
4803 mutable const RootT* mRoot;
4850 template<
typename RayT>
4853 return mRoot->getDimAndCache(ijk, ray, *
this);
4855 template<
typename OpT,
typename... ArgsT>
4858 return mRoot->template
get<OpT>(ijk, args...);
4861 template<
typename OpT,
typename... ArgsT>
4864 return const_cast<RootT*
>(mRoot)->
template set<OpT>(ijk, args...);
4871 template<
typename, u
int32_t>
4873 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
4877 template<
typename NodeT>
4882template<
typename BuildT,
int LEVEL0>
4885 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 should be 0, 1, or 2");
4899 mutable CoordT mKey;
4900 mutable const RootT* mRoot;
4901 mutable const NodeT* mNode;
4933 mKey = CoordType::max();
4946 return (ijk[0] & int32_t(~NodeT::MASK)) == mKey[0] &&
4947 (ijk[1] & int32_t(~NodeT::MASK)) == mKey[1] &&
4948 (ijk[2] & int32_t(~NodeT::MASK)) == mKey[2];
4963 template<
typename RayT>
4966 if (this->
isCached(ijk))
return mNode->getDimAndCache(ijk, ray, *
this);
4967 return mRoot->getDimAndCache(ijk, ray, *
this);
4970 template<
typename OpT,
typename... ArgsT>
4973 if constexpr(OpT::LEVEL <= LEVEL0)
if (this->
isCached(ijk))
return mNode->template getAndCache<OpT>(ijk, *
this, args...);
4974 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
4977 template<
typename OpT,
typename... ArgsT>
4980 if constexpr(OpT::LEVEL <= LEVEL0)
if (this->
isCached(ijk))
return const_cast<NodeT*
>(mNode)->
template setAndCache<OpT>(ijk, *
this, args...);
4981 return const_cast<RootT*
>(mRoot)->
template setAndCache<OpT>(ijk, *
this, args...);
4988 template<
typename, u
int32_t>
4990 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
4996 mKey = ijk & ~NodeT::MASK;
5001 template<
typename OtherNodeT>
5002 __hostdev__ void insert(
const CoordType&,
const OtherNodeT*)
const {}
5006template<
typename BuildT,
int LEVEL0,
int LEVEL1>
5009 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 must be 0, 1, 2");
5010 static_assert(LEVEL1 >= 0 && LEVEL1 <= 2,
"LEVEL1 must be 0, 1, 2");
5011 static_assert(LEVEL0 < LEVEL1,
"Level 0 must be lower than level 1");
5024#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5025 mutable CoordT mKey;
5027 mutable CoordT mKeys[2];
5029 mutable const RootT* mRoot;
5030 mutable const Node1T* mNode1;
5031 mutable const Node2T* mNode2;
5042#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5043 : mKey(CoordType::max())
5045 : mKeys{CoordType::max(), CoordType::max()}
5068#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5069 mKey = CoordType::max();
5071 mKeys[0] = mKeys[1] = CoordType::max();
5084#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5089 if (dirty & int32_t(~Node1T::MASK)) {
5095 __hostdev__ bool isCached2(CoordValueType dirty)
const
5099 if (dirty & int32_t(~Node2T::MASK)) {
5105 __hostdev__ CoordValueType computeDirty(
const CoordType& ijk)
const
5107 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
5112 return (ijk[0] & int32_t(~Node1T::MASK)) == mKeys[0][0] &&
5113 (ijk[1] & int32_t(~Node1T::MASK)) == mKeys[0][1] &&
5114 (ijk[2] & int32_t(~Node1T::MASK)) == mKeys[0][2];
5118 return (ijk[0] & int32_t(~Node2T::MASK)) == mKeys[1][0] &&
5119 (ijk[1] & int32_t(~Node2T::MASK)) == mKeys[1][1] &&
5120 (ijk[2] & int32_t(~Node2T::MASK)) == mKeys[1][2];
5136 template<
typename RayT>
5139#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5140 const CoordValueType dirty = this->computeDirty(ijk);
5145 return mNode1->getDimAndCache(ijk, ray, *
this);
5147 return mNode2->getDimAndCache(ijk, ray, *
this);
5149 return mRoot->getDimAndCache(ijk, ray, *
this);
5152 template<
typename OpT,
typename... ArgsT>
5155#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5156 const CoordValueType dirty = this->computeDirty(ijk);
5160 if constexpr(OpT::LEVEL <= LEVEL0) {
5161 if (this->
isCached1(dirty))
return mNode1->template getAndCache<OpT>(ijk, *
this, args...);
5162 }
else if constexpr(OpT::LEVEL <= LEVEL1) {
5163 if (this->
isCached2(dirty))
return mNode2->template getAndCache<OpT>(ijk, *
this, args...);
5165 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5168 template<
typename OpT,
typename... ArgsT>
5171#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5172 const CoordValueType dirty = this->computeDirty(ijk);
5176 if constexpr(OpT::LEVEL <= LEVEL0) {
5177 if (this->
isCached1(dirty))
return const_cast<Node1T*
>(mNode1)->
template setAndCache<OpT>(ijk, *
this, args...);
5178 }
else if constexpr(OpT::LEVEL <= LEVEL1) {
5179 if (this->
isCached2(dirty))
return const_cast<Node2T*
>(mNode2)->
template setAndCache<OpT>(ijk, *
this, args...);
5181 return const_cast<RootT*
>(mRoot)->
template setAndCache<OpT>(ijk, *
this, args...);
5188 template<
typename, u
int32_t>
5190 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5196#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5199 mKeys[0] = ijk & ~Node1T::MASK;
5203 __hostdev__ void insert(
const CoordType& ijk,
const Node2T* node)
const
5205#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5208 mKeys[1] = ijk & ~Node2T::MASK;
5212 template<
typename OtherNodeT>
5213 __hostdev__ void insert(
const CoordType&,
const OtherNodeT*)
const {}
5217template<
typename BuildT>
5218class ReadAccessor<BuildT, 0, 1, 2>
5220 using GridT = NanoGrid<BuildT>;
5221 using TreeT = NanoTree<BuildT>;
5222 using RootT = NanoRoot<BuildT>;
5223 using NodeT2 = NanoUpper<BuildT>;
5224 using NodeT1 = NanoLower<BuildT>;
5225 using LeafT = NanoLeaf<BuildT>;
5226 using CoordT =
typename RootT::CoordType;
5227 using ValueT =
typename RootT::ValueType;
5229 using FloatType =
typename RootT::FloatType;
5230 using CoordValueType =
typename RootT::CoordT::ValueType;
5233#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5234 mutable CoordT mKey;
5236 mutable CoordT mKeys[3];
5238 mutable const RootT* mRoot;
5239 mutable const void* mNode[3];
5242 using BuildType = BuildT;
5243 using ValueType = ValueT;
5244 using CoordType = CoordT;
5246 static const int CacheLevels = 3;
5250#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5251 : mKey(CoordType::max())
5253 : mKeys{CoordType::max(), CoordType::max(), CoordType::max()}
5256 , mNode{
nullptr,
nullptr,
nullptr}
5262 : ReadAccessor(grid.tree().root())
5268 : ReadAccessor(tree.root())
5272 __hostdev__ const RootT& root()
const {
return *mRoot; }
5275 ReadAccessor(
const ReadAccessor&) =
default;
5276 ~ReadAccessor() =
default;
5277 ReadAccessor& operator=(
const ReadAccessor&) =
default;
5282 template<
typename NodeT>
5285 using T =
typename NodeTrait<TreeT, NodeT::LEVEL>::type;
5286 static_assert(util::is_same<T, NodeT>::value,
"ReadAccessor::getNode: Invalid node type");
5287 return reinterpret_cast<const T*
>(mNode[NodeT::LEVEL]);
5291 __hostdev__ const typename NodeTrait<TreeT, LEVEL>::type* getNode()
const
5293 using T =
typename NodeTrait<TreeT, LEVEL>::type;
5294 static_assert(LEVEL >= 0 && LEVEL <= 2,
"ReadAccessor::getNode: Invalid node type");
5295 return reinterpret_cast<const T*
>(mNode[LEVEL]);
5301#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5302 mKey = CoordType::max();
5304 mKeys[0] = mKeys[1] = mKeys[2] = CoordType::max();
5306 mNode[0] = mNode[1] = mNode[2] =
nullptr;
5309#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5310 template<
typename NodeT>
5311 __hostdev__ bool isCached(CoordValueType dirty)
const
5313 if (!mNode[NodeT::LEVEL])
5315 if (dirty & int32_t(~NodeT::MASK)) {
5316 mNode[NodeT::LEVEL] =
nullptr;
5322 __hostdev__ CoordValueType computeDirty(
const CoordType& ijk)
const
5324 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
5327 template<
typename NodeT>
5328 __hostdev__ bool isCached(
const CoordType& ijk)
const
5330 return (ijk[0] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][0] &&
5331 (ijk[1] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][1] &&
5332 (ijk[2] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][2];
5336 __hostdev__ ValueType getValue(
const CoordType& ijk)
const {
return this->
template get<GetValue<BuildT>>(ijk);}
5337 __hostdev__ ValueType getValue(
int i,
int j,
int k)
const {
return this->
template get<GetValue<BuildT>>(CoordType(i, j, k)); }
5338 __hostdev__ ValueType operator()(
const CoordType& ijk)
const {
return this->
template get<GetValue<BuildT>>(ijk); }
5339 __hostdev__ ValueType operator()(
int i,
int j,
int k)
const {
return this->
template get<GetValue<BuildT>>(CoordType(i, j, k)); }
5340 __hostdev__ auto getNodeInfo(
const CoordType& ijk)
const {
return this->
template get<GetNodeInfo<BuildT>>(ijk); }
5341 __hostdev__ bool isActive(
const CoordType& ijk)
const {
return this->
template get<GetState<BuildT>>(ijk); }
5342 __hostdev__ bool probeValue(
const CoordType& ijk, ValueType& v)
const {
return this->
template get<ProbeValue<BuildT>>(ijk, v); }
5343 __hostdev__ const LeafT* probeLeaf(
const CoordType& ijk)
const {
return this->
template get<GetLeaf<BuildT>>(ijk); }
5345 template<
typename OpT,
typename... ArgsT>
5346 __hostdev__ typename OpT::Type get(
const CoordType& ijk, ArgsT&&... args)
const
5348#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5349 const CoordValueType dirty = this->computeDirty(ijk);
5353 if constexpr(OpT::LEVEL <=0) {
5354 if (this->isCached<LeafT>(dirty))
return ((
const LeafT*)mNode[0])->template getAndCache<OpT>(ijk, *
this, args...);
5355 }
else if constexpr(OpT::LEVEL <= 1) {
5356 if (this->isCached<NodeT1>(dirty))
return ((
const NodeT1*)mNode[1])->template getAndCache<OpT>(ijk, *
this, args...);
5357 }
else if constexpr(OpT::LEVEL <= 2) {
5358 if (this->isCached<NodeT2>(dirty))
return ((
const NodeT2*)mNode[2])->template getAndCache<OpT>(ijk, *
this, args...);
5360 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5363 template<
typename OpT,
typename... ArgsT>
5364 __hostdev__ void set(
const CoordType& ijk, ArgsT&&... args)
const
5366#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5367 const CoordValueType dirty = this->computeDirty(ijk);
5371 if constexpr(OpT::LEVEL <= 0) {
5372 if (this->isCached<LeafT>(dirty))
return ((LeafT*)mNode[0])->template setAndCache<OpT>(ijk, *
this, args...);
5373 }
else if constexpr(OpT::LEVEL <= 1) {
5374 if (this->isCached<NodeT1>(dirty))
return ((NodeT1*)mNode[1])->template setAndCache<OpT>(ijk, *
this, args...);
5375 }
else if constexpr(OpT::LEVEL <= 2) {
5376 if (this->isCached<NodeT2>(dirty))
return ((NodeT2*)mNode[2])->template setAndCache<OpT>(ijk, *
this, args...);
5378 return ((RootT*)mRoot)->template setAndCache<OpT>(ijk, *
this, args...);
5381 template<
typename RayT>
5382 __hostdev__ uint32_t getDim(
const CoordType& ijk,
const RayT& ray)
const
5384#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5385 const CoordValueType dirty = this->computeDirty(ijk);
5389 if (this->isCached<LeafT>(dirty)) {
5390 return ((LeafT*)mNode[0])->getDimAndCache(ijk, ray, *
this);
5391 }
else if (this->isCached<NodeT1>(dirty)) {
5392 return ((NodeT1*)mNode[1])->getDimAndCache(ijk, ray, *
this);
5393 }
else if (this->isCached<NodeT2>(dirty)) {
5394 return ((NodeT2*)mNode[2])->getDimAndCache(ijk, ray, *
this);
5396 return mRoot->getDimAndCache(ijk, ray, *
this);
5402 friend class RootNode;
5403 template<
typename, u
int32_t>
5404 friend class InternalNode;
5405 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5406 friend class LeafNode;
5409 template<
typename NodeT>
5410 __hostdev__ void insert(
const CoordType& ijk,
const NodeT* node)
const
5412#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5415 mKeys[NodeT::LEVEL] = ijk & ~NodeT::MASK;
5417 mNode[NodeT::LEVEL] = node;
5435template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5441template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5447template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5463 CoordBBox mIndexBBox;
5464 uint32_t mRootTableSize, mPadding{0};
5467 template<
typename T>
5470 mGridData = *grid.
data();
5471 mTreeData = *grid.
tree().data();
5473 mRootTableSize = grid.
tree().root().getTableSize();
5478 *
this = *
reinterpret_cast<const GridMetaData*
>(gridData);
5481 mGridData = *gridData;
5501 template<
typename T>
5541template<
typename AttT,
typename BuildT = u
int32_t>
5550 : AccT(
grid.tree().root())
5552 , mData(
grid.template getBlindData<AttT>(0))
5568 const uint64_t count = mGrid.blindMetaData(0u).mValueCount;
5570 end = begin + count;
5578 auto* leaf = this->probeLeaf(ijk);
5579 if (leaf ==
nullptr) {
5582 begin = mData + leaf->minimum();
5583 end = begin + leaf->maximum();
5584 return leaf->maximum();
5590 begin = end =
nullptr;
5591 if (
auto* leaf = this->probeLeaf(ijk)) {
5593 if (leaf->isActive(offset)) {
5594 begin = mData + leaf->minimum();
5595 end = begin + leaf->getValue(offset);
5597 begin += leaf->getValue(offset - 1);
5604template<
typename AttT>
5613 : AccT(
grid.tree().root())
5615 , mData(
grid.template getBlindData<AttT>(0))
5635 const uint64_t count = mGrid.blindMetaData(0u).mValueCount;
5637 end = begin + count;
5645 auto* leaf = this->probeLeaf(ijk);
5646 if (leaf ==
nullptr)
5648 begin = mData + leaf->offset();
5649 end = begin + leaf->pointCount();
5650 return leaf->pointCount();
5656 if (
auto* leaf = this->probeLeaf(ijk)) {
5658 if (leaf->isActive(n)) {
5659 begin = mData + leaf->first(n);
5660 end = mData + leaf->last(n);
5664 begin = end =
nullptr;
5672template<
typename ChannelT,
typename IndexT = ValueIndex>
5702 , mChannel(channelPtr)
5733 return mChannel =
const_cast<ChannelT*
>(mGrid.template getBlindData<ChannelT>(channelID));
5738 __hostdev__ uint64_t
idx(
int i,
int j,
int k)
const {
return BaseT::getValue(math::Coord(i, j, k)); }
5749 const bool isActive = BaseT::probeValue(ijk,
idx);
5756 template<
typename T>
5757 __hostdev__ T&
getValue(
const math::Coord& ijk, T* channelPtr)
const {
return channelPtr[BaseT::getValue(ijk)]; }
5765struct MiniGridHandle {
5770 BufferType(BufferType &&other) : data(other.data), size(other.size) {other.data=
nullptr; other.size=0;}
5771 ~BufferType() {std::free(data);}
5772 BufferType& operator=(
const BufferType &other) =
delete;
5773 BufferType& operator=(BufferType &&other){data=other.data; size=other.size; other.data=
nullptr; other.size=0;
return *
this;}
5774 static BufferType create(
size_t n, BufferType* dummy =
nullptr) {
return BufferType(n);}
5776 MiniGridHandle(BufferType &&buf) : buffer(std::move(buf)) {}
5777 const uint8_t* data()
const {
return buffer.data;}
5859#if !defined(__CUDA_ARCH__) && !defined(__HIP__)
5882template<
typename StreamT>
5888#ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS
5893 const char* gridName = gridData->
gridName();
5902 os.write((
const char*)&head,
sizeof(
FileHeader));
5904 os.write(gridName, nameSize);
5906 os.write((
const char*)gridData, gridData->
mGridSize);
5911template<
typename GridHandleT,
template<
typename...>
class VecT>
5914#ifdef NANOVDB_USE_IOSTREAMS
5915 std::ofstream os(fileName, std::ios::out | std::ios::binary | std::ios::trunc);
5919 StreamT(
const char* name) { fptr = fopen(name,
"wb"); }
5920 ~StreamT() { fclose(fptr); }
5921 void write(
const char* data,
size_t n) { fwrite(data, 1, n, fptr); }
5922 bool is_open()
const {
return fptr != NULL; }
5925 if (!os.is_open()) {
5926 fprintf(stderr,
"nanovdb::writeUncompressedGrids: Unable to open file \"%s\"for output\n", fileName);
5929 for (
auto& h : handles) {
5939template<
typename GridHandleT,
typename StreamT,
template<
typename...>
class VecT>
5940VecT<GridHandleT>
readUncompressedGrids(StreamT& is,
const typename GridHandleT::BufferType& pool =
typename GridHandleT::BufferType())
5942 VecT<GridHandleT> handles;
5944 is.read((
char*)&data,
sizeof(
GridData));
5946 uint64_t size = data.
mGridSize, sum = 0u;
5949 is.read((
char*)&data,
sizeof(
GridData));
5950 sum += data.mGridSize;
5952 is.skip(-int64_t(sum +
sizeof(
GridData)));
5953 auto buffer = GridHandleT::BufferType::create(size + sum, &pool);
5954 is.read((
char*)(buffer.data()), buffer.size());
5955 handles.emplace_back(std::move(buffer));
5959 while(is.read((
char*)&head,
sizeof(
FileHeader))) {
5961 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid magic number = \"%s\"\n", (
const char*)&(head.
magic));
5965 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid major version = \"%s\"\n",
toStr(str, head.
version));
5969 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid codec = \"%s\"\n",
toStr(str, head.
codec));
5973 for (uint16_t i = 0; i < head.
gridCount; ++i) {
5975 is.skip(meta.nameSize);
5976 auto buffer = GridHandleT::BufferType::create(meta.gridSize, &pool);
5977 is.read((
char*)buffer.data(), meta.gridSize);
5978 handles.emplace_back(std::move(buffer));
5986template<
typename GridHandleT,
template<
typename...>
class VecT>
5987VecT<GridHandleT>
readUncompressedGrids(
const char* fileName,
const typename GridHandleT::BufferType& buffer =
typename GridHandleT::BufferType())
5989#ifdef NANOVDB_USE_IOSTREAMS
5990 struct StreamT :
public std::ifstream {
5991 StreamT(
const char* name) : std::ifstream(name, std::ios::in | std::ios::binary){}
5992 void skip(int64_t off) { this->seekg(off, std::ios_base::cur); }
5997 StreamT(
const char* name) { fptr = fopen(name,
"rb"); }
5998 ~StreamT() { fclose(fptr); }
5999 bool read(
char* data,
size_t n) {
6000 size_t m = fread(data, 1, n, fptr);
6003 void skip(int64_t off) { fseek(fptr, (
long int)off, SEEK_CUR); }
6004 bool is_open()
const {
return fptr != NULL; }
6007 StreamT is(fileName);
6008 if (!is.is_open()) {
6009 fprintf(stderr,
"nanovdb::readUncompressedGrids: Unable to open file \"%s\"for input\n", fileName);
6055template<
typename BuildT>
6067template<
typename BuildT>
6080template<
typename BuildT>
6095template<
typename BuildT>
6109template<
typename BuildT>
6123template<
typename BuildT>
6137template<
typename BuildT>
6150template<
typename BuildT>
6162template<
typename BuildT>
6173template<
typename BuildT>
6187 return tile.state > 0u;
6208template<
typename BuildT>
#define NANOVDB_MAGIC_FILE
Definition NanoVDB.h:141
#define NANOVDB_MAGIC_GRID
Definition NanoVDB.h:140
#define NANOVDB_MINOR_VERSION_NUMBER
Definition NanoVDB.h:147
#define NANOVDB_DATA_ALIGNMENT
Definition NanoVDB.h:133
#define NANOVDB_MAJOR_VERSION_NUMBER
Definition NanoVDB.h:146
#define NANOVDB_MAGIC_NUMB
Definition NanoVDB.h:139
#define NANOVDB_PATCH_VERSION_NUMBER
Definition NanoVDB.h:148
BitFlags(std::initializer_list< uint8_t > list)
Definition NanoVDB.h:929
__hostdev__ void setBitOn(std::initializer_list< uint8_t > list)
Definition NanoVDB.h:959
__hostdev__ Type getFlags() const
Definition NanoVDB.h:951
__hostdev__ void setOn()
Definition NanoVDB.h:953
BitFlags(Type mask)
Definition NanoVDB.h:928
__hostdev__ bool isMaskOn(MaskT mask) const
Definition NanoVDB.h:993
__hostdev__ void setBitOff(uint8_t bit)
Definition NanoVDB.h:957
__hostdev__ void setOff()
Definition NanoVDB.h:954
__hostdev__ bool isBitOn(uint8_t bit) const
Definition NanoVDB.h:990
BitFlags()
Definition NanoVDB.h:927
__hostdev__ void setMaskOff(MaskT mask)
Definition NanoVDB.h:971
__hostdev__ void initBit(std::initializer_list< uint8_t > list)
Definition NanoVDB.h:940
__hostdev__ bool isMaskOff(std::initializer_list< MaskT > list) const
return true if any of the masks in the list are off
Definition NanoVDB.h:1007
__hostdev__ void initMask(std::initializer_list< MaskT > list)
Definition NanoVDB.h:946
__hostdev__ void setBit(uint8_t bit, bool on)
Definition NanoVDB.h:984
__hostdev__ void setBitOn(uint8_t bit)
Definition NanoVDB.h:956
__hostdev__ Type & data()
Definition NanoVDB.h:939
BitFlags(std::initializer_list< MaskT > list)
Definition NanoVDB.h:934
__hostdev__ void setMask(MaskT mask, bool on)
Definition NanoVDB.h:986
__hostdev__ bool isOff() const
Definition NanoVDB.h:989
__hostdev__ bool isBitOff(uint8_t bit) const
Definition NanoVDB.h:991
__hostdev__ void setBitOff(std::initializer_list< uint8_t > list)
Definition NanoVDB.h:963
__hostdev__ void setMaskOff(std::initializer_list< MaskT > list)
Definition NanoVDB.h:979
__hostdev__ bool isMaskOn(std::initializer_list< MaskT > list) const
return true if any of the masks in the list are on
Definition NanoVDB.h:998
__hostdev__ Type data() const
Definition NanoVDB.h:938
__hostdev__ bool isOn() const
Definition NanoVDB.h:988
__hostdev__ void setMaskOn(std::initializer_list< MaskT > list)
Definition NanoVDB.h:974
__hostdev__ bool isMaskOff(MaskT mask) const
Definition NanoVDB.h:995
__hostdev__ void setMaskOn(MaskT mask)
Definition NanoVDB.h:969
decltype(mFlags) Type
Definition NanoVDB.h:926
__hostdev__ BitFlags & operator=(Type n)
required for backwards compatibility
Definition NanoVDB.h:1015
__hostdev__ ChannelT & operator()(int i, int j, int k) const
Definition NanoVDB.h:5743
__hostdev__ ChannelT * setChannel(uint32_t channelID)
Change to an internal channel, assuming it exists as as blind data in the IndexGrid.
Definition NanoVDB.h:5731
NanoTree< IndexT > TreeType
Definition NanoVDB.h:5683
__hostdev__ uint64_t getIndex(const math::Coord &ijk) const
Return the linear offset into a channel that maps to the specified coordinate.
Definition NanoVDB.h:5737
__hostdev__ ChannelAccessor(const NanoGrid< IndexT > &grid, ChannelT *channelPtr)
Ctor from an IndexGrid and an external channel.
Definition NanoVDB.h:5699
__hostdev__ bool probeValue(const math::Coord &ijk, typename util::remove_const< ChannelT >::type &v) const
return the state and updates the value of the specified voxel
Definition NanoVDB.h:5746
__hostdev__ const uint64_t & valueCount() const
Return total number of values indexed by the IndexGrid.
Definition NanoVDB.h:5721
__hostdev__ ChannelT & operator()(const math::Coord &ijk) const
Definition NanoVDB.h:5742
__hostdev__ uint64_t idx(int i, int j, int k) const
Definition NanoVDB.h:5738
__hostdev__ const TreeType & tree() const
Definition NanoVDB.h:5715
__hostdev__ ChannelAccessor(const NanoGrid< IndexT > &grid, uint32_t channelID=0u)
Ctor from an IndexGrid and an integer ID of an internal channel that is assumed to exist as blind dat...
Definition NanoVDB.h:5688
__hostdev__ const NanoGrid< IndexT > & grid() const
Definition NanoVDB.h:5712
ChannelT ValueType
Definition NanoVDB.h:5682
ChannelAccessor< ChannelT, IndexT > AccessorType
Definition NanoVDB.h:5684
__hostdev__ const Vec3d & voxelSize() const
Return a vector of the axial voxel sizes.
Definition NanoVDB.h:5718
__hostdev__ T & getValue(const math::Coord &ijk, T *channelPtr) const
Return the value from a specified channel that maps to the specified coordinate.
Definition NanoVDB.h:5757
__hostdev__ ChannelT * setChannel(ChannelT *channelPtr)
Definition NanoVDB.h:5725
__hostdev__ ChannelT & getValue(const math::Coord &ijk) const
Return the value from a cached channel that maps to the specified coordinate.
Definition NanoVDB.h:5741
Class that encapsulates two CRC32 checksums, one for the Grid, Tree and Root node meta data and one f...
Definition NanoVDB.h:1791
__hostdev__ Checksum(uint64_t checksum, CheckMode mode=CheckMode::Full)
Definition NanoVDB.h:1814
__hostdev__ bool isFull() const
return true if the 64 bit checksum is fill, i.e. of both had and nodes
Definition NanoVDB.h:1840
__hostdev__ Checksum(uint32_t head, uint32_t tail)
Constructor that allows the two 32bit checksums to be initiated explicitly.
Definition NanoVDB.h:1809
__hostdev__ uint64_t checksum() const
return the 64 bit checksum of this instance
Definition NanoVDB.h:1821
__hostdev__ uint64_t full() const
Definition NanoVDB.h:1827
__hostdev__ uint64_t & full()
Definition NanoVDB.h:1828
__hostdev__ bool isEmpty() const
return true if the 64 bit checksum is disables (unset)
Definition NanoVDB.h:1843
__hostdev__ bool operator==(const Checksum &rhs) const
return true if the checksums are identical
Definition NanoVDB.h:1856
__hostdev__ Checksum()
default constructor initiates checksum to EMPTY
Definition NanoVDB.h:1804
__hostdev__ bool isHalf() const
Definition NanoVDB.h:1837
__hostdev__ uint32_t head() const
Definition NanoVDB.h:1829
__hostdev__ uint32_t & head()
Definition NanoVDB.h:1830
uint64_t mCRC64
Definition NanoVDB.h:1796
uint32_t mCRC32[2]
Definition NanoVDB.h:1796
static constexpr uint32_t EMPTY32
Definition NanoVDB.h:1800
__hostdev__ uint32_t tail() const
Definition NanoVDB.h:1831
__hostdev__ uint32_t checksum(int i) const
Definition NanoVDB.h:1825
__hostdev__ uint32_t & checksum(int i)
Definition NanoVDB.h:1823
__hostdev__ bool operator!=(const Checksum &rhs) const
return true if the checksums are not identical
Definition NanoVDB.h:1860
static constexpr uint64_t EMPTY64
Definition NanoVDB.h:1801
__hostdev__ bool isPartial() const
return true if the 64 bit checksum is partial, i.e. of head only
Definition NanoVDB.h:1836
__hostdev__ CheckMode mode() const
return the mode of the 64 bit checksum
Definition NanoVDB.h:1848
__hostdev__ uint32_t & tail()
Definition NanoVDB.h:1832
__hostdev__ void disable()
Definition NanoVDB.h:1845
Dummy type for a 16bit quantization of float point values.
Definition NanoVDB.h:196
Dummy type for a 4bit quantization of float point values.
Definition NanoVDB.h:190
Dummy type for a 8bit quantization of float point values.
Definition NanoVDB.h:193
Dummy type for a variable bit quantization of floating point values.
Definition NanoVDB.h:199
Highest level of the data structure. Contains a tree and a world->index transform (that currently onl...
Definition NanoVDB.h:2100
__hostdev__ const NanoTree< BuildT > & tree() const
Definition NanoVDB.h:2154
typename RootType::LeafNodeType LeafNodeType
Definition NanoVDB.h:2107
__hostdev__ const GridClass & gridClass() const
Definition NanoVDB.h:2229
typename TreeT::ValueType ValueType
Definition NanoVDB.h:2109
__hostdev__ DataType * data()
Definition NanoVDB.h:2123
__hostdev__ Vec3T worldToIndexF(const Vec3T &xyz) const
Definition NanoVDB.h:2193
typename TreeT::RootType RootType
Definition NanoVDB.h:2103
__hostdev__ bool hasMinMax() const
Definition NanoVDB.h:2238
__hostdev__ util::enable_if< util::is_same< T, Point >::value, constuint64_t & >::type pointCount() const
Definition NanoVDB.h:2151
__hostdev__ int findBlindData(const char *name) const
__hostdev__ const Map & map() const
Definition NanoVDB.h:2166
typename TreeT::CoordType CoordType
Definition NanoVDB.h:2111
typename RootNodeType::ChildNodeType UpperNodeType
Definition NanoVDB.h:2105
__hostdev__ const GridBlindMetaData & blindMetaData(uint32_t n) const
Definition NanoVDB.h:2305
__hostdev__ uint32_t blindDataCount() const
Definition NanoVDB.h:2271
__hostdev__ bool hasStdDeviation() const
Definition NanoVDB.h:2242
__hostdev__ BlindDataT * getBlindData(uint32_t n)
Definition NanoVDB.h:2299
__hostdev__ uint32_t gridIndex() const
Definition NanoVDB.h:2134
__hostdev__ bool isUnknown() const
Definition NanoVDB.h:2237
__hostdev__ Vec3T worldToIndexDir(const Vec3T &dir) const
Definition NanoVDB.h:2184
__hostdev__ const GridType & gridType() const
Definition NanoVDB.h:2228
__hostdev__ bool isSequential() const
Definition NanoVDB.h:2256
__hostdev__ const Checksum & checksum() const
Definition NanoVDB.h:2265
GridData DataType
Definition NanoVDB.h:2108
RootType RootNodeType
Definition NanoVDB.h:2104
__hostdev__ bool isValid() const
Definition NanoVDB.h:2227
__hostdev__ uint64_t gridSize() const
Definition NanoVDB.h:2131
__hostdev__ Version version() const
Definition NanoVDB.h:2121
__hostdev__ Vec3T indexToWorldGrad(const Vec3T &grad) const
Definition NanoVDB.h:2189
__hostdev__ bool hasLongGridName() const
Definition NanoVDB.h:2240
__hostdev__ Vec3T indexToWorldGradF(const Vec3T &grad) const
Definition NanoVDB.h:2212
__hostdev__ bool hasBBox() const
Definition NanoVDB.h:2239
__hostdev__ util::enable_if< BuildTraits< T >::is_index, constuint64_t & >::type valueCount() const
Definition NanoVDB.h:2144
__hostdev__ Vec3T indexToWorldDirF(const Vec3T &dir) const
Definition NanoVDB.h:2202
__hostdev__ const char * shortGridName() const
Definition NanoVDB.h:2262
__hostdev__ const char * gridName() const
Definition NanoVDB.h:2259
__hostdev__ bool isMask() const
Definition NanoVDB.h:2236
__hostdev__ const BlindDataT * getBlindData(uint32_t n) const
Definition NanoVDB.h:2292
__hostdev__ uint64_t activeVoxelCount() const
Definition NanoVDB.h:2224
DefaultReadAccessor< BuildType > AccessorType
Definition NanoVDB.h:2112
__hostdev__ bool isBreadthFirst() const
Definition NanoVDB.h:2243
__hostdev__ bool isPointIndex() const
Definition NanoVDB.h:2233
__hostdev__ bool hasAverage() const
Definition NanoVDB.h:2241
__hostdev__ bool isGridIndex() const
Definition NanoVDB.h:2234
__hostdev__ Vec3T indexToWorldDir(const Vec3T &dir) const
Definition NanoVDB.h:2179
__hostdev__ Vec3T indexToWorld(const Vec3T &xyz) const
Definition NanoVDB.h:2174
__hostdev__ bool isLevelSet() const
Definition NanoVDB.h:2230
__hostdev__ uint32_t gridCount() const
Definition NanoVDB.h:2137
__hostdev__ bool isPointData() const
Definition NanoVDB.h:2235
typename UpperNodeType::ChildNodeType LowerNodeType
Definition NanoVDB.h:2106
__hostdev__ AccessorType getAccessor() const
Definition NanoVDB.h:2160
__hostdev__ Vec3T worldToIndex(const Vec3T &xyz) const
Definition NanoVDB.h:2170
__hostdev__ const void * blindData(uint32_t n) const
Definition NanoVDB.h:2284
__hostdev__ const DataType * data() const
Definition NanoVDB.h:2125
__hostdev__ bool isStaggered() const
Definition NanoVDB.h:2232
__hostdev__ Vec3T worldToIndexDirF(const Vec3T &dir) const
Definition NanoVDB.h:2207
__hostdev__ Vec3T indexToWorldF(const Vec3T &xyz) const
Definition NanoVDB.h:2197
__hostdev__ const Vec3d & voxelSize() const
Definition NanoVDB.h:2163
TreeT TreeType
Definition NanoVDB.h:2102
Grid(const Grid &)=delete
Disallow constructions, copy and assignment.
typename TreeT::BuildType BuildType
Definition NanoVDB.h:2110
Grid & operator=(const Grid &)=delete
__hostdev__ bool isFogVolume() const
Definition NanoVDB.h:2231
__hostdev__ bool isSequential() const
Definition NanoVDB.h:2248
__hostdev__ int findBlindDataForSemantic(GridBlindDataSemantic semantic) const
__hostdev__ NanoTree< BuildT > & tree()
Definition NanoVDB.h:2157
Dummy type for a 16 bit floating point values (placeholder for IEEE 754 Half)
Definition NanoVDB.h:187
Visits child nodes of this node only.
Definition NanoVDB.h:3267
__hostdev__ NodeT & operator*() const
Definition NanoVDB.h:3285
__hostdev__ ChildIter(ParentT *parent)
Definition NanoVDB.h:3279
ChildIter & operator=(const ChildIter &)=default
__hostdev__ CoordType getOrigin() const
Definition NanoVDB.h:3295
__hostdev__ NodeT * operator->() const
Definition NanoVDB.h:3290
__hostdev__ CoordType getCoord() const
Definition NanoVDB.h:3300
__hostdev__ ChildIter()
Definition NanoVDB.h:3274
DenseIterator & operator=(const DenseIterator &)=default
__hostdev__ DenseIterator(const InternalNode *parent)
Definition NanoVDB.h:3394
__hostdev__ CoordType getOrigin() const
Definition NanoVDB.h:3416
__hostdev__ const ChildT * probeChild(ValueType &value) const
Definition NanoVDB.h:3400
__hostdev__ bool isValueOn() const
Definition NanoVDB.h:3411
__hostdev__ DenseIterator()
Definition NanoVDB.h:3389
__hostdev__ CoordType getCoord() const
Definition NanoVDB.h:3421
ValueIterator & operator=(const ValueIterator &)=default
__hostdev__ ValueIterator(const InternalNode *parent)
Definition NanoVDB.h:3321
__hostdev__ ValueIterator()
Definition NanoVDB.h:3316
__hostdev__ CoordType getOrigin() const
Definition NanoVDB.h:3332
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:3327
__hostdev__ CoordType getCoord() const
Definition NanoVDB.h:3337
__hostdev__ bool isActive() const
Definition NanoVDB.h:3338
__hostdev__ ValueOnIterator(const InternalNode *parent)
Definition NanoVDB.h:3360
__hostdev__ ValueOnIterator()
Definition NanoVDB.h:3355
__hostdev__ CoordType getOrigin() const
Definition NanoVDB.h:3371
ValueOnIterator & operator=(const ValueOnIterator &)=default
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:3366
__hostdev__ CoordType getCoord() const
Definition NanoVDB.h:3376
Internal nodes of a VDB tree.
Definition NanoVDB.h:3241
__hostdev__ const MaskType< LOG2DIM > & childMask() const
Definition NanoVDB.h:3448
__hostdev__ const FloatType & stdDeviation() const
Definition NanoVDB.h:3467
__hostdev__ const ValueType & minimum() const
Definition NanoVDB.h:3455
__hostdev__ ConstChildIterator cbeginChild() const
Definition NanoVDB.h:3307
__hostdev__ const ChildNodeType * probeChild(const CoordType &ijk) const
Definition NanoVDB.h:3498
__hostdev__ const ValueType & maximum() const
Definition NanoVDB.h:3458
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3250
__hostdev__ DenseIterator beginDense() const
Definition NanoVDB.h:3424
__hostdev__ DataType * data()
Definition NanoVDB.h:3433
ChildIter< const InternalNode > ConstChildIterator
Definition NanoVDB.h:3304
__hostdev__ DenseIterator cbeginChildAll() const
Definition NanoVDB.h:3425
InternalData< ChildT, Log2Dim > DataType
Definition NanoVDB.h:3243
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:3488
static __hostdev__ Coord OffsetToLocalCoord(uint32_t n)
Definition NanoVDB.h:3513
__hostdev__ ChildNodeType * probeChild(const CoordType &ijk)
Definition NanoVDB.h:3493
friend class ReadAccessor
Definition NanoVDB.h:3557
static constexpr uint32_t MASK
Definition NanoVDB.h:3260
static __hostdev__ uint32_t dim()
Definition NanoVDB.h:3438
typename ChildT::CoordType CoordType
Definition NanoVDB.h:3249
static constexpr uint32_t LEVEL
Definition NanoVDB.h:3261
__hostdev__ const MaskType< LOG2DIM > & getValueMask() const
Definition NanoVDB.h:3445
__hostdev__ FloatType variance() const
Definition NanoVDB.h:3464
__hostdev__ ValueIterator cbeginValueAll() const
Definition NanoVDB.h:3346
friend class InternalNode
Definition NanoVDB.h:3562
static constexpr uint32_t DIM
Definition NanoVDB.h:3258
__hostdev__ OpT::Type get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:3538
typename DataType::BuildT BuildType
Definition NanoVDB.h:3246
__hostdev__ void localToGlobalCoord(Coord &ijk) const
Definition NanoVDB.h:3521
typename Mask< Log2Dim >::template Iterator< On > MaskIterT
Definition NanoVDB.h:3254
__hostdev__ ValueType getFirstValue() const
Definition NanoVDB.h:3474
ChildT ChildNodeType
Definition NanoVDB.h:3248
typename DataType::ValueT ValueType
Definition NanoVDB.h:3244
typename DataType::StatsT FloatType
Definition NanoVDB.h:3245
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:3490
__hostdev__ void set(const CoordType &ijk, ArgsT &&... args)
Definition NanoVDB.h:3546
__hostdev__ ValueOnIterator beginValueOn() const
Definition NanoVDB.h:3379
__hostdev__ CoordType origin() const
Definition NanoVDB.h:3452
typename ChildT::LeafNodeType LeafNodeType
Definition NanoVDB.h:3247
static constexpr uint32_t TOTAL
Definition NanoVDB.h:3257
ChildIter< InternalNode > ChildIterator
Definition NanoVDB.h:3303
__hostdev__ ValueOnIterator cbeginValueOn() const
Definition NanoVDB.h:3380
static constexpr uint32_t LOG2DIM
Definition NanoVDB.h:3256
__hostdev__ ValueType getLastValue() const
Definition NanoVDB.h:3481
__hostdev__ const math::BBox< CoordType > & bbox() const
Definition NanoVDB.h:3470
__hostdev__ const MaskType< LOG2DIM > & getChildMask() const
Definition NanoVDB.h:3449
__hostdev__ ValueIterator beginValue() const
Definition NanoVDB.h:3345
static __hostdev__ uint32_t CoordToOffset(const CoordType &ijk)
Definition NanoVDB.h:3505
__hostdev__ Coord offsetToGlobalCoord(uint32_t n) const
Definition NanoVDB.h:3527
static constexpr uint32_t SIZE
Definition NanoVDB.h:3259
typename ChildT::template MaskType< LOG2 > MaskType
Definition NanoVDB.h:3252
__hostdev__ const LeafNodeType * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:3491
__hostdev__ ChildIterator beginChild()
Definition NanoVDB.h:3306
__hostdev__ const MaskType< LOG2DIM > & valueMask() const
Definition NanoVDB.h:3444
__hostdev__ const DataType * data() const
Definition NanoVDB.h:3435
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:3487
__hostdev__ const FloatType & average() const
Definition NanoVDB.h:3461
static constexpr uint64_t NUM_VALUES
Definition NanoVDB.h:3262
InternalNode & operator=(const InternalNode &)=delete
InternalNode(const InternalNode &)=delete
__hostdev__ bool isActive() const
Definition NanoVDB.h:3535
friend class RootNode
Definition NanoVDB.h:3560
static __hostdev__ size_t memUsage()
Definition NanoVDB.h:3441
ValueIterator & operator=(const ValueIterator &)=default
__hostdev__ CoordT getCoord() const
Definition NanoVDB.h:4325
__hostdev__ ValueIterator(const LeafNode *parent)
Definition NanoVDB.h:4313
__hostdev__ ValueIterator()
Definition NanoVDB.h:4308
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:4320
__hostdev__ ValueIterator & operator++()
Definition NanoVDB.h:4336
__hostdev__ ValueIterator operator++(int)
Definition NanoVDB.h:4341
__hostdev__ bool isActive() const
Definition NanoVDB.h:4330
__hostdev__ CoordT getCoord() const
Definition NanoVDB.h:4291
__hostdev__ ValueOffIterator()
Definition NanoVDB.h:4275
ValueOffIterator & operator=(const ValueOffIterator &)=default
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:4286
__hostdev__ ValueOffIterator(const LeafNode *parent)
Definition NanoVDB.h:4280
__hostdev__ ValueOnIterator()
Definition NanoVDB.h:4242
__hostdev__ CoordT getCoord() const
Definition NanoVDB.h:4258
__hostdev__ ValueOnIterator(const LeafNode *parent)
Definition NanoVDB.h:4247
ValueOnIterator & operator=(const ValueOnIterator &)=default
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:4253
Leaf nodes of the VDB tree. (defaults to 8x8x8 = 512 voxels)
Definition NanoVDB.h:4215
__hostdev__ void setValueOnly(uint32_t offset, const ValueType &v)
Sets the value at the specified location but leaves its state unchanged.
Definition NanoVDB.h:4457
__hostdev__ FloatType stdDeviation() const
Return a const reference to the standard deviation of all the active values encoded in this leaf node...
Definition NanoVDB.h:4382
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4229
__hostdev__ DataType * data()
Definition NanoVDB.h:4361
typename DataType::BuildType BuildType
Definition NanoVDB.h:4227
static __hostdev__ CoordT OffsetToLocalCoord(uint32_t n)
Compute the local coordinates from a linear offset.
Definition NanoVDB.h:4392
static __hostdev__ uint32_t padding()
Definition NanoVDB.h:4427
LeafData< BuildT, CoordT, MaskT, Log2Dim > DataType
Definition NanoVDB.h:4224
CoordT CoordType
Definition NanoVDB.h:4228
friend class ReadAccessor
Definition NanoVDB.h:4527
static constexpr uint32_t MASK
Definition NanoVDB.h:4357
__hostdev__ CoordT offsetToGlobalCoord(uint32_t n) const
Definition NanoVDB.h:4402
static __hostdev__ uint32_t dim()
Return the dimension, in index space, of this leaf node (typically 8 as for openvdb leaf nodes!...
Definition NanoVDB.h:4408
LeafNode< BuildT, CoordT, MaskT, Log2Dim > LeafNodeType
Definition NanoVDB.h:4223
static constexpr uint32_t LEVEL
Definition NanoVDB.h:4358
__hostdev__ const MaskType< LOG2DIM > & getValueMask() const
Definition NanoVDB.h:4367
__hostdev__ FloatType variance() const
Return the variance of all the active values encoded in this leaf node.
Definition NanoVDB.h:4379
__hostdev__ auto set(const uint32_t n, ArgsT &&... args)
Definition NanoVDB.h:4518
LeafNode & operator=(const LeafNode &)=delete
__hostdev__ CoordT origin() const
Return the origin in index space of this leaf node.
Definition NanoVDB.h:4387
__hostdev__ ValueIterator cbeginValueAll() const
Definition NanoVDB.h:4350
friend class InternalNode
Definition NanoVDB.h:4532
static constexpr uint32_t DIM
Definition NanoVDB.h:4355
__hostdev__ const LeafNode * probeLeaf(const CoordT &) const
Definition NanoVDB.h:4482
__hostdev__ ValueOffIterator cbeginValueOff() const
Definition NanoVDB.h:4299
__hostdev__ void localToGlobalCoord(Coord &ijk) const
Converts (in place) a local index coordinate to a global index coordinate.
Definition NanoVDB.h:4400
typename DataType::FloatType FloatType
Definition NanoVDB.h:4226
__hostdev__ ValueType getFirstValue() const
Return the first value in this leaf node.
Definition NanoVDB.h:4445
static __hostdev__ uint32_t CoordToOffset(const CoordT &ijk)
Definition NanoVDB.h:4485
typename Mask< Log2Dim >::template Iterator< ON > MaskIterT
Definition NanoVDB.h:4233
__hostdev__ void setValueOnly(const CoordT &ijk, const ValueType &v)
Definition NanoVDB.h:4458
__hostdev__ FloatType average() const
Return a const reference to the average of all the active values encoded in this leaf node.
Definition NanoVDB.h:4376
__hostdev__ math::BBox< CoordT > bbox() const
Return the bounding box in index space of active values in this leaf node.
Definition NanoVDB.h:4411
__hostdev__ bool probeValue(const CoordT &ijk, ValueType &v) const
Return true if the voxel value at the given coordinate is active and updates v with the value.
Definition NanoVDB.h:4475
__hostdev__ uint8_t flags() const
Definition NanoVDB.h:4384
__hostdev__ bool hasBBox() const
Definition NanoVDB.h:4472
__hostdev__ auto set(const CoordType &ijk, ArgsT &&... args)
Definition NanoVDB.h:4512
__hostdev__ ValueOffIterator beginValueOff() const
Definition NanoVDB.h:4298
__hostdev__ ValueOnIterator beginValueOn() const
Definition NanoVDB.h:4265
static constexpr uint32_t TOTAL
Definition NanoVDB.h:4354
__hostdev__ void setValue(const CoordT &ijk, const ValueType &v)
Sets the value at the specified location and activate its state.
Definition NanoVDB.h:4452
__hostdev__ bool isActive(const CoordT &ijk) const
Return true if the voxel value at the given coordinate is active.
Definition NanoVDB.h:4461
__hostdev__ ValueType minimum() const
Return a const reference to the minimum active value encoded in this leaf node.
Definition NanoVDB.h:4370
__hostdev__ auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:4500
__hostdev__ ValueOnIterator cbeginValueOn() const
Definition NanoVDB.h:4266
MaskT< LOG2 > MaskType
Definition NanoVDB.h:4231
__hostdev__ ValueType maximum() const
Return a const reference to the maximum active value encoded in this leaf node.
Definition NanoVDB.h:4373
static constexpr uint32_t LOG2DIM
Definition NanoVDB.h:4353
__hostdev__ ValueType getLastValue() const
Return the last value in this leaf node.
Definition NanoVDB.h:4447
__hostdev__ bool isActive(uint32_t n) const
Definition NanoVDB.h:4462
LeafNode(const LeafNode &)=delete
__hostdev__ ValueType getValue(const CoordT &ijk) const
Return the voxel value at the given coordinate.
Definition NanoVDB.h:4442
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:4565
__hostdev__ ValueIterator beginValue() const
Definition NanoVDB.h:4349
__hostdev__ uint64_t memUsage() const
return memory usage in bytes for the leaf node
Definition NanoVDB.h:4430
static constexpr uint32_t SIZE
Definition NanoVDB.h:4356
typename DataType::ValueType ValueType
Definition NanoVDB.h:4225
__hostdev__ auto get(const uint32_t n, ArgsT &&... args) const
Definition NanoVDB.h:4506
__hostdev__ ValueType getValue(uint32_t offset) const
Return the voxel value at the given offset.
Definition NanoVDB.h:4439
__hostdev__ const MaskType< LOG2DIM > & valueMask() const
Return a const reference to the bit mask of active voxels in this leaf node.
Definition NanoVDB.h:4366
__hostdev__ const DataType * data() const
Definition NanoVDB.h:4363
static constexpr uint64_t NUM_VALUES
Definition NanoVDB.h:4359
static __hostdev__ uint32_t voxelCount()
Return the total number of voxels (e.g. values) encoded in this leaf node.
Definition NanoVDB.h:4425
__hostdev__ bool isActive() const
Return true if any of the voxel value are active in this leaf node.
Definition NanoVDB.h:4465
friend class RootNode
Definition NanoVDB.h:4530
Definition NanoVDB.h:1096
DenseIterator & operator=(const DenseIterator &)=default
__hostdev__ DenseIterator & operator++()
Definition NanoVDB.h:1106
__hostdev__ DenseIterator operator++(int)
Definition NanoVDB.h:1111
__hostdev__ uint32_t pos() const
Definition NanoVDB.h:1104
__hostdev__ uint32_t operator*() const
Definition NanoVDB.h:1103
__hostdev__ DenseIterator(uint32_t pos=Mask::SIZE)
Definition NanoVDB.h:1098
Definition NanoVDB.h:1062
__hostdev__ Iterator operator++(int)
Definition NanoVDB.h:1083
__hostdev__ Iterator()
Definition NanoVDB.h:1064
Iterator & operator=(const Iterator &)=default
__hostdev__ uint32_t pos() const
Definition NanoVDB.h:1076
__hostdev__ uint32_t operator*() const
Definition NanoVDB.h:1075
__hostdev__ Iterator & operator++()
Definition NanoVDB.h:1078
__hostdev__ Iterator(uint32_t pos, const Mask *parent)
Definition NanoVDB.h:1069
Bit-mask to encode active states and facilitate sequential iterators and a fast codec for I/O compres...
Definition NanoVDB.h:1028
__hostdev__ Mask(const Mask &other)
Copy constructor.
Definition NanoVDB.h:1145
__hostdev__ bool isOff(uint32_t n) const
Return true if the given bit is NOT set.
Definition NanoVDB.h:1201
__hostdev__ void set(uint32_t n, bool on)
Set the specified bit on or off.
Definition NanoVDB.h:1260
__hostdev__ void setOn()
Set all bits on.
Definition NanoVDB.h:1273
__hostdev__ uint32_t countOn(uint32_t i) const
Return the number of lower set bits in mask up to but excluding the i'th bit.
Definition NanoVDB.h:1052
NANOVDB_HOSTDEV_DISABLE_WARNING __hostdev__ uint32_t findNext(uint32_t start) const
Definition NanoVDB.h:1343
__hostdev__ uint32_t countOn() const
Return the total number of set bits in this Mask.
Definition NanoVDB.h:1043
__hostdev__ uint64_t * words()
Return a pointer to the list of words of the bit mask.
Definition NanoVDB.h:1152
__hostdev__ Mask(bool on)
Definition NanoVDB.h:1137
__hostdev__ DenseIterator beginAll() const
Definition NanoVDB.h:1129
__hostdev__ void setOff(uint32_t n)
Set the specified bit off.
Definition NanoVDB.h:1224
__hostdev__ void setOff()
Set all bits off.
Definition NanoVDB.h:1279
Iterator< false > OffIterator
Definition NanoVDB.h:1123
Mask & operator=(const Mask &)=default
__hostdev__ Mask()
Initialize all bits to zero.
Definition NanoVDB.h:1132
__hostdev__ Mask & operator&=(const Mask &other)
Bitwise intersection.
Definition NanoVDB.h:1299
Iterator< true > OnIterator
Definition NanoVDB.h:1122
__hostdev__ util::enable_if<!util::is_same< MaskT, Mask >::value, Mask & >::type operator=(const MaskT &other)
Assignment operator that works with openvdb::util::NodeMask.
Definition NanoVDB.h:1172
__hostdev__ void toggle(uint32_t n)
Definition NanoVDB.h:1296
__hostdev__ bool operator!=(const Mask &other) const
Definition NanoVDB.h:1195
__hostdev__ bool isOff() const
Return true if none of the bits are set in this Mask.
Definition NanoVDB.h:1213
static constexpr uint32_t WORD_COUNT
Definition NanoVDB.h:1031
__hostdev__ OffIterator beginOff() const
Definition NanoVDB.h:1127
__hostdev__ void toggle()
brief Toggle the state of all bits in the mask
Definition NanoVDB.h:1291
__hostdev__ const uint64_t * words() const
Definition NanoVDB.h:1153
__hostdev__ void set(bool on)
Set all bits off.
Definition NanoVDB.h:1285
__hostdev__ OnIterator beginOn() const
Definition NanoVDB.h:1125
static __hostdev__ uint32_t wordCount()
Return the number of machine words used by this Mask.
Definition NanoVDB.h:1040
static __hostdev__ uint32_t bitCount()
Return the number of bits available in this Mask.
Definition NanoVDB.h:1037
__hostdev__ Mask & operator|=(const Mask &other)
Bitwise union.
Definition NanoVDB.h:1307
__hostdev__ bool operator==(const Mask &other) const
Definition NanoVDB.h:1186
NANOVDB_HOSTDEV_DISABLE_WARNING __hostdev__ uint32_t findPrev(uint32_t start) const
Definition NanoVDB.h:1357
__hostdev__ bool isOn(uint32_t n) const
Return true if the given bit is set.
Definition NanoVDB.h:1198
static constexpr uint32_t SIZE
Definition NanoVDB.h:1030
__hostdev__ bool isOn() const
Return true if all the bits are set in this Mask.
Definition NanoVDB.h:1204
__hostdev__ void setWord(WordT w, uint32_t n)
Definition NanoVDB.h:1163
NANOVDB_HOSTDEV_DISABLE_WARNING __hostdev__ uint32_t findFirst() const
Definition NanoVDB.h:1333
__hostdev__ Mask & operator-=(const Mask &other)
Bitwise difference.
Definition NanoVDB.h:1315
__hostdev__ Mask & operator^=(const Mask &other)
Bitwise XOR.
Definition NanoVDB.h:1323
__hostdev__ WordT getWord(uint32_t n) const
Definition NanoVDB.h:1156
__hostdev__ void setOn(uint32_t n)
Set the specified bit on.
Definition NanoVDB.h:1222
static __hostdev__ size_t memUsage()
Return the memory footprint in bytes of this Mask.
Definition NanoVDB.h:1034
__hostdev__ uint64_t voxelPoints(const Coord &ijk, const AttT *&begin, const AttT *&end) const
get iterators over attributes to points at a specific voxel location
Definition NanoVDB.h:5654
PointAccessor(const NanoGrid< Point > &grid)
Definition NanoVDB.h:5612
__hostdev__ uint64_t leafPoints(const Coord &ijk, const AttT *&begin, const AttT *&end) const
Return the number of points in the leaf node containing the coordinate ijk. If this return value is l...
Definition NanoVDB.h:5643
__hostdev__ uint64_t gridPoints(const AttT *&begin, const AttT *&end) const
Return the total number of point in the grid and set the iterators to the complete range of points.
Definition NanoVDB.h:5633
__hostdev__ const NanoGrid< Point > & grid() const
Definition NanoVDB.h:5629
__hostdev__ uint64_t voxelPoints(const Coord &ijk, const AttT *&begin, const AttT *&end) const
get iterators over attributes to points at a specific voxel location
Definition NanoVDB.h:5588
__hostdev__ uint64_t leafPoints(const Coord &ijk, const AttT *&begin, const AttT *&end) const
Return the number of points in the leaf node containing the coordinate ijk. If this return value is l...
Definition NanoVDB.h:5576
__hostdev__ uint64_t gridPoints(const AttT *&begin, const AttT *&end) const
Return the total number of point in the grid and set the iterators to the complete range of points.
Definition NanoVDB.h:5566
__hostdev__ const NanoGrid< BuildT > & grid() const
Definition NanoVDB.h:5562
PointAccessor(const NanoGrid< BuildT > &grid)
Definition NanoVDB.h:5549
Dummy type for indexing points into voxels.
Definition NanoVDB.h:202
__hostdev__ auto set(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:4862
ReadAccessor & operator=(const ReadAccessor &)=default
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:4847
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition NanoVDB.h:4812
friend class InternalNode
Definition NanoVDB.h:4872
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition NanoVDB.h:4851
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:4849
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:4848
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition NanoVDB.h:4845
typename RootT::CoordType CoordType
Definition NanoVDB.h:4807
__hostdev__ auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:4856
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition NanoVDB.h:4846
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition NanoVDB.h:4824
friend class LeafNode
Definition NanoVDB.h:4874
ReadAccessor(const ReadAccessor &)=default
Defaults constructors.
typename RootT::ValueType ValueType
Definition NanoVDB.h:4806
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition NanoVDB.h:4818
__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:4831
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:4839
static const int CacheLevels
Definition NanoVDB.h:4809
BuildT BuildType
Definition NanoVDB.h:4805
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition NanoVDB.h:4844
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:4843
__hostdev__ const RootT & root() const
Definition NanoVDB.h:4833
friend class RootNode
Allow nodes to insert themselves into the cache.
Definition NanoVDB.h:4870
ReadAccessor & operator=(const ReadAccessor &)=default
__hostdev__ void set(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:4978
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:4959
CoordT CoordType
Definition NanoVDB.h:4906
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition NanoVDB.h:4911
friend class InternalNode
Definition NanoVDB.h:4989
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition NanoVDB.h:4964
__hostdev__ OpT::Type get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:4971
ValueT ValueType
Definition NanoVDB.h:4905
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:4961
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:4960
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition NanoVDB.h:4957
__hostdev__ bool isCached(const CoordType &ijk) const
Definition NanoVDB.h:4944
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition NanoVDB.h:4958
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition NanoVDB.h:4925
friend class LeafNode
Definition NanoVDB.h:4991
ReadAccessor(const ReadAccessor &)=default
Defaults constructors.
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition NanoVDB.h:4919
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition NanoVDB.h:4931
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:4951
static const int CacheLevels
Definition NanoVDB.h:4908
BuildT BuildType
Definition NanoVDB.h:4904
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition NanoVDB.h:4956
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:4955
__hostdev__ const RootT & root() const
Definition NanoVDB.h:4937
friend class RootNode
Allow nodes to insert themselves into the cache.
Definition NanoVDB.h:4987
ReadAccessor & operator=(const ReadAccessor &)=default
__hostdev__ bool isCached1(const CoordType &ijk) const
Definition NanoVDB.h:5110
__hostdev__ void set(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:5169
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:5132
CoordT CoordType
Definition NanoVDB.h:5036
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition NanoVDB.h:5041
friend class InternalNode
Definition NanoVDB.h:5189
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition NanoVDB.h:5137
__hostdev__ OpT::Type get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:5153
ValueT ValueType
Definition NanoVDB.h:5035
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:5134
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:5133
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition NanoVDB.h:5130
__hostdev__ bool isCached2(const CoordType &ijk) const
Definition NanoVDB.h:5116
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition NanoVDB.h:5131
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition NanoVDB.h:5060
friend class LeafNode
Definition NanoVDB.h:5191
ReadAccessor(const ReadAccessor &)=default
Defaults constructors.
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition NanoVDB.h:5054
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition NanoVDB.h:5066
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:5124
static const int CacheLevels
Definition NanoVDB.h:5038
BuildT BuildType
Definition NanoVDB.h:5034
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition NanoVDB.h:5129
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:5128
__hostdev__ const RootT & root() const
Definition NanoVDB.h:5077
friend class RootNode
Allow nodes to insert themselves into the cache.
Definition NanoVDB.h:5187
Definition NanoVDB.h:2089
Definition NanoVDB.h:2659
__hostdev__ TileT & operator*() const
Definition NanoVDB.h:2683
TileT * mPos
Definition NanoVDB.h:2663
__hostdev__ TileIter()
Definition NanoVDB.h:2666
TileT * mBegin
Definition NanoVDB.h:2663
__hostdev__ TileIter(DataT *data, uint32_t pos=0)
Definition NanoVDB.h:2667
typename util::match_const< ChildT, DataT >::type NodeT
Definition NanoVDB.h:2662
__hostdev__ bool isChild() const
Definition NanoVDB.h:2698
typename util::match_const< Tile, DataT >::type TileT
Definition NanoVDB.h:2661
TileT * mEnd
Definition NanoVDB.h:2663
__hostdev__ ValueT value() const
Definition NanoVDB.h:2718
__hostdev__ RootData * data() const
Definition NanoVDB.h:2693
__hostdev__ bool isValueOn() const
Definition NanoVDB.h:2708
__hostdev__ bool isValue() const
Definition NanoVDB.h:2703
__hostdev__ NodeT * child() const
Definition NanoVDB.h:2713
__hostdev__ auto pos() const
Definition NanoVDB.h:2677
__hostdev__ TileIter & operator++()
Definition NanoVDB.h:2678
__hostdev__ TileT * operator->() const
Definition NanoVDB.h:2688
__hostdev__ BaseIter(DataT *data)
Definition NanoVDB.h:2834
__hostdev__ BaseIter()
Definition NanoVDB.h:2833
typename util::match_const< Tile, RootT >::type TileT
Definition NanoVDB.h:2831
DataType::template TileIter< DataT > mTileIter
Definition NanoVDB.h:2832
__hostdev__ CoordType getOrigin() const
Definition NanoVDB.h:2840
typename util::match_const< DataType, RootT >::type DataT
Definition NanoVDB.h:2830
__hostdev__ uint32_t pos() const
Definition NanoVDB.h:2838
__hostdev__ TileT * tile() const
Definition NanoVDB.h:2839
__hostdev__ CoordType getCoord() const
Definition NanoVDB.h:2841
Definition NanoVDB.h:2846
__hostdev__ NodeT & operator*() const
Definition NanoVDB.h:2858
__hostdev__ ChildIter operator++(int)
Definition NanoVDB.h:2866
__hostdev__ ChildIter(RootT *parent)
Definition NanoVDB.h:2854
__hostdev__ ChildIter & operator++()
Definition NanoVDB.h:2860
__hostdev__ NodeT * operator->() const
Definition NanoVDB.h:2859
__hostdev__ ChildIter()
Definition NanoVDB.h:2853
Definition NanoVDB.h:2949
__hostdev__ NodeT * probeChild(ValueType &value) const
Definition NanoVDB.h:2957
__hostdev__ DenseIter operator++(int)
Definition NanoVDB.h:2969
__hostdev__ DenseIter & operator++()
Definition NanoVDB.h:2964
__hostdev__ DenseIter()
Definition NanoVDB.h:2955
__hostdev__ DenseIter(RootT *parent)
Definition NanoVDB.h:2956
__hostdev__ bool isValueOn() const
Definition NanoVDB.h:2963
Definition NanoVDB.h:2882
__hostdev__ ValueIter & operator++()
Definition NanoVDB.h:2894
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:2892
__hostdev__ ValueIter operator++(int)
Definition NanoVDB.h:2900
__hostdev__ ValueIter()
Definition NanoVDB.h:2887
__hostdev__ ValueIter(RootT *parent)
Definition NanoVDB.h:2888
__hostdev__ bool isActive() const
Definition NanoVDB.h:2893
Definition NanoVDB.h:2916
__hostdev__ ValueOnIter(RootT *parent)
Definition NanoVDB.h:2922
__hostdev__ ValueOnIter()
Definition NanoVDB.h:2921
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:2926
__hostdev__ ValueOnIter operator++(int)
Definition NanoVDB.h:2933
__hostdev__ ValueOnIter & operator++()
Definition NanoVDB.h:2927
Top-most node of the VDB tree structure.
Definition NanoVDB.h:2805
__hostdev__ const FloatType & stdDeviation() const
Definition NanoVDB.h:3022
__hostdev__ const ValueType & minimum() const
Definition NanoVDB.h:3010
__hostdev__ ConstChildIterator cbeginChild() const
Definition NanoVDB.h:2878
__hostdev__ DenseIterator beginDense()
Definition NanoVDB.h:2980
__hostdev__ const ValueType & maximum() const
Definition NanoVDB.h:3013
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:2822
ChildIter< const RootNode > ConstChildIterator
Definition NanoVDB.h:2875
__hostdev__ DataType * data()
Definition NanoVDB.h:2992
__hostdev__ bool isEmpty() const
Definition NanoVDB.h:3031
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:3036
__hostdev__ ConstValueOnIterator cbeginValueOn() const
Definition NanoVDB.h:2945
__hostdev__ ValueIterator beginValue()
Definition NanoVDB.h:2911
friend class ReadAccessor
Definition NanoVDB.h:3066
ChildT UpperNodeType
Definition NanoVDB.h:2811
typename ChildT::CoordType CoordType
Definition NanoVDB.h:2818
static constexpr uint32_t LEVEL
Definition NanoVDB.h:2824
__hostdev__ FloatType variance() const
Definition NanoVDB.h:3019
RootNode & operator=(const RootNode &)=delete
ValueOnIter< RootNode > ValueOnIterator
Definition NanoVDB.h:2941
ValueIter< const RootNode > ConstValueIterator
Definition NanoVDB.h:2909
__hostdev__ OpT::Type get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:3042
RootData< ChildT > DataType
Definition NanoVDB.h:2807
__hostdev__ const uint32_t & tileCount() const
Definition NanoVDB.h:3006
typename DataType::BuildT BuildType
Definition NanoVDB.h:2816
ValueIter< RootNode > ValueIterator
Definition NanoVDB.h:2908
RootNode(const RootNode &)=delete
ChildT ChildNodeType
Definition NanoVDB.h:2808
typename DataType::ValueT ValueType
Definition NanoVDB.h:2814
__hostdev__ ConstDenseIterator cbeginDense() const
Definition NanoVDB.h:2981
RootType RootNodeType
Definition NanoVDB.h:2810
__hostdev__ ConstValueIterator cbeginValueAll() const
Definition NanoVDB.h:2912
RootNode< ChildT > RootType
Definition NanoVDB.h:2809
typename DataType::StatsT FloatType
Definition NanoVDB.h:2815
__hostdev__ const ValueType & background() const
Definition NanoVDB.h:3003
ChildIter< RootNode > ChildIterator
Definition NanoVDB.h:2874
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:3038
__hostdev__ ValueOnIterator beginValueOn()
Definition NanoVDB.h:2944
__hostdev__ void set(const CoordType &ijk, ArgsT &&... args)
Definition NanoVDB.h:3052
friend class Tree
Definition NanoVDB.h:3069
typename ChildT::LeafNodeType LeafNodeType
Definition NanoVDB.h:2813
DefaultReadAccessor< BuildType > AccessorType
Definition NanoVDB.h:2820
math::BBox< CoordType > BBoxType
Definition NanoVDB.h:2819
ValueOnIter< const RootNode > ConstValueOnIterator
Definition NanoVDB.h:2942
__hostdev__ ConstDenseIterator cbeginChildAll() const
Definition NanoVDB.h:2982
__hostdev__ const BBoxType & bbox() const
Definition NanoVDB.h:2997
typename DataType::Tile Tile
Definition NanoVDB.h:2821
__hostdev__ uint64_t memUsage() const
Definition NanoVDB.h:3028
typename UpperNodeType::ChildNodeType LowerNodeType
Definition NanoVDB.h:2812
__hostdev__ AccessorType getAccessor() const
Definition NanoVDB.h:2990
__hostdev__ const LeafNodeType * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:3039
static __hostdev__ uint64_t memUsage(uint32_t tableSize)
Definition NanoVDB.h:3025
__hostdev__ ChildIterator beginChild()
Definition NanoVDB.h:2877
__hostdev__ const DataType * data() const
Definition NanoVDB.h:2994
RootNode()=delete
This class cannot be constructed or deleted.
__hostdev__ const uint32_t & getTableSize() const
Definition NanoVDB.h:3007
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:3034
__hostdev__ const FloatType & average() const
Definition NanoVDB.h:3016
DenseIter< const RootNode > ConstDenseIterator
Definition NanoVDB.h:2978
DenseIter< RootNode > DenseIterator
Definition NanoVDB.h:2977
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:3035
VDB Tree, which is a thin wrapper around a RootNode.
Definition NanoVDB.h:2395
typename RootT::ChildNodeType Node2
Definition NanoVDB.h:2414
__hostdev__ const NodeT * getFirstNode() const
Definition NanoVDB.h:2505
typename RootType::LeafNodeType LeafNodeType
Definition NanoVDB.h:2407
__hostdev__ DataType * data()
Definition NanoVDB.h:2424
RootT Node3
Definition NanoVDB.h:2413
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:2442
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:2429
__hostdev__ const NodeTrait< NanoRoot< BuildT >, 2 >::type * getFirstUpper() const
Definition NanoVDB.h:2535
__hostdev__ NanoRoot< BuildT > & root()
Definition NanoVDB.h:2431
__hostdev__ NodeTrait< NanoRoot< BuildT >, 1 >::type * getFirstLower()
Definition NanoVDB.h:2532
__hostdev__ uint32_t nodeCount() const
Definition NanoVDB.h:2474
typename RootNodeType::ChildNodeType UpperNodeType
Definition NanoVDB.h:2405
__hostdev__ LeafNodeType * getFirstLeaf()
Definition NanoVDB.h:2530
Tree()=delete
This class cannot be constructed or deleted.
__hostdev__ const LeafNodeType * getFirstLeaf() const
Definition NanoVDB.h:2531
__hostdev__ const ValueType & background() const
Definition NanoVDB.h:2451
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:2448
__hostdev__ auto set(const CoordType &ijk, ArgsT &&... args)
Definition NanoVDB.h:2544
RootT RootNodeType
Definition NanoVDB.h:2404
typename RootT::CoordType CoordType
Definition NanoVDB.h:2410
__hostdev__ uint64_t activeVoxelCount() const
Definition NanoVDB.h:2460
DefaultReadAccessor< BuildType > AccessorType
Definition NanoVDB.h:2411
__hostdev__ auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:2538
Tree(const Tree &)=delete
LeafNodeType Node0
Definition NanoVDB.h:2416
__hostdev__ NodeTrait< NanoRoot< BuildT >, LEVEL >::type * getFirstNode()
Definition NanoVDB.h:2515
__hostdev__ NodeT * getFirstNode()
Definition NanoVDB.h:2495
typename Node2::ChildNodeType Node1
Definition NanoVDB.h:2415
__hostdev__ uint32_t totalNodeCount() const
Definition NanoVDB.h:2486
RootT RootType
Definition NanoVDB.h:2403
__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:2533
typename UpperNodeType::ChildNodeType LowerNodeType
Definition NanoVDB.h:2406
__hostdev__ AccessorType getAccessor() const
Definition NanoVDB.h:2435
typename RootT::ValueType ValueType
Definition NanoVDB.h:2408
__hostdev__ const NodeTrait< NanoRoot< BuildT >, LEVEL >::type * getFirstNode() const
Definition NanoVDB.h:2524
__hostdev__ uint32_t nodeCount(int level) const
Definition NanoVDB.h:2480
__hostdev__ const uint32_t & activeTileCount(uint32_t level) const
Definition NanoVDB.h:2467
TreeData DataType
Definition NanoVDB.h:2402
__hostdev__ const DataType * data() const
Definition NanoVDB.h:2426
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:2438
__hostdev__ NodeTrait< NanoRoot< BuildT >, 2 >::type * getFirstUpper()
Definition NanoVDB.h:2534
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:2439
__hostdev__ const NanoRoot< BuildT > & root() const
Definition NanoVDB.h:2433
typename RootT::BuildType BuildType
Definition NanoVDB.h:2409
Like ValueIndex but with a mutable mask.
Definition NanoVDB.h:178
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:184
Like ValueOnIndex but with a mutable mask.
Definition NanoVDB.h:181
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:674
__hostdev__ Version(uint32_t major, uint32_t minor, uint32_t patch)
Constructor from major.minor.patch version numbers.
Definition NanoVDB.h:688
__hostdev__ uint32_t getMajor() const
Definition NanoVDB.h:701
__hostdev__ Version()
Default constructor.
Definition NanoVDB.h:679
static constexpr uint32_t End
Definition NanoVDB.h:677
__hostdev__ bool operator<=(const Version &rhs) const
Definition NanoVDB.h:697
__hostdev__ bool operator==(const Version &rhs) const
Definition NanoVDB.h:695
__hostdev__ Version(uint32_t data)
Constructor from a raw uint32_t data representation.
Definition NanoVDB.h:686
__hostdev__ int age() const
Returns the difference between major version of this instance and NANOVDB_MAJOR_VERSION_NUMBER.
Definition NanoVDB.h:708
__hostdev__ bool isCompatible() const
Definition NanoVDB.h:704
__hostdev__ bool operator>(const Version &rhs) const
Definition NanoVDB.h:698
__hostdev__ uint32_t getMinor() const
Definition NanoVDB.h:702
__hostdev__ bool operator>=(const Version &rhs) const
Definition NanoVDB.h:699
__hostdev__ bool operator<(const Version &rhs) const
Definition NanoVDB.h:696
__hostdev__ uint32_t id() const
Definition NanoVDB.h:700
__hostdev__ uint32_t getPatch() const
Definition NanoVDB.h:703
static constexpr uint32_t StrLen
Definition NanoVDB.h:677
Definition NanoVDB.h:5781
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:5883
__hostdev__ Codec toCodec(const char *str)
Definition NanoVDB.h:5805
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:5940
__hostdev__ const char * toStr(char *dst, Codec codec)
Definition NanoVDB.h:5795
Codec
Define compression codecs.
Definition NanoVDB.h:5789
@ StrLen
Definition NanoVDB.h:5793
@ ZIP
Definition NanoVDB.h:5790
@ End
Definition NanoVDB.h:5792
@ BLOSC
Definition NanoVDB.h:5791
@ NONE
Definition NanoVDB.h:5789
void writeUncompressedGrids(const char *fileName, const VecT< GridHandleT > &handles, bool raw=false)
write multiple NanoVDB grids to a single file, without compression.
Definition NanoVDB.h:5912
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:622
uint32_t findHighestOn(uint32_t v)
Returns the index of the highest, i.e. most significant, on bit in the specified 32 bit word.
Definition Util.h:572
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:478
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:502
static int64_t PtrDiff(const void *p, const void *q)
Compute the distance, in bytes, between two pointers, dist = p - q.
Definition Util.h:464
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:558
Grid< Fp4Tree > Fp4Grid
Definition NanoVDB.h:4668
ReadAccessor< BuildT, 0, 1, 2 > DefaultReadAccessor
Definition NanoVDB.h:2092
PointType
Definition NanoVDB.h:396
@ Voxel32
Definition NanoVDB.h:402
@ Grid32
Definition NanoVDB.h:401
@ Voxel8
Definition NanoVDB.h:404
@ Default
Definition NanoVDB.h:405
@ PointID
Definition NanoVDB.h:397
@ World32
Definition NanoVDB.h:399
@ Disable
Definition NanoVDB.h:396
@ Voxel16
Definition NanoVDB.h:403
@ World64
Definition NanoVDB.h:398
@ Grid64
Definition NanoVDB.h:400
auto callNanoGrid(GridDataT *gridData, ArgsT &&... args)
Below is an example of the struct used for generic programming with callNanoGrid.
Definition NanoVDB.h:4719
__hostdev__ constexpr uint32_t strlen()
return the number of characters (including null termination) required to convert enum type to a strin...
Definition NanoVDB.h:210
Grid< Vec4fTree > Vec4fGrid
Definition NanoVDB.h:4678
Grid< NanoTree< BuildT > > NanoGrid
Definition NanoVDB.h:4614
__hostdev__ CheckMode toCheckMode(const Checksum &checksum)
Maps 64 bit checksum to CheckMode enum.
Definition NanoVDB.h:1866
Grid< OnIndexMaskTree > OnIndexMaskGrid
Definition NanoVDB.h:4687
__hostdev__ GridType toGridType()
Maps from a templated build type to a GridType enum.
Definition NanoVDB.h:807
__hostdev__ char * toStr(char *dst, GridType gridType)
Maps a GridType to a c-string.
Definition NanoVDB.h:254
NanoTree< Vec3i > Vec3ITree
Definition NanoVDB.h:4659
Grid< Fp16Tree > Fp16Grid
Definition NanoVDB.h:4670
Grid< FloatTree > FloatGrid
Definition NanoVDB.h:4667
Grid< Vec3fTree > Vec3fGrid
Definition NanoVDB.h:4676
__hostdev__ bool isInteger(GridType gridType)
Return true if the GridType maps to a POD integer type.
Definition NanoVDB.h:584
InternalNode< NanoLeaf< BuildT >, 4 > NanoLower
Definition NanoVDB.h:4606
Grid< Vec4dTree > Vec4dGrid
Definition NanoVDB.h:4679
__hostdev__ MagicType toMagic(uint64_t magic)
maps 64 bits of magic number to enum
Definition NanoVDB.h:367
Grid< BoolTree > BoolGrid
Definition NanoVDB.h:4682
InternalNode< NanoLower< BuildT >, 5 > NanoUpper
Definition NanoVDB.h:4608
GridClass
Classes (superset of OpenVDB) that are currently supported by NanoVDB.
Definition NanoVDB.h:291
@ FogVolume
Definition NanoVDB.h:293
@ TensorGrid
Definition NanoVDB.h:300
@ VoxelVolume
Definition NanoVDB.h:298
@ End
Definition NanoVDB.h:301
@ Unknown
Definition NanoVDB.h:291
@ Topology
Definition NanoVDB.h:297
@ PointIndex
Definition NanoVDB.h:295
@ IndexGrid
Definition NanoVDB.h:299
@ PointData
Definition NanoVDB.h:296
@ Staggered
Definition NanoVDB.h:294
@ LevelSet
Definition NanoVDB.h:292
GridType
List of types that are currently supported by NanoVDB.
Definition NanoVDB.h:220
@ Vec3u8
Definition NanoVDB.h:244
@ Float
Definition NanoVDB.h:221
@ Boolean
Definition NanoVDB.h:231
@ Vec4f
Definition NanoVDB.h:237
@ Int16
Definition NanoVDB.h:223
@ StrLen
Definition NanoVDB.h:248
@ Fp4
Definition NanoVDB.h:233
@ Mask
Definition NanoVDB.h:228
@ OnIndexMask
Definition NanoVDB.h:242
@ Vec3u16
Definition NanoVDB.h:245
@ Vec4d
Definition NanoVDB.h:238
@ IndexMask
Definition NanoVDB.h:241
@ Fp8
Definition NanoVDB.h:234
@ End
Definition NanoVDB.h:247
@ Unknown
Definition NanoVDB.h:220
@ Index
Definition NanoVDB.h:239
@ FpN
Definition NanoVDB.h:236
@ UInt8
Definition NanoVDB.h:246
@ RGBA8
Definition NanoVDB.h:232
@ Int32
Definition NanoVDB.h:224
@ OnIndex
Definition NanoVDB.h:240
@ Half
Definition NanoVDB.h:229
@ PointIndex
Definition NanoVDB.h:243
@ Vec3d
Definition NanoVDB.h:227
@ Double
Definition NanoVDB.h:222
@ UInt32
Definition NanoVDB.h:230
@ Vec3f
Definition NanoVDB.h:226
@ Int64
Definition NanoVDB.h:225
@ Fp16
Definition NanoVDB.h:235
CheckMode
List of different modes for computing for a checksum.
Definition NanoVDB.h:1764
@ Partial
Definition NanoVDB.h:1767
@ Full
Definition NanoVDB.h:1769
@ Disable
Definition NanoVDB.h:1764
@ Half
Definition NanoVDB.h:1766
@ Empty
Definition NanoVDB.h:1765
Grid< Vec3dTree > Vec3dGrid
Definition NanoVDB.h:4677
Grid< Point > PointGrid
Definition NanoVDB.h:4683
NanoTree< ValueOnIndexMask > OnIndexMaskTree
Definition NanoVDB.h:4665
RootNode< NanoUpper< BuildT > > NanoRoot
Definition NanoVDB.h:4610
ReadAccessor< ValueT, LEVEL0, LEVEL1, LEVEL2 > createAccessor(const NanoGrid< ValueT > &grid)
Free-standing function for convenient creation of a ReadAccessor with optional and customizable node ...
Definition NanoVDB.h:5436
NanoTree< ValueMask > MaskTree
Definition NanoVDB.h:4660
GridFlags
Grid flags which indicate what extra information is present in the grid buffer.
Definition NanoVDB.h:328
@ HasAverage
Definition NanoVDB.h:332
@ HasStdDeviation
Definition NanoVDB.h:333
@ HasLongGridName
Definition NanoVDB.h:329
@ HasMinMax
Definition NanoVDB.h:331
@ End
Definition NanoVDB.h:335
@ HasBBox
Definition NanoVDB.h:330
@ IsBreadthFirst
Definition NanoVDB.h:334
Grid< OnIndexTree > OnIndexGrid
Definition NanoVDB.h:4685
Grid< Vec3ITree > Vec3IGrid
Definition NanoVDB.h:4680
Grid< Fp8Tree > Fp8Grid
Definition NanoVDB.h:4669
Grid< Int64Tree > Int64Grid
Definition NanoVDB.h:4675
Tree< NanoRoot< BuildT > > NanoTree
Definition NanoVDB.h:4612
__hostdev__ GridType mapToGridType()
Definition NanoVDB.h:867
NanoTree< int32_t > Int32Tree
Definition NanoVDB.h:4652
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:4604
NanoTree< ValueOnIndex > OnIndexTree
Definition NanoVDB.h:4663
GridBlindDataClass
Blind-data Classes that are currently supported by NanoVDB.
Definition NanoVDB.h:411
@ ChannelArray
Definition NanoVDB.h:415
@ End
Definition NanoVDB.h:416
@ IndexArray
Definition NanoVDB.h:412
@ AttributeArray
Definition NanoVDB.h:413
@ GridName
Definition NanoVDB.h:414
NanoTree< double > DoubleTree
Definition NanoVDB.h:4651
NanoTree< ValueIndex > IndexTree
Definition NanoVDB.h:4662
__hostdev__ bool isFloatingPointVector(GridType gridType)
return true if the GridType maps to a floating point vec3.
Definition NanoVDB.h:572
NanoTree< Vec4d > Vec4dTree
Definition NanoVDB.h:4658
Grid< UInt32Tree > UInt32Grid
Definition NanoVDB.h:4674
NanoTree< Fp8 > Fp8Tree
Definition NanoVDB.h:4648
static __hostdev__ bool isAligned(const void *p)
return true if the specified pointer is 32 byte aligned
Definition NanoVDB.h:542
MagicType
Enums used to identify magic numbers recognized by NanoVDB.
Definition NanoVDB.h:358
@ OpenVDB
Definition NanoVDB.h:359
@ NanoGrid
Definition NanoVDB.h:361
@ Unknown
Definition NanoVDB.h:358
@ NanoVDB
Definition NanoVDB.h:360
@ NanoFile
Definition NanoVDB.h:362
NanoTree< int64_t > Int64Tree
Definition NanoVDB.h:4654
__hostdev__ bool isValid(GridType gridType, GridClass gridClass)
return true if the combination of GridType and GridClass is valid.
Definition NanoVDB.h:608
NanoTree< Vec4f > Vec4fTree
Definition NanoVDB.h:4657
NanoTree< Vec3d > Vec3dTree
Definition NanoVDB.h:4656
NanoTree< Fp16 > Fp16Tree
Definition NanoVDB.h:4649
Grid< MaskTree > MaskGrid
Definition NanoVDB.h:4681
NanoTree< ValueIndexMask > IndexMaskTree
Definition NanoVDB.h:4664
static __hostdev__ uint64_t alignmentPadding(const void *p)
return the smallest number of bytes that when added to the specified pointer results in a 32 byte ali...
Definition NanoVDB.h:545
NanoTree< FpN > FpNTree
Definition NanoVDB.h:4650
__hostdev__ bool isIndex(GridType gridType)
Return true if the GridType maps to a special index type (not a POD integer type).
Definition NanoVDB.h:597
static __hostdev__ T * alignPtr(T *p)
offset the specified pointer so it is 32 byte aligned. Works with both const and non-const pointers.
Definition NanoVDB.h:553
Grid< IndexTree > IndexGrid
Definition NanoVDB.h:4684
GridBlindDataSemantic
Blind-data Semantics that are currently understood by NanoVDB.
Definition NanoVDB.h:419
@ PointRadius
Definition NanoVDB.h:423
@ PointPosition
Definition NanoVDB.h:420
@ PointColor
Definition NanoVDB.h:421
@ VoxelCoords
Definition NanoVDB.h:428
@ PointVelocity
Definition NanoVDB.h:424
@ End
Definition NanoVDB.h:429
@ Unknown
Definition NanoVDB.h:419
@ GridCoords
Definition NanoVDB.h:427
@ WorldCoords
Definition NanoVDB.h:426
@ PointNormal
Definition NanoVDB.h:422
@ PointId
Definition NanoVDB.h:425
Grid< Int32Tree > Int32Grid
Definition NanoVDB.h:4673
NanoTree< Vec3f > Vec3fTree
Definition NanoVDB.h:4655
NanoTree< bool > BoolTree
Definition NanoVDB.h:4661
NanoTree< uint32_t > UInt32Tree
Definition NanoVDB.h:4653
Grid< IndexMaskTree > IndexMaskGrid
Definition NanoVDB.h:4686
__hostdev__ GridClass mapToGridClass(GridClass defaultClass=GridClass::Unknown)
Definition NanoVDB.h:889
Grid< DoubleTree > DoubleGrid
Definition NanoVDB.h:4672
Grid< FpNTree > FpNGrid
Definition NanoVDB.h:4671
NanoTree< float > FloatTree
Definition NanoVDB.h:4646
NanoTree< Fp4 > Fp4Tree
Definition NanoVDB.h:4647
__hostdev__ GridClass toGridClass(GridClass defaultClass=GridClass::Unknown)
Maps from a templated build type to a GridClass enum.
Definition NanoVDB.h:873
#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:906
uint32_t mFlags
Definition NanoVDB.h:911
uint64_t mFlags
Definition NanoVDB.h:916
uint8_t mFlags
Definition NanoVDB.h:901
float type
Definition NanoVDB.h:522
float Type
Definition NanoVDB.h:521
float type
Definition NanoVDB.h:508
float Type
Definition NanoVDB.h:507
float type
Definition NanoVDB.h:515
float Type
Definition NanoVDB.h:514
float type
Definition NanoVDB.h:529
float Type
Definition NanoVDB.h:528
float type
Definition NanoVDB.h:501
float Type
Definition NanoVDB.h:500
uint64_t Type
Definition NanoVDB.h:535
uint64_t type
Definition NanoVDB.h:536
uint64_t Type
Definition NanoVDB.h:479
uint64_t type
Definition NanoVDB.h:480
uint64_t Type
Definition NanoVDB.h:465
uint64_t type
Definition NanoVDB.h:466
bool Type
Definition NanoVDB.h:493
bool type
Definition NanoVDB.h:494
uint64_t Type
Definition NanoVDB.h:486
uint64_t type
Definition NanoVDB.h:487
uint64_t Type
Definition NanoVDB.h:472
uint64_t type
Definition NanoVDB.h:473
Maps one type (e.g. the build types above) to other (actual) types.
Definition NanoVDB.h:457
T Type
Definition NanoVDB.h:458
T type
Definition NanoVDB.h:459
Define static boolean tests for template build types.
Definition NanoVDB.h:436
static constexpr bool is_indexmask
Definition NanoVDB.h:441
static constexpr bool is_offindex
Definition NanoVDB.h:440
static constexpr bool is_onindex
Definition NanoVDB.h:439
static constexpr bool is_index
Definition NanoVDB.h:438
static constexpr bool is_Fp
Definition NanoVDB.h:445
static constexpr bool is_float
Definition NanoVDB.h:447
static constexpr bool is_special
Definition NanoVDB.h:449
static constexpr bool is_FpX
Definition NanoVDB.h:443
double FloatType
Definition NanoVDB.h:800
double FloatType
Definition NanoVDB.h:758
uint64_t FloatType
Definition NanoVDB.h:776
uint64_t FloatType
Definition NanoVDB.h:770
bool FloatType
Definition NanoVDB.h:794
uint64_t FloatType
Definition NanoVDB.h:788
uint64_t FloatType
Definition NanoVDB.h:782
bool FloatType
Definition NanoVDB.h:764
float FloatType
Definition NanoVDB.h:752
Implements Tree::getDim(math::Coord)
Definition NanoVDB.h:6111
static __hostdev__ Type get(const NanoUpper< BuildT > &, uint32_t)
Definition NanoVDB.h:6116
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6115
uint32_t Type
Definition NanoVDB.h:6112
static __hostdev__ Type get(const NanoLower< BuildT > &, uint32_t)
Definition NanoVDB.h:6117
static constexpr int LEVEL
Definition NanoVDB.h:6113
static __hostdev__ Type get(const NanoLeaf< BuildT > &, uint32_t)
Definition NanoVDB.h:6118
static __hostdev__ Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6114
Return the pointer to the leaf node that contains math::Coord. Implements Tree::probeLeaf(math::Coord...
Definition NanoVDB.h:6125
static __hostdev__ Type get(const NanoUpper< BuildT > &, uint32_t)
Definition NanoVDB.h:6130
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6129
static __hostdev__ Type get(const NanoLower< BuildT > &, uint32_t)
Definition NanoVDB.h:6131
static constexpr int LEVEL
Definition NanoVDB.h:6127
const NanoLeaf< BuildT > * Type
Definition NanoVDB.h:6126
static __hostdev__ Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6128
static __hostdev__ Type get(const NanoLeaf< BuildT > &leaf, uint32_t)
Definition NanoVDB.h:6132
Return point to the lower internal node where math::Coord maps to one of its values,...
Definition NanoVDB.h:6139
const NanoLower< BuildT > * Type
Definition NanoVDB.h:6140
static __hostdev__ Type get(const NanoUpper< BuildT > &, uint32_t)
Definition NanoVDB.h:6144
static __hostdev__ Type get(const NanoLower< BuildT > &node, uint32_t)
Definition NanoVDB.h:6145
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6143
static constexpr int LEVEL
Definition NanoVDB.h:6141
static __hostdev__ Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6142
Definition NanoVDB.h:6214
uint32_t level
Definition NanoVDB.h:6215
FloatType average
Definition NanoVDB.h:6217
ValueType maximum
Definition NanoVDB.h:6216
CoordBBox bbox
Definition NanoVDB.h:6218
ValueType minimum
Definition NanoVDB.h:6216
uint32_t dim
Definition NanoVDB.h:6215
FloatType stdDevi
Definition NanoVDB.h:6217
Implements Tree::getNodeInfo(math::Coord)
Definition NanoVDB.h:6210
static __hostdev__ Type get(const NanoUpper< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6230
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &tile)
Definition NanoVDB.h:6226
static __hostdev__ Type get(const NanoLeaf< BuildT > &leaf, uint32_t n)
Definition NanoVDB.h:6238
typename NanoLeaf< BuildT >::ValueType ValueType
Definition NanoVDB.h:6211
static constexpr int LEVEL
Definition NanoVDB.h:6220
NodeInfo Type
Definition NanoVDB.h:6221
typename NanoLeaf< BuildT >::FloatType FloatType
Definition NanoVDB.h:6212
static __hostdev__ Type get(const NanoRoot< BuildT > &root)
Definition NanoVDB.h:6222
static __hostdev__ Type get(const NanoLower< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6234
Implements Tree::isActive(math::Coord)
Definition NanoVDB.h:6097
static __hostdev__ Type get(const NanoUpper< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6102
bool Type
Definition NanoVDB.h:6098
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &tile)
Definition NanoVDB.h:6101
static __hostdev__ Type get(const NanoLeaf< BuildT > &leaf, uint32_t n)
Definition NanoVDB.h:6104
static constexpr int LEVEL
Definition NanoVDB.h:6099
static __hostdev__ Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6100
static __hostdev__ Type get(const NanoLower< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6103
Return point to the root Tile where math::Coord maps to one of its values, i.e. terminates.
Definition NanoVDB.h:6164
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &tile)
Definition NanoVDB.h:6168
static constexpr int LEVEL
Definition NanoVDB.h:6166
static __hostdev__ Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6167
const typename NanoRoot< BuildT >::Tile * Type
Definition NanoVDB.h:6165
Return point to the upper internal node where math::Coord maps to one of its values,...
Definition NanoVDB.h:6152
static __hostdev__ Type get(const NanoUpper< BuildT > &node, uint32_t)
Definition NanoVDB.h:6157
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6156
static constexpr int LEVEL
Definition NanoVDB.h:6154
const NanoUpper< BuildT > * Type
Definition NanoVDB.h:6153
static __hostdev__ Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6155
Below is an example of a struct used for random get methods.
Definition NanoVDB.h:6057
static __hostdev__ Type get(const NanoUpper< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6062
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &tile)
Definition NanoVDB.h:6061
static __hostdev__ Type get(const NanoLeaf< BuildT > &leaf, uint32_t n)
Definition NanoVDB.h:6064
static constexpr int LEVEL
Definition NanoVDB.h:6059
static __hostdev__ Type get(const NanoRoot< BuildT > &root)
Definition NanoVDB.h:6060
static __hostdev__ Type get(const NanoLower< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6063
typename NanoLeaf< BuildT >::ValueType Type
Definition NanoVDB.h:6058
Struct with all the member data of the Grid (useful during serialization of an openvdb grid)
Definition NanoVDB.h:1895
__hostdev__ Vec3T applyInverseJacobian(const Vec3T &xyz) const
Definition NanoVDB.h:1984
__hostdev__ bool isEmpty() const
test if the grid is empty, e.i the root table has size 0
Definition NanoVDB.h:2080
__hostdev__ bool isRootConnected() const
return true if RootData follows TreeData in memory without any extra padding
Definition NanoVDB.h:2084
static __hostdev__ uint64_t memUsage()
Return memory usage in bytes for this class only.
Definition NanoVDB.h:2063
uint32_t mBlindMetadataCount
Definition NanoVDB.h:1911
__hostdev__ const void * treePtr() const
Definition NanoVDB.h:2003
Version mVersion
Definition NanoVDB.h:1899
uint32_t mData0
Definition NanoVDB.h:1912
__hostdev__ uint32_t nodeCount() const
Return number of nodes at LEVEL.
Definition NanoVDB.h:2031
GridType mGridType
Definition NanoVDB.h:1909
__hostdev__ void setMinMaxOn(bool on=true)
Definition NanoVDB.h:1965
uint64_t mMagic
Definition NanoVDB.h:1897
__hostdev__ void * nodePtr()
Return a non-const void pointer to the first node at LEVEL.
Definition NanoVDB.h:2020
__hostdev__ Vec3T applyIJTF(const Vec3T &xyz) const
Definition NanoVDB.h:1997
GridClass mGridClass
Definition NanoVDB.h:1908
__hostdev__ void setBBoxOn(bool on=true)
Definition NanoVDB.h:1966
__hostdev__ void setLongGridNameOn(bool on=true)
Definition NanoVDB.h:1967
uint64_t mGridSize
Definition NanoVDB.h:1903
__hostdev__ const GridBlindMetaData * blindMetaData(uint32_t n) const
Returns a const reference to the blindMetaData at the specified linear offset.
Definition NanoVDB.h:2040
__hostdev__ Vec3T applyInverseJacobianF(const Vec3T &xyz) const
Definition NanoVDB.h:1995
__hostdev__ bool isValid() const
return true if the magic number and the version are both valid
Definition NanoVDB.h:1952
__hostdev__ Vec3T applyInverseMapF(const Vec3T &xyz) const
Definition NanoVDB.h:1991
__hostdev__ void init(std::initializer_list< GridFlags > list={GridFlags::IsBreadthFirst}, uint64_t gridSize=0u, const Map &map=Map(), GridType gridType=GridType::Unknown, GridClass gridClass=GridClass::Unknown)
Definition NanoVDB.h:1918
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:2069
Checksum mChecksum
Definition NanoVDB.h:1898
Vec3dBBox mWorldBBox
Definition NanoVDB.h:1906
__hostdev__ uint32_t rootTableSize() const
return the root table has size
Definition NanoVDB.h:2072
__hostdev__ const char * gridName() const
Definition NanoVDB.h:2046
__hostdev__ Vec3T applyIJT(const Vec3T &xyz) const
Definition NanoVDB.h:1986
uint64_t mData1
Definition NanoVDB.h:1913
uint32_t mGridCount
Definition NanoVDB.h:1902
__hostdev__ const void * nodePtr() const
Return a non-const void pointer to the first node at LEVEL.
Definition NanoVDB.h:2008
__hostdev__ void setStdDeviationOn(bool on=true)
Definition NanoVDB.h:1969
__hostdev__ Vec3T applyMap(const Vec3T &xyz) const
Definition NanoVDB.h:1978
uint64_t mData2
Definition NanoVDB.h:1914
__hostdev__ Vec3T applyJacobianF(const Vec3T &xyz) const
Definition NanoVDB.h:1993
__hostdev__ Vec3T applyInverseMap(const Vec3T &xyz) const
Definition NanoVDB.h:1980
Map mMap
Definition NanoVDB.h:1905
__hostdev__ const Vec3dBBox & worldBBox() const
return AABB of active values in world space
Definition NanoVDB.h:2066
__hostdev__ Vec3T applyJacobian(const Vec3T &xyz) const
Definition NanoVDB.h:1982
Vec3d mVoxelSize
Definition NanoVDB.h:1907
BitFlags< 32 > mFlags
Definition NanoVDB.h:1900
char mGridName[MaxNameSize]
Definition NanoVDB.h:1904
int64_t mBlindMetadataOffset
Definition NanoVDB.h:1910
uint32_t mGridIndex
Definition NanoVDB.h:1901
static const int MaxNameSize
Definition NanoVDB.h:1896
__hostdev__ void * treePtr()
Definition NanoVDB.h:2000
__hostdev__ Vec3T applyMapF(const Vec3T &xyz) const
Definition NanoVDB.h:1989
__hostdev__ bool setGridName(const char *src)
Definition NanoVDB.h:1970
__hostdev__ void setAverageOn(bool on=true)
Definition NanoVDB.h:1968
const typename GridT::TreeType Type
Definition NanoVDB.h:2386
const typename GridT::TreeType type
Definition NanoVDB.h:2387
defines a tree type from a grid type while preserving constness
Definition NanoVDB.h:2379
typename GridT::TreeType Type
Definition NanoVDB.h:2380
typename GridT::TreeType type
Definition NanoVDB.h:2381
StatsT mAverage
Definition NanoVDB.h:3154
typename ChildT::CoordType CoordT
Definition NanoVDB.h:3132
__hostdev__ void setMin(const ValueT &v)
Definition NanoVDB.h:3223
__hostdev__ const StatsT & average() const
Definition NanoVDB.h:3213
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3134
__hostdev__ const ValueT & getMin() const
Definition NanoVDB.h:3211
MaskT mChildMask
Definition NanoVDB.h:3150
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:3167
__hostdev__ const ValueT & getMax() const
Definition NanoVDB.h:3212
__hostdev__ void setDev(const StatsT &v)
Definition NanoVDB.h:3226
math::BBox< CoordT > mBBox
Definition NanoVDB.h:3147
InternalData(const InternalData &)=delete
__hostdev__ void setChild(uint32_t n, const void *ptr)
Definition NanoVDB.h:3169
typename ChildT::FloatType StatsT
Definition NanoVDB.h:3131
__hostdev__ void setAvg(const StatsT &v)
Definition NanoVDB.h:3225
__hostdev__ bool isChild(uint32_t n) const
Definition NanoVDB.h:3206
__hostdev__ void setValue(uint32_t n, const ValueT &v)
Definition NanoVDB.h:3176
typename ChildT::BuildType BuildT
Definition NanoVDB.h:3130
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:3161
StatsT mStdDevi
Definition NanoVDB.h:3155
Tile mTable[1u<<(3 *LOG2DIM)]
Definition NanoVDB.h:3165
__hostdev__ void setMax(const ValueT &v)
Definition NanoVDB.h:3224
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:3209
__hostdev__ ChildT * getChild(uint32_t n)
Returns a pointer to the child node at the specifed linear offset.
Definition NanoVDB.h:3183
ValueT mMaximum
Definition NanoVDB.h:3153
__hostdev__ bool isActive(uint32_t n) const
Definition NanoVDB.h:3200
MaskT mValueMask
Definition NanoVDB.h:3149
typename ChildT::template MaskType< LOG2DIM > MaskT
Definition NanoVDB.h:3133
__hostdev__ ValueT getValue(uint32_t n) const
Definition NanoVDB.h:3194
__hostdev__ const StatsT & stdDeviation() const
Definition NanoVDB.h:3214
InternalData & operator=(const InternalData &)=delete
typename ChildT::ValueType ValueT
Definition NanoVDB.h:3129
__hostdev__ const ChildT * getChild(uint32_t n) const
Definition NanoVDB.h:3188
ValueT mMinimum
Definition NanoVDB.h:3152
InternalData()=delete
This class cannot be constructed or deleted.
uint64_t mFlags
Definition NanoVDB.h:3148
static __hostdev__ constexpr uint64_t memUsage()
Definition NanoVDB.h:3843
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3840
__hostdev__ float getValue(uint32_t i) const
Definition NanoVDB.h:3851
Fp16 BuildType
Definition NanoVDB.h:3838
uint16_t mCode[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:3841
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:3844
uint16_t ArrayType
Definition NanoVDB.h:3839
LeafData()=delete
This class cannot be constructed or deleted.
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:3837
static __hostdev__ constexpr uint8_t bitWidth()
Definition NanoVDB.h:3850
static __hostdev__ constexpr uint64_t memUsage()
Definition NanoVDB.h:3776
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3773
__hostdev__ float getValue(uint32_t i) const
Definition NanoVDB.h:3784
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
uint8_t mCode[1u<<(3 *LOG2DIM - 1)]
Definition NanoVDB.h:3774
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:3777
LeafData()=delete
This class cannot be constructed or deleted.
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:3770
uint8_t ArrayType
Definition NanoVDB.h:3772
Fp4 BuildType
Definition NanoVDB.h:3771
static __hostdev__ constexpr uint8_t bitWidth()
Definition NanoVDB.h:3783
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3810
__hostdev__ float getValue(uint32_t i) const
Definition NanoVDB.h:3820
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:3813
LeafData()=delete
This class cannot be constructed or deleted.
Fp8 BuildType
Definition NanoVDB.h:3808
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:3807
uint8_t ArrayType
Definition NanoVDB.h:3809
static __hostdev__ constexpr int64_t memUsage()
Definition NanoVDB.h:3812
uint8_t mCode[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:3811
static __hostdev__ constexpr uint8_t bitWidth()
Definition NanoVDB.h:3819
FpN BuildType
Definition NanoVDB.h:3871
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3872
__hostdev__ float getValue(uint32_t i) const
Definition NanoVDB.h:3882
static __hostdev__ size_t memUsage(uint32_t bitWidth)
Definition NanoVDB.h:3881
__hostdev__ uint8_t bitWidth() const
Definition NanoVDB.h:3879
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:3873
LeafData()=delete
This class cannot be constructed or deleted.
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:3870
__hostdev__ size_t memUsage() const
Definition NanoVDB.h:3880
uint64_t mOffset
Definition NanoVDB.h:4160
uint16_t mValues[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:4162
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4153
__hostdev__ void setMin(const ValueType &)
Definition NanoVDB.h:4192
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:4172
__hostdev__ void setDev(const FloatType &)
Definition NanoVDB.h:4195
__hostdev__ void setValueOnly(uint32_t offset, uint16_t value)
Definition NanoVDB.h:4179
uint64_t ValueType
Definition NanoVDB.h:4149
__hostdev__ uint64_t last(uint32_t i) const
Definition NanoVDB.h:4177
uint8_t mFlags
Definition NanoVDB.h:4157
LeafData & operator=(const LeafData &)=delete
__hostdev__ void setValue(uint32_t offset, uint16_t value)
Definition NanoVDB.h:4180
LeafData(const LeafData &)=delete
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:4158
CoordT mBBoxMin
Definition NanoVDB.h:4155
uint8_t mBBoxDif[3]
Definition NanoVDB.h:4156
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:4185
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:4168
Point BuildType
Definition NanoVDB.h:4150
__hostdev__ void setAvg(const FloatType &)
Definition NanoVDB.h:4194
uint16_t ArrayType
Definition NanoVDB.h:4152
__hostdev__ ValueType getMax() const
Definition NanoVDB.h:4188
typename FloatTraits< ValueType >::FloatType FloatType
Definition NanoVDB.h:4151
__hostdev__ uint64_t offset() const
Definition NanoVDB.h:4174
LeafData()=delete
This class cannot be constructed or deleted.
__hostdev__ uint64_t first(uint32_t i) const
Definition NanoVDB.h:4176
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:4198
__hostdev__ FloatType getDev() const
Definition NanoVDB.h:4190
__hostdev__ uint64_t getValue(uint32_t i) const
Definition NanoVDB.h:4178
uint64_t mPointCount
Definition NanoVDB.h:4161
__hostdev__ FloatType getAvg() const
Definition NanoVDB.h:4189
__hostdev__ void setMax(const ValueType &)
Definition NanoVDB.h:4193
__hostdev__ ValueType getMin() const
Definition NanoVDB.h:4187
__hostdev__ uint64_t pointCount() const
Definition NanoVDB.h:4175
MaskT< LOG2DIM > mMask
Definition NanoVDB.h:4125
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:4126
__hostdev__ bool isMaskOn(uint32_t offset) const
Definition NanoVDB.h:4127
__hostdev__ void setMask(uint32_t offset, bool v)
Definition NanoVDB.h:4128
ValueIndexMask BuildType
Definition NanoVDB.h:4124
static __hostdev__ uint32_t valueCount()
Definition NanoVDB.h:4078
__hostdev__ uint64_t getMax() const
Definition NanoVDB.h:4083
ValueIndex BuildType
Definition NanoVDB.h:4076
LeafIndexBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:4075
__hostdev__ uint64_t getAvg() const
Definition NanoVDB.h:4084
__hostdev__ uint64_t getValue(uint32_t i) const
Definition NanoVDB.h:4086
__hostdev__ uint64_t lastOffset() const
Definition NanoVDB.h:4080
__hostdev__ uint64_t getDev() const
Definition NanoVDB.h:4085
__hostdev__ uint64_t getMin() const
Definition NanoVDB.h:4082
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3989
__hostdev__ void setMin(const ValueType &)
Definition NanoVDB.h:4011
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:3997
__hostdev__ bool getDev() const
Definition NanoVDB.h:4008
__hostdev__ bool getValue(uint32_t i) const
Definition NanoVDB.h:4004
__hostdev__ void setDev(const FloatType &)
Definition NanoVDB.h:4014
ValueMask BuildType
Definition NanoVDB.h:3986
uint8_t mFlags
Definition NanoVDB.h:3993
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
__hostdev__ void setValue(uint32_t offset, bool)
Definition NanoVDB.h:4009
static __hostdev__ bool hasStats()
Definition NanoVDB.h:3998
__hostdev__ bool getMax() const
Definition NanoVDB.h:4006
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:3994
CoordT mBBoxMin
Definition NanoVDB.h:3991
bool ValueType
Definition NanoVDB.h:3985
uint8_t mBBoxDif[3]
Definition NanoVDB.h:3992
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:4010
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:3999
__hostdev__ void setAvg(const FloatType &)
Definition NanoVDB.h:4013
LeafData()=delete
This class cannot be constructed or deleted.
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:4017
uint64_t mPadding[2]
Definition NanoVDB.h:3995
__hostdev__ bool getMin() const
Definition NanoVDB.h:4005
bool FloatType
Definition NanoVDB.h:3987
__hostdev__ void setMax(const ValueType &)
Definition NanoVDB.h:4012
__hostdev__ bool getAvg() const
Definition NanoVDB.h:4007
void ArrayType
Definition NanoVDB.h:3988
MaskT< LOG2DIM > mMask
Definition NanoVDB.h:4136
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:4137
__hostdev__ bool isMaskOn(uint32_t offset) const
Definition NanoVDB.h:4138
ValueOnIndexMask BuildType
Definition NanoVDB.h:4135
__hostdev__ void setMask(uint32_t offset, bool v)
Definition NanoVDB.h:4139
__hostdev__ uint64_t getMax() const
Definition NanoVDB.h:4103
LeafIndexBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:4095
__hostdev__ uint64_t getAvg() const
Definition NanoVDB.h:4104
__hostdev__ uint64_t getValue(uint32_t i) const
Definition NanoVDB.h:4106
__hostdev__ uint64_t lastOffset() const
Definition NanoVDB.h:4101
__hostdev__ uint64_t getDev() const
Definition NanoVDB.h:4105
__hostdev__ uint64_t getMin() const
Definition NanoVDB.h:4102
__hostdev__ uint32_t valueCount() const
Definition NanoVDB.h:4097
ValueOnIndex BuildType
Definition NanoVDB.h:4096
bool BuildType
Definition NanoVDB.h:3936
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3939
__hostdev__ void setMax(const bool &)
Definition NanoVDB.h:3963
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:3949
__hostdev__ bool getDev() const
Definition NanoVDB.h:3955
__hostdev__ bool getValue(uint32_t i) const
Definition NanoVDB.h:3951
uint8_t mFlags
Definition NanoVDB.h:3943
LeafData & operator=(const LeafData &)=delete
__hostdev__ void setAvg(const bool &)
Definition NanoVDB.h:3964
LeafData(const LeafData &)=delete
MaskT< LOG2DIM > ArrayType
Definition NanoVDB.h:3938
static __hostdev__ bool hasStats()
Definition NanoVDB.h:3950
__hostdev__ void setMin(const bool &)
Definition NanoVDB.h:3962
__hostdev__ bool getMax() const
Definition NanoVDB.h:3953
__hostdev__ void setDev(const bool &)
Definition NanoVDB.h:3965
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:3944
MaskT< LOG2DIM > mValues
Definition NanoVDB.h:3945
CoordT mBBoxMin
Definition NanoVDB.h:3941
bool ValueType
Definition NanoVDB.h:3935
uint8_t mBBoxDif[3]
Definition NanoVDB.h:3942
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:3961
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:3948
LeafData()=delete
This class cannot be constructed or deleted.
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:3968
__hostdev__ void setValue(uint32_t offset, bool v)
Definition NanoVDB.h:3956
uint64_t mPadding[2]
Definition NanoVDB.h:3946
__hostdev__ bool getMin() const
Definition NanoVDB.h:3952
bool FloatType
Definition NanoVDB.h:3937
__hostdev__ bool getAvg() const
Definition NanoVDB.h:3954
ValueType mMaximum
Definition NanoVDB.h:3632
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3624
typename FloatTraits< ValueT >::FloatType FloatType
Definition NanoVDB.h:3622
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:3644
FloatType mAverage
Definition NanoVDB.h:3633
__hostdev__ void setAvg(const FloatType &v)
Definition NanoVDB.h:3671
uint8_t mFlags
Definition NanoVDB.h:3628
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static __hostdev__ bool hasStats()
Definition NanoVDB.h:3646
ValueT ValueType
Definition NanoVDB.h:3620
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:3629
CoordT mBBoxMin
Definition NanoVDB.h:3626
uint8_t mBBoxDif[3]
Definition NanoVDB.h:3627
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:3655
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:3640
__hostdev__ ValueType getValue(uint32_t i) const
Definition NanoVDB.h:3648
__hostdev__ void fill(const ValueType &v)
Definition NanoVDB.h:3680
__hostdev__ ValueType getMax() const
Definition NanoVDB.h:3658
LeafData()=delete
This class cannot be constructed or deleted.
ValueT ArrayType
Definition NanoVDB.h:3623
__hostdev__ void setMin(const ValueType &v)
Definition NanoVDB.h:3669
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:3678
__hostdev__ void setValueOnly(uint32_t offset, const ValueType &value)
Definition NanoVDB.h:3649
__hostdev__ FloatType getDev() const
Definition NanoVDB.h:3660
ValueType mMinimum
Definition NanoVDB.h:3631
__hostdev__ FloatType getAvg() const
Definition NanoVDB.h:3659
__hostdev__ void setValue(uint32_t offset, const ValueType &value)
Definition NanoVDB.h:3650
ValueT BuildType
Definition NanoVDB.h:3621
ValueType mValues[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:3635
FloatType mStdDevi
Definition NanoVDB.h:3634
__hostdev__ ValueType getMin() const
Definition NanoVDB.h:3657
__hostdev__ void setMax(const ValueType &v)
Definition NanoVDB.h:3670
__hostdev__ void setDev(const FloatType &v)
Definition NanoVDB.h:3672
Base-class for quantized float leaf nodes.
Definition NanoVDB.h:3698
__hostdev__ float getAvg() const
return the quantized average of the active values in this node
Definition NanoVDB.h:3739
float ValueType
Definition NanoVDB.h:3701
__hostdev__ float getMax() const
return the quantized maximum of the active values in this node
Definition NanoVDB.h:3736
__hostdev__ float getDev() const
return the quantized standard deviation of the active values in this node
Definition NanoVDB.h:3743
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:3713
__hostdev__ void setDev(float dev)
Definition NanoVDB.h:3755
uint16_t mMax
Definition NanoVDB.h:3711
uint8_t mFlags
Definition NanoVDB.h:3706
uint16_t mMin
Definition NanoVDB.h:3711
static __hostdev__ bool hasStats()
Definition NanoVDB.h:3715
__hostdev__ void setAvg(float avg)
Definition NanoVDB.h:3752
float mQuantum
Definition NanoVDB.h:3710
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:3707
uint16_t mAvg
Definition NanoVDB.h:3711
CoordT mBBoxMin
Definition NanoVDB.h:3704
uint8_t mBBoxDif[3]
Definition NanoVDB.h:3705
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:3730
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:3720
float mMinimum
Definition NanoVDB.h:3709
float FloatType
Definition NanoVDB.h:3702
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:3758
uint16_t mDev
Definition NanoVDB.h:3711
__hostdev__ void init(float min, float max, uint8_t bitWidth)
Definition NanoVDB.h:3724
__hostdev__ void setMin(float min)
Definition NanoVDB.h:3746
__hostdev__ void setMax(float max)
Definition NanoVDB.h:3749
__hostdev__ float getMin() const
return the quantized minimum of the active values in this node
Definition NanoVDB.h:3733
uint64_t mOffset
Definition NanoVDB.h:4043
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4037
__hostdev__ const uint64_t & firstOffset() const
Definition NanoVDB.h:4051
__hostdev__ void setMin(const ValueType &)
Definition NanoVDB.h:4052
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:4048
__hostdev__ void setDev(const FloatType &)
Definition NanoVDB.h:4055
uint64_t ValueType
Definition NanoVDB.h:4034
uint64_t FloatType
Definition NanoVDB.h:4035
uint8_t mFlags
Definition NanoVDB.h:4041
uint64_t mPrefixSum
Definition NanoVDB.h:4043
LeafIndexBase & operator=(const LeafIndexBase &)=default
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:4042
LeafIndexBase(const LeafIndexBase &)=default
CoordT mBBoxMin
Definition NanoVDB.h:4039
uint8_t mBBoxDif[3]
Definition NanoVDB.h:4040
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:4056
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:4044
__hostdev__ void setAvg(const FloatType &)
Definition NanoVDB.h:4054
__hostdev__ bool hasStats() const
Definition NanoVDB.h:4049
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:4058
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:4053
void ArrayType
Definition NanoVDB.h:4036
Definition NanoVDB.h:4218
static __hostdev__ uint32_t dim()
Definition NanoVDB.h:4221
static constexpr uint32_t DIM
Definition NanoVDB.h:4220
static constexpr uint32_t TOTAL
Definition NanoVDB.h:4219
Defines an affine transform and its inverse represented as a 3x3 matrix and a vec3 translation.
Definition NanoVDB.h:1377
double mTaperD
Definition NanoVDB.h:1385
__hostdev__ Map()
Default constructor for the identity map.
Definition NanoVDB.h:1388
void set(const Mat4T &mat, const Mat4T &invMat, double taper=1.0)
Initialize the member data from 4x4 matrices.
Definition NanoVDB.h:1420
__hostdev__ Vec3d getVoxelSize() const
Return a voxels size in each coordinate direction, measured at the origin.
Definition NanoVDB.h:1511
__hostdev__ Vec3T applyInverseJacobian(const Vec3T &xyz) const
Apply the linear inverse 3x3 transformation to an input 3d vector using 64bit floating point arithmet...
Definition NanoVDB.h:1488
double mVecD[3]
Definition NanoVDB.h:1384
float mInvMatF[9]
Definition NanoVDB.h:1379
__hostdev__ Vec3T applyIJTF(const Vec3T &xyz) const
Definition NanoVDB.h:1508
__hostdev__ Vec3T applyMap(const Vec3T &ijk) const
Apply the forward affine transformation to a vector using 64bit floating point arithmetics.
Definition NanoVDB.h:1431
__hostdev__ Vec3T applyInverseJacobianF(const Vec3T &xyz) const
Apply the linear inverse 3x3 transformation to an input 3d vector using 32bit floating point arithmet...
Definition NanoVDB.h:1497
__hostdev__ Vec3T applyJacobian(const Vec3T &ijk) const
Apply the linear forward 3x3 transformation to an input 3d vector using 64bit floating point arithmet...
Definition NanoVDB.h:1448
__hostdev__ Vec3T applyInverseMapF(const Vec3T &xyz) const
Apply the inverse affine mapping to a vector using 32bit floating point arithmetics.
Definition NanoVDB.h:1476
double mInvMatD[9]
Definition NanoVDB.h:1383
__hostdev__ Vec3T applyIJT(const Vec3T &xyz) const
Apply the transposed inverse 3x3 transformation to an input 3d vector using 64bit floating point arit...
Definition NanoVDB.h:1506
float mMatF[9]
Definition NanoVDB.h:1378
__hostdev__ Vec3T applyInverseMap(const Vec3T &xyz) const
Apply the inverse affine mapping to a vector using 64bit floating point arithmetics.
Definition NanoVDB.h:1465
double mMatD[9]
Definition NanoVDB.h:1382
__hostdev__ Map(double s, const Vec3d &t=Vec3d(0.0, 0.0, 0.0))
Definition NanoVDB.h:1399
__hostdev__ Vec3T applyMapF(const Vec3T &ijk) const
Apply the forward affine transformation to a vector using 32bit floating point arithmetics.
Definition NanoVDB.h:1439
__hostdev__ Vec3T applyJacobianF(const Vec3T &ijk) const
Apply the linear forward 3x3 transformation to an input 3d vector using 32bit floating point arithmet...
Definition NanoVDB.h:1457
float mTaperF
Definition NanoVDB.h:1381
float mVecF[3]
Definition NanoVDB.h:1380
void set(const MatT &mat, const MatT &invMat, const Vec3T &translate, double taper=1.0)
Initialize the member data from 3x3 or 4x4 matrices.
Definition NanoVDB.h:1515
NanoLeaf< BuildT > type
Definition NanoVDB.h:4625
NanoLeaf< BuildT > Type
Definition NanoVDB.h:4624
NanoLower< BuildT > Type
Definition NanoVDB.h:4630
NanoLower< BuildT > type
Definition NanoVDB.h:4631
NanoUpper< BuildT > type
Definition NanoVDB.h:4637
NanoUpper< BuildT > Type
Definition NanoVDB.h:4636
NanoRoot< BuildT > type
Definition NanoVDB.h:4643
NanoRoot< BuildT > Type
Definition NanoVDB.h:4642
Trait to map from LEVEL to node type.
Definition NanoVDB.h:4618
typename GridOrTreeOrRootT::LeafNodeType type
Definition NanoVDB.h:1688
typename GridOrTreeOrRootT::LeafNodeType Type
Definition NanoVDB.h:1687
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType Type
Definition NanoVDB.h:1702
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType type
Definition NanoVDB.h:1703
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType type
Definition NanoVDB.h:1717
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType Type
Definition NanoVDB.h:1716
typename GridOrTreeOrRootT::RootNodeType type
Definition NanoVDB.h:1731
typename GridOrTreeOrRootT::RootNodeType Type
Definition NanoVDB.h:1730
const typename GridOrTreeOrRootT::LeafNodeType Type
Definition NanoVDB.h:1694
const typename GridOrTreeOrRootT::LeafNodeType type
Definition NanoVDB.h:1695
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType type
Definition NanoVDB.h:1710
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType Type
Definition NanoVDB.h:1709
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType Type
Definition NanoVDB.h:1723
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType type
Definition NanoVDB.h:1724
const typename GridOrTreeOrRootT::RootNodeType type
Definition NanoVDB.h:1739
const typename GridOrTreeOrRootT::RootNodeType Type
Definition NanoVDB.h:1738
Struct to derive node type from its level in a given grid, tree or root while preserving constness.
Definition NanoVDB.h:1680
Implements Tree::probeLeaf(math::Coord)
Definition NanoVDB.h:6175
static __hostdev__ Type get(const NanoLeaf< BuildT > &leaf, uint32_t n, ValueT &v)
Definition NanoVDB.h:6199
bool Type
Definition NanoVDB.h:6176
static __hostdev__ Type get(const NanoLower< BuildT > &node, uint32_t n, ValueT &v)
Definition NanoVDB.h:6194
typename BuildToValueMap< BuildT >::Type ValueT
Definition NanoVDB.h:6178
static constexpr int LEVEL
Definition NanoVDB.h:6177
static __hostdev__ Type get(const NanoUpper< BuildT > &node, uint32_t n, ValueT &v)
Definition NanoVDB.h:6189
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &tile, ValueT &v)
Definition NanoVDB.h:6184
static __hostdev__ Type get(const NanoRoot< BuildT > &root, ValueT &v)
Definition NanoVDB.h:6179
Definition NanoVDB.h:2617
ValueT value
Definition NanoVDB.h:2640
uint32_t state
Definition NanoVDB.h:2639
__hostdev__ bool isChild() const
Definition NanoVDB.h:2633
KeyT key
Definition NanoVDB.h:2637
__hostdev__ CoordT origin() const
Definition NanoVDB.h:2636
__hostdev__ bool isValue() const
Definition NanoVDB.h:2634
int64_t child
Definition NanoVDB.h:2638
__hostdev__ void setChild(const CoordType &k, const void *ptr, const RootData *data)
Definition NanoVDB.h:2619
__hostdev__ void setValue(const CoordType &k, bool s, const ValueType &v)
Definition NanoVDB.h:2626
__hostdev__ bool isActive() const
Definition NanoVDB.h:2635
StatsT mAverage
Definition NanoVDB.h:2605
typename ChildT::CoordType CoordT
Definition NanoVDB.h:2571
RootData()=delete
This class cannot be constructed or deleted.
__hostdev__ void setMin(const ValueT &v)
Definition NanoVDB.h:2788
__hostdev__ const StatsT & average() const
Definition NanoVDB.h:2785
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:2573
__hostdev__ const ValueT & getMin() const
Definition NanoVDB.h:2783
__hostdev__ Tile * probeTile(const CoordT &ijk)
Definition NanoVDB.h:2747
__hostdev__ TileIterator beginTile()
Definition NanoVDB.h:2728
ValueT mBackground
Definition NanoVDB.h:2602
__hostdev__ ConstTileIterator probe(const CoordT &ijk) const
Definition NanoVDB.h:2739
__hostdev__ const ValueT & getMax() const
Definition NanoVDB.h:2784
__hostdev__ ChildT * getChild(const Tile *tile)
Returns a const reference to the child node in the specified tile.
Definition NanoVDB.h:2772
__hostdev__ void setDev(const StatsT &v)
Definition NanoVDB.h:2791
uint32_t mTableSize
Definition NanoVDB.h:2600
math::BBox< CoordT > mBBox
Definition NanoVDB.h:2599
uint64_t KeyT
Return a key based on the coordinates of a voxel.
Definition NanoVDB.h:2577
__hostdev__ ConstTileIterator cbeginTile() const
Definition NanoVDB.h:2729
__hostdev__ ChildT * probeChild(const CoordT &ijk)
Definition NanoVDB.h:2758
typename ChildT::FloatType StatsT
Definition NanoVDB.h:2572
__hostdev__ void setAvg(const StatsT &v)
Definition NanoVDB.h:2790
__hostdev__ const Tile * tile(uint32_t n) const
Returns a pointer to the tile at the specified linear offset.
Definition NanoVDB.h:2646
__hostdev__ const Tile * probeTile(const CoordT &ijk) const
Definition NanoVDB.h:2753
typename ChildT::BuildType BuildT
Definition NanoVDB.h:2570
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:2611
StatsT mStdDevi
Definition NanoVDB.h:2606
RootData(const RootData &)=delete
static __hostdev__ CoordT KeyToCoord(const KeyT &key)
Definition NanoVDB.h:2587
RootData & operator=(const RootData &)=delete
static __hostdev__ KeyT CoordToKey(const CoordType &ijk)
Definition NanoVDB.h:2579
__hostdev__ void setMax(const ValueT &v)
Definition NanoVDB.h:2789
ValueT mMaximum
Definition NanoVDB.h:2604
__hostdev__ TileIterator probe(const CoordT &ijk)
Definition NanoVDB.h:2731
__hostdev__ const StatsT & stdDeviation() const
Definition NanoVDB.h:2786
__hostdev__ Tile * tile(uint32_t n)
Definition NanoVDB.h:2651
typename ChildT::ValueType ValueT
Definition NanoVDB.h:2569
TileIter< const RootData > ConstTileIterator
Definition NanoVDB.h:2726
__hostdev__ const ChildT * probeChild(const CoordT &ijk) const
Definition NanoVDB.h:2764
__hostdev__ const ChildT * getChild(const Tile *tile) const
Definition NanoVDB.h:2777
TileIter< RootData > TileIterator
Definition NanoVDB.h:2725
ValueT mMinimum
Definition NanoVDB.h:2603
Definition NanoVDB.h:6069
static __hostdev__ void set(NanoLower< BuildT > &node, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6076
static __hostdev__ void set(NanoRoot< BuildT > &, const ValueT &)
Definition NanoVDB.h:6073
static __hostdev__ void set(NanoUpper< BuildT > &node, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6075
static constexpr int LEVEL
Definition NanoVDB.h:6072
static __hostdev__ void set(NanoLeaf< BuildT > &leaf, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6077
typename NanoLeaf< BuildT >::ValueType ValueT
Definition NanoVDB.h:6071
static __hostdev__ void set(typename NanoRoot< BuildT >::Tile &tile, const ValueT &v)
Definition NanoVDB.h:6074
Definition NanoVDB.h:6082
static __hostdev__ void set(NanoLower< BuildT > &, uint32_t, const ValueT &)
Definition NanoVDB.h:6089
static __hostdev__ void set(NanoRoot< BuildT > &, const ValueT &)
Definition NanoVDB.h:6086
static __hostdev__ void set(NanoUpper< BuildT > &, uint32_t, const ValueT &)
Definition NanoVDB.h:6088
static constexpr int LEVEL
Definition NanoVDB.h:6085
static __hostdev__ void set(NanoLeaf< BuildT > &leaf, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6090
static __hostdev__ void set(typename NanoRoot< BuildT >::Tile &, const ValueT &)
Definition NanoVDB.h:6087
typename NanoLeaf< BuildT >::ValueType ValueT
Definition NanoVDB.h:6084
T ElementType
Definition NanoVDB.h:732
static const int Rank
Definition NanoVDB.h:728
static const int Size
Definition NanoVDB.h:731
static T scalar(const T &s)
Definition NanoVDB.h:733
static const bool IsVector
Definition NanoVDB.h:730
static const bool IsScalar
Definition NanoVDB.h:729
static ElementType scalar(const T &v)
Definition NanoVDB.h:744
static const int Rank
Definition NanoVDB.h:739
static const int Size
Definition NanoVDB.h:742
typename T::ValueType ElementType
Definition NanoVDB.h:743
static const bool IsVector
Definition NanoVDB.h:741
static const bool IsScalar
Definition NanoVDB.h:740
Definition NanoVDB.h:2343
__hostdev__ const void * getRoot() const
Get a const void pointer to the root node (never NULL)
Definition NanoVDB.h:2359
__hostdev__ bool isEmpty() const
Return true if the root is empty, i.e. has not child nodes or constant tiles.
Definition NanoVDB.h:2365
int64_t mNodeOffset[4]
Definition NanoVDB.h:2344
__hostdev__ bool isRootNext() const
return true if RootData is layout out immediately after TreeData in memory
Definition NanoVDB.h:2371
TreeData & operator=(const TreeData &)=default
__hostdev__ void setRoot(const void *root)
Definition NanoVDB.h:2350
uint32_t mNodeCount[3]
Definition NanoVDB.h:2345
__hostdev__ void * getRoot()
Get a non-const void pointer to the root node (never NULL)
Definition NanoVDB.h:2356
uint32_t mTileCount[3]
Definition NanoVDB.h:2346
__hostdev__ void setFirstNode(const NodeT *node)
Definition NanoVDB.h:2362
__hostdev__ CoordBBox bbox() const
Return the index bounding box of all the active values in this tree, i.e. in all nodes of the tree.
Definition NanoVDB.h:2368
uint64_t mVoxelCount
Definition NanoVDB.h:2347
C++11 implementation of std::enable_if.
Definition Util.h:335
static constexpr bool value
Definition Util.h:329
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:431
T type
Definition Util.h:387
ValueT value
Definition NanoVDB.h:3138
Tile(const Tile &)=delete
Tile & operator=(const Tile &)=delete
Tile()=delete
This class cannot be constructed or deleted.
int64_t child
Definition NanoVDB.h:3139