OpenVDB 13.2.0
Loading...
Searching...
No Matches
nanovdb::tools Namespace Reference

Namespaces

namespace  build
namespace  morphology
namespace  trait

Classes

class  AbsDiff
 Compression oracle based on absolute difference. More...
struct  Crc32TailOld
class  CreateNanoGrid
 Creates any nanovdb Grid from any source grid (certain combinations are obviously not allowed) More...
class  Extrema
class  Extrema< nanovdb::Half, 0 >
 Template specialization of Extrema on scalar Half precision value types, i.e. rank = 0. More...
class  Extrema< ValueT, 0 >
 Template specialization of Extrema on scalar value types, i.e. rank = 0.
class  Extrema< VecT, 1 >
 Template specialization of Extrema on vector value types, i.e. rank = 1. More...
class  GridStats
 Allows for the construction of NanoVDB grids without any dependency. More...
struct  IsNanoGridValid
struct  MapToNano
 Trait that maps any type to the corresponding nanovdb type. More...
class  NanoToOpenVDB
 This class will serialize an OpenVDB grid into a NanoVDB grid managed by a GridHandle. More...
class  NodeAccessor
 The NodeAccessor provides a uniform API for accessing nodes in NanoVDB, OpenVDB and build Grids. More...
class  NodeAccessor< NanoGrid< BuildT > >
 Template specialization for nanovdb::Grid which is special since its NodeManage uses a handle in order to support node access on the GPU! More...
struct  NoopStats
 No-op Stats class. More...
class  RelDiff
 Compression oracle based on relative difference. More...
class  Stats
class  Stats< nanovdb::Half, 0 >
 This class computes statistics (minimum value, maximum value, mean, variance and standard deviation) of a population of half precision floating-point values. More...
class  Stats< ValueT, 0 >
 This class computes statistics (minimum value, maximum value, mean, variance and standard deviation) of a population of floating-point values. More...
class  Stats< ValueT, 1 >
 This class computes statistics (minimum value, maximum value, mean, variance and standard deviation) of a population of floating-point values. More...
struct  VoxelBlockManager
 CPU counterpart of tools::cuda::VoxelBlockManager. Provides host-side decode of the inverse maps (sequential index -> leaf + voxel offset) for a single voxel block. The implementation is single-threaded per block and SIMD-accelerated (via util::shuffleDownMask and util::buildMaskPrefixSums); the caller is responsible for parallelism across blocks (e.g. OpenMP or nanovdb::util::forEach). More...
struct  VoxelBlockManagerBase
 Compile-time geometry parameters and output sentinels shared by the CPU and CUDA VoxelBlockManager decode structs. More...
class  VoxelBlockManagerHandle
 Move-only owner of the two raw metadata buffers that back a VoxelBlockManager: the per-block firstLeafID array (uint32_t[blockCount]) and the per-block jumpMap array (uint64_t[blockCount * JumpMapLength]). More...

Enumerations

enum class  StatsMode : uint32_t {
  Disable = 0 , BBox = 1 , MinMax = 2 , All = 3 ,
  Default = 3 , End = 4
}
 Grid flags which indicate what extra information is present in the grid buffer. More...

Functions

template<typename SrcGridT, typename DstBuildT = typename MapToNano<typename SrcGridT::BuildType>::type, typename BufferT = HostBuffer>
util::disable_if< BuildTraits< DstBuildT >::is_index||BuildTraits< DstBuildT >::is_Fp, GridHandle< BufferT > >::type createNanoGrid (const SrcGridT &srcGrid, StatsMode sMode=StatsMode::Default, CheckMode cMode=CheckMode::Default, int verbose=0, const BufferT &buffer=BufferT())
 Freestanding function that creates a NanoGrid<T> from any source grid.
template<typename SrcGridT, typename DstBuildT = typename MapToNano<typename SrcGridT::BuildType>::type, typename BufferT = HostBuffer>
util::enable_if< BuildTraits< DstBuildT >::is_index, GridHandle< BufferT > >::type createNanoGrid (const SrcGridT &srcGrid, uint32_t channels=0u, bool includeStats=true, bool includeTiles=true, int verbose=0, const BufferT &buffer=BufferT())
 Freestanding function that creates a NanoGrid<ValueIndex> or NanoGrid<ValueOnIndex> from any source grid.
template<typename SrcGridT, typename DstBuildT = typename MapToNano<typename SrcGridT::BuildType>::type, typename OracleT = AbsDiff, typename BufferT = HostBuffer>
util::enable_if< util::is_same< FpN, DstBuildT >::value, GridHandle< BufferT > >::type createNanoGrid (const SrcGridT &srcGrid, StatsMode sMode=StatsMode::Default, CheckMode cMode=CheckMode::Default, bool ditherOn=false, int verbose=0, const OracleT &oracle=OracleT(), const BufferT &buffer=BufferT())
 Freestanding function to create a NanoGrid<FpN> from any source grid.
template<typename SrcGridT, typename DstBuildT = typename MapToNano<typename SrcGridT::BuildType>::type, typename BufferT = HostBuffer>
util::enable_if< BuildTraits< DstBuildT >::is_FpX, GridHandle< BufferT > >::type createNanoGrid (const SrcGridT &srcGrid, StatsMode sMode=StatsMode::Default, CheckMode cMode=CheckMode::Default, bool ditherOn=false, int verbose=0, const BufferT &buffer=BufferT())
 Freestanding function to create a NanoGrid<FpX> from any source grid, X=4,8,16.
template<typename DstT, typename SrcT>
DstT CreateNanoGridValueCast (const SrcT val)
template<>
nanovdb::Half CreateNanoGridValueCast< nanovdb::Half, float > (const float val)
template<>
nanovdb::Half CreateNanoGridValueCast< nanovdb::Half, double > (const double val)
template<>
float CreateNanoGridValueCast< float, nanovdb::Half > (const nanovdb::Half val)
template<>
double CreateNanoGridValueCast< double, nanovdb::Half > (const nanovdb::Half val)
template<typename BuildT = float, typename BufferT = HostBuffer>
util::enable_if< util::is_same< BuildT, float, double >::value, GridHandle< BufferT > >::type createLevelSetSphere (double radius=100.0, const Vec3d &center=Vec3d(0), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0), const std::string &name="sphere_ls", StatsMode sMode=StatsMode::Default, CheckMode cMode=CheckMode::Default, const BufferT &buffer=BufferT())
 Returns a handle to a narrow-band level set of a sphere.
template<typename BuildT, typename BufferT = HostBuffer>
util::enable_if< util::is_same< BuildT, Fp4, Fp8, Fp16 >::value, GridHandle< BufferT > >::type createLevelSetSphere (double radius=100.0, const Vec3d &center=Vec3d(0), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0), const std::string &name="sphere_ls", StatsMode sMode=StatsMode::Default, CheckMode cMode=CheckMode::Default, bool ditherOn=false, const BufferT &buffer=BufferT())
template<typename BuildT, typename BufferT = HostBuffer>
util::enable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createLevelSetSphere (double radius=100.0, const Vec3d &center=Vec3d(0), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0), const std::string &name="sphere_ls_FpN", StatsMode sMode=StatsMode::Default, CheckMode cMode=CheckMode::Default, float tolerance=-1.0f, bool ditherOn=false, const BufferT &buffer=BufferT())
template<typename BuildT = float, typename BufferT = HostBuffer>
util::disable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createFogVolumeSphere (double radius=100.0, const Vec3d &center=Vec3d(0.0), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="sphere_fog", StatsMode sMode=StatsMode::Default, CheckMode cMode=CheckMode::Default, const BufferT &buffer=BufferT())
 Returns a handle to a sparse fog volume of a sphere such that the exterior is 0 and inactive, the interior is active with values varying smoothly from 0 at the surface of the sphere to 1 at the halfWidth and interior of the sphere.
