Skip to main content

Checkpoint

Struct Checkpoint 

Source
pub struct Checkpoint {
Show 15 fields pub deck_hash: u64, pub unknowns: Vec<String>, pub t: f64, pub accepted_steps: usize, pub step_index: usize, pub dt_next: Option<f64>, pub ringing_cooldown: u32, pub x_prev: Vec<f64>, pub x_prev_prev: Option<Vec<f64>>, pub point_prev: PointSnapshot, pub prev_diode_raw_ioff: BTreeMap<String, f64>, pub prev_segments: Option<Vec<u8>>, pub prev_gate_states: Option<BTreeMap<String, bool>>, pub prev_outputs: BTreeMap<String, SignalSnapshot>, pub blocks: Vec<(String, BlockSnapshot)>,
}
Expand description

The complete loop-carried state of a transient run at the end of an accepted step.

Fields§

§deck_hash: u64

Identifies the deck this was taken from — see deck_hash. A load into a deck with a different hash is refused as DaeError::CheckpointDeckMismatch.

§unknowns: Vec<String>

The system’s unknown names, in x order — reported in the mismatch error so the reader can see what differs, and double-checked on load.

§t: f64§accepted_steps: usize

Accepted steps so far (the adaptive stall guard counts from here).

§step_index: usize

The loop’s own step index — nonzero on resume, so the first resumed step is not treated as a run’s first step (which would force backward Euler).

§dt_next: Option<f64>

The adaptive controller’s suggested next step; None for a fixed-step run.

§ringing_cooldown: u32§x_prev: Vec<f64>§x_prev_prev: Option<Vec<f64>>§point_prev: PointSnapshot§prev_diode_raw_ioff: BTreeMap<String, f64>§prev_segments: Option<Vec<u8>>

Each diode’s previous segment, as classify_segments numbers them (0 breakdown, 1 leakage, 2 forward); None before the first accepted step.

§prev_gate_states: Option<BTreeMap<String, bool>>

Each ideal switch’s previous gate state, true for on.

§prev_outputs: BTreeMap<String, SignalSnapshot>§blocks: Vec<(String, BlockSnapshot)>

One entry per block, in the caller’s block order, keyed by name for the mismatch check.

Implementations§

Source§

impl Checkpoint

Source

pub fn to_bytes(&self) -> Result<Vec<u8>, DaeError>

The file encoding: MAGIC, FORMAT_VERSION, then the postcard payload.

Source

pub fn from_bytes(bytes: &[u8]) -> Result<Self, DaeError>

The inverse of Self::to_bytes; a wrong magic or an unknown version is reported as such rather than decoded into garbage.

Source

pub fn write_to(&self, path: &Path) -> Result<(), DaeError>

Source

pub fn read_from(path: &Path) -> Result<Self, DaeError>

Trait Implementations§

Source§

impl Clone for Checkpoint

Source§

fn clone(&self) -> Self

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 Debug for Checkpoint

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Checkpoint

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Checkpoint

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Checkpoint

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Checkpoint

Auto Trait Implementations§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.