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: NewtonDamped2D

See NewtonDamped2D mechanics

§cycle: BacteriaCycle§cellular_reactions: BacteriaReactions§interactionextracellulargradient: GradientSensing

Implementations§

§

impl Bacteria

pub fn from( py: Python<'_>, bacteria_template: BacteriaTemplate, ) -> Result<Bacteria, PyErr>

Available on crate feature 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.

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.

Conversion function of mass to volume

pub fn increase_volume(&mut self, volume_increment: f64)

Available on crate feature 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.

Obtain the current cell radius

Trait Implementations§

§

impl Clone for Bacteria

§

fn clone(&self) -> Bacteria

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Cycle<Bacteria> for BacteriaCycle

§

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>

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>

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
where BacteriaCycle: Cycle<Bacteria, __cr_private_Float>,

§

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>

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>

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 Debug for Bacteria

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<'de> Deserialize<'de> for Bacteria

§

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 Bacteria
where BacteriaReactions: Interaction<__cr_private_Pos, __cr_private_Vel, __cr_private_For, __cr_private_Inf>,

§

fn get_interaction_information(&self) -> __cr_private_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: &__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.
§

fn is_neighbor( &self, own_pos: &__cr_private_Pos, ext_pos: &__cr_private_Pos, ext_inf: &__cr_private_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.
§

impl InteractionExtracellularGradient<Bacteria, Matrix<Matrix<f64, Const<2>, Const<1>, ArrayStorage<f64, 2, 1>>, Const<cellular_raza_building_blocks::::cell_models::pool_bacteria::{impl#4}::{constant#0}>, Const<1>, ArrayStorage<Matrix<f64, Const<2>, Const<1>, ArrayStorage<f64, 2, 1>>, cellular_raza_building_blocks::::cell_models::pool_bacteria::{impl#4}::{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#4}::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#4}::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
where GradientSensing: InteractionExtracellularGradient<Bacteria, __cr_private_ExtraGradient>,

§

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 IntoPy<Py<PyAny>> for Bacteria

§

fn into_py(self, py: Python<'_>) -> Py<PyAny>

👎Deprecated since 0.23.0: IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.
Performs the conversion.
§

impl<'py> IntoPyObject<'py> for Bacteria

§

type Target = Bacteria

The Python output type
§

type Output = Bound<'py, <Bacteria as IntoPyObject<'py>>::Target>

The smart pointer type to use. Read more
§

type Error = PyErr

The type returned in the event of a conversion error.
§

fn into_pyobject( self, py: Python<'py>, ) -> Result<<Bacteria as IntoPyObject<'py>>::Output, <Bacteria as IntoPyObject<'py>>::Error>

Performs the conversion.
§

impl<__cr_private_Ri> Intracellular<__cr_private_Ri> for Bacteria
where BacteriaReactions: Intracellular<__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)

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 Bacteria
where 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>

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>

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 Bacteria
where NewtonDamped2D: Position<__cr_private_Pos>,

§

fn pos(&self) -> __cr_private_Pos

Gets the cells current position.
§

fn set_pos(&mut self, pos: &__cr_private_Pos)

Gets the cells current velocity.
§

impl PyClass for Bacteria

§

type Frozen = False

Whether the pyclass is frozen. Read more
§

impl PyTypeInfo for Bacteria

§

const NAME: &'static str = "Bacteria"

Class name.
§

const MODULE: Option<&'static str> = ::core::option::Option::None

Module name, if any.
§

fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject

Returns the PyTypeObject instance for this type.
§

fn type_object(py: Python<'_>) -> Bound<'_, PyType>

Returns the safe abstraction over the type object.
§

fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>

👎Deprecated since 0.23.0: renamed to PyTypeInfo::type_object
Deprecated name for [PyTypeInfo::type_object].
§

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_type_of_bound(object: &Bound<'_, PyAny>) -> bool

👎Deprecated since 0.23.0: renamed to PyTypeInfo::is_type_of
Deprecated name for [PyTypeInfo::is_type_of].
§

fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of this type.
§

fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool

👎Deprecated since 0.23.0: renamed to PyTypeInfo::is_exact_type_of
Deprecated name for [PyTypeInfo::is_exact_type_of].
§

impl<__cr_private_Ri> Reactions<__cr_private_Ri> for Bacteria
where BacteriaReactions: Reactions<__cr_private_Ri>, Bacteria: Intracellular<__cr_private_Ri>,

§

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

§

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 Bacteria
where NewtonDamped2D: Velocity<__cr_private_Vel>,

§

fn velocity(&self) -> __cr_private_Vel

Gets the cells current velocity.
§

fn set_velocity(&mut self, velocity: &__cr_private_Vel)

Sets the cells current velocity.
§

impl Volume for Bacteria

§

fn get_volume(&self) -> f64

Obtain the cells current volume.
§

impl DerefToPyAny for Bacteria

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromPyObject<'_> for T
where T: PyClass + Clone,

§

fn extract_bound(obj: &Bound<'_, PyAny>) -> Result<T, PyErr>

Extracts Self from the bound smart pointer obj. Read more
§

impl<'py, T> FromPyObjectBound<'_, 'py> for T
where T: FromPyObject<'py>,

§

fn from_py_object_bound(ob: Borrowed<'_, 'py, PyAny>) -> Result<T, PyErr>

Extracts Self from the bound smart pointer obj. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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
§

impl<'py, T> IntoPyObjectExt<'py> for T
where T: IntoPyObject<'py>,

§

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>

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>

Converts self into a Python object. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> PyErrArguments for T
where T: for<'py> IntoPyObject<'py> + Send + Sync,

§

fn arguments(self, py: Python<'_>) -> Py<PyAny>

Arguments for exception
§

impl<T> PyTypeCheck for T
where T: PyTypeInfo,

§

const NAME: &'static str = <T as PyTypeInfo>::NAME

Name of self. This is used in error messages, for example.
§

fn type_check(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of Self, which may include a subtype. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

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

Checks if self is actually part of its subset T (and can be converted to it).
§

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

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<Pos, Vel, For, Inf, Float, A> Agent<Pos, Vel, For, Inf, Float> for A
where Pos: PositionBound, For: ForceBound, Vel: VelocityBound, A: Cycle<A, Float> + Interaction<Pos, Vel, For, Inf> + Mechanics<Pos, Vel, For, Float> + Position<Pos> + Velocity<Vel> + Send + Sync + Clone + Serialize + for<'a> Deserialize<'a>,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> InteractionInformation for T
where T: Send + Sync + Clone + Debug,

§

impl<T> Ungil for T
where T: Send,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,