Trait Interaction

pub trait Interaction<Pos, Vel, Force, Inf = ()> {
    // Required methods
    fn get_interaction_information(&self) -> Inf;
    fn calculate_force_between(
        &self,
        own_pos: &Pos,
        own_vel: &Vel,
        ext_pos: &Pos,
        ext_vel: &Vel,
        ext_info: &Inf,
    ) -> Result<(Force, Force), CalcError>;

    // Provided methods
    fn is_neighbor(
        &self,
        own_pos: &Pos,
        ext_pos: &Pos,
        ext_inf: &Inf,
    ) -> Result<bool, CalcError> { ... }
    fn react_to_neighbors(&mut self, neighbors: usize) -> Result<(), CalcError> { ... }
}
Expand description

Trait describing force-interactions between cellular agents.

Required Methods§

fn get_interaction_information(&self) -> Inf

Get additional information of cellular properties (ie. for cell-specific interactions). For now, this can also be used to get the mass of the other cell-agent. In the future, we will probably provide a custom function for this.

fn calculate_force_between( &self, own_pos: &Pos, own_vel: &Vel, ext_pos: &Pos, ext_vel: &Vel, ext_info: &Inf, ) -> Result<(Force, Force), CalcError>

Calculates the forces (velocity-derivative) on the corresponding external position given external velocity. By providing velocities, we can calculate terms that are related to friction. The function returns two forces, one acting on the current agent and the other on the external agent.

Provided Methods§

fn is_neighbor( &self, own_pos: &Pos, ext_pos: &Pos, ext_inf: &Inf, ) -> Result<bool, CalcError>

Checks if the other cell represented by position and information is a neighbor to the current one or not.

fn react_to_neighbors(&mut self, neighbors: usize) -> Result<(), CalcError>

Reacts to the results gathered by the Interaction::is_neighbor method and changes the state of the cell.

Trait Implementations§

§

impl<Pos, Vel, For, Inf> Interaction<Pos, Vel, For, Inf> for Box<dyn Interaction<Pos, Vel, For, Inf>>

§

fn get_interaction_information(&self) -> Inf

Get additional information of cellular properties (ie. for cell-specific interactions). For now, this can also be used to get the mass of the other cell-agent. In the future, we will probably provide a custom function for this.
§

fn calculate_force_between( &self, own_pos: &Pos, own_vel: &Vel, ext_pos: &Pos, ext_vel: &Vel, ext_info: &Inf, ) -> Result<(For, For), CalcError>

Calculates the forces (velocity-derivative) on the corresponding external position given external velocity. By providing velocities, we can calculate terms that are related to friction. The function returns two forces, one acting on the current agent and the other on the external agent.
§

fn is_neighbor( &self, own_pos: &Pos, ext_pos: &Pos, ext_inf: &Inf, ) -> Result<bool, CalcError>

Checks if the other cell represented by position and information is a neighbor to the current one or not.
§

fn react_to_neighbors(&mut self, neighbors: usize) -> Result<(), CalcError>

Reacts to the results gathered by the Interaction::is_neighbor method and changes the state of the cell.

Implementations on Foreign Types§

§

impl<Pos, Vel, For, Inf> Interaction<Pos, Vel, For, Inf> for Box<dyn Interaction<Pos, Vel, For, Inf>>

§

fn get_interaction_information(&self) -> Inf

§

fn calculate_force_between( &self, own_pos: &Pos, own_vel: &Vel, ext_pos: &Pos, ext_vel: &Vel, ext_info: &Inf, ) -> Result<(For, For), CalcError>

§

fn is_neighbor( &self, own_pos: &Pos, ext_pos: &Pos, ext_inf: &Inf, ) -> Result<bool, CalcError>

§

fn react_to_neighbors(&mut self, neighbors: usize) -> Result<(), CalcError>

Implementors§

§

impl Interaction<Matrix<f64, Const<2>, Const<1>, ArrayStorage<f64, 2, 1>>, Matrix<f64, Const<2>, Const<1>, ArrayStorage<f64, 2, 1>>, Matrix<f64, Const<2>, Const<1>, ArrayStorage<f64, 2, 1>>, f64> for BacteriaReactions

§

