Commit b4c6692
committed
feat(hpc/blocked_grid): add blocked_grid_struct! macro for SoA-of-grids (PR-X3 B)
The macro generates an SoA-of-grids struct: each named field becomes its
own BlockedGrid<FieldT, BR, BC> with shared rows/cols/padded dimensions.
Generated API (v1 — L1 only; L2/L3/L4 deferred to follow-up):
- {Name}::new(rows, cols) constructor
- rows/cols/padded_rows/padded_cols accessors
- blocks_l1() lockstep iteration → {Name}L1Block<'_>
- map_l1() PRIMARY compute path → new {Name}, input unchanged
- bulk_apply_l1() SECONDARY write-back, carries verbatim
# Data-flow rule docstring section per .claude/rules/data-flow.md Rule #3
- field_n::<I>() compile-time field accessor (P1 G4 ruling)
- {Name}L1Block / {Name}L1BlockMut / {Name}L1BlockIter view types
Also adds:
- FieldGridRef trait (object-safe dimension accessor for &dyn use)
- Clone impl for BlockedGrid<T: Copy + Default, BR, BC>
- paste = "1" dependency (identifier concat for {Name}L1Block naming)
- pub use paste re-export in lib.rs for $crate::paste::paste! macro hygiene
Reserved field names enforced (compile error if shadowed): `new`, `rows`,
`cols`, `padded_rows`, `padded_cols`, `blocks_l1/2/3/4`, `map_l1/2/3/4`,
`bulk_apply_l1/2/3/4`, `field_n`, `default`.
Inline tests: 2/3/4-field generation, pub/private field visibility,
#[derive(Clone)] passthrough, map_l1 input-unchanged invariant,
bulk_apply_l1 lockstep mutation, field_n::<0>/<1> accessor.
5-gate result: check OK, lib 111/111, doc 79/79, fmt OK, clippy OK.
https://claude.ai/code/session_01UwJuKqP828qyX1VkLgGJFS1 parent 32eaf11 commit b4c6692
5 files changed
Lines changed: 821 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
101 | 106 | | |
102 | 107 | | |
103 | 108 | | |
| |||
0 commit comments