|
OpenVDB 11.0.0
|
Namespaces | |
| namespace | Internal |
| Internal functions for compressed read/write of a NanoVDB GridHandle into a stream. | |
Classes | |
| struct | FileGridMetaData |
| This class defines the meta data stored for each grid in a segment. More... | |
| struct | FileHeader |
| Data encoded at the head of each segment of a file or stream. More... | |
| struct | FileMetaData |
| struct | Segment |
| This class defines all the data stored in segment of a file. More... | |
Typedefs | |
| using | fileSize_t = uint64_t |
Enumerations | |
| enum class | Codec : uint16_t { NONE = 0 , ZIP = 1 , BLOSC = 2 , END = 3 } |
| Define compression codecs. More... | |
Functions | |
| const char * | toStr (Codec codec) |
| 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. | |
| template<typename BufferT > | |
| void | writeGrid (const std::string &fileName, const GridHandle< BufferT > &handle, io::Codec codec=io::Codec::NONE, int verbose=0) |
| Write a single grid to file (over-writing existing content of the file) | |
| template<typename BufferT = HostBuffer, template< typename... > class VecT = std::vector> | |
| void | writeGrids (const std::string &fileName, const VecT< GridHandle< BufferT > > &handles, Codec codec=Codec::NONE, int verbose=0) |
| Write multiple grids to file (over-writing existing content of the file) | |
| template<typename BufferT = HostBuffer> | |
| GridHandle< BufferT > | readGrid (const std::string &fileName, int n=0, int verbose=0, const BufferT &buffer=BufferT()) |
| Read and return one or all grids from a file into a single GridHandle. | |
| template<typename BufferT = HostBuffer> | |
| GridHandle< BufferT > | readGrid (const std::string &fileName, const std::string &gridName, int verbose=0, const BufferT &buffer=BufferT()) |
| Read and return the first grid with a specific name from a file. | |
| template<typename BufferT = HostBuffer, template< typename... > class VecT = std::vector> | |
| VecT< GridHandle< BufferT > > | readGrids (const std::string &fileName, int verbose=0, const BufferT &buffer=BufferT()) |
| Read all the grids in the file and return them as a vector of multiple GridHandles, each containing all grids encoded in the same segment of the file (i.e. they where written together) | |
| uint64_t | stringHash (const char *cstr) |
| Standard hash function to use on strings; std::hash may vary by platform/implementation and is know to produce frequent collisions. | |
| uint64_t | stringHash (const std::string &str) |
| Return a uint64_t hash key of a std::string. | |
| uint64_t | reverseEndianness (uint64_t val) |
| Return a uint64_t with its bytes reversed so we can check for endianness. | |
| bool | hasGrid (const std::string &fileName, const std::string &gridName) |
| Return true if the file contains a grid with the specified name. | |
| bool | hasGrid (std::istream &is, const std::string &gridName) |
| Return true if the stream contains a grid with the specified name. | |
| std::vector< FileGridMetaData > | readGridMetaData (const std::string &fileName) |
| Reads and returns a vector of meta data for all the grids found in the specified file. | |
| std::vector< FileGridMetaData > | readGridMetaData (std::istream &is) |
| Reads and returns a vector of meta data for all the grids found in the specified stream. | |
| template<typename BufferT > | |
| void | writeGrid (std::ostream &os, const GridHandle< BufferT > &handle, Codec codec) |
| template<typename BufferT = HostBuffer, template< typename... > class VecT = std::vector> | |
| void | writeGrids (std::ostream &os, const VecT< GridHandle< BufferT > > &handles, Codec codec=Codec::NONE) |
| template<typename BufferT > | |
| GridHandle< BufferT > | readGrid (std::istream &is, int n, const BufferT &pool) |
| template<typename BufferT > | |
| GridHandle< BufferT > | readGrid (std::istream &is, const std::string &gridName, const BufferT &pool) |
| Read a specific grid from an input stream given the name of the grid. | |
| template<typename BufferT = HostBuffer, template< typename... > class VecT = std::vector> | |
| VecT< GridHandle< BufferT > > | readGrids (std::istream &is, const BufferT &pool=BufferT()) |
| using fileSize_t = uint64_t |
We fix a specific size for counting bytes in files so that they are saved the same regardless of machine precision. (Note there are still little/bigendian issues, however)
|
strong |
|
inline |
Return true if the file contains a grid with the specified name.
|
inline |
Return true if the stream contains a grid with the specified name.
| GridHandle< BufferT > readGrid | ( | const std::string & | fileName, |
| const std::string & | gridName, | ||
| int | verbose = 0, |
||
| const BufferT & | buffer = BufferT() |
||
| ) |
Read and return the first grid with a specific name from a file.
Read the first grid with a specific name.
| BufferT | Type of buffer used memory allocation |
| fileName | string name of file to be read from |
| gridName | string name of the grid to be read |
| verbose | specify verbosity level. Default value of zero means quiet. |
| buffer | optional buffer used for memory allocation |
| will | throw a std::runtime_error if the file does not contain a grid with the specific name |
| GridHandle< BufferT > readGrid | ( | const std::string & | fileName, |
| int | n = 0, |
||
| int | verbose = 0, |
||
| const BufferT & | buffer = BufferT() |
||
| ) |
Read and return one or all grids from a file into a single GridHandle.
Read the n'th grid.
| BufferT | Type of buffer used memory allocation |
| fileName | string name of file to be read from |
| n | zero-based signed index of the grid to be read. The default value of 0 means read only first grid. A negative value of n means read all grids in the file. |
| verbose | specify verbosity level. Default value of zero means quiet. |
| buffer | optional buffer used for memory allocation |
| will | throw a std::runtime_error if the file does not contain a grid with index n |
| GridHandle< BufferT > readGrid | ( | std::istream & | is, |
| const std::string & | gridName, | ||
| const BufferT & | pool | ||
| ) |
Read a specific grid from an input stream given the name of the grid.
| BufferT | Buffer type used for allocation |
| is | input stream from which to read the grid |
| gridName | string name of the (first) grid to be returned |
| pool | optional memory pool from which to allocate the grid buffer |
| std::runtime_error | with no grid exists with the specified name |
| GridHandle< BufferT > readGrid | ( | std::istream & | is, |
| int | n, | ||
| const BufferT & | pool | ||
| ) |
|
inline |
Reads and returns a vector of meta data for all the grids found in the specified file.
|
inline |
Reads and returns a vector of meta data for all the grids found in the specified stream.
| VecT< GridHandle< BufferT > > readGrids | ( | const std::string & | fileName, |
| int | verbose = 0, |
||
| const BufferT & | buffer = BufferT() |
||
| ) |
Read all the grids in the file and return them as a vector of multiple GridHandles, each containing all grids encoded in the same segment of the file (i.e. they where written together)
Read all the grids.
| BufferT | Type of buffer used memory allocation |
| fileName | string name of file to be read from |
| verbose | specify verbosity level. Default value of zero means quiet. |
| buffer | optional buffer used for memory allocation |
| VecT< GridHandle< BufferT > > readGrids | ( | std::istream & | is, |
| const BufferT & | pool = BufferT() |
||
| ) |
| 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.
| VecT< GridHandleT > readUncompressedGrids | ( | StreamT & | is, |
| const typename GridHandleT::BufferType & | pool = typename GridHandleT::BufferType() |
||
| ) |
read all uncompressed grids from a stream and return their handles.
| 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)"
|
inline |
Return a uint64_t with its bytes reversed so we can check for endianness.
|
inline |
Standard hash function to use on strings; std::hash may vary by platform/implementation and is know to produce frequent collisions.
|
inline |
Return a uint64_t hash key of a std::string.
|
inline |
| void writeGrid | ( | const std::string & | fileName, |
| const GridHandle< BufferT > & | handle, | ||
| io::Codec | codec = io::Codec::NONE, |
||
| int | verbose = 0 |
||
| ) |
Write a single grid to file (over-writing existing content of the file)
| void writeGrid | ( | std::ostream & | os, |
| const GridHandle< BufferT > & | handle, | ||
| Codec | codec | ||
| ) |
| void writeGrids | ( | const std::string & | fileName, |
| const VecT< GridHandle< BufferT > > & | handles, | ||
| Codec | codec = Codec::NONE, |
||
| int | verbose = 0 |
||
| ) |
Write multiple grids to file (over-writing existing content of the file)
| void writeGrids | ( | std::ostream & | os, |
| const VecT< GridHandle< BufferT > > & | handles, | ||
| Codec | codec = Codec::NONE |
||
| ) |
| 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.
| std::invalid_argument | if buffer does not point to a valid NanoVDB grid. |
| void writeUncompressedGrids | ( | const char * | fileName, |
| const VecT< GridHandleT > & | handles, | ||
| bool | raw = false |
||
| ) |
write multiple NanoVDB grids to a single file, without compression.