cellular_raza_core::backend::chili

Trait UpdateMechanics

Source
pub trait UpdateMechanics<Pos, Vel, For, const N: usize> {
    // Required methods
    fn set_last_position(&mut self, pos: Pos);
    fn previous_positions<'a>(&'a self) -> RingBufferIterRef<'a, Pos, N> ;
    fn set_last_velocity(&mut self, vel: Vel);
    fn previous_velocities<'a>(&'a self) -> RingBufferIterRef<'a, Vel, N> ;
    fn n_previous_values(&self) -> usize;
    fn add_force(&mut self, force: For);
    fn get_current_force_and_reset(&mut self) -> For;
}
Expand description

Used to store intermediate information about last positions and velocities. Can store up to N values.

Required Methods§

Source

fn set_last_position(&mut self, pos: Pos)

Stores the last position of the cell. May overwrite old results depending on how many old results are being stored.

Source

fn previous_positions<'a>(&'a self) -> RingBufferIterRef<'a, Pos, N>

Get all previous positions. This number maybe smaller than the maximum number of stored positions but never exceeds it.

Source

fn set_last_velocity(&mut self, vel: Vel)

Stores the last velocity of the cell. Overwrites old results when stored amount exceeds number of maximum stored values.

Source

fn previous_velocities<'a>(&'a self) -> RingBufferIterRef<'a, Vel, N>

Get all previous velocities. This number may be smaller than the maximum number of stored velocities but never exceeds it.

Source

fn n_previous_values(&self) -> usize

Get the number of previous values currently stored

This number is by definition between 0 and N.

Source

fn add_force(&mut self, force: For)

Add force to currently stored forces

Source

fn get_current_force_and_reset(&mut self) -> For

Obtain current force on cell

Implementors§

Source§

impl<Pos, Vel, For, const N: usize> UpdateMechanics<Pos, Vel, For, N> for AuxStorageMechanics<Pos, Vel, For, N>
where For: Clone + AddAssign<For>,