pub struct CheckpointWriter;Expand description
Serialises and deserialises simulation checkpoints as byte buffers.
A checkpoint stores positions, velocities, the current step, and the current simulation time. All values are encoded as little-endian bytes.
Implementations§
Source§impl CheckpointWriter
impl CheckpointWriter
Sourcepub fn save_state(
positions: &[[f64; 3]],
velocities: &[[f64; 3]],
step: u64,
time: f64,
) -> Vec<u8> ⓘ
pub fn save_state( positions: &[[f64; 3]], velocities: &[[f64; 3]], step: u64, time: f64, ) -> Vec<u8> ⓘ
Serialise a simulation state to a byte buffer.
positions–Nparticle positions\[x, y, z\](f64 metres)velocities–Nparticle velocities\[vx, vy, vz\](f64 m/s)step– current step indextime– current simulation time (seconds)
Trait Implementations§
Source§impl Debug for CheckpointWriter
impl Debug for CheckpointWriter
Source§impl Default for CheckpointWriter
impl Default for CheckpointWriter
Source§fn default() -> CheckpointWriter
fn default() -> CheckpointWriter
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CheckpointWriter
impl RefUnwindSafe for CheckpointWriter
impl Send for CheckpointWriter
impl Sync for CheckpointWriter
impl Unpin for CheckpointWriter
impl UnsafeUnpin for CheckpointWriter
impl UnwindSafe for CheckpointWriter
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§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 moreSource§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).Source§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.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.