OpenVDB  9.1.1
Public Member Functions | List of all members
GridHandle< BufferT > Class Template Reference

This class serves to manage a raw memory buffer of a NanoVDB Grid. More...

#include <nanovdb/util/GridHandle.h>

Inherits GridHandleBase.

Public Member Functions

 GridHandle (BufferT &&buffer)
 Move constructor from a buffer. More...
 
 GridHandle ()=default
 Empty ctor. More...
 
 GridHandle (const GridHandle &)=delete
 Disallow copy-construction. More...
 
GridHandleoperator= (const GridHandle &)=delete
 Disallow copy assignment operation. More...
 
GridHandleoperator= (GridHandle &&other) noexcept
 Move copy assignment operation. More...
 
 GridHandle (GridHandle &&other) noexcept
 Move copy-constructor. More...
 
 ~GridHandle () override
 Default destructor. More...
 
void reset ()
 clear the buffer 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 () override
 Returns a non-const pointer to the data. More...
 
const uint8_t * data () const override
 Returns a const pointer to the data. More...
 
uint64_t size () const override
 Returns the size in bytes of the raw memory buffer managed by this GridHandle's allocator. More...
 
template<typename ValueT >
const NanoGrid< ValueT > * grid (uint32_t n=0) const
 Returns a const pointer to the n'th NanoVDB grid encoded in this GridHandle. More...
 
template<typename ValueT >
NanoGrid< ValueT > * grid (uint32_t n=0)
 Returns a pointer to the n'th NanoVDB grid encoded in this GridHandle. More...
 
template<typename ValueT , typename U = BufferT>
std::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>
std::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>
std::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>
std::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 empty () const
 Return true if this handle is empty, i.e. has no allocated memory. More...
 
 operator bool () const
 Return true if this handle contains a grid. More...
 
const GridMetaDatagridMetaData () const
 Returns a const point to the grid meta data (see definition above). More...
 
GridType gridType () const
 Returns the GridType handled by this instance, and GridType::End if empty. More...
 
uint32_t gridCount () const
 Return the number of grids contained in this buffer. More...
 

Detailed Description

template<typename BufferT = HostBuffer>
class nanovdb::GridHandle< BufferT >

This class serves to manage a raw memory buffer of a NanoVDB Grid.

Note
It is important to note that this class does NOT depend on OpenVDB.

Constructor & Destructor Documentation

GridHandle ( BufferT &&  buffer)
inline

Move constructor from a buffer.

GridHandle ( )
default

Empty ctor.

GridHandle ( const GridHandle< BufferT > &  )
delete

Disallow copy-construction.

GridHandle ( GridHandle< BufferT > &&  other)
inlinenoexcept

Move copy-constructor.

~GridHandle ( )
inlineoverride

Default destructor.

Member Function Documentation

BufferT& buffer ( )
inline

Return a reference to the buffer.

const BufferT& buffer ( ) const
inline

Return a const reference to the buffer.

uint8_t* data ( )
inlineoverridevirtual

Returns a non-const pointer to the data.

Warning
Note that the return pointer can be NULL if the GridHandle was not initialized

Implements GridHandleBase.

const uint8_t* data ( ) const
inlineoverridevirtual

Returns a const pointer to the data.

Warning
Note that the return pointer can be NULL if the GridHandle was not initialized

Implements GridHandleBase.

std::enable_if<BufferTraits<U>::hasDeviceDual, void>::type deviceDownload ( void *  stream = nullptr,
bool  sync = true 
)
inline

Download the grid to from the device, e.g. from GPU to CPU.

Note
This method is only available if the buffer supports devices
std::enable_if<BufferTraits<U>::hasDeviceDual, const NanoGrid<ValueT>*>::type deviceGrid ( uint32_t  n = 0) const
inline

Return a const pointer to the n'th grid encoded in this GridHandle on the device, e.g. GPU.

Warning
Note that the return pointer can be NULL if the GridHandle was not initialized, n is invalid or if the template parameter does not match the specified grid!
std::enable_if<BufferTraits<U>::hasDeviceDual, NanoGrid<ValueT>*>::type deviceGrid ( uint32_t  n = 0)
inline

Return a const pointer to the n'th grid encoded in this GridHandle on the device, e.g. GPU.

Warning
Note that the return pointer can be NULL if the GridHandle was not initialized, n is invalid or if the template parameter does not match the specified grid!
std::enable_if<BufferTraits<U>::hasDeviceDual, void>::type deviceUpload ( void *  stream = nullptr,
bool  sync = true 
)
inline

Upload the grid to the device, e.g. from CPU to GPU.

Note
This method is only available if the buffer supports devices
bool empty ( ) const
inlineinherited

Return true if this handle is empty, i.e. has no allocated memory.

const NanoGrid<ValueT>* grid ( uint32_t  n = 0) const
inline

Returns a const pointer to the n'th NanoVDB grid encoded in this GridHandle.

Warning
Note that the return pointer can be NULL if the GridHandle was not initialized, n is invalid or if the template parameter does not match the specified grid!
NanoGrid<ValueT>* grid ( uint32_t  n = 0)
inline

Returns a pointer to the n'th NanoVDB grid encoded in this GridHandle.

Warning
Note that the return pointer can be NULL if the GridHandle was not initialized, n is invalid or if the template parameter does not match the specified grid!
uint32_t gridCount ( ) const
inlineinherited

Return the number of grids contained in this buffer.

const GridMetaData* gridMetaData ( ) const
inlineinherited

Returns a const point to the grid meta data (see definition above).

Warning
Note that the return pointer can be NULL if the GridHandle was not initialized
GridType gridType ( ) const
inlineinherited

Returns the GridType handled by this instance, and GridType::End if empty.

operator bool ( ) const
inlineinherited

Return true if this handle contains a grid.

GridHandle& operator= ( const GridHandle< BufferT > &  )
delete

Disallow copy assignment operation.

GridHandle& operator= ( GridHandle< BufferT > &&  other)
inlinenoexcept

Move copy assignment operation.

void reset ( )
inline

clear the buffer

uint64_t size ( ) const
inlineoverridevirtual

Returns the size in bytes of the raw memory buffer managed by this GridHandle's allocator.

Implements GridHandleBase.