HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NanoVDB.h File Reference

Implements a light-weight self-contained VDB data-structure in a single file! In other words, this is a significantly watered-down version of the OpenVDB implementation, with few dependencies - so a one-stop-shop for a minimalistic VDB data structure that run on most platforms! More...

#include <stdlib.h>
#include <stdint.h>
#include <stddef.h>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <limits>
#include <utility>
+ Include dependency graph for NanoVDB.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  nanovdb::ValueIndex
 Dummy type for a voxel whose value equals an offset into an external value array. More...
 
class  nanovdb::ValueOnIndex
 Dummy type for a voxel whose value equals an offset into an external value array of active values. More...
 
class  nanovdb::ValueIndexMask
 Like ValueIndex but with a mutable mask. More...
 
class  nanovdb::ValueOnIndexMask
 Like ValueOnIndex but with a mutable mask. More...
 
class  nanovdb::ValueMask
 Dummy type for a voxel whose value equals its binary active state. More...
 
class  nanovdb::Half
 Dummy type for a 16 bit floating point values (placeholder for IEEE 754 Half) More...
 
class  nanovdb::Fp4
 Dummy type for a 4bit quantization of float point values. More...
 
class  nanovdb::Fp8
 Dummy type for a 8bit quantization of float point values. More...
 
class  nanovdb::Fp16
 Dummy type for a 16bit quantization of float point values. More...
 
class  nanovdb::FpN
 Dummy type for a variable bit quantization of floating point values. More...
 
class  nanovdb::Point
 Dummy type for indexing points into voxels. More...
 
struct  nanovdb::is_same< T0, T1, T >
 C++11 implementation of std::is_same. More...
 
struct  nanovdb::is_same< T0, T1 >
 
struct  nanovdb::is_same< T, T >
 
struct  nanovdb::is_floating_point< T >
 C++11 implementation of std::is_floating_point. More...
 
struct  nanovdb::BuildTraits< T >
 Define static boolean tests for template build types. More...
 
struct  nanovdb::enable_if< bool, T >
 C++11 implementation of std::enable_if. More...
 
struct  nanovdb::enable_if< true, T >
 
struct  nanovdb::disable_if< bool, T >
 
struct  nanovdb::disable_if< true, T >
 
struct  nanovdb::is_const< T >
 
struct  nanovdb::is_const< const T >
 
struct  nanovdb::is_pointer< T >
 Trait used to identify template parameter that are pointers. More...
 
struct  nanovdb::is_pointer< T * >
 Template specialization of non-const pointers. More...
 
struct  nanovdb::is_pointer< const T * >
 Template specialization of const pointers. More...
 
struct  nanovdb::remove_const< T >
 Trait use to const from type. Default implementation is just a pass-through. More...
 
struct  nanovdb::remove_const< const T >
 Template specialization of trait class use to remove const qualifier type from a type. More...
 
struct  nanovdb::remove_reference< T >
 Trait use to remove reference, i.e. "&", qualifier from a type. Default implementation is just a pass-through. More...
 
struct  nanovdb::remove_reference< T & >
 Template specialization of trait class use to remove reference, i.e. "&", qualifier from a type. More...
 
struct  nanovdb::remove_pointer< T >
 Trait use to remove pointer, i.e. "*", qualifier from a type. Default implementation is just a pass-through. More...
 
struct  nanovdb::remove_pointer< T * >
 Template specialization of trait class use to to remove pointer, i.e. "*", qualifier from a type. More...
 
struct  nanovdb::match_const< T, ReferenceT >
 Trait used to transfer the const-ness of a reference type to another type. More...
 
struct  nanovdb::match_const< T, const ReferenceT >
 Template specialization used to transfer the const-ness of a reference type to another type. More...
 
struct  nanovdb::is_specialization< AnyType, TemplateType >
 Metafunction used to determine if the first template parameter is a specialization of the class template given in the second template parameter. More...
 
struct  nanovdb::is_specialization< TemplateType< Args...>, TemplateType >
 
struct  nanovdb::BuildToValueMap< T >
 Maps one type (e.g. the build types above) to other (actual) types. More...
 
struct  nanovdb::BuildToValueMap< ValueIndex >
 
struct  nanovdb::BuildToValueMap< ValueOnIndex >
 
struct  nanovdb::BuildToValueMap< ValueIndexMask >
 
struct  nanovdb::BuildToValueMap< ValueOnIndexMask >
 
struct  nanovdb::BuildToValueMap< ValueMask >
 
struct  nanovdb::BuildToValueMap< Half >
 
struct  nanovdb::BuildToValueMap< Fp4 >
 
struct  nanovdb::BuildToValueMap< Fp8 >
 
struct  nanovdb::BuildToValueMap< Fp16 >
 
struct  nanovdb::BuildToValueMap< FpN >
 
struct  nanovdb::BuildToValueMap< Point >
 
class  nanovdb::Version
 Bit-compacted representation of all three version numbers. More...
 
struct  nanovdb::Tolerance< T >
 Tolerance for floating-point comparison. More...
 
struct  nanovdb::Tolerance< float >
 
struct  nanovdb::Tolerance< double >
 
struct  nanovdb::Delta< T >
 Delta for small floating-point offsets. More...
 
struct  nanovdb::Delta< float >
 
struct  nanovdb::Delta< double >
 
struct  nanovdb::Maximum< T >
 Maximum floating-point values. More...
 
struct  nanovdb::Maximum< T >
 Maximum floating-point values. More...
 
class  nanovdb::Vec3< typename >
 A simple vector class with three components, similar to openvdb::math::Vec3. More...
 
class  nanovdb::Coord
 Signed (i, j, k) 32-bit integer coordinate class, similar to openvdb::math::Coord. More...
 
