SphSystemData3

Struct SphSystemData3 

Source
pub struct SphSystemData3 { /* private fields */ }
Expand description

§3-D SPH particle system data.

This class extends ParticleSystemData3 to specialize the data model for SPH. It includes density and pressure array as a default particle attribute, and it also contains SPH utilities such as interpolation operator.

Implementations§

Source§

impl SphSystemData3

Source

pub fn new_default() -> SphSystemData3

Constructs empty SPH system.

Source

pub fn new(number_of_particles: usize) -> SphSystemData3

Constructs SPH system data with given number of particles.

Source§

impl SphSystemData3

Source

pub fn set_radius(&mut self, new_radius: f64)

\brief Sets the radius.

Sets the radius of the particle system. The radius will be interpreted as target spacing.

Source

pub fn set_mass(&mut self, new_mass: f64)

\brief Sets the mass of a particle.

Setting the mass of a particle will change the target density.

  • parameter: new_mass The new mass.
Source

pub fn densities(&self) -> &Vec<f64>

Returns the density array accessor (immutable).

Source

pub fn densities_mut(&mut self) -> &mut Vec<f64>

Returns the density array accessor (mutable).

Source

pub fn pressures(&self) -> &Vec<f64>

Returns the pressure array accessor (immutable).

Source

pub fn pressures_mut(&mut self) -> &mut Vec<f64>

Returns the pressure array accessor (mutable).

Source

pub fn update_densities(&mut self)

\brief Updates the density array with the latest particle positions.

This function updates the density array by recalculating each particle’s latest nearby particles’ position.

\warning You must update the neighbor searcher (SphSystemData3::build_neighbor_searcher) before calling this function.

Source

pub fn set_target_density(&mut self, target_density: f64)

Sets the target density of this particle system.

Source

pub fn target_density(&self) -> f64

Returns the target density of this particle system.

Source

pub fn set_target_spacing(&mut self, spacing: f64)

\brief Sets the target particle spacing in meters.

Once this function is called, hash grid and density should be updated using updateHashGrid() and update_densities).

Source

pub fn target_spacing(&self) -> f64

Returns the target particle spacing in meters.

Source

pub fn set_relative_kernel_radius(&mut self, relative_radius: f64)

\brief Sets the relative kernel radius.

Sets the relative kernel radius compared to the target particle spacing (i.e. kernel radius / target spacing). Once this function is called, hash grid and density should be updated using updateHashGrid() and update_densities).

Source

pub fn relative_kernel_radius(&self) -> f64

\brief Returns the relative kernel radius.

Returns the relative kernel radius compared to the target particle spacing (i.e. kernel radius / target spacing).

Source

pub fn set_kernel_radius(&mut self, kernel_radius: f64)

\brief Sets the absolute kernel radius.

Sets the absolute kernel radius compared to the target particle spacing (i.e. relative kernel radius * target spacing). Once this function is called, hash grid and density should be updated using updateHashGrid() and update_densities).

Source

pub fn kernel_radius(&self) -> f64

Returns the kernel radius in meters unit.

Source

pub fn sum_of_kernel_nearby(&self, origin: &Vector3D) -> f64

Returns sum of kernel function evaluation for each nearby particle.

Source

pub fn interpolate_scalar(&self, origin: &Vector3D, values: &Vec<f64>) -> f64

\brief Returns interpolated value at given origin point.

Returns interpolated scalar data from the given position using standard SPH weighted average. The data array should match the particle layout. For example, density or pressure arrays can be used.

\warning You must update the neighbor searcher (SphSystemData3::build_neighbor_searcher) before calling this function.

Source

pub fn interpolate_vec( &self, origin: &Vector3D, values: &Vec<Vector3D>, ) -> Vector3D

\brief Returns interpolated vector value at given origin point.

Returns interpolated vector data from the given position using standard SPH weighted average. The data array should match the particle layout. For example, velocity or acceleration arrays can be used.

\warning You must update the neighbor searcher (SphSystemData3::build_neighbor_searcher) before calling this function.

Source

pub fn gradient_at(&self, i: usize, values: &Vec<f64>) -> Vector3D

Returns the gradient of the given values at i-th particle.

\warning You must update the neighbor lists (SphSystemData3::build_neighbor_lists) before calling this function.

Source

pub fn laplacian_at_scalar(&self, i: usize, values: &Vec<f64>) -> f64

Returns the laplacian of the given values at i-th particle.

\warning You must update the neighbor lists (SphSystemData3::build_neighbor_lists) before calling this function.

Source

pub fn laplacian_at_vec(&self, i: usize, values: &Vec<Vector3D>) -> Vector3D

Returns the laplacian of the given values at i-th particle.

\warning You must update the neighbor lists (SphSystemData3::build_neighbor_lists) before calling this function.

Source

pub fn build_neighbor_searcher(&mut self)

Builds neighbor searcher with kernel radius.

Source

pub fn build_neighbor_lists(&mut self)

Builds neighbor lists with kernel radius.

Source§

impl SphSystemData3

Source

pub fn radius(&self) -> f64

Returns the radius of the particles.

Source

pub fn mass(&self) -> f64

Returns the mass of the particles.

Source

pub fn positions(&self) -> &Vec<Vector3D>

Returns the position array (immutable).

Source

pub fn positions_mut(&mut self) -> &mut Vec<Vector3D>

Returns the position array (mutable).

Source

pub fn velocities(&self) -> &Vec<Vector3D>

Returns the velocity array (immutable).

Source

pub fn velocities_mut(&mut self) -> &mut Vec<Vector3D>

Returns the velocity array (mutable).

Source

pub fn forces(&self) -> &Vec<Vector3D>

Returns the force array (immutable).

Source

pub fn forces_mut(&mut self) -> &mut Vec<Vector3D>

Returns the force array (mutable).

Source

pub fn number_of_particles(&self) -> usize

Returns the number of particles.

Source

pub fn neighbor_lists(&self) -> &Vec<Vec<usize>>

\brief Returns neighbor lists.

This function returns neighbor lists which is available after calling PointParallelHashGridSearcher2::build_neighbor_lists. Each list stores indices of the neighbors.

\return Neighbor lists.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

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>,

Source§

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.
Source§

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

Source§

fn vzip(self) -> V