Struct salva3d::object::Fluid

source ·
pub struct Fluid {
    pub nonpressure_forces: Vec<Box<dyn NonPressureForce>>,
    pub positions: Vec<Point<Real>>,
    pub velocities: Vec<Vector<Real>>,
    pub accelerations: Vec<Vector<Real>>,
    pub volumes: Vec<Real>,
    pub density0: Real,
    /* private fields */
}
Expand description

A fluid object.

A fluid object is composed of movable particles with additional properties like viscosity.

Fields§

§nonpressure_forces: Vec<Box<dyn NonPressureForce>>

Nonpressure forces this fluid is subject to.

§positions: Vec<Point<Real>>

The world-space position of the fluid particles.

§velocities: Vec<Vector<Real>>

The velocities of the fluid particles.

§accelerations: Vec<Vector<Real>>

The accelerations of the fluid particles.

§volumes: Vec<Real>

The volume of the fluid particles.

§density0: Real

The rest density of this fluid.

Implementations§

source§

impl Fluid

source

pub fn new( particle_positions: Vec<Point<Real>>, particle_radius: Real, density0: Real ) -> Self

Initializes a new fluid object with the given particle positions, particle radius, density, and viscosity.

The particle radius should be the same as the radius used to initialize the liquid world.

source

pub fn delete_particle_at_next_timestep(&mut self, particle: usize)

Mark the given particle to be deleted at the next timestep.

source

pub fn num_deleted_particles(&self) -> usize

The number of particles that will be deleted at the next timestep.

source

pub fn deleted_particles_mask(&self) -> &[bool]

The mask of particles that will be deleted at the next timestep.

source

pub fn particle_radius(&self) -> Real

The radius of this fluid’s particles.

source

pub fn default_particle_volume(&self) -> Real

The default volume given to each of this fluid’s particles.

source

pub fn add_particles( &mut self, positions: &[Point<Real>], velocities: Option<&[Vector<Real>]> )

Add a set of particles to this fluid.

If velocities is None the velocity of each particle will be initialized at zero. If it is not None, then it must be a slice with the same length than positions.

source

pub fn z_sort(&mut self)

Sorts all the particles of this fluids according to morton order.

source

pub fn transform_by(&mut self, t: &Isometry<Real>)

Apply the given transformation to each particle of this fluid.

source

pub fn num_particles(&self) -> usize

The number of particles on this fluid.

source

pub fn particle_mass(&self, i: usize) -> Real

The mass of the i-th particle of this fluid.

source

pub fn particle_inv_mass(&self, i: usize) -> Real

The inverse mass of the i-th particle of this fluid.

Returns 0 if the i-th particle has a zero mass.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Fluid

§

impl Send for Fluid

§

impl Sync for Fluid

§

impl Unpin for Fluid

§

impl !UnwindSafe for Fluid

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.