class  nanovdb::Vec3< typename >
 A simple vector class with three components, similar to openvdb::math::Vec3. More...
 
class  nanovdb::Vec4< T >
 A simple vector class with four components, similar to openvdb::math::Vec4. More...
 
class  nanovdb::Rgba8
 8-bit red, green, blue, alpha packed into 32 bit unsigned int More...
 
struct  nanovdb::TensorTraits< T, Rank >
 
struct  nanovdb::TensorTraits< T, 0 >
 
struct  nanovdb::TensorTraits< T, 1 >
 
struct  nanovdb::FloatTraits< T, int >
 
struct  nanovdb::FloatTraits< T, 8 >
 
struct  nanovdb::FloatTraits< bool, 1 >
 
struct  nanovdb::FloatTraits< ValueIndex, 1 >
 
struct  nanovdb::FloatTraits< ValueIndexMask, 1 >
 
struct  nanovdb::FloatTraits< ValueOnIndex, 1 >
 
struct  nanovdb::FloatTraits< ValueOnIndexMask, 1 >
 
struct  nanovdb::FloatTraits< ValueMask, 1 >
 
struct  nanovdb::FloatTraits< Point, 1 >
 
struct  nanovdb::BaseBBox< Vec3T >
 
struct  nanovdb::BBox< Vec3T, bool >
 
struct  nanovdb::BBox< Vec3T, true >
 Partial template specialization for floating point coordinate types. More...
 
struct  nanovdb::BBox< CoordT, false >
 Partial template specialization for integer coordinate types. More...
 
class  nanovdb::BBox< CoordT, false >::Iterator
 Iterator over the domain covered by a BBox. More...
 
struct  nanovdb::BitArray< N >
 
struct  nanovdb::BitArray< 8 >
 
struct  nanovdb::BitArray< 16 >
 
struct  nanovdb::BitArray< 32 >
 
struct  nanovdb::BitArray< 64 >
 
class  nanovdb::BitFlags< N >
 
class  nanovdb::Mask< LOG2DIM >
 Bit-mask to encode active states and facilitate sequential iterators and a fast codec for I/O compression. More...
 
class  nanovdb::Mask< LOG2DIM >::Iterator< On >
 
class  nanovdb::Mask< LOG2DIM >::DenseIterator
 
struct  nanovdb::Map
 Defines an affine transform and its inverse represented as a 3x3 matrix and a vec3 translation. More...
 
struct  nanovdb::NodeTrait< GridOrTreeOrRootT, LEVEL >
 Struct to derive node type from its level in a given grid, tree or root while preserving constness. More...
 
struct  nanovdb::NodeTrait< GridOrTreeOrRootT, 0 >
 
struct  nanovdb::NodeTrait< const GridOrTreeOrRootT, 0 >
 
struct  nanovdb::NodeTrait< GridOrTreeOrRootT, 1 >
 
struct  nanovdb::NodeTrait< const GridOrTreeOrRootT, 1 >
 
struct  nanovdb::NodeTrait< GridOrTreeOrRootT, 2 >
 
struct  nanovdb::NodeTrait< const GridOrTreeOrRootT, 2 >
 
struct  nanovdb::NodeTrait< GridOrTreeOrRootT, 3 >
 
struct  nanovdb::NodeTrait< const GridOrTreeOrRootT, 3 >
 
struct  nanovdb::GetValue< BuildT >
 Implements Tree::getValue(Coord), i.e. return the value associated with a specific coordinate ijk. More...
 
struct  nanovdb::SetValue< BuildT >
 
struct  nanovdb::SetVoxel< BuildT >
 
struct  nanovdb::GetState< BuildT >
 Implements Tree::isActive(Coord) More...
 
struct  nanovdb::GetDim< BuildT >
 Implements Tree::getDim(Coord) More...
 
struct  nanovdb::GetLeaf< BuildT >
 Return the pointer to the leaf node that contains Coord. Implements Tree::probeLeaf(Coord) More...
 
struct  nanovdb::ProbeValue< BuildT >
 Implements Tree::probeLeaf(Coord) More...
 
struct  nanovdb::GetNodeInfo< BuildT >
 Implements Tree::getNodeInfo(Coord) More...
 
class  nanovdb::ReadAccessor< BuildT, LEVEL0, LEVEL1, LEVEL2 >
 
class  nanovdb::Grid< TreeT >
 Highest level of the data structure. Contains a tree and a world->index transform (that currently only supports uniform scaling and translation). More...
 
struct  nanovdb::GridTree< GridT >
 defines a tree type from a grid type while preserving constness More...
 
struct  nanovdb::GridTree< const GridT >
 
class  nanovdb::Tree< RootT >
 VDB Tree, which is a thin wrapper around a RootNode. More...
 
class  nanovdb::RootNode< ChildT >
 Top-most node of the VDB tree structure. More...
 
class  nanovdb::RootNode< ChildT >::BaseIter< RootT >
 
class  nanovdb::RootNode< ChildT >::ChildIter< RootT >
 
class  nanovdb::RootNode< ChildT >::ValueIter< RootT >
 
class  nanovdb::RootNode< ChildT >::ValueOnIter< RootT >
 
class  nanovdb::RootNode< ChildT >::DenseIter< RootT >
 
class  nanovdb::InternalNode< ChildT, Log2Dim >
 Internal nodes of a VDB treedim(),. More...
 
class  nanovdb::InternalNode< ChildT, Log2Dim >::ChildIter< ParentT >
 Visits child nodes of this node only. More...
 
class  nanovdb::InternalNode< ChildT, Log2Dim >::ValueIterator
 Visits all tile values in this node, i.e. both inactive and active tiles. More...
 
class  nanovdb::InternalNode< ChildT, Log2Dim >::ValueOnIterator
 Visits active tile values of this node only. More...
 
