Skip to content

Commit ee96b79

Browse files
HenrZumknaranjajubicker
authored
380 improve naming and avoid different transition times (#388)
Vast renaming of model parameters and infection states. Avoiding misleading or incorrect transition time inputs for ODE models. Co-authored-by: Martin Joachim Kühn <[email protected]> Co-authored-by: jubicker <[email protected]>
1 parent 4fc4f43 commit ee96b79

File tree

206 files changed

+6546
-6915
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

206 files changed

+6546
-6915
lines changed

cpp/benchmarks/integrator_step.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (cfg) 2020-2021 German Aerospace Center (DLR-SC)
2+
* Copyright (C) 2020-2023 German Aerospace Center (DLR-SC)
33
*
44
* Authors: Rene Schmieding
55
*
@@ -63,4 +63,4 @@ BENCHMARK_TEMPLATE(integrator_step, mio::ControlledStepperWrapper<boost::numeric
6363
BENCHMARK_TEMPLATE(integrator_step, mio::ControlledStepperWrapper<boost::numeric::odeint::runge_kutta_fehlberg78>)
6464
->Name("simulate SecirModel boost rkf78");
6565
// run all benchmarks
66-
BENCHMARK_MAIN();
66+
BENCHMARK_MAIN();

cpp/benchmarks/integrator_step.h

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020-2021 German Aerospace Center (DLR-SC)
2+
* Copyright (C) 2020-2023 German Aerospace Center (DLR-SC)
33
*
44
* Authors: Rene Schmieding
55
*
@@ -29,77 +29,77 @@ namespace mio
2929
{
3030
namespace benchmark
3131
{
32-
/// @brief parameters for integrator-step benchmark
33-
struct IntegratorStepConfig {
34-
int num_agegroups;
35-
double t_init, dt_init, abs_tol, rel_tol, dt_min, dt_max;
36-
Eigen::VectorXd yt, ytp1;
37-
/**
32+
/// @brief parameters for integrator-step benchmark
33+
struct IntegratorStepConfig {
34+
int num_agegroups;
35+
double t_init, dt_init, abs_tol, rel_tol, dt_min, dt_max;
36+
Eigen::VectorXd yt, ytp1;
37+
/**
3838
* @brief creates configuration with default parameters for a secir model
3939
* @return configuration for integrator-step benchmark
4040
*/
41-
static IntegratorStepConfig initialize()
42-
{
43-
const double vals[8] = {6377.873644, 35.249156, 30.029611, 182.145865,
44-
66.153059, 79.530621, 3069.383604, 159.634440};
45-
return IntegratorStepConfig{1,
46-
50,
47-
1,
48-
1e-10,
49-
1e-5,
50-
std::numeric_limits<double>::min(),
51-
std::numeric_limits<double>::max(),
52-
Eigen::Matrix<double, 8, 1>(vals),
53-
Eigen::VectorXd::Zero(8)};
54-
}
55-
/**
41+
static IntegratorStepConfig initialize()
42+
{
43+
const double vals[8] = {6377.873644, 35.249156, 30.029611, 182.145865,
44+
66.153059, 79.530621, 3069.383604, 159.634440};
45+
return IntegratorStepConfig{1,
46+
50,
47+
1,
48+
1e-10,
49+
1e-5,
50+
std::numeric_limits<double>::min(),
51+
std::numeric_limits<double>::max(),
52+
Eigen::Matrix<double, 8, 1>(vals),
53+
Eigen::VectorXd::Zero(8)};
54+
}
55+
/**
5656
* @brief reads configuration from json file
5757
* @param path the path of the configfile
5858
* @return configuration for integrator-step benchmark
5959
*/
60-
static IntegratorStepConfig initialize(std::string path)
61-
{
62-
auto result = mio::read_json(path, mio::Tag<IntegratorStepConfig>{});
63-
if (!result) { // failed to read config
64-
mio::log(mio::LogLevel::critical, result.error().formatted_message());
65-
abort();
66-
}
67-
return result.value();
68-
}
69-
/// @brief function implementing mio::deserialize, used by read_json in initialize
70-
template <class IOContext>
71-
static mio::IOResult<IntegratorStepConfig> deserialize(IOContext& io)
72-
{
73-
auto obj = io.expect_object("integrator_step");
74-
auto num_agegroups_io = obj.expect_element("num_agegroups", mio::Tag<int>{});
75-
auto t_init_io = obj.expect_element("t_init", mio::Tag<double>{});
76-
auto dt_init_io = obj.expect_element("dt_init", mio::Tag<double>{});
77-
auto abs_tol_io = obj.expect_element("abs_tol", mio::Tag<double>{});
78-
auto rel_tol_io = obj.expect_element("rel_tol", mio::Tag<double>{});
79-
auto dt_min_io = obj.expect_element("dt_min", mio::Tag<double>{});
80-
auto dt_max_io = obj.expect_element("dt_max", mio::Tag<double>{});
81-
auto yt_io = obj.expect_list("yt", mio::Tag<double>{});
82-
return mio::apply(
83-
io,
84-
[](auto&& num_agegroups, auto&& t_init, auto&& dt_init, auto&& abs_tol, auto&& rel_tol, auto&& dt_min,
85-
auto&& dt_max, auto&& yt) {
86-
IntegratorStepConfig cfg{num_agegroups,
87-
t_init,
88-
dt_init,
89-
abs_tol,
90-
rel_tol,
91-
dt_min,
92-
dt_max,
93-
Eigen::VectorXd::Zero(yt.size()),
94-
Eigen::VectorXd::Zero(yt.size())};
95-
for (size_t i = 0; i < yt.size(); i++) {
96-
cfg.yt[i] = yt[i];
97-
}
98-
return cfg;
99-
},
100-
num_agegroups_io, t_init_io, dt_init_io, abs_tol_io, rel_tol_io, dt_min_io, dt_max_io, yt_io);
60+
static IntegratorStepConfig initialize(std::string path)
61+
{
62+
auto result = mio::read_json(path, mio::Tag<IntegratorStepConfig>{});
63+
if (!result) { // failed to read config
64+
mio::log(mio::LogLevel::critical, result.error().formatted_message());
65+
abort();
10166
}
102-
};
67+
return result.value();
68+
}
69+
/// @brief function implementing mio::deserialize, used by read_json in initialize
70+
template <class IOContext>
71+
static mio::IOResult<IntegratorStepConfig> deserialize(IOContext& io)
72+
{
73+
auto obj = io.expect_object("integrator_step");
74+
auto num_agegroups_io = obj.expect_element("num_agegroups", mio::Tag<int>{});
75+
auto t_init_io = obj.expect_element("t_init", mio::Tag<double>{});
76+
auto dt_init_io = obj.expect_element("dt_init", mio::Tag<double>{});
77+
auto abs_tol_io = obj.expect_element("abs_tol", mio::Tag<double>{});
78+
auto rel_tol_io = obj.expect_element("rel_tol", mio::Tag<double>{});
79+
auto dt_min_io = obj.expect_element("dt_min", mio::Tag<double>{});
80+
auto dt_max_io = obj.expect_element("dt_max", mio::Tag<double>{});
81+
auto yt_io = obj.expect_list("yt", mio::Tag<double>{});
82+
return mio::apply(
83+
io,
84+
[](auto&& num_agegroups, auto&& t_init, auto&& dt_init, auto&& abs_tol, auto&& rel_tol, auto&& dt_min,
85+
auto&& dt_max, auto&& yt) {
86+
IntegratorStepConfig cfg{num_agegroups,
87+
t_init,
88+
dt_init,
89+
abs_tol,
90+
rel_tol,
91+
dt_min,
92+
dt_max,
93+
Eigen::VectorXd::Zero(yt.size()),
94+
Eigen::VectorXd::Zero(yt.size())};
95+
for (size_t i = 0; i < yt.size(); i++) {
96+
cfg.yt[i] = yt[i];
97+
}
98+
return cfg;
99+
},
100+
num_agegroups_io, t_init_io, dt_init_io, abs_tol_io, rel_tol_io, dt_min_io, dt_max_io, yt_io);
101+
}
102+
};
103103
} // namespace benchmark
104104

105105
} // namespace mio

0 commit comments

Comments
 (0)