template<typename BuildT, typename BufferT = HostBuffer>
util::enable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createFogVolumeSphere (double radius=100.0, const Vec3d &center=Vec3d(0.0), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="sphere_fog", StatsMode sMode=StatsMode::Default, CheckMode cMode=CheckMode::Default, float tolerance=-1.0f, bool ditherOn=false, const BufferT &buffer=BufferT())
template<typename BuildT = float, typename BufferT = HostBuffer>
util::disable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createPointSphere (int pointsPerVoxel=1, double radius=100.0, const Vec3d &center=Vec3d(0.0), double voxelSize=1.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="sphere_points", CheckMode mode=CheckMode::Default, const BufferT &buffer=BufferT())
 Returns a handle to a PointDataGrid containing points scattered on the surface of a sphere.
template<typename BuildT = float, typename BufferT = HostBuffer>
util::disable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createLevelSetTorus (double majorRadius=100.0, double minorRadius=50.0, const Vec3d &center=Vec3d(0.0), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="torus_ls", StatsMode sMode=StatsMode::Default, CheckMode cMode=CheckMode::Default, const BufferT &buffer=BufferT())
 Returns a handle to a narrow-band level set of a torus in the xz-plane.
template<typename BuildT, typename BufferT = HostBuffer>
util::enable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createLevelSetTorus (double majorRadius=100.0, double minorRadius=50.0, const Vec3d &center=Vec3d(0.0), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="torus_ls", StatsMode sMode=StatsMode::Default, CheckMode cMode=CheckMode::Default, float tolerance=-1.0f, bool ditherOn=false, const BufferT &buffer=BufferT())
template<typename BuildT = float, typename BufferT = HostBuffer>
util::disable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createFogVolumeTorus (double majorRadius=100.0, double minorRadius=50.0, const Vec3d &center=Vec3d(0.0), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="torus_fog", StatsMode sMode=StatsMode::Default, CheckMode cMode=CheckMode::Default, const BufferT &buffer=BufferT())
 Returns a handle to a sparse fog volume of a torus in the xz-plane such that the exterior is 0 and inactive, the interior is active with values varying smoothly from 0 at the surface of the torus to 1 at the halfWidth and interior of the torus.
template<typename BuildT, typename BufferT = HostBuffer>
util::enable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createFogVolumeTorus (double majorRadius=100.0, double minorRadius=50.0, const Vec3d &center=Vec3d(0.0), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="torus_fog_FpN", StatsMode sMode=StatsMode::Default, CheckMode cMode=CheckMode::Default, float tolerance=-1.0f, bool ditherOn=false, const BufferT &buffer=BufferT())
template<typename BuildT = float, typename BufferT = HostBuffer>
util::disable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createPointTorus (int pointsPerVoxel=1, double majorRadius=100.0, double minorRadius=50.0, const Vec3d &center=Vec3d(0.0), double voxelSize=1.0, const Vec3d &origin=Vec3d(0.0f), const std::string &name="torus_points", CheckMode cMode=CheckMode::Default, const BufferT &buffer=BufferT())
 Returns a handle to a PointDataGrid containing points scattered on the surface of a torus.
template<typename BuildT = float, typename BufferT = HostBuffer>
util::disable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createLevelSetBox (double width=40.0, double height=60.0, double depth=100.0, const Vec3d &center=Vec3d(0.0), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="box_ls", StatsMode sMode=StatsMode::Default, CheckMode cMode=CheckMode::Default, const BufferT &buffer=BufferT())
 Returns a handle to a narrow-band level set of a box.
template<typename BuildT, typename BufferT = HostBuffer>
util::enable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createLevelSetBox (double width=40.0, double height=60.0, double depth=100.0, const Vec3d &center=Vec3d(0.0), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="box_ls_FpN", StatsMode sMode=StatsMode::Default, CheckMode cMode=CheckMode::Default, float tolerance=-1.0f, bool ditherOn=false, const BufferT &buffer=BufferT())
template<typename BuildT = float, typename BufferT = HostBuffer>
util::disable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createFogVolumeBox (double width=40.0, double height=60.0, double depth=100.0, const Vec3d &center=Vec3d(0.0), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="box_fog", StatsMode sMode=StatsMode::Default, CheckMode cMode=CheckMode::Default, const BufferT &buffer=BufferT())
 Returns a handle to a sparse fog volume of a box such that the exterior is 0 and inactive, the interior is active with values varying smoothly from 0 at the surface of the box to 1 at the halfWidth and interior of the box.
template<typename BuildT, typename BufferT = HostBuffer>
util::enable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createFogVolumeBox (double width=40.0, double height=60.0, double depth=100.0, const Vec3d &center=Vec3d(0.0), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="box_fog_FpN", StatsMode sMode=StatsMode::Default, CheckMode cMode=CheckMode::Default, float tolerance=-1.0f, bool ditherOn=false, const BufferT &buffer=BufferT())
template<typename BuildT = float, typename BufferT = HostBuffer>
util::disable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createLevelSetOctahedron (double scale=100.0, const Vec3d &center=Vec3d(0.0), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="octadedron_ls", StatsMode sMode=StatsMode::Default, CheckMode cMode=CheckMode::Default, const BufferT &buffer=BufferT())
 Returns a handle to a narrow-band level set of a octahedron.
template<typename BuildT, typename BufferT = HostBuffer>
util::enable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createLevelSetOctahedron (double scale=100.0, const Vec3d &center=Vec3d(0.0), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="octadedron_ls_FpN", StatsMode sMode=StatsMode::Default, CheckMode cMode=CheckMode::Default, float tolerance=-1.0f, bool ditherOn=false, const BufferT &buffer=BufferT())
template<typename BuildT = float, typename BufferT = HostBuffer>
util::disable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createFogVolumeOctahedron (double scale=100.0, const Vec3d &center=Vec3d(0.0), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="octadedron_fog", StatsMode sMode=StatsMode::Default, CheckMode cMode=CheckMode::Default, const BufferT &buffer=BufferT())
 Returns a handle to a sparse fog volume of an octahedron such that the exterior is 0 and inactive, the interior is active with values varying smoothly from 0 at the surface of the octahedron to 1 at the halfWidth and interior of the octahedron.
template<typename BuildT, typename BufferT = HostBuffer>
util::enable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createFogVolumeOctahedron (double scale=100.0, const Vec3d &center=Vec3d(0.0), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="octadedron_fog_FpN", StatsMode sMode=StatsMode::Default, CheckMode cMode=CheckMode::Default, float tolerance=-1.0f, bool ditherOn=false, const BufferT &buffer=BufferT())
template<typename BuildT = float, typename BufferT = HostBuffer>
util::disable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createLevelSetBBox (double width=40.0, double height=60.0, double depth=100.0, double thickness=10.0, const Vec3d &center=Vec3d(0.0), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="bbox_ls", StatsMode sMode=StatsMode::Default, CheckMode cMode=CheckMode::Default, const BufferT &buffer=BufferT())
 Returns a handle to a narrow-band level set of a bounding-box (= wireframe of a box)
template<typename BuildT, typename BufferT = HostBuffer>
util::enable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createLevelSetBBox (double width=40.0, double height=60.0, double depth=100.0, double thickness=10.0, const Vec3d &center=Vec3d(0.0), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="bbox_ls_FpN", StatsMode sMode=StatsMode::Default, CheckMode cMode=CheckMode::Default, float tolerance=-1.0f, bool ditherOn=false, const BufferT &buffer=BufferT())
template<typename BuildT = float, typename BufferT = HostBuffer>
util::disable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createPointBox (int pointsPerVoxel=1, double width=40.0, double height=60.0, double depth=100.0, const Vec3d &center=Vec3d(0.0), double voxelSize=1.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="box_points", CheckMode mode=CheckMode::Default, const BufferT &buffer=BufferT())
 Returns a handle to a PointDataGrid containing points scattered on the surface of a box.
