Loading...
Searching...
No Matches
GridHandle< BufferT > Class Template Reference

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

`#include <nanovdb/util/GridHandle.h>`

Inheritance diagram for GridHandle< BufferT >:

## Public Types

using | BufferType = BufferT

## Public Member Functions

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

## 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.

## Member Typedef Documentation

## BufferType

template<typename BufferT = HostBuffer>

using BufferType = BufferT

## Constructor & Destructor Documentation

## GridHandle() [1/4]

template<typename BufferT = HostBuffer>

GridHandle | ( | BufferT && | buffer | ) |

inline

Move constructor from a buffer.

## GridHandle() [2/4]

template<typename BufferT = HostBuffer>

GridHandle | ( |  | ) |

default

Empty ctor.

## GridHandle() [3/4]

template<typename BufferT = HostBuffer>

GridHandle | ( | const GridHandle< BufferT > & |  | ) |

delete

Disallow copy-construction.

## GridHandle() [4/4]

template<typename BufferT = HostBuffer>

GridHandle | ( | GridHandle< BufferT > && | other | ) |

inline noexcept

Move copy-constructor.

## ~GridHandle()

template<typename BufferT = HostBuffer>

~GridHandle | ( |  | ) |

inline override

Default destructor.

## Member Function Documentation

## buffer() [1/2]

template<typename BufferT = HostBuffer>

BufferT & buffer | ( |  | ) |

inline

Return a reference to the buffer.

## buffer() [2/2]

template<typename BufferT = HostBuffer>

const BufferT & buffer | ( |  | ) | const

inline

Return a const reference to the buffer.

## data() [1/2]

template<typename BufferT = HostBuffer>

const uint8_t * data | ( |  | ) | const

inline override virtual

Returns a const pointer to the data.

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

Implements GridHandleBase.

## data() [2/2]

template<typename BufferT = HostBuffer>

uint8_t * data | ( |  | ) |

inline override virtual

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.

## deviceDownload()

template<typename BufferT = HostBuffer>
template<typename U = BufferT>

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

## deviceGrid() [1/2]

template<typename BufferT = HostBuffer>
template<typename ValueT, typename U = BufferT>

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!

## deviceGrid() [2/2]

template<typename BufferT = HostBuffer>
template<typename ValueT, typename U = BufferT>

std::enable_if< BufferTraits< U >::hasDeviceDual, constNanoGrid< 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!

## deviceUpload()

template<typename BufferT = HostBuffer>
template<typename U = BufferT>

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

## empty()

bool empty | ( |  | ) | const

inline inherited

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

## grid() [1/2]

template<typename BufferT = HostBuffer>
template<typename ValueT>

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!

## grid() [2/2]

template<typename BufferT = HostBuffer>
template<typename ValueT>

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!

## gridCount()

uint32_t gridCount | ( |  | ) | const

inline inherited

Return the number of grids contained in this buffer.

## gridMetaData()

const GridMetaData * gridMetaData | ( |  | ) | const

inline inherited

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 gridType | ( |  | ) | const

inline inherited

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

## operator bool()

operator bool | ( |  | ) | const

inline inherited

Return true if this handle contains a grid.

## operator=() [1/2]

template<typename BufferT = HostBuffer>

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

delete

Disallow copy assignment operation.

## operator=() [2/2]

template<typename BufferT = HostBuffer>

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

inline noexcept

Move copy assignment operation.

## reset()

template<typename BufferT = HostBuffer>

void reset | ( |  | ) |

inline

clear the buffer

## size()

template<typename BufferT = HostBuffer>

uint64_t size | ( |  | ) | const

inline override virtual

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

Implements GridHandleBase.