|
OpenVDB 11.0.0
|
This class serves to manage a buffer containing one or more NanoVDB Grids. More...
#include <nanovdb/util/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. | |
| template<typename T = BufferT, typename disable_if< BufferTraits< T >::hasDeviceDual, int >::type = 0> | |
| GridHandle (T &&buffer) | |
| Move constructor from a dual host-device buffer. | |
| GridHandle ()=default | |
| Constructs an empty GridHandle. | |
| GridHandle (const GridHandle &)=delete | |
| Disallow copy-construction. | |
| GridHandle (GridHandle &&other) noexcept | |
| Move copy-constructor. | |
| void | reset () |
| clear this GridHandle to an empty handle | |
| GridHandle & | operator= (const GridHandle &)=delete |
| Disallow copy assignment operation. | |
| GridHandle & | operator= (GridHandle &&other) noexcept |
| Move copy assignment operation. | |
| 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. | |
| BufferT & | buffer () |
| Return a reference to the buffer. | |
| const BufferT & | buffer () const |
| Return a const reference to the buffer. | |
| uint8_t * | data () |
| Returns a non-const pointer to the data. | |
| const uint8_t * | data () const |
| Returns a const pointer to the data. | |
| template<typename U = BufferT> | |
| enable_if< BufferTraits< U >::hasDeviceDual, constuint8_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. | |
| bool | empty () const |
| Return true if this handle is empty, i.e. has no allocated memory. | |
| bool | isEmpty () const |
| operator bool () const | |
| Return true if this handle contains any grids. | |
| 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. | |
| template<typename ValueT > | |
| NanoGrid< ValueT > * | grid (uint32_t n=0) |
| Returns a host pointer to the n'th NanoVDB grid encoded in this GridHandle. | |
| template<typename ValueT , typename U = BufferT> | |
| enable_if< BufferTraits< U >::hasDeviceDual, constNanoGrid< 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| uint32_t | gridCount () const |
| Return the total number of grids contained in this buffer. | |
| uint64_t | gridSize (uint32_t n=0) const |
| Return the grid size of the n'th grid in this GridHandle. | |
| GridType | gridType (uint32_t n=0) const |
| Return the GridType of the n'th grid in this GridHandle. | |
| const GridData * | gridData (uint32_t n=0) const |
| Access to the GridData of the n'th grid in the current handle. | |
| const GridMetaData * | gridMetaData (uint32_t n=0) const |
| Returns a const point to the n'th grid meta data. | |
| void | write (std::ostream &os, uint32_t n) const |
| Write a specific grid in this buffer to an output stream. | |
| void | write (std::ostream &os) const |
| Write the entire grid buffer to an output stream. | |
| void | write (const std::string &fileName) const |
| Write this entire grid buffer to a file. | |
| void | write (const std::string &fileName, uint32_t n) const |
| Write a specific grid to file. | |
| void | read (std::istream &is, const BufferT &pool=BufferT()) |
| Read an entire raw grid buffer from an input stream. | |
| 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. | |
| 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. | |
| void | read (const std::string &fileName, const BufferT &pool=BufferT()) |
| Read a raw grid buffer from a file. | |
| 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. | |
| 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. | |
This class serves to manage a buffer containing one or more NanoVDB Grids.
| using BufferType = 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! |
| 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.
|
inline |
Return a reference to the buffer.
|
inline |
Return a const reference to the buffer.
|
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 |
|
inline |
Returns a non-const pointer to the data.
|
inline |
Returns a const pointer to the data.
|
inline |
|
inline |
|
inline |
Download the grid to from the device, e.g. from GPU to CPU.
|
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 |
|
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 |
|
inline |
Upload the grid to the device, e.g. from CPU to GPU.
|
inline |
Return true if this handle is empty, i.e. has no allocated memory.
|
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 |
|
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 |
|
inline |
Return the total number of grids contained in this buffer.
|
inline |
|
inline |
Returns a const point to the n'th grid meta data.
| n | zero-based ID of the grid |
|
inline |
Return the grid size of the n'th grid in this GridHandle.
| n | index of the grid (assumed to be less than gridCount()) |
|
inline |
Return the GridType of the n'th grid in this GridHandle.
| n | index of the grid (assumed to be less than gridCount()) |
|
inline |
|
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.
|
inline |
Return true if this handle contains any grids.
|
delete |
Disallow copy assignment operation.
|
inlinenoexcept |
Move copy assignment operation.
|
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 |
|
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 |
|
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 |
| void 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 |
| 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.
| 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 |
| 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.
| 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 |
|
inline |
clear this GridHandle to an empty handle
|
inline |
Returns the size in bytes of the raw memory buffer managed by this GridHandle.
|
inline |
Write this entire grid buffer to a file.
| fileName | string name of the output file |
|
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 |
|
inline |
Write the entire grid buffer to an output stream.
| os | output stream that the buffer will be written to |
|
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 |