class  nanovdb::InternalNode< ChildT, Log2Dim >::DenseIterator
 Visits all tile values and child nodes of this node. More...
 
class  nanovdb::LeafNode< BuildT, CoordT, MaskT, Log2Dim >
 Leaf nodes of the VDB tree. (defaults to 8x8x8 = 512 voxels) More...
 
struct  nanovdb::LeafNode< BuildT, CoordT, MaskT, Log2Dim >::ChildNodeType
 
class  nanovdb::LeafNode< BuildT, CoordT, MaskT, Log2Dim >::ValueOnIterator
 Visits all active values in a leaf node. More...
 
class  nanovdb::LeafNode< BuildT, CoordT, MaskT, Log2Dim >::ValueOffIterator
 Visits all inactive values in a leaf node. More...
 
class  nanovdb::LeafNode< BuildT, CoordT, MaskT, Log2Dim >::ValueIterator
 Visits all values in a leaf node, i.e. both active and inactive values. More...
 
struct  nanovdb::NanoNode< BuildT, LEVEL >
 Trait to map from LEVEL to node type. More...
 
struct  nanovdb::NanoNode< BuildT, 0 >
 
struct  nanovdb::NanoNode< BuildT, 1 >
 
struct  nanovdb::NanoNode< BuildT, 2 >
 
struct  nanovdb::NanoNode< BuildT, 3 >
 
class  nanovdb::ReadAccessor< BuildT,-1,-1,-1 >
 A read-only value accessor with three levels of node caching. This allows for inverse tree traversal during lookup, which is on average significantly faster than calling the equivalent method on the tree (i.e. top-down traversal). More...
 
class  nanovdb::ReadAccessor< BuildT, LEVEL0,-1,-1 >
 Node caching at a single tree level. More...
 
class  nanovdb::ReadAccessor< BuildT, LEVEL0, LEVEL1,-1 >
 
class  nanovdb::ReadAccessor< BuildT, 0, 1, 2 >
 Node caching at all (three) tree levels. More...
 
class  nanovdb::GridMetaData
 This is a convenient class that allows for access to grid meta-data that are independent of the value type of a grid. That is, this class can be used to get information about a grid without actually knowing its ValueType. More...
 
class  nanovdb::PointAccessor< AttT, BuildT >
 Class to access points at a specific voxel location. More...
 
class  nanovdb::PointAccessor< AttT, Point >
 
class  nanovdb::ChannelAccessor< ChannelT, IndexT >
 Class to access values in channels at a specific voxel location. More...
 
struct  nanovdb::io::FileHeader
 Data encoded at the head of each segment of a file or stream. More...
 
struct  nanovdb::io::FileMetaData
 
struct  nanovdb::GetValue< BuildT >
 Implements Tree::getValue(Coord), i.e. return the value associated with a specific coordinate ijk. More...
 
struct  nanovdb::SetValue< BuildT >
 
struct  nanovdb::SetVoxel< BuildT >
 
struct  nanovdb::GetState< BuildT >
 Implements Tree::isActive(Coord) More...
 
struct  nanovdb::GetDim< BuildT >
 Implements Tree::getDim(Coord) More...
 
struct  nanovdb::GetLeaf< BuildT >
 Return the pointer to the leaf node that contains Coord. Implements Tree::probeLeaf(Coord) More...
 
struct  nanovdb::GetLower< BuildT >
 Return point to the lower internal node where Coord maps to one of its values, i.e. terminates. More...
 
struct  nanovdb::GetUpper< BuildT >
 Return point to the upper internal node where Coord maps to one of its values, i.e. terminates. More...
 
struct  nanovdb::ProbeValue< BuildT >
 Implements Tree::probeLeaf(Coord) More...
 
struct  nanovdb::GetNodeInfo< BuildT >
 Implements Tree::getNodeInfo(Coord) More...
 
struct  nanovdb::GetNodeInfo< BuildT >::NodeInfo
 

Namespaces

 nanovdb
 
 nanovdb::io
 

Macros

#define NANOVDB_MAGIC_NUMBER   0x304244566f6e614eUL
 
#define NANOVDB_MAGIC_GRID   0x314244566f6e614eUL
 
#define NANOVDB_MAGIC_FILE   0x324244566f6e614eUL
 
#define NANOVDB_MAGIC_NODE   0x334244566f6e614eUL
 
#define NANOVDB_MAGIC_MASK   0x00FFFFFFFFFFFFFFUL
 
#define NANOVDB_MAJOR_VERSION_NUMBER   32
 
#define NANOVDB_MINOR_VERSION_NUMBER   6
 
#define NANOVDB_PATCH_VERSION_NUMBER   0
 
#define TBB_SUPPRESS_DEPRECATED_MESSAGES   1
 
#define NANOVDB_USE_SINGLE_ROOT_KEY
 
#define NANOVDB_NEW_ACCESSOR_METHODS
 
#define NANOVDB_FPN_BRANCHLESS
 
#define NANOVDB_DATA_ALIGNMENT   32
 
#define NANOVDB_ALIGN(n)   alignas(n)
 
#define NANOVDB_ASSERT(x)   assert(x)
 
#define __hostdev__
 
#define __global__
 
#define __device__
 
#define __host__
 
#define NANOVDB_HOSTDEV_DISABLE_WARNING
 
#define NANOVDB_OFFSETOF(CLASS, MEMBER)   ((int)(size_t)((char*)&((CLASS*)0)->MEMBER - (char*)0))
 

Typedefs

using nanovdb::Vec3d = Vec3< double >
 
using nanovdb::Vec3f = Vec3< float >
 
using nanovdb::Vec3i = Vec3< int32_t >
 
using nanovdb::Vec3u = Vec3< uint32_t >
 
using nanovdb::Vec3u8 = Vec3< uint8_t >
 
