[][src]Struct salva2d::object::Fluid

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,
    // some fields omitted
}

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

impl Fluid[src]

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

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.

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

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

pub fn num_deleted_particles(&self) -> usize[src]

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

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

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

pub fn particle_radius(&self) -> Real[src]

The radius of this fluid's particles.

pub fn default_particle_volume(&self) -> Real[src]

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

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

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.

pub fn z_sort(&mut self)[src]

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

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

Apply the given transformation to each particle of this fluid.

pub fn num_particles(&self) -> usize[src]

The number of particles on this fluid.

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

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

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

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

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,