OpenVDB 13.1.0
Loading...
Searching...
No Matches
GridHandle.h File Reference

Defines GridHandle, which manages a memory buffer containing one or more NanoVDB grids: host-resident, dual host/device, or a single-space device-only buffer. More...

#include <fstream>
#include <iostream>
#include <cstring>
#include <stdexcept>
#include <string>
#include <vector>
#include <initializer_list>
#include <nanovdb/NanoVDB.h>
#include <nanovdb/HostBuffer.h>
#include <nanovdb/tools/GridChecksum.h>

Go to the source code of this file.

Classes

class  GridHandle< BufferT >
 This class serves to manage a buffer containing one or more NanoVDB Grids. More...

Namespaces

namespace  nanovdb
 Defines a simple memory pool used to call cub functions that use dynamic temporary storage.
namespace  nanovdb::cuda
namespace  nanovdb::cuda::detail
namespace  nanovdb::detail

Functions

template<typename BufferT>
BufferT createHostStorage (uint64_t bytes, const BufferT &pool)
 Allocates bytes of host-readable storage for a GridHandle: through BufferT::create for buffers that provide it, and through pool's resource for a host-accessible single-space buffer (e.g. a pinned-resource cuda::Buffer). The braced third argument selects the uninitialized-storage constructor without naming its tag type, so this header stays CUDA-free.
void parseHostGridChain (const GridData *head, uint64_t bytes, std::vector< GridHandleMetaData > &meta)
 Validates the grid chain in bytes of host-readable memory headed by head and fills meta with one entry per grid: every header must be valid, carry its expected index and the chain's total count, and fit inside the buffer, so a truncated buffer or a forged header is rejected before its metadata is trusted. This is the host counterpart of the device-side chain parse, and it is what makes a handle's metadata safe to adopt without re-validation (cuda::copyTo).
template<typename BufferT, template< class, class... > class VectorT = std::vector>
VectorT< GridHandle< BufferT > > splitGrids (const GridHandle< BufferT > &handle, const BufferT *other=nullptr)
 Split all grids in a single GridHandle into a vector of multiple GridHandles each with a single grid.
template<typename BufferT, template< class, class... > class VectorT>
GridHandle< BufferT > mergeGrids (const VectorT< GridHandle< BufferT > > &handles, const BufferT *pool=nullptr)
 Combines (or merges) multiple GridHandles into a single GridHandle containing all grids.

Detailed Description

Defines GridHandle, which manages a memory buffer containing one or more NanoVDB grids: host-resident, dual host/device, or a single-space device-only buffer.

Author
Ken Museth
Date
January 8, 2020