118 #ifndef NANOVDB_NANOVDB_H_HAS_BEEN_INCLUDED 119 #define NANOVDB_NANOVDB_H_HAS_BEEN_INCLUDED 121 #define NANOVDB_MAGIC_NUMBER 0x304244566f6e614eUL // "NanoVDB0" in hex - little endian (uint64_t) 123 #define NANOVDB_MAJOR_VERSION_NUMBER 32 // reflects changes to the ABI and hence also the file format 124 #define NANOVDB_MINOR_VERSION_NUMBER 4 // reflects changes to the API but not ABI 125 #define NANOVDB_PATCH_VERSION_NUMBER 2 // reflects changes that does not affect the ABI or API 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) 141 #endif // !defined(NANOVDB_ALIGN) 143 #ifdef __CUDACC_RTC__ 145 typedef signed char int8_t;
146 typedef short int16_t;
148 typedef long long int64_t;
149 typedef unsigned char uint8_t;
150 typedef unsigned int uint32_t;
151 typedef unsigned short uint16_t;
152 typedef unsigned long long uint64_t;
154 #define NANOVDB_ASSERT(x) 156 #define UINT64_C(x) (x ## ULL) 158 #else // !__CUDACC_RTC__ 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) 186 #endif // __CUDACC_RTC__ 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)];
355 template<
typename T1,
typename T2>
358 static constexpr
bool value =
false;
370 template <
bool,
typename T =
void>
375 template <
typename T>
386 static constexpr
bool value =
false;
425 template<
typename AnyType,
template<
typename...>
class TemplateType>
430 template<
typename... Args,
template<
typename...>
class TemplateType>
439 template <
typename T>
517 template <
typename T>
525 template <
typename T>
529 return reinterpret_cast<const T*
>( (
const uint8_t*)p +
alignmentPadding(p) );
534 template <
typename T1,
typename T2>
538 return reinterpret_cast<const char*
>(p) - reinterpret_cast<const char*>(q);
541 template <
typename DstT,
typename SrcT>
545 return reinterpret_cast<DstT*
>(
reinterpret_cast<char*
>(p) + offset);
548 template <
typename DstT,
typename SrcT>
552 return reinterpret_cast<const DstT*
>(
reinterpret_cast<const char*
>(p) + offset);
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]);
657 : mData( major << 21 | minor << 10 | patch )
673 #ifndef __CUDACC_RTC__ 676 char *buffer = (
char*)malloc(4 + 1 + 4 + 1 + 4 + 1);
721 #if defined(__CUDA_ARCH__) || defined(__HIP__) 728 struct Maximum<uint32_t>
733 struct Maximum<float>
738 struct Maximum<double>
751 template<
typename Type>
757 template<
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)));
778 template<
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)));
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;
877 template<
typename CoordT,
typename RealT,
template<
typename>
class Vec3T>
880 template<
typename CoordT,
template<
typename>
class Vec3T>
883 return CoordT(int32_t(rintf(xyz[0])), int32_t(rintf(xyz[1])), int32_t(rintf(xyz[2])));
888 template<
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)));
894 template<
typename CoordT,
typename RealT,
template<
typename>
class Vec3T>
913 template <
typename T>
914 __hostdev__ inline T
Sign(
const T &x) {
return ((T(0) < x)?T(1):T(0)) - ((x < T(0))?T(1):T(0)); }
916 template<
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])
933 template<
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])
953 template<u
int64_t wordSize>
956 const uint64_t r = byteCount % wordSize;
957 return r ? byteCount - r + wordSize : byteCount;
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>
1137 template<
int Log2N = 3 + 4 + 5>
1138 __hostdev__ uint32_t
hash()
const {
return ((1 << Log2N) - 1) & (mVec[0] * 73856093 ^ mVec[1] * 19349663 ^ mVec[2] * 83492791); }
1143 (uint8_t(
bool(mVec[1] & (1u << 31))) << 1) |
1144 (uint8_t(
bool(mVec[2] & (1u << 31))) << 2)); }
1156 template<
typename T>
1173 template<
typename T2>
1175 : mVec{T(v[0]), T(v[1]), T(v[2])}
1179 : mVec{T(ijk[0]), T(ijk[1]), T(ijk[2])}
1184 template<
typename Vec3T>
1194 template<
typename Vec3T>
1195 __hostdev__ T
dot(
const Vec3T& v)
const {
return mVec[0] * v[0] + mVec[1] * v[1] + mVec[2] * v[2]; }
1196 template<
typename Vec3T>
1199 return Vec3(mVec[1] * v[2] - mVec[2] * v[1],
1200 mVec[2] * v[0] - mVec[0] * v[2],
1201 mVec[0] * v[1] - mVec[1] * v[0]);
1205 return mVec[0] * mVec[0] + mVec[1] * mVec[1] + mVec[2] * mVec[2];
1241 if (other[0] < mVec[0])
1243 if (other[1] < mVec[1])
1245 if (other[2] < mVec[2])
1253 if (other[0] > mVec[0])
1255 if (other[1] > mVec[1])
1257 if (other[2] > mVec[2])
1264 return mVec[0] < mVec[1] ? (mVec[0] < mVec[2] ? mVec[0] : mVec[2]) : (mVec[1] < mVec[2] ? mVec[1] : mVec[2]);
1269 return mVec[0] > mVec[1] ? (mVec[0] > mVec[2] ? mVec[0] : mVec[2]) : (mVec[1] > mVec[2] ? mVec[1] : mVec[2]);
1276 template<
typename T1,
typename T2>
1279 return Vec3<T2>(scalar * vec[0], scalar * vec[1], scalar * vec[2]);
1281 template<
typename T1,
typename T2>
1284 return Vec3<T2>(scalar / vec[0], scalar / vec[1], scalar / vec[2]);
1301 template<
typename T>
1318 template<
typename T2>
1320 : mVec{T(v[0]), T(v[1]), T(v[2]), T(v[3])}
1323 __hostdev__ bool operator==(
const Vec4& rhs)
const {
return mVec[0] == rhs[0] && mVec[1] == rhs[1] && mVec[2] == rhs[2] && mVec[3] == rhs[3]; }
1324 __hostdev__ bool operator!=(
const Vec4& rhs)
const {
return mVec[0] != rhs[0] || mVec[1] != rhs[1] || mVec[2] != rhs[2] || mVec[3] != rhs[3]; }
1325 template<
typename Vec4T>
1336 template<
typename Vec4T>
1337 __hostdev__ T
dot(
const Vec4T& v)
const {
return mVec[0] * v[0] + mVec[1] * v[1] + mVec[2] * v[2] + mVec[3] * v[3]; }
1340 return mVec[0] * mVec[0] + mVec[1] * mVec[1] + mVec[2] * mVec[2] + mVec[3] * mVec[3];
1379 if (other[0] < mVec[0])
1381 if (other[1] < mVec[1])
1383 if (other[2] < mVec[2])
1385 if (other[3] < mVec[3])
1393 if (other[0] > mVec[0])
1395 if (other[1] > mVec[1])
1397 if (other[2] > mVec[2])
1399 if (other[3] > mVec[3])
1405 template<
typename T1,
typename T2>
1408 return Vec4<T2>(scalar * vec[0], scalar * vec[1], scalar * vec[2], scalar * vec[3]);
1410 template<
typename T1,
typename T2>
1413 return Vec4<T2>(scalar / vec[0], scalar / vec[1], scalar / vec[2], scalar / vec[3]);
1428 template<
typename T>
1431 static const int Rank = 0;
1432 static const bool IsScalar =
true;
1433 static const bool IsVector =
false;
1434 static const int Size = 1;
1439 template<
typename T>
1442 static const int Rank = 1;
1443 static const bool IsScalar =
false;
1444 static const bool IsVector =
true;
1445 static const int Size = T::SIZE;
1452 template<typename T, int = sizeof(typename TensorTraits<T>::ElementType)>
1458 template<
typename T>
1485 template<
typename BuildT>
1530 template<
typename Vec3T>
1533 return Vec3T(fmaf(xyz[0], mat[0], fmaf(xyz[1], mat[1], xyz[2] * mat[2])),
1534 fmaf(xyz[0], mat[3], fmaf(xyz[1], mat[4], xyz[2] * mat[5])),
1535 fmaf(xyz[0], mat[6], fmaf(xyz[1], mat[7], xyz[2] * mat[8])));
1538 template<
typename Vec3T>
1541 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])),
1542 fma(static_cast<double>(xyz[0]), mat[3], fma(static_cast<double>(xyz[1]), mat[4], static_cast<double>(xyz[2]) * mat[5])),
1543 fma(static_cast<double>(xyz[0]), mat[6], fma(static_cast<double>(xyz[1]), mat[7], static_cast<double>(xyz[2]) * mat[8])));
1546 template<
typename Vec3T>
1549 return Vec3T(fmaf(xyz[0], mat[0], fmaf(xyz[1], mat[1], fmaf(xyz[2], mat[2], vec[0]))),
1550 fmaf(xyz[0], mat[3], fmaf(xyz[1], mat[4], fmaf(xyz[2], mat[5], vec[1]))),
1551 fmaf(xyz[0], mat[6], fmaf(xyz[1], mat[7], fmaf(xyz[2], mat[8], vec[2]))));
1554 template<
typename Vec3T>
1557 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]))),
1558 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]))),
1559 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]))));
1564 template<
typename Vec3T>
1567 return Vec3T(fmaf(xyz[0], mat[0], fmaf(xyz[1], mat[3], xyz[2] * mat[6])),
1568 fmaf(xyz[0], mat[1], fmaf(xyz[1], mat[4], xyz[2] * mat[7])),
1569 fmaf(xyz[0], mat[2], fmaf(xyz[1], mat[5], xyz[2] * mat[8])));
1572 template<
typename Vec3T>
1575 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])),
1576 fma(static_cast<double>(xyz[0]), mat[1], fma(static_cast<double>(xyz[1]), mat[4], static_cast<double>(xyz[2]) * mat[7])),
1577 fma(static_cast<double>(xyz[0]), mat[2], fma(static_cast<double>(xyz[1]), mat[5], static_cast<double>(xyz[2]) * mat[8])));
1580 template<
typename Vec3T>
1583 return Vec3T(fmaf(xyz[0], mat[0], fmaf(xyz[1], mat[3], fmaf(xyz[2], mat[6], vec[0]))),
1584 fmaf(xyz[0], mat[1], fmaf(xyz[1], mat[4], fmaf(xyz[2], mat[7], vec[1]))),
1585 fmaf(xyz[0], mat[2], fmaf(xyz[1], mat[5], fmaf(xyz[2], mat[8], vec[2]))));
1588 template<
typename Vec3T>
1591 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]))),
1592 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]))),
1593 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]))));
1599 template<
typename Vec3T>
1620 mCoord[0].minComponent(xyz);
1621 mCoord[1].maxComponent(xyz);
1661 template<
typename Vec3T>
1668 using BaseT::mCoord;
1690 mCoord[0][1] >= mCoord[1][1] ||
1691 mCoord[0][2] >= mCoord[1][2]; }
1695 return p[0] > mCoord[0][0] && p[1] > mCoord[0][1] && p[2] > mCoord[0][2] &&
1696 p[0] < mCoord[1][0] && p[1] < mCoord[1][1] && p[2] < mCoord[1][2];
1705 template<
typename CoordT>
1710 using BaseT::mCoord;
1725 if (mPos[2] < mBBox[1][2]) {
1727 }
else if (mPos[1] < mBBox[1][1]) {
1728 mPos[2] = mBBox[0][2];
1730 }
else if (mPos[0] <= mBBox[1][0]) {
1731 mPos[2] = mBBox[0][2];
1732 mPos[1] = mBBox[0][1];
1757 template<
typename SplitT>
1759 :
BaseT(other.mCoord[0], other.mCoord[1])
1762 const int n =
MaxIndex(this->dim());
1763 mCoord[1][n] = (mCoord[0][n] + mCoord[1][n]) >> 1;
1764 other.mCoord[0][n] = mCoord[1][n] + 1;
1773 mCoord[0][1] < mCoord[1][1] &&
1774 mCoord[0][2] < mCoord[1][2]; }
1777 mCoord[0][1] > mCoord[1][1] ||
1778 mCoord[0][2] > mCoord[1][2]; }
1780 __hostdev__ uint64_t
volume()
const {
auto d = this->dim();
return uint64_t(d[0])*uint64_t(d[1])*uint64_t(d[2]); }
1785 return !(CoordT::lessThan(b.min(), this->
min()) || CoordT::lessThan(this->
max(), b.max()));
1791 return !(CoordT::lessThan(this->
max(), b.min()) || CoordT::lessThan(b.max(), this->
min()));
1795 template<
typename RealT>
1800 Vec3<RealT>(RealT(mCoord[1][0] + 1), RealT(mCoord[1][1] + 1), RealT(mCoord[1][2] + 1)));
1805 return BBox(mCoord[0].offsetBy(-padding), mCoord[1].offsetBy(padding));
1821 #if (defined(__CUDA_ARCH__) || defined(__HIP__)) && defined(NANOVDB_USE_INTRINSICS) 1823 #elif defined(_MSC_VER) && defined(NANOVDB_USE_INTRINSICS) 1824 unsigned long index;
1825 _BitScanForward(&index, v);
1826 return static_cast<uint32_t
>(index);
1827 #elif (defined(__GNUC__) || defined(__clang__)) && defined(NANOVDB_USE_INTRINSICS) 1828 return static_cast<uint32_t
>(__builtin_ctzl(v));
1831 static const unsigned char DeBruijn[32] = {
1832 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};
1834 #if defined(_MSC_VER) && !defined(__NVCC__) 1835 #pragma warning(push) 1836 #pragma warning(disable : 4146) 1838 return DeBruijn[uint32_t((v & -v) * 0x077CB531U) >> 27];
1839 #if defined(_MSC_VER) && !defined(__NVCC__) 1840 #pragma warning(pop) 1853 #if defined(_MSC_VER) && defined(NANOVDB_USE_INTRINSICS) 1854 unsigned long index;
1855 _BitScanReverse(&index, v);
1856 return static_cast<uint32_t
>(index);
1857 #elif (defined(__GNUC__) || defined(__clang__)) && defined(NANOVDB_USE_INTRINSICS) 1858 return sizeof(
unsigned long) * 8 - 1 - __builtin_clzl(v);
1861 static const unsigned char DeBruijn[32] = {
1862 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};
1868 return DeBruijn[uint32_t(v * 0x07C4ACDDU) >> 27];
1879 #if (defined(__CUDA_ARCH__) || defined(__HIP__)) && defined(NANOVDB_USE_INTRINSICS) 1881 #elif defined(_MSC_VER) && defined(NANOVDB_USE_INTRINSICS) 1882 unsigned long index;
1883 _BitScanForward64(&index, v);
1884 return static_cast<uint32_t
>(index);
1885 #elif (defined(__GNUC__) || defined(__clang__)) && defined(NANOVDB_USE_INTRINSICS) 1886 return static_cast<uint32_t
>(__builtin_ctzll(v));
1889 static const unsigned char DeBruijn[64] = {
1890 0, 1, 2, 53, 3, 7, 54, 27, 4, 38, 41, 8, 34, 55, 48, 28,
1891 62, 5, 39, 46, 44, 42, 22, 9, 24, 35, 59, 56, 49, 18, 29, 11,
1892 63, 52, 6, 26, 37, 40, 33, 47, 61, 45, 43, 21, 23, 58, 17, 10,
1893 51, 25, 36, 32, 60, 20, 57, 16, 50, 31, 19, 15, 30, 14, 13, 12,
1896 #if defined(_MSC_VER) && !defined(__NVCC__) 1897 #pragma warning(push) 1898 #pragma warning(disable : 4146) 1900 return DeBruijn[uint64_t((v & -v) * UINT64_C(0x022FDD63CC95386D)) >> 58];
1901 #if defined(_MSC_VER) && !defined(__NVCC__) 1902 #pragma warning(pop) 1915 #if defined(_MSC_VER) && defined(NANOVDB_USE_INTRINSICS) 1916 unsigned long index;
1917 _BitScanReverse64(&index, v);
1918 return static_cast<uint32_t
>(index);
1919 #elif (defined(__GNUC__) || defined(__clang__)) && defined(NANOVDB_USE_INTRINSICS) 1920 return sizeof(
unsigned long) * 8 - 1 - __builtin_clzll(v);
1922 const uint32_t* p =
reinterpret_cast<const uint32_t*
>(&v);
1933 #if (defined(__CUDA_ARCH__) || defined(__HIP__)) && defined(NANOVDB_USE_INTRINSICS) 1937 #elif defined(_MSC_VER) && defined(_M_X64) && (_MSC_VER >= 1928) && defined(NANOVDB_USE_INTRINSICS) 1939 return __popcnt64(v);
1940 #elif (defined(__GNUC__) || defined(__clang__)) && defined(NANOVDB_USE_INTRINSICS) 1942 return __builtin_popcountll(v);
1943 #else// use software implementation 1945 v = v - ((v >> 1) & uint64_t(0x5555555555555555));
1946 v = (v & uint64_t(0x3333333333333333)) + ((v >> 2) & uint64_t(0x3333333333333333));
1947 return (((v + (v >> 4)) & uint64_t(0xF0F0F0F0F0F0F0F)) * uint64_t(0x101010101010101)) >> 56;
1955 template<u
int32_t LOG2DIM>
1958 static constexpr uint32_t SIZE = 1U << (3 * LOG2DIM);
1959 static constexpr uint32_t WORD_COUNT = SIZE >> 6;
1960 uint64_t mWords[WORD_COUNT];
1975 uint32_t sum = 0, n = WORD_COUNT;
1976 for (
const uint64_t* w = mWords; n--; ++w)
1984 uint32_t n = i >> 6, sum =
CountOn( mWords[n] & ((uint64_t(1) << (i & 63u))-1u) );
1985 for (
const uint64_t* w = mWords; n--; ++w) sum +=
CountOn(*w);
2001 mPos = mParent->findNext<On>(mPos + 1);
2013 const Mask* mParent;
2026 for (uint32_t i = 0; i < WORD_COUNT; ++i)
2031 const uint64_t v = on ? ~uint64_t(0) : uint64_t(0);
2032 for (uint32_t i = 0; i < WORD_COUNT; ++i)
2039 for (uint32_t i = 0; i < WORD_COUNT; ++i)
2040 mWords[i] = other.mWords[i];
2044 template<
typename WordT>
2048 return reinterpret_cast<const WordT*
>(mWords)[n];
2052 template<
typename WordT>
2056 return reinterpret_cast<WordT*
>(mWords)[n];
2060 template<
typename MaskT>
2063 static_assert(
sizeof(
Mask) ==
sizeof(MaskT),
"Mismatching sizeof");
2064 static_assert(WORD_COUNT == MaskT::WORD_COUNT,
"Mismatching word count");
2065 static_assert(LOG2DIM == MaskT::LOG2DIM,
"Mismatching LOG2DIM");
2066 auto *src =
reinterpret_cast<const uint64_t*
>(&other);
2067 uint64_t *dst = mWords;
2068 for (uint32_t i = 0; i < WORD_COUNT; ++i) {
2076 for (uint32_t i = 0; i < WORD_COUNT; ++i) {
2077 if (mWords[i] != other.mWords[i])
return false;
2085 __hostdev__ bool isOn(uint32_t n)
const {
return 0 != (mWords[n >> 6] & (uint64_t(1) << (n & 63))); }
2088 __hostdev__ bool isOff(uint32_t n)
const {
return 0 == (mWords[n >> 6] & (uint64_t(1) << (n & 63))); }
2093 for (uint32_t i = 0; i < WORD_COUNT; ++i)
2094 if (mWords[i] != ~uint64_t(0))
2102 for (uint32_t i = 0; i < WORD_COUNT; ++i)
2103 if (mWords[i] != uint64_t(0))
2117 #if 1 // switch between branchless 2118 auto &word = mWords[n >> 6];
2120 word &= ~(uint64_t(1) << n);
2121 word |= uint64_t(On) << n;
2130 for (uint32_t i = 0; i < WORD_COUNT; ++i)
2131 mWords[i] = ~uint64_t(0);
2137 for (uint32_t i = 0; i < WORD_COUNT; ++i)
2138 mWords[i] = uint64_t(0);
2144 const uint64_t v = on ? ~uint64_t(0) : uint64_t(0);
2145 for (uint32_t i = 0; i < WORD_COUNT; ++i)
2151 uint32_t n = WORD_COUNT;
2152 for (
auto* w = mWords; n--; ++w)
2160 uint64_t *w1 = mWords;
2161 const uint64_t *w2 = other.mWords;
2162 for (uint32_t n = WORD_COUNT; n--; ++w1, ++w2) *w1 &= *w2;
2168 uint64_t *w1 = mWords;
2169 const uint64_t *w2 = other.mWords;
2170 for (uint32_t n = WORD_COUNT; n--; ++w1, ++w2) *w1 |= *w2;
2176 uint64_t *w1 = mWords;
2177 const uint64_t *w2 = other.mWords;
2178 for (uint32_t n = WORD_COUNT; n--; ++w1, ++w2) *w1 &= ~*w2;
2184 uint64_t *w1 = mWords;
2185 const uint64_t *w2 = other.mWords;
2186 for (uint32_t n = WORD_COUNT; n--; ++w1, ++w2) *w1 ^= *w2;
2197 const uint64_t* w = mWords;
2198 for (; n<WORD_COUNT && !(On ? *w : ~*w); ++w, ++n);
2199 return n==WORD_COUNT ? SIZE : (n << 6) +
FindLowestOn(On ? *w : ~*w);
2204 __hostdev__ uint32_t findNext(uint32_t start)
const 2206 uint32_t n = start >> 6;
2207 if (n >= WORD_COUNT)
2209 uint32_t m = start & 63;
2210 uint64_t b = On ? mWords[n] : ~mWords[n];
2211 if (b & (uint64_t(1) << m))
2213 b &= ~uint64_t(0) << m;
2214 while (!b && ++n < WORD_COUNT)
2215 b = On ? mWords[n] : ~mWords[n];
2235 template<
typename Mat3T,
typename Vec3T>
2236 __hostdev__ void set(
const Mat3T& mat,
const Mat3T& invMat,
const Vec3T& translate,
double taper);
2240 template<
typename Mat4T>
2241 __hostdev__ void set(
const Mat4T& mat,
const Mat4T& invMat,
double taper) {this->
set(mat, invMat, mat[3], taper);}
2243 template<
typename Vec3T>
2244 __hostdev__ void set(
double scale,
const Vec3T &translation,
double taper);
2246 template<
typename Vec3T>
2248 template<
typename Vec3T>
2251 template<
typename Vec3T>
2253 template<
typename Vec3T>
2256 template<
typename Vec3T>
2261 template<
typename Vec3T>
2267 template<
typename Vec3T>
2269 template<
typename Vec3T>
2272 template<
typename Vec3T>
2274 template<
typename Vec3T>
2278 template<
typename Mat3T,
typename Vec3T>
2283 mTaperF =
static_cast<float>(taper);
2285 for (
int i = 0; i < 3; ++i) {
2286 *vd++ = translate[i];
2287 *vf++ =
static_cast<float>(translate[i]);
2288 for (
int j = 0; j < 3; ++j) {
2290 *mid++ = invMat[j][i];
2291 *mf++ =
static_cast<float>(mat[j][i]);
2292 *mif++ =
static_cast<float>(invMat[j][i]);
2297 template<
typename Vec3T>
2300 const double mat[3][3] = {
2304 }, idx = 1.0/dx, invMat[3][3] = {
2309 this->
set(mat, invMat, trans, taper);
2316 static const int MaxNameSize = 256;
2323 char mName[MaxNameSize];
2333 template <
typename T>
2342 template<
typename Gr
idOrTreeOrRootT,
int LEVEL>
2346 template<
typename Gr
idOrTreeOrRootT>
2349 static_assert(GridOrTreeOrRootT::RootType::LEVEL == 3,
"Tree depth is not supported");
2350 using Type =
typename GridOrTreeOrRootT::LeafNodeType;
2351 using type =
typename GridOrTreeOrRootT::LeafNodeType;
2353 template<
typename Gr
idOrTreeOrRootT>
2356 static_assert(GridOrTreeOrRootT::RootType::LEVEL == 3,
"Tree depth is not supported");
2357 using Type =
const typename GridOrTreeOrRootT::LeafNodeType;
2358 using type =
const typename GridOrTreeOrRootT::LeafNodeType;
2361 template<
typename Gr
idOrTreeOrRootT>
2364 static_assert(GridOrTreeOrRootT::RootType::LEVEL == 3,
"Tree depth is not supported");
2365 using Type =
typename GridOrTreeOrRootT::RootType::ChildNodeType::ChildNodeType;
2366 using type =
typename GridOrTreeOrRootT::RootType::ChildNodeType::ChildNodeType;
2368 template<
typename Gr
idOrTreeOrRootT>
2371 static_assert(GridOrTreeOrRootT::RootType::LEVEL == 3,
"Tree depth is not supported");
2372 using Type =
const typename GridOrTreeOrRootT::RootType::ChildNodeType::ChildNodeType;
2373 using type =
const typename GridOrTreeOrRootT::RootType::ChildNodeType::ChildNodeType;
2375 template<
typename Gr
idOrTreeOrRootT>
2378 static_assert(GridOrTreeOrRootT::RootType::LEVEL == 3,
"Tree depth is not supported");
2379 using Type =
typename GridOrTreeOrRootT::RootType::ChildNodeType;
2380 using type =
typename GridOrTreeOrRootT::RootType::ChildNodeType;
2382 template<
typename Gr
idOrTreeOrRootT>
2385 static_assert(GridOrTreeOrRootT::RootType::LEVEL == 3,
"Tree depth is not supported");
2386 using Type =
const typename GridOrTreeOrRootT::RootType::ChildNodeType;
2387 using type =
const typename GridOrTreeOrRootT::RootType::ChildNodeType;
2389 template<
typename Gr
idOrTreeOrRootT>
2392 static_assert(GridOrTreeOrRootT::RootType::LEVEL == 3,
"Tree depth is not supported");
2393 using Type =
typename GridOrTreeOrRootT::RootType;
2394 using type =
typename GridOrTreeOrRootT::RootType;
2397 template<
typename Gr
idOrTreeOrRootT>
2400 static_assert(GridOrTreeOrRootT::RootType::LEVEL == 3,
"Tree depth is not supported");
2401 using Type =
const typename GridOrTreeOrRootT::RootType;
2402 using type =
const typename GridOrTreeOrRootT::RootType;
2433 static const int MaxNameSize = 256;
2441 char mGridName[MaxNameSize];
2504 template<
typename Vec3T>
2506 template<
typename Vec3T>
2508 template<
typename Vec3T>
2510 template<
typename Vec3T>
2512 template<
typename Vec3T>
2515 template<
typename Vec3T>
2517 template<
typename Vec3T>
2519 template<
typename Vec3T>
2521 template<
typename Vec3T>
2523 template<
typename Vec3T>
2538 return PtrAdd<GridBlindMetaData>(
this, mBlindMetadataOffset) + n;
2544 template <
typename BuildT,
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1>
2547 template <
typename BuildT>
2554 template<
typename TreeT>
2570 Grid& operator=(
const Grid&) =
delete;
2594 template <
typename T = BuildType>
2598 __hostdev__ const TreeT&
tree()
const {
return *
reinterpret_cast<const TreeT*
>(this->treePtr()); }
2613 template<
typename Vec3T>
2617 template<
typename Vec3T>
2622 template<
typename Vec3T>
2627 template<
typename Vec3T>
2632 template<
typename Vec3T>
2636 template<
typename Vec3T>
2640 template<
typename Vec3T>
2645 template<
typename Vec3T>
2650 template<
typename Vec3T>
2655 template<
typename Vec3T>
2691 template <
typename NodeT>
2696 template <
int LEVEL>
2702 if (this->hasLongGridName()) {
2704 const auto &metaData = this->blindMetaData(DataType::mBlindMetadataCount-1);
2706 return metaData.template getBlindData<const char>();
2708 return DataType::mGridName;
2731 if (DataType::mBlindMetadataCount == 0u) {
2735 return this->blindMetaData(n).template getBlindData<void>();
2744 template<
typename TreeT>
2747 for (uint32_t i = 0, n = this->blindDataCount(); i < n; ++i)
2748 if (this->blindMetaData(i).mSemantic == semantic)
2755 template<
int ROOT_LEVEL = 3>
2758 static_assert(
ROOT_LEVEL == 3,
"Root level is assumed to be three");
2759 uint64_t mNodeOffset[4];
2760 uint32_t mNodeCount[3];
2761 uint32_t mTileCount[3];
2764 template <
typename RootT>
2766 template <
typename RootT>
2768 template <
typename RootT>
2771 template <
typename NodeT>
2774 mNodeOffset[NodeT::LEVEL] = node ?
PtrDiff(node,
this) : 0;
2781 template<
typename Gr
idT>
2784 using Type =
typename GridT::TreeType;
2785 using type =
typename GridT::TreeType;
2787 template<
typename Gr
idT>
2790 using Type =
const typename GridT::TreeType;
2791 using type =
const typename GridT::TreeType;
2797 template<
typename RootT>
2800 static_assert(RootT::LEVEL == 3,
"Tree depth is not supported");
2801 static_assert(RootT::ChildNodeType::LOG2DIM == 5,
"Tree configuration is not supported");
2802 static_assert(RootT::ChildNodeType::ChildNodeType::LOG2DIM == 4,
"Tree configuration is not supported");
2803 static_assert(RootT::LeafNodeType::LOG2DIM == 3,
"Tree configuration is not supported");
2815 using Node2 =
typename RootT::ChildNodeType;
2816 using Node1 =
typename Node2::ChildNodeType;
2822 Tree& operator=(
const Tree&) =
delete;
2870 return DataType::mTileCount[level - 1];
2873 template<
typename NodeT>
2876 static_assert(NodeT::LEVEL < 3,
"Invalid NodeT");
2877 return DataType::mNodeCount[NodeT::LEVEL];
2883 return DataType::mNodeCount[level];
2889 template <
typename NodeT>
2892 const uint64_t offset = DataType::mNodeOffset[NodeT::LEVEL];
2893 return offset>0 ? PtrAdd<NodeT>(
this, offset) :
nullptr;
2899 template <
typename NodeT>
2902 const uint64_t offset = DataType::mNodeOffset[NodeT::LEVEL];
2903 return offset>0 ? PtrAdd<NodeT>(
this, offset) :
nullptr;
2909 template <
int LEVEL>
2913 return this->
template getFirstNode<typename NodeTrait<RootT,LEVEL>::type>();
2919 template <
int LEVEL>
2923 return this->
template getFirstNode<typename NodeTrait<RootT,LEVEL>::type>();
2939 template<
typename RootT>
2942 min = this->root().minimum();
2943 max = this->root().maximum();
2951 template<
typename ChildT>
2958 static constexpr
bool FIXED_SIZE =
false;
2961 #ifdef USE_SINGLE_ROOT_KEY 2963 template <
typename CoordType>
2966 static_assert(
sizeof(
CoordT) ==
sizeof(CoordType),
"Mismatching sizeof");
2967 static_assert(32 - ChildT::TOTAL <= 21,
"Cannot use 64 bit root keys");
2968 return (
KeyT(uint32_t(ijk[2]) >> ChildT::TOTAL)) |
2969 (
KeyT(uint32_t(ijk[1]) >> ChildT::TOTAL) << 21) |
2970 (
KeyT(uint32_t(ijk[0]) >> ChildT::TOTAL) << 42);
2974 static constexpr uint64_t MASK = (1u << 21) - 1;
2975 return CoordT(((key >> 42) & MASK) << ChildT::TOTAL,
2976 ((key >> 21) & MASK) << ChildT::TOTAL,
2977 (key & MASK) << ChildT::TOTAL);
2980 using KeyT = CoordT;
2981 __hostdev__ static KeyT CoordToKey(
const CoordT& ijk) {
return ijk & ~ChildT::MASK; }
2982 __hostdev__ static CoordT KeyToCoord(
const KeyT& key) {
return key; }
3000 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
Tile 3002 template <
typename CoordType>
3005 key = CoordToKey(k);
3008 template <
typename CoordType,
typename ValueType>
3011 key = CoordToKey(k);
3032 return reinterpret_cast<const Tile*
>(
this + 1) + n;
3037 return reinterpret_cast<Tile*
>(
this + 1) + n;
3046 return PtrAdd<ChildT>(
this, tile->
child);
3051 return PtrAdd<ChildT>(
this, tile->
child);
3072 template<
typename ChildT>
3089 static constexpr
bool FIXED_SIZE = DataType::FIXED_SIZE;
3091 static constexpr uint32_t LEVEL = 1 + ChildT::LEVEL;
3096 uint32_t mPos, mSize;
3101 while (mPos<mSize && !mParent->tile(mPos)->isChild()) ++mPos;
3112 while (mPos < mSize && mParent->tile(mPos)->isValue()) ++mPos;
3127 uint32_t mPos, mSize;
3132 while (mPos < mSize && mParent->tile(mPos)->isChild()) ++mPos;
3143 while (mPos < mSize && mParent->tile(mPos)->isChild()) ++mPos;
3158 uint32_t mPos, mSize;
3163 while (mPos < mSize && !mParent->tile(mPos)->isActive()) ++mPos;
3173 while (mPos < mSize && !mParent->tile(mPos)->isActive()) ++mPos;
3233 if (
const Tile* tile = this->probeTile(ijk)) {
3234 return tile->isChild() ? this->getChild(tile)->getValue(ijk) : tile->value;
3236 return DataType::mBackground;
3241 if (
const Tile* tile = this->probeTile(ijk)) {
3242 return tile->isChild() ? this->getChild(tile)->isActive(ijk) : tile->state;
3252 if (
const Tile* tile = this->probeTile(ijk)) {
3253 if (tile->isChild()) {
3254 const auto *
child = this->getChild(tile);
3255 return child->probeValue(ijk, v);
3260 v = DataType::mBackground;
3266 const Tile* tile = this->probeTile(ijk);
3267 if (tile && tile->isChild()) {
3268 const auto *
child = this->getChild(tile);
3269 return child->probeLeaf(ijk);
3276 const Tile* tile = this->probeTile(ijk);
3277 if (tile && tile->isChild()) {
3278 return this->getChild(tile);
3286 const Tile* tiles =
reinterpret_cast<const Tile*
>(
this + 1);
3287 const auto key = DataType::CoordToKey(ijk);
3288 #if 1 // switch between linear and binary seach 3289 for (uint32_t i = 0; i < DataType::mTableSize; ++i) {
3290 if (tiles[i].key == key)
return &tiles[i];
3292 #else// do not enable binary search if tiles are not guaranteed to be sorted!!!!!! 3294 int32_t low = 0, high = DataType::mTableSize;
3295 while (low != high) {
3296 int mid = low + ((high - low) >> 1);
3297 const Tile* tile = &tiles[mid];
3298 if (tile->key == key) {
3300 }
else if (tile->key < key) {
3314 template<
typename,
int,
int,
int>
3321 template<
typename AccT>
3322 __hostdev__ typename AccT::NodeInfo getNodeInfoAndCache(
const CoordType& ijk,
const AccT& acc)
const 3324 using NodeInfoT =
typename AccT::NodeInfo;
3325 if (
const Tile* tile = this->probeTile(ijk)) {
3326 if (tile->isChild()) {
3327 const auto *
child = this->getChild(tile);
3328 acc.insert(ijk,
child);
3329 return child->getNodeInfoAndCache(ijk, acc);
3331 return NodeInfoT{LEVEL, ChildT::dim(), tile->value, tile->value, tile->value,
3332 0, tile->origin(), tile->origin() + CoordType(ChildT::DIM)};
3334 return NodeInfoT{LEVEL, ChildT::dim(), this->minimum(), this->maximum(),
3335 this->average(), this->stdDeviation(), this->bbox()[0], this->bbox()[1]};
3339 template<
typename AccT>
3340 __hostdev__ ValueType getValueAndCache(
const CoordType& ijk,
const AccT& acc)
const 3342 if (
const Tile* tile = this->probeTile(ijk)) {
3343 if (tile->isChild()) {
3344 const auto *
child = this->getChild(tile);
3345 acc.insert(ijk,
child);
3346 return child->getValueAndCache(ijk, acc);
3350 return DataType::mBackground;
3353 template<
typename AccT>
3354 __hostdev__ bool isActiveAndCache(
const CoordType& ijk,
const AccT& acc)
const 3356 const Tile* tile = this->probeTile(ijk);
3357 if (tile && tile->isChild()) {
3358 const auto *
child = this->getChild(tile);
3359 acc.insert(ijk,
child);
3360 return child->isActiveAndCache(ijk, acc);
3365 template<
typename AccT>
3366 __hostdev__ bool probeValueAndCache(
const CoordType& ijk, ValueType& v,
const AccT& acc)
const 3368 if (
const Tile* tile = this->probeTile(ijk)) {
3369 if (tile->isChild()) {
3370 const auto *
child = this->getChild(tile);
3371 acc.insert(ijk,
child);
3372 return child->probeValueAndCache(ijk, v, acc);
3377 v = DataType::mBackground;
3381 template<
typename AccT>
3382 __hostdev__ const LeafNodeType* probeLeafAndCache(
const CoordType& ijk,
const AccT& acc)
const 3384 const Tile* tile = this->probeTile(ijk);
3385 if (tile && tile->isChild()) {
3386 const auto *
child = this->getChild(tile);
3387 acc.insert(ijk,
child);
3388 return child->probeLeafAndCache(ijk, acc);
3393 template<
typename RayT,
typename AccT>
3394 __hostdev__ uint32_t getDimAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const 3396 if (
const Tile* tile = this->probeTile(ijk)) {
3397 if (tile->isChild()) {
3398 const auto *
child = this->getChild(tile);
3399 acc.insert(ijk,
child);
3400 return child->getDimAndCache(ijk, ray, acc);
3402 return 1 << ChildT::TOTAL;
3404 return ChildNodeType::dim();
3416 template<
typename ChildT, u
int32_t LOG2DIM>
3423 using MaskT =
typename ChildT::template MaskType<LOG2DIM>;
3424 static constexpr
bool FIXED_SIZE =
true;
3433 Tile& operator=(
const Tile&) =
delete;
3453 + (1u << (3 * LOG2DIM))*(sizeof(ValueT) > 8u ?
sizeof(
ValueT) : 8u));
3455 alignas(32) Tile mTable[1u << (3 * LOG2DIM)];
3462 mTable[n].child =
PtrDiff(ptr,
this);
3465 template <
typename ValueT>
3469 mTable[n].value = v;
3476 return PtrAdd<ChildT>(
this, mTable[n].child);
3481 return PtrAdd<ChildT>(
this, mTable[n].child);
3487 return mTable[n].value;
3493 return mValueMask.isOn(n);
3498 template <
typename T>
3519 template<
typename ChildT, u
int32_t Log2Dim = ChildT::LOG2DIM + 1>
3530 static constexpr
bool FIXED_SIZE = DataType::FIXED_SIZE;
3531 template<u
int32_t LOG2>
3536 static constexpr uint32_t LOG2DIM = Log2Dim;
3537 static constexpr uint32_t TOTAL = LOG2DIM + ChildT::TOTAL;
3538 static constexpr uint32_t DIM = 1u << TOTAL;
3539 static constexpr uint32_t SIZE = 1u << (3 * LOG2DIM);
3540 static constexpr uint32_t MASK = (1u << TOTAL) - 1u;
3541 static constexpr uint32_t LEVEL = 1 + ChildT::LEVEL;
3542 static constexpr uint64_t NUM_VALUES = uint64_t(1) << (3 * TOTAL);
3637 const uint32_t n = CoordToOffset(ijk);
3638 return DataType::mChildMask.isOn(n) ? this->getChild(n)->getValue(ijk) : DataType::getValue(n);
3643 const uint32_t n = CoordToOffset(ijk);
3644 return DataType::mChildMask.isOn(n) ? this->getChild(n)->isActive(ijk) : DataType::isActive(n);
3650 const uint32_t n = CoordToOffset(ijk);
3651 if (DataType::mChildMask.isOn(n))
3652 return this->getChild(n)->probeValue(ijk, v);
3653 v = DataType::getValue(n);
3654 return DataType::isActive(n);
3659 const uint32_t n = CoordToOffset(ijk);
3660 if (DataType::mChildMask.isOn(n))
3661 return this->getChild(n)->probeLeaf(ijk);
3667 const uint32_t n = CoordToOffset(ijk);
3668 return DataType::mChildMask.isOn(n) ? this->getChild(n) :
nullptr;
3675 return (((ijk[0] & MASK) >> ChildT::TOTAL) << (2 * LOG2DIM)) +
3676 (((ijk[1] & MASK) >> ChildT::TOTAL) << (LOG2DIM)) +
3677 ((ijk[2] & MASK) >> ChildT::TOTAL);
3679 return (((ijk[0] & MASK) >> ChildT::TOTAL) << (2 * LOG2DIM)) |
3680 (((ijk[1] & MASK) >> ChildT::TOTAL) << (LOG2DIM)) |
3681 ((ijk[2] & MASK) >> ChildT::TOTAL);
3689 const uint32_t m = n & ((1 << 2 * LOG2DIM) - 1);
3690 return Coord(n >> 2 * LOG2DIM, m >> LOG2DIM, m & ((1 << LOG2DIM) - 1));
3696 ijk <<= ChildT::TOTAL;
3697 ijk += this->origin();
3703 this->localToGlobalCoord(ijk);
3710 return DataType::mFlags & uint32_t(2);
3717 template<
typename,
int,
int,
int>
3722 template<
typename, u
int32_t>
3726 template<
typename AccT>
3729 const uint32_t n = CoordToOffset(ijk);
3730 if (!DataType::mChildMask.isOn(n))
3731 return DataType::getValue(n);
3732 const ChildT*
child = this->getChild(n);
3733 acc.insert(ijk,
child);
3734 return child->getValueAndCache(ijk, acc);
3737 template<
typename AccT>
3738 __hostdev__ typename AccT::NodeInfo getNodeInfoAndCache(
const CoordType& ijk,
const AccT& acc)
const 3740 using NodeInfoT =
typename AccT::NodeInfo;
3741 const uint32_t n = CoordToOffset(ijk);
3742 if (!DataType::mChildMask.isOn(n)) {
3743 return NodeInfoT{LEVEL, this->dim(), this->minimum(), this->maximum(), this->average(),
3744 this->stdDeviation(), this->bbox()[0], this->bbox()[1]};
3746 const ChildT*
child = this->getChild(n);
3747 acc.insert(ijk,
child);
3748 return child->getNodeInfoAndCache(ijk, acc);
3751 template<
typename AccT>
3752 __hostdev__ bool isActiveAndCache(
const CoordType& ijk,
const AccT& acc)
const 3754 const uint32_t n = CoordToOffset(ijk);
3755 if (!DataType::mChildMask.isOn(n))
3756 return DataType::isActive(n);
3757 const ChildT*
child = this->getChild(n);
3758 acc.insert(ijk,
child);
3759 return child->isActiveAndCache(ijk, acc);
3762 template<
typename AccT>
3763 __hostdev__ bool probeValueAndCache(
const CoordType& ijk, ValueType& v,
const AccT& acc)
const 3765 const uint32_t n = CoordToOffset(ijk);
3766 if (!DataType::mChildMask.isOn(n)) {
3767 v = DataType::getValue(n);
3768 return DataType::isActive(n);
3770 const ChildT*
child = this->getChild(n);
3771 acc.insert(ijk,
child);
3772 return child->probeValueAndCache(ijk, v, acc);
3775 template<
typename AccT>
3776 __hostdev__ const LeafNodeType* probeLeafAndCache(
const CoordType& ijk,
const AccT& acc)
const 3778 const uint32_t n = CoordToOffset(ijk);
3779 if (!DataType::mChildMask.isOn(n))
3781 const ChildT*
child = this->getChild(n);
3782 acc.insert(ijk,
child);
3783 return child->probeLeafAndCache(ijk, acc);
3786 template<
typename RayT,
typename AccT>
3787 __hostdev__ uint32_t getDimAndCache(
const CoordType& ijk,
const RayT& ray,
const AccT& acc)
const 3789 if (DataType::mFlags & uint32_t(1u))
return this->dim();
3792 const uint32_t n = CoordToOffset(ijk);
3793 if (DataType::mChildMask.isOn(n)) {
3794 const ChildT*
child = this->getChild(n);
3795 acc.insert(ijk,
child);
3796 return child->getDimAndCache(ijk, ray, acc);
3798 return ChildNodeType::dim();
3808 template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3811 static_assert(
sizeof(CoordT) ==
sizeof(
Coord),
"Mismatching sizeof");
3812 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3817 static constexpr
bool FIXED_SIZE =
true;
3820 uint8_t mBBoxDif[3];
3834 return sizeof(
LeafData) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>)
3835 + 2*(
sizeof(ValueT) +
sizeof(
FloatType))
3836 + (1u << (3 * LOG2DIM))*
sizeof(ValueT));
3845 mValueMask.setOn(offset);
3846 mValues[offset] =
value;
3859 template <
typename T>
3870 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3873 static_assert(
sizeof(CoordT) ==
sizeof(
Coord),
"Mismatching sizeof");
3874 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
3879 uint8_t mBBoxDif[3];
3893 return sizeof(
LeafFnBase) - (12 + 3 + 1 +
sizeof(MaskT<LOG2DIM>) + 2*4 + 4*2);
3898 mQuantum = (
max -
min)/
float((1 << bitWidth)-1);
3926 template <
typename T>
3933 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3934 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp4, CoordT, MaskT, LOG2DIM>
3940 static constexpr
bool FIXED_SIZE =
true;
3941 alignas(32) uint8_t mCode[1u << (3 * LOG2DIM - 1)];
3945 static_assert(BaseT::padding()==0,
"expected no padding in LeafFnBase");
3946 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << (3 * LOG2DIM - 1));
3953 const uint8_t c = mCode[i>>1];
3954 return ( (i&1) ? c >> 4 : c & uint8_t(15) )*BaseT::mQuantum + BaseT::mMinimum;
3956 return ((mCode[i>>1] >> ((i&1)<<2)) & uint8_t(15))*BaseT::mQuantum + BaseT::mMinimum;
3967 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3968 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp8, CoordT, MaskT, LOG2DIM>
3974 static constexpr
bool FIXED_SIZE =
true;
3975 alignas(32) uint8_t mCode[1u << 3 * LOG2DIM];
3978 static_assert(BaseT::padding()==0,
"expected no padding in LeafFnBase");
3979 return sizeof(
LeafData) -
sizeof(
BaseT) - (1u << 3 * LOG2DIM);
3985 return mCode[i]*BaseT::mQuantum + BaseT::mMinimum;
3994 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
3995 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
Fp16, CoordT, MaskT, LOG2DIM>
4001 static constexpr
bool FIXED_SIZE =
true;
4002 alignas(32) uint16_t mCode[1u << 3 * LOG2DIM];
4006 static_assert(BaseT::padding()==0,
"expected no padding in LeafFnBase");
4007 return sizeof(
LeafData) -
sizeof(
BaseT) - 2*(1u << 3 * LOG2DIM);
4013 return mCode[i]*BaseT::mQuantum + BaseT::mMinimum;
4023 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4024 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<
FpN, CoordT, MaskT, LOG2DIM>
4030 static constexpr
bool FIXED_SIZE =
false;
4032 static_assert(BaseT::padding()==0,
"expected no padding in LeafFnBase");
4041 #ifdef NANOVDB_FPN_BRANCHLESS// faster 4042 const int b = BaseT::mFlags >> 5;
4044 uint16_t code =
reinterpret_cast<const uint16_t*
>(
this + 1)[i >> (4 - b)];
4045 const static uint8_t shift[5] = {15, 7, 3, 1, 0};
4046 const static uint16_t mask[5] = {1, 3, 15, 255, 65535};
4047 code >>= (i & shift[b]) << b;
4050 uint32_t code =
reinterpret_cast<const uint32_t*
>(
this + 1)[i >> (5 - b)];
4052 code >>= (i & ((32 >> b) - 1)) << b;
4053 code &= (1 << (1 << b)) - 1;
4055 #else// use branched version (slow) 4057 auto *values =
reinterpret_cast<const uint8_t*
>(
this+1);
4058 switch (BaseT::mFlags >> 5) {
4060 code = float((values[i>>3] >> (i&7) ) & uint8_t(1));
4063 code = float((values[i>>2] >> ((i&3)<<1)) & uint8_t(3));
4066 code = float((values[i>>1] >> ((i&1)<<2)) & uint8_t(15));
4069 code = float(values[i]);
4072 code = float(reinterpret_cast<const uint16_t*>(values)[i]);
4075 return float(code) * BaseT::mQuantum + BaseT::mMinimum;
4086 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4087 struct NANOVDB_ALIGN(NANOVDB_DATA_ALIGNMENT)
LeafData<bool, CoordT, MaskT, LOG2DIM>
4089 static_assert(
sizeof(CoordT) ==
sizeof(
Coord),
"Mismatching sizeof");
4090 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4095 static constexpr
bool FIXED_SIZE =
true;
4098 uint8_t mBBoxDif[3];
4102 uint64_t mPadding[2];
4115 mValueMask.setOn(offset);
4116 mValues.set(offset, v);
4124 template <
typename T>
4135 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4138 static_assert(
sizeof(CoordT) ==
sizeof(
Coord),
"Mismatching sizeof");
4139 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4144 static constexpr
bool FIXED_SIZE =
true;
4147 uint8_t mBBoxDif[3];
4150 uint64_t mPadding[2];
4155 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2*8u);
4166 mValueMask.setOn(offset);
4174 template <
typename T>
4185 template<
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4188 static_assert(
sizeof(CoordT) ==
sizeof(
Coord),
"Mismatching sizeof");
4189 static_assert(
sizeof(MaskT<LOG2DIM>) ==
sizeof(
Mask<LOG2DIM>),
"Mismatching sizeof");
4194 static constexpr
bool FIXED_SIZE =
true;
4197 uint8_t mBBoxDif[3];
4206 return sizeof(
LeafData) - (12u + 3u + 1u +
sizeof(MaskT<LOG2DIM>) + 2*8u);
4217 mValueMask.setOn(offset);
4222 if (mFlags & uint8_t(16u)) {
4223 return mValueMask.isOn(i) ? mValueOff + mValueMask.countOn(i) : 0;
4225 return mValueOff + i;
4228 template <
typename T>
4230 template <
typename T>
4232 template <
typename T>
4234 template <
typename T>
4236 template <
typename T>
4247 template<
typename BuildT,
4248 typename CoordT = Coord,
4249 template<u
int32_t>
class MaskT =
Mask,
4250 uint32_t Log2Dim = 3>
4256 static constexpr uint32_t TOTAL = 0;
4257 static constexpr uint32_t DIM = 1;
4266 static constexpr
bool FIXED_SIZE = DataType::FIXED_SIZE;
4267 template<u
int32_t LOG2>
4314 __hostdev__ operator bool()
const {
return mPos < (1u << 3 * Log2Dim);}
4326 static constexpr uint32_t LOG2DIM = Log2Dim;
4327 static constexpr uint32_t TOTAL = LOG2DIM;
4328 static constexpr uint32_t DIM = 1u << TOTAL;
4329 static constexpr uint32_t SIZE = 1u << 3 * LOG2DIM;
4330 static constexpr uint32_t MASK = (1u << LOG2DIM) - 1u;
4331 static constexpr uint32_t LEVEL = 0;
4332 static constexpr uint64_t NUM_VALUES = uint64_t(1) << (3 * TOTAL);
4364 const uint32_t m = n & ((1 << 2 * LOG2DIM) - 1);
4365 return CoordT(n >> 2 * LOG2DIM, m >> LOG2DIM, m & MASK);
4373 return OffsetToLocalCoord(n) + this->origin();
4382 BBox<CoordT> bbox(DataType::mBBoxMin, DataType::mBBoxMin);
4383 if ( this->hasBBox() ) {
4384 bbox.max()[0] += DataType::mBBoxDif[0];
4385 bbox.max()[1] += DataType::mBBoxDif[1];
4386 bbox.max()[2] += DataType::mBBoxDif[2];
4433 return !DataType::mValueMask.isOff();
4441 const uint32_t n = CoordToOffset(ijk);
4442 v = DataType::getValue(n);
4443 return DataType::mValueMask.isOn(n);
4452 return ((ijk[0] & MASK) << (2 * LOG2DIM)) + ((ijk[1] & MASK) << LOG2DIM) + (ijk[2] & MASK);
4454 return ((ijk[0] & MASK) << (2 * LOG2DIM)) | ((ijk[1] & MASK) << LOG2DIM) | (ijk[2] & MASK);
4471 template<
typename,
int,
int,
int>
4476 template<
typename, u
int32_t>
4480 template<
typename AccT>
4481 __hostdev__ ValueType getValueAndCache(
const CoordT& ijk,
const AccT&)
const {
return this->getValue(ijk); }
4484 template<
typename AccT>
4485 __hostdev__ typename AccT::NodeInfo getNodeInfoAndCache(
const CoordType& ,
const AccT& )
const {
4486 using NodeInfoT =
typename AccT::NodeInfo;
4487 return NodeInfoT{LEVEL, this->dim(), this->minimum(), this->maximum(),
4488 this->average(), this->stdDeviation(), this->bbox()[0], this->bbox()[1]};
4491 template<
typename AccT>
4492 __hostdev__ bool isActiveAndCache(
const CoordT& ijk,
const AccT&)
const {
return this->isActive(ijk); }
4494 template<
typename AccT>
4495 __hostdev__ bool probeValueAndCache(
const CoordT& ijk, ValueType& v,
const AccT&)
const {
return this->probeValue(ijk, v); }
4497 template<
typename AccT>
4498 __hostdev__ const LeafNode* probeLeafAndCache(
const CoordT&,
const AccT&)
const {
return this; }
4500 template<
typename RayT,
typename AccT>
4501 __hostdev__ uint32_t getDimAndCache(
const CoordT&,
const RayT& ,
const AccT&)
const 4503 if (DataType::mFlags & uint8_t(1u))
return this->dim();
4506 return ChildNodeType::dim();
4511 template<
typename ValueT,
typename CoordT,
template<u
int32_t>
class MaskT, uint32_t LOG2DIM>
4514 static_assert(LOG2DIM == 3,
"LeafNode::updateBBox: only supports LOGDIM = 3!");
4515 if (DataType::mValueMask.isOff()) {
4516 DataType::mFlags &= ~uint8_t(2);
4519 auto update = [&](uint32_t
min, uint32_t
max,
int axis) {
4521 DataType::mBBoxMin[axis] = (DataType::mBBoxMin[axis] & ~MASK) +
int(
min);
4522 DataType::mBBoxDif[axis] = uint8_t(
max -
min);
4524 uint64_t word64 = DataType::mValueMask.template getWord<uint64_t>(0);
4525 uint32_t Xmin = word64 ? 0u : 8u;
4526 uint32_t Xmax = Xmin;
4527 for (
int i = 1; i < 8; ++i) {
4528 if (uint64_t w = DataType::mValueMask.
template getWord<uint64_t>(i)) {
4537 update(Xmin, Xmax, 0);
4539 const uint32_t *p =
reinterpret_cast<const uint32_t*
>(&word64), word32 = p[0] | p[1];
4540 const uint16_t *q =
reinterpret_cast<const uint16_t*
>(&word32), word16 = q[0] | q[1];
4541 const uint8_t *b =
reinterpret_cast<const uint8_t*
>(&word16), byte = b[0] | b[1];
4544 DataType::mFlags |= uint8_t(2);
4552 template<
typename BuildT>
4554 template<
typename BuildT>
4556 template<
typename BuildT>
4558 template<
typename BuildT>
4560 template<
typename BuildT>
4562 template<
typename BuildT>
4566 template<
typename BuildT,
int LEVEL>
4570 template<
typename BuildT>
4576 template<
typename BuildT>
4582 template<
typename BuildT>
4588 template<
typename BuildT>
4644 template <
typename BuildT>
4654 mutable const RootT* mRoot;
4659 static const int CacheLevels = 0;
4694 return mRoot->getValueAndCache(ijk, *
this);
4698 return this->getValue(ijk);
4702 return this->getValue(
CoordType(i,j,k));
4707 return mRoot->getNodeInfoAndCache(ijk, *
this);
4712 return mRoot->isActiveAndCache(ijk, *
this);
4717 return mRoot->probeValueAndCache(ijk, v, *
this);
4722 return mRoot->probeLeafAndCache(ijk, *
this);
4725 template<
typename RayT>
4728 return mRoot->getDimAndCache(ijk, ray, *
this);
4735 template<
typename, u
int32_t>
4737 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
4741 template<
typename NodeT>
4746 template <
typename BuildT,
int LEVEL0>
4749 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 should be 0, 1, or 2");
4763 mutable CoordT mKey;
4764 mutable const RootT* mRoot;
4765 mutable const NodeT* mNode;
4771 static const int CacheLevels = 1;
4805 return (ijk[0] & int32_t(~NodeT::MASK)) == mKey[0] &&
4806 (ijk[1] & int32_t(~NodeT::MASK)) == mKey[1] &&
4807 (ijk[2] & int32_t(~NodeT::MASK)) == mKey[2];
4812 if (this->isCached(ijk)) {
4813 return mNode->getValueAndCache(ijk, *
this);
4815 return mRoot->getValueAndCache(ijk, *
this);
4819 return this->getValue(ijk);
4823 return this->getValue(
CoordType(i,j,k));
4828 if (this->isCached(ijk)) {
4829 return mNode->getNodeInfoAndCache(ijk, *
this);
4831 return mRoot->getNodeInfoAndCache(ijk, *
this);
4836 if (this->isCached(ijk)) {
4837 return mNode->isActiveAndCache(ijk, *
this);
4839 return mRoot->isActiveAndCache(ijk, *
this);
4844 if (this->isCached(ijk)) {
4845 return mNode->probeValueAndCache(ijk, v, *
this);
4847 return mRoot->probeValueAndCache(ijk, v, *
this);
4852 if (this->isCached(ijk)) {
4853 return mNode->probeLeafAndCache(ijk, *
this);
4855 return mRoot->probeLeafAndCache(ijk, *
this);
4858 template<
typename RayT>
4861 if (this->isCached(ijk)) {
4862 return mNode->getDimAndCache(ijk, ray, *
this);
4864 return mRoot->getDimAndCache(ijk, ray, *
this);
4871 template<
typename, u
int32_t>
4873 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
4879 mKey = ijk & ~NodeT::MASK;
4884 template<
typename OtherNodeT>
4885 __hostdev__ void insert(
const CoordType&,
const OtherNodeT*)
const {}
4889 template <
typename BuildT,
int LEVEL0,
int LEVEL1>
4892 static_assert(LEVEL0 >= 0 && LEVEL0 <= 2,
"LEVEL0 must be 0, 1, 2");
4893 static_assert(LEVEL1 >= 0 && LEVEL1 <= 2,
"LEVEL1 must be 0, 1, 2");
4894 static_assert(LEVEL0 < LEVEL1,
"Level 0 must be lower than level 1");
4907 #ifdef USE_SINGLE_ACCESSOR_KEY // 44 bytes total 4908 mutable CoordT mKey;
4909 #else // 68 bytes total 4910 mutable CoordT mKeys[2];
4912 mutable const RootT* mRoot;
4913 mutable const Node1T* mNode1;
4914 mutable const Node2T* mNode2;
4920 static const int CacheLevels = 2;
4926 #ifdef USE_SINGLE_ACCESSOR_KEY 4946 #ifdef USE_SINGLE_ACCESSOR_KEY 4962 #ifdef USE_SINGLE_ACCESSOR_KEY 4963 __hostdev__ bool isCached1(CoordValueType dirty)
const 4967 if (dirty & int32_t(~Node1T::MASK)) {
4973 __hostdev__ bool isCached2(CoordValueType dirty)
const 4977 if (dirty & int32_t(~Node2T::MASK)) {
4983 __hostdev__ CoordValueType computeDirty(
const CoordType& ijk)
const 4985 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
4990 return (ijk[0] & int32_t(~Node1T::MASK)) == mKeys[0][0] &&
4991 (ijk[1] & int32_t(~Node1T::MASK)) == mKeys[0][1] &&
4992 (ijk[2] & int32_t(~Node1T::MASK)) == mKeys[0][2];
4996 return (ijk[0] & int32_t(~Node2T::MASK)) == mKeys[1][0] &&
4997 (ijk[1] & int32_t(~Node2T::MASK)) == mKeys[1][1] &&
4998 (ijk[2] & int32_t(~Node2T::MASK)) == mKeys[1][2];
5004 #ifdef USE_SINGLE_ACCESSOR_KEY 5005 const CoordValueType dirty = this->computeDirty(ijk);
5009 if (this->isCached1(dirty)) {
5010 return mNode1->getValueAndCache(ijk, *
this);
5011 }
else if (this->isCached2(dirty)) {
5012 return mNode2->getValueAndCache(ijk, *
this);
5014 return mRoot->getValueAndCache(ijk, *
this);
5018 return this->getValue(ijk);
5022 return this->getValue(
CoordType(i,j,k));
5027 #ifdef USE_SINGLE_ACCESSOR_KEY 5028 const CoordValueType dirty = this->computeDirty(ijk);
5032 if (this->isCached1(dirty)) {
5033 return mNode1->getNodeInfoAndCache(ijk, *
this);
5034 }
else if (this->isCached2(dirty)) {
5035 return mNode2->getNodeInfoAndCache(ijk, *
this);
5037 return mRoot->getNodeInfoAndCache(ijk, *
this);
5042 #ifdef USE_SINGLE_ACCESSOR_KEY 5043 const CoordValueType dirty = this->computeDirty(ijk);
5047 if (this->isCached1(dirty)) {
5048 return mNode1->isActiveAndCache(ijk, *
this);
5049 }
else if (this->isCached2(dirty)) {
5050 return mNode2->isActiveAndCache(ijk, *
this);
5052 return mRoot->isActiveAndCache(ijk, *
this);
5057 #ifdef USE_SINGLE_ACCESSOR_KEY 5058 const CoordValueType dirty = this->computeDirty(ijk);
5062 if (this->isCached1(dirty)) {
5063 return mNode1->probeValueAndCache(ijk, v, *
this);
5064 }
else if (this->isCached2(dirty)) {
5065 return mNode2->probeValueAndCache(ijk, v, *
this);
5067 return mRoot->probeValueAndCache(ijk, v, *
this);
5072 #ifdef USE_SINGLE_ACCESSOR_KEY 5073 const CoordValueType dirty = this->computeDirty(ijk);
5077 if (this->isCached1(dirty)) {
5078 return mNode1->probeLeafAndCache(ijk, *
this);
5079 }
else if (this->isCached2(dirty)) {
5080 return mNode2->probeLeafAndCache(ijk, *
this);
5082 return mRoot->probeLeafAndCache(ijk, *
this);
5085 template<
typename RayT>
5088 #ifdef USE_SINGLE_ACCESSOR_KEY 5089 const CoordValueType dirty = this->computeDirty(ijk);
5093 if (this->isCached1(dirty)) {
5094 return mNode1->getDimAndCache(ijk, ray, *
this);
5095 }
else if (this->isCached2(dirty)) {
5096 return mNode2->getDimAndCache(ijk, ray, *
this);
5098 return mRoot->getDimAndCache(ijk, ray, *
this);
5105 template<
typename, u
int32_t>
5107 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5113 #ifdef USE_SINGLE_ACCESSOR_KEY 5116 mKeys[0] = ijk & ~Node1T::MASK;
5120 __hostdev__ void insert(
const CoordType& ijk,
const Node2T* node)
const 5122 #ifdef USE_SINGLE_ACCESSOR_KEY 5125 mKeys[1] = ijk & ~Node2T::MASK;
5129 template <
typename OtherNodeT>
5130 __hostdev__ void insert(
const CoordType&,
const OtherNodeT*)
const {}
5135 template <
typename BuildT>
5151 #ifdef USE_SINGLE_ACCESSOR_KEY // 44 bytes total 5152 mutable CoordT mKey;
5153 #else // 68 bytes total 5154 mutable CoordT mKeys[3];
5156 mutable const RootT* mRoot;
5157 mutable const void* mNode[3];
5163 static const int CacheLevels = 3;
5169 #ifdef USE_SINGLE_ACCESSOR_KEY 5175 , mNode{
nullptr,
nullptr,
nullptr}
5195 template<
typename NodeT>
5200 return reinterpret_cast<const T*
>(mNode[NodeT::LEVEL]);
5203 template <
int LEVEL>
5207 static_assert(LEVEL>=0 && LEVEL<=2,
"ReadAccessor::getNode: Invalid node type");
5208 return reinterpret_cast<const T*
>(mNode[LEVEL]);
5215 #ifdef USE_SINGLE_ACCESSOR_KEY 5220 mNode[0] = mNode[1] = mNode[2] =
nullptr;
5223 #ifdef USE_SINGLE_ACCESSOR_KEY 5224 template<
typename NodeT>
5225 __hostdev__ bool isCached(CoordValueType dirty)
const 5227 if (!mNode[NodeT::LEVEL])
5229 if (dirty & int32_t(~NodeT::MASK)) {
5230 mNode[NodeT::LEVEL] =
nullptr;
5236 __hostdev__ CoordValueType computeDirty(
const CoordType& ijk)
const 5238 return (ijk[0] ^ mKey[0]) | (ijk[1] ^ mKey[1]) | (ijk[2] ^ mKey[2]);
5241 template<
typename NodeT>
5244 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];
5250 #ifdef USE_SINGLE_ACCESSOR_KEY 5251 const CoordValueType dirty = this->computeDirty(ijk);
5255 if (this->isCached<LeafT>(dirty)) {
5256 return ((
LeafT*)mNode[0])->getValue(ijk);
5257 }
else if (this->isCached<NodeT1>(dirty)) {
5258 return ((
NodeT1*)mNode[1])->getValueAndCache(ijk, *
this);
5259 }
else if (this->isCached<NodeT2>(dirty)) {
5260 return ((
NodeT2*)mNode[2])->getValueAndCache(ijk, *
this);
5262 return mRoot->getValueAndCache(ijk, *
this);
5266 return this->getValue(ijk);
5270 return this->getValue(
CoordType(i,j,k));
5275 #ifdef USE_SINGLE_ACCESSOR_KEY 5276 const CoordValueType dirty = this->computeDirty(ijk);
5280 if (this->isCached<LeafT>(dirty)) {
5281 return ((
LeafT*)mNode[0])->getNodeInfoAndCache(ijk, *
this);
5282 }
else if (this->isCached<NodeT1>(dirty)) {
5283 return ((
NodeT1*)mNode[1])->getNodeInfoAndCache(ijk, *
this);
5284 }
else if (this->isCached<NodeT2>(dirty)) {
5285 return ((
NodeT2*)mNode[2])->getNodeInfoAndCache(ijk, *
this);
5287 return mRoot->getNodeInfoAndCache(ijk, *
this);
5292 #ifdef USE_SINGLE_ACCESSOR_KEY 5293 const CoordValueType dirty = this->computeDirty(ijk);
5297 if (this->isCached<LeafT>(dirty)) {
5298 return ((
LeafT*)mNode[0])->isActive(ijk);
5299 }
else if (this->isCached<NodeT1>(dirty)) {
5300 return ((
NodeT1*)mNode[1])->isActiveAndCache(ijk, *
this);
5301 }
else if (this->isCached<NodeT2>(dirty)) {
5302 return ((
NodeT2*)mNode[2])->isActiveAndCache(ijk, *
this);
5304 return mRoot->isActiveAndCache(ijk, *
this);
5309 #ifdef USE_SINGLE_ACCESSOR_KEY 5310 const CoordValueType dirty = this->computeDirty(ijk);
5314 if (this->isCached<LeafT>(dirty)) {
5315 return ((
LeafT*)mNode[0])->probeValue(ijk, v);
5316 }
else if (this->isCached<NodeT1>(dirty)) {
5317 return ((
NodeT1*)mNode[1])->probeValueAndCache(ijk, v, *
this);
5318 }
else if (this->isCached<NodeT2>(dirty)) {
5319 return ((
NodeT2*)mNode[2])->probeValueAndCache(ijk, v, *
this);
5321 return mRoot->probeValueAndCache(ijk, v, *
this);
5326 #ifdef USE_SINGLE_ACCESSOR_KEY 5327 const CoordValueType dirty = this->computeDirty(ijk);
5331 if (this->isCached<LeafT>(dirty)) {
5332 return ((
LeafT*)mNode[0]);
5333 }
else if (this->isCached<NodeT1>(dirty)) {
5334 return ((
NodeT1*)mNode[1])->probeLeafAndCache(ijk, *
this);
5335 }
else if (this->isCached<NodeT2>(dirty)) {
5336 return ((
NodeT2*)mNode[2])->probeLeafAndCache(ijk, *
this);
5338 return mRoot->probeLeafAndCache(ijk, *
this);
5341 template<
typename RayT>
5344 #ifdef USE_SINGLE_ACCESSOR_KEY 5345 const CoordValueType dirty = this->computeDirty(ijk);
5349 if (this->isCached<LeafT>(dirty)) {
5350 return ((
LeafT*)mNode[0])->getDimAndCache(ijk, ray, *
this);
5351 }
else if (this->isCached<NodeT1>(dirty)) {
5352 return ((
NodeT1*)mNode[1])->getDimAndCache(ijk, ray, *
this);
5353 }
else if (this->isCached<NodeT2>(dirty)) {
5354 return ((
NodeT2*)mNode[2])->getDimAndCache(ijk, ray, *
this);
5356 return mRoot->getDimAndCache(ijk, ray, *
this);
5363 template<
typename, u
int32_t>
5365 template<
typename,
typename,
template<u
int32_t>
class, uint32_t>
5369 template<
typename NodeT>
5372 #ifdef USE_SINGLE_ACCESSOR_KEY 5375 mKeys[NodeT::LEVEL] = ijk & ~NodeT::MASK;
5377 mNode[NodeT::LEVEL] = node;
5395 template <
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5401 template <
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5407 template <
int LEVEL0 = -1,
int LEVEL1 = -1,
int LEVEL2 = -1,
typename ValueT =
float>
5459 template<
typename AttT>
5470 :
AccT(grid.tree().root())
5472 , mData(reinterpret_cast<const AttT*>(grid.blindData(0)))
5485 end = begin + count;
5493 auto* leaf = this->probeLeaf(ijk);
5494 if (leaf ==
nullptr) {
5497 begin = mData + leaf->minimum();
5498 end = begin + leaf->maximum();
5499 return leaf->maximum();
5505 auto* leaf = this->probeLeaf(ijk);
5506 if (leaf ==
nullptr)
5508 const uint32_t offset = LeafNodeType::CoordToOffset(ijk);
5509 if (leaf->isActive(offset)) {
5510 auto* p = mData + leaf->minimum();
5511 begin = p + (offset == 0 ? 0 : leaf->getValue(offset - 1));
5512 end = p + leaf->getValue(offset);
5522 template<
typename ChannelT>
5537 :
BaseT(grid.tree().root())
5543 this->setChannel(channelID);
5548 :
BaseT(grid.tree().root())
5550 , mChannel(channelPtr)
5572 mChannel = channelPtr;
5580 this->setChannel(reinterpret_cast<ChannelT*>(const_cast<void*>(mGrid.
blindData(channelID))));
5596 const bool isActive = BaseT::probeValue(ijk, idx);
5603 template <
typename T>
5609 #if !defined(__CUDA_ARCH__) && !defined(__HIP__) 5614 struct MiniGridHandle {
5619 BufferType(BufferType &&other) : data(other.data), size(other.size) {other.data=
nullptr; other.size=0;}
5620 ~BufferType() {std::free(data);}
5621 BufferType& operator=(
const BufferType &other) =
delete;
5622 BufferType& operator=(BufferType &&other){data=other.data; size=other.size; other.data=
nullptr; other.size=0;
return *
this;}
5623 static BufferType create(
size_t n, BufferType* dummy =
nullptr) {
return BufferType(n);}
5625 MiniGridHandle(BufferType &&buf) : buffer(
std::move(buf)) {}
5626 const uint8_t* data()
const {
return buffer.data;}
5646 template <
typename StreamT>
5649 char header[192] = {0}, *dst = header;
5650 const char *grid = (
const char*)buffer, *tree = grid + 672, *root = tree + *(
const uint64_t*)(tree + 24);
5651 auto cpy = [&](
const char *src,
int n){
for (
auto *end=src+n; src!=end; ++src) *dst++ = *src;};
5652 if (*(
const uint64_t*)(grid)!=0x304244566f6e614eUL) {
5653 fprintf(stderr,
"nanovdb::writeUncompressedGrid: invalid magic number\n"); exit(EXIT_FAILURE);
5654 }
else if (*(
const uint32_t*)(grid+16)>>21!=32) {
5655 fprintf(stderr,
"nanovdb::writeUncompressedGrid: invalid major version\n"); exit(EXIT_FAILURE);
5659 *(uint16_t*)(dst) = 1; dst += 4;
5666 cpy(grid + 560, 48);
5668 cpy(grid + 608, 24);
5669 const char *gridName = grid + 40;
5670 if (*(
const uint32_t*)(grid+20) & uint32_t(1)) {
5671 gridName = grid + *(
const int64_t*)(grid + 640) + 288*(*(
const uint32_t*)(grid + 648) - 1);
5672 gridName += *(
const uint64_t*)gridName;
5674 uint32_t nameSize = 1;
5675 for (
const char *p = gridName; *p!=
'\0'; ++p) ++nameSize;
5676 *(uint32_t*)(dst) = nameSize; dst += 4;
5678 *(uint32_t*)(dst) = 1; dst += 4;
5682 assert(dst - header == 192);
5683 os.write(header, 192);
5684 os.write(gridName, nameSize);
5686 const uint64_t gridSize = *(
const uint64_t*)(grid + 32);
5687 os.write(grid, gridSize);
5688 if (*(
const uint32_t*)(grid+24) >= *(
const uint32_t*)(grid+28) - 1)
break;
5694 template<
typename GridHandleT,
template<
typename...>
class VecT>
5697 #ifdef NANOVDB_USE_IOSTREAMS// use this to switch between std::ofstream or FILE implementations 5698 std::ofstream os(fileName, std::ios::out | std::ios::binary | std::ios::trunc);
5702 StreamT(
const char *name) {fptr = fopen(name,
"wb");}
5703 ~StreamT() {fclose(fptr);}
5704 void write(
const char *data,
size_t n){fwrite(data, 1, n, fptr);}
5705 bool is_open()
const {
return fptr != NULL;}
5708 if (!os.is_open()) {
5709 fprintf(stderr,
"nanovdb::writeUncompressedGrids: Unable to open file \"%s\"for output\n",fileName); exit(EXIT_FAILURE);
5719 template<
typename GridHandleT,
typename StreamT,
template<
typename...>
class VecT>
5720 VecT<GridHandleT>
readUncompressedGrids(StreamT& is,
const typename GridHandleT::BufferType& buffer =
typename GridHandleT::BufferType())
5722 char header[16], metadata[176];
5723 VecT<GridHandleT> handles;
5724 while(is.read(header, 16)) {
5725 if (*(uint64_t*)(header)!=0x304244566f6e614eUL) {
5726 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid magic number\n"); exit(EXIT_FAILURE);
5727 }
else if (*(uint32_t*)(header+8)>>21!=32) {
5728 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid major version\n"); exit(EXIT_FAILURE);
5729 }
else if (*(uint16_t*)(header+14)!=0) {
5730 fprintf(stderr,
"nanovdb::readUncompressedGrids: invalid codec\n"); exit(EXIT_FAILURE);
5732 for (uint16_t i=0, e=*(uint16_t*)(header+12); i<e; ++i) {
5733 if (!is.read(metadata, 176)) {
5734 fprintf(stderr,
"nanovdb::readUncompressedGrids: error reading metadata\n"); exit(EXIT_FAILURE);
5736 const uint64_t gridSize = *(uint64_t*)(metadata);
5737 GridHandleT handle(GridHandleT::BufferType::create(gridSize, &buffer));
5738 is.skip(*(uint32_t*)(metadata + 136));
5739 is.read((
char*)handle.data(), gridSize);
5740 handles.emplace_back(std::move(handle));
5747 template<
typename GridHandleT,
template<
typename...>
class VecT>
5748 VecT<GridHandleT>
readUncompressedGrids(
const char *fileName,
const typename GridHandleT::BufferType& buffer =
typename GridHandleT::BufferType())
5750 #ifdef NANOVDB_USE_IOSTREAMS// use this to switch between std::ifstream or FILE implementations 5751 struct StreamT :
public std::ifstream {
5752 StreamT(
const char *name) : std::ifstream(name, std::ios::in | std::ios::binary) {}
5753 void skip(uint32_t off) {this->seekg(off, std::ios_base::cur);}
5758 StreamT(
const char *name) {fptr = fopen(name,
"rb");}
5759 ~StreamT() {fclose(fptr);}
5760 bool read(
char *data,
size_t n){
size_t m=fread(data, 1, n, fptr);
return n==m;}
5761 void skip(uint32_t off){fseek(fptr, off, SEEK_CUR);}
5762 bool is_open()
const {
return fptr != NULL;}
5765 StreamT is(fileName);
5766 if (!is.is_open()) {
5767 fprintf(stderr,
"nanovdb::readUncompressedGrids: Unable to open file \"%s\"for input\n",fileName); exit(EXIT_FAILURE);
5769 return readUncompressedGrids<GridHandleT, StreamT, VecT>(is, buffer);
5774 #endif// if !defined(__CUDA_ARCH__) && !defined(__HIP__) 5778 #endif // end of NANOVDB_NANOVDB_H_HAS_BEEN_INCLUDED typename FloatTraits< BuildT >::FloatType FloatType
Definition: NanoVDB.h:3815
ValueType operator()(const CoordType &ijk) const
Definition: NanoVDB.h:5264
ValueType getValue(const CoordType &ijk) const
Definition: NanoVDB.h:4810
const ChildT * getChild(uint32_t n) const
Definition: NanoVDB.h:3478
float getAvg() const
return the quantized average of the active values in this node
Definition: NanoVDB.h:3908
void setAvg(const FloatType &)
Definition: NanoVDB.h:4171
typename TreeT::RootType RootType
Definition: NanoVDB.h:2559
ChannelT & getValue(const Coord &ijk) const
Return the value from a cached channel that maps to the specified coordinate.
Definition: NanoVDB.h:5588
int32_t ValueType
Definition: NanoVDB.h:970
NodeInfo getNodeInfo(const CoordType &ijk) const
Definition: NanoVDB.h:5025
static size_t memUsage(uint32_t bitWidth)
Definition: NanoVDB.h:4038
bool type
Definition: NanoVDB.h:457
Visits all tile values in this node, i.e. both inactive and active tiles.
Definition: NanoVDB.h:3561
uint64_t getMax() const
Definition: NanoVDB.h:4212
const uint32_t & packed() const
Definition: NanoVDB.h:593
void setMin(const T &min, T *p)
Definition: NanoVDB.h:4229
ValueT ValueType
Definition: NanoVDB.h:4917
Vec3T indexToWorldDirF(const Vec3T &dir) const
transformation from index space direction to world space direction
Definition: NanoVDB.h:2646
int32_t x() const
Definition: NanoVDB.h:996
static uint32_t CoordToOffset(const CoordT &ijk)
Return the linear offset corresponding to the given coordinate.
Definition: NanoVDB.h:4449
void setAvg(const T &avg, T *p)
Definition: NanoVDB.h:4233
FloatType mStdDevi
Definition: NanoVDB.h:3827
float type
Definition: NanoVDB.h:464
const void * treePtr() const
Definition: NanoVDB.h:2530
void localToGlobalCoord(Coord &ijk) const
modifies local coordinates to global coordinates of a tile or child node
Definition: NanoVDB.h:3694
StatsT mStdDevi
Definition: NanoVDB.h:3445
ChildT * child
Definition: GridBuilder.h:1289
Vec3(T x)
Definition: NanoVDB.h:1165
const StatsT & average() const
Definition: NanoVDB.h:3503
static BBox createCube(const CoordT &min, typename CoordT::ValueType dim)
Definition: NanoVDB.h:1767
static bool isAligned(const void *p)
return true if the specified pointer is aligned
Definition: NanoVDB.h:498
BBox(BBox &other, const SplitT &)
Definition: NanoVDB.h:1758
static constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition: NanoVDB.h:3892
static float value()
Definition: NanoVDB.h:708
ValueOnIterator & operator++()
Definition: NanoVDB.h:3170
Vec3 operator/(const Vec3 &v) const
Definition: NanoVDB.h:1210
void extrema(ValueType &min, ValueType &max) const
Sets the extrema values of all the active values in this tree, i.e. in all nodes of the tree...
Definition: NanoVDB.h:2940
const MaskType< LOG2DIM > & valueMask() const
Return a const reference to the bit mask of active voxels in this internal node.
Definition: NanoVDB.h:3608
ValueType operator()(int i, int j, int k) const
Definition: NanoVDB.h:5020
typename GridOrTreeOrRootT::RootType::ChildNodeType type
Definition: NanoVDB.h:2380
Tile * tile(uint32_t n)
Definition: NanoVDB.h:3034
Vec3T worldToIndexDirF(const Vec3T &dir) const
transformation from world space direction to index space direction
Definition: NanoVDB.h:2651
void setDev(float dev)
Definition: NanoVDB.h:3924
void setRoot(const RootT *root)
Definition: NanoVDB.h:2765
const GridBlindMetaData * blindMetaData(uint32_t n) const
Returns a const reference to the blindMetaData at the specified linear offset.
Definition: NanoVDB.h:2535
Coord & operator+=(const Coord &rhs)
Definition: NanoVDB.h:1077
static constexpr uint32_t padding()
Definition: NanoVDB.h:4205
VDB Tree, which is a thin wrapper around a RootNode.
Definition: NanoVDB.h:2798
bool isOff(uint32_t n) const
Return true if the given bit is NOT set.
Definition: NanoVDB.h:2088
uint8_t flags() const
Definition: NanoVDB.h:4356
void setOn()
Set all bits on.
Definition: NanoVDB.h:2128
const DataType * data() const
Definition: NanoVDB.h:3195
float Type
Definition: NanoVDB.h:484
uint64_t mValueOff
Definition: NanoVDB.h:4202
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
float FloatType
Definition: NanoVDB.h:3876
uint32_t gridIndex() const
Return index of this grid in the buffer.
Definition: NanoVDB.h:2586
Highest level of the data structure. Contains a tree and a world->index transform (that currently onl...
Definition: NanoVDB.h:2555
Coord offsetBy(ValueType dx, ValueType dy, ValueType dz) const
Definition: NanoVDB.h:1116
const BBoxType & bbox() const
Return a const reference to the index bounding box of all the active values in this tree...
Definition: NanoVDB.h:3198
Vec3 & normalize()
Definition: NanoVDB.h:1237
T length() const
Definition: NanoVDB.h:1207
DataType * data()
Definition: NanoVDB.h:3193
Vec4 & normalize()
Definition: NanoVDB.h:1375
Vec4(T x, T y, T z, T w)
Definition: NanoVDB.h:1314
void setFlagsOff()
Definition: NanoVDB.h:2453
Vec4 & operator-=(const Vec4 &v)
Definition: NanoVDB.h:1358
ValueT getValue(uint32_t n) const
Definition: NanoVDB.h:3484
void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition: NanoVDB.h:4790
uint64_t checksum() const
Return checksum of the grid buffer.
Definition: NanoVDB.h:2715
typename Vec3T::ValueType ValueType
Definition: NanoVDB.h:1665
uint32_t blindDataCount() const
Return the count of blind-data encoded in this grid.
Definition: NanoVDB.h:2721
void setDev(const StatsT &v)
Definition: NanoVDB.h:3062
ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition: NanoVDB.h:4676
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:3632
#define NANOVDB_PATCH_VERSION_NUMBER
Definition: NanoVDB.h:125
void setMax(const T &max, T *p)
Definition: NanoVDB.h:4231
uint64_t idx(int i, int j, int k) const
Definition: NanoVDB.h:5585
static constexpr uint64_t memUsage()
Definition: NanoVDB.h:3943
T Sign(const T &x)
Return the sign of the given value as an integer (either -1, 0 or 1).
Definition: NanoVDB.h:914
typename NanoRoot< uint32_t >::LeafNodeType LeafNodeType
Definition: NanoVDB.h:5467
bool isActive() const
Return true if any of the voxel value are active in this leaf node.
Definition: NanoVDB.h:4429
Rgba8(uint8_t v)
Definition: NanoVDB.h:574
Metafunction used to determine if the first template parameter is a specialization of the class templ...
Definition: NanoVDB.h:426
static uint32_t dim()
Definition: NanoVDB.h:4258
Iterator begin() const
Definition: NanoVDB.h:1747
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:3213
Class to access values in channels at a specific voxel location.
Definition: NanoVDB.h:5523
uint64_t getDev() const
Definition: NanoVDB.h:4214
ValueType getValue(const CoordType &ijk) const
Return the value of the given voxel.
Definition: NanoVDB.h:3231
ChildIterator(const RootNode *parent)
Definition: NanoVDB.h:3099
uint64_t memUsage()
return memory usage in bytes for the class
Definition: NanoVDB.h:4399
static float value()
Definition: NanoVDB.h:692
CoordType getOrigin() const
Definition: NanoVDB.h:3586
const DataType * data() const
Definition: NanoVDB.h:4336
Mask(bool on)
Definition: NanoVDB.h:2029
double mVecD[3]
Definition: NanoVDB.h:2231
Vec4(const Vec4< T2 > &v)
Definition: NanoVDB.h:1319
Vec4 operator-(const Vec4 &v) const
Definition: NanoVDB.h:1347
typename GridT::TreeType Type
Definition: NanoVDB.h:2784
ValueType getValue(const CoordType &ijk) const
Definition: NanoVDB.h:5002
static uint32_t CoordToOffset(const CoordType &ijk)
Return the linear offset corresponding to the given coordinate.
Definition: NanoVDB.h:3672
Definition: NanoVDB.h:3155
ValueType operator*() const
Definition: NanoVDB.h:3166
typename ChildT::CoordType CoordType
Definition: NanoVDB.h:3529
float getValue(uint32_t i) const
Definition: NanoVDB.h:4039
uint64_t getAvg() const
Definition: NanoVDB.h:4213
GridClass
Classes (defined in OpenVDB) that are currently supported by NanoVDB.
Definition: NanoVDB.h:281
const DataType * data() const
Definition: NanoVDB.h:3599
typename DataType::ValueT ValueType
Definition: NanoVDB.h:3081
bool updateBBox()
Updates the local bounding box of active voxels in this node. Return true if bbox was updated...
Definition: NanoVDB.h:4512
static T scalar(const T &s)
Definition: NanoVDB.h:1436
typename RootT::BuildType BuildType
Definition: NanoVDB.h:2810
bool getMin() const
Definition: NanoVDB.h:4109
const ChildNodeType * probeChild(const CoordType &ijk) const
Definition: NanoVDB.h:3274
bool probeValue(const CoordType &ijk, ValueType &v) const
Definition: NanoVDB.h:4715
uint32_t state
Definition: NanoVDB.h:3022
const typename GridOrTreeOrRootT::RootType::ChildNodeType::ChildNodeType Type
Definition: NanoVDB.h:2372
const ValueT & getMin() const
Definition: NanoVDB.h:3054
BuildT BuildType
Definition: NanoVDB.h:3814
CoordT mBBoxMin
Definition: NanoVDB.h:4146
uint32_t getMajor() const
Definition: NanoVDB.h:669
const NodeTrait< RootT, 2 >::type * getFirstUpper() const
Definition: NanoVDB.h:2932
ValueType getValue(const CoordType &ijk) const
Return the value of the given voxel.
Definition: NanoVDB.h:3635
void writeUncompressedGrids(const char *fileName, const VecT< GridHandleT > &handles)
write multiple NanoVDB grids to a single file, without compression.
Definition: NanoVDB.h:5695
bool isOn() const
Return true if all the bits are set in this Mask.
Definition: NanoVDB.h:2091
Vec4 operator/(const T &s) const
Definition: NanoVDB.h:1349
uint8_t mFlags
Definition: NanoVDB.h:3821
bool getDev() const
Definition: NanoVDB.h:4112
static uint64_t memUsage(uint32_t tableSize)
Return the expected memory footprint in bytes with the specified number of tiles. ...
Definition: NanoVDB.h:3225
ChannelAccessor(const IndexGrid &grid, ChannelT *channelPtr)
Ctor from an IndexGrid and an external channel.
Definition: NanoVDB.h:5547
int32_t z() const
Definition: NanoVDB.h:998
ValueType operator()(int i, int j, int k) const
Definition: NanoVDB.h:4700
Definition: NanoVDB.h:2545
bool isActive() const
Definition: NanoVDB.h:3136
LeafNodeType Node0
Definition: NanoVDB.h:2817
static constexpr uint32_t padding()
Definition: NanoVDB.h:3944
const LeafNodeType * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:3264
void setMin(const ValueT &v)
Definition: NanoVDB.h:3059
bool probeValue(const CoordType &ijk, ValueType &v) const
Definition: NanoVDB.h:5307
typename DataType::StatsT FloatType
Definition: NanoVDB.h:3082
ValueType & operator[](IndexType i)
Return a non-const reference to the given Coord component.
Definition: NanoVDB.h:1016
bool isActive(uint32_t n) const
Definition: NanoVDB.h:4426
typename GridOrTreeOrRootT::RootType::ChildNodeType::ChildNodeType type
Definition: NanoVDB.h:2366
ValueOnIterator beginValueOn() const
Definition: NanoVDB.h:3183
const RootT & root() const
Definition: NanoVDB.h:5185
ChildT ChildNodeType
Definition: NanoVDB.h:3078
CoordT offsetToGlobalCoord(uint32_t n) const
Definition: NanoVDB.h:4371
static constexpr uint32_t padding()
Definition: NanoVDB.h:4154
static const bool value
Definition: NanoVDB.h:415
const ValueType & background() const
Return a const reference to the background value.
Definition: NanoVDB.h:2851
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:2045
typename GridOrTreeOrRootT::RootType type
Definition: NanoVDB.h:2394
BaseBBox()
Definition: NanoVDB.h:1647
uint32_t nodeCount(int level) const
Definition: NanoVDB.h:2880
FloatType getDev() const
Definition: NanoVDB.h:3852
Vec4 & operator/=(const T &s)
Definition: NanoVDB.h:1374
MaskT< LOG2DIM > ArrayType
Definition: NanoVDB.h:4094
Vec3T applyInverseJacobianF(const Vec3T &xyz) const
Definition: NanoVDB.h:2522
NanoBuildT Type
Definition: NanoVDB.h:442
uint64_t mMagic
Definition: NanoVDB.h:2434
void setBBoxOn(bool on=true)
Definition: NanoVDB.h:2462
T lengthSqr() const
Definition: NanoVDB.h:1338
uint64_t mGridSize
Definition: NanoVDB.h:2440
void setOrigin(const T &ijk)
Definition: NanoVDB.h:3499
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:3620
bool hasBBox() const
Definition: NanoVDB.h:4436
bool isChild() const
Definition: NanoVDB.h:3016
RootT Node3
Definition: NanoVDB.h:2814
bool isActive() const
Definition: NanoVDB.h:4313
Trait to map from LEVEL to node type.
Definition: NanoVDB.h:4567
Rgba8 & operator=(Rgba8 &&)=default
Vec3T & min()
Definition: NanoVDB.h:1607
Rgba8(float r, float g, float b, float a=1.0f)
Definition: NanoVDB.h:575
uint32_t countOn() const
Return the total number of set bits in this Mask.
Definition: NanoVDB.h:1973
int findBlindDataForSemantic(GridBlindDataSemantic semantic) const
Return the index of the blind data with specified semantic if found, otherwise -1.
Definition: NanoVDB.h:2745
#define NANOVDB_MINOR_VERSION_NUMBER
Definition: NanoVDB.h:124
float lengthSqr() const
Definition: NanoVDB.h:584
Vec4 operator/(const Vec4 &v) const
Definition: NanoVDB.h:1345
A simple vector class with three double components, similar to openvdb::math::Vec4.
Definition: NanoVDB.h:1302
CoordT RoundDown(const Vec3T< RealT > &xyz)
Definition: NanoVDB.h:895
uint64_t KeyT
Return a key based on the coordinates of a voxel.
Definition: NanoVDB.h:2962
void setValueOnly(const CoordT &ijk, const ValueType &v)
Definition: NanoVDB.h:4422
void setOn(uint32_t n)
Set the specified bit on.
Definition: NanoVDB.h:2109
BuildT ValueType
Definition: NanoVDB.h:3813
Coord & translate(const Vec3T &xyz)
Definition: NanoVDB.h:1611
uint64_t mFlags
Definition: NanoVDB.h:3438
ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition: NanoVDB.h:5180
BBox< CoordT > bbox() const
Return the bounding box in index space of active values in this leaf node.
Definition: NanoVDB.h:4380
T type
Definition: NanoVDB.h:400
static constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition: NanoVDB.h:2996
static uint32_t FindHighestOn(uint32_t v)
Returns the index of the highest, i.e. most significant, on bit in the specified 32 bit word...
Definition: NanoVDB.h:1850
Rgba8()
Definition: NanoVDB.h:572
float mInvMatF[9]
Definition: NanoVDB.h:2226
const ValueT & getMin() const
Definition: NanoVDB.h:3501
bool getAvg() const
Definition: NanoVDB.h:4162
uint64_t getIndex(const Coord &ijk) const
Return the linear offset into a channel that maps to the specified coordinate.
Definition: NanoVDB.h:5584
static constexpr bool value
Definition: NanoVDB.h:386
Coord offsetBy(ValueType n) const
Definition: NanoVDB.h:1121
ValueType operator()(const CoordType &ijk) const
Definition: NanoVDB.h:5016
Coord operator>>(IndexType n) const
Definition: NanoVDB.h:1036
uint32_t mGridCount
Definition: NanoVDB.h:2439
CoordT mBBoxMin
Definition: NanoVDB.h:3819
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:2867
BBox(const Coord &min, const Coord &max)
Definition: NanoVDB.h:1678
uint8_t & r()
Definition: NanoVDB.h:599
void setAverageOn(bool on=true)
Definition: NanoVDB.h:2478
static constexpr uint8_t bitWidth()
Definition: NanoVDB.h:3949
bool getDev() const
Definition: NanoVDB.h:4163
bool isActive() const
Definition: NanoVDB.h:3571
MatType scale(const Vec3< typename MatType::value_type > &s)
Return a matrix that scales by s.
Definition: Mat.h:615
float getMax() const
return the quantized maximum of the active values in this node
Definition: NanoVDB.h:3905
uint64_t FloatType
Definition: NanoVDB.h:1473
NodeT * getFirstNode()
return a pointer to the first node of the specified type
Definition: NanoVDB.h:2890
float mQuantum
Definition: NanoVDB.h:3884
typename RootT::CoordType CoordType
Definition: NanoVDB.h:4657
Iterator & operator++()
Definition: NanoVDB.h:1999
BBox(const Vec3T &min, const Vec3T &max)
Definition: NanoVDB.h:1674
void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition: NanoVDB.h:4944
MaskT< LOG2 > MaskType
Definition: NanoVDB.h:4268
const LeafNode * probeLeaf(const CoordT &) const
Definition: NanoVDB.h:4446
Vec3(const Coord &ijk)
Definition: NanoVDB.h:1178
Map mMap
Definition: NanoVDB.h:2442
void setValue(uint32_t n, const ValueT &v)
Definition: NanoVDB.h:3466
bool operator<(const Rgba8 &rhs) const
Definition: NanoVDB.h:582
ValueIterator(const InternalNode *parent)
Definition: NanoVDB.h:3567
float type
Definition: NanoVDB.h:478
TreeT & tree()
Return a non-const reference to the tree.
Definition: NanoVDB.h:2601
GridType mapToGridType()
Maps from a templated value type to a GridType enum.
Definition: NanoVDB.h:1486
bool getMax() const
Definition: NanoVDB.h:4110
static uint64_t memUsage()
Definition: NanoVDB.h:3838
Definition: NanoVDB.h:3124
typename ChildT::LeafNodeType LeafNodeType
Definition: NanoVDB.h:3077
bool isActive(const CoordT &ijk) const
Return true if the voxel value at the given coordinate is active.
Definition: NanoVDB.h:4425
Bit-compacted representation of all three version numbers.
Definition: NanoVDB.h:647
const typename GridOrTreeOrRootT::RootType::ChildNodeType::ChildNodeType type
Definition: NanoVDB.h:2373
const GridBlindMetaData & blindMetaData(uint32_t n) const
Definition: NanoVDB.h:2738
const uint64_t & valueCount() const
Return total number of values indexed by the IndexGrid.
Definition: NanoVDB.h:5567
DataType * data()
Definition: NanoVDB.h:2825
bool isCached2(const CoordType &ijk) const
Definition: NanoVDB.h:4994
Type Max(Type a, Type b)
Definition: NanoVDB.h:779
typename DataType::ValueT ValueType
Definition: NanoVDB.h:3524
bool isInside(const BBox &b) const
Return true if the given bounding box is inside this bounding box.
Definition: NanoVDB.h:1783
typename GridOrTreeOrRootT::LeafNodeType Type
Definition: NanoVDB.h:2350
T ValueType
Definition: NanoVDB.h:1308
static constexpr uint32_t padding()
Definition: NanoVDB.h:3977
float mVecF[3]
Definition: NanoVDB.h:2227
Definition: NanoVDB.h:3426
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:5491
void setAvg(const bool &)
Definition: NanoVDB.h:4121
Vec3(const Vec3< T2 > &v)
Definition: NanoVDB.h:1174
const FloatType & stdDeviation() const
Return a const reference to the standard deviation of all the active values encoded in this internal ...
Definition: NanoVDB.h:3629
static uint64_t memUsage()
return memory usage in bytes for the class
Definition: NanoVDB.h:2830
const uint8_t & r() const
Definition: NanoVDB.h:595
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
Type Min(Type a, Type b)
Definition: NanoVDB.h:758
BaseBBox & intersect(const BaseBBox &bbox)
Intersect this bounding box with the given bounding box.
Definition: NanoVDB.h:1626
const TreeT & tree() const
Return a const reference to the tree.
Definition: NanoVDB.h:2598
void setMin(float min)
Definition: NanoVDB.h:3915
ValueType operator*() const
Definition: NanoVDB.h:3585
ValueType mMaximum
Definition: NanoVDB.h:3825
BaseBBox(const Vec3T &min, const Vec3T &max)
Definition: NanoVDB.h:1648
typename GridOrTreeOrRootT::LeafNodeType type
Definition: NanoVDB.h:2351
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:4149
Vec3R mVoxelSize
Definition: NanoVDB.h:2444
Definition: NanoVDB.h:398
const T & operator[](int i) const
Definition: NanoVDB.h:1192
void init(float min, float max, uint8_t bitWidth)
Definition: NanoVDB.h:3895
const Tile * tile(uint32_t n) const
Returns a non-const reference to the tile at the specified linear offset.
Definition: NanoVDB.h:3029
PointAccessor(const UInt32Grid &grid)
Definition: NanoVDB.h:5469
const LeafNodeType * getFirstLeaf() const
Definition: NanoVDB.h:2928
typename DataType::BuildT BuildType
Definition: NanoVDB.h:3083
bool is_divisible() const
Definition: NanoVDB.h:1772
Version version() const
Definition: NanoVDB.h:2573
void setMin(const bool &)
Definition: NanoVDB.h:4119
bool hasBBox() const
Definition: NanoVDB.h:2683
void setValue(uint32_t offset, const ValueType &value)
Definition: NanoVDB.h:3843
bool isOn(uint32_t n) const
Return true if the given bit is set.
Definition: NanoVDB.h:2085
FloatType variance() const
Return the variance of all the active values encoded in this leaf node.
Definition: NanoVDB.h:4351
Vec3T matMult(const float *mat, const Vec3T &xyz)
Definition: NanoVDB.h:1531
Vec3T indexToWorldF(const Vec3T &xyz) const
index to world space transformation
Definition: NanoVDB.h:2641
const ChildNodeType * probeChild(const CoordType &ijk) const
Definition: NanoVDB.h:3665
int32_t Ceil(float x)
Definition: NanoVDB.h:827
bool operator!=(const Coord &rhs) const
Definition: NanoVDB.h:1046
bool probeValue(const CoordType &ijk, ValueType &v) const
Definition: NanoVDB.h:5055
void setMin(const ValueType &v)
Definition: NanoVDB.h:3854
ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition: NanoVDB.h:5183
bool FloatType
Definition: NanoVDB.h:1467
void setStdDeviationOn(bool on=true)
Definition: NanoVDB.h:2486
bool probeValue(const CoordType &ijk, ValueType &v) const
Definition: NanoVDB.h:4842
FloatType stdDeviation() const
Return a const reference to the standard deviation of all the active values encoded in this leaf node...
Definition: NanoVDB.h:4354
Definition: NanoVDB.h:1453
const ChildT * operator->() const
Definition: NanoVDB.h:3105
typename DataType::FloatType FloatType
Definition: NanoVDB.h:4263
#define NANOVDB_DATA_ALIGNMENT
Definition: NanoVDB.h:137
ValueOnIterator beginValueOn() const
Definition: NanoVDB.h:3589
bool isActive(uint32_t n) const
Definition: NanoVDB.h:3490
typename DataType::Tile Tile
Definition: NanoVDB.h:3088
WordT & getWord(int n)
Return a reference to the nth word of the bit mask, for a word of arbitrary size. ...
Definition: NanoVDB.h:2053
Mask & operator &=(const Mask &other)
Bitwise intersection.
Definition: NanoVDB.h:2158
typename ReadAccessor< ValueT, -1, -1, -1 >::NodeInfo NodeInfo
Definition: NanoVDB.h:4773
CoordT CoordType
Definition: NanoVDB.h:4265
T length() const
Definition: NanoVDB.h:1342
T lengthSqr() const
Definition: NanoVDB.h:1203
DataType * data()
Definition: NanoVDB.h:3597
ValueIterator(const RootNode *parent)
Definition: NanoVDB.h:3130
bool isInside(const Vec3T &xyz)
Definition: NanoVDB.h:1637
Dummy type for a 16bit quantization of float point values.
Definition: NanoVDB.h:228
uint8_t ArrayType
Definition: NanoVDB.h:3973
static fileSize_t write(std::ostream &os, const GridHandle< BufferT > &handle, Codec codec)
Vec3T applyInverseMap(const Vec3T &xyz) const
Definition: NanoVDB.h:2507
typename Mask< Log2Dim >::template Iterator< On > MaskIterT
Definition: NanoVDB.h:3534
ValueOnIterator()
Definition: NanoVDB.h:4278
Vec3 operator-(const Vec3 &v) const
Definition: NanoVDB.h:1212
Coord & operator-=(const Coord &rhs)
Definition: NanoVDB.h:1084
bool hasOverlap(const BBox &b) const
Return true if the given bounding box overlaps with this bounding box.
Definition: NanoVDB.h:1789
static constexpr uint8_t bitWidth()
Definition: NanoVDB.h:3982
bool empty() const
Return true if this bounding box is empty, i.e. uninitialized.
Definition: NanoVDB.h:1776
CoordType getOrigin() const
Definition: NanoVDB.h:3169
Vec3< T2 > operator/(T1 scalar, const Vec3< T2 > &vec)
Definition: NanoVDB.h:1282
ValueOnIterator()
Definition: NanoVDB.h:3160
CoordType mBBoxMin
Definition: NanoVDB.h:4668
uint16_t ArrayType
Definition: NanoVDB.h:4000
ValueT value
Definition: NanoVDB.h:3023
Node caching at all (three) tree levels.
Definition: NanoVDB.h:5136
BBox()
Definition: NanoVDB.h:1669
bool isPointData() const
Definition: NanoVDB.h:2679
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:3216
ValueType getValue(const CoordType &ijk) const
Return the value of the given voxel (regardless of state or location in the tree.) ...
Definition: NanoVDB.h:2839
const LeafT * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:5070
ChildIterator()
Definition: NanoVDB.h:3098
Vec4 & operator=(const Vec4T &rhs)
Definition: NanoVDB.h:1326
bool operator>=(const Version &rhs) const
Definition: NanoVDB.h:667
Stuct with all the member data of the LeafNode (useful during serialization of an openvdb LeafNode) ...
Definition: NanoVDB.h:3809
GridBlindDataSemantic
Blind-data Semantics that are currently understood by NanoVDB.
Definition: NanoVDB.h:343
uint32_t packed
Definition: NanoVDB.h:562
Version mVersion
Definition: NanoVDB.h:2436
ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition: NanoVDB.h:4679
bool isCached1(const CoordType &ijk) const
Definition: NanoVDB.h:4988
GridFlags
Grid flags which indicate what extra information is present in the grid buffer.
Definition: NanoVDB.h:306
uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition: NanoVDB.h:4726
void setOrigin(const T &ijk)
Definition: NanoVDB.h:4237
static uint32_t FindLowestOn(uint32_t v)
Returns the index of the lowest, i.e. least significant, on bit in the specified 32 bit word...
Definition: NanoVDB.h:1818
uint32_t mFlags
Definition: NanoVDB.h:2437
double mInvMatD[9]
Definition: NanoVDB.h:2230
const uint8_t & a() const
Definition: NanoVDB.h:598
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:5396
RootT RootType
Definition: NanoVDB.h:2807
NodeInfo getNodeInfo(const CoordType &ijk) const
Definition: NanoVDB.h:4705
uint64_t activeVoxelCount() const
Return the total number of active voxels in this tree.
Definition: NanoVDB.h:2860
Definition: NanoVDB.h:208
float type
Definition: NanoVDB.h:471
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:3623
const IndexGrid & grid() const
Return a const reference to the IndexGrid.
Definition: NanoVDB.h:5558
float Type
Definition: NanoVDB.h:477
bool probeValue(const CoordType &ijk, ValueType &v) const
Combines the previous two methods in a single call.
Definition: NanoVDB.h:2848
bool getValue(uint32_t i) const
Definition: NanoVDB.h:4159
GridType mGridType
Definition: NanoVDB.h:2446
Vec3 & operator-=(const Vec3 &v)
Definition: NanoVDB.h:1222
uint64_t mChecksum
Definition: NanoVDB.h:2435
Definition: NanoVDB.h:1990
NodeTrait< RootT, 1 >::type * getFirstLower()
Definition: NanoVDB.h:2929
const ValueT & getMax() const
Definition: NanoVDB.h:3502
Vec3 operator-() const
Definition: NanoVDB.h:1208
Vec3 cross(const Vec3T &v) const
Definition: NanoVDB.h:1197
Bit-mask to encode active states and facilitate sequential iterators and a fast codec for I/O compres...
Definition: NanoVDB.h:1956
bool operator<(const Coord &rhs) const
Return true if this Coord is lexicographically less than the given Coord.
Definition: NanoVDB.h:1039
int32_t & x()
Definition: NanoVDB.h:1000
static size_t memUsage()
Definition: NanoVDB.h:1008
void setOff()
Set all bits off.
Definition: NanoVDB.h:2135
AccessorType getAccessor() const
Definition: NanoVDB.h:2836
static ElementType scalar(const T &v)
Definition: NanoVDB.h:1447
const Vec3R & voxelSize() const
Return a vector of the axial voxel sizes.
Definition: NanoVDB.h:5564
static void read(std::istream &is, GridHandle< BufferT > &handle, Codec codec)
const void * blindData(uint32_t n) const
Returns a const pointer to the blindData at the specified linear offset.
Definition: NanoVDB.h:2729
void toggle()
brief Toggle the state of all bits in the mask
Definition: NanoVDB.h:2149
ValueType operator()(int i, int j, int k) const
Definition: NanoVDB.h:4821
uint64_t mData2
Definition: NanoVDB.h:2450
typename ChildT::ValueType ValueT
Definition: NanoVDB.h:2954
float mMinimum
Definition: NanoVDB.h:3883
uint32_t gridCount() const
Return total number of grids in the buffer.
Definition: NanoVDB.h:2589
CoordType getOrigin() const
Definition: NanoVDB.h:3106
Coord round() const
Definition: NanoVDB.h:1273
static constexpr uint8_t bitWidth()
Definition: NanoVDB.h:4010
void setMax(const ValueType &)
Definition: NanoVDB.h:4170
T Pow4(T x)
Definition: NanoVDB.h:849
KeyT key
Definition: NanoVDB.h:3020
bool getValue(uint32_t i) const
Definition: NanoVDB.h:4108
float getValue(uint32_t i) const
Definition: NanoVDB.h:3950
const LeafT * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:5324
typename DataType::StatsT FloatType
Definition: NanoVDB.h:3525
bool isChild(uint32_t n) const
Definition: NanoVDB.h:3496
bool ValueType
Definition: NanoVDB.h:4091
A simple vector class with three double components, similar to openvdb::math::Vec3.
Definition: NanoVDB.h:963
Mask & operator^=(const Mask &other)
Bitwise XOR.
Definition: NanoVDB.h:2182
bool getMin() const
Definition: NanoVDB.h:4160
uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition: NanoVDB.h:5086
size_t memUsage() const
Definition: NanoVDB.h:4037
Top-most node of the VDB tree structure.
Definition: NanoVDB.h:3073
void setValue(uint32_t offset, bool v)
Definition: NanoVDB.h:4113
typename ReadAccessor< ValueT, -1, -1, -1 >::NodeInfo NodeInfo
Definition: NanoVDB.h:5165
int64_t child
Definition: NanoVDB.h:3429
const typename GridOrTreeOrRootT::RootType Type
Definition: NanoVDB.h:2401
#define NANOVDB_MAJOR_VERSION_NUMBER
Definition: NanoVDB.h:123
static uint64_t memUsage()
Definition: NanoVDB.h:4209
ValueType operator*() const
Definition: NanoVDB.h:4311
uint8_t ArrayType
Definition: NanoVDB.h:3939
const ChildT * getChild(const Tile *tile) const
Definition: NanoVDB.h:3048
Struct to derive node type from its level in a given grid, tree or root while preserving constness...
Definition: NanoVDB.h:2343
typename GridT::TreeType type
Definition: NanoVDB.h:2785
T & getValue(const Coord &ijk, T *channelPtr) const
Return the value from a specified channel that maps to the specified coordinate.
Definition: NanoVDB.h:5604
Vec3T worldToIndexF(const Vec3T &xyz) const
world to index space transformation
Definition: NanoVDB.h:2637
const RootT & root() const
Definition: NanoVDB.h:4796
static CoordT KeyToCoord(const KeyT &key)
Definition: NanoVDB.h:2972
typename RootT::ChildNodeType Node2
Definition: NanoVDB.h:2815
float getValue(uint32_t i) const
Definition: NanoVDB.h:4011
Vec3 & minComponent(const Vec3 &other)
Perform a component-wise minimum with the other Coord.
Definition: NanoVDB.h:1239
const char * c_str() const
Definition: NanoVDB.h:674
ValueType mMinimum
Definition: NanoVDB.h:3824
uint8_t mFlags
Definition: NanoVDB.h:4198
uint32_t getPatch() const
Definition: NanoVDB.h:671
const Vec3T & max() const
Definition: NanoVDB.h:1610
ChannelT & operator()(int i, int j, int k) const
Definition: NanoVDB.h:5590
bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:4710
typename GridOrTreeOrRootT::RootType::ChildNodeType Type
Definition: NanoVDB.h:2379
uint64_t Type
Definition: NanoVDB.h:449
const LeafT * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:4850
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:2692
ValueT mMaximum
Definition: NanoVDB.h:3443
BBox(const CoordT &min, const CoordT &max)
Definition: NanoVDB.h:1752
void setValueOnly(uint32_t offset, const ValueType &value)
Definition: NanoVDB.h:3842
ValueType mMinimum
Definition: NanoVDB.h:4664
Vec3T & max()
Definition: NanoVDB.h:1608
T ElementType
Definition: NanoVDB.h:1435
bool hasAverage() const
Definition: NanoVDB.h:2685
Vec4 & operator+=(const Vec4 &v)
Definition: NanoVDB.h:1350
Coord & maxComponent(const Coord &other)
Perform a component-wise maximum with the other Coord.
Definition: NanoVDB.h:1105
float Type
Definition: NanoVDB.h:491
bool isEmpty() const
Return true if this tree is empty, i.e. contains no values or nodes.
Definition: NanoVDB.h:2845
Struct with all the member data of the RootNode (useful during serialization of an openvdb RootNode) ...
Definition: NanoVDB.h:2952
BBox expandBy(typename CoordT::ValueType padding) const
Return a new instance that is expanded by the specified padding.
Definition: NanoVDB.h:1803
ValueType operator*() const
Definition: NanoVDB.h:3135
openvdb::GridBase Grid
Definition: Utils.h:34
static BBox createCube(const Coord &min, typename Coord::ValueType dim)
Definition: NanoVDB.h:1683
bool probeValue(const CoordType &ijk, ValueType &v) const
return the state and updates the value of the specified voxel
Definition: NanoVDB.h:3648
static T * alignPtr(T *p)
offset the specified pointer so it is aligned.
Definition: NanoVDB.h:518
int32_t Floor(float x)
Definition: NanoVDB.h:818
Mask()
Initialize all bits to zero.
Definition: NanoVDB.h:2024
CoordT getCoord() const
Definition: NanoVDB.h:4282
static constexpr bool value
Definition: NanoVDB.h:358
double FloatType
Definition: NanoVDB.h:1461
static DstT * PtrAdd(SrcT *p, int64_t offset)
Definition: NanoVDB.h:542
const MaskType< LOG2DIM > & childMask() const
Return a const reference to the bit mask of child nodes in this internal node.
Definition: NanoVDB.h:3611
bool isCached(const CoordType &ijk) const
Definition: NanoVDB.h:4803
ValueIterator()
Definition: NanoVDB.h:3566
Delta for small floating-point offsets.
Definition: NanoVDB.h:704
GridClass mGridClass
Definition: NanoVDB.h:2445
Vec3T applyInverseJacobian(const Vec3T &xyz) const
Definition: NanoVDB.h:2511
Dummy type for a voxel whose value equals an offset into an external value array. ...
Definition: NanoVDB.h:213
Maps one type (e.g. the build types above) to other (actual) types.
Definition: NanoVDB.h:440
Coord()
Initialize all coordinates to zero.
Definition: NanoVDB.h:974
const Vec3R & voxelSize() const
Return a const reference to the size of a voxel in world units.
Definition: NanoVDB.h:2607
Coord floor() const
Definition: NanoVDB.h:1271
CoordT origin() const
Return the origin in index space of this leaf node.
Definition: NanoVDB.h:4359
DataType * data()
Definition: NanoVDB.h:4334
ValueType getValue(uint32_t i) const
Definition: NanoVDB.h:3841
void setMax(float max)
Definition: NanoVDB.h:3918
ValueType max() const
Return the largest vector component.
Definition: NanoVDB.h:1267
double ValueType
Definition: NanoVDB.h:1163
CoordT origin() const
Definition: NanoVDB.h:3019
typename ChildT::CoordType CoordType
Definition: NanoVDB.h:3085
OffIterator beginOff() const
Definition: NanoVDB.h:2021
CoordT dim() const
Definition: NanoVDB.h:1779
uint32_t getMinor() const
Definition: NanoVDB.h:670
const typename GridOrTreeOrRootT::RootType::ChildNodeType Type
Definition: NanoVDB.h:2386
double mMatD[9]
Definition: NanoVDB.h:2229
void setChild(uint32_t n, const void *ptr)
Definition: NanoVDB.h:3459
Vec3T indexToWorld(const Vec3T &xyz) const
index to world space transformation
Definition: NanoVDB.h:2618
const ValueT & getMax() const
Definition: NanoVDB.h:3055
bool isActive() const
Definition: NanoVDB.h:3018
void setMax(const ValueT &v)
Definition: NanoVDB.h:3507
const GridType & gridType() const
Definition: NanoVDB.h:2672
bool operator<=(const Version &rhs) const
Definition: NanoVDB.h:665
static uint32_t padding()
Definition: NanoVDB.h:4396
const typename GridOrTreeOrRootT::LeafNodeType type
Definition: NanoVDB.h:2358
static size_t memUsage()
Return memory usage in bytes for the class.
Definition: NanoVDB.h:3605
const NodeT * getFirstNode() const
return a const pointer to the first node of the specified type
Definition: NanoVDB.h:2900
static Coord Floor(const Vec3T &xyz)
Return the largest integer coordinates that are not greater than xyz (node centered conversion)...
Definition: NanoVDB.h:1133
bool isApproxZero(const Type &x)
Definition: NanoVDB.h:752
Vec3T applyInverseJacobianF(const Vec3T &xyz) const
Definition: NanoVDB.h:2270
bool hasMinMax() const
Definition: NanoVDB.h:2682
static double value()
Definition: NanoVDB.h:697
Definition: NanoVDB.h:1655
Vec3T applyIJT(const Vec3T &xyz) const
Definition: NanoVDB.h:2273
float getValue(uint32_t i) const
Definition: NanoVDB.h:3983
CoordT CoordType
Definition: NanoVDB.h:4918
T Abs(T x)
Definition: NanoVDB.h:854
Vec3 operator+(const Vec3 &v) const
Definition: NanoVDB.h:1211
typename Node2::ChildNodeType Node1
Definition: NanoVDB.h:2816
Definition: NanoVDB.h:3093
Dummy type for a 16 bit floating point values.
Definition: NanoVDB.h:219
#define NANOVDB_MAGIC_NUMBER
Definition: NanoVDB.h:121
float Fract(float x)
Definition: NanoVDB.h:809
NodeTrait< RootT, 2 >::type * getFirstUpper()
Definition: NanoVDB.h:2931
uint8_t & g()
Definition: NanoVDB.h:600
const IndexTree & tree() const
Return a const reference to the tree of the IndexGrid.
Definition: NanoVDB.h:5561
Iterator & operator=(const Iterator &)=default
float getDev() const
return the quantized standard deviation of the active values in this node
Definition: NanoVDB.h:3912
Coord operator<<(IndexType n) const
Definition: NanoVDB.h:1033
uint8_t c[4]
Definition: NanoVDB.h:561
#define ROOT_LEVEL
Definition: CNanoVDB.h:53
Coord & operator>>=(uint32_t n)
Definition: NanoVDB.h:1061
bool isMask() const
Definition: NanoVDB.h:2680
int64_t child
Definition: NanoVDB.h:3021
uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition: NanoVDB.h:5342
BuildT ArrayType
Definition: NanoVDB.h:3816
uint32_t mBlindMetadataCount
Definition: NanoVDB.h:2448
ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition: NanoVDB.h:4938
void setDev(const T &dev, T *p)
Definition: NanoVDB.h:4235
T dot(const Vec4T &v) const
Definition: NanoVDB.h:1337
float mMatF[9]
Definition: NanoVDB.h:2225
Vec3T applyJacobianF(const Vec3T &xyz) const
Definition: NanoVDB.h:2520
uint32_t CountOn(uint64_t v)
Definition: NanoVDB.h:1931
Vec3T worldToIndex(const Vec3T &xyz) const
world to index space transformation
Definition: NanoVDB.h:2614
Vec3(T x, T y, T z)
Definition: NanoVDB.h:1169
ChildIterator beginChild() const
Definition: NanoVDB.h:3558
bool BuildType
Definition: NanoVDB.h:4092
8-bit red, green, blue, alpha packed into 32 bit unsigned int
Definition: NanoVDB.h:558
ValueT ValueType
Definition: NanoVDB.h:4768
NodeInfo getNodeInfo(const CoordType &ijk) const
Definition: NanoVDB.h:5273
bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:5290
ValueType min() const
Return the smallest vector component.
Definition: NanoVDB.h:1262
bool operator<(const Version &rhs) const
Definition: NanoVDB.h:664
Version(uint32_t major, uint32_t minor, uint32_t patch)
Definition: NanoVDB.h:656
VecT< GridHandleT > readUncompressedGrids(const char *fileName, const typename GridHandleT::BufferType &buffer=typename GridHandleT::BufferType())
Read a multiple un-compressed NanoVDB grids from a file and return them as a vector.
Definition: NanoVDB.h:5748
static constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition: NanoVDB.h:3833
bool isEmpty() const
Return true if this grid is empty, i.e. contains no values or nodes.
Definition: NanoVDB.h:2718
Dummy type for a variable bit quantization of floating point values.
Definition: NanoVDB.h:231
Vec3T applyJacobian(const Vec3T &xyz) const
Definition: NanoVDB.h:2252
ValueOnIterator(const InternalNode *parent)
Definition: NanoVDB.h:3583
int MaxIndex(const Vec3T &v)
Definition: NanoVDB.h:934
Vec3T applyMapF(const Vec3T &xyz) const
Definition: NanoVDB.h:2516
NodeInfo getNodeInfo(const CoordType &ijk) const
Definition: NanoVDB.h:4826
static const int SIZE
Definition: NanoVDB.h:565
StatsT mAverage
Definition: NanoVDB.h:2990
const uint8_t & operator[](int n) const
Definition: NanoVDB.h:591
const Map & map() const
Return a const reference to the Map for this grid.
Definition: NanoVDB.h:2610
ValueIterator & operator++()
Definition: NanoVDB.h:4315
Vec3T applyIJTF(const Vec3T &xyz) const
Definition: NanoVDB.h:2275
Visits all values in a leaf node, i.e. both active and inactive values.
Definition: NanoVDB.h:4303
Vec3 & operator/=(const T &s)
Definition: NanoVDB.h:1236
Rgba8(uint8_t r, uint8_t g, uint8_t b, uint8_t a=255u)
Definition: NanoVDB.h:573
T type
Definition: NanoVDB.h:378
Visits active tile values of this node only.
Definition: NanoVDB.h:3577
void setOrigin(const T &ijk)
Definition: NanoVDB.h:4125
int32_t & z()
Definition: NanoVDB.h:1002
Visits all inactive values in a leaf node.
Definition: NanoVDB.h:4288
Vec3T applyJacobianF(const Vec3T &xyz) const
Definition: NanoVDB.h:2254
bool isFloatingPoint(GridType gridType)
return true if the GridType maps to a floating point value.
Definition: NanoVDB.h:610
Coord & operator+=(int n)
Definition: NanoVDB.h:1068
typename RootT::ValueType ValueType
Definition: NanoVDB.h:2809
uint64_t ValueType
Definition: NanoVDB.h:4190
ChannelT & operator()(const Coord &ijk) const
Definition: NanoVDB.h:5589
uint32_t pos() const
Definition: NanoVDB.h:3108
const RootT & root() const
Definition: NanoVDB.h:2834
Mask & operator-=(const Mask &other)
Bitwise difference.
Definition: NanoVDB.h:2174
float FloatType
Definition: NanoVDB.h:1455
Vec3T applyMap(const Vec3T &xyz) const
Definition: NanoVDB.h:2247
bool isUnknown() const
Definition: NanoVDB.h:2681
uint32_t IndexType
Definition: NanoVDB.h:971
Iterator()
Definition: NanoVDB.h:1993
typename ChildT::BuildType BuildT
Definition: NanoVDB.h:2955
const DataType * data() const
Definition: NanoVDB.h:2577
typename TreeT::ValueType ValueType
Definition: NanoVDB.h:2561
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:5503
const BBox< CoordType > & indexBBox() const
Computes a AABB of active values in index space.
Definition: NanoVDB.h:2665
ValueT value
Definition: GridBuilder.h:1290
float ValueType
Definition: NanoVDB.h:3875
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:5536
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:3626
CoordT Round(const Vec3T< RealT > &xyz)
enable_if< is_same< T, ValueIndex >::value, uint64_t >::type valueCount() const
Return the total number of values indexed by this IndexGrid.
Definition: NanoVDB.h:2595
Vec3< double > asVec3d() const
Return a double precision floating-point vector of this coordinate.
Definition: NanoVDB.h:1296
void setOrigin(const T &ijk)
Definition: NanoVDB.h:3860
typename ChildT::template MaskType< LOG2DIM > MaskT
Definition: NanoVDB.h:3423
ValueType mMaximum
Definition: NanoVDB.h:4665
bool operator!=(const BaseBBox &rhs) const
Definition: NanoVDB.h:1604
static uint32_t wordCount()
Return the number of machine words used by this Mask.
Definition: NanoVDB.h:1970
BBox()
Definition: NanoVDB.h:1748
ValueIterator operator++(int)
Definition: NanoVDB.h:3146
Vec3T applyIJTF(const Vec3T &xyz) const
Definition: NanoVDB.h:2524
uint8_t mFlags
Definition: NanoVDB.h:4148
void setValue(uint32_t offset, uint64_t)
Definition: NanoVDB.h:4215
Vec3 operator/(const T &s) const
Definition: NanoVDB.h:1214
typename GridOrTreeOrRootT::RootType::ChildNodeType::ChildNodeType Type
Definition: NanoVDB.h:2365
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:3881
int64_t mBlindMetadataOffset
Definition: NanoVDB.h:2447
float mTaperF
Definition: NanoVDB.h:2228
void setAvg(const FloatType &v)
Definition: NanoVDB.h:3856
ReadAccessor(const RootT &root)
Constructor from a root node.
Definition: NanoVDB.h:5168
ValueType maximum() const
Return a const reference to the maximum active value encoded in this leaf node.
Definition: NanoVDB.h:4345
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:3219
ValueType operator*() const
Definition: NanoVDB.h:4296
void setAvg(const StatsT &v)
Definition: NanoVDB.h:3508
T type
Definition: NanoVDB.h:406
bool isValue() const
Definition: NanoVDB.h:3017
ChildIterator()
Definition: NanoVDB.h:3550
bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:3641
BBox(const BaseBBox< Coord > &bbox)
Definition: NanoVDB.h:1688
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:3222
const char * gridName() const
Return a c-string with the name of this grid.
Definition: NanoVDB.h:2700
Vec4 & minComponent(const Vec4 &other)
Perform a component-wise minimum with the other Coord.
Definition: NanoVDB.h:1377
typename RootT::LeafNodeType LeafNodeType
Definition: NanoVDB.h:2808
const LeafT * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:4720
CoordT mBBoxMin
Definition: NanoVDB.h:4097
static CoordT OffsetToLocalCoord(uint32_t n)
Definition: NanoVDB.h:4361
T & operator[](int i)
Definition: NanoVDB.h:1193
ValueOnIterator operator++(int)
Definition: NanoVDB.h:3176
Vec3T & operator[](int i)
Definition: NanoVDB.h:1606
void setValueOnly(uint32_t offset, const ValueType &v)
Sets the value at the specified location but leaves its state unchanged.
Definition: NanoVDB.h:4421
static const int SIZE
Definition: NanoVDB.h:1307
Vec3T applyIJT(const Vec3T &xyz) const
Definition: NanoVDB.h:2513
uint32_t pos() const
Definition: NanoVDB.h:3168
void setMax(const bool &)
Definition: NanoVDB.h:4120
typename ChildT::BuildType BuildT
Definition: NanoVDB.h:3420
void setLongGridNameOn(bool on=true)
Definition: NanoVDB.h:2470
static uint64_t memUsage()
Definition: NanoVDB.h:3457
bool getAvg() const
Definition: NanoVDB.h:4111
void setDev(const FloatType &v)
Definition: NanoVDB.h:3857
float getMin() const
return the quantized minimum of the active values in this node
Definition: NanoVDB.h:3902
uint32_t nodeCount() const
Definition: NanoVDB.h:2874
Iterator(uint32_t pos, const Mask *parent)
Definition: NanoVDB.h:1994
uint64_t activeVoxelCount() const
Return the total number of active voxels in this tree.
Definition: NanoVDB.h:2668
const NodeTrait< TreeT, LEVEL >::type * getNode() const
Definition: NanoVDB.h:5204
void setDev(const bool &)
Definition: NanoVDB.h:4122
ValueType getValue(const CoordType &ijk) const
Definition: NanoVDB.h:5248
DataType * data()
Definition: NanoVDB.h:2575
ValueType operator*() const
Definition: NanoVDB.h:3569
Vec3T mCoord[2]
Definition: NanoVDB.h:1602
ValueT mMinimum
Definition: NanoVDB.h:3442
RootT & root()
Definition: NanoVDB.h:2832
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:4100
bool operator==(const Rgba8 &rhs) const
Definition: NanoVDB.h:583
const BBox< Vec3R > & worldBBox() const
Computes a AABB of active values in world space.
Definition: NanoVDB.h:2659
Coord ceil() const
Definition: NanoVDB.h:1272
Coord operator &(IndexType n) const
Return a new instance with coordinates masked by the given unsigned integer.
Definition: NanoVDB.h:1030
const LeafNodeType * probeLeaf(const CoordType &ijk) const
Definition: NanoVDB.h:3657
ValueIterator(const LeafNode *parent)
Definition: NanoVDB.h:4309
Dummy type for a 8bit quantization of float point values.
Definition: NanoVDB.h:225
ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition: NanoVDB.h:4941
Maximum floating-point values.
Definition: NanoVDB.h:720
void setOrigin(const T &ijk)
Definition: NanoVDB.h:3927
Dummy type for a voxel whose value equals its binary active state.
Definition: NanoVDB.h:216
AccessorType getAccessor() const
Return a new instance of a ReadAccessor used to access values in this grid.
Definition: NanoVDB.h:2604
const CoordT & operator*() const
Definition: NanoVDB.h:1745
const T & operator[](int i) const
Definition: NanoVDB.h:1334
Vec4 operator*(const T &s) const
Definition: NanoVDB.h:1348
Version()
Definition: NanoVDB.h:651
static constexpr uint32_t padding()
Definition: NanoVDB.h:4031
const uint8_t & b() const
Definition: NanoVDB.h:597
bool isValid() const
Methods related to the classification of this grid.
Definition: NanoVDB.h:2671
Vec3T applyJacobian(const Vec3T &xyz) const
Definition: NanoVDB.h:2509
int32_t & y()
Definition: NanoVDB.h:1001
Vec3T applyInverseMap(const Vec3T &xyz) const
Definition: NanoVDB.h:2257
Vec3 & operator*=(const T &s)
Definition: NanoVDB.h:1229
uint32_t mGridIndex
Definition: NanoVDB.h:2438
T dot(const Vec3T &v) const
Definition: NanoVDB.h:1195
uint64_t mVoxelCount
Definition: NanoVDB.h:2762
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:3210
uint64_t type
Definition: NanoVDB.h:450
static Coord OffsetToLocalCoord(uint32_t n)
Definition: NanoVDB.h:3686
static constexpr uint32_t padding()
Definition: NanoVDB.h:4005
int32_t y() const
Definition: NanoVDB.h:997
Coord operator-(const Coord &rhs) const
Definition: NanoVDB.h:1076
const char * toStr(GridType gridType)
Retuns a c-string used to describe a GridType.
Definition: NanoVDB.h:267
CoordType getOrigin() const
Definition: NanoVDB.h:3555
ValueType getMin() const
Definition: NanoVDB.h:3849
BBox< Vec3R > mWorldBBox
Definition: NanoVDB.h:2443
ValueOnIterator()
Definition: NanoVDB.h:3582
CoordT CoordType
Definition: NanoVDB.h:5161
bool isEmpty() const
Return true if this RootNode is empty, i.e. contains no values or nodes.
Definition: NanoVDB.h:3248
#define NANOVDB_ASSERT(x)
Definition: NanoVDB.h:173
ValueT mBackground
Definition: NanoVDB.h:2987
ValueOnIterator beginValueOn() const
Definition: NanoVDB.h:4285
BBox< CoordT > mBBox
Definition: NanoVDB.h:3437
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:2857
const typename GridOrTreeOrRootT::RootType::ChildNodeType type
Definition: NanoVDB.h:2387
const uint32_t & tileCount() const
Return the number of tiles encoded in this root node.
Definition: NanoVDB.h:3207
void ArrayType
Definition: NanoVDB.h:4143
const Vec3T & operator[](int i) const
Definition: NanoVDB.h:1605
Defines an affine transform and its inverse represented as a 3x3 matrix and a vec3 translation...
Definition: NanoVDB.h:2223
float Type
Definition: NanoVDB.h:470
bool operator!=(const Vec3 &rhs) const
Definition: NanoVDB.h:1183
static double value()
Definition: NanoVDB.h:713
Coord(ValueType n)
Initializes all coordinates to the given signed integer.
Definition: NanoVDB.h:980
bool operator>(const Version &rhs) const
Definition: NanoVDB.h:666
GridType
List of types that are currently supported by NanoVDB.
Definition: NanoVDB.h:243
ValueType operator()(const CoordType &ijk) const
Definition: NanoVDB.h:4817
typename TreeT::CoordType CoordType
Definition: NanoVDB.h:2563
void setValue(const CoordT &ijk, const ValueType &v)
Sets the value at the specified location and activate its state.
Definition: NanoVDB.h:4416
bool isPointIndex() const
Definition: NanoVDB.h:2677
const uint8_t & g() const
Definition: NanoVDB.h:596
bool operator==(const Version &rhs) const
Definition: NanoVDB.h:663
uint32_t operator*() const
Definition: NanoVDB.h:1996
Class to access points at a specific voxel location.
Definition: NanoVDB.h:5460
uint64_t getMin() const
Definition: NanoVDB.h:4211
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:4200
void setChild(const CoordType &k, const ChildT *ptr, const RootData *data)
Definition: NanoVDB.h:3003
Vec4 & operator*=(const T &s)
Definition: NanoVDB.h:1366
Vec3 & operator=(const Vec3T &rhs)
Definition: NanoVDB.h:1185
ValueT mMaximum
Definition: NanoVDB.h:2989
CoordT mBBoxMin
Definition: NanoVDB.h:4196
Vec3T indexToWorldGradF(const Vec3T &grad) const
Transforms the gradient from index space to world space.
Definition: NanoVDB.h:2656
Vec3T applyInverseJacobian(const Vec3T &xyz) const
Definition: NanoVDB.h:2268
uint32_t pos() const
Definition: NanoVDB.h:1997
ValueT mMinimum
Definition: NanoVDB.h:2988
NodeTrait< RootT, LEVEL >::type * getFirstNode()
return a pointer to the first node at the specified level
Definition: NanoVDB.h:2911
ValueType operator*() const
Definition: NanoVDB.h:4281
bool isInside(const CoordT &p) const
Definition: NanoVDB.h:1781
bool FloatType
Definition: NanoVDB.h:1479
ChildIterator beginChild() const
Definition: NanoVDB.h:3122
static KeyT CoordToKey(const CoordType &ijk)
Definition: NanoVDB.h:2964
void set(const Mat3T &mat, const Mat3T &invMat, const Vec3T &translate, double taper)
Initialize the member data.
Definition: NanoVDB.h:2279
ChildIterator operator++(int)
Definition: NanoVDB.h:3115
FloatType average() const
Return a const reference to the average of all the active values encoded in this leaf node...
Definition: NanoVDB.h:4348
void clear()
Reset this access to its initial state, i.e. with an empty cache.
Definition: NanoVDB.h:5213
const char * shortGridName() const
Return a c-string with the name of this grid, truncated to 255 characters.
Definition: NanoVDB.h:2712
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:5481
typename ChildT::ValueType ValueT
Definition: NanoVDB.h:3419
bool isCached(const CoordType &ijk) const
Definition: NanoVDB.h:5242
BBox< CoordT > mBBox
Definition: NanoVDB.h:2984
float Sqrt(float x)
Return the square root of a floating-point value.
Definition: NanoVDB.h:902
static Coord max()
Definition: NanoVDB.h:1004
CoordType mBBoxMax
Definition: NanoVDB.h:4669
const ValueType & background() const
Return the total number of active voxels in the root and all its child nodes.
Definition: NanoVDB.h:3204
Vec3< T2 > operator*(T1 scalar, const Vec3< T2 > &vec)
Definition: NanoVDB.h:1277
int MinIndex(const Vec3T &v)
Definition: NanoVDB.h:917
uint8_t mFlags
Definition: NanoVDB.h:3880
FloatType mAverage
Definition: NanoVDB.h:4666
uint32_t id() const
Definition: NanoVDB.h:668
bool isOff() const
Return true if none of the bits are set in this Mask.
Definition: NanoVDB.h:2100
Internal nodes of a VDB treedim(),.
Definition: NanoVDB.h:3520
Vec3T indexToWorldGrad(const Vec3T &grad) const
transform the gradient from index space to world space.
Definition: NanoVDB.h:2633
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:5593
ValueType operator()(int i, int j, int k) const
Definition: NanoVDB.h:5268
uint8_t & b()
Definition: NanoVDB.h:601
ValueOffIterator beginValueOff() const
Definition: NanoVDB.h:4300
static const int SIZE
Definition: NanoVDB.h:1162
static constexpr uint32_t padding()
Return padding of this class in bytes, due to aliasing and 32B alignment.
Definition: NanoVDB.h:3451
#define NANOVDB_HOSTDEV_DISABLE_WARNING
Definition: NanoVDB.h:202
typename ReadAccessor< ValueT,-1,-1,-1 >::NodeInfo NodeInfo
Definition: NanoVDB.h:4922
ValueT ValueType
Definition: NanoVDB.h:5160
const ChildT & operator*() const
Definition: NanoVDB.h:3553
TreeT TreeType
Definition: NanoVDB.h:2558
bool isFogVolume() const
Definition: NanoVDB.h:2675
Base-class for quantized float leaf nodes.
Definition: NanoVDB.h:3871
static constexpr uint32_t padding()
Definition: NanoVDB.h:4104
bool operator==(const Vec3 &rhs) const
Definition: NanoVDB.h:1182
Vec4 & maxComponent(const Vec4 &other)
Perform a component-wise maximum with the other Coord.
Definition: NanoVDB.h:1391
FloatType getAvg() const
Definition: NanoVDB.h:3851
ValueIterator beginValue() const
Definition: NanoVDB.h:3574
Definition: NanoVDB.h:2756
const StatsT & average() const
Definition: NanoVDB.h:3056
const RootT * getRoot() const
Definition: NanoVDB.h:2769
static constexpr uint64_t memUsage()
Definition: NanoVDB.h:4004
OnIterator beginOn() const
Definition: NanoVDB.h:2019
Coord & operator &=(int n)
Definition: NanoVDB.h:1047
Iterator< false > OffIterator
Definition: NanoVDB.h:2017
bool isLevelSet() const
Definition: NanoVDB.h:2674
ValueType getValue(const CoordType &ijk) const
Definition: NanoVDB.h:4692
Struct with all the member data of the InternalNode (useful during serialization of an openvdb Intern...
Definition: NanoVDB.h:3417
Vec3T applyInverseMapF(const Vec3T &xyz) const
Definition: NanoVDB.h:2518
CoordT getCoord() const
Definition: NanoVDB.h:4297
ValueOnIterator(const LeafNode *parent)
Definition: NanoVDB.h:4279
const typename GridT::TreeType Type
Definition: NanoVDB.h:2790
uint8_t & a()
Definition: NanoVDB.h:602
float Clamp(float x, float a, float b)
Definition: NanoVDB.h:800
BaseBBox & expand(const Vec3T &xyz)
Definition: NanoVDB.h:1618
bool probeValue(const CoordType &ijk, ValueType &v) const
Definition: NanoVDB.h:3250
bool isGridIndex() const
Definition: NanoVDB.h:2678
Dummy type for a 4bit quantization of float point values.
Definition: NanoVDB.h:222
typename ChildT::CoordType CoordT
Definition: NanoVDB.h:3422
Vec3T Vec3Type
Definition: NanoVDB.h:1664
Vec3 operator*(const T &s) const
Definition: NanoVDB.h:1213
bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:4834
const ChildT * operator->() const
Definition: NanoVDB.h:3554
static bool lessThan(const Coord &a, const Coord &b)
Definition: NanoVDB.h:1125
Vec3 & maxComponent(const Vec3 &other)
Perform a component-wise maximum with the other Coord.
Definition: NanoVDB.h:1251
const typename GridT::TreeType type
Definition: NanoVDB.h:2791
RootT * getRoot()
Definition: NanoVDB.h:2767
Iterator operator++(int)
Definition: NanoVDB.h:2004
Vec3T indexToWorldDir(const Vec3T &dir) const
transformation from index space direction to world space direction
Definition: NanoVDB.h:2623
typename GridOrTreeOrRootT::RootType Type
Definition: NanoVDB.h:2393
BBox< Vec3< RealT > > asReal() const
Definition: NanoVDB.h:1796
uint8_t mFlags
Definition: NanoVDB.h:4099
static const bool value
Definition: NanoVDB.h:428
bool hasLongGridName() const
Definition: NanoVDB.h:2684
static uint64_t memUsage()
Definition: NanoVDB.h:4152
NanoBuildT type
Definition: NanoVDB.h:443
void setValue(uint32_t offset, bool)
Definition: NanoVDB.h:4164
void toggle(uint32_t n)
Definition: NanoVDB.h:2155
uint64_t volume() const
Definition: NanoVDB.h:1780
AccessorType getAccessor() const
Definition: NanoVDB.h:3191
uint32_t hash() const
Return a hash key derived from the existing coordinates.
Definition: NanoVDB.h:1138
static T value()
Definition: NanoVDB.h:746
void localToGlobalCoord(Coord &ijk) const
Converts (in place) a local index coordinate to a global index coordinate.
Definition: NanoVDB.h:4369
CoordT getCoord() const
Definition: NanoVDB.h:4312
Struct with all the member data of the Grid (useful during serialization of an openvdb grid) ...
Definition: NanoVDB.h:2431
bool ValueType
Definition: NanoVDB.h:4140
typename ChildT::template MaskType< LOG2 > MaskType
Definition: NanoVDB.h:3532
Coord & operator<<=(uint32_t n)
Definition: NanoVDB.h:1054
bool isInside(const Vec3T &p) const
Definition: NanoVDB.h:1693
Definition: NanoVDB.h:1426
const Tile * probeTile(const CoordType &ijk) const
Find and return a Tile of this root node.
Definition: NanoVDB.h:3284
void setAvg(float avg)
Definition: NanoVDB.h:3921
typename DataType::BuildType BuildType
Definition: NanoVDB.h:4264
bool FloatType
Definition: NanoVDB.h:4142
ValueType getMax() const
Definition: NanoVDB.h:3850
void writeUncompressedGrid(StreamT &os, const void *buffer)
This is a standalone alternative to io::writeGrid(...,Codec::NONE) defined in util/IO.h Unlike the latter this function has no dependencies at all, not even NanoVDB.h, so it also works if client code only includes PNanoVDB.h!
Definition: NanoVDB.h:5647
uint32_t mData0
Definition: NanoVDB.h:2449
static uint32_t bitCount()
Return the number of bits available in this Mask.
Definition: NanoVDB.h:1967
const NodeTrait< RootT, 1 >::type * getFirstLower() const
Definition: NanoVDB.h:2930
void setMax(const ValueType &v)
Definition: NanoVDB.h:3855
uint8_t & operator[](int n)
Definition: NanoVDB.h:592
bool isBreadthFirst() const
Definition: NanoVDB.h:2687
uint64_t getValue(uint32_t i) const
Definition: NanoVDB.h:4220
typename ChildT::FloatType StatsT
Definition: NanoVDB.h:3421
static uint64_t memUsage()
Return memory usage in bytes for this class only.
Definition: NanoVDB.h:2580
static int64_t PtrDiff(const T1 *p, const T2 *q)
Definition: NanoVDB.h:535
bool Type
Definition: NanoVDB.h:456
const ValueType & operator[](IndexType i) const
Return a const reference to the given Coord component.
Definition: NanoVDB.h:1012
Mask & operator=(const MaskT &other)
Assignment operator that works with openvdb::util::NodeMask.
Definition: NanoVDB.h:2061
static uint64_t memUsage()
Definition: NanoVDB.h:3887
float length() const
Definition: NanoVDB.h:590
T & operator[](int i)
Definition: NanoVDB.h:1335
bool operator==(const Coord &rhs) const
Definition: NanoVDB.h:1045
const typename GridOrTreeOrRootT::RootType type
Definition: NanoVDB.h:2402
uint64_t memUsage() const
Return the actual memory footprint of this root node.
Definition: NanoVDB.h:3228
StatsT mAverage
Definition: NanoVDB.h:3444
ValueType getValue(const CoordT &ijk) const
Return the voxel value at the given coordinate.
Definition: NanoVDB.h:4411
Tolerance for floating-point comparison.
Definition: NanoVDB.h:688
void setFirstNode(const NodeT *node)
Definition: NanoVDB.h:2772
const RootT & root() const
Definition: NanoVDB.h:4685
CoordT mBBoxMin
Definition: NanoVDB.h:3878
Vec4 operator-() const
Definition: NanoVDB.h:1343
typename ChildT::CoordType CoordT
Definition: NanoVDB.h:2956
T Pow2(T x)
Definition: NanoVDB.h:837
static uint32_t voxelCount()
Return the total number of voxels (e.g. values) encoded in this leaf node.
Definition: NanoVDB.h:4394
void setAvg(const StatsT &v)
Definition: NanoVDB.h:3061
static Coord min()
Definition: NanoVDB.h:1006
MaskT mValueMask
Definition: NanoVDB.h:3439
bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:3239
uint32_t mDim
Definition: NanoVDB.h:4663
void clear()
Reset this access to its initial state, i.e. with an empty cache Noop since this template specializa...
Definition: NanoVDB.h:4683
uint16_t mMin
Definition: NanoVDB.h:3885
bool isStaggered() const
Definition: NanoVDB.h:2676
ChildIterator & operator++()
Definition: NanoVDB.h:3109
typename ChildT::FloatType StatsT
Definition: NanoVDB.h:2957
CoordT CoordType
Definition: NanoVDB.h:4769
LeafNodeType * getFirstLeaf()
Template specializations of getFirstNode.
Definition: NanoVDB.h:2927
ValueIterator beginValue() const
Definition: NanoVDB.h:4323
ValueIterator()
Definition: NanoVDB.h:3129
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:4439
const typename GridOrTreeOrRootT::LeafNodeType Type
Definition: NanoVDB.h:2357
Vec3T dim() const
Definition: NanoVDB.h:1692
void setMin(const ValueType &)
Definition: NanoVDB.h:4169
MaskT< LOG2DIM > mValues
Definition: NanoVDB.h:4101
static bool isValid(const void *p)
return true if the specified pointer is aligned and not NULL
Definition: NanoVDB.h:504
uint64_t mStatsOff
Definition: NanoVDB.h:4201
void setMinMaxOn(bool on=true)
Definition: NanoVDB.h:2454
void * treePtr()
Definition: NanoVDB.h:2527
void setValue(const CoordType &k, bool s, const ValueType &v)
Definition: NanoVDB.h:3009
void setChannel(uint32_t channelID)
Change to an internal channel, assuming it exists as as blind data in the IndexGrid.
Definition: NanoVDB.h:5578
ValueType minimum() const
Return a const reference to the minimum active value encoded in this leaf node.
Definition: NanoVDB.h:4342
uint32_t mTableSize
Definition: NanoVDB.h:2985
typename TreeT::BuildType BuildType
Definition: NanoVDB.h:2562
typename T::ValueType ElementType
Definition: NanoVDB.h:1446
ValueType getValue(uint32_t offset) const
Return the voxel value at the given offset.
Definition: NanoVDB.h:4408
const StatsT & stdDeviation() const
Definition: NanoVDB.h:3504
const StatsT & stdDeviation() const
Definition: NanoVDB.h:3057
Iterator operator++(int)
Definition: NanoVDB.h:1737
uint64_t gridSize() const
Return the memory footprint of the entire grid, i.e. including all nodes and blind data...
Definition: NanoVDB.h:2583
Definition: NanoVDB.h:4254
typename RootT::CoordType CoordType
Definition: NanoVDB.h:2811
float type
Definition: NanoVDB.h:492
defines a tree type from a grid type while preserving constness
Definition: NanoVDB.h:2782
bool operator!=(const Vec4 &rhs) const
Definition: NanoVDB.h:1324
void setOff(uint32_t n)
Set the specified bit off.
Definition: NanoVDB.h:2112
#define __hostdev__
Definition: NanoVDB.h:192
typename RootT::ValueType ValueType
Definition: NanoVDB.h:4656
void setDev(const FloatType &)
Definition: NanoVDB.h:4172
const DataType * data() const
Definition: NanoVDB.h:2827
const GridClass & gridClass() const
Definition: NanoVDB.h:2673
NanoTree< ValueIndex > IndexTree
Definition: NanoVDB.h:4606
const ChildT & operator*() const
Definition: NanoVDB.h:3104
Visits child nodes of this node only.
Definition: NanoVDB.h:3545
ValueIterator beginValue() const
Definition: NanoVDB.h:3153
Vec3 operator*(const Vec3 &v) const
Definition: NanoVDB.h:1209
Vec4 operator+(const Vec4 &v) const
Definition: NanoVDB.h:1346
ReadAccessor(const RootT &root)
Constructor from a root node.
Definition: NanoVDB.h:4925
Iterator & operator++()
Definition: NanoVDB.h:1723
uint8_t ValueType
Definition: NanoVDB.h:566
ValueOffIterator(const LeafNode *parent)
Definition: NanoVDB.h:4294
typename Mask< Log2Dim >::template Iterator< ON > MaskIterT
Definition: NanoVDB.h:4270
Leaf nodes of the VDB tree. (defaults to 8x8x8 = 512 voxels)
Definition: NanoVDB.h:4251
uint32_t & packed()
Definition: NanoVDB.h:594
static size_t memUsage()
Return the memory footprint in bytes of this Mask.
Definition: NanoVDB.h:1964
bool operator==(const BaseBBox &rhs) const
Definition: NanoVDB.h:1603
void setDev(const StatsT &v)
Definition: NanoVDB.h:3509
ReadAccessor(const GridT &grid)
Constructor from a grid.
Definition: NanoVDB.h:4784
Vec3T applyMap(const Vec3T &xyz) const
Definition: NanoVDB.h:2505
T Pow3(T x)
Definition: NanoVDB.h:843
uint32_t mLevel
Definition: NanoVDB.h:4662
Iterator(const BBox &b)
Definition: NanoVDB.h:1718
ChildT * getChild(uint32_t n)
Returns a pointer to the child node at the specifed linear offset.
Definition: NanoVDB.h:3473
bool getMax() const
Definition: NanoVDB.h:4161
void setOrigin(const T &ijk)
Definition: NanoVDB.h:4175
bool FloatType
Definition: NanoVDB.h:4093
double mTaperD
Definition: NanoVDB.h:2232
void setMax(const ValueT &v)
Definition: NanoVDB.h:3060
uint32_t getDim(const CoordType &ijk, const RayT &ray) const
Definition: NanoVDB.h:4859
MaskT mChildMask
Definition: NanoVDB.h:3440
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:1982
uint8_t octant() const
Return the octant of this Coord.
Definition: NanoVDB.h:1142
ChildT * getChild(const Tile *tile)
Returns a const reference to the child node in the specified tile.
Definition: NanoVDB.h:3043
ValueIterator & operator++()
Definition: NanoVDB.h:3140
Iterator< true > OnIterator
Definition: NanoVDB.h:2016
Signed (i, j, k) 32-bit integer coordinate class, similar to openvdb::math::Coord.
Definition: NanoVDB.h:966
Vec3T matMultT(const float *mat, const Vec3T &xyz)
Definition: NanoVDB.h:1565
Vec3< float > asVec3s() const
Return a single precision floating-point vector of this coordinate.
Definition: NanoVDB.h:1293
bool operator==(const Vec4 &rhs) const
Definition: NanoVDB.h:1323
ValueIterator()
Definition: NanoVDB.h:4308
MaskT< LOG2DIM > mValueMask
Definition: NanoVDB.h:3822
Definition: NanoVDB.h:384
C++11 implementation of std::is_floating_point.
Definition: NanoVDB.h:413
const Vec3T & min() const
Definition: NanoVDB.h:1609
void setMin(const ValueT &v)
Definition: NanoVDB.h:3506
Definition: NanoVDB.h:3000
Coord offsetToGlobalCoord(uint32_t n) const
Definition: NanoVDB.h:3700
uint8_t bitWidth() const
Definition: NanoVDB.h:4036
FloatType mAverage
Definition: NanoVDB.h:3826
Coord operator+(const Coord &rhs) const
Definition: NanoVDB.h:1075
static constexpr int64_t memUsage()
Definition: NanoVDB.h:3976
CoordType origin() const
Return the origin in index space of this leaf node.
Definition: NanoVDB.h:3614
Definition: NanoVDB.h:1600
bool isActive() const
Return true if this node or any of its child nodes contain active values.
Definition: NanoVDB.h:3708
float Type
Definition: NanoVDB.h:463
StatsT mStdDevi
Definition: NanoVDB.h:2991
Vec3 & operator+=(const Vec3 &v)
Definition: NanoVDB.h:1215
CoordType getOrigin() const
Definition: NanoVDB.h:3139
Coord(ValueType i, ValueType j, ValueType k)
Initializes coordinate to the given signed integers.
Definition: NanoVDB.h:986
C++11 implementation of std::enable_if.
Definition: NanoVDB.h:371
ValueT value
Definition: NanoVDB.h:3428
FloatType mStdDevi
Definition: NanoVDB.h:4667
ValueOnIterator(const RootNode *parent)
Definition: NanoVDB.h:3161
ValueType operator()(const CoordType &ijk) const
Definition: NanoVDB.h:4696
ReadAccessor(const TreeT &tree)
Constructor from a tree.
Definition: NanoVDB.h:4787
bool operator!=(const Mask &other) const
Definition: NanoVDB.h:2082
bool isActive(const CoordType &ijk) const
Definition: NanoVDB.h:5040
C++11 implementation of std::is_same.
Definition: NanoVDB.h:356
ChildIterator(const InternalNode *parent)
Definition: NanoVDB.h:3551
static uint64_t memUsage()
Definition: NanoVDB.h:4105
Mask & operator|=(const Mask &other)
Bitwise union.
Definition: NanoVDB.h:2166
const MaskType< LOG2DIM > & valueMask() const
Return a const reference to the bit mask of active voxels in this leaf node.
Definition: NanoVDB.h:4339
const RootT & root() const
Definition: NanoVDB.h:4955
void setChannel(ChannelT *channelPtr)
Change to an external channel.
Definition: NanoVDB.h:5570
static uint32_t dim()
Return the dimension, in voxel units, of this internal node (typically 8*16 or 8*16*32) ...
Definition: NanoVDB.h:3602
CoordType getOrigin() const
Definition: NanoVDB.h:3570
ChildT ChildNodeType
Definition: NanoVDB.h:3528
bool hasStdDeviation() const
Definition: NanoVDB.h:2686
Coord & minComponent(const Coord &other)
Perform a component-wise minimum with the other Coord.
Definition: NanoVDB.h:1093
typename DataType::BuildT BuildType
Definition: NanoVDB.h:3526
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:2842
const NodeT * getNode() const
Return a const point to the cached node of the specified type.
Definition: NanoVDB.h:5196
ValueIterator operator++(int)
Definition: NanoVDB.h:4316
typename DataType::ValueType ValueType
Definition: NanoVDB.h:4262
Vec3T applyMapF(const Vec3T &xyz) const
Definition: NanoVDB.h:2249
float type
Definition: NanoVDB.h:485
bool empty() const
Definition: NanoVDB.h:1689
ReadAccessor(const RootT &root)
Constructor from a root node.
Definition: NanoVDB.h:4673
Coord(ValueType *ptr)
Definition: NanoVDB.h:991
typename ChildT::LeafNodeType LeafNodeType
Definition: NanoVDB.h:3527
Mask(const Mask &other)
Copy constructor.
Definition: NanoVDB.h:2037
Vec4 operator*(const Vec4 &v) const
Definition: NanoVDB.h:1344
Coord & operator=(const CoordT &other)
Assignment operator that works with openvdb::Coord.
Definition: NanoVDB.h:1020
void ArrayType
Definition: NanoVDB.h:4193
ValueOffIterator()
Definition: NanoVDB.h:4293
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:3617
uint32_t pos() const
Definition: NanoVDB.h:3138
GridBlindDataClass
Blind-data Classes that are currently supported by NanoVDB.
Definition: NanoVDB.h:335
Vec3T worldToIndexDir(const Vec3T &dir) const
transformation from world space direction to index space direction
Definition: NanoVDB.h:2628
Vec4(T x)
Definition: NanoVDB.h:1310
const NodeTrait< RootT, LEVEL >::type * getFirstNode() const
return a const pointer to the first node of the specified level
Definition: NanoVDB.h:2921
void setBreadthFirstOn(bool on=true)
Definition: NanoVDB.h:2494
Visits all active values in a leaf node.
Definition: NanoVDB.h:4273
static uint32_t dim()
Return the dimension, in index space, of this leaf node (typically 8 as for openvdb leaf nodes!) ...
Definition: NanoVDB.h:4377
Vec3T applyInverseMapF(const Vec3T &xyz) const
Definition: NanoVDB.h:2262
bool operator==(const Mask &other) const
Definition: NanoVDB.h:2074
uint64_t FloatType
Definition: NanoVDB.h:4192
ReadAccessor(const RootT &root)
Constructor from a root node.
Definition: NanoVDB.h:4776