|
| TimeSeries< FP > | calculate_compartments (const TimeSeries< FP > &subcompartments_ts) const |
| | Cumulates a simulation result with subcompartments to produce a result that divides the population only into the infection states defined in InfectionState. More...
|
| |
| bool | check_constraints () const |
| | Checks that the model satisfies all constraints (e.g. More...
|
| |
| void | get_derivatives (Eigen::Ref< const Eigen::VectorX< FP >> pop, Eigen::Ref< const Eigen::VectorX< FP >> y, FP t, Eigen::Ref< Eigen::VectorX< FP >> dydt) const override |
| | Evaluates the right-hand-side f of the ODE dydt = f(y, t). More...
|
| |
| | Model () |
| | Default constructor. More...
|
| |
| | Model (const Populations &pop, const ParameterSet ¶ms) |
| | Constructor using Populations and ParameterSet. More...
|
| |
| bool | apply_constraints () |
| | Checks whether the model satisfies all constraints. More...
|
| |
| bool | check_constraints () const |
| | Checks that the model satisfies all constraints (e.g. More...
|
| |
| | CompartmentalModel (CompartmentalModel &&)=default |
| |
| | CompartmentalModel (const CompartmentalModel &)=default |
| |
| | CompartmentalModel (Populations const &po, ParameterSet const &pa) |
| | CompartmentalModel default constructor. More...
|
| |
| void | eval_right_hand_side (Eigen::Ref< const Eigen::VectorX< FP >> pop, Eigen::Ref< const Eigen::VectorX< FP >> y, FP t, Eigen::Ref< Eigen::VectorX< FP >> dydt) const |
| | This function evaluates the right-hand-side f of the ODE dydt = f(y, t). More...
|
| |
| Eigen::VectorX< FP > | get_initial_values () const |
| | Get the initial conditions for the ODE dydt = f(y, t). More...
|
| |
| CompartmentalModel & | operator= (CompartmentalModel &&)=default |
| |
| CompartmentalModel & | operator= (const CompartmentalModel &)=default |
| |
| virtual | ~CompartmentalModel ()=default |
| |
|
| template<size_t Group = 0> |
| bool | check_constraints_impl () const |
| | Checks whether LctState of a group satisfies all constraints. More...
|
| |
| template<size_t Group = 0> |
| void | compress_vector (const Eigen::VectorX< FP > &subcompartments, Eigen::VectorX< FP > &compartments) const |
| | Converts a vector with subcompartments in a vector without subcompartments by summing up subcompartment values. More...
|
| |
| template<size_t Group = 0> |
| void | get_derivatives_impl (Eigen::Ref< const Eigen::VectorX< FP >> pop, Eigen::Ref< const Eigen::VectorX< FP >> y, FP t, Eigen::Ref< Eigen::VectorX< FP >> dydt) const |
| | Evaluates the right-hand-side f of the ODE dydt = f(y, t) recursively for each group. More...
|
| |
| template<size_t Group1, size_t Group2 = 0> |
| void | interact (Eigen::Ref< const Eigen::VectorX< FP >> pop, Eigen::Ref< const Eigen::VectorX< FP >> y, FP t, Eigen::Ref< Eigen::VectorX< FP >> dydt, double *part_a, double *part_b, int relevant_disease) const |
| | Calculates flows that are caused by people becoming infected (outflow from compartment S, Ra or Rb) for Group1. More...
|
| |
template<typename FP, class... LctStates>
class mio::lsecir2d::Model< FP, LctStates >
Class that defines an LCT-SECIR-2-DISEASE model.
- Template Parameters
-
| LctStates | The LCT2D model can work with any number of LctStates, where each LctState corresponds to a group, e.g. one AgeGroup. The purpose of the LctStates is to define the number of subcompartments for each InfectionState. If you do not want to divide the population into groups, just use one LctState. If you want to divide the population according to more than one category, e.g. sex and age, you have to specify one LctState for each pair of groups, e.g. for (female, A00-A04), (female, A05-A14) etc. This is because the number of subcompartments can be different for each group. Therefore, the number of LctStates also determines the number of groups. |
template<typename FP , class... LctStates>
Cumulates a simulation result with subcompartments to produce a result that divides the population only into the infection states defined in InfectionState.
If the model is used for simulation, we will get a result in form of a TimeSeries with infection states divided in subcompartments. The function calculates a TimeSeries without subcompartments from another TimeSeries with subcompartments. This is done by summing up the numbers in the subcompartments.
- Parameters
-
| [in] | subcompartments_ts | Result of a simulation with the model. |
- Returns
- Result of the simulation divided in infection states without subcompartments. Returns TimeSeries with values -1 if calculation is not possible.
template<typename FP , class... LctStates>
template<size_t Group = 0>
Checks whether LctState of a group satisfies all constraints.
Recursively, it checks that all groups satisfy the constraints.
- Template Parameters
-
| group | The group for which the constraints should be checked. |
- Returns
- Returns true if one or more constraints are not satisfied, false otherwise.
template<typename FP , class... LctStates>
template<size_t Group = 0>
| void mio::lsecir2d::Model< FP, LctStates >::compress_vector |
( |
const Eigen::VectorX< FP > & |
subcompartments, |
|
|
Eigen::VectorX< FP > & |
compartments |
|
) |
| const |
|
inlineprivate |
Converts a vector with subcompartments in a vector without subcompartments by summing up subcompartment values.
This is done recursively for each group which corresponds to a slice of the vector.
- Template Parameters
-
| group | The group specifying the slice of the vector being considered. |
- Parameters
-
| [in] | subcompartments | The vector that should be converted. |
| [out] | compartments | Reference to the vector where the output is stored. |
template<typename FP , class... LctStates>
| void mio::lsecir2d::Model< FP, LctStates >::get_derivatives |
( |
Eigen::Ref< const Eigen::VectorX< FP >> |
pop, |
|
|
Eigen::Ref< const Eigen::VectorX< FP >> |
y, |
|
|
FP |
t, |
|
|
Eigen::Ref< Eigen::VectorX< FP >> |
dydt |
|
) |
| const |
|
inlineoverridevirtual |
Evaluates the right-hand-side f of the ODE dydt = f(y, t).
The LCT-SECIR-2-DISEASE model is defined through ordinary differential equations of the form dydt = f(y, t). y is a vector containing the number of individuals for each (sub-) compartment. This function evaluates the right-hand-side f of the ODE and can be used in an ODE solver.
- Parameters
-
| [in] | pop | The current state of the population in the geographic unit we are considering. |
| [in] | y | The current state of the model (or a subpopulation) as a flat array. |
| [in] | t | The current time. |
| [out] | dydt | A reference to the calculated output. |
Reimplemented from mio::CompartmentalModel< FP, InfectionState, LctPopulations< FP, LctStates... >, Parameters< FP > >.
template<typename FP , class... LctStates>
template<size_t Group = 0>
| void mio::lsecir2d::Model< FP, LctStates >::get_derivatives_impl |
( |
Eigen::Ref< const Eigen::VectorX< FP >> |
pop, |
|
|
Eigen::Ref< const Eigen::VectorX< FP >> |
y, |
|
|
FP |
t, |
|
|
Eigen::Ref< Eigen::VectorX< FP >> |
dydt |
|
) |
| const |
|
inlineprivate |
Evaluates the right-hand-side f of the ODE dydt = f(y, t) recursively for each group.
See also the function get_derivative. For each group, one slice of the output vector is calculated.
- Template Parameters
-
| group | The group specifying the slice of the vector being considered.
|
- Parameters
-
| [in] | pop | The current state of the population in the geographic unit we are considering. |
| [in] | y | The current state of the model (or a subpopulation) as a flat array. |
| [in] | t | The current time. |
| [out] | dydt | A reference to the calculated output. |
template<typename FP , class... LctStates>
template<size_t Group1, size_t Group2 = 0>
| void mio::lsecir2d::Model< FP, LctStates >::interact |
( |
Eigen::Ref< const Eigen::VectorX< FP >> |
pop, |
|
|
Eigen::Ref< const Eigen::VectorX< FP >> |
y, |
|
|
FP |
t, |
|
|
Eigen::Ref< Eigen::VectorX< FP >> |
dydt, |
|
|
double * |
part_a, |
|
|
double * |
part_b, |
|
|
int |
relevant_disease |
|
) |
| const |
|
inlineprivate |
Calculates flows that are caused by people becoming infected (outflow from compartment S, Ra or Rb) for Group1.
This is done recursively by calculating the interaction terms with each group.
- Template Parameters
-
| Group1 | The group for which the derivative of the compartment should be calculated. |
| Group2 | The group that Group1 interacts with. |
- Parameters
-
| [in] | pop | The current state of the population in the geographic unit we are considering. |
| [in] | y | The current state of the model (or a subpopulation) as a flat array. |
| [in] | t | The current time. |
| [out] | dydt | A reference to the calculated output. The flow from Susceptible needs to be split into 2 parts for Exposed_1a and Exposed_1b: |
| [out] | part_a | Reference to amount of flow caused by people infected with disease a. |
| [out] | part_b | Reference to amount of flow caused by people infected with disease b. |
| [in] | relevant_disease | Index for which infected people cause the outflow (0 = a, 1 = b, 2 = a and b). |