template<typename SrcBuildT = float, typename BufferT = HostBuffer>
GridHandle< BufferT > createPointScatter (const NanoGrid< SrcBuildT > &srcGrid, int pointsPerVoxel=1, const std::string &name="point_scatter", CheckMode mode=CheckMode::Default, const BufferT &buffer=BufferT())
 Given an input NanoVDB voxel grid this methods returns a GridHandle to another NanoVDB PointDataGrid with points scattered in the active leaf voxels of in input grid. Note, the coordinates of the points are encoded as blind data in world-space.
Checksum evalChecksum (const GridData *gridData, CheckMode mode=CheckMode::Default)
 Compute the (2 x CRC32) checksum of the specified gridData.
Checksum getChecksum (const GridData *gridData)
 Extract the checksum of a grid.
bool validateChecksum (const GridData *gridData, CheckMode mode=CheckMode::Default)
 Return true if the checksum of gridData matches the expected value already encoded into the grid's meta data.
void updateChecksum (GridData *gridData, CheckMode mode)
 Updates the checksum of a grid.
void updateChecksum (GridData *gridData)
 Updates the checksum of a grid by preserving its mode.
__hostdev__ uint32_t crc32Head (const GridData *gridData, const uint32_t *lut)
 Compute the crc32 checksum of a grid's head, i.e. its GridData and TreeData, using a lookup table. GridData::mMagic and GridData::mChecksum are excluded.
__hostdev__ uint32_t crc32Head (const GridData *gridData)
template<typename ValueT>
uint32_t crc32TailOld (const NanoGrid< ValueT > *grid, const uint32_t *lut)
uint32_t crc32Tail (const GridData *gridData, const uint32_t *lut)
template<typename ValueT>
uint32_t crc32Tail (const NanoGrid< ValueT > *grid, const uint32_t *lut)
template<typename ValueT>
Checksum evalChecksum (const NanoGrid< ValueT > *grid, CheckMode mode)
template<typename ValueT>
Checksum checksum (const NanoGrid< ValueT > *grid, CheckMode mode)
Checksum checksum (const GridData *gridData, CheckMode mode)
template<typename ValueT>
Checksum checksum (const NanoGrid< ValueT > &grid, CheckMode mode)
template<typename ValueT>
bool validateChecksum (const NanoGrid< ValueT > *grid, CheckMode mode)
template<typename ValueT>
bool validateChecksum (const NanoGrid< ValueT > &grid, CheckMode mode)
template<typename ValueT>
void updateChecksum (NanoGrid< ValueT > *grid, CheckMode mode)
template<typename ValueT>
void updateChecksum (NanoGrid< ValueT > *grid)
template<typename ValueT>
void updateChecksum (NanoGrid< ValueT > &grid, CheckMode mode)
__hostdev__ void updateGridCount (GridData *data, uint32_t gridIndex, uint32_t gridCount)
 Updates the ground index and count, as well as the head checksum if needed.
template<typename BuildT>
void updateGridStats (NanoGrid< BuildT > *grid, StatsMode mode=StatsMode::Default)
 Re-computes the min/max, stats and bbox information for an existing NanoVDB Grid.
template<typename BuildT>
Extrema< typename NanoGrid< BuildT >::ValueType > getExtrema (const NanoGrid< BuildT > &grid, const CoordBBox &bbox)
 Determine the extrema of all the values in a grid that intersects the specified bounding box.
template<typename BuildT>
void gridStats (NanoGrid< BuildT > &grid, StatsMode mode=StatsMode::Default)
template<typename ValueT>
bool isValid (const NanoGrid< ValueT > *grid, CheckMode mode, bool verbose=false)
 Performs several validation tests on a grid pointer.
template<typename ValueT>
bool isValid (const NanoGrid< ValueT > &grid, bool detailed=true, bool verbose=false)
 Return true if the specified grid passes several validation tests.
template<typename ValueT>
__hostdev__ char * checkGrid (const NanoGrid< ValueT > *grid, char *error, CheckMode mode=CheckMode::Full)
 validate grid
template<typename GridHandleT>
bool validateGrid (const GridHandleT &handle, uint32_t gridID, CheckMode mode, bool verbose)
 Validate a specific grid in a GridHandle.
template<typename GridHandleT>
bool validateGrids (const GridHandleT &handle, CheckMode mode, bool verbose)
 Validate all the grids in a GridHandle.
template<typename NanoBuildT>
auto nanoToOpenVDB (const NanoGrid< NanoBuildT > &grid)
 Free-standing function that de-serializes a typed NanoVDB grid into an OpenVDB Grid.
template<typename NanoBuildT, typename NanoValueT>
util::enable_if_t< BuildTraits< NanoBuildT >::is_index, trait::OpenGridPtr< NanoValueT > > nanoToOpenVDB (const NanoGrid< NanoBuildT > &grid, const NanoValueT *sideCar, GridClass gridClass=GridClass::Unknown, const char *gridName=nullptr)
 Free-standing function that de-serializes an IndexGrid with a sidecar into an OpenVDB Grid.
template<typename BufferT>
openvdb::GridBase::Ptr nanoToOpenVDB (const GridHandle< BufferT > &handle, uint32_t gridID=0)
 Forward declaration of free-standing function that de-serializes a grid in a NanoVDB GridHandle into an OpenVDB GridBase.
template<int Log2BlockWidth, typename BufferT>
void buildVoxelBlockManager (const NanoGrid< ValueOnIndex > *grid, VoxelBlockManagerHandle< BufferT > &handle)
 Rebuild a VoxelBlockManager in-place using a pre-allocated handle. Zeros the jumpMap and recomputes both metadata arrays. No memory allocation.
template<int Log2BlockWidth, typename BufferT = HostBuffer>
VoxelBlockManagerHandle< BufferT > buildVoxelBlockManager (const NanoGrid< ValueOnIndex > *grid, uint64_t firstOffset=0, uint64_t lastOffset=0, uint64_t nBlocks=0, const BufferT *pool=nullptr)
 Allocate buffers and build a VoxelBlockManager on the host from a ValueOnIndex grid. Uses nanovdb::util::forEach to process lower internal nodes in parallel.

Enumeration Type Documentation

◆ StatsMode

enum class StatsMode : uint32_t
strong

Grid flags which indicate what extra information is present in the grid buffer.

Enumerator
Disable 
BBox 
MinMax 
All 
Default 
End 

Function Documentation

◆ buildVoxelBlockManager() [1/2]

template<int Log2BlockWidth, typename BufferT = HostBuffer>
VoxelBlockManagerHandle< BufferT > buildVoxelBlockManager ( const NanoGrid< ValueOnIndex > * grid,
uint64_t firstOffset = 0,
uint64_t lastOffset = 0,
uint64_t nBlocks = 0,
const BufferT * pool = nullptr )

Allocate buffers and build a VoxelBlockManager on the host from a ValueOnIndex grid. Uses nanovdb::util::forEach to process lower internal nodes in parallel.

Template Parameters
Log2BlockWidthLog2 of the number of active voxels per VBM block
BufferTBuffer type for the returned handle (default: HostBuffer)
Parameters
gridHost-accessible ValueOnIndex grid (must satisfy isSequential())
firstOffsetFirst active-voxel offset covered by this VBM; must satisfy firstOffset == 1 (mod BlockWidth). Pass 0 (default) to use 1, which covers the full grid from the first active voxel.
lastOffsetLast active-voxel offset covered by this VBM. Pass 0 (default) to use grid->activeVoxelCount(), covering the full grid.
nBlocksAllocated capacity in blocks; must be >= ceil((lastOffset - firstOffset + 1) / BlockWidth). Pass 0 (default) to use the minimum required capacity.
poolOptional pool buffer for allocation (passed to BufferT::create)
Returns
A fully constructed VoxelBlockManagerHandle

