OpenVDB: nanovdb::io Namespace Reference

OpenVDB 12.0.1 |

Loading...
Searching...
No Matches
Classes | Enumerations | Functions
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 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()

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 :)

## ◆ 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")