Struct FixedStepsize
pub struct FixedStepsize<F> { /* private fields */ }
Expand description
Time stepping with a fixed time length
This time-stepper increments the time variable by the same length.
let t0 = 1.0;
let dt = 0.2;
let partial_save_points = vec![3.0, 5.0, 11.0, 20.0];
let time_stepper = FixedStepsize::from_partial_save_points(t0, dt, partial_save_points).unwrap();
Implementations§
§impl<F> FixedStepsize<F>
impl<F> FixedStepsize<F>
pub fn from_partial_save_steps(
t0: F,
dt: F,
n_steps: u64,
save_interval: u64,
) -> Result<FixedStepsize<F>, TimeError>
Available on crate feature cpu_os_threads
only.
pub fn from_partial_save_steps( t0: F, dt: F, n_steps: u64, save_interval: u64, ) -> Result<FixedStepsize<F>, TimeError>
cpu_os_threads
only.Construct the stepper from initial time, increment, number of steps and save interval
pub fn from_partial_save_interval(
t0: F,
dt: F,
t_max: F,
save_interval: F,
) -> Result<FixedStepsize<F>, TimeError>
Available on crate feature cpu_os_threads
only.
pub fn from_partial_save_interval( t0: F, dt: F, t_max: F, save_interval: F, ) -> Result<FixedStepsize<F>, TimeError>
cpu_os_threads
only.Similar to Self::from_partial_save_points but specify the time step between every save point together with the integration step.
pub fn from_partial_save_freq(
t0: F,
dt: F,
t_max: F,
save_freq: usize,
) -> Result<FixedStepsize<F>, TimeError>
Available on crate feature cpu_os_threads
only.
pub fn from_partial_save_freq( t0: F, dt: F, t_max: F, save_freq: usize, ) -> Result<FixedStepsize<F>, TimeError>
cpu_os_threads
only.Similar to Self::from_partial_save_interval but specify a multiple of the time increment instead of a floating point value. This method is preferred over the one previously mentioned.
pub fn from_partial_save_points(
t0: F,
dt: F,
partial_save_points: Vec<F>,
) -> Result<FixedStepsize<F>, TimeError>
Available on crate feature cpu_os_threads
only.
pub fn from_partial_save_points( t0: F, dt: F, partial_save_points: Vec<F>, ) -> Result<FixedStepsize<F>, TimeError>
cpu_os_threads
only.Simple function to construct the stepper from an initial time point, the time increment and the time points at which the simulation should be saved. Notice that these saves do not cover FullSaves but only PartialSaves.
Trait Implementations§
§impl<F> Clone for FixedStepsize<F>where
F: Clone,
impl<F> Clone for FixedStepsize<F>where
F: Clone,
§fn clone(&self) -> FixedStepsize<F>
fn clone(&self) -> FixedStepsize<F>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl<'de, F> Deserialize<'de> for FixedStepsize<F>where
F: Deserialize<'de>,
impl<'de, F> Deserialize<'de> for FixedStepsize<F>where
F: Deserialize<'de>,
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<FixedStepsize<F>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<FixedStepsize<F>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl<F> Serialize for FixedStepsize<F>where
F: Serialize,
impl<F> Serialize for FixedStepsize<F>where
F: Serialize,
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
§impl<F> TimeStepper<F> for FixedStepsize<F>where
F: Float + FromPrimitive,
impl<F> TimeStepper<F> for FixedStepsize<F>where
F: Float + FromPrimitive,
§fn advance(&mut self) -> Result<Option<NextTimePoint<F>>, TimeError>
fn advance(&mut self) -> Result<Option<NextTimePoint<F>>, TimeError>
Advances the time stepper to the next time point. Also returns if there is an event
scheduled to take place and the next time value and iteration number
§fn get_last_full_save(&self) -> Option<(F, usize)>
fn get_last_full_save(&self) -> Option<(F, usize)>
Retrieved the last point at which the simulation was fully recovered.
This might be helpful in the future when error handling is more mature and able to recover.
§fn initialize_bar(&self) -> Result<Bar, TimeError>
fn initialize_bar(&self) -> Result<Bar, TimeError>
Creates a bar that tracks the simulation progress
§fn update_bar(&self, bar: &mut Bar) -> Result<(), Error>
fn update_bar(&self, bar: &mut Bar) -> Result<(), Error>
Update a given bar to show the current simulation state
Auto Trait Implementations§
impl<F> Freeze for FixedStepsize<F>where
F: Freeze,
impl<F> RefUnwindSafe for FixedStepsize<F>where
F: RefUnwindSafe,
impl<F> Send for FixedStepsize<F>where
F: Send,
impl<F> Sync for FixedStepsize<F>where
F: Sync,
impl<F> Unpin for FixedStepsize<F>where
F: Unpin,
impl<F> UnwindSafe for FixedStepsize<F>where
F: UnwindSafe,
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.