StaticGraph

Struct StaticGraph 

Source
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: usize

Width of the grid in nodes (not blocks).

§height: usize

Height of the grid in nodes (not blocks).

§depth: usize

Depth of the grid for 3D codes (1 for 2D codes).

§stride_x: usize

Stride to move one position in X direction (always 1).

§stride_y: usize

Stride to move one position in Y direction (typically equals width).

§stride_z: usize

Stride to move one position in Z direction (typically equals width * height).

§blk_stride_y: usize

Number of blocks per row of blocks.

§shift_y: u32

Log2 of stride_y for fast division via bit shift.

§shift_z: u32

Log2 of stride_z for fast division via bit shift.

§row_end_mask: u64

Bitmask identifying nodes at the right edge of their 8-wide block row.

§row_start_mask: u64

Bitmask identifying nodes at the left edge of their 8-wide block row.

Trait Implementations§

Source§

impl Clone for StaticGraph

Source§

fn clone(&self) -> StaticGraph

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StaticGraph

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for StaticGraph

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.