OpenVDB: CreateNanoGrid< SrcGridT > Class Template Reference

OpenVDB 11.0.0

Loading...
Searching...
No Matches
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.
| CreateNanoGrid (const SrcNodeAccT &srcNodeAcc)
| Constructor from a source node accessor (defined above)
void | setVerbose (int mode=1)
| Set the level of verbosity.
void | enableDithering (bool on=true)
| Enable or disable dithering, i.e. randomization of the quantization error.
void | setStats (StatsMode mode=StatsMode::Default)
| Set the mode used for computing statistics of the destination grid.
void | setChecksum (ChecksumMode mode=ChecksumMode::Default)
| Set the mode used for computing checksums of the destination grid.
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.
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.
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.
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.
uint64_t | valueCount () const
| This method only has affect when getHandle was called with DstBuildT = ValueIndex or ValueOnIndex.
template<typename DstBuildT >
enable_if< BuildTraits< DstBuildT >::is_index >::type | copyValues (SrcValueT *buffer)
| Copy values from the source grid into a provided buffer.

## 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

## ◆ SrcBuildT

template<typename SrcGridT >

using SrcBuildT = typename SrcNodeAccT::BuildType

## ◆ SrcNodeAccT

template<typename SrcGridT >

using SrcNodeAccT = NodeAccessor<SrcGridT>

## ◆ SrcNodeT

template<typename SrcGridT >
template<int LEVEL>

using SrcNodeT = typename NodeTrait<SrcRootT, LEVEL>::type

## ◆ SrcRootT

template<typename SrcGridT >

using SrcRootT = typename SrcNodeAccT::RootType

## ◆ SrcTreeT

template<typename SrcGridT >

using SrcTreeT = typename SrcNodeAccT::TreeType

## ◆ SrcValueT

template<typename SrcGridT >

using SrcValueT = typename SrcNodeAccT::ValueType

## Constructor & Destructor Documentation

## ◆ CreateNanoGrid() [1/2]

template<typename SrcGridT >

CreateNanoGrid | ( | const SrcGridT & | srcGrid | ) |

Constructor from a source grid.

Parameters

  srcGrid | Source grid of type SrcGridT

## ◆ CreateNanoGrid() [2/2]

template<typename SrcGridT >

CreateNanoGrid | ( | const SrcNodeAccT & | srcNodeAcc | ) |

Constructor from a source node accessor (defined above)

Parameters

  srcNodeAcc | Source node accessor of type SrcNodeAccT

## Member Function Documentation

## ◆ addBlindData()

template<typename SrcGridT >

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

  name | String name of the blind data
  dataSemantic | Semantics of the blind data
  dataClass | Class of the blind data
  dataType | Type of the blind data
  count | Element count of the blind data
  size | Size of each element of the blind data

Returns
  Return the index used to access the blind data

## ◆ copyValues()

template<typename SrcGridT >
template<typename DstBuildT >

enable_if< BuildTraits< DstBuildT >::is_index >::type copyValues | ( | SrcValueT * | buffer | ) |

Copy values from the source grid into a provided buffer.

Template Parameters

  DstBuildT | Must be ValueIndex or ValueOnIndex, i.e. a index grid

Parameters

  buffer | point in which to write values

## ◆ enableDithering()

template<typename SrcGridT >

void enableDithering | ( | bool | on = true | ) |
| inline

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

Parameters

  on | enable or disable dithering

Warning
  Dithering only has an affect when DstBuildT = {Fp4, Fp8, Fp16, FpN}

## ◆ getHandle() [1/3]

template<typename SrcGridT >
template<typename DstBuildT , typename BufferT >

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

  DstBuildT | build type of the destination, output, grid
  BufferT | Type of the buffer used for allocating the destination grid

Parameters

  buffer | instance 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}

## ◆ getHandle() [2/3]

template<typename SrcGridT >
template<typename DstBuildT , typename OracleT , typename BufferT >

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

  DstBuildT | FpN, i.e. the destination grid uses variable bit quantization
  OracleT | Type of oracle used to determine the N in FpN
  BufferT | Type of the buffer used for allocating the destination grid

Parameters

  oracle | Instance of the oracle used to determine the N in FpN
  buffer | instance of the buffer use for allocation

Returns
  Return an instance of a GridHandle (invoking move semantics)

Note
  This version assumes DstBuildT == FpN

## ◆ getHandle() [3/3]

template<typename SrcGridT >
template<typename DstBuildT , typename BufferT >

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

  DstBuildT | ValueIndex or ValueOnIndex, i.e. index all or just active values
  BufferT | Type of the buffer used for allocating the destination grid

Parameters

  channels | Number of copies of values encoded as blind data in the destination grid
  includeStats | Specify if statics should be indexed
  includeTiles | Specify if tile values, i.e. non-leaf-node-values, should be indexed
  buffer | instance of the buffer use for allocation

Returns
  Return an instance of a GridHandle (invoking move semantics)

## ◆ setChecksum()

template<typename SrcGridT >

void setChecksum | ( | ChecksumMode | mode = ChecksumMode::Default | ) |
| inline

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

Parameters

  mode | specify the mode of checksum

## ◆ setStats()

template<typename SrcGridT >

void setStats | ( | StatsMode | mode = StatsMode::Default | ) |
| inline

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

Parameters

  mode | specify the mode of statistics

## ◆ setVerbose()

template<typename SrcGridT >

void setVerbose | ( | int | mode = 1 | ) |
| inline

Set the level of verbosity.

Parameters

  mode | level of verbosity, mode=0 means quiet

## ◆ valueCount()

template<typename SrcGridT >

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.