pub struct ParticleDataset {
pub ids: Vec<u64>,
pub positions: Vec<[f64; 3]>,
pub velocities: Vec<[f64; 3]>,
pub masses: Vec<f64>,
pub radii: Vec<f64>,
pub properties: HashMap<String, Vec<f64>>,
pub time: f64,
pub step: u64,
}Expand description
A single-frame snapshot of a particle simulation.
Each particle is identified by a unique integer id and carries:
position, velocity, mass, radius, and an optional property bag.
Fields§
§ids: Vec<u64>Particle IDs (parallel arrays with positions, velocities, etc.).
positions: Vec<[f64; 3]>Particle positions — [x, y, z] for each particle.
velocities: Vec<[f64; 3]>Particle velocities — [vx, vy, vz] for each particle.
masses: Vec<f64>Particle masses.
radii: Vec<f64>Particle radii.
properties: HashMap<String, Vec<f64>>Named scalar/vector properties per particle (e.g. "temperature").
time: f64Simulation time associated with this snapshot.
step: u64Simulation step index.
Implementations§
Source§impl ParticleDataset
impl ParticleDataset
Sourcepub fn add_particle(
&mut self,
id: u64,
position: [f64; 3],
velocity: [f64; 3],
mass: f64,
radius: f64,
) -> usize
pub fn add_particle( &mut self, id: u64, position: [f64; 3], velocity: [f64; 3], mass: f64, radius: f64, ) -> usize
Add a single particle, returning its index.
Sourcepub fn add_property(&mut self, name: impl Into<String>, values: Vec<f64>)
pub fn add_property(&mut self, name: impl Into<String>, values: Vec<f64>)
Add a named scalar property array.
values must have the same length as the current particle count (or be
empty, which will be zero-extended later).
Sourcepub fn bounding_box(&self) -> Option<([f64; 3], [f64; 3])>
pub fn bounding_box(&self) -> Option<([f64; 3], [f64; 3])>
Compute the axis-aligned bounding box as (min, max).
Returns None if the dataset is empty.
Sourcepub fn kinetic_energy(&self) -> f64
pub fn kinetic_energy(&self) -> f64
Compute the total kinetic energy (0.5 * m * v²).
Sourcepub fn merge(&mut self, other: &ParticleDataset)
pub fn merge(&mut self, other: &ParticleDataset)
Merge another dataset into this one (append particles).
Trait Implementations§
Source§impl Clone for ParticleDataset
impl Clone for ParticleDataset
Source§fn clone(&self) -> ParticleDataset
fn clone(&self) -> ParticleDataset
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParticleDataset
impl Debug for ParticleDataset
Source§impl Default for ParticleDataset
impl Default for ParticleDataset
Source§fn default() -> ParticleDataset
fn default() -> ParticleDataset
Auto Trait Implementations§
impl Freeze for ParticleDataset
impl RefUnwindSafe for ParticleDataset
impl Send for ParticleDataset
impl Sync for ParticleDataset
impl Unpin for ParticleDataset
impl UnsafeUnpin for ParticleDataset
impl UnwindSafe for ParticleDataset
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
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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.