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];
1162 template<
typename WordT>
1167 return reinterpret_cast<WordT*
>(mWords)[n];
1169 template<
typename WordT>
1174 reinterpret_cast<WordT*
>(mWords)[n] = w;
1178 template<
typename MaskT = Mask>
1181 static_assert(
sizeof(
Mask) ==
sizeof(MaskT),
"Mismatching sizeof");
1182 static_assert(
WORD_COUNT == MaskT::WORD_COUNT,
"Mismatching word count");
1183 static_assert(LOG2DIM == MaskT::LOG2DIM,
"Mismatching LOG2DIM");
1184 auto* src =
reinterpret_cast<const uint64_t*
>(&other);
1185 for (uint64_t *dst = mWords, *end = dst +
WORD_COUNT; dst != end; ++dst)
1196 if (mWords[i] != other.mWords[i])
1205 __hostdev__ bool isOn(uint32_t n)
const {
return 0 != (mWords[n >> 6] & (uint64_t(1) << (n & 63))); }
1208 __hostdev__ bool isOff(uint32_t n)
const {
return 0 == (mWords[n >> 6] & (uint64_t(1) << (n & 63))); }
1214 if (mWords[i] != ~uint64_t(0))
1223 if (mWords[i] != uint64_t(0))
1233#if defined(__CUDACC__)
1234 __device__ inline void setOnAtomic(uint32_t n)
1236 atomicOr(
reinterpret_cast<unsigned long long int*
>(
this) + (n >> 6), 1ull << (n & 63));
1238 __device__ inline void setOffAtomic(uint32_t n)
1240 atomicAnd(
reinterpret_cast<unsigned long long int*
>(
this) + (n >> 6), ~(1ull << (n & 63)));
1242 __device__ inline void setAtomic(uint32_t n,
bool on)
1244 on ? this->setOnAtomic(n) : this->setOffAtomic(n);
1270 auto& word = mWords[n >> 6];
1272 word &= ~(uint64_t(1) << n);
1273 word |= uint64_t(on) << n;
1282 for (uint32_t i = 0; i <
WORD_COUNT; ++i)mWords[i] = ~uint64_t(0);
1288 for (uint32_t i = 0; i <
WORD_COUNT; ++i) mWords[i] = uint64_t(0);
1294 const uint64_t v = on ? ~uint64_t(0) : uint64_t(0);
1295 for (uint32_t i = 0; i <
WORD_COUNT; ++i) mWords[i] = v;
1301 for (
auto* w = mWords; n--; ++w) *w = ~*w;
1308 uint64_t* w1 = mWords;
1309 const uint64_t* w2 = other.mWords;
1310 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 &= *w2;
1316 uint64_t* w1 = mWords;
1317 const uint64_t* w2 = other.mWords;
1318 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 |= *w2;
1324 uint64_t* w1 = mWords;
1325 const uint64_t* w2 = other.mWords;
1326 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 &= ~*w2;
1332 uint64_t* w1 = mWords;
1333 const uint64_t* w2 = other.mWords;
1334 for (uint32_t n =
WORD_COUNT; n--; ++w1, ++w2) *w1 ^= *w2;
1343 const uint64_t* w = mWords;
1344 for (; n <
WORD_COUNT && !(ON ? *w : ~*w); ++w, ++n);
1352 uint32_t n = start >> 6;
1354 uint32_t m = start & 63u;
1355 uint64_t b = ON ? mWords[n] : ~mWords[n];
1356 if (b & (uint64_t(1u) << m))
return start;
1357 b &= ~uint64_t(0u) << m;
1358 while (!b && ++n <
WORD_COUNT) b = ON ? mWords[n] : ~mWords[n];
1366 uint32_t n = start >> 6;
1368 uint32_t m = start & 63u;
1369 uint64_t b = ON ? mWords[n] : ~mWords[n];
1370 if (b & (uint64_t(1u) << m))
return start;
1371 b &= (uint64_t(1u) << m) - 1u;
1372 while (!b && n) b = ON ? mWords[--n] : ~mWords[--n];
1396 :
mMatF{ 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}
1397 ,
mInvMatF{1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}
1398 ,
mVecF{0.0f, 0.0f, 0.0f}
1400 ,
mMatD{ 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}
1401 ,
mInvMatD{1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0}
1402 ,
mVecD{0.0, 0.0, 0.0}
1407 :
mMatF{float(s), 0.0f, 0.0f, 0.0f, float(s), 0.0f, 0.0f, 0.0f, float(s)}
1408 ,
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)}
1409 ,
mVecF{float(t[0]), float(t[1]), float(t[2])}
1411 ,
mMatD{s, 0.0, 0.0, 0.0, s, 0.0, 0.0, 0.0, s}
1412 ,
mInvMatD{1.0 / s, 0.0, 0.0, 0.0, 1.0 / s, 0.0, 0.0, 0.0, 1.0 / s}
1413 ,
mVecD{t[0], t[1], t[2]}
1420 template<
typename MatT,
typename Vec3T>
1421 void set(
const MatT& mat,
const MatT& invMat,
const Vec3T& translate,
double taper = 1.0);
1426 template<
typename Mat4T>
1427 void set(
const Mat4T& mat,
const Mat4T& invMat,
double taper = 1.0) { this->
set(mat, invMat, mat[3], taper); }
1429 template<
typename Vec3T>
1430 void set(
double scale,
const Vec3T& translation,
double taper = 1.0);
1437 template<
typename Vec3T>
1445 template<
typename Vec3T>
1454 template<
typename Vec3T>
1463 template<
typename Vec3T>
1471 template<
typename Vec3T>
1482 template<
typename Vec3T>
1494 template<
typename Vec3T>
1503 template<
typename Vec3T>
1512 template<
typename Vec3T>
1514 template<
typename Vec3T>
1521template<
typename MatT,
typename Vec3T>
1522inline void Map::set(
const MatT& mat,
const MatT& invMat,
const Vec3T& translate,
double taper)
1526 mTaperF =
static_cast<float>(taper);
1528 for (
int i = 0; i < 3; ++i) {
1529 *vd++ = translate[i];
1530 *vf++ =
static_cast<float>(translate[i]);
1531 for (
int j = 0; j < 3; ++j) {
1533 *mid++ = invMat[j][i];
1534 *mf++ =
static_cast<float>(mat[j][i]);
1535 *mif++ =
static_cast<float>(invMat[j][i]);
1540template<
typename Vec3T>
1541inline void Map::set(
double dx,
const Vec3T& trans,
double taper)
1544 const double mat[3][3] = { {dx, 0.0, 0.0},
1547 const double idx = 1.0 / dx;
1548 const double invMat[3][3] = { {idx, 0.0, 0.0},
1551 this->
set(mat, invMat, trans, taper);
1583 template<
typename BlindDataT>
1593 auto check = [&]()->
bool{
1611 default:
return true;}
1629template<
typename Gr
idOrTreeOrRootT,
int LEVEL>
1633template<
typename Gr
idOrTreeOrRootT>
1636 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1637 using Type =
typename GridOrTreeOrRootT::LeafNodeType;
1638 using type =
typename GridOrTreeOrRootT::LeafNodeType;
1640template<
typename Gr
idOrTreeOrRootT>
1643 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1644 using Type =
const typename GridOrTreeOrRootT::LeafNodeType;
1645 using type =
const typename GridOrTreeOrRootT::LeafNodeType;
1648template<
typename Gr
idOrTreeOrRootT>
1651 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1652 using Type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1653 using type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1655template<
typename Gr
idOrTreeOrRootT>
1658 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1659 using Type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1660 using type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType;
1662template<
typename Gr
idOrTreeOrRootT>
1665 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1666 using Type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1667 using type =
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1669template<
typename Gr
idOrTreeOrRootT>
1672 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1673 using Type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1674 using type =
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType;
1676template<
typename Gr
idOrTreeOrRootT>
1679 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1680 using Type =
typename GridOrTreeOrRootT::RootNodeType;
1681 using type =
typename GridOrTreeOrRootT::RootNodeType;
1684template<
typename Gr
idOrTreeOrRootT>
1687 static_assert(GridOrTreeOrRootT::RootNodeType::LEVEL == 3,
"Tree depth is not supported");
1688 using Type =
const typename GridOrTreeOrRootT::RootNodeType;
1689 using type =
const typename GridOrTreeOrRootT::RootNodeType;
1694template<
typename BuildT>
1696template<
typename BuildT>
1698template<
typename BuildT>
1700template<
typename BuildT>
1702template<
typename BuildT>
1704template<
typename BuildT>
1706template<
typename BuildT>
1708template<
typename BuildT>
1770 [[deprecated(
"Use Checksum::data instead.")]]
1772 [[deprecated(
"Use Checksum::head and Ckecksum::tail instead.")]]
1774 [[deprecated(
"Use Checksum::head and Ckecksum::tail instead.")]]
1785 [[deprecated(
"Use Checksum::isHalf instead.")]]
1869 uint64_t gridSize = 0u,
1874#ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS
1884 mGridSize = gridSize;
1885 mGridName[0] =
'\0';
1887 mWorldBBox = Vec3dBBox();
1888 mVoxelSize = map.getVoxelSize();
1889 mGridClass = gridClass;
1890 mGridType = gridType;
1891 mBlindMetadataOffset = mGridSize;
1892 mBlindMetadataCount = 0u;
1905 if (test) test =
mVersion.isCompatible();
1923 template<
typename Vec3T>
1925 template<
typename Vec3T>
1927 template<
typename Vec3T>
1929 template<
typename Vec3T>
1931 template<
typename Vec3T>
1934 template<
typename Vec3T>
1936 template<
typename Vec3T>
1938 template<
typename Vec3T>
1940 template<
typename Vec3T>
1942 template<
typename Vec3T>
1953 template <u
int32_t LEVEL>
1956 static_assert(LEVEL >= 0 && LEVEL <= 3,
"invalid LEVEL template parameter");
1957 const void *treeData =
this + 1;
1959 return nodeOffset ?
util::PtrAdd(treeData, nodeOffset) :
nullptr;
1965 template <u
int32_t LEVEL>
1968 static_assert(LEVEL >= 0 && LEVEL <= 3,
"invalid LEVEL template parameter");
1969 void *treeData =
this + 1;
1971 return nodeOffset ?
util::PtrAdd(treeData, nodeOffset) :
nullptr;
1976 template <u
int32_t LEVEL>
1979 static_assert(LEVEL >= 0 && LEVEL < 3,
"invalid LEVEL template parameter");
2000 return metaData->template getBlindData<const char>();
2034template<
typename BuildT,
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1>
2037template<
typename BuildT>
2044template<
typename TreeT>
2088 template<
typename T = BuildType>
2095 template<
typename T = BuildType>
2115 template<
typename Vec3T>
2119 template<
typename Vec3T>
2124 template<
typename Vec3T>
2129 template<
typename Vec3T>
2134 template<
typename Vec3T>
2138 template<
typename Vec3T>
2142 template<
typename Vec3T>
2147 template<
typename Vec3T>
2152 template<
typename Vec3T>
2157 template<
typename Vec3T>
2193 template<
typename NodeT>
2229 [[deprecated(
"Use Grid::getBlindData<T>() instead.")]]
2232 printf(
"\nnanovdb::Grid::blindData is unsafe and hence deprecated! Please use nanovdb::Grid::getBlindData instead.\n\n");
2237 template <
typename BlindDataT>
2244 template <
typename BlindDataT>
2257template<
typename TreeT>
2267template<
typename TreeT>
2270 auto test = [&](
int n) {
2273 if (name[i] != str[i])
2275 if (name[i] ==
'\0' && str[i] ==
'\0')
2308 template<
typename NodeT>
2324template<
typename Gr
idT>
2327 using Type =
typename GridT::TreeType;
2328 using type =
typename GridT::TreeType;
2330template<
typename Gr
idT>
2333 using Type =
const typename GridT::TreeType;
2334 using type =
const typename GridT::TreeType;
2340template<
typename RootT>
2343 static_assert(RootT::LEVEL == 3,
"Tree depth is not supported");
2344 static_assert(RootT::ChildNodeType::LOG2DIM == 5,
"Tree configuration is not supported");
2345 static_assert(RootT::ChildNodeType::ChildNodeType::LOG2DIM == 4,
"Tree configuration is not supported");
2346 static_assert(RootT::LeafNodeType::LOG2DIM == 3,
"Tree configuration is not supported");
2361 using Node2 =
typename RootT::ChildNodeType;
2362 using Node1 =
typename Node2::ChildNodeType;
2420 template<
typename NodeT>
2423 static_assert(NodeT::LEVEL < 3,
"Invalid NodeT");
2441 template<
typename NodeT>
2451 template<
typename NodeT>
2484 template<
typename OpT,
typename... ArgsT>
2490 template<
typename OpT,
typename... ArgsT>
2501template<
typename RootT>
2504 min = this->
root().minimum();
2505 max = this->
root().maximum();
2513template<
typename ChildT>
2523#ifdef NANOVDB_USE_SINGLE_ROOT_KEY
2525 template<
typename CoordType>
2528 static_assert(
sizeof(
CoordT) ==
sizeof(CoordType),
"Mismatching sizeof");
2529 static_assert(32 - ChildT::TOTAL <= 21,
"Cannot use 64 bit root keys");
2530 return (
KeyT(uint32_t(ijk[2]) >> ChildT::TOTAL)) |
2531 (
KeyT(uint32_t(ijk[1]) >> ChildT::TOTAL) << 21) |
2532 (
KeyT(uint32_t(ijk[0]) >> ChildT::TOTAL) << 42);
2536 static constexpr uint64_t MASK = (1u << 21) - 1;
2537 return CoordT(((key >> 42) & MASK) << ChildT::TOTAL,
2538 ((key >> 21) & MASK) << ChildT::TOTAL,
2539 (key & MASK) << ChildT::TOTAL);
2542 using KeyT = CoordT;
2543 __hostdev__ static KeyT CoordToKey(
const CoordT& ijk) {
return ijk & ~ChildT::MASK; }
2544 __hostdev__ static CoordT KeyToCoord(
const KeyT& key) {
return key; }
2563 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
Tile
2565 template<
typename CoordType>
2572 template<
typename CoordType,
typename ValueType>
2596 return reinterpret_cast<const Tile*
>(
this + 1) + n;
2601 return reinterpret_cast<Tile*
>(
this + 1) + n;
2614 while (low != high) {
2615 int mid = low + ((high - low) >> 1);
2617 if (
tile->key == key) {
2619 }
else if (
tile->key < key) {
2668template<
typename ChildT>
2689 static constexpr uint32_t
LEVEL = 1 + ChildT::LEVEL;
2691 template<
typename RootT>
2714 return this->
tile()->origin();
2719 return this->
tile()->origin();
2723 template<
typename RootT>
2739 while (*
this && !this->
tile()->isChild())
2756 while (*
this && this->
tile()->isValue())
2774 template<
typename RootT>
2788 while (*
this && this->
tile()->isChild())
2794 return this->
tile()->value;
2799 return this->
tile()->state;
2805 while (*
this && this->
tile()->isChild())
2823 template<
typename RootT>
2843 return this->
tile()->value;
2867 template<
typename RootT>
2886 NodeT* child =
nullptr;
2887 auto* t = this->
tile();
2898 return this->
tile()->state;
2970#ifdef NANOVDB_NEW_ACCESSOR_METHODS
2981 __hostdev__ ValueType getValue(
const CoordType& ijk)
const
2983 if (
const Tile* tile = DataType::probeTile(ijk)) {
2984 return tile->isChild() ? this->getChild(tile)->getValue(ijk) : tile->value;
2986 return DataType::mBackground;
2988 __hostdev__ ValueType getValue(
int i,
int j,
int k)
const {
return this->getValue(CoordType(i, j, k)); }
2990 __hostdev__ bool isActive(
const CoordType& ijk)
const
2992 if (
const Tile* tile = DataType::probeTile(ijk)) {
2993 return tile->isChild() ? this->getChild(tile)->isActive(ijk) : tile->state;
2998 __hostdev__ bool probeValue(
const CoordType& ijk, ValueType& v)
const
3000 if (
const Tile* tile = DataType::probeTile(ijk)) {
3001 if (tile->isChild()) {
3002 const auto* child = this->getChild(tile);
3003 return child->probeValue(ijk, v);
3008 v = DataType::mBackground;
3012 __hostdev__ const LeafNodeType* probeLeaf(
const CoordType& ijk)
const
3014 const Tile* tile = DataType::probeTile(ijk);
3015 if (tile && tile->isChild()) {
3016 const auto* child = this->getChild(tile);
3017 return child->probeLeaf(ijk);
3036 template<
typename OpT,
typename... ArgsT>
3040 if (
tile->isChild())
3042 return OpT::get(*
tile, args...);
3044 return OpT::get(*
this, args...);
3047 template<
typename OpT,
typename... ArgsT>
3053 if (
tile->isChild())
3055 return OpT::set(*
tile, args...);
3057 return OpT::set(*
this, args...);
3062 static_assert(
sizeof(
typename DataType::Tile) %
NANOVDB_DATA_ALIGNMENT == 0,
"sizeof(RootData::Tile) is misaligned");
3064 template<
typename,
int,
int,
int>
3069#ifndef NANOVDB_NEW_ACCESSOR_METHODS
3071 template<
typename AccT>
3072 __hostdev__ typename AccT::NodeInfo getNodeInfoAndCache(
const CoordType& ijk,
const AccT& acc)
const
3074 using NodeInfoT =
typename AccT::NodeInfo;
3076 if (
tile->isChild()) {
3078 acc.insert(ijk, child);
3079 return child->getNodeInfoAndCache(ijk, acc);
3081 return NodeInfoT{LEVEL, ChildT::dim(), tile->value, tile->value, tile->value, 0, tile->origin(), tile->origin() + CoordType(ChildT::DIM)};
3083 return NodeInfoT{LEVEL, ChildT::dim(), this->minimum(), this->maximum(), this->average(), this->stdDeviation(), this->bbox()[0], this->bbox()[1]};
3087 template<
typename AccT>
3088 __hostdev__ ValueType getValueAndCache(
const CoordType& ijk,
const AccT& acc)
const
3090 if (
const Tile* tile = this->probeTile(ijk)) {
3091 if (tile->isChild()) {
3092 const auto* child = this->getChild(tile);
3093 acc.insert(ijk, child);
3094 return child->getValueAndCache(ijk, acc);
3098 return DataType::mBackground;
3101 template<
typename AccT>
3102 __hostdev__ bool isActiveAndCache(
const CoordType& ijk,
const AccT& acc)
const
3104 const Tile* tile = this->probeTile(ijk);
3105 if (tile && tile->isChild()) {
3106 const auto* child = this->getChild(tile);
3107 acc.insert(ijk, child);
3108 return child->isActiveAndCache(ijk, acc);
3113 template<
typename AccT>
3114 __hostdev__ bool probeValueAndCache(
const CoordType& ijk, ValueType& v,
const AccT& acc)
const
3116 if (
const Tile* tile = this->probeTile(ijk)) {
3117 if (tile->isChild()) {
3118 const auto* child = this->getChild(tile);
3119 acc.insert(ijk, child);
3120 return child->probeValueAndCache(ijk, v, acc);
3125 v = DataType::mBackground;
3129 template<
typename AccT>
3130 __hostdev__ const LeafNodeType* probeLeafAndCache(
const CoordType& ijk,
const AccT& acc)
const
3132 const Tile* tile = this->probeTile(ijk);
3133 if (tile && tile->isChild()) {
3134 const auto* child = this->getChild(tile);
3135 acc.insert(ijk, child);
3136 return child->probeLeafAndCache(ijk, acc);
3142 template<
typename RayT,
typename AccT>
3143 __hostdev__ uint32_t getDimAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const
3145 if (
const Tile* tile = this->probeTile(ijk)) {
3146 if (tile->isChild()) {
3147 const auto* child = this->getChild(tile);
3148 acc.insert(ijk, child);
3149 return child->getDimAndCache(ijk, ray, acc);
3151 return 1 << ChildT::TOTAL;
3153 return ChildNodeType::dim();
3156 template<
typename OpT,
typename AccT,
typename... ArgsT>
3159 getAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
const
3161 if (
const Tile* tile = this->probeTile(ijk)) {
3162 if (tile->isChild()) {
3163 const ChildT* child = this->getChild(tile);
3164 acc.insert(ijk, child);
3165 return child->template getAndCache<OpT>(ijk, acc, args...);
3167 return OpT::get(*tile, args...);
3169 return OpT::get(*
this, args...);
3172 template<
typename OpT,
typename AccT,
typename... ArgsT>
3174 __hostdev__ decltype(OpT::set(util::declval<Tile&>(), util::declval<ArgsT>()...))
3175 setAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
3177 if (Tile* tile = DataType::probeTile(ijk)) {
3178 if (tile->isChild()) {
3179 ChildT* child = this->getChild(tile);
3180 acc.insert(ijk, child);
3181 return child->template setAndCache<OpT>(ijk, acc, args...);
3183 return OpT::set(*tile, args...);
3185 return OpT::set(*
this, args...);
3197template<
typename ChildT, u
int32_t LOG2DIM>
3204 using MaskT =
typename ChildT::template MaskType<LOG2DIM>;
3236 alignas(32) Tile
mTable[1u << (3 * LOG2DIM)];
3246 template<
typename ValueT>
3279 template<
typename T>
3287#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__llvm__)
3288#pragma GCC diagnostic push
3289#pragma GCC diagnostic ignored "-Wstringop-overflow"
3295#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__llvm__)
3296#pragma GCC diagnostic pop
3307template<
typename ChildT, u
int32_t Log2Dim = ChildT::LOG2DIM + 1>
3319 template<u
int32_t LOG2>
3329 static constexpr uint32_t
LEVEL = 1 + ChildT::LEVEL;
3333 template <
typename ParentT>
3356 return *mParent->getChild(BaseT::pos());
3361 return mParent->getChild(BaseT::pos());
3366 return (*this)->origin();
3398 return mParent->data()->getValue(BaseT::pos());
3403 return mParent->offsetToGlobalCoord(BaseT::pos());
3409 return mParent->data()->isActive(BaseT::mPos);
3437 return mParent->data()->getValue(BaseT::pos());
3442 return mParent->offsetToGlobalCoord(BaseT::pos());
3464 , mParent(parent->
data())
3471 const ChildT* child =
nullptr;
3472 if (mParent->mChildMask.isOn(BaseT::pos())) {
3473 child = mParent->getChild(BaseT::pos());
3475 value = mParent->getValue(BaseT::pos());
3482 return mParent->isActive(BaseT::pos());
3487 return mParent->offsetToGlobalCoord(BaseT::pos());
3554#ifdef NANOVDB_NEW_ACCESSOR_METHODS
3562 __hostdev__ ValueType getValue(
const CoordType& ijk)
const
3564 const uint32_t n = CoordToOffset(ijk);
3565 return DataType::mChildMask.isOn(n) ? this->getChild(n)->getValue(ijk) : DataType::getValue(n);
3567 __hostdev__ bool isActive(
const CoordType& ijk)
const
3569 const uint32_t n = CoordToOffset(ijk);
3570 return DataType::mChildMask.isOn(n) ? this->getChild(n)->isActive(ijk) : DataType::isActive(n);
3572 __hostdev__ bool probeValue(
const CoordType& ijk, ValueType& v)
const
3574 const uint32_t n = CoordToOffset(ijk);
3575 if (DataType::mChildMask.isOn(n))
3576 return this->getChild(n)->probeValue(ijk, v);
3577 v = DataType::getValue(n);
3578 return DataType::isActive(n);
3580 __hostdev__ const LeafNodeType* probeLeaf(
const CoordType& ijk)
const
3582 const uint32_t n = CoordToOffset(ijk);
3583 if (DataType::mChildMask.isOn(n))
3584 return this->getChild(n)->probeLeaf(ijk);
3604 return (((ijk[0] &
MASK) >> ChildT::TOTAL) << (2 *
LOG2DIM)) |
3605 (((ijk[1] &
MASK) >> ChildT::TOTAL) << (
LOG2DIM)) |
3606 ((ijk[2] &
MASK) >> ChildT::TOTAL);
3613 const uint32_t m = n & ((1 << 2 *
LOG2DIM) - 1);
3620 ijk <<= ChildT::TOTAL;
3634 template<
typename OpT,
typename... ArgsT>
3640 return OpT::get(*
this, n, args...);
3643 template<
typename OpT,
typename... ArgsT>
3651 return OpT::set(*
this, n, args...);
3657 template<
typename,
int,
int,
int>
3662 template<
typename, u
int32_t>
3665#ifndef NANOVDB_NEW_ACCESSOR_METHODS
3667 template<
typename AccT>
3673 const ChildT* child = this->
getChild(n);
3674 acc.insert(ijk, child);
3675 return child->getValueAndCache(ijk, acc);
3677 template<
typename AccT>
3678 __hostdev__ bool isActiveAndCache(
const CoordType& ijk,
const AccT& acc)
const
3680 const uint32_t n = CoordToOffset(ijk);
3681 if (DataType::mChildMask.isOff(n))
3682 return DataType::isActive(n);
3683 const ChildT* child = this->getChild(n);
3684 acc.insert(ijk, child);
3685 return child->isActiveAndCache(ijk, acc);
3687 template<
typename AccT>
3688 __hostdev__ bool probeValueAndCache(
const CoordType& ijk, ValueType& v,
const AccT& acc)
const
3690 const uint32_t n = CoordToOffset(ijk);
3691 if (DataType::mChildMask.isOff(n)) {
3692 v = DataType::getValue(n);
3693 return DataType::isActive(n);
3695 const ChildT* child = this->getChild(n);
3696 acc.insert(ijk, child);
3697 return child->probeValueAndCache(ijk, v, acc);
3699 template<
typename AccT>
3700 __hostdev__ const LeafNodeType* probeLeafAndCache(
const CoordType& ijk,
const AccT& acc)
const
3702 const uint32_t n = CoordToOffset(ijk);
3703 if (DataType::mChildMask.isOff(n))
3705 const ChildT* child = this->getChild(n);
3706 acc.insert(ijk, child);
3707 return child->probeLeafAndCache(ijk, acc);
3709 template<
typename AccT>
3710 __hostdev__ typename AccT::NodeInfo getNodeInfoAndCache(
const CoordType& ijk,
const AccT& acc)
const
3712 using NodeInfoT =
typename AccT::NodeInfo;
3713 const uint32_t n = CoordToOffset(ijk);
3714 if (DataType::mChildMask.isOff(n)) {
3715 return NodeInfoT{LEVEL, this->dim(), this->minimum(), this->maximum(), this->average(), this->stdDeviation(), this->bbox()[0], this->bbox()[1]};
3717 const ChildT* child = this->getChild(n);
3718 acc.insert(ijk, child);
3719 return child->getNodeInfoAndCache(ijk, acc);
3723 template<
typename RayT,
typename AccT>
3724 __hostdev__ uint32_t getDimAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const
3726 if (DataType::mFlags & uint32_t(1u))
3730 const uint32_t n = CoordToOffset(ijk);
3731 if (DataType::mChildMask.isOn(n)) {
3732 const ChildT* child = this->getChild(n);
3733 acc.insert(ijk, child);
3734 return child->getDimAndCache(ijk, ray, acc);
3736 return ChildNodeType::dim();
3739 template<
typename OpT,
typename AccT,
typename... ArgsT>
3742 getAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
const
3744 const uint32_t n = CoordToOffset(ijk);
3745 if (DataType::mChildMask.isOff(n))
3746 return OpT::get(*
this, n, args...);
3747 const ChildT* child = this->getChild(n);
3748 acc.insert(ijk, child);
3749 return child->template getAndCache<OpT>(ijk, acc, args...);
3752 template<
typename OpT,
typename AccT,
typename... ArgsT>
3754 __hostdev__ decltype(OpT::set(util::declval<InternalNode&>(), util::declval<uint32_t>(), util::declval<ArgsT>()...))
3755 setAndCache(
const CoordType& ijk,
const AccT& acc, ArgsT&&... args)
3757 const uint32_t n = CoordToOffset(ijk);
3758 if (DataType::mChildMask.isOff(n))
3759 return OpT::set(*
this, n, args...);
3760 ChildT* child = this->getChild(n);
3761 acc.insert(ijk, child);
3762 return child->template setAndCache<OpT>(ijk, acc, args...);
3772template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3775 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3776 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3799 return sizeof(
LeafData) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>) + 2 * (
sizeof(ValueT) +
sizeof(
FloatType)) + (1u << (3 * LOG2DIM)) *
sizeof(ValueT));
3824 template<
typename T>
3829 for (
auto *p =
mValues, *q = p + 512; p != q; ++p)
3843template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3846 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
3847 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3869 return sizeof(
LeafFnBase) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>) + 2 * 4 + 4 * 2);
3874 mQuantum = (max - min) /
float((1 << bitWidth) - 1);
3904 template<
typename T>
3913template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3914struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp4, CoordT, MaskT, LOG2DIM>
3921 alignas(32) uint8_t
mCode[1u << (3 * LOG2DIM - 1)];
3926 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3927 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << (3 * LOG2DIM - 1));
3934 const uint8_t c =
mCode[i>>1];
3950template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3951struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp8, CoordT, MaskT, LOG2DIM>
3958 alignas(32) uint8_t
mCode[1u << 3 * LOG2DIM];
3962 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3963 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << 3 * LOG2DIM);
3980template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3981struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp16, CoordT, MaskT, LOG2DIM>
3988 alignas(32) uint16_t
mCode[1u << 3 * LOG2DIM];
3993 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
3994 return sizeof(
LeafData) -
sizeof(
BaseT) - 2 * (1u << 3 * LOG2DIM);
4012template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4013struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
FpN, CoordT, MaskT, LOG2DIM>
4022 static_assert(
BaseT::padding() == 0,
"expected no padding in LeafFnBase");
4031#ifdef NANOVDB_FPN_BRANCHLESS
4034 uint16_t code =
reinterpret_cast<const uint16_t*
>(
this + 1)[i >> (4 - b)];
4035 const static uint8_t shift[5] = {15, 7, 3, 1, 0};
4036 const static uint16_t mask[5] = {1, 3, 15, 255, 65535};
4037 code >>= (i & shift[b]) << b;
4040 uint32_t code =
reinterpret_cast<const uint32_t*
>(
this + 1)[i >> (5 - b)];
4041 code >>= (i & ((32 >> b) - 1)) << b;
4042 code &= (1 << (1 << b)) - 1;
4046 auto* values =
reinterpret_cast<const uint8_t*
>(
this + 1);
4049 code = float((values[i >> 3] >> (i & 7)) & uint8_t(1));
4052 code = float((values[i >> 2] >> ((i & 3) << 1)) & uint8_t(3));
4055 code = float((values[i >> 1] >> ((i & 1) << 2)) & uint8_t(15));
4058 code = float(values[i]);
4061 code = float(
reinterpret_cast<const uint16_t*
>(values)[i]);
4077template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4078struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<bool, CoordT, MaskT, LOG2DIM>
4080 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4081 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4114 template<
typename T>
4127template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4130 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4131 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4148 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u);
4163 template<
typename T>
4176template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4179 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4180 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4193 return sizeof(
LeafIndexBase) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u);
4204 template<
typename T>
4218template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4238template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4256 uint32_t n = i >> 6;
4257 const uint64_t w =
BaseT::mValueMask.words()[n], mask = uint64_t(1) << (i & 63u);
4258 if (!(w & mask))
return uint64_t(0);
4267template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4269 :
public LeafData<ValueIndex, CoordT, MaskT, LOG2DIM>
4278template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4280 :
public LeafData<ValueOnIndex, CoordT, MaskT, LOG2DIM>
4291template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4292struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Point, CoordT, MaskT, LOG2DIM>
4294 static_assert(
sizeof(CoordT) ==
sizeof(Coord),
"Mismatching sizeof");
4295 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4317 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2 * 8u + (1u << 3 * LOG2DIM) * 2u);
4344 template<
typename T>
4357template<
typename BuildT,
4358 typename CoordT = Coord,
4359 template<u
int32_t>
class MaskT =
Mask,
4360 uint32_t Log2Dim = 3>
4367 static constexpr uint32_t
DIM = 1;
4377 template<u
int32_t LOG2>
4403 return mParent->getValue(BaseT::pos());
4408 return mParent->offsetToGlobalCoord(BaseT::pos());
4436 return mParent->getValue(BaseT::pos());
4441 return mParent->offsetToGlobalCoord(BaseT::pos());
4457 , mPos(1u << 3 * Log2Dim)
4470 return mParent->getValue(mPos);
4475 return mParent->offsetToGlobalCoord(mPos);
4480 return mParent->isActive(mPos);
4482 __hostdev__ operator bool()
const {
return mPos < (1u << 3 * Log2Dim); }
4542 const uint32_t m = n & ((1 << 2 *
LOG2DIM) - 1);
4566 bbox = math::BBox<CoordT>();
4646 template<
typename OpT,
typename... ArgsT>
4652 template<
typename OpT,
typename... ArgsT>
4655 return OpT::get(*
this, n, args...);
4658 template<
typename OpT,
typename... ArgsT>
4664 template<
typename OpT,
typename... ArgsT>
4667 return OpT::set(*
this, n, args...);
4673 template<
typename,
int,
int,
int>
4678 template<
typename, u
int32_t>
4681#ifndef NANOVDB_NEW_ACCESSOR_METHODS
4683 template<
typename AccT>
4687 template<
typename AccT>
4688 __hostdev__ typename AccT::NodeInfo getNodeInfoAndCache(
const CoordType& ,
const AccT& )
const
4690 using NodeInfoT =
typename AccT::NodeInfo;
4691 return NodeInfoT{LEVEL, this->dim(), this->minimum(), this->maximum(), this->average(), this->stdDeviation(), this->bbox()[0], this->bbox()[1]};
4694 template<
typename AccT>
4695 __hostdev__ bool isActiveAndCache(
const CoordT& ijk,
const AccT&)
const {
return this->isActive(ijk); }
4697 template<
typename AccT>
4698 __hostdev__ bool probeValueAndCache(
const CoordT& ijk, ValueType& v,
const AccT&)
const {
return this->probeValue(ijk, v); }
4700 template<
typename AccT>
4701 __hostdev__ const LeafNode* probeLeafAndCache(
const CoordT&,
const AccT&)
const {
return this; }
4704 template<
typename RayT,
typename AccT>
4705 __hostdev__ uint32_t getDimAndCache(
const CoordT&,
const RayT& ,
const AccT&)
const
4707 if (DataType::mFlags & uint8_t(1u))
4711 return ChildNodeType::dim();
4714 template<
typename OpT,
typename AccT,
typename... ArgsT>
4717 getAndCache(
const CoordType& ijk,
const AccT&, ArgsT&&... args)
const
4719 return OpT::get(*
this, CoordToOffset(ijk), args...);
4722 template<
typename OpT,
typename AccT,
typename... ArgsT>
4724 __hostdev__ decltype(OpT::set(util::declval<LeafNode&>(), util::declval<uint32_t>(), util::declval<ArgsT>()...))
4725 setAndCache(
const CoordType& ijk,
const AccT&, ArgsT&&... args)
4727 return OpT::set(*
this, CoordToOffset(ijk), args...);
4734template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4737 static_assert(
LOG2DIM == 3,
"LeafNode::updateBBox: only supports LOGDIM = 3!");
4742 auto update = [&](uint32_t min, uint32_t max,
int axis) {
4748 uint32_t Xmin = word64 ? 0u : 8u, Xmax = Xmin;
4749 for (
int i = 1; i < 8; ++i) {
4758 update(Xmin, Xmax, 0);
4760 const uint32_t *p =
reinterpret_cast<const uint32_t*
>(&word64), word32 = p[0] | p[1];
4761 const uint16_t *q =
reinterpret_cast<const uint16_t*
>(&word32), word16 = q[0] | q[1];
4762 const uint8_t *b =
reinterpret_cast<const uint8_t*
>(&word16),
byte = b[0] | b[1];
4773template<
typename BuildT>
4775template<
typename BuildT>
4777template<
typename BuildT>
4779template<
typename BuildT>
4781template<
typename BuildT>
4783template<
typename BuildT>
4787template<
typename BuildT,
int LEVEL>
4791template<
typename BuildT>
4797template<
typename BuildT>
4803template<
typename BuildT>
4809template<
typename BuildT>
4888template<
typename OpT,
typename GridDataT,
typename... ArgsT>
4892 switch (gridData->mGridType){
4894 return OpT::template known<float>(gridData, args...);
4896 return OpT::template known<double>(gridData, args...);
4898 return OpT::template known<int16_t>(gridData, args...);
4900 return OpT::template known<int32_t>(gridData, args...);
4902 return OpT::template known<int64_t>(gridData, args...);
4904 return OpT::template known<Vec3f>(gridData, args...);
4906 return OpT::template known<Vec3d>(gridData, args...);
4908 return OpT::template known<uint32_t>(gridData, args...);
4910 return OpT::template known<ValueMask>(gridData, args...);
4912 return OpT::template known<ValueIndex>(gridData, args...);
4914 return OpT::template known<ValueOnIndex>(gridData, args...);
4916 return OpT::template known<ValueIndexMask>(gridData, args...);
4918 return OpT::template known<ValueOnIndexMask>(gridData, args...);
4920 return OpT::template known<bool>(gridData, args...);
4922 return OpT::template known<math::Rgba8>(gridData, args...);
4924 return OpT::template known<Fp4>(gridData, args...);
4926 return OpT::template known<Fp8>(gridData, args...);
4928 return OpT::template known<Fp16>(gridData, args...);
4930 return OpT::template known<FpN>(gridData, args...);
4932 return OpT::template known<Vec4f>(gridData, args...);
4934 return OpT::template known<Vec4d>(gridData, args...);
4936 return OpT::template known<uint8_t>(gridData, args...);
4938 return OpT::unknown(gridData, args...);
4963template<
typename BuildT>
4973 mutable const RootT* mRoot;
4980#ifndef NANOVDB_NEW_ACCESSOR_METHODS
5021#ifdef NANOVDB_NEW_ACCESSOR_METHODS
5034 __hostdev__ ValueType getValue(
const CoordType& ijk)
const
5036 return mRoot->getValueAndCache(ijk, *
this);
5038 __hostdev__ ValueType getValue(
int i,
int j,
int k)
const
5040 return this->getValue(CoordType(i, j, k));
5042 __hostdev__ ValueType operator()(
const CoordType& ijk)
const
5044 return this->getValue(ijk);
5046 __hostdev__ ValueType operator()(
int i,
int j,
int k)
const
5048 return this->getValue(CoordType(i, j, k));
5051 __hostdev__ NodeInfo getNodeInfo(
const CoordType& ijk)
const
5053 return mRoot->getNodeInfoAndCache(ijk, *
this);
5056 __hostdev__ bool isActive(
const CoordType& ijk)
const
5058 return mRoot->isActiveAndCache(ijk, *
this);
5061 __hostdev__ bool probeValue(
const CoordType& ijk, ValueType& v)
const
5063 return mRoot->probeValueAndCache(ijk, v, *
this);
5066 __hostdev__ const LeafT* probeLeaf(
const CoordType& ijk)
const
5068 return mRoot->probeLeafAndCache(ijk, *
this);
5071 template<
typename RayT>
5074 return mRoot->getDimAndCache(ijk, ray, *
this);
5076 template<
typename OpT,
typename... ArgsT>
5079 return mRoot->template
get<OpT>(ijk, args...);
5082 template<
typename OpT,
typename... ArgsT>
5085 return const_cast<RootT*
>(mRoot)->
template set<OpT>(ijk, args...);
5092 template<
typename, u
int32_t>
5094 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5098 template<
typename NodeT>
5103template<
typename BuildT,
int LEVEL0>
5106 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 should be 0, 1, or 2");
5120 mutable CoordT mKey;
5121 mutable const RootT* mRoot;
5122 mutable const NodeT* mNode;
5130#ifndef NANOVDB_NEW_ACCESSOR_METHODS
5131 using NodeInfo =
typename ReadAccessor<ValueT, -1, -1, -1>::NodeInfo;
5156 mKey = CoordType::max();
5169 return (ijk[0] & int32_t(~NodeT::MASK)) == mKey[0] &&
5170 (ijk[1] & int32_t(~NodeT::MASK)) == mKey[1] &&
5171 (ijk[2] & int32_t(~NodeT::MASK)) == mKey[2];
5174#ifdef NANOVDB_NEW_ACCESSOR_METHODS
5187 __hostdev__ ValueType getValue(
const CoordType& ijk)
const
5189 if (this->isCached(ijk))
5190 return mNode->getValueAndCache(ijk, *
this);
5191 return mRoot->getValueAndCache(ijk, *
this);
5193 __hostdev__ ValueType getValue(
int i,
int j,
int k)
const
5195 return this->getValue(CoordType(i, j, k));
5197 __hostdev__ ValueType operator()(
const CoordType& ijk)
const
5199 return this->getValue(ijk);
5201 __hostdev__ ValueType operator()(
int i,
int j,
int k)
const
5203 return this->getValue(CoordType(i, j, k));
5206 __hostdev__ NodeInfo getNodeInfo(
const CoordType& ijk)
const
5208 if (this->isCached(ijk))
5209 return mNode->getNodeInfoAndCache(ijk, *
this);
5210 return mRoot->getNodeInfoAndCache(ijk, *
this);
5213 __hostdev__ bool isActive(
const CoordType& ijk)
const
5215 if (this->isCached(ijk))
5216 return mNode->isActiveAndCache(ijk, *
this);
5217 return mRoot->isActiveAndCache(ijk, *
this);
5220 __hostdev__ bool probeValue(
const CoordType& ijk, ValueType& v)
const
5222 if (this->isCached(ijk))
5223 return mNode->probeValueAndCache(ijk, v, *
this);
5224 return mRoot->probeValueAndCache(ijk, v, *
this);
5227 __hostdev__ const LeafT* probeLeaf(
const CoordType& ijk)
const
5229 if (this->isCached(ijk))
5230 return mNode->probeLeafAndCache(ijk, *
this);
5231 return mRoot->probeLeafAndCache(ijk, *
this);
5234 template<
typename RayT>
5238 return mNode->getDimAndCache(ijk, ray, *
this);
5239 return mRoot->getDimAndCache(ijk, ray, *
this);
5242 template<
typename OpT,
typename... ArgsT>
5246 return mNode->template getAndCache<OpT>(ijk, *
this, args...);
5247 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5250 template<
typename OpT,
typename... ArgsT>
5254 return const_cast<NodeT*
>(mNode)->
template setAndCache<OpT>(ijk, *
this, args...);
5255 return const_cast<RootT*
>(mRoot)->
template setAndCache<OpT>(ijk, *
this, args...);
5262 template<
typename, u
int32_t>
5264 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5270 mKey = ijk & ~NodeT::MASK;
5275 template<
typename OtherNodeT>
5276 __hostdev__ void insert(
const CoordType&,
const OtherNodeT*)
const {}
5280template<
typename BuildT,
int LEVEL0,
int LEVEL1>
5283 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 must be 0, 1, 2");
5284 static_assert(LEVEL1 >= 0 && LEVEL1 <= 2,
"LEVEL1 must be 0, 1, 2");
5285 static_assert(LEVEL0 < LEVEL1,
"Level 0 must be lower than level 1");
5298#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5299 mutable CoordT mKey;
5301 mutable CoordT mKeys[2];
5303 mutable const RootT* mRoot;
5304 mutable const Node1T* mNode1;
5305 mutable const Node2T* mNode2;
5313#ifndef NANOVDB_NEW_ACCESSOR_METHODS
5314 using NodeInfo =
typename ReadAccessor<ValueT, -1, -1, -1>::NodeInfo;
5318#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5319 : mKey(CoordType::max())
5321 : mKeys{CoordType::max(), CoordType::max()}
5344#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5345 mKey = CoordType::max();
5347 mKeys[0] = mKeys[1] = CoordType::max();
5360#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5365 if (dirty & int32_t(~Node1T::MASK)) {
5371 __hostdev__ bool isCached2(CoordValueType dirty)
const
5375 if (dirty & int32_t(~Node2T::MASK)) {
5381 __hostdev__ CoordValueType computeDirty(
const CoordType& ijk)
const
5383 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
5388 return (ijk[0] & int32_t(~Node1T::MASK)) == mKeys[0][0] &&
5389 (ijk[1] & int32_t(~Node1T::MASK)) == mKeys[0][1] &&
5390 (ijk[2] & int32_t(~Node1T::MASK)) == mKeys[0][2];
5394 return (ijk[0] & int32_t(~Node2T::MASK)) == mKeys[1][0] &&
5395 (ijk[1] & int32_t(~Node2T::MASK)) == mKeys[1][1] &&
5396 (ijk[2] & int32_t(~Node2T::MASK)) == mKeys[1][2];
5400#ifdef NANOVDB_NEW_ACCESSOR_METHODS
5414 __hostdev__ ValueType getValue(
const CoordType& ijk)
const
5416#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5417 const CoordValueType dirty = this->computeDirty(ijk);
5421 if (this->isCached1(dirty)) {
5422 return mNode1->getValueAndCache(ijk, *
this);
5423 }
else if (this->isCached2(dirty)) {
5424 return mNode2->getValueAndCache(ijk, *
this);
5426 return mRoot->getValueAndCache(ijk, *
this);
5428 __hostdev__ ValueType operator()(
const CoordType& ijk)
const
5430 return this->getValue(ijk);
5432 __hostdev__ ValueType operator()(
int i,
int j,
int k)
const
5434 return this->getValue(CoordType(i, j, k));
5436 __hostdev__ ValueType getValue(
int i,
int j,
int k)
const
5438 return this->getValue(CoordType(i, j, k));
5440 __hostdev__ NodeInfo getNodeInfo(
const CoordType& ijk)
const
5442#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5443 const CoordValueType dirty = this->computeDirty(ijk);
5447 if (this->isCached1(dirty)) {
5448 return mNode1->getNodeInfoAndCache(ijk, *
this);
5449 }
else if (this->isCached2(dirty)) {
5450 return mNode2->getNodeInfoAndCache(ijk, *
this);
5452 return mRoot->getNodeInfoAndCache(ijk, *
this);
5455 __hostdev__ bool isActive(
const CoordType& ijk)
const
5457#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5458 const CoordValueType dirty = this->computeDirty(ijk);
5462 if (this->isCached1(dirty)) {
5463 return mNode1->isActiveAndCache(ijk, *
this);
5464 }
else if (this->isCached2(dirty)) {
5465 return mNode2->isActiveAndCache(ijk, *
this);
5467 return mRoot->isActiveAndCache(ijk, *
this);
5470 __hostdev__ bool probeValue(
const CoordType& ijk, ValueType& v)
const
5472#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5473 const CoordValueType dirty = this->computeDirty(ijk);
5477 if (this->isCached1(dirty)) {
5478 return mNode1->probeValueAndCache(ijk, v, *
this);
5479 }
else if (this->isCached2(dirty)) {
5480 return mNode2->probeValueAndCache(ijk, v, *
this);
5482 return mRoot->probeValueAndCache(ijk, v, *
this);
5485 __hostdev__ const LeafT* probeLeaf(
const CoordType& ijk)
const
5487#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5488 const CoordValueType dirty = this->computeDirty(ijk);
5492 if (this->isCached1(dirty)) {
5493 return mNode1->probeLeafAndCache(ijk, *
this);
5494 }
else if (this->isCached2(dirty)) {
5495 return mNode2->probeLeafAndCache(ijk, *
this);
5497 return mRoot->probeLeafAndCache(ijk, *
this);
5501 template<
typename RayT>
5504#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5505 const CoordValueType dirty = this->computeDirty(ijk);
5510 return mNode1->getDimAndCache(ijk, ray, *
this);
5512 return mNode2->getDimAndCache(ijk, ray, *
this);
5514 return mRoot->getDimAndCache(ijk, ray, *
this);
5517 template<
typename OpT,
typename... ArgsT>
5520#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5521 const CoordValueType dirty = this->computeDirty(ijk);
5526 return mNode1->template getAndCache<OpT>(ijk, *
this, args...);
5528 return mNode2->template getAndCache<OpT>(ijk, *
this, args...);
5530 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5533 template<
typename OpT,
typename... ArgsT>
5536#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5537 const CoordValueType dirty = this->computeDirty(ijk);
5542 return const_cast<Node1T*
>(mNode1)->
template setAndCache<OpT>(ijk, *
this, args...);
5544 return const_cast<Node2T*
>(mNode2)->
template setAndCache<OpT>(ijk, *
this, args...);
5546 return const_cast<RootT*
>(mRoot)->
template setAndCache<OpT>(ijk, *
this, args...);
5553 template<
typename, u
int32_t>
5555 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5561#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5564 mKeys[0] = ijk & ~Node1T::MASK;
5568 __hostdev__ void insert(
const CoordType& ijk,
const Node2T* node)
const
5570#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5573 mKeys[1] = ijk & ~Node2T::MASK;
5577 template<
typename OtherNodeT>
5578 __hostdev__ void insert(
const CoordType&,
const OtherNodeT*)
const {}
5582template<
typename BuildT>
5583class ReadAccessor<BuildT, 0, 1, 2>
5585 using GridT = NanoGrid<BuildT>;
5586 using TreeT = NanoTree<BuildT>;
5587 using RootT = NanoRoot<BuildT>;
5588 using NodeT2 = NanoUpper<BuildT>;
5589 using NodeT1 = NanoLower<BuildT>;
5590 using LeafT = NanoLeaf<BuildT>;
5591 using CoordT =
typename RootT::CoordType;
5592 using ValueT =
typename RootT::ValueType;
5594 using FloatType =
typename RootT::FloatType;
5595 using CoordValueType =
typename RootT::CoordT::ValueType;
5598#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5599 mutable CoordT mKey;
5601 mutable CoordT mKeys[3];
5603 mutable const RootT* mRoot;
5604 mutable const void* mNode[3];
5607 using BuildType = BuildT;
5608 using ValueType = ValueT;
5609 using CoordType = CoordT;
5611 static const int CacheLevels = 3;
5612#ifndef NANOVDB_NEW_ACCESSOR_METHODS
5613 using NodeInfo =
typename ReadAccessor<ValueT, -1, -1, -1>::NodeInfo;
5617#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5618 : mKey(CoordType::max())
5620 : mKeys{CoordType::max(), CoordType::max(), CoordType::max()}
5623 , mNode{
nullptr,
nullptr,
nullptr}
5629 : ReadAccessor(grid.tree().root())
5635 : ReadAccessor(tree.root())
5639 __hostdev__ const RootT& root()
const {
return *mRoot; }
5642 ReadAccessor(
const ReadAccessor&) =
default;
5643 ~ReadAccessor() =
default;
5644 ReadAccessor& operator=(
const ReadAccessor&) =
default;
5649 template<
typename NodeT>
5652 using T =
typename NodeTrait<TreeT, NodeT::LEVEL>::type;
5653 static_assert(util::is_same<T, NodeT>::value,
"ReadAccessor::getNode: Invalid node type");
5654 return reinterpret_cast<const T*
>(mNode[NodeT::LEVEL]);
5658 __hostdev__ const typename NodeTrait<TreeT, LEVEL>::type* getNode()
const
5660 using T =
typename NodeTrait<TreeT, LEVEL>::type;
5661 static_assert(LEVEL >= 0 && LEVEL <= 2,
"ReadAccessor::getNode: Invalid node type");
5662 return reinterpret_cast<const T*
>(mNode[LEVEL]);
5668#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5669 mKey = CoordType::max();
5671 mKeys[0] = mKeys[1] = mKeys[2] = CoordType::max();
5673 mNode[0] = mNode[1] = mNode[2] =
nullptr;
5676#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5677 template<
typename NodeT>
5678 __hostdev__ bool isCached(CoordValueType dirty)
const
5680 if (!mNode[NodeT::LEVEL])
5682 if (dirty & int32_t(~NodeT::MASK)) {
5683 mNode[NodeT::LEVEL] =
nullptr;
5689 __hostdev__ CoordValueType computeDirty(
const CoordType& ijk)
const
5691 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
5694 template<
typename NodeT>
5695 __hostdev__ bool isCached(
const CoordType& ijk)
const
5697 return (ijk[0] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][0] &&
5698 (ijk[1] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][1] &&
5699 (ijk[2] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][2];
5703#ifdef NANOVDB_NEW_ACCESSOR_METHODS
5704 __hostdev__ ValueType getValue(
const CoordType& ijk)
const
5706 return this->
template get<GetValue<BuildT>>(ijk);
5708 __hostdev__ ValueType getValue(
int i,
int j,
int k)
const {
return this->
template get<GetValue<BuildT>>(CoordType(i, j, k)); }
5709 __hostdev__ ValueType operator()(
const CoordType& ijk)
const {
return this->
template get<GetValue<BuildT>>(ijk); }
5710 __hostdev__ ValueType operator()(
int i,
int j,
int k)
const {
return this->
template get<GetValue<BuildT>>(CoordType(i, j, k)); }
5711 __hostdev__ auto getNodeInfo(
const CoordType& ijk)
const {
return this->
template get<GetNodeInfo<BuildT>>(ijk); }
5712 __hostdev__ bool isActive(
const CoordType& ijk)
const {
return this->
template get<GetState<BuildT>>(ijk); }
5713 __hostdev__ bool probeValue(
const CoordType& ijk, ValueType& v)
const {
return this->
template get<ProbeValue<BuildT>>(ijk, v); }
5714 __hostdev__ const LeafT* probeLeaf(
const CoordType& ijk)
const {
return this->
template get<GetLeaf<BuildT>>(ijk); }
5717 __hostdev__ ValueType getValue(
const CoordType& ijk)
const
5719#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5720 const CoordValueType dirty = this->computeDirty(ijk);
5724 if (this->isCached<LeafT>(dirty)) {
5725 return ((LeafT*)mNode[0])->getValue(ijk);
5726 }
else if (this->isCached<NodeT1>(dirty)) {
5727 return ((NodeT1*)mNode[1])->getValueAndCache(ijk, *
this);
5728 }
else if (this->isCached<NodeT2>(dirty)) {
5729 return ((NodeT2*)mNode[2])->getValueAndCache(ijk, *
this);
5731 return mRoot->getValueAndCache(ijk, *
this);
5733 __hostdev__ ValueType operator()(
const CoordType& ijk)
const
5735 return this->getValue(ijk);
5737 __hostdev__ ValueType operator()(
int i,
int j,
int k)
const
5739 return this->getValue(CoordType(i, j, k));
5741 __hostdev__ ValueType getValue(
int i,
int j,
int k)
const
5743 return this->getValue(CoordType(i, j, k));
5746 __hostdev__ NodeInfo getNodeInfo(
const CoordType& ijk)
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])->getNodeInfoAndCache(ijk, *
this);
5755 }
else if (this->isCached<NodeT1>(dirty)) {
5756 return ((NodeT1*)mNode[1])->getNodeInfoAndCache(ijk, *
this);
5757 }
else if (this->isCached<NodeT2>(dirty)) {
5758 return ((NodeT2*)mNode[2])->getNodeInfoAndCache(ijk, *
this);
5760 return mRoot->getNodeInfoAndCache(ijk, *
this);
5763 __hostdev__ bool isActive(
const CoordType& ijk)
const
5765#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5766 const CoordValueType dirty = this->computeDirty(ijk);
5770 if (this->isCached<LeafT>(dirty)) {
5771 return ((LeafT*)mNode[0])->isActive(ijk);
5772 }
else if (this->isCached<NodeT1>(dirty)) {
5773 return ((NodeT1*)mNode[1])->isActiveAndCache(ijk, *
this);
5774 }
else if (this->isCached<NodeT2>(dirty)) {
5775 return ((NodeT2*)mNode[2])->isActiveAndCache(ijk, *
this);
5777 return mRoot->isActiveAndCache(ijk, *
this);
5780 __hostdev__ bool probeValue(
const CoordType& ijk, ValueType& v)
const
5782#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5783 const CoordValueType dirty = this->computeDirty(ijk);
5787 if (this->isCached<LeafT>(dirty)) {
5788 return ((LeafT*)mNode[0])->probeValue(ijk, v);
5789 }
else if (this->isCached<NodeT1>(dirty)) {
5790 return ((NodeT1*)mNode[1])->probeValueAndCache(ijk, v, *
this);
5791 }
else if (this->isCached<NodeT2>(dirty)) {
5792 return ((NodeT2*)mNode[2])->probeValueAndCache(ijk, v, *
this);
5794 return mRoot->probeValueAndCache(ijk, v, *
this);
5796 __hostdev__ const LeafT* probeLeaf(
const CoordType& ijk)
const
5798#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5799 const CoordValueType dirty = this->computeDirty(ijk);
5803 if (this->isCached<LeafT>(dirty)) {
5804 return ((LeafT*)mNode[0]);
5805 }
else if (this->isCached<NodeT1>(dirty)) {
5806 return ((NodeT1*)mNode[1])->probeLeafAndCache(ijk, *
this);
5807 }
else if (this->isCached<NodeT2>(dirty)) {
5808 return ((NodeT2*)mNode[2])->probeLeafAndCache(ijk, *
this);
5810 return mRoot->probeLeafAndCache(ijk, *
this);
5814 template<
typename OpT,
typename... ArgsT>
5815 __hostdev__ auto get(
const CoordType& ijk, ArgsT&&... args)
const
5817#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5818 const CoordValueType dirty = this->computeDirty(ijk);
5822 if (this->isCached<LeafT>(dirty)) {
5823 return ((
const LeafT*)mNode[0])->template getAndCache<OpT>(ijk, *
this, args...);
5824 }
else if (this->isCached<NodeT1>(dirty)) {
5825 return ((
const NodeT1*)mNode[1])->template getAndCache<OpT>(ijk, *
this, args...);
5826 }
else if (this->isCached<NodeT2>(dirty)) {
5827 return ((
const NodeT2*)mNode[2])->template getAndCache<OpT>(ijk, *
this, args...);
5829 return mRoot->template getAndCache<OpT>(ijk, *
this, args...);
5832 template<
typename OpT,
typename... ArgsT>
5833 __hostdev__ auto set(
const CoordType& ijk, ArgsT&&... args)
const
5835#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5836 const CoordValueType dirty = this->computeDirty(ijk);
5840 if (this->isCached<LeafT>(dirty)) {
5841 return ((LeafT*)mNode[0])->template setAndCache<OpT>(ijk, *
this, args...);
5842 }
else if (this->isCached<NodeT1>(dirty)) {
5843 return ((NodeT1*)mNode[1])->template setAndCache<OpT>(ijk, *
this, args...);
5844 }
else if (this->isCached<NodeT2>(dirty)) {
5845 return ((NodeT2*)mNode[2])->template setAndCache<OpT>(ijk, *
this, args...);
5847 return ((RootT*)mRoot)->template setAndCache<OpT>(ijk, *
this, args...);
5850 template<
typename RayT>
5851 __hostdev__ uint32_t getDim(
const CoordType& ijk,
const RayT& ray)
const
5853#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5854 const CoordValueType dirty = this->computeDirty(ijk);
5858 if (this->isCached<LeafT>(dirty)) {
5859 return ((LeafT*)mNode[0])->getDimAndCache(ijk, ray, *
this);
5860 }
else if (this->isCached<NodeT1>(dirty)) {
5861 return ((NodeT1*)mNode[1])->getDimAndCache(ijk, ray, *
this);
5862 }
else if (this->isCached<NodeT2>(dirty)) {
5863 return ((NodeT2*)mNode[2])->getDimAndCache(ijk, ray, *
this);
5865 return mRoot->getDimAndCache(ijk, ray, *
this);
5871 friend class RootNode;
5872 template<
typename, u
int32_t>
5873 friend class InternalNode;
5874 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5875 friend class LeafNode;
5878 template<
typename NodeT>
5879 __hostdev__ void insert(
const CoordType& ijk,
const NodeT* node)
const
5881#ifdef NANOVDB_USE_SINGLE_ACCESSOR_KEY
5884 mKeys[NodeT::LEVEL] = ijk & ~NodeT::MASK;
5886 mNode[NodeT::LEVEL] = node;
5904template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5910template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5916template<
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5932 CoordBBox mIndexBBox;
5933 uint32_t mRootTableSize, mPadding{0};
5936 template<
typename T>
5939 mGridData = *grid.
data();
5940 mTreeData = *grid.
tree().data();
5942 mRootTableSize = grid.
tree().root().getTableSize();
5947 *
this = *
reinterpret_cast<const GridMetaData*
>(gridData);
5950 mGridData = *gridData;
5970 template<
typename T>
6010template<
typename AttT,
typename BuildT = u
int32_t>
6019 : AccT(
grid.tree().root())
6021 , mData(
grid.template getBlindData<AttT>(0))
6037 const uint64_t count = mGrid.blindMetaData(0u).mValueCount;
6039 end = begin + count;
6047 auto* leaf = this->probeLeaf(ijk);
6048 if (leaf ==
nullptr) {
6051 begin = mData + leaf->minimum();
6052 end = begin + leaf->maximum();
6053 return leaf->maximum();
6059 begin = end =
nullptr;
6060 if (
auto* leaf = this->probeLeaf(ijk)) {
6062 if (leaf->isActive(offset)) {
6063 begin = mData + leaf->minimum();
6064 end = begin + leaf->getValue(offset);
6066 begin += leaf->getValue(offset - 1);
6073template<
typename AttT>
6082 : AccT(
grid.tree().root())
6084 , mData(
grid.template getBlindData<AttT>(0))
6104 const uint64_t count = mGrid.blindMetaData(0u).mValueCount;
6106 end = begin + count;
6114 auto* leaf = this->probeLeaf(ijk);
6115 if (leaf ==
nullptr)
6117 begin = mData + leaf->offset();
6118 end = begin + leaf->pointCount();
6119 return leaf->pointCount();
6125 if (
auto* leaf = this->probeLeaf(ijk)) {
6127 if (leaf->isActive(n)) {
6128 begin = mData + leaf->first(n);
6129 end = mData + leaf->last(n);
6133 begin = end =
nullptr;
6141template<
typename ChannelT,
typename IndexT = ValueIndex>
6171 , mChannel(channelPtr)
6202 return mChannel =
const_cast<ChannelT*
>(mGrid.template getBlindData<ChannelT>(channelID));
6207 __hostdev__ uint64_t
idx(
int i,
int j,
int k)
const {
return BaseT::getValue(math::Coord(i, j, k)); }
6218 const bool isActive = BaseT::probeValue(ijk,
idx);
6225 template<
typename T>
6226 __hostdev__ T&
getValue(
const math::Coord& ijk, T* channelPtr)
const {
return channelPtr[BaseT::getValue(ijk)]; }
6234struct MiniGridHandle {
6239 BufferType(BufferType &&other) : data(other.data), size(other.size) {other.data=
nullptr; other.size=0;}
6240 ~BufferType() {std::free(data);}
6241 BufferType& operator=(
const BufferType &other) =
delete;
6242 BufferType& operator=(BufferType &&other){data=other.data; size=other.size; other.data=
nullptr; other.size=0;
return *
this;}
6243 static BufferType create(
size_t n, BufferType* dummy =
nullptr) {
return BufferType(n);}
6245 MiniGridHandle(BufferType &&buf) : buffer(std::move(buf)) {}
6246 const uint8_t* data()
const {
return buffer.data;}
6328#if !defined(__CUDA_ARCH__) && !defined(__HIP__)
6351template<
typename StreamT>
6357#ifdef NANOVDB_USE_NEW_MAGIC_NUMBERS
6362 const char* gridName = gridData->
gridName();
6371 os.write((
const char*)&head,
sizeof(
FileHeader));
6373 os.write(gridName, nameSize);
6375 os.write((
const char*)gridData, gridData->
mGridSize);
6380template<
typename GridHandleT,
template<
typename...>
class VecT>
6383#ifdef NANOVDB_USE_IOSTREAMS
6384 std::ofstream os(fileName, std::ios::out | std::ios::binary | std::ios::trunc);
6388 StreamT(
const char* name) { fptr = fopen(name,
"wb"); }
6389 ~StreamT() { fclose(fptr); }
6390 void write(
const char* data,
size_t n) { fwrite(data, 1, n, fptr); }
6391 bool is_open()
const {
return fptr != NULL; }
6394 if (!os.is_open()) {
6395 fprintf(stderr,
"nanovdb::writeUncompressedGrids: Unable to open file \"%s\"for output\n", fileName);
6398 for (
auto& h : handles) {
6408template<
typename GridHandleT,
typename StreamT,
template<
typename...>
class VecT>
6409VecT<GridHandleT>
readUncompressedGrids(StreamT& is,
const typename GridHandleT::BufferType& pool =
typename GridHandleT::BufferType())
6411 VecT<GridHandleT> handles;
6413 is.read((
char*)&data,
sizeof(
GridData));
6415 uint64_t size = data.
mGridSize, sum = 0u;
6418 is.read((
char*)&data,
sizeof(
GridData));
6419 sum += data.mGridSize;
6421 is.skip(-int64_t(sum +
sizeof(
GridData)));
6422 auto buffer = GridHandleT::BufferType::create(size + sum, &pool);
6423 is.read((
char*)(buffer.data()), buffer.size());
6424 handles.emplace_back(std::move(buffer));
6428 while(is.read((
char*)&head,
sizeof(
FileHeader))) {
6430 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid magic number = \"%s\"\n", (
const char*)&(head.
magic));
6434 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid major version = \"%s\"\n",
toStr(str, head.
version));
6438 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid codec = \"%s\"\n",
toStr(str, head.
codec));
6442 for (uint16_t i = 0; i < head.
gridCount; ++i) {
6444 is.skip(meta.nameSize);
6445 auto buffer = GridHandleT::BufferType::create(meta.gridSize, &pool);
6446 is.read((
char*)buffer.data(), meta.gridSize);
6447 handles.emplace_back(std::move(buffer));
6455template<
typename GridHandleT,
template<
typename...>
class VecT>
6456VecT<GridHandleT>
readUncompressedGrids(
const char* fileName,
const typename GridHandleT::BufferType& buffer =
typename GridHandleT::BufferType())
6458#ifdef NANOVDB_USE_IOSTREAMS
6459 struct StreamT :
public std::ifstream {
6460 StreamT(
const char* name) : std::ifstream(name, std::ios::in | std::ios::binary){}
6461 void skip(int64_t off) { this->seekg(off, std::ios_base::cur); }
6466 StreamT(
const char* name) { fptr = fopen(name,
"rb"); }
6467 ~StreamT() { fclose(fptr); }
6468 bool read(
char* data,
size_t n) {
6469 size_t m = fread(data, 1, n, fptr);
6472 void skip(int64_t off) { fseek(fptr, (
long int)off, SEEK_CUR); }
6473 bool is_open()
const {
return fptr != NULL; }
6476 StreamT is(fileName);
6477 if (!is.is_open()) {
6478 fprintf(stderr,
"nanovdb::readUncompressedGrids: Unable to open file \"%s\"for input\n", fileName);
6493template<
typename BuildT>
6503template<
typename BuildT>
6515template<
typename BuildT>
6529template<
typename BuildT>
6541template<
typename BuildT>
6553template<
typename BuildT>
6565template<
typename BuildT>
6577template<
typename BuildT>
6589template<
typename BuildT>
6601 return tile.state > 0u;
6622template<
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:6212
__hostdev__ ChannelT * setChannel(uint32_t channelID)
Change to an internal channel, assuming it exists as as blind data in the IndexGrid.
Definition NanoVDB.h:6200
NanoTree< IndexT > TreeType
Definition NanoVDB.h:6152
__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:6206
__hostdev__ ChannelAccessor(const NanoGrid< IndexT > &grid, ChannelT *channelPtr)
Ctor from an IndexGrid and an external channel.
Definition NanoVDB.h:6168
__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:6215
__hostdev__ const uint64_t & valueCount() const
Return total number of values indexed by the IndexGrid.
Definition NanoVDB.h:6190
__hostdev__ ChannelT & operator()(const math::Coord &ijk) const
Definition NanoVDB.h:6211
__hostdev__ uint64_t idx(int i, int j, int k) const
Definition NanoVDB.h:6207
__hostdev__ const TreeType & tree() const
Definition NanoVDB.h:6184
__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:6157
__hostdev__ const NanoGrid< IndexT > & grid() const
Definition NanoVDB.h:6181
ChannelT ValueType
Definition NanoVDB.h:6151
ChannelAccessor< ChannelT, IndexT > AccessorType
Definition NanoVDB.h:6153
__hostdev__ const Vec3d & voxelSize() const
Return a vector of the axial voxel sizes.
Definition NanoVDB.h:6187
__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:6226
__hostdev__ ChannelT * setChannel(ChannelT *channelPtr)
Definition NanoVDB.h:6194
__hostdev__ ChannelT & getValue(const math::Coord &ijk) const
Return the value from a cached channel that maps to the specified coordinate.
Definition NanoVDB.h:6210
Class that encapsulates two CRC32 checksums, one for the Grid, Tree and Root node meta data and one f...
Definition NanoVDB.h:1741
__hostdev__ Checksum(uint64_t checksum, CheckMode mode=CheckMode::Full)
Definition NanoVDB.h:1764
__hostdev__ bool isFull() const
return true if the 64 bit checksum is fill, i.e. of both had and nodes
Definition NanoVDB.h:1790
__hostdev__ Checksum(uint32_t head, uint32_t tail)
Constructor that allows the two 32bit checksums to be initiated explicitly.
Definition NanoVDB.h:1759
__hostdev__ uint64_t checksum() const
return the 64 bit checksum of this instance
Definition NanoVDB.h:1771
__hostdev__ uint64_t full() const
Definition NanoVDB.h:1777
__hostdev__ uint64_t & full()
Definition NanoVDB.h:1778
__hostdev__ bool isEmpty() const
return true if the 64 bit checksum is disables (unset)
Definition NanoVDB.h:1793
__hostdev__ bool operator==(const Checksum &rhs) const
return true if the checksums are identical
Definition NanoVDB.h:1806
__hostdev__ Checksum()
default constructor initiates checksum to EMPTY
Definition NanoVDB.h:1754
__hostdev__ bool isHalf() const
Definition NanoVDB.h:1787
__hostdev__ uint32_t head() const
Definition NanoVDB.h:1779
__hostdev__ uint32_t & head()
Definition NanoVDB.h:1780
uint64_t mCRC64
Definition NanoVDB.h:1746
uint32_t mCRC32[2]
Definition NanoVDB.h:1746
static constexpr uint32_t EMPTY32
Definition NanoVDB.h:1750
__hostdev__ uint32_t tail() const
Definition NanoVDB.h:1781
__hostdev__ uint32_t checksum(int i) const
Definition NanoVDB.h:1775
__hostdev__ uint32_t & checksum(int i)
Definition NanoVDB.h:1773
__hostdev__ bool operator!=(const Checksum &rhs) const
return true if the checksums are not identical
Definition NanoVDB.h:1810
static constexpr uint64_t EMPTY64
Definition NanoVDB.h:1751
__hostdev__ bool isPartial() const
return true if the 64 bit checksum is partial, i.e. of head only
Definition NanoVDB.h:1786
__hostdev__ CheckMode mode() const
return the mode of the 64 bit checksum
Definition NanoVDB.h:1798
__hostdev__ uint32_t & tail()
Definition NanoVDB.h:1782
__hostdev__ void disable()
Definition NanoVDB.h:1795
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:2046
__hostdev__ const NanoTree< BuildT > & tree() const
Definition NanoVDB.h:2100
typename RootType::LeafNodeType LeafNodeType
Definition NanoVDB.h:2053
__hostdev__ const GridClass & gridClass() const
Definition NanoVDB.h:2175
typename TreeT::ValueType ValueType
Definition NanoVDB.h:2055
__hostdev__ DataType * data()
Definition NanoVDB.h:2069
__hostdev__ Vec3T worldToIndexF(const Vec3T &xyz) const
Definition NanoVDB.h:2139
typename TreeT::RootType RootType
Definition NanoVDB.h:2049
__hostdev__ bool hasMinMax() const
Definition NanoVDB.h:2184
__hostdev__ util::enable_if< util::is_same< T, Point >::value, constuint64_t & >::type pointCount() const
Definition NanoVDB.h:2097
__hostdev__ int findBlindData(const char *name) const
__hostdev__ const Map & map() const
Definition NanoVDB.h:2112
typename TreeT::CoordType CoordType
Definition NanoVDB.h:2057
typename RootNodeType::ChildNodeType UpperNodeType
Definition NanoVDB.h:2051
__hostdev__ const GridBlindMetaData & blindMetaData(uint32_t n) const
Definition NanoVDB.h:2251
__hostdev__ uint32_t blindDataCount() const
Definition NanoVDB.h:2217
__hostdev__ bool hasStdDeviation() const
Definition NanoVDB.h:2188
__hostdev__ BlindDataT * getBlindData(uint32_t n)
Definition NanoVDB.h:2245
__hostdev__ uint32_t gridIndex() const
Definition NanoVDB.h:2080
__hostdev__ bool isUnknown() const
Definition NanoVDB.h:2183
__hostdev__ Vec3T worldToIndexDir(const Vec3T &dir) const
Definition NanoVDB.h:2130
__hostdev__ const GridType & gridType() const
Definition NanoVDB.h:2174
__hostdev__ bool isSequential() const
Definition NanoVDB.h:2202
__hostdev__ const Checksum & checksum() const
Definition NanoVDB.h:2211
GridData DataType
Definition NanoVDB.h:2054
RootType RootNodeType
Definition NanoVDB.h:2050
__hostdev__ bool isValid() const
Definition NanoVDB.h:2173
__hostdev__ uint64_t gridSize() const
Definition NanoVDB.h:2077
__hostdev__ Version version() const
Definition NanoVDB.h:2067
__hostdev__ Vec3T indexToWorldGrad(const Vec3T &grad) const
Definition NanoVDB.h:2135
__hostdev__ bool hasLongGridName() const
Definition NanoVDB.h:2186
__hostdev__ Vec3T indexToWorldGradF(const Vec3T &grad) const
Definition NanoVDB.h:2158
__hostdev__ bool hasBBox() const
Definition NanoVDB.h:2185
__hostdev__ util::enable_if< BuildTraits< T >::is_index, constuint64_t & >::type valueCount() const
Definition NanoVDB.h:2090
__hostdev__ Vec3T indexToWorldDirF(const Vec3T &dir) const
Definition NanoVDB.h:2148
__hostdev__ const char * shortGridName() const
Definition NanoVDB.h:2208
__hostdev__ const char * gridName() const
Definition NanoVDB.h:2205
__hostdev__ bool isMask() const
Definition NanoVDB.h:2182
__hostdev__ const BlindDataT * getBlindData(uint32_t n) const
Definition NanoVDB.h:2238
__hostdev__ uint64_t activeVoxelCount() const
Definition NanoVDB.h:2170
DefaultReadAccessor< BuildType > AccessorType
Definition NanoVDB.h:2058
__hostdev__ bool isBreadthFirst() const
Definition NanoVDB.h:2189
__hostdev__ bool isPointIndex() const
Definition NanoVDB.h:2179
__hostdev__ bool hasAverage() const
Definition NanoVDB.h:2187
__hostdev__ bool isGridIndex() const
Definition NanoVDB.h:2180
__hostdev__ Vec3T indexToWorldDir(const Vec3T &dir) const
Definition NanoVDB.h:2125
__hostdev__ Vec3T indexToWorld(const Vec3T &xyz) const
Definition NanoVDB.h:2120
__hostdev__ bool isLevelSet() const
Definition NanoVDB.h:2176
__hostdev__ uint32_t gridCount() const
Definition NanoVDB.h:2083
__hostdev__ bool isPointData() const
Definition NanoVDB.h:2181
typename UpperNodeType::ChildNodeType LowerNodeType
Definition NanoVDB.h:2052
__hostdev__ AccessorType getAccessor() const
Definition NanoVDB.h:2106
__hostdev__ Vec3T worldToIndex(const Vec3T &xyz) const
Definition NanoVDB.h:2116
__hostdev__ const void * blindData(uint32_t n) const
Definition NanoVDB.h:2230
__hostdev__ const DataType * data() const
Definition NanoVDB.h:2071
__hostdev__ bool isStaggered() const
Definition NanoVDB.h:2178
__hostdev__ Vec3T worldToIndexDirF(const Vec3T &dir) const
Definition NanoVDB.h:2153
__hostdev__ Vec3T indexToWorldF(const Vec3T &xyz) const
Definition NanoVDB.h:2143
__hostdev__ const Vec3d & voxelSize() const
Definition NanoVDB.h:2109
TreeT TreeType
Definition NanoVDB.h:2048
Grid(const Grid &)=delete
Disallow constructions, copy and assignment.
typename TreeT::BuildType BuildType
Definition NanoVDB.h:2056
Grid & operator=(const Grid &)=delete
__hostdev__ bool isFogVolume() const
Definition NanoVDB.h:2177
__hostdev__ bool isSequential() const
Definition NanoVDB.h:2194
__hostdev__ int findBlindDataForSemantic(GridBlindDataSemantic semantic) const
__hostdev__ NanoTree< BuildT > & tree()
Definition NanoVDB.h:2103
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:3335
__hostdev__ NodeT & operator*() const
Definition NanoVDB.h:3353
__hostdev__ ChildIter(ParentT *parent)
Definition NanoVDB.h:3347
ChildIter & operator=(const ChildIter &)=default
__hostdev__ CoordType getOrigin() const
Definition NanoVDB.h:3363
__hostdev__ NodeT * operator->() const
Definition NanoVDB.h:3358
__hostdev__ CoordType getCoord() const
Definition NanoVDB.h:3368
__hostdev__ ChildIter()
Definition NanoVDB.h:3342
DenseIterator & operator=(const DenseIterator &)=default
__hostdev__ DenseIterator(const InternalNode *parent)
Definition NanoVDB.h:3462
__hostdev__ CoordType getOrigin() const
Definition NanoVDB.h:3484
__hostdev__ const ChildT * probeChild(ValueType &value) const
Definition NanoVDB.h:3468
__hostdev__ bool isValueOn() const
Definition NanoVDB.h:3479
__hostdev__ DenseIterator()
Definition NanoVDB.h:3457
__hostdev__ CoordType getCoord() const
Definition NanoVDB.h:3489
ValueIterator & operator=(const ValueIterator &)=default
__hostdev__ ValueIterator(const InternalNode *parent)
Definition NanoVDB.h:3389
__hostdev__ ValueIterator()
Definition NanoVDB.h:3384
__hostdev__ CoordType getOrigin() const
Definition NanoVDB.h:3400
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:3395
__hostdev__ CoordType getCoord() const
Definition NanoVDB.h:3405
__hostdev__ bool isActive() const
Definition NanoVDB.h:3406
__hostdev__ ValueOnIterator(const InternalNode *parent)
Definition NanoVDB.h:3428
__hostdev__ ValueOnIterator()
Definition NanoVDB.h:3423
__hostdev__ CoordType getOrigin() const
Definition NanoVDB.h:3439
ValueOnIterator & operator=(const ValueOnIterator &)=default
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:3434
__hostdev__ CoordType getCoord() const
Definition NanoVDB.h:3444
Internal nodes of a VDB tree.
Definition NanoVDB.h:3309
__hostdev__ const MaskType< LOG2DIM > & childMask() const
Definition NanoVDB.h:3516
__hostdev__ const FloatType & stdDeviation() const
Definition NanoVDB.h:3535
__hostdev__ const ValueType & minimum() const
Definition NanoVDB.h:3523
__hostdev__ ConstChildIterator cbeginChild() const
Definition NanoVDB.h:3375
__hostdev__ const ChildNodeType * probeChild(const CoordType &ijk) const
Definition NanoVDB.h:3595
__hostdev__ const ValueType & maximum() const
Definition NanoVDB.h:3526
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3318
__hostdev__ DenseIterator beginDense() const
Definition NanoVDB.h:3492
__hostdev__ DataType * data()
Definition NanoVDB.h:3501
ChildIter< const InternalNode > ConstChildIterator
Definition NanoVDB.h:3372
__hostdev__ DenseIterator cbeginChildAll() const
Definition NanoVDB.h:3493
InternalData< ChildT, Log2Dim > DataType
Definition NanoVDB.h:3311
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:3557
static __hostdev__ Coord OffsetToLocalCoord(uint32_t n)
Definition NanoVDB.h:3610
__hostdev__ ChildNodeType * probeChild(const CoordType &ijk)
Definition NanoVDB.h:3590
friend class ReadAccessor
Definition NanoVDB.h:3658
static constexpr uint32_t MASK
Definition NanoVDB.h:3328
static __hostdev__ uint32_t dim()
Definition NanoVDB.h:3506
typename ChildT::CoordType CoordType
Definition NanoVDB.h:3317
static constexpr uint32_t LEVEL
Definition NanoVDB.h:3329
__hostdev__ const MaskType< LOG2DIM > & getValueMask() const
Definition NanoVDB.h:3513
__hostdev__ FloatType variance() const
Definition NanoVDB.h:3532
__hostdev__ ValueIterator cbeginValueAll() const
Definition NanoVDB.h:3414
friend class InternalNode
Definition NanoVDB.h:3663
static constexpr uint32_t DIM
Definition NanoVDB.h:3326
typename DataType::BuildT BuildType
Definition NanoVDB.h:3314
__hostdev__ void localToGlobalCoord(Coord &ijk) const
Definition NanoVDB.h:3618
typename Mask< Log2Dim >::template Iterator< On > MaskIterT
Definition NanoVDB.h:3322
__hostdev__ ValueType getFirstValue() const
Definition NanoVDB.h:3542
ChildT ChildNodeType
Definition NanoVDB.h:3316
typename DataType::ValueT ValueType
Definition NanoVDB.h:3312
typename DataType::StatsT FloatType
Definition NanoVDB.h:3313
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:3559
__hostdev__ ValueOnIterator beginValueOn() const
Definition NanoVDB.h:3447
__hostdev__ CoordType origin() const
Definition NanoVDB.h:3520
typename ChildT::LeafNodeType LeafNodeType
Definition NanoVDB.h:3315
static constexpr uint32_t TOTAL
Definition NanoVDB.h:3325
__hostdev__ auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:3635
ChildIter< InternalNode > ChildIterator
Definition NanoVDB.h:3371
__hostdev__ ValueOnIterator cbeginValueOn() const
Definition NanoVDB.h:3448
static constexpr uint32_t LOG2DIM
Definition NanoVDB.h:3324
__hostdev__ ValueType getLastValue() const
Definition NanoVDB.h:3549
__hostdev__ const math::BBox< CoordType > & bbox() const
Definition NanoVDB.h:3538
__hostdev__ decltype(OpT::set(util::declval< InternalNode & >(), util::declval< uint32_t >(), util::declval< ArgsT >()...)) set(const CoordType &ijk, ArgsT &&... args)
Definition NanoVDB.h:3646
__hostdev__ const MaskType< LOG2DIM > & getChildMask() const
Definition NanoVDB.h:3517
__hostdev__ ValueIterator beginValue() const
Definition NanoVDB.h:3413
static __hostdev__ uint32_t CoordToOffset(const CoordType &ijk)
Definition NanoVDB.h:3602
__hostdev__ Coord offsetToGlobalCoord(uint32_t n) const
Definition NanoVDB.h:3624
static constexpr uint32_t SIZE
Definition NanoVDB.h:3327
typename ChildT::template MaskType< LOG2 > MaskType
Definition NanoVDB.h:3320
__hostdev__ const LeafNodeType * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:3560
__hostdev__ ChildIterator beginChild()
Definition NanoVDB.h:3374
__hostdev__ const MaskType< LOG2DIM > & valueMask() const
Definition NanoVDB.h:3512
__hostdev__ const DataType * data() const
Definition NanoVDB.h:3503
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:3556
__hostdev__ const FloatType & average() const
Definition NanoVDB.h:3529
static constexpr uint64_t NUM_VALUES
Definition NanoVDB.h:3330
InternalNode & operator=(const InternalNode &)=delete
InternalNode(const InternalNode &)=delete
__hostdev__ bool isActive() const
Definition NanoVDB.h:3632
friend class RootNode
Definition NanoVDB.h:3661
static __hostdev__ size_t memUsage()
Definition NanoVDB.h:3509
ValueIterator & operator=(const ValueIterator &)=default
__hostdev__ CoordT getCoord() const
Definition NanoVDB.h:4472
__hostdev__ ValueIterator(const LeafNode *parent)
Definition NanoVDB.h:4460
__hostdev__ ValueIterator()
Definition NanoVDB.h:4455
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:4467
__hostdev__ ValueIterator & operator++()
Definition NanoVDB.h:4483
__hostdev__ ValueIterator operator++(int)
Definition NanoVDB.h:4488
__hostdev__ bool isActive() const
Definition NanoVDB.h:4477
__hostdev__ CoordT getCoord() const
Definition NanoVDB.h:4438
__hostdev__ ValueOffIterator()
Definition NanoVDB.h:4422
ValueOffIterator & operator=(const ValueOffIterator &)=default
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:4433
__hostdev__ ValueOffIterator(const LeafNode *parent)
Definition NanoVDB.h:4427
__hostdev__ ValueOnIterator()
Definition NanoVDB.h:4389
__hostdev__ CoordT getCoord() const
Definition NanoVDB.h:4405
__hostdev__ ValueOnIterator(const LeafNode *parent)
Definition NanoVDB.h:4394
ValueOnIterator & operator=(const ValueOnIterator &)=default
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:4400
Leaf nodes of the VDB tree. (defaults to 8x8x8 = 512 voxels)
Definition NanoVDB.h:4362
__hostdev__ void setValueOnly(uint32_t offset, const ValueType &v)
Sets the value at the specified location but leaves its state unchanged.
Definition NanoVDB.h:4604
__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:4529
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4376
__hostdev__ DataType * data()
Definition NanoVDB.h:4508
typename DataType::BuildType BuildType
Definition NanoVDB.h:4374
static __hostdev__ CoordT OffsetToLocalCoord(uint32_t n)
Compute the local coordinates from a linear offset.
Definition NanoVDB.h:4539
static __hostdev__ uint32_t padding()
Definition NanoVDB.h:4574
LeafData< BuildT, CoordT, MaskT, Log2Dim > DataType
Definition NanoVDB.h:4371
CoordT CoordType
Definition NanoVDB.h:4375
friend class ReadAccessor
Definition NanoVDB.h:4674
static constexpr uint32_t MASK
Definition NanoVDB.h:4504
__hostdev__ CoordT offsetToGlobalCoord(uint32_t n) const
Definition NanoVDB.h:4549
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:4555
LeafNode< BuildT, CoordT, MaskT, Log2Dim > LeafNodeType
Definition NanoVDB.h:4370
static constexpr uint32_t LEVEL
Definition NanoVDB.h:4505
__hostdev__ const MaskType< LOG2DIM > & getValueMask() const
Definition NanoVDB.h:4514
__hostdev__ FloatType variance() const
Return the variance of all the active values encoded in this leaf node.
Definition NanoVDB.h:4526
__hostdev__ auto set(const uint32_t n, ArgsT &&... args)
Definition NanoVDB.h:4665
LeafNode & operator=(const LeafNode &)=delete
__hostdev__ CoordT origin() const
Return the origin in index space of this leaf node.
Definition NanoVDB.h:4534
__hostdev__ ValueIterator cbeginValueAll() const
Definition NanoVDB.h:4497
friend class InternalNode
Definition NanoVDB.h:4679
static constexpr uint32_t DIM
Definition NanoVDB.h:4502
__hostdev__ const LeafNode * probeLeaf(const CoordT &) const
Definition NanoVDB.h:4629
__hostdev__ ValueOffIterator cbeginValueOff() const
Definition NanoVDB.h:4446
__hostdev__ void localToGlobalCoord(Coord &ijk) const
Converts (in place) a local index coordinate to a global index coordinate.
Definition NanoVDB.h:4547
typename DataType::FloatType FloatType
Definition NanoVDB.h:4373
__hostdev__ ValueType getFirstValue() const
Return the first value in this leaf node.
Definition NanoVDB.h:4592
static __hostdev__ uint32_t CoordToOffset(const CoordT &ijk)
Definition NanoVDB.h:4632
typename Mask< Log2Dim >::template Iterator< ON > MaskIterT
Definition NanoVDB.h:4380
__hostdev__ void setValueOnly(const CoordT &ijk, const ValueType &v)
Definition NanoVDB.h:4605
__hostdev__ FloatType average() const
Return a const reference to the average of all the active values encoded in this leaf node.
Definition NanoVDB.h:4523
__hostdev__ math::BBox< CoordT > bbox() const
Return the bounding box in index space of active values in this leaf node.
Definition NanoVDB.h:4558
__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:4622
__hostdev__ uint8_t flags() const
Definition NanoVDB.h:4531
__hostdev__ bool hasBBox() const
Definition NanoVDB.h:4619
__hostdev__ auto set(const CoordType &ijk, ArgsT &&... args)
Definition NanoVDB.h:4659
__hostdev__ ValueOffIterator beginValueOff() const
Definition NanoVDB.h:4445
__hostdev__ ValueOnIterator beginValueOn() const
Definition NanoVDB.h:4412
static constexpr uint32_t TOTAL
Definition NanoVDB.h:4501
__hostdev__ void setValue(const CoordT &ijk, const ValueType &v)
Sets the value at the specified location and activate its state.
Definition NanoVDB.h:4599
__hostdev__ bool isActive(const CoordT &ijk) const
Return true if the voxel value at the given coordinate is active.
Definition NanoVDB.h:4608
__hostdev__ ValueType minimum() const
Return a const reference to the minimum active value encoded in this leaf node.
Definition NanoVDB.h:4517
__hostdev__ auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:4647
__hostdev__ ValueOnIterator cbeginValueOn() const
Definition NanoVDB.h:4413
MaskT< LOG2 > MaskType
Definition NanoVDB.h:4378
__hostdev__ ValueType maximum() const
Return a const reference to the maximum active value encoded in this leaf node.
Definition NanoVDB.h:4520
static constexpr uint32_t LOG2DIM
Definition NanoVDB.h:4500
__hostdev__ ValueType getLastValue() const
Return the last value in this leaf node.
Definition NanoVDB.h:4594
__hostdev__ bool isActive(uint32_t n) const
Definition NanoVDB.h:4609
LeafNode(const LeafNode &)=delete
__hostdev__ ValueType getValue(const CoordT &ijk) const
Return the voxel value at the given coordinate.
Definition NanoVDB.h:4589
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:4735
__hostdev__ ValueIterator beginValue() const
Definition NanoVDB.h:4496
__hostdev__ uint64_t memUsage() const
return memory usage in bytes for the leaf node
Definition NanoVDB.h:4577
static constexpr uint32_t SIZE
Definition NanoVDB.h:4503
typename DataType::ValueType ValueType
Definition NanoVDB.h:4372
__hostdev__ auto get(const uint32_t n, ArgsT &&... args) const
Definition NanoVDB.h:4653
__hostdev__ ValueType getValue(uint32_t offset) const
Return the voxel value at the given offset.
Definition NanoVDB.h:4586
__hostdev__ const MaskType< LOG2DIM > & valueMask() const
Return a const reference to the bit mask of active voxels in this leaf node.
Definition NanoVDB.h:4513
__hostdev__ const DataType * data() const
Definition NanoVDB.h:4510
static constexpr uint64_t NUM_VALUES
Definition NanoVDB.h:4506
static __hostdev__ uint32_t voxelCount()
Return the total number of voxels (e.g. values) encoded in this leaf node.
Definition NanoVDB.h:4572
__hostdev__ bool isActive() const
Return true if any of the voxel value are active in this leaf node.
Definition NanoVDB.h:4612
friend class RootNode
Definition NanoVDB.h:4677
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:1208
__hostdev__ void set(uint32_t n, bool on)
Set the specified bit on or off.
Definition NanoVDB.h:1267
__hostdev__ void setOn()
Set all bits on.
Definition NanoVDB.h:1280
__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:1350
__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:1231
__hostdev__ void setOff()
Set all bits off.
Definition NanoVDB.h:1286
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:1306
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:1179
__hostdev__ void toggle(uint32_t n)
Definition NanoVDB.h:1303
__hostdev__ bool operator!=(const Mask &other) const
Definition NanoVDB.h:1202
__hostdev__ bool isOff() const
Return true if none of the bits are set in this Mask.
Definition NanoVDB.h:1220
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:1298
__hostdev__ const uint64_t * words() const
Definition NanoVDB.h:1160
__hostdev__ void set(bool on)
Set all bits off.
Definition NanoVDB.h:1292
__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:1314
__hostdev__ bool operator==(const Mask &other) const
Definition NanoVDB.h:1193
NANOVDB_HOSTDEV_DISABLE_WARNING __hostdev__ uint32_t findPrev(uint32_t start) const
Definition NanoVDB.h:1364
__hostdev__ bool isOn(uint32_t n) const
Return true if the given bit is set.
Definition NanoVDB.h:1205
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:1211
__hostdev__ void setWord(WordT w, uint32_t n)
Definition NanoVDB.h:1170
NANOVDB_HOSTDEV_DISABLE_WARNING __hostdev__ uint32_t findFirst() const
Definition NanoVDB.h:1340
__hostdev__ Mask & operator-=(const Mask &other)
Bitwise difference.
Definition NanoVDB.h:1322
__hostdev__ Mask & operator^=(const Mask &other)
Bitwise XOR.
Definition NanoVDB.h:1330
__hostdev__ WordT getWord(uint32_t n) const
Definition NanoVDB.h:1163
__hostdev__ void setOn(uint32_t n)
Set the specified bit on.
Definition NanoVDB.h:1229
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:6123
PointAccessor(const NanoGrid< Point > &grid)
Definition NanoVDB.h:6081
__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:6112
__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:6102
__hostdev__ const NanoGrid< Point > & grid() const
Definition NanoVDB.h:6098
__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:6057
__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:6045
__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:6035
__hostdev__ const NanoGrid< BuildT > & grid() const
Definition NanoVDB.h:6031
PointAccessor(const NanoGrid< BuildT > &grid)
Definition NanoVDB.h:6018
Dummy type for indexing points into voxels.
Definition NanoVDB.h:203
__hostdev__ auto set(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:5083
ReadAccessor & operator=(const ReadAccessor &)=default
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:5030
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition NanoVDB.h:4994
friend class InternalNode
Definition NanoVDB.h:5093
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition NanoVDB.h:5072
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:5032
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:5031
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition NanoVDB.h:5028
typename RootT::CoordType CoordType
Definition NanoVDB.h:4977
__hostdev__ auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:5077
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition NanoVDB.h:5029
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition NanoVDB.h:5006
friend class LeafNode
Definition NanoVDB.h:5095
ReadAccessor(const ReadAccessor &)=default
Defaults constructors.
typename RootT::ValueType ValueType
Definition NanoVDB.h:4976
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition NanoVDB.h:5000
__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:5013
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:5022
static const int CacheLevels
Definition NanoVDB.h:4979
BuildT BuildType
Definition NanoVDB.h:4975
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition NanoVDB.h:5027
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:5026
__hostdev__ const RootT & root() const
Definition NanoVDB.h:5015
friend class RootNode
Allow nodes to insert themselves into the cache.
Definition NanoVDB.h:5091
__hostdev__ auto set(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:5251
ReadAccessor & operator=(const ReadAccessor &)=default
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:5183
CoordT CoordType
Definition NanoVDB.h:5127
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition NanoVDB.h:5134
friend class InternalNode
Definition NanoVDB.h:5263
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition NanoVDB.h:5235
ValueT ValueType
Definition NanoVDB.h:5126
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:5185
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:5184
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition NanoVDB.h:5181
__hostdev__ auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:5243
__hostdev__ bool isCached(const CoordType &ijk) const
Definition NanoVDB.h:5167
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition NanoVDB.h:5182
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition NanoVDB.h:5148
friend class LeafNode
Definition NanoVDB.h:5265
ReadAccessor(const ReadAccessor &)=default
Defaults constructors.
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition NanoVDB.h:5142
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition NanoVDB.h:5154
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:5175
static const int CacheLevels
Definition NanoVDB.h:5129
BuildT BuildType
Definition NanoVDB.h:5125
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition NanoVDB.h:5180
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:5179
__hostdev__ const RootT & root() const
Definition NanoVDB.h:5160
friend class RootNode
Allow nodes to insert themselves into the cache.
Definition NanoVDB.h:5261
__hostdev__ auto set(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:5534
ReadAccessor & operator=(const ReadAccessor &)=default
__hostdev__ bool isCached1(const CoordType &ijk) const
Definition NanoVDB.h:5386
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:5409
CoordT CoordType
Definition NanoVDB.h:5310
__hostdev__ ReadAccessor(const RootT &root)
Constructor from a root node.
Definition NanoVDB.h:5317
friend class InternalNode
Definition NanoVDB.h:5554
__hostdev__ uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition NanoVDB.h:5502
ValueT ValueType
Definition NanoVDB.h:5309
__hostdev__ const LeafT * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:5411
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:5410
__hostdev__ ValueType operator()(int i, int j, int k) const
Definition NanoVDB.h:5407
__hostdev__ auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:5518
__hostdev__ bool isCached2(const CoordType &ijk) const
Definition NanoVDB.h:5392
__hostdev__ auto getNodeInfo(const CoordType &ijk) const
Definition NanoVDB.h:5408
__hostdev__ ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition NanoVDB.h:5336
friend class LeafNode
Definition NanoVDB.h:5556
ReadAccessor(const ReadAccessor &)=default
Defaults constructors.
__hostdev__ ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition NanoVDB.h:5330
__hostdev__ void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition NanoVDB.h:5342
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:5401
static const int CacheLevels
Definition NanoVDB.h:5312
BuildT BuildType
Definition NanoVDB.h:5308
__hostdev__ ValueType operator()(const CoordType &ijk) const
Definition NanoVDB.h:5406
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:5405
__hostdev__ const RootT & root() const
Definition NanoVDB.h:5353
friend class RootNode
Allow nodes to insert themselves into the cache.
Definition NanoVDB.h:5552
Definition NanoVDB.h:2035
uint32_t mPos
Definition NanoVDB.h:2698
uint32_t mSize
Definition NanoVDB.h:2698
typename util::match_const< Tile, RootT >::type TileT
Definition NanoVDB.h:2696
__hostdev__ CoordType getOrigin() const
Definition NanoVDB.h:2711
DataT * mData
Definition NanoVDB.h:2697
typename util::match_const< DataType, RootT >::type DataT
Definition NanoVDB.h:2695
__hostdev__ uint32_t pos() const
Definition NanoVDB.h:2708
__hostdev__ BaseIter(DataT *data=nullptr, uint32_t n=0)
Definition NanoVDB.h:2699
__hostdev__ void next()
Definition NanoVDB.h:2709
__hostdev__ TileT * tile() const
Definition NanoVDB.h:2710
__hostdev__ CoordType getCoord() const
Definition NanoVDB.h:2716
Definition NanoVDB.h:2725
__hostdev__ NodeT & operator*() const
Definition NanoVDB.h:2742
__hostdev__ ChildIter operator++(int)
Definition NanoVDB.h:2760
__hostdev__ ChildIter(RootT *parent)
Definition NanoVDB.h:2735
__hostdev__ ChildIter & operator++()
Definition NanoVDB.h:2752
__hostdev__ NodeT * operator->() const
Definition NanoVDB.h:2747
__hostdev__ ChildIter()
Definition NanoVDB.h:2731
Definition NanoVDB.h:2869
__hostdev__ NodeT * probeChild(ValueType &value) const
Definition NanoVDB.h:2883
__hostdev__ DenseIter operator++(int)
Definition NanoVDB.h:2906
__hostdev__ DenseIter & operator++()
Definition NanoVDB.h:2900
__hostdev__ DenseIter()
Definition NanoVDB.h:2874
__hostdev__ DenseIter(RootT *parent)
Definition NanoVDB.h:2878
__hostdev__ bool isValueOn() const
Definition NanoVDB.h:2895
Definition NanoVDB.h:2776
__hostdev__ ValueIter & operator++()
Definition NanoVDB.h:2801
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:2791
__hostdev__ ValueIter operator++(int)
Definition NanoVDB.h:2809
__hostdev__ ValueIter()
Definition NanoVDB.h:2780
__hostdev__ ValueIter(RootT *parent)
Definition NanoVDB.h:2784
__hostdev__ bool isActive() const
Definition NanoVDB.h:2796
Definition NanoVDB.h:2825
__hostdev__ ValueOnIter(RootT *parent)
Definition NanoVDB.h:2833
__hostdev__ ValueOnIter()
Definition NanoVDB.h:2829
__hostdev__ ValueType operator*() const
Definition NanoVDB.h:2840
__hostdev__ ValueOnIter operator++(int)
Definition NanoVDB.h:2853
__hostdev__ ValueOnIter & operator++()
Definition NanoVDB.h:2845
Top-most node of the VDB tree structure.
Definition NanoVDB.h:2670
__hostdev__ const FloatType & stdDeviation() const
Definition NanoVDB.h:2959
__hostdev__ const ValueType & minimum() const
Definition NanoVDB.h:2947
__hostdev__ ConstChildIterator cbeginChild() const
Definition NanoVDB.h:2772
__hostdev__ DenseIterator beginDense()
Definition NanoVDB.h:2917
__hostdev__ const ChildNodeType * probeChild(const CoordType &ijk) const
Definition NanoVDB.h:3024
__hostdev__ const ValueType & maximum() const
Definition NanoVDB.h:2950
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:2687
ChildIter< const RootNode > ConstChildIterator
Definition NanoVDB.h:2769
__hostdev__ DataType * data()
Definition NanoVDB.h:2929
__hostdev__ bool isEmpty() const
Definition NanoVDB.h:2968
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:2974
__hostdev__ ConstValueOnIterator cbeginValueOn() const
Definition NanoVDB.h:2865
__hostdev__ ValueIterator beginValue()
Definition NanoVDB.h:2820
__hostdev__ ChildNodeType * probeChild(const CoordType &ijk)
Definition NanoVDB.h:3030
friend class ReadAccessor
Definition NanoVDB.h:3065
ChildT UpperNodeType
Definition NanoVDB.h:2676
typename ChildT::CoordType CoordType
Definition NanoVDB.h:2683
static constexpr uint32_t LEVEL
Definition NanoVDB.h:2689
__hostdev__ FloatType variance() const
Definition NanoVDB.h:2956
__hostdev__ decltype(OpT::set(util::declval< Tile & >(), util::declval< ArgsT >()...)) set(const CoordType &ijk, ArgsT &&... args)
Definition NanoVDB.h:3050
RootNode & operator=(const RootNode &)=delete
ValueOnIter< RootNode > ValueOnIterator
Definition NanoVDB.h:2861
ValueIter< const RootNode > ConstValueIterator
Definition NanoVDB.h:2818
RootData< ChildT > DataType
Definition NanoVDB.h:2672
__hostdev__ const uint32_t & tileCount() const
Return the number of tiles encoded in this root node.
Definition NanoVDB.h:2943
typename DataType::BuildT BuildType
Definition NanoVDB.h:2681
ValueIter< RootNode > ValueIterator
Definition NanoVDB.h:2817
RootNode(const RootNode &)=delete
ChildT ChildNodeType
Definition NanoVDB.h:2673
typename DataType::ValueT ValueType
Definition NanoVDB.h:2679
__hostdev__ ConstDenseIterator cbeginDense() const
Definition NanoVDB.h:2918
RootType RootNodeType
Definition NanoVDB.h:2675
__hostdev__ ConstValueIterator cbeginValueAll() const
Definition NanoVDB.h:2821
RootNode< ChildT > RootType
Definition NanoVDB.h:2674
typename DataType::StatsT FloatType
Definition NanoVDB.h:2680
__hostdev__ const ValueType & background() const
Definition NanoVDB.h:2940
ChildIter< RootNode > ChildIterator
Definition NanoVDB.h:2768
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:2976
__hostdev__ ValueOnIterator beginValueOn()
Definition NanoVDB.h:2864
friend class Tree
Definition NanoVDB.h:3068
typename ChildT::LeafNodeType LeafNodeType
Definition NanoVDB.h:2678
DefaultReadAccessor< BuildType > AccessorType
Definition NanoVDB.h:2685
math::BBox< CoordType > BBoxType
Definition NanoVDB.h:2684
__hostdev__ auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:3037
ValueOnIter< const RootNode > ConstValueOnIterator
Definition NanoVDB.h:2862
__hostdev__ ConstDenseIterator cbeginChildAll() const
Definition NanoVDB.h:2919
__hostdev__ const BBoxType & bbox() const
Definition NanoVDB.h:2934
typename DataType::Tile Tile
Definition NanoVDB.h:2686
__hostdev__ uint64_t memUsage() const
Definition NanoVDB.h:2965
typename UpperNodeType::ChildNodeType LowerNodeType
Definition NanoVDB.h:2677
__hostdev__ AccessorType getAccessor() const
Definition NanoVDB.h:2927
__hostdev__ const LeafNodeType * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:2977
static __hostdev__ uint64_t memUsage(uint32_t tableSize)
Definition NanoVDB.h:2962
__hostdev__ ChildIterator beginChild()
Definition NanoVDB.h:2771
__hostdev__ const DataType * data() const
Definition NanoVDB.h:2931
RootNode()=delete
This class cannot be constructed or deleted.
__hostdev__ const uint32_t & getTableSize() const
Definition NanoVDB.h:2944
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:2972
__hostdev__ const FloatType & average() const
Definition NanoVDB.h:2953
DenseIter< const RootNode > ConstDenseIterator
Definition NanoVDB.h:2915
DenseIter< RootNode > DenseIterator
Definition NanoVDB.h:2914
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:2973
VDB Tree, which is a thin wrapper around a RootNode.
Definition NanoVDB.h:2342
typename RootT::ChildNodeType Node2
Definition NanoVDB.h:2361
__hostdev__ const NodeT * getFirstNode() const
Definition NanoVDB.h:2452
typename RootType::LeafNodeType LeafNodeType
Definition NanoVDB.h:2354
__hostdev__ DataType * data()
Definition NanoVDB.h:2371
RootT Node3
Definition NanoVDB.h:2360
__hostdev__ bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:2389
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:2376
__hostdev__ const NodeTrait< NanoRoot< BuildT >, 2 >::type * getFirstUpper() const
Definition NanoVDB.h:2482
__hostdev__ NanoRoot< BuildT > & root()
Definition NanoVDB.h:2378
__hostdev__ NodeTrait< NanoRoot< BuildT >, 1 >::type * getFirstLower()
Definition NanoVDB.h:2479
__hostdev__ uint32_t nodeCount() const
Definition NanoVDB.h:2421
typename RootNodeType::ChildNodeType UpperNodeType
Definition NanoVDB.h:2352
__hostdev__ LeafNodeType * getFirstLeaf()
Definition NanoVDB.h:2477
Tree()=delete
This class cannot be constructed or deleted.
__hostdev__ const LeafNodeType * getFirstLeaf() const
Definition NanoVDB.h:2478
__hostdev__ const ValueType & background() const
Definition NanoVDB.h:2398
__hostdev__ bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:2395
__hostdev__ auto set(const CoordType &ijk, ArgsT &&... args)
Definition NanoVDB.h:2491
RootT RootNodeType
Definition NanoVDB.h:2351
typename RootT::CoordType CoordType
Definition NanoVDB.h:2357
__hostdev__ uint64_t activeVoxelCount() const
Definition NanoVDB.h:2407
DefaultReadAccessor< BuildType > AccessorType
Definition NanoVDB.h:2358
__hostdev__ auto get(const CoordType &ijk, ArgsT &&... args) const
Definition NanoVDB.h:2485
Tree(const Tree &)=delete
LeafNodeType Node0
Definition NanoVDB.h:2363
__hostdev__ NodeTrait< NanoRoot< BuildT >, LEVEL >::type * getFirstNode()
Definition NanoVDB.h:2462
__hostdev__ NodeT * getFirstNode()
Definition NanoVDB.h:2442
typename Node2::ChildNodeType Node1
Definition NanoVDB.h:2362
__hostdev__ uint32_t totalNodeCount() const
Definition NanoVDB.h:2433
RootT RootType
Definition NanoVDB.h:2350
__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:2480
typename UpperNodeType::ChildNodeType LowerNodeType
Definition NanoVDB.h:2353
__hostdev__ AccessorType getAccessor() const
Definition NanoVDB.h:2382
typename RootT::ValueType ValueType
Definition NanoVDB.h:2355
__hostdev__ const NodeTrait< NanoRoot< BuildT >, LEVEL >::type * getFirstNode() const
Definition NanoVDB.h:2471
__hostdev__ uint32_t nodeCount(int level) const
Definition NanoVDB.h:2427
__hostdev__ const uint32_t & activeTileCount(uint32_t level) const
Definition NanoVDB.h:2414
TreeData DataType
Definition NanoVDB.h:2349
__hostdev__ const DataType * data() const
Definition NanoVDB.h:2373
__hostdev__ ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:2385
__hostdev__ NodeTrait< NanoRoot< BuildT >, 2 >::type * getFirstUpper()
Definition NanoVDB.h:2481
__hostdev__ ValueType getValue(int i, int j, int k) const
Definition NanoVDB.h:2386
__hostdev__ const NanoRoot< BuildT > & root() const
Definition NanoVDB.h:2380
typename RootT::BuildType BuildType
Definition NanoVDB.h:2356
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:6250
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:6352
__hostdev__ Codec toCodec(const char *str)
Definition NanoVDB.h:6274
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:6409
__hostdev__ const char * toStr(char *dst, Codec codec)
Definition NanoVDB.h:6264
Codec
Define compression codecs.
Definition NanoVDB.h:6258
@ StrLen
Definition NanoVDB.h:6262
@ ZIP
Definition NanoVDB.h:6259
@ End
Definition NanoVDB.h:6261
@ BLOSC
Definition NanoVDB.h:6260
@ NONE
Definition NanoVDB.h:6258
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:6381
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:4838
ReadAccessor< BuildT, 0, 1, 2 > DefaultReadAccessor
Definition NanoVDB.h:2038
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:4889
__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:4848
Grid< NanoTree< BuildT > > NanoGrid
Definition NanoVDB.h:4784
__hostdev__ CheckMode toCheckMode(const Checksum &checksum)
Maps 64 bit checksum to CheckMode enum.
Definition NanoVDB.h:1816
Grid< OnIndexMaskTree > OnIndexMaskGrid
Definition NanoVDB.h:4857
__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:4829
Grid< Fp16Tree > Fp16Grid
Definition NanoVDB.h:4840
Grid< FloatTree > FloatGrid
Definition NanoVDB.h:4837
Grid< Vec3fTree > Vec3fGrid
Definition NanoVDB.h:4846
__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:4776
Grid< Vec4dTree > Vec4dGrid
Definition NanoVDB.h:4849
__hostdev__ MagicType toMagic(uint64_t magic)
maps 64 bits of magic number to enum
Definition NanoVDB.h:368
Grid< BoolTree > BoolGrid
Definition NanoVDB.h:4852
InternalNode< NanoLower< BuildT >, 5 > NanoUpper
Definition NanoVDB.h:4778
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:1714
@ Partial
Definition NanoVDB.h:1717
@ Full
Definition NanoVDB.h:1719
@ Disable
Definition NanoVDB.h:1714
@ Half
Definition NanoVDB.h:1716
@ Empty
Definition NanoVDB.h:1715
Grid< Vec3dTree > Vec3dGrid
Definition NanoVDB.h:4847
Grid< Point > PointGrid
Definition NanoVDB.h:4853
NanoTree< ValueOnIndexMask > OnIndexMaskTree
Definition NanoVDB.h:4835
RootNode< NanoUpper< BuildT > > NanoRoot
Definition NanoVDB.h:4780
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:5905
NanoTree< ValueMask > MaskTree
Definition NanoVDB.h:4830
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:4855
Grid< Vec3ITree > Vec3IGrid
Definition NanoVDB.h:4850
Grid< Fp8Tree > Fp8Grid
Definition NanoVDB.h:4839
Grid< Int64Tree > Int64Grid
Definition NanoVDB.h:4845
Tree< NanoRoot< BuildT > > NanoTree
Definition NanoVDB.h:4782
__hostdev__ GridType mapToGridType()
Definition NanoVDB.h:872
NanoTree< int32_t > Int32Tree
Definition NanoVDB.h:4822
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:4774
NanoTree< ValueOnIndex > OnIndexTree
Definition NanoVDB.h:4833
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:4821
NanoTree< ValueIndex > IndexTree
Definition NanoVDB.h:4832
__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:4828
Grid< UInt32Tree > UInt32Grid
Definition NanoVDB.h:4844
NanoTree< Fp8 > Fp8Tree
Definition NanoVDB.h:4818
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:4824
__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:4827
NanoTree< Vec3d > Vec3dTree
Definition NanoVDB.h:4826
NanoTree< Fp16 > Fp16Tree
Definition NanoVDB.h:4819
Grid< MaskTree > MaskGrid
Definition NanoVDB.h:4851
NanoTree< ValueIndexMask > IndexMaskTree
Definition NanoVDB.h:4834
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:4820
__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:4854
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:4843
NanoTree< Vec3f > Vec3fTree
Definition NanoVDB.h:4825
NanoTree< bool > BoolTree
Definition NanoVDB.h:4831
NanoTree< uint32_t > UInt32Tree
Definition NanoVDB.h:4823
Grid< IndexMaskTree > IndexMaskGrid
Definition NanoVDB.h:4856
__hostdev__ GridClass mapToGridClass(GridClass defaultClass=GridClass::Unknown)
Definition NanoVDB.h:894
Grid< DoubleTree > DoubleGrid
Definition NanoVDB.h:4842
Grid< FpNTree > FpNGrid
Definition NanoVDB.h:4841
NanoTree< float > FloatTree
Definition NanoVDB.h:4816
NanoTree< Fp4 > Fp4Tree
Definition NanoVDB.h:4817
__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:6543
static __hostdev__ uint32_t get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6545
static __hostdev__ uint32_t get(const NanoLeaf< BuildT > &, uint32_t)
Definition NanoVDB.h:6548
static __hostdev__ uint32_t get(const NanoLower< BuildT > &, uint32_t)
Definition NanoVDB.h:6547
static __hostdev__ uint32_t get(const NanoUpper< BuildT > &, uint32_t)
Definition NanoVDB.h:6546
static __hostdev__ uint32_t get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6544
Return the pointer to the leaf node that contains math::Coord. Implements Tree::probeLeaf(math::Coord...
Definition NanoVDB.h:6555
static __hostdev__ const NanoLeaf< BuildT > * get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6557
static __hostdev__ const NanoLeaf< BuildT > * get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6556
static __hostdev__ const NanoLeaf< BuildT > * get(const NanoUpper< BuildT > &, uint32_t)
Definition NanoVDB.h:6558
static __hostdev__ const NanoLeaf< BuildT > * get(const NanoLower< BuildT > &, uint32_t)
Definition NanoVDB.h:6559
static __hostdev__ const NanoLeaf< BuildT > * get(const NanoLeaf< BuildT > &leaf, uint32_t)
Definition NanoVDB.h:6560
Return point to the lower internal node where math::Coord maps to one of its values,...
Definition NanoVDB.h:6567
static __hostdev__ const NanoLower< BuildT > * get(const NanoUpper< BuildT > &, uint32_t)
Definition NanoVDB.h:6570
static __hostdev__ const NanoLower< BuildT > * get(const NanoLeaf< BuildT > &, uint32_t)
Definition NanoVDB.h:6572
static __hostdev__ const NanoLower< BuildT > * get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6568
static __hostdev__ const NanoLower< BuildT > * get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6569
static __hostdev__ const NanoLower< BuildT > * get(const NanoLower< BuildT > &node, uint32_t)
Definition NanoVDB.h:6571
Definition NanoVDB.h:6628
uint32_t level
Definition NanoVDB.h:6629
FloatType average
Definition NanoVDB.h:6631
ValueType maximum
Definition NanoVDB.h:6630
CoordBBox bbox
Definition NanoVDB.h:6632
ValueType minimum
Definition NanoVDB.h:6630
uint32_t dim
Definition NanoVDB.h:6629
FloatType stdDevi
Definition NanoVDB.h:6631
Implements Tree::getNodeInfo(math::Coord)
Definition NanoVDB.h:6624
static __hostdev__ NodeInfo get(const NanoUpper< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6642
static __hostdev__ NodeInfo get(const NanoLeaf< BuildT > &leaf, uint32_t n)
Definition NanoVDB.h:6650
typename NanoLeaf< BuildT >::ValueType ValueType
Definition NanoVDB.h:6625
static __hostdev__ NodeInfo get(const NanoRoot< BuildT > &root)
Definition NanoVDB.h:6634
static __hostdev__ NodeInfo get(const NanoLower< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6646
typename NanoLeaf< BuildT >::FloatType FloatType
Definition NanoVDB.h:6626
static __hostdev__ NodeInfo get(const typename NanoRoot< BuildT >::Tile &tile)
Definition NanoVDB.h:6638
Implements Tree::isActive(math::Coord)
Definition NanoVDB.h:6531
static __hostdev__ auto get(const NanoLeaf< BuildT > &leaf, uint32_t n)
Definition NanoVDB.h:6536
static __hostdev__ auto get(const NanoLower< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6535
static __hostdev__ auto get(const NanoUpper< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6534
static __hostdev__ auto get(const typename NanoRoot< BuildT >::Tile &tile)
Definition NanoVDB.h:6533
static __hostdev__ auto get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6532
Return point to the upper internal node where math::Coord maps to one of its values,...
Definition NanoVDB.h:6579
static __hostdev__ const NanoUpper< BuildT > * get(const NanoUpper< BuildT > &node, uint32_t)
Definition NanoVDB.h:6582
static __hostdev__ const NanoUpper< BuildT > * get(const NanoLower< BuildT > &node, uint32_t)
Definition NanoVDB.h:6583
static __hostdev__ const NanoUpper< BuildT > * get(const NanoLeaf< BuildT > &, uint32_t)
Definition NanoVDB.h:6584
static __hostdev__ const NanoUpper< BuildT > * get(const NanoRoot< BuildT > &)
Definition NanoVDB.h:6580
static __hostdev__ const NanoUpper< BuildT > * get(const typename NanoRoot< BuildT >::Tile &)
Definition NanoVDB.h:6581
Implements Tree::getValue(math::Coord), i.e. return the value associated with a specific coordinate i...
Definition NanoVDB.h:6495
static __hostdev__ auto get(const NanoRoot< BuildT > &root)
Definition NanoVDB.h:6496
static __hostdev__ auto get(const NanoLeaf< BuildT > &leaf, uint32_t n)
Definition NanoVDB.h:6500
static __hostdev__ auto get(const NanoLower< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6499
static __hostdev__ auto get(const NanoUpper< BuildT > &node, uint32_t n)
Definition NanoVDB.h:6498
static __hostdev__ auto get(const typename NanoRoot< BuildT >::Tile &tile)
Definition NanoVDB.h:6497
Struct with all the member data of the Grid (useful during serialization of an openvdb grid)
Definition NanoVDB.h:1845
__hostdev__ Vec3T applyInverseJacobian(const Vec3T &xyz) const
Definition NanoVDB.h:1930
__hostdev__ bool isEmpty() const
test if the grid is empty, e.i the root table has size 0
Definition NanoVDB.h:2026
__hostdev__ bool isRootConnected() const
return true if RootData follows TreeData in memory without any extra padding
Definition NanoVDB.h:2030
static __hostdev__ uint64_t memUsage()
Return memory usage in bytes for this class only.
Definition NanoVDB.h:2009
uint32_t mBlindMetadataCount
Definition NanoVDB.h:1861
__hostdev__ const void * treePtr() const
Definition NanoVDB.h:1949
Version mVersion
Definition NanoVDB.h:1849
uint32_t mData0
Definition NanoVDB.h:1862
__hostdev__ uint32_t nodeCount() const
Return number of nodes at LEVEL.
Definition NanoVDB.h:1977
GridType mGridType
Definition NanoVDB.h:1859
__hostdev__ void setMinMaxOn(bool on=true)
Definition NanoVDB.h:1911
uint64_t mMagic
Definition NanoVDB.h:1847
__hostdev__ void * nodePtr()
Return a non-const void pointer to the first node at LEVEL.
Definition NanoVDB.h:1966
__hostdev__ Vec3T applyIJTF(const Vec3T &xyz) const
Definition NanoVDB.h:1943
GridClass mGridClass
Definition NanoVDB.h:1858
__hostdev__ void setBBoxOn(bool on=true)
Definition NanoVDB.h:1912
__hostdev__ void setLongGridNameOn(bool on=true)
Definition NanoVDB.h:1913
uint64_t mGridSize
Definition NanoVDB.h:1853
__hostdev__ const GridBlindMetaData * blindMetaData(uint32_t n) const
Returns a const reference to the blindMetaData at the specified linear offset.
Definition NanoVDB.h:1986
__hostdev__ Vec3T applyInverseJacobianF(const Vec3T &xyz) const
Definition NanoVDB.h:1941
__hostdev__ bool isValid() const
return true if the magic number and the version are both valid
Definition NanoVDB.h:1898
__hostdev__ Vec3T applyInverseMapF(const Vec3T &xyz) const
Definition NanoVDB.h:1937
__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:1868
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:2015
Checksum mChecksum
Definition NanoVDB.h:1848
Vec3dBBox mWorldBBox
Definition NanoVDB.h:1856
__hostdev__ uint32_t rootTableSize() const
return the root table has size
Definition NanoVDB.h:2018
__hostdev__ const char * gridName() const
Definition NanoVDB.h:1992
__hostdev__ Vec3T applyIJT(const Vec3T &xyz) const
Definition NanoVDB.h:1932
uint64_t mData1
Definition NanoVDB.h:1863
uint32_t mGridCount
Definition NanoVDB.h:1852
__hostdev__ const void * nodePtr() const
Return a non-const void pointer to the first node at LEVEL.
Definition NanoVDB.h:1954
__hostdev__ void setStdDeviationOn(bool on=true)
Definition NanoVDB.h:1915
__hostdev__ Vec3T applyMap(const Vec3T &xyz) const
Definition NanoVDB.h:1924
uint64_t mData2
Definition NanoVDB.h:1864
__hostdev__ Vec3T applyJacobianF(const Vec3T &xyz) const
Definition NanoVDB.h:1939
__hostdev__ Vec3T applyInverseMap(const Vec3T &xyz) const
Definition NanoVDB.h:1926
Map mMap
Definition NanoVDB.h:1855
__hostdev__ const Vec3dBBox & worldBBox() const
return AABB of active values in world space
Definition NanoVDB.h:2012
__hostdev__ Vec3T applyJacobian(const Vec3T &xyz) const
Definition NanoVDB.h:1928
Vec3d mVoxelSize
Definition NanoVDB.h:1857
BitFlags< 32 > mFlags
Definition NanoVDB.h:1850
char mGridName[MaxNameSize]
Definition NanoVDB.h:1854
int64_t mBlindMetadataOffset
Definition NanoVDB.h:1860
uint32_t mGridIndex
Definition NanoVDB.h:1851
static const int MaxNameSize
Definition NanoVDB.h:1846
__hostdev__ void * treePtr()
Definition NanoVDB.h:1946
__hostdev__ Vec3T applyMapF(const Vec3T &xyz) const
Definition NanoVDB.h:1935
__hostdev__ bool setGridName(const char *src)
Definition NanoVDB.h:1916
__hostdev__ void setAverageOn(bool on=true)
Definition NanoVDB.h:1914
const typename GridT::TreeType Type
Definition NanoVDB.h:2333
const typename GridT::TreeType type
Definition NanoVDB.h:2334
defines a tree type from a grid type while preserving constness
Definition NanoVDB.h:2326
typename GridT::TreeType Type
Definition NanoVDB.h:2327
typename GridT::TreeType type
Definition NanoVDB.h:2328
StatsT mAverage
Definition NanoVDB.h:3225
typename ChildT::CoordType CoordT
Definition NanoVDB.h:3203
__hostdev__ void setMin(const ValueT &v)
Definition NanoVDB.h:3291
__hostdev__ const StatsT & average() const
Definition NanoVDB.h:3284
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3205
__hostdev__ const ValueT & getMin() const
Definition NanoVDB.h:3282
MaskT mChildMask
Definition NanoVDB.h:3221
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:3238
__hostdev__ const ValueT & getMax() const
Definition NanoVDB.h:3283
__hostdev__ void setDev(const StatsT &v)
Definition NanoVDB.h:3294
math::BBox< CoordT > mBBox
Definition NanoVDB.h:3218
InternalData(const InternalData &)=delete
__hostdev__ void setChild(uint32_t n, const void *ptr)
Definition NanoVDB.h:3240
typename ChildT::FloatType StatsT
Definition NanoVDB.h:3202
__hostdev__ void setAvg(const StatsT &v)
Definition NanoVDB.h:3293
__hostdev__ bool isChild(uint32_t n) const
Definition NanoVDB.h:3277
__hostdev__ void setValue(uint32_t n, const ValueT &v)
Definition NanoVDB.h:3247
typename ChildT::BuildType BuildT
Definition NanoVDB.h:3201
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:3232
StatsT mStdDevi
Definition NanoVDB.h:3226
Tile mTable[1u<<(3 *LOG2DIM)]
Definition NanoVDB.h:3236
__hostdev__ void setMax(const ValueT &v)
Definition NanoVDB.h:3292
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:3280
__hostdev__ ChildT * getChild(uint32_t n)
Returns a pointer to the child node at the specifed linear offset.
Definition NanoVDB.h:3254
ValueT mMaximum
Definition NanoVDB.h:3224
__hostdev__ bool isActive(uint32_t n) const
Definition NanoVDB.h:3271
MaskT mValueMask
Definition NanoVDB.h:3220
typename ChildT::template MaskType< LOG2DIM > MaskT
Definition NanoVDB.h:3204
__hostdev__ ValueT getValue(uint32_t n) const
Definition NanoVDB.h:3265
__hostdev__ const StatsT & stdDeviation() const
Definition NanoVDB.h:3285
InternalData & operator=(const InternalData &)=delete
typename ChildT::ValueType ValueT
Definition NanoVDB.h:3200
__hostdev__ const ChildT * getChild(uint32_t n) const
Definition NanoVDB.h:3259
ValueT mMinimum
Definition NanoVDB.h:3223
InternalData()=delete
This class cannot be constructed or deleted.
uint64_t mFlags
Definition NanoVDB.h:3219
static __hostdev__ constexpr uint64_t memUsage()
Definition NanoVDB.h:3990
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3987
__hostdev__ float getValue(uint32_t i) const
Definition NanoVDB.h:3998
Fp16 BuildType
Definition NanoVDB.h:3985
uint16_t mCode[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:3988
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:3991
uint16_t ArrayType
Definition NanoVDB.h:3986
LeafData()=delete
This class cannot be constructed or deleted.
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:3984
static __hostdev__ constexpr uint8_t bitWidth()
Definition NanoVDB.h:3997
static __hostdev__ constexpr uint64_t memUsage()
Definition NanoVDB.h:3923
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3920
__hostdev__ float getValue(uint32_t i) const
Definition NanoVDB.h:3931
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
uint8_t mCode[1u<<(3 *LOG2DIM - 1)]
Definition NanoVDB.h:3921
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:3924
LeafData()=delete
This class cannot be constructed or deleted.
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:3917
uint8_t ArrayType
Definition NanoVDB.h:3919
Fp4 BuildType
Definition NanoVDB.h:3918
static __hostdev__ constexpr uint8_t bitWidth()
Definition NanoVDB.h:3930
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3957
__hostdev__ float getValue(uint32_t i) const
Definition NanoVDB.h:3967
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:3960
LeafData()=delete
This class cannot be constructed or deleted.
Fp8 BuildType
Definition NanoVDB.h:3955
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:3954
uint8_t ArrayType
Definition NanoVDB.h:3956
static __hostdev__ constexpr int64_t memUsage()
Definition NanoVDB.h:3959
uint8_t mCode[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:3958
static __hostdev__ constexpr uint8_t bitWidth()
Definition NanoVDB.h:3966
FpN BuildType
Definition NanoVDB.h:4018
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4019
__hostdev__ float getValue(uint32_t i) const
Definition NanoVDB.h:4029
static __hostdev__ size_t memUsage(uint32_t bitWidth)
Definition NanoVDB.h:4028
__hostdev__ uint8_t bitWidth() const
Definition NanoVDB.h:4026
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:4020
LeafData()=delete
This class cannot be constructed or deleted.
LeafFnBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:4017
__hostdev__ size_t memUsage() const
Definition NanoVDB.h:4027
uint64_t mOffset
Definition NanoVDB.h:4307
uint16_t mValues[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:4309
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4300
__hostdev__ void setMin(const ValueType &)
Definition NanoVDB.h:4339
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:4319
__hostdev__ void setDev(const FloatType &)
Definition NanoVDB.h:4342
__hostdev__ void setValueOnly(uint32_t offset, uint16_t value)
Definition NanoVDB.h:4326
uint64_t ValueType
Definition NanoVDB.h:4296
__hostdev__ uint64_t last(uint32_t i) const
Definition NanoVDB.h:4324
uint8_t mFlags
Definition NanoVDB.h:4304
LeafData & operator=(const LeafData &)=delete
__hostdev__ void setValue(uint32_t offset, uint16_t value)
Definition NanoVDB.h:4327
LeafData(const LeafData &)=delete
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:4305
CoordT mBBoxMin
Definition NanoVDB.h:4302
uint8_t mBBoxDif[3]
Definition NanoVDB.h:4303
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:4332
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:4315
Point BuildType
Definition NanoVDB.h:4297
__hostdev__ void setAvg(const FloatType &)
Definition NanoVDB.h:4341
uint16_t ArrayType
Definition NanoVDB.h:4299
__hostdev__ ValueType getMax() const
Definition NanoVDB.h:4335
typename FloatTraits< ValueType >::FloatType FloatType
Definition NanoVDB.h:4298
__hostdev__ uint64_t offset() const
Definition NanoVDB.h:4321
LeafData()=delete
This class cannot be constructed or deleted.
__hostdev__ uint64_t first(uint32_t i) const
Definition NanoVDB.h:4323
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:4345
__hostdev__ FloatType getDev() const
Definition NanoVDB.h:4337
__hostdev__ uint64_t getValue(uint32_t i) const
Definition NanoVDB.h:4325
uint64_t mPointCount
Definition NanoVDB.h:4308
__hostdev__ FloatType getAvg() const
Definition NanoVDB.h:4336
__hostdev__ void setMax(const ValueType &)
Definition NanoVDB.h:4340
__hostdev__ ValueType getMin() const
Definition NanoVDB.h:4334
__hostdev__ uint64_t pointCount() const
Definition NanoVDB.h:4322
MaskT< LOG2DIM > mMask
Definition NanoVDB.h:4272
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:4273
__hostdev__ bool isMaskOn(uint32_t offset) const
Definition NanoVDB.h:4274
__hostdev__ void setMask(uint32_t offset, bool v)
Definition NanoVDB.h:4275
ValueIndexMask BuildType
Definition NanoVDB.h:4271
static __hostdev__ uint32_t valueCount()
Definition NanoVDB.h:4225
__hostdev__ uint64_t getMax() const
Definition NanoVDB.h:4230
ValueIndex BuildType
Definition NanoVDB.h:4223
LeafIndexBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:4222
__hostdev__ uint64_t getAvg() const
Definition NanoVDB.h:4231
__hostdev__ uint64_t getValue(uint32_t i) const
Definition NanoVDB.h:4233
__hostdev__ uint64_t lastOffset() const
Definition NanoVDB.h:4227
__hostdev__ uint64_t getDev() const
Definition NanoVDB.h:4232
__hostdev__ uint64_t getMin() const
Definition NanoVDB.h:4229
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4136
__hostdev__ void setMin(const ValueType &)
Definition NanoVDB.h:4158
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:4144
__hostdev__ bool getDev() const
Definition NanoVDB.h:4155
__hostdev__ bool getValue(uint32_t i) const
Definition NanoVDB.h:4151
__hostdev__ void setDev(const FloatType &)
Definition NanoVDB.h:4161
ValueMask BuildType
Definition NanoVDB.h:4133
uint8_t mFlags
Definition NanoVDB.h:4140
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
__hostdev__ void setValue(uint32_t offset, bool)
Definition NanoVDB.h:4156
static __hostdev__ bool hasStats()
Definition NanoVDB.h:4145
__hostdev__ bool getMax() const
Definition NanoVDB.h:4153
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:4141
CoordT mBBoxMin
Definition NanoVDB.h:4138
bool ValueType
Definition NanoVDB.h:4132
uint8_t mBBoxDif[3]
Definition NanoVDB.h:4139
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:4157
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:4146
__hostdev__ void setAvg(const FloatType &)
Definition NanoVDB.h:4160
LeafData()=delete
This class cannot be constructed or deleted.
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:4164
uint64_t mPadding[2]
Definition NanoVDB.h:4142
__hostdev__ bool getMin() const
Definition NanoVDB.h:4152
bool FloatType
Definition NanoVDB.h:4134
__hostdev__ void setMax(const ValueType &)
Definition NanoVDB.h:4159
__hostdev__ bool getAvg() const
Definition NanoVDB.h:4154
void ArrayType
Definition NanoVDB.h:4135
MaskT< LOG2DIM > mMask
Definition NanoVDB.h:4283
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:4284
__hostdev__ bool isMaskOn(uint32_t offset) const
Definition NanoVDB.h:4285
ValueOnIndexMask BuildType
Definition NanoVDB.h:4282
__hostdev__ void setMask(uint32_t offset, bool v)
Definition NanoVDB.h:4286
__hostdev__ uint64_t getMax() const
Definition NanoVDB.h:4250
LeafIndexBase< CoordT, MaskT, LOG2DIM > BaseT
Definition NanoVDB.h:4242
__hostdev__ uint64_t getAvg() const
Definition NanoVDB.h:4251
__hostdev__ uint64_t getValue(uint32_t i) const
Definition NanoVDB.h:4253
__hostdev__ uint64_t lastOffset() const
Definition NanoVDB.h:4248
__hostdev__ uint64_t getDev() const
Definition NanoVDB.h:4252
__hostdev__ uint64_t getMin() const
Definition NanoVDB.h:4249
__hostdev__ uint32_t valueCount() const
Definition NanoVDB.h:4244
ValueOnIndex BuildType
Definition NanoVDB.h:4243
bool BuildType
Definition NanoVDB.h:4083
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4086
__hostdev__ void setMax(const bool &)
Definition NanoVDB.h:4110
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:4096
__hostdev__ bool getDev() const
Definition NanoVDB.h:4102
__hostdev__ bool getValue(uint32_t i) const
Definition NanoVDB.h:4098
uint8_t mFlags
Definition NanoVDB.h:4090
LeafData & operator=(const LeafData &)=delete
__hostdev__ void setAvg(const bool &)
Definition NanoVDB.h:4111
LeafData(const LeafData &)=delete
MaskT< LOG2DIM > ArrayType
Definition NanoVDB.h:4085
static __hostdev__ bool hasStats()
Definition NanoVDB.h:4097
__hostdev__ void setMin(const bool &)
Definition NanoVDB.h:4109
__hostdev__ bool getMax() const
Definition NanoVDB.h:4100
__hostdev__ void setDev(const bool &)
Definition NanoVDB.h:4112
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:4091
MaskT< LOG2DIM > mValues
Definition NanoVDB.h:4092
CoordT mBBoxMin
Definition NanoVDB.h:4088
bool ValueType
Definition NanoVDB.h:4082
uint8_t mBBoxDif[3]
Definition NanoVDB.h:4089
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:4108
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:4095
LeafData()=delete
This class cannot be constructed or deleted.
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:4115
__hostdev__ void setValue(uint32_t offset, bool v)
Definition NanoVDB.h:4103
uint64_t mPadding[2]
Definition NanoVDB.h:4093
__hostdev__ bool getMin() const
Definition NanoVDB.h:4099
bool FloatType
Definition NanoVDB.h:4084
__hostdev__ bool getAvg() const
Definition NanoVDB.h:4101
ValueType mMaximum
Definition NanoVDB.h:3789
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:3781
typename FloatTraits< ValueT >::FloatType FloatType
Definition NanoVDB.h:3779
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:3801
FloatType mAverage
Definition NanoVDB.h:3790
__hostdev__ void setAvg(const FloatType &v)
Definition NanoVDB.h:3821
uint8_t mFlags
Definition NanoVDB.h:3785
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static __hostdev__ bool hasStats()
Definition NanoVDB.h:3803
ValueT ValueType
Definition NanoVDB.h:3777
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:3786
CoordT mBBoxMin
Definition NanoVDB.h:3783
uint8_t mBBoxDif[3]
Definition NanoVDB.h:3784
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:3812
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:3797
__hostdev__ ValueType getValue(uint32_t i) const
Definition NanoVDB.h:3805
__hostdev__ void fill(const ValueType &v)
Definition NanoVDB.h:3827
__hostdev__ ValueType getMax() const
Definition NanoVDB.h:3815
LeafData()=delete
This class cannot be constructed or deleted.
ValueT ArrayType
Definition NanoVDB.h:3780
__hostdev__ void setMin(const ValueType &v)
Definition NanoVDB.h:3819
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:3825
__hostdev__ void setValueOnly(uint32_t offset, const ValueType &value)
Definition NanoVDB.h:3806
__hostdev__ FloatType getDev() const
Definition NanoVDB.h:3817
ValueType mMinimum
Definition NanoVDB.h:3788
__hostdev__ FloatType getAvg() const
Definition NanoVDB.h:3816
__hostdev__ void setValue(uint32_t offset, const ValueType &value)
Definition NanoVDB.h:3807
ValueT BuildType
Definition NanoVDB.h:3778
ValueType mValues[1u<< 3 *LOG2DIM]
Definition NanoVDB.h:3792
FloatType mStdDevi
Definition NanoVDB.h:3791
__hostdev__ ValueType getMin() const
Definition NanoVDB.h:3814
__hostdev__ void setMax(const ValueType &v)
Definition NanoVDB.h:3820
__hostdev__ void setDev(const FloatType &v)
Definition NanoVDB.h:3822
Base-class for quantized float leaf nodes.
Definition NanoVDB.h:3845
__hostdev__ float getAvg() const
return the quantized average of the active values in this node
Definition NanoVDB.h:3886
float ValueType
Definition NanoVDB.h:3848
__hostdev__ float getMax() const
return the quantized maximum of the active values in this node
Definition NanoVDB.h:3883
__hostdev__ float getDev() const
return the quantized standard deviation of the active values in this node
Definition NanoVDB.h:3890
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:3860
__hostdev__ void setDev(float dev)
Definition NanoVDB.h:3902
uint16_t mMax
Definition NanoVDB.h:3858
uint8_t mFlags
Definition NanoVDB.h:3853
uint16_t mMin
Definition NanoVDB.h:3858
static __hostdev__ bool hasStats()
Definition NanoVDB.h:3862
__hostdev__ void setAvg(float avg)
Definition NanoVDB.h:3899
float mQuantum
Definition NanoVDB.h:3857
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:3854
uint16_t mAvg
Definition NanoVDB.h:3858
CoordT mBBoxMin
Definition NanoVDB.h:3851
uint8_t mBBoxDif[3]
Definition NanoVDB.h:3852
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:3877
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:3867
float mMinimum
Definition NanoVDB.h:3856
float FloatType
Definition NanoVDB.h:3849
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:3905
uint16_t mDev
Definition NanoVDB.h:3858
__hostdev__ void init(float min, float max, uint8_t bitWidth)
Definition NanoVDB.h:3871
__hostdev__ void setMin(float min)
Definition NanoVDB.h:3893
__hostdev__ void setMax(float max)
Definition NanoVDB.h:3896
__hostdev__ float getMin() const
return the quantized minimum of the active values in this node
Definition NanoVDB.h:3880
uint64_t mOffset
Definition NanoVDB.h:4190
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:4184
__hostdev__ const uint64_t & firstOffset() const
Definition NanoVDB.h:4198
__hostdev__ void setMin(const ValueType &)
Definition NanoVDB.h:4199
static __hostdev__ uint64_t memUsage()
Definition NanoVDB.h:4195
__hostdev__ void setDev(const FloatType &)
Definition NanoVDB.h:4202
uint64_t ValueType
Definition NanoVDB.h:4181
uint64_t FloatType
Definition NanoVDB.h:4182
uint8_t mFlags
Definition NanoVDB.h:4188
uint64_t mPrefixSum
Definition NanoVDB.h:4190
LeafIndexBase & operator=(const LeafIndexBase &)=default
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:4189
LeafIndexBase(const LeafIndexBase &)=default
CoordT mBBoxMin
Definition NanoVDB.h:4186
uint8_t mBBoxDif[3]
Definition NanoVDB.h:4187
__hostdev__ void setOn(uint32_t offset)
Definition NanoVDB.h:4203
static __hostdev__ constexpr uint32_t padding()
Definition NanoVDB.h:4191
__hostdev__ void setAvg(const FloatType &)
Definition NanoVDB.h:4201
__hostdev__ bool hasStats() const
Definition NanoVDB.h:4196
__hostdev__ void setOrigin(const T &ijk)
Definition NanoVDB.h:4205
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:4200
void ArrayType
Definition NanoVDB.h:4183
Definition NanoVDB.h:4365
static __hostdev__ uint32_t dim()
Definition NanoVDB.h:4368
static constexpr uint32_t DIM
Definition NanoVDB.h:4367
static constexpr uint32_t TOTAL
Definition NanoVDB.h:4366
Defines an affine transform and its inverse represented as a 3x3 matrix and a vec3 translation.
Definition NanoVDB.h:1384
double mTaperD
Definition NanoVDB.h:1392
__hostdev__ Map()
Default constructor for the identity map.
Definition NanoVDB.h:1395
void set(const Mat4T &mat, const Mat4T &invMat, double taper=1.0)
Initialize the member data from 4x4 matrices.
Definition NanoVDB.h:1427
__hostdev__ Vec3d getVoxelSize() const
Return a voxels size in each coordinate direction, measured at the origin.
Definition NanoVDB.h:1518
__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:1495
double mVecD[3]
Definition NanoVDB.h:1391
float mInvMatF[9]
Definition NanoVDB.h:1386
__hostdev__ Vec3T applyIJTF(const Vec3T &xyz) const
Definition NanoVDB.h:1515
__hostdev__ Vec3T applyMap(const Vec3T &ijk) const
Apply the forward affine transformation to a vector using 64bit floating point arithmetics.
Definition NanoVDB.h:1438
__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:1504
__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:1455
__hostdev__ Vec3T applyInverseMapF(const Vec3T &xyz) const
Apply the inverse affine mapping to a vector using 32bit floating point arithmetics.
Definition NanoVDB.h:1483
double mInvMatD[9]
Definition NanoVDB.h:1390
__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:1513
float mMatF[9]
Definition NanoVDB.h:1385
__hostdev__ Vec3T applyInverseMap(const Vec3T &xyz) const
Apply the inverse affine mapping to a vector using 64bit floating point arithmetics.
Definition NanoVDB.h:1472
double mMatD[9]
Definition NanoVDB.h:1389
__hostdev__ Map(double s, const Vec3d &t=Vec3d(0.0, 0.0, 0.0))
Definition NanoVDB.h:1406
__hostdev__ Vec3T applyMapF(const Vec3T &ijk) const
Apply the forward affine transformation to a vector using 32bit floating point arithmetics.
Definition NanoVDB.h:1446
__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:1464
float mTaperF
Definition NanoVDB.h:1388
float mVecF[3]
Definition NanoVDB.h:1387
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:1522
NanoLeaf< BuildT > type
Definition NanoVDB.h:4795
NanoLeaf< BuildT > Type
Definition NanoVDB.h:4794
NanoLower< BuildT > Type
Definition NanoVDB.h:4800
NanoLower< BuildT > type
Definition NanoVDB.h:4801
NanoUpper< BuildT > type
Definition NanoVDB.h:4807
NanoUpper< BuildT > Type
Definition NanoVDB.h:4806
NanoRoot< BuildT > type
Definition NanoVDB.h:4813
NanoRoot< BuildT > Type
Definition NanoVDB.h:4812
Trait to map from LEVEL to node type.
Definition NanoVDB.h:4788
typename GridOrTreeOrRootT::LeafNodeType type
Definition NanoVDB.h:1638
typename GridOrTreeOrRootT::LeafNodeType Type
Definition NanoVDB.h:1637
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType Type
Definition NanoVDB.h:1652
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType type
Definition NanoVDB.h:1653
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType type
Definition NanoVDB.h:1667
typename GridOrTreeOrRootT::RootNodeType::ChildNodeType Type
Definition NanoVDB.h:1666
typename GridOrTreeOrRootT::RootNodeType type
Definition NanoVDB.h:1681
typename GridOrTreeOrRootT::RootNodeType Type
Definition NanoVDB.h:1680
const typename GridOrTreeOrRootT::LeafNodeType Type
Definition NanoVDB.h:1644
const typename GridOrTreeOrRootT::LeafNodeType type
Definition NanoVDB.h:1645
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType type
Definition NanoVDB.h:1660
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType::ChildNodeType Type
Definition NanoVDB.h:1659
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType Type
Definition NanoVDB.h:1673
const typename GridOrTreeOrRootT::RootNodeType::ChildNodeType type
Definition NanoVDB.h:1674
const typename GridOrTreeOrRootT::RootNodeType type
Definition NanoVDB.h:1689
const typename GridOrTreeOrRootT::RootNodeType Type
Definition NanoVDB.h:1688
Struct to derive node type from its level in a given grid, tree or root while preserving constness.
Definition NanoVDB.h:1630
Implements Tree::probeLeaf(math::Coord)
Definition NanoVDB.h:6591
static __hostdev__ bool get(const NanoLower< BuildT > &node, uint32_t n, ValueT &v)
Definition NanoVDB.h:6608
typename BuildToValueMap< BuildT >::Type ValueT
Definition NanoVDB.h:6592
static __hostdev__ bool get(const NanoUpper< BuildT > &node, uint32_t n, ValueT &v)
Definition NanoVDB.h:6603
static __hostdev__ bool get(const NanoLeaf< BuildT > &leaf, uint32_t n, ValueT &v)
Definition NanoVDB.h:6613
static __hostdev__ bool get(const NanoRoot< BuildT > &root, ValueT &v)
Definition NanoVDB.h:6593
static __hostdev__ bool get(const typename NanoRoot< BuildT >::Tile &tile, ValueT &v)
Definition NanoVDB.h:6598
Definition NanoVDB.h:2564
ValueT value
Definition NanoVDB.h:2587
uint32_t state
Definition NanoVDB.h:2586
__hostdev__ bool isChild() const
Definition NanoVDB.h:2580
KeyT key
Definition NanoVDB.h:2584
__hostdev__ CoordT origin() const
Definition NanoVDB.h:2583
__hostdev__ bool isValue() const
Definition NanoVDB.h:2581
int64_t child
Definition NanoVDB.h:2585
__hostdev__ void setChild(const CoordType &k, const void *ptr, const RootData *data)
Definition NanoVDB.h:2566
__hostdev__ void setValue(const CoordType &k, bool s, const ValueType &v)
Definition NanoVDB.h:2573
__hostdev__ bool isActive() const
Definition NanoVDB.h:2582
StatsT mAverage
Definition NanoVDB.h:2552
typename ChildT::CoordType CoordT
Definition NanoVDB.h:2518
RootData()=delete
This class cannot be constructed or deleted.
__hostdev__ void setMin(const ValueT &v)
Definition NanoVDB.h:2653
__hostdev__ const StatsT & average() const
Definition NanoVDB.h:2650
static constexpr bool FIXED_SIZE
Definition NanoVDB.h:2520
__hostdev__ const ValueT & getMin() const
Definition NanoVDB.h:2648
__hostdev__ Tile * probeTile(const CoordT &ijk)
Definition NanoVDB.h:2604
ValueT mBackground
Definition NanoVDB.h:2549
__hostdev__ const ValueT & getMax() const
Definition NanoVDB.h:2649
__hostdev__ ChildT * getChild(const Tile *tile)
Returns a const reference to the child node in the specified tile.
Definition NanoVDB.h:2637
__hostdev__ void setDev(const StatsT &v)
Definition NanoVDB.h:2656
uint32_t mTableSize
Definition NanoVDB.h:2547
math::BBox< CoordT > mBBox
Definition NanoVDB.h:2546
uint64_t KeyT
Return a key based on the coordinates of a voxel.
Definition NanoVDB.h:2524
typename ChildT::FloatType StatsT
Definition NanoVDB.h:2519
__hostdev__ void setAvg(const StatsT &v)
Definition NanoVDB.h:2655
__hostdev__ const Tile * tile(uint32_t n) const
Returns a non-const reference to the tile at the specified linear offset.
Definition NanoVDB.h:2593
__hostdev__ const Tile * probeTile(const CoordT &ijk) const
Definition NanoVDB.h:2629
typename ChildT::BuildType BuildT
Definition NanoVDB.h:2517
static __hostdev__ constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:2558
StatsT mStdDevi
Definition NanoVDB.h:2553
RootData(const RootData &)=delete
static __hostdev__ CoordT KeyToCoord(const KeyT &key)
Definition NanoVDB.h:2534
RootData & operator=(const RootData &)=delete
static __hostdev__ KeyT CoordToKey(const CoordType &ijk)
Definition NanoVDB.h:2526
__hostdev__ void setMax(const ValueT &v)
Definition NanoVDB.h:2654
ValueT mMaximum
Definition NanoVDB.h:2551
__hostdev__ const StatsT & stdDeviation() const
Definition NanoVDB.h:2651
__hostdev__ Tile * tile(uint32_t n)
Definition NanoVDB.h:2598
typename ChildT::ValueType ValueT
Definition NanoVDB.h:2516
__hostdev__ const ChildT * getChild(const Tile *tile) const
Definition NanoVDB.h:2642
ValueT mMinimum
Definition NanoVDB.h:2550
Definition NanoVDB.h:6505
static __hostdev__ auto set(NanoLower< BuildT > &node, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6511
static __hostdev__ auto set(NanoUpper< BuildT > &node, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6510
static __hostdev__ auto set(NanoRoot< BuildT > &, const ValueT &)
Definition NanoVDB.h:6508
static __hostdev__ auto set(NanoLeaf< BuildT > &leaf, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6512
static __hostdev__ auto set(typename NanoRoot< BuildT >::Tile &tile, const ValueT &v)
Definition NanoVDB.h:6509
typename NanoLeaf< BuildT >::ValueType ValueT
Definition NanoVDB.h:6507
Definition NanoVDB.h:6517
static __hostdev__ auto set(NanoUpper< BuildT > &, uint32_t, const ValueT &)
Definition NanoVDB.h:6522
static __hostdev__ auto set(NanoRoot< BuildT > &, const ValueT &)
Definition NanoVDB.h:6520
static __hostdev__ auto set(NanoLeaf< BuildT > &leaf, uint32_t n, const ValueT &v)
Definition NanoVDB.h:6524
static __hostdev__ auto set(NanoLower< BuildT > &, uint32_t, const ValueT &)
Definition NanoVDB.h:6523
typename NanoLeaf< BuildT >::ValueType ValueT
Definition NanoVDB.h:6519
static __hostdev__ auto set(typename NanoRoot< BuildT >::Tile &, const ValueT &)
Definition NanoVDB.h:6521
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:2289
__hostdev__ const void * getRoot() const
Get a const void pointer to the root node (never NULL)
Definition NanoVDB.h:2306
__hostdev__ bool isEmpty() const
Return true if the root is empty, i.e. has not child nodes or constant tiles.
Definition NanoVDB.h:2312
int64_t mNodeOffset[4]
Definition NanoVDB.h:2290
__hostdev__ bool isRootNext() const
return true if RootData is layout out immediately after TreeData in memory
Definition NanoVDB.h:2318
TreeData & operator=(const TreeData &)=default
__hostdev__ void setRoot(const void *root)
Definition NanoVDB.h:2297
uint32_t mNodeCount[3]
Definition NanoVDB.h:2291
__hostdev__ void * getRoot()
Get a non-const void pointer to the root node (never NULL)
Definition NanoVDB.h:2303
uint32_t mTileCount[3]
Definition NanoVDB.h:2292
__hostdev__ void setFirstNode(const NodeT *node)
Definition NanoVDB.h:2309
__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:2315
uint64_t mVoxelCount
Definition NanoVDB.h:2293
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:3209
Tile(const Tile &)=delete
Tile & operator=(const Tile &)=delete
Tile()=delete
This class cannot be constructed or deleted.
int64_t child
Definition NanoVDB.h:3210