pub struct SolverOptions<S: Scalar> {
pub rtol: S,
pub atol: S,
pub h0: Option<S>,
pub h_max: S,
pub h_min: S,
pub max_steps: usize,
pub t_eval: Option<Vec<S>>,
pub dense_output: bool,
pub events: Vec<Arc<dyn EventFunction<S>>>,
}Expand description
Solver options and tolerances.
Cloneable thanks to Arc-wrapped event functions.
Fields§
§rtol: SRelative tolerance
atol: SAbsolute tolerance (scalar)
h0: Option<S>Initial step size (None = auto)
h_max: SMaximum step size
h_min: SMinimum step size
max_steps: usizeMaximum number of steps
t_eval: Option<Vec<S>>Output grid in the integration direction. When Some, each solver
returns exactly these (t, y) pairs (Hermite cubic interpolated
from accepted step endpoints; endpoints are reproduced bit-exact).
When None, the natural adaptive step grid is returned.
dense_output: boolEnable dense output
events: Vec<Arc<dyn EventFunction<S>>>Event functions for zero-crossing detection (Arc enables Clone)
Implementations§
Source§impl<S: Scalar> SolverOptions<S>
impl<S: Scalar> SolverOptions<S>
Sourcepub fn rtol(self, rtol: S) -> Self
pub fn rtol(self, rtol: S) -> Self
Set relative tolerance.
Examples found in repository?
examples/radau5_step_audit.rs (line 15)
10fn run<F>(name: &str, rhs: F, t0: f64, tf: f64, y0: Vec<f64>, rtol: f64, atol: f64)
11where
12 F: Fn(f64, &[f64], &mut [f64]) + Copy,
13{
14 let problem = OdeProblem::new(rhs, t0, tf, y0.clone());
15 let opts = SolverOptions::default().rtol(rtol).atol(atol);
16 let res = Radau5::solve(&problem, t0, tf, &y0, &opts).expect("solve failed");
17 println!(
18 "{:<32} acc={:>4} rej={:>3} rhs={:>5} jac={:>3} lu={:>4}",
19 name,
20 res.stats.n_accept,
21 res.stats.n_reject,
22 res.stats.n_eval,
23 res.stats.n_jac,
24 res.stats.n_lu,
25 );
26}Sourcepub fn atol(self, atol: S) -> Self
pub fn atol(self, atol: S) -> Self
Set absolute tolerance.
Examples found in repository?
examples/radau5_step_audit.rs (line 15)
10fn run<F>(name: &str, rhs: F, t0: f64, tf: f64, y0: Vec<f64>, rtol: f64, atol: f64)
11where
12 F: Fn(f64, &[f64], &mut [f64]) + Copy,
13{
14 let problem = OdeProblem::new(rhs, t0, tf, y0.clone());
15 let opts = SolverOptions::default().rtol(rtol).atol(atol);
16 let res = Radau5::solve(&problem, t0, tf, &y0, &opts).expect("solve failed");
17 println!(
18 "{:<32} acc={:>4} rej={:>3} rhs={:>5} jac={:>3} lu={:>4}",
19 name,
20 res.stats.n_accept,
21 res.stats.n_reject,
22 res.stats.n_eval,
23 res.stats.n_jac,
24 res.stats.n_lu,
25 );
26}Sourcepub fn event(self, event: Box<dyn EventFunction<S>>) -> Self
pub fn event(self, event: Box<dyn EventFunction<S>>) -> Self
Add an event function for zero-crossing detection.
Internally converts to Arc to enable Clone on SolverOptions.
Trait Implementations§
Source§impl<S: Scalar> Clone for SolverOptions<S>
impl<S: Scalar> Clone for SolverOptions<S>
Source§impl<S: Scalar> Debug for SolverOptions<S>
impl<S: Scalar> Debug for SolverOptions<S>
Auto Trait Implementations§
impl<S> Freeze for SolverOptions<S>where
S: Freeze,
impl<S> !RefUnwindSafe for SolverOptions<S>
impl<S> Send for SolverOptions<S>
impl<S> Sync for SolverOptions<S>
impl<S> Unpin for SolverOptions<S>where
S: Unpin,
impl<S> UnsafeUnpin for SolverOptions<S>where
S: UnsafeUnpin,
impl<S> !UnwindSafe for SolverOptions<S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more