◆ buildVoxelBlockManager() [2/2]

template<int Log2BlockWidth, typename BufferT>
void buildVoxelBlockManager ( const NanoGrid< ValueOnIndex > * grid,
VoxelBlockManagerHandle< BufferT > & handle )

Rebuild a VoxelBlockManager in-place using a pre-allocated handle. Zeros the jumpMap and recomputes both metadata arrays. No memory allocation.

Template Parameters
Log2BlockWidthLog2 of the number of active voxels per VBM block
BufferTBuffer type of the handle (must provide host-accessible data())
Parameters
gridHost-accessible ValueOnIndex grid (must satisfy isSequential())
handlePre-allocated handle whose blockCount/firstOffset/lastOffset are already set to match the grid

◆ checkGrid()

template<typename ValueT>
__hostdev__ char * checkGrid ( const NanoGrid< ValueT > * grid,
char * error,
CheckMode mode = CheckMode::Full )

validate grid

◆ checksum() [1/3]

Checksum checksum ( const GridData * gridData,
CheckMode mode )
inline

◆ checksum() [2/3]

template<typename ValueT>
Checksum checksum ( const NanoGrid< ValueT > & grid,
CheckMode mode )

◆ checksum() [3/3]

template<typename ValueT>
Checksum checksum ( const NanoGrid< ValueT > * grid,
CheckMode mode )

◆ crc32Head() [1/2]

__hostdev__ uint32_t crc32Head ( const GridData * gridData)
inline
Parameters
gridData
Returns

◆ crc32Head() [2/2]

__hostdev__ uint32_t crc32Head ( const GridData * gridData,
const uint32_t * lut )
inline

Compute the crc32 checksum of a grid's head, i.e. its GridData and TreeData, using a lookup table. GridData::mMagic and GridData::mChecksum are excluded.

Parameters
gridDataBase pointer to the grid.
lutPointer to the lookup table for accelerated crc32 computation.
Returns
crc32 checksum of the grid's head.

◆ crc32Tail() [1/2]

uint32_t crc32Tail ( const GridData * gridData,
const uint32_t * lut )
inline

◆ crc32Tail() [2/2]

template<typename ValueT>
uint32_t crc32Tail ( const NanoGrid< ValueT > * grid,
const uint32_t * lut )

◆ crc32TailOld()

template<typename ValueT>
uint32_t crc32TailOld ( const NanoGrid< ValueT > * grid,
const uint32_t * lut )

◆ createFogVolumeBox() [1/2]

template<typename BuildT = float, typename BufferT = HostBuffer>
util::disable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createFogVolumeBox ( double width = 40.0,
double height = 60.0,
double depth = 100.0,
const Vec3d & center = Vec3d(0.0),
double voxelSize = 1.0,
double halfWidth = 3.0,
const Vec3d & origin = Vec3d(0.0),
const std::string & name = "box_fog",
StatsMode sMode = StatsMode::Default,
CheckMode cMode = CheckMode::Default,
const BufferT & buffer = BufferT() )

Returns a handle to a sparse fog volume of a box such that the exterior is 0 and inactive, the interior is active with values varying smoothly from 0 at the surface of the box to 1 at the halfWidth and interior of the box.

Parameters
widthWidth of box in world units
heightHeight of box in world units
depthDepth of box in world units
centerCenter of box in world units
voxelSizeSize of a voxel in world units
halfWidthHalf-width of narrow band in voxel units
originOrigin of grid in world units
nameName of the grid
sModeMode of computation for the statistics.
cModeMode of computation for the checksum.
bufferBuffer used for memory allocation by the handle

The BuildT template parameter must be one of the following: float (default), double, Fp4, Fp8, Fp16 or FpN. The Fp4, Fp8, Fp16 and FpN overloads take an extra ditherOn argument, and the FpN overload also takes a tolerance argument that sets the global error tolerance.

◆ createFogVolumeBox() [2/2]

template<typename BuildT, typename BufferT = HostBuffer>
util::enable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createFogVolumeBox ( double width = 40.0,
double height = 60.0,
double depth = 100.0,
const Vec3d & center = Vec3d(0.0),
double voxelSize = 1.0,
double halfWidth = 3.0,
const Vec3d & origin = Vec3d(0.0),
const std::string & name = "box_fog_FpN",
StatsMode sMode = StatsMode::Default,
CheckMode cMode = CheckMode::Default,
float tolerance = -1.0f,
bool ditherOn = false,
const BufferT & buffer = BufferT() )

◆ createFogVolumeOctahedron() [1/2]

template<typename BuildT = float, typename BufferT = HostBuffer>
util::disable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createFogVolumeOctahedron ( double scale = 100.0,
const Vec3d & center = Vec3d(0.0),
double voxelSize = 1.0,
double halfWidth = 3.0,
const Vec3d & origin = Vec3d(0.0),
const std::string & name = "octadedron_fog",
StatsMode sMode = StatsMode::Default,
CheckMode cMode = CheckMode::Default,
const BufferT & buffer = BufferT() )

Returns a handle to a sparse fog volume of an octahedron such that the exterior is 0 and inactive, the interior is active with values varying smoothly from 0 at the surface of the octahedron to 1 at the halfWidth and interior of the octahedron.

Parameters
scaleScale of octahedron in world units
centerCenter of box in world units
voxelSizeSize of a voxel in world units
halfWidthHalf-width of narrow band in voxel units
originOrigin of grid in world units
nameName of the grid
sModeMode of computation for the statistics.
cModeMode of computation for the checksum.
bufferBuffer used for memory allocation by the handle

The BuildT template parameter must be one of the following: float (default), double, Fp4, Fp8, Fp16 or FpN. The Fp4, Fp8, Fp16 and FpN overloads take an extra ditherOn argument, and the FpN overload also takes a tolerance argument that sets the global error tolerance.

◆ createFogVolumeOctahedron() [2/2]

template<typename BuildT, typename BufferT = HostBuffer>
util::enable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createFogVolumeOctahedron ( double scale = 100.0,
const Vec3d & center = Vec3d(0.0),
double voxelSize = 1.0,
double halfWidth = 3.0,
const Vec3d & origin = Vec3d(0.0),
const std::string & name = "octadedron_fog_FpN",
StatsMode sMode = StatsMode::Default,
CheckMode cMode = CheckMode::Default,
float tolerance = -1.0f,
bool ditherOn = false,
const BufferT & buffer = BufferT() )

◆ createFogVolumeSphere() [1/2]

template<typename BuildT = float, typename BufferT = HostBuffer>
util::disable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createFogVolumeSphere ( double radius = 100.0,
const Vec3d & center = Vec3d(0.0),
double voxelSize = 1.0,
double halfWidth = 3.0,
const Vec3d & origin = Vec3d(0.0),
const std::string & name = "sphere_fog",
StatsMode sMode = StatsMode::Default,
CheckMode cMode = CheckMode::Default,
const BufferT & buffer = BufferT() )

Returns a handle to a sparse fog volume of a sphere such that the exterior is 0 and inactive, the interior is active with values varying smoothly from 0 at the surface of the sphere to 1 at the halfWidth and interior of the sphere.

