Skip to content

Conversation

@fderuiter
Copy link
Owner

Refactored math_explorer/src/biology/morphogenesis.rs to eliminate DRY violation in TuringSystem.
Extracted the finite-difference stencil and reaction logic into apply_stencil_impl.
Verified with tests.
Updated engineering decision records.


PR created automatically by Jules for task 16301892021858618432 started by @fderuiter

- Extracted duplicated reaction-diffusion stencil logic from `step` and `derivative_in_place` into a private static method `apply_stencil_impl`.
- Applied the Stencil Pattern (Strategy/Template Method variation) to ensure consistent physics across optimized Euler steps and generic ODE solvers.
- Reduced code duplication by ~100 lines while preserving zero-cost abstractions and sliding window optimizations.
- Updated `Systems Core` EDR log.

Co-authored-by: fderuiter <127706008+fderuiter@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@fderuiter
Copy link
Owner Author

Run cargo fmt -- --check
Diff in /home/runner/work/math/math/math_explorer/src/biology/morphogenesis.rs:256:
&self.state,
&mut self.next_state.u,
&mut self.next_state.v,

  •        |u_curr, v_curr, du_dt, dv_dt| {
    
  •            (
    
  •                u_curr + dt * du_dt,
    
  •                v_curr + dt * dv_dt,
    
  •            )
    
  •        },
    
  •        |u_curr, v_curr, du_dt, dv_dt| (u_curr + dt * du_dt, v_curr + dt * dv_dt),
       );
    
       // Swap buffers (states)
    

Diff in /home/runner/work/math/math/math_explorer/src/biology/morphogenesis.rs:281:
input_state: &TuringState,
out_u: &mut [f64],
out_v: &mut [f64],

  •    mut op: F
    
  • )
  • where
  •    mut op: F,
    
  • ) where
    F: FnMut(f64, f64, f64, f64) -> (f64, f64),
    {
    let n = input_state.len();
    Error: Process completed with exit code 1.

@google-labs-jules
Copy link
Contributor

Run cargo fmt -- --check
Diff in /home/runner/work/math/math/math_explorer/src/biology/morphogenesis.rs:256:
&self.state,
&mut self.next_state.u,
&mut self.next_state.v,

  •        |u_curr, v_curr, du_dt, dv_dt| {
    
  •            (
    
  •                u_curr + dt * du_dt,
    
  •                v_curr + dt * dv_dt,
    
  •            )
    
  •        },
    
  •        |u_curr, v_curr, du_dt, dv_dt| (u_curr + dt * du_dt, v_curr + dt * dv_dt),
       );
    
       // Swap buffers (states)
    

Diff in /home/runner/work/math/math/math_explorer/src/biology/morphogenesis.rs:281:
input_state: &TuringState,
out_u: &mut [f64],
out_v: &mut [f64],

  •    mut op: F
    
  • )
  • where
  •    mut op: F,
    
  • ) where
    F: FnMut(f64, f64, f64, f64) -> (f64, f64),
    {
    let n = input_state.len();
    Error: Process completed with exit code 1.

Fixed formatting as requested by running cargo fmt.

Ran `cargo fmt` to address PR review feedback regarding code style in `TuringSystem::step` and `apply_stencil_impl`.

Co-authored-by: fderuiter <127706008+fderuiter@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants