OpenVDB  11.0.0
Classes | Public Types | Public Member Functions | List of all members
CreateNanoGrid< SrcGridT > Class Template Reference

Creates any nanovdb Grid from any source grid (certain combinations are obviously not allowed) More...

#include <nanovdb/util/CreateNanoGrid.h>

Classes

struct  BlindMetaData
 

Public Types

using SrcNodeAccT = NodeAccessor< SrcGridT >
 
using SrcBuildT = typename SrcNodeAccT::BuildType
 
using SrcValueT = typename SrcNodeAccT::ValueType
 
using SrcTreeT = typename SrcNodeAccT::TreeType
 
using SrcRootT = typename SrcNodeAccT::RootType
 
template<int LEVEL>
using SrcNodeT = typename NodeTrait< SrcRootT, LEVEL >::type
 

Public Member Functions

 CreateNanoGrid (const SrcGridT &srcGrid)
 Constructor from a source grid. More...
 
 CreateNanoGrid (const SrcNodeAccT &srcNodeAcc)
 Constructor from a source node accessor (defined above) More...
 
void setVerbose (int mode=1)
 Set the level of verbosity. More...
 
void enableDithering (bool on=true)
 Enable or disable dithering, i.e. randomization of the quantization error. More...
 
void setStats (StatsMode mode=StatsMode::Default)
 Set the mode used for computing statistics of the destination grid. More...
 
void setChecksum (ChecksumMode mode=ChecksumMode::Default)
 Set the mode used for computing checksums of the destination grid. More...
 
template<typename DstBuildT = typename MapToNano<SrcBuildT>::type, typename BufferT = HostBuffer>
disable_if< is_same< DstBuildT, FpN >::value||BuildTraits< DstBuildT >::is_index, GridHandle< BufferT > >::type getHandle (const BufferT &buffer=BufferT())
 Converts the source grid into a nanovdb grid with the specified destination build type. More...
 
template<typename DstBuildT = typename MapToNano<SrcBuildT>::type, typename OracleT = AbsDiff, typename BufferT = HostBuffer>
enable_if< is_same< DstBuildT, FpN >::value, GridHandle< BufferT > >::type getHandle (const OracleT &oracle=OracleT(), const BufferT &buffer=BufferT())
 Converts the source grid into a nanovdb grid with variable bit quantization. More...
 
template<typename DstBuildT = typename MapToNano<SrcBuildT>::type, typename BufferT = HostBuffer>
enable_if< BuildTraits< DstBuildT >::is_index, GridHandle< BufferT > >::type getHandle (uint32_t channels=0u, bool includeStats=true, bool includeTiles=true, const BufferT &buffer=BufferT())
 Converts the source grid into a nanovdb grid with indices to external arrays of values. More...
 
uint64_t addBlindData (const std::string &name, GridBlindDataSemantic dataSemantic, GridBlindDataClass dataClass, GridType dataType, size_t count, size_t size)
 Add blind data to the destination grid. More...
 
uint64_t valueCount () const
 This method only has affect when getHandle was called with DstBuildT = ValueIndex or ValueOnIndex. More...
 
template<typename DstBuildT >
enable_if< BuildTraits< DstBuildT >::is_index >::type copyValues (SrcValueT *buffer)
 Copy values from the source grid into a provided buffer. More...
 

Detailed Description

template<typename SrcGridT>
class nanovdb::CreateNanoGrid< SrcGridT >

Creates any nanovdb Grid from any source grid (certain combinations are obviously not allowed)

Member Typedef Documentation

using SrcNodeAccT = NodeAccessor<SrcGridT>
using SrcNodeT = typename NodeTrait<SrcRootT, LEVEL>::type
using SrcRootT = typename SrcNodeAccT::RootType
using SrcTreeT = typename SrcNodeAccT::TreeType

Constructor & Destructor Documentation

CreateNanoGrid ( const SrcGridT &  srcGrid)

Constructor from a source grid.

Parameters
srcGridSource grid of type SrcGridT
CreateNanoGrid ( const SrcNodeAccT srcNodeAcc)

