118#ifndef NANOVDB_NANOVDB_H_HAS_BEEN_INCLUDED
119#define NANOVDB_NANOVDB_H_HAS_BEEN_INCLUDED
121#define NANOVDB_MAGIC_NUMBER 0x304244566f6e614eUL
123#define NANOVDB_MAJOR_VERSION_NUMBER 32
124#define NANOVDB_MINOR_VERSION_NUMBER 4
125#define NANOVDB_PATCH_VERSION_NUMBER 2
128#define USE_SINGLE_ROOT_KEY
135#define NANOVDB_FPN_BRANCHLESS
137#define NANOVDB_DATA_ALIGNMENT 32
139#if !defined(NANOVDB_ALIGN)
140#define NANOVDB_ALIGN(n) alignas(n)
145typedef signed char int8_t;
146typedef short int16_t;
148typedef long long int64_t;
149typedef unsigned char uint8_t;
150typedef unsigned int uint32_t;
151typedef unsigned short uint16_t;
152typedef unsigned long long uint64_t;
154#define NANOVDB_ASSERT(x)
156#define UINT64_C(x) (x ## ULL)
168#ifdef NANOVDB_USE_IOSTREAMS
173#define NANOVDB_ASSERT(x) assert(x)
175#define NANOVDB_ASSERT(x)
178#if defined(NANOVDB_USE_INTRINSICS) && defined(_MSC_VER)
180#pragma intrinsic(_BitScanReverse)
181#pragma intrinsic(_BitScanForward)
182#pragma intrinsic(_BitScanReverse64)
183#pragma intrinsic(_BitScanForward64)
188#if defined(__CUDACC__) || defined(__HIP__)
190#define __hostdev__ __host__ __device__
197#if defined(_MSC_VER) && defined(__CUDACC__)
198#define NANOVDB_HOSTDEV_DISABLE_WARNING __pragma("hd_warning_disable")
199#elif defined(__GNUC__) && defined(__CUDACC__)
200#define NANOVDB_HOSTDEV_DISABLE_WARNING _Pragma("hd_warning_disable")
202#define NANOVDB_HOSTDEV_DISABLE_WARNING
206#define NANOVDB_OFFSETOF(CLASS, MEMBER) ((int)(size_t)((char*)&((CLASS*)0)->MEMBER - (char*)0))
265#ifndef __CUDACC_RTC__
269 static const char * LUT[] = {
"?",
"float",
"double" ,
"int16",
"int32",
270 "int64",
"Vec3f",
"Vec3d",
"Mask",
"Half",
271 "uint32",
"bool",
"RGBA8",
"Float4",
"Float8",
272 "Float16",
"FloatN",
"Vec4f",
"Vec4d",
"Index",
"End" };
273 static_assert(
sizeof(LUT)/
sizeof(
char*) - 1 == int(
GridType::End),
"Unexpected size of LUT" );
274 return LUT[
static_cast<int>(gridType)];
292#ifndef __CUDACC_RTC__
296 static const char * LUT[] = {
"?",
"SDF",
"FOG" ,
"MAC",
"PNTIDX",
297 "PNTDAT",
"TOPO",
"VOX",
"INDEX",
"END" };
298 static_assert(
sizeof(LUT)/
sizeof(
char*) - 1 == int(
GridClass::End),
"Unexpected size of LUT" );
299 return LUT[
static_cast<int>(gridClass)];
316#ifndef __CUDACC_RTC__
320 static const char * LUT[] = {
"has long grid name",
324 "has standard deviation",
327 static_assert( 1 << (
sizeof(LUT)/
sizeof(
char*) - 1) ==
int(
GridFlags::End),
"Unexpected size of LUT" );
328 return LUT[
static_cast<int>(gridFlags)];
355template<
typename T1,
typename T2>
358 static constexpr bool value =
false;
370template <
bool,
typename T =
void>
386 static constexpr bool value =
false;
425template<
typename AnyType,
template<
typename...>
class TemplateType>
430template<
typename... Args,
template<
typename...>
class TemplateType>
529 return reinterpret_cast<const T*
>( (
const uint8_t*)p +
alignmentPadding(p) );
534template <
typename T1,
typename T2>
538 return reinterpret_cast<const char*
>(p) -
reinterpret_cast<const char*
>(q);
541template <
typename DstT,
typename SrcT>
545 return reinterpret_cast<DstT*
>(
reinterpret_cast<char*
>(p) + offset);
548template <
typename DstT,
typename SrcT>
552 return reinterpret_cast<const DstT*
>(
reinterpret_cast<const char*
>(p) + offset);
572 __hostdev__ Rgba8() : mData{{0,0,0,0}} {
static_assert(
sizeof(uint32_t) ==
sizeof(Rgba8),
"Unexpected sizeof");}
573 __hostdev__ Rgba8(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255u) : mData{{r, g, b, a}} {}
576 : mData{{(uint8_t(0.5f + r * 255.0f)),
577 (uint8_t(0.5f + g * 255.0f)),
578 (uint8_t(0.5f + b * 255.0f)),
579 (uint8_t(0.5f + a * 255.0f))}}
586 return 0.0000153787005f*(float(mData.c[0])*mData.c[0] +
587 float(mData.c[1])*mData.c[1] +
588 float(mData.c[2])*mData.c[2]);
612 return gridType == GridType::Float ||
613 gridType == GridType::Double ||
614 gridType == GridType::Fp4 ||
615 gridType == GridType::Fp8 ||
616 gridType == GridType::Fp16 ||
617 gridType == GridType::FpN;
625 if (gridClass == GridClass::LevelSet || gridClass == GridClass::FogVolume) {
627 }
else if (gridClass == GridClass::Staggered) {
628 return gridType == GridType::Vec3f || gridType == GridType::Vec3d ||
629 gridType == GridType::Vec4f || gridType == GridType::Vec4d;
630 }
else if (gridClass == GridClass::PointIndex || gridClass == GridClass::PointData) {
631 return gridType == GridType::UInt32;
632 }
else if (gridClass == GridClass::Topology) {
633 return gridType == GridType::Mask;
634 }
else if (gridClass == GridClass::IndexGrid) {
635 return gridType == GridType::Index;
636 }
else if (gridClass == GridClass::VoxelVolume) {
637 return gridType == GridType::RGBA8 || gridType == GridType::Float || gridType == GridType::Double || gridType == GridType::Vec3f || gridType == GridType::Vec3d || gridType == GridType::UInt32;
639 return gridClass < GridClass::End && gridType < GridType::End;
657 : mData( major << 21 | minor << 10 | patch )
673#ifndef __CUDACC_RTC__
676 char *buffer = (
char*)malloc(4 + 1 + 4 + 1 + 4 + 1);
677 snprintf(buffer, 4 + 1 + 4 + 1 + 4 + 1,
"%d.%d.%d", this->getMajor(), this->getMinor(), this->getPatch());
721#if defined(__CUDA_ARCH__) || defined(__HIP__)
728struct Maximum<uint32_t>
738struct Maximum<double>
746 static T
value() {
return std::numeric_limits<T>::max(); }
751template<
typename Type>
757template<
typename Type>
760 return (a < b) ? a : b;
764 return int32_t(fminf(
float(a),
float(b)));
768 return uint32_t(fminf(
float(a),
float(b)));
778template<
typename Type>
781 return (a > b) ? a : b;
786 return int32_t(fmaxf(
float(a),
float(b)));
790 return uint32_t(fmaxf(
float(a),
float(b)));
802 return Max(Min(x, b), a);
806 return Max(Min(x, b), a);
811 return x - floorf(x);
820 return int32_t(floorf(x));
824 return int32_t(floor(x));
829 return int32_t(ceilf(x));
833 return int32_t(ceil(x));
856 return x < 0 ? -x : x;
877template<
typename CoordT,
typename RealT,
template<
typename>
class Vec3T>
880template<
typename CoordT,
template<
typename>
class Vec3T>
883 return CoordT(int32_t(rintf(xyz[0])), int32_t(rintf(xyz[1])), int32_t(rintf(xyz[2])));
888template<
typename CoordT,
template<
typename>
class Vec3T>
891 return CoordT(int32_t(floor(xyz[0] + 0.5)), int32_t(floor(xyz[1] + 0.5)), int32_t(floor(xyz[2] + 0.5)));
894template<
typename CoordT,
typename RealT,
template<
typename>
class Vec3T>
897 return CoordT(Floor(xyz[0]), Floor(xyz[1]), Floor(xyz[2]));
914__hostdev__ inline T Sign(
const T &x) {
return ((T(0) < x)?T(1):T(0)) - ((x < T(0))?T(1):T(0)); }
916template<
typename Vec3T>
920 static const int hashTable[8] = {2, 1, 9, 1, 2, 9, 0, 0};
921 const int hashKey = ((v[0] < v[1]) << 2) + ((v[0] < v[2]) << 1) + (v[1] < v[2]);
922 return hashTable[hashKey];
924 if (v[0] < v[1] && v[0] < v[2])
933template<
typename Vec3T>
937 static const int hashTable[8] = {2, 1, 9, 1, 2, 9, 0, 0};
938 const int hashKey = ((v[0] > v[1]) << 2) + ((v[0] > v[2]) << 1) + (v[1] > v[2]);
939 return hashTable[hashKey];
941 if (v[0] > v[1] && v[0] > v[2])
953template<u
int64_t wordSize>
956 const uint64_t r = byteCount % wordSize;
957 return r ? byteCount - r + wordSize : byteCount;
963template<
typename>
class Vec3;
992 : mVec{ptr[0], ptr[1], ptr[2]}
1019 template <
typename CoordT>
1022 static_assert(
sizeof(
Coord) ==
sizeof(CoordT),
"Mis-matched sizeof");
1041 return mVec[0] < rhs[0] ? true : mVec[0] > rhs[0] ? false : mVec[1] < rhs[1] ? true : mVec[1] > rhs[1] ? false : mVec[2] < rhs[2] ? true :
false;
1095 if (other[0] < mVec[0])
1097 if (other[1] < mVec[1])
1099 if (other[2] < mVec[2])
1107 if (other[0] > mVec[0])
1109 if (other[1] > mVec[1])
1111 if (other[2] > mVec[2])
1118 return Coord(mVec[0] + dx, mVec[1] + dy, mVec[2] + dz);
1127 return (a[0] < b[0] || a[1] < b[1] || a[2] < b[2]);
1132 template<
typename Vec3T>
1139 template<
int Log2N = 3 + 4 + 5>
1140 __hostdev__ uint32_t
hash()
const {
return ((1 << Log2N) - 1) & (mVec[0] * 73856093 ^ mVec[1] * 19349669 ^ mVec[2] * 83492791); }
1145 (uint8_t(
bool(mVec[1] & (1u << 31))) << 1) |
1146 (uint8_t(
bool(mVec[2] & (1u << 31))) << 2)); }
1164 static const int SIZE = 3;
1175 template<
typename T2>
1177 : mVec{T(v[0]), T(v[1]), T(v[2])}
1181 : mVec{T(ijk[0]), T(ijk[1]), T(ijk[2])}
1186 template<
typename Vec3T>
1196 template<
typename Vec3T>
1197 __hostdev__ T
dot(
const Vec3T& v)
const {
return mVec[0] * v[0] + mVec[1] * v[1] + mVec[2] * v[2]; }
1198 template<
typename Vec3T>
1201 return Vec3(mVec[1] * v[2] - mVec[2] * v[1],
1202 mVec[2] * v[0] - mVec[0] * v[2],
1203 mVec[0] * v[1] - mVec[1] * v[0]);
1207 return mVec[0] * mVec[0] + mVec[1] * mVec[1] + mVec[2] * mVec[2];
1243 if (other[0] < mVec[0])
1245 if (other[1] < mVec[1])
1247 if (other[2] < mVec[2])
1255 if (other[0] > mVec[0])
1257 if (other[1] > mVec[1])
1259 if (other[2] > mVec[2])
1266 return mVec[0] < mVec[1] ? (mVec[0] < mVec[2] ? mVec[0] : mVec[2]) : (mVec[1] < mVec[2] ? mVec[1] : mVec[2]);
1271 return mVec[0] > mVec[1] ? (mVec[0] > mVec[2] ? mVec[0] : mVec[2]) : (mVec[1] > mVec[2] ? mVec[1] : mVec[2]);
1278template<
typename T1,
typename T2>
1281 return Vec3<T2>(scalar * vec[0], scalar * vec[1], scalar * vec[2]);
1283template<
typename T1,
typename T2>
1286 return Vec3<T2>(scalar / vec[0], scalar / vec[1], scalar / vec[2]);
1309 static const int SIZE = 4;
1320 template<
typename T2>
1322 : mVec{T(v[0]), T(v[1]), T(v[2]), T(v[3])}
1325 __hostdev__ bool operator==(
const Vec4& rhs)
const {
return mVec[0] == rhs[0] && mVec[1] == rhs[1] && mVec[2] == rhs[2] && mVec[3] == rhs[3]; }
1326 __hostdev__ bool operator!=(
const Vec4& rhs)
const {
return mVec[0] != rhs[0] || mVec[1] != rhs[1] || mVec[2] != rhs[2] || mVec[3] != rhs[3]; }
1327 template<
typename Vec4T>
1338 template<
typename Vec4T>
1339 __hostdev__ T
dot(
const Vec4T& v)
const {
return mVec[0] * v[0] + mVec[1] * v[1] + mVec[2] * v[2] + mVec[3] * v[3]; }
1342 return mVec[0] * mVec[0] + mVec[1] * mVec[1] + mVec[2] * mVec[2] + mVec[3] * mVec[3];
1381 if (other[0] < mVec[0])
1383 if (other[1] < mVec[1])
1385 if (other[2] < mVec[2])
1387 if (other[3] < mVec[3])
1395 if (other[0] > mVec[0])
1397 if (other[1] > mVec[1])
1399 if (other[2] > mVec[2])
1401 if (other[3] > mVec[3])
1407template<
typename T1,
typename T2>
1410 return Vec4<T2>(scalar * vec[0], scalar * vec[1], scalar * vec[2], scalar * vec[3]);
1412template<
typename T1,
typename T2>
1415 return Vec4<T2>(scalar / vec[0], scalar / vec[1], scalar / vec[2], scalar / vec[3]);
1425template<
typename T,
int Rank = (is_specialization<T, Vec3>::value ||
1426 is_specialization<T, Vec4>::value ||
1427 is_same<T, Rgba8>::value) ? 1 : 0>
1433 static const int Rank = 0;
1434 static const bool IsScalar =
true;
1435 static const bool IsVector =
false;
1436 static const int Size = 1;
1444 static const int Rank = 1;
1445 static const bool IsScalar =
false;
1446 static const bool IsVector =
true;
1447 static const int Size = T::SIZE;
1454template<
typename T,
int = sizeof(
typename TensorTraits<T>::ElementType)>
1487template<
typename BuildT>
1491 return GridType::Float;
1493 return GridType::Double;
1495 return GridType::Int16;
1497 return GridType::Int32;
1499 return GridType::Int64;
1501 return GridType::Vec3f;
1503 return GridType::Vec3d;
1505 return GridType::UInt32;
1507 return GridType::Mask;
1509 return GridType::Index;
1511 return GridType::Boolean;
1513 return GridType::RGBA8;
1515 return GridType::Fp4;
1517 return GridType::Fp8;
1519 return GridType::Fp16;
1521 return GridType::FpN;
1523 return GridType::Vec4f;
1525 return GridType::Vec4d;
1527 return GridType::Unknown;
1532template<
typename Vec3T>
1535 return Vec3T(fmaf(xyz[0], mat[0], fmaf(xyz[1], mat[1], xyz[2] * mat[2])),
1536 fmaf(xyz[0], mat[3], fmaf(xyz[1], mat[4], xyz[2] * mat[5])),
1537 fmaf(xyz[0], mat[6], fmaf(xyz[1], mat[7], xyz[2] * mat[8])));
1540template<
typename Vec3T>
1543 return Vec3T(fma(
static_cast<double>(xyz[0]), mat[0], fma(
static_cast<double>(xyz[1]), mat[1],
static_cast<double>(xyz[2]) * mat[2])),
1544 fma(
static_cast<double>(xyz[0]), mat[3], fma(
static_cast<double>(xyz[1]), mat[4],
static_cast<double>(xyz[2]) * mat[5])),
1545 fma(
static_cast<double>(xyz[0]), mat[6], fma(
static_cast<double>(xyz[1]), mat[7],
static_cast<double>(xyz[2]) * mat[8])));
1548template<
typename Vec3T>
1551 return Vec3T(fmaf(xyz[0], mat[0], fmaf(xyz[1], mat[1], fmaf(xyz[2], mat[2], vec[0]))),
1552 fmaf(xyz[0], mat[3], fmaf(xyz[1], mat[4], fmaf(xyz[2], mat[5], vec[1]))),
1553 fmaf(xyz[0], mat[6], fmaf(xyz[1], mat[7], fmaf(xyz[2], mat[8], vec[2]))));
1556template<
typename Vec3T>
1559 return Vec3T(fma(
static_cast<double>(xyz[0]), mat[0], fma(
static_cast<double>(xyz[1]), mat[1], fma(
static_cast<double>(xyz[2]), mat[2], vec[0]))),
1560 fma(
static_cast<double>(xyz[0]), mat[3], fma(
static_cast<double>(xyz[1]), mat[4], fma(
static_cast<double>(xyz[2]), mat[5], vec[1]))),
1561 fma(
static_cast<double>(xyz[0]), mat[6], fma(
static_cast<double>(xyz[1]), mat[7], fma(
static_cast<double>(xyz[2]), mat[8], vec[2]))));
1566template<
typename Vec3T>
1569 return Vec3T(fmaf(xyz[0], mat[0], fmaf(xyz[1], mat[3], xyz[2] * mat[6])),
1570 fmaf(xyz[0], mat[1], fmaf(xyz[1], mat[4], xyz[2] * mat[7])),
1571 fmaf(xyz[0], mat[2], fmaf(xyz[1], mat[5], xyz[2] * mat[8])));
1574template<
typename Vec3T>
1577 return Vec3T(fma(
static_cast<double>(xyz[0]), mat[0], fma(
static_cast<double>(xyz[1]), mat[3],
static_cast<double>(xyz[2]) * mat[6])),
1578 fma(
static_cast<double>(xyz[0]), mat[1], fma(
static_cast<double>(xyz[1]), mat[4],
static_cast<double>(xyz[2]) * mat[7])),
1579 fma(
static_cast<double>(xyz[0]), mat[2], fma(
static_cast<double>(xyz[1]), mat[5],
static_cast<double>(xyz[2]) * mat[8])));
1582template<
typename Vec3T>
1585 return Vec3T(fmaf(xyz[0], mat[0], fmaf(xyz[1], mat[3], fmaf(xyz[2], mat[6], vec[0]))),
1586 fmaf(xyz[0], mat[1], fmaf(xyz[1], mat[4], fmaf(xyz[2], mat[7], vec[1]))),
1587 fmaf(xyz[0], mat[2], fmaf(xyz[1], mat[5], fmaf(xyz[2], mat[8], vec[2]))));
1590template<
typename Vec3T>
1593 return Vec3T(fma(
static_cast<double>(xyz[0]), mat[0], fma(
static_cast<double>(xyz[1]), mat[3], fma(
static_cast<double>(xyz[2]), mat[6], vec[0]))),
1594 fma(
static_cast<double>(xyz[0]), mat[1], fma(
static_cast<double>(xyz[1]), mat[4], fma(
static_cast<double>(xyz[2]), mat[7], vec[1]))),
1595 fma(
static_cast<double>(xyz[0]), mat[2], fma(
static_cast<double>(xyz[1]), mat[5], fma(
static_cast<double>(xyz[2]), mat[8], vec[2]))));
1601template<
typename Vec3T>
1622 mCoord[0].minComponent(xyz);
1623 mCoord[1].maxComponent(xyz);
1630 mCoord[0].maxComponent(bbox.
min());
1631 mCoord[1].minComponent(bbox.
max());
1641 if (xyz[0] < mCoord[0][0] || xyz[1] < mCoord[0][1] || xyz[2] < mCoord[0][2])
1643 if (xyz[0] > mCoord[1][0] || xyz[1] > mCoord[1][1] || xyz[2] > mCoord[1][2])
1656template<typename Vec3T, bool = is_floating_point<typename Vec3T::ValueType>::value>
1663template<
typename Vec3T>
1670 using BaseT::mCoord;
1687 return BBox(min, min.offsetBy(dim));
1692 mCoord[0][1] >= mCoord[1][1] ||
1693 mCoord[0][2] >= mCoord[1][2]; }
1694 __hostdev__ Vec3T
dim()
const {
return this->empty() ? Vec3T(0) : this->max() - this->min(); }
1697 return p[0] > mCoord[0][0] && p[1] > mCoord[0][1] && p[2] > mCoord[0][2] &&
1698 p[0] < mCoord[1][0] && p[1] < mCoord[1][1] && p[2] < mCoord[1][2];
1707template<
typename CoordT>
1712 using BaseT::mCoord;
1727 if (mPos[2] < mBBox[1][2]) {
1729 }
else if (mPos[1] < mBBox[1][1]) {
1730 mPos[2] = mBBox[0][2];
1732 }
else if (mPos[0] <= mBBox[1][0]) {
1733 mPos[2] = mBBox[0][2];
1734 mPos[1] = mBBox[0][1];
1751 :
BaseT(CoordT::max(), CoordT::min())
1759 template<
typename SplitT>
1761 :
BaseT(other.mCoord[0], other.mCoord[1])
1764 const int n = MaxIndex(this->dim());
1765 mCoord[1][n] = (mCoord[0][n] + mCoord[1][n]) >> 1;
1766 other.mCoord[0][n] = mCoord[1][n] + 1;
1771 return BBox(min, min.offsetBy(dim - 1));
1775 mCoord[0][1] < mCoord[1][1] &&
1776 mCoord[0][2] < mCoord[1][2]; }
1779 mCoord[0][1] > mCoord[1][1] ||
1780 mCoord[0][2] > mCoord[1][2]; }
1782 __hostdev__ uint64_t
volume()
const {
auto d = this->dim();
return uint64_t(d[0])*uint64_t(d[1])*uint64_t(d[2]); }
1783 __hostdev__ bool isInside(
const CoordT& p)
const {
return !(CoordT::lessThan(p, this->min()) || CoordT::lessThan(this->max(), p)); }
1787 return !(CoordT::lessThan(b.min(), this->min()) || CoordT::lessThan(this->max(), b.max()));
1793 return !(CoordT::lessThan(this->max(), b.min()) || CoordT::lessThan(b.max(), this->min()));
1797 template<
typename RealT>
1802 Vec3<RealT>(RealT(mCoord[1][0] + 1), RealT(mCoord[1][1] + 1), RealT(mCoord[1][2] + 1)));
1807 return BBox(mCoord[0].offsetBy(-padding), mCoord[1].offsetBy(padding));
1823#if (defined(__CUDA_ARCH__) || defined(__HIP__)) && defined(NANOVDB_USE_INTRINSICS)
1825#elif defined(_MSC_VER) && defined(NANOVDB_USE_INTRINSICS)
1826 unsigned long index;
1827 _BitScanForward(&index, v);
1828 return static_cast<uint32_t
>(index);
1829#elif (defined(__GNUC__) || defined(__clang__)) && defined(NANOVDB_USE_INTRINSICS)
1830 return static_cast<uint32_t
>(__builtin_ctzl(v));
1833 static const unsigned char DeBruijn[32] = {
1834 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9};
1836#if defined(_MSC_VER) && !defined(__NVCC__)
1837#pragma warning(push)
1838#pragma warning(disable : 4146)
1840 return DeBruijn[uint32_t((v & -v) * 0x077CB531U) >> 27];
1841#if defined(_MSC_VER) && !defined(__NVCC__)
1855#if defined(_MSC_VER) && defined(NANOVDB_USE_INTRINSICS)
1856 unsigned long index;
1857 _BitScanReverse(&index, v);
1858 return static_cast<uint32_t
>(index);
1859#elif (defined(__GNUC__) || defined(__clang__)) && defined(NANOVDB_USE_INTRINSICS)
1860 return sizeof(
unsigned long) * 8 - 1 - __builtin_clzl(v);
1863 static const unsigned char DeBruijn[32] = {
1864 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31};
1870 return DeBruijn[uint32_t(v * 0x07C4ACDDU) >> 27];
1881#if (defined(__CUDA_ARCH__) || defined(__HIP__)) && defined(NANOVDB_USE_INTRINSICS)
1882 return __ffsll(
static_cast<unsigned long long int>(v));
1883#elif defined(_MSC_VER) && defined(NANOVDB_USE_INTRINSICS)
1884 unsigned long index;
1885 _BitScanForward64(&index, v);
1886 return static_cast<uint32_t
>(index);
1887#elif (defined(__GNUC__) || defined(__clang__)) && defined(NANOVDB_USE_INTRINSICS)
1888 return static_cast<uint32_t
>(__builtin_ctzll(v));
1891 static const unsigned char DeBruijn[64] = {
1892 0, 1, 2, 53, 3, 7, 54, 27, 4, 38, 41, 8, 34, 55, 48, 28,
1893 62, 5, 39, 46, 44, 42, 22, 9, 24, 35, 59, 56, 49, 18, 29, 11,
1894 63, 52, 6, 26, 37, 40, 33, 47, 61, 45, 43, 21, 23, 58, 17, 10,
1895 51, 25, 36, 32, 60, 20, 57, 16, 50, 31, 19, 15, 30, 14, 13, 12,
1898#if defined(_MSC_VER) && !defined(__NVCC__)
1899#pragma warning(push)
1900#pragma warning(disable : 4146)
1902 return DeBruijn[uint64_t((v & -v) * UINT64_C(0x022FDD63CC95386D)) >> 58];
1903#if defined(_MSC_VER) && !defined(__NVCC__)
1917#if defined(_MSC_VER) && defined(NANOVDB_USE_INTRINSICS)
1918 unsigned long index;
1919 _BitScanReverse64(&index, v);
1920 return static_cast<uint32_t
>(index);
1921#elif (defined(__GNUC__) || defined(__clang__)) && defined(NANOVDB_USE_INTRINSICS)
1922 return sizeof(
unsigned long) * 8 - 1 - __builtin_clzll(v);
1924 const uint32_t* p =
reinterpret_cast<const uint32_t*
>(&v);
1925 return p[1] ? 32u + FindHighestOn(p[1]) : FindHighestOn(p[0]);
1935#if (defined(__CUDA_ARCH__) || defined(__HIP__)) && defined(NANOVDB_USE_INTRINSICS)
1939#elif defined(_MSC_VER) && defined(_M_X64) && (_MSC_VER >= 1928) && defined(NANOVDB_USE_INTRINSICS)
1941 return __popcnt64(v);
1942#elif (defined(__GNUC__) || defined(__clang__)) && defined(NANOVDB_USE_INTRINSICS)
1944 return __builtin_popcountll(v);
1947 v = v - ((v >> 1) & uint64_t(0x5555555555555555));
1948 v = (v & uint64_t(0x3333333333333333)) + ((v >> 2) & uint64_t(0x3333333333333333));
1949 return (((v + (v >> 4)) & uint64_t(0xF0F0F0F0F0F0F0F)) * uint64_t(0x101010101010101)) >> 56;
1957template<u
int32_t LOG2DIM>
1960 static constexpr uint32_t SIZE = 1U << (3 * LOG2DIM);
1961 static constexpr uint32_t WORD_COUNT = SIZE >> 6;
1962 uint64_t mWords[WORD_COUNT];
1977 uint32_t sum = 0, n = WORD_COUNT;
1978 for (
const uint64_t* w = mWords; n--; ++w)
1986 uint32_t n = i >> 6, sum = CountOn( mWords[n] & ((uint64_t(1) << (i & 63u))-1u) );
1987 for (
const uint64_t* w = mWords; n--; ++w) sum += CountOn(*w);
2003 mPos = mParent->findNext<On>(mPos + 1);
2015 const Mask* mParent;
2028 for (uint32_t i = 0; i < WORD_COUNT; ++i)
2033 const uint64_t v = on ? ~uint64_t(0) : uint64_t(0);
2034 for (uint32_t i = 0; i < WORD_COUNT; ++i)
2041 for (uint32_t i = 0; i < WORD_COUNT; ++i)
2042 mWords[i] = other.mWords[i];
2046 template<
typename WordT>
2050 return reinterpret_cast<const WordT*
>(mWords)[n];
2054 template<
typename WordT>
2058 return reinterpret_cast<WordT*
>(mWords)[n];
2062 template<
typename MaskT>
2065 static_assert(
sizeof(
Mask) ==
sizeof(MaskT),
"Mismatching sizeof");
2066 static_assert(WORD_COUNT == MaskT::WORD_COUNT,
"Mismatching word count");
2067 static_assert(LOG2DIM == MaskT::LOG2DIM,
"Mismatching LOG2DIM");
2068 auto *src =
reinterpret_cast<const uint64_t*
>(&other);
2069 uint64_t *dst = mWords;
2070 for (uint32_t i = 0; i < WORD_COUNT; ++i) {
2078 for (uint32_t i = 0; i < WORD_COUNT; ++i) {
2079 if (mWords[i] != other.mWords[i])
return false;
2087 __hostdev__ bool isOn(uint32_t n)
const {
return 0 != (mWords[n >> 6] & (uint64_t(1) << (n & 63))); }
2090 __hostdev__ bool isOff(uint32_t n)
const {
return 0 == (mWords[n >> 6] & (uint64_t(1) << (n & 63))); }
2095 for (uint32_t i = 0; i < WORD_COUNT; ++i)
2096 if (mWords[i] != ~uint64_t(0))
2104 for (uint32_t i = 0; i < WORD_COUNT; ++i)
2105 if (mWords[i] != uint64_t(0))
2120 auto &word = mWords[n >> 6];
2122 word &= ~(uint64_t(1) << n);
2123 word |= uint64_t(On) << n;
2125 On ? this->setOn(n) : this->setOff(n);
2132 for (uint32_t i = 0; i < WORD_COUNT; ++i)
2133 mWords[i] = ~uint64_t(0);
2139 for (uint32_t i = 0; i < WORD_COUNT; ++i)
2140 mWords[i] = uint64_t(0);
2146 const uint64_t v = on ? ~uint64_t(0) : uint64_t(0);
2147 for (uint32_t i = 0; i < WORD_COUNT; ++i)
2153 uint32_t n = WORD_COUNT;
2154 for (
auto* w = mWords; n--; ++w)
2162 uint64_t *w1 = mWords;
2163 const uint64_t *w2 = other.mWords;
2164 for (uint32_t n = WORD_COUNT; n--; ++w1, ++w2) *w1 &= *w2;
2170 uint64_t *w1 = mWords;
2171 const uint64_t *w2 = other.mWords;
2172 for (uint32_t n = WORD_COUNT; n--; ++w1, ++w2) *w1 |= *w2;
2178 uint64_t *w1 = mWords;
2179 const uint64_t *w2 = other.mWords;
2180 for (uint32_t n = WORD_COUNT; n--; ++w1, ++w2) *w1 &= ~*w2;
2186 uint64_t *w1 = mWords;
2187 const uint64_t *w2 = other.mWords;
2188 for (uint32_t n = WORD_COUNT; n--; ++w1, ++w2) *w1 ^= *w2;
2199 const uint64_t* w = mWords;
2200 for (; n<WORD_COUNT && !(On ? *w : ~*w); ++w, ++n);
2201 return n==WORD_COUNT ? SIZE : (n << 6) + FindLowestOn(On ? *w : ~*w);
2206 __hostdev__ uint32_t findNext(uint32_t start)
const
2208 uint32_t n = start >> 6;
2209 if (n >= WORD_COUNT)
2211 uint32_t m = start & 63;
2212 uint64_t b = On ? mWords[n] : ~mWords[n];
2213 if (b & (uint64_t(1) << m))
2215 b &= ~uint64_t(0) << m;
2216 while (!b && ++n < WORD_COUNT)
2217 b = On ? mWords[n] : ~mWords[n];
2218 return (!b ? SIZE : (n << 6) + FindLowestOn(b));
2237 template<
typename Mat3T,
typename Vec3T>
2238 __hostdev__ void set(
const Mat3T& mat,
const Mat3T& invMat,
const Vec3T& translate,
double taper);
2242 template<
typename Mat4T>
2243 __hostdev__ void set(
const Mat4T& mat,
const Mat4T& invMat,
double taper) {this->
set(mat, invMat, mat[3], taper);}
2245 template<
typename Vec3T>
2246 __hostdev__ void set(
double scale,
const Vec3T &translation,
double taper);
2248 template<
typename Vec3T>
2250 template<
typename Vec3T>
2253 template<
typename Vec3T>
2255 template<
typename Vec3T>
2258 template<
typename Vec3T>
2261 return matMult(mInvMatD, Vec3T(xyz[0] - mVecD[0], xyz[1] - mVecD[1], xyz[2] - mVecD[2]));
2263 template<
typename Vec3T>
2266 return matMult(mInvMatF, Vec3T(xyz[0] - mVecF[0], xyz[1] - mVecF[1], xyz[2] - mVecF[2]));
2269 template<
typename Vec3T>
2271 template<
typename Vec3T>
2274 template<
typename Vec3T>
2276 template<
typename Vec3T>
2280template<
typename Mat3T,
typename Vec3T>
2281__hostdev__ inline void Map::set(
const Mat3T& mat,
const Mat3T& invMat,
const Vec3T& translate,
double taper)
2283 float *mf = mMatF, *vf = mVecF, *mif = mInvMatF;
2284 double *md = mMatD, *vd = mVecD, *mid = mInvMatD;
2285 mTaperF =
static_cast<float>(taper);
2287 for (
int i = 0; i < 3; ++i) {
2288 *vd++ = translate[i];
2289 *vf++ =
static_cast<float>(translate[i]);
2290 for (
int j = 0; j < 3; ++j) {
2292 *mid++ = invMat[j][i];
2293 *mf++ =
static_cast<float>(mat[j][i]);
2294 *mif++ =
static_cast<float>(invMat[j][i]);
2299template<
typename Vec3T>
2300__hostdev__ inline void Map::set(
double dx,
const Vec3T &trans,
double taper)
2302 const double mat[3][3] = {
2306 }, idx = 1.0/dx, invMat[3][3] = {
2311 this->set(mat, invMat, trans, taper);
2318 static const int MaxNameSize = 256;
2325 char mName[MaxNameSize];
2335 template <
typename T>
2344template<
typename Gr
idOrTreeOrRootT,
int LEVEL>
2348template<
typename Gr
idOrTreeOrRootT>
2351 static_assert(GridOrTreeOrRootT::RootType::LEVEL == 3,
"Tree depth is not supported");
2352 using Type =
typename GridOrTreeOrRootT::LeafNodeType;
2353 using type =
typename GridOrTreeOrRootT::LeafNodeType;
2355template<
typename Gr
idOrTreeOrRootT>
2358 static_assert(GridOrTreeOrRootT::RootType::LEVEL == 3,
"Tree depth is not supported");
2359 using Type =
const typename GridOrTreeOrRootT::LeafNodeType;
2360 using type =
const typename GridOrTreeOrRootT::LeafNodeType;
2363template<
typename Gr
idOrTreeOrRootT>
2366 static_assert(GridOrTreeOrRootT::RootType::LEVEL == 3,
"Tree depth is not supported");
2367 using Type =
typename GridOrTreeOrRootT::RootType::ChildNodeType::ChildNodeType;
2368 using type =
typename GridOrTreeOrRootT::RootType::ChildNodeType::ChildNodeType;
2370template<
typename Gr
idOrTreeOrRootT>
2373 static_assert(GridOrTreeOrRootT::RootType::LEVEL == 3,
"Tree depth is not supported");
2374 using Type =
const typename GridOrTreeOrRootT::RootType::ChildNodeType::ChildNodeType;
2375 using type =
const typename GridOrTreeOrRootT::RootType::ChildNodeType::ChildNodeType;
2377template<
typename Gr
idOrTreeOrRootT>
2380 static_assert(GridOrTreeOrRootT::RootType::LEVEL == 3,
"Tree depth is not supported");
2381 using Type =
typename GridOrTreeOrRootT::RootType::ChildNodeType;
2382 using type =
typename GridOrTreeOrRootT::RootType::ChildNodeType;
2384template<
typename Gr
idOrTreeOrRootT>
2387 static_assert(GridOrTreeOrRootT::RootType::LEVEL == 3,
"Tree depth is not supported");
2388 using Type =
const typename GridOrTreeOrRootT::RootType::ChildNodeType;
2389 using type =
const typename GridOrTreeOrRootT::RootType::ChildNodeType;
2391template<
typename Gr
idOrTreeOrRootT>
2394 static_assert(GridOrTreeOrRootT::RootType::LEVEL == 3,
"Tree depth is not supported");
2395 using Type =
typename GridOrTreeOrRootT::RootType;
2396 using type =
typename GridOrTreeOrRootT::RootType;
2399template<
typename Gr
idOrTreeOrRootT>
2402 static_assert(GridOrTreeOrRootT::RootType::LEVEL == 3,
"Tree depth is not supported");
2403 using Type =
const typename GridOrTreeOrRootT::RootType;
2404 using type =
const typename GridOrTreeOrRootT::RootType;
2435 static const int MaxNameSize = 256;
2443 char mGridName[MaxNameSize];
2459 mFlags |=
static_cast<uint32_t
>(GridFlags::HasMinMax);
2461 mFlags &= ~static_cast<uint32_t>(GridFlags::HasMinMax);
2467 mFlags |=
static_cast<uint32_t
>(GridFlags::HasBBox);
2469 mFlags &= ~static_cast<uint32_t>(GridFlags::HasBBox);
2475 mFlags |=
static_cast<uint32_t
>(GridFlags::HasLongGridName);
2477 mFlags &= ~static_cast<uint32_t>(GridFlags::HasLongGridName);
2483 mFlags |=
static_cast<uint32_t
>(GridFlags::HasAverage);
2485 mFlags &= ~static_cast<uint32_t>(GridFlags::HasAverage);
2491 mFlags |=
static_cast<uint32_t
>(GridFlags::HasStdDeviation);
2493 mFlags &= ~static_cast<uint32_t>(GridFlags::HasStdDeviation);
2499 mFlags |=
static_cast<uint32_t
>(GridFlags::IsBreadthFirst);
2501 mFlags &= ~static_cast<uint32_t>(GridFlags::IsBreadthFirst);
2506 template<
typename Vec3T>
2508 template<
typename Vec3T>
2510 template<
typename Vec3T>
2512 template<
typename Vec3T>
2514 template<
typename Vec3T>
2517 template<
typename Vec3T>
2519 template<
typename Vec3T>
2521 template<
typename Vec3T>
2523 template<
typename Vec3T>
2525 template<
typename Vec3T>
2540 return PtrAdd<GridBlindMetaData>(
this, mBlindMetadataOffset) + n;
2546template <
typename BuildT,
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1>
2549template <
typename BuildT>
2556template<
typename TreeT>
2596 template <
typename T = BuildType>
2600 __hostdev__ const TreeT&
tree()
const {
return *
reinterpret_cast<const TreeT*
>(this->treePtr()); }
2615 template<
typename Vec3T>
2619 template<
typename Vec3T>
2624 template<
typename Vec3T>
2629 template<
typename Vec3T>
2634 template<
typename Vec3T>
2638 template<
typename Vec3T>
2642 template<
typename Vec3T>
2647 template<
typename Vec3T>
2652 template<
typename Vec3T>
2657 template<
typename Vec3T>
2685 __hostdev__ bool hasBBox()
const {
return DataType::mFlags &
static_cast<uint32_t
>(GridFlags::HasBBox); }
2693 template <
typename NodeT>
2698 template <
int LEVEL>
2704 if (this->hasLongGridName()) {
2706 const auto &metaData = this->blindMetaData(DataType::mBlindMetadataCount-1);
2707 NANOVDB_ASSERT(metaData.mDataClass == GridBlindDataClass::GridName);
2708 return metaData.template getBlindData<const char>();
2710 return DataType::mGridName;
2733 if (DataType::mBlindMetadataCount == 0u) {
2737 return this->blindMetaData(n).template getBlindData<void>();
2746template<
typename TreeT>
2749 for (uint32_t i = 0, n = this->blindDataCount(); i < n; ++i)
2750 if (this->blindMetaData(i).mSemantic == semantic)
2757template<
int ROOT_LEVEL = 3>
2760 static_assert(
ROOT_LEVEL == 3,
"Root level is assumed to be three");
2761 uint64_t mNodeOffset[4];
2762 uint32_t mNodeCount[3];
2763 uint32_t mTileCount[3];
2766 template <
typename RootT>
2768 template <
typename RootT>
2770 template <
typename RootT>
2773 template <
typename NodeT>
2776 mNodeOffset[NodeT::LEVEL] = node ?
PtrDiff(node,
this) : 0;
2783template<
typename Gr
idT>
2786 using Type =
typename GridT::TreeType;
2787 using type =
typename GridT::TreeType;
2789template<
typename Gr
idT>
2792 using Type =
const typename GridT::TreeType;
2793 using type =
const typename GridT::TreeType;
2799template<
typename RootT>
2802 static_assert(RootT::LEVEL == 3,
"Tree depth is not supported");
2803 static_assert(RootT::ChildNodeType::LOG2DIM == 5,
"Tree configuration is not supported");
2804 static_assert(RootT::ChildNodeType::ChildNodeType::LOG2DIM == 4,
"Tree configuration is not supported");
2805 static_assert(RootT::LeafNodeType::LOG2DIM == 3,
"Tree configuration is not supported");
2817 using Node2 =
typename RootT::ChildNodeType;
2818 using Node1 =
typename Node2::ChildNodeType;
2856 __hostdev__ void extrema(ValueType& min, ValueType& max)
const;
2872 return DataType::mTileCount[level - 1];
2875 template<
typename NodeT>
2878 static_assert(NodeT::LEVEL < 3,
"Invalid NodeT");
2879 return DataType::mNodeCount[NodeT::LEVEL];
2885 return DataType::mNodeCount[level];
2891 template <
typename NodeT>
2894 const uint64_t offset = DataType::mNodeOffset[NodeT::LEVEL];
2895 return offset>0 ? PtrAdd<NodeT>(
this, offset) :
nullptr;
2901 template <
typename NodeT>
2904 const uint64_t offset = DataType::mNodeOffset[NodeT::LEVEL];
2905 return offset>0 ? PtrAdd<NodeT>(
this, offset) :
nullptr;
2911 template <
int LEVEL>
2915 return this->
template getFirstNode<typename NodeTrait<RootT,LEVEL>::type>();
2921 template <
int LEVEL>
2925 return this->
template getFirstNode<typename NodeTrait<RootT,LEVEL>::type>();
2941template<
typename RootT>
2944 min = this->root().minimum();
2945 max = this->root().maximum();
2953template<
typename ChildT>
2960 static constexpr bool FIXED_SIZE =
false;
2963#ifdef USE_SINGLE_ROOT_KEY
2965 template <
typename CoordType>
2968 static_assert(
sizeof(
CoordT) ==
sizeof(CoordType),
"Mismatching sizeof");
2969 static_assert(32 - ChildT::TOTAL <= 21,
"Cannot use 64 bit root keys");
2970 return (
KeyT(uint32_t(ijk[2]) >> ChildT::TOTAL)) |
2971 (
KeyT(uint32_t(ijk[1]) >> ChildT::TOTAL) << 21) |
2972 (
KeyT(uint32_t(ijk[0]) >> ChildT::TOTAL) << 42);
2976 static constexpr uint64_t MASK = (1u << 21) - 1;
2977 return CoordT(((key >> 42) & MASK) << ChildT::TOTAL,
2978 ((key >> 21) & MASK) << ChildT::TOTAL,
2979 (key & MASK) << ChildT::TOTAL);
2982 using KeyT = CoordT;
2983 __hostdev__ static KeyT CoordToKey(
const CoordT& ijk) {
return ijk & ~ChildT::MASK; }
2984 __hostdev__ static CoordT KeyToCoord(
const KeyT& key) {
return key; }
3002 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
Tile
3004 template <
typename CoordType>
3007 key = CoordToKey(k);
3010 template <
typename CoordType,
typename ValueType>
3013 key = CoordToKey(k);
3034 return reinterpret_cast<const Tile*
>(
this + 1) + n;
3039 return reinterpret_cast<Tile*
>(
this + 1) + n;
3048 return PtrAdd<ChildT>(
this, tile->
child);
3053 return PtrAdd<ChildT>(
this, tile->
child);
3074template<
typename ChildT>
3091 static constexpr bool FIXED_SIZE = DataType::FIXED_SIZE;
3093 static constexpr uint32_t LEVEL = 1 + ChildT::LEVEL;
3098 uint32_t mPos, mSize;
3103 while (mPos<mSize && !mParent->tile(mPos)->isChild()) ++mPos;
3114 while (mPos < mSize && mParent->tile(mPos)->isValue()) ++mPos;
3129 uint32_t mPos, mSize;
3134 while (mPos < mSize && mParent->tile(mPos)->isChild()) ++mPos;
3145 while (mPos < mSize && mParent->tile(mPos)->isChild()) ++mPos;
3160 uint32_t mPos, mSize;
3165 while (mPos < mSize && !mParent->tile(mPos)->isActive()) ++mPos;
3175 while (mPos < mSize && !mParent->tile(mPos)->isActive()) ++mPos;
3235 if (
const Tile* tile = this->probeTile(ijk)) {
3236 return tile->isChild() ? this->getChild(tile)->getValue(ijk) : tile->value;
3238 return DataType::mBackground;
3243 if (
const Tile* tile = this->probeTile(ijk)) {
3244 return tile->isChild() ? this->getChild(tile)->isActive(ijk) : tile->state;
3254 if (
const Tile* tile = this->probeTile(ijk)) {
3255 if (tile->isChild()) {
3256 const auto *
child = this->getChild(tile);
3257 return child->probeValue(ijk, v);
3262 v = DataType::mBackground;
3268 const Tile* tile = this->probeTile(ijk);
3269 if (tile && tile->isChild()) {
3270 const auto *
child = this->getChild(tile);
3271 return child->probeLeaf(ijk);
3278 const Tile* tile = this->probeTile(ijk);
3279 if (tile && tile->isChild()) {
3280 return this->getChild(tile);
3288 const Tile* tiles =
reinterpret_cast<const Tile*
>(
this + 1);
3289 const auto key = DataType::CoordToKey(ijk);
3291 for (uint32_t i = 0; i < DataType::mTableSize; ++i) {
3292 if (tiles[i].key == key)
return &tiles[i];
3296 int32_t low = 0, high = DataType::mTableSize;
3297 while (low != high) {
3298 int mid = low + ((high - low) >> 1);
3299 const Tile* tile = &tiles[mid];
3300 if (tile->key == key) {
3302 }
else if (tile->key < key) {
3314 static_assert(
sizeof(
typename DataType::Tile) %
NANOVDB_DATA_ALIGNMENT == 0,
"sizeof(RootData::Tile) is misaligned");
3316 template<
typename,
int,
int,
int>
3323 template<
typename AccT>
3324 __hostdev__ typename AccT::NodeInfo getNodeInfoAndCache(
const CoordType& ijk,
const AccT& acc)
const
3326 using NodeInfoT =
typename AccT::NodeInfo;
3327 if (
const Tile* tile = this->probeTile(ijk)) {
3328 if (tile->isChild()) {
3329 const auto *
child = this->getChild(tile);
3330 acc.insert(ijk,
child);
3331 return child->getNodeInfoAndCache(ijk, acc);
3333 return NodeInfoT{LEVEL, ChildT::dim(), tile->value, tile->value, tile->value,
3334 0, tile->origin(), tile->origin() + CoordType(ChildT::DIM)};
3336 return NodeInfoT{LEVEL, ChildT::dim(), this->minimum(), this->maximum(),
3337 this->average(), this->stdDeviation(), this->bbox()[0], this->bbox()[1]};
3341 template<
typename AccT>
3342 __hostdev__ ValueType getValueAndCache(
const CoordType& ijk,
const AccT& acc)
const
3344 if (
const Tile* tile = this->probeTile(ijk)) {
3345 if (tile->isChild()) {
3346 const auto *
child = this->getChild(tile);
3347 acc.insert(ijk,
child);
3348 return child->getValueAndCache(ijk, acc);
3352 return DataType::mBackground;
3355 template<
typename AccT>
3356 __hostdev__ bool isActiveAndCache(
const CoordType& ijk,
const AccT& acc)
const
3358 const Tile* tile = this->probeTile(ijk);
3359 if (tile && tile->isChild()) {
3360 const auto *
child = this->getChild(tile);
3361 acc.insert(ijk,
child);
3362 return child->isActiveAndCache(ijk, acc);
3367 template<
typename AccT>
3368 __hostdev__ bool probeValueAndCache(
const CoordType& ijk, ValueType& v,
const AccT& acc)
const
3370 if (
const Tile* tile = this->probeTile(ijk)) {
3371 if (tile->isChild()) {
3372 const auto *
child = this->getChild(tile);
3373 acc.insert(ijk,
child);
3374 return child->probeValueAndCache(ijk, v, acc);
3379 v = DataType::mBackground;
3383 template<
typename AccT>
3384 __hostdev__ const LeafNodeType* probeLeafAndCache(
const CoordType& ijk,
const AccT& acc)
const
3386 const Tile* tile = this->probeTile(ijk);
3387 if (tile && tile->isChild()) {
3388 const auto *
child = this->getChild(tile);
3389 acc.insert(ijk,
child);
3390 return child->probeLeafAndCache(ijk, acc);
3395 template<
typename RayT,
typename AccT>
3396 __hostdev__ uint32_t getDimAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const
3398 if (
const Tile* tile = this->probeTile(ijk)) {
3399 if (tile->isChild()) {
3400 const auto *
child = this->getChild(tile);
3401 acc.insert(ijk,
child);
3402 return child->getDimAndCache(ijk, ray, acc);
3404 return 1 << ChildT::TOTAL;
3406 return ChildNodeType::dim();
3418template<
typename ChildT, u
int32_t LOG2DIM>
3425 using MaskT =
typename ChildT::template MaskType<LOG2DIM>;
3426 static constexpr bool FIXED_SIZE =
true;
3455 + (1u << (3 * LOG2DIM))*(
sizeof(
ValueT) > 8u ?
sizeof(
ValueT) : 8u));
3457 alignas(32)
Tile mTable[1u << (3 * LOG2DIM)];
3464 mTable[n].child =
PtrDiff(ptr,
this);
3467 template <
typename ValueT>
3471 mTable[n].value = v;
3478 return PtrAdd<ChildT>(
this, mTable[n].
child);
3483 return PtrAdd<ChildT>(
this, mTable[n].
child);
3489 return mTable[n].value;
3495 return mValueMask.isOn(n);
3500 template <
typename T>
3521template<
typename ChildT, u
int32_t Log2Dim = ChildT::LOG2DIM + 1>
3532 static constexpr bool FIXED_SIZE = DataType::FIXED_SIZE;
3533 template<u
int32_t LOG2>
3538 static constexpr uint32_t LOG2DIM = Log2Dim;
3539 static constexpr uint32_t TOTAL = LOG2DIM + ChildT::TOTAL;
3540 static constexpr uint32_t DIM = 1u << TOTAL;
3541 static constexpr uint32_t SIZE = 1u << (3 * LOG2DIM);
3542 static constexpr uint32_t MASK = (1u << TOTAL) - 1u;
3543 static constexpr uint32_t LEVEL = 1 + ChildT::LEVEL;
3544 static constexpr uint64_t NUM_VALUES = uint64_t(1) << (3 * TOTAL);
3639 const uint32_t n = CoordToOffset(ijk);
3640 return DataType::mChildMask.isOn(n) ? this->getChild(n)->getValue(ijk) : DataType::getValue(n);
3645 const uint32_t n = CoordToOffset(ijk);
3646 return DataType::mChildMask.isOn(n) ? this->getChild(n)->isActive(ijk) : DataType::isActive(n);
3652 const uint32_t n = CoordToOffset(ijk);
3653 if (DataType::mChildMask.isOn(n))
3654 return this->getChild(n)->probeValue(ijk, v);
3655 v = DataType::getValue(n);
3656 return DataType::isActive(n);
3661 const uint32_t n = CoordToOffset(ijk);
3662 if (DataType::mChildMask.isOn(n))
3663 return this->getChild(n)->probeLeaf(ijk);
3669 const uint32_t n = CoordToOffset(ijk);
3670 return DataType::mChildMask.isOn(n) ? this->getChild(n) :
nullptr;
3677 return (((ijk[0] & MASK) >> ChildT::TOTAL) << (2 * LOG2DIM)) +
3678 (((ijk[1] & MASK) >> ChildT::TOTAL) << (LOG2DIM)) +
3679 ((ijk[2] & MASK) >> ChildT::TOTAL);
3681 return (((ijk[0] & MASK) >> ChildT::TOTAL) << (2 * LOG2DIM)) |
3682 (((ijk[1] & MASK) >> ChildT::TOTAL) << (LOG2DIM)) |
3683 ((ijk[2] & MASK) >> ChildT::TOTAL);
3691 const uint32_t m = n & ((1 << 2 * LOG2DIM) - 1);
3692 return Coord(n >> 2 * LOG2DIM, m >> LOG2DIM, m & ((1 << LOG2DIM) - 1));
3698 ijk <<= ChildT::TOTAL;
3699 ijk += this->origin();
3704 Coord ijk = InternalNode::OffsetToLocalCoord(n);
3705 this->localToGlobalCoord(ijk);
3712 return DataType::mFlags & uint32_t(2);
3719 template<
typename,
int,
int,
int>
3724 template<
typename, u
int32_t>
3728 template<
typename AccT>
3731 const uint32_t n = CoordToOffset(ijk);
3732 if (!DataType::mChildMask.isOn(n))
3733 return DataType::getValue(n);
3734 const ChildT*
child = this->getChild(n);
3735 acc.insert(ijk,
child);
3736 return child->getValueAndCache(ijk, acc);
3739 template<
typename AccT>
3740 __hostdev__ typename AccT::NodeInfo getNodeInfoAndCache(
const CoordType& ijk,
const AccT& acc)
const
3742 using NodeInfoT =
typename AccT::NodeInfo;
3743 const uint32_t n = CoordToOffset(ijk);
3744 if (!DataType::mChildMask.isOn(n)) {
3745 return NodeInfoT{LEVEL, this->dim(), this->minimum(), this->maximum(), this->average(),
3746 this->stdDeviation(), this->bbox()[0], this->bbox()[1]};
3748 const ChildT*
child = this->getChild(n);
3749 acc.insert(ijk,
child);
3750 return child->getNodeInfoAndCache(ijk, acc);
3753 template<
typename AccT>
3754 __hostdev__ bool isActiveAndCache(
const CoordType& ijk,
const AccT& acc)
const
3756 const uint32_t n = CoordToOffset(ijk);
3757 if (!DataType::mChildMask.isOn(n))
3758 return DataType::isActive(n);
3759 const ChildT*
child = this->getChild(n);
3760 acc.insert(ijk,
child);
3761 return child->isActiveAndCache(ijk, acc);
3764 template<
typename AccT>
3765 __hostdev__ bool probeValueAndCache(
const CoordType& ijk, ValueType& v,
const AccT& acc)
const
3767 const uint32_t n = CoordToOffset(ijk);
3768 if (!DataType::mChildMask.isOn(n)) {
3769 v = DataType::getValue(n);
3770 return DataType::isActive(n);
3772 const ChildT*
child = this->getChild(n);
3773 acc.insert(ijk,
child);
3774 return child->probeValueAndCache(ijk, v, acc);
3777 template<
typename AccT>
3778 __hostdev__ const LeafNodeType* probeLeafAndCache(
const CoordType& ijk,
const AccT& acc)
const
3780 const uint32_t n = CoordToOffset(ijk);
3781 if (!DataType::mChildMask.isOn(n))
3783 const ChildT*
child = this->getChild(n);
3784 acc.insert(ijk,
child);
3785 return child->probeLeafAndCache(ijk, acc);
3788 template<
typename RayT,
typename AccT>
3789 __hostdev__ uint32_t getDimAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const
3791 if (DataType::mFlags & uint32_t(1u))
return this->dim();
3794 const uint32_t n = CoordToOffset(ijk);
3795 if (DataType::mChildMask.isOn(n)) {
3796 const ChildT*
child = this->getChild(n);
3797 acc.insert(ijk,
child);
3798 return child->getDimAndCache(ijk, ray, acc);
3800 return ChildNodeType::dim();
3810template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3813 static_assert(
sizeof(CoordT) ==
sizeof(
Coord),
"Mismatching sizeof");
3814 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3819 static constexpr bool FIXED_SIZE =
true;
3822 uint8_t mBBoxDif[3];
3836 return sizeof(
LeafData) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>)
3837 + 2*(
sizeof(ValueT) +
sizeof(
FloatType))
3838 + (1u << (3 * LOG2DIM))*
sizeof(ValueT));
3847 mValueMask.setOn(offset);
3848 mValues[offset] =
value;
3861 template <
typename T>
3872template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3875 static_assert(
sizeof(CoordT) ==
sizeof(
Coord),
"Mismatching sizeof");
3876 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3881 uint8_t mBBoxDif[3];
3895 return sizeof(
LeafFnBase) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>) + 2*4 + 4*2);
3900 mQuantum = (max - min)/
float((1 << bitWidth)-1);
3928 template <
typename T>
3935template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3936struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp4, CoordT, MaskT, LOG2DIM>
3942 static constexpr bool FIXED_SIZE =
true;
3943 alignas(32) uint8_t mCode[1u << (3 * LOG2DIM - 1)];
3947 static_assert(BaseT::padding()==0,
"expected no padding in LeafFnBase");
3948 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << (3 * LOG2DIM - 1));
3955 const uint8_t c = mCode[i>>1];
3956 return ( (i&1) ? c >> 4 : c & uint8_t(15) )*BaseT::mQuantum + BaseT::mMinimum;
3958 return ((mCode[i>>1] >> ((i&1)<<2)) & uint8_t(15))*BaseT::mQuantum + BaseT::mMinimum;
3969template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3970struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp8, CoordT, MaskT, LOG2DIM>
3976 static constexpr bool FIXED_SIZE =
true;
3977 alignas(32) uint8_t mCode[1u << 3 * LOG2DIM];
3980 static_assert(BaseT::padding()==0,
"expected no padding in LeafFnBase");
3981 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << 3 * LOG2DIM);
3987 return mCode[i]*BaseT::mQuantum + BaseT::mMinimum;
3996template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3997struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp16, CoordT, MaskT, LOG2DIM>
4003 static constexpr bool FIXED_SIZE =
true;
4004 alignas(32) uint16_t mCode[1u << 3 * LOG2DIM];
4008 static_assert(BaseT::padding()==0,
"expected no padding in LeafFnBase");
4009 return sizeof(
LeafData) -
sizeof(
BaseT) - 2*(1u << 3 * LOG2DIM);
4015 return mCode[i]*BaseT::mQuantum + BaseT::mMinimum;
4025template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4026struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
FpN, CoordT, MaskT, LOG2DIM>
4032 static constexpr bool FIXED_SIZE =
false;
4034 static_assert(BaseT::padding()==0,
"expected no padding in LeafFnBase");
4043#ifdef NANOVDB_FPN_BRANCHLESS
4044 const int b = BaseT::mFlags >> 5;
4046 uint16_t code =
reinterpret_cast<const uint16_t*
>(
this + 1)[i >> (4 - b)];
4047 const static uint8_t shift[5] = {15, 7, 3, 1, 0};
4048 const static uint16_t mask[5] = {1, 3, 15, 255, 65535};
4049 code >>= (i & shift[b]) << b;
4052 uint32_t code =
reinterpret_cast<const uint32_t*
>(
this + 1)[i >> (5 - b)];
4054 code >>= (i & ((32 >> b) - 1)) << b;
4055 code &= (1 << (1 << b)) - 1;
4059 auto *values =
reinterpret_cast<const uint8_t*
>(
this+1);
4060 switch (BaseT::mFlags >> 5) {
4062 code = float((values[i>>3] >> (i&7) ) & uint8_t(1));
4065 code = float((values[i>>2] >> ((i&3)<<1)) & uint8_t(3));
4068 code = float((values[i>>1] >> ((i&1)<<2)) & uint8_t(15));
4071 code = float(values[i]);
4074 code = float(
reinterpret_cast<const uint16_t*
>(values)[i]);
4077 return float(code) * BaseT::mQuantum + BaseT::mMinimum;
4088template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4089struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<bool, CoordT, MaskT, LOG2DIM>
4091 static_assert(
sizeof(CoordT) ==
sizeof(
Coord),
"Mismatching sizeof");
4092 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4097 static constexpr bool FIXED_SIZE =
true;
4100 uint8_t mBBoxDif[3];
4104 uint64_t mPadding[2];
4117 mValueMask.setOn(offset);
4118 mValues.set(offset, v);
4126 template <
typename T>
4137template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4140 static_assert(
sizeof(CoordT) ==
sizeof(
Coord),
"Mismatching sizeof");
4141 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4146 static constexpr bool FIXED_SIZE =
true;
4149 uint8_t mBBoxDif[3];
4152 uint64_t mPadding[2];
4157 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2*8u);
4168 mValueMask.setOn(offset);
4176 template <
typename T>
4187template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4190 static_assert(
sizeof(CoordT) ==
sizeof(
Coord),
"Mismatching sizeof");
4191 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4196 static constexpr bool FIXED_SIZE =
true;
4199 uint8_t mBBoxDif[3];
4208 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2*8u);
4219 mValueMask.setOn(offset);
4224 if (mFlags & uint8_t(16u)) {
4225 return mValueMask.isOn(i) ? mValueOff + mValueMask.countOn(i) : 0;
4227 return mValueOff + i;
4230 template <
typename T>
4232 template <
typename T>
4234 template <
typename T>
4236 template <
typename T>
4238 template <
typename T>
4249template<
typename BuildT,
4250 typename CoordT =
Coord,
4251 template<u
int32_t>
class MaskT =
Mask,
4252 uint32_t Log2Dim = 3>
4258 static constexpr uint32_t TOTAL = 0;
4259 static constexpr uint32_t DIM = 1;
4268 static constexpr bool FIXED_SIZE = DataType::FIXED_SIZE;
4269 template<u
int32_t LOG2>
4316 __hostdev__ operator bool()
const {
return mPos < (1u << 3 * Log2Dim);}
4328 static constexpr uint32_t LOG2DIM = Log2Dim;
4329 static constexpr uint32_t TOTAL = LOG2DIM;
4330 static constexpr uint32_t DIM = 1u << TOTAL;
4331 static constexpr uint32_t SIZE = 1u << 3 * LOG2DIM;
4332 static constexpr uint32_t MASK = (1u << LOG2DIM) - 1u;
4333 static constexpr uint32_t LEVEL = 0;
4334 static constexpr uint64_t NUM_VALUES = uint64_t(1) << (3 * TOTAL);
4366 const uint32_t m = n & ((1 << 2 * LOG2DIM) - 1);
4367 return CoordT(n >> 2 * LOG2DIM, m >> LOG2DIM, m & MASK);
4375 return OffsetToLocalCoord(n) + this->origin();
4384 BBox<CoordT> bbox(DataType::mBBoxMin, DataType::mBBoxMin);
4385 if ( this->hasBBox() ) {
4386 bbox.max()[0] += DataType::mBBoxDif[0];
4387 bbox.max()[1] += DataType::mBBoxDif[1];
4388 bbox.max()[2] += DataType::mBBoxDif[2];
4435 return !DataType::mValueMask.isOff();
4443 const uint32_t n = CoordToOffset(ijk);
4444 v = DataType::getValue(n);
4445 return DataType::mValueMask.isOn(n);
4454 return ((ijk[0] & MASK) << (2 * LOG2DIM)) + ((ijk[1] & MASK) << LOG2DIM) + (ijk[2] & MASK);
4456 return ((ijk[0] & MASK) << (2 * LOG2DIM)) | ((ijk[1] & MASK) << LOG2DIM) | (ijk[2] & MASK);
4473 template<
typename,
int,
int,
int>
4478 template<
typename, u
int32_t>
4482 template<
typename AccT>
4483 __hostdev__ ValueType getValueAndCache(
const CoordT& ijk,
const AccT&)
const {
return this->getValue(ijk); }
4486 template<
typename AccT>
4487 __hostdev__ typename AccT::NodeInfo getNodeInfoAndCache(
const CoordType& ,
const AccT& )
const {
4488 using NodeInfoT =
typename AccT::NodeInfo;
4489 return NodeInfoT{LEVEL, this->dim(), this->minimum(), this->maximum(),
4490 this->average(), this->stdDeviation(), this->bbox()[0], this->bbox()[1]};
4493 template<
typename AccT>
4494 __hostdev__ bool isActiveAndCache(
const CoordT& ijk,
const AccT&)
const {
return this->isActive(ijk); }
4496 template<
typename AccT>
4497 __hostdev__ bool probeValueAndCache(
const CoordT& ijk, ValueType& v,
const AccT&)
const {
return this->probeValue(ijk, v); }
4499 template<
typename AccT>
4500 __hostdev__ const LeafNode* probeLeafAndCache(
const CoordT&,
const AccT&)
const {
return this; }
4502 template<
typename RayT,
typename AccT>
4503 __hostdev__ uint32_t getDimAndCache(
const CoordT&,
const RayT& ,
const AccT&)
const
4505 if (DataType::mFlags & uint8_t(1u))
return this->dim();
4508 return ChildNodeType::dim();
4513template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4516 static_assert(LOG2DIM == 3,
"LeafNode::updateBBox: only supports LOGDIM = 3!");
4517 if (DataType::mValueMask.isOff()) {
4518 DataType::mFlags &= ~uint8_t(2);
4521 auto update = [&](uint32_t min, uint32_t max,
int axis) {
4523 DataType::mBBoxMin[axis] = (DataType::mBBoxMin[axis] & ~MASK) +
int(min);
4524 DataType::mBBoxDif[axis] = uint8_t(max - min);
4526 uint64_t word64 = DataType::mValueMask.template getWord<uint64_t>(0);
4527 uint32_t Xmin = word64 ? 0u : 8u;
4528 uint32_t Xmax = Xmin;
4529 for (
int i = 1; i < 8; ++i) {
4530 if (uint64_t w = DataType::mValueMask.
template getWord<uint64_t>(i)) {
4539 update(Xmin, Xmax, 0);
4540 update(FindLowestOn(word64) >> 3, FindHighestOn(word64) >> 3, 1);
4541 const uint32_t *p =
reinterpret_cast<const uint32_t*
>(&word64), word32 = p[0] | p[1];
4542 const uint16_t *q =
reinterpret_cast<const uint16_t*
>(&word32), word16 = q[0] | q[1];
4543 const uint8_t *b =
reinterpret_cast<const uint8_t*
>(&word16),
byte = b[0] | b[1];
4545 update(FindLowestOn(
static_cast<uint32_t
>(
byte)), FindHighestOn(
static_cast<uint32_t
>(
byte)), 2);
4546 DataType::mFlags |= uint8_t(2);
4554template<
typename BuildT>
4556template<
typename BuildT>
4558template<
typename BuildT>
4560template<
typename BuildT>
4562template<
typename BuildT>
4564template<
typename BuildT>
4568template<
typename BuildT,
int LEVEL>
4572template<
typename BuildT>
4578template<
typename BuildT>
4584template<
typename BuildT>
4590template<
typename BuildT>
4646template <
typename BuildT>
4656 mutable const RootT* mRoot;
4661 static const int CacheLevels = 0;
4696 return mRoot->getValueAndCache(ijk, *
this);
4700 return this->getValue(ijk);
4704 return this->getValue(
CoordType(i,j,k));
4709 return mRoot->getNodeInfoAndCache(ijk, *
this);
4714 return mRoot->isActiveAndCache(ijk, *
this);
4719 return mRoot->probeValueAndCache(ijk, v, *
this);
4724 return mRoot->probeLeafAndCache(ijk, *
this);
4727 template<
typename RayT>
4730 return mRoot->getDimAndCache(ijk, ray, *
this);
4737 template<
typename, u
int32_t>
4739 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
4743 template<
typename NodeT>
4748template <
typename BuildT,
int LEVEL0>
4751 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 should be 0, 1, or 2");
4765 mutable CoordT mKey;
4766 mutable const RootT* mRoot;
4767 mutable const NodeT* mNode;
4773 static const int CacheLevels = 1;
4794 mKey = CoordType::max();
4807 return (ijk[0] & int32_t(~NodeT::MASK)) == mKey[0] &&
4808 (ijk[1] & int32_t(~NodeT::MASK)) == mKey[1] &&
4809 (ijk[2] & int32_t(~NodeT::MASK)) == mKey[2];
4814 if (this->isCached(ijk)) {
4815 return mNode->getValueAndCache(ijk, *
this);
4817 return mRoot->getValueAndCache(ijk, *
this);
4821 return this->getValue(ijk);
4825 return this->getValue(
CoordType(i,j,k));
4830 if (this->isCached(ijk)) {
4831 return mNode->getNodeInfoAndCache(ijk, *
this);
4833 return mRoot->getNodeInfoAndCache(ijk, *
this);
4838 if (this->isCached(ijk)) {
4839 return mNode->isActiveAndCache(ijk, *
this);
4841 return mRoot->isActiveAndCache(ijk, *
this);
4846 if (this->isCached(ijk)) {
4847 return mNode->probeValueAndCache(ijk, v, *
this);
4849 return mRoot->probeValueAndCache(ijk, v, *
this);
4854 if (this->isCached(ijk)) {
4855 return mNode->probeLeafAndCache(ijk, *
this);
4857 return mRoot->probeLeafAndCache(ijk, *
this);
4860 template<
typename RayT>
4863 if (this->isCached(ijk)) {
4864 return mNode->getDimAndCache(ijk, ray, *
this);
4866 return mRoot->getDimAndCache(ijk, ray, *
this);
4873 template<
typename, u
int32_t>
4875 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
4881 mKey = ijk & ~NodeT::MASK;
4886 template<
typename OtherNodeT>
4887 __hostdev__ void insert(
const CoordType&,
const OtherNodeT*)
const {}
4891template <
typename BuildT,
int LEVEL0,
int LEVEL1>
4894 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 must be 0, 1, 2");
4895 static_assert(LEVEL1 >= 0 && LEVEL1 <= 2,
"LEVEL1 must be 0, 1, 2");
4896 static_assert(LEVEL0 < LEVEL1,
"Level 0 must be lower than level 1");
4909#ifdef USE_SINGLE_ACCESSOR_KEY
4910 mutable CoordT mKey;
4912 mutable CoordT mKeys[2];
4914 mutable const RootT* mRoot;
4915 mutable const Node1T* mNode1;
4916 mutable const Node2T* mNode2;
4922 static const int CacheLevels = 2;
4928#ifdef USE_SINGLE_ACCESSOR_KEY
4929 : mKey(CoordType::max())
4931 : mKeys{CoordType::max(), CoordType::max()}
4948#ifdef USE_SINGLE_ACCESSOR_KEY
4949 mKey = CoordType::max();
4951 mKeys[0] = mKeys[1] = CoordType::max();
4964#ifdef USE_SINGLE_ACCESSOR_KEY
4965 __hostdev__ bool isCached1(CoordValueType dirty)
const
4969 if (dirty & int32_t(~Node1T::MASK)) {
4975 __hostdev__ bool isCached2(CoordValueType dirty)
const
4979 if (dirty & int32_t(~Node2T::MASK)) {
4985 __hostdev__ CoordValueType computeDirty(
const CoordType& ijk)
const
4987 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
4992 return (ijk[0] & int32_t(~Node1T::MASK)) == mKeys[0][0] &&
4993 (ijk[1] & int32_t(~Node1T::MASK)) == mKeys[0][1] &&
4994 (ijk[2] & int32_t(~Node1T::MASK)) == mKeys[0][2];
4998 return (ijk[0] & int32_t(~Node2T::MASK)) == mKeys[1][0] &&
4999 (ijk[1] & int32_t(~Node2T::MASK)) == mKeys[1][1] &&
5000 (ijk[2] & int32_t(~Node2T::MASK)) == mKeys[1][2];
5006#ifdef USE_SINGLE_ACCESSOR_KEY
5007 const CoordValueType dirty = this->computeDirty(ijk);
5011 if (this->isCached1(dirty)) {
5012 return mNode1->getValueAndCache(ijk, *
this);
5013 }
else if (this->isCached2(dirty)) {
5014 return mNode2->getValueAndCache(ijk, *
this);
5016 return mRoot->getValueAndCache(ijk, *
this);
5020 return this->getValue(ijk);
5024 return this->getValue(
CoordType(i,j,k));
5029#ifdef USE_SINGLE_ACCESSOR_KEY
5030 const CoordValueType dirty = this->computeDirty(ijk);
5034 if (this->isCached1(dirty)) {
5035 return mNode1->getNodeInfoAndCache(ijk, *
this);
5036 }
else if (this->isCached2(dirty)) {
5037 return mNode2->getNodeInfoAndCache(ijk, *
this);
5039 return mRoot->getNodeInfoAndCache(ijk, *
this);
5044#ifdef USE_SINGLE_ACCESSOR_KEY
5045 const CoordValueType dirty = this->computeDirty(ijk);
5049 if (this->isCached1(dirty)) {
5050 return mNode1->isActiveAndCache(ijk, *
this);
5051 }
else if (this->isCached2(dirty)) {
5052 return mNode2->isActiveAndCache(ijk, *
this);
5054 return mRoot->isActiveAndCache(ijk, *
this);
5059#ifdef USE_SINGLE_ACCESSOR_KEY
5060 const CoordValueType dirty = this->computeDirty(ijk);
5064 if (this->isCached1(dirty)) {
5065 return mNode1->probeValueAndCache(ijk, v, *
this);
5066 }
else if (this->isCached2(dirty)) {
5067 return mNode2->probeValueAndCache(ijk, v, *
this);
5069 return mRoot->probeValueAndCache(ijk, v, *
this);
5074#ifdef USE_SINGLE_ACCESSOR_KEY
5075 const CoordValueType dirty = this->computeDirty(ijk);
5079 if (this->isCached1(dirty)) {
5080 return mNode1->probeLeafAndCache(ijk, *
this);
5081 }
else if (this->isCached2(dirty)) {
5082 return mNode2->probeLeafAndCache(ijk, *
this);
5084 return mRoot->probeLeafAndCache(ijk, *
this);
5087 template<
typename RayT>
5090#ifdef USE_SINGLE_ACCESSOR_KEY
5091 const CoordValueType dirty = this->computeDirty(ijk);
5095 if (this->isCached1(dirty)) {
5096 return mNode1->getDimAndCache(ijk, ray, *
this);
5097 }
else if (this->isCached2(dirty)) {
5098 return mNode2->getDimAndCache(ijk, ray, *
this);
5100 return mRoot->getDimAndCache(ijk, ray, *
this);
5107 template<
typename, u
int32_t>
5109 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5115#ifdef USE_SINGLE_ACCESSOR_KEY
5118 mKeys[0] = ijk & ~Node1T::MASK;
5122 __hostdev__ void insert(
const CoordType& ijk,
const Node2T* node)
const
5124#ifdef USE_SINGLE_ACCESSOR_KEY
5127 mKeys[1] = ijk & ~Node2T::MASK;
5131 template <
typename OtherNodeT>
5132 __hostdev__ void insert(
const CoordType&,
const OtherNodeT*)
const {}
5137template <
typename BuildT>
5153#ifdef USE_SINGLE_ACCESSOR_KEY
5154 mutable CoordT mKey;
5156 mutable CoordT mKeys[3];
5158 mutable const RootT* mRoot;
5159 mutable const void* mNode[3];
5165 static const int CacheLevels = 3;
5171#ifdef USE_SINGLE_ACCESSOR_KEY
5172 : mKey(CoordType::max())
5174 : mKeys{CoordType::max(), CoordType::max(), CoordType::max()}
5177 , mNode{
nullptr,
nullptr,
nullptr}
5197 template<
typename NodeT>
5202 return reinterpret_cast<const T*
>(mNode[NodeT::LEVEL]);
5205 template <
int LEVEL>
5209 static_assert(LEVEL>=0 && LEVEL<=2,
"ReadAccessor::getNode: Invalid node type");
5210 return reinterpret_cast<const T*
>(mNode[LEVEL]);
5217#ifdef USE_SINGLE_ACCESSOR_KEY
5218 mKey = CoordType::max();
5220 mKeys[0] = mKeys[1] = mKeys[2] = CoordType::max();
5222 mNode[0] = mNode[1] = mNode[2] =
nullptr;
5225#ifdef USE_SINGLE_ACCESSOR_KEY
5226 template<
typename NodeT>
5227 __hostdev__ bool isCached(CoordValueType dirty)
const
5229 if (!mNode[NodeT::LEVEL])
5231 if (dirty & int32_t(~NodeT::MASK)) {
5232 mNode[NodeT::LEVEL] =
nullptr;
5238 __hostdev__ CoordValueType computeDirty(
const CoordType& ijk)
const
5240 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
5243 template<
typename NodeT>
5246 return (ijk[0] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][0] && (ijk[1] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][1] && (ijk[2] & int32_t(~NodeT::MASK)) == mKeys[NodeT::LEVEL][2];
5252#ifdef USE_SINGLE_ACCESSOR_KEY
5253 const CoordValueType dirty = this->computeDirty(ijk);
5257 if (this->isCached<LeafT>(dirty)) {
5258 return ((
LeafT*)mNode[0])->getValue(ijk);
5259 }
else if (this->isCached<NodeT1>(dirty)) {
5260 return ((
NodeT1*)mNode[1])->getValueAndCache(ijk, *
this);
5261 }
else if (this->isCached<NodeT2>(dirty)) {
5262 return ((
NodeT2*)mNode[2])->getValueAndCache(ijk, *
this);
5264 return mRoot->getValueAndCache(ijk, *
this);
5268 return this->getValue(ijk);
5272 return this->getValue(
CoordType(i,j,k));
5277#ifdef USE_SINGLE_ACCESSOR_KEY
5278 const CoordValueType dirty = this->computeDirty(ijk);
5282 if (this->isCached<LeafT>(dirty)) {
5283 return ((
LeafT*)mNode[0])->getNodeInfoAndCache(ijk, *
this);
5284 }
else if (this->isCached<NodeT1>(dirty)) {
5285 return ((
NodeT1*)mNode[1])->getNodeInfoAndCache(ijk, *
this);
5286 }
else if (this->isCached<NodeT2>(dirty)) {
5287 return ((
NodeT2*)mNode[2])->getNodeInfoAndCache(ijk, *
this);
5289 return mRoot->getNodeInfoAndCache(ijk, *
this);
5294#ifdef USE_SINGLE_ACCESSOR_KEY
5295 const CoordValueType dirty = this->computeDirty(ijk);
5299 if (this->isCached<LeafT>(dirty)) {
5300 return ((
LeafT*)mNode[0])->isActive(ijk);
5301 }
else if (this->isCached<NodeT1>(dirty)) {
5302 return ((
NodeT1*)mNode[1])->isActiveAndCache(ijk, *
this);
5303 }
else if (this->isCached<NodeT2>(dirty)) {
5304 return ((
NodeT2*)mNode[2])->isActiveAndCache(ijk, *
this);
5306 return mRoot->isActiveAndCache(ijk, *
this);
5311#ifdef USE_SINGLE_ACCESSOR_KEY
5312 const CoordValueType dirty = this->computeDirty(ijk);
5316 if (this->isCached<LeafT>(dirty)) {
5317 return ((
LeafT*)mNode[0])->probeValue(ijk, v);
5318 }
else if (this->isCached<NodeT1>(dirty)) {
5319 return ((
NodeT1*)mNode[1])->probeValueAndCache(ijk, v, *
this);
5320 }
else if (this->isCached<NodeT2>(dirty)) {
5321 return ((
NodeT2*)mNode[2])->probeValueAndCache(ijk, v, *
this);
5323 return mRoot->probeValueAndCache(ijk, v, *
this);
5328#ifdef USE_SINGLE_ACCESSOR_KEY
5329 const CoordValueType dirty = this->computeDirty(ijk);
5333 if (this->isCached<LeafT>(dirty)) {
5334 return ((
LeafT*)mNode[0]);
5335 }
else if (this->isCached<NodeT1>(dirty)) {
5336 return ((
NodeT1*)mNode[1])->probeLeafAndCache(ijk, *
this);
5337 }
else if (this->isCached<NodeT2>(dirty)) {
5338 return ((
NodeT2*)mNode[2])->probeLeafAndCache(ijk, *
this);
5340 return mRoot->probeLeafAndCache(ijk, *
this);
5343 template<
typename RayT>
5346#ifdef USE_SINGLE_ACCESSOR_KEY
5347 const CoordValueType dirty = this->computeDirty(ijk);
5351 if (this->isCached<LeafT>(dirty)) {
5352 return ((
LeafT*)mNode[0])->getDimAndCache(ijk, ray, *
this);
5353 }
else if (this->isCached<NodeT1>(dirty)) {
5354 return ((
NodeT1*)mNode[1])->getDimAndCache(ijk, ray, *
this);
5355 }
else if (this->isCached<NodeT2>(dirty)) {
5356 return ((
NodeT2*)mNode[2])->getDimAndCache(ijk, ray, *
this);
5358 return mRoot->getDimAndCache(ijk, ray, *
this);
5365 template<
typename, u
int32_t>
5367 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5371 template<
typename NodeT>
5374#ifdef USE_SINGLE_ACCESSOR_KEY
5377 mKeys[NodeT::LEVEL] = ijk & ~NodeT::MASK;
5379 mNode[NodeT::LEVEL] = node;
5397template <
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5403template <
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5409template <
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5461template<
typename AttT>
5472 :
AccT(grid.tree().root())
5474 , mData(reinterpret_cast<const AttT*>(grid.blindData(0)))
5487 end = begin + count;
5495 auto* leaf = this->probeLeaf(ijk);
5496 if (leaf ==
nullptr) {
5499 begin = mData + leaf->minimum();
5500 end = begin + leaf->maximum();
5501 return leaf->maximum();
5507 auto* leaf = this->probeLeaf(ijk);
5508 if (leaf ==
nullptr)
5510 const uint32_t offset = LeafNodeType::CoordToOffset(ijk);
5511 if (leaf->isActive(offset)) {
5512 auto* p = mData + leaf->minimum();
5513 begin = p + (offset == 0 ? 0 : leaf->getValue(offset - 1));
5514 end = p + leaf->getValue(offset);
5524template<
typename ChannelT>
5539 :
BaseT(grid.tree().root())
5545 this->setChannel(channelID);
5550 :
BaseT(grid.tree().root())
5552 , mChannel(channelPtr)
5574 mChannel = channelPtr;
5582 this->setChannel(
reinterpret_cast<ChannelT*
>(
const_cast<void*
>(mGrid.
blindData(channelID))));
5598 const bool isActive = BaseT::probeValue(ijk, idx);
5605 template <
typename T>
5611#if !defined(__CUDA_ARCH__) && !defined(__HIP__)
5616struct MiniGridHandle {
5621 BufferType(BufferType &&other) : data(other.data), size(other.size) {other.data=
nullptr; other.size=0;}
5622 ~BufferType() {std::free(data);}
5623 BufferType& operator=(
const BufferType &other) =
delete;
5624 BufferType& operator=(BufferType &&other){data=other.data; size=other.size; other.data=
nullptr; other.size=0;
return *
this;}
5625 static BufferType create(
size_t n, BufferType* dummy =
nullptr) {
return BufferType(n);}
5627 MiniGridHandle(BufferType &&buf) : buffer(
std::move(buf)) {}
5628 const uint8_t* data()
const {
return buffer.data;}
5648template <
typename StreamT>
5651 char header[192] = {0}, *dst = header;
5652 const char *grid = (
const char*)buffer, *tree = grid + 672, *root = tree + *(
const uint64_t*)(tree + 24);
5653 auto cpy = [&](
const char *src,
int n){
for (
auto *end=src+n; src!=end; ++src) *dst++ = *src;};
5654 if (*(
const uint64_t*)(grid)!=0x304244566f6e614eUL) {
5655 fprintf(stderr,
"nanovdb::writeUncompressedGrid: invalid magic number\n"); exit(EXIT_FAILURE);
5656 }
else if (*(
const uint32_t*)(grid+16)>>21!=32) {
5657 fprintf(stderr,
"nanovdb::writeUncompressedGrid: invalid major version\n"); exit(EXIT_FAILURE);
5661 *(uint16_t*)(dst) = 1; dst += 4;
5668 cpy(grid + 560, 48);
5670 cpy(grid + 608, 24);
5671 const char *gridName = grid + 40;
5672 if (*(
const uint32_t*)(grid+20) & uint32_t(1)) {
5673 gridName = grid + *(
const int64_t*)(grid + 640) + 288*(*(
const uint32_t*)(grid + 648) - 1);
5674 gridName += *(
const uint64_t*)gridName;
5676 uint32_t nameSize = 1;
5677 for (
const char *p = gridName; *p!=
'\0'; ++p) ++nameSize;
5678 *(uint32_t*)(dst) = nameSize; dst += 4;
5680 *(uint32_t*)(dst) = 1; dst += 4;
5684 assert(dst - header == 192);
5685 os.write(header, 192);
5686 os.write(gridName, nameSize);
5688 const uint64_t gridSize = *(
const uint64_t*)(grid + 32);
5689 os.write(grid, gridSize);
5690 if (*(
const uint32_t*)(grid+24) >= *(
const uint32_t*)(grid+28) - 1)
break;
5696template<
typename GridHandleT,
template<
typename...>
class VecT>
5699#ifdef NANOVDB_USE_IOSTREAMS
5700 std::ofstream os(fileName, std::ios::out | std::ios::binary | std::ios::trunc);
5704 StreamT(
const char *name) {fptr = fopen(name,
"wb");}
5705 ~StreamT() {fclose(fptr);}
5706 void write(
const char *data,
size_t n){fwrite(data, 1, n, fptr);}
5707 bool is_open()
const {
return fptr != NULL;}
5710 if (!os.is_open()) {
5711 fprintf(stderr,
"nanovdb::writeUncompressedGrids: Unable to open file \"%s\"for output\n",fileName); exit(EXIT_FAILURE);
5721template<
typename GridHandleT,
typename StreamT,
template<
typename...>
class VecT>
5722VecT<GridHandleT>
readUncompressedGrids(StreamT& is,
const typename GridHandleT::BufferType& buffer =
typename GridHandleT::BufferType())
5724 char header[16], metadata[176];
5725 VecT<GridHandleT> handles;
5726 while(is.read(header, 16)) {
5727 if (*(uint64_t*)(header)!=0x304244566f6e614eUL) {
5728 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid magic number\n"); exit(EXIT_FAILURE);
5729 }
else if (*(uint32_t*)(header+8)>>21!=32) {
5730 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid major version\n"); exit(EXIT_FAILURE);
5731 }
else if (*(uint16_t*)(header+14)!=0) {
5732 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid codec\n"); exit(EXIT_FAILURE);
5734 for (uint16_t i=0, e=*(uint16_t*)(header+12); i<e; ++i) {
5735 if (!is.read(metadata, 176)) {
5736 fprintf(stderr,
"nanovdb::readUncompressedGrids: error reading metadata\n"); exit(EXIT_FAILURE);
5738 const uint64_t gridSize = *(uint64_t*)(metadata);
5739 GridHandleT handle(GridHandleT::BufferType::create(gridSize, &buffer));
5740 is.skip(*(uint32_t*)(metadata + 136));
5741 is.read((
char*)handle.data(), gridSize);
5742 handles.emplace_back(std::move(handle));
5749template<
typename GridHandleT,
template<
typename...>
class VecT>
5750VecT<GridHandleT>
readUncompressedGrids(
const char *fileName,
const typename GridHandleT::BufferType& buffer =
typename GridHandleT::BufferType())
5752#ifdef NANOVDB_USE_IOSTREAMS
5753 struct StreamT :
public std::ifstream {
5754 StreamT(
const char *name) : std::ifstream(name, std::ios::in | std::ios::binary) {}
5755 void skip(uint32_t off) {this->seekg(off, std::ios_base::cur);}
5760 StreamT(
const char *name) {fptr = fopen(name,
"rb");}
5761 ~StreamT() {fclose(fptr);}
5762 bool read(
char *data,
size_t n){
size_t m=fread(data, 1, n, fptr);
return n==m;}
5763 void skip(uint32_t off){fseek(fptr, off, SEEK_CUR);}
5764 bool is_open()
const {
return fptr != NULL;}
5767 StreamT is(fileName);
5768 if (!is.is_open()) {
5769 fprintf(stderr,
"nanovdb::readUncompressedGrids: Unable to open file \"%s\"for input\n",fileName); exit(EXIT_FAILURE);
5771 return readUncompressedGrids<GridHandleT, StreamT, VecT>(is, buffer);
#define ROOT_LEVEL
Definition CNanoVDB.h:53
ValueT value
Definition GridBuilder.h:1290
ChildT * child
Definition GridBuilder.h:1289
#define NANOVDB_HOSTDEV_DISABLE_WARNING
Definition NanoVDB.h:202
#define NANOVDB_MINOR_VERSION_NUMBER
Definition NanoVDB.h:124
#define NANOVDB_DATA_ALIGNMENT
Definition NanoVDB.h:137
#define __hostdev__
Definition NanoVDB.h:192
#define NANOVDB_MAJOR_VERSION_NUMBER
Definition NanoVDB.h:123
#define NANOVDB_ASSERT(x)
Definition NanoVDB.h:173
#define NANOVDB_MAGIC_NUMBER
Definition NanoVDB.h:121
#define NANOVDB_PATCH_VERSION_NUMBER
Definition NanoVDB.h:125
const CoordT & operator*() const
Definition NanoVDB.h:1747
Iterator(const BBox &b)
Definition NanoVDB.h:1720
Iterator operator++(int)
Definition NanoVDB.h:1739
Iterator & operator++()
Definition NanoVDB.h:1725
Class to access values in channels at a specific voxel location.
Definition NanoVDB.h:5526
T & getValue(const Coord &ijk, T *channelPtr) const
Return the value from a specified channel that maps to the specified coordinate.
Definition NanoVDB.h:5606
uint64_t getIndex(const Coord &ijk) const
Return the linear offset into a channel that maps to the specified coordinate.
Definition NanoVDB.h:5586
const IndexGrid & grid() const
Return a const reference to the IndexGrid.
Definition NanoVDB.h:5560
const uint64_t & valueCount() const
Return total number of values indexed by the IndexGrid.
Definition NanoVDB.h:5569
const Vec3R & voxelSize() const
Return a vector of the axial voxel sizes.
Definition NanoVDB.h:5566
ChannelT & operator()(int i, int j, int k) const
Definition NanoVDB.h:5592
uint64_t idx(int i, int j, int k) const
Definition NanoVDB.h:5587
void setChannel(uint32_t channelID)
Change to an internal channel, assuming it exists as as blind data in the IndexGrid.
Definition NanoVDB.h:5580
ChannelAccessor(const IndexGrid &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:5538
ChannelAccessor(const IndexGrid &grid, ChannelT *channelPtr)
Ctor from an IndexGrid and an external channel.
Definition NanoVDB.h:5549
const IndexTree & tree() const
Return a const reference to the tree of the IndexGrid.
Definition NanoVDB.h:5563
bool probeValue(const CoordType &ijk, typename remove_const< ChannelT >::type &v) const
return the state and updates the value of the specified voxel
Definition NanoVDB.h:5595
ChannelT ValueType
Definition NanoVDB.h:5532
void setChannel(ChannelT *channelPtr)
Change to an external channel.
Definition NanoVDB.h:5572
ChannelT & getValue(const Coord &ijk) const
Return the value from a cached channel that maps to the specified coordinate.
Definition NanoVDB.h:5590
ChannelT & operator()(const Coord &ijk) const
Definition NanoVDB.h:5591
Signed (i, j, k) 32-bit integer coordinate class, similar to openvdb::math::Coord.
Definition NanoVDB.h:967
Coord & operator&=(int n)
Definition NanoVDB.h:1047
Coord operator-(const Coord &rhs) const
Definition NanoVDB.h:1076
uint32_t IndexType
Definition NanoVDB.h:971
Coord operator<<(IndexType n) const
Definition NanoVDB.h:1033
static Coord Floor(const Vec3T &xyz)
Return the largest integer coordinates that are not greater than xyz (node centered conversion).
Definition NanoVDB.h:1133
Coord(ValueType n)
Initializes all coordinates to the given signed integer.
Definition NanoVDB.h:980
Coord & operator-=(const Coord &rhs)
Definition NanoVDB.h:1084
Coord & operator>>=(uint32_t n)
Definition NanoVDB.h:1061
Coord & minComponent(const Coord &other)
Perform a component-wise minimum with the other Coord.
Definition NanoVDB.h:1093
Coord operator+(const Coord &rhs) const
Definition NanoVDB.h:1075
static size_t memUsage()
Definition NanoVDB.h:1008
bool operator<(const Coord &rhs) const
Return true if this Coord is lexicographically less than the given Coord.
Definition NanoVDB.h:1039
Coord & operator+=(const Coord &rhs)
Definition NanoVDB.h:1077
Coord & operator=(const CoordT &other)
Assignment operator that works with openvdb::Coord.
Definition NanoVDB.h:1020
int32_t y() const
Definition NanoVDB.h:997
Coord & maxComponent(const Coord &other)
Perform a component-wise maximum with the other Coord.
Definition NanoVDB.h:1105
Coord operator&(IndexType n) const
Return a new instance with coordinates masked by the given unsigned integer.
Definition NanoVDB.h:1030
Coord()
Initialize all coordinates to zero.
Definition NanoVDB.h:974
uint8_t octant() const
Return the octant of this Coord.
Definition NanoVDB.h:1144
const ValueType & operator[](IndexType i) const
Return a const reference to the given Coord component.
Definition NanoVDB.h:1012
int32_t z() const
Definition NanoVDB.h:998
Coord & operator<<=(uint32_t n)
Definition NanoVDB.h:1054
int32_t x() const
Definition NanoVDB.h:996
Coord(ValueType i, ValueType j, ValueType k)
Initializes coordinate to the given signed integers.
Definition NanoVDB.h:986
int32_t & y()
Definition NanoVDB.h:1001
Coord offsetBy(ValueType n) const
Definition NanoVDB.h:1121
int32_t & x()
Definition NanoVDB.h:1000
Coord(ValueType *ptr)
Definition NanoVDB.h:991
bool operator!=(const Coord &rhs) const
Definition NanoVDB.h:1046
static Coord min()
Definition NanoVDB.h:1006
ValueType & operator[](IndexType i)
Return a non-const reference to the given Coord component.
Definition NanoVDB.h:1016
bool operator==(const Coord &rhs) const
Definition NanoVDB.h:1045
Coord offsetBy(ValueType dx, ValueType dy, ValueType dz) const
Definition NanoVDB.h:1116
static Coord max()
Definition NanoVDB.h:1004
int32_t & z()
Definition NanoVDB.h:1002
static bool lessThan(const Coord &a, const Coord &b)
Definition NanoVDB.h:1125
Coord operator>>(IndexType n) const
Definition NanoVDB.h:1036
uint32_t hash() const
Return a hash key derived from the existing coordinates.
Definition NanoVDB.h:1140
int32_t ValueType
Definition NanoVDB.h:970
Coord & operator+=(int n)
Definition NanoVDB.h:1068
Dummy type for a 16bit quantization of float point values.
Definition NanoVDB.h:228
Dummy type for a 4bit quantization of float point values.
Definition NanoVDB.h:222
Dummy type for a 8bit quantization of float point values.
Definition NanoVDB.h:225
Dummy type for a variable bit quantization of floating point values.
Definition NanoVDB.h:231
Highest level of the data structure. Contains a tree and a world->index transform (that currently onl...
Definition NanoVDB.h:2558
Vec3T indexToWorld(const Vec3T &xyz) const
index to world space transformation
Definition NanoVDB.h:2620
Vec3T indexToWorldF(const Vec3T &xyz) const
index to world space transformation
Definition NanoVDB.h:2643
const GridType & gridType() const
Definition NanoVDB.h:2674
uint32_t blindDataCount() const
Return the count of blind-data encoded in this grid.
Definition NanoVDB.h:2723
typename TreeT::ValueType ValueType
Definition NanoVDB.h:2563
enable_if< is_same< T, ValueIndex >::value, constuint64_t & >::type valueCount() const
Return the total number of values indexed by this IndexGrid.
Definition NanoVDB.h:2597
typename TreeT::RootType RootType
Definition NanoVDB.h:2561
bool isSequential() const
return true if the specified node type is layed out breadth-first in memory and has a fixed size....
Definition NanoVDB.h:2694
bool isPointData() const
Definition NanoVDB.h:2681
uint32_t gridIndex() const
Return index of this grid in the buffer.
Definition NanoVDB.h:2588
const char * shortGridName() const
Return a c-string with the name of this grid, truncated to 255 characters.
Definition NanoVDB.h:2714
bool isBreadthFirst() const
Definition NanoVDB.h:2689
uint64_t activeVoxelCount() const
Return the total number of active voxels in this tree.
Definition NanoVDB.h:2670
Vec3T indexToWorldDirF(const Vec3T &dir) const
transformation from index space direction to world space direction
Definition NanoVDB.h:2648
typename TreeT::CoordType CoordType
Definition NanoVDB.h:2565
Vec3T worldToIndexF(const Vec3T &xyz) const
world to index space transformation
Definition NanoVDB.h:2639
Vec3T worldToIndexDirF(const Vec3T &dir) const
transformation from world space direction to index space direction
Definition NanoVDB.h:2653
const Vec3R & voxelSize() const
Return a const reference to the size of a voxel in world units.
Definition NanoVDB.h:2609
bool isStaggered() const
Definition NanoVDB.h:2678
const GridClass & gridClass() const
Definition NanoVDB.h:2675
bool isValid() const
Methods related to the classification of this grid.
Definition NanoVDB.h:2673
DataType * data()
Definition NanoVDB.h:2577
bool hasAverage() const
Definition NanoVDB.h:2687
bool hasMinMax() const
Definition NanoVDB.h:2684
const char * gridName() const
Return a c-string with the name of this grid.
Definition NanoVDB.h:2702
const BBox< Vec3R > & worldBBox() const
Computes a AABB of active values in world space.
Definition NanoVDB.h:2661
AccessorType getAccessor() const
Return a new instance of a ReadAccessor used to access values in this grid.
Definition NanoVDB.h:2606
uint64_t gridSize() const
Return the memory footprint of the entire grid, i.e. including all nodes and blind data.
Definition NanoVDB.h:2585
const GridBlindMetaData & blindMetaData(uint32_t n) const
Definition NanoVDB.h:2740
Vec3T indexToWorldDir(const Vec3T &dir) const
transformation from index space direction to world space direction
Definition NanoVDB.h:2625
Vec3T indexToWorldGradF(const Vec3T &grad) const
Transforms the gradient from index space to world space.
Definition NanoVDB.h:2658
uint64_t checksum() const
Return checksum of the grid buffer.
Definition NanoVDB.h:2717
bool isFogVolume() const
Definition NanoVDB.h:2677
const TreeT & tree() const
Return a const reference to the tree.
Definition NanoVDB.h:2600
bool isMask() const
Definition NanoVDB.h:2682
const BBox< CoordType > & indexBBox() const
Computes a AABB of active values in index space.
Definition NanoVDB.h:2667
bool hasLongGridName() const
Definition NanoVDB.h:2686
const void * blindData(uint32_t n) const
Returns a const pointer to the blindData at the specified linear offset.
Definition NanoVDB.h:2731
static uint64_t memUsage()
Return memory usage in bytes for this class only.
Definition NanoVDB.h:2582
TreeT & tree()
Return a non-const reference to the tree.
Definition NanoVDB.h:2603
Vec3T worldToIndex(const Vec3T &xyz) const
world to index space transformation
Definition NanoVDB.h:2616
uint32_t gridCount() const
Return total number of grids in the buffer.
Definition NanoVDB.h:2591
Vec3T worldToIndexDir(const Vec3T &dir) const
transformation from world space direction to index space direction
Definition NanoVDB.h:2630
Version version() const
Definition NanoVDB.h:2575
bool isEmpty() const
Return true if this grid is empty, i.e. contains no values or nodes.
Definition NanoVDB.h:2720
const Map & map() const
Return a const reference to the Map for this grid.
Definition NanoVDB.h:2612
bool hasStdDeviation() const
Definition NanoVDB.h:2688
bool hasBBox() const
Definition NanoVDB.h:2685
bool isLevelSet() const
Definition NanoVDB.h:2676
bool isGridIndex() const
Definition NanoVDB.h:2680
TreeT TreeType
Definition NanoVDB.h:2560
Grid(const Grid &)=delete
Disallow constructions, copy and assignment.
typename TreeT::BuildType BuildType
Definition NanoVDB.h:2564
Grid & operator=(const Grid &)=delete
Vec3T indexToWorldGrad(const Vec3T &grad) const
transform the gradient from index space to world space.
Definition NanoVDB.h:2635
const DataType * data() const
Definition NanoVDB.h:2579
bool isPointIndex() const
Definition NanoVDB.h:2679
bool isUnknown() const
Definition NanoVDB.h:2683
Dummy type for a 16 bit floating point values.
Definition NanoVDB.h:219
Visits child nodes of this node only.
Definition NanoVDB.h:3548
ChildIterator()
Definition NanoVDB.h:3552
CoordType getOrigin() const
Definition NanoVDB.h:3557
const ChildT * operator->() const
Definition NanoVDB.h:3556
ChildIterator & operator=(const ChildIterator &)=default
ChildIterator(const InternalNode *parent)
Definition NanoVDB.h:3553
const ChildT & operator*() const
Definition NanoVDB.h:3555
Visits all tile values in this node, i.e. both inactive and active tiles.
Definition NanoVDB.h:3564
ValueIterator & operator=(const ValueIterator &)=default
ValueIterator(const InternalNode *parent)
Definition NanoVDB.h:3569
bool isActive() const
Definition NanoVDB.h:3573
ValueIterator()
Definition NanoVDB.h:3568
CoordType getOrigin() const
Definition NanoVDB.h:3572
ValueType operator*() const
Definition NanoVDB.h:3571
Visits active tile values of this node only.
Definition NanoVDB.h:3580
ValueOnIterator(const InternalNode *parent)
Definition NanoVDB.h:3585
ValueOnIterator & operator=(const ValueOnIterator &)=default
CoordType getOrigin() const
Definition NanoVDB.h:3588
ValueType operator*() const
Definition NanoVDB.h:3587
ValueOnIterator()
Definition NanoVDB.h:3584
Internal nodes of a VDB treedim(),.
Definition NanoVDB.h:3523
Coord offsetToGlobalCoord(uint32_t n) const
Definition NanoVDB.h:3702
const MaskType< LOG2DIM > & valueMask() const
Return a const reference to the bit mask of active voxels in this internal node.
Definition NanoVDB.h:3610
ValueIterator beginValue() const
Definition NanoVDB.h:3576
bool isActive() const
Return true if this node or any of its child nodes contain active values.
Definition NanoVDB.h:3710
static uint32_t dim()
Return the dimension, in voxel units, of this internal node (typically 8*16 or 8*16*32)
Definition NanoVDB.h:3604
static size_t memUsage()
Return memory usage in bytes for the class.
Definition NanoVDB.h:3607
CoordType origin() const
Return the origin in index space of this leaf node.
Definition NanoVDB.h:3616
typename ChildT::CoordType CoordType
Definition NanoVDB.h:3531
ChildIterator beginChild() const
Definition NanoVDB.h:3560
const BBox< CoordType > & bbox() const
Return a const reference to the bounding box in index space of active values in this internal node an...
Definition NanoVDB.h:3634
FloatType variance() const
Return the variance of all the active values encoded in this internal node and any of its child nodes...
Definition NanoVDB.h:3628
const MaskType< LOG2DIM > & childMask() const
Return a const reference to the bit mask of child nodes in this internal node.
Definition NanoVDB.h:3613
const FloatType & average() const
Return a const reference to the average of all the active values encoded in this internal node and an...
Definition NanoVDB.h:3625
DataType * data()
Definition NanoVDB.h:3599
void localToGlobalCoord(Coord &ijk) const
modifies local coordinates to global coordinates of a tile or child node
Definition NanoVDB.h:3696
typename DataType::BuildT BuildType
Definition NanoVDB.h:3528
typename Mask< Log2Dim >::template Iterator< On > MaskIterT
Definition NanoVDB.h:3536
ChildT ChildNodeType
Definition NanoVDB.h:3530
const LeafNodeType * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:3659
bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:3643
typename DataType::ValueT ValueType
Definition NanoVDB.h:3526
static uint32_t CoordToOffset(const CoordType &ijk)
Return the linear offset corresponding to the given coordinate.
Definition NanoVDB.h:3674
typename DataType::StatsT FloatType
Definition NanoVDB.h:3527
static Coord OffsetToLocalCoord(uint32_t n)
Definition NanoVDB.h:3688
bool probeValue(const CoordType &ijk, ValueType &v) const
return the state and updates the value of the specified voxel
Definition NanoVDB.h:3650
typename ChildT::LeafNodeType LeafNodeType
Definition NanoVDB.h:3529
const ChildNodeType * probeChild(const CoordType &ijk) const
Definition NanoVDB.h:3667
const FloatType & stdDeviation() const
Return a const reference to the standard deviation of all the active values encoded in this internal ...
Definition NanoVDB.h:3631
const ValueType & maximum() const
Return a const reference to the maximum active value encoded in this internal node and any of its chi...
Definition NanoVDB.h:3622
InternalNode()=delete
This class cannot be constructed or deleted.
ValueType getValue(const CoordType &ijk) const
Return the value of the given voxel.
Definition NanoVDB.h:3637
typename ChildT::template MaskType< LOG2 > MaskType
Definition NanoVDB.h:3534
const ValueType & minimum() const
Return a const reference to the minimum active value encoded in this internal node and any of its chi...
Definition NanoVDB.h:3619
const DataType * data() const
Definition NanoVDB.h:3601
InternalNode & operator=(const InternalNode &)=delete
InternalNode(const InternalNode &)=delete
ValueOnIterator beginValueOn() const
Definition NanoVDB.h:3591
Visits all values in a leaf node, i.e. both active and inactive values.
Definition NanoVDB.h:4306
ValueIterator & operator=(const ValueIterator &)=default
ValueIterator & operator++()
Definition NanoVDB.h:4317
ValueIterator operator++(int)
Definition NanoVDB.h:4318
ValueIterator(const LeafNode *parent)
Definition NanoVDB.h:4311
bool isActive() const
Definition NanoVDB.h:4315
CoordT getCoord() const
Definition NanoVDB.h:4314
ValueIterator()
Definition NanoVDB.h:4310
ValueType operator*() const
Definition NanoVDB.h:4313
Visits all inactive values in a leaf node.
Definition NanoVDB.h:4291
ValueOffIterator()
Definition NanoVDB.h:4295
CoordT getCoord() const
Definition NanoVDB.h:4299
ValueOffIterator & operator=(const ValueOffIterator &)=default
ValueType operator*() const
Definition NanoVDB.h:4298
ValueOffIterator(const LeafNode *parent)
Definition NanoVDB.h:4296
Visits all active values in a leaf node.
Definition NanoVDB.h:4276
CoordT getCoord() const
Definition NanoVDB.h:4284
ValueOnIterator(const LeafNode *parent)
Definition NanoVDB.h:4281
ValueOnIterator & operator=(const ValueOnIterator &)=default
ValueType operator*() const
Definition NanoVDB.h:4283
ValueOnIterator()
Definition NanoVDB.h:4280
Leaf nodes of the VDB tree. (defaults to 8x8x8 = 512 voxels)
Definition NanoVDB.h:4254
void setValue(const CoordT &ijk, const ValueType &v)
Sets the value at the specified location and activate its state.
Definition NanoVDB.h:4418
void setValueOnly(uint32_t offset, const ValueType &v)
Sets the value at the specified location but leaves its state unchanged.
Definition NanoVDB.h:4423
bool isActive(const CoordT &ijk) const
Return true if the voxel value at the given coordinate is active.
Definition NanoVDB.h:4427
typename DataType::BuildType BuildType
Definition NanoVDB.h:4266
const MaskType< LOG2DIM > & valueMask() const
Return a const reference to the bit mask of active voxels in this leaf node.
Definition NanoVDB.h:4341
ValueIterator beginValue() const
Definition NanoVDB.h:4325
bool isActive() const
Return true if any of the voxel value are active in this leaf node.
Definition NanoVDB.h:4431
CoordT CoordType
Definition NanoVDB.h:4267
static uint32_t dim()
Return the dimension, in index space, of this leaf node (typically 8 as for openvdb leaf nodes!...
Definition NanoVDB.h:4379
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:4441
FloatType variance() const
Return the variance of all the active values encoded in this leaf node.
Definition NanoVDB.h:4353
LeafNode & operator=(const LeafNode &)=delete
bool isActive(uint32_t n) const
Definition NanoVDB.h:4428
DataType * data()
Definition NanoVDB.h:4336
uint8_t flags() const
Definition NanoVDB.h:4358
void localToGlobalCoord(Coord &ijk) const
Converts (in place) a local index coordinate to a global index coordinate.
Definition NanoVDB.h:4371
ValueType maximum() const
Return a const reference to the maximum active value encoded in this leaf node.
Definition NanoVDB.h:4347
typename DataType::FloatType FloatType
Definition NanoVDB.h:4265
CoordT origin() const
Return the origin in index space of this leaf node.
Definition NanoVDB.h:4361
typename Mask< Log2Dim >::template Iterator< ON > MaskIterT
Definition NanoVDB.h:4272
static uint32_t CoordToOffset(const CoordT &ijk)
Return the linear offset corresponding to the given coordinate.
Definition NanoVDB.h:4451
CoordT offsetToGlobalCoord(uint32_t n) const
Definition NanoVDB.h:4373
void setValueOnly(const CoordT &ijk, const ValueType &v)
Definition NanoVDB.h:4424
ValueType getValue(uint32_t offset) const
Return the voxel value at the given offset.
Definition NanoVDB.h:4410
FloatType average() const
Return a const reference to the average of all the active values encoded in this leaf node.
Definition NanoVDB.h:4350
const LeafNode * probeLeaf(const CoordT &) const
Definition NanoVDB.h:4448
ValueType getValue(const CoordT &ijk) const
Return the voxel value at the given coordinate.
Definition NanoVDB.h:4413
MaskT< LOG2 > MaskType
Definition NanoVDB.h:4270
static uint32_t voxelCount()
Return the total number of voxels (e.g. values) encoded in this leaf node.
Definition NanoVDB.h:4396
LeafNode(const LeafNode &)=delete
ValueOffIterator beginValueOff() const
Definition NanoVDB.h:4302
BBox< CoordT > bbox() const
Return the bounding box in index space of active values in this leaf node.
Definition NanoVDB.h:4382
LeafNode()=delete
This class cannot be constructed or deleted.
ValueType minimum() const
Return a const reference to the minimum active value encoded in this leaf node.
Definition NanoVDB.h:4344
typename DataType::ValueType ValueType
Definition NanoVDB.h:4264
static uint32_t padding()
Definition NanoVDB.h:4398
static CoordT OffsetToLocalCoord(uint32_t n)
Definition NanoVDB.h:4363
bool hasBBox() const
Definition NanoVDB.h:4438
uint64_t memUsage()
return memory usage in bytes for the class
Definition NanoVDB.h:4401
const DataType * data() const
Definition NanoVDB.h:4338
ValueOnIterator beginValueOn() const
Definition NanoVDB.h:4287
FloatType stdDeviation() const
Return a const reference to the standard deviation of all the active values encoded in this leaf node...
Definition NanoVDB.h:4356
Definition NanoVDB.h:1993
Iterator()
Definition NanoVDB.h:1995
Iterator & operator=(const Iterator &)=default
uint32_t operator*() const
Definition NanoVDB.h:1998
Iterator operator++(int)
Definition NanoVDB.h:2006
uint32_t pos() const
Definition NanoVDB.h:1999
Iterator(uint32_t pos, const Mask *parent)
Definition NanoVDB.h:1996
Iterator & operator++()
Definition NanoVDB.h:2001
Bit-mask to encode active states and facilitate sequential iterators and a fast codec for I/O compres...
Definition NanoVDB.h:1959
void set(uint32_t n, bool On)
Set the specified bit on or off.
Definition NanoVDB.h:2117
OnIterator beginOn() const
Definition NanoVDB.h:2021
bool isOff(uint32_t n) const
Return true if the given bit is NOT set.
Definition NanoVDB.h:2090
const WordT & getWord(int n) const
Return a const reference to the nth word of the bit mask, for a word of arbitrary size.
Definition NanoVDB.h:2047
bool operator==(const Mask &other) const
Definition NanoVDB.h:2076
static size_t memUsage()
Return the memory footprint in bytes of this Mask.
Definition NanoVDB.h:1966
OffIterator beginOff() const
Definition NanoVDB.h:2023
void setOn()
Set all bits on.
Definition NanoVDB.h:2130
void toggle(uint32_t n)
Definition NanoVDB.h:2157
uint32_t countOn() const
Return the total number of set bits in this Mask.
Definition NanoVDB.h:1975
Mask & operator^=(const Mask &other)
Bitwise XOR.
Definition NanoVDB.h:2184
void setOff(uint32_t n)
Set the specified bit off.
Definition NanoVDB.h:2114
Mask(const Mask &other)
Copy constructor.
Definition NanoVDB.h:2039
WordT & getWord(int n)
Return a reference to the nth word of the bit mask, for a word of arbitrary size.
Definition NanoVDB.h:2055
Mask(bool on)
Definition NanoVDB.h:2031
Mask & operator=(const MaskT &other)
Assignment operator that works with openvdb::util::NodeMask.
Definition NanoVDB.h:2063
bool isOn(uint32_t n) const
Return true if the given bit is set.
Definition NanoVDB.h:2087
void set(bool on)
Set all bits off.
Definition NanoVDB.h:2144
Mask & operator|=(const Mask &other)
Bitwise union.
Definition NanoVDB.h:2168
void setOff()
Set all bits off.
Definition NanoVDB.h:2137
Mask & operator&=(const Mask &other)
Bitwise intersection.
Definition NanoVDB.h:2160
static uint32_t bitCount()
Return the number of bits available in this Mask.
Definition NanoVDB.h:1969
bool isOff() const
Return true if none of the bits are set in this Mask.
Definition NanoVDB.h:2102
bool operator!=(const Mask &other) const
Definition NanoVDB.h:2084
void toggle()
brief Toggle the state of all bits in the mask
Definition NanoVDB.h:2151
Mask & operator-=(const Mask &other)
Bitwise difference.
Definition NanoVDB.h:2176
static uint32_t wordCount()
Return the number of machine words used by this Mask.
Definition NanoVDB.h:1972
bool isOn() const
Return true if all the bits are set in this Mask.
Definition NanoVDB.h:2093
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:1984
Mask()
Initialize all bits to zero.
Definition NanoVDB.h:2026
void setOn(uint32_t n)
Set the specified bit on.
Definition NanoVDB.h:2111
Class to access points at a specific voxel location.
Definition NanoVDB.h:5463
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:5483
typename NanoRoot< uint32_t >::LeafNodeType LeafNodeType
Definition NanoVDB.h:5469
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:5493
PointAccessor(const UInt32Grid &grid)
Definition NanoVDB.h:5471
uint64_t voxelPoints(const Coord &ijk, const AttT *&begin, const AttT *&end) const
get iterators over offsets to points at a specific voxel location
Definition NanoVDB.h:5505
ReadAccessor & operator=(const ReadAccessor &)=default
ValueType operator()(int i, int j, int k) const
Definition NanoVDB.h:4702
ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition NanoVDB.h:4678
NodeInfo getNodeInfo(const CoordType &ijk) const
Definition NanoVDB.h:4707
ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition NanoVDB.h:4681
ValueType operator()(const CoordType &ijk) const
Definition NanoVDB.h:4698
bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:4712
bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:4717
typename RootT::CoordType CoordType
Definition NanoVDB.h:4659
ReadAccessor(const ReadAccessor &)=default
Defaults constructors.
const RootT & root() const
Definition NanoVDB.h:4687
void clear()
Reset this access to its initial state, i.e. with an empty cache @node Noop since this template speci...
Definition NanoVDB.h:4685
ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:4694
typename RootT::ValueType ValueType
Definition NanoVDB.h:4658
const LeafT * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:4722
uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition NanoVDB.h:4728
ReadAccessor(const RootT &root)
Constructor from a root node.
Definition NanoVDB.h:4675
Node caching at all (three) tree levels.
Definition NanoVDB.h:5139
ReadAccessor & operator=(const ReadAccessor &)=default
typename ReadAccessor< ValueT, -1, -1, -1 >::NodeInfo NodeInfo
Definition NanoVDB.h:5167
const NodeTrait< TreeT, LEVEL >::type * getNode() const
Definition NanoVDB.h:5206
CoordT CoordType
Definition NanoVDB.h:5163
ValueType operator()(int i, int j, int k) const
Definition NanoVDB.h:5270
ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition NanoVDB.h:5182
NodeInfo getNodeInfo(const CoordType &ijk) const
Definition NanoVDB.h:5275
ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition NanoVDB.h:5185
ValueType operator()(const CoordType &ijk) const
Definition NanoVDB.h:5266
ValueT ValueType
Definition NanoVDB.h:5162
bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:5292
const NodeT * getNode() const
Return a const point to the cached node of the specified type.
Definition NanoVDB.h:5198
bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:5309
ReadAccessor(const ReadAccessor &)=default
Defaults constructors.
const RootT & root() const
Definition NanoVDB.h:5187
void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition NanoVDB.h:5215
ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:5250
bool isCached(const CoordType &ijk) const
Definition NanoVDB.h:5244
const LeafT * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:5326
uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition NanoVDB.h:5344
ReadAccessor(const RootT &root)
Constructor from a root node.
Definition NanoVDB.h:5170
ReadAccessor & operator=(const ReadAccessor &)=default
typename ReadAccessor< ValueT, -1, -1, -1 >::NodeInfo NodeInfo
Definition NanoVDB.h:4775
CoordT CoordType
Definition NanoVDB.h:4771
ValueType operator()(int i, int j, int k) const
Definition NanoVDB.h:4823
ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition NanoVDB.h:4786
bool isCached(const CoordType &ijk) const
Definition NanoVDB.h:4805
NodeInfo getNodeInfo(const CoordType &ijk) const
Definition NanoVDB.h:4828
ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition NanoVDB.h:4789
ValueType operator()(const CoordType &ijk) const
Definition NanoVDB.h:4819
ValueT ValueType
Definition NanoVDB.h:4770
bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:4836
bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:4844
ReadAccessor(const ReadAccessor &)=default
Defaults constructors.
const RootT & root() const
Definition NanoVDB.h:4798
void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition NanoVDB.h:4792
ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:4812
const LeafT * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:4852
uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition NanoVDB.h:4861
ReadAccessor(const RootT &root)
Constructor from a root node.
Definition NanoVDB.h:4778
ReadAccessor & operator=(const ReadAccessor &)=default
CoordT CoordType
Definition NanoVDB.h:4920
ValueType operator()(int i, int j, int k) const
Definition NanoVDB.h:5022
ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition NanoVDB.h:4940
NodeInfo getNodeInfo(const CoordType &ijk) const
Definition NanoVDB.h:5027
ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition NanoVDB.h:4943
ValueType operator()(const CoordType &ijk) const
Definition NanoVDB.h:5018
ValueT ValueType
Definition NanoVDB.h:4919
bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:5042
bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:5057
typename ReadAccessor< ValueT,-1,-1,-1 >::NodeInfo NodeInfo
Definition NanoVDB.h:4924
bool isCached1(const CoordType &ijk) const
Definition NanoVDB.h:4990
ReadAccessor(const ReadAccessor &)=default
Defaults constructors.
const RootT & root() const
Definition NanoVDB.h:4957
void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition NanoVDB.h:4946
ValueType getValue(const CoordType &ijk) const
Definition NanoVDB.h:5004
bool isCached2(const CoordType &ijk) const
Definition NanoVDB.h:4996
const LeafT * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:5072
uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition NanoVDB.h:5088
ReadAccessor(const RootT &root)
Constructor from a root node.
Definition NanoVDB.h:4927
Definition NanoVDB.h:2547
8-bit red, green, blue, alpha packed into 32 bit unsigned int
Definition NanoVDB.h:559
const uint32_t & packed() const
Definition NanoVDB.h:593
Rgba8(uint8_t r, uint8_t g, uint8_t b, uint8_t a=255u)
Definition NanoVDB.h:573
Rgba8 & operator=(const Rgba8 &)=default
const uint8_t & g() const
Definition NanoVDB.h:596
uint8_t & g()
Definition NanoVDB.h:600
Rgba8(float r, float g, float b, float a=1.0f)
Definition NanoVDB.h:575
uint32_t packed
Definition NanoVDB.h:562
const uint8_t & a() const
Definition NanoVDB.h:598
bool operator<(const Rgba8 &rhs) const
Definition NanoVDB.h:582
const uint8_t & r() const
Definition NanoVDB.h:595
Rgba8()
Definition NanoVDB.h:572
Rgba8(uint8_t v)
Definition NanoVDB.h:574
float lengthSqr() const
Definition NanoVDB.h:584
Rgba8 & operator=(Rgba8 &&)=default
const uint8_t & b() const
Definition NanoVDB.h:597
uint32_t & packed()
Definition NanoVDB.h:594
uint8_t & r()
Definition NanoVDB.h:599
uint8_t & operator[](int n)
Definition NanoVDB.h:592
float length() const
Definition NanoVDB.h:590
const uint8_t & operator[](int n) const
Definition NanoVDB.h:591
bool operator==(const Rgba8 &rhs) const
Definition NanoVDB.h:583
uint8_t ValueType
Definition NanoVDB.h:566
Rgba8(const Rgba8 &)=default
uint8_t & b()
Definition NanoVDB.h:601
uint8_t c[4]
Definition NanoVDB.h:561
uint8_t & a()
Definition NanoVDB.h:602
static const int SIZE
Definition NanoVDB.h:565
Definition NanoVDB.h:3096
ChildIterator()
Definition NanoVDB.h:3100
ChildIterator & operator++()
Definition NanoVDB.h:3111
ChildIterator operator++(int)
Definition NanoVDB.h:3117
CoordType getOrigin() const
Definition NanoVDB.h:3108
const ChildT * operator->() const
Definition NanoVDB.h:3107
ChildIterator & operator=(const ChildIterator &)=default
uint32_t pos() const
Definition NanoVDB.h:3110
const ChildT & operator*() const
Definition NanoVDB.h:3106
ChildIterator(const RootNode *parent)
Definition NanoVDB.h:3101
Definition NanoVDB.h:3127
ValueIterator & operator=(const ValueIterator &)=default
ValueIterator & operator++()
Definition NanoVDB.h:3142
ValueIterator operator++(int)
Definition NanoVDB.h:3148
bool isActive() const
Definition NanoVDB.h:3138
ValueIterator()
Definition NanoVDB.h:3131
CoordType getOrigin() const
Definition NanoVDB.h:3141
ValueType operator*() const
Definition NanoVDB.h:3137
uint32_t pos() const
Definition NanoVDB.h:3140
ValueIterator(const RootNode *parent)
Definition NanoVDB.h:3132
Definition NanoVDB.h:3158
ValueOnIterator operator++(int)
Definition NanoVDB.h:3178
ValueOnIterator(const RootNode *parent)
Definition NanoVDB.h:3163
ValueOnIterator & operator=(const ValueOnIterator &)=default
CoordType getOrigin() const
Definition NanoVDB.h:3171
ValueOnIterator & operator++()
Definition NanoVDB.h:3172
ValueType operator*() const
Definition NanoVDB.h:3168
uint32_t pos() const
Definition NanoVDB.h:3170
ValueOnIterator()
Definition NanoVDB.h:3162
Top-most node of the VDB tree structure.
Definition NanoVDB.h:3076
const uint32_t & tileCount() const
Return the number of tiles encoded in this root node.
Definition NanoVDB.h:3209
static uint64_t memUsage(uint32_t tableSize)
Return the expected memory footprint in bytes with the specified number of tiles.
Definition NanoVDB.h:3227
ValueIterator beginValue() const
Definition NanoVDB.h:3155
typename ChildT::CoordType CoordType
Definition NanoVDB.h:3087
ChildIterator beginChild() const
Definition NanoVDB.h:3124
FloatType variance() const
Return the variance of all the active values encoded in this root node and any of its child nodes.
Definition NanoVDB.h:3221
const FloatType & average() const
Return a const reference to the average of all the active values encoded in this root node and any of...
Definition NanoVDB.h:3218
RootNode & operator=(const RootNode &)=delete
DataType * data()
Definition NanoVDB.h:3195
AccessorType getAccessor() const
Definition NanoVDB.h:3193
typename DataType::BuildT BuildType
Definition NanoVDB.h:3085
const BBoxType & bbox() const
Return a const reference to the index bounding box of all the active values in this tree,...
Definition NanoVDB.h:3200
RootNode(const RootNode &)=delete
ChildT ChildNodeType
Definition NanoVDB.h:3080
const LeafNodeType * probeLeaf(const CoordType &ijk) const
Definition NanoVDB.h:3266
bool isActive(const CoordType &ijk) const
Definition NanoVDB.h:3241
typename DataType::ValueT ValueType
Definition NanoVDB.h:3083
typename DataType::StatsT FloatType
Definition NanoVDB.h:3084
uint64_t memUsage() const
Return the actual memory footprint of this root node.
Definition NanoVDB.h:3230
bool probeValue(const CoordType &ijk, ValueType &v) const
Definition NanoVDB.h:3252
typename ChildT::LeafNodeType LeafNodeType
Definition NanoVDB.h:3079
const ChildNodeType * probeChild(const CoordType &ijk) const
Definition NanoVDB.h:3276
const FloatType & stdDeviation() const
Return a const reference to the standard deviation of all the active values encoded in this root node...
Definition NanoVDB.h:3224
const Tile * probeTile(const CoordType &ijk) const
Find and return a Tile of this root node.
Definition NanoVDB.h:3286
const ValueType & maximum() const
Return a const reference to the maximum active value encoded in this root node and any of its child n...
Definition NanoVDB.h:3215
typename DataType::Tile Tile
Definition NanoVDB.h:3090
ValueType getValue(const CoordType &ijk) const
Return the value of the given voxel.
Definition NanoVDB.h:3233
const ValueType & background() const
Return the total number of active voxels in the root and all its child nodes.
Definition NanoVDB.h:3206
bool isEmpty() const
Return true if this RootNode is empty, i.e. contains no values or nodes.
Definition NanoVDB.h:3250
RootNode()=delete
This class cannot be constructed or deleted.
const ValueType & minimum() const
Return a const reference to the minimum active value encoded in this root node and any of its child n...
Definition NanoVDB.h:3212
const DataType * data() const
Definition NanoVDB.h:3197
ValueOnIterator beginValueOn() const
Definition NanoVDB.h:3185
VDB Tree, which is a thin wrapper around a RootNode.
Definition NanoVDB.h:2801
typename RootT::ChildNodeType Node2
Definition NanoVDB.h:2817
const NodeTrait< RootT, 1 >::type * getFirstLower() const
Definition NanoVDB.h:2932
RootT Node3
Definition NanoVDB.h:2816
const uint32_t & activeTileCount(uint32_t level) const
Return the total number of active tiles at the specified level of the tree.
Definition NanoVDB.h:2869
const NodeT * getFirstNode() const
return a const pointer to the first node of the specified type
Definition NanoVDB.h:2902
uint64_t activeVoxelCount() const
Return the total number of active voxels in this tree.
Definition NanoVDB.h:2862
typename RootT::LeafNodeType LeafNodeType
Definition NanoVDB.h:2810
const BBox< CoordType > & bbox() const
Return a const reference to the index bounding box of all the active values in this tree,...
Definition NanoVDB.h:2859
const NodeTrait< RootT, 2 >::type * getFirstUpper() const
Definition NanoVDB.h:2934
DataType * data()
Definition NanoVDB.h:2827
uint32_t nodeCount() const
Definition NanoVDB.h:2876
NodeTrait< RootT, 1 >::type * getFirstLower()
Definition NanoVDB.h:2931
Tree()=delete
This class cannot be constructed or deleted.
AccessorType getAccessor() const
Definition NanoVDB.h:2838
NodeTrait< RootT, 2 >::type * getFirstUpper()
Definition NanoVDB.h:2933
bool isActive(const CoordType &ijk) const
Return the active state of the given voxel (regardless of state or location in the tree....
Definition NanoVDB.h:2844
const LeafNodeType * getFirstLeaf() const
Definition NanoVDB.h:2930
NodeTrait< RootT, LEVEL >::type * getFirstNode()
return a pointer to the first node at the specified level
Definition NanoVDB.h:2913
bool probeValue(const CoordType &ijk, ValueType &v) const
Combines the previous two methods in a single call.
Definition NanoVDB.h:2850
typename RootT::CoordType CoordType
Definition NanoVDB.h:2813
RootT & root()
Definition NanoVDB.h:2834
LeafNodeType * getFirstLeaf()
Template specializations of getFirstNode.
Definition NanoVDB.h:2929
Tree(const Tree &)=delete
static uint64_t memUsage()
return memory usage in bytes for the class
Definition NanoVDB.h:2832
LeafNodeType Node0
Definition NanoVDB.h:2819
NodeT * getFirstNode()
return a pointer to the first node of the specified type
Definition NanoVDB.h:2892
uint32_t nodeCount(int level) const
Definition NanoVDB.h:2882
typename Node2::ChildNodeType Node1
Definition NanoVDB.h:2818
const NodeTrait< RootT, LEVEL >::type * getFirstNode() const
return a const pointer to the first node of the specified level
Definition NanoVDB.h:2923
const RootT & root() const
Definition NanoVDB.h:2836
ValueType getValue(const CoordType &ijk) const
Return the value of the given voxel (regardless of state or location in the tree.)
Definition NanoVDB.h:2841
RootT RootType
Definition NanoVDB.h:2809
const ValueType & background() const
Return a const reference to the background value.
Definition NanoVDB.h:2853
bool isEmpty() const
Return true if this tree is empty, i.e. contains no values or nodes.
Definition NanoVDB.h:2847
Tree & operator=(const Tree &)=delete
typename RootT::ValueType ValueType
Definition NanoVDB.h:2811
const DataType * data() const
Definition NanoVDB.h:2829
typename RootT::BuildType BuildType
Definition NanoVDB.h:2812
Dummy type for a voxel whose value equals an offset into an external value array.
Definition NanoVDB.h:213
Dummy type for a voxel whose value equals its binary active state.
Definition NanoVDB.h:216
Vec3(const Vec3< T2 > &v)
Definition NanoVDB.h:1176
Coord round() const
Definition NanoVDB.h:1275
Vec3(T x)
Definition NanoVDB.h:1167
ValueType min() const
Return the smallest vector component.
Definition NanoVDB.h:1264
Vec3 & minComponent(const Vec3 &other)
Perform a component-wise minimum with the other Coord.
Definition NanoVDB.h:1241
Vec3(const Coord &ijk)
Definition NanoVDB.h:1180
bool operator==(const Vec3 &rhs) const
Definition NanoVDB.h:1184
Vec3 operator-() const
Definition NanoVDB.h:1210
T length() const
Definition NanoVDB.h:1209
Vec3 operator*(const Vec3 &v) const
Definition NanoVDB.h:1211
Vec3 & maxComponent(const Vec3 &other)
Perform a component-wise maximum with the other Coord.
Definition NanoVDB.h:1253
Vec3 & operator-=(const Vec3 &v)
Definition NanoVDB.h:1224
Coord floor() const
Definition NanoVDB.h:1273
Vec3 operator*(const T &s) const
Definition NanoVDB.h:1215
Vec3(T x, T y, T z)
Definition NanoVDB.h:1171
Vec3 operator/(const Vec3 &v) const
Definition NanoVDB.h:1212
T dot(const Vec3T &v) const
Definition NanoVDB.h:1197
Vec3 & operator=(const Vec3T &rhs)
Definition NanoVDB.h:1187
Vec3 & operator*=(const T &s)
Definition NanoVDB.h:1231
Vec3 & normalize()
Definition NanoVDB.h:1239
T lengthSqr() const
Definition NanoVDB.h:1205
Vec3 & operator+=(const Vec3 &v)
Definition NanoVDB.h:1217
Coord ceil() const
Definition NanoVDB.h:1274
const T & operator[](int i) const
Definition NanoVDB.h:1194
Vec3 cross(const Vec3T &v) const
Definition NanoVDB.h:1199
Vec3 operator/(const T &s) const
Definition NanoVDB.h:1216
bool operator!=(const Vec3 &rhs) const
Definition NanoVDB.h:1185
Vec3 operator+(const Vec3 &v) const
Definition NanoVDB.h:1213
T & operator[](int i)
Definition NanoVDB.h:1195
Vec3 operator-(const Vec3 &v) const
Definition NanoVDB.h:1214
ValueType max() const
Return the largest vector component.
Definition NanoVDB.h:1269
Vec3 & operator/=(const T &s)
Definition NanoVDB.h:1238
T ValueType
Definition NanoVDB.h:1165
A simple vector class with three double components, similar to openvdb::math::Vec4.
Definition NanoVDB.h:1305
Vec4 & normalize()
Definition NanoVDB.h:1377
Vec4 & operator/=(const T &s)
Definition NanoVDB.h:1376
Vec4 operator/(const Vec4 &v) const
Definition NanoVDB.h:1347
Vec4 & operator+=(const Vec4 &v)
Definition NanoVDB.h:1352
Vec4 operator*(const T &s) const
Definition NanoVDB.h:1350
T length() const
Definition NanoVDB.h:1344
Vec4 operator-(const Vec4 &v) const
Definition NanoVDB.h:1349
Vec4 & operator*=(const T &s)
Definition NanoVDB.h:1368
Vec4 operator*(const Vec4 &v) const
Definition NanoVDB.h:1346
Vec4(T x, T y, T z, T w)
Definition NanoVDB.h:1316
bool operator!=(const Vec4 &rhs) const
Definition NanoVDB.h:1326
Vec4 & maxComponent(const Vec4 &other)
Perform a component-wise maximum with the other Coord.
Definition NanoVDB.h:1393
Vec4(const Vec4< T2 > &v)
Definition NanoVDB.h:1321
T lengthSqr() const
Definition NanoVDB.h:1340
const T & operator[](int i) const
Definition NanoVDB.h:1336
Vec4 & operator=(const Vec4T &rhs)
Definition NanoVDB.h:1328
Vec4 & operator-=(const Vec4 &v)
Definition NanoVDB.h:1360
bool operator==(const Vec4 &rhs) const
Definition NanoVDB.h:1325
Vec4 & minComponent(const Vec4 &other)
Perform a component-wise minimum with the other Coord.
Definition NanoVDB.h:1379
T & operator[](int i)
Definition NanoVDB.h:1337
Vec4 operator-() const
Definition NanoVDB.h:1345
Vec4 operator/(const T &s) const
Definition NanoVDB.h:1351
T dot(const Vec4T &v) const
Definition NanoVDB.h:1339
T ValueType
Definition NanoVDB.h:1310
Vec4(T x)
Definition NanoVDB.h:1312
Vec4 operator+(const Vec4 &v) const
Definition NanoVDB.h:1348
Bit-compacted representation of all three version numbers.
Definition NanoVDB.h:648
const char * c_str() const
Definition NanoVDB.h:674
uint32_t getPatch() const
Definition NanoVDB.h:671
bool operator<=(const Version &rhs) const
Definition NanoVDB.h:665
Version()
Definition NanoVDB.h:651
bool operator==(const Version &rhs) const
Definition NanoVDB.h:663
Version(uint32_t major, uint32_t minor, uint32_t patch)
Definition NanoVDB.h:656
uint32_t getMajor() const
Definition NanoVDB.h:669
bool operator>=(const Version &rhs) const
Definition NanoVDB.h:667
uint32_t getMinor() const
Definition NanoVDB.h:670
uint32_t id() const
Definition NanoVDB.h:668
void writeUncompressedGrid(StreamT &os, const void *buffer)
This is a standalone alternative to io::writeGrid(...,Codec::NONE) defined in util/IO....
Definition NanoVDB.h:5649
VecT< GridHandleT > readUncompressedGrids(StreamT &is, const typename GridHandleT::BufferType &buffer=typename GridHandleT::BufferType())
read all uncompressed grids from a stream and return their handles.
Definition NanoVDB.h:5722
void writeUncompressedGrids(const char *fileName, const VecT< GridHandleT > &handles)
write multiple NanoVDB grids to a single file, without compression.
Definition NanoVDB.h:5697
uint64_t AlignUp(uint64_t byteCount)
round up byteSize to the nearest wordSize, e.g. to align to machine word: AlignUp<sizeof(size_t)(n)
Definition NanoVDB.h:954
const char * toStr(GridType gridType)
Retuns a c-string used to describe a GridType.
Definition NanoVDB.h:267
float Fract(float x)
Definition NanoVDB.h:809
static int64_t PtrDiff(const T1 *p, const T2 *q)
Definition NanoVDB.h:535
static uint64_t alignmentPadding(const void *p)
return the smallest number of bytes that when added to the specified pointer results in an aligned po...
Definition NanoVDB.h:510
Vec3T matMult(const float *mat, const Vec3T &xyz)
Definition NanoVDB.h:1533
static DstT * PtrAdd(SrcT *p, int64_t offset)
Definition NanoVDB.h:542
GridClass
Classes (defined in OpenVDB) that are currently supported by NanoVDB.
Definition NanoVDB.h:281
Vec3T matMultT(const float *mat, const Vec3T &xyz)
Definition NanoVDB.h:1567
GridType
List of types that are currently supported by NanoVDB.
Definition NanoVDB.h:243
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:5398
static T * alignPtr(T *p)
offset the specified pointer so it is aligned.
Definition NanoVDB.h:518
GridFlags
Grid flags which indicate what extra information is present in the grid buffer.
Definition NanoVDB.h:306
int32_t Floor(float x)
Definition NanoVDB.h:818
GridBlindDataClass
Blind-data Classes that are currently supported by NanoVDB.
Definition NanoVDB.h:335
GridType mapToGridType()
Maps from a templated value type to a GridType enum.
Definition NanoVDB.h:1488
static bool isAligned(const void *p)
return true if the specified pointer is aligned
Definition NanoVDB.h:498
GridBlindDataSemantic
Blind-data Semantics that are currently understood by NanoVDB.
Definition NanoVDB.h:343
bool isFloatingPoint(GridType gridType)
return true if the GridType maps to a floating point value.
Definition NanoVDB.h:610
static bool isValid(const void *p)
return true if the specified pointer is aligned and not NULL
Definition NanoVDB.h:504
Iterator begin() const
Definition NanoVDB.h:1749
BBox()
Definition NanoVDB.h:1750
bool is_divisible() const
Definition NanoVDB.h:1774
BBox(const CoordT &min, const CoordT &max)
Definition NanoVDB.h:1754
CoordT dim() const
Definition NanoVDB.h:1781
bool empty() const
Return true if this bounding box is empty, i.e. uninitialized.
Definition NanoVDB.h:1778
BBox expandBy(typename CoordT::ValueType padding) const
Return a new instance that is expanded by the specified padding.
Definition NanoVDB.h:1805
bool isInside(const BBox &b) const
Return true if the given bounding box is inside this bounding box.
Definition NanoVDB.h:1785
bool hasOverlap(const BBox &b) const
Return true if the given bounding box overlaps with this bounding box.
Definition NanoVDB.h:1791
uint64_t volume() const
Definition NanoVDB.h:1782
static BBox createCube(const CoordT &min, typename CoordT::ValueType dim)
Definition NanoVDB.h:1769
BBox(BBox &other, const SplitT &)
Definition NanoVDB.h:1760
BBox< Vec3< RealT > > asReal() const
Definition NanoVDB.h:1798
bool isInside(const CoordT &p) const
Definition NanoVDB.h:1783
Vec3T dim() const
Definition NanoVDB.h:1694
bool isInside(const Vec3T &p) const
Definition NanoVDB.h:1695
BBox()
Definition NanoVDB.h:1671
BBox(const Coord &min, const Coord &max)
Definition NanoVDB.h:1680
bool empty() const
Definition NanoVDB.h:1691
BBox(const Vec3T &min, const Vec3T &max)
Definition NanoVDB.h:1676
Vec3T Vec3Type
Definition NanoVDB.h:1666
typename Vec3T::ValueType ValueType
Definition NanoVDB.h:1667
static BBox createCube(const Coord &min, typename Coord::ValueType dim)
Definition NanoVDB.h:1685
BBox(const BaseBBox< Coord > &bbox)
Definition NanoVDB.h:1690
Definition NanoVDB.h:1657
Definition NanoVDB.h:1603
Vec3T mCoord[2]
Definition NanoVDB.h:1604
BaseBBox()
Definition NanoVDB.h:1649
const Vec3T & max() const
Definition NanoVDB.h:1612
Coord & translate(const Vec3T &xyz)
Definition NanoVDB.h:1613
BaseBBox & expand(const Vec3T &xyz)
Definition NanoVDB.h:1620
bool operator!=(const BaseBBox &rhs) const
Definition NanoVDB.h:1606
const Vec3T & operator[](int i) const
Definition NanoVDB.h:1607
Vec3T & operator[](int i)
Definition NanoVDB.h:1608
bool isInside(const Vec3T &xyz)
Definition NanoVDB.h:1639
const Vec3T & min() const
Definition NanoVDB.h:1611
BaseBBox(const Vec3T &min, const Vec3T &max)
Definition NanoVDB.h:1650
Vec3T & min()
Definition NanoVDB.h:1609
bool operator==(const BaseBBox &rhs) const
Definition NanoVDB.h:1605
Vec3T & max()
Definition NanoVDB.h:1610
BaseBBox & intersect(const BaseBBox &bbox)
Intersect this bounding box with the given bounding box.
Definition NanoVDB.h:1628
float type
Definition NanoVDB.h:485
float Type
Definition NanoVDB.h:484
float type
Definition NanoVDB.h:471
float Type
Definition NanoVDB.h:470
float type
Definition NanoVDB.h:478
float Type
Definition NanoVDB.h:477
float type
Definition NanoVDB.h:492
float Type
Definition NanoVDB.h:491
float type
Definition NanoVDB.h:464
float Type
Definition NanoVDB.h:463
uint64_t Type
Definition NanoVDB.h:449
uint64_t type
Definition NanoVDB.h:450
bool Type
Definition NanoVDB.h:456
bool type
Definition NanoVDB.h:457
Maps one type (e.g. the build types above) to other (actual) types.
Definition NanoVDB.h:441
T Type
Definition NanoVDB.h:442
T type
Definition NanoVDB.h:443
static double value()
Definition NanoVDB.h:713
static float value()
Definition NanoVDB.h:708
Delta for small floating-point offsets.
Definition NanoVDB.h:704
double FloatType
Definition NanoVDB.h:1463
uint64_t FloatType
Definition NanoVDB.h:1475
bool FloatType
Definition NanoVDB.h:1481
bool FloatType
Definition NanoVDB.h:1469
Definition NanoVDB.h:1456
float FloatType
Definition NanoVDB.h:1457
Struct with all the member data of the Grid (useful during serialization of an openvdb grid)
Definition NanoVDB.h:2434
uint32_t mFlags
Definition NanoVDB.h:2439
const void * treePtr() const
Definition NanoVDB.h:2532
void setMinMaxOn(bool on=true)
Definition NanoVDB.h:2456
void setAverageOn(bool on=true)
Definition NanoVDB.h:2480
Vec3T applyInverseJacobianF(const Vec3T &xyz) const
Definition NanoVDB.h:2524
Vec3T applyIJTF(const Vec3T &xyz) const
Definition NanoVDB.h:2526
uint32_t mBlindMetadataCount
Definition NanoVDB.h:2450
Version mVersion
Definition NanoVDB.h:2438
uint32_t mData0
Definition NanoVDB.h:2451
GridType mGridType
Definition NanoVDB.h:2448
uint64_t mMagic
Definition NanoVDB.h:2436
void setStdDeviationOn(bool on=true)
Definition NanoVDB.h:2488
Vec3T applyIJT(const Vec3T &xyz) const
Definition NanoVDB.h:2515
GridClass mGridClass
Definition NanoVDB.h:2447
void setBBoxOn(bool on=true)
Definition NanoVDB.h:2464
void setLongGridNameOn(bool on=true)
Definition NanoVDB.h:2472
Vec3T applyJacobianF(const Vec3T &xyz) const
Definition NanoVDB.h:2522
uint64_t mGridSize
Definition NanoVDB.h:2442
BBox< Vec3R > mWorldBBox
Definition NanoVDB.h:2445
Vec3T applyInverseJacobian(const Vec3T &xyz) const
Definition NanoVDB.h:2513
void * treePtr()
Definition NanoVDB.h:2529
const GridBlindMetaData * blindMetaData(uint32_t n) const
Returns a const reference to the blindMetaData at the specified linear offset.
Definition NanoVDB.h:2537
void setBreadthFirstOn(bool on=true)
Definition NanoVDB.h:2496
uint64_t mChecksum
Definition NanoVDB.h:2437
Vec3T applyMapF(const Vec3T &xyz) const
Definition NanoVDB.h:2518
uint64_t mData1
Definition NanoVDB.h:2452
uint32_t mGridCount
Definition NanoVDB.h:2441
Vec3R mVoxelSize
Definition NanoVDB.h:2446
Vec3T applyInverseMap(const Vec3T &xyz) const
Definition NanoVDB.h:2509
Map mMap
Definition NanoVDB.h:2444
Vec3T applyJacobian(const Vec3T &xyz) const
Definition NanoVDB.h:2511
void setFlagsOff()
Definition NanoVDB.h:2455
int64_t mBlindMetadataOffset
Definition NanoVDB.h:2449
uint32_t mGridIndex
Definition NanoVDB.h:2440
Vec3T applyMap(const Vec3T &xyz) const
Definition NanoVDB.h:2507
Vec3T applyInverseMapF(const Vec3T &xyz) const
Definition NanoVDB.h:2520
const typename GridT::TreeType Type
Definition NanoVDB.h:2792
const typename GridT::TreeType type
Definition NanoVDB.h:2793
defines a tree type from a grid type while preserving constness
Definition NanoVDB.h:2785
typename GridT::TreeType Type
Definition NanoVDB.h:2786
typename GridT::TreeType type
Definition NanoVDB.h:2787
Struct with all the member data of the InternalNode (useful during serialization of an openvdb Intern...
Definition NanoVDB.h:3420
void setOrigin(const T &ijk)
Definition NanoVDB.h:3501
StatsT mAverage
Definition NanoVDB.h:3446
typename ChildT::CoordType CoordT
Definition NanoVDB.h:3424
void setChild(uint32_t n, const void *ptr)
Definition NanoVDB.h:3461
MaskT mChildMask
Definition NanoVDB.h:3442
void setValue(uint32_t n, const ValueT &v)
Definition NanoVDB.h:3468
InternalData(const InternalData &)=delete
const ValueT & getMax() const
Definition NanoVDB.h:3504
void setDev(const StatsT &v)
Definition NanoVDB.h:3511
const ChildT * getChild(uint32_t n) const
Definition NanoVDB.h:3480
bool isActive(uint32_t n) const
Definition NanoVDB.h:3492
void setMin(const ValueT &v)
Definition NanoVDB.h:3508
typename ChildT::FloatType StatsT
Definition NanoVDB.h:3423
bool isChild(uint32_t n) const
Definition NanoVDB.h:3498
typename ChildT::BuildType BuildT
Definition NanoVDB.h:3422
ValueT getValue(uint32_t n) const
Definition NanoVDB.h:3486
static constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:3453
const ValueT & getMin() const
Definition NanoVDB.h:3503
void setMax(const ValueT &v)
Definition NanoVDB.h:3509
StatsT mStdDevi
Definition NanoVDB.h:3447
BBox< CoordT > mBBox
Definition NanoVDB.h:3439
ChildT * getChild(uint32_t n)
Returns a pointer to the child node at the specifed linear offset.
Definition NanoVDB.h:3475
ValueT mMaximum
Definition NanoVDB.h:3445
const StatsT & stdDeviation() const
Definition NanoVDB.h:3506
static uint64_t memUsage()
Definition NanoVDB.h:3459
const StatsT & average() const
Definition NanoVDB.h:3505
MaskT mValueMask
Definition NanoVDB.h:3441
typename ChildT::template MaskType< LOG2DIM > MaskT
Definition NanoVDB.h:3425
InternalData & operator=(const InternalData &)=delete
void setAvg(const StatsT &v)
Definition NanoVDB.h:3510
typename ChildT::ValueType ValueT
Definition NanoVDB.h:3421
ValueT mMinimum
Definition NanoVDB.h:3444
InternalData()=delete
This class cannot be constructed or deleted.
uint64_t mFlags
Definition NanoVDB.h:3440
static constexpr uint8_t bitWidth()
Definition NanoVDB.h:4012
float getValue(uint32_t i) const
Definition NanoVDB.h:4013
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static constexpr uint32_t padding()
Definition NanoVDB.h:4007
uint16_t ArrayType
Definition NanoVDB.h:4002
LeafData()=delete
This class cannot be constructed or deleted.
static constexpr uint64_t memUsage()
Definition NanoVDB.h:4006
static constexpr uint8_t bitWidth()
Definition NanoVDB.h:3951
float getValue(uint32_t i) const
Definition NanoVDB.h:3952
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static constexpr uint32_t padding()
Definition NanoVDB.h:3946
LeafData()=delete
This class cannot be constructed or deleted.
uint8_t ArrayType
Definition NanoVDB.h:3941
static constexpr uint64_t memUsage()
Definition NanoVDB.h:3945
static constexpr uint8_t bitWidth()
Definition NanoVDB.h:3984
float getValue(uint32_t i) const
Definition NanoVDB.h:3985
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
static constexpr uint32_t padding()
Definition NanoVDB.h:3979
static constexpr int64_t memUsage()
Definition NanoVDB.h:3978
LeafData()=delete
This class cannot be constructed or deleted.
uint8_t ArrayType
Definition NanoVDB.h:3975
size_t memUsage() const
Definition NanoVDB.h:4039
float getValue(uint32_t i) const
Definition NanoVDB.h:4041
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
uint8_t bitWidth() const
Definition NanoVDB.h:4038
static constexpr uint32_t padding()
Definition NanoVDB.h:4033
LeafData()=delete
This class cannot be constructed or deleted.
static size_t memUsage(uint32_t bitWidth)
Definition NanoVDB.h:4040
void setOrigin(const T &ijk)
Definition NanoVDB.h:4239
void setDev(const T &dev, T *p)
Definition NanoVDB.h:4237
uint64_t getMax() const
Definition NanoVDB.h:4214
uint64_t ValueType
Definition NanoVDB.h:4192
uint64_t FloatType
Definition NanoVDB.h:4194
uint64_t mValueOff
Definition NanoVDB.h:4204
uint8_t mFlags
Definition NanoVDB.h:4200
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
uint64_t getValue(uint32_t i) const
Definition NanoVDB.h:4222
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:4202
CoordT mBBoxMin
Definition NanoVDB.h:4198
static constexpr uint32_t padding()
Definition NanoVDB.h:4207
void setValue(uint32_t offset, uint64_t)
Definition NanoVDB.h:4217
LeafData()=delete
This class cannot be constructed or deleted.
void setMax(const T &max, T *p)
Definition NanoVDB.h:4233
static uint64_t memUsage()
Definition NanoVDB.h:4211
void setMin(const T &min, T *p)
Definition NanoVDB.h:4231
uint64_t getAvg() const
Definition NanoVDB.h:4215
uint64_t getDev() const
Definition NanoVDB.h:4216
uint64_t mStatsOff
Definition NanoVDB.h:4203
void ArrayType
Definition NanoVDB.h:4195
void setAvg(const T &avg, T *p)
Definition NanoVDB.h:4235
uint64_t getMin() const
Definition NanoVDB.h:4213
void setOrigin(const T &ijk)
Definition NanoVDB.h:4177
bool getDev() const
Definition NanoVDB.h:4165
bool getMin() const
Definition NanoVDB.h:4162
void setMax(const ValueType &)
Definition NanoVDB.h:4172
bool getValue(uint32_t i) const
Definition NanoVDB.h:4161
uint8_t mFlags
Definition NanoVDB.h:4150
LeafData & operator=(const LeafData &)=delete
bool getMax() const
Definition NanoVDB.h:4163
void setDev(const FloatType &)
Definition NanoVDB.h:4174
LeafData(const LeafData &)=delete
bool getAvg() const
Definition NanoVDB.h:4164
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:4151
void setValue(uint32_t offset, bool)
Definition NanoVDB.h:4166
CoordT mBBoxMin
Definition NanoVDB.h:4148
static constexpr uint32_t padding()
Definition NanoVDB.h:4156
bool ValueType
Definition NanoVDB.h:4142
LeafData()=delete
This class cannot be constructed or deleted.
void setAvg(const FloatType &)
Definition NanoVDB.h:4173
static uint64_t memUsage()
Definition NanoVDB.h:4154
void setMin(const ValueType &)
Definition NanoVDB.h:4171
bool FloatType
Definition NanoVDB.h:4144
void ArrayType
Definition NanoVDB.h:4145
void setOrigin(const T &ijk)
Definition NanoVDB.h:4127
bool getDev() const
Definition NanoVDB.h:4114
bool BuildType
Definition NanoVDB.h:4094
void setMin(const bool &)
Definition NanoVDB.h:4121
bool getMin() const
Definition NanoVDB.h:4111
void setMax(const bool &)
Definition NanoVDB.h:4122
void setValue(uint32_t offset, bool v)
Definition NanoVDB.h:4115
bool getValue(uint32_t i) const
Definition NanoVDB.h:4110
uint8_t mFlags
Definition NanoVDB.h:4101
LeafData & operator=(const LeafData &)=delete
bool getMax() const
Definition NanoVDB.h:4112
LeafData(const LeafData &)=delete
MaskT< LOG2DIM > ArrayType
Definition NanoVDB.h:4096
bool getAvg() const
Definition NanoVDB.h:4113
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:4102
MaskT< LOG2DIM > mValues
Definition NanoVDB.h:4103
CoordT mBBoxMin
Definition NanoVDB.h:4099
static constexpr uint32_t padding()
Definition NanoVDB.h:4106
bool ValueType
Definition NanoVDB.h:4093
void setDev(const bool &)
Definition NanoVDB.h:4124
LeafData()=delete
This class cannot be constructed or deleted.
static uint64_t memUsage()
Definition NanoVDB.h:4107
void setAvg(const bool &)
Definition NanoVDB.h:4123
bool FloatType
Definition NanoVDB.h:4095
Stuct with all the member data of the LeafNode (useful during serialization of an openvdb LeafNode)
Definition NanoVDB.h:3812
void setOrigin(const T &ijk)
Definition NanoVDB.h:3862
ValueType mMaximum
Definition NanoVDB.h:3827
FloatType getDev() const
Definition NanoVDB.h:3854
typename FloatTraits< ValueT >::FloatType FloatType
Definition NanoVDB.h:3817
void setMin(const ValueType &v)
Definition NanoVDB.h:3856
void setMax(const ValueType &v)
Definition NanoVDB.h:3857
FloatType mAverage
Definition NanoVDB.h:3828
void setDev(const FloatType &v)
Definition NanoVDB.h:3859
uint8_t mFlags
Definition NanoVDB.h:3823
LeafData & operator=(const LeafData &)=delete
LeafData(const LeafData &)=delete
ValueType getMin() const
Definition NanoVDB.h:3851
ValueType getValue(uint32_t i) const
Definition NanoVDB.h:3843
void setValue(uint32_t offset, const ValueType &value)
Definition NanoVDB.h:3845
ValueT ValueType
Definition NanoVDB.h:3815
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:3824
void setValueOnly(uint32_t offset, const ValueType &value)
Definition NanoVDB.h:3844
CoordT mBBoxMin
Definition NanoVDB.h:3821
static constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:3835
ValueType getMax() const
Definition NanoVDB.h:3852
LeafData()=delete
This class cannot be constructed or deleted.
ValueT ArrayType
Definition NanoVDB.h:3818
FloatType getAvg() const
Definition NanoVDB.h:3853
static uint64_t memUsage()
Definition NanoVDB.h:3840
ValueType mMinimum
Definition NanoVDB.h:3826
void setAvg(const FloatType &v)
Definition NanoVDB.h:3858
ValueT BuildType
Definition NanoVDB.h:3816
FloatType mStdDevi
Definition NanoVDB.h:3829
Base-class for quantized float leaf nodes.
Definition NanoVDB.h:3874
void setOrigin(const T &ijk)
Definition NanoVDB.h:3929
float ValueType
Definition NanoVDB.h:3877
float getMin() const
return the quantized minimum of the active values in this node
Definition NanoVDB.h:3904
void setDev(float dev)
Definition NanoVDB.h:3926
void setMin(float min)
Definition NanoVDB.h:3917
float getAvg() const
return the quantized average of the active values in this node
Definition NanoVDB.h:3910
uint8_t mFlags
Definition NanoVDB.h:3882
float mQuantum
Definition NanoVDB.h:3886
MaskT< LOG2DIM > mValueMask
Definition NanoVDB.h:3883
void init(float min, float max, uint8_t bitWidth)
Definition NanoVDB.h:3897
uint16_t mAvg
Definition NanoVDB.h:3887
CoordT mBBoxMin
Definition NanoVDB.h:3880
static constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:3894
float mMinimum
Definition NanoVDB.h:3885
float FloatType
Definition NanoVDB.h:3878
void setMax(float max)
Definition NanoVDB.h:3920
void setAvg(float avg)
Definition NanoVDB.h:3923
static uint64_t memUsage()
Definition NanoVDB.h:3889
float getDev() const
return the quantized standard deviation of the active values in this node
Definition NanoVDB.h:3914
float getMax() const
return the quantized maximum of the active values in this node
Definition NanoVDB.h:3907
Definition NanoVDB.h:4257
static uint32_t dim()
Definition NanoVDB.h:4260
Defines an affine transform and its inverse represented as a 3x3 matrix and a vec3 translation.
Definition NanoVDB.h:2226
double mTaperD
Definition NanoVDB.h:2234
Vec3T applyInverseJacobianF(const Vec3T &xyz) const
Definition NanoVDB.h:2272
Vec3T applyIJTF(const Vec3T &xyz) const
Definition NanoVDB.h:2277
Vec3T applyIJT(const Vec3T &xyz) const
Definition NanoVDB.h:2275
Vec3T applyJacobianF(const Vec3T &xyz) const
Definition NanoVDB.h:2256
Vec3T applyInverseJacobian(const Vec3T &xyz) const
Definition NanoVDB.h:2270
void set(const Mat4T &mat, const Mat4T &invMat, double taper)
Initialize the member data.
Definition NanoVDB.h:2243
Vec3T applyMapF(const Vec3T &xyz) const
Definition NanoVDB.h:2251
Vec3T applyInverseMap(const Vec3T &xyz) const
Definition NanoVDB.h:2259
Vec3T applyJacobian(const Vec3T &xyz) const
Definition NanoVDB.h:2254
Vec3T applyMap(const Vec3T &xyz) const
Definition NanoVDB.h:2249
Vec3T applyInverseMapF(const Vec3T &xyz) const
Definition NanoVDB.h:2264
float mTaperF
Definition NanoVDB.h:2230
Maximum floating-point values.
Definition NanoVDB.h:745
static T value()
Definition NanoVDB.h:746
Trait to map from LEVEL to node type.
Definition NanoVDB.h:4569
typename GridOrTreeOrRootT::LeafNodeType type
Definition NanoVDB.h:2353
typename GridOrTreeOrRootT::LeafNodeType Type
Definition NanoVDB.h:2352
typename GridOrTreeOrRootT::RootType::ChildNodeType::ChildNodeType Type
Definition NanoVDB.h:2367
typename GridOrTreeOrRootT::RootType::ChildNodeType::ChildNodeType type
Definition NanoVDB.h:2368
typename GridOrTreeOrRootT::RootType::ChildNodeType Type
Definition NanoVDB.h:2381
typename GridOrTreeOrRootT::RootType::ChildNodeType type
Definition NanoVDB.h:2382
typename GridOrTreeOrRootT::RootType type
Definition NanoVDB.h:2396
typename GridOrTreeOrRootT::RootType Type
Definition NanoVDB.h:2395
const typename GridOrTreeOrRootT::LeafNodeType Type
Definition NanoVDB.h:2359
const typename GridOrTreeOrRootT::LeafNodeType type
Definition NanoVDB.h:2360
const typename GridOrTreeOrRootT::RootType::ChildNodeType::ChildNodeType Type
Definition NanoVDB.h:2374
const typename GridOrTreeOrRootT::RootType::ChildNodeType::ChildNodeType type
Definition NanoVDB.h:2375
const typename GridOrTreeOrRootT::RootType::ChildNodeType type
Definition NanoVDB.h:2389
const typename GridOrTreeOrRootT::RootType::ChildNodeType Type
Definition NanoVDB.h:2388
const typename GridOrTreeOrRootT::RootType type
Definition NanoVDB.h:2404
const typename GridOrTreeOrRootT::RootType Type
Definition NanoVDB.h:2403
Struct to derive node type from its level in a given grid, tree or root while preserving constness.
Definition NanoVDB.h:2345
uint32_t mLevel
Definition NanoVDB.h:4664
ValueType mMaximum
Definition NanoVDB.h:4667
uint32_t mDim
Definition NanoVDB.h:4665
FloatType mAverage
Definition NanoVDB.h:4668
CoordType mBBoxMax
Definition NanoVDB.h:4671
ValueType mMinimum
Definition NanoVDB.h:4666
CoordType mBBoxMin
Definition NanoVDB.h:4670
FloatType mStdDevi
Definition NanoVDB.h:4669
Definition NanoVDB.h:3003
ValueT value
Definition NanoVDB.h:3025
void setChild(const CoordType &k, const ChildT *ptr, const RootData *data)
Definition NanoVDB.h:3005
uint32_t state
Definition NanoVDB.h:3024
bool isActive() const
Definition NanoVDB.h:3020
KeyT key
Definition NanoVDB.h:3022
void setValue(const CoordType &k, bool s, const ValueType &v)
Definition NanoVDB.h:3011
CoordT origin() const
Definition NanoVDB.h:3021
bool isValue() const
Definition NanoVDB.h:3019
bool isChild() const
Definition NanoVDB.h:3018
int64_t child
Definition NanoVDB.h:3023
Struct with all the member data of the RootNode (useful during serialization of an openvdb RootNode)
Definition NanoVDB.h:2955
StatsT mAverage
Definition NanoVDB.h:2992
typename ChildT::CoordType CoordT
Definition NanoVDB.h:2958
static CoordT KeyToCoord(const KeyT &key)
Definition NanoVDB.h:2974
const ChildT * getChild(const Tile *tile) const
Definition NanoVDB.h:3050
RootData()=delete
This class cannot be constructed or deleted.
ValueT mBackground
Definition NanoVDB.h:2989
Tile * tile(uint32_t n)
Definition NanoVDB.h:3036
const Tile * tile(uint32_t n) const
Returns a non-const reference to the tile at the specified linear offset.
Definition NanoVDB.h:3031
uint32_t mTableSize
Definition NanoVDB.h:2987
const ValueT & getMax() const
Definition NanoVDB.h:3057
void setDev(const StatsT &v)
Definition NanoVDB.h:3064
uint64_t KeyT
Return a key based on the coordinates of a voxel.
Definition NanoVDB.h:2964
void setMin(const ValueT &v)
Definition NanoVDB.h:3061
typename ChildT::FloatType StatsT
Definition NanoVDB.h:2959
typename ChildT::BuildType BuildT
Definition NanoVDB.h:2957
ChildT * getChild(const Tile *tile)
Returns a const reference to the child node in the specified tile.
Definition NanoVDB.h:3045
static constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition NanoVDB.h:2998
const ValueT & getMin() const
Definition NanoVDB.h:3056
void setMax(const ValueT &v)
Definition NanoVDB.h:3062
StatsT mStdDevi
Definition NanoVDB.h:2993
RootData(const RootData &)=delete
static KeyT CoordToKey(const CoordType &ijk)
Definition NanoVDB.h:2966
RootData & operator=(const RootData &)=delete
BBox< CoordT > mBBox
Definition NanoVDB.h:2986
ValueT mMaximum
Definition NanoVDB.h:2991
const StatsT & stdDeviation() const
Definition NanoVDB.h:3059
const StatsT & average() const
Definition NanoVDB.h:3058
void setAvg(const StatsT &v)
Definition NanoVDB.h:3063
typename ChildT::ValueType ValueT
Definition NanoVDB.h:2956
ValueT mMinimum
Definition NanoVDB.h:2990
T ElementType
Definition NanoVDB.h:1437
static T scalar(const T &s)
Definition NanoVDB.h:1438
static ElementType scalar(const T &v)
Definition NanoVDB.h:1449
typename T::ValueType ElementType
Definition NanoVDB.h:1448
Definition NanoVDB.h:1428
static double value()
Definition NanoVDB.h:697
static float value()
Definition NanoVDB.h:692
Tolerance for floating-point comparison.
Definition NanoVDB.h:688
Definition NanoVDB.h:2759
const RootT * getRoot() const
Definition NanoVDB.h:2771
void setFirstNode(const NodeT *node)
Definition NanoVDB.h:2774
RootT * getRoot()
Definition NanoVDB.h:2769
void setRoot(const RootT *root)
Definition NanoVDB.h:2767
uint64_t mVoxelCount
Definition NanoVDB.h:2764
T type
Definition NanoVDB.h:378
C++11 implementation of std::enable_if.
Definition NanoVDB.h:372
static constexpr bool value
Definition NanoVDB.h:386
C++11 implementation of std::is_floating_point.
Definition NanoVDB.h:414
static const bool value
Definition NanoVDB.h:415
C++11 implementation of std::is_same.
Definition NanoVDB.h:357
static constexpr bool value
Definition NanoVDB.h:358
Metafunction used to determine if the first template parameter is a specialization of the class templ...
Definition NanoVDB.h:427
static const bool value
Definition NanoVDB.h:428
T type
Definition NanoVDB.h:406
T type
Definition NanoVDB.h:400
Definition NanoVDB.h:3429
ValueT value
Definition NanoVDB.h:3430
Tile(const Tile &)=delete
Tile & operator=(const Tile &)=delete
Tile()=delete
This class cannot be constructed or deleted.
int64_t child
Definition NanoVDB.h:3431