コンテンツにスキップ

Integrator

このコンテンツはまだ日本語訳がありません。

Defined in: integrator.rs:11

pub trait Integrator

Common interface for fixed-step numerical integrators.

Implementors provide step(Integrator::step), which advances the state by a single time step. Default implementations of integrate(Integrator::integrate) and integrate_with_events(Integrator::integrate_with_events) build on step to provide multi-step integration with optional event detection.

fn step<S: DynamicalSystem>(&self, system: &S, t: f64, state: &::State, dt: f64) -> ::State

Perform a single integration step, advancing the state from t by dt.


fn integrate<S, F>(&self, system: &S, initial: ::State, t0: f64, t_end: f64, dt: f64, callback: F) -> ::State where S: DynamicalSystem, F: FnMut(f64, &::State)

Integrate a dynamical system from t0 to t_end using fixed step size dt.

Calls callback(t, &state) after each step, allowing the caller to record intermediate states (e.g., for energy monitoring or trajectory output).

Returns the final state at t_end.


fn integrate_with_events<S, F, E, B>(&self, system: &S, initial: ::State, t0: f64, t_end: f64, dt: f64, callback: F, event_check: E) -> IntegrationOutcome<::State, B> where S: DynamicalSystem, F: FnMut(f64, &::State), E: [Fn(f64, &::State) -> ControlFlow<B>](https://doc.rust-lang.org/std/ops/function/trait.Fn.html)

Integrate a dynamical system with event detection and NaN/Inf checking.

After each step:

  1. Checks for NaN/Inf in state → returns IntegrationOutcome::Error
  2. Calls callback(t, &state)
  3. Calls event_check(t, &state) → if Break(reason), returns Terminated