using nanovdb::Vec3u16 = Vec3< uint16_t >
 
using nanovdb::Vec4R = Vec4< double >
 
using nanovdb::Vec4d = Vec4< double >
 
using nanovdb::Vec4f = Vec4< float >
 
using nanovdb::Vec4i = Vec4< int >
 
using nanovdb::PackedRGBA8 = Rgba8
 
using nanovdb::CoordBBox = BBox< Coord >
 
using nanovdb::BBoxR = BBox< Vec3d >
 
template<typename BuildT >
using nanovdb::DefaultReadAccessor = ReadAccessor< BuildT, 0, 1, 2 >
 
using nanovdb::BaseT = LeafFnBase< CoordT, MaskT, LOG2DIM >
 
using nanovdb::BuildType = Fp4
 
using nanovdb::ArrayType = uint8_t
 
using nanovdb::ValueType = bool
 
using nanovdb::FloatType = bool
 
template<typename BuildT >
using nanovdb::NanoLeaf = LeafNode< BuildT, Coord, Mask, 3 >
 Template specializations to the default configuration used in OpenVDB: Root -> 32^3 -> 16^3 -> 8^3. More...
 
template<typename BuildT >
using nanovdb::NanoLower = InternalNode< NanoLeaf< BuildT >, 4 >
 
template<typename BuildT >
using nanovdb::NanoUpper = InternalNode< NanoLower< BuildT >, 5 >
 
template<typename BuildT >
using nanovdb::NanoRoot = RootNode< NanoUpper< BuildT >>
 
template<typename BuildT >
using nanovdb::NanoTree = Tree< NanoRoot< BuildT >>
 
template<typename BuildT >
using nanovdb::NanoGrid = Grid< NanoTree< BuildT >>
 
using nanovdb::FloatTree = NanoTree< float >
 
using nanovdb::Fp4Tree = NanoTree< Fp4 >
 
using nanovdb::Fp8Tree = NanoTree< Fp8 >
 
using nanovdb::Fp16Tree = NanoTree< Fp16 >
 
using nanovdb::FpNTree = NanoTree< FpN >
 
using nanovdb::DoubleTree = NanoTree< double >
 
using nanovdb::Int32Tree = NanoTree< int32_t >
 
using nanovdb::UInt32Tree = NanoTree< uint32_t >
 
using nanovdb::Int64Tree = NanoTree< int64_t >
 
using nanovdb::Vec3fTree = NanoTree< Vec3f >
 
using nanovdb::Vec3dTree = NanoTree< Vec3d >
 
using nanovdb::Vec4fTree = NanoTree< Vec4f >
 
using nanovdb::Vec4dTree = NanoTree< Vec4d >
 
using nanovdb::Vec3ITree = NanoTree< Vec3i >
 
using nanovdb::MaskTree = NanoTree< ValueMask >
 
using nanovdb::BoolTree = NanoTree< bool >
 
using nanovdb::IndexTree = NanoTree< ValueIndex >
 
using nanovdb::OnIndexTree = NanoTree< ValueOnIndex >
 
using nanovdb::IndexMaskTree = NanoTree< ValueIndexMask >
 
using nanovdb::OnIndexMaskTree = NanoTree< ValueOnIndexMask >
 
using nanovdb::FloatGrid = Grid< FloatTree >
 
using nanovdb::Fp4Grid = Grid< Fp4Tree >
 
using nanovdb::Fp8Grid = Grid< Fp8Tree >
 
using nanovdb::Fp16Grid = Grid< Fp16Tree >
 
using nanovdb::FpNGrid = Grid< FpNTree >
 
using nanovdb::DoubleGrid = Grid< DoubleTree >
 
using nanovdb::Int32Grid = Grid< Int32Tree >
 
using nanovdb::UInt32Grid = Grid< UInt32Tree >
 
using nanovdb::Int64Grid = Grid< Int64Tree >
 
using nanovdb::Vec3fGrid = Grid< Vec3fTree >
 
using nanovdb::Vec3dGrid = Grid< Vec3dTree >
 
using nanovdb::Vec4fGrid = Grid< Vec4fTree >
 
using nanovdb::Vec4dGrid = Grid< Vec4dTree >
 
using nanovdb::Vec3IGrid = Grid< Vec3ITree >
 
using nanovdb::MaskGrid = Grid< MaskTree >
 
using nanovdb::BoolGrid = Grid< BoolTree >
 
using nanovdb::PointGrid = Grid< Point >
 
using nanovdb::IndexGrid = Grid< IndexTree >
 
using nanovdb::OnIndexGrid = Grid< OnIndexTree >
 
using nanovdb::IndexMaskGrid = Grid< IndexMaskTree >
 
using nanovdb::OnIndexMaskGrid = Grid< OnIndexMaskTree >
 

Enumerations

enum  nanovdb::GridType : uint32_t {
  nanovdb::GridType::Unknown = 0, nanovdb::GridType::Float = 1, nanovdb::GridType::Double = 2, nanovdb::GridType::Int16 = 3,
  nanovdb::GridType::Int32 = 4, nanovdb::GridType::Int64 = 5, nanovdb::GridType::Vec3f = 6, nanovdb::GridType::Vec3d = 7,
  nanovdb::GridType::Mask = 8, nanovdb::GridType::Half = 9, nanovdb::GridType::UInt32 = 10, nanovdb::GridType::Boolean = 11,
  nanovdb::GridType::RGBA8 = 12, nanovdb::GridType::Fp4 = 13, nanovdb::GridType::Fp8 = 14, nanovdb::GridType::Fp16 = 15,
  nanovdb::GridType::FpN = 16, nanovdb::GridType::Vec4f = 17, nanovdb::GridType::Vec4d = 18, nanovdb::GridType::Index = 19,
  nanovdb::GridType::OnIndex = 20, nanovdb::GridType::IndexMask = 21, nanovdb::GridType::OnIndexMask = 22, nanovdb::GridType::PointIndex = 23,
  nanovdb::GridType::Vec3u8 = 24, nanovdb::GridType::Vec3u16 = 25, nanovdb::GridType::End = 26
}
 List of types that are currently supported by NanoVDB. More...
 
