Skip to content

AdaptiveStepper853

Defined in: mod.rs:228

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

Stateful adaptive stepper for DOP853.

Created via Dop853::stepper. Callers repeatedly call advance_to(AdaptiveStepper853::advance_to) to advance to successive target times.

dt_min: f64

Minimum step size below which integration fails.


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 advance_to_roots<F, E, B>(&mut self, t_target: f64, callback: F, event_check: E, roots: &mut RootSet<’_, ::State>) -> [Result<RootOutcome<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 to t_target, stopping at the first boundary a RootEvent(crate::RootEvent) in roots describes.

Each accepted step is examined on its raw candidate y8, before the projection: if an event changed sign over it, bisection re-steps from the step’s own start with the same first-stage derivative until the bracket is narrower than RootSearch::t_tolerance(crate::RootSearch::t_tolerance), and the state at the boundary is what the stepper commits. Neither the trials nor the state a root stopped at reach the callback, which sees ordinary committed steps only: a boundary state is not final until the caller has handled the root, so it reads that one from the stepper.

The trials cannot move the step size: it is grown or shrunk from the error of the step that was accepted, exactly as in advance_to(Self::advance_to).

Reaching a boundary ends the walk whether or not the event is terminal: terminal in the outcome says what the events asked for, and a caller that resumes takes its next step from the boundary. The guards in roots are what keep that step from reporting the departure as a new crossing, so the same set has to be passed back.

event_check is the one advance_to(Self::advance_to) takes, and it is asked in the same places: about the state the walk starts from, and about each ordinary step it commits. A boundary is not one of those places — that state is the caller’s to handle — so a caller whose condition can hold there asks it again once it has.

A value that is already zero at the state the stepper starts from is the “before” of the first step, and that step reports a root as soon as the value leaves zero toward the side the event counts. What stops a resumption from reporting the root it is standing on is RootGuard(crate::RootGuard), which the same roots carries: the step starting at that root’s own time does not report that event again.


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.