pub struct SirGridModel;Expand description
The SIR epidemic as a GridModel.
Trait Implementations§
Source§impl Debug for SirGridModel
impl Debug for SirGridModel
Source§impl GridModel for SirGridModel
impl GridModel for SirGridModel
Source§const ID: &'static str = "sir"
const ID: &'static str = "sir"
Stable id that identifies the model in a model set, on the command line and in a spec file.
Source§const DESCRIPTION: &'static str = "Classic SIR compartmental model on a 2D grid with Moore neighborhood"
const DESCRIPTION: &'static str = "Classic SIR compartmental model on a 2D grid with Moore neighborhood"
One-line description shown in the UI.
Source§const NEIGHBORHOOD: NeighborhoodKind = NeighborhoodKind::Moore
const NEIGHBORHOOD: NeighborhoodKind = NeighborhoodKind::Moore
Neighbourhood whose cells
Self::step_cell receives.Source§const STATS: &'static [StatDescriptor]
const STATS: &'static [StatDescriptor]
Stat series for the history chart. Declared once, so
stats returns bare values.Source§const ACTIONS: &'static [ActionDescriptor] = ACTION_SPECS
const ACTIONS: &'static [ActionDescriptor] = ACTION_SPECS
One-off steps the user can trigger. Each gets a button in the Parameters panel.
Source§type Params = SirParams
type Params = SirParams
Hot parameters, extracted once per tick to keep enum matching out of the inner loop.
Source§fn param_descriptors() -> Vec<ParamDescriptor>
fn param_descriptors() -> Vec<ParamDescriptor>
Model parameters. The engine prepends grid width and height, but never shows them here.
Source§fn from_params(params: &[ParamValue]) -> SirParams
fn from_params(params: &[ParamValue]) -> SirParams
Extracts the hot parameters for one tick.
params is this model’s own slice, so its indices are 0 based.Source§fn init(grid: &mut Grid2D<u8>, params: &[ParamValue], rng: &mut u64)
fn init(grid: &mut Grid2D<u8>, params: &[ParamValue], rng: &mut u64)
Fills the grid for a new run. Read more
Source§fn step_cell(
cell: u8,
neighbors: &[u8],
params: &SirParams,
rng: &mut u64,
) -> u8
fn step_cell( cell: u8, neighbors: &[u8], params: &SirParams, rng: &mut u64, ) -> u8
Returns the next value of
cell, given its neighbours. Read moreAuto Trait Implementations§
impl Freeze for SirGridModel
impl RefUnwindSafe for SirGridModel
impl Send for SirGridModel
impl Sync for SirGridModel
impl Unpin for SirGridModel
impl UnsafeUnpin for SirGridModel
impl UnwindSafe for SirGridModel
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> 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