|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Forest-fire rule (Drossel & Schwabl, 1992). More...
#include <tpl_ca_stochastic_rules.H>
Public Types | |
| using | engine_type = Engine |
| Underlying RNG engine type. | |
Public Member Functions | |
| Forest_Fire_Rule (const double p_growth, const double p_lightning, std::uint64_t master_seed=0) | |
| Build a forest-fire rule with the given probabilities. | |
| double | p_growth () const noexcept |
| double | p_lightning () const noexcept |
| std::uint64_t | master_seed () const noexcept |
| void | set_master_seed (std::uint64_t s) noexcept |
| Replace the master seed; takes effect on the next step. | |
| template<typename State , std::size_t Rank> | |
| State | operator() (const State ¤t, Neighbor_View< State > neighbours, const Cell_Context< Rank > &ctx) const |
Compute the next forest-fire state for cell current. | |
Private Attributes | |
| double | p_growth_ |
| double | p_lightning_ |
| std::uint64_t | master_seed_ |
Forest-fire rule (Drossel & Schwabl, 1992).
Transition (synchronous, neighbourhood-defined by the engine):
BURNING → EMPTY.TREE → BURNING if at least one neighbour is BURNING, else BURNING with probability p_lightning, else stays TREE.EMPTY → TREE with probability p_growth, else stays EMPTY.Probabilities are sampled from a per-cell deterministic engine, so the trajectory only depends on master_seed, the initial frame and the chosen probabilities.
| Engine | RNG engine; defaults to std::mt19937_64. |
Definition at line 114 of file tpl_ca_stochastic_rules.H.
| using Aleph::CA::Forest_Fire_Rule< Engine >::engine_type = Engine |
Underlying RNG engine type.
Definition at line 122 of file tpl_ca_stochastic_rules.H.
|
inline |
Build a forest-fire rule with the given probabilities.
| [in] | p_growth | probability that an EMPTY cell grows a tree. |
| [in] | p_lightning | probability that a TREE ignites spontaneously when no neighbour is burning. |
| [in] | master_seed | master seed forwarded to cell_seed(). |
| std::domain_error | if p_growth or p_lightning is not in [0, 1]. |
Definition at line 133 of file tpl_ca_stochastic_rules.H.
References ah_domain_error_if, Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::Forest_Fire_Rule< Engine >::p_growth(), and Aleph::CA::Forest_Fire_Rule< Engine >::p_lightning().
|
inlinenoexcept |
Definition at line 155 of file tpl_ca_stochastic_rules.H.
References Aleph::CA::Forest_Fire_Rule< Engine >::master_seed_.
|
inline |
Compute the next forest-fire state for cell current.
| State | integral or enum-typed cell state convertible to Forest_Cell. |
| Rank | lattice rank carried by ctx. |
| [in] | current | current centre-cell state. |
| [in] | neighbours | read-only neighbour values. |
| [in] | ctx | per-cell context with step and coord. |
| Any | exception thrown by the RNG constructor. |
Definition at line 178 of file tpl_ca_stochastic_rules.H.
References Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::BURNING, Aleph::CA::EMPTY, Aleph::CA::Forest_Fire_Rule< Engine >::master_seed_, Aleph::CA::Forest_Fire_Rule< Engine >::p_growth_, Aleph::CA::Forest_Fire_Rule< Engine >::p_lightning_, Aleph::CA::TREE, and Aleph::CA::uniform_unit().
|
inlinenoexcept |
Definition at line 143 of file tpl_ca_stochastic_rules.H.
References Aleph::CA::Forest_Fire_Rule< Engine >::p_growth_.
Referenced by Aleph::CA::Forest_Fire_Rule< Engine >::Forest_Fire_Rule().
|
inlinenoexcept |
Definition at line 149 of file tpl_ca_stochastic_rules.H.
References Aleph::CA::Forest_Fire_Rule< Engine >::p_lightning_.
Referenced by Aleph::CA::Forest_Fire_Rule< Engine >::Forest_Fire_Rule().
|
inlinenoexcept |
Replace the master seed; takes effect on the next step.
Definition at line 161 of file tpl_ca_stochastic_rules.H.
References Aleph::CA::Forest_Fire_Rule< Engine >::master_seed_.
|
private |
Definition at line 118 of file tpl_ca_stochastic_rules.H.
Referenced by Aleph::CA::Forest_Fire_Rule< Engine >::master_seed(), Aleph::CA::Forest_Fire_Rule< Engine >::operator()(), and Aleph::CA::Forest_Fire_Rule< Engine >::set_master_seed().
|
private |
Definition at line 116 of file tpl_ca_stochastic_rules.H.
Referenced by Aleph::CA::Forest_Fire_Rule< Engine >::operator()(), and Aleph::CA::Forest_Fire_Rule< Engine >::p_growth().
|
private |
Definition at line 117 of file tpl_ca_stochastic_rules.H.
Referenced by Aleph::CA::Forest_Fire_Rule< Engine >::operator()(), and Aleph::CA::Forest_Fire_Rule< Engine >::p_lightning().