@@ -768,12 +768,6 @@ TEST(TestOdeSECIRTS, set_divi_data_invalid_dates)
768768 // Assure that populations is the same as before.
769769 EXPECT_THAT (print_wrap (model_vector[0 ].populations .array ().cast <double >()),
770770 MatrixNear (print_wrap (model.populations .array ().cast <double >()), 1e-10 , 1e-10 ));
771-
772- // Test with data after DIVI dataset was no longer updated.
773- EXPECT_THAT (mio::osecirts::details::set_divi_data (model_vector, " " , {1001 }, {2025 , 12 , 01 }, 1.0 ), IsSuccess ());
774- EXPECT_THAT (print_wrap (model_vector[0 ].populations .array ().cast <double >()),
775- MatrixNear (print_wrap (model.populations .array ().cast <double >()), 1e-10 , 1e-10 ));
776-
777771 mio::set_log_level (mio::LogLevel::warn);
778772}
779773
@@ -802,7 +796,7 @@ TEST(TestOdeSECIRTS, set_confirmed_cases_data_with_ICU)
802796
803797 // Change dates of the case data so that no ICU data is available at that time.
804798 // Also, increase the number of confirmed cases by 1 each day.
805- const auto t0 = mio::Date (2025 , 1 , 1 );
799+ const auto t0 = mio::Date (2000 , 1 , 1 );
806800 auto day_add = 0 ;
807801 for (auto & entry : case_data) {
808802 entry.date = offset_date_by_days (t0, day_add);
@@ -1079,6 +1073,91 @@ TEST(TestOdeSECIRTS, model_initialization)
10791073 MatrixNear (print_wrap (expected_values), 1e-5 , 1e-5 ));
10801074}
10811075
1076+ TEST (TestOdeSECIRTS, set_vaccination_data_not_avail)
1077+ {
1078+ const auto num_age_groups = 2 ;
1079+ const auto num_days = 5 ;
1080+ mio::osecirts::Model<double > model (num_age_groups);
1081+ std::vector<mio::osecirts::Model<double >> model_vector = {model};
1082+
1083+ // Setup initial non-zero vaccination data
1084+ auto & params = model_vector[0 ].parameters ;
1085+ params.get <mio::osecirts::DailyPartialVaccinations<double >>().resize (mio::SimulationDay (num_days + 1 ));
1086+ params.get <mio::osecirts::DailyFullVaccinations<double >>().resize (mio::SimulationDay (num_days + 1 ));
1087+ params.get <mio::osecirts::DailyBoosterVaccinations<double >>().resize (mio::SimulationDay (num_days + 1 ));
1088+
1089+ const double initial_partial_vacc_val = 10.0 ;
1090+ const double initial_full_vacc_val = 5.0 ;
1091+ const double initial_booster_vacc_val = 2.0 ;
1092+
1093+ for (auto g = mio::AgeGroup (0 ); g < mio::AgeGroup (num_age_groups); ++g) {
1094+ for (auto d = mio::SimulationDay (0 ); d < mio::SimulationDay (num_days + 1 ); ++d) {
1095+ params.get <mio::osecirts::DailyPartialVaccinations<double >>()[{g, d}] = initial_partial_vacc_val;
1096+ params.get <mio::osecirts::DailyFullVaccinations<double >>()[{g, d}] = initial_full_vacc_val;
1097+ params.get <mio::osecirts::DailyBoosterVaccinations<double >>()[{g, d}] = initial_booster_vacc_val;
1098+ }
1099+ }
1100+
1101+ // Call set_vaccination_data with an unavailable date
1102+ mio::Date unavailable_date (2019 , 1 , 1 ); // Date before vaccinations started
1103+ std::vector<int > region = {1001 };
1104+ std::string any_path = " dummy_vacc_path.json" ;
1105+
1106+ auto result =
1107+ mio::osecirts::details::set_vaccination_data (model_vector, any_path, unavailable_date, region, num_days);
1108+
1109+ ASSERT_THAT (result, IsSuccess ());
1110+
1111+ // Check that vaccinations are set to zero for all days and age groups
1112+ for (auto d = mio::SimulationDay (0 ); d < mio::SimulationDay (num_days + 1 ); ++d) {
1113+ for (auto a = mio::AgeGroup (0 ); a < mio::AgeGroup (num_age_groups); ++a) {
1114+ auto partial_vacc = params.get <mio::osecirts::DailyPartialVaccinations<double >>()[{a, d}];
1115+ auto full_vacc = params.get <mio::osecirts::DailyFullVaccinations<double >>()[{a, d}];
1116+ auto booster_vacc = params.get <mio::osecirts::DailyBoosterVaccinations<double >>()[{a, d}];
1117+ EXPECT_NEAR (partial_vacc, 0.0 , 1e-10 );
1118+ EXPECT_NEAR (full_vacc, 0.0 , 1e-10 );
1119+ EXPECT_NEAR (booster_vacc, 0.0 , 1e-10 );
1120+ }
1121+ }
1122+ }
1123+
1124+ TEST (TestOdeSECIRTS, set_vaccination_data_min_date_not_avail)
1125+ {
1126+ mio::set_log_level (mio::LogLevel::off);
1127+
1128+ // create model
1129+ const auto num_age_groups = 1 ;
1130+ const auto num_days = 5 ;
1131+ mio::osecirts::Model<double > model (num_age_groups);
1132+ std::vector<mio::osecirts::Model<double >> model_vector = {model};
1133+ auto & params = model_vector[0 ].parameters ;
1134+
1135+ // create simple vaccination data
1136+ std::vector<mio::VaccinationDataEntry> vacc_data = {
1137+ mio::VaccinationDataEntry{10.0 , 5.0 , 2.0 , 0.0 , mio::Date (2021 , 1 , 15 ), mio::AgeGroup (0 ), {}, {}, {}}};
1138+
1139+ // simulation date before vaccination data
1140+ mio::Date earlier_date (2021 , 1 , 1 );
1141+ std::vector<int > region = {0 };
1142+
1143+ auto result = mio::osecirts::details::set_vaccination_data (model_vector, vacc_data, earlier_date, region, num_days);
1144+ ASSERT_THAT (result, IsSuccess ());
1145+
1146+ // check that vaccinations are set to zero for all days and age groups
1147+ for (auto d = mio::SimulationDay (0 ); d < mio::SimulationDay (num_days + 1 ); ++d) {
1148+ for (auto a = mio::AgeGroup (0 ); a < mio::AgeGroup (num_age_groups); ++a) {
1149+ auto partial_vacc = params.get <mio::osecirts::DailyPartialVaccinations<double >>()[{a, d}];
1150+ auto full_vacc = params.get <mio::osecirts::DailyFullVaccinations<double >>()[{a, d}];
1151+ auto booster_vacc = params.get <mio::osecirts::DailyBoosterVaccinations<double >>()[{a, d}];
1152+ EXPECT_NEAR (partial_vacc, 0.0 , 1e-10 );
1153+ EXPECT_NEAR (full_vacc, 0.0 , 1e-10 );
1154+ EXPECT_NEAR (booster_vacc, 0.0 , 1e-10 );
1155+ }
1156+ }
1157+
1158+ mio::set_log_level (mio::LogLevel::warn);
1159+ }
1160+
10821161#endif
10831162
10841163TEST (TestOdeSECIRTS, parameter_percentiles)
0 commit comments