Skip to main content

Integrator

Struct Integrator 

Source
pub struct Integrator<const N: usize> { /* private fields */ }
Expand description

A stateful integrator for an N-component system.

Implementations§

Source§

impl<const N: usize> Integrator<N>

Source

pub fn new( method: Method, t0_s: f64, y0: [f64; N], ) -> Result<Self, SettingsError>

An integrator at (t0, y0).

§Errors

SettingsError for a bad method setting or a non-finite t0 or y0.

Source

pub fn with_step_limit(self, steps: u64) -> Self

Limits the steps, accepted and rejected, over the integrator’s life (DEFAULT_STEP_LIMIT otherwise).

Source

pub fn set_step_limit(&mut self, steps: u64)

Changes the step limit, for example to continue after IntegrationError::StepLimit.

Source

pub fn reset(&mut self, t_s: f64, y: [f64; N]) -> Result<(), SettingsError>

Moves the integrator to a new time and state, as after an impulse or a projection such as renormalizing a quaternion. The step-size estimate carries over.

§Errors

SettingsError::NotFinite for a non-finite time or state; the integrator is unchanged.

Source

pub fn method(&self) -> Method

The method.

Source

pub fn time_s(&self) -> f64

The current time, in seconds.

Source

pub fn state(&self) -> &[f64; N]

The current state.

Source

pub fn stats(&self) -> Stats

Work done so far.

Source

pub fn next_step_s(&self) -> Option<f64>

The step the adaptive method will try next, once it has taken one.

Source

pub fn fired_events(&self) -> &[usize]

The events that fired at the current time, ascending, after Advance::Events; empty otherwise.

Source

pub fn advance<S>( &mut self, system: &mut S, t_stop_s: f64, ) -> Result<Advance, IntegrationError<S::Error>>
where S: OdeSystem<N> + ?Sized,

Integrates toward t_stop_s (which may be infinite), stopping at the first events.

  • The last step is shortened, or stretched by up to 1%, to end exactly at t_stop_s. A stop within the rounding of t counts as reached without a step.
  • Events are checked at the end of every accepted step. The earliest crossing is located on the step’s dense output; the integrator stops there with the dense output’s state, just past the crossing (within EVENT_TIME_RESOLUTION_S), and reports every event that is past its zero at that state.
  • A call that starts on an event it returned doesn’t return it again: the event’s function is already past zero there, and a crossing must start strictly on the near side.
  • OdeSystem::accept_step sees every accepted step and may stop the integration.
  • The derivative is evaluated afresh at the start of each call, so a caller can change the system (a phase) between calls.
§Errors

IntegrationError: a failed derivative, a non-finite solution or event, a step that can’t be made small enough, the step limit, or a stop time in the past. The integrator is left at its last accepted step.

Trait Implementations§

Source§

impl<const N: usize> Clone for Integrator<N>

Source§

fn clone(&self) -> Integrator<N>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const N: usize> Debug for Integrator<N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<const N: usize> Freeze for Integrator<N>

§

impl<const N: usize> RefUnwindSafe for Integrator<N>

§

impl<const N: usize> Send for Integrator<N>

§

impl<const N: usize> Sync for Integrator<N>

§

impl<const N: usize> Unpin for Integrator<N>

§

impl<const N: usize> UnsafeUnpin for Integrator<N>

§

impl<const N: usize> UnwindSafe for Integrator<N>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.