Parameters
radiusRadius of sphere in world units
centerCenter of sphere in world units
voxelSizeSize of a voxel in world units
halfWidthHalf-width of narrow band in voxel units
originOrigin of grid in world units
nameName of the grid
sModeMode of computation for the statistics.
cModeMode of computation for the checksum.
bufferBuffer used for memory allocation by the handle

The BuildT template parameter must be one of the following: float (default), double, Fp4, Fp8, Fp16 or FpN. The Fp4, Fp8, Fp16 and FpN overloads take an extra ditherOn argument, and the FpN overload also takes a tolerance argument that sets the global error tolerance.

◆ createFogVolumeSphere() [2/2]

template<typename BuildT, typename BufferT = HostBuffer>
util::enable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createFogVolumeSphere ( double radius = 100.0,
const Vec3d & center = Vec3d(0.0),
double voxelSize = 1.0,
double halfWidth = 3.0,
const Vec3d & origin = Vec3d(0.0),
const std::string & name = "sphere_fog",
StatsMode sMode = StatsMode::Default,
CheckMode cMode = CheckMode::Default,
float tolerance = -1.0f,
bool ditherOn = false,
const BufferT & buffer = BufferT() )

◆ createFogVolumeTorus() [1/2]

template<typename BuildT = float, typename BufferT = HostBuffer>
util::disable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createFogVolumeTorus ( double majorRadius = 100.0,
double minorRadius = 50.0,
const Vec3d & center = Vec3d(0.0),
double voxelSize = 1.0,
double halfWidth = 3.0,
const Vec3d & origin = Vec3d(0.0),
const std::string & name = "torus_fog",
StatsMode sMode = StatsMode::Default,
CheckMode cMode = CheckMode::Default,
const BufferT & buffer = BufferT() )

Returns a handle to a sparse fog volume of a torus in the xz-plane such that the exterior is 0 and inactive, the interior is active with values varying smoothly from 0 at the surface of the torus to 1 at the halfWidth and interior of the torus.

Parameters
majorRadiusMajor radius of torus in world units
minorRadiusMinor radius of torus in world units
centerCenter of torus in world units
voxelSizeSize of a voxel in world units
halfWidthHalf-width of narrow band in voxel units
originOrigin of grid in world units
nameName of the grid
sModeMode of computation for the statistics.
cModeMode of computation for the checksum.
bufferBuffer used for memory allocation by the handle

The BuildT template parameter must be one of the following: float (default), double, Fp4, Fp8, Fp16 or FpN. The Fp4, Fp8, Fp16 and FpN overloads take an extra ditherOn argument, and the FpN overload also takes a tolerance argument that sets the global error tolerance.

◆ createFogVolumeTorus() [2/2]

template<typename BuildT, typename BufferT = HostBuffer>
util::enable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createFogVolumeTorus ( double majorRadius = 100.0,
double minorRadius = 50.0,
const Vec3d & center = Vec3d(0.0),
double voxelSize = 1.0,
double halfWidth = 3.0,
const Vec3d & origin = Vec3d(0.0),
const std::string & name = "torus_fog_FpN",
StatsMode sMode = StatsMode::Default,
CheckMode cMode = CheckMode::Default,
float tolerance = -1.0f,
bool ditherOn = false,
const BufferT & buffer = BufferT() )

◆ createLevelSetBBox() [1/2]

template<typename BuildT = float, typename BufferT = HostBuffer>
util::disable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createLevelSetBBox ( double width = 40.0,
double height = 60.0,
double depth = 100.0,
double thickness = 10.0,
const Vec3d & center = Vec3d(0.0),
double voxelSize = 1.0,
double halfWidth = 3.0,
const Vec3d & origin = Vec3d(0.0),
const std::string & name = "bbox_ls",
StatsMode sMode = StatsMode::Default,
CheckMode cMode = CheckMode::Default,
const BufferT & buffer = BufferT() )

Returns a handle to a narrow-band level set of a bounding-box (= wireframe of a box)

Parameters
widthWidth of box in world units
heightHeight of box in world units
depthDepth of box in world units
thicknessThickness of the wire in world units
centerCenter of bbox in world units
voxelSizeSize of a voxel in world units
halfWidthHalf-width of narrow band in voxel units
originOrigin of grid in world units
nameName of the grid
sModeMode of computation for the statistics.
cModeMode of computation for the checksum.
bufferBuffer used for memory allocation by the handle

The BuildT template parameter must be one of the following: float (default), double, Fp4, Fp8, Fp16 or FpN. The Fp4, Fp8, Fp16 and FpN overloads take an extra ditherOn argument, and the FpN overload also takes a tolerance argument that sets the global error tolerance.

◆ createLevelSetBBox() [2/2]

template<typename BuildT, typename BufferT = HostBuffer>
util::enable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createLevelSetBBox ( double width = 40.0,
double height = 60.0,
double depth = 100.0,
double thickness = 10.0,
const Vec3d & center = Vec3d(0.0),
double voxelSize = 1.0,
double halfWidth = 3.0,
const Vec3d & origin = Vec3d(0.0),
const std::string & name = "bbox_ls_FpN",
StatsMode sMode = StatsMode::Default,
CheckMode cMode = CheckMode::Default,
float tolerance = -1.0f,
bool ditherOn = false,
const BufferT & buffer = BufferT() )

◆ createLevelSetBox() [1/2]

template<typename BuildT = float, typename BufferT = HostBuffer>
util::disable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createLevelSetBox ( double width = 40.0,
double height = 60.0,
double depth = 100.0,
const Vec3d & center = Vec3d(0.0),
double voxelSize = 1.0,
double halfWidth = 3.0,
const Vec3d & origin = Vec3d(0.0),
const std::string & name = "box_ls",
StatsMode sMode = StatsMode::Default,
CheckMode cMode = CheckMode::Default,
const BufferT & buffer = BufferT() )

Returns a handle to a narrow-band level set of a box.

Parameters
widthWidth of box in world units
heightHeight of box in world units
depthDepth of box in world units
centerCenter of box in world units
voxelSizeSize of a voxel in world units
halfWidthHalf-width of narrow band in voxel units
originOrigin of grid in world units
nameName of the grid
sModeMode of computation for the statistics.
cModeMode of computation for the checksum.
bufferBuffer used for memory allocation by the handle

The BuildT template parameter must be one of the following: float (default), double, Fp4, Fp8, Fp16 or FpN. The Fp4, Fp8, Fp16 and FpN overloads take an extra ditherOn argument, and the FpN overload also takes a tolerance argument that sets the global error tolerance.

◆ createLevelSetBox() [2/2]

template<typename BuildT, typename BufferT = HostBuffer>
util::enable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createLevelSetBox ( double width = 40.0,
double height = 60.0,
double depth = 100.0,
const Vec3d & center = Vec3d(0.0),
double voxelSize = 1.0,
double halfWidth = 3.0,
const Vec3d & origin = Vec3d(0.0),
const std::string & name = "box_ls_FpN",
StatsMode sMode = StatsMode::Default,
CheckMode cMode = CheckMode::Default,
float tolerance = -1.0f,
bool ditherOn = false,
const BufferT & buffer = BufferT() )

◆ createLevelSetOctahedron() [1/2]

template<typename BuildT = float, typename BufferT = HostBuffer>
util::disable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createLevelSetOctahedron ( double scale = 100.0,
const Vec3d & center = Vec3d(0.0),
double voxelSize = 1.0,
double halfWidth = 3.0,
const Vec3d & origin = Vec3d(0.0),
const std::string & name = "octadedron_ls",
StatsMode sMode = StatsMode::Default,
CheckMode cMode = CheckMode::Default,
const BufferT & buffer = BufferT() )

Returns a handle to a narrow-band level set of a octahedron.

