Skip to content

AdaptiveStepper

Defined in: mod.rs:109

pub struct AdaptiveStepper\<'a, S: [DynamicalSystem](../../traits/dynamicalsystem/)\> {
pub dt_min: f64,
// ...
}

Stateful adaptive stepper that encapsulates FSAL k1/dt management.

Created via DormandPrince::stepper. Callers repeatedly call advance_to(AdaptiveStepper::advance_to) to advance to successive target times (e.g. output interval boundaries), without needing to manage k1 reuse or step-size adaptation themselves.

dt_min: f64

Minimum step size below which integration fails. Can be overridden after construction to match the total integration interval.


fn from_checked_state(self) -> Self

Skip the event check on the state this stepper starts from.

For a segment that continues where the previous one ended: the caller has asked its predicate about that state already. Checks after accepted steps are unaffected.


fn advance_to<F, E, B>(&mut self, t_target: f64, callback: F, event_check: E) -> [Result<AdvanceOutcome<B>, IntegrationError>](https://doc.rust-lang.org/std/result/enum.Result.html) where F: FnMut(f64, &::State), E: [Fn(f64, &::State) -> ControlFlow<B>](https://doc.rust-lang.org/std/ops/function/trait.Fn.html)

Advance adaptively to t_target.

  • For a target that advances, event_check runs first on the state the stepper currently holds, before any step. A level-triggered event can already hold there, and reporting it after a step would name a state the predicate itself rejects. Terminating there leaves the stepper where it was and calls no callback, since the callback reports accepted steps and none was taken. A later advance_to therefore re-evaluates the state it stopped at: for a predicate that only reads the state that is the same answer, but one carrying its own counters sees the endpoint twice. A target the stepper has already reached takes no step, so it asks nothing and reports Reached.
  • Each accepted step calls callback(t, &state).
  • If event_check returns Break(reason), returns Event { reason }.
  • On success returns Reached with internal state updated to t_target.

fn state(&self) -> &::State

Current state.


fn t(&self) -> f64

Current time.


fn dt(&self) -> f64

Current adaptive step size.


fn into_state(self) -> ::State

Consume the stepper and return the final state.