pub struct FluidSimulation {Show 15 fields
pub particles: Vec<SphParticle>,
pub kernel_radius: f32,
pub rest_density: f32,
pub viscosity: f32,
pub pressure_stiffness: f32,
pub surface_tension: f32,
pub gravity: Vec3,
pub restitution: f32,
pub particle_radius: f32,
pub neighbor_grid: HashMap<(i32, i32, i32), Vec<usize>>,
pub domain_min: Vec3,
pub domain_max: Vec3,
pub time_scale: f32,
pub max_velocity: f32,
pub color_field_threshold: f32,
}Fields§
§particles: Vec<SphParticle>§kernel_radius: f32§rest_density: f32§viscosity: f32§pressure_stiffness: f32§surface_tension: f32§gravity: Vec3§restitution: f32§particle_radius: f32§neighbor_grid: HashMap<(i32, i32, i32), Vec<usize>>§domain_min: Vec3§domain_max: Vec3§time_scale: f32§max_velocity: f32§color_field_threshold: f32Implementations§
Source§impl FluidSimulation
impl FluidSimulation
pub fn new(kernel_radius: f32, rest_density: f32) -> Self
pub fn spawn_block(&mut self, min: Vec3, max: Vec3, spacing: f32, mass: f32)
pub fn build_neighbor_grid(&mut self)
pub fn get_neighbors(&self, pos: Vec3) -> Vec<usize>
Sourcepub fn compute_density(&mut self)
pub fn compute_density(&mut self)
Compute density for all particles
Sourcepub fn compute_pressure(&mut self)
pub fn compute_pressure(&mut self)
Compute pressure from density: P = k*(rho - rho_0)
Sourcepub fn compute_forces(&mut self)
pub fn compute_forces(&mut self)
Compute pressure, viscosity, and surface tension forces
Trait Implementations§
Source§impl Clone for FluidSimulation
impl Clone for FluidSimulation
Auto Trait Implementations§
impl Freeze for FluidSimulation
impl RefUnwindSafe for FluidSimulation
impl Send for FluidSimulation
impl Sync for FluidSimulation
impl Unpin for FluidSimulation
impl UnsafeUnpin for FluidSimulation
impl UnwindSafe for FluidSimulation
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.