Struct particular::compute_method::storage::PointMass
source · #[repr(C)]pub struct PointMass<V, S> {
pub position: V,
pub mass: S,
}
Expand description
Point-mass representation of an object in space.
Fields§
§position: V
Position of the object.
mass: S
Mass of the object.
Implementations§
source§impl<V: Zero, S: Zero> PointMass<V, S>
impl<V: Zero, S: Zero> PointMass<V, S>
sourcepub const ZERO: Self = _
pub const ZERO: Self = _
PointMass
with position and mass set to Zero::ZERO
.
source§impl<V, S> PointMass<V, S>
impl<V, S> PointMass<V, S>
sourcepub const fn new(position: V, mass: S) -> Self
pub const fn new(position: V, mass: S) -> Self
Creates a new PointMass
with the given position and mass.
sourcepub fn new_lane(position: V::Lane, mass: S::Lane) -> Self
pub fn new_lane(position: V::Lane, mass: S::Lane) -> Self
Creates a new PointMass
with the given lanes of positions and masses.
sourcepub fn new_com(data: &[Self]) -> Self
pub fn new_com(data: &[Self]) -> Self
Returns the PointMass
corresponding to the center of mass and total mass of the given
slice of point-masses.
sourcepub fn splat_lane(position: V::Element, mass: S::Element) -> Self
pub fn splat_lane(position: V::Element, mass: S::Element) -> Self
Creates a new PointMass
with all lanes set to the given position and mass.
sourcepub fn slice_to_lane<const L: usize, T, E>(slice: &[PointMass<T, E>]) -> Self
pub fn slice_to_lane<const L: usize, T, E>(slice: &[PointMass<T, E>]) -> Self
Returns a SIMD
point-masses from a slice of SIMD::Element
point-masses.
sourcepub fn slice_to_lanes<'a, const L: usize, T, E>(
slice: &'a [PointMass<T, E>]
) -> impl Iterator<Item = Self> + 'a
pub fn slice_to_lanes<'a, const L: usize, T, E>( slice: &'a [PointMass<T, E>] ) -> impl Iterator<Item = Self> + 'a
Returns an iterator of SIMD
point-masses from a slice of SIMD::Element
point-masses.
sourcepub fn is_massless(&self) -> bool
pub fn is_massless(&self) -> bool
Returns true if the mass is zero.
sourcepub fn is_massive(&self) -> bool
pub fn is_massive(&self) -> bool
Returns false if the mass is zero.
sourcepub fn force_scalar<const CHECK_ZERO: bool>(
&self,
position: V,
mass: S,
softening: S
) -> V
pub fn force_scalar<const CHECK_ZERO: bool>( &self, position: V, mass: S, softening: S ) -> V
Computes the gravitational force exerted on the current point-mass using the given position
and mass. This method is optimised in the case where V
and S
are scalar types.
If the position of the current point-mass is guaranteed to be different from the given
position, this computation can be more efficient with CHECK_ZERO
set to false.
sourcepub fn force_simd<const CHECK_ZERO: bool>(
&self,
position: V,
mass: S,
softening: S
) -> V
pub fn force_simd<const CHECK_ZERO: bool>( &self, position: V, mass: S, softening: S ) -> V
Computes the gravitational force exerted on the current point-mass using the given position
and mass. This method is optimised in the case where V
and S
are simd types.
If the position of the current point-mass is guaranteed to be different from the given
position, this computation can be more efficient with CHECK_ZERO
set to false.
sourcepub fn acceleration_tree<const X: usize, const D: usize>(
&self,
tree: &Orthtree<X, D, S, PointMass<V, S>>,
node: Option<NodeID>,
theta: S,
softening: S
) -> V
pub fn acceleration_tree<const X: usize, const D: usize>( &self, tree: &Orthtree<X, D, S, PointMass<V, S>>, node: Option<NodeID>, theta: S, softening: S ) -> V
Computes the gravitational acceleration exerted on the current point-mass by the specified
node of the given Orthtree
following the Barnes-Hut
approximation with the given theta
parameter, provided V
and S
are scalar types.