Constructor from a source node accessor (defined above)

Parameters
srcNodeAccSource node accessor of type SrcNodeAccT

Member Function Documentation

uint64_t addBlindData ( const std::string &  name,
GridBlindDataSemantic  dataSemantic,
GridBlindDataClass  dataClass,
GridType  dataType,
size_t  count,
size_t  size 
)
inline

Add blind data to the destination grid.

Parameters
nameString name of the blind data
dataSemanticSemantics of the blind data
dataClassClass of the blind data
dataTypeType of the blind data
countElement count of the blind data
sizeSize of each element of the blind data
Returns
Return the index used to access the blind data
enable_if< BuildTraits< DstBuildT >::is_index >::type copyValues ( SrcValueT buffer)

Copy values from the source grid into a provided buffer.

Template Parameters
DstBuildTMust be ValueIndex or ValueOnIndex, i.e. a index grid
Parameters
bufferpoint in which to write values
void enableDithering ( bool  on = true)
inline

Enable or disable dithering, i.e. randomization of the quantization error.

Parameters
onenable or disable dithering
Warning
Dithering only has an affect when DstBuildT = {Fp4, Fp8, Fp16, FpN}
disable_if< is_same< DstBuildT, FpN >::value||BuildTraits< DstBuildT >::is_index, GridHandle< BufferT > >::type getHandle ( const BufferT &  buffer = BufferT())

Converts the source grid into a nanovdb grid with the specified destination build type.

Template Parameters
DstBuildTbuild type of the destination, output, grid
BufferTType of the buffer used for allocating the destination grid
Parameters
bufferinstance of the buffer use for allocation
Returns
Return an instance of a GridHandle (invoking move semantics)
Note
This version is when DstBuildT != {FpN, ValueIndex, ValueOnIndex}
enable_if< is_same< DstBuildT, FpN >::value, GridHandle< BufferT > >::type getHandle ( const OracleT &  oracle = OracleT(),
const BufferT &  buffer = BufferT() 
)

Converts the source grid into a nanovdb grid with variable bit quantization.

Template Parameters
DstBuildTFpN, i.e. the destination grid uses variable bit quantization
OracleTType of oracle used to determine the N in FpN
BufferTType of the buffer used for allocating the destination grid
Parameters
oracleInstance of the oracle used to determine the N in FpN
bufferinstance of the buffer use for allocation
Returns
Return an instance of a GridHandle (invoking move semantics)
Note
This version assumes DstBuildT == FpN
enable_if< BuildTraits< DstBuildT >::is_index, GridHandle< BufferT > >::type getHandle ( uint32_t  channels = 0u,
bool  includeStats = true,
bool  includeTiles = true,
const BufferT &  buffer = BufferT() 
)

Converts the source grid into a nanovdb grid with indices to external arrays of values.

Template Parameters
DstBuildTValueIndex or ValueOnIndex, i.e. index all or just active values
BufferTType of the buffer used for allocating the destination grid
Parameters
channelsNumber of copies of values encoded as blind data in the destination grid
includeStatsSpecify if statics should be indexed
includeTilesSpecify if tile values, i.e. non-leaf-node-values, should be indexed
bufferinstance of the buffer use for allocation
Returns
Return an instance of a GridHandle (invoking move semantics)
void setChecksum ( ChecksumMode  mode = ChecksumMode::Default)
inline

Set the mode used for computing checksums of the destination grid.

Parameters
modespecify the mode of checksum
void setStats ( StatsMode  mode = StatsMode::Default)
inline

Set the mode used for computing statistics of the destination grid.

Parameters
modespecify the mode of statistics
void setVerbose ( int  mode = 1)
inline

Set the level of verbosity.

Parameters
modelevel of verbosity, mode=0 means quiet
uint64_t valueCount ( ) const
inline

This method only has affect when getHandle was called with DstBuildT = ValueIndex or ValueOnIndex.

Returns
Return the number of indexed values. If called before getHandle was called with DstBuildT = ValueIndex or ValueOnIndex the return value is zero. Else it is a value larger than zero.