pub struct StaticGraph {
pub width: usize,
pub height: usize,
pub depth: usize,
pub stride_x: usize,
pub stride_y: usize,
pub stride_z: usize,
pub blk_stride_y: usize,
pub shift_y: u32,
pub shift_z: u32,
pub row_end_mask: u64,
pub row_start_mask: u64,
}Expand description
Static graph structure containing grid topology metadata.
This structure holds precomputed information about the lattice dimensions and memory layout. It enables efficient coordinate calculations during decoding without runtime division or modulo operations.
§Design Philosophy
Traditional graph representations store explicit adjacency lists. This decoder
instead uses SWAR (SIMD Within A Register) bit operations for neighbor traversal,
achieving 19-427x faster performance than lookup tables. The StaticGraph stores
only the minimal metadata needed to support these operations.
§Memory Layout
Nodes are organized in 64-node blocks using Morton (Z-order) encoding. Within each block, nodes are arranged as an 8x8 grid. Blocks themselves are arranged in row-major order.
Grid Layout (4x4 blocks = 32x32 nodes):
+--------+--------+--------+--------+
| Blk 0 | Blk 1 | Blk 2 | Blk 3 | Row 0
+--------+--------+--------+--------+
| Blk 4 | Blk 5 | Blk 6 | Blk 7 | Row 1
+--------+--------+--------+--------+
| Blk 8 | Blk 9 | Blk 10 | Blk 11 | Row 2
+--------+--------+--------+--------+
| Blk 12 | Blk 13 | Blk 14 | Blk 15 | Row 3
+--------+--------+--------+--------+Fields§
§width: usizeWidth of the grid in nodes (not blocks).
height: usizeHeight of the grid in nodes (not blocks).
depth: usizeDepth of the grid for 3D codes (1 for 2D codes).
stride_x: usizeStride to move one position in X direction (always 1).
stride_y: usizeStride to move one position in Y direction (typically equals width).
stride_z: usizeStride to move one position in Z direction (typically equals width * height).
blk_stride_y: usizeNumber of blocks per row of blocks.
shift_y: u32Log2 of stride_y for fast division via bit shift.
shift_z: u32Log2 of stride_z for fast division via bit shift.
row_end_mask: u64Bitmask identifying nodes at the right edge of their 8-wide block row.
row_start_mask: u64Bitmask identifying nodes at the left edge of their 8-wide block row.
Trait Implementations§
Source§impl Clone for StaticGraph
impl Clone for StaticGraph
Source§fn clone(&self) -> StaticGraph
fn clone(&self) -> StaticGraph
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more