Skip to main content

Model

Struct Model 

Source
pub struct Model {
    pub species: Vec<Species>,
    pub exchange: Vec<Exchange>,
    pub chemotaxis: Vec<Vec<f64>>,
    pub width: usize,
    pub height: usize,
    pub depth: usize,
    pub contact: Vec<f64>,
    pub types: Vec<CellType>,
    pub temperature: f64,
    pub neighbour_order: u8,
    pub seed: u64,
}
Expand description

The whole model: what a Blueprint would state, in one struct.

Fields§

§species: Vec<Species>

Diffusing species, in the order a description lists them.

§exchange: Vec<Exchange>

Secretion and uptake per cell type, index 0 the medium.

§chemotaxis: Vec<Vec<f64>>

Chemotactic sensitivity per cell type and species, index 0 the medium. Positive climbs a gradient.

§width: usize

Lattice width in sites.

§height: usize

Lattice height in sites.

§depth: usize

Lattice depth in sites. One is a plane, and every neighbourhood then drops its out-of-plane offsets.

§contact: Vec<f64>

Contact energies, row-major over (type_a, type_b), symmetric.

§types: Vec<CellType>

One entry per type, index 0 the medium.

§temperature: f64

Metropolis fluctuation amplitude, the Potts temperature.

§neighbour_order: u8

1 for the four von Neumann neighbours, 2 for the eight Moore ones.

§seed: u64

Random seed.

Implementations§

Source§

impl Model

Source

pub fn n_types(&self) -> usize

Number of cell types, counting the medium.

Source

pub fn dimensions(&self) -> usize

How many dimensions the lattice spans.

Source

pub fn has_motility(&self) -> bool

Whether any type keeps a memory of where it has been.

Source

pub fn has_external_potential(&self) -> bool

Whether any type drifts.

Source

pub fn has_connectivity(&self) -> bool

Whether any type refuses a copy that would pinch it.

Source

pub fn has_length_constraint(&self) -> bool

Whether any type constrains its length, so a run without one skips the moment bookkeeping.

Source

pub fn has_chemotaxis(&self) -> bool

Whether any type follows a gradient.

Source

pub fn has_population_events(&self) -> bool

Whether any type divides or dies, so a run without either skips the per-step scan over labels.

Source

pub fn contact_energy(&self, a: u8, b: u8) -> f64

Contact energy between two types.

Source

pub fn validate(&self) -> Result<(), String>

Check the shapes agree before a run starts.

§Errors

A message naming the first inconsistency found.

Trait Implementations§

Source§

impl Clone for Model

Source§

fn clone(&self) -> Model

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Model

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Model

Source§

fn default() -> Model

A one-site medium-only lattice at a temperature that runs. It exists so a caller states the terms it cares about and leaves the rest, which is what keeps a new energy term from touching every call site.

Auto Trait Implementations§

§

impl Freeze for Model

§

impl RefUnwindSafe for Model

§

impl Send for Model

§

impl Sync for Model

§

impl Unpin for Model

§

impl UnsafeUnpin for Model

§

impl UnwindSafe for Model

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, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.