template<typename Space, typename DemographicPolicy, typename MemoryPolicy>
class quetzal::demography::HistoryBase< Space, DemographicPolicy, MemoryPolicy >
Base class for simulating and recording spatial population history, encpasulating backward migration logic.
It makes use of the CRTP design pattern, meaning that this class has to be specialized to define History classes offering customized behaviors, like details of the demograhic algorithms (mass_based or individual_based) or storage aspects.
- Template Parameters
-
Space | Demes identifiers. |
DemographicPolicy | Policy Used for populations dynamics simulation algorithms, see demographic_policy |
MemoryPolicy | Policy used for storage and access to demographic quantities, see memory_policy |
|
| HistoryBase (coord_type const &x, value_type N, unsigned int nb_generations) |
| Constructor initializing the demographic database.
|
|
auto | distribution_area (time_type t) const |
| Retrieve demes where N > 0 at time t.
|
|
auto & | pop_size (coord_type const &x, time_type const &t) |
| Population size at deme x at time t.
|
|
auto | get_functor_N () const noexcept |
| Read-only functor.
|
|
auto | get_pop_size (coord_type const &x, time_type const &t) |
| Read-only.
|
|
void | set_pop_size (coord_type const &x, time_type const &t, value_type N) |
| Used in derived class History to increment migrants.
|
|
unsigned int const & | nb_generations () const |
| Last time recorded in the foward-in-time database history.
|
|
template<typename Generator > |
coord_type | backward_kernel (coord_type const &x, time_type t, Generator &gen) const |
| Samples a coordinate from the backward-in-time transition matrix.
|
|
template<typename Space , typename DemographicPolicy , typename MemoryPolicy >
template<typename Generator >
coord_type quetzal::demography::HistoryBase< Space, DemographicPolicy, MemoryPolicy >::backward_kernel |
( |
coord_type const & |
x, |
|
|
time_type |
t, |
|
|
Generator & |
gen |
|
) |
| const |
|
inline |
Samples a coordinate from the backward-in-time transition matrix.
The transition matrix is computed from the demographic flows database. The returned coordinate object will basically answer the question: when an individual is found in \(x\) at time \(t\), where could it have been at time \(t-1\) ?