Parameters
scaleScale of octahedron in world units
centerCenter of octahedron in world units
voxelSizeSize of a voxel in world units
halfWidthHalf-width of narrow band in voxel units
originOrigin of grid in world units
nameName of the grid
sModeMode of computation for the statistics.
cModeMode of computation for the checksum.
bufferBuffer used for memory allocation by the handle

The BuildT template parameter must be one of the following: float (default), double, Fp4, Fp8, Fp16 or FpN. The Fp4, Fp8, Fp16 and FpN overloads take an extra ditherOn argument, and the FpN overload also takes a tolerance argument that sets the global error tolerance.

◆ createLevelSetOctahedron() [2/2]

template<typename BuildT, typename BufferT = HostBuffer>
util::enable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createLevelSetOctahedron ( double scale = 100.0,
const Vec3d & center = Vec3d(0.0),
double voxelSize = 1.0,
double halfWidth = 3.0,
const Vec3d & origin = Vec3d(0.0),
const std::string & name = "octadedron_ls_FpN",
StatsMode sMode = StatsMode::Default,
CheckMode cMode = CheckMode::Default,
float tolerance = -1.0f,
bool ditherOn = false,
const BufferT & buffer = BufferT() )

◆ createLevelSetSphere() [1/3]

template<typename BuildT, typename BufferT = HostBuffer>
util::enable_if< util::is_same< BuildT, Fp4, Fp8, Fp16 >::value, GridHandle< BufferT > >::type createLevelSetSphere ( double radius = 100.0,
const Vec3d & center = Vec3d(0),
double voxelSize = 1.0,
double halfWidth = 3.0,
const Vec3d & origin = Vec3d(0),
const std::string & name = "sphere_ls",
StatsMode sMode = StatsMode::Default,
CheckMode cMode = CheckMode::Default,
bool ditherOn = false,
const BufferT & buffer = BufferT() )

◆ createLevelSetSphere() [2/3]

template<typename BuildT = float, typename BufferT = HostBuffer>
util::enable_if< util::is_same< BuildT, float, double >::value, GridHandle< BufferT > >::type createLevelSetSphere ( double radius = 100.0,
const Vec3d & center = Vec3d(0),
double voxelSize = 1.0,
double halfWidth = 3.0,
const Vec3d & origin = Vec3d(0),
const std::string & name = "sphere_ls",
StatsMode sMode = StatsMode::Default,
CheckMode cMode = CheckMode::Default,
const BufferT & buffer = BufferT() )

Returns a handle to a narrow-band level set of a sphere.

Parameters
radiusRadius of sphere in world units
centerCenter of sphere in world units
voxelSizeSize of a voxel in world units
halfWidthHalf-width of narrow band in voxel units
originOrigin of grid in world units
nameName of the grid
sModeMode of computation for the statistics.
cModeMode of computation for the checksum.
bufferBuffer used for memory allocation by the handle

The BuildT template parameter must be one of the following: float (default), double, Fp4, Fp8, Fp16 or FpN. The Fp4, Fp8, Fp16 and FpN overloads take an extra ditherOn argument, and the FpN overload also takes a tolerance argument that sets the global error tolerance.

◆ createLevelSetSphere() [3/3]

template<typename BuildT, typename BufferT = HostBuffer>
util::enable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createLevelSetSphere ( double radius = 100.0,
const Vec3d & center = Vec3d(0),
double voxelSize = 1.0,
double halfWidth = 3.0,
const Vec3d & origin = Vec3d(0),
const std::string & name = "sphere_ls_FpN",
StatsMode sMode = StatsMode::Default,
CheckMode cMode = CheckMode::Default,
float tolerance = -1.0f,
bool ditherOn = false,
const BufferT & buffer = BufferT() )

◆ createLevelSetTorus() [1/2]

template<typename BuildT = float, typename BufferT = HostBuffer>
util::disable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createLevelSetTorus ( double majorRadius = 100.0,
double minorRadius = 50.0,
const Vec3d & center = Vec3d(0.0),
double voxelSize = 1.0,
double halfWidth = 3.0,
const Vec3d & origin = Vec3d(0.0),
const std::string & name = "torus_ls",
StatsMode sMode = StatsMode::Default,
CheckMode cMode = CheckMode::Default,
const BufferT & buffer = BufferT() )

Returns a handle to a narrow-band level set of a torus in the xz-plane.

Parameters
majorRadiusMajor radius of torus in world units
minorRadiusMinor radius of torus in world units
centerCenter of torus in world units
voxelSizeSize of a voxel in world units
halfWidthHalf-width of narrow band in voxel units
originOrigin of grid in world units
nameName of the grid
sModeMode of computation for the statistics.
cModeMode of computation for the checksum.
bufferBuffer used for memory allocation by the handle

The BuildT template parameter must be one of the following: float (default), double, Fp4, Fp8, Fp16 or FpN. The Fp4, Fp8, Fp16 and FpN overloads take an extra ditherOn argument, and the FpN overload also takes a tolerance argument that sets the global error tolerance.

◆ createLevelSetTorus() [2/2]

template<typename BuildT, typename BufferT = HostBuffer>
util::enable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createLevelSetTorus ( double majorRadius = 100.0,
double minorRadius = 50.0,
const Vec3d & center = Vec3d(0.0),
double voxelSize = 1.0,
double halfWidth = 3.0,
const Vec3d & origin = Vec3d(0.0),
const std::string & name = "torus_ls",
StatsMode sMode = StatsMode::Default,
CheckMode cMode = CheckMode::Default,
float tolerance = -1.0f,
bool ditherOn = false,
const BufferT & buffer = BufferT() )

◆ createNanoGrid() [1/4]

template<typename SrcGridT, typename DstBuildT = typename MapToNano<typename SrcGridT::BuildType>::type, typename BufferT = HostBuffer>
util::enable_if< BuildTraits< DstBuildT >::is_FpX, GridHandle< BufferT > >::type createNanoGrid ( const SrcGridT & srcGrid,
StatsMode sMode = StatsMode::Default,
CheckMode cMode = CheckMode::Default,
bool ditherOn = false,
int verbose = 0,
const BufferT & buffer = BufferT() )

Freestanding function to create a NanoGrid<FpX> from any source grid, X=4,8,16.

Template Parameters
SrcGridTType of in input (source) grid, e.g. openvdb::Grid or nanovdb::Grid
DstBuildT= Fp4, Fp8 or Fp16, i.e. quantization bit-width of the output grid
BufferTType of the buffer used to allocate the destination grid
Parameters
srcGridInput (source) grid to be converted
ditherOnswitch to enable or disable dithering of quantization error
sModeMode for computing statistics of the destination grid
cModeMode for computing checksums of the destination grid
verboseMode of verbosity
bufferInstance of a buffer used for allocation
Returns
Handle to the destination NanoGrid

◆ createNanoGrid() [2/4]

template<typename SrcGridT, typename DstBuildT = typename MapToNano<typename SrcGridT::BuildType>::type, typename OracleT = AbsDiff, typename BufferT = HostBuffer>
util::enable_if< util::is_same< FpN, DstBuildT >::value, GridHandle< BufferT > >::type createNanoGrid ( const SrcGridT & srcGrid,
StatsMode sMode = StatsMode::Default,
CheckMode cMode = CheckMode::Default,
bool ditherOn = false,
int verbose = 0,
const OracleT & oracle = OracleT(),
const BufferT & buffer = BufferT() )

Freestanding function to create a NanoGrid<FpN> from any source grid.

