pub struct PyLbmBinding { /* private fields */ }Expand description
PyO3-style binding handle for a 2-D LBM simulation.
Uses the PyLbmGrid type (D2Q9 BGK) defined earlier in this file.
Implementations§
Source§impl PyLbmBinding
impl PyLbmBinding
Sourcepub fn new(width: usize, height: usize, viscosity: f64) -> Self
pub fn new(width: usize, height: usize, viscosity: f64) -> Self
Create a new LBM binding with the given grid dimensions and viscosity.
Sourcepub fn from_config(config: PyLbmConfig) -> Self
pub fn from_config(config: PyLbmConfig) -> Self
Create from an explicit PyLbmConfig.
Sourcepub fn grid_width(&self) -> usize
pub fn grid_width(&self) -> usize
Grid width (number of cells along X).
Sourcepub fn grid_height(&self) -> usize
pub fn grid_height(&self) -> usize
Grid height (number of cells along Y).
Sourcepub fn cell_count(&self) -> usize
pub fn cell_count(&self) -> usize
Total number of cells.
Sourcepub fn get_density_flat(&self) -> Vec<f64>
pub fn get_density_flat(&self) -> Vec<f64>
Return the density field as a flat row-major array.
Sourcepub fn get_velocity_flat(&self) -> Vec<f64>
pub fn get_velocity_flat(&self) -> Vec<f64>
Return velocity field as interleaved [ux0,uy0, ux1,uy1, …].
Sourcepub fn get_speed_flat(&self) -> Vec<f64>
pub fn get_speed_flat(&self) -> Vec<f64>
Return velocity magnitude (speed) for each cell as a flat array.
Sourcepub fn mean_density(&self) -> f64
pub fn mean_density(&self) -> f64
Mean density across all cells.
Sourcepub fn step_count(&self) -> u64
pub fn step_count(&self) -> u64
Number of completed steps.
Trait Implementations§
Source§impl Clone for PyLbmBinding
impl Clone for PyLbmBinding
Source§fn clone(&self) -> PyLbmBinding
fn clone(&self) -> PyLbmBinding
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 PyLbmBinding
impl RefUnwindSafe for PyLbmBinding
impl Send for PyLbmBinding
impl Sync for PyLbmBinding
impl Unpin for PyLbmBinding
impl UnsafeUnpin for PyLbmBinding
impl UnwindSafe for PyLbmBinding
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.