Template Class FixedDenseGrid3D
Defined in File FixedDenseGrid3D.h
Class Documentation
-
template<typename T, size_t SIDE_NUM_BITS, typename inner_coord_t>
class FixedDenseGrid3D A dense 3D grid of NxNxN cells with N = 2^SIDE_NUM_BITS.
All cells are allocated contiguously via
calloc(zero-initialized), which is faster thannew[]for large arrays because the OS can provide zero-filled pages without actually writing them. For this reason,Tmust be trivially copyable (enforced bystatic_assert).Cell storage order is X-major:
cells_[cx + cy*N + cz*N*N]. The bit-shift arithmetic incellByIndex()exploits the power-of-two side length to replace multiplications with shifts.This is an internal building block for
mola::SparseVoxelPointCloud, where it serves as the dense inner grid inside each sparse outer block.- Template Parameters:
T – Cell type. Must be trivially copyable.
SIDE_NUM_BITS – log₂ of the number of cells per dimension (e.g. 5 → 32³).
inner_coord_t – Integer type for the index coordinates (e.g.
uint32_t).
Public Functions
-
inline FixedDenseGrid3D()
-
inline ~FixedDenseGrid3D()
-
FixedDenseGrid3D(const FixedDenseGrid3D&) = default
-
FixedDenseGrid3D &operator=(const FixedDenseGrid3D&) = default
-
FixedDenseGrid3D(FixedDenseGrid3D&&) = default
-
FixedDenseGrid3D &operator=(FixedDenseGrid3D&&) = default
-
inline T &cellByIndex(const index3d_t<inner_coord_t> &idx)
-
inline const T &cellByIndex(const index3d_t<inner_coord_t> &idx) const
Public Static Attributes
-
static constexpr size_t CELLS_PER_DIM = 1 << SIDE_NUM_BITS
-
static constexpr size_t TOTAL_CELL_COUNT = 1 << (3 * SIDE_NUM_BITS)