Template Parameters
SrcGridTType of in input (source) grid, e.g. openvdb::Grid or nanovdb::Grid
DstBuildT= FpN, i.e. variable bit-width of the output grid
OracleTType of the oracle used to determine the local bit-width, i.e. N in FpN
BufferTType of the buffer used to allocate the destination grid
Parameters
srcGridInput (source) grid to be converted
ditherOnswitch to enable or disable dithering of quantization error
sModeMode for computing statistics of the destination grid
cModeMode for computing checksums of the destination grid
verboseMode of verbosity
oracleInstance of a oracle used to determine the local bit-width, i.e. N in FpN
bufferInstance of a buffer used for allocation
Returns
Handle to the destination NanoGrid

◆ createNanoGrid() [3/4]

template<typename SrcGridT, typename DstBuildT = typename MapToNano<typename SrcGridT::BuildType>::type, typename BufferT = HostBuffer>
util::disable_if< BuildTraits< DstBuildT >::is_index||BuildTraits< DstBuildT >::is_Fp, GridHandle< BufferT > >::type createNanoGrid ( const SrcGridT & srcGrid,
StatsMode sMode = StatsMode::Default,
CheckMode cMode = CheckMode::Default,
int verbose = 0,
const BufferT & buffer = BufferT() )

Freestanding function that creates a NanoGrid<T> from any source grid.

Template Parameters
SrcGridTType of in input (source) grid, e.g. openvdb::Grid or nanovdb::Grid
DstBuildTType of values in the output (destination) nanovdb Grid, e.g. float or nanovdb::Fp16
BufferTType of the buffer used ti allocate the destination grid
Parameters
srcGridInput (source) grid to be converted
sModeMode for computing statistics of the destination grid
cModeMode for computing checksums of the destination grid
verboseMode of verbosity
bufferInstance of a buffer used for allocation
Returns
Handle to the destination NanoGrid

◆ createNanoGrid() [4/4]

template<typename SrcGridT, typename DstBuildT = typename MapToNano<typename SrcGridT::BuildType>::type, typename BufferT = HostBuffer>
util::enable_if< BuildTraits< DstBuildT >::is_index, GridHandle< BufferT > >::type createNanoGrid ( const SrcGridT & srcGrid,
uint32_t channels = 0u,
bool includeStats = true,
bool includeTiles = true,
int verbose = 0,
const BufferT & buffer = BufferT() )

Freestanding function that creates a NanoGrid<ValueIndex> or NanoGrid<ValueOnIndex> from any source grid.

Template Parameters
SrcGridTType of in input (source) grid, e.g. openvdb::Grid or nanovdb::Grid
DstBuildTIf ValueIndex all (active and inactive) values are indexed and if it is ValueOnIndex only active values are indexed.
BufferTBufferT Type of the buffer used ti allocate the destination grid
Parameters
srcGridInput (source) grid to be converted
channelsIf non-zero the values (active or all) in srcGrid are encoded as blind data in the output index grid. channels indicates the number of copies of these blind data
includeStatsIf true all tree nodes will includes indices for stats, i.e. min/max/avg/std-div
includeTilesIf false on values in leaf nodes are indexed
verboseMode of verbosity
bufferInstance of a buffer used for allocation
Returns
Handle to the destination NanoGrid<T> where T = ValueIndex or ValueOnIndex

◆ CreateNanoGridValueCast()

template<typename DstT, typename SrcT>
DstT CreateNanoGridValueCast ( const SrcT val)
inline

◆ CreateNanoGridValueCast< double, nanovdb::Half >()

template<>
double CreateNanoGridValueCast< double, nanovdb::Half > ( const nanovdb::Half val)
inline

◆ CreateNanoGridValueCast< float, nanovdb::Half >()

template<>
float CreateNanoGridValueCast< float, nanovdb::Half > ( const nanovdb::Half val)
inline

◆ CreateNanoGridValueCast< nanovdb::Half, double >()

template<>
nanovdb::Half CreateNanoGridValueCast< nanovdb::Half, double > ( const double val)
inline

◆ CreateNanoGridValueCast< nanovdb::Half, float >()

template<>
nanovdb::Half CreateNanoGridValueCast< nanovdb::Half, float > ( const float val)
inline

◆ createPointBox()

template<typename BuildT = float, typename BufferT = HostBuffer>
util::disable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createPointBox ( int pointsPerVoxel = 1,
double width = 40.0,
double height = 60.0,
double depth = 100.0,
const Vec3d & center = Vec3d(0.0),
double voxelSize = 1.0,
const Vec3d & origin = Vec3d(0.0),
const std::string & name = "box_points",
CheckMode mode = CheckMode::Default,
const BufferT & buffer = BufferT() )

Returns a handle to a PointDataGrid containing points scattered on the surface of a box.

Parameters
pointsPerVoxelNumber of point per voxel on on the surface
widthWidth of box in world units
heightHeight of box in world units
depthDepth of box in world units
centerCenter of box in world units
voxelSizeSize of a voxel in world units
originOrigin of grid in world units
nameName of the grid
modeMode of computation for the checksum.
bufferBuffer used for memory allocation by the handle

◆ createPointScatter()

template<typename SrcBuildT = float, typename BufferT = HostBuffer>
GridHandle< BufferT > createPointScatter ( const NanoGrid< SrcBuildT > & srcGrid,
int pointsPerVoxel = 1,
const std::string & name = "point_scatter",
CheckMode mode = CheckMode::Default,
const BufferT & buffer = BufferT() )
inline

Given an input NanoVDB voxel grid this methods returns a GridHandle to another NanoVDB PointDataGrid with points scattered in the active leaf voxels of in input grid. Note, the coordinates of the points are encoded as blind data in world-space.

Parameters
srcGridConst input grid used to determine the active voxels to scatter points into
pointsPerVoxelNumber of point per voxel on on the surface
nameName of the grid
modeMode of computation for the checksum.
bufferBuffer used for memory allocation by the handle

◆ createPointSphere()

template<typename BuildT = float, typename BufferT = HostBuffer>
util::disable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createPointSphere ( int pointsPerVoxel = 1,
double radius = 100.0,
const Vec3d & center = Vec3d(0.0),
double voxelSize = 1.0,
const Vec3d & origin = Vec3d(0.0),
const std::string & name = "sphere_points",
CheckMode mode = CheckMode::Default,
const BufferT & buffer = BufferT() )

Returns a handle to a PointDataGrid containing points scattered on the surface of a sphere.

Parameters
pointsPerVoxelNumber of point per voxel on on the surface
radiusRadius of sphere in world units
centerCenter of sphere in world units
voxelSizeSize of a voxel in world units
originOrigin of grid in world units
nameName of the grid
modeMode of computation for the checksum.
bufferBuffer used for memory allocation by the handle

The BuildT template parameter must be float (default) or double.

◆ createPointTorus()

template<typename BuildT = float, typename BufferT = HostBuffer>
util::disable_if< util::is_same< FpN, BuildT >::value, GridHandle< BufferT > >::type createPointTorus ( int pointsPerVoxel = 1,
double majorRadius = 100.0,
double minorRadius = 50.0,
const Vec3d & center = Vec3d(0.0),
double voxelSize = 1.0,
const Vec3d & origin = Vec3d(0.0f),
const std::string & name = "torus_points",
CheckMode cMode = CheckMode::Default,
const BufferT & buffer = BufferT() )

Returns a handle to a PointDataGrid containing points scattered on the surface of a torus.

Parameters
pointsPerVoxelNumber of point per voxel on on the surface
majorRadiusMajor radius of torus in world units
minorRadiusMinor radius of torus in world units
centerCenter of torus in world units
voxelSizeSize of a voxel in world units
originOrigin of grid in world units
nameName of the grid
cModeMode of computation for the checksum.
bufferBuffer used for memory allocation by the handle

The BuildT template parameter must be float (default) or double.

◆ evalChecksum() [1/2]

Checksum evalChecksum ( const GridData * gridData,
CheckMode mode = CheckMode::Default )
inline

