pub struct ParticleDiffWriter {
pub pos_threshold: f64,
pub vel_threshold: f64,
pub deltas: Vec<(u64, Vec<ParticleDelta>)>,
/* private fields */
}Expand description
Writes only the changes between consecutive particle frames (delta encoding).
This format is useful for large simulations where only a small fraction of particles move significantly each frame, enabling compact storage.
Fields§
§pos_threshold: f64Threshold below which position changes are considered zero.
vel_threshold: f64Threshold below which velocity changes are considered zero.
deltas: Vec<(u64, Vec<ParticleDelta>)>Accumulated delta frames.
Implementations§
Source§impl ParticleDiffWriter
impl ParticleDiffWriter
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a diff writer with default thresholds (1e-9 for position, 1e-9 for velocity).
Sourcepub fn with_thresholds(pos_threshold: f64, vel_threshold: f64) -> Self
pub fn with_thresholds(pos_threshold: f64, vel_threshold: f64) -> Self
Create with custom thresholds.
Sourcepub fn write_frame(&mut self, current: &ParticleDataset) -> usize
pub fn write_frame(&mut self, current: &ParticleDataset) -> usize
Process a new frame, computing and storing the delta vs the previous frame.
Returns the number of changed particles in this frame.
Sourcepub fn total_deltas(&self) -> usize
pub fn total_deltas(&self) -> usize
Total number of delta records across all frames.
Sourcepub fn reconstruct(&self, through_step: u64) -> ParticleDataset
pub fn reconstruct(&self, through_step: u64) -> ParticleDataset
Reconstruct a full dataset from delta frames up to step.
Trait Implementations§
Source§impl Debug for ParticleDiffWriter
impl Debug for ParticleDiffWriter
Source§impl Default for ParticleDiffWriter
impl Default for ParticleDiffWriter
Source§fn default() -> ParticleDiffWriter
fn default() -> ParticleDiffWriter
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ParticleDiffWriter
impl RefUnwindSafe for ParticleDiffWriter
impl Send for ParticleDiffWriter
impl Sync for ParticleDiffWriter
impl Unpin for ParticleDiffWriter
impl UnsafeUnpin for ParticleDiffWriter
impl UnwindSafe for ParticleDiffWriter
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.