Struct salva2d::LiquidWorld

source ·
pub struct LiquidWorld {
    pub counters: Counters,
    /* private fields */
}
Expand description

The physics world for simulating fluids with boundaries.

Fields§

§counters: Counters

Performance counters of the whole fluid simulation engine.

Implementations§

source§

impl LiquidWorld

source

pub fn new( solver: impl PressureSolver + Send + Sync + 'static, particle_radius: Real, smoothing_factor: Real ) -> Self

Initialize a new liquid world.

§Parameters
  • particle_radius: the radius of every particle on this world.
  • smoothing_factor: the smoothing factor used to compute the SPH kernel radius. The kernel radius will be computed as `particle_radius * smoothing_factor * 2.0.
source

pub fn step(&mut self, dt: Real, gravity: &Vector<Real>)

Advances the simulation by dt milliseconds.

All the fluid particles will be affected by an acceleration equal to gravity.

source

pub fn step_with_coupling( &mut self, dt: Real, gravity: &Vector<Real>, coupling: &mut impl CouplingManager )

Advances the simulation by dt milliseconds, taking into account coupling with an external rigid-body engine.

source

pub fn add_fluid(&mut self, fluid: Fluid) -> FluidHandle

Add a fluid to the liquid world.

source

pub fn add_boundary(&mut self, boundary: Boundary) -> BoundaryHandle

Add a boundary to the liquid world.

source

pub fn remove_fluid(&mut self, handle: FluidHandle) -> Option<Fluid>

Add a fluid to the liquid world.

source

pub fn remove_boundary(&mut self, handle: BoundaryHandle) -> Option<Boundary>

Add a boundary to the liquid world.

source

pub fn fluids(&self) -> &FluidSet

The set of fluids on this liquid world.

source

pub fn fluids_mut(&mut self) -> &mut FluidSet

The mutable set of fluids on this liquid world.

source

pub fn boundaries(&self) -> &BoundarySet

The set of boundaries on this liquid world.

source

pub fn boundaries_mut(&mut self) -> &mut BoundarySet

The mutable set of boundaries on this liquid world.

source

pub fn h(&self) -> Real

The SPH kernel radius.

source

pub fn particle_radius(&self) -> Real

The radius of every particle on this liquid world.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.