enum  nanovdb::GridClass : uint32_t {
  nanovdb::GridClass::Unknown = 0, nanovdb::GridClass::LevelSet = 1, nanovdb::GridClass::FogVolume = 2, nanovdb::GridClass::Staggered = 3,
  nanovdb::GridClass::PointIndex = 4, nanovdb::GridClass::PointData = 5, nanovdb::GridClass::Topology = 6, nanovdb::GridClass::VoxelVolume = 7,
  nanovdb::GridClass::IndexGrid = 8, nanovdb::GridClass::TensorGrid = 9, nanovdb::GridClass::End = 10
}
 Classes (superset of OpenVDB) that are currently supported by NanoVDB. More...
 
enum  nanovdb::GridFlags : uint32_t {
  nanovdb::GridFlags::HasLongGridName = 1 << 0, nanovdb::GridFlags::HasBBox = 1 << 1, nanovdb::GridFlags::HasMinMax = 1 << 2, nanovdb::GridFlags::HasAverage = 1 << 3,
  nanovdb::GridFlags::HasStdDeviation = 1 << 4, nanovdb::GridFlags::IsBreadthFirst = 1 << 5, nanovdb::GridFlags::End = 1 << 6
}
 Grid flags which indicate what extra information is present in the grid buffer. More...
 
enum  nanovdb::GridBlindDataClass : uint32_t {
  nanovdb::GridBlindDataClass::Unknown = 0, nanovdb::GridBlindDataClass::IndexArray = 1, nanovdb::GridBlindDataClass::AttributeArray = 2, nanovdb::GridBlindDataClass::GridName = 3,
  nanovdb::GridBlindDataClass::ChannelArray = 4, nanovdb::GridBlindDataClass::End = 5
}
 Blind-data Classes that are currently supported by NanoVDB. More...
 
enum  nanovdb::GridBlindDataSemantic : uint32_t {
  nanovdb::GridBlindDataSemantic::Unknown = 0, nanovdb::GridBlindDataSemantic::PointPosition = 1, nanovdb::GridBlindDataSemantic::PointColor = 2, nanovdb::GridBlindDataSemantic::PointNormal = 3,
  nanovdb::GridBlindDataSemantic::PointRadius = 4, nanovdb::GridBlindDataSemantic::PointVelocity = 5, nanovdb::GridBlindDataSemantic::PointId = 6, nanovdb::GridBlindDataSemantic::WorldCoords = 7,
  nanovdb::GridBlindDataSemantic::GridCoords = 8, nanovdb::GridBlindDataSemantic::VoxelCoords = 9, nanovdb::GridBlindDataSemantic::End = 10
}
 Blind-data Semantics that are currently understood by NanoVDB. More...
 
enum  nanovdb::io::Codec : uint16_t { nanovdb::io::Codec::NONE = 0, nanovdb::io::Codec::ZIP = 1, nanovdb::io::Codec::BLOSC = 2, nanovdb::io::Codec::END = 3 }
 Define compression codecs. More...
 

Functions

const char * nanovdb::toStr (GridType gridType)
 Maps a GridType to a c-string. More...
 
const char * nanovdb::toStr (GridClass gridClass)
 Retuns a c-string used to describe a GridClass. More...
 
const char * nanovdb::toStr (GridFlags gridFlags)
 Retuns a c-string used to describe a GridFlags. More...
 
__hostdev__ bool nanovdb::isFloatingPoint (GridType gridType)
 return true if the GridType maps to a floating point type More...
 
__hostdev__ bool nanovdb::isFloatingPointVector (GridType gridType)
 return true if the GridType maps to a floating point vec3. More...
 
__hostdev__ bool nanovdb::isInteger (GridType gridType)
 Return true if the GridType maps to a POD integer type. More...
 
__hostdev__ bool nanovdb::isIndex (GridType gridType)
 Return true if the GridType maps to a special index type (not a POD integer type). More...
 
__hostdev__ bool nanovdb::isValid (GridType gridType, GridClass gridClass)
 return true if the combination of GridType and GridClass is valid. More...
 
__hostdev__ bool nanovdb::isValid (const GridBlindDataClass &blindClass, const GridBlindDataSemantic &blindSemantics, const GridType &blindType)
 return true if the combination of GridBlindDataClass, GridBlindDataSemantic and GridType is valid. More...
 
template<typename Type >
__hostdev__ bool nanovdb::isApproxZero (const Type &x)
 
template<typename Type >
__hostdev__ Type nanovdb::Min (Type a, Type b)
 
__hostdev__ int32_t nanovdb::Min (int32_t a, int32_t b)
 
__hostdev__ uint32_t nanovdb::Min (uint32_t a, uint32_t b)
 
__hostdev__ float nanovdb::Min (float a, float b)
 
__hostdev__ double nanovdb::Min (double a, double b)
 
template<typename Type >
__hostdev__ Type nanovdb::Max (Type a, Type b)
 
__hostdev__ int32_t nanovdb::Max (int32_t a, int32_t b)
 
__hostdev__ uint32_t nanovdb::Max (uint32_t a, uint32_t b)
 
__hostdev__ float nanovdb::Max (float a, float b)
 
__hostdev__ double nanovdb::Max (double a, double b)
 
__hostdev__ float nanovdb::Clamp (float x, float a, float b)
 
__hostdev__ double nanovdb::Clamp (double x, double a, double b)
 
__hostdev__ float nanovdb::Fract (float x)
 
