@@ -40,8 +40,6 @@ int main()
4040
4141 double nb_total_t0 = 1000 , nb_inf_t0 = 10 ;
4242
43- auto integrator = std::make_shared<mio::EulerIntegratorCore<ScalarType>>();
44-
4543 // default model run to be compared against
4644 mio::osecir::Model model_a (1 );
4745 const auto indx_flow_SE =
@@ -56,7 +54,9 @@ int main()
5654 // set probability of transmission and risk of infection to 1.
5755 model_a.parameters .get <mio::osecir::TransmissionProbabilityOnContact<ScalarType>>() = 1.0 ;
5856 model_a.parameters .get <mio::osecir::RiskOfInfectionFromSymptomatic<ScalarType>>() = 1.0 ;
59- auto result_a = mio::simulate_flows<ScalarType>(t0, tmax, dt, model_a, integrator);
57+
58+ mio::EulerIntegratorCore<ScalarType> integrator;
59+ auto result_a = mio::simulate_flows<ScalarType>(t0, tmax, dt, model_a, integrator.clone ());
6060 result_a[1 ].print_table ({" S->E" , " E->I_NS" , " I_NS->I_Sy" , " I_NS->R" , " I_NSC->I_SyC" , " I_NSC->R" , " I_Sy->I_Sev" ,
6161 " I_Sy->R" , " I_SyC->I_Sev" , " I_SyC->R" , " I_Sev->I_Crit" , " I_Sev->R" , " I_Sev->D" ,
6262 " I_Crit->D" , " I_Crit->R" },
@@ -73,7 +73,8 @@ int main()
7373 mio::ContactMatrixGroup& contact_matrix_b = model_b.parameters .get <mio::osecir::ContactPatterns<ScalarType>>();
7474 contact_matrix_b[0 ] = mio::ContactMatrix (Eigen::MatrixXd::Constant (1 , 1 , cont_freq));
7575 contact_matrix_b[0 ].add_damping (0.5 , mio::SimulationTime (0 .)); // contact reduction happens here!
76- auto result_b = mio::simulate_flows<ScalarType>(t0, tmax, dt, model_b, integrator);
76+
77+ auto result_b = mio::simulate_flows<ScalarType>(t0, tmax, dt, model_b, integrator.clone ());
7778 result_b[1 ].print_table ({" S->E" , " E->I_NS" , " I_NS->I_Sy" , " I_NS->R" , " I_NSC->I_SyC" , " I_NSC->R" , " I_Sy->I_Sev" ,
7879 " I_Sy->R" , " I_SyC->I_Sev" , " I_SyC->R" , " I_Sev->I_Crit" , " I_Sev->R" , " I_Sev->D" ,
7980 " I_Crit->D" , " I_Crit->R" },
@@ -91,7 +92,8 @@ int main()
9192 mio::ContactMatrixGroup& contact_matrix_c = model_c.parameters .get <mio::osecir::ContactPatterns<ScalarType>>();
9293 contact_matrix_c[0 ] = mio::ContactMatrix (Eigen::MatrixXd::Constant (1 , 1 , cont_freq));
9394 contact_matrix_c[0 ].add_damping (1 ., mio::SimulationTime (0 .)); // contact reduction happens here!
94- auto result_c = mio::simulate_flows<ScalarType>(t0, tmax, dt, model_c, integrator);
95+
96+ auto result_c = mio::simulate_flows<ScalarType>(t0, tmax, dt, model_c, integrator.clone ());
9597 result_c[1 ].print_table ({" S->E" , " E->I_NS" , " I_NS->I_Sy" , " I_NS->R" , " I_NSC->I_SyC" , " I_NSC->R" , " I_Sy->I_Sev" ,
9698 " I_Sy->R" , " I_SyC->I_Sev" , " I_SyC->R" , " I_Sev->I_Crit" , " I_Sev->R" , " I_Sev->D" ,
9799 " I_Crit->D" , " I_Crit->R" },
@@ -109,7 +111,8 @@ int main()
109111 mio::ContactMatrixGroup& contact_matrix_d = model_d.parameters .get <mio::osecir::ContactPatterns<ScalarType>>();
110112 contact_matrix_d[0 ] = mio::ContactMatrix (Eigen::MatrixXd::Constant (1 , 1 , cont_freq));
111113 contact_matrix_d[0 ].add_damping (-1 ., mio::SimulationTime (0 .)); // contact increase happens here!
112- auto result_d = mio::simulate_flows<ScalarType>(t0, tmax, dt, model_d, integrator);
114+
115+ auto result_d = mio::simulate_flows<ScalarType>(t0, tmax, dt, model_d, integrator.clone ());
113116 result_d[1 ].print_table ({" S->E" , " E->I_NS" , " I_NS->I_Sy" , " I_NS->R" , " I_NSC->I_SyC" , " I_NSC->R" , " I_Sy->I_Sev" ,
114117 " I_Sy->R" , " I_SyC->I_Sev" , " I_SyC->R" , " I_Sev->I_Crit" , " I_Sev->R" , " I_Sev->D" ,
115118 " I_Crit->D" , " I_Crit->R" },
0 commit comments