HDK
|
This class serves to manage a buffer containing one or more NanoVDB Grids. More...
#include <GridHandle.h>
Public Types | |
using | BufferType = BufferT |
Public Member Functions | |
template<typename T = BufferT, typename enable_if< BufferTraits< T >::hasDeviceDual, int >::type = 0> | |
GridHandle (T &&buffer) | |
Move constructor from a host buffer. More... | |
template<typename T = BufferT, typename disable_if< BufferTraits< T >::hasDeviceDual, int >::type = 0> | |
GridHandle (T &&buffer) | |
Move constructor from a dual host-device buffer. More... | |
GridHandle ()=default | |
Constructs an empty GridHandle. More... | |
GridHandle (const GridHandle &)=delete | |
Disallow copy-construction. More... | |
GridHandle (GridHandle &&other) noexcept | |
Move copy-constructor. More... | |
void | reset () |
clear this GridHandle to an empty handle More... | |
GridHandle & | operator= (const GridHandle &)=delete |
Disallow copy assignment operation. More... | |
GridHandle & | operator= (GridHandle &&other) noexcept |
Move copy assignment operation. More... | |
template<typename OtherBufferT = HostBuffer> | |
GridHandle< OtherBufferT > | copy (const OtherBufferT &buffer=OtherBufferT()) const |
Performs a deep copy of the GridHandle, possibly templated on a different buffer type. More... | |
BufferT & | buffer () |
Return a reference to the buffer. More... | |
const BufferT & | buffer () const |
Return a const reference to the buffer. More... | |
uint8_t * | data () |
Returns a non-const pointer to the data. More... | |
const uint8_t * | data () const |
Returns a const pointer to the data. More... | |
template<typename U = BufferT> | |
enable_if< BufferTraits< U > ::hasDeviceDual, const uint8_t * > ::type | deviceData () const |
template<typename U = BufferT> | |
enable_if< BufferTraits< U > ::hasDeviceDual, uint8_t * > ::type | deviceData () |
uint64_t | size () const |
Returns the size in bytes of the raw memory buffer managed by this GridHandle. More... | |
operator bool () const | |
Return true if this handle contains any grids. More... | |
template<typename ValueT > | |
const NanoGrid< ValueT > * | grid (uint32_t n=0) const |
Returns a const host pointer to the n'th NanoVDB grid encoded in this GridHandle. More... | |
template<typename ValueT > | |
NanoGrid< ValueT > * | grid (uint32_t n=0) |
Returns a host pointer to the n'th NanoVDB grid encoded in this GridHandle. More... | |
template<typename ValueT , typename U = BufferT> | |
enable_if< BufferTraits< U > ::hasDeviceDual, const NanoGrid< ValueT > * >::type | deviceGrid (uint32_t n=0) const |
Return a const pointer to the n'th grid encoded in this GridHandle on the device, e.g. GPU. More... | |
template<typename ValueT , typename U = BufferT> | |
enable_if< BufferTraits< U > ::hasDeviceDual, NanoGrid < ValueT > * >::type | deviceGrid (uint32_t n=0) |
Return a const pointer to the n'th grid encoded in this GridHandle on the device, e.g. GPU. More... | |
template<typename U = BufferT> | |
enable_if< BufferTraits< U > ::hasDeviceDual, void >::type | deviceUpload (void *stream=nullptr, bool sync=true) |
Upload the grid to the device, e.g. from CPU to GPU. More... | |
template<typename U = BufferT> | |
enable_if< BufferTraits< U > ::hasDeviceDual, void >::type | deviceDownload (void *stream=nullptr, bool sync=true) |
Download the grid to from the device, e.g. from GPU to CPU. More... | |
bool | isPadded () const |
Check if the buffer is this handle has any padding, i.e. if the buffer is larger than the combined size of all its grids. More... | |
uint32_t | gridCount () const |
Return the total number of grids contained in this buffer. More... | |
uint64_t | gridSize (uint32_t n=0) const |
Return the grid size of the n'th grid in this GridHandle. More... | |
GridType | gridType (uint32_t n=0) const |
Return the GridType of the n'th grid in this GridHandle. More... | |
const GridData * | gridData (uint32_t n=0) const |
Access to the GridData of the n'th grid in the current handle. More... | |
const GridMetaData * | gridMetaData (uint32_t n=0) const |
Returns a const point to the n'th grid meta data. More... | |
void | write (std::ostream &os, uint32_t n) const |
Write a specific grid in this buffer to an output stream. More... | |
void | write (std::ostream &os) const |
Write the entire grid buffer to an output stream. More... | |
void | write (const std::string &fileName) const |
Write this entire grid buffer to a file. More... | |
void | write (const std::string &fileName, uint32_t n) const |
Write a specific grid to file. More... | |
void | read (std::istream &is, const BufferT &pool=BufferT()) |
Read an entire raw grid buffer from an input stream. More... | |
void | read (std::istream &is, uint32_t n, const BufferT &pool=BufferT()) |
Read a specific grid from an input stream containing a raw grid buffer. More... | |
void | read (std::istream &is, const std::string &gridName, const BufferT &pool=BufferT()) |
Read a specific grid from an input stream containing a raw grid buffer. More... | |
void | read (const std::string &fileName, const BufferT &pool=BufferT()) |
Read a raw grid buffer from a file. More... | |
void | read (const std::string &fileName, uint32_t n, const BufferT &pool=BufferT()) |
Read a specific grid from a file containing a raw grid buffer. More... | |
void | read (const std::string &fileName, const std::string &gridName, const BufferT &pool=BufferT()) |
Read a specific grid from a file containing a raw grid buffer. More... | |
bool | empty () const |
Return true if this handle is empty, i.e. has no allocated memory. More... | |
bool | isEmpty () const |
Return true if this handle is empty, i.e. has no allocated memory. More... | |
This class serves to manage a buffer containing one or more NanoVDB Grids.
Definition at line 37 of file GridHandle.h.
using nanovdb::GridHandle< BufferT >::BufferType = BufferT |
Definition at line 46 of file GridHandle.h.
nanovdb::GridHandle< BufferT >::GridHandle | ( | T && | buffer | ) |
Move constructor from a host buffer.
buffer | buffer containing one or more NanoGrids that will be moved into this GridHandle |
Will | throw and error with the buffer does not contain a valid NanoGrid! |
Definition at line 322 of file GridHandle.h.
nanovdb::GridHandle< BufferT >::GridHandle | ( | T && | buffer | ) |
Move constructor from a dual host-device buffer.
buffer | buffer containing one or more NanoGrids that will be moved into this GridHandle |
Will | throw and error with the buffer does not contain a valid NanoGrid! |
|
default |
Constructs an empty GridHandle.
|
delete |
Disallow copy-construction.
|
inlinenoexcept |
Move copy-constructor.
Definition at line 67 of file GridHandle.h.
|
inline |
Return a reference to the buffer.
Definition at line 96 of file GridHandle.h.
|
inline |
Return a const reference to the buffer.
Definition at line 99 of file GridHandle.h.
|
inline |
Performs a deep copy of the GridHandle, possibly templated on a different buffer type.
OtherBufferT | Buffer type of the deep copy |
buffer | optional buffer used for allocation |
Definition at line 335 of file GridHandle.h.
|
inline |
Returns a non-const pointer to the data.
Definition at line 103 of file GridHandle.h.
|
inline |
Returns a const pointer to the data.
Definition at line 107 of file GridHandle.h.
|
inline |
Definition at line 111 of file GridHandle.h.
|
inline |
Definition at line 114 of file GridHandle.h.
|
inline |
Download the grid to from the device, e.g. from GPU to CPU.
Definition at line 173 of file GridHandle.h.
|
inline |
Return a const pointer to the n'th grid encoded in this GridHandle on the device, e.g. GPU.
ValueT | Value type of the grid point to be returned |
n | Index of the (device) grid pointer to be returned |
Definition at line 355 of file GridHandle.h.
|
inline |
Return a const pointer to the n'th grid encoded in this GridHandle on the device, e.g. GPU.
ValueT | Value type of the grid point to be returned |
n | Index if of the grid pointer to be returned |
verbose | if non-zero error messages will be printed in case something failed |
Definition at line 161 of file GridHandle.h.
|
inline |
Upload the grid to the device, e.g. from CPU to GPU.
Definition at line 167 of file GridHandle.h.
|
inline |
Return true if this handle is empty, i.e. has no allocated memory.
Definition at line 121 of file GridHandle.h.
|
inline |
Returns a const host pointer to the n'th NanoVDB grid encoded in this GridHandle.
ValueT | Value type of the grid point to be returned |
n | Index of the (host) grid pointer to be returned |
Definition at line 345 of file GridHandle.h.
|
inline |
Returns a host pointer to the n'th NanoVDB grid encoded in this GridHandle.
ValueT | Value type of the grid point to be returned |
n | Index of the (host) grid pointer to be returned |
Definition at line 142 of file GridHandle.h.
|
inline |
Return the total number of grids contained in this buffer.
Definition at line 180 of file GridHandle.h.
|
inline |
Access to the GridData of the n'th grid in the current handle.
n | zero-based ID of the grid |
Definition at line 293 of file GridHandle.h.
|
inline |
Returns a const point to the n'th grid meta data.
n | zero-based ID of the grid |
Definition at line 301 of file GridHandle.h.
|
inline |
Return the grid size of the n'th grid in this GridHandle.
n | index of the grid (assumed to be less than gridCount()) |
Definition at line 185 of file GridHandle.h.
|
inline |
Return the GridType of the n'th grid in this GridHandle.
n | index of the grid (assumed to be less than gridCount()) |
Definition at line 190 of file GridHandle.h.
|
inline |
Return true if this handle is empty, i.e. has no allocated memory.
Definition at line 122 of file GridHandle.h.
|
inline |
Check if the buffer is this handle has any padding, i.e. if the buffer is larger than the combined size of all its grids.
Definition at line 177 of file GridHandle.h.
|
inline |
Return true if this handle contains any grids.
Definition at line 126 of file GridHandle.h.
|
delete |
Disallow copy assignment operation.
|
inlinenoexcept |
Move copy assignment operation.
Definition at line 82 of file GridHandle.h.
void nanovdb::GridHandle< BufferT >::read | ( | std::istream & | is, |
const BufferT & | pool = BufferT() |
||
) |
Read an entire raw grid buffer from an input stream.
is | input stream containing a raw grid buffer |
pool | optional pool from which to allocate the new grid buffer |
Will | throw a std::logic_error if the stream does not contain a valid raw grid |
Definition at line 363 of file GridHandle.h.
void nanovdb::GridHandle< BufferT >::read | ( | std::istream & | is, |
uint32_t | n, | ||
const BufferT & | pool = BufferT() |
||
) |
Read a specific grid from an input stream containing a raw grid buffer.
is | input stream containing a raw grid buffer |
n | zero-based index of the grid to be read |
pool | optional pool from which to allocate the new grid buffer |
Will | throw a std::logic_error if the stream does not contain a valid raw grid |
Definition at line 385 of file GridHandle.h.
void nanovdb::GridHandle< BufferT >::read | ( | std::istream & | is, |
const std::string & | gridName, | ||
const BufferT & | pool = BufferT() |
||
) |
Read a specific grid from an input stream containing a raw grid buffer.
is | input stream containing a raw grid buffer |
gridName | string name of the grid to be read |
pool | optional pool from which to allocate the new grid buffer |
Will | throw a std::logic_error if the stream does not contain a valid raw grid with the speficied name |
Definition at line 407 of file GridHandle.h.
|
inline |
Read a raw grid buffer from a file.
filename | string name of the input file containing a raw grid buffer |
pool | optional pool from which to allocate the new grid buffe |
Definition at line 259 of file GridHandle.h.
|
inline |
Read a specific grid from a file containing a raw grid buffer.
filename | string name of the input file containing a raw grid buffer |
n | zero-based index of the grid to be read |
pool | optional pool from which to allocate the new grid buffer |
Will | throw a std::ios_base::failure if the file does not exist and a std::logic_error if the files does not contain a valid raw grid |
Definition at line 271 of file GridHandle.h.
|
inline |
Read a specific grid from a file containing a raw grid buffer.
filename | string name of the input file containing a raw grid buffer |
gridName | string name of the grid to be read |
pool | optional pool from which to allocate the new grid buffer |
Will | throw a std::ios_base::failure if the file does not exist and a std::logic_error if the files does not contain a valid raw grid withe the specified name |
Definition at line 283 of file GridHandle.h.
|
inline |
clear this GridHandle to an empty handle
Definition at line 73 of file GridHandle.h.
|
inline |
Returns the size in bytes of the raw memory buffer managed by this GridHandle.
Definition at line 117 of file GridHandle.h.
|
inline |
Write a specific grid in this buffer to an output stream.
os | output stream that the buffer will be written to |
n | zero-based index of the grid to be written to stream |
Definition at line 205 of file GridHandle.h.
|
inline |
Write the entire grid buffer to an output stream.
os | output stream that the buffer will be written to |
Definition at line 215 of file GridHandle.h.
|
inline |
Write this entire grid buffer to a file.
fileName | string name of the output file |
Definition at line 221 of file GridHandle.h.
|
inline |
Write a specific grid to file.
fileName | string name of the output file |
n | zero-based index of the grid to be written to file |
Definition at line 230 of file GridHandle.h.