__hostdev__ double nanovdb::Fract (double x)
 
__hostdev__ int32_t nanovdb::Floor (float x)
 
__hostdev__ int32_t nanovdb::Floor (double x)
 
__hostdev__ int32_t nanovdb::Ceil (float x)
 
__hostdev__ int32_t nanovdb::Ceil (double x)
 
template<typename T >
__hostdev__nanovdb::Pow2 (T x)
 
template<typename T >
__hostdev__nanovdb::Pow3 (T x)
 
template<typename T >
__hostdev__nanovdb::Pow4 (T x)
 
template<typename T >
__hostdev__nanovdb::Abs (T x)
 
template<>
__hostdev__ float nanovdb::Abs (float x)
 
template<>
__hostdev__ double nanovdb::Abs (double x)
 
template<>
__hostdev__ int nanovdb::Abs (int x)
 
template<typename CoordT , typename RealT , template< typename > class Vec3T>
__hostdev__ CoordT nanovdb::Round (const Vec3T< RealT > &xyz)
 
template<typename CoordT , template< typename > class Vec3T>
__hostdev__ CoordT nanovdb::Round (const Vec3T< float > &xyz)
 
template<typename CoordT , template< typename > class Vec3T>
__hostdev__ CoordT nanovdb::Round (const Vec3T< double > &xyz)
 
template<typename CoordT , typename RealT , template< typename > class Vec3T>
__hostdev__ CoordT nanovdb::RoundDown (const Vec3T< RealT > &xyz)
 
template<typename T >
__hostdev__nanovdb::Sign (const T &x)
 Return the sign of the given value as an integer (either -1, 0 or 1). More...
 
template<typename Vec3T >
__hostdev__ int nanovdb::MinIndex (const Vec3T &v)
 
template<typename Vec3T >
__hostdev__ int nanovdb::MaxIndex (const Vec3T &v)
 
template<uint64_t wordSize>
__hostdev__ uint64_t nanovdb::AlignUp (uint64_t byteCount)
 round up byteSize to the nearest wordSize, e.g. to align to machine word: AlignUp<sizeof(size_t)(n) More...
 
template<typename T1 , typename T2 >
__hostdev__ Vec3< T2 > nanovdb::operator* (T1 scalar, const Vec3< T2 > &vec)
 
template<typename T1 , typename T2 >
__hostdev__ Vec3< T2 > nanovdb::operator/ (T1 scalar, const Vec3< T2 > &vec)
 
template<typename T1 , typename T2 >
__hostdev__ Vec4< T2 > nanovdb::operator* (T1 scalar, const Vec4< T2 > &vec)
 
template<typename T1 , typename T2 >
__hostdev__ Vec4< T2 > nanovdb::operator/ (T1 scalar, const Vec4< T2 > &vec)
 
template<typename BuildT >
__hostdev__ GridType nanovdb::mapToGridType ()
 Maps from a templated build type to a GridType enum. More...
 
template<typename BuildT >
__hostdev__ GridClass nanovdb::mapToGridClass (GridClass defaultClass=GridClass::Unknown)
 Maps from a templated build type to a GridClass enum. More...
 
template<typename Vec3T >
__hostdev__ Vec3T nanovdb::matMult (const float *mat, const Vec3T &xyz)
 Multiply a 3x3 matrix and a 3d vector using 32bit floating point arithmetics. More...
 
template<typename Vec3T >
__hostdev__ Vec3T nanovdb::matMult (const double *mat, const Vec3T &xyz)
 Multiply a 3x3 matrix and a 3d vector using 64bit floating point arithmetics. More...
 
template<typename Vec3T >
__hostdev__ Vec3T nanovdb::matMult (const float *mat, const float *vec, const Vec3T &xyz)
 Multiply a 3x3 matrix to a 3d vector and add another 3d vector using 32bit floating point arithmetics. More...
 
template<typename Vec3T >
__hostdev__ Vec3T nanovdb::matMult (const double *mat, const double *vec, const Vec3T &xyz)
 Multiply a 3x3 matrix to a 3d vector and add another 3d vector using 64bit floating point arithmetics. More...
 
template<typename Vec3T >
__hostdev__ Vec3T nanovdb::matMultT (const float *mat, const Vec3T &xyz)
 Multiply the transposed of a 3x3 matrix and a 3d vector using 32bit floating point arithmetics. More...
 
template<typename Vec3T >
__hostdev__ Vec3T nanovdb::matMultT (const double *mat, const Vec3T &xyz)
 Multiply the transposed of a 3x3 matrix and a 3d vector using 64bit floating point arithmetics. More...
 
template<typename Vec3T >
__hostdev__ Vec3T nanovdb::matMultT (const float *mat, const float *vec, const Vec3T &xyz)
 
template<typename Vec3T >
__hostdev__ Vec3T nanovdb::matMultT (const double *mat, const double *vec, const Vec3T &xyz)
 
NANOVDB_HOSTDEV_DISABLE_WARNING
__hostdev__ uint32_t 
nanovdb::CountOn (uint64_t v)
 
struct nanovdb::NANOVDB_ALIGN (NANOVDB_DATA_ALIGNMENT) GridData
 Struct with all the member data of the Grid (useful during serialization of an openvdb grid) More...
 
__hostdev__ float nanovdb::getValue (uint32_t i) const
 
 nanovdb::LeafData ()=delete
 This class cannot be constructed or deleted. More...
 
 nanovdb::LeafData (const LeafData &)=delete
 
LeafData & nanovdb::operator= (const LeafData &)=delete
 
 nanovdb::~LeafData ()=delete
 
__hostdev__ bool nanovdb::getMin () const
 
__hostdev__ bool nanovdb::getMax () const
 
__hostdev__ bool nanovdb::getAvg () const
 
