pub struct CheckpointWriter {
pub path: PathBuf,
pub compress: bool,
}Expand description
Writes simulation snapshots to a binary checkpoint file.
Call methods in order:
write_header(CheckpointWriter::write_header)write_positions(optional)write_velocities(optional)- Any number of
write_scalars/write_integers finalize
Fields§
§path: PathBufDestination file path.
compress: boolWhether to compress the output (currently a no-op placeholder).
Implementations§
Source§impl CheckpointWriter
impl CheckpointWriter
Sourcepub fn with_compress(self, compress: bool) -> Self
pub fn with_compress(self, compress: bool) -> Self
Enable or disable compression (placeholder for future extension).
Sourcepub fn write_header(&self, meta: &CheckpointMetadata) -> Result<()>
pub fn write_header(&self, meta: &CheckpointMetadata) -> Result<()>
Write the file header and metadata record.
Creates (or truncates) the file and writes the magic number, format version, and serialized metadata.
Sourcepub fn write_positions(&self, pos: &[[f64; 3]]) -> Result<()>
pub fn write_positions(&self, pos: &[[f64; 3]]) -> Result<()>
Append a positions block ([[f64; 3\]]) to the checkpoint file.
Each position is written as three little-endian f64 values.
Sourcepub fn write_velocities(&self, vel: &[[f64; 3]]) -> Result<()>
pub fn write_velocities(&self, vel: &[[f64; 3]]) -> Result<()>
Append a velocities block ([[f64; 3\]]) to the checkpoint file.
Sourcepub fn write_scalars(&self, name: &str, data: &[f64]) -> Result<()>
pub fn write_scalars(&self, name: &str, data: &[f64]) -> Result<()>
Append a named scalar (f64) array to the checkpoint file.
Trait Implementations§
Source§impl Clone for CheckpointWriter
impl Clone for CheckpointWriter
Source§fn clone(&self) -> CheckpointWriter
fn clone(&self) -> CheckpointWriter
Returns a duplicate 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 moreAuto 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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.