OpenVDB 13.1.0
Loading...
Searching...
No Matches
VoxelBlockManager< Log2BlockWidth > Struct Template Reference

CPU counterpart of tools::cuda::VoxelBlockManager. Provides host-side decode of the inverse maps (sequential index -> leaf + voxel offset) for a single voxel block. The implementation is single-threaded per block and SIMD-accelerated (via util::shuffleDownMask and util::buildMaskPrefixSums); the caller is responsible for parallelism across blocks (e.g. OpenMP or nanovdb::util::forEach). More...

#include <nanovdb/tools/VoxelBlockManager.h>

Public Types

using Base = VoxelBlockManagerBase<Log2BlockWidth>

Static Public Member Functions

template<class BuildT>
static util::enable_if< BuildTraits< BuildT >::is_index, void >::type decodeInverseMaps (const NanoGrid< BuildT > *grid, const uint32_t firstLeafID, const uint64_t *jumpMap, const uint64_t blockFirstOffset, uint32_t *leafIndex, uint16_t *voxelOffset)
 Decode the inverse maps for a single voxel block on the host.

Static Public Attributes

static constexpr int BlockWidth
static constexpr int JumpMapLength
 number of uint64_t words per block in the jumpMap
static constexpr uint32_t UnusedLeafIndex
 Sentinel written to leafIndex slots with no active voxel in this block.
static constexpr uint16_t UnusedVoxelOffset
 Sentinel written to voxelOffset slots with no active voxel in this block.

Detailed Description

template<int Log2BlockWidth>
struct nanovdb::tools::VoxelBlockManager< Log2BlockWidth >

CPU counterpart of tools::cuda::VoxelBlockManager. Provides host-side decode of the inverse maps (sequential index -> leaf + voxel offset) for a single voxel block. The implementation is single-threaded per block and SIMD-accelerated (via util::shuffleDownMask and util::buildMaskPrefixSums); the caller is responsible for parallelism across blocks (e.g. OpenMP or nanovdb::util::forEach).

Member Typedef Documentation

◆ Base

template<int Log2BlockWidth>
using Base = VoxelBlockManagerBase<Log2BlockWidth>

Member Function Documentation

◆ decodeInverseMaps()

template<int Log2BlockWidth>
template<class BuildT>
util::enable_if< BuildTraits< BuildT >::is_index, void >::type decodeInverseMaps ( const NanoGrid< BuildT > * grid,
const uint32_t firstLeafID,
const uint64_t * jumpMap,
const uint64_t blockFirstOffset,
uint32_t * leafIndex,
uint16_t * voxelOffset )
inlinestatic

Decode the inverse maps for a single voxel block on the host.

Given the VBM metadata for one block (firstLeafID and the block's slice of the jumpMap) and the block's base sequential offset, fills leafIndex[] and voxelOffset[] so that for each position p in [0, BlockWidth):

  • leafIndex[p] = index of the leaf node containing sequential voxel (blockFirstOffset + p), or UnusedLeafIndex if that index is beyond the last active voxel.
  • voxelOffset[p] = local (0..511) offset of that voxel within its leaf, or UnusedVoxelOffset.

The CPU analogue of the CUDA decodeInverseMaps. Single-threaded per block; SIMD is used internally. The caller is responsible for parallelism across blocks.

Template Parameters
BuildTBuild type of the grid (must be an index type)
Parameters
gridHost-accessible OnIndex grid
firstLeafIDIndex of the first leaf overlapping this block
jumpMapPointer to the JumpMapLength words for this block
blockFirstOffsetSequential index of the first voxel in this block
leafIndexOutput array of length BlockWidth
voxelOffsetOutput array of length BlockWidth

Member Data Documentation

◆ BlockWidth

template<int Log2BlockWidth>
int BlockWidth
staticconstexpr

◆ JumpMapLength

template<int Log2BlockWidth>
int JumpMapLength
staticconstexpr

number of uint64_t words per block in the jumpMap

◆ UnusedLeafIndex

template<int Log2BlockWidth>
uint32_t UnusedLeafIndex
staticconstexpr

Sentinel written to leafIndex slots with no active voxel in this block.

◆ UnusedVoxelOffset

template<int Log2BlockWidth>
uint16_t UnusedVoxelOffset
staticconstexpr

Sentinel written to voxelOffset slots with no active voxel in this block.