125#ifndef NANOVDB_NANOVDB_H_HAS_BEEN_INCLUDED
126#define NANOVDB_NANOVDB_H_HAS_BEEN_INCLUDED
130#include <nanovdb/math/Math.h>
133#define NANOVDB_DATA_ALIGNMENT 32
139#define NANOVDB_MAGIC_NUMB 0x304244566f6e614eUL
140#define NANOVDB_MAGIC_GRID 0x314244566f6e614eUL
141#define NANOVDB_MAGIC_FILE 0x324244566f6e614eUL
142#define NANOVDB_MAGIC_MASK 0x00FFFFFFFFFFFFFFUL
144#define NANOVDB_USE_NEW_MAGIC_NUMBERS
146#define NANOVDB_MAJOR_VERSION_NUMBER 32
147#define NANOVDB_MINOR_VERSION_NUMBER 9
148#define NANOVDB_PATCH_VERSION_NUMBER 2
150#define TBB_SUPPRESS_DEPRECATED_MESSAGES 1
153#define NANOVDB_USE_SINGLE_ROOT_KEY
166#define NANOVDB_FPN_BRANCHLESS
168#if !defined(NANOVDB_ALIGN)
169#define NANOVDB_ALIGN(n) alignas(n)
208template <
class EnumT>
209__hostdev__ inline constexpr uint32_t
strlen(){
return (uint32_t)EnumT::StrLen - (uint32_t)EnumT::End;}
497 return defaultSemantic;
693 switch (blindClass) {
745 : mData(major << 21 | minor << 10 | patch)
778template<
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>
789 static T
scalar(
const T& s) {
return s; }
798 static const int Size = T::SIZE;
805template<
typename T,
int = sizeof(
typename TensorTraits<T>::ElementType)>
850template<
typename BuildT>
905template<
typename BuildT>
906[[deprecated(
"Use toGridType<T>() instead.")]]
912template<
typename BuildT>
927template<
typename BuildT>
928[[deprecated(
"Use toGridClass<T>() instead.")]]
971 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
973 template<
typename MaskT>
976 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
983 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
985 template<
typename MaskT>
989 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
1001 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
1005 for (
auto bit : list) mFlags &= ~static_cast<Type>(1 << bit);
1008 template<
typename MaskT>
1010 template<
typename MaskT>
1013 template<
typename MaskT>
1016 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
1018 template<
typename MaskT>
1021 for (
auto mask : list) mFlags &= ~static_cast<Type>(mask);
1025 template<
typename MaskT>
1032 template<
typename MaskT>
1034 template<
typename MaskT>
1037 template<
typename MaskT>
1040 for (
auto mask : list) {
1041 if (0 != (mFlags &
static_cast<Type>(mask)))
return true;
1046 template<
typename MaskT>
1049 for (
auto mask : list) {
1050 if (0 == (mFlags &
static_cast<Type>(mask)))
return true;
1066template<u
int32_t LOG2DIM>
1070 static constexpr uint32_t
SIZE = 1U << (3 * LOG2DIM);
1086 for (
const uint64_t *w = mWords, *q = w +
WORD_COUNT; w != q; ++w)
1094 uint32_t n = i >> 6, sum =
util::countOn(mWords[n] & ((uint64_t(1) << (i & 63u)) - 1u));
1095 for (
const uint64_t* w = mWords; n--; ++w)
1120 mPos = mParent->findNext<On>(mPos + 1);
1132 const Mask* mParent;
1179 const uint64_t v = on ? ~uint64_t(0) : uint64_t(0);
1188 mWords[i] = other.mWords[i];
1195 template<
typename WordT>
1200 return reinterpret_cast<WordT*
>(mWords)[n];
1202 template<
typename WordT>
1207 reinterpret_cast<WordT*
>(mWords)[n] = w;
1211 template<
typename MaskT = Mask>
1214 static_assert(
sizeof(
Mask) ==
sizeof(MaskT),
"Mismatching sizeof");
1215 static_assert(
WORD_COUNT == MaskT::WORD_COUNT,
"Mismatching word count");
1216 static_assert(LOG2DIM == MaskT::LOG2DIM,
"Mismatching LOG2DIM");
1217 auto* src =
reinterpret_cast<const uint64_t*
>(&other);
1218 for (uint64_t *dst = mWords, *end = dst +
WORD_COUNT; dst != end; ++dst)
1229 if (mWords[i] != other.mWords[i])
1238 __hostdev__ bool isOn(uint32_t n)
const {
return 0 != (mWords[n >> 6] & (uint64_t(1) << (n & 63))); }
1241 __hostdev__ bool isOff(uint32_t n)
const {
return 0 == (mWords[n >> 6] & (uint64_t(1) << (n & 63))); }
1247 if (mWords[i] != ~uint64_t(0))
1256 if (mWords[i] != uint64_t(0))
1278#if defined(__CUDACC__)
1305 auto& word = mWords[n >> 6];
1307 word &= ~(uint64_t(1) << n);
1308 word |= uint64_t(on) << n;
1317 for (uint32_t i = 0; i <
WORD_COUNT; ++i)mWords[i] = ~uint64_t(0);
1323 for (uint32_t i = 0; i <
WORD_COUNT; ++i) mWords[i] = uint64_t(0);
1329 const uint64_t v = on ? ~uint64_t(0) : uint64_t(0);
1330 for (uint32_t i = 0; i <
WORD_COUNT; ++i) mWords[i] = v;
1336 for (
auto* w = mWords; n--; ++w) *w = ~*w;
1343 uint64_t* w1 = mWords;
1344 const uint64_t* w2 = other.mWords;
1345 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 &= *w2;
1351 uint64_t* w1 = mWords;
1352 const uint64_t* w2 = other.mWords;
1353 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 |= *w2;
1359 uint64_t* w1 = mWords;
1360 const uint64_t* w2 = other.mWords;
1361 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 &= ~*w2;
1367 uint64_t* w1 = mWords;
1368 const uint64_t* w2 = other.mWords;
1369 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 ^= *w2;
1378 const uint64_t* w = mWords;
1379 for (; n <
WORD_COUNT && !(ON ? *w : ~*w); ++w, ++n);
1387 uint32_t n = start >> 6;
1389 uint32_t m = start & 63u;
1390 uint64_t b = ON ? mWords[n] : ~mWords[n];
1391 if (b & (uint64_t(1u) << m))
return start;
1392 b &= ~uint64_t(0u) << m;
1393 while (!b && ++n <
WORD_COUNT) b = ON ? mWords[n] : ~mWords[n];
1401 uint32_t n = start >> 6;
1403 uint32_t m = start & 63u;
1404 uint64_t b = ON ? mWords[n] : ~mWords[n];
1405 if (b & (uint64_t(1u) << m))
return start;
1406 b &= (uint64_t(1u) << m) - 1u;
1407 while (!b && n) b = ON ? mWords[--n] : ~mWords[--n];
1431 :
mMatF{ 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}
1432 ,
mInvMatF{1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}
1433 ,
mVecF{0.0f, 0.0f, 0.0f}
1435 ,
mMatD{ 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}
1436 ,
mInvMatD{1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}
1437 ,
mVecD{0.0, 0.0, 0.0}
1442 :
mMatF{float(s), 0.0f, 0.0f, 0.0f, float(s), 0.0f, 0.0f, 0.0f, float(s)}
1443 ,
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)}
1444 ,
mVecF{float(t[0]), float(t[1]), float(t[2])}
1446 ,
mMatD{s, 0.0, 0.0, 0.0, s, 0.0, 0.0, 0.0, s}
1447 ,
mInvMatD{1.0 / s, 0.0, 0.0, 0.0, 1.0 / s, 0.0, 0.0, 0.0, 1.0 / s}
1448 ,
mVecD{t[0], t[1], t[2]}
1455 template<
typename MatT,
typename Vec3T>
1456 void set(
const MatT& mat,
const MatT& invMat,
const Vec3T& translate,
double taper = 1.0);
1461 template<
typename Mat4T>
1462 void set(
const Mat4T& mat,
const Mat4T& invMat,
double taper = 1.0) { this->
set(mat, invMat, mat[3], taper); }
1464 template<
typename Vec3T>
1465 void set(
double scale,
const Vec3T& translation,
double taper = 1.0);
1472 template<
typename Vec3T>
1480 template<
typename Vec3T>
1489 template<
typename Vec3T>
1498 template<
typename Vec3T>
1506 template<
typename Vec3T>
1517 template<
typename Vec3T>
1529 template<
typename Vec3T>
1538 template<
typename Vec3T>
1547 template<
typename Vec3T>
1549 template<
typename Vec3T>
1556template<
typename MatT,
typename Vec3T>
1557inline void Map::set(
const MatT& mat,
const MatT& invMat,
const Vec3T& translate,
double taper)
1561 mTaperF =
static_cast<float>(taper);
1563 for (
int i = 0; i < 3; ++i) {
1564 *vd++ = translate[i];
1565 *vf++ =
static_cast<float>(translate[i]);
1566 for (
int j = 0; j < 3; ++j) {
1568 *mid++ = invMat[j][i];
1569 *mf++ =
static_cast<float>(mat[j][i]);
1570 *mif++ =
static_cast<float>(invMat[j][i]);
1575template<
typename Vec3T>
1576inline void Map::set(
double dx,
const Vec3T& trans,
double taper)
1579 const double mat[3][3] = { {dx, 0.0, 0.0},
1582 const double idx = 1.0 / dx;
1583 const double invMat[3][3] = { {idx, 0.0, 0.0},
1586 this->
set(mat, invMat, trans, taper);
1675 template<
typename BlindDataT>
1686 auto check = [&]()->
bool{
1704 default:
return true;}
1726template<
typename Gr
idOrTreeOrRootT,
int LEVEL>
1730template<
typename Gr
idOrTreeOrRootT>
1733 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1734 using Type =
typename GridOrTreeOrRootT::LeafNodeType;
1735 using type =
typename GridOrTreeOrRootT::LeafNodeType;
1737template<
typename Gr
idOrTreeOrRootT>
1740 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1741 using Type =
const typename GridOrTreeOrRootT::LeafNodeType;
1742 using type =
const typename GridOrTreeOrRootT::LeafNodeType;
1745template<
typename Gr
idOrTreeOrRootT>
1748 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1749 using Type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1750 using type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1752template<
typename Gr
idOrTreeOrRootT>
1755 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1756 using Type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1757 using type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1759template<
typename Gr
idOrTreeOrRootT>
1762 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1763 using Type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1764 using type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1766template<
typename Gr
idOrTreeOrRootT>
1769 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1770 using Type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1771 using type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1773template<
typename Gr
idOrTreeOrRootT>
1776 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1777 using Type =
typename GridOrTreeOrRootT::RootNodeType;
1778 using type =
typename GridOrTreeOrRootT::RootNodeType;
1781template<
typename Gr
idOrTreeOrRootT>
1784 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1785 using Type =
const typename GridOrTreeOrRootT::RootNodeType;
1786 using type =
const typename GridOrTreeOrRootT::RootNodeType;
1789template<
typename Gr
idOrTreeOrRootT,
int LEVEL>
1794template<
typename BuildT>
1796template<
typename BuildT>
1798template<
typename BuildT>
1800template<
typename BuildT>
1802template<
typename BuildT>
1804template<
typename BuildT>
1806template<
typename BuildT>
1808template<
typename BuildT>
1870 [[deprecated(
"Use Checksum::data instead.")]]
1872 [[deprecated(
"Use Checksum::head and Ckecksum::tail instead.")]]
1874 [[deprecated(
"Use Checksum::head and Ckecksum::tail instead.")]]
1885 [[deprecated(
"Use Checksum::isHalf instead.")]]
1969 uint64_t gridSize = 0u,
1974#ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS
1984 mGridSize = gridSize;
1985 mGridName[0] =
'\0';
1987 mWorldBBox = Vec3dBBox();
1988 mVoxelSize = map.getVoxelSize();
1989 mGridClass = gridClass;
1990 mGridType = gridType;
1991 mBlindMetadataOffset = mGridSize;
1992 mBlindMetadataCount = 0u;
1995#ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS
2009 if (test) test =
mVersion.isCompatible();
2027 template<
typename Vec3T>
2029 template<
typename Vec3T>
2031 template<
typename Vec3T>
2033 template<
typename Vec3T>
2035 template<
typename Vec3T>
2038 template<
typename Vec3T>
2040 template<
typename Vec3T>
2042 template<
typename Vec3T>
2044 template<
typename Vec3T>
2046 template<
typename Vec3T>
2057 template <u
int32_t LEVEL>
2060 static_assert(LEVEL >= 0 && LEVEL <= 3,
"invalid LEVEL template parameter");
2061 const void *treeData =
this + 1;
2063 return nodeOffset ?
util::PtrAdd(treeData, nodeOffset) :
nullptr;
2069 template <u
int32_t LEVEL>
2072 static_assert(LEVEL >= 0 && LEVEL <= 3,
"invalid LEVEL template parameter");
2073 void *treeData =
this + 1;
2075 return nodeOffset ?
util::PtrAdd(treeData, nodeOffset) :
nullptr;
2080 template <u
int32_t LEVEL>
2083 static_assert(LEVEL >= 0 && LEVEL < 3,
"invalid LEVEL template parameter");
2104 return metaData->template getBlindData<const char>();
2138template<
typename BuildT,
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1>
2141template<
typename BuildT>
2148template<
typename TreeT>
2192 template<
typename T = BuildType>
2199 template<
typename T = BuildType>
2219 template<
typename Vec3T>
2223 template<
typename Vec3T>
2228 template<
typename Vec3T>
2233 template<
typename Vec3T>
2238 template<
typename Vec3T>
2242 template<
typename Vec3T>
2246 template<
typename Vec3T>
2251 template<
typename Vec3T>
2256 template<
typename Vec3T>
2261 template<
typename Vec3T>
2298 template<
typename NodeT>
2334 [[deprecated(
"Use Grid::getBlindData<T>() instead.")]]
2337 printf(
"\nnanovdb::Grid::blindData is unsafe and hence deprecated! Please use nanovdb::Grid::getBlindData instead.\n\n");
2342 template <
typename BlindDataT>
2349 template <
typename BlindDataT>
2362template<
typename TreeT>
2372template<
typename TreeT>
2375 auto test = [&](
int n) {
2378 if (name[i] != str[i])
2380 if (name[i] ==
'\0' && str[i] ==
'\0')
2412 template<
typename NodeT>
2428template<
typename Gr
idT>
2431 using Type =
typename GridT::TreeType;
2432 using type =
typename GridT::TreeType;
2434template<
typename Gr
idT>
2437 using Type =
const typename GridT::TreeType;
2438 using type =
const typename GridT::TreeType;
2441template<
typename Gr
idT>
2447template<
typename RootT>
2450 static_assert(RootT::LEVEL == 3,
"Tree depth is not supported");
2451 static_assert(RootT::ChildNodeType::LOG2DIM == 5,
"Tree configuration is not supported");
2452 static_assert(RootT::ChildNodeType::ChildNodeType::LOG2DIM == 4,
"Tree configuration is not supported");
2453 static_assert(RootT::LeafNodeType::LOG2DIM == 3,
"Tree configuration is not supported");
2468 using Node2 =
typename RootT::ChildNodeType;
2469 using Node1 =
typename Node2::ChildNodeType;
2527 template<
typename NodeT>
2530 static_assert(NodeT::LEVEL < 3,
"Invalid NodeT");
2548 template<
typename NodeT>
2558 template<
typename NodeT>
2591 template<
typename OpT,
typename... ArgsT>
2597 template<
typename OpT,
typename... ArgsT>
2608template<
typename RootT>
2611 min = this->
root().minimum();
2612 max = this->
root().maximum();
2620template<
typename ChildT>
2630#ifdef NANOVDB_USE_SINGLE_ROOT_KEY
2632 template<
typename CoordType>
2635 static_assert(
sizeof(
CoordT) ==
sizeof(CoordType),
"Mismatching sizeof");
2636 static_assert(32 - ChildT::TOTAL <= 21,
"Cannot use 64 bit root keys");
2637 return (
KeyT(uint32_t(ijk[2]) >> ChildT::TOTAL)) |
2638 (
KeyT(uint32_t(ijk[1]) >> ChildT::TOTAL) << 21) |
2639 (
KeyT(uint32_t(ijk[0]) >> ChildT::TOTAL) << 42);
2643 static constexpr uint64_t MASK = (1u << 21) - 1;
2644 return CoordT(((key >> 42) & MASK) << ChildT::TOTAL,
2645 ((key >> 21) & MASK) << ChildT::TOTAL,
2646 ( key & MASK) << ChildT::TOTAL);
2649 using KeyT = CoordT;
2650 __hostdev__ static KeyT CoordToKey(
const CoordT& ijk) {
return ijk & ~ChildT::MASK; }
2651 __hostdev__ static CoordT KeyToCoord(
const KeyT& key) {
return key; }
2670 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
Tile
2672 template<
typename CoordType>
2679 template<
typename CoordType,
typename ValueType>
2703 return reinterpret_cast<const Tile*
>(
this + 1) + n;
2708 return reinterpret_cast<Tile*
>(
this + 1) + n;
2711 template<
typename DataT>
2750 return reinterpret_cast<DataT*
>(
mBegin) - 1;
2755 return mPos->child != 0;
2760 return mPos->child == 0;
2765 return mPos->child == 0 &&
mPos->state != 0;
2789 for(; iter; ++iter)
if (iter->key == key)
break;
2797 for(; iter; ++iter)
if (iter->key == key)
break;
2803 auto iter = this->
probe(ijk);
2804 return iter ? iter.operator->() :
nullptr;
2814 auto iter = this->
probe(ijk);
2815 return iter && iter.isChild() ? iter.child() :
nullptr;
2857template<
typename ChildT>
2878 static constexpr uint32_t
LEVEL = 1 + ChildT::LEVEL;
2880 template<
typename RootT>
2898 template<
typename RootT>
2910 while (mTileIter && mTileIter.isValue()) ++mTileIter;
2917 while (mTileIter && mTileIter.isValue()) ++mTileIter;
2934 template<
typename RootT>
2944 while (mTileIter && mTileIter.isChild()) ++mTileIter;
2951 while (mTileIter && mTileIter.isChild()) ++mTileIter;
2968 template<
typename RootT>
2978 while (mTileIter && !mTileIter.isValueOn()) ++mTileIter;
2984 while (mTileIter && !mTileIter.isValueOn()) ++mTileIter;
3001 template<
typename RootT>
3013 if (mTileIter.isChild())
return mTileIter.child();
3014 value = mTileIter.value();
3095 template<
typename OpT,
typename... ArgsT>
3100 return OpT::get(*
tile, args...);
3102 return OpT::get(*
this, args...);
3105 template<
typename OpT,
typename... ArgsT>
3110 return OpT::set(*
tile, args...);
3112 return OpT::set(*
this, args...);
3117 static_assert(
sizeof(
typename DataType::Tile) %
NANOVDB_DATA_ALIGNMENT == 0,
"sizeof(RootData::Tile) is misaligned");
3119 template<
typename,
int,
int,
int>
3125 template<
typename RayT,
typename AccT>
3126 __hostdev__ uint32_t getDimAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const
3129 if (
tile->isChild()) {
3131 acc.insert(ijk, child);
3132 return child->getDimAndCache(ijk, ray, acc);
3134 return 1 << ChildT::TOTAL;
3136 return ChildNodeType::dim();
3139 template<
typename OpT,
typename AccT,
typename... ArgsT>
3140 __hostdev__ typename OpT::Type getAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
const
3142 if (
const Tile* tile = this->probeTile(ijk)) {
3143 if constexpr(OpT::LEVEL < LEVEL) {
3144 if (tile->isChild()) {
3145 const ChildT* child = this->getChild(tile);
3146 acc.insert(ijk, child);
3147 return child->template getAndCache<OpT>(ijk, acc, args...);
3150 return OpT::get(*tile, args...);
3152 return OpT::get(*
this, args...);
3155 template<
typename OpT,
typename AccT,
typename... ArgsT>
3156 __hostdev__ void setAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
3158 if (Tile* tile = DataType::probeTile(ijk)) {
3159 if constexpr(OpT::LEVEL < LEVEL) {
3160 if (tile->isChild()) {
3161 ChildT* child = this->getChild(tile);
3162 acc.insert(ijk, child);
3163 return child->template setAndCache<OpT>(ijk, acc, args...);
3166 return OpT::set(*tile, args...);
3168 return OpT::set(*
this, args...);
3180template<
typename ChildT, u
int32_t LOG2DIM>
3187 using MaskT =
typename ChildT::template MaskType<LOG2DIM>;
3219 alignas(32) Tile
mTable[1u << (3 * LOG2DIM)];
3229 template<
typename ValueT>
3262 template<
typename T>
3274#if defined(__GNUC__) && (__GNUC__ < 14) && !defined(__APPLE__) && !defined(__llvm__)
3275#pragma GCC diagnostic push
3276#pragma GCC diagnostic ignored "-Wstringop-overflow"
3282#if defined(__GNUC__) && (__GNUC__ < 14) && !defined(__APPLE__) && !defined(__llvm__)
3283#pragma GCC diagnostic pop
3294template<
typename ChildT, u
int32_t Log2Dim = ChildT::LOG2DIM + 1>
3306 template<u
int32_t LOG2>
3316 static constexpr uint32_t
LEVEL = 1 + ChildT::LEVEL;
3320 template <
typename ParentT>
3343 return *mParent->getChild(BaseT::pos());
3348 return mParent->getChild(BaseT::pos());
3353 return (*this)->origin();
3385 return mParent->data()->getValue(BaseT::pos());
3390 return mParent->offsetToGlobalCoord(BaseT::pos());
3396 return mParent->data()->isActive(BaseT::mPos);
3424 return mParent->data()->getValue(BaseT::pos());
3429 return mParent->offsetToGlobalCoord(BaseT::pos());
3451 , mParent(parent->
data())
3458 const ChildT* child =
nullptr;
3459 if (mParent->mChildMask.isOn(BaseT::pos())) {
3460 child = mParent->getChild(BaseT::pos());
3462 value = mParent->getValue(BaseT::pos());
3469 return mParent->isActive(BaseT::pos());
3474 return mParent->offsetToGlobalCoord(BaseT::pos());
3562 return (((ijk[0] &
MASK) >> ChildT::TOTAL) << (2 *
LOG2DIM)) |
3563 (((ijk[1] &
MASK) >> ChildT::TOTAL) << (
LOG2DIM)) |
3564 ((ijk[2] &
MASK) >> ChildT::TOTAL);
3571 const uint32_t m = n & ((1 << 2 *
LOG2DIM) - 1);
3578 ijk <<= ChildT::TOTAL;
3592 template<
typename OpT,
typename... ArgsT>
3597 return OpT::get(*
this, n, args...);
3600 template<
typename OpT,
typename... ArgsT>
3605 return OpT::set(*
this, n, args...);
3611 template<
typename,
int,
int,
int>
3616 template<
typename, u
int32_t>
3619 template<
typename RayT,
typename AccT>
3620 __hostdev__ uint32_t getDimAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const
3628 const ChildT* child = this->
getChild(n);
3629 acc.insert(ijk, child);
3630 return child->getDimAndCache(ijk, ray, acc);
3632 return ChildNodeType::dim();
3635 template<
typename OpT,
typename AccT,
typename... ArgsT>
3636 __hostdev__ typename OpT::Type getAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
const
3638 const uint32_t n = CoordToOffset(ijk);
3639 if constexpr(OpT::LEVEL < LEVEL) {
3640 if (this->isChild(n)) {
3641 const ChildT* child = this->getChild(n);
3642 acc.insert(ijk, child);
3643 return child->template getAndCache<OpT>(ijk, acc, args...);
3646 return OpT::get(*
this, n, args...);
3649 template<
typename OpT,
typename AccT,
typename... ArgsT>
3650 __hostdev__ void setAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
3652 const uint32_t n = CoordToOffset(ijk);
3653 if constexpr(OpT::LEVEL < LEVEL) {
3654 if (this->isChild(n)) {
3655 ChildT* child = this->getChild(n);
3656 acc.insert(ijk, child);
3657 return child->template setAndCache<OpT>(ijk, acc, args...);
3660 return OpT::set(*
this, n, args...);
3670template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3673 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3674 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3697 return sizeof(
LeafData) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>) + 2 * (
sizeof(ValueT) +
sizeof(
FloatType)) + (1u << (3 * LOG2DIM)) *
sizeof(ValueT));
3720#if defined(__GNUC__) && (__GNUC__ < 12) && !defined(__APPLE__) && !defined(__llvm__)
3721#pragma GCC diagnostic push
3722#pragma GCC diagnostic ignored "-Wstringop-overflow"
3728#if defined(__GNUC__) && (__GNUC__ < 12) && !defined(__APPLE__) && !defined(__llvm__)
3729#pragma GCC diagnostic pop
3732 template<
typename T>
3737 for (
auto *p =
mValues, *q = p + 512; p != q; ++p)
3751template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3754 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3755 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3777 return sizeof(
LeafFnBase) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>) + 2 * 4 + 4 * 2);
3782 mQuantum = (max - min) /
float((1 << bitWidth) - 1);
3812 template<
typename T>
3821template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3822struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp4, CoordT, MaskT, LOG2DIM>
3829 alignas(32) uint8_t
mCode[1u << (3 * LOG2DIM - 1)];
3834 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3835 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << (3 * LOG2DIM - 1));
3842 const uint8_t c =
mCode[i>>1];
3858template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3859struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp8, CoordT, MaskT, LOG2DIM>
3866 alignas(32) uint8_t
mCode[1u << 3 * LOG2DIM];
3870 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3871 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << 3 * LOG2DIM);
3888template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3889struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp16, CoordT, MaskT, LOG2DIM>
3896 alignas(32) uint16_t
mCode[1u << 3 * LOG2DIM];
3901 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3902 return sizeof(
LeafData) -
sizeof(
BaseT) - 2 * (1u << 3 * LOG2DIM);
3920template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3921struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
FpN, CoordT, MaskT, LOG2DIM>
3930 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3939#ifdef NANOVDB_FPN_BRANCHLESS
3942 uint16_t code =
reinterpret_cast<const uint16_t*
>(
this + 1)[i >> (4 - b)];
3943 const static uint8_t shift[5] = {15, 7, 3, 1, 0};
3944 const static uint16_t mask[5] = {1, 3, 15, 255, 65535};
3945 code >>= (i & shift[b]) << b;
3948 uint32_t code =
reinterpret_cast<const uint32_t*
>(
this + 1)[i >> (5 - b)];
3949 code >>= (i & ((32 >> b) - 1)) << b;
3950 code &= (1 << (1 << b)) - 1;
3954 auto* values =
reinterpret_cast<const uint8_t*
>(
this + 1);
3957 code = float((values[i >> 3] >> (i & 7)) & uint8_t(1));
3960 code = float((values[i >> 2] >> ((i & 3) << 1)) & uint8_t(3));
3963 code = float((values[i >> 1] >> ((i & 1) << 2)) & uint8_t(15));
3966 code = float(values[i]);
3969 code = float(
reinterpret_cast<const uint16_t*
>(values)[i]);
3985template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3986struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<bool, CoordT, MaskT, LOG2DIM>
3988 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3989 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4022 template<
typename T>
4035template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4038 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4039 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4056 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u);
4071 template<
typename T>
4084template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4087 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4088 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4101 return sizeof(
LeafIndexBase) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u);
4112 template<
typename T>
4126template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4146template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4164 uint32_t n = i >> 6;
4165 const uint64_t w =
BaseT::mValueMask.words()[n], mask = uint64_t(1) << (i & 63u);
4166 if (!(w & mask))
return uint64_t(0);
4175template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4176struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Point, CoordT, MaskT, LOG2DIM>
4178 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4179 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4201 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u + (1u << 3 * LOG2DIM) * 2u);
4228 template<
typename T>
4241template<
typename BuildT,
4242 typename CoordT = Coord,
4243 template<u
int32_t>
class MaskT =
Mask,
4244 uint32_t Log2Dim = 3>
4251 static constexpr uint32_t
DIM = 1;
4261 template<u
int32_t LOG2>
4287 return mParent->getValue(BaseT::pos());
4292 return mParent->offsetToGlobalCoord(BaseT::pos());
4320 return mParent->getValue(BaseT::pos());
4325 return mParent->offsetToGlobalCoord(BaseT::pos());
4341 , mPos(1u << 3 * Log2Dim)
4354 return mParent->getValue(mPos);
4359 return mParent->offsetToGlobalCoord(mPos);
4364 return mParent->isActive(mPos);
4366 __hostdev__ operator bool()
const {
return mPos < (1u << 3 * Log2Dim); }
4426 const uint32_t m = n & ((1 << 2 *
LOG2DIM) - 1);
4450 bbox = math::BBox<CoordT>();
4530 template<
typename OpT,
typename... ArgsT>
4536 template<
typename OpT,
typename... ArgsT>
4539 return OpT::get(*
this, n, args...);
4542 template<
typename OpT,
typename... ArgsT>
4548 template<
typename OpT,
typename... ArgsT>
4551 return OpT::set(*
this, n, args...);
4557 template<
typename,
int,
int,
int>
4562 template<
typename, u
int32_t>
4565 template<
typename RayT,
typename AccT>
4566 __hostdev__ uint32_t getDimAndCache(
const CoordT&,
const RayT& ,
const AccT&)
const
4575 template<
typename OpT,
typename AccT,
typename... ArgsT>
4578 getAndCache(
const CoordType& ijk,
const AccT&, ArgsT&&... args)
const
4580 return OpT::get(*
this, CoordToOffset(ijk), args...);
4583 template<
typename OpT,
typename AccT,
typename... ArgsT>
4585 __hostdev__ decltype(OpT::set(util::declval<LeafNode&>(), util::declval<uint32_t>(), util::declval<ArgsT>()...))
4586 setAndCache(
const CoordType& ijk,
const AccT&, ArgsT&&... args)
4588 return OpT::set(*
this, CoordToOffset(ijk), args...);
4595template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4598 static_assert(
LOG2DIM == 3,
"LeafNode::updateBBox: only supports LOGDIM = 3!");
4603 auto update = [&](uint32_t min, uint32_t max,
int axis) {
4609 uint32_t Xmin = word64 ? 0u : 8u, Xmax = Xmin;
4610 for (
int i = 1; i < 8; ++i) {
4619 update(Xmin, Xmax, 0);
4621 const uint32_t *p =
reinterpret_cast<const uint32_t*
>(&word64), word32 = p[0] | p[1];
4622 const uint16_t *q =
reinterpret_cast<const uint16_t*
>(&word32), word16 = q[0] | q[1];
4623 const uint8_t *b =
reinterpret_cast<const uint8_t*
>(&word16),
byte = b[0] | b[1];
4634template<
typename BuildT>
4636template<
typename BuildT>
4638template<
typename BuildT>
4640template<
typename BuildT>
4642template<
typename BuildT>
4644template<
typename BuildT>
4648template<
typename BuildT,
int LEVEL>
4652template<
typename BuildT>
4658template<
typename BuildT>
4664template<
typename BuildT>
4670template<
typename BuildT>
4677template<
typename BuildT,
int LEVEL>
4748template<
typename OpT,
typename GridDataT,
typename... ArgsT>
4752 switch (gridData->mGridType){
4754 return OpT::template known<float>(gridData, args...);
4756 return OpT::template known<double>(gridData, args...);
4758 return OpT::template known<int16_t>(gridData, args...);
4760 return OpT::template known<int32_t>(gridData, args...);
4762 return OpT::template known<int64_t>(gridData, args...);
4764 return OpT::template known<Vec3f>(gridData, args...);
4766 return OpT::template known<Vec3d>(gridData, args...);
4768 return OpT::template known<uint32_t>(gridData, args...);
4770 return OpT::template known<ValueMask>(gridData, args...);
4772 return OpT::template known<ValueIndex>(gridData, args...);
4774 return OpT::template known<ValueOnIndex>(gridData, args...);
4776 return OpT::template known<bool>(gridData, args...);
4778 return OpT::template known<math::Rgba8>(gridData, args...);
4780 return OpT::template known<Fp4>(gridData, args...);
4782 return OpT::template known<Fp8>(gridData, args...);
4784 return OpT::template known<Fp16>(gridData, args...);
4786 return OpT::template known<FpN>(gridData, args...);
4788 return OpT::template known<Vec4f>(gridData, args...);
4790 return OpT::template known<Vec4d>(gridData, args...);
4792 return OpT::template known<uint8_t>(gridData, args...);
4794 return OpT::unknown(gridData, args...);
4819template<
typename BuildT>
4829 mutable const RootT* mRoot;
4876 template<
typename RayT>
4879 return mRoot->getDimAndCache(ijk, ray, *
this);
4881 template<
typename OpT,
typename... ArgsT>
4884 return mRoot->template
get<OpT>(ijk, args...);
4887 template<
typename OpT,
typename... ArgsT>
4890 return const_cast<RootT*
>(mRoot)->
template set<OpT>(ijk, args...);
4897 template<
typename, u
int32_t>
4899 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
4903 template<
typename NodeT>
4908template<
typename BuildT,
int LEVEL0>
4911 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 should be 0, 1, or 2");
4925 mutable CoordT mKey;
4926 mutable const RootT* mRoot;
4927 mutable const NodeT* mNode;
4959 mKey = CoordType::max();
4972 return (ijk[0] & int32_t(~NodeT::MASK)) == mKey[0] &&
4973 (ijk[1] & int32_t(~NodeT::MASK)) == mKey[1] &&
4974 (ijk[2] & int32_t(~NodeT::MASK)) == mKey[2];
4989 template<
typename RayT>
4992 if (this->
isCached(ijk))
return mNode->getDimAndCache(ijk, ray, *
this);
4993 return mRoot->getDimAndCache(ijk, ray, *
this);
4996 template<
typename OpT,
typename... ArgsT>
4999 if constexpr(OpT::LEVEL <= LEVEL0)
if (this->
isCached(ijk))
return mNode->template getAndCache<OpT>(ijk, *
this, args...);
5000 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5003 template<
typename OpT,
typename... ArgsT>
5006 if constexpr(OpT::LEVEL <= LEVEL0)
if (this->
isCached(ijk))
return const_cast<NodeT*
>(mNode)->
template setAndCache<OpT>(ijk, *
this, args...);
5007 return const_cast<RootT*
>(mRoot)->
template setAndCache<OpT>(ijk, *
this, args...);
5014 template<
typename, u
int32_t>
5016 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5022 mKey = ijk & ~NodeT::MASK;
5027 template<
typename OtherNodeT>
5028 __hostdev__ void insert(
const CoordType&,
const OtherNodeT*)
const {}
5032template<
typename BuildT,
int LEVEL0,
int LEVEL1>
5035 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 must be 0, 1, 2");
5036 static_assert(LEVEL1 >= 0 && LEVEL1 <= 2,
"LEVEL1 must be 0, 1, 2");
5037 static_assert(LEVEL0 < LEVEL1,
"Level 0 must be lower than level 1");
5050#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5051 mutable CoordT mKey;
5053 mutable CoordT mKeys[2];
5055 mutable const RootT* mRoot;
5056 mutable const Node1T* mNode1;
5057 mutable const Node2T* mNode2;
5068#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5069 : mKey(CoordType::max())
5071 : mKeys{CoordType::max(), CoordType::max()}
5094#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5095 mKey = CoordType::max();
5097 mKeys[0] = mKeys[1] = CoordType::max();
5110#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5115 if (dirty & int32_t(~Node1T::MASK)) {
5121 __hostdev__ bool isCached2(CoordValueType dirty)
const
5125 if (dirty & int32_t(~Node2T::MASK)) {
5131 __hostdev__ CoordValueType computeDirty(
const CoordType& ijk)
const
5133 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
5138 return (ijk[0] & int32_t(~Node1T::MASK)) == mKeys[0][0] &&
5139 (ijk[1] & int32_t(~Node1T::MASK)) == mKeys[0][1] &&
5140 (ijk[2] & int32_t(~Node1T::MASK)) == mKeys[0][2];
5144 return (ijk[0] & int32_t(~Node2T::MASK)) == mKeys[1][0] &&
5145 (ijk[1] & int32_t(~Node2T::MASK)) == mKeys[1][1] &&
5146 (ijk[2] & int32_t(~Node2T::MASK)) == mKeys[1][2];
5162 template<
typename RayT>
5165#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5166 const CoordValueType dirty = this->computeDirty(ijk);
5171 return mNode1->getDimAndCache(ijk, ray, *
this);
5173 return mNode2->getDimAndCache(ijk, ray, *
this);
5175 return mRoot->getDimAndCache(ijk, ray, *
this);
5178 template<
typename OpT,
typename... ArgsT>
5181#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5182 const CoordValueType dirty = this->computeDirty(ijk);
5186 if constexpr(OpT::LEVEL <= LEVEL0) {
5187 if (this->
isCached1(dirty))
return mNode1->template getAndCache<OpT>(ijk, *
this, args...);
5189#ifdef NANOVDB_USE_OLD_ACCESSOR
5192 if constexpr(OpT::LEVEL <= LEVEL1) {
5193 if (this->
isCached2(dirty))
return mNode2->template getAndCache<OpT>(ijk, *
this, args...);
5195 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5198 template<
typename OpT,
typename... ArgsT>
5201#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5202 const CoordValueType dirty = this->computeDirty(ijk);
5206 if constexpr(OpT::LEVEL <= LEVEL0) {
5207 if (this->
isCached1(dirty))
return const_cast<Node1T*
>(mNode1)->
template setAndCache<OpT>(ijk, *
this, args...);
5209#ifdef NANOVDB_USE_OLD_ACCESSOR
5212 if constexpr(OpT::LEVEL <= LEVEL1) {
5213 if (this->
isCached2(dirty))
return const_cast<Node2T*
>(mNode2)->
template setAndCache<OpT>(ijk, *
this, args...);
5215 return const_cast<RootT*
>(mRoot)->
template setAndCache<OpT>(ijk, *
this, args...);
5222 template<
typename, u
int32_t>
5224 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5230#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5233 mKeys[0] = ijk & ~Node1T::MASK;
5237 __hostdev__ void insert(
const CoordType& ijk,
const Node2T* node)
const
5239#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5242 mKeys[1] = ijk & ~Node2T::MASK;
5246 template<
typename OtherNodeT>
5247 __hostdev__ void insert(
const CoordType&,
const OtherNodeT*)
const {}
5251template<
typename BuildT>
5252class ReadAccessor<BuildT, 0, 1, 2>
5254 using GridT = NanoGrid<BuildT>;
5255 using TreeT = NanoTree<BuildT>;
5256 using RootT = NanoRoot<BuildT>;
5257 using NodeT2 = NanoUpper<BuildT>;
5258 using NodeT1 = NanoLower<BuildT>;
5259 using LeafT = NanoLeaf<BuildT>;
5260 using CoordT =
typename RootT::CoordType;
5261 using ValueT =
typename RootT::ValueType;
5263 using FloatType =
typename RootT::FloatType;
5264 using CoordValueType =
typename RootT::CoordT::ValueType;
5267#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5268 mutable CoordT mKey;
5270 mutable CoordT mKeys[3];
5272 mutable const RootT* mRoot;
5273 mutable const void* mNode[3];
5276 using BuildType = BuildT;
5277 using ValueType = ValueT;
5278 using CoordType = CoordT;
5280 static const int CacheLevels = 3;
5284#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5285 : mKey(CoordType::max())
5287 : mKeys{CoordType::max(), CoordType::max(), CoordType::max()}
5290 , mNode{
nullptr,
nullptr,
nullptr}
5296 : ReadAccessor(grid.tree().root())
5302 : ReadAccessor(tree.root())
5306 __hostdev__ const RootT& root()
const {
return *mRoot; }
5309 ReadAccessor(
const ReadAccessor&) =
default;
5310 ~ReadAccessor() =
default;
5311 ReadAccessor& operator=(
const ReadAccessor&) =
default;
5316 template<
typename NodeT>
5319 using T =
typename NodeTrait<TreeT, NodeT::LEVEL>::type;
5320 static_assert(util::is_same<T, NodeT>::value,
"ReadAccessor::getNode: Invalid node type");
5321 return reinterpret_cast<const T*
>(mNode[NodeT::LEVEL]);
5325 __hostdev__ const typename NodeTrait<TreeT, LEVEL>::type* getNode()
const
5327 using T =
typename NodeTrait<TreeT, LEVEL>::type;
5328 static_assert(LEVEL >= 0 && LEVEL <= 2,
"ReadAccessor::getNode: Invalid node type");
5329 return reinterpret_cast<const T*
>(mNode[LEVEL]);
5335#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5336 mKey = CoordType::max();
5338 mKeys[0] = mKeys[1] = mKeys[2] = CoordType::max();
5340 mNode[0] = mNode[1] = mNode[2] =
nullptr;
5343#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5344 template<
typename NodeT>
5345 __hostdev__ bool isCached(CoordValueType dirty)
const
5347 if (!mNode[NodeT::LEVEL])
5349 if (dirty & int32_t(~NodeT::MASK)) {
5350 mNode[NodeT::LEVEL] =
nullptr;
5356 __hostdev__ CoordValueType computeDirty(
const CoordType& ijk)
const
5358 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
5361 template<
typename NodeT>
5362 __hostdev__ bool isCached(
const CoordType& ijk)
const
5364 return (ijk[0] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][0] &&
5365 (ijk[1] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][1] &&
5366 (ijk[2] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][2];
5370 __hostdev__ ValueType getValue(
const CoordType& ijk)
const {
return this->
template get<GetValue<BuildT>>(ijk);}
5371 __hostdev__ ValueType getValue(
int i,
int j,
int k)
const {
return this->
template get<GetValue<BuildT>>(CoordType(i, j, k)); }
5372 __hostdev__ ValueType operator()(
const CoordType& ijk)
const {
return this->
template get<GetValue<BuildT>>(ijk); }
5373 __hostdev__ ValueType operator()(
int i,
int j,
int k)
const {
return this->
template get<GetValue<BuildT>>(CoordType(i, j, k)); }
5374 __hostdev__ auto getNodeInfo(
const CoordType& ijk)
const {
return this->
template get<GetNodeInfo<BuildT>>(ijk); }
5375 __hostdev__ bool isActive(
const CoordType& ijk)
const {
return this->
template get<GetState<BuildT>>(ijk); }
5376 __hostdev__ bool probeValue(
const CoordType& ijk, ValueType& v)
const {
return this->
template get<ProbeValue<BuildT>>(ijk, v); }
5377 __hostdev__ const LeafT* probeLeaf(
const CoordType& ijk)
const {
return this->
template get<GetLeaf<BuildT>>(ijk); }
5379 template<
typename OpT,
typename... ArgsT>
5380 __hostdev__ typename OpT::Type get(
const CoordType& ijk, ArgsT&&... args)
const
5382#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5383 const CoordValueType dirty = this->computeDirty(ijk);
5387 if constexpr(OpT::LEVEL <=0) {
5388 if (this->isCached<LeafT>(dirty))
return ((
const LeafT*)mNode[0])->template getAndCache<OpT>(ijk, *
this, args...);
5390#ifdef NANOVDB_USE_OLD_ACCESSOR
5393 if constexpr(OpT::LEVEL <= 1) {
5394 if (this->isCached<NodeT1>(dirty))
return ((
const NodeT1*)mNode[1])->template getAndCache<OpT>(ijk, *
this, args...);
5396#ifdef NANOVDB_USE_OLD_ACCESSOR
5399 if constexpr(OpT::LEVEL <= 2) {
5400 if (this->isCached<NodeT2>(dirty))
return ((
const NodeT2*)mNode[2])->template getAndCache<OpT>(ijk, *
this, args...);
5402 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5405 template<
typename OpT,
typename... ArgsT>
5406 __hostdev__ void set(
const CoordType& ijk, ArgsT&&... args)
const
5408#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5409 const CoordValueType dirty = this->computeDirty(ijk);
5413 if constexpr(OpT::LEVEL <= 0) {
5414 if (this->isCached<LeafT>(dirty))
return ((LeafT*)mNode[0])->template setAndCache<OpT>(ijk, *
this, args...);
5416#ifdef NANOVDB_USE_OLD_ACCESSOR
5419 if constexpr(OpT::LEVEL <= 1) {
5420 if (this->isCached<NodeT1>(dirty))
return ((NodeT1*)mNode[1])->template setAndCache<OpT>(ijk, *
this, args...);
5422#ifdef NANOVDB_USE_OLD_ACCESSOR
5425 if constexpr(OpT::LEVEL <= 2) {
5426 if (this->isCached<NodeT2>(dirty))
return ((NodeT2*)mNode[2])->template setAndCache<OpT>(ijk, *
this, args...);
5428 return ((RootT*)mRoot)->template setAndCache<OpT>(ijk, *
this, args...);
5431 template<
typename RayT>
5432 __hostdev__ uint32_t getDim(
const CoordType& ijk,
const RayT& ray)
const
5434#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5435 const CoordValueType dirty = this->computeDirty(ijk);
5439 if (this->isCached<LeafT>(dirty)) {
5440 return ((LeafT*)mNode[0])->getDimAndCache(ijk, ray, *
this);
5441 }
else if (this->isCached<NodeT1>(dirty)) {
5442 return ((NodeT1*)mNode[1])->getDimAndCache(ijk, ray, *
this);
5443 }
else if (this->isCached<NodeT2>(dirty)) {
5444 return ((NodeT2*)mNode[2])->getDimAndCache(ijk, ray, *
this);
5446 return mRoot->getDimAndCache(ijk, ray, *
this);
5452 friend class RootNode;
5453 template<
typename, u
int32_t>
5454 friend class InternalNode;
5455 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5456 friend class LeafNode;
5459 template<
typename NodeT>
5460 __hostdev__ void insert(
const CoordType& ijk,
const NodeT* node)
const
5462#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5465 mKeys[NodeT::LEVEL] = ijk & ~NodeT::MASK;
5467 mNode[NodeT::LEVEL] = node;
5485template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5491template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5497template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5513 CoordBBox mIndexBBox;
5514 uint32_t mRootTableSize, mPadding{0};
5517 template<
typename T>
5520 mGridData = *grid.
data();
5521 mTreeData = *grid.
tree().data();
5523 mRootTableSize = grid.
tree().root().getTableSize();
5528 *
this = *
reinterpret_cast<const GridMetaData*
>(gridData);
5531 mGridData = *gridData;
5551 template<
typename T>
5592template<
typename AttT,
typename BuildT = u
int32_t>
5601 : AccT(
grid.tree().root())
5603 , mData(
grid.template getBlindData<AttT>(0))
5619 const uint64_t count = mGrid.blindMetaData(0u).mValueCount;
5621 end = begin + count;
5629 auto* leaf = this->probeLeaf(ijk);
5630 if (leaf ==
nullptr) {
5633 begin = mData + leaf->minimum();
5634 end = begin + leaf->maximum();
5635 return leaf->maximum();
5641 begin = end =
nullptr;
5642 if (
auto* leaf = this->probeLeaf(ijk)) {
5644 if (leaf->isActive(offset)) {
5645 begin = mData + leaf->minimum();
5646 end = begin + leaf->getValue(offset);
5648 begin += leaf->getValue(offset - 1);
5655template<
typename AttT>
5664 : AccT(
grid.tree().root())
5666 , mData(
grid.template getBlindData<AttT>(0))
5686 const uint64_t count = mGrid.blindMetaData(0u).mValueCount;
5688 end = begin + count;
5696 auto* leaf = this->probeLeaf(ijk);
5697 if (leaf ==
nullptr)
5699 begin = mData + leaf->offset();
5700 end = begin + leaf->pointCount();
5701 return leaf->pointCount();
5707 if (
auto* leaf = this->probeLeaf(ijk)) {
5709 if (leaf->isActive(n)) {
5710 begin = mData + leaf->first(n);
5711 end = mData + leaf->last(n);
5715 begin = end =
nullptr;
5723template<
typename ChannelT,
typename IndexT = ValueIndex>
5753 , mChannel(channelPtr)
5784 return mChannel =
const_cast<ChannelT*
>(mGrid.template getBlindData<ChannelT>(channelID));
5789 __hostdev__ uint64_t
idx(
int i,
int j,
int k)
const {
return BaseT::getValue(math::Coord(i, j, k)); }
5800 const bool isActive = BaseT::probeValue(ijk,
idx);
5807 template<
typename T>
5808 __hostdev__ T&
getValue(
const math::Coord& ijk, T* channelPtr)
const {
return channelPtr[BaseT::getValue(ijk)]; }
5815template <
typename BuildT,
typename ValueT>
5820template <
typename Gr
idT,
typename ValueT>
5823 using BuildT =
typename GridT::BuildType;
5836struct MiniGridHandle {
5841 BufferType(BufferType &&other) : data(other.data), size(other.size) {other.data=
nullptr; other.size=0;}
5842 ~BufferType() {std::free(data);}
5843 BufferType& operator=(
const BufferType &other) =
delete;
5844 BufferType& operator=(BufferType &&other){data=other.data; size=other.size; other.data=
nullptr; other.size=0;
return *
this;}
5845 static BufferType create(
size_t n, BufferType* dummy =
nullptr) {
return BufferType(n);}
5847 MiniGridHandle(BufferType &&buf) : buffer(std::move(buf)) {}
5848 const uint8_t* data()
const {
return buffer.data;}
5930#if !defined(__CUDA_ARCH__) && !defined(__HIP__)
5953template<
typename StreamT>
5959#ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS
5964 const char* gridName = gridData->
gridName();
5974 os.write((
const char*)&head,
sizeof(
FileHeader));
5976 os.write(gridName, nameSize);
5983 os.write((
const char*)&data,
sizeof(
GridData));
5986 os.write((
const char*)gridData, gridData->
mGridSize);
5998template<
typename StreamT,
typename ValueT>
6008 fprintf(stderr,
"nanovdb::writeUncompressedGrid: expected an IndexGrid but got \"%s\"\n",
toStr(str, gridData->
mGridClass));
6011 fprintf(stderr,
"nanovdb::writeUncompressedGrid: index grid already has \"%i\" blind data\n", gridData->
mBlindMetadataCount);
6016#ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS
6021 const char* gridName = gridData->
gridName();
6030 os.write((
const char*)&head,
sizeof(
FileHeader));
6032 os.write(gridName, nameSize);
6041 os.write((
const char*)&data,
sizeof(
GridData));
6047 os.write((
const char*)blindData, gridData->
mData1*
sizeof(ValueT));
6052template<
typename GridHandleT,
template<
typename...>
class VecT>
6055#ifdef NANOVDB_USE_IOSTREAMS
6056 std::ofstream os(fileName, std::ios::out | std::ios::binary | std::ios::trunc);
6060 StreamT(
const char* name) { fptr = fopen(name,
"wb"); }
6061 ~StreamT() { fclose(fptr); }
6062 void write(
const char* data,
size_t n) { fwrite(data, 1, n, fptr); }
6063 bool is_open()
const {
return fptr != NULL; }
6066 if (!os.is_open()) {
6067 fprintf(stderr,
"nanovdb::writeUncompressedGrids: Unable to open file \"%s\"for output\n", fileName);
6070 for (
auto& h : handles) {
6080template<
typename GridHandleT,
typename StreamT,
template<
typename...>
class VecT>
6081VecT<GridHandleT>
readUncompressedGrids(StreamT& is,
const typename GridHandleT::BufferType& pool =
typename GridHandleT::BufferType())
6083 VecT<GridHandleT> handles;
6085 is.read((
char*)&data,
sizeof(
GridData));
6087 uint64_t size = data.
mGridSize, sum = 0u;
6090 is.read((
char*)&data,
sizeof(
GridData));
6091 sum += data.mGridSize;
6093 is.skip(-int64_t(sum +
sizeof(
GridData)));
6094 auto buffer = GridHandleT::BufferType::create(size + sum, &pool);
6095 is.read((
char*)(buffer.data()), buffer.size());
6096 handles.emplace_back(std::move(buffer));
6100 while(is.read((
char*)&head,
sizeof(
FileHeader))) {
6102 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid magic number = \"%s\"\n", (
const char*)&(head.
magic));
6106 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid major version = \"%s\"\n",
toStr(str, head.
version));
6110 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid codec = \"%s\"\n",
toStr(str, head.
codec));
6114 for (uint16_t i = 0; i < head.
gridCount; ++i) {
6116 is.skip(meta.nameSize);
6117 auto buffer = GridHandleT::BufferType::create(meta.gridSize, &pool);
6118 is.read((
char*)buffer.data(), meta.gridSize);
6119 handles.emplace_back(std::move(buffer));
6127template<
typename GridHandleT,
template<
typename...>
class VecT>
6128VecT<GridHandleT>
readUncompressedGrids(
const char* fileName,
const typename GridHandleT::BufferType& buffer =
typename GridHandleT::BufferType())
6130#ifdef NANOVDB_USE_IOSTREAMS
6131 struct StreamT :
public std::ifstream {
6132 StreamT(
const char* name) : std::ifstream(name, std::ios::in | std::ios::binary){}
6133 void skip(int64_t off) { this->seekg(off, std::ios_base::cur); }
6138 StreamT(
const char* name) { fptr = fopen(name,
"rb"); }
6139 ~StreamT() { fclose(fptr); }
6140 bool read(
char* data,
size_t n) {
6141 size_t m = fread(data, 1, n, fptr);
6144 void skip(int64_t off) { fseek(fptr, (
long int)off, SEEK_CUR); }
6145 bool is_open()
const {
return fptr != NULL; }
6148 StreamT is(fileName);
6149 if (!is.is_open()) {
6150 fprintf(stderr,
"nanovdb::readUncompressedGrids: Unable to open file \"%s\"for input\n", fileName);
6196template<
typename BuildT>
6208template<
typename BuildT>
6221template<
typename BuildT>
6236template<
typename BuildT>
6250template<
typename BuildT>
6264template<
typename BuildT>
6278template<
typename BuildT>
6291template<
typename BuildT>
6303template<
typename BuildT>
6314template<
typename BuildT>
6328 return tile.state > 0u;
6349template<
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:969
__hostdev__ void setBitOn(std::initializer_list< uint8_t > list)
Definition NanoVDB.h:999
__hostdev__ Type getFlags() const
Definition NanoVDB.h:991
__hostdev__ void setOn()
Definition NanoVDB.h:993
BitFlags(Type mask)
Definition NanoVDB.h:968
__hostdev__ bool isMaskOn(MaskT mask) const
Definition NanoVDB.h:1033
__hostdev__ void setBitOff(uint8_t bit)
Definition NanoVDB.h:997
__hostdev__ void setOff()
Definition NanoVDB.h:994
__hostdev__ bool isBitOn(uint8_t bit) const
Definition NanoVDB.h:1030
BitFlags()
Definition NanoVDB.h:967
__hostdev__ void setMaskOff(MaskT mask)
Definition NanoVDB.h:1011
__hostdev__ void initBit(std::initializer_list< uint8_t > list)
Definition NanoVDB.h:980
__hostdev__ bool isMaskOff(std::initializer_list< MaskT > list) const
return true if any of the masks in the list are off
Definition NanoVDB.h:1047
__hostdev__ void initMask(std::initializer_list< MaskT > list)
Definition NanoVDB.h:986
__hostdev__ void setBit(uint8_t bit, bool on)
Definition NanoVDB.h:1024
__hostdev__ void setBitOn(uint8_t bit)
Definition NanoVDB.h:996
__hostdev__ Type & data()
Definition NanoVDB.h:979
BitFlags(std::initializer_list< MaskT > list)
Definition NanoVDB.h:974
__hostdev__ void setMask(MaskT mask, bool on)
Definition NanoVDB.h:1026
__hostdev__ bool isOff() const
Definition NanoVDB.h:1029
__hostdev__ bool isBitOff(uint8_t bit) const
Definition NanoVDB.h:1031
__hostdev__ void setBitOff(std::initializer_list< uint8_t > list)
Definition NanoVDB.h:1003
__hostdev__ void setMaskOff(std::initializer_list< MaskT > list)
Definition NanoVDB.h:1019
__hostdev__ bool isMaskOn(std::initializer_list< MaskT > list) const
return true if any of the masks in the list are on
Definition NanoVDB.h:1038
__hostdev__ Type data() const
Definition NanoVDB.h:978
__hostdev__ bool isOn() const
Definition NanoVDB.h:1028
__hostdev__ void setMaskOn(std::initializer_list< MaskT > list)
Definition NanoVDB.h:1014
__hostdev__ bool isMaskOff(MaskT mask) const
Definition NanoVDB.h:1035
__hostdev__ void setMaskOn(MaskT mask)
Definition NanoVDB.h:1009
decltype(mFlags) Type
Definition NanoVDB.h:966
__hostdev__ BitFlags & operator=(Type n)
required for backwards compatibility
Definition NanoVDB.h:1055
Class to access values in channels at a specific voxel location.
Definition NanoVDB.h:5725
__hostdev__ ChannelT & operator()(int i, int j, int k) const
Definition NanoVDB.h:5794
__hostdev__ ChannelT * setChannel(uint32_t channelID)
Change to an internal channel, assuming it exists as as blind data in the IndexGrid.
Definition NanoVDB.h:5782
NanoTree< IndexT > TreeType
Definition NanoVDB.h:5734
__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:5788
__hostdev__ ChannelAccessor(const NanoGrid< IndexT > &grid, ChannelT *channelPtr)
Ctor from an IndexGrid and an external channel.
Definition NanoVDB.h:5750
__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:5797
__hostdev__ const uint64_t & valueCount() const
Return total number of values indexed by the IndexGrid.
Definition NanoVDB.h:5772
__hostdev__ ChannelT & operator()(const math::Coord &ijk) const
Definition NanoVDB.h:5793
__hostdev__ uint64_t idx(int i, int j, int k) const
Definition NanoVDB.h:5789
__hostdev__ const TreeType & tree() const
Definition NanoVDB.h:5766
__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:5739
__hostdev__ const NanoGrid< IndexT > & grid() const
Definition NanoVDB.h:5763
ChannelT ValueType
Definition NanoVDB.h:5733
ChannelAccessor< ChannelT, IndexT > AccessorType
Definition NanoVDB.h:5735
__hostdev__ const Vec3d & voxelSize() const
Return a vector of the axial voxel sizes.
Definition NanoVDB.h:5769
__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:5808
__hostdev__ ChannelT * setChannel(ChannelT *channelPtr)
Definition NanoVDB.h:5776
__hostdev__ ChannelT & getValue(const math::Coord &ijk) const
Return the value from a cached channel that maps to the specified coordinate.
Definition NanoVDB.h:5792
Class that encapsulates two CRC32 checksums, one for the Grid, Tree and Root node meta data and one f...
Definition NanoVDB.h:1841
__hostdev__ Checksum(uint64_t checksum, CheckMode mode=CheckMode::Full)
Definition NanoVDB.h:1864
__hostdev__ bool isFull() const
return true if the 64 bit checksum is fill, i.e. of both had and nodes
Definition NanoVDB.h:1890
__hostdev__ Checksum(uint32_t head, uint32_t tail)
Constructor that allows the two 32bit checksums to be initiated explicitly.
Definition NanoVDB.h:1859
__hostdev__ uint64_t checksum() const
return the 64 bit checksum of this instance
Definition NanoVDB.h:1871
__hostdev__ uint64_t full() const
Definition NanoVDB.h:1877
__hostdev__ uint64_t & full()
Definition NanoVDB.h:1878
__hostdev__ bool isEmpty() const
return true if the 64 bit checksum is disables (unset)
Definition NanoVDB.h:1893
__hostdev__ bool operator==(const Checksum &rhs) const
return true if the checksums are identical
Definition NanoVDB.h:1906
__hostdev__ Checksum()
default constructor initiates checksum to EMPTY
Definition NanoVDB.h:1854
__hostdev__ bool isHalf() const
Definition NanoVDB.h:1887
__hostdev__ uint32_t head() const
Definition NanoVDB.h:1879
__hostdev__ uint32_t & head()
Definition NanoVDB.h:1880
uint64_t mCRC64
Definition NanoVDB.h:1846
uint32_t mCRC32[2]
Definition NanoVDB.h:1846
static constexpr uint32_t EMPTY32
Definition NanoVDB.h:1850
__hostdev__ uint32_t tail() const
Definition NanoVDB.h:1881
__hostdev__ uint32_t checksum(int i) const
Definition NanoVDB.h:1875
__hostdev__ uint32_t & checksum(int i)
Definition NanoVDB.h:1873
__hostdev__ bool operator!=(const Checksum &rhs) const
return true if the checksums are not identical
Definition NanoVDB.h:1910
static constexpr uint64_t EMPTY64
Definition NanoVDB.h:1851
__hostdev__ bool isPartial() const
return true if the 64 bit checksum is partial, i.e. of head only
Definition NanoVDB.h:1886
__hostdev__ CheckMode mode() const
return the mode of the 64 bit checksum
Definition NanoVDB.h:1898
__hostdev__ uint32_t & tail()
Definition NanoVDB.h:1882
__hostdev__ void disable()
Definition NanoVDB.h:1895
Dummy type for a 16bit quantization of float point values.
Definition NanoVDB.h:195
Dummy type for a 4bit quantization of float point values.
Definition NanoVDB.h:189
Dummy type for a 8bit quantization of float point values.
Definition NanoVDB.h:192
Dummy type for a variable bit quantization of floating point values.
Definition NanoVDB.h:198
Highest level of the data structure. Contains a tree and a world->index transform (that currently onl...
Definition NanoVDB.h:2150
__hostdev__ const NanoTree< BuildT > & tree() const
Definition NanoVDB.h:2204
typename RootType::LeafNodeType LeafNodeType
Definition NanoVDB.h:2157
__hostdev__ const GridClass & gridClass() const
Definition NanoVDB.h:2279
typename TreeT::ValueType ValueType
Definition NanoVDB.h:2159
__hostdev__ DataType * data()
Definition NanoVDB.h:2173
__hostdev__ Vec3T worldToIndexF(const Vec3T &xyz) const
Definition NanoVDB.h:2243
typename TreeT::RootType RootType
Definition NanoVDB.h:2153
__hostdev__ bool hasMinMax() const
Definition NanoVDB.h:2289
__hostdev__ util::enable_if< util::is_same< T, Point >::value, constuint64_t & >::type pointCount() const
Definition NanoVDB.h:2201
__hostdev__ int findBlindData(const char *name) const
__hostdev__ const Map & map() const
Definition NanoVDB.h:2216
typename TreeT::CoordType CoordType
Definition NanoVDB.h:2161
typename RootNodeType::ChildNodeType UpperNodeType
Definition NanoVDB.h:2155
__hostdev__ const GridBlindMetaData & blindMetaData(uint32_t n) const
Definition NanoVDB.h:2356
__hostdev__ uint32_t blindDataCount() const
Definition NanoVDB.h:2322
__hostdev__ bool hasStdDeviation() const
Definition NanoVDB.h:2293
__hostdev__ BlindDataT * getBlindData(uint32_t n)
Definition NanoVDB.h:2350
__hostdev__ uint32_t gridIndex() const
Definition NanoVDB.h:2184
__hostdev__ bool isUnknown() const
Definition NanoVDB.h:2288
__hostdev__ Vec3T worldToIndexDir(const Vec3T &dir) const
Definition NanoVDB.h:2234
__hostdev__ const GridType & gridType() const
Definition NanoVDB.h:2278
__hostdev__ bool isSequential() const
Definition NanoVDB.h:2307
__hostdev__ const Checksum & checksum() const
Definition NanoVDB.h:2316
__hostdev__ bool isVoxelBVH() const
Definition NanoVDB.h:2286
GridData DataType
Definition NanoVDB.h:2158
RootType RootNodeType
Definition NanoVDB.h:2154
__hostdev__ bool isValid() const
Definition NanoVDB.h:2277
__hostdev__ uint64_t gridSize() const
Definition NanoVDB.h:2181
__hostdev__ Version version() const
Definition NanoVDB.h:2171
__hostdev__ Vec3T indexToWorldGrad(const Vec3T &grad) const
Definition NanoVDB.h:2239
__hostdev__ bool hasLongGridName() const
Definition NanoVDB.h:2291
__hostdev__ Vec3T indexToWorldGradF(const Vec3T &grad) const
Definition NanoVDB.h:2262
__hostdev__ bool hasBBox() const
Definition NanoVDB.h:2290
__hostdev__ util::enable_if< BuildTraits< T >::is_index, constuint64_t & >::type valueCount() const
Definition NanoVDB.h:2194
__hostdev__ Vec3T indexToWorldDirF(const Vec3T &dir) const
Definition NanoVDB.h:2252
__hostdev__ const char * shortGridName() const
Definition NanoVDB.h:2313
__hostdev__ const char * gridName() const
Definition NanoVDB.h:2310
__hostdev__ bool isMask() const
Definition NanoVDB.h:2287
__hostdev__ const BlindDataT * getBlindData(uint32_t n) const
Definition NanoVDB.h:2343
__hostdev__ uint64_t activeVoxelCount() const
Definition NanoVDB.h:2274
DefaultReadAccessor< BuildType > AccessorType
Definition NanoVDB.h:2162
__hostdev__ bool isBreadthFirst() const
Definition NanoVDB.h:2294
__hostdev__ bool isPointIndex() const
Definition NanoVDB.h:2283
__hostdev__ bool hasAverage() const
Definition NanoVDB.h:2292
__hostdev__ bool isGridIndex() const
Definition NanoVDB.h:2284
__hostdev__ Vec3T indexToWorldDir(const Vec3T &dir) const
Definition NanoVDB.h:2229
__hostdev__ Vec3T indexToWorld(const Vec3T &xyz) const
Definition NanoVDB.h:2224
__hostdev__ bool isLevelSet() const
Definition NanoVDB.h:2280
__hostdev__ uint32_t gridCount() const
Definition NanoVDB.h:2187
__hostdev__ bool isPointData() const
Definition NanoVDB.h:2285
typename UpperNodeType::ChildNodeType LowerNodeType
Definition NanoVDB.h:2156
__hostdev__ AccessorType getAccessor() const
Definition NanoVDB.h:2210
__hostdev__ Vec3T worldToIndex(const Vec3T &xyz) const
Definition NanoVDB.h:2220
__hostdev__ const void * blindData(uint32_t n) const
Definition NanoVDB.h:2335
__hostdev__ const DataType * data() const
Definition NanoVDB.h:2175
__hostdev__ bool isStaggered() const
Definition NanoVDB.h:2282
__hostdev__ Vec3T worldToIndexDirF(const Vec3T &dir) const
Definition NanoVDB.h:2257
__hostdev__ Vec3T indexToWorldF(const Vec3T &xyz) const
Definition NanoVDB.h:2247
__hostdev__ const Vec3d & voxelSize() const
Definition NanoVDB.h:2213
TreeT TreeType
Definition NanoVDB.h:2152
Grid(const Grid &)=delete
Disallow constructions, copy and assignment.
typename TreeT::BuildType BuildType
Definition NanoVDB.h:2160
Grid & operator=(const Grid &)=delete
__hostdev__ bool isFogVolume() const
Definition NanoVDB.h:2281
__hostdev__ bool isSequential() const
Definition NanoVDB.h:2299
__hostdev__ int findBlindDataForSemantic(GridBlindDataSemantic semantic) const
__hostdev__ NanoTree< BuildT > & tree()
Definition NanoVDB.h:2207
Dummy type for a 16 bit floating point values (placeholder for IEEE 754 Half)
Definition NanoVDB.h:186
Visits child nodes of this node only.
Definition NanoVDB.h:3322
__hostdev__ NodeT & operator*() const
Definition NanoVDB.h:3340
__hostdev__ ChildIter(ParentT *parent)
Definition NanoVDB.h:3334
ChildIter & operator=(const ChildIter &)=default
__hostdev__ CoordType getOrigin() const
Definition NanoVDB.h:3350
__hostdev__ NodeT * operator->() const
Definition NanoVDB.h:3345
__hostdev__ CoordType getCoord() const
Definition NanoVDB.h:3355
__hostdev__ ChildIter()
Definition NanoVDB.h:3329
DenseIterator & operator=(const DenseIterator &)=default
__hostdev__ DenseIterator(const InternalNode *parent)
Definition NanoVDB.h:3449
__hostdev__ CoordType getOrigin() const
Definition NanoVDB.h:3471
__hostdev__ const ChildT * probeChild(ValueType &value) const
Definition NanoVDB.h:3455
__hostdev__ bool isValueOn() const
Definition NanoVDB.h:3466
__hostdev__ DenseIterator()
Definition NanoVDB.h:3444
__hostdev__ CoordType getCoord() const
Definition NanoVDB.h:3476
ValueIterator & operator=(const ValueIterator &)=default
__hostdev__ ValueIterator(const InternalNode *parent)
Definition NanoVDB.h:3376
__hostdev__ ValueIterator()
Definition NanoVDB.h:3371
__hostdev__ CoordType getOrigin() const
Definition NanoVDB.h:3387
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:3382
__hostdev__ CoordType getCoord() const
Definition NanoVDB.h:3392
__hostdev__ bool isActive() const
Definition NanoVDB.h:3393
__hostdev__ ValueOnIterator(const InternalNode *parent)
Definition NanoVDB.h:3415
__hostdev__ ValueOnIterator()
Definition NanoVDB.h:3410
__hostdev__ CoordType getOrigin() const
Definition NanoVDB.h:3426
ValueOnIterator & operator=(const ValueOnIterator &)=default
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:3421
__hostdev__ CoordType getCoord() const
Definition NanoVDB.h:3431
Internal nodes of a VDB tree.
Definition NanoVDB.h:3296
__hostdev__ const MaskType< LOG2DIM > & childMask() const
Definition NanoVDB.h:3503
__hostdev__ const FloatType & stdDeviation() const
Definition NanoVDB.h:3522
__hostdev__ const ValueType & minimum() const
Definition NanoVDB.h:3510
__hostdev__ ConstChildIterator cbeginChild() const
Definition NanoVDB.h:3362
__hostdev__ const ChildNodeType * probeChild(const CoordType &ijk) const
Definition NanoVDB.h:3553
__hostdev__ const ValueType & maximum() const
Definition NanoVDB.h:3513
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3305
__hostdev__ DenseIterator beginDense() const
Definition NanoVDB.h:3479
__hostdev__ DataType * data()
Definition NanoVDB.h:3488
ChildIter< const InternalNode > ConstChildIterator
Definition NanoVDB.h:3359
__hostdev__ DenseIterator cbeginChildAll() const
Definition NanoVDB.h:3480
InternalData< ChildT, Log2Dim > DataType
Definition NanoVDB.h:3298
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:3543
static __hostdev__ Coord OffsetToLocalCoord(uint32_t n)
Definition NanoVDB.h:3568
__hostdev__ ChildNodeType * probeChild(const CoordType &ijk)
Definition NanoVDB.h:3548
friend class ReadAccessor
Definition NanoVDB.h:3612
static constexpr uint32_t MASK
Definition NanoVDB.h:3315
static __hostdev__ uint32_t dim()
Definition NanoVDB.h:3493
typename ChildT::CoordType CoordType
Definition NanoVDB.h:3304
static constexpr uint32_t LEVEL
Definition NanoVDB.h:3316
__hostdev__ const MaskType< LOG2DIM > & getValueMask() const
Definition NanoVDB.h:3500
__hostdev__ FloatType variance() const
Definition NanoVDB.h:3519
__hostdev__ ValueIterator cbeginValueAll() const
Definition NanoVDB.h:3401
friend class InternalNode
Definition NanoVDB.h:3617
static constexpr uint32_t DIM
Definition NanoVDB.h:3313
__hostdev__ OpT::Type get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:3593
typename DataType::BuildT BuildType
Definition NanoVDB.h:3301
__hostdev__ void localToGlobalCoord(Coord &ijk) const
Definition NanoVDB.h:3576
typename Mask< Log2Dim >::template Iterator< On > MaskIterT
Definition NanoVDB.h:3309
__hostdev__ ValueType getFirstValue() const
Definition NanoVDB.h:3529
ChildT ChildNodeType
Definition NanoVDB.h:3303
typename DataType::ValueT ValueType
Definition NanoVDB.h:3299
typename DataType::StatsT FloatType
Definition NanoVDB.h:3300
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:3545
__hostdev__ void set(const CoordType &ijk, ArgsT &&... args)
Definition NanoVDB.h:3601
__hostdev__ ValueOnIterator beginValueOn() const
Definition NanoVDB.h:3434
__hostdev__ CoordType origin() const
Definition NanoVDB.h:3507
typename ChildT::LeafNodeType LeafNodeType
Definition NanoVDB.h:3302
static constexpr uint32_t TOTAL
Definition NanoVDB.h:3312
ChildIter< InternalNode > ChildIterator
Definition NanoVDB.h:3358
__hostdev__ ValueOnIterator cbeginValueOn() const
Definition NanoVDB.h:3435
static constexpr uint32_t LOG2DIM
Definition NanoVDB.h:3311
__hostdev__ ValueType getLastValue() const
Definition NanoVDB.h:3536
__hostdev__ const math::BBox< CoordType > & bbox() const
Definition NanoVDB.h:3525
__hostdev__ const MaskType< LOG2DIM > & getChildMask() const
Definition NanoVDB.h:3504
__hostdev__ ValueIterator beginValue() const
Definition NanoVDB.h:3400
static __hostdev__ uint32_t CoordToOffset(const CoordType &ijk)
Definition NanoVDB.h:3560
__hostdev__ Coord offsetToGlobalCoord(uint32_t n) const
Definition NanoVDB.h:3582
static constexpr uint32_t SIZE
Definition NanoVDB.h:3314
typename ChildT::template MaskType< LOG2 > MaskType
Definition NanoVDB.h:3307
__hostdev__ const LeafNodeType * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:3546
__hostdev__ ChildIterator beginChild()
Definition NanoVDB.h:3361
__hostdev__ const MaskType< LOG2DIM > & valueMask() const
Definition NanoVDB.h:3499
__hostdev__ const DataType * data() const
Definition NanoVDB.h:3490
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:3542
__hostdev__ const FloatType & average() const
Definition NanoVDB.h:3516
static constexpr uint64_t NUM_VALUES
Definition NanoVDB.h:3317
InternalNode & operator=(const InternalNode &)=delete
InternalNode(const InternalNode &)=delete
__hostdev__ bool isActive() const
Definition NanoVDB.h:3590
friend class RootNode
Definition NanoVDB.h:3615
static __hostdev__ size_t memUsage()
Definition NanoVDB.h:3496
ValueIterator & operator=(const ValueIterator &)=default
__hostdev__ CoordT getCoord() const
Definition NanoVDB.h:4356
__hostdev__ ValueIterator(const LeafNode *parent)
Definition NanoVDB.h:4344
__hostdev__ ValueIterator()
Definition NanoVDB.h:4339
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:4351
__hostdev__ ValueIterator & operator++()
Definition NanoVDB.h:4367
__hostdev__ ValueIterator operator++(int)
Definition NanoVDB.h:4372
__hostdev__ bool isActive() const
Definition NanoVDB.h:4361
__hostdev__ CoordT getCoord() const
Definition NanoVDB.h:4322
__hostdev__ ValueOffIterator()
Definition NanoVDB.h:4306
ValueOffIterator & operator=(const ValueOffIterator &)=default
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:4317
__hostdev__ ValueOffIterator(const LeafNode *parent)
Definition NanoVDB.h:4311
__hostdev__ ValueOnIterator()
Definition NanoVDB.h:4273
__hostdev__ CoordT getCoord() const
Definition NanoVDB.h:4289
__hostdev__ ValueOnIterator(const LeafNode *parent)
Definition NanoVDB.h:4278
ValueOnIterator & operator=(const ValueOnIterator &)=default
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:4284
Leaf nodes of the VDB tree. (defaults to 8x8x8 = 512 voxels)
Definition NanoVDB.h:4246
__hostdev__ void setValueOnly(uint32_t offset, const ValueType &v)
Sets the value at the specified location but leaves its state unchanged.
Definition NanoVDB.h:4488
__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:4413
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4260
__hostdev__ DataType * data()
Definition NanoVDB.h:4392
typename DataType::BuildType BuildType
Definition NanoVDB.h:4258
static __hostdev__ CoordT OffsetToLocalCoord(uint32_t n)
Compute the local coordinates from a linear offset.
Definition NanoVDB.h:4423
static __hostdev__ uint32_t padding()
Definition NanoVDB.h:4458
LeafData< BuildT, CoordT, MaskT, Log2Dim > DataType
Definition NanoVDB.h:4255
CoordT CoordType
Definition NanoVDB.h:4259
friend class ReadAccessor
Definition NanoVDB.h:4558
static constexpr uint32_t MASK
Definition NanoVDB.h:4388
__hostdev__ CoordT offsetToGlobalCoord(uint32_t n) const
Definition NanoVDB.h:4433
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:4439
LeafNode< BuildT, CoordT, MaskT, Log2Dim > LeafNodeType
Definition NanoVDB.h:4254
static constexpr uint32_t LEVEL
Definition NanoVDB.h:4389
__hostdev__ const MaskType< LOG2DIM > & getValueMask() const
Definition NanoVDB.h:4398
__hostdev__ FloatType variance() const
Return the variance of all the active values encoded in this leaf node.
Definition NanoVDB.h:4410
__hostdev__ auto set(const uint32_t n, ArgsT &&... args)
Definition NanoVDB.h:4549
LeafNode & operator=(const LeafNode &)=delete
__hostdev__ CoordT origin() const
Return the origin in index space of this leaf node.
Definition NanoVDB.h:4418
__hostdev__ ValueIterator cbeginValueAll() const
Definition NanoVDB.h:4381
friend class InternalNode
Definition NanoVDB.h:4563
static constexpr uint32_t DIM
Definition NanoVDB.h:4386
__hostdev__ const LeafNode * probeLeaf(const CoordT &) const
Definition NanoVDB.h:4513
__hostdev__ ValueOffIterator cbeginValueOff() const
Definition NanoVDB.h:4330
__hostdev__ void localToGlobalCoord(Coord &ijk) const
Converts (in place) a local index coordinate to a global index coordinate.
Definition NanoVDB.h:4431
typename DataType::FloatType FloatType
Definition NanoVDB.h:4257
__hostdev__ ValueType getFirstValue() const
Return the first value in this leaf node.
Definition NanoVDB.h:4476
static __hostdev__ uint32_t CoordToOffset(const CoordT &ijk)
Definition NanoVDB.h:4516
typename Mask< Log2Dim >::template Iterator< ON > MaskIterT
Definition NanoVDB.h:4264
__hostdev__ void setValueOnly(const CoordT &ijk, const ValueType &v)
Definition NanoVDB.h:4489
__hostdev__ FloatType average() const
Return a const reference to the average of all the active values encoded in this leaf node.
Definition NanoVDB.h:4407
__hostdev__ math::BBox< CoordT > bbox() const
Return the bounding box in index space of active values in this leaf node.
Definition NanoVDB.h:4442
__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:4506
__hostdev__ uint8_t flags() const
Definition NanoVDB.h:4415
__hostdev__ bool hasBBox() const
Definition NanoVDB.h:4503
__hostdev__ auto set(const CoordType &ijk, ArgsT &&... args)
Definition NanoVDB.h:4543
__hostdev__ ValueOffIterator beginValueOff() const
Definition NanoVDB.h:4329
__hostdev__ ValueOnIterator beginValueOn() const
Definition NanoVDB.h:4296
static constexpr uint32_t TOTAL
Definition NanoVDB.h:4385
__hostdev__ void setValue(const CoordT &ijk, const ValueType &v)
Sets the value at the specified location and activate its state.
Definition NanoVDB.h:4483
__hostdev__ bool isActive(const CoordT &ijk) const
Return true if the voxel value at the given coordinate is active.
Definition NanoVDB.h:4492
__hostdev__ ValueType minimum() const
Return a const reference to the minimum active value encoded in this leaf node.
Definition NanoVDB.h:4401
__hostdev__ auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:4531
__hostdev__ ValueOnIterator cbeginValueOn() const
Definition NanoVDB.h:4297
MaskT< LOG2 > MaskType
Definition NanoVDB.h:4262
__hostdev__ ValueType maximum() const
Return a const reference to the maximum active value encoded in this leaf node.
Definition NanoVDB.h:4404
static constexpr uint32_t LOG2DIM
Definition NanoVDB.h:4384
__hostdev__ ValueType getLastValue() const
Return the last value in this leaf node.
Definition NanoVDB.h:4478
__hostdev__ bool isActive(uint32_t n) const
Definition NanoVDB.h:4493
LeafNode(const LeafNode &)=delete
__hostdev__ ValueType getValue(const CoordT &ijk) const
Return the voxel value at the given coordinate.
Definition NanoVDB.h:4473
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:4596
__hostdev__ ValueIterator beginValue() const
Definition NanoVDB.h:4380
__hostdev__ uint64_t memUsage() const
return memory usage in bytes for the leaf node
Definition NanoVDB.h:4461
static constexpr uint32_t SIZE
Definition NanoVDB.h:4387
typename DataType::ValueType ValueType
Definition NanoVDB.h:4256
__hostdev__ auto get(const uint32_t n, ArgsT &&... args) const
Definition NanoVDB.h:4537
__hostdev__ ValueType getValue(uint32_t offset) const
Return the voxel value at the given offset.
Definition NanoVDB.h:4470
__hostdev__ const MaskType< LOG2DIM > & valueMask() const
Return a const reference to the bit mask of active voxels in this leaf node.
Definition NanoVDB.h:4397
__hostdev__ const DataType * data() const
Definition NanoVDB.h:4394
static constexpr uint64_t NUM_VALUES
Definition NanoVDB.h:4390
static __hostdev__ uint32_t voxelCount()
Return the total number of voxels (e.g. values) encoded in this leaf node.
Definition NanoVDB.h:4456
__hostdev__ bool isActive() const
Return true if any of the voxel value are active in this leaf node.
Definition NanoVDB.h:4496
friend class RootNode
Definition NanoVDB.h:4561
Definition NanoVDB.h:1136
DenseIterator & operator=(const DenseIterator &)=default
__hostdev__ DenseIterator & operator++()
Definition NanoVDB.h:1146
__hostdev__ DenseIterator operator++(int)
Definition NanoVDB.h:1151
__hostdev__ uint32_t pos() const
Definition NanoVDB.h:1144
__hostdev__ uint32_t operator*() const
Definition NanoVDB.h:1143
__hostdev__ DenseIterator(uint32_t pos=Mask::SIZE)
Definition NanoVDB.h:1138
Definition NanoVDB.h:1102
__hostdev__ Iterator operator++(int)
Definition NanoVDB.h:1123
__hostdev__ Iterator()
Definition NanoVDB.h:1104
Iterator & operator=(const Iterator &)=default
__hostdev__ uint32_t pos() const
Definition NanoVDB.h:1116
__hostdev__ uint32_t operator*() const
Definition NanoVDB.h:1115
__hostdev__ Iterator & operator++()
Definition NanoVDB.h:1118
__hostdev__ Iterator(uint32_t pos, const Mask *parent)
Definition NanoVDB.h:1109
Bit-mask to encode active states and facilitate sequential iterators and a fast codec for I/O compres...
Definition NanoVDB.h:1068
__hostdev__ Mask(const Mask &other)
Copy constructor.
Definition NanoVDB.h:1185
__hostdev__ void setAtomic(uint32_t n, bool on)
Definition NanoVDB.h:1274
__hostdev__ bool isOff(uint32_t n) const
Return true if the given bit is NOT set.
Definition NanoVDB.h:1241
__hostdev__ void set(uint32_t n, bool on)
Set the specified bit on or off.
Definition NanoVDB.h:1302
__hostdev__ void setOffAtomic(uint32_t n)
Definition NanoVDB.h:1270
__hostdev__ void setOnAtomic(uint32_t n)
Definition NanoVDB.h:1266
__hostdev__ void setOn()
Set all bits on.
Definition NanoVDB.h:1315
__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:1092
NANOVDB_HOSTDEV_DISABLE_WARNING __hostdev__ uint32_t findNext(uint32_t start) const
Definition NanoVDB.h:1385
__hostdev__ uint32_t countOn() const
Return the total number of set bits in this Mask.
Definition NanoVDB.h:1083
__hostdev__ uint64_t * words()
Return a pointer to the list of words of the bit mask.
Definition NanoVDB.h:1192
__hostdev__ Mask(bool on)
Definition NanoVDB.h:1177
__hostdev__ DenseIterator beginAll() const
Definition NanoVDB.h:1169
__hostdev__ void setOff(uint32_t n)
Set the specified bit off.
Definition NanoVDB.h:1264
__hostdev__ void setOff()
Set all bits off.
Definition NanoVDB.h:1321
Iterator< false > OffIterator
Definition NanoVDB.h:1163
Mask & operator=(const Mask &)=default
__hostdev__ Mask()
Initialize all bits to zero.
Definition NanoVDB.h:1172
__hostdev__ Mask & operator&=(const Mask &other)
Bitwise intersection.
Definition NanoVDB.h:1341
Iterator< true > OnIterator
Definition NanoVDB.h:1162
__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:1212
__hostdev__ void toggle(uint32_t n)
Definition NanoVDB.h:1338
__hostdev__ bool operator!=(const Mask &other) const
Definition NanoVDB.h:1235
__hostdev__ bool isOff() const
Return true if none of the bits are set in this Mask.
Definition NanoVDB.h:1253
static constexpr uint32_t WORD_COUNT
Definition NanoVDB.h:1071
__hostdev__ OffIterator beginOff() const
Definition NanoVDB.h:1167
__hostdev__ void toggle()
brief Toggle the state of all bits in the mask
Definition NanoVDB.h:1333
__hostdev__ const uint64_t * words() const
Definition NanoVDB.h:1193
__hostdev__ void set(bool on)
Set all bits off.
Definition NanoVDB.h:1327
__hostdev__ OnIterator beginOn() const
Definition NanoVDB.h:1165
static __hostdev__ uint32_t wordCount()
Return the number of machine words used by this Mask.
Definition NanoVDB.h:1080
static __hostdev__ uint32_t bitCount()
Return the number of bits available in this Mask.
Definition NanoVDB.h:1077
__hostdev__ Mask & operator|=(const Mask &other)
Bitwise union.
Definition NanoVDB.h:1349
__hostdev__ bool operator==(const Mask &other) const
Definition NanoVDB.h:1226
NANOVDB_HOSTDEV_DISABLE_WARNING __hostdev__ uint32_t findPrev(uint32_t start) const
Definition NanoVDB.h:1399
__hostdev__ bool isOn(uint32_t n) const
Return true if the given bit is set.
Definition NanoVDB.h:1238
static constexpr uint32_t SIZE
Definition NanoVDB.h:1070
__hostdev__ bool isOn() const
Return true if all the bits are set in this Mask.
Definition NanoVDB.h:1244
__hostdev__ void setWord(WordT w, uint32_t n)
Definition NanoVDB.h:1203
NANOVDB_HOSTDEV_DISABLE_WARNING __hostdev__ uint32_t findFirst() const
Definition NanoVDB.h:1375
__hostdev__ Mask & operator-=(const Mask &other)
Bitwise difference.
Definition NanoVDB.h:1357
__hostdev__ Mask & operator^=(const Mask &other)
Bitwise XOR.
Definition NanoVDB.h:1365
__hostdev__ WordT getWord(uint32_t n) const
Definition NanoVDB.h:1196
__hostdev__ void setOn(uint32_t n)
Set the specified bit on.
Definition NanoVDB.h:1262
static __hostdev__ size_t memUsage()
Return the memory footprint in bytes of this Mask.
Definition NanoVDB.h:1074
__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:5705
PointAccessor(const NanoGrid< Point > &grid)
Definition NanoVDB.h:5663
__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:5694
__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:5684
__hostdev__ const NanoGrid< Point > & grid() const
Definition NanoVDB.h:5680
__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:5639
__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:5627
__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:5617
__hostdev__ const NanoGrid< BuildT > & grid() const
Definition NanoVDB.h:5613
PointAccessor(const NanoGrid< BuildT > &grid)
Definition NanoVDB.h:5600
Dummy type for indexing points into voxels.
Definition NanoVDB.h:201
__hostdev__ auto set(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:4888
ReadAccessor & operator=(const ReadAccessor &)=default
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:4873
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition NanoVDB.h:4838
friend class InternalNode
Definition NanoVDB.h:4898
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition NanoVDB.h:4877
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:4875
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:4874
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition NanoVDB.h:4871
typename RootT::CoordType CoordType
Definition NanoVDB.h:4833
__hostdev__ auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:4882
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition NanoVDB.h:4872
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition NanoVDB.h:4850
friend class LeafNode
Definition NanoVDB.h:4900
ReadAccessor(const ReadAccessor &)=default
Defaults constructors.
typename RootT::ValueType ValueType
Definition NanoVDB.h:4832
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition NanoVDB.h:4844
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition NanoVDB.h:4857
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:4865
static const int CacheLevels
Definition NanoVDB.h:4835
BuildT BuildType
Definition NanoVDB.h:4831
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition NanoVDB.h:4870
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:4869
__hostdev__ const RootT & root() const
Definition NanoVDB.h:4859
friend class RootNode
Allow nodes to insert themselves into the cache.
Definition NanoVDB.h:4896
ReadAccessor & operator=(const ReadAccessor &)=default
__hostdev__ void set(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:5004
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:4985
CoordT CoordType
Definition NanoVDB.h:4932
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition NanoVDB.h:4937
friend class InternalNode
Definition NanoVDB.h:5015
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition NanoVDB.h:4990
__hostdev__ OpT::Type get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:4997
ValueT ValueType
Definition NanoVDB.h:4931
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:4987
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:4986
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition NanoVDB.h:4983
__hostdev__ bool isCached(const CoordType &ijk) const
Definition NanoVDB.h:4970
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition NanoVDB.h:4984
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition NanoVDB.h:4951
friend class LeafNode
Definition NanoVDB.h:5017
ReadAccessor(const ReadAccessor &)=default
Defaults constructors.
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition NanoVDB.h:4945
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition NanoVDB.h:4957
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:4977
static const int CacheLevels
Definition NanoVDB.h:4934
BuildT BuildType
Definition NanoVDB.h:4930
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition NanoVDB.h:4982
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:4981
__hostdev__ const RootT & root() const
Definition NanoVDB.h:4963
friend class RootNode
Allow nodes to insert themselves into the cache.
Definition NanoVDB.h:5013
ReadAccessor & operator=(const ReadAccessor &)=default
__hostdev__ bool isCached1(const CoordType &ijk) const
Definition NanoVDB.h:5136
__hostdev__ void set(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:5199
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:5158
CoordT CoordType
Definition NanoVDB.h:5062
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition NanoVDB.h:5067
friend class InternalNode
Definition NanoVDB.h:5223
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition NanoVDB.h:5163
__hostdev__ OpT::Type get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:5179
ValueT ValueType
Definition NanoVDB.h:5061
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:5160
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:5159
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition NanoVDB.h:5156
__hostdev__ bool isCached2(const CoordType &ijk) const
Definition NanoVDB.h:5142
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition NanoVDB.h:5157
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition NanoVDB.h:5086
friend class LeafNode
Definition NanoVDB.h:5225
ReadAccessor(const ReadAccessor &)=default
Defaults constructors.
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition NanoVDB.h:5080
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition NanoVDB.h:5092
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:5150
static const int CacheLevels
Definition NanoVDB.h:5064
BuildT BuildType
Definition NanoVDB.h:5060
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition NanoVDB.h:5155
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:5154
__hostdev__ const RootT & root() const
Definition NanoVDB.h:5103
friend class RootNode
Allow nodes to insert themselves into the cache.
Definition NanoVDB.h:5221
Definition NanoVDB.h:2139
Definition NanoVDB.h:2713
__hostdev__ TileT & operator*() const
Definition NanoVDB.h:2737
TileT * mPos
Definition NanoVDB.h:2717
__hostdev__ TileIter()
Definition NanoVDB.h:2720
TileT * mBegin
Definition NanoVDB.h:2717
__hostdev__ TileIter(DataT *data, uint32_t pos=0)
Definition NanoVDB.h:2721
typename util::match_const< ChildT, DataT >::type NodeT
Definition NanoVDB.h:2716
__hostdev__ bool isChild() const
Definition NanoVDB.h:2752
typename util::match_const< Tile, DataT >::type TileT
Definition NanoVDB.h:2715
TileT * mEnd
Definition NanoVDB.h:2717
__hostdev__ ValueT value() const
Definition NanoVDB.h:2772
__hostdev__ RootData * data() const
Definition NanoVDB.h:2747
__hostdev__ bool isValueOn() const
Definition NanoVDB.h:2762
__hostdev__ bool isValue() const
Definition NanoVDB.h:2757
__hostdev__ NodeT * child() const
Definition NanoVDB.h:2767
__hostdev__ auto pos() const
Definition NanoVDB.h:2731
__hostdev__ TileIter & operator++()
Definition NanoVDB.h:2732
__hostdev__ TileT * operator->() const
Definition NanoVDB.h:2742
__hostdev__ BaseIter(DataT *data)
Definition NanoVDB.h:2888
__hostdev__ BaseIter()
Definition NanoVDB.h:2887
typename util::match_const< Tile, RootT >::type TileT
Definition NanoVDB.h:2885
DataType::template TileIter< DataT > mTileIter
Definition NanoVDB.h:2886
__hostdev__ CoordType getOrigin() const
Definition NanoVDB.h:2894
typename util::match_const< DataType, RootT >::type DataT
Definition NanoVDB.h:2884
__hostdev__ uint32_t pos() const
Definition NanoVDB.h:2892
__hostdev__ TileT * tile() const
Definition NanoVDB.h:2893
__hostdev__ CoordType getCoord() const
Definition NanoVDB.h:2895
Definition NanoVDB.h:2900
__hostdev__ NodeT & operator*() const
Definition NanoVDB.h:2912
__hostdev__ ChildIter operator++(int)
Definition NanoVDB.h:2920
__hostdev__ ChildIter(RootT *parent)
Definition NanoVDB.h:2908
__hostdev__ ChildIter & operator++()
Definition NanoVDB.h:2914
__hostdev__ NodeT * operator->() const
Definition NanoVDB.h:2913
__hostdev__ ChildIter()
Definition NanoVDB.h:2907
Definition NanoVDB.h:3003
__hostdev__ NodeT * probeChild(ValueType &value) const
Definition NanoVDB.h:3011
__hostdev__ DenseIter operator++(int)
Definition NanoVDB.h:3023
__hostdev__ DenseIter & operator++()
Definition NanoVDB.h:3018
__hostdev__ DenseIter()
Definition NanoVDB.h:3009
__hostdev__ DenseIter(RootT *parent)
Definition NanoVDB.h:3010
__hostdev__ bool isValueOn() const
Definition NanoVDB.h:3017
Definition NanoVDB.h:2936
__hostdev__ ValueIter & operator++()
Definition NanoVDB.h:2948
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:2946
__hostdev__ ValueIter operator++(int)
Definition NanoVDB.h:2954
__hostdev__ ValueIter()
Definition NanoVDB.h:2941
__hostdev__ ValueIter(RootT *parent)
Definition NanoVDB.h:2942
__hostdev__ bool isActive() const
Definition NanoVDB.h:2947
Definition NanoVDB.h:2970
__hostdev__ ValueOnIter(RootT *parent)
Definition NanoVDB.h:2976
__hostdev__ ValueOnIter()
Definition NanoVDB.h:2975
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:2980
__hostdev__ ValueOnIter operator++(int)
Definition NanoVDB.h:2987
__hostdev__ ValueOnIter & operator++()
Definition NanoVDB.h:2981
Top-most node of the VDB tree structure.
Definition NanoVDB.h:2859
__hostdev__ const FloatType & stdDeviation() const
Definition NanoVDB.h:3076
__hostdev__ const ValueType & minimum() const
Definition NanoVDB.h:3064
__hostdev__ ConstChildIterator cbeginChild() const
Definition NanoVDB.h:2932
__hostdev__ DenseIterator beginDense()
Definition NanoVDB.h:3034
__hostdev__ const ValueType & maximum() const
Definition NanoVDB.h:3067
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:2876
ChildIter< const RootNode > ConstChildIterator
Definition NanoVDB.h:2929
__hostdev__ DataType * data()
Definition NanoVDB.h:3046
__hostdev__ bool isEmpty() const
Definition NanoVDB.h:3085
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:3090
__hostdev__ ConstValueOnIterator cbeginValueOn() const
Definition NanoVDB.h:2999
__hostdev__ ValueIterator beginValue()
Definition NanoVDB.h:2965
friend class ReadAccessor
Definition NanoVDB.h:3120
ChildT UpperNodeType
Definition NanoVDB.h:2865
typename ChildT::CoordType CoordType
Definition NanoVDB.h:2872
static constexpr uint32_t LEVEL
Definition NanoVDB.h:2878
__hostdev__ FloatType variance() const
Definition NanoVDB.h:3073
RootNode & operator=(const RootNode &)=delete
ValueOnIter< RootNode > ValueOnIterator
Definition NanoVDB.h:2995
ValueIter< const RootNode > ConstValueIterator
Definition NanoVDB.h:2963
__hostdev__ OpT::Type get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:3096
RootData< ChildT > DataType
Definition NanoVDB.h:2861
__hostdev__ const uint32_t & tileCount() const
Definition NanoVDB.h:3060
typename DataType::BuildT BuildType
Definition NanoVDB.h:2870
ValueIter< RootNode > ValueIterator
Definition NanoVDB.h:2962
RootNode(const RootNode &)=delete
ChildT ChildNodeType
Definition NanoVDB.h:2862
typename DataType::ValueT ValueType
Definition NanoVDB.h:2868
__hostdev__ ConstDenseIterator cbeginDense() const
Definition NanoVDB.h:3035
RootType RootNodeType
Definition NanoVDB.h:2864
__hostdev__ ConstValueIterator cbeginValueAll() const
Definition NanoVDB.h:2966
RootNode< ChildT > RootType
Definition NanoVDB.h:2863
typename DataType::StatsT FloatType
Definition NanoVDB.h:2869
__hostdev__ const ValueType & background() const
Definition NanoVDB.h:3057
ChildIter< RootNode > ChildIterator
Definition NanoVDB.h:2928
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:3092
__hostdev__ ValueOnIterator beginValueOn()
Definition NanoVDB.h:2998
__hostdev__ void set(const CoordType &ijk, ArgsT &&... args)
Definition NanoVDB.h:3106
friend class Tree
Definition NanoVDB.h:3123
typename ChildT::LeafNodeType LeafNodeType
Definition NanoVDB.h:2867
DefaultReadAccessor< BuildType > AccessorType
Definition NanoVDB.h:2874
math::BBox< CoordType > BBoxType
Definition NanoVDB.h:2873
ValueOnIter< const RootNode > ConstValueOnIterator
Definition NanoVDB.h:2996
__hostdev__ ConstDenseIterator cbeginChildAll() const
Definition NanoVDB.h:3036
__hostdev__ const BBoxType & bbox() const
Definition NanoVDB.h:3051
typename DataType::Tile Tile
Definition NanoVDB.h:2875
__hostdev__ uint64_t memUsage() const
Definition NanoVDB.h:3082
typename UpperNodeType::ChildNodeType LowerNodeType
Definition NanoVDB.h:2866
__hostdev__ AccessorType getAccessor() const
Definition NanoVDB.h:3044
__hostdev__ const LeafNodeType * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:3093
static __hostdev__ uint64_t memUsage(uint32_t tableSize)
Definition NanoVDB.h:3079
__hostdev__ ChildIterator beginChild()
Definition NanoVDB.h:2931
__hostdev__ const DataType * data() const
Definition NanoVDB.h:3048
RootNode()=delete
This class cannot be constructed or deleted.
__hostdev__ const uint32_t & getTableSize() const
Definition NanoVDB.h:3061
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:3088
__hostdev__ const FloatType & average() const
Definition NanoVDB.h:3070
DenseIter< const RootNode > ConstDenseIterator
Definition NanoVDB.h:3032
DenseIter< RootNode > DenseIterator
Definition NanoVDB.h:3031
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:3089
VDB Tree, which is a thin wrapper around a RootNode.
Definition NanoVDB.h:2449
typename RootT::ChildNodeType Node2
Definition NanoVDB.h:2468
__hostdev__ const NodeT * getFirstNode() const
Definition NanoVDB.h:2559
typename RootType::LeafNodeType LeafNodeType
Definition NanoVDB.h:2461
__hostdev__ DataType * data()
Definition NanoVDB.h:2478
RootT Node3
Definition NanoVDB.h:2467
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:2496
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:2483
__hostdev__ const NodeTrait< NanoRoot< BuildT >, 2 >::type * getFirstUpper() const
Definition NanoVDB.h:2589
__hostdev__ NanoRoot< BuildT > & root()
Definition NanoVDB.h:2485
__hostdev__ NodeTrait< NanoRoot< BuildT >, 1 >::type * getFirstLower()
Definition NanoVDB.h:2586
__hostdev__ uint32_t nodeCount() const
Definition NanoVDB.h:2528
typename RootNodeType::ChildNodeType UpperNodeType
Definition NanoVDB.h:2459
__hostdev__ LeafNodeType * getFirstLeaf()
Definition NanoVDB.h:2584
Tree()=delete
This class cannot be constructed or deleted.
__hostdev__ const LeafNodeType * getFirstLeaf() const
Definition NanoVDB.h:2585
__hostdev__ const ValueType & background() const
Definition NanoVDB.h:2505
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:2502
__hostdev__ auto set(const CoordType &ijk, ArgsT &&... args)
Definition NanoVDB.h:2598
RootT RootNodeType
Definition NanoVDB.h:2458
typename RootT::CoordType CoordType
Definition NanoVDB.h:2464
__hostdev__ uint64_t activeVoxelCount() const
Definition NanoVDB.h:2514
DefaultReadAccessor< BuildType > AccessorType
Definition NanoVDB.h:2465
__hostdev__ auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:2592
Tree(const Tree &)=delete
LeafNodeType Node0
Definition NanoVDB.h:2470
__hostdev__ NodeTrait< NanoRoot< BuildT >, LEVEL >::type * getFirstNode()
Definition NanoVDB.h:2569
__hostdev__ NodeT * getFirstNode()
Definition NanoVDB.h:2549
typename Node2::ChildNodeType Node1
Definition NanoVDB.h:2469
__hostdev__ uint32_t totalNodeCount() const
Definition NanoVDB.h:2540
RootT RootType
Definition NanoVDB.h:2457
__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:2587
typename UpperNodeType::ChildNodeType LowerNodeType
Definition NanoVDB.h:2460
__hostdev__ AccessorType getAccessor() const
Definition NanoVDB.h:2489
typename RootT::ValueType ValueType
Definition NanoVDB.h:2462
__hostdev__ const NodeTrait< NanoRoot< BuildT >, LEVEL >::type * getFirstNode() const
Definition NanoVDB.h:2578
__hostdev__ uint32_t nodeCount(int level) const
Definition NanoVDB.h:2534
__hostdev__ const uint32_t & activeTileCount(uint32_t level) const
Definition NanoVDB.h:2521
TreeData DataType
Definition NanoVDB.h:2456
__hostdev__ const DataType * data() const
Definition NanoVDB.h:2480
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:2492
__hostdev__ NodeTrait< NanoRoot< BuildT >, 2 >::type * getFirstUpper()
Definition NanoVDB.h:2588
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:2493
__hostdev__ const NanoRoot< BuildT > & root() const
Definition NanoVDB.h:2487
typename RootT::BuildType BuildType
Definition NanoVDB.h:2463
Dummy type for a voxel whose value equals an offset into an external value array.
Definition NanoVDB.h:177
Dummy type for a voxel whose value equals its binary active state.
Definition NanoVDB.h:183
Dummy type for a voxel whose value equals an offset into an external value array of active values.
Definition NanoVDB.h:180
Bit-compacted representation of all three version numbers.
Definition NanoVDB.h:730
__hostdev__ Version(uint32_t major, uint32_t minor, uint32_t patch)
Constructor from major.minor.patch version numbers.
Definition NanoVDB.h:744
__hostdev__ uint32_t getMajor() const
Definition NanoVDB.h:757
__hostdev__ Version()
Default constructor.
Definition NanoVDB.h:735
static constexpr uint32_t End
Definition NanoVDB.h:733
__hostdev__ bool operator<=(const Version &rhs) const
Definition NanoVDB.h:753
__hostdev__ bool operator==(const Version &rhs) const
Definition NanoVDB.h:751
__hostdev__ Version(uint32_t data)
Constructor from a raw uint32_t data representation.
Definition NanoVDB.h:742
__hostdev__ int age() const
Returns the difference between major version of this instance and NANOVDB_MAJOR_VERSION_NUMBER.
Definition NanoVDB.h:764
__hostdev__ bool isCompatible() const
Definition NanoVDB.h:760
__hostdev__ bool operator>(const Version &rhs) const
Definition NanoVDB.h:754
__hostdev__ uint32_t getMinor() const
Definition NanoVDB.h:758
__hostdev__ bool operator>=(const Version &rhs) const
Definition NanoVDB.h:755
__hostdev__ bool operator<(const Version &rhs) const
Definition NanoVDB.h:752
__hostdev__ uint32_t id() const
Definition NanoVDB.h:756
__hostdev__ uint32_t getPatch() const
Definition NanoVDB.h:759
static constexpr uint32_t StrLen
Definition NanoVDB.h:733
Definition NanoVDB.h:5852
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:5954
__hostdev__ Codec toCodec(const char *str)
Definition NanoVDB.h:5876
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:6081
__hostdev__ const char * toStr(char *dst, Codec codec)
Definition NanoVDB.h:5866
Codec
Define compression codecs.
Definition NanoVDB.h:5860
@ StrLen
Definition NanoVDB.h:5864
@ ZIP
Definition NanoVDB.h:5861
@ End
Definition NanoVDB.h:5863
@ BLOSC
Definition NanoVDB.h:5862
@ NONE
Definition NanoVDB.h:5860
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:6053
size_t strlen(const char *str)
length of a c-sting, excluding '\0'.
Definition Util.h:165
uint32_t countOn(uint64_t v)
Definition Util.h:668
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:618
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:197
bool streq(const char *lhs, const char *rhs)
Test if two null-terminated byte strings are the same.
Definition Util.h:280
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:524
static void * memzero(void *dst, size_t byteCount)
Zero initialization of memory.
Definition Util.h:309
char * strcpy(char *dst, const char *src)
Copy characters from src to dst.
Definition Util.h:178
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:548
static int64_t PtrDiff(const void *p, const void *q)
Compute the distance, in bytes, between two pointers, dist = p - q.
Definition Util.h:510
uint64_t atomicOr(uint64_t *target, uint64_t mask)
Atomically ORs mask into the 64-bit word at target (relaxed ordering). Returns the old value....
Definition Util.h:693
char * sprint(char *dst, T var1, Types... var2)
prints a variable number of string and/or numbers to a destination string
Definition Util.h:298
uint64_t atomicAnd(uint64_t *target, uint64_t mask)
Atomically ANDs mask into the 64-bit word at target (relaxed ordering). Returns the old value....
Definition Util.h:717
Definition GridHandle.h:27
__hostdev__ bool isFloatingPoint(GridType gridType)
return true if the GridType maps to a floating point type
Definition NanoVDB.h:616
__hostdev__ auto getAccessor(const GridT &grid, ValueT *sideCar=nullptr)
Generic template functions that return an Accessor to either an index grid or a regular grid.
Definition NanoVDB.h:5821
Grid< Fp4Tree > Fp4Grid
Definition NanoVDB.h:4700
ReadAccessor< BuildT, 0, 1, 2 > DefaultReadAccessor
Definition NanoVDB.h:2142
PointType
Definition NanoVDB.h:395
@ Voxel32
Definition NanoVDB.h:401
@ Grid32
Definition NanoVDB.h:400
@ Voxel8
Definition NanoVDB.h:403
@ Default
Definition NanoVDB.h:404
@ PointID
Definition NanoVDB.h:396
@ World32
Definition NanoVDB.h:398
@ Disable
Definition NanoVDB.h:395
@ Voxel16
Definition NanoVDB.h:402
@ World64
Definition NanoVDB.h:397
@ Grid64
Definition NanoVDB.h:399
auto callNanoGrid(GridDataT *gridData, ArgsT &&... args)
Below is an example of the struct used for generic programming with callNanoGrid.
Definition NanoVDB.h:4749
__hostdev__ constexpr uint32_t strlen()
return the number of characters (including null termination) required to convert enum type to a strin...
Definition NanoVDB.h:209
Grid< Vec4fTree > Vec4fGrid
Definition NanoVDB.h:4710
Grid< NanoTree< BuildT > > NanoGrid
Definition NanoVDB.h:4645
__hostdev__ CheckMode toCheckMode(const Checksum &checksum)
Maps 64 bit checksum to CheckMode enum.
Definition NanoVDB.h:1916
__hostdev__ GridType toGridType()
Maps from a templated build type to a GridType enum.
Definition NanoVDB.h:851
typename NodeTrait< GridOrTreeOrRootT, LEVEL >::type NodeTraitT
Definition NanoVDB.h:1790
__hostdev__ char * toStr(char *dst, GridType gridType)
Maps a GridType to a c-string.
Definition NanoVDB.h:253
NanoTree< Vec3i > Vec3ITree
Definition NanoVDB.h:4693
Grid< Fp16Tree > Fp16Grid
Definition NanoVDB.h:4702
Grid< FloatTree > FloatGrid
Definition NanoVDB.h:4699
Grid< Vec3fTree > Vec3fGrid
Definition NanoVDB.h:4708
__hostdev__ bool isInteger(GridType gridType)
Return true if the GridType maps to a POD integer type.
Definition NanoVDB.h:642
__hostdev__ GridClass toGridClass(GridBlindDataSemantic semantics, GridClass defaultClass=GridClass::Unknown)
Maps from GridBlindDataSemantic to GridClass.
Definition NanoVDB.h:448
InternalNode< NanoLeaf< BuildT >, 4 > NanoLower
Definition NanoVDB.h:4637
Grid< Vec4dTree > Vec4dGrid
Definition NanoVDB.h:4711
typename GridTree< GridT >::type GridTreeT
Definition NanoVDB.h:2442
__hostdev__ MagicType toMagic(uint64_t magic)
maps 64 bits of magic number to enum
Definition NanoVDB.h:366
Grid< BoolTree > BoolGrid
Definition NanoVDB.h:4714
InternalNode< NanoLower< BuildT >, 5 > NanoUpper
Definition NanoVDB.h:4639
GridClass
Classes (superset of OpenVDB) that are currently supported by NanoVDB.
Definition NanoVDB.h:288
@ FogVolume
Definition NanoVDB.h:290
@ TensorGrid
Definition NanoVDB.h:297
@ VoxelVolume
Definition NanoVDB.h:295
@ End
Definition NanoVDB.h:299
@ Unknown
Definition NanoVDB.h:288
@ Topology
Definition NanoVDB.h:294
@ VoxelBVH
Definition NanoVDB.h:298
@ PointIndex
Definition NanoVDB.h:292
@ IndexGrid
Definition NanoVDB.h:296
@ PointData
Definition NanoVDB.h:293
@ Staggered
Definition NanoVDB.h:291
@ LevelSet
Definition NanoVDB.h:289
GridType
List of types that are currently supported by NanoVDB.
Definition NanoVDB.h:219
@ Vec3u8
Definition NanoVDB.h:243
@ Float
Definition NanoVDB.h:220
@ Boolean
Definition NanoVDB.h:230
@ Vec4f
Definition NanoVDB.h:236
@ Int16
Definition NanoVDB.h:222
@ StrLen
Definition NanoVDB.h:247
@ Fp4
Definition NanoVDB.h:232
@ Mask
Definition NanoVDB.h:227
@ Vec3u16
Definition NanoVDB.h:244
@ Vec4d
Definition NanoVDB.h:237
@ Fp8
Definition NanoVDB.h:233
@ End
Definition NanoVDB.h:246
@ Unknown
Definition NanoVDB.h:219
@ Index
Definition NanoVDB.h:238
@ FpN
Definition NanoVDB.h:235
@ UInt8
Definition NanoVDB.h:245
@ RGBA8
Definition NanoVDB.h:231
@ Int32
Definition NanoVDB.h:223
@ OnIndex
Definition NanoVDB.h:239
@ Half
Definition NanoVDB.h:228
@ PointIndex
Definition NanoVDB.h:242
@ Vec3d
Definition NanoVDB.h:226
@ Double
Definition NanoVDB.h:221
@ UInt32
Definition NanoVDB.h:229
@ Vec3f
Definition NanoVDB.h:225
@ Int64
Definition NanoVDB.h:224
@ Fp16
Definition NanoVDB.h:234
CheckMode
List of different modes for computing for a checksum.
Definition NanoVDB.h:1814
@ Partial
Definition NanoVDB.h:1817
@ Full
Definition NanoVDB.h:1819
@ Disable
Definition NanoVDB.h:1814
@ Half
Definition NanoVDB.h:1816
@ Empty
Definition NanoVDB.h:1815
Grid< Vec3dTree > Vec3dGrid
Definition NanoVDB.h:4709
typename NanoNode< BuildT, LEVEL >::type NanoNodeT
Definition NanoVDB.h:4678
Grid< Point > PointGrid
Definition NanoVDB.h:4715
RootNode< NanoUpper< BuildT > > NanoRoot
Definition NanoVDB.h:4641
typename util::conditional< BuildTraits< BuildT >::is_index, ChannelAccessor< ValueT, BuildT >, DefaultReadAccessor< BuildT > >::type AccType
Generic Accessor type that maps to either a ReadAccessor or ChannelAccessor.
Definition NanoVDB.h:5816
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:5486
NanoTree< ValueMask > MaskTree
Definition NanoVDB.h:4694
GridFlags
Grid flags which indicate what extra information is present in the grid buffer.
Definition NanoVDB.h:327
@ HasAverage
Definition NanoVDB.h:331
@ HasStdDeviation
Definition NanoVDB.h:332
@ HasLongGridName
Definition NanoVDB.h:328
@ HasMinMax
Definition NanoVDB.h:330
@ End
Definition NanoVDB.h:334
@ HasBBox
Definition NanoVDB.h:329
@ IsBreadthFirst
Definition NanoVDB.h:333
Grid< OnIndexTree > OnIndexGrid
Definition NanoVDB.h:4717
Grid< Vec3ITree > Vec3IGrid
Definition NanoVDB.h:4712
Grid< Fp8Tree > Fp8Grid
Definition NanoVDB.h:4701
__hostdev__ GridBlindDataSemantic toSemantic(GridClass gridClass, GridBlindDataSemantic defaultSemantic=GridBlindDataSemantic::Unknown)
Maps from GridClass to GridBlindDataSemantic.
Definition NanoVDB.h:482
Grid< Int64Tree > Int64Grid
Definition NanoVDB.h:4707
Tree< NanoRoot< BuildT > > NanoTree
Definition NanoVDB.h:4643
__hostdev__ GridType mapToGridType()
Definition NanoVDB.h:907
NanoTree< int32_t > Int32Tree
Definition NanoVDB.h:4686
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:4635
NanoTree< ValueOnIndex > OnIndexTree
Definition NanoVDB.h:4697
GridBlindDataClass
Blind-data Classes that are currently supported by NanoVDB.
Definition NanoVDB.h:410
@ ChannelArray
Definition NanoVDB.h:414
@ End
Definition NanoVDB.h:415
@ IndexArray
Definition NanoVDB.h:411
@ AttributeArray
Definition NanoVDB.h:412
@ GridName
Definition NanoVDB.h:413
NanoTree< double > DoubleTree
Definition NanoVDB.h:4685
NanoTree< ValueIndex > IndexTree
Definition NanoVDB.h:4696
__hostdev__ bool isFloatingPointVector(GridType gridType)
return true if the GridType maps to a floating point vec3.
Definition NanoVDB.h:630
NanoTree< Vec4d > Vec4dTree
Definition NanoVDB.h:4692
Grid< UInt32Tree > UInt32Grid
Definition NanoVDB.h:4706
NanoTree< Fp8 > Fp8Tree
Definition NanoVDB.h:4682
static __hostdev__ bool isAligned(const void *p)
return true if the specified pointer is 32 byte aligned
Definition NanoVDB.h:600
MagicType
Enums used to identify magic numbers recognized by NanoVDB.
Definition NanoVDB.h:357
@ OpenVDB
Definition NanoVDB.h:358
@ NanoGrid
Definition NanoVDB.h:360
@ Unknown
Definition NanoVDB.h:357
@ NanoVDB
Definition NanoVDB.h:359
@ NanoFile
Definition NanoVDB.h:361
typename BuildToValueMap< T >::type BuildToValueMapT
Definition NanoVDB.h:595
NanoTree< int64_t > Int64Tree
Definition NanoVDB.h:4688
__hostdev__ bool isValid(GridType gridType, GridClass gridClass)
return true if the combination of GridType and GridClass is valid.
Definition NanoVDB.h:664
NanoTree< Vec4f > Vec4fTree
Definition NanoVDB.h:4691
NanoTree< Vec3d > Vec3dTree
Definition NanoVDB.h:4690
NanoTree< Fp16 > Fp16Tree
Definition NanoVDB.h:4683
Grid< MaskTree > MaskGrid
Definition NanoVDB.h:4713
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:603
NanoTree< FpN > FpNTree
Definition NanoVDB.h:4684
__hostdev__ bool isIndex(GridType gridType)
Return true if the GridType maps to a special index type (not a POD integer type).
Definition NanoVDB.h:655
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:611
Grid< IndexTree > IndexGrid
Definition NanoVDB.h:4716
GridBlindDataSemantic
Blind-data Semantics that are currently understood by NanoVDB.
Definition NanoVDB.h:418
@ GaussianId
Definition NanoVDB.h:438
@ PointQuat
Definition NanoVDB.h:432
@ TriangleId
Definition NanoVDB.h:437
@ FogVolume
Definition NanoVDB.h:429
@ PointRadius
Definition NanoVDB.h:422
@ LineId
Definition NanoVDB.h:436
@ PointOpacity
Definition NanoVDB.h:431
@ PointPosition
Definition NanoVDB.h:419
@ PointColor
Definition NanoVDB.h:420
@ VoxelCoords
Definition NanoVDB.h:427
@ PointVelocity
Definition NanoVDB.h:423
@ End
Definition NanoVDB.h:441
@ Unknown
Definition NanoVDB.h:418
@ GridCoords
Definition NanoVDB.h:426
@ WorldCoords
Definition NanoVDB.h:425
@ VoxelBVH
Definition NanoVDB.h:440
@ PointNormal
Definition NanoVDB.h:421
@ PointSH0
Definition NanoVDB.h:434
@ PointSHN
Definition NanoVDB.h:435
@ Staggered
Definition NanoVDB.h:430
@ LevelSet
Definition NanoVDB.h:428
@ PointScale
Definition NanoVDB.h:433
@ PointId
Definition NanoVDB.h:424
Grid< Int32Tree > Int32Grid
Definition NanoVDB.h:4705
NanoTree< Vec3f > Vec3fTree
Definition NanoVDB.h:4689
NanoTree< bool > BoolTree
Definition NanoVDB.h:4695
NanoTree< uint32_t > UInt32Tree
Definition NanoVDB.h:4687
__hostdev__ GridClass mapToGridClass(GridClass defaultClass=GridClass::Unknown)
Definition NanoVDB.h:929
Grid< DoubleTree > DoubleGrid
Definition NanoVDB.h:4704
Grid< FpNTree > FpNGrid
Definition NanoVDB.h:4703
NanoTree< float > FloatTree
Definition NanoVDB.h:4680
NanoTree< Fp4 > Fp4Tree
Definition NanoVDB.h:4681
#define NANOVDB_HOSTDEV_DISABLE_WARNING
Definition Util.h:106
#define __hostdev__
Definition Util.h:76
#define NANOVDB_ASSERT(x)
Definition Util.h:53
uint16_t mFlags
Definition NanoVDB.h:946
uint32_t mFlags
Definition NanoVDB.h:951
uint64_t mFlags
Definition NanoVDB.h:956
uint8_t mFlags
Definition NanoVDB.h:941
float type
Definition NanoVDB.h:577
float Type
Definition NanoVDB.h:576
float type
Definition NanoVDB.h:563
float Type
Definition NanoVDB.h:562
float type
Definition NanoVDB.h:570
float Type
Definition NanoVDB.h:569
float type
Definition NanoVDB.h:584
float Type
Definition NanoVDB.h:583
float type
Definition NanoVDB.h:556
float Type
Definition NanoVDB.h:555
uint64_t Type
Definition NanoVDB.h:590
uint64_t type
Definition NanoVDB.h:591
uint64_t Type
Definition NanoVDB.h:534
uint64_t type
Definition NanoVDB.h:535
bool Type
Definition NanoVDB.h:548
bool type
Definition NanoVDB.h:549
uint64_t Type
Definition NanoVDB.h:541
uint64_t type
Definition NanoVDB.h:542
Maps one type (e.g. the build types above) to other (actual) types.
Definition NanoVDB.h:526
T Type
Definition NanoVDB.h:527
T type
Definition NanoVDB.h:528
Define static boolean tests for template build types.
Definition NanoVDB.h:506
static constexpr bool is_offindex
Definition NanoVDB.h:510
static constexpr bool is_onindex
Definition NanoVDB.h:509
static constexpr bool is_index
Definition NanoVDB.h:508
static constexpr bool is_Fp
Definition NanoVDB.h:514
static constexpr bool is_float
Definition NanoVDB.h:516
static constexpr bool is_special
Definition NanoVDB.h:518
static constexpr bool is_FpX
Definition NanoVDB.h:512
double FloatType
Definition NanoVDB.h:844
double FloatType
Definition NanoVDB.h:814
uint64_t FloatType
Definition NanoVDB.h:826
bool FloatType
Definition NanoVDB.h:838
uint64_t FloatType
Definition NanoVDB.h:832
bool FloatType
Definition NanoVDB.h:820
float FloatType
Definition NanoVDB.h:808
Implements Tree::getDim(math::Coord)
Definition NanoVDB.h:6252
static __hostdev__ Type get(const NanoUpper< BuildT > &, uint32_t)
Definition NanoVDB.h:6257
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6256
uint32_t Type
Definition NanoVDB.h:6253
static __hostdev__ Type get(const NanoLower< BuildT > &, uint32_t)
Definition NanoVDB.h:6258
static constexpr int LEVEL
Definition NanoVDB.h:6254
static __hostdev__ Type get(const NanoLeaf< BuildT > &, uint32_t)
Definition NanoVDB.h:6259
static __hostdev__ Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6255
Return the pointer to the leaf node that contains math::Coord. Implements Tree::probeLeaf(math::Coord...
Definition NanoVDB.h:6266
static __hostdev__ Type get(const NanoUpper< BuildT > &, uint32_t)
Definition NanoVDB.h:6271
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6270
static __hostdev__ Type get(const NanoLower< BuildT > &, uint32_t)
Definition NanoVDB.h:6272
static constexpr int LEVEL
Definition NanoVDB.h:6268
const NanoLeaf< BuildT > * Type
Definition NanoVDB.h:6267
static __hostdev__ Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6269
static __hostdev__ Type get(const NanoLeaf< BuildT > &leaf, uint32_t)
Definition NanoVDB.h:6273
Return point to the lower internal node where math::Coord maps to one of its values,...
Definition NanoVDB.h:6280
const NanoLower< BuildT > * Type
Definition NanoVDB.h:6281
static __hostdev__ Type get(const NanoUpper< BuildT > &, uint32_t)
Definition NanoVDB.h:6285
static __hostdev__ Type get(const NanoLower< BuildT > &node, uint32_t)
Definition NanoVDB.h:6286
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6284
static constexpr int LEVEL
Definition NanoVDB.h:6282
static __hostdev__ Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6283
Definition NanoVDB.h:6355
uint32_t level
Definition NanoVDB.h:6356
FloatType average
Definition NanoVDB.h:6358
ValueType maximum
Definition NanoVDB.h:6357
CoordBBox bbox
Definition NanoVDB.h:6359
ValueType minimum
Definition NanoVDB.h:6357
uint32_t dim
Definition NanoVDB.h:6356
FloatType stdDevi
Definition NanoVDB.h:6358
Implements Tree::getNodeInfo(math::Coord)
Definition NanoVDB.h:6351
static __hostdev__ Type get(const NanoUpper< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6371
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &tile)
Definition NanoVDB.h:6367
static __hostdev__ Type get(const NanoLeaf< BuildT > &leaf, uint32_t n)
Definition NanoVDB.h:6379
typename NanoLeaf< BuildT >::ValueType ValueType
Definition NanoVDB.h:6352
static constexpr int LEVEL
Definition NanoVDB.h:6361
NodeInfo Type
Definition NanoVDB.h:6362
typename NanoLeaf< BuildT >::FloatType FloatType
Definition NanoVDB.h:6353
static __hostdev__ Type get(const NanoRoot< BuildT > &root)
Definition NanoVDB.h:6363
static __hostdev__ Type get(const NanoLower< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6375
Implements Tree::isActive(math::Coord)
Definition NanoVDB.h:6238
static __hostdev__ Type get(const NanoUpper< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6243
bool Type
Definition NanoVDB.h:6239
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &tile)
Definition NanoVDB.h:6242
static __hostdev__ Type get(const NanoLeaf< BuildT > &leaf, uint32_t n)
Definition NanoVDB.h:6245
static constexpr int LEVEL
Definition NanoVDB.h:6240
static __hostdev__ Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6241
static __hostdev__ Type get(const NanoLower< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6244
Return point to the root Tile where math::Coord maps to one of its values, i.e. terminates.
Definition NanoVDB.h:6305
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &tile)
Definition NanoVDB.h:6309
static constexpr int LEVEL
Definition NanoVDB.h:6307
static __hostdev__ Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6308
const typename NanoRoot< BuildT >::Tile * Type
Definition NanoVDB.h:6306
Return point to the upper internal node where math::Coord maps to one of its values,...
Definition NanoVDB.h:6293
static __hostdev__ Type get(const NanoUpper< BuildT > &node, uint32_t)
Definition NanoVDB.h:6298
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6297
static constexpr int LEVEL
Definition NanoVDB.h:6295
const NanoUpper< BuildT > * Type
Definition NanoVDB.h:6294
static __hostdev__ Type get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6296
Below is an example of a struct used for random get methods.
Definition NanoVDB.h:6198
static __hostdev__ Type get(const NanoUpper< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6203
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &tile)
Definition NanoVDB.h:6202
static __hostdev__ Type get(const NanoLeaf< BuildT > &leaf, uint32_t n)
Definition NanoVDB.h:6205
static constexpr int LEVEL
Definition NanoVDB.h:6200
static __hostdev__ Type get(const NanoRoot< BuildT > &root)
Definition NanoVDB.h:6201
static __hostdev__ Type get(const NanoLower< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6204
typename NanoLeaf< BuildT >::ValueType Type
Definition NanoVDB.h:6199
Struct with all the member data of the Grid (useful during serialization of an openvdb grid)
Definition NanoVDB.h:1945
__hostdev__ Vec3T applyInverseJacobian(const Vec3T &xyz) const
Definition NanoVDB.h:2034
__hostdev__ bool isEmpty() const
test if the grid is empty, e.i the root table has size 0
Definition NanoVDB.h:2130
__hostdev__ bool isRootConnected() const
return true if RootData follows TreeData in memory without any extra padding
Definition NanoVDB.h:2134
static __hostdev__ uint64_t memUsage()
Return memory usage in bytes for this class only.
Definition NanoVDB.h:2113
uint32_t mBlindMetadataCount
Definition NanoVDB.h:1961
__hostdev__ const void * treePtr() const
Definition NanoVDB.h:2053
Version mVersion
Definition NanoVDB.h:1949
uint32_t mData0
Definition NanoVDB.h:1962
__hostdev__ uint32_t nodeCount() const
Return number of nodes at LEVEL.
Definition NanoVDB.h:2081
GridType mGridType
Definition NanoVDB.h:1959
__hostdev__ void setMinMaxOn(bool on=true)
Definition NanoVDB.h:2015
uint64_t mMagic
Definition NanoVDB.h:1947
__hostdev__ void * nodePtr()
Return a non-const void pointer to the first node at LEVEL.
Definition NanoVDB.h:2070
__hostdev__ Vec3T applyIJTF(const Vec3T &xyz) const
Definition NanoVDB.h:2047
GridClass mGridClass
Definition NanoVDB.h:1958
__hostdev__ void setBBoxOn(bool on=true)
Definition NanoVDB.h:2016
__hostdev__ void setLongGridNameOn(bool on=true)
Definition NanoVDB.h:2017
uint64_t mGridSize
Definition NanoVDB.h:1953
__hostdev__ const GridBlindMetaData * blindMetaData(uint32_t n) const
Returns a const reference to the blindMetaData at the specified linear offset.
Definition NanoVDB.h:2090
__hostdev__ Vec3T applyInverseJacobianF(const Vec3T &xyz) const
Definition NanoVDB.h:2045
__hostdev__ bool isValid() const
return true if the magic number and the version are both valid
Definition NanoVDB.h:2002
__hostdev__ Vec3T applyInverseMapF(const Vec3T &xyz) const
Definition NanoVDB.h:2041
__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:1968
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:2119
Checksum mChecksum
Definition NanoVDB.h:1948
Vec3dBBox mWorldBBox
Definition NanoVDB.h:1956
__hostdev__ uint32_t rootTableSize() const
return the root table has size
Definition NanoVDB.h:2122
__hostdev__ const char * gridName() const
Definition NanoVDB.h:2096
__hostdev__ Vec3T applyIJT(const Vec3T &xyz) const
Definition NanoVDB.h:2036
uint64_t mData1
Definition NanoVDB.h:1963
uint32_t mGridCount
Definition NanoVDB.h:1952
__hostdev__ const void * nodePtr() const
Return a non-const void pointer to the first node at LEVEL.
Definition NanoVDB.h:2058
__hostdev__ void setStdDeviationOn(bool on=true)
Definition NanoVDB.h:2019
__hostdev__ Vec3T applyMap(const Vec3T &xyz) const
Definition NanoVDB.h:2028
uint64_t mData2
Definition NanoVDB.h:1964
__hostdev__ Vec3T applyJacobianF(const Vec3T &xyz) const
Definition NanoVDB.h:2043
__hostdev__ Vec3T applyInverseMap(const Vec3T &xyz) const
Definition NanoVDB.h:2030
Map mMap
Definition NanoVDB.h:1955
__hostdev__ const Vec3dBBox & worldBBox() const
return AABB of active values in world space
Definition NanoVDB.h:2116
__hostdev__ Vec3T applyJacobian(const Vec3T &xyz) const
Definition NanoVDB.h:2032
Vec3d mVoxelSize
Definition NanoVDB.h:1957
BitFlags< 32 > mFlags
Definition NanoVDB.h:1950
char mGridName[MaxNameSize]
Definition NanoVDB.h:1954
int64_t mBlindMetadataOffset
Definition NanoVDB.h:1960
uint32_t mGridIndex
Definition NanoVDB.h:1951
static const int MaxNameSize
Definition NanoVDB.h:1946
__hostdev__ void * treePtr()
Definition NanoVDB.h:2050
__hostdev__ Vec3T applyMapF(const Vec3T &xyz) const
Definition NanoVDB.h:2039
__hostdev__ bool setGridName(const char *src)
Definition NanoVDB.h:2020
__hostdev__ void setAverageOn(bool on=true)
Definition NanoVDB.h:2018
const typename GridT::TreeType Type
Definition NanoVDB.h:2437
const typename GridT::TreeType type
Definition NanoVDB.h:2438
defines a tree type from a grid type while preserving constness
Definition NanoVDB.h:2430
typename GridT::TreeType Type
Definition NanoVDB.h:2431
typename GridT::TreeType type
Definition NanoVDB.h:2432
StatsT mAverage
Definition NanoVDB.h:3208
typename ChildT::CoordType CoordT
Definition NanoVDB.h:3186
__hostdev__ void setMin(const ValueT &v)
Definition NanoVDB.h:3278
__hostdev__ const StatsT & average() const
Definition NanoVDB.h:3267
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3188
__hostdev__ const ValueT & getMin() const
Definition NanoVDB.h:3265
MaskT mChildMask
Definition NanoVDB.h:3204
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:3221
__hostdev__ const ValueT & getMax() const
Definition NanoVDB.h:3266
__hostdev__ void setDev(const StatsT &v)
Definition NanoVDB.h:3281
math::BBox< CoordT > mBBox
Definition NanoVDB.h:3201
InternalData(const InternalData &)=delete
__hostdev__ void setChild(uint32_t n, const void *ptr)
Definition NanoVDB.h:3223
typename ChildT::FloatType StatsT
Definition NanoVDB.h:3185
__hostdev__ void setAvg(const StatsT &v)
Definition NanoVDB.h:3280
__hostdev__ bool isChild(uint32_t n) const
Definition NanoVDB.h:3260
__hostdev__ void setValue(uint32_t n, const ValueT &v)
Definition NanoVDB.h:3230
typename ChildT::BuildType BuildT
Definition NanoVDB.h:3184
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:3215
StatsT mStdDevi
Definition NanoVDB.h:3209
Tile mTable[1u<<(3 *LOG2DIM)]
Definition NanoVDB.h:3219
__hostdev__ void setMax(const ValueT &v)
Definition NanoVDB.h:3279
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:3263
__hostdev__ ChildT * getChild(uint32_t n)
Returns a pointer to the child node at the specifed linear offset.
Definition NanoVDB.h:3237
ValueT mMaximum
Definition NanoVDB.h:3207
__hostdev__ bool isActive(uint32_t n) const
Definition NanoVDB.h:3254
MaskT mValueMask
Definition NanoVDB.h:3203
typename ChildT::template MaskType< LOG2DIM > MaskT
Definition NanoVDB.h:3187
__hostdev__ ValueT getValue(uint32_t n) const
Definition NanoVDB.h:3248
__hostdev__ const StatsT & stdDeviation() const
Definition NanoVDB.h:3268
InternalData & operator=(const InternalData &)=delete
typename ChildT::ValueType ValueT
Definition NanoVDB.h:3183
__hostdev__ const ChildT * getChild(uint32_t n) const
Definition NanoVDB.h:3242
ValueT mMinimum
Definition NanoVDB.h:3206
InternalData()=delete
This class cannot be constructed or deleted.
uint64_t mFlags
Definition NanoVDB.h:3202
static __hostdev__ constexpr uint64_t memUsage()
Definition NanoVDB.h:3898
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3895
__hostdev__ float getValue(uint32_t i) const
Definition NanoVDB.h:3906
Fp16 BuildType
Definition NanoVDB.h:3893
uint16_t mCode[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:3896
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:3899
uint16_t ArrayType
Definition NanoVDB.h:3894
LeafData()=delete
This class cannot be constructed or deleted.
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:3892
static __hostdev__ constexpr uint8_t bitWidth()
Definition NanoVDB.h:3905
static __hostdev__ constexpr uint64_t memUsage()
Definition NanoVDB.h:3831
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3828
__hostdev__ float getValue(uint32_t i) const
Definition NanoVDB.h:3839
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
uint8_t mCode[1u<<(3 *LOG2DIM - 1)]
Definition NanoVDB.h:3829
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:3832
LeafData()=delete
This class cannot be constructed or deleted.
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:3825
uint8_t ArrayType
Definition NanoVDB.h:3827
Fp4 BuildType
Definition NanoVDB.h:3826
static __hostdev__ constexpr uint8_t bitWidth()
Definition NanoVDB.h:3838
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3865
__hostdev__ float getValue(uint32_t i) const
Definition NanoVDB.h:3875
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:3868
LeafData()=delete
This class cannot be constructed or deleted.
Fp8 BuildType
Definition NanoVDB.h:3863
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:3862
uint8_t ArrayType
Definition NanoVDB.h:3864
static __hostdev__ constexpr int64_t memUsage()
Definition NanoVDB.h:3867
uint8_t mCode[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:3866
static __hostdev__ constexpr uint8_t bitWidth()
Definition NanoVDB.h:3874
FpN BuildType
Definition NanoVDB.h:3926
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3927
__hostdev__ float getValue(uint32_t i) const
Definition NanoVDB.h:3937
static __hostdev__ size_t memUsage(uint32_t bitWidth)
Definition NanoVDB.h:3936
__hostdev__ uint8_t bitWidth() const
Definition NanoVDB.h:3934
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:3928
LeafData()=delete
This class cannot be constructed or deleted.
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:3925
__hostdev__ size_t memUsage() const
Definition NanoVDB.h:3935
uint64_t mOffset
Definition NanoVDB.h:4191
uint16_t mValues[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:4193
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4184
__hostdev__ void setMin(const ValueType &)
Definition NanoVDB.h:4223
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:4203
__hostdev__ void setDev(const FloatType &)
Definition NanoVDB.h:4226
__hostdev__ void setValueOnly(uint32_t offset, uint16_t value)
Definition NanoVDB.h:4210
uint64_t ValueType
Definition NanoVDB.h:4180
__hostdev__ uint64_t last(uint32_t i) const
Definition NanoVDB.h:4208
uint8_t mFlags
Definition NanoVDB.h:4188
LeafData & operator=(const LeafData &)=delete
__hostdev__ void setValue(uint32_t offset, uint16_t value)
Definition NanoVDB.h:4211
LeafData(const LeafData &)=delete
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:4189
CoordT mBBoxMin
Definition NanoVDB.h:4186
uint8_t mBBoxDif[3]
Definition NanoVDB.h:4187
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:4216
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:4199
Point BuildType
Definition NanoVDB.h:4181
__hostdev__ void setAvg(const FloatType &)
Definition NanoVDB.h:4225
uint16_t ArrayType
Definition NanoVDB.h:4183
__hostdev__ ValueType getMax() const
Definition NanoVDB.h:4219
typename FloatTraits< ValueType >::FloatType FloatType
Definition NanoVDB.h:4182
__hostdev__ uint64_t offset() const
Definition NanoVDB.h:4205
LeafData()=delete
This class cannot be constructed or deleted.
__hostdev__ uint64_t first(uint32_t i) const
Definition NanoVDB.h:4207
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:4229
__hostdev__ FloatType getDev() const
Definition NanoVDB.h:4221
__hostdev__ uint64_t getValue(uint32_t i) const
Definition NanoVDB.h:4209
uint64_t mPointCount
Definition NanoVDB.h:4192
__hostdev__ FloatType getAvg() const
Definition NanoVDB.h:4220
__hostdev__ void setMax(const ValueType &)
Definition NanoVDB.h:4224
__hostdev__ ValueType getMin() const
Definition NanoVDB.h:4218
__hostdev__ uint64_t pointCount() const
Definition NanoVDB.h:4206
static __hostdev__ uint32_t valueCount()
Definition NanoVDB.h:4133
__hostdev__ uint64_t getMax() const
Definition NanoVDB.h:4138
ValueIndex BuildType
Definition NanoVDB.h:4131
LeafIndexBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:4130
__hostdev__ uint64_t getAvg() const
Definition NanoVDB.h:4139
__hostdev__ uint64_t getValue(uint32_t i) const
Definition NanoVDB.h:4141
__hostdev__ uint64_t lastOffset() const
Definition NanoVDB.h:4135
__hostdev__ uint64_t getDev() const
Definition NanoVDB.h:4140
__hostdev__ uint64_t getMin() const
Definition NanoVDB.h:4137
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4044
__hostdev__ void setMin(const ValueType &)
Definition NanoVDB.h:4066
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:4052
__hostdev__ bool getDev() const
Definition NanoVDB.h:4063
__hostdev__ bool getValue(uint32_t i) const
Definition NanoVDB.h:4059
__hostdev__ void setDev(const FloatType &)
Definition NanoVDB.h:4069
ValueMask BuildType
Definition NanoVDB.h:4041
uint8_t mFlags
Definition NanoVDB.h:4048
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
__hostdev__ void setValue(uint32_t offset, bool)
Definition NanoVDB.h:4064
static __hostdev__ bool hasStats()
Definition NanoVDB.h:4053
__hostdev__ bool getMax() const
Definition NanoVDB.h:4061
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:4049
CoordT mBBoxMin
Definition NanoVDB.h:4046
bool ValueType
Definition NanoVDB.h:4040
uint8_t mBBoxDif[3]
Definition NanoVDB.h:4047
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:4065
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:4054
__hostdev__ void setAvg(const FloatType &)
Definition NanoVDB.h:4068
LeafData()=delete
This class cannot be constructed or deleted.
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:4072
uint64_t mPadding[2]
Definition NanoVDB.h:4050
__hostdev__ bool getMin() const
Definition NanoVDB.h:4060
bool FloatType
Definition NanoVDB.h:4042
__hostdev__ void setMax(const ValueType &)
Definition NanoVDB.h:4067
__hostdev__ bool getAvg() const
Definition NanoVDB.h:4062
void ArrayType
Definition NanoVDB.h:4043
__hostdev__ uint64_t getMax() const
Definition NanoVDB.h:4158
LeafIndexBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:4150
__hostdev__ uint64_t getAvg() const
Definition NanoVDB.h:4159
__hostdev__ uint64_t getValue(uint32_t i) const
Definition NanoVDB.h:4161
__hostdev__ uint64_t lastOffset() const
Definition NanoVDB.h:4156
__hostdev__ uint64_t getDev() const
Definition NanoVDB.h:4160
__hostdev__ uint64_t getMin() const
Definition NanoVDB.h:4157
__hostdev__ uint32_t valueCount() const
Definition NanoVDB.h:4152
ValueOnIndex BuildType
Definition NanoVDB.h:4151
bool BuildType
Definition NanoVDB.h:3991
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3994
__hostdev__ void setMax(const bool &)
Definition NanoVDB.h:4018
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:4004
__hostdev__ bool getDev() const
Definition NanoVDB.h:4010
__hostdev__ bool getValue(uint32_t i) const
Definition NanoVDB.h:4006
uint8_t mFlags
Definition NanoVDB.h:3998
LeafData & operator=(const LeafData &)=delete
__hostdev__ void setAvg(const bool &)
Definition NanoVDB.h:4019
LeafData(const LeafData &)=delete
MaskT< LOG2DIM > ArrayType
Definition NanoVDB.h:3993
static __hostdev__ bool hasStats()
Definition NanoVDB.h:4005
__hostdev__ void setMin(const bool &)
Definition NanoVDB.h:4017
__hostdev__ bool getMax() const
Definition NanoVDB.h:4008
__hostdev__ void setDev(const bool &)
Definition NanoVDB.h:4020
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:3999
MaskT< LOG2DIM > mValues
Definition NanoVDB.h:4000
CoordT mBBoxMin
Definition NanoVDB.h:3996
bool ValueType
Definition NanoVDB.h:3990
uint8_t mBBoxDif[3]
Definition NanoVDB.h:3997
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:4016
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:4003
LeafData()=delete
This class cannot be constructed or deleted.
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:4023
__hostdev__ void setValue(uint32_t offset, bool v)
Definition NanoVDB.h:4011
uint64_t mPadding[2]
Definition NanoVDB.h:4001
__hostdev__ bool getMin() const
Definition NanoVDB.h:4007
bool FloatType
Definition NanoVDB.h:3992
__hostdev__ bool getAvg() const
Definition NanoVDB.h:4009
ValueType mMaximum
Definition NanoVDB.h:3687
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3679
typename FloatTraits< ValueT >::FloatType FloatType
Definition NanoVDB.h:3677
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:3699
FloatType mAverage
Definition NanoVDB.h:3688
__hostdev__ void setAvg(const FloatType &v)
Definition NanoVDB.h:3726
uint8_t mFlags
Definition NanoVDB.h:3683
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static __hostdev__ bool hasStats()
Definition NanoVDB.h:3701
ValueT ValueType
Definition NanoVDB.h:3675
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:3684
CoordT mBBoxMin
Definition NanoVDB.h:3681
uint8_t mBBoxDif[3]
Definition NanoVDB.h:3682
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:3710
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:3695
__hostdev__ ValueType getValue(uint32_t i) const
Definition NanoVDB.h:3703
__hostdev__ void fill(const ValueType &v)
Definition NanoVDB.h:3735
__hostdev__ ValueType getMax() const
Definition NanoVDB.h:3713
LeafData()=delete
This class cannot be constructed or deleted.
ValueT ArrayType
Definition NanoVDB.h:3678
__hostdev__ void setMin(const ValueType &v)
Definition NanoVDB.h:3724
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:3733
__hostdev__ void setValueOnly(uint32_t offset, const ValueType &value)
Definition NanoVDB.h:3704
__hostdev__ FloatType getDev() const
Definition NanoVDB.h:3715
ValueType mMinimum
Definition NanoVDB.h:3686
__hostdev__ FloatType getAvg() const
Definition NanoVDB.h:3714
__hostdev__ void setValue(uint32_t offset, const ValueType &value)
Definition NanoVDB.h:3705
ValueT BuildType
Definition NanoVDB.h:3676
ValueType mValues[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:3690
FloatType mStdDevi
Definition NanoVDB.h:3689
__hostdev__ ValueType getMin() const
Definition NanoVDB.h:3712
__hostdev__ void setMax(const ValueType &v)
Definition NanoVDB.h:3725
__hostdev__ void setDev(const FloatType &v)
Definition NanoVDB.h:3727
Base-class for quantized float leaf nodes.
Definition NanoVDB.h:3753
__hostdev__ float getAvg() const
return the quantized average of the active values in this node
Definition NanoVDB.h:3794
float ValueType
Definition NanoVDB.h:3756
__hostdev__ float getMax() const
return the quantized maximum of the active values in this node
Definition NanoVDB.h:3791
__hostdev__ float getDev() const
return the quantized standard deviation of the active values in this node
Definition NanoVDB.h:3798
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:3768
__hostdev__ void setDev(float dev)
Definition NanoVDB.h:3810
uint16_t mMax
Definition NanoVDB.h:3766
uint8_t mFlags
Definition NanoVDB.h:3761
uint16_t mMin
Definition NanoVDB.h:3766
static __hostdev__ bool hasStats()
Definition NanoVDB.h:3770
__hostdev__ void setAvg(float avg)
Definition NanoVDB.h:3807
float mQuantum
Definition NanoVDB.h:3765
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:3762
uint16_t mAvg
Definition NanoVDB.h:3766
CoordT mBBoxMin
Definition NanoVDB.h:3759
uint8_t mBBoxDif[3]
Definition NanoVDB.h:3760
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:3785
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:3775
float mMinimum
Definition NanoVDB.h:3764
float FloatType
Definition NanoVDB.h:3757
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:3813
uint16_t mDev
Definition NanoVDB.h:3766
__hostdev__ void init(float min, float max, uint8_t bitWidth)
Definition NanoVDB.h:3779
__hostdev__ void setMin(float min)
Definition NanoVDB.h:3801
__hostdev__ void setMax(float max)
Definition NanoVDB.h:3804
__hostdev__ float getMin() const
return the quantized minimum of the active values in this node
Definition NanoVDB.h:3788
uint64_t mOffset
Definition NanoVDB.h:4098
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4092
__hostdev__ const uint64_t & firstOffset() const
Definition NanoVDB.h:4106
__hostdev__ void setMin(const ValueType &)
Definition NanoVDB.h:4107
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:4103
__hostdev__ void setDev(const FloatType &)
Definition NanoVDB.h:4110
uint64_t ValueType
Definition NanoVDB.h:4089
uint64_t FloatType
Definition NanoVDB.h:4090
uint8_t mFlags
Definition NanoVDB.h:4096
uint64_t mPrefixSum
Definition NanoVDB.h:4098
LeafIndexBase & operator=(const LeafIndexBase &)=default
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:4097
LeafIndexBase(const LeafIndexBase &)=default
CoordT mBBoxMin
Definition NanoVDB.h:4094
uint8_t mBBoxDif[3]
Definition NanoVDB.h:4095
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:4111
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:4099
__hostdev__ void setAvg(const FloatType &)
Definition NanoVDB.h:4109
__hostdev__ bool hasStats() const
Definition NanoVDB.h:4104
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:4113
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:4108
void ArrayType
Definition NanoVDB.h:4091
Definition NanoVDB.h:4249
static __hostdev__ uint32_t dim()
Definition NanoVDB.h:4252
static constexpr uint32_t DIM
Definition NanoVDB.h:4251
static constexpr uint32_t TOTAL
Definition NanoVDB.h:4250
Defines an affine transform and its inverse represented as a 3x3 matrix and a vec3 translation.
Definition NanoVDB.h:1419
double mTaperD
Definition NanoVDB.h:1427
__hostdev__ Map()
Default constructor for the identity map.
Definition NanoVDB.h:1430
void set(const Mat4T &mat, const Mat4T &invMat, double taper=1.0)
Initialize the member data from 4x4 matrices.
Definition NanoVDB.h:1462
__hostdev__ Vec3d getVoxelSize() const
Return a voxels size in each coordinate direction, measured at the origin.
Definition NanoVDB.h:1553
__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:1530
double mVecD[3]
Definition NanoVDB.h:1426
float mInvMatF[9]
Definition NanoVDB.h:1421
__hostdev__ Vec3T applyIJTF(const Vec3T &xyz) const
Definition NanoVDB.h:1550
__hostdev__ Vec3T applyMap(const Vec3T &ijk) const
Apply the forward affine transformation to a vector using 64bit floating point arithmetics.
Definition NanoVDB.h:1473
__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:1539
__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:1490
__hostdev__ Vec3T applyInverseMapF(const Vec3T &xyz) const
Apply the inverse affine mapping to a vector using 32bit floating point arithmetics.
Definition NanoVDB.h:1518
double mInvMatD[9]
Definition NanoVDB.h:1425
__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:1548
float mMatF[9]
Definition NanoVDB.h:1420
__hostdev__ Vec3T applyInverseMap(const Vec3T &xyz) const
Apply the inverse affine mapping to a vector using 64bit floating point arithmetics.
Definition NanoVDB.h:1507
double mMatD[9]
Definition NanoVDB.h:1424
__hostdev__ Map(double s, const Vec3d &t=Vec3d(0.0, 0.0, 0.0))
Definition NanoVDB.h:1441
__hostdev__ Vec3T applyMapF(const Vec3T &ijk) const
Apply the forward affine transformation to a vector using 32bit floating point arithmetics.
Definition NanoVDB.h:1481
__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:1499
float mTaperF
Definition NanoVDB.h:1423
float mVecF[3]
Definition NanoVDB.h:1422
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:1557
NanoLeaf< BuildT > type
Definition NanoVDB.h:4656
NanoLeaf< BuildT > Type
Definition NanoVDB.h:4655
NanoLower< BuildT > Type
Definition NanoVDB.h:4661
NanoLower< BuildT > type
Definition NanoVDB.h:4662
NanoUpper< BuildT > type
Definition NanoVDB.h:4668
NanoUpper< BuildT > Type
Definition NanoVDB.h:4667
NanoRoot< BuildT > type
Definition NanoVDB.h:4674
NanoRoot< BuildT > Type
Definition NanoVDB.h:4673
Trait to map from LEVEL to node type.
Definition NanoVDB.h:4649
typename GridOrTreeOrRootT::LeafNodeType type
Definition NanoVDB.h:1735
typename GridOrTreeOrRootT::LeafNodeType Type
Definition NanoVDB.h:1734
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType Type
Definition NanoVDB.h:1749
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType type
Definition NanoVDB.h:1750
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType type
Definition NanoVDB.h:1764
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType Type
Definition NanoVDB.h:1763
typename GridOrTreeOrRootT::RootNodeType type
Definition NanoVDB.h:1778
typename GridOrTreeOrRootT::RootNodeType Type
Definition NanoVDB.h:1777
const typename GridOrTreeOrRootT::LeafNodeType Type
Definition NanoVDB.h:1741
const typename GridOrTreeOrRootT::LeafNodeType type
Definition NanoVDB.h:1742
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType type
Definition NanoVDB.h:1757
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType Type
Definition NanoVDB.h:1756
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType Type
Definition NanoVDB.h:1770
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType type
Definition NanoVDB.h:1771
const typename GridOrTreeOrRootT::RootNodeType type
Definition NanoVDB.h:1786
const typename GridOrTreeOrRootT::RootNodeType Type
Definition NanoVDB.h:1785
Struct to derive node type from its level in a given grid, tree or root while preserving constness.
Definition NanoVDB.h:1727
Implements Tree::probeLeaf(math::Coord)
Definition NanoVDB.h:6316
static __hostdev__ Type get(const NanoLeaf< BuildT > &leaf, uint32_t n, ValueT &v)
Definition NanoVDB.h:6340
bool Type
Definition NanoVDB.h:6317
static __hostdev__ Type get(const NanoLower< BuildT > &node, uint32_t n, ValueT &v)
Definition NanoVDB.h:6335
typename BuildToValueMap< BuildT >::Type ValueT
Definition NanoVDB.h:6319
static constexpr int LEVEL
Definition NanoVDB.h:6318
static __hostdev__ Type get(const NanoUpper< BuildT > &node, uint32_t n, ValueT &v)
Definition NanoVDB.h:6330
static __hostdev__ Type get(const typename NanoRoot< BuildT >::Tile &tile, ValueT &v)
Definition NanoVDB.h:6325
static __hostdev__ Type get(const NanoRoot< BuildT > &root, ValueT &v)
Definition NanoVDB.h:6320
Definition NanoVDB.h:2671
ValueT value
Definition NanoVDB.h:2694
uint32_t state
Definition NanoVDB.h:2693
__hostdev__ bool isChild() const
Definition NanoVDB.h:2687
KeyT key
Definition NanoVDB.h:2691
__hostdev__ CoordT origin() const
Definition NanoVDB.h:2690
__hostdev__ bool isValue() const
Definition NanoVDB.h:2688
int64_t child
Definition NanoVDB.h:2692
__hostdev__ void setChild(const CoordType &k, const void *ptr, const RootData *data)
Definition NanoVDB.h:2673
__hostdev__ void setValue(const CoordType &k, bool s, const ValueType &v)
Definition NanoVDB.h:2680
__hostdev__ bool isActive() const
Definition NanoVDB.h:2689
StatsT mAverage
Definition NanoVDB.h:2659
typename ChildT::CoordType CoordT
Definition NanoVDB.h:2625
RootData()=delete
This class cannot be constructed or deleted.
__hostdev__ void setMin(const ValueT &v)
Definition NanoVDB.h:2842
__hostdev__ const StatsT & average() const
Definition NanoVDB.h:2839
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:2627
__hostdev__ const ValueT & getMin() const
Definition NanoVDB.h:2837
__hostdev__ Tile * probeTile(const CoordT &ijk)
Definition NanoVDB.h:2801
__hostdev__ TileIterator beginTile()
Definition NanoVDB.h:2782
ValueT mBackground
Definition NanoVDB.h:2656
__hostdev__ ConstTileIterator probe(const CoordT &ijk) const
Definition NanoVDB.h:2793
__hostdev__ const ValueT & getMax() const
Definition NanoVDB.h:2838
__hostdev__ ChildT * getChild(const Tile *tile)
Returns a const reference to the child node in the specified tile.
Definition NanoVDB.h:2826
__hostdev__ void setDev(const StatsT &v)
Definition NanoVDB.h:2845
uint32_t mTableSize
Definition NanoVDB.h:2654
math::BBox< CoordT > mBBox
Definition NanoVDB.h:2653
uint64_t KeyT
Return a key based on the coordinates of a voxel.
Definition NanoVDB.h:2631
__hostdev__ ConstTileIterator cbeginTile() const
Definition NanoVDB.h:2783
__hostdev__ ChildT * probeChild(const CoordT &ijk)
Definition NanoVDB.h:2812
typename ChildT::FloatType StatsT
Definition NanoVDB.h:2626
__hostdev__ void setAvg(const StatsT &v)
Definition NanoVDB.h:2844
__hostdev__ const Tile * tile(uint32_t n) const
Returns a pointer to the tile at the specified linear offset.
Definition NanoVDB.h:2700
__hostdev__ const Tile * probeTile(const CoordT &ijk) const
Definition NanoVDB.h:2807
typename ChildT::BuildType BuildT
Definition NanoVDB.h:2624
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:2665
StatsT mStdDevi
Definition NanoVDB.h:2660
RootData(const RootData &)=delete
static __hostdev__ CoordT KeyToCoord(const KeyT &key)
Definition NanoVDB.h:2641
RootData & operator=(const RootData &)=delete
static __hostdev__ KeyT CoordToKey(const CoordType &ijk)
Definition NanoVDB.h:2633
__hostdev__ void setMax(const ValueT &v)
Definition NanoVDB.h:2843
ValueT mMaximum
Definition NanoVDB.h:2658
__hostdev__ TileIterator probe(const CoordT &ijk)
Definition NanoVDB.h:2785
__hostdev__ const StatsT & stdDeviation() const
Definition NanoVDB.h:2840
__hostdev__ Tile * tile(uint32_t n)
Definition NanoVDB.h:2705
typename ChildT::ValueType ValueT
Definition NanoVDB.h:2623
TileIter< const RootData > ConstTileIterator
Definition NanoVDB.h:2780
__hostdev__ const ChildT * probeChild(const CoordT &ijk) const
Definition NanoVDB.h:2818
__hostdev__ const ChildT * getChild(const Tile *tile) const
Definition NanoVDB.h:2831
TileIter< RootData > TileIterator
Definition NanoVDB.h:2779
ValueT mMinimum
Definition NanoVDB.h:2657
Definition NanoVDB.h:6210
static __hostdev__ void set(NanoLower< BuildT > &node, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6217
static __hostdev__ void set(NanoRoot< BuildT > &, const ValueT &)
Definition NanoVDB.h:6214
static __hostdev__ void set(NanoUpper< BuildT > &node, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6216
static constexpr int LEVEL
Definition NanoVDB.h:6213
static __hostdev__ void set(NanoLeaf< BuildT > &leaf, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6218
typename NanoLeaf< BuildT >::ValueType ValueT
Definition NanoVDB.h:6212
static __hostdev__ void set(typename NanoRoot< BuildT >::Tile &tile, const ValueT &v)
Definition NanoVDB.h:6215
Definition NanoVDB.h:6223
static __hostdev__ void set(NanoLower< BuildT > &, uint32_t, const ValueT &)
Definition NanoVDB.h:6230
static __hostdev__ void set(NanoRoot< BuildT > &, const ValueT &)
Definition NanoVDB.h:6227
static __hostdev__ void set(NanoUpper< BuildT > &, uint32_t, const ValueT &)
Definition NanoVDB.h:6229
static constexpr int LEVEL
Definition NanoVDB.h:6226
static __hostdev__ void set(NanoLeaf< BuildT > &leaf, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6231
static __hostdev__ void set(typename NanoRoot< BuildT >::Tile &, const ValueT &)
Definition NanoVDB.h:6228
typename NanoLeaf< BuildT >::ValueType ValueT
Definition NanoVDB.h:6225
T ElementType
Definition NanoVDB.h:788
static const int Rank
Definition NanoVDB.h:784
static const int Size
Definition NanoVDB.h:787
static T scalar(const T &s)
Definition NanoVDB.h:789
static const bool IsVector
Definition NanoVDB.h:786
static const bool IsScalar
Definition NanoVDB.h:785
static ElementType scalar(const T &v)
Definition NanoVDB.h:800
static const int Rank
Definition NanoVDB.h:795
static const int Size
Definition NanoVDB.h:798
typename T::ValueType ElementType
Definition NanoVDB.h:799
static const bool IsVector
Definition NanoVDB.h:797
static const bool IsScalar
Definition NanoVDB.h:796
Definition NanoVDB.h:2394
__hostdev__ const void * getRoot() const
Get a const void pointer to the root node (never NULL)
Definition NanoVDB.h:2410
__hostdev__ bool isEmpty() const
Return true if the root is empty, i.e. has not child nodes or constant tiles.
Definition NanoVDB.h:2416
int64_t mNodeOffset[4]
Definition NanoVDB.h:2395
__hostdev__ bool isRootNext() const
return true if RootData is layout out immediately after TreeData in memory
Definition NanoVDB.h:2422
TreeData & operator=(const TreeData &)=default
__hostdev__ void setRoot(const void *root)
Definition NanoVDB.h:2401
uint32_t mNodeCount[3]
Definition NanoVDB.h:2396
__hostdev__ void * getRoot()
Get a non-const void pointer to the root node (never NULL)
Definition NanoVDB.h:2407
uint32_t mTileCount[3]
Definition NanoVDB.h:2397
__hostdev__ void setFirstNode(const NodeT *node)
Definition NanoVDB.h:2413
__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:2419
uint64_t mVoxelCount
Definition NanoVDB.h:2398
C++11 implementation of std::conditional.
Definition Util.h:403
C++11 implementation of std::enable_if.
Definition Util.h:353
static constexpr bool value
Definition Util.h:344
C++11 implementation of std::is_same.
Definition Util.h:327
static constexpr bool value
Definition Util.h:328
typename remove_const< T >::type type
Definition Util.h:473
T type
Definition Util.h:420
ValueT value
Definition NanoVDB.h:3192
Tile(const Tile &)=delete
Tile & operator=(const Tile &)=delete
Tile()=delete
This class cannot be constructed or deleted.
int64_t child
Definition NanoVDB.h:3193