Struct Bacteria
pub struct Bacteria {
pub mechanics: NewtonDamped2D,
pub cycle: BacteriaCycle,
pub cellular_reactions: BacteriaReactions,
pub interactionextracellulargradient: GradientSensing,
}Expand description
Bacteria-Agent as used in the pool-model example
Fields§
§mechanics: NewtonDamped2DSee NewtonDamped2D mechanics
cycle: BacteriaCycleSee BacteriaCycle
cellular_reactions: BacteriaReactions§interactionextracellulargradient: GradientSensingSee GradientSensing
Implementations§
§impl Bacteria
impl Bacteria
pub fn from(
py: Python<'_>,
bacteria_template: BacteriaTemplate,
) -> Result<Bacteria, PyErr>
Available on crate feature cpu_os_threads only.
pub fn from( py: Python<'_>, bacteria_template: BacteriaTemplate, ) -> Result<Bacteria, PyErr>
cpu_os_threads only.Convert a BacteriaTemplate into a Bacteria
pub fn volume_to_mass(&self, volume: f64) -> f64
Available on crate feature cpu_os_threads only.
pub fn volume_to_mass(&self, volume: f64) -> f64
cpu_os_threads only.We can have a look at this paper https://doi.org/10.1128/jb.148.1.58-63.1981 and see that the average density of E.Coli is between 1.080 and 1.100 g/ml This means we can safely set the density to 1.09
pub fn mass_to_volume(&self, mass: f64) -> f64
Available on crate feature cpu_os_threads only.
pub fn mass_to_volume(&self, mass: f64) -> f64
cpu_os_threads only.Conversion function of mass to volume
pub fn increase_volume(&mut self, volume_increment: f64)
Available on crate feature cpu_os_threads only.
pub fn increase_volume(&mut self, volume_increment: f64)
cpu_os_threads only.Modifies the cell and increases the overall volume by the specified amount.
pub fn cell_radius(&self) -> f64
Available on crate feature cpu_os_threads only.
pub fn cell_radius(&self) -> f64
cpu_os_threads only.Obtain the current cell radius
Trait Implementations§
§impl Cycle<Bacteria> for BacteriaCycle
impl Cycle<Bacteria> for BacteriaCycle
§fn update_cycle(
rng: &mut ChaCha8Rng,
dt: &f64,
cell: &mut Bacteria,
) -> Option<CycleEvent>
fn update_cycle( rng: &mut ChaCha8Rng, dt: &f64, cell: &mut Bacteria, ) -> Option<CycleEvent>
Continuously updates cellular properties and may spawn a CycleEvent which
then calls the corresponding functions (see also CycleEvent).
§fn divide(
rng: &mut ChaCha8Rng,
c1: &mut Bacteria,
) -> Result<Bacteria, DivisionError>
fn divide( rng: &mut ChaCha8Rng, c1: &mut Bacteria, ) -> Result<Bacteria, DivisionError>
Performs division of the cell by modifying the existing one and spawning an additional cell.
The user is responsible for correctly adjusting cell-specific values such as intracellular
concentrations or position of the two resulting cells.
Corresponds to CycleEvent::Division.
§fn update_conditional_phased_death(
rng: &mut ChaCha8Rng,
dt: &Float,
cell: &mut Cell,
) -> Result<bool, DeathError>
fn update_conditional_phased_death( rng: &mut ChaCha8Rng, dt: &Float, cell: &mut Cell, ) -> Result<bool, DeathError>
Method corresponding to the CycleEvent::PhasedDeath event.
Update the cell while returning a boolean which indicates if the updating procedure has
finished. As soon as the return value is
true the cell is removed.§impl<__cr_private_Float> Cycle<Bacteria, __cr_private_Float> for Bacteria
impl<__cr_private_Float> Cycle<Bacteria, __cr_private_Float> for Bacteria
§fn update_cycle(
rng: &mut ChaCha8Rng,
dt: &__cr_private_Float,
cell: &mut Bacteria,
) -> Option<CycleEvent>
fn update_cycle( rng: &mut ChaCha8Rng, dt: &__cr_private_Float, cell: &mut Bacteria, ) -> Option<CycleEvent>
Continuously updates cellular properties and may spawn a CycleEvent which
then calls the corresponding functions (see also CycleEvent).
§fn divide(
rng: &mut ChaCha8Rng,
cell: &mut Bacteria,
) -> Result<Bacteria, DivisionError>
fn divide( rng: &mut ChaCha8Rng, cell: &mut Bacteria, ) -> Result<Bacteria, DivisionError>
Performs division of the cell by modifying the existing one and spawning an additional cell.
The user is responsible for correctly adjusting cell-specific values such as intracellular
concentrations or position of the two resulting cells.
Corresponds to CycleEvent::Division.
§fn update_conditional_phased_death(
rng: &mut ChaCha8Rng,
dt: &__cr_private_Float,
cell: &mut Bacteria,
) -> Result<bool, DeathError>
fn update_conditional_phased_death( rng: &mut ChaCha8Rng, dt: &__cr_private_Float, cell: &mut Bacteria, ) -> Result<bool, DeathError>
Method corresponding to the CycleEvent::PhasedDeath event.
Update the cell while returning a boolean which indicates if the updating procedure has
finished. As soon as the return value is
true the cell is removed.§impl<'de> Deserialize<'de> for Bacteria
impl<'de> Deserialize<'de> for Bacteria
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Bacteria, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Bacteria, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§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 Bacteriawhere
BacteriaReactions: Interaction<__cr_private_Pos, __cr_private_Vel, __cr_private_For, __cr_private_Inf> + InteractionInformation<__cr_private_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 Bacteriawhere
BacteriaReactions: Interaction<__cr_private_Pos, __cr_private_Vel, __cr_private_For, __cr_private_Inf> + InteractionInformation<__cr_private_Inf>,
§fn calculate_force_between(
&self,
own_pos: &__cr_private_Pos,
own_vel: &__cr_private_Vel,
ext_pos: &__cr_private_Pos,
ext_vel: &__cr_private_Vel,
ext_info: &__cr_private_Inf,
) -> Result<(__cr_private_For, __cr_private_For), CalcError>
fn calculate_force_between( &self, own_pos: &__cr_private_Pos, own_vel: &__cr_private_Vel, ext_pos: &__cr_private_Pos, ext_vel: &__cr_private_Vel, ext_info: &__cr_private_Inf, ) -> Result<(__cr_private_For, __cr_private_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.
§impl InteractionExtracellularGradient<Bacteria, Matrix<Matrix<f64, Const<2>, Const<1>, ArrayStorage<f64, 2, 1>>, Const<cellular_raza_building_blocks::::cell_models::pool_bacteria::{impl#5}::{constant#0}>, Const<1>, ArrayStorage<Matrix<f64, Const<2>, Const<1>, ArrayStorage<f64, 2, 1>>, cellular_raza_building_blocks::::cell_models::pool_bacteria::{impl#5}::{constant#0}, 1>>> for GradientSensing
impl InteractionExtracellularGradient<Bacteria, Matrix<Matrix<f64, Const<2>, Const<1>, ArrayStorage<f64, 2, 1>>, Const<cellular_raza_building_blocks::::cell_models::pool_bacteria::{impl#5}::{constant#0}>, Const<1>, ArrayStorage<Matrix<f64, Const<2>, Const<1>, ArrayStorage<f64, 2, 1>>, cellular_raza_building_blocks::::cell_models::pool_bacteria::{impl#5}::{constant#0}, 1>>> for GradientSensing
§fn sense_gradient(
_cell: &mut Bacteria,
_gradient: &Matrix<Matrix<f64, Const<2>, Const<1>, ArrayStorage<f64, 2, 1>>, Const<cellular_raza_building_blocks::::cell_models::pool_bacteria::{impl#5}::sense_gradient::{constant#0}>, Const<1>, ArrayStorage<Matrix<f64, Const<2>, Const<1>, ArrayStorage<f64, 2, 1>>, cellular_raza_building_blocks::::cell_models::pool_bacteria::{impl#5}::sense_gradient::{constant#0}, 1>>,
) -> Result<(), CalcError>
fn sense_gradient( _cell: &mut Bacteria, _gradient: &Matrix<Matrix<f64, Const<2>, Const<1>, ArrayStorage<f64, 2, 1>>, Const<cellular_raza_building_blocks::::cell_models::pool_bacteria::{impl#5}::sense_gradient::{constant#0}>, Const<1>, ArrayStorage<Matrix<f64, Const<2>, Const<1>, ArrayStorage<f64, 2, 1>>, cellular_raza_building_blocks::::cell_models::pool_bacteria::{impl#5}::sense_gradient::{constant#0}, 1>>, ) -> Result<(), CalcError>
The cell-agent senses the gradient and changes the behaviour of the cell.
§impl<__cr_private_ExtraGradient> InteractionExtracellularGradient<Bacteria, __cr_private_ExtraGradient> for Bacteria
impl<__cr_private_ExtraGradient> InteractionExtracellularGradient<Bacteria, __cr_private_ExtraGradient> for Bacteria
§fn sense_gradient(
cell: &mut Bacteria,
gradient: &__cr_private_ExtraGradient,
) -> Result<(), CalcError>
fn sense_gradient( cell: &mut Bacteria, gradient: &__cr_private_ExtraGradient, ) -> Result<(), CalcError>
The cell-agent senses the gradient and changes the behaviour of the cell.
§impl<__cr_private_Inf> InteractionInformation<__cr_private_Inf> for Bacteriawhere
BacteriaReactions: InteractionInformation<__cr_private_Inf>,
impl<__cr_private_Inf> InteractionInformation<__cr_private_Inf> for Bacteriawhere
BacteriaReactions: InteractionInformation<__cr_private_Inf>,
§fn get_interaction_information(&self) -> __cr_private_Inf
fn get_interaction_information(&self) -> __cr_private_Inf
Get additional information of cellular properties (ie. for cell-specific interactions).
§impl<'py> IntoPyObject<'py> for Bacteria
impl<'py> IntoPyObject<'py> for Bacteria
§impl<__cr_private_Ri> Intracellular<__cr_private_Ri> for Bacteriawhere
BacteriaReactions: Intracellular<__cr_private_Ri>,
impl<__cr_private_Ri> Intracellular<__cr_private_Ri> for Bacteriawhere
BacteriaReactions: Intracellular<__cr_private_Ri>,
§fn get_intracellular(&self) -> __cr_private_Ri
fn get_intracellular(&self) -> __cr_private_Ri
Obtains the current intracellular values.
§fn set_intracellular(&mut self, concentration_vector: __cr_private_Ri)
fn set_intracellular(&mut self, concentration_vector: __cr_private_Ri)
Sets the current intracellular values.
§impl<__cr_private_Pos, __cr_private_Vel, __cr_private_For, __cr_private_Float> Mechanics<__cr_private_Pos, __cr_private_Vel, __cr_private_For, __cr_private_Float> for Bacteriawhere
NewtonDamped2D: Mechanics<__cr_private_Pos, __cr_private_Vel, __cr_private_For, __cr_private_Float>,
impl<__cr_private_Pos, __cr_private_Vel, __cr_private_For, __cr_private_Float> Mechanics<__cr_private_Pos, __cr_private_Vel, __cr_private_For, __cr_private_Float> for Bacteriawhere
NewtonDamped2D: Mechanics<__cr_private_Pos, __cr_private_Vel, __cr_private_For, __cr_private_Float>,
§fn calculate_increment(
&self,
force: __cr_private_For,
) -> Result<(__cr_private_Pos, __cr_private_Vel), CalcError>
fn calculate_increment( &self, force: __cr_private_For, ) -> Result<(__cr_private_Pos, __cr_private_Vel), CalcError>
Calculate the time-derivative of force and velocity given all the forces that act on the
cell.
Simple damping effects should be included in this trait if not explicitly given by the
SubDomainForce trait.
§fn get_random_contribution(
&self,
rng: &mut ChaCha8Rng,
dt: __cr_private_Float,
) -> Result<(__cr_private_Pos, __cr_private_Vel), RngError>
fn get_random_contribution( &self, rng: &mut ChaCha8Rng, dt: __cr_private_Float, ) -> Result<(__cr_private_Pos, __cr_private_Vel), RngError>
Define a new random variable in case that the mechanics type contains a random aspect to
its motion.
By default this function does nothing.
§impl<__cr_private_Pos> Position<__cr_private_Pos> for Bacteriawhere
NewtonDamped2D: Position<__cr_private_Pos>,
impl<__cr_private_Pos> Position<__cr_private_Pos> for Bacteriawhere
NewtonDamped2D: Position<__cr_private_Pos>,
§fn set_pos(&mut self, pos: &__cr_private_Pos)
fn set_pos(&mut self, pos: &__cr_private_Pos)
Gets the cells current velocity.
§impl PyTypeInfo for Bacteria
impl PyTypeInfo for Bacteria
§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Returns the PyTypeObject instance for this type.
§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
Returns the safe abstraction over the type object.
§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
Checks if
object is an instance of this type or a subclass of this type.§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
Checks if
object is an instance of this type.§impl<__cr_private_Ri> Reactions<__cr_private_Ri> for Bacteria
impl<__cr_private_Ri> Reactions<__cr_private_Ri> for Bacteria
§fn calculate_intracellular_increment(
&self,
intracellular: &__cr_private_Ri,
) -> Result<__cr_private_Ri, CalcError>
fn calculate_intracellular_increment( &self, intracellular: &__cr_private_Ri, ) -> Result<__cr_private_Ri, CalcError>
Calculates the purely intracellular reaction increment.
Users who implement this trait should always use the given argument instead of relying on
values obtained via
self.§impl Serialize for Bacteria
impl Serialize for Bacteria
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
§impl<__cr_private_Vel> Velocity<__cr_private_Vel> for Bacteriawhere
NewtonDamped2D: Velocity<__cr_private_Vel>,
impl<__cr_private_Vel> Velocity<__cr_private_Vel> for Bacteriawhere
NewtonDamped2D: Velocity<__cr_private_Vel>,
§fn set_velocity(&mut self, velocity: &__cr_private_Vel)
fn set_velocity(&mut self, velocity: &__cr_private_Vel)
Sets the cells current velocity.
impl DerefToPyAny for Bacteria
Auto Trait Implementations§
impl Freeze for Bacteria
impl RefUnwindSafe for Bacteria
impl Send for Bacteria
impl Sync for Bacteria
impl Unpin for Bacteria
impl UnwindSafe for Bacteria
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
Converts
self into an owned Python object, dropping type information.§fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
Converts
self into an owned Python object, dropping type information and unbinding it
from the 'py lifetime.§fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
Converts
self into a Python object. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
§const NAME: &'static str = T::NAME
const NAME: &'static str = T::NAME
👎Deprecated since 0.27.0: Use ::classinfo_object() instead and format the type name at runtime. Note that using built-in cast features is often better than manual PyTypeCheck usage.
Name of self. This is used in error messages, for example.
§fn type_check(object: &Bound<'_, PyAny>) -> bool
fn type_check(object: &Bound<'_, PyAny>) -> bool
§fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
Returns the expected type as a possible argument for the
isinstance and issubclass function. Read more§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.