Compute the (2 x CRC32) checksum of the specified gridData.

Parameters
gridDataBase pointer to the grid from which the checksum is computed.
modeDefines the mode of computation for the checksum.
Returns
Return the (2 x CRC32) checksum of the specified gridData

◆ evalChecksum() [2/2]

template<typename ValueT>
Checksum evalChecksum ( const NanoGrid< ValueT > * grid,
CheckMode mode )
Template Parameters
ValueT
Parameters
grid
mode
Returns

◆ getChecksum()

Checksum getChecksum ( const GridData * gridData)
inline

Extract the checksum of a grid.

Parameters
gridDataBase pointer to grid with a checksum
Returns
Checksum encoded in the specified grid

◆ getExtrema()

template<typename BuildT>
Extrema< typename NanoGrid< BuildT >::ValueType > getExtrema ( const NanoGrid< BuildT > & grid,
const CoordBBox & bbox )

Determine the extrema of all the values in a grid that intersects the specified bounding box.

return the extrema of all the values in a grid that intersects the specified bounding box.

Template Parameters
BuildTBuild type of the input grid
Parameters
gridtyped grid
bboxindex bounding box in which min/max are computed
Returns
Extream of values insixe bbox

◆ gridStats()

template<typename BuildT>
void gridStats ( NanoGrid< BuildT > & grid,
StatsMode mode = StatsMode::Default )

◆ isValid() [1/2]

template<typename ValueT>
bool isValid ( const NanoGrid< ValueT > & grid,
bool detailed = true,
bool verbose = false )

Return true if the specified grid passes several validation tests.

Template Parameters
ValueTBuild type of the input grid
Parameters
gridGrid to validate
detailedIf true the validation test is detailed and relatively slow.
verboseIf true information about the first failed test is printed to std::cerr
Note
This method has been deprecated by the one defined above

◆ isValid() [2/2]

template<typename ValueT>
bool isValid ( const NanoGrid< ValueT > * grid,
CheckMode mode,
bool verbose = false )

Performs several validation tests on a grid pointer.

Template Parameters
ValueTBuild type of the input grid
Parameters
gridconst point to the grid that needs validation
modeMode of the validation check (defined in GridChecksum.h)
verboseIf true information about the first failed test is printed to std::cerr
Returns
Return true if the specified grid passes several validation tests.

◆ nanoToOpenVDB() [1/3]

template<typename BufferT>
openvdb::GridBase::Ptr nanoToOpenVDB ( const GridHandle< BufferT > & handle,
uint32_t gridID = 0 )

Forward declaration of free-standing function that de-serializes a grid in a NanoVDB GridHandle into an OpenVDB GridBase.

Template Parameters
BufferTTemplate type of the buffer used to allocate the grid handle
Parameters
handleHandle for the input grid to be converted
gridIDID of the grid in the GridHandle to be converted (defaults to first grid)
Returns
Shared pointer to an OpenVDB BaseGrid
Note
If grid number gridID in handle has GridType IndexGrid, then the first suitable blind data is used as the sidecar data

◆ nanoToOpenVDB() [2/3]

template<typename NanoBuildT>
auto nanoToOpenVDB ( const NanoGrid< NanoBuildT > & grid)

Free-standing function that de-serializes a typed NanoVDB grid into an OpenVDB Grid.

Template Parameters
NanoBuildTTemplate build type for the grid
Parameters
gridNanoVDB grid to be converted to an OpenVDB grid
Returns
If NanoBuildT is an index type, e.g. ValueOnIndex, a shared pointer to an OpenVDB GridBase is returned. Otherwise a shared pointer to an OpenVDB Grid of a matching type . (trait::OpenGridPtr<NanoBuildT>) is returned.

◆ nanoToOpenVDB() [3/3]

template<typename NanoBuildT, typename NanoValueT>
util::enable_if_t< BuildTraits< NanoBuildT >::is_index, trait::OpenGridPtr< NanoValueT > > nanoToOpenVDB ( const NanoGrid< NanoBuildT > & grid,
const NanoValueT * sideCar,
GridClass gridClass = GridClass::Unknown,
const char * gridName = nullptr )

Free-standing function that de-serializes an IndexGrid with a sidecar into an OpenVDB Grid.

Template Parameters
NanoValueTTemplate type of the sidecar data accompanying the index grid
Parameters
gridIndexGrid into the sidecar data
sideCarLinear array of sidecar data
gridClassGridClass corresponding to the sidecar data
gridNameName of the output grid
Returns
Shared pointer to an OpenVDB Grid of a matching type (trait::OpenGridPtr<NanoValueT>)

◆ updateChecksum() [1/5]

void updateChecksum ( GridData * gridData)
inline

Updates the checksum of a grid by preserving its mode.

Parameters
gridDataBase pointer to grid

◆ updateChecksum() [2/5]

void updateChecksum ( GridData * gridData,
CheckMode mode )
inline

Updates the checksum of a grid.

Parameters
gridDataBase pointer to the grid whose checksum will be updated.
modeDefines the mode of computation for the checksum.

◆ updateChecksum() [3/5]

template<typename ValueT>
void updateChecksum ( NanoGrid< ValueT > & grid,
CheckMode mode )

◆ updateChecksum() [4/5]

template<typename ValueT>
void updateChecksum ( NanoGrid< ValueT > * grid)

◆ updateChecksum() [5/5]

template<typename ValueT>
void updateChecksum ( NanoGrid< ValueT > * grid,
CheckMode mode )
Template Parameters
ValueT
Parameters
grid
mode

◆ updateGridCount()

__hostdev__ void updateGridCount ( GridData * data,
uint32_t gridIndex,
uint32_t gridCount )
inline

Updates the ground index and count, as well as the head checksum if needed.

Parameters
dataPointer to grid data
gridIndexNew value of the index
gridCountNew value of the grid count

◆ updateGridStats()

template<typename BuildT>
void updateGridStats ( NanoGrid< BuildT > * grid,
StatsMode mode = StatsMode::Default )

Re-computes the min/max, stats and bbox information for an existing NanoVDB Grid.

Parameters
gridGrid whose stats to update
modeMode of computation for the statistics.

◆ validateChecksum() [1/3]

bool validateChecksum ( const GridData * gridData,
CheckMode mode = CheckMode::Default )
inline

Return true if the checksum of gridData matches the expected value already encoded into the grid's meta data.

Parameters
gridDataBase pointer to the grid whose checksum is validated.
modeDefines the mode of computation for the checksum.

◆ validateChecksum() [2/3]

template<typename ValueT>
bool validateChecksum ( const NanoGrid< ValueT > & grid,
CheckMode mode )

◆ validateChecksum() [3/3]

template<typename ValueT>
bool validateChecksum ( const NanoGrid< ValueT > * grid,
CheckMode mode )
Template Parameters
ValueT
Parameters
grid
mode
Returns

◆ validateGrid()

template<typename GridHandleT>
bool validateGrid ( const GridHandleT & handle,
uint32_t gridID,
CheckMode mode,
bool verbose )

Validate a specific grid in a GridHandle.

Template Parameters
GridHandleTType of GridHandle
Parameters
handleGridHandle containing host grids
gridIDlinear index of the grid to be validated
modenode of validation tests
verboseif true information is printed if the grid fails a validation test
Returns
true if grid gridID passes all the validation tests

◆ validateGrids()

template<typename GridHandleT>
bool validateGrids ( const GridHandleT & handle,
CheckMode mode,
bool verbose )

Validate all the grids in a GridHandle.

Template Parameters
GridHandleTType of GridHandle
Parameters
handleGridHandle containing host grids (0,1...,N)
modenode of validation tests
verboseif true information is printed if a grid fails a validation test
Returns
true if all grids pass alle the validation tests