118#ifndef NANOVDB_NANOVDB_H_HAS_BEEN_INCLUDED
119#define NANOVDB_NANOVDB_H_HAS_BEEN_INCLUDED
123#include <nanovdb/math/Math.h>
126#define NANOVDB_DATA_ALIGNMENT 32
134#define NANOVDB_MAGIC_NUMB 0x304244566f6e614eUL
135#define NANOVDB_MAGIC_GRID 0x314244566f6e614eUL
136#define NANOVDB_MAGIC_FILE 0x324244566f6e614eUL
137#define NANOVDB_MAGIC_NODE 0x334244566f6e614eUL
138#define NANOVDB_MAGIC_FRAG 0x344244566f6e614eUL
139#define NANOVDB_MAGIC_MASK 0x00FFFFFFFFFFFFFFUL
144#define NANOVDB_MAJOR_VERSION_NUMBER 32
145#define NANOVDB_MINOR_VERSION_NUMBER 7
146#define NANOVDB_PATCH_VERSION_NUMBER 0
148#define TBB_SUPPRESS_DEPRECATED_MESSAGES 1
151#define NANOVDB_USE_SINGLE_ROOT_KEY
160#define NANOVDB_NEW_ACCESSOR_METHODS
162#define NANOVDB_FPN_BRANCHLESS
164#if !defined(NANOVDB_ALIGN)
165#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;}
642 switch (blindClass) {
694 : mData(major << 21 | minor << 10 | patch)
727template<
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>
738 static T
scalar(
const T& s) {
return s; }
747 static const int Size = T::SIZE;
754template<
typename T,
int = sizeof(
typename TensorTraits<T>::ElementType)>
811template<
typename BuildT>
870template<
typename BuildT>
871[[deprecated(
"Use toGridType<T>() instead.")]]
877template<
typename BuildT>
892template<
typename BuildT>
893[[deprecated(
"Use toGridClass<T>() instead.")]]
936 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
938 template<
typename MaskT>
941 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
948 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
950 template<
typename MaskT>
954 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
968 for (
auto bit : list) mFlags |=
static_cast<Type>(1 << bit);
972 for (
auto bit : list) mFlags &= ~static_cast<Type>(1 << bit);
975 template<
typename MaskT>
977 template<
typename MaskT>
980 template<
typename MaskT>
983 for (
auto mask : list) mFlags |=
static_cast<Type>(mask);
985 template<
typename MaskT>
988 for (
auto mask : list) mFlags &= ~static_cast<Type>(mask);
992 template<
typename MaskT>
999 template<
typename MaskT>
1001 template<
typename MaskT>
1004 template<
typename MaskT>
1007 for (
auto mask : list) {
1008 if (0 != (mFlags &
static_cast<Type>(mask)))
return true;
1013 template<
typename MaskT>
1016 for (
auto mask : list) {
1017 if (0 == (mFlags &
static_cast<Type>(mask)))
return true;
1033template<u
int32_t LOG2DIM>
1037 static constexpr uint32_t
SIZE = 1U << (3 * LOG2DIM);
1053 for (
const uint64_t *w = mWords, *q = w +
WORD_COUNT; w != q; ++w)
1061 uint32_t n = i >> 6, sum =
util::countOn(mWords[n] & ((uint64_t(1) << (i & 63u)) - 1u));
1062 for (
const uint64_t* w = mWords; n--; ++w)
1087 mPos = mParent->findNext<On>(mPos + 1);
1099 const Mask* mParent;
1146 const uint64_t v = on ? ~uint64_t(0) : uint64_t(0);
1155 mWords[i] = other.mWords[i];
1163 template<
typename MaskT = Mask>
1166 static_assert(
sizeof(
Mask) ==
sizeof(MaskT),
"Mismatching sizeof");
1167 static_assert(
WORD_COUNT == MaskT::WORD_COUNT,
"Mismatching word count");
1168 static_assert(LOG2DIM == MaskT::LOG2DIM,
"Mismatching LOG2DIM");
1169 auto* src =
reinterpret_cast<const uint64_t*
>(&other);
1170 for (uint64_t *dst = mWords, *end = dst +
WORD_COUNT; dst != end; ++dst)
1181 if (mWords[i] != other.mWords[i])
1190 __hostdev__ bool isOn(uint32_t n)
const {
return 0 != (mWords[n >> 6] & (uint64_t(1) << (n & 63))); }
1193 __hostdev__ bool isOff(uint32_t n)
const {
return 0 == (mWords[n >> 6] & (uint64_t(1) << (n & 63))); }
1199 if (mWords[i] != ~uint64_t(0))
1208 if (mWords[i] != uint64_t(0))
1218#if defined(__CUDACC__)
1219 __device__ inline void setOnAtomic(uint32_t n)
1221 atomicOr(
reinterpret_cast<unsigned long long int*
>(
this) + (n >> 6), 1ull << (n & 63));
1223 __device__ inline void setOffAtomic(uint32_t n)
1225 atomicAnd(
reinterpret_cast<unsigned long long int*
>(
this) + (n >> 6), ~(1ull << (n & 63)));
1227 __device__ inline void setAtomic(uint32_t n,
bool on)
1229 on ? this->setOnAtomic(n) : this->setOffAtomic(n);
1236 auto& word = mWords[n >> 6];
1238 word &= ~(uint64_t(1) << n);
1239 word |= uint64_t(on) << n;
1248 for (uint32_t i = 0; i <
WORD_COUNT; ++i)mWords[i] = ~uint64_t(0);
1254 for (uint32_t i = 0; i <
WORD_COUNT; ++i) mWords[i] = uint64_t(0);
1260 const uint64_t v = on ? ~uint64_t(0) : uint64_t(0);
1261 for (uint32_t i = 0; i <
WORD_COUNT; ++i) mWords[i] = v;
1267 for (
auto* w = mWords; n--; ++w) *w = ~*w;
1274 uint64_t* w1 = mWords;
1275 const uint64_t* w2 = other.mWords;
1276 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 &= *w2;
1282 uint64_t* w1 = mWords;
1283 const uint64_t* w2 = other.mWords;
1284 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 |= *w2;
1290 uint64_t* w1 = mWords;
1291 const uint64_t* w2 = other.mWords;
1292 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 &= ~*w2;
1298 uint64_t* w1 = mWords;
1299 const uint64_t* w2 = other.mWords;
1300 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 ^= *w2;
1309 const uint64_t* w = mWords;
1310 for (; n <
WORD_COUNT && !(ON ? *w : ~*w); ++w, ++n);
1318 uint32_t n = start >> 6;
1320 uint32_t m = start & 63u;
1321 uint64_t b = ON ? mWords[n] : ~mWords[n];
1322 if (b & (uint64_t(1u) << m))
return start;
1323 b &= ~uint64_t(0u) << m;
1324 while (!b && ++n <
WORD_COUNT) b = ON ? mWords[n] : ~mWords[n];
1332 uint32_t n = start >> 6;
1334 uint32_t m = start & 63u;
1335 uint64_t b = ON ? mWords[n] : ~mWords[n];
1336 if (b & (uint64_t(1u) << m))
return start;
1337 b &= (uint64_t(1u) << m) - 1u;
1338 while (!b && n) b = ON ? mWords[--n] : ~mWords[--n];
1362 :
mMatF{ 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}
1363 ,
mInvMatF{1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}
1364 ,
mVecF{0.0f, 0.0f, 0.0f}
1366 ,
mMatD{ 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}
1367 ,
mInvMatD{1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}
1368 ,
mVecD{0.0, 0.0, 0.0}
1373 :
mMatF{float(s), 0.0f, 0.0f, 0.0f, float(s), 0.0f, 0.0f, 0.0f, float(s)}
1374 ,
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)}
1375 ,
mVecF{float(t[0]), float(t[1]), float(t[2])}
1377 ,
mMatD{s, 0.0, 0.0, 0.0, s, 0.0, 0.0, 0.0, s}
1378 ,
mInvMatD{1.0 / s, 0.0, 0.0, 0.0, 1.0 / s, 0.0, 0.0, 0.0, 1.0 / s}
1379 ,
mVecD{t[0], t[1], t[2]}
1386 template<
typename MatT,
typename Vec3T>
1387 void set(
const MatT& mat,
const MatT& invMat,
const Vec3T& translate,
double taper = 1.0);
1392 template<
typename Mat4T>
1393 void set(
const Mat4T& mat,
const Mat4T& invMat,
double taper = 1.0) { this->
set(mat, invMat, mat[3], taper); }
1395 template<
typename Vec3T>
1396 void set(
double scale,
const Vec3T& translation,
double taper = 1.0);
1403 template<
typename Vec3T>
1411 template<
typename Vec3T>
1420 template<
typename Vec3T>
1429 template<
typename Vec3T>
1437 template<
typename Vec3T>
1448 template<
typename Vec3T>
1460 template<
typename Vec3T>
1469 template<
typename Vec3T>
1478 template<
typename Vec3T>
1480 template<
typename Vec3T>
1487template<
typename MatT,
typename Vec3T>
1488inline void Map::set(
const MatT& mat,
const MatT& invMat,
const Vec3T& translate,
double taper)
1492 mTaperF =
static_cast<float>(taper);
1494 for (
int i = 0; i < 3; ++i) {
1495 *vd++ = translate[i];
1496 *vf++ =
static_cast<float>(translate[i]);
1497 for (
int j = 0; j < 3; ++j) {
1499 *mid++ = invMat[j][i];
1500 *mf++ =
static_cast<float>(mat[j][i]);
1501 *mif++ =
static_cast<float>(invMat[j][i]);
1506template<
typename Vec3T>
1507inline void Map::set(
double dx,
const Vec3T& trans,
double taper)
1510 const double mat[3][3] = { {dx, 0.0, 0.0},
1513 const double idx = 1.0 / dx;
1514 const double invMat[3][3] = { {idx, 0.0, 0.0},
1517 this->
set(mat, invMat, trans, taper);
1549 template<
typename BlindDataT>
1559 auto check = [&]()->
bool{
1577 default:
return true;}
1595template<
typename Gr
idOrTreeOrRootT,
int LEVEL>
1599template<
typename Gr
idOrTreeOrRootT>
1602 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1603 using Type =
typename GridOrTreeOrRootT::LeafNodeType;
1604 using type =
typename GridOrTreeOrRootT::LeafNodeType;
1606template<
typename Gr
idOrTreeOrRootT>
1609 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1610 using Type =
const typename GridOrTreeOrRootT::LeafNodeType;
1611 using type =
const typename GridOrTreeOrRootT::LeafNodeType;
1614template<
typename Gr
idOrTreeOrRootT>
1617 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1618 using Type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1619 using type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1621template<
typename Gr
idOrTreeOrRootT>
1624 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1625 using Type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1626 using type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1628template<
typename Gr
idOrTreeOrRootT>
1631 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1632 using Type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1633 using type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1635template<
typename Gr
idOrTreeOrRootT>
1638 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1639 using Type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1640 using type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1642template<
typename Gr
idOrTreeOrRootT>
1645 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1646 using Type =
typename GridOrTreeOrRootT::RootNodeType;
1647 using type =
typename GridOrTreeOrRootT::RootNodeType;
1650template<
typename Gr
idOrTreeOrRootT>
1653 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1654 using Type =
const typename GridOrTreeOrRootT::RootNodeType;
1655 using type =
const typename GridOrTreeOrRootT::RootNodeType;
1660template<
typename BuildT>
1662template<
typename BuildT>
1664template<
typename BuildT>
1666template<
typename BuildT>
1668template<
typename BuildT>
1670template<
typename BuildT>
1672template<
typename BuildT>
1674template<
typename BuildT>
1736 [[deprecated(
"Use Checksum::data instead.")]]
1738 [[deprecated(
"Use Checksum::head and Ckecksum::tail instead.")]]
1740 [[deprecated(
"Use Checksum::head and Ckecksum::tail instead.")]]
1751 [[deprecated(
"Use Checksum::isHalf instead.")]]
1835 uint64_t gridSize = 0u,
1840#ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS
1850 mGridSize = gridSize;
1851 mGridName[0] =
'\0';
1853 mWorldBBox = Vec3dBBox();
1854 mVoxelSize = map.getVoxelSize();
1855 mGridClass = gridClass;
1856 mGridType = gridType;
1857 mBlindMetadataOffset = mGridSize;
1858 mBlindMetadataCount = 0u;
1871 if (test) test =
mVersion.isCompatible();
1889 template<
typename Vec3T>
1891 template<
typename Vec3T>
1893 template<
typename Vec3T>
1895 template<
typename Vec3T>
1897 template<
typename Vec3T>
1900 template<
typename Vec3T>
1902 template<
typename Vec3T>
1904 template<
typename Vec3T>
1906 template<
typename Vec3T>
1908 template<
typename Vec3T>
1919 template <u
int32_t LEVEL>
1922 static_assert(LEVEL >= 0 && LEVEL <= 3,
"invalid LEVEL template parameter");
1923 const void *treeData =
this + 1;
1925 return nodeOffset ?
util::PtrAdd(treeData, nodeOffset) :
nullptr;
1931 template <u
int32_t LEVEL>
1934 static_assert(LEVEL >= 0 && LEVEL <= 3,
"invalid LEVEL template parameter");
1935 void *treeData =
this + 1;
1937 return nodeOffset ?
util::PtrAdd(treeData, nodeOffset) :
nullptr;
1942 template <u
int32_t LEVEL>
1945 static_assert(LEVEL >= 0 && LEVEL < 3,
"invalid LEVEL template parameter");
1966 return metaData->template getBlindData<const char>();
2000template<
typename BuildT,
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1>
2003template<
typename BuildT>
2010template<
typename TreeT>
2054 template<
typename T = BuildType>
2061 template<
typename T = BuildType>
2081 template<
typename Vec3T>
2085 template<
typename Vec3T>
2090 template<
typename Vec3T>
2095 template<
typename Vec3T>
2100 template<
typename Vec3T>
2104 template<
typename Vec3T>
2108 template<
typename Vec3T>
2113 template<
typename Vec3T>
2118 template<
typename Vec3T>
2123 template<
typename Vec3T>
2159 template<
typename NodeT>
2195 [[deprecated(
"Use Grid::getBlindData<T>() instead.")]]
2198 printf(
"\nnanovdb::Grid::blindData is unsafe and hence deprecated! Please use nanovdb::Grid::getBlindData instead.\n\n");
2203 template <
typename BlindDataT>
2210 template <
typename BlindDataT>
2223template<
typename TreeT>
2233template<
typename TreeT>
2236 auto test = [&](
int n) {
2239 if (name[i] != str[i])
2241 if (name[i] ==
'\0' && str[i] ==
'\0')
2274 template<
typename NodeT>
2290template<
typename Gr
idT>
2293 using Type =
typename GridT::TreeType;
2294 using type =
typename GridT::TreeType;
2296template<
typename Gr
idT>
2299 using Type =
const typename GridT::TreeType;
2300 using type =
const typename GridT::TreeType;
2306template<
typename RootT>
2309 static_assert(RootT::LEVEL == 3,
"Tree depth is not supported");
2310 static_assert(RootT::ChildNodeType::LOG2DIM == 5,
"Tree configuration is not supported");
2311 static_assert(RootT::ChildNodeType::ChildNodeType::LOG2DIM == 4,
"Tree configuration is not supported");
2312 static_assert(RootT::LeafNodeType::LOG2DIM == 3,
"Tree configuration is not supported");
2327 using Node2 =
typename RootT::ChildNodeType;
2328 using Node1 =
typename Node2::ChildNodeType;
2386 template<
typename NodeT>
2389 static_assert(NodeT::LEVEL < 3,
"Invalid NodeT");
2407 template<
typename NodeT>
2417 template<
typename NodeT>
2450 template<
typename OpT,
typename... ArgsT>
2456 template<
typename OpT,
typename... ArgsT>
2467template<
typename RootT>
2470 min = this->
root().minimum();
2471 max = this->
root().maximum();
2479template<
typename ChildT>
2489#ifdef NANOVDB_USE_SINGLE_ROOT_KEY
2491 template<
typename CoordType>
2494 static_assert(
sizeof(
CoordT) ==
sizeof(CoordType),
"Mismatching sizeof");
2495 static_assert(32 - ChildT::TOTAL <= 21,
"Cannot use 64 bit root keys");
2496 return (
KeyT(uint32_t(ijk[2]) >> ChildT::TOTAL)) |
2497 (
KeyT(uint32_t(ijk[1]) >> ChildT::TOTAL) << 21) |
2498 (
KeyT(uint32_t(ijk[0]) >> ChildT::TOTAL) << 42);
2502 static constexpr uint64_t MASK = (1u << 21) - 1;
2503 return CoordT(((key >> 42) & MASK) << ChildT::TOTAL,
2504 ((key >> 21) & MASK) << ChildT::TOTAL,
2505 (key & MASK) << ChildT::TOTAL);
2508 using KeyT = CoordT;
2509 __hostdev__ static KeyT CoordToKey(
const CoordT& ijk) {
return ijk & ~ChildT::MASK; }
2510 __hostdev__ static CoordT KeyToCoord(
const KeyT& key) {
return key; }
2529 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
Tile
2531 template<
typename CoordType>
2538 template<
typename CoordType,
typename ValueType>
2562 return reinterpret_cast<const Tile*
>(
this + 1) + n;
2567 return reinterpret_cast<Tile*
>(
this + 1) + n;
2580 while (low != high) {
2581 int mid = low + ((high - low) >> 1);
2583 if (
tile->key == key) {
2585 }
else if (
tile->key < key) {
2634template<
typename ChildT>
2655 static constexpr uint32_t
LEVEL = 1 + ChildT::LEVEL;
2657 template<
typename RootT>
2680 return this->
tile()->origin();
2685 return this->
tile()->origin();
2689 template<
typename RootT>
2705 while (*
this && !this->
tile()->isChild())
2722 while (*
this && this->
tile()->isValue())
2740 template<
typename RootT>
2754 while (*
this && this->
tile()->isChild())
2760 return this->
tile()->value;
2765 return this->
tile()->state;
2771 while (*
this && this->
tile()->isChild())
2789 template<
typename RootT>
2809 return this->
tile()->value;
2833 template<
typename RootT>
2852 NodeT* child =
nullptr;
2853 auto* t = this->
tile();
2864 return this->
tile()->state;
2936#ifdef NANOVDB_NEW_ACCESSOR_METHODS
2947 __hostdev__ ValueType getValue(
const CoordType& ijk)
const
2949 if (
const Tile* tile = DataType::probeTile(ijk)) {
2950 return tile->isChild() ? this->getChild(tile)->getValue(ijk) : tile->value;
2952 return DataType::mBackground;
2954 __hostdev__ ValueType getValue(
int i,
int j,
int k)
const {
return this->getValue(CoordType(i, j, k)); }
2956 __hostdev__ bool isActive(
const CoordType& ijk)
const
2958 if (
const Tile* tile = DataType::probeTile(ijk)) {
2959 return tile->isChild() ? this->getChild(tile)->isActive(ijk) : tile->state;
2964 __hostdev__ bool probeValue(
const CoordType& ijk, ValueType& v)
const
2966 if (
const Tile* tile = DataType::probeTile(ijk)) {
2967 if (tile->isChild()) {
2968 const auto* child = this->getChild(tile);
2969 return child->probeValue(ijk, v);
2974 v = DataType::mBackground;
2978 __hostdev__ const LeafNodeType* probeLeaf(
const CoordType& ijk)
const
2980 const Tile* tile = DataType::probeTile(ijk);
2981 if (tile && tile->isChild()) {
2982 const auto* child = this->getChild(tile);
2983 return child->probeLeaf(ijk);
3002 template<
typename OpT,
typename... ArgsT>
3006 if (
tile->isChild())
3008 return OpT::get(*
tile, args...);
3010 return OpT::get(*
this, args...);
3013 template<
typename OpT,
typename... ArgsT>
3019 if (
tile->isChild())
3021 return OpT::set(*
tile, args...);
3023 return OpT::set(*
this, args...);
3028 static_assert(
sizeof(
typename DataType::Tile) %
NANOVDB_DATA_ALIGNMENT == 0,
"sizeof(RootData::Tile) is misaligned");
3030 template<
typename,
int,
int,
int>
3035#ifndef NANOVDB_NEW_ACCESSOR_METHODS
3037 template<
typename AccT>
3038 __hostdev__ typename AccT::NodeInfo getNodeInfoAndCache(
const CoordType& ijk,
const AccT& acc)
const
3040 using NodeInfoT =
typename AccT::NodeInfo;
3042 if (
tile->isChild()) {
3044 acc.insert(ijk, child);
3045 return child->getNodeInfoAndCache(ijk, acc);
3047 return NodeInfoT{LEVEL, ChildT::dim(), tile->value, tile->value, tile->value, 0, tile->origin(), tile->origin() + CoordType(ChildT::DIM)};
3049 return NodeInfoT{LEVEL, ChildT::dim(), this->minimum(), this->maximum(), this->average(), this->stdDeviation(), this->bbox()[0], this->bbox()[1]};
3053 template<
typename AccT>
3054 __hostdev__ ValueType getValueAndCache(
const CoordType& ijk,
const AccT& acc)
const
3056 if (
const Tile* tile = this->probeTile(ijk)) {
3057 if (tile->isChild()) {
3058 const auto* child = this->getChild(tile);
3059 acc.insert(ijk, child);
3060 return child->getValueAndCache(ijk, acc);
3064 return DataType::mBackground;
3067 template<
typename AccT>
3068 __hostdev__ bool isActiveAndCache(
const CoordType& ijk,
const AccT& acc)
const
3070 const Tile* tile = this->probeTile(ijk);
3071 if (tile && tile->isChild()) {
3072 const auto* child = this->getChild(tile);
3073 acc.insert(ijk, child);
3074 return child->isActiveAndCache(ijk, acc);
3079 template<
typename AccT>
3080 __hostdev__ bool probeValueAndCache(
const CoordType& ijk, ValueType& v,
const AccT& acc)
const
3082 if (
const Tile* tile = this->probeTile(ijk)) {
3083 if (tile->isChild()) {
3084 const auto* child = this->getChild(tile);
3085 acc.insert(ijk, child);
3086 return child->probeValueAndCache(ijk, v, acc);
3091 v = DataType::mBackground;
3095 template<
typename AccT>
3096 __hostdev__ const LeafNodeType* probeLeafAndCache(
const CoordType& ijk,
const AccT& acc)
const
3098 const Tile* tile = this->probeTile(ijk);
3099 if (tile && tile->isChild()) {
3100 const auto* child = this->getChild(tile);
3101 acc.insert(ijk, child);
3102 return child->probeLeafAndCache(ijk, acc);
3108 template<
typename RayT,
typename AccT>
3109 __hostdev__ uint32_t getDimAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const
3111 if (
const Tile* tile = this->probeTile(ijk)) {
3112 if (tile->isChild()) {
3113 const auto* child = this->getChild(tile);
3114 acc.insert(ijk, child);
3115 return child->getDimAndCache(ijk, ray, acc);
3117 return 1 << ChildT::TOTAL;
3119 return ChildNodeType::dim();
3122 template<
typename OpT,
typename AccT,
typename... ArgsT>
3125 getAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
const
3127 if (
const Tile* tile = this->probeTile(ijk)) {
3128 if (tile->isChild()) {
3129 const ChildT* child = this->getChild(tile);
3130 acc.insert(ijk, child);
3131 return child->template getAndCache<OpT>(ijk, acc, args...);
3133 return OpT::get(*tile, args...);
3135 return OpT::get(*
this, args...);
3138 template<
typename OpT,
typename AccT,
typename... ArgsT>
3140 __hostdev__ decltype(OpT::set(util::declval<Tile&>(), util::declval<ArgsT>()...))
3141 setAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
3143 if (Tile* tile = DataType::probeTile(ijk)) {
3144 if (tile->isChild()) {
3145 ChildT* child = this->getChild(tile);
3146 acc.insert(ijk, child);
3147 return child->template setAndCache<OpT>(ijk, acc, args...);
3149 return OpT::set(*tile, args...);
3151 return OpT::set(*
this, args...);
3163template<
typename ChildT, u
int32_t LOG2DIM>
3170 using MaskT =
typename ChildT::template MaskType<LOG2DIM>;
3202 alignas(32) Tile
mTable[1u << (3 * LOG2DIM)];
3212 template<
typename ValueT>
3245 template<
typename T>
3253#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__llvm__)
3254#pragma GCC diagnostic push
3255#pragma GCC diagnostic ignored "-Wstringop-overflow"
3261#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__llvm__)
3262#pragma GCC diagnostic pop
3273template<
typename ChildT, u
int32_t Log2Dim = ChildT::LOG2DIM + 1>
3285 template<u
int32_t LOG2>
3295 static constexpr uint32_t
LEVEL = 1 + ChildT::LEVEL;
3299 template <
typename ParentT>
3322 return *mParent->getChild(BaseT::pos());
3327 return mParent->getChild(BaseT::pos());
3332 return (*this)->origin();
3364 return mParent->data()->getValue(BaseT::pos());
3369 return mParent->offsetToGlobalCoord(BaseT::pos());
3375 return mParent->data()->isActive(BaseT::mPos);
3403 return mParent->data()->getValue(BaseT::pos());
3408 return mParent->offsetToGlobalCoord(BaseT::pos());
3430 , mParent(parent->
data())
3437 const ChildT* child =
nullptr;
3438 if (mParent->mChildMask.isOn(BaseT::pos())) {
3439 child = mParent->getChild(BaseT::pos());
3441 value = mParent->getValue(BaseT::pos());
3448 return mParent->isActive(BaseT::pos());
3453 return mParent->offsetToGlobalCoord(BaseT::pos());
3520#ifdef NANOVDB_NEW_ACCESSOR_METHODS
3528 __hostdev__ ValueType getValue(
const CoordType& ijk)
const
3530 const uint32_t n = CoordToOffset(ijk);
3531 return DataType::mChildMask.isOn(n) ? this->getChild(n)->getValue(ijk) : DataType::getValue(n);
3533 __hostdev__ bool isActive(
const CoordType& ijk)
const
3535 const uint32_t n = CoordToOffset(ijk);
3536 return DataType::mChildMask.isOn(n) ? this->getChild(n)->isActive(ijk) : DataType::isActive(n);
3538 __hostdev__ bool probeValue(
const CoordType& ijk, ValueType& v)
const
3540 const uint32_t n = CoordToOffset(ijk);
3541 if (DataType::mChildMask.isOn(n))
3542 return this->getChild(n)->probeValue(ijk, v);
3543 v = DataType::getValue(n);
3544 return DataType::isActive(n);
3546 __hostdev__ const LeafNodeType* probeLeaf(
const CoordType& ijk)
const
3548 const uint32_t n = CoordToOffset(ijk);
3549 if (DataType::mChildMask.isOn(n))
3550 return this->getChild(n)->probeLeaf(ijk);
3570 return (((ijk[0] &
MASK) >> ChildT::TOTAL) << (2 *
LOG2DIM)) |
3571 (((ijk[1] &
MASK) >> ChildT::TOTAL) << (
LOG2DIM)) |
3572 ((ijk[2] &
MASK) >> ChildT::TOTAL);
3579 const uint32_t m = n & ((1 << 2 *
LOG2DIM) - 1);
3586 ijk <<= ChildT::TOTAL;
3600 template<
typename OpT,
typename... ArgsT>
3606 return OpT::get(*
this, n, args...);
3609 template<
typename OpT,
typename... ArgsT>
3617 return OpT::set(*
this, n, args...);
3623 template<
typename,
int,
int,
int>
3628 template<
typename, u
int32_t>
3631#ifndef NANOVDB_NEW_ACCESSOR_METHODS
3633 template<
typename AccT>
3639 const ChildT* child = this->
getChild(n);
3640 acc.insert(ijk, child);
3641 return child->getValueAndCache(ijk, acc);
3643 template<
typename AccT>
3644 __hostdev__ bool isActiveAndCache(
const CoordType& ijk,
const AccT& acc)
const
3646 const uint32_t n = CoordToOffset(ijk);
3647 if (DataType::mChildMask.isOff(n))
3648 return DataType::isActive(n);
3649 const ChildT* child = this->getChild(n);
3650 acc.insert(ijk, child);
3651 return child->isActiveAndCache(ijk, acc);
3653 template<
typename AccT>
3654 __hostdev__ bool probeValueAndCache(
const CoordType& ijk, ValueType& v,
const AccT& acc)
const
3656 const uint32_t n = CoordToOffset(ijk);
3657 if (DataType::mChildMask.isOff(n)) {
3658 v = DataType::getValue(n);
3659 return DataType::isActive(n);
3661 const ChildT* child = this->getChild(n);
3662 acc.insert(ijk, child);
3663 return child->probeValueAndCache(ijk, v, acc);
3665 template<
typename AccT>
3666 __hostdev__ const LeafNodeType* probeLeafAndCache(
const CoordType& ijk,
const AccT& acc)
const
3668 const uint32_t n = CoordToOffset(ijk);
3669 if (DataType::mChildMask.isOff(n))
3671 const ChildT* child = this->getChild(n);
3672 acc.insert(ijk, child);
3673 return child->probeLeafAndCache(ijk, acc);
3675 template<
typename AccT>
3676 __hostdev__ typename AccT::NodeInfo getNodeInfoAndCache(
const CoordType& ijk,
const AccT& acc)
const
3678 using NodeInfoT =
typename AccT::NodeInfo;
3679 const uint32_t n = CoordToOffset(ijk);
3680 if (DataType::mChildMask.isOff(n)) {
3681 return NodeInfoT{LEVEL, this->dim(), this->minimum(), this->maximum(), this->average(), this->stdDeviation(), this->bbox()[0], this->bbox()[1]};
3683 const ChildT* child = this->getChild(n);
3684 acc.insert(ijk, child);
3685 return child->getNodeInfoAndCache(ijk, acc);
3689 template<
typename RayT,
typename AccT>
3690 __hostdev__ uint32_t getDimAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const
3692 if (DataType::mFlags & uint32_t(1u))
3696 const uint32_t n = CoordToOffset(ijk);
3697 if (DataType::mChildMask.isOn(n)) {
3698 const ChildT* child = this->getChild(n);
3699 acc.insert(ijk, child);
3700 return child->getDimAndCache(ijk, ray, acc);
3702 return ChildNodeType::dim();
3705 template<
typename OpT,
typename AccT,
typename... ArgsT>
3708 getAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
const
3710 const uint32_t n = CoordToOffset(ijk);
3711 if (DataType::mChildMask.isOff(n))
3712 return OpT::get(*
this, n, args...);
3713 const ChildT* child = this->getChild(n);
3714 acc.insert(ijk, child);
3715 return child->template getAndCache<OpT>(ijk, acc, args...);
3718 template<
typename OpT,
typename AccT,
typename... ArgsT>
3720 __hostdev__ decltype(OpT::set(util::declval<InternalNode&>(), util::declval<uint32_t>(), util::declval<ArgsT>()...))
3721 setAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
3723 const uint32_t n = CoordToOffset(ijk);
3724 if (DataType::mChildMask.isOff(n))
3725 return OpT::set(*
this, n, args...);
3726 ChildT* child = this->getChild(n);
3727 acc.insert(ijk, child);
3728 return child->template setAndCache<OpT>(ijk, acc, args...);
3738template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3741 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3742 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3765 return sizeof(
LeafData) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>) + 2 * (
sizeof(ValueT) +
sizeof(
FloatType)) + (1u << (3 * LOG2DIM)) *
sizeof(ValueT));
3790 template<
typename T>
3795 for (
auto *p =
mValues, *q = p + 512; p != q; ++p)
3809template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3812 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3813 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3835 return sizeof(
LeafFnBase) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>) + 2 * 4 + 4 * 2);
3840 mQuantum = (max - min) /
float((1 << bitWidth) - 1);
3870 template<
typename T>
3879template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3880struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp4, CoordT, MaskT, LOG2DIM>
3887 alignas(32) uint8_t
mCode[1u << (3 * LOG2DIM - 1)];
3892 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3893 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << (3 * LOG2DIM - 1));
3900 const uint8_t c =
mCode[i>>1];
3916template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3917struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp8, CoordT, MaskT, LOG2DIM>
3924 alignas(32) uint8_t
mCode[1u << 3 * LOG2DIM];
3928 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3929 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << 3 * LOG2DIM);
3946template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3947struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp16, CoordT, MaskT, LOG2DIM>
3954 alignas(32) uint16_t
mCode[1u << 3 * LOG2DIM];
3959 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3960 return sizeof(
LeafData) -
sizeof(
BaseT) - 2 * (1u << 3 * LOG2DIM);
3978template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3979struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
FpN, CoordT, MaskT, LOG2DIM>
3988 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3997#ifdef NANOVDB_FPN_BRANCHLESS
4000 uint16_t code =
reinterpret_cast<const uint16_t*
>(
this + 1)[i >> (4 - b)];
4001 const static uint8_t shift[5] = {15, 7, 3, 1, 0};
4002 const static uint16_t mask[5] = {1, 3, 15, 255, 65535};
4003 code >>= (i & shift[b]) << b;
4006 uint32_t code =
reinterpret_cast<const uint32_t*
>(
this + 1)[i >> (5 - b)];
4007 code >>= (i & ((32 >> b) - 1)) << b;
4008 code &= (1 << (1 << b)) - 1;
4012 auto* values =
reinterpret_cast<const uint8_t*
>(
this + 1);
4015 code = float((values[i >> 3] >> (i & 7)) & uint8_t(1));
4018 code = float((values[i >> 2] >> ((i & 3) << 1)) & uint8_t(3));
4021 code = float((values[i >> 1] >> ((i & 1) << 2)) & uint8_t(15));
4024 code = float(values[i]);
4027 code = float(
reinterpret_cast<const uint16_t*
>(values)[i]);
4043template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4044struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<bool, CoordT, MaskT, LOG2DIM>
4046 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4047 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4080 template<
typename T>
4093template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4096 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4097 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4114 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u);
4129 template<
typename T>
4142template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4145 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4146 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4159 return sizeof(
LeafIndexBase) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u);
4170 template<
typename T>
4184template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4204template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4222 uint32_t n = i >> 6;
4223 const uint64_t w =
BaseT::mValueMask.words()[n], mask = uint64_t(1) << (i & 63u);
4224 if (!(w & mask))
return uint64_t(0);
4233template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4235 :
public LeafData<ValueIndex, CoordT, MaskT, LOG2DIM>
4244template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4246 :
public LeafData<ValueOnIndex, CoordT, MaskT, LOG2DIM>
4257template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4258struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Point, CoordT, MaskT, LOG2DIM>
4260 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4261 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4283 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u + (1u << 3 * LOG2DIM) * 2u);
4310 template<
typename T>
4323template<
typename BuildT,
4324 typename CoordT = Coord,
4325 template<u
int32_t>
class MaskT =
Mask,
4326 uint32_t Log2Dim = 3>
4333 static constexpr uint32_t
DIM = 1;
4343 template<u
int32_t LOG2>
4369 return mParent->getValue(BaseT::pos());
4374 return mParent->offsetToGlobalCoord(BaseT::pos());
4402 return mParent->getValue(BaseT::pos());
4407 return mParent->offsetToGlobalCoord(BaseT::pos());
4423 , mPos(1u << 3 * Log2Dim)
4436 return mParent->getValue(mPos);
4441 return mParent->offsetToGlobalCoord(mPos);
4446 return mParent->isActive(mPos);
4448 __hostdev__ operator bool()
const {
return mPos < (1u << 3 * Log2Dim); }
4508 const uint32_t m = n & ((1 << 2 *
LOG2DIM) - 1);
4532 bbox = math::BBox<CoordT>();
4612 template<
typename OpT,
typename... ArgsT>
4618 template<
typename OpT,
typename... ArgsT>
4621 return OpT::get(*
this, n, args...);
4624 template<
typename OpT,
typename... ArgsT>
4630 template<
typename OpT,
typename... ArgsT>
4633 return OpT::set(*
this, n, args...);
4639 template<
typename,
int,
int,
int>
4644 template<
typename, u
int32_t>
4647#ifndef NANOVDB_NEW_ACCESSOR_METHODS
4649 template<
typename AccT>
4653 template<
typename AccT>
4654 __hostdev__ typename AccT::NodeInfo getNodeInfoAndCache(
const CoordType& ,
const AccT& )
const
4656 using NodeInfoT =
typename AccT::NodeInfo;
4657 return NodeInfoT{LEVEL, this->dim(), this->minimum(), this->maximum(), this->average(), this->stdDeviation(), this->bbox()[0], this->bbox()[1]};
4660 template<
typename AccT>
4661 __hostdev__ bool isActiveAndCache(
const CoordT& ijk,
const AccT&)
const {
return this->isActive(ijk); }
4663 template<
typename AccT>
4664 __hostdev__ bool probeValueAndCache(
const CoordT& ijk, ValueType& v,
const AccT&)
const {
return this->probeValue(ijk, v); }
4666 template<
typename AccT>
4667 __hostdev__ const LeafNode* probeLeafAndCache(
const CoordT&,
const AccT&)
const {
return this; }
4670 template<
typename RayT,
typename AccT>
4671 __hostdev__ uint32_t getDimAndCache(
const CoordT&,
const RayT& ,
const AccT&)
const
4673 if (DataType::mFlags & uint8_t(1u))
4677 return ChildNodeType::dim();
4680 template<
typename OpT,
typename AccT,
typename... ArgsT>
4683 getAndCache(
const CoordType& ijk,
const AccT&, ArgsT&&... args)
const
4685 return OpT::get(*
this, CoordToOffset(ijk), args...);
4688 template<
typename OpT,
typename AccT,
typename... ArgsT>
4690 __hostdev__ decltype(OpT::set(util::declval<LeafNode&>(), util::declval<uint32_t>(), util::declval<ArgsT>()...))
4691 setAndCache(
const CoordType& ijk,
const AccT&, ArgsT&&... args)
4693 return OpT::set(*
this, CoordToOffset(ijk), args...);
4700template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4703 static_assert(
LOG2DIM == 3,
"LeafNode::updateBBox: only supports LOGDIM = 3!");
4708 auto update = [&](uint32_t min, uint32_t max,
int axis) {
4714 uint32_t Xmin = word64 ? 0u : 8u, Xmax = Xmin;
4715 for (
int i = 1; i < 8; ++i) {
4724 update(Xmin, Xmax, 0);
4726 const uint32_t *p =
reinterpret_cast<const uint32_t*
>(&word64), word32 = p[0] | p[1];
4727 const uint16_t *q =
reinterpret_cast<const uint16_t*
>(&word32), word16 = q[0] | q[1];
4728 const uint8_t *b =
reinterpret_cast<const uint8_t*
>(&word16),
byte = b[0] | b[1];
4739template<
typename BuildT>
4741template<
typename BuildT>
4743template<
typename BuildT>
4745template<
typename BuildT>
4747template<
typename BuildT>
4749template<
typename BuildT>
4753template<
typename BuildT,
int LEVEL>
4757template<
typename BuildT>
4763template<
typename BuildT>
4769template<
typename BuildT>
4775template<
typename BuildT>
4854template<
typename OpT,
typename GridDataT,
typename... ArgsT>
4858 switch (gridData->mGridType){
4860 return OpT::template known<float>(gridData, args...);
4862 return OpT::template known<double>(gridData, args...);
4864 return OpT::template known<int16_t>(gridData, args...);
4866 return OpT::template known<int32_t>(gridData, args...);
4868 return OpT::template known<int64_t>(gridData, args...);
4870 return OpT::template known<Vec3f>(gridData, args...);
4872 return OpT::template known<Vec3d>(gridData, args...);
4874 return OpT::template known<uint32_t>(gridData, args...);
4876 return OpT::template known<ValueMask>(gridData, args...);
4878 return OpT::template known<ValueIndex>(gridData, args...);
4880 return OpT::template known<ValueOnIndex>(gridData, args...);
4882 return OpT::template known<ValueIndexMask>(gridData, args...);
4884 return OpT::template known<ValueOnIndexMask>(gridData, args...);
4886 return OpT::template known<bool>(gridData, args...);
4888 return OpT::template known<math::Rgba8>(gridData, args...);
4890 return OpT::template known<Fp4>(gridData, args...);
4892 return OpT::template known<Fp8>(gridData, args...);
4894 return OpT::template known<Fp16>(gridData, args...);
4896 return OpT::template known<FpN>(gridData, args...);
4898 return OpT::template known<Vec4f>(gridData, args...);
4900 return OpT::template known<Vec4d>(gridData, args...);
4902 return OpT::template known<uint8_t>(gridData, args...);
4904 return OpT::unknown(gridData, args...);
4929template<
typename BuildT>
4939 mutable const RootT* mRoot;
4946#ifndef NANOVDB_NEW_ACCESSOR_METHODS
4987#ifdef NANOVDB_NEW_ACCESSOR_METHODS
5000 __hostdev__ ValueType getValue(
const CoordType& ijk)
const
5002 return mRoot->getValueAndCache(ijk, *
this);
5004 __hostdev__ ValueType getValue(
int i,
int j,
int k)
const
5006 return this->getValue(CoordType(i, j, k));
5008 __hostdev__ ValueType operator()(
const CoordType& ijk)
const
5010 return this->getValue(ijk);
5012 __hostdev__ ValueType operator()(
int i,
int j,
int k)
const
5014 return this->getValue(CoordType(i, j, k));
5017 __hostdev__ NodeInfo getNodeInfo(
const CoordType& ijk)
const
5019 return mRoot->getNodeInfoAndCache(ijk, *
this);
5022 __hostdev__ bool isActive(
const CoordType& ijk)
const
5024 return mRoot->isActiveAndCache(ijk, *
this);
5027 __hostdev__ bool probeValue(
const CoordType& ijk, ValueType& v)
const
5029 return mRoot->probeValueAndCache(ijk, v, *
this);
5032 __hostdev__ const LeafT* probeLeaf(
const CoordType& ijk)
const
5034 return mRoot->probeLeafAndCache(ijk, *
this);
5037 template<
typename RayT>
5040 return mRoot->getDimAndCache(ijk, ray, *
this);
5042 template<
typename OpT,
typename... ArgsT>
5045 return mRoot->template
get<OpT>(ijk, args...);
5048 template<
typename OpT,
typename... ArgsT>
5051 return const_cast<RootT*
>(mRoot)->
template set<OpT>(ijk, args...);
5058 template<
typename, u
int32_t>
5060 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5064 template<
typename NodeT>
5069template<
typename BuildT,
int LEVEL0>
5072 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 should be 0, 1, or 2");
5086 mutable CoordT mKey;
5087 mutable const RootT* mRoot;
5088 mutable const NodeT* mNode;
5096#ifndef NANOVDB_NEW_ACCESSOR_METHODS
5097 using NodeInfo =
typename ReadAccessor<ValueT, -1, -1, -1>::NodeInfo;
5122 mKey = CoordType::max();
5135 return (ijk[0] & int32_t(~NodeT::MASK)) == mKey[0] &&
5136 (ijk[1] & int32_t(~NodeT::MASK)) == mKey[1] &&
5137 (ijk[2] & int32_t(~NodeT::MASK)) == mKey[2];
5140#ifdef NANOVDB_NEW_ACCESSOR_METHODS
5153 __hostdev__ ValueType getValue(
const CoordType& ijk)
const
5155 if (this->isCached(ijk))
5156 return mNode->getValueAndCache(ijk, *
this);
5157 return mRoot->getValueAndCache(ijk, *
this);
5159 __hostdev__ ValueType getValue(
int i,
int j,
int k)
const
5161 return this->getValue(CoordType(i, j, k));
5163 __hostdev__ ValueType operator()(
const CoordType& ijk)
const
5165 return this->getValue(ijk);
5167 __hostdev__ ValueType operator()(
int i,
int j,
int k)
const
5169 return this->getValue(CoordType(i, j, k));
5172 __hostdev__ NodeInfo getNodeInfo(
const CoordType& ijk)
const
5174 if (this->isCached(ijk))
5175 return mNode->getNodeInfoAndCache(ijk, *
this);
5176 return mRoot->getNodeInfoAndCache(ijk, *
this);
5179 __hostdev__ bool isActive(
const CoordType& ijk)
const
5181 if (this->isCached(ijk))
5182 return mNode->isActiveAndCache(ijk, *
this);
5183 return mRoot->isActiveAndCache(ijk, *
this);
5186 __hostdev__ bool probeValue(
const CoordType& ijk, ValueType& v)
const
5188 if (this->isCached(ijk))
5189 return mNode->probeValueAndCache(ijk, v, *
this);
5190 return mRoot->probeValueAndCache(ijk, v, *
this);
5193 __hostdev__ const LeafT* probeLeaf(
const CoordType& ijk)
const
5195 if (this->isCached(ijk))
5196 return mNode->probeLeafAndCache(ijk, *
this);
5197 return mRoot->probeLeafAndCache(ijk, *
this);
5200 template<
typename RayT>
5204 return mNode->getDimAndCache(ijk, ray, *
this);
5205 return mRoot->getDimAndCache(ijk, ray, *
this);
5208 template<
typename OpT,
typename... ArgsT>
5212 return mNode->template getAndCache<OpT>(ijk, *
this, args...);
5213 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5216 template<
typename OpT,
typename... ArgsT>
5220 return const_cast<NodeT*
>(mNode)->
template setAndCache<OpT>(ijk, *
this, args...);
5221 return const_cast<RootT*
>(mRoot)->
template setAndCache<OpT>(ijk, *
this, args...);
5228 template<
typename, u
int32_t>
5230 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5236 mKey = ijk & ~NodeT::MASK;
5241 template<
typename OtherNodeT>
5242 __hostdev__ void insert(
const CoordType&,
const OtherNodeT*)
const {}
5246template<
typename BuildT,
int LEVEL0,
int LEVEL1>
5249 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 must be 0, 1, 2");
5250 static_assert(LEVEL1 >= 0 && LEVEL1 <= 2,
"LEVEL1 must be 0, 1, 2");
5251 static_assert(LEVEL0 < LEVEL1,
"Level 0 must be lower than level 1");
5264#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5265 mutable CoordT mKey;
5267 mutable CoordT mKeys[2];
5269 mutable const RootT* mRoot;
5270 mutable const Node1T* mNode1;
5271 mutable const Node2T* mNode2;
5279#ifndef NANOVDB_NEW_ACCESSOR_METHODS
5280 using NodeInfo =
typename ReadAccessor<ValueT, -1, -1, -1>::NodeInfo;
5284#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5285 : mKey(CoordType::max())
5287 : mKeys{CoordType::max(), CoordType::max()}
5310#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5311 mKey = CoordType::max();
5313 mKeys[0] = mKeys[1] = CoordType::max();
5326#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5331 if (dirty & int32_t(~Node1T::MASK)) {
5337 __hostdev__ bool isCached2(CoordValueType dirty)
const
5341 if (dirty & int32_t(~Node2T::MASK)) {
5347 __hostdev__ CoordValueType computeDirty(
const CoordType& ijk)
const
5349 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
5354 return (ijk[0] & int32_t(~Node1T::MASK)) == mKeys[0][0] &&
5355 (ijk[1] & int32_t(~Node1T::MASK)) == mKeys[0][1] &&
5356 (ijk[2] & int32_t(~Node1T::MASK)) == mKeys[0][2];
5360 return (ijk[0] & int32_t(~Node2T::MASK)) == mKeys[1][0] &&
5361 (ijk[1] & int32_t(~Node2T::MASK)) == mKeys[1][1] &&
5362 (ijk[2] & int32_t(~Node2T::MASK)) == mKeys[1][2];
5366#ifdef NANOVDB_NEW_ACCESSOR_METHODS
5380 __hostdev__ ValueType getValue(
const CoordType& ijk)
const
5382#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5383 const CoordValueType dirty = this->computeDirty(ijk);
5387 if (this->isCached1(dirty)) {
5388 return mNode1->getValueAndCache(ijk, *
this);
5389 }
else if (this->isCached2(dirty)) {
5390 return mNode2->getValueAndCache(ijk, *
this);
5392 return mRoot->getValueAndCache(ijk, *
this);
5394 __hostdev__ ValueType operator()(
const CoordType& ijk)
const
5396 return this->getValue(ijk);
5398 __hostdev__ ValueType operator()(
int i,
int j,
int k)
const
5400 return this->getValue(CoordType(i, j, k));
5402 __hostdev__ ValueType getValue(
int i,
int j,
int k)
const
5404 return this->getValue(CoordType(i, j, k));
5406 __hostdev__ NodeInfo getNodeInfo(
const CoordType& ijk)
const
5408#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5409 const CoordValueType dirty = this->computeDirty(ijk);
5413 if (this->isCached1(dirty)) {
5414 return mNode1->getNodeInfoAndCache(ijk, *
this);
5415 }
else if (this->isCached2(dirty)) {
5416 return mNode2->getNodeInfoAndCache(ijk, *
this);
5418 return mRoot->getNodeInfoAndCache(ijk, *
this);
5421 __hostdev__ bool isActive(
const CoordType& ijk)
const
5423#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5424 const CoordValueType dirty = this->computeDirty(ijk);
5428 if (this->isCached1(dirty)) {
5429 return mNode1->isActiveAndCache(ijk, *
this);
5430 }
else if (this->isCached2(dirty)) {
5431 return mNode2->isActiveAndCache(ijk, *
this);
5433 return mRoot->isActiveAndCache(ijk, *
this);
5436 __hostdev__ bool probeValue(
const CoordType& ijk, ValueType& v)
const
5438#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5439 const CoordValueType dirty = this->computeDirty(ijk);
5443 if (this->isCached1(dirty)) {
5444 return mNode1->probeValueAndCache(ijk, v, *
this);
5445 }
else if (this->isCached2(dirty)) {
5446 return mNode2->probeValueAndCache(ijk, v, *
this);
5448 return mRoot->probeValueAndCache(ijk, v, *
this);
5451 __hostdev__ const LeafT* probeLeaf(
const CoordType& ijk)
const
5453#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5454 const CoordValueType dirty = this->computeDirty(ijk);
5458 if (this->isCached1(dirty)) {
5459 return mNode1->probeLeafAndCache(ijk, *
this);
5460 }
else if (this->isCached2(dirty)) {
5461 return mNode2->probeLeafAndCache(ijk, *
this);
5463 return mRoot->probeLeafAndCache(ijk, *
this);
5467 template<
typename RayT>
5470#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5471 const CoordValueType dirty = this->computeDirty(ijk);
5476 return mNode1->getDimAndCache(ijk, ray, *
this);
5478 return mNode2->getDimAndCache(ijk, ray, *
this);
5480 return mRoot->getDimAndCache(ijk, ray, *
this);
5483 template<
typename OpT,
typename... ArgsT>
5486#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5487 const CoordValueType dirty = this->computeDirty(ijk);
5492 return mNode1->template getAndCache<OpT>(ijk, *
this, args...);
5494 return mNode2->template getAndCache<OpT>(ijk, *
this, args...);
5496 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5499 template<
typename OpT,
typename... ArgsT>
5502#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5503 const CoordValueType dirty = this->computeDirty(ijk);
5508 return const_cast<Node1T*
>(mNode1)->
template setAndCache<OpT>(ijk, *
this, args...);
5510 return const_cast<Node2T*
>(mNode2)->
template setAndCache<OpT>(ijk, *
this, args...);
5512 return const_cast<RootT*
>(mRoot)->
template setAndCache<OpT>(ijk, *
this, args...);
5519 template<
typename, u
int32_t>
5521 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5527#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5530 mKeys[0] = ijk & ~Node1T::MASK;
5534 __hostdev__ void insert(
const CoordType& ijk,
const Node2T* node)
const
5536#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5539 mKeys[1] = ijk & ~Node2T::MASK;
5543 template<
typename OtherNodeT>
5544 __hostdev__ void insert(
const CoordType&,
const OtherNodeT*)
const {}
5548template<
typename BuildT>
5549class ReadAccessor<BuildT, 0, 1, 2>
5551 using GridT = NanoGrid<BuildT>;
5552 using TreeT = NanoTree<BuildT>;
5553 using RootT = NanoRoot<BuildT>;
5554 using NodeT2 = NanoUpper<BuildT>;
5555 using NodeT1 = NanoLower<BuildT>;
5556 using LeafT = NanoLeaf<BuildT>;
5557 using CoordT =
typename RootT::CoordType;
5558 using ValueT =
typename RootT::ValueType;
5560 using FloatType =
typename RootT::FloatType;
5561 using CoordValueType =
typename RootT::CoordT::ValueType;
5564#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5565 mutable CoordT mKey;
5567 mutable CoordT mKeys[3];
5569 mutable const RootT* mRoot;
5570 mutable const void* mNode[3];
5573 using BuildType = BuildT;
5574 using ValueType = ValueT;
5575 using CoordType = CoordT;
5577 static const int CacheLevels = 3;
5578#ifndef NANOVDB_NEW_ACCESSOR_METHODS
5579 using NodeInfo =
typename ReadAccessor<ValueT, -1, -1, -1>::NodeInfo;
5583#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5584 : mKey(CoordType::max())
5586 : mKeys{CoordType::max(), CoordType::max(), CoordType::max()}
5589 , mNode{
nullptr,
nullptr,
nullptr}
5595 : ReadAccessor(grid.tree().root())
5601 : ReadAccessor(tree.root())
5605 __hostdev__ const RootT& root()
const {
return *mRoot; }
5608 ReadAccessor(
const ReadAccessor&) =
default;
5609 ~ReadAccessor() =
default;
5610 ReadAccessor& operator=(
const ReadAccessor&) =
default;
5615 template<
typename NodeT>
5618 using T =
typename NodeTrait<TreeT, NodeT::LEVEL>::type;
5619 static_assert(util::is_same<T, NodeT>::value,
"ReadAccessor::getNode: Invalid node type");
5620 return reinterpret_cast<const T*
>(mNode[NodeT::LEVEL]);
5624 __hostdev__ const typename NodeTrait<TreeT, LEVEL>::type* getNode()
const
5626 using T =
typename NodeTrait<TreeT, LEVEL>::type;
5627 static_assert(LEVEL >= 0 && LEVEL <= 2,
"ReadAccessor::getNode: Invalid node type");
5628 return reinterpret_cast<const T*
>(mNode[LEVEL]);
5634#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5635 mKey = CoordType::max();
5637 mKeys[0] = mKeys[1] = mKeys[2] = CoordType::max();
5639 mNode[0] = mNode[1] = mNode[2] =
nullptr;
5642#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5643 template<
typename NodeT>
5644 __hostdev__ bool isCached(CoordValueType dirty)
const
5646 if (!mNode[NodeT::LEVEL])
5648 if (dirty & int32_t(~NodeT::MASK)) {
5649 mNode[NodeT::LEVEL] =
nullptr;
5655 __hostdev__ CoordValueType computeDirty(
const CoordType& ijk)
const
5657 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
5660 template<
typename NodeT>
5661 __hostdev__ bool isCached(
const CoordType& ijk)
const
5663 return (ijk[0] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][0] &&
5664 (ijk[1] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][1] &&
5665 (ijk[2] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][2];
5669#ifdef NANOVDB_NEW_ACCESSOR_METHODS
5670 __hostdev__ ValueType getValue(
const CoordType& ijk)
const
5672 return this->
template get<GetValue<BuildT>>(ijk);
5674 __hostdev__ ValueType getValue(
int i,
int j,
int k)
const {
return this->
template get<GetValue<BuildT>>(CoordType(i, j, k)); }
5675 __hostdev__ ValueType operator()(
const CoordType& ijk)
const {
return this->
template get<GetValue<BuildT>>(ijk); }
5676 __hostdev__ ValueType operator()(
int i,
int j,
int k)
const {
return this->
template get<GetValue<BuildT>>(CoordType(i, j, k)); }
5677 __hostdev__ auto getNodeInfo(
const CoordType& ijk)
const {
return this->
template get<GetNodeInfo<BuildT>>(ijk); }
5678 __hostdev__ bool isActive(
const CoordType& ijk)
const {
return this->
template get<GetState<BuildT>>(ijk); }
5679 __hostdev__ bool probeValue(
const CoordType& ijk, ValueType& v)
const {
return this->
template get<ProbeValue<BuildT>>(ijk, v); }
5680 __hostdev__ const LeafT* probeLeaf(
const CoordType& ijk)
const {
return this->
template get<GetLeaf<BuildT>>(ijk); }
5683 __hostdev__ ValueType getValue(
const CoordType& ijk)
const
5685#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5686 const CoordValueType dirty = this->computeDirty(ijk);
5690 if (this->isCached<LeafT>(dirty)) {
5691 return ((LeafT*)mNode[0])->getValue(ijk);
5692 }
else if (this->isCached<NodeT1>(dirty)) {
5693 return ((NodeT1*)mNode[1])->getValueAndCache(ijk, *
this);
5694 }
else if (this->isCached<NodeT2>(dirty)) {
5695 return ((NodeT2*)mNode[2])->getValueAndCache(ijk, *
this);
5697 return mRoot->getValueAndCache(ijk, *
this);
5699 __hostdev__ ValueType operator()(
const CoordType& ijk)
const
5701 return this->getValue(ijk);
5703 __hostdev__ ValueType operator()(
int i,
int j,
int k)
const
5705 return this->getValue(CoordType(i, j, k));
5707 __hostdev__ ValueType getValue(
int i,
int j,
int k)
const
5709 return this->getValue(CoordType(i, j, k));
5712 __hostdev__ NodeInfo getNodeInfo(
const CoordType& ijk)
const
5714#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5715 const CoordValueType dirty = this->computeDirty(ijk);
5719 if (this->isCached<LeafT>(dirty)) {
5720 return ((LeafT*)mNode[0])->getNodeInfoAndCache(ijk, *
this);
5721 }
else if (this->isCached<NodeT1>(dirty)) {
5722 return ((NodeT1*)mNode[1])->getNodeInfoAndCache(ijk, *
this);
5723 }
else if (this->isCached<NodeT2>(dirty)) {
5724 return ((NodeT2*)mNode[2])->getNodeInfoAndCache(ijk, *
this);
5726 return mRoot->getNodeInfoAndCache(ijk, *
this);
5729 __hostdev__ bool isActive(
const CoordType& ijk)
const
5731#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5732 const CoordValueType dirty = this->computeDirty(ijk);
5736 if (this->isCached<LeafT>(dirty)) {
5737 return ((LeafT*)mNode[0])->isActive(ijk);
5738 }
else if (this->isCached<NodeT1>(dirty)) {
5739 return ((NodeT1*)mNode[1])->isActiveAndCache(ijk, *
this);
5740 }
else if (this->isCached<NodeT2>(dirty)) {
5741 return ((NodeT2*)mNode[2])->isActiveAndCache(ijk, *
this);
5743 return mRoot->isActiveAndCache(ijk, *
this);
5746 __hostdev__ bool probeValue(
const CoordType& ijk, ValueType& v)
const
5748#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5749 const CoordValueType dirty = this->computeDirty(ijk);
5753 if (this->isCached<LeafT>(dirty)) {
5754 return ((LeafT*)mNode[0])->probeValue(ijk, v);
5755 }
else if (this->isCached<NodeT1>(dirty)) {
5756 return ((NodeT1*)mNode[1])->probeValueAndCache(ijk, v, *
this);
5757 }
else if (this->isCached<NodeT2>(dirty)) {
5758 return ((NodeT2*)mNode[2])->probeValueAndCache(ijk, v, *
this);
5760 return mRoot->probeValueAndCache(ijk, v, *
this);
5762 __hostdev__ const LeafT* probeLeaf(
const CoordType& ijk)
const
5764#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5765 const CoordValueType dirty = this->computeDirty(ijk);
5769 if (this->isCached<LeafT>(dirty)) {
5770 return ((LeafT*)mNode[0]);
5771 }
else if (this->isCached<NodeT1>(dirty)) {
5772 return ((NodeT1*)mNode[1])->probeLeafAndCache(ijk, *
this);
5773 }
else if (this->isCached<NodeT2>(dirty)) {
5774 return ((NodeT2*)mNode[2])->probeLeafAndCache(ijk, *
this);
5776 return mRoot->probeLeafAndCache(ijk, *
this);
5780 template<
typename OpT,
typename... ArgsT>
5781 __hostdev__ auto get(
const CoordType& ijk, ArgsT&&... args)
const
5783#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5784 const CoordValueType dirty = this->computeDirty(ijk);
5788 if (this->isCached<LeafT>(dirty)) {
5789 return ((
const LeafT*)mNode[0])->template getAndCache<OpT>(ijk, *
this, args...);
5790 }
else if (this->isCached<NodeT1>(dirty)) {
5791 return ((
const NodeT1*)mNode[1])->template getAndCache<OpT>(ijk, *
this, args...);
5792 }
else if (this->isCached<NodeT2>(dirty)) {
5793 return ((
const NodeT2*)mNode[2])->template getAndCache<OpT>(ijk, *
this, args...);
5795 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5798 template<
typename OpT,
typename... ArgsT>
5799 __hostdev__ auto set(
const CoordType& ijk, ArgsT&&... args)
const
5801#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5802 const CoordValueType dirty = this->computeDirty(ijk);
5806 if (this->isCached<LeafT>(dirty)) {
5807 return ((LeafT*)mNode[0])->template setAndCache<OpT>(ijk, *
this, args...);
5808 }
else if (this->isCached<NodeT1>(dirty)) {
5809 return ((NodeT1*)mNode[1])->template setAndCache<OpT>(ijk, *
this, args...);
5810 }
else if (this->isCached<NodeT2>(dirty)) {
5811 return ((NodeT2*)mNode[2])->template setAndCache<OpT>(ijk, *
this, args...);
5813 return ((RootT*)mRoot)->template setAndCache<OpT>(ijk, *
this, args...);
5816 template<
typename RayT>
5817 __hostdev__ uint32_t getDim(
const CoordType& ijk,
const RayT& ray)
const
5819#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5820 const CoordValueType dirty = this->computeDirty(ijk);
5824 if (this->isCached<LeafT>(dirty)) {
5825 return ((LeafT*)mNode[0])->getDimAndCache(ijk, ray, *
this);
5826 }
else if (this->isCached<NodeT1>(dirty)) {
5827 return ((NodeT1*)mNode[1])->getDimAndCache(ijk, ray, *
this);
5828 }
else if (this->isCached<NodeT2>(dirty)) {
5829 return ((NodeT2*)mNode[2])->getDimAndCache(ijk, ray, *
this);
5831 return mRoot->getDimAndCache(ijk, ray, *
this);
5837 friend class RootNode;
5838 template<
typename, u
int32_t>
5839 friend class InternalNode;
5840 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5841 friend class LeafNode;
5844 template<
typename NodeT>
5845 __hostdev__ void insert(
const CoordType& ijk,
const NodeT* node)
const
5847#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5850 mKeys[NodeT::LEVEL] = ijk & ~NodeT::MASK;
5852 mNode[NodeT::LEVEL] = node;
5870template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5876template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5882template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5898 CoordBBox mIndexBBox;
5899 uint32_t mRootTableSize, mPadding{0};
5902 template<
typename T>
5905 mGridData = *grid.
data();
5906 mTreeData = *grid.
tree().data();
5908 mRootTableSize = grid.
tree().root().getTableSize();
5913 *
this = *
reinterpret_cast<const GridMetaData*
>(gridData);
5916 mGridData = *gridData;
5936 template<
typename T>
5976template<
typename AttT,
typename BuildT = u
int32_t>
5985 : AccT(
grid.tree().root())
5987 , mData(
grid.template getBlindData<AttT>(0))
6003 const uint64_t count = mGrid.blindMetaData(0u).mValueCount;
6005 end = begin + count;
6013 auto* leaf = this->probeLeaf(ijk);
6014 if (leaf ==
nullptr) {
6017 begin = mData + leaf->minimum();
6018 end = begin + leaf->maximum();
6019 return leaf->maximum();
6025 begin = end =
nullptr;
6026 if (
auto* leaf = this->probeLeaf(ijk)) {
6028 if (leaf->isActive(offset)) {
6029 begin = mData + leaf->minimum();
6030 end = begin + leaf->getValue(offset);
6032 begin += leaf->getValue(offset - 1);
6039template<
typename AttT>
6048 : AccT(
grid.tree().root())
6050 , mData(
grid.template getBlindData<AttT>(0))
6070 const uint64_t count = mGrid.blindMetaData(0u).mValueCount;
6072 end = begin + count;
6080 auto* leaf = this->probeLeaf(ijk);
6081 if (leaf ==
nullptr)
6083 begin = mData + leaf->offset();
6084 end = begin + leaf->pointCount();
6085 return leaf->pointCount();
6091 if (
auto* leaf = this->probeLeaf(ijk)) {
6093 if (leaf->isActive(n)) {
6094 begin = mData + leaf->first(n);
6095 end = mData + leaf->last(n);
6099 begin = end =
nullptr;
6107template<
typename ChannelT,
typename IndexT = ValueIndex>
6137 , mChannel(channelPtr)
6168 return mChannel =
const_cast<ChannelT*
>(mGrid.template getBlindData<ChannelT>(channelID));
6173 __hostdev__ uint64_t
idx(
int i,
int j,
int k)
const {
return BaseT::getValue(math::Coord(i, j, k)); }
6184 const bool isActive = BaseT::probeValue(ijk,
idx);
6191 template<
typename T>
6192 __hostdev__ T&
getValue(
const math::Coord& ijk, T* channelPtr)
const {
return channelPtr[BaseT::getValue(ijk)]; }
6200struct MiniGridHandle {
6205 BufferType(BufferType &&other) : data(other.data), size(other.size) {other.data=
nullptr; other.size=0;}
6206 ~BufferType() {std::free(data);}
6207 BufferType& operator=(
const BufferType &other) =
delete;
6208 BufferType& operator=(BufferType &&other){data=other.data; size=other.size; other.data=
nullptr; other.size=0;
return *
this;}
6209 static BufferType create(
size_t n, BufferType* dummy =
nullptr) {
return BufferType(n);}
6211 MiniGridHandle(BufferType &&buf) : buffer(std::move(buf)) {}
6212 const uint8_t* data()
const {
return buffer.data;}
6294#if !defined(__CUDA_ARCH__) && !defined(__HIP__)
6317template<
typename StreamT>
6323#ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS
6328 const char* gridName = gridData->
gridName();
6337 os.write((
const char*)&head,
sizeof(
FileHeader));
6339 os.write(gridName, nameSize);
6341 os.write((
const char*)gridData, gridData->
mGridSize);
6346template<
typename GridHandleT,
template<
typename...>
class VecT>
6349#ifdef NANOVDB_USE_IOSTREAMS
6350 std::ofstream os(fileName, std::ios::out | std::ios::binary | std::ios::trunc);
6354 StreamT(
const char* name) { fptr = fopen(name,
"wb"); }
6355 ~StreamT() { fclose(fptr); }
6356 void write(
const char* data,
size_t n) { fwrite(data, 1, n, fptr); }
6357 bool is_open()
const {
return fptr != NULL; }
6360 if (!os.is_open()) {
6361 fprintf(stderr,
"nanovdb::writeUncompressedGrids: Unable to open file \"%s\"for output\n", fileName);
6364 for (
auto& h : handles) {
6374template<
typename GridHandleT,
typename StreamT,
template<
typename...>
class VecT>
6375VecT<GridHandleT>
readUncompressedGrids(StreamT& is,
const typename GridHandleT::BufferType& pool =
typename GridHandleT::BufferType())
6377 VecT<GridHandleT> handles;
6379 is.read((
char*)&data,
sizeof(
GridData));
6381 uint64_t size = data.
mGridSize, sum = 0u;
6384 is.read((
char*)&data,
sizeof(
GridData));
6385 sum += data.mGridSize;
6387 is.skip(-int64_t(sum +
sizeof(
GridData)));
6388 auto buffer = GridHandleT::BufferType::create(size + sum, &pool);
6389 is.read((
char*)(buffer.data()), buffer.size());
6390 handles.emplace_back(std::move(buffer));
6394 while(is.read((
char*)&head,
sizeof(
FileHeader))) {
6396 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid magic number = \"%s\"\n", (
const char*)&(head.
magic));
6400 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid major version = \"%s\"\n",
toStr(str, head.
version));
6404 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid codec = \"%s\"\n",
toStr(str, head.
codec));
6408 for (uint16_t i = 0; i < head.
gridCount; ++i) {
6410 is.skip(meta.nameSize);
6411 auto buffer = GridHandleT::BufferType::create(meta.gridSize, &pool);
6412 is.read((
char*)buffer.data(), meta.gridSize);
6413 handles.emplace_back(std::move(buffer));
6421template<
typename GridHandleT,
template<
typename...>
class VecT>
6422VecT<GridHandleT>
readUncompressedGrids(
const char* fileName,
const typename GridHandleT::BufferType& buffer =
typename GridHandleT::BufferType())
6424#ifdef NANOVDB_USE_IOSTREAMS
6425 struct StreamT :
public std::ifstream {
6426 StreamT(
const char* name) : std::ifstream(name, std::ios::in | std::ios::binary){}
6427 void skip(int64_t off) { this->seekg(off, std::ios_base::cur); }
6432 StreamT(
const char* name) { fptr = fopen(name,
"rb"); }
6433 ~StreamT() { fclose(fptr); }
6434 bool read(
char* data,
size_t n) {
6435 size_t m = fread(data, 1, n, fptr);
6438 void skip(int64_t off) { fseek(fptr, (
long int)off, SEEK_CUR); }
6439 bool is_open()
const {
return fptr != NULL; }
6442 StreamT is(fileName);
6443 if (!is.is_open()) {
6444 fprintf(stderr,
"nanovdb::readUncompressedGrids: Unable to open file \"%s\"for input\n", fileName);
6459template<
typename BuildT>
6469template<
typename BuildT>
6481template<
typename BuildT>
6495template<
typename BuildT>
6507template<
typename BuildT>
6519template<
typename BuildT>
6531template<
typename BuildT>
6543template<
typename BuildT>
6555template<
typename BuildT>
6567 return tile.state > 0u;
6588template<
typename BuildT>
#define NANOVDB_MAGIC_FILE
Definition NanoVDB.h:136
#define NANOVDB_MAGIC_FRAG
Definition NanoVDB.h:138
#define NANOVDB_MAGIC_GRID
Definition NanoVDB.h:135
#define NANOVDB_MINOR_VERSION_NUMBER
Definition NanoVDB.h:145
#define NANOVDB_DATA_ALIGNMENT
Definition NanoVDB.h:126
#define NANOVDB_MAJOR_VERSION_NUMBER
Definition NanoVDB.h:144
#define NANOVDB_MAGIC_NUMB
Definition NanoVDB.h:134
#define NANOVDB_PATCH_VERSION_NUMBER
Definition NanoVDB.h:146
#define NANOVDB_MAGIC_NODE
Definition NanoVDB.h:137
BitFlags(std::initializer_list< uint8_t > list)
Definition NanoVDB.h:934
__hostdev__ void setBitOn(std::initializer_list< uint8_t > list)
Definition NanoVDB.h:966
__hostdev__ Type getFlags() const
Definition NanoVDB.h:958
__hostdev__ void setOn()
Definition NanoVDB.h:960
BitFlags(Type mask)
Definition NanoVDB.h:933
__hostdev__ bool isMaskOn(MaskT mask) const
Definition NanoVDB.h:1000
__hostdev__ void setBitOff(uint8_t bit)
Definition NanoVDB.h:964
__hostdev__ void setOff()
Definition NanoVDB.h:961
__hostdev__ bool isBitOn(uint8_t bit) const
Definition NanoVDB.h:997
BitFlags()
Definition NanoVDB.h:932
__hostdev__ void setMaskOff(MaskT mask)
Definition NanoVDB.h:978
__hostdev__ void initBit(std::initializer_list< uint8_t > list)
Definition NanoVDB.h:945
__hostdev__ bool isMaskOff(std::initializer_list< MaskT > list) const
return true if any of the masks in the list are off
Definition NanoVDB.h:1014
__hostdev__ void initMask(std::initializer_list< MaskT > list)
Definition NanoVDB.h:951
__hostdev__ void setBit(uint8_t bit, bool on)
Definition NanoVDB.h:991
__hostdev__ void setBitOn(uint8_t bit)
Definition NanoVDB.h:963
__hostdev__ Type & data()
Definition NanoVDB.h:944
BitFlags(std::initializer_list< MaskT > list)
Definition NanoVDB.h:939
__hostdev__ void setMask(MaskT mask, bool on)
Definition NanoVDB.h:993
__hostdev__ bool isOff() const
Definition NanoVDB.h:996
__hostdev__ bool isBitOff(uint8_t bit) const
Definition NanoVDB.h:998
__hostdev__ void setBitOff(std::initializer_list< uint8_t > list)
Definition NanoVDB.h:970
__hostdev__ void setMaskOff(std::initializer_list< MaskT > list)
Definition NanoVDB.h:986
__hostdev__ bool isMaskOn(std::initializer_list< MaskT > list) const
return true if any of the masks in the list are on
Definition NanoVDB.h:1005
__hostdev__ Type data() const
Definition NanoVDB.h:943
__hostdev__ bool isOn() const
Definition NanoVDB.h:995
__hostdev__ void setMaskOn(std::initializer_list< MaskT > list)
Definition NanoVDB.h:981
__hostdev__ bool isMaskOff(MaskT mask) const
Definition NanoVDB.h:1002
__hostdev__ void setMaskOn(MaskT mask)
Definition NanoVDB.h:976
decltype(mFlags) Type
Definition NanoVDB.h:931
__hostdev__ BitFlags & operator=(Type n)
required for backwards compatibility
Definition NanoVDB.h:1022
__hostdev__ ChannelT & operator()(int i, int j, int k) const
Definition NanoVDB.h:6178
__hostdev__ ChannelT * setChannel(uint32_t channelID)
Change to an internal channel, assuming it exists as as blind data in the IndexGrid.
Definition NanoVDB.h:6166
NanoTree< IndexT > TreeType
Definition NanoVDB.h:6118
__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:6172
__hostdev__ ChannelAccessor(const NanoGrid< IndexT > &grid, ChannelT *channelPtr)
Ctor from an IndexGrid and an external channel.
Definition NanoVDB.h:6134
__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:6181
__hostdev__ const uint64_t & valueCount() const
Return total number of values indexed by the IndexGrid.
Definition NanoVDB.h:6156
__hostdev__ ChannelT & operator()(const math::Coord &ijk) const
Definition NanoVDB.h:6177
__hostdev__ uint64_t idx(int i, int j, int k) const
Definition NanoVDB.h:6173
__hostdev__ const TreeType & tree() const
Definition NanoVDB.h:6150
__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:6123
__hostdev__ const NanoGrid< IndexT > & grid() const
Definition NanoVDB.h:6147
ChannelT ValueType
Definition NanoVDB.h:6117
ChannelAccessor< ChannelT, IndexT > AccessorType
Definition NanoVDB.h:6119
__hostdev__ const Vec3d & voxelSize() const
Return a vector of the axial voxel sizes.
Definition NanoVDB.h:6153
__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:6192
__hostdev__ ChannelT * setChannel(ChannelT *channelPtr)
Definition NanoVDB.h:6160
__hostdev__ ChannelT & getValue(const math::Coord &ijk) const
Return the value from a cached channel that maps to the specified coordinate.
Definition NanoVDB.h:6176
Class that encapsulates two CRC32 checksums, one for the Grid, Tree and Root node meta data and one f...
Definition NanoVDB.h:1707
__hostdev__ Checksum(uint64_t checksum, CheckMode mode=CheckMode::Full)
Definition NanoVDB.h:1730
__hostdev__ bool isFull() const
return true if the 64 bit checksum is fill, i.e. of both had and nodes
Definition NanoVDB.h:1756
__hostdev__ Checksum(uint32_t head, uint32_t tail)
Constructor that allows the two 32bit checksums to be initiated explicitly.
Definition NanoVDB.h:1725
__hostdev__ uint64_t checksum() const
return the 64 bit checksum of this instance
Definition NanoVDB.h:1737
__hostdev__ uint64_t full() const
Definition NanoVDB.h:1743
__hostdev__ uint64_t & full()
Definition NanoVDB.h:1744
__hostdev__ bool isEmpty() const
return true if the 64 bit checksum is disables (unset)
Definition NanoVDB.h:1759
__hostdev__ bool operator==(const Checksum &rhs) const
return true if the checksums are identical
Definition NanoVDB.h:1772
__hostdev__ Checksum()
default constructor initiates checksum to EMPTY
Definition NanoVDB.h:1720
__hostdev__ bool isHalf() const
Definition NanoVDB.h:1753
__hostdev__ uint32_t head() const
Definition NanoVDB.h:1745
__hostdev__ uint32_t & head()
Definition NanoVDB.h:1746
uint64_t mCRC64
Definition NanoVDB.h:1712
uint32_t mCRC32[2]
Definition NanoVDB.h:1712
static constexpr uint32_t EMPTY32
Definition NanoVDB.h:1716
__hostdev__ uint32_t tail() const
Definition NanoVDB.h:1747
__hostdev__ uint32_t checksum(int i) const
Definition NanoVDB.h:1741
__hostdev__ uint32_t & checksum(int i)
Definition NanoVDB.h:1739
__hostdev__ bool operator!=(const Checksum &rhs) const
return true if the checksums are not identical
Definition NanoVDB.h:1776
static constexpr uint64_t EMPTY64
Definition NanoVDB.h:1717
__hostdev__ bool isPartial() const
return true if the 64 bit checksum is partial, i.e. of head only
Definition NanoVDB.h:1752
__hostdev__ CheckMode mode() const
return the mode of the 64 bit checksum
Definition NanoVDB.h:1764
__hostdev__ uint32_t & tail()
Definition NanoVDB.h:1748
__hostdev__ void disable()
Definition NanoVDB.h:1761
Dummy type for a 16bit quantization of float point values.
Definition NanoVDB.h:197
Dummy type for a 4bit quantization of float point values.
Definition NanoVDB.h:191
Dummy type for a 8bit quantization of float point values.
Definition NanoVDB.h:194
Dummy type for a variable bit quantization of floating point values.
Definition NanoVDB.h:200
Highest level of the data structure. Contains a tree and a world->index transform (that currently onl...
Definition NanoVDB.h:2012
__hostdev__ const NanoTree< BuildT > & tree() const
Definition NanoVDB.h:2066
typename RootType::LeafNodeType LeafNodeType
Definition NanoVDB.h:2019
__hostdev__ const GridClass & gridClass() const
Definition NanoVDB.h:2141
typename TreeT::ValueType ValueType
Definition NanoVDB.h:2021
__hostdev__ DataType * data()
Definition NanoVDB.h:2035
__hostdev__ Vec3T worldToIndexF(const Vec3T &xyz) const
Definition NanoVDB.h:2105
typename TreeT::RootType RootType
Definition NanoVDB.h:2015
__hostdev__ bool hasMinMax() const
Definition NanoVDB.h:2150
__hostdev__ util::enable_if< util::is_same< T, Point >::value, constuint64_t & >::type pointCount() const
Definition NanoVDB.h:2063
__hostdev__ int findBlindData(const char *name) const
__hostdev__ const Map & map() const
Definition NanoVDB.h:2078
typename TreeT::CoordType CoordType
Definition NanoVDB.h:2023
typename RootNodeType::ChildNodeType UpperNodeType
Definition NanoVDB.h:2017
__hostdev__ const GridBlindMetaData & blindMetaData(uint32_t n) const
Definition NanoVDB.h:2217
__hostdev__ uint32_t blindDataCount() const
Definition NanoVDB.h:2183
__hostdev__ bool hasStdDeviation() const
Definition NanoVDB.h:2154
__hostdev__ BlindDataT * getBlindData(uint32_t n)
Definition NanoVDB.h:2211
__hostdev__ uint32_t gridIndex() const
Definition NanoVDB.h:2046
__hostdev__ bool isUnknown() const
Definition NanoVDB.h:2149
__hostdev__ Vec3T worldToIndexDir(const Vec3T &dir) const
Definition NanoVDB.h:2096
__hostdev__ const GridType & gridType() const
Definition NanoVDB.h:2140
__hostdev__ bool isSequential() const
Definition NanoVDB.h:2168
__hostdev__ const Checksum & checksum() const
Definition NanoVDB.h:2177
GridData DataType
Definition NanoVDB.h:2020
RootType RootNodeType
Definition NanoVDB.h:2016
__hostdev__ bool isValid() const
Definition NanoVDB.h:2139
__hostdev__ uint64_t gridSize() const
Definition NanoVDB.h:2043
__hostdev__ Version version() const
Definition NanoVDB.h:2033
__hostdev__ Vec3T indexToWorldGrad(const Vec3T &grad) const
Definition NanoVDB.h:2101
__hostdev__ bool hasLongGridName() const
Definition NanoVDB.h:2152
__hostdev__ Vec3T indexToWorldGradF(const Vec3T &grad) const
Definition NanoVDB.h:2124
__hostdev__ bool hasBBox() const
Definition NanoVDB.h:2151
__hostdev__ util::enable_if< BuildTraits< T >::is_index, constuint64_t & >::type valueCount() const
Definition NanoVDB.h:2056
__hostdev__ Vec3T indexToWorldDirF(const Vec3T &dir) const
Definition NanoVDB.h:2114
__hostdev__ const char * shortGridName() const
Definition NanoVDB.h:2174
__hostdev__ const char * gridName() const
Definition NanoVDB.h:2171
__hostdev__ bool isMask() const
Definition NanoVDB.h:2148
__hostdev__ const BlindDataT * getBlindData(uint32_t n) const
Definition NanoVDB.h:2204
__hostdev__ uint64_t activeVoxelCount() const
Definition NanoVDB.h:2136
DefaultReadAccessor< BuildType > AccessorType
Definition NanoVDB.h:2024
__hostdev__ bool isBreadthFirst() const
Definition NanoVDB.h:2155
__hostdev__ bool isPointIndex() const
Definition NanoVDB.h:2145
__hostdev__ bool hasAverage() const
Definition NanoVDB.h:2153
__hostdev__ bool isGridIndex() const
Definition NanoVDB.h:2146
__hostdev__ Vec3T indexToWorldDir(const Vec3T &dir) const
Definition NanoVDB.h:2091
__hostdev__ Vec3T indexToWorld(const Vec3T &xyz) const
Definition NanoVDB.h:2086
__hostdev__ bool isLevelSet() const
Definition NanoVDB.h:2142
__hostdev__ uint32_t gridCount() const
Definition NanoVDB.h:2049
__hostdev__ bool isPointData() const
Definition NanoVDB.h:2147
typename UpperNodeType::ChildNodeType LowerNodeType
Definition NanoVDB.h:2018
__hostdev__ AccessorType getAccessor() const
Definition NanoVDB.h:2072
__hostdev__ Vec3T worldToIndex(const Vec3T &xyz) const
Definition NanoVDB.h:2082
__hostdev__ const void * blindData(uint32_t n) const
Definition NanoVDB.h:2196
__hostdev__ const DataType * data() const
Definition NanoVDB.h:2037
__hostdev__ bool isStaggered() const
Definition NanoVDB.h:2144
__hostdev__ Vec3T worldToIndexDirF(const Vec3T &dir) const
Definition NanoVDB.h:2119
__hostdev__ Vec3T indexToWorldF(const Vec3T &xyz) const
Definition NanoVDB.h:2109
__hostdev__ const Vec3d & voxelSize() const
Definition NanoVDB.h:2075
TreeT TreeType
Definition NanoVDB.h:2014
Grid(const Grid &)=delete
Disallow constructions, copy and assignment.
typename TreeT::BuildType BuildType
Definition NanoVDB.h:2022
Grid & operator=(const Grid &)=delete
__hostdev__ bool isFogVolume() const
Definition NanoVDB.h:2143
__hostdev__ bool isSequential() const
Definition NanoVDB.h:2160
__hostdev__ int findBlindDataForSemantic(GridBlindDataSemantic semantic) const
__hostdev__ NanoTree< BuildT > & tree()
Definition NanoVDB.h:2069
Dummy type for a 16 bit floating point values (placeholder for IEEE 754 Half)
Definition NanoVDB.h:188
Visits child nodes of this node only.
Definition NanoVDB.h:3301
__hostdev__ NodeT & operator*() const
Definition NanoVDB.h:3319
__hostdev__ ChildIter(ParentT *parent)
Definition NanoVDB.h:3313
ChildIter & operator=(const ChildIter &)=default
__hostdev__ CoordType getOrigin() const
Definition NanoVDB.h:3329
__hostdev__ NodeT * operator->() const
Definition NanoVDB.h:3324
__hostdev__ CoordType getCoord() const
Definition NanoVDB.h:3334
__hostdev__ ChildIter()
Definition NanoVDB.h:3308
DenseIterator & operator=(const DenseIterator &)=default
__hostdev__ DenseIterator(const InternalNode *parent)
Definition NanoVDB.h:3428
__hostdev__ CoordType getOrigin() const
Definition NanoVDB.h:3450
__hostdev__ const ChildT * probeChild(ValueType &value) const
Definition NanoVDB.h:3434
__hostdev__ bool isValueOn() const
Definition NanoVDB.h:3445
__hostdev__ DenseIterator()
Definition NanoVDB.h:3423
__hostdev__ CoordType getCoord() const
Definition NanoVDB.h:3455
ValueIterator & operator=(const ValueIterator &)=default
__hostdev__ ValueIterator(const InternalNode *parent)
Definition NanoVDB.h:3355
__hostdev__ ValueIterator()
Definition NanoVDB.h:3350
__hostdev__ CoordType getOrigin() const
Definition NanoVDB.h:3366
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:3361
__hostdev__ CoordType getCoord() const
Definition NanoVDB.h:3371
__hostdev__ bool isActive() const
Definition NanoVDB.h:3372
__hostdev__ ValueOnIterator(const InternalNode *parent)
Definition NanoVDB.h:3394
__hostdev__ ValueOnIterator()
Definition NanoVDB.h:3389
__hostdev__ CoordType getOrigin() const
Definition NanoVDB.h:3405
ValueOnIterator & operator=(const ValueOnIterator &)=default
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:3400
__hostdev__ CoordType getCoord() const
Definition NanoVDB.h:3410
Internal nodes of a VDB tree.
Definition NanoVDB.h:3275
__hostdev__ const MaskType< LOG2DIM > & childMask() const
Definition NanoVDB.h:3482
__hostdev__ const FloatType & stdDeviation() const
Definition NanoVDB.h:3501
__hostdev__ const ValueType & minimum() const
Definition NanoVDB.h:3489
__hostdev__ ConstChildIterator cbeginChild() const
Definition NanoVDB.h:3341
__hostdev__ const ChildNodeType * probeChild(const CoordType &ijk) const
Definition NanoVDB.h:3561
__hostdev__ const ValueType & maximum() const
Definition NanoVDB.h:3492
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3284
__hostdev__ DenseIterator beginDense() const
Definition NanoVDB.h:3458
__hostdev__ DataType * data()
Definition NanoVDB.h:3467
ChildIter< const InternalNode > ConstChildIterator
Definition NanoVDB.h:3338
__hostdev__ DenseIterator cbeginChildAll() const
Definition NanoVDB.h:3459
InternalData< ChildT, Log2Dim > DataType
Definition NanoVDB.h:3277
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:3523
static __hostdev__ Coord OffsetToLocalCoord(uint32_t n)
Definition NanoVDB.h:3576
__hostdev__ ChildNodeType * probeChild(const CoordType &ijk)
Definition NanoVDB.h:3556
friend class ReadAccessor
Definition NanoVDB.h:3624
static constexpr uint32_t MASK
Definition NanoVDB.h:3294
static __hostdev__ uint32_t dim()
Definition NanoVDB.h:3472
typename ChildT::CoordType CoordType
Definition NanoVDB.h:3283
static constexpr uint32_t LEVEL
Definition NanoVDB.h:3295
__hostdev__ const MaskType< LOG2DIM > & getValueMask() const
Definition NanoVDB.h:3479
__hostdev__ FloatType variance() const
Definition NanoVDB.h:3498
__hostdev__ ValueIterator cbeginValueAll() const
Definition NanoVDB.h:3380
friend class InternalNode
Definition NanoVDB.h:3629
static constexpr uint32_t DIM
Definition NanoVDB.h:3292
typename DataType::BuildT BuildType
Definition NanoVDB.h:3280
__hostdev__ void localToGlobalCoord(Coord &ijk) const
Definition NanoVDB.h:3584
typename Mask< Log2Dim >::template Iterator< On > MaskIterT
Definition NanoVDB.h:3288
__hostdev__ ValueType getFirstValue() const
Definition NanoVDB.h:3508
ChildT ChildNodeType
Definition NanoVDB.h:3282
typename DataType::ValueT ValueType
Definition NanoVDB.h:3278
typename DataType::StatsT FloatType
Definition NanoVDB.h:3279
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:3525
__hostdev__ ValueOnIterator beginValueOn() const
Definition NanoVDB.h:3413
__hostdev__ CoordType origin() const
Definition NanoVDB.h:3486
typename ChildT::LeafNodeType LeafNodeType
Definition NanoVDB.h:3281
static constexpr uint32_t TOTAL
Definition NanoVDB.h:3291
__hostdev__ auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:3601
ChildIter< InternalNode > ChildIterator
Definition NanoVDB.h:3337
__hostdev__ ValueOnIterator cbeginValueOn() const
Definition NanoVDB.h:3414
static constexpr uint32_t LOG2DIM
Definition NanoVDB.h:3290
__hostdev__ ValueType getLastValue() const
Definition NanoVDB.h:3515
__hostdev__ const math::BBox< CoordType > & bbox() const
Definition NanoVDB.h:3504
__hostdev__ decltype(OpT::set(util::declval< InternalNode & >(), util::declval< uint32_t >(), util::declval< ArgsT >()...)) set(const CoordType &ijk, ArgsT &&... args)
Definition NanoVDB.h:3612
__hostdev__ const MaskType< LOG2DIM > & getChildMask() const
Definition NanoVDB.h:3483
__hostdev__ ValueIterator beginValue() const
Definition NanoVDB.h:3379
static __hostdev__ uint32_t CoordToOffset(const CoordType &ijk)
Definition NanoVDB.h:3568
__hostdev__ Coord offsetToGlobalCoord(uint32_t n) const
Definition NanoVDB.h:3590
static constexpr uint32_t SIZE
Definition NanoVDB.h:3293
typename ChildT::template MaskType< LOG2 > MaskType
Definition NanoVDB.h:3286
__hostdev__ const LeafNodeType * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:3526
__hostdev__ ChildIterator beginChild()
Definition NanoVDB.h:3340
__hostdev__ const MaskType< LOG2DIM > & valueMask() const
Definition NanoVDB.h:3478
__hostdev__ const DataType * data() const
Definition NanoVDB.h:3469
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:3522
__hostdev__ const FloatType & average() const
Definition NanoVDB.h:3495
static constexpr uint64_t NUM_VALUES
Definition NanoVDB.h:3296
InternalNode & operator=(const InternalNode &)=delete
InternalNode(const InternalNode &)=delete
__hostdev__ bool isActive() const
Definition NanoVDB.h:3598
friend class RootNode
Definition NanoVDB.h:3627
static __hostdev__ size_t memUsage()
Definition NanoVDB.h:3475
ValueIterator & operator=(const ValueIterator &)=default
__hostdev__ CoordT getCoord() const
Definition NanoVDB.h:4438
__hostdev__ ValueIterator(const LeafNode *parent)
Definition NanoVDB.h:4426
__hostdev__ ValueIterator()
Definition NanoVDB.h:4421
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:4433
__hostdev__ ValueIterator & operator++()
Definition NanoVDB.h:4449
__hostdev__ ValueIterator operator++(int)
Definition NanoVDB.h:4454
__hostdev__ bool isActive() const
Definition NanoVDB.h:4443
__hostdev__ CoordT getCoord() const
Definition NanoVDB.h:4404
__hostdev__ ValueOffIterator()
Definition NanoVDB.h:4388
ValueOffIterator & operator=(const ValueOffIterator &)=default
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:4399
__hostdev__ ValueOffIterator(const LeafNode *parent)
Definition NanoVDB.h:4393
__hostdev__ ValueOnIterator()
Definition NanoVDB.h:4355
__hostdev__ CoordT getCoord() const
Definition NanoVDB.h:4371
__hostdev__ ValueOnIterator(const LeafNode *parent)
Definition NanoVDB.h:4360
ValueOnIterator & operator=(const ValueOnIterator &)=default
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:4366
Leaf nodes of the VDB tree. (defaults to 8x8x8 = 512 voxels)
Definition NanoVDB.h:4328
__hostdev__ void setValueOnly(uint32_t offset, const ValueType &v)
Sets the value at the specified location but leaves its state unchanged.
Definition NanoVDB.h:4570
__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:4495
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4342
__hostdev__ DataType * data()
Definition NanoVDB.h:4474
typename DataType::BuildType BuildType
Definition NanoVDB.h:4340
static __hostdev__ CoordT OffsetToLocalCoord(uint32_t n)
Compute the local coordinates from a linear offset.
Definition NanoVDB.h:4505
static __hostdev__ uint32_t padding()
Definition NanoVDB.h:4540
LeafData< BuildT, CoordT, MaskT, Log2Dim > DataType
Definition NanoVDB.h:4337
CoordT CoordType
Definition NanoVDB.h:4341
friend class ReadAccessor
Definition NanoVDB.h:4640
static constexpr uint32_t MASK
Definition NanoVDB.h:4470
__hostdev__ CoordT offsetToGlobalCoord(uint32_t n) const
Definition NanoVDB.h:4515
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:4521
LeafNode< BuildT, CoordT, MaskT, Log2Dim > LeafNodeType
Definition NanoVDB.h:4336
static constexpr uint32_t LEVEL
Definition NanoVDB.h:4471
__hostdev__ const MaskType< LOG2DIM > & getValueMask() const
Definition NanoVDB.h:4480
__hostdev__ FloatType variance() const
Return the variance of all the active values encoded in this leaf node.
Definition NanoVDB.h:4492
__hostdev__ auto set(const uint32_t n, ArgsT &&... args)
Definition NanoVDB.h:4631
LeafNode & operator=(const LeafNode &)=delete
__hostdev__ CoordT origin() const
Return the origin in index space of this leaf node.
Definition NanoVDB.h:4500
__hostdev__ ValueIterator cbeginValueAll() const
Definition NanoVDB.h:4463
friend class InternalNode
Definition NanoVDB.h:4645
static constexpr uint32_t DIM
Definition NanoVDB.h:4468
__hostdev__ const LeafNode * probeLeaf(const CoordT &) const
Definition NanoVDB.h:4595
__hostdev__ ValueOffIterator cbeginValueOff() const
Definition NanoVDB.h:4412
__hostdev__ void localToGlobalCoord(Coord &ijk) const
Converts (in place) a local index coordinate to a global index coordinate.
Definition NanoVDB.h:4513
typename DataType::FloatType FloatType
Definition NanoVDB.h:4339
__hostdev__ ValueType getFirstValue() const
Return the first value in this leaf node.
Definition NanoVDB.h:4558
static __hostdev__ uint32_t CoordToOffset(const CoordT &ijk)
Definition NanoVDB.h:4598
typename Mask< Log2Dim >::template Iterator< ON > MaskIterT
Definition NanoVDB.h:4346
__hostdev__ void setValueOnly(const CoordT &ijk, const ValueType &v)
Definition NanoVDB.h:4571
__hostdev__ FloatType average() const
Return a const reference to the average of all the active values encoded in this leaf node.
Definition NanoVDB.h:4489
__hostdev__ math::BBox< CoordT > bbox() const
Return the bounding box in index space of active values in this leaf node.
Definition NanoVDB.h:4524
__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:4588
__hostdev__ uint8_t flags() const
Definition NanoVDB.h:4497
__hostdev__ bool hasBBox() const
Definition NanoVDB.h:4585
__hostdev__ auto set(const CoordType &ijk, ArgsT &&... args)
Definition NanoVDB.h:4625
__hostdev__ ValueOffIterator beginValueOff() const
Definition NanoVDB.h:4411
__hostdev__ ValueOnIterator beginValueOn() const
Definition NanoVDB.h:4378
static constexpr uint32_t TOTAL
Definition NanoVDB.h:4467
__hostdev__ void setValue(const CoordT &ijk, const ValueType &v)
Sets the value at the specified location and activate its state.
Definition NanoVDB.h:4565
__hostdev__ bool isActive(const CoordT &ijk) const
Return true if the voxel value at the given coordinate is active.
Definition NanoVDB.h:4574
__hostdev__ ValueType minimum() const
Return a const reference to the minimum active value encoded in this leaf node.
Definition NanoVDB.h:4483
__hostdev__ auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:4613
__hostdev__ ValueOnIterator cbeginValueOn() const
Definition NanoVDB.h:4379
MaskT< LOG2 > MaskType
Definition NanoVDB.h:4344
__hostdev__ ValueType maximum() const
Return a const reference to the maximum active value encoded in this leaf node.
Definition NanoVDB.h:4486
static constexpr uint32_t LOG2DIM
Definition NanoVDB.h:4466
__hostdev__ ValueType getLastValue() const
Return the last value in this leaf node.
Definition NanoVDB.h:4560
__hostdev__ bool isActive(uint32_t n) const
Definition NanoVDB.h:4575
LeafNode(const LeafNode &)=delete
__hostdev__ ValueType getValue(const CoordT &ijk) const
Return the voxel value at the given coordinate.
Definition NanoVDB.h:4555
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:4701
__hostdev__ ValueIterator beginValue() const
Definition NanoVDB.h:4462
__hostdev__ uint64_t memUsage() const
return memory usage in bytes for the leaf node
Definition NanoVDB.h:4543
static constexpr uint32_t SIZE
Definition NanoVDB.h:4469
typename DataType::ValueType ValueType
Definition NanoVDB.h:4338
__hostdev__ auto get(const uint32_t n, ArgsT &&... args) const
Definition NanoVDB.h:4619
__hostdev__ ValueType getValue(uint32_t offset) const
Return the voxel value at the given offset.
Definition NanoVDB.h:4552
__hostdev__ const MaskType< LOG2DIM > & valueMask() const
Return a const reference to the bit mask of active voxels in this leaf node.
Definition NanoVDB.h:4479
__hostdev__ const DataType * data() const
Definition NanoVDB.h:4476
static constexpr uint64_t NUM_VALUES
Definition NanoVDB.h:4472
static __hostdev__ uint32_t voxelCount()
Return the total number of voxels (e.g. values) encoded in this leaf node.
Definition NanoVDB.h:4538
__hostdev__ bool isActive() const
Return true if any of the voxel value are active in this leaf node.
Definition NanoVDB.h:4578
friend class RootNode
Definition NanoVDB.h:4643
Definition NanoVDB.h:1103
DenseIterator & operator=(const DenseIterator &)=default
__hostdev__ DenseIterator & operator++()
Definition NanoVDB.h:1113
__hostdev__ DenseIterator operator++(int)
Definition NanoVDB.h:1118
__hostdev__ uint32_t pos() const
Definition NanoVDB.h:1111
__hostdev__ uint32_t operator*() const
Definition NanoVDB.h:1110
__hostdev__ DenseIterator(uint32_t pos=Mask::SIZE)
Definition NanoVDB.h:1105
Definition NanoVDB.h:1069
__hostdev__ Iterator operator++(int)
Definition NanoVDB.h:1090
__hostdev__ Iterator()
Definition NanoVDB.h:1071
Iterator & operator=(const Iterator &)=default
__hostdev__ uint32_t pos() const
Definition NanoVDB.h:1083
__hostdev__ uint32_t operator*() const
Definition NanoVDB.h:1082
__hostdev__ Iterator & operator++()
Definition NanoVDB.h:1085
__hostdev__ Iterator(uint32_t pos, const Mask *parent)
Definition NanoVDB.h:1076
Bit-mask to encode active states and facilitate sequential iterators and a fast codec for I/O compres...
Definition NanoVDB.h:1035
__hostdev__ Mask(const Mask &other)
Copy constructor.
Definition NanoVDB.h:1152
__hostdev__ bool isOff(uint32_t n) const
Return true if the given bit is NOT set.
Definition NanoVDB.h:1193
__hostdev__ void set(uint32_t n, bool on)
Set the specified bit on or off.
Definition NanoVDB.h:1233
__hostdev__ void setOn()
Set all bits on.
Definition NanoVDB.h:1246
__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:1059
NANOVDB_HOSTDEV_DISABLE_WARNING __hostdev__ uint32_t findNext(uint32_t start) const
Definition NanoVDB.h:1316
__hostdev__ uint32_t countOn() const
Return the total number of set bits in this Mask.
Definition NanoVDB.h:1050
__hostdev__ uint64_t * words()
Return a pointer to the list of words of the bit mask.
Definition NanoVDB.h:1159
__hostdev__ Mask(bool on)
Definition NanoVDB.h:1144
__hostdev__ DenseIterator beginAll() const
Definition NanoVDB.h:1136
__hostdev__ void setOff(uint32_t n)
Set the specified bit off.
Definition NanoVDB.h:1216
__hostdev__ void setOff()
Set all bits off.
Definition NanoVDB.h:1252
Iterator< false > OffIterator
Definition NanoVDB.h:1130
Mask & operator=(const Mask &)=default
__hostdev__ Mask()
Initialize all bits to zero.
Definition NanoVDB.h:1139
__hostdev__ Mask & operator&=(const Mask &other)
Bitwise intersection.
Definition NanoVDB.h:1272
Iterator< true > OnIterator
Definition NanoVDB.h:1129
__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:1164
__hostdev__ void toggle(uint32_t n)
Definition NanoVDB.h:1269
__hostdev__ bool operator!=(const Mask &other) const
Definition NanoVDB.h:1187
__hostdev__ bool isOff() const
Return true if none of the bits are set in this Mask.
Definition NanoVDB.h:1205
static constexpr uint32_t WORD_COUNT
Definition NanoVDB.h:1038
__hostdev__ OffIterator beginOff() const
Definition NanoVDB.h:1134
__hostdev__ void toggle()
brief Toggle the state of all bits in the mask
Definition NanoVDB.h:1264
__hostdev__ const uint64_t * words() const
Definition NanoVDB.h:1160
__hostdev__ void set(bool on)
Set all bits off.
Definition NanoVDB.h:1258
__hostdev__ OnIterator beginOn() const
Definition NanoVDB.h:1132
static __hostdev__ uint32_t wordCount()
Return the number of machine words used by this Mask.
Definition NanoVDB.h:1047
static __hostdev__ uint32_t bitCount()
Return the number of bits available in this Mask.
Definition NanoVDB.h:1044
__hostdev__ Mask & operator|=(const Mask &other)
Bitwise union.
Definition NanoVDB.h:1280
__hostdev__ bool operator==(const Mask &other) const
Definition NanoVDB.h:1178
NANOVDB_HOSTDEV_DISABLE_WARNING __hostdev__ uint32_t findPrev(uint32_t start) const
Definition NanoVDB.h:1330
__hostdev__ bool isOn(uint32_t n) const
Return true if the given bit is set.
Definition NanoVDB.h:1190
static constexpr uint32_t SIZE
Definition NanoVDB.h:1037
__hostdev__ bool isOn() const
Return true if all the bits are set in this Mask.
Definition NanoVDB.h:1196
NANOVDB_HOSTDEV_DISABLE_WARNING __hostdev__ uint32_t findFirst() const
Definition NanoVDB.h:1306
__hostdev__ Mask & operator-=(const Mask &other)
Bitwise difference.
Definition NanoVDB.h:1288
__hostdev__ Mask & operator^=(const Mask &other)
Bitwise XOR.
Definition NanoVDB.h:1296
__hostdev__ void setOn(uint32_t n)
Set the specified bit on.
Definition NanoVDB.h:1214
static __hostdev__ size_t memUsage()
Return the memory footprint in bytes of this Mask.
Definition NanoVDB.h:1041
__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:6089
PointAccessor(const NanoGrid< Point > &grid)
Definition NanoVDB.h:6047
__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:6078
__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:6068
__hostdev__ const NanoGrid< Point > & grid() const
Definition NanoVDB.h:6064
__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:6023
__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:6011
__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:6001
__hostdev__ const NanoGrid< BuildT > & grid() const
Definition NanoVDB.h:5997
PointAccessor(const NanoGrid< BuildT > &grid)
Definition NanoVDB.h:5984
Dummy type for indexing points into voxels.
Definition NanoVDB.h:203
__hostdev__ auto set(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:5049
ReadAccessor & operator=(const ReadAccessor &)=default
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:4996
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition NanoVDB.h:4960
friend class InternalNode
Definition NanoVDB.h:5059
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition NanoVDB.h:5038
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:4998
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:4997
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition NanoVDB.h:4994
typename RootT::CoordType CoordType
Definition NanoVDB.h:4943
__hostdev__ auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:5043
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition NanoVDB.h:4995
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition NanoVDB.h:4972
friend class LeafNode
Definition NanoVDB.h:5061
ReadAccessor(const ReadAccessor &)=default
Defaults constructors.
typename RootT::ValueType ValueType
Definition NanoVDB.h:4942
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition NanoVDB.h:4966
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache @node Noop since this template speci...
Definition NanoVDB.h:4979
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:4988
static const int CacheLevels
Definition NanoVDB.h:4945
BuildT BuildType
Definition NanoVDB.h:4941
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition NanoVDB.h:4993
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:4992
__hostdev__ const RootT & root() const
Definition NanoVDB.h:4981
friend class RootNode
Allow nodes to insert themselves into the cache.
Definition NanoVDB.h:5057
__hostdev__ auto set(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:5217
ReadAccessor & operator=(const ReadAccessor &)=default
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:5149
CoordT CoordType
Definition NanoVDB.h:5093
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition NanoVDB.h:5100
friend class InternalNode
Definition NanoVDB.h:5229
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition NanoVDB.h:5201
ValueT ValueType
Definition NanoVDB.h:5092
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:5151
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:5150
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition NanoVDB.h:5147
__hostdev__ auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:5209
__hostdev__ bool isCached(const CoordType &ijk) const
Definition NanoVDB.h:5133
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition NanoVDB.h:5148
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition NanoVDB.h:5114
friend class LeafNode
Definition NanoVDB.h:5231
ReadAccessor(const ReadAccessor &)=default
Defaults constructors.
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition NanoVDB.h:5108
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition NanoVDB.h:5120
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:5141
static const int CacheLevels
Definition NanoVDB.h:5095
BuildT BuildType
Definition NanoVDB.h:5091
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition NanoVDB.h:5146
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:5145
__hostdev__ const RootT & root() const
Definition NanoVDB.h:5126
friend class RootNode
Allow nodes to insert themselves into the cache.
Definition NanoVDB.h:5227
__hostdev__ auto set(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:5500
ReadAccessor & operator=(const ReadAccessor &)=default
__hostdev__ bool isCached1(const CoordType &ijk) const
Definition NanoVDB.h:5352
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:5375
CoordT CoordType
Definition NanoVDB.h:5276
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition NanoVDB.h:5283
friend class InternalNode
Definition NanoVDB.h:5520
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition NanoVDB.h:5468
ValueT ValueType
Definition NanoVDB.h:5275
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:5377
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:5376
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition NanoVDB.h:5373
__hostdev__ auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:5484
__hostdev__ bool isCached2(const CoordType &ijk) const
Definition NanoVDB.h:5358
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition NanoVDB.h:5374
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition NanoVDB.h:5302
friend class LeafNode
Definition NanoVDB.h:5522
ReadAccessor(const ReadAccessor &)=default
Defaults constructors.
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition NanoVDB.h:5296
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition NanoVDB.h:5308
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:5367
static const int CacheLevels
Definition NanoVDB.h:5278
BuildT BuildType
Definition NanoVDB.h:5274
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition NanoVDB.h:5372
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:5371
__hostdev__ const RootT & root() const
Definition NanoVDB.h:5319
friend class RootNode
Allow nodes to insert themselves into the cache.
Definition NanoVDB.h:5518
Definition NanoVDB.h:2001
uint32_t mPos
Definition NanoVDB.h:2664
uint32_t mSize
Definition NanoVDB.h:2664
typename util::match_const< Tile, RootT >::type TileT
Definition NanoVDB.h:2662
__hostdev__ CoordType getOrigin() const
Definition NanoVDB.h:2677
DataT * mData
Definition NanoVDB.h:2663
typename util::match_const< DataType, RootT >::type DataT
Definition NanoVDB.h:2661
__hostdev__ uint32_t pos() const
Definition NanoVDB.h:2674
__hostdev__ BaseIter(DataT *data=nullptr, uint32_t n=0)
Definition NanoVDB.h:2665
__hostdev__ void next()
Definition NanoVDB.h:2675
__hostdev__ TileT * tile() const
Definition NanoVDB.h:2676
__hostdev__ CoordType getCoord() const
Definition NanoVDB.h:2682
Definition NanoVDB.h:2691
__hostdev__ NodeT & operator*() const
Definition NanoVDB.h:2708
__hostdev__ ChildIter operator++(int)
Definition NanoVDB.h:2726
__hostdev__ ChildIter(RootT *parent)
Definition NanoVDB.h:2701
__hostdev__ ChildIter & operator++()
Definition NanoVDB.h:2718
__hostdev__ NodeT * operator->() const
Definition NanoVDB.h:2713
__hostdev__ ChildIter()
Definition NanoVDB.h:2697
Definition NanoVDB.h:2835
__hostdev__ NodeT * probeChild(ValueType &value) const
Definition NanoVDB.h:2849
__hostdev__ DenseIter operator++(int)
Definition NanoVDB.h:2872
__hostdev__ DenseIter & operator++()
Definition NanoVDB.h:2866
__hostdev__ DenseIter()
Definition NanoVDB.h:2840
__hostdev__ DenseIter(RootT *parent)
Definition NanoVDB.h:2844
__hostdev__ bool isValueOn() const
Definition NanoVDB.h:2861
Definition NanoVDB.h:2742
__hostdev__ ValueIter & operator++()
Definition NanoVDB.h:2767
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:2757
__hostdev__ ValueIter operator++(int)
Definition NanoVDB.h:2775
__hostdev__ ValueIter()
Definition NanoVDB.h:2746
__hostdev__ ValueIter(RootT *parent)
Definition NanoVDB.h:2750
__hostdev__ bool isActive() const
Definition NanoVDB.h:2762
Definition NanoVDB.h:2791
__hostdev__ ValueOnIter(RootT *parent)
Definition NanoVDB.h:2799
__hostdev__ ValueOnIter()
Definition NanoVDB.h:2795
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:2806
__hostdev__ ValueOnIter operator++(int)
Definition NanoVDB.h:2819
__hostdev__ ValueOnIter & operator++()
Definition NanoVDB.h:2811
Top-most node of the VDB tree structure.
Definition NanoVDB.h:2636
__hostdev__ const FloatType & stdDeviation() const
Definition NanoVDB.h:2925
__hostdev__ const ValueType & minimum() const
Definition NanoVDB.h:2913
__hostdev__ ConstChildIterator cbeginChild() const
Definition NanoVDB.h:2738
__hostdev__ DenseIterator beginDense()
Definition NanoVDB.h:2883
__hostdev__ const ChildNodeType * probeChild(const CoordType &ijk) const
Definition NanoVDB.h:2990
__hostdev__ const ValueType & maximum() const
Definition NanoVDB.h:2916
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:2653
ChildIter< const RootNode > ConstChildIterator
Definition NanoVDB.h:2735
__hostdev__ DataType * data()
Definition NanoVDB.h:2895
__hostdev__ bool isEmpty() const
Definition NanoVDB.h:2934
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:2940
__hostdev__ ConstValueOnIterator cbeginValueOn() const
Definition NanoVDB.h:2831
__hostdev__ ValueIterator beginValue()
Definition NanoVDB.h:2786
__hostdev__ ChildNodeType * probeChild(const CoordType &ijk)
Definition NanoVDB.h:2996
friend class ReadAccessor
Definition NanoVDB.h:3031
ChildT UpperNodeType
Definition NanoVDB.h:2642
typename ChildT::CoordType CoordType
Definition NanoVDB.h:2649
static constexpr uint32_t LEVEL
Definition NanoVDB.h:2655
__hostdev__ FloatType variance() const
Definition NanoVDB.h:2922
__hostdev__ decltype(OpT::set(util::declval< Tile & >(), util::declval< ArgsT >()...)) set(const CoordType &ijk, ArgsT &&... args)
Definition NanoVDB.h:3016
RootNode & operator=(const RootNode &)=delete
ValueOnIter< RootNode > ValueOnIterator
Definition NanoVDB.h:2827
ValueIter< const RootNode > ConstValueIterator
Definition NanoVDB.h:2784
RootData< ChildT > DataType
Definition NanoVDB.h:2638
__hostdev__ const uint32_t & tileCount() const
Return the number of tiles encoded in this root node.
Definition NanoVDB.h:2909
typename DataType::BuildT BuildType
Definition NanoVDB.h:2647
ValueIter< RootNode > ValueIterator
Definition NanoVDB.h:2783
RootNode(const RootNode &)=delete
ChildT ChildNodeType
Definition NanoVDB.h:2639
typename DataType::ValueT ValueType
Definition NanoVDB.h:2645
__hostdev__ ConstDenseIterator cbeginDense() const
Definition NanoVDB.h:2884
RootType RootNodeType
Definition NanoVDB.h:2641
__hostdev__ ConstValueIterator cbeginValueAll() const
Definition NanoVDB.h:2787
RootNode< ChildT > RootType
Definition NanoVDB.h:2640
typename DataType::StatsT FloatType
Definition NanoVDB.h:2646
__hostdev__ const ValueType & background() const
Definition NanoVDB.h:2906
ChildIter< RootNode > ChildIterator
Definition NanoVDB.h:2734
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:2942
__hostdev__ ValueOnIterator beginValueOn()
Definition NanoVDB.h:2830
friend class Tree
Definition NanoVDB.h:3034
typename ChildT::LeafNodeType LeafNodeType
Definition NanoVDB.h:2644
DefaultReadAccessor< BuildType > AccessorType
Definition NanoVDB.h:2651
math::BBox< CoordType > BBoxType
Definition NanoVDB.h:2650
__hostdev__ auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:3003
ValueOnIter< const RootNode > ConstValueOnIterator
Definition NanoVDB.h:2828
__hostdev__ ConstDenseIterator cbeginChildAll() const
Definition NanoVDB.h:2885
__hostdev__ const BBoxType & bbox() const
Definition NanoVDB.h:2900
typename DataType::Tile Tile
Definition NanoVDB.h:2652
__hostdev__ uint64_t memUsage() const
Definition NanoVDB.h:2931
typename UpperNodeType::ChildNodeType LowerNodeType
Definition NanoVDB.h:2643
__hostdev__ AccessorType getAccessor() const
Definition NanoVDB.h:2893
__hostdev__ const LeafNodeType * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:2943
static __hostdev__ uint64_t memUsage(uint32_t tableSize)
Definition NanoVDB.h:2928
__hostdev__ ChildIterator beginChild()
Definition NanoVDB.h:2737
__hostdev__ const DataType * data() const
Definition NanoVDB.h:2897
RootNode()=delete
This class cannot be constructed or deleted.
__hostdev__ const uint32_t & getTableSize() const
Definition NanoVDB.h:2910
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:2938
__hostdev__ const FloatType & average() const
Definition NanoVDB.h:2919
DenseIter< const RootNode > ConstDenseIterator
Definition NanoVDB.h:2881
DenseIter< RootNode > DenseIterator
Definition NanoVDB.h:2880
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:2939
VDB Tree, which is a thin wrapper around a RootNode.
Definition NanoVDB.h:2308
typename RootT::ChildNodeType Node2
Definition NanoVDB.h:2327
__hostdev__ const NodeT * getFirstNode() const
Definition NanoVDB.h:2418
typename RootType::LeafNodeType LeafNodeType
Definition NanoVDB.h:2320
__hostdev__ DataType * data()
Definition NanoVDB.h:2337
RootT Node3
Definition NanoVDB.h:2326
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:2355
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:2342
__hostdev__ const NodeTrait< NanoRoot< BuildT >, 2 >::type * getFirstUpper() const
Definition NanoVDB.h:2448
__hostdev__ NanoRoot< BuildT > & root()
Definition NanoVDB.h:2344
__hostdev__ NodeTrait< NanoRoot< BuildT >, 1 >::type * getFirstLower()
Definition NanoVDB.h:2445
__hostdev__ uint32_t nodeCount() const
Definition NanoVDB.h:2387
typename RootNodeType::ChildNodeType UpperNodeType
Definition NanoVDB.h:2318
__hostdev__ LeafNodeType * getFirstLeaf()
Definition NanoVDB.h:2443
Tree()=delete
This class cannot be constructed or deleted.
__hostdev__ const LeafNodeType * getFirstLeaf() const
Definition NanoVDB.h:2444
__hostdev__ const ValueType & background() const
Definition NanoVDB.h:2364
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:2361
__hostdev__ auto set(const CoordType &ijk, ArgsT &&... args)
Definition NanoVDB.h:2457
RootT RootNodeType
Definition NanoVDB.h:2317
typename RootT::CoordType CoordType
Definition NanoVDB.h:2323
__hostdev__ uint64_t activeVoxelCount() const
Definition NanoVDB.h:2373
DefaultReadAccessor< BuildType > AccessorType
Definition NanoVDB.h:2324
__hostdev__ auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:2451
Tree(const Tree &)=delete
LeafNodeType Node0
Definition NanoVDB.h:2329
__hostdev__ NodeTrait< NanoRoot< BuildT >, LEVEL >::type * getFirstNode()
Definition NanoVDB.h:2428
__hostdev__ NodeT * getFirstNode()
Definition NanoVDB.h:2408
typename Node2::ChildNodeType Node1
Definition NanoVDB.h:2328
__hostdev__ uint32_t totalNodeCount() const
Definition NanoVDB.h:2399
RootT RootType
Definition NanoVDB.h:2316
__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:2446
typename UpperNodeType::ChildNodeType LowerNodeType
Definition NanoVDB.h:2319
__hostdev__ AccessorType getAccessor() const
Definition NanoVDB.h:2348
typename RootT::ValueType ValueType
Definition NanoVDB.h:2321
__hostdev__ const NodeTrait< NanoRoot< BuildT >, LEVEL >::type * getFirstNode() const
Definition NanoVDB.h:2437
__hostdev__ uint32_t nodeCount(int level) const
Definition NanoVDB.h:2393
__hostdev__ const uint32_t & activeTileCount(uint32_t level) const
Definition NanoVDB.h:2380
TreeData DataType
Definition NanoVDB.h:2315
__hostdev__ const DataType * data() const
Definition NanoVDB.h:2339
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:2351
__hostdev__ NodeTrait< NanoRoot< BuildT >, 2 >::type * getFirstUpper()
Definition NanoVDB.h:2447
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:2352
__hostdev__ const NanoRoot< BuildT > & root() const
Definition NanoVDB.h:2346
typename RootT::BuildType BuildType
Definition NanoVDB.h:2322
Like ValueIndex but with a mutable mask.
Definition NanoVDB.h:179
Dummy type for a voxel whose value equals an offset into an external value array.
Definition NanoVDB.h:173
Dummy type for a voxel whose value equals its binary active state.
Definition NanoVDB.h:185
Like ValueOnIndex but with a mutable mask.
Definition NanoVDB.h:182
Dummy type for a voxel whose value equals an offset into an external value array of active values.
Definition NanoVDB.h:176
Bit-compacted representation of all three version numbers.
Definition NanoVDB.h:679
__hostdev__ Version(uint32_t major, uint32_t minor, uint32_t patch)
Constructor from major.minor.patch version numbers.
Definition NanoVDB.h:693
__hostdev__ uint32_t getMajor() const
Definition NanoVDB.h:706
__hostdev__ Version()
Default constructor.
Definition NanoVDB.h:684
static constexpr uint32_t End
Definition NanoVDB.h:682
__hostdev__ bool operator<=(const Version &rhs) const
Definition NanoVDB.h:702
__hostdev__ bool operator==(const Version &rhs) const
Definition NanoVDB.h:700
__hostdev__ Version(uint32_t data)
Constructor from a raw uint32_t data representation.
Definition NanoVDB.h:691
__hostdev__ int age() const
Returns the difference between major version of this instance and NANOVDB_MAJOR_VERSION_NUMBER.
Definition NanoVDB.h:713
__hostdev__ bool isCompatible() const
Definition NanoVDB.h:709
__hostdev__ bool operator>(const Version &rhs) const
Definition NanoVDB.h:703
__hostdev__ uint32_t getMinor() const
Definition NanoVDB.h:707
__hostdev__ bool operator>=(const Version &rhs) const
Definition NanoVDB.h:704
__hostdev__ bool operator<(const Version &rhs) const
Definition NanoVDB.h:701
__hostdev__ uint32_t id() const
Definition NanoVDB.h:705
__hostdev__ uint32_t getPatch() const
Definition NanoVDB.h:708
static constexpr uint32_t StrLen
Definition NanoVDB.h:682
Definition NanoVDB.h:6216
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:6318
__hostdev__ Codec toCodec(const char *str)
Definition NanoVDB.h:6240
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:6375
__hostdev__ const char * toStr(char *dst, Codec codec)
Definition NanoVDB.h:6230
Codec
Define compression codecs.
Definition NanoVDB.h:6224
@ StrLen
Definition NanoVDB.h:6228
@ ZIP
Definition NanoVDB.h:6225
@ End
Definition NanoVDB.h:6227
@ BLOSC
Definition NanoVDB.h:6226
@ NONE
Definition NanoVDB.h:6224
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:6347
size_t strlen(const char *str)
length of a c-sting, excluding '\0'.
Definition Util.h:153
uint32_t countOn(uint64_t v)
Definition Util.h:622
uint32_t findHighestOn(uint32_t v)
Returns the index of the highest, i.e. most significant, on bit in the specified 32 bit word.
Definition Util.h:572
char * strncpy(char *dst, const char *src, size_t max)
Copies the first num characters of src to dst. If the end of the source C string (which is signaled b...
Definition Util.h:185
bool streq(const char *lhs, const char *rhs)
Test if two null-terminated byte strings are the same.
Definition Util.h:268
static DstT * PtrAdd(void *p, int64_t offset)
Adds a byte offset to a non-const pointer to produce another non-const pointer.
Definition Util.h:478
char * strcpy(char *dst, const char *src)
Copy characters from src to dst.
Definition Util.h:166
uint32_t findLowestOn(uint32_t v)
Returns the index of the lowest, i.e. least significant, on bit in the specified 32 bit word.
Definition Util.h:502
static int64_t PtrDiff(const void *p, const void *q)
Compute the distance, in bytes, between two pointers, dist = p - q.
Definition Util.h:464
char * sprint(char *dst, T var1, Types... var2)
prints a variable number of string and/or numbers to a destination string
Definition Util.h:286
T && declval() noexcept
Minimal implementation of std::declval, which converts any type T to.
Definition GridHandle.h:27
__hostdev__ bool isFloatingPoint(GridType gridType)
return true if the GridType maps to a floating point type
Definition NanoVDB.h:563
Grid< Fp4Tree > Fp4Grid
Definition NanoVDB.h:4804
ReadAccessor< BuildT, 0, 1, 2 > DefaultReadAccessor
Definition NanoVDB.h:2004
PointType
Definition NanoVDB.h:401
@ Voxel32
Definition NanoVDB.h:407
@ Grid32
Definition NanoVDB.h:406
@ Voxel8
Definition NanoVDB.h:409
@ Default
Definition NanoVDB.h:410
@ PointID
Definition NanoVDB.h:402
@ World32
Definition NanoVDB.h:404
@ Disable
Definition NanoVDB.h:401
@ Voxel16
Definition NanoVDB.h:408
@ World64
Definition NanoVDB.h:403
@ Grid64
Definition NanoVDB.h:405
auto callNanoGrid(GridDataT *gridData, ArgsT &&... args)
Below is an example of the struct used for generic programming with callNanoGrid.
Definition NanoVDB.h:4855
__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:4814
Grid< NanoTree< BuildT > > NanoGrid
Definition NanoVDB.h:4750
__hostdev__ CheckMode toCheckMode(const Checksum &checksum)
Maps 64 bit checksum to CheckMode enum.
Definition NanoVDB.h:1782
Grid< OnIndexMaskTree > OnIndexMaskGrid
Definition NanoVDB.h:4823
__hostdev__ GridType toGridType()
Maps from a templated build type to a GridType enum.
Definition NanoVDB.h:812
__hostdev__ char * toStr(char *dst, GridType gridType)
Maps a GridType to a c-string.
Definition NanoVDB.h:253
NanoTree< Vec3i > Vec3ITree
Definition NanoVDB.h:4795
Grid< Fp16Tree > Fp16Grid
Definition NanoVDB.h:4806
Grid< FloatTree > FloatGrid
Definition NanoVDB.h:4803
Grid< Vec3fTree > Vec3fGrid
Definition NanoVDB.h:4812
__hostdev__ bool isInteger(GridType gridType)
Return true if the GridType maps to a POD integer type.
Definition NanoVDB.h:589
InternalNode< NanoLeaf< BuildT >, 4 > NanoLower
Definition NanoVDB.h:4742
Grid< Vec4dTree > Vec4dGrid
Definition NanoVDB.h:4815
__hostdev__ MagicType toMagic(uint64_t magic)
maps 64 bits of magic number to enum
Definition NanoVDB.h:368
Grid< BoolTree > BoolGrid
Definition NanoVDB.h:4818
InternalNode< NanoLower< BuildT >, 5 > NanoUpper
Definition NanoVDB.h:4744
GridClass
Classes (superset of OpenVDB) that are currently supported by NanoVDB.
Definition NanoVDB.h:290
@ FogVolume
Definition NanoVDB.h:292
@ TensorGrid
Definition NanoVDB.h:299
@ VoxelVolume
Definition NanoVDB.h:297
@ End
Definition NanoVDB.h:300
@ Unknown
Definition NanoVDB.h:290
@ Topology
Definition NanoVDB.h:296
@ PointIndex
Definition NanoVDB.h:294
@ IndexGrid
Definition NanoVDB.h:298
@ PointData
Definition NanoVDB.h:295
@ Staggered
Definition NanoVDB.h:293
@ LevelSet
Definition NanoVDB.h:291
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
@ OnIndexMask
Definition NanoVDB.h:241
@ Vec3u16
Definition NanoVDB.h:244
@ Vec4d
Definition NanoVDB.h:237
@ IndexMask
Definition NanoVDB.h:240
@ 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:1680
@ Partial
Definition NanoVDB.h:1683
@ Full
Definition NanoVDB.h:1685
@ Disable
Definition NanoVDB.h:1680
@ Half
Definition NanoVDB.h:1682
@ Empty
Definition NanoVDB.h:1681
Grid< Vec3dTree > Vec3dGrid
Definition NanoVDB.h:4813
Grid< Point > PointGrid
Definition NanoVDB.h:4819
NanoTree< ValueOnIndexMask > OnIndexMaskTree
Definition NanoVDB.h:4801
RootNode< NanoUpper< BuildT > > NanoRoot
Definition NanoVDB.h:4746
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:5871
NanoTree< ValueMask > MaskTree
Definition NanoVDB.h:4796
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:4821
Grid< Vec3ITree > Vec3IGrid
Definition NanoVDB.h:4816
Grid< Fp8Tree > Fp8Grid
Definition NanoVDB.h:4805
Grid< Int64Tree > Int64Grid
Definition NanoVDB.h:4811
Tree< NanoRoot< BuildT > > NanoTree
Definition NanoVDB.h:4748
__hostdev__ GridType mapToGridType()
Definition NanoVDB.h:872
NanoTree< int32_t > Int32Tree
Definition NanoVDB.h:4788
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:4740
NanoTree< ValueOnIndex > OnIndexTree
Definition NanoVDB.h:4799
GridBlindDataClass
Blind-data Classes that are currently supported by NanoVDB.
Definition NanoVDB.h:416
@ ChannelArray
Definition NanoVDB.h:420
@ End
Definition NanoVDB.h:421
@ IndexArray
Definition NanoVDB.h:417
@ AttributeArray
Definition NanoVDB.h:418
@ GridName
Definition NanoVDB.h:419
NanoTree< double > DoubleTree
Definition NanoVDB.h:4787
NanoTree< ValueIndex > IndexTree
Definition NanoVDB.h:4798
__hostdev__ bool isFloatingPointVector(GridType gridType)
return true if the GridType maps to a floating point vec3.
Definition NanoVDB.h:577
NanoTree< Vec4d > Vec4dTree
Definition NanoVDB.h:4794
Grid< UInt32Tree > UInt32Grid
Definition NanoVDB.h:4810
NanoTree< Fp8 > Fp8Tree
Definition NanoVDB.h:4784
static __hostdev__ bool isAligned(const void *p)
return true if the specified pointer is 32 byte aligned
Definition NanoVDB.h:547
MagicType
Enums used to identify magic numbers recognized by NanoVDB.
Definition NanoVDB.h:357
@ OpenVDB
Definition NanoVDB.h:358
@ NanoNode
Definition NanoVDB.h:362
@ NanoGrid
Definition NanoVDB.h:360
@ NanoFrag
Definition NanoVDB.h:363
@ Unknown
Definition NanoVDB.h:357
@ NanoVDB
Definition NanoVDB.h:359
@ NanoFile
Definition NanoVDB.h:361
NanoTree< int64_t > Int64Tree
Definition NanoVDB.h:4790
__hostdev__ bool isValid(GridType gridType, GridClass gridClass)
return true if the combination of GridType and GridClass is valid.
Definition NanoVDB.h:613
NanoTree< Vec4f > Vec4fTree
Definition NanoVDB.h:4793
NanoTree< Vec3d > Vec3dTree
Definition NanoVDB.h:4792
NanoTree< Fp16 > Fp16Tree
Definition NanoVDB.h:4785
Grid< MaskTree > MaskGrid
Definition NanoVDB.h:4817
NanoTree< ValueIndexMask > IndexMaskTree
Definition NanoVDB.h:4800
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:550
NanoTree< FpN > FpNTree
Definition NanoVDB.h:4786
__hostdev__ bool isIndex(GridType gridType)
Return true if the GridType maps to a special index type (not a POD integer type).
Definition NanoVDB.h:602
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:558
Grid< IndexTree > IndexGrid
Definition NanoVDB.h:4820
GridBlindDataSemantic
Blind-data Semantics that are currently understood by NanoVDB.
Definition NanoVDB.h:424
@ PointRadius
Definition NanoVDB.h:428
@ PointPosition
Definition NanoVDB.h:425
@ PointColor
Definition NanoVDB.h:426
@ VoxelCoords
Definition NanoVDB.h:433
@ PointVelocity
Definition NanoVDB.h:429
@ End
Definition NanoVDB.h:434
@ Unknown
Definition NanoVDB.h:424
@ GridCoords
Definition NanoVDB.h:432
@ WorldCoords
Definition NanoVDB.h:431
@ PointNormal
Definition NanoVDB.h:427
@ PointId
Definition NanoVDB.h:430
Grid< Int32Tree > Int32Grid
Definition NanoVDB.h:4809
NanoTree< Vec3f > Vec3fTree
Definition NanoVDB.h:4791
NanoTree< bool > BoolTree
Definition NanoVDB.h:4797
NanoTree< uint32_t > UInt32Tree
Definition NanoVDB.h:4789
Grid< IndexMaskTree > IndexMaskGrid
Definition NanoVDB.h:4822
__hostdev__ GridClass mapToGridClass(GridClass defaultClass=GridClass::Unknown)
Definition NanoVDB.h:894
Grid< DoubleTree > DoubleGrid
Definition NanoVDB.h:4808
Grid< FpNTree > FpNGrid
Definition NanoVDB.h:4807
NanoTree< float > FloatTree
Definition NanoVDB.h:4782
NanoTree< Fp4 > Fp4Tree
Definition NanoVDB.h:4783
__hostdev__ GridClass toGridClass(GridClass defaultClass=GridClass::Unknown)
Maps from a templated build type to a GridClass enum.
Definition NanoVDB.h:878
#define NANOVDB_HOSTDEV_DISABLE_WARNING
Definition Util.h:94
#define __hostdev__
Definition Util.h:73
#define NANOVDB_ASSERT(x)
Definition Util.h:50
#define __device__
Definition Util.h:79
uint16_t mFlags
Definition NanoVDB.h:911
uint32_t mFlags
Definition NanoVDB.h:916
uint64_t mFlags
Definition NanoVDB.h:921
uint8_t mFlags
Definition NanoVDB.h:906
float type
Definition NanoVDB.h:527
float Type
Definition NanoVDB.h:526
float type
Definition NanoVDB.h:513
float Type
Definition NanoVDB.h:512
float type
Definition NanoVDB.h:520
float Type
Definition NanoVDB.h:519
float type
Definition NanoVDB.h:534
float Type
Definition NanoVDB.h:533
float type
Definition NanoVDB.h:506
float Type
Definition NanoVDB.h:505
uint64_t Type
Definition NanoVDB.h:540
uint64_t type
Definition NanoVDB.h:541
uint64_t Type
Definition NanoVDB.h:484
uint64_t type
Definition NanoVDB.h:485
uint64_t Type
Definition NanoVDB.h:470
uint64_t type
Definition NanoVDB.h:471
bool Type
Definition NanoVDB.h:498
bool type
Definition NanoVDB.h:499
uint64_t Type
Definition NanoVDB.h:491
uint64_t type
Definition NanoVDB.h:492
uint64_t Type
Definition NanoVDB.h:477
uint64_t type
Definition NanoVDB.h:478
Maps one type (e.g. the build types above) to other (actual) types.
Definition NanoVDB.h:462
T Type
Definition NanoVDB.h:463
T type
Definition NanoVDB.h:464
Define static boolean tests for template build types.
Definition NanoVDB.h:441
static constexpr bool is_indexmask
Definition NanoVDB.h:446
static constexpr bool is_offindex
Definition NanoVDB.h:445
static constexpr bool is_onindex
Definition NanoVDB.h:444
static constexpr bool is_index
Definition NanoVDB.h:443
static constexpr bool is_Fp
Definition NanoVDB.h:450
static constexpr bool is_float
Definition NanoVDB.h:452
static constexpr bool is_special
Definition NanoVDB.h:454
static constexpr bool is_FpX
Definition NanoVDB.h:448
double FloatType
Definition NanoVDB.h:805
double FloatType
Definition NanoVDB.h:763
uint64_t FloatType
Definition NanoVDB.h:781
uint64_t FloatType
Definition NanoVDB.h:775
bool FloatType
Definition NanoVDB.h:799
uint64_t FloatType
Definition NanoVDB.h:793
uint64_t FloatType
Definition NanoVDB.h:787
bool FloatType
Definition NanoVDB.h:769
float FloatType
Definition NanoVDB.h:757
Implements Tree::getDim(math::Coord)
Definition NanoVDB.h:6509
static __hostdev__ uint32_t get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6511
static __hostdev__ uint32_t get(const NanoLeaf< BuildT > &, uint32_t)
Definition NanoVDB.h:6514
static __hostdev__ uint32_t get(const NanoLower< BuildT > &, uint32_t)
Definition NanoVDB.h:6513
static __hostdev__ uint32_t get(const NanoUpper< BuildT > &, uint32_t)
Definition NanoVDB.h:6512
static __hostdev__ uint32_t get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6510
Return the pointer to the leaf node that contains math::Coord. Implements Tree::probeLeaf(math::Coord...
Definition NanoVDB.h:6521
static __hostdev__ const NanoLeaf< BuildT > * get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6523
static __hostdev__ const NanoLeaf< BuildT > * get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6522
static __hostdev__ const NanoLeaf< BuildT > * get(const NanoUpper< BuildT > &, uint32_t)
Definition NanoVDB.h:6524
static __hostdev__ const NanoLeaf< BuildT > * get(const NanoLower< BuildT > &, uint32_t)
Definition NanoVDB.h:6525
static __hostdev__ const NanoLeaf< BuildT > * get(const NanoLeaf< BuildT > &leaf, uint32_t)
Definition NanoVDB.h:6526
Return point to the lower internal node where math::Coord maps to one of its values,...
Definition NanoVDB.h:6533
static __hostdev__ const NanoLower< BuildT > * get(const NanoUpper< BuildT > &, uint32_t)
Definition NanoVDB.h:6536
static __hostdev__ const NanoLower< BuildT > * get(const NanoLeaf< BuildT > &, uint32_t)
Definition NanoVDB.h:6538
static __hostdev__ const NanoLower< BuildT > * get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6534
static __hostdev__ const NanoLower< BuildT > * get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6535
static __hostdev__ const NanoLower< BuildT > * get(const NanoLower< BuildT > &node, uint32_t)
Definition NanoVDB.h:6537
Definition NanoVDB.h:6594
uint32_t level
Definition NanoVDB.h:6595
FloatType average
Definition NanoVDB.h:6597
ValueType maximum
Definition NanoVDB.h:6596
CoordBBox bbox
Definition NanoVDB.h:6598
ValueType minimum
Definition NanoVDB.h:6596
uint32_t dim
Definition NanoVDB.h:6595
FloatType stdDevi
Definition NanoVDB.h:6597
Implements Tree::getNodeInfo(math::Coord)
Definition NanoVDB.h:6590
static __hostdev__ NodeInfo get(const NanoUpper< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6608
static __hostdev__ NodeInfo get(const NanoLeaf< BuildT > &leaf, uint32_t n)
Definition NanoVDB.h:6616
typename NanoLeaf< BuildT >::ValueType ValueType
Definition NanoVDB.h:6591
static __hostdev__ NodeInfo get(const NanoRoot< BuildT > &root)
Definition NanoVDB.h:6600
static __hostdev__ NodeInfo get(const NanoLower< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6612
typename NanoLeaf< BuildT >::FloatType FloatType
Definition NanoVDB.h:6592
static __hostdev__ NodeInfo get(const typename NanoRoot< BuildT >::Tile &tile)
Definition NanoVDB.h:6604
Implements Tree::isActive(math::Coord)
Definition NanoVDB.h:6497
static __hostdev__ auto get(const NanoLeaf< BuildT > &leaf, uint32_t n)
Definition NanoVDB.h:6502
static __hostdev__ auto get(const NanoLower< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6501
static __hostdev__ auto get(const NanoUpper< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6500
static __hostdev__ auto get(const typename NanoRoot< BuildT >::Tile &tile)
Definition NanoVDB.h:6499
static __hostdev__ auto get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6498
Return point to the upper internal node where math::Coord maps to one of its values,...
Definition NanoVDB.h:6545
static __hostdev__ const NanoUpper< BuildT > * get(const NanoUpper< BuildT > &node, uint32_t)
Definition NanoVDB.h:6548
static __hostdev__ const NanoUpper< BuildT > * get(const NanoLower< BuildT > &node, uint32_t)
Definition NanoVDB.h:6549
static __hostdev__ const NanoUpper< BuildT > * get(const NanoLeaf< BuildT > &, uint32_t)
Definition NanoVDB.h:6550
static __hostdev__ const NanoUpper< BuildT > * get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6546
static __hostdev__ const NanoUpper< BuildT > * get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6547
Implements Tree::getValue(math::Coord), i.e. return the value associated with a specific coordinate i...
Definition NanoVDB.h:6461
static __hostdev__ auto get(const NanoRoot< BuildT > &root)
Definition NanoVDB.h:6462
static __hostdev__ auto get(const NanoLeaf< BuildT > &leaf, uint32_t n)
Definition NanoVDB.h:6466
static __hostdev__ auto get(const NanoLower< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6465
static __hostdev__ auto get(const NanoUpper< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6464
static __hostdev__ auto get(const typename NanoRoot< BuildT >::Tile &tile)
Definition NanoVDB.h:6463
Struct with all the member data of the Grid (useful during serialization of an openvdb grid)
Definition NanoVDB.h:1811
__hostdev__ Vec3T applyInverseJacobian(const Vec3T &xyz) const
Definition NanoVDB.h:1896
__hostdev__ bool isEmpty() const
test if the grid is empty, e.i the root table has size 0
Definition NanoVDB.h:1992
__hostdev__ bool isRootConnected() const
return true if RootData follows TreeData in memory without any extra padding
Definition NanoVDB.h:1996
static __hostdev__ uint64_t memUsage()
Return memory usage in bytes for this class only.
Definition NanoVDB.h:1975
uint32_t mBlindMetadataCount
Definition NanoVDB.h:1827
__hostdev__ const void * treePtr() const
Definition NanoVDB.h:1915
Version mVersion
Definition NanoVDB.h:1815
uint32_t mData0
Definition NanoVDB.h:1828
__hostdev__ uint32_t nodeCount() const
Return number of nodes at LEVEL.
Definition NanoVDB.h:1943
GridType mGridType
Definition NanoVDB.h:1825
__hostdev__ void setMinMaxOn(bool on=true)
Definition NanoVDB.h:1877
uint64_t mMagic
Definition NanoVDB.h:1813
__hostdev__ void * nodePtr()
Return a non-const void pointer to the first node at LEVEL.
Definition NanoVDB.h:1932
__hostdev__ Vec3T applyIJTF(const Vec3T &xyz) const
Definition NanoVDB.h:1909
GridClass mGridClass
Definition NanoVDB.h:1824
__hostdev__ void setBBoxOn(bool on=true)
Definition NanoVDB.h:1878
__hostdev__ void setLongGridNameOn(bool on=true)
Definition NanoVDB.h:1879
uint64_t mGridSize
Definition NanoVDB.h:1819
__hostdev__ const GridBlindMetaData * blindMetaData(uint32_t n) const
Returns a const reference to the blindMetaData at the specified linear offset.
Definition NanoVDB.h:1952
__hostdev__ Vec3T applyInverseJacobianF(const Vec3T &xyz) const
Definition NanoVDB.h:1907
__hostdev__ bool isValid() const
return true if the magic number and the version are both valid
Definition NanoVDB.h:1864
__hostdev__ Vec3T applyInverseMapF(const Vec3T &xyz) const
Definition NanoVDB.h:1903
__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:1834
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:1981
Checksum mChecksum
Definition NanoVDB.h:1814
Vec3dBBox mWorldBBox
Definition NanoVDB.h:1822
__hostdev__ uint32_t rootTableSize() const
return the root table has size
Definition NanoVDB.h:1984
__hostdev__ const char * gridName() const
Definition NanoVDB.h:1958
__hostdev__ Vec3T applyIJT(const Vec3T &xyz) const
Definition NanoVDB.h:1898
uint64_t mData1
Definition NanoVDB.h:1829
uint32_t mGridCount
Definition NanoVDB.h:1818
__hostdev__ const void * nodePtr() const
Return a non-const void pointer to the first node at LEVEL.
Definition NanoVDB.h:1920
__hostdev__ void setStdDeviationOn(bool on=true)
Definition NanoVDB.h:1881
__hostdev__ Vec3T applyMap(const Vec3T &xyz) const
Definition NanoVDB.h:1890
uint64_t mData2
Definition NanoVDB.h:1830
__hostdev__ Vec3T applyJacobianF(const Vec3T &xyz) const
Definition NanoVDB.h:1905
__hostdev__ Vec3T applyInverseMap(const Vec3T &xyz) const
Definition NanoVDB.h:1892
Map mMap
Definition NanoVDB.h:1821
__hostdev__ const Vec3dBBox & worldBBox() const
return AABB of active values in world space
Definition NanoVDB.h:1978
__hostdev__ Vec3T applyJacobian(const Vec3T &xyz) const
Definition NanoVDB.h:1894
Vec3d mVoxelSize
Definition NanoVDB.h:1823
BitFlags< 32 > mFlags
Definition NanoVDB.h:1816
char mGridName[MaxNameSize]
Definition NanoVDB.h:1820
int64_t mBlindMetadataOffset
Definition NanoVDB.h:1826
uint32_t mGridIndex
Definition NanoVDB.h:1817
static const int MaxNameSize
Definition NanoVDB.h:1812
__hostdev__ void * treePtr()
Definition NanoVDB.h:1912
__hostdev__ Vec3T applyMapF(const Vec3T &xyz) const
Definition NanoVDB.h:1901
__hostdev__ bool setGridName(const char *src)
Definition NanoVDB.h:1882
__hostdev__ void setAverageOn(bool on=true)
Definition NanoVDB.h:1880
const typename GridT::TreeType Type
Definition NanoVDB.h:2299
const typename GridT::TreeType type
Definition NanoVDB.h:2300
defines a tree type from a grid type while preserving constness
Definition NanoVDB.h:2292
typename GridT::TreeType Type
Definition NanoVDB.h:2293
typename GridT::TreeType type
Definition NanoVDB.h:2294
StatsT mAverage
Definition NanoVDB.h:3191
typename ChildT::CoordType CoordT
Definition NanoVDB.h:3169
__hostdev__ void setMin(const ValueT &v)
Definition NanoVDB.h:3257
__hostdev__ const StatsT & average() const
Definition NanoVDB.h:3250
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3171
__hostdev__ const ValueT & getMin() const
Definition NanoVDB.h:3248
MaskT mChildMask
Definition NanoVDB.h:3187
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:3204
__hostdev__ const ValueT & getMax() const
Definition NanoVDB.h:3249
__hostdev__ void setDev(const StatsT &v)
Definition NanoVDB.h:3260
math::BBox< CoordT > mBBox
Definition NanoVDB.h:3184
InternalData(const InternalData &)=delete
__hostdev__ void setChild(uint32_t n, const void *ptr)
Definition NanoVDB.h:3206
typename ChildT::FloatType StatsT
Definition NanoVDB.h:3168
__hostdev__ void setAvg(const StatsT &v)
Definition NanoVDB.h:3259
__hostdev__ bool isChild(uint32_t n) const
Definition NanoVDB.h:3243
__hostdev__ void setValue(uint32_t n, const ValueT &v)
Definition NanoVDB.h:3213
typename ChildT::BuildType BuildT
Definition NanoVDB.h:3167
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:3198
StatsT mStdDevi
Definition NanoVDB.h:3192
Tile mTable[1u<<(3 *LOG2DIM)]
Definition NanoVDB.h:3202
__hostdev__ void setMax(const ValueT &v)
Definition NanoVDB.h:3258
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:3246
__hostdev__ ChildT * getChild(uint32_t n)
Returns a pointer to the child node at the specifed linear offset.
Definition NanoVDB.h:3220
ValueT mMaximum
Definition NanoVDB.h:3190
__hostdev__ bool isActive(uint32_t n) const
Definition NanoVDB.h:3237
MaskT mValueMask
Definition NanoVDB.h:3186
typename ChildT::template MaskType< LOG2DIM > MaskT
Definition NanoVDB.h:3170
__hostdev__ ValueT getValue(uint32_t n) const
Definition NanoVDB.h:3231
__hostdev__ const StatsT & stdDeviation() const
Definition NanoVDB.h:3251
InternalData & operator=(const InternalData &)=delete
typename ChildT::ValueType ValueT
Definition NanoVDB.h:3166
__hostdev__ const ChildT * getChild(uint32_t n) const
Definition NanoVDB.h:3225
ValueT mMinimum
Definition NanoVDB.h:3189
InternalData()=delete
This class cannot be constructed or deleted.
uint64_t mFlags
Definition NanoVDB.h:3185
static __hostdev__ constexpr uint64_t memUsage()
Definition NanoVDB.h:3956
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3953
__hostdev__ float getValue(uint32_t i) const
Definition NanoVDB.h:3964
Fp16 BuildType
Definition NanoVDB.h:3951
uint16_t mCode[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:3954
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:3957
uint16_t ArrayType
Definition NanoVDB.h:3952
LeafData()=delete
This class cannot be constructed or deleted.
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:3950
static __hostdev__ constexpr uint8_t bitWidth()
Definition NanoVDB.h:3963
static __hostdev__ constexpr uint64_t memUsage()
Definition NanoVDB.h:3889
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3886
__hostdev__ float getValue(uint32_t i) const
Definition NanoVDB.h:3897
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
uint8_t mCode[1u<<(3 *LOG2DIM - 1)]
Definition NanoVDB.h:3887
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:3890
LeafData()=delete
This class cannot be constructed or deleted.
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:3883
uint8_t ArrayType
Definition NanoVDB.h:3885
Fp4 BuildType
Definition NanoVDB.h:3884
static __hostdev__ constexpr uint8_t bitWidth()
Definition NanoVDB.h:3896
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3923
__hostdev__ float getValue(uint32_t i) const
Definition NanoVDB.h:3933
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:3926
LeafData()=delete
This class cannot be constructed or deleted.
Fp8 BuildType
Definition NanoVDB.h:3921
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:3920
uint8_t ArrayType
Definition NanoVDB.h:3922
static __hostdev__ constexpr int64_t memUsage()
Definition NanoVDB.h:3925
uint8_t mCode[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:3924
static __hostdev__ constexpr uint8_t bitWidth()
Definition NanoVDB.h:3932
FpN BuildType
Definition NanoVDB.h:3984
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3985
__hostdev__ float getValue(uint32_t i) const
Definition NanoVDB.h:3995
static __hostdev__ size_t memUsage(uint32_t bitWidth)
Definition NanoVDB.h:3994
__hostdev__ uint8_t bitWidth() const
Definition NanoVDB.h:3992
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:3986
LeafData()=delete
This class cannot be constructed or deleted.
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:3983
__hostdev__ size_t memUsage() const
Definition NanoVDB.h:3993
uint64_t mOffset
Definition NanoVDB.h:4273
uint16_t mValues[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:4275
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4266
__hostdev__ void setMin(const ValueType &)
Definition NanoVDB.h:4305
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:4285
__hostdev__ void setDev(const FloatType &)
Definition NanoVDB.h:4308
__hostdev__ void setValueOnly(uint32_t offset, uint16_t value)
Definition NanoVDB.h:4292
uint64_t ValueType
Definition NanoVDB.h:4262
__hostdev__ uint64_t last(uint32_t i) const
Definition NanoVDB.h:4290
uint8_t mFlags
Definition NanoVDB.h:4270
LeafData & operator=(const LeafData &)=delete
__hostdev__ void setValue(uint32_t offset, uint16_t value)
Definition NanoVDB.h:4293
LeafData(const LeafData &)=delete
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:4271
CoordT mBBoxMin
Definition NanoVDB.h:4268
uint8_t mBBoxDif[3]
Definition NanoVDB.h:4269
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:4298
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:4281
Point BuildType
Definition NanoVDB.h:4263
__hostdev__ void setAvg(const FloatType &)
Definition NanoVDB.h:4307
uint16_t ArrayType
Definition NanoVDB.h:4265
__hostdev__ ValueType getMax() const
Definition NanoVDB.h:4301
typename FloatTraits< ValueType >::FloatType FloatType
Definition NanoVDB.h:4264
__hostdev__ uint64_t offset() const
Definition NanoVDB.h:4287
LeafData()=delete
This class cannot be constructed or deleted.
__hostdev__ uint64_t first(uint32_t i) const
Definition NanoVDB.h:4289
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:4311
__hostdev__ FloatType getDev() const
Definition NanoVDB.h:4303
__hostdev__ uint64_t getValue(uint32_t i) const
Definition NanoVDB.h:4291
uint64_t mPointCount
Definition NanoVDB.h:4274
__hostdev__ FloatType getAvg() const
Definition NanoVDB.h:4302
__hostdev__ void setMax(const ValueType &)
Definition NanoVDB.h:4306
__hostdev__ ValueType getMin() const
Definition NanoVDB.h:4300
__hostdev__ uint64_t pointCount() const
Definition NanoVDB.h:4288
MaskT< LOG2DIM > mMask
Definition NanoVDB.h:4238
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:4239
__hostdev__ bool isMaskOn(uint32_t offset) const
Definition NanoVDB.h:4240
__hostdev__ void setMask(uint32_t offset, bool v)
Definition NanoVDB.h:4241
ValueIndexMask BuildType
Definition NanoVDB.h:4237
static __hostdev__ uint32_t valueCount()
Definition NanoVDB.h:4191
__hostdev__ uint64_t getMax() const
Definition NanoVDB.h:4196
ValueIndex BuildType
Definition NanoVDB.h:4189
LeafIndexBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:4188
__hostdev__ uint64_t getAvg() const
Definition NanoVDB.h:4197
__hostdev__ uint64_t getValue(uint32_t i) const
Definition NanoVDB.h:4199
__hostdev__ uint64_t lastOffset() const
Definition NanoVDB.h:4193
__hostdev__ uint64_t getDev() const
Definition NanoVDB.h:4198
__hostdev__ uint64_t getMin() const
Definition NanoVDB.h:4195
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4102
__hostdev__ void setMin(const ValueType &)
Definition NanoVDB.h:4124
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:4110
__hostdev__ bool getDev() const
Definition NanoVDB.h:4121
__hostdev__ bool getValue(uint32_t i) const
Definition NanoVDB.h:4117
__hostdev__ void setDev(const FloatType &)
Definition NanoVDB.h:4127
ValueMask BuildType
Definition NanoVDB.h:4099
uint8_t mFlags
Definition NanoVDB.h:4106
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
__hostdev__ void setValue(uint32_t offset, bool)
Definition NanoVDB.h:4122
static __hostdev__ bool hasStats()
Definition NanoVDB.h:4111
__hostdev__ bool getMax() const
Definition NanoVDB.h:4119
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:4107
CoordT mBBoxMin
Definition NanoVDB.h:4104
bool ValueType
Definition NanoVDB.h:4098
uint8_t mBBoxDif[3]
Definition NanoVDB.h:4105
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:4123
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:4112
__hostdev__ void setAvg(const FloatType &)
Definition NanoVDB.h:4126
LeafData()=delete
This class cannot be constructed or deleted.
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:4130
uint64_t mPadding[2]
Definition NanoVDB.h:4108
__hostdev__ bool getMin() const
Definition NanoVDB.h:4118
bool FloatType
Definition NanoVDB.h:4100
__hostdev__ void setMax(const ValueType &)
Definition NanoVDB.h:4125
__hostdev__ bool getAvg() const
Definition NanoVDB.h:4120
void ArrayType
Definition NanoVDB.h:4101
MaskT< LOG2DIM > mMask
Definition NanoVDB.h:4249
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:4250
__hostdev__ bool isMaskOn(uint32_t offset) const
Definition NanoVDB.h:4251
ValueOnIndexMask BuildType
Definition NanoVDB.h:4248
__hostdev__ void setMask(uint32_t offset, bool v)
Definition NanoVDB.h:4252
__hostdev__ uint64_t getMax() const
Definition NanoVDB.h:4216
LeafIndexBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:4208
__hostdev__ uint64_t getAvg() const
Definition NanoVDB.h:4217
__hostdev__ uint64_t getValue(uint32_t i) const
Definition NanoVDB.h:4219
__hostdev__ uint64_t lastOffset() const
Definition NanoVDB.h:4214
__hostdev__ uint64_t getDev() const
Definition NanoVDB.h:4218
__hostdev__ uint64_t getMin() const
Definition NanoVDB.h:4215
__hostdev__ uint32_t valueCount() const
Definition NanoVDB.h:4210
ValueOnIndex BuildType
Definition NanoVDB.h:4209
bool BuildType
Definition NanoVDB.h:4049
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4052
__hostdev__ void setMax(const bool &)
Definition NanoVDB.h:4076
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:4062
__hostdev__ bool getDev() const
Definition NanoVDB.h:4068
__hostdev__ bool getValue(uint32_t i) const
Definition NanoVDB.h:4064
uint8_t mFlags
Definition NanoVDB.h:4056
LeafData & operator=(const LeafData &)=delete
__hostdev__ void setAvg(const bool &)
Definition NanoVDB.h:4077
LeafData(const LeafData &)=delete
MaskT< LOG2DIM > ArrayType
Definition NanoVDB.h:4051
static __hostdev__ bool hasStats()
Definition NanoVDB.h:4063
__hostdev__ void setMin(const bool &)
Definition NanoVDB.h:4075
__hostdev__ bool getMax() const
Definition NanoVDB.h:4066
__hostdev__ void setDev(const bool &)
Definition NanoVDB.h:4078
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:4057
MaskT< LOG2DIM > mValues
Definition NanoVDB.h:4058
CoordT mBBoxMin
Definition NanoVDB.h:4054
bool ValueType
Definition NanoVDB.h:4048
uint8_t mBBoxDif[3]
Definition NanoVDB.h:4055
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:4074
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:4061
LeafData()=delete
This class cannot be constructed or deleted.
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:4081
__hostdev__ void setValue(uint32_t offset, bool v)
Definition NanoVDB.h:4069
uint64_t mPadding[2]
Definition NanoVDB.h:4059
__hostdev__ bool getMin() const
Definition NanoVDB.h:4065
bool FloatType
Definition NanoVDB.h:4050
__hostdev__ bool getAvg() const
Definition NanoVDB.h:4067
ValueType mMaximum
Definition NanoVDB.h:3755
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3747
typename FloatTraits< ValueT >::FloatType FloatType
Definition NanoVDB.h:3745
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:3767
FloatType mAverage
Definition NanoVDB.h:3756
__hostdev__ void setAvg(const FloatType &v)
Definition NanoVDB.h:3787
uint8_t mFlags
Definition NanoVDB.h:3751
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static __hostdev__ bool hasStats()
Definition NanoVDB.h:3769
ValueT ValueType
Definition NanoVDB.h:3743
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:3752
CoordT mBBoxMin
Definition NanoVDB.h:3749
uint8_t mBBoxDif[3]
Definition NanoVDB.h:3750
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:3778
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:3763
__hostdev__ ValueType getValue(uint32_t i) const
Definition NanoVDB.h:3771
__hostdev__ void fill(const ValueType &v)
Definition NanoVDB.h:3793
__hostdev__ ValueType getMax() const
Definition NanoVDB.h:3781
LeafData()=delete
This class cannot be constructed or deleted.
ValueT ArrayType
Definition NanoVDB.h:3746
__hostdev__ void setMin(const ValueType &v)
Definition NanoVDB.h:3785
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:3791
__hostdev__ void setValueOnly(uint32_t offset, const ValueType &value)
Definition NanoVDB.h:3772
__hostdev__ FloatType getDev() const
Definition NanoVDB.h:3783
ValueType mMinimum
Definition NanoVDB.h:3754
__hostdev__ FloatType getAvg() const
Definition NanoVDB.h:3782
__hostdev__ void setValue(uint32_t offset, const ValueType &value)
Definition NanoVDB.h:3773
ValueT BuildType
Definition NanoVDB.h:3744
ValueType mValues[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:3758
FloatType mStdDevi
Definition NanoVDB.h:3757
__hostdev__ ValueType getMin() const
Definition NanoVDB.h:3780
__hostdev__ void setMax(const ValueType &v)
Definition NanoVDB.h:3786
__hostdev__ void setDev(const FloatType &v)
Definition NanoVDB.h:3788
Base-class for quantized float leaf nodes.
Definition NanoVDB.h:3811
__hostdev__ float getAvg() const
return the quantized average of the active values in this node
Definition NanoVDB.h:3852
float ValueType
Definition NanoVDB.h:3814
__hostdev__ float getMax() const
return the quantized maximum of the active values in this node
Definition NanoVDB.h:3849
__hostdev__ float getDev() const
return the quantized standard deviation of the active values in this node
Definition NanoVDB.h:3856
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:3826
__hostdev__ void setDev(float dev)
Definition NanoVDB.h:3868
uint16_t mMax
Definition NanoVDB.h:3824
uint8_t mFlags
Definition NanoVDB.h:3819
uint16_t mMin
Definition NanoVDB.h:3824
static __hostdev__ bool hasStats()
Definition NanoVDB.h:3828
__hostdev__ void setAvg(float avg)
Definition NanoVDB.h:3865
float mQuantum
Definition NanoVDB.h:3823
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:3820
uint16_t mAvg
Definition NanoVDB.h:3824
CoordT mBBoxMin
Definition NanoVDB.h:3817
uint8_t mBBoxDif[3]
Definition NanoVDB.h:3818
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:3843
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:3833
float mMinimum
Definition NanoVDB.h:3822
float FloatType
Definition NanoVDB.h:3815
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:3871
uint16_t mDev
Definition NanoVDB.h:3824
__hostdev__ void init(float min, float max, uint8_t bitWidth)
Definition NanoVDB.h:3837
__hostdev__ void setMin(float min)
Definition NanoVDB.h:3859
__hostdev__ void setMax(float max)
Definition NanoVDB.h:3862
__hostdev__ float getMin() const
return the quantized minimum of the active values in this node
Definition NanoVDB.h:3846
uint64_t mOffset
Definition NanoVDB.h:4156
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4150
__hostdev__ const uint64_t & firstOffset() const
Definition NanoVDB.h:4164
__hostdev__ void setMin(const ValueType &)
Definition NanoVDB.h:4165
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:4161
__hostdev__ void setDev(const FloatType &)
Definition NanoVDB.h:4168
uint64_t ValueType
Definition NanoVDB.h:4147
uint64_t FloatType
Definition NanoVDB.h:4148
uint8_t mFlags
Definition NanoVDB.h:4154
uint64_t mPrefixSum
Definition NanoVDB.h:4156
LeafIndexBase & operator=(const LeafIndexBase &)=default
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:4155
LeafIndexBase(const LeafIndexBase &)=default
CoordT mBBoxMin
Definition NanoVDB.h:4152
uint8_t mBBoxDif[3]
Definition NanoVDB.h:4153
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:4169
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:4157
__hostdev__ void setAvg(const FloatType &)
Definition NanoVDB.h:4167
__hostdev__ bool hasStats() const
Definition NanoVDB.h:4162
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:4171
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:4166
void ArrayType
Definition NanoVDB.h:4149
Definition NanoVDB.h:4331
static __hostdev__ uint32_t dim()
Definition NanoVDB.h:4334
static constexpr uint32_t DIM
Definition NanoVDB.h:4333
static constexpr uint32_t TOTAL
Definition NanoVDB.h:4332
Defines an affine transform and its inverse represented as a 3x3 matrix and a vec3 translation.
Definition NanoVDB.h:1350
double mTaperD
Definition NanoVDB.h:1358
__hostdev__ Map()
Default constructor for the identity map.
Definition NanoVDB.h:1361
void set(const Mat4T &mat, const Mat4T &invMat, double taper=1.0)
Initialize the member data from 4x4 matrices.
Definition NanoVDB.h:1393
__hostdev__ Vec3d getVoxelSize() const
Return a voxels size in each coordinate direction, measured at the origin.
Definition NanoVDB.h:1484
__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:1461
double mVecD[3]
Definition NanoVDB.h:1357
float mInvMatF[9]
Definition NanoVDB.h:1352
__hostdev__ Vec3T applyIJTF(const Vec3T &xyz) const
Definition NanoVDB.h:1481
__hostdev__ Vec3T applyMap(const Vec3T &ijk) const
Apply the forward affine transformation to a vector using 64bit floating point arithmetics.
Definition NanoVDB.h:1404
__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:1470
__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:1421
__hostdev__ Vec3T applyInverseMapF(const Vec3T &xyz) const
Apply the inverse affine mapping to a vector using 32bit floating point arithmetics.
Definition NanoVDB.h:1449
double mInvMatD[9]
Definition NanoVDB.h:1356
__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:1479
float mMatF[9]
Definition NanoVDB.h:1351
__hostdev__ Vec3T applyInverseMap(const Vec3T &xyz) const
Apply the inverse affine mapping to a vector using 64bit floating point arithmetics.
Definition NanoVDB.h:1438
double mMatD[9]
Definition NanoVDB.h:1355
__hostdev__ Map(double s, const Vec3d &t=Vec3d(0.0, 0.0, 0.0))
Definition NanoVDB.h:1372
__hostdev__ Vec3T applyMapF(const Vec3T &ijk) const
Apply the forward affine transformation to a vector using 32bit floating point arithmetics.
Definition NanoVDB.h:1412
__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:1430
float mTaperF
Definition NanoVDB.h:1354
float mVecF[3]
Definition NanoVDB.h:1353
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:1488
NanoLeaf< BuildT > type
Definition NanoVDB.h:4761
NanoLeaf< BuildT > Type
Definition NanoVDB.h:4760
NanoLower< BuildT > Type
Definition NanoVDB.h:4766
NanoLower< BuildT > type
Definition NanoVDB.h:4767
NanoUpper< BuildT > type
Definition NanoVDB.h:4773
NanoUpper< BuildT > Type
Definition NanoVDB.h:4772
NanoRoot< BuildT > type
Definition NanoVDB.h:4779
NanoRoot< BuildT > Type
Definition NanoVDB.h:4778
Trait to map from LEVEL to node type.
Definition NanoVDB.h:4754
typename GridOrTreeOrRootT::LeafNodeType type
Definition NanoVDB.h:1604
typename GridOrTreeOrRootT::LeafNodeType Type
Definition NanoVDB.h:1603
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType Type
Definition NanoVDB.h:1618
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType type
Definition NanoVDB.h:1619
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType type
Definition NanoVDB.h:1633
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType Type
Definition NanoVDB.h:1632
typename GridOrTreeOrRootT::RootNodeType type
Definition NanoVDB.h:1647
typename GridOrTreeOrRootT::RootNodeType Type
Definition NanoVDB.h:1646
const typename GridOrTreeOrRootT::LeafNodeType Type
Definition NanoVDB.h:1610
const typename GridOrTreeOrRootT::LeafNodeType type
Definition NanoVDB.h:1611
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType type
Definition NanoVDB.h:1626
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType Type
Definition NanoVDB.h:1625
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType Type
Definition NanoVDB.h:1639
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType type
Definition NanoVDB.h:1640
const typename GridOrTreeOrRootT::RootNodeType type
Definition NanoVDB.h:1655
const typename GridOrTreeOrRootT::RootNodeType Type
Definition NanoVDB.h:1654
Struct to derive node type from its level in a given grid, tree or root while preserving constness.
Definition NanoVDB.h:1596
Implements Tree::probeLeaf(math::Coord)
Definition NanoVDB.h:6557
static __hostdev__ bool get(const NanoLower< BuildT > &node, uint32_t n, ValueT &v)
Definition NanoVDB.h:6574
typename BuildToValueMap< BuildT >::Type ValueT
Definition NanoVDB.h:6558
static __hostdev__ bool get(const NanoUpper< BuildT > &node, uint32_t n, ValueT &v)
Definition NanoVDB.h:6569
static __hostdev__ bool get(const NanoLeaf< BuildT > &leaf, uint32_t n, ValueT &v)
Definition NanoVDB.h:6579
static __hostdev__ bool get(const NanoRoot< BuildT > &root, ValueT &v)
Definition NanoVDB.h:6559
static __hostdev__ bool get(const typename NanoRoot< BuildT >::Tile &tile, ValueT &v)
Definition NanoVDB.h:6564
Definition NanoVDB.h:2530
ValueT value
Definition NanoVDB.h:2553
uint32_t state
Definition NanoVDB.h:2552
__hostdev__ bool isChild() const
Definition NanoVDB.h:2546
KeyT key
Definition NanoVDB.h:2550
__hostdev__ CoordT origin() const
Definition NanoVDB.h:2549
__hostdev__ bool isValue() const
Definition NanoVDB.h:2547
int64_t child
Definition NanoVDB.h:2551
__hostdev__ void setChild(const CoordType &k, const void *ptr, const RootData *data)
Definition NanoVDB.h:2532
__hostdev__ void setValue(const CoordType &k, bool s, const ValueType &v)
Definition NanoVDB.h:2539
__hostdev__ bool isActive() const
Definition NanoVDB.h:2548
StatsT mAverage
Definition NanoVDB.h:2518
typename ChildT::CoordType CoordT
Definition NanoVDB.h:2484
RootData()=delete
This class cannot be constructed or deleted.
__hostdev__ void setMin(const ValueT &v)
Definition NanoVDB.h:2619
__hostdev__ const StatsT & average() const
Definition NanoVDB.h:2616
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:2486
__hostdev__ const ValueT & getMin() const
Definition NanoVDB.h:2614
__hostdev__ Tile * probeTile(const CoordT &ijk)
Definition NanoVDB.h:2570
ValueT mBackground
Definition NanoVDB.h:2515
__hostdev__ const ValueT & getMax() const
Definition NanoVDB.h:2615
__hostdev__ ChildT * getChild(const Tile *tile)
Returns a const reference to the child node in the specified tile.
Definition NanoVDB.h:2603
__hostdev__ void setDev(const StatsT &v)
Definition NanoVDB.h:2622
uint32_t mTableSize
Definition NanoVDB.h:2513
math::BBox< CoordT > mBBox
Definition NanoVDB.h:2512
uint64_t KeyT
Return a key based on the coordinates of a voxel.
Definition NanoVDB.h:2490
typename ChildT::FloatType StatsT
Definition NanoVDB.h:2485
__hostdev__ void setAvg(const StatsT &v)
Definition NanoVDB.h:2621
__hostdev__ const Tile * tile(uint32_t n) const
Returns a non-const reference to the tile at the specified linear offset.
Definition NanoVDB.h:2559
__hostdev__ const Tile * probeTile(const CoordT &ijk) const
Definition NanoVDB.h:2595
typename ChildT::BuildType BuildT
Definition NanoVDB.h:2483
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:2524
StatsT mStdDevi
Definition NanoVDB.h:2519
RootData(const RootData &)=delete
static __hostdev__ CoordT KeyToCoord(const KeyT &key)
Definition NanoVDB.h:2500
RootData & operator=(const RootData &)=delete
static __hostdev__ KeyT CoordToKey(const CoordType &ijk)
Definition NanoVDB.h:2492
__hostdev__ void setMax(const ValueT &v)
Definition NanoVDB.h:2620
ValueT mMaximum
Definition NanoVDB.h:2517
__hostdev__ const StatsT & stdDeviation() const
Definition NanoVDB.h:2617
__hostdev__ Tile * tile(uint32_t n)
Definition NanoVDB.h:2564
typename ChildT::ValueType ValueT
Definition NanoVDB.h:2482
__hostdev__ const ChildT * getChild(const Tile *tile) const
Definition NanoVDB.h:2608
ValueT mMinimum
Definition NanoVDB.h:2516
Definition NanoVDB.h:6471
static __hostdev__ auto set(NanoLower< BuildT > &node, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6477
static __hostdev__ auto set(NanoUpper< BuildT > &node, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6476
static __hostdev__ auto set(NanoRoot< BuildT > &, const ValueT &)
Definition NanoVDB.h:6474
static __hostdev__ auto set(NanoLeaf< BuildT > &leaf, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6478
static __hostdev__ auto set(typename NanoRoot< BuildT >::Tile &tile, const ValueT &v)
Definition NanoVDB.h:6475
typename NanoLeaf< BuildT >::ValueType ValueT
Definition NanoVDB.h:6473
Definition NanoVDB.h:6483
static __hostdev__ auto set(NanoUpper< BuildT > &, uint32_t, const ValueT &)
Definition NanoVDB.h:6488
static __hostdev__ auto set(NanoRoot< BuildT > &, const ValueT &)
Definition NanoVDB.h:6486
static __hostdev__ auto set(NanoLeaf< BuildT > &leaf, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6490
static __hostdev__ auto set(NanoLower< BuildT > &, uint32_t, const ValueT &)
Definition NanoVDB.h:6489
typename NanoLeaf< BuildT >::ValueType ValueT
Definition NanoVDB.h:6485
static __hostdev__ auto set(typename NanoRoot< BuildT >::Tile &, const ValueT &)
Definition NanoVDB.h:6487
T ElementType
Definition NanoVDB.h:737
static const int Rank
Definition NanoVDB.h:733
static const int Size
Definition NanoVDB.h:736
static T scalar(const T &s)
Definition NanoVDB.h:738
static const bool IsVector
Definition NanoVDB.h:735
static const bool IsScalar
Definition NanoVDB.h:734
static ElementType scalar(const T &v)
Definition NanoVDB.h:749
static const int Rank
Definition NanoVDB.h:744
static const int Size
Definition NanoVDB.h:747
typename T::ValueType ElementType
Definition NanoVDB.h:748
static const bool IsVector
Definition NanoVDB.h:746
static const bool IsScalar
Definition NanoVDB.h:745
Definition NanoVDB.h:2255
__hostdev__ const void * getRoot() const
Get a const void pointer to the root node (never NULL)
Definition NanoVDB.h:2272
__hostdev__ bool isEmpty() const
Return true if the root is empty, i.e. has not child nodes or constant tiles.
Definition NanoVDB.h:2278
int64_t mNodeOffset[4]
Definition NanoVDB.h:2256
__hostdev__ bool isRootNext() const
return true if RootData is layout out immediately after TreeData in memory
Definition NanoVDB.h:2284
TreeData & operator=(const TreeData &)=default
__hostdev__ void setRoot(const void *root)
Definition NanoVDB.h:2263
uint32_t mNodeCount[3]
Definition NanoVDB.h:2257
__hostdev__ void * getRoot()
Get a non-const void pointer to the root node (never NULL)
Definition NanoVDB.h:2269
uint32_t mTileCount[3]
Definition NanoVDB.h:2258
__hostdev__ void setFirstNode(const NodeT *node)
Definition NanoVDB.h:2275
__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:2281
uint64_t mVoxelCount
Definition NanoVDB.h:2259
C++11 implementation of std::enable_if.
Definition Util.h:335
static constexpr bool value
Definition Util.h:329
C++11 implementation of std::is_same.
Definition Util.h:315
static constexpr bool value
Definition Util.h:316
typename remove_const< T >::type type
Definition Util.h:431
T type
Definition Util.h:387
ValueT value
Definition NanoVDB.h:3175
Tile(const Tile &)=delete
Tile & operator=(const Tile &)=delete
Tile()=delete
This class cannot be constructed or deleted.
int64_t child
Definition NanoVDB.h:3176