OpenVDB  12.0.0
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  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! More...
 
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. More...
 
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. More...
 
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. More...
 

Enumeration Type Documentation

enum Codec : uint16_t
strong

Define compression codecs.

Note
NONE is the default, ZIP is slow but compact and BLOSC offers a great balance.
Exceptions
NanoVDBoptionally 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

VecT<GridHandleT> nanovdb::io::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_argumentif stream does not contain a single uncompressed valid NanoVDB grid

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

VecT<GridHandleT> nanovdb::io::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.

__hostdev__ Codec nanovdb::io::toCodec ( const char *  str)
inline
__hostdev__ const char* nanovdb::io::toStr ( char *  dst,
Codec  codec 
)
inline
void nanovdb::io::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_argumentif 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 :)
void nanovdb::io::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")