pub struct ODEiv2Evolve { /* private fields */ }

Implementations§

source§

impl ODEiv2Evolve

source

pub fn new(dim: usize) -> Option<ODEiv2Evolve>

This function returns a pointer to a newly allocated instance of an evolution function for a system of dim dimensions.

source

pub fn apply( &mut self, c: &mut ODEiv2Control, s: &mut ODEiv2Step, sys: &mut ODEiv2System<'_>, t: &mut f64, t1: f64, h: &mut f64, y: &mut [f64] ) -> Result<(), Value>

This function advances the system (e, sys) from time t and position y using the stepping function step. The new time and position are stored in t and y on output.

The initial step-size is taken as h. The control function con is applied to check whether the local error estimated by the stepping function step using step-size h exceeds the required error tolerance. If the error is too high, the step is retried by calling step with a decreased step-size. This process is continued until an acceptable step-size is found. An estimate of the local error for the step can be obtained from the components of the array e->yerr[].

If the user-supplied functions defined in the system sys returns Value::BadFunc, the function returns immediately with the same return code. In this case the user must call gsl_odeiv2_step_reset and gsl_odeiv2_evolve_reset before calling this function again.

Otherwise, if the user-supplied functions defined in the system sys or the stepping function step return a status other than crate::Value::Success, the step is retried with a decreased step-size. If the step-size decreases below machine precision, a status of ::Failuer is returned if the user functions returned crate::Value::Success. Otherwise the value returned by user function is returned. If no acceptable step can be made, t and y will be restored to their pre-step values and h contains the final attempted step-size.

If the step is successful the function returns a suggested step-size for the next step in h. The maximum time t1 is guaranteed not to be exceeded by the time-step. On the final time-step the value of t will be set to t1 exactly.

source

pub fn apply_fixed_step( &mut self, c: &mut ODEiv2Control, s: &mut ODEiv2Step, sys: &mut ODEiv2System<'_>, t: &mut f64, h: f64, y: &mut [f64] ) -> Result<(), Value>

This function advances the ODE-system (e, sys, con) from time t and position y using the stepping function step by a specified step size h. If the local error estimated by the stepping function exceeds the desired error level, the step is not taken and the function returns Value::Failure. Otherwise the value returned by user function is returned.

source

pub fn reset(&mut self) -> Result<(), Value>

This function resets the evolution function e. It should be used whenever the next use of e will not be a continuation of a previous step.

source

pub fn set_driver(&mut self, d: &ODEiv2Driver<'_>) -> Result<(), Value>

This function sets a pointer of the driver object d for evolve object e.

If a system has discontinuous changes in the derivatives at known points, it is advisable to evolve the system between each discontinuity in sequence. For example, if a step-change in an external driving force occurs at times t_a, t_b and t_c then evolution should be carried out over the ranges (t_0,t_a), (t_a,t_b), (t_b,t_c), and (t_c,t_1) separately and not directly over the range (t_0,t_1).

Trait Implementations§

source§

impl Drop for ODEiv2Evolve

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.