__hostdev__ bool nanovdb::getDev () const
 
__hostdev__ void nanovdb::setValue (uint32_t offset, bool v)
 
__hostdev__ void nanovdb::setOn (uint32_t offset)
 
__hostdev__ void nanovdb::setMin (const bool &)
 
__hostdev__ void nanovdb::setMax (const bool &)
 
__hostdev__ void nanovdb::setAvg (const bool &)
 
__hostdev__ void nanovdb::setDev (const bool &)
 
template<typename T >
__hostdev__ void nanovdb::setOrigin (const T &ijk)
 
__hostdev__ uint64_t nanovdb::lastOffset () const
 
__hostdev__ bool nanovdb::isMaskOn (uint32_t offset) const
 
__hostdev__ void nanovdb::setMask (uint32_t offset, bool v)
 
__hostdev__ uint64_t nanovdb::offset () const
 
__hostdev__ uint64_t nanovdb::pointCount () const
 
__hostdev__ uint64_t nanovdb::first (uint32_t i) const
 
__hostdev__ uint64_t nanovdb::last (uint32_t i) const
 
__hostdev__ void nanovdb::setValueOnly (uint32_t offset, uint16_t value)
 
__hostdev__ void nanovdb::setValue (uint32_t offset, uint16_t value)
 
template<int LEVEL0 = -1, int LEVEL1 = -1, int LEVEL2 = -1, typename ValueT = float>
ReadAccessor< ValueT, LEVEL0,
LEVEL1, LEVEL2 > 
nanovdb::createAccessor (const NanoGrid< ValueT > &grid)
 Free-standing function for convenient creation of a ReadAccessor with optional and customizable node caching. More...
 
template<int LEVEL0 = -1, int LEVEL1 = -1, int LEVEL2 = -1, typename ValueT = float>
ReadAccessor< ValueT, LEVEL0,
LEVEL1, LEVEL2 > 
nanovdb::createAccessor (const NanoTree< ValueT > &tree)
 
template<int LEVEL0 = -1, int LEVEL1 = -1, int LEVEL2 = -1, typename ValueT = float>
ReadAccessor< ValueT, LEVEL0,
LEVEL1, LEVEL2 > 
nanovdb::createAccessor (const NanoRoot< ValueT > &root)
 
const char * nanovdb::io::toStr (Codec codec)
 
template<typename StreamT >
void nanovdb::io::writeUncompressedGrid (StreamT &os, const GridData *gridData, bool raw=false)
 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! More...
 
template<typename GridHandleT , template< typename...> class VecT>
void nanovdb::io::writeUncompressedGrids (const char *fileName, const VecT< GridHandleT > &handles, bool raw=false)
 write multiple NanoVDB grids to a single file, without compression. More...
 
template<typename GridHandleT , typename StreamT , template< typename...> class VecT>
VecT< GridHandleT > nanovdb::io::readUncompressedGrids (StreamT &is, const typename GridHandleT::BufferType &pool=typename GridHandleT::BufferType())
 read all uncompressed grids from a stream and return their handles. More...
 
template<typename GridHandleT , template< typename...> class VecT>
VecT< GridHandleT > nanovdb::io::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. More...
 
template<typename T >
__hostdev__ constexpr T nanovdb::pi ()
 Pi constant taken from Boost to match old behaviour. More...
 
template<>
__hostdev__ constexpr float nanovdb::pi ()
 Pi constant taken from Boost to match old behaviour. More...
 
template<>
__hostdev__ constexpr double nanovdb::pi ()
 Pi constant taken from Boost to match old behaviour. More...
 
template<>
__hostdev__ constexpr long double nanovdb::pi ()
 Pi constant taken from Boost to match old behaviour. More...
 
__hostdev__ float nanovdb::Sqrt (float x)
 Return the square root of a floating-point value. More...
 
__hostdev__ double nanovdb::Sqrt (double x)
 Return the square root of a floating-point value. More...
 

Variables

uint8_t nanovdb::mCode [1u<< (3 *LOG2DIM-1)]
 
CoordT nanovdb::mBBoxMin
 
uint8_t nanovdb::mBBoxDif [3]
 
uint8_t nanovdb::mFlags
 
MaskT< LOG2DIM > nanovdb::mValueMask
 
MaskT< LOG2DIM > nanovdb::mValues
 
uint64_t nanovdb::mPadding [2]
 
MaskT< LOG2DIM > nanovdb::mMask
 
uint64_t nanovdb::mOffset
 
uint64_t nanovdb::mPointCount
 

Detailed Description

Implements a light-weight self-contained VDB data-structure in a single file! In other words, this is a significantly watered-down version of the OpenVDB implementation, with few dependencies - so a one-stop-shop for a minimalistic VDB data structure that run on most platforms!

Author
Ken Museth
Date
January 8, 2020
Note
It is important to note that NanoVDB (by design) is a read-only sparse GPU (and CPU) friendly data structure intended for applications like rendering and collision detection. As such it obviously lacks a lot of the functionality and features of OpenVDB grids. NanoVDB is essentially a compact linearized (or serialized) representation of an OpenVDB tree with getValue methods only. For best performance use the ReadAccessor::getValue method as opposed to the Tree::getValue method. Note that since a ReadAccessor caches previous access patterns it is by design not thread-safe, so use one instantiation per thread (it is very light-weight). Also, it is not safe to copy accessors between the GPU and CPU! In fact, client code should only interface with the API of the Grid class (all other nodes of the NanoVDB data structure can safely be ignored by most client codes)!
Warning
NanoVDB grids can only be constructed via tools like createNanoGrid or the GridBuilder. This explains why none of the grid nodes defined below have public constructors or destructors.

