Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
ca_sir_epidemic_example.cc File Reference

Phase 8 example: SIR epidemic on a 2-D toroidal lattice. More...

#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <string>
#include <ca-rng.H>
#include <ca-traits.H>
#include <tpl_ca_engine.H>
#include <tpl_ca_lattice.H>
#include <tpl_ca_neighborhood.H>
#include <tpl_ca_storage.H>
#include <tpl_ca_stochastic_rules.H>
Include dependency graph for ca_sir_epidemic_example.cc:

Go to the source code of this file.

Functions

int main ()
 

Detailed Description

Phase 8 example: SIR epidemic on a 2-D toroidal lattice.

Runs the discrete-time SIR rule

S -> I  with probability 1 - (1 - beta)^k        (k infected nbrs)
I -> R  with probability gamma
R -> R                                            (immune)

for a 64x64 toroidal grid seeded with a single infected cell at the centre. The example contrasts two regimes:

  • "Subcritical" (R0 ~ 0.7): epidemic dies out rapidly.
  • "Supercritical" (R0 ~ 3.2): wavefront spreads radially until the supply of susceptibles is exhausted.

After every snapshot the example prints the lattice in ASCII plus the (S, I, R) tally and a tiny prevalence bar so the output reads like a printed epidemic curve.

Glyphs: '.' susceptible '*' infected '#' recovered

Definition in file ca_sir_epidemic_example.cc.

Function Documentation

◆ main()

int main ( void  )