-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1132 Rename public members of IDE model #1173
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,7 +84,7 @@ int main(int argc, char** argv) | |
init.add_time_point(init.get_last_time() + dt, | ||
Vec::Constant((int)mio::isecir::InfectionTransition::Count, 1. * dt)); | ||
} | ||
model.m_transitions = init; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you adjust in the example ide_secir lines 78+80+123+124 and in example ide_secir_ageres 64 - 69 + 124-125? |
||
model.flows = init; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please also adapt the README (with m_populations). And maybe transitions to flows. |
||
else { | ||
// Use the real data for initialization. | ||
|
@@ -100,8 +100,8 @@ int main(int argc, char** argv) | |
sim.advance(2.); | ||
|
||
// Print results. | ||
sim.get_transitions().print_table({"S->E", "E->C", "C->I", "C->R", "I->H", "I->R", "H->U", "H->R", "U->D", "U->R"}, | ||
16, 8); | ||
sim.get_flows().print_table({"S->E", "E->C", "C->I", "C->R", "I->H", "I->R", "H->U", "H->R", "U->D", "U->R"}, 16, | ||
8); | ||
|
||
return 0; | ||
} |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,22 +42,22 @@ class Model | |
/** | ||
* @brief Constructor to create an IDE-SECIR model. | ||
* | ||
* @param[in, out] init TimeSeries with the initial values of the number of individuals, | ||
* @param[in, out] flows_init TimeSeries with the initial values of the number of individuals, | ||
* which transit within one timestep dt from one compartment to another. | ||
* Possible transitions are specified in #InfectionTransition%s. | ||
* Considered time points should have the distance dt. The last time point determines the start time t0 of the | ||
* simulation. | ||
* The time history must reach a certain point in the past so that the simulation can be performed. | ||
* A warning is displayed if the condition is violated. | ||
* @param[in] N_init A vector, containing the populations of the considered region, for every AgeGroup. | ||
* @param[in] deaths A vector, containing the total number of deaths at time t0, for every AgeGroup. | ||
* @param[in] deaths_init A vector, containing the total number of deaths at time t0, for every AgeGroup. | ||
* @param[in] num_agegroups The number of AgeGroups. | ||
* @param[in] total_confirmed_cases A vector, containing the total confirmed cases at time t0 can be set if it | ||
* @param[in] total_confirmed_cases_init A vector, containing the total confirmed cases at time t0 can be set if it | ||
* should be used for initialization, for every AgeGroup. | ||
*/ | ||
Model(TimeSeries<ScalarType>&& init, CustomIndexArray<ScalarType, AgeGroup> N_init, | ||
CustomIndexArray<ScalarType, AgeGroup> deaths, size_t num_agegroups, | ||
CustomIndexArray<ScalarType, AgeGroup> total_confirmed_cases = CustomIndexArray<ScalarType, AgeGroup>()); | ||
Model(TimeSeries<ScalarType>&& flows_init, CustomIndexArray<ScalarType, AgeGroup> N_init, | ||
CustomIndexArray<ScalarType, AgeGroup> deaths_init, size_t num_agegroups, | ||
CustomIndexArray<ScalarType, AgeGroup> total_confirmed_cases_init = CustomIndexArray<ScalarType, AgeGroup>()); | ||
|
||
// ---- Additional functionality such as constraint checking, setters and getters, etc. ---- | ||
/** | ||
|
@@ -67,10 +67,10 @@ class Model | |
bool check_constraints(ScalarType dt) const; | ||
|
||
/** | ||
* @brief Returns a flat index for the InfectionTransition TimeSeries. | ||
* @brief Returns a flat index for the TimeSeries flows which contains values for the InfectionTransitions. | ||
* | ||
* In the TimeSeries we store a vector for each time point. In this vector we store the different | ||
* #InfectionTransition%s for every AgeGroup. | ||
* In the TimeSeries we store a vector for each time point. In this vector we store values for the different | ||
* InfectionTransitions for every AgeGroup. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not #InfectionTransition%s? |
||
* This function is used to get the right index in this vector for a specific AgeGroup and InfectionTransition. | ||
* | ||
* @param[in] transition_idx Index determining which InfectionTransition we want to evaluate. | ||
|
@@ -83,10 +83,10 @@ class Model | |
} | ||
|
||
/** | ||
* @brief Returns a flat index for the InfectionState TimeSeries. | ||
* @brief Returns a flat index for the TimeSeries populations which contains values for the InfectionStates. | ||
* | ||
* In the TimeSeries we store a vector for each time point. In this vector we store the different InfectionStates | ||
* for every AgeGroup. | ||
* In the TimeSeries we store a vector for each time point. In this vector we store values for the | ||
* different InfectionStates for every AgeGroup. | ||
* This function is used to get the right index in this vector for a specific AgeGroup and InfectionState. | ||
* | ||
* @param[in] state_idx Index at which InfectionState we want to evaluate. | ||
|
@@ -142,15 +142,15 @@ class Model | |
|
||
// ---- Public parameters. ---- | ||
ParameterSet parameters{AgeGroup(m_num_agegroups)}; ///< ParameterSet of Model Parameters. | ||
// Attention: m_populations and m_transitions do not necessarily have the same number of time points due to the | ||
// Attention: populations and flows do not necessarily have the same number of time points due to the | ||
// initialization part. | ||
TimeSeries<ScalarType> | ||
m_transitions; ///< TimeSeries containing points of time and the corresponding number of transitions for every | ||
// AgeGroup. | ||
TimeSeries<ScalarType> m_populations; ///< TimeSeries containing points of time and the corresponding number of | ||
flows; ///< TimeSeries containing points of time and the corresponding number of individuals transitioning from | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. flows and InfectionTransitions and Transitiondistributions are no longer linked by name. Do you think that's bad? I dont know how to feel about this. |
||
// one InfectionState to another as defined in InfectionTransitions for every AgeGroup. | ||
TimeSeries<ScalarType> populations; ///< TimeSeries containing points of time and the corresponding number of | ||
// people in defined #InfectionState%s for every AgeGroup. | ||
CustomIndexArray<ScalarType, AgeGroup> | ||
m_total_confirmed_cases; ///< CustomIndexArray that contains the total number of confirmed cases at time t0 for every AgeGroup. | ||
total_confirmed_cases; ///< CustomIndexArray that contains the total number of confirmed cases at time t0 for every AgeGroup. | ||
|
||
private: | ||
// ---- Functionality to calculate the sizes of the compartments for time t0. ---- | ||
|
@@ -165,7 +165,7 @@ class Model | |
* @param[in] dt Time discretization step size. | ||
* @param[in] idx_InfectionState Specifies the considered #InfectionState | ||
* @param[in] group The AgeGroup for which we want to compute. | ||
* @param[in] idx_IncomingFlow Specifies the index of the incoming flow to #InfectionState in m_transitions. | ||
* @param[in] idx_IncomingFlow Specifies the index of the incoming flow to #InfectionState in flows. | ||
* @param[in] idx_TransitionDistribution1 Specifies the index of the first relevant TransitionDistribution, | ||
* related to a flow from the considered #InfectionState to any other #InfectionState. | ||
* This index is also used for related probability. | ||
|
@@ -185,7 +185,7 @@ class Model | |
* | ||
* The values for the compartments Exposed, InfectedNoSymptoms, InfectedSymptoms, InfectedSevere and | ||
* InfectedCritical for time t_0 are calculated using the initial data in form of flows. | ||
* Calculated values are stored in m_populations. | ||
* Calculated values are stored in populations. | ||
* | ||
* @param[in] dt Time discretization step size. | ||
*/ | ||
|
@@ -214,10 +214,10 @@ class Model | |
|
||
// ---- Functionality for the iterations of a simulation. ---- | ||
/** | ||
* @brief Computes number of Susceptible%s for the current last time in m_populations. | ||
* @brief Computes number of Susceptible%s for the current last time in populations. | ||
* | ||
* Number is computed using previous number of Susceptible%s and the force of infection (also from previous timestep). | ||
* Number is stored at the matching index in m_populations. | ||
* Number is stored at the matching index in populations. | ||
* @param[in] dt Time discretization step size. | ||
*/ | ||
void compute_susceptibles(ScalarType dt); | ||
|
@@ -240,10 +240,10 @@ class Model | |
Eigen::Index current_time_index, AgeGroup group); | ||
|
||
/** | ||
* @brief Computes size of a flow for the current last time value in m_transitions. | ||
* @brief Computes size of a flow for the current last time value in flows. | ||
* | ||
* Computes size of one flow from #InfectionTransition, specified in idx_InfectionTransitions, for the current | ||
* last time value in m_transitions. | ||
* last time value in flows. | ||
* | ||
* @param[in] idx_InfectionTransitions Specifies the considered flow from #InfectionTransition. | ||
* @param[in] idx_IncomingFlow Index of the flow in #InfectionTransition, which goes to the considered starting | ||
|
@@ -256,9 +256,9 @@ class Model | |
AgeGroup group); | ||
|
||
/** | ||
* @brief Sets all required flows for the current last timestep in m_transitions. | ||
* @brief Sets all required flows for the current last timestep in flows. | ||
* | ||
* New values are stored in m_transitions. Most values are computed via the function compute_flow(). | ||
* New values are stored in flows. Most values are computed via the function compute_flow(). | ||
* | ||
* @param[in] dt Time step. | ||
*/ | ||
|
@@ -267,7 +267,7 @@ class Model | |
/** | ||
* @brief Updates the values of one compartment using flows. | ||
* | ||
* New value is stored in m_populations. The value is calculated using the compartment size in the previous | ||
* New value is stored in populations. The value is calculated using the compartment size in the previous | ||
* time step and the related flows of the current time step. | ||
* Therefore the flows of the current time step should be calculated before using this function. | ||
*/ | ||
|
@@ -278,22 +278,22 @@ class Model | |
/** | ||
* @brief Updates the values of all compartments except Susceptible at initialization. | ||
* | ||
* New values are stored in m_populations. The values are calculated using the compartment size in the previous | ||
* New values are stored in populations. The values are calculated using the compartment size in the previous | ||
* time step and the related flows of the current time step. | ||
* Therefore the flows of the current time step should be calculated before using this function. | ||
* | ||
*/ | ||
void update_compartments(); | ||
|
||
/** | ||
* @brief Computes force of infection for the current last time in m_transitions. | ||
* @brief Computes force of infection for the current last time in flows. | ||
* | ||
* Computed value is stored in m_forceofinfection. | ||
* | ||
* @param[in] dt Time discretization step size. | ||
* @param[in] initialization If true we are in the case of the initialization of the model. | ||
* For this we need forceofinfection at time point t0-dt and not at the current last time | ||
* (given by m_transitions) as in the other time steps. | ||
* (given by flows) as in the other time steps. | ||
*/ | ||
void compute_forceofinfection(ScalarType dt, bool initialization = false); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually adapt also the num_transitions in the ide examples and name them num_flows? Also in the tests? On the other hand this is consistent with InfectionTransition.. I dont know