Please see the following paper for more details on the data structure: K. Museth, “VDB: High-Resolution Sparse Volumes with Dynamic Topology”, ACM Transactions on Graphics 32(3), 2013, which can be found here: http://www.museth.org/Ken/Publications_files/Museth_TOG13.pdf

NanoVDB was first published there: https://dl.acm.org/doi/fullHtml/10.1145/3450623.3464653

Overview: This file implements the following fundamental class that when combined forms the backbone of the VDB tree data structure:

Coord- a signed integer coordinate Vec3 - a 3D vector Vec4 - a 4D vector BBox - a bounding box Mask - a bitmask essential to the non-root tree nodes Map - an affine coordinate transformation Grid - contains a Tree and a map for world<->index transformations. Use this class as the main API with client code! Tree - contains a RootNode and getValue methods that should only be used for debugging RootNode - the top-level node of the VDB data structure InternalNode - the internal nodes of the VDB data structure LeafNode - the lowest level tree nodes that encode voxel values and state ReadAccessor - implements accelerated random access operations

Semantics: A VDB data structure encodes values and (binary) states associated with signed integer coordinates. Values encoded at the leaf node level are denoted voxel values, and values associated with other tree nodes are referred to as tile values, which by design cover a larger coordinate index domain.

Memory layout:

It's important to emphasize that all the grid data (defined below) are explicitly 32 byte aligned, which implies that any memory buffer that contains a NanoVDB grid must also be at 32 byte aligned. That is, the memory address of the beginning of a buffer (see ascii diagram below) must be divisible by 32, i.e. uintptr_t(&buffer)%32 == 0! If this is not the case, the C++ standard says the behaviour is undefined! Normally this is not a concerns on GPUs, because they use 256 byte aligned allocations, but the same cannot be said about the CPU.

GridData is always at the very beginning of the buffer immediately followed by TreeData! The remaining nodes and blind-data are allowed to be scattered throughout the buffer, though in practice they are arranged as:

GridData: 672 bytes (e.g. magic, checksum, major, flags, index, count, size, name, map, world bbox, voxel size, class, type, offset, count)

TreeData: 64 bytes (node counts and byte offsets)

... optional padding ...

RootData: size depends on ValueType (index bbox, voxel count, tile count, min/max/avg/standard deviation)

Array of: RootData::Tile

... optional padding ...

Array of: Upper InternalNodes of size 32^3: bbox, two bit masks, 32768 tile values, and min/max/avg/standard deviation values

... optional padding ...

Array of: Lower InternalNodes of size 16^3: bbox, two bit masks, 4096 tile values, and min/max/avg/standard deviation values

... optional padding ...

Array of: LeafNodes of size 8^3: bbox, bit masks, 512 voxel values, and min/max/avg/standard deviation values

Notation: "]---[" implies it has optional padding, and "][" implies zero padding

[GridData(672B)][TreeData(64B)]—[RootData][N x Root::Tile]—[InternalData<5>]—[InternalData<4>]—[LeafData<3>]—[BLINDMETA...]—[BLIND0]—[BLIND1]—etc. ^ ^ ^ ^ ^ ^ | | | | | | +– Start of 32B aligned buffer | | | | +– Node0::DataType* leafData GridType::DataType* gridData | | | | | | | +– Node1::DataType* lowerData RootType::DataType* rootData –+ | | | +– Node2::DataType* upperData | +– RootType::DataType::Tile* tile

Definition in file NanoVDB.h.

Macro Definition Documentation

#define __device__

Definition at line 219 of file NanoVDB.h.

#define __global__

Definition at line 216 of file NanoVDB.h.

#define __host__

Definition at line 222 of file NanoVDB.h.

#define __hostdev__

Definition at line 213 of file NanoVDB.h.

#define NANOVDB_ALIGN (   n)    alignas(n)

Definition at line 157 of file NanoVDB.h.

#define NANOVDB_ASSERT (   x)    assert(x)

Definition at line 190 of file NanoVDB.h.

#define NANOVDB_DATA_ALIGNMENT   32

Definition at line 154 of file NanoVDB.h.

#define NANOVDB_FPN_BRANCHLESS

Definition at line 151 of file NanoVDB.h.

#define NANOVDB_HOSTDEV_DISABLE_WARNING

Definition at line 234 of file NanoVDB.h.

#define NANOVDB_MAGIC_FILE   0x324244566f6e614eUL

Definition at line 128 of file NanoVDB.h.

#define NANOVDB_MAGIC_GRID   0x314244566f6e614eUL

Definition at line 127 of file NanoVDB.h.

#define NANOVDB_MAGIC_MASK   0x00FFFFFFFFFFFFFFUL

Definition at line 130 of file NanoVDB.h.

#define NANOVDB_MAGIC_NODE   0x334244566f6e614eUL

Definition at line 129 of file NanoVDB.h.

#define NANOVDB_MAGIC_NUMBER   0x304244566f6e614eUL

Definition at line 126 of file NanoVDB.h.

#define NANOVDB_MAJOR_VERSION_NUMBER   32

Definition at line 133 of file NanoVDB.h.

#define NANOVDB_MINOR_VERSION_NUMBER   6

Definition at line 134 of file NanoVDB.h.

#define NANOVDB_NEW_ACCESSOR_METHODS

Definition at line 149 of file NanoVDB.h.

#define NANOVDB_OFFSETOF (   CLASS,
  MEMBER 
)    ((int)(size_t)((char*)&((CLASS*)0)->MEMBER - (char*)0))

Definition at line 245 of file NanoVDB.h.

#define NANOVDB_PATCH_VERSION_NUMBER   0

Definition at line 135 of file NanoVDB.h.

#define NANOVDB_USE_SINGLE_ROOT_KEY

Definition at line 140 of file NanoVDB.h.

#define TBB_SUPPRESS_DEPRECATED_MESSAGES   1

Definition at line 137 of file NanoVDB.h.