OpenVDB 13.0.0

Loading...
Searching...
No Matches
nanovdb::io Namespace Reference

## Classes
struct | FileHeader
| Data encoded at the head of each segment of a file or stream. More...
struct | FileMetaData

## Enumerations
enum class | Codec : uint16_t { NONE = 0 , ZIP = 1 , BLOSC = 2 , End = 3 , StrLen = 6 + End }
| Define compression codecs. More...

## Functions
__hostdev__ const char * | toStr (char *dst, Codec codec)
__hostdev__ Codec | toCodec (const char *str)
template<typename StreamT>
void | 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!
template<typename StreamT, typename ValueT>
void | writeUncompressedGrid (StreamT &os, const GridData *gridData, const ValueT *blindData, GridBlindDataSemantic semantic=GridBlindDataSemantic::Unknown, bool raw=false)
| Write an IndexGrid to a stream and append blind data.
template<typename GridHandleT, template< typename... > class VecT>
void | writeUncompressedGrids (const char *fileName, const VecT< GridHandleT > &handles, bool raw=false)
| write multiple NanoVDB grids to a single file, without compression.
template<typename GridHandleT, typename StreamT, template< typename... > class VecT>
VecT< GridHandleT > | readUncompressedGrids (StreamT &is, const typename GridHandleT::BufferType &pool=typename GridHandleT::BufferType())
| read all uncompressed grids from a stream and return their handles.
template<typename GridHandleT, template< typename... > class VecT>
VecT< GridHandleT > | readUncompressedGrids (const char *fileName, const typename GridHandleT::BufferType &buffer=typename GridHandleT::BufferType())
| Read a multiple un-compressed NanoVDB grids from a file and return them as a vector.

## Enumeration Type Documentation

## ◆ Codec

enum class Codec : uint16_t
| strong

Define compression codecs.

Note
  NONE is the default, ZIP is slow but compact and BLOSC offers a great balance.

Exceptions

  NanoVDB | optionally supports ZIP and BLOSC compression and will throw an exception if its support is required but missing.

Enumerator
NONE |
ZIP |
BLOSC |
End |
StrLen |

## Function Documentation

## ◆ readUncompressedGrids() [1/2]

template<typename GridHandleT, template< typename... > class VecT>

VecT< GridHandleT > readUncompressedGrids | ( | const char * | fileName,
|  | const typename GridHandleT::BufferType & | buffer = typename GridHandleT::BufferType() )

Read a multiple un-compressed NanoVDB grids from a file and return them as a vector.

## ◆ readUncompressedGrids() [2/2]

template<typename GridHandleT, typename StreamT, template< typename... > class VecT>

VecT< GridHandleT > readUncompressedGrids | ( | StreamT & | is,
|  | const typename GridHandleT::BufferType & | pool = typename GridHandleT::BufferType() )

read all uncompressed grids from a stream and return their handles.

Exceptions

  std::invalid_argument | if stream does not contain a single uncompressed valid NanoVDB grid

StreamT class must support: "bool read(char*, size_t)" and "void skip(uint32_t)"

## ◆ toCodec()

__hostdev__ Codec toCodec | ( | const char * | str | ) |
| inline

## ◆ toStr()

__hostdev__ const char * toStr | ( | char * | dst,
|  | Codec | codec )
| inline

## ◆ writeUncompressedGrid() [1/2]

template<typename StreamT>

void 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!

Writes a raw NanoVDB buffer, possibly with multiple grids, to a stream WITHOUT compression. It follows all the conventions in util/IO.h so the stream can be read by all existing client code of NanoVDB.

Note
  This method will always write uncompressed grids to the stream, i.e. Blosc or ZIP compression is never applied! This is a fundamental limitation and feature of this standalone function.

Exceptions

  std::invalid_argument | if buffer does not point to a valid NanoVDB grid.

Warning
  This is pretty ugly code that involves lots of pointer and bit manipulations - not for the faint of heart :)

## ◆ writeUncompressedGrid() [2/2]

template<typename StreamT, typename ValueT>

void writeUncompressedGrid | ( | StreamT & | os,
|  | const GridData * | gridData,
|  | const ValueT * | blindData,
|  | GridBlindDataSemantic | semantic = GridBlindDataSemantic::Unknown,
|  | bool | raw = false )

Write an IndexGrid to a stream and append blind data.

Template Parameters

  StreamT | Type of stream to write the IndexGrid and blind data to
  ValueT | Type of the blind data

Parameters

  os | Output stream to write to
  gridData | GridData containing an IndexGrid WITHOUT existing blind data
  blindData | Raw point to array of blind data
  semantic | GridBlindDataSemantic of the blind data
  raw | If true the IndexGrid and blind data are streamed raw, i.e. without a file header.

## ◆ writeUncompressedGrids()

template<typename GridHandleT, template< typename... > class VecT>

void writeUncompressedGrids | ( | const char * | fileName,
|  | const VecT< GridHandleT > & | handles,
|  | bool | raw = false )

write multiple NanoVDB grids to a single file, without compression.

Note
  To write all grids in a single GridHandle simply use handle.write("fieNane")