Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .jules/architect.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@
**Problem:** `math_explorer/src/biology/morphogenesis.rs` implemented a custom solver loop inside `TuringSystem::step`, preventing the use of generic ODE solvers (like Runge-Kutta 4) and duplicating integration logic. The state `TuringState` lacked standard arithmetic operators, making it incompatible with the library's `OdeSystem` ecosystem.
**Decision:** Applied "Traitification". Implemented `VectorOperations`, `OdeSystem`, and `TimeStepper` for `TuringSystem`. Preserved the highly optimized sliding-window stencil logic in `derivative_in_place` and the manual Euler step in `step`.
**Consequence:** `TuringSystem` is now a first-class citizen in the generic analysis module. It can be simulated with any `Solver` while maintaining zero-cost abstraction for the default use case.

## 2026-06-25 - [Reaction-Diffusion Stencil Abstraction]
**Problem:** `math_explorer/src/biology/morphogenesis.rs` contained duplicated logic for the finite-difference Laplacian stencil and sliding-window optimization in both `step` (Euler integration) and `derivative_in_place` (ODE derivative). This violated DRY and increased maintenance burden.
**Decision:** Refactored `morphogenesis` into a submodule. Extracted `Kinetics` and `State`. Implemented a generic `apply_reaction_diffusion_stencil` method using the "Closure Strategy". This method encapsulates the stencil math and optimization, accepting a closure to handle the result (either updating state or writing derivative).
**Consequence:** Code duplication eliminated. Logic for the optimized 1D stencil exists in exactly one place. The "Zero-Cost Abstraction" ensures no runtime penalty for the closure usage (monomorphization).
Loading