impl<F, S, A, R, I1, I2, D> Interaction<Matrix<F, D, Const<2>, S>, Matrix<F, D, Const<2>, S>, Matrix<F, D, Const<2>, S>, (I1, I2)> for VertexDerivedInteraction<A, R, I1, I2>
where A: Interaction<Matrix<F, Const<2>, Const<1>, ArrayStorage<F, 2, 1>>, Matrix<F, Const<2>, Const<1>, ArrayStorage<F, 2, 1>>, Matrix<F, Const<2>, Const<1>, ArrayStorage<F, 2, 1>>, I1>, R: Interaction<Matrix<F, Const<2>, Const<1>, ArrayStorage<F, 2, 1>>, Matrix<F, Const<2>, Const<1>, ArrayStorage<F, 2, 1>>, Matrix<F, Const<2>, Const<1>, ArrayStorage<F, 2, 1>>, I2>, D: Dim, F: Scalar + RealField + Copy, Matrix<F, D, Const<2>, S>: Mul<F, Output = Matrix<F, D, Const<2>, S>>, S: RawStorageMut<F, D, Const<2>> + Storage<F, D, Const<2>> + Clone,

§

impl<I, F, Inf, const D: usize> Interaction<Matrix<F, Dyn, Const<D>, VecStorage<F, Dyn, Const<D>>>, Matrix<F, Dyn, Const<D>, VecStorage<F, Dyn, Const<D>>>, Matrix<F, Dyn, Const<D>, VecStorage<F, Dyn, Const<D>>>, Inf> for RodInteraction<I>
where I: Interaction<Matrix<F, Const<D>, Const<1>, ArrayStorage<F, D, 1>>, Matrix<F, Const<D>, Const<1>, ArrayStorage<F, D, 1>>, Matrix<F, Const<D>, Const<1>, ArrayStorage<F, D, 1>>, Inf>, F: 'static + RealField + Copy + Debug + Zero,

§

impl<Pos, Vel, For> Interaction<Pos, Vel, For> for NoInteraction
where For: Zero,

§

impl<Pos, Vel, For, Inf, A> Interaction<Pos, Vel, For, Inf> for CellAgentBox<A>
where A: Interaction<Pos, Vel, For, Inf> + Serialize + for<'a> Deserialize<'a>,

§

impl<Pos, Vel, For, Inf, Mec, Int, Cyc, React, IntExtracellular> Interaction<Pos, Vel, For, Inf> for ModularCell<Mec, Int, Cyc, React, IntExtracellular>
where Int: Interaction<Pos, Vel, For, Inf>,

§

impl<__cr_private_Pos, __cr_private_Vel, __cr_private_For, __cr_private_Inf> Interaction<__cr_private_Pos, __cr_private_Vel, __cr_private_For, __cr_private_Inf> for Bacteria
where BacteriaReactions: Interaction<__cr_private_Pos, __cr_private_Vel, __cr_private_For, __cr_private_Inf>,

§

impl<const D: usize> Interaction<Matrix<f32, Const<D>, Const<1>, ArrayStorage<f32, D, 1>>, Matrix<f32, Const<D>, Const<1>, ArrayStorage<f32, D, 1>>, Matrix<f32, Const<D>, Const<1>, ArrayStorage<f32, D, 1>>> for BoundLennardJonesF32

§

impl<const D: usize> Interaction<Matrix<f32, Const<D>, Const<1>, ArrayStorage<f32, D, 1>>, Matrix<f32, Const<D>, Const<1>, ArrayStorage<f32, D, 1>>, Matrix<f32, Const<D>, Const<1>, ArrayStorage<f32, D, 1>>, f32> for MiePotentialF32

§

impl<const D: usize> Interaction<Matrix<f32, Const<D>, Const<1>, ArrayStorage<f32, D, 1>>, Matrix<f32, Const<D>, Const<1>, ArrayStorage<f32, D, 1>>, Matrix<f32, Const<D>, Const<1>, ArrayStorage<f32, D, 1>>, f32> for MorsePotentialF32

§

impl<const D: usize> Interaction<Matrix<f64, Const<D>, Const<1>, ArrayStorage<f64, D, 1>>, Matrix<f64, Const<D>, Const<1>, ArrayStorage<f64, D, 1>>, Matrix<f64, Const<D>, Const<1>, ArrayStorage<f64, D, 1>>> for BoundLennardJones

§

impl<const D: usize> Interaction<Matrix<f64, Const<D>, Const<1>, ArrayStorage<f64, D, 1>>, Matrix<f64, Const<D>, Const<1>, ArrayStorage<f64, D, 1>>, Matrix<f64, Const<D>, Const<1>, ArrayStorage<f64, D, 1>>, f64> for MiePotential

§

impl<const D: usize> Interaction<Matrix<f64, Const<D>, Const<1>, ArrayStorage<f64, D, 1>>, Matrix<f64, Const<D>, Const<1>, ArrayStorage<f64, D, 1>>, Matrix<f64, Const<D>, Const<1>, ArrayStorage<f64, D, 1>>, f64> for MorsePotential