Sim C++

Sim C++ finds similarities within the code files.

File 1 File 2
src/IrishModel.cpp: line 101-350 src/TempModel.cpp: line 101-355 [1565]
for (unsigned int age = start_age; ag int nseed = startdist[age - start_age poparray[age].S -= nseed; // take dis poparray[age].E += nseed; // put dise } } Status IrishModel::Run(std::vector seed_pop = BuildPo std::vector> param parameter_fit[0][5] = fixedParameters_ std::vector poparray = B for (int tt{1}; tt < n_sim_steps; ++tt //initialize return value InfectionState infection_state; //identify the lock down if(tt > day_shut){ inLockdown = true; //introduce disease from background i if(!inLockdown && seedlist.seedmethod { //compute the total number of suscept GenerateDiseasedPopulation(poparray, } //compute the forces of infection std::vector lambda = Generate parameter_set, fixedParameters_[0].in // step each agegroup through infecti for ( int age{0}; age < n_agegroup; + InfectionState new_spread = GenerateInfectionSpread(poparray[age] fixedParameters_[age],parameter_fit[a ageGroupData_.cfr_byage[age], lambda[ infection_state.deaths += new_spread. infection_state.hospital_deaths += ne infection_state.detected += new_sprea } status.pop_array.push_back(poparray); status.simulation.push_back(infection status.deaths.push_back(infection_sta status.hospital_deaths.push_back(infe } //save the population in each epi comp for ( int age{0}; age < n_agegroup; ++ status.ends.push_back(poparray[age]); } return status; } void IrishModel::SetFixedParameters(con { fixedParameters_ = BuildFixedParamete } InfectionState IrishModel::GenerateInfe const int& n_hospitalised, params fix std::vector cfr_tab, double l { Compartments newpop(pop); // Fixed parameters const double T_lat= fixed_parameters. const double T_inf= fixed_parameters. const double T_rec= fixed_parameters. const double T_sym= fixed_parameters. const double T_hos= fixed_parameters. const double K=fixed_parameters.K; double capacity = n_hospitalised / K; capacity = std::min(1.0, capacity); const double p_h = cfr_tab[0]; const double p_d = cfr_tab[2]; const double p_s = parameter_set[Mode const double rrd = parameter_set[Mode // hospitalized const int outpatient = Flow(rng_, pop. const int newdeathsH = static_cast(rn const int mild = outClinical - severe; const int hospitalize = static_cast IrishModel::Generat const AgeGroupData& age_data, const s { double p_i = parameter_set[ModelParame double p_hcw = parameter_set[ModelPara double c_hcw = parameter_set[ModelPara double d_val = parameter_set[ModelPara double q_val = parameter_set[ModelPara int n_agegroup = age_data.waifw_norm.s std::vector lambda(n_agegroup) double quarantined = 0.0; // mean prop std::vector I_mat(n_agegroup); //contact matrix std::vector> waifw //age-dependent transmission rate std::vector> beta( if(shut) { for ( int from{0}; from < n_agegroup; { for ( int to{0}; to < n_agegroup; ++t { //contact network during shutdown per waifw[from][to] = (1.0-d_val) * age_d } } } for ( int from{0}; from < n_agegroup; for ( int to{0}; to < n_agegroup; ++t { if(waifw[from][to]>0) { quarantined += age_data.waifw_home[fr } else { quarantined += 0; } beta[from][to] = waifw[from][to] * p_ } } //mean proportion reduction in contac quarantined = 1 - (quarantined / stat //compute the pressure from infectiou //compute the pressure from hospitali for ( int from{0}; from < n_agegroup; if(from < (n_agegroup-1)) { //n-agegr // are considered those that are infe // asym are infectious pre-clinical a // sym are infectious plus those that int tot_asym = static_cast(pops[ for (size_t age = start_age; age < po int nseed = startdist[age - start_age poparray[age].S -= nseed; // take dis poparray[age].E += nseed; // put dise } } Status TempModel::Run(std::vector seed_pop = BuildPo std::vector> param parameter_fit[0][5] = fixedParameters_ std::vector poparray = B for (int tt{1}; tt < n_sim_steps; ++tt //initialize return value InfectionState infection_state; //identify the lock down if(tt > day_shut){ inLockdown = true; //introduce disease from background i if(!inLockdown && seedlist.seedmethod { //compute the total number of suscept GenerateDiseasedPopulation(poparray, } //compute the forces of infection std::vector lambda = Generate poparray, inLockdown); // step each agegroup through infecti for ( int age{0}; age < n_agegroup; + InfectionState new_spread = GenerateInfectionSpread(poparray[age] fixedParameters_[age],parameter_fit[a ageGroupData_.cfr_byage[age],lambda[a infection_state.deaths += new_spread. infection_state.hospital_deaths += ne infection_state.detected += new_sprea } status.pop_array.push_back(poparray); status.simulation.push_back(infection status.deaths.push_back(infection_sta status.hospital_deaths.push_back(infe } //save the population in each epi comp for ( int age{0}; age < n_agegroup; ++ status.ends.push_back(poparray[age]); } return status; } void TempModel::SetFixedParameters(cons { fixedParameters_ = BuildFixedParamete } InfectionState TempModel::GenerateInfec const int& n_hospitalised, params fix std::vector cfr_tab, double l { Compartments newpop(pop); // Fixed parameters const double T_lat= fixed_parameters. const double T_inf= fixed_parameters. const double T_rec= fixed_parameters. const double T_sym= fixed_parameters. const double T_hos= fixed_parameters. const double K=fixed_parameters.K; double capacity = n_hospitalised / K; capacity = std::min(1.0, capacity); const double p_h= cfr_tab[0]; const double p_d= cfr_tab[2]; const double p_s= parameter_set[Model const double rrd= parameter_set[Model // hospitalized const int outpatient = Flow(rng_, pop. const int newdeathsH = static_cast(rn const int mild = outClinical - severe; const int hospitalize = static_cast TempModel::Generate const AgeGroupData& age_data, const s { double p_i = parameter_set[ModelParame double p_hcw = parameter_set[ModelPara double c_hcw = parameter_set[ModelPara double d_val = parameter_set[ModelPara double q_val = parameter_set[ModelPara int n_agegroup = age_data.waifw_norm.s std::vector lambda(n_agegroup) double quarantined = 0.0; // mean prop std::vector I_mat(n_agegroup); //contact matrix std::vector> waifw //age-dependent transmission rate std::vector> beta( if(shut) { for ( int from{0}; from < n_agegroup; { for ( int to{0}; to < n_agegroup; ++t { //contact network during shutdown per waifw[from][to] = (1.0-d_val) * age_d } } } for ( int from{0}; from < n_agegroup; for ( int to{0}; to < n_agegroup; ++t { if(waifw[from][to]>0) { quarantined += age_data.waifw_home[fr } else { quarantined += 0; } beta[from][to] = waifw[from][to] * p_ } } //mean proportion reduction in contac quarantined = 1 - (quarantined / stat //compute the pressure from infectiou //compute the pressure from hospitali for ( int from{0}; from < n_agegroup; if(from < (n_agegroup-1)) { //n-agegr // are considered those that are infe // asym are infectious pre-clinical a // sym are infectious plus those that int tot_asym = pops[from].I_p + stati
src/OriginalModel.cpp: line 74-247 src/TempModel.cpp: line 74-266 [1152]
_temp[age].I_p += startdist[age - 1]; } } return _temp; } void OriginalModel::GenerateDiseasedPop std::vector& seedarray, const { size_t start_age = 1; int n_susc = 0; for (size_t age = start_age; age < po { seedarray[age - start_age] = static_c n_susc += poparray[age].S; } // how many diseased is introduced in // as a proportion of number of Susce // (not total population, only 20-70 int startdz = static_cast(rng_-> //unsigned int startdist[seedarray.si std::vector startdist(s rng_->Multinomial(seedarray.size(), s for (size_t age = start_age; age < po int nseed = startdist[age - start_age poparray[age].S -= nseed; // take dis poparray[age].E += nseed; // put dise } } Status OriginalModel::Run(std::vector seed_pop = BuildPo std::vector> param parameter_fit[0][5] = fixedParameters_ std::vector poparray = B for (int tt{1}; tt < n_sim_steps; ++tt //initialize return value InfectionState infection_state; //identify the lock down if(tt > day_shut){ inLockdown = true; //introduce disease from background i if(!inLockdown && seedlist.seedmethod { //compute the total number of suscept GenerateDiseasedPopulation(poparray, } //compute the forces of infection std::vector lambda = Generate poparray, inLockdown); // step each agegroup through infecti for ( int age{0}; age < n_agegroup; + InfectionState new_spread = GenerateInfectionSpread(poparray[age] fixedParameters_[age],parameter_fit[a ageGroupData_.cfr_byage[age], lambda[ infection_state.deaths += new_spread. infection_state.hospital_deaths += ne infection_state.detected += new_sprea } status.pop_array.push_back(poparray); status.simulation.push_back(infection status.deaths.push_back(infection_sta status.hospital_deaths.push_back(infe } //save the population in each epi comp for ( int age{0}; age < n_agegroup; ++ status.ends.push_back(poparray[age]); } return status; } void OriginalModel::SetFixedParameters( { fixedParameters_ = BuildFixedParamete } InfectionState OriginalModel::GenerateI const int& n_hospitalised, params fix std::vector cfr_tab, double l { Compartments newpop(pop); // Fixed parameters const double T_lat= fixed_parameters. const double T_inf= fixed_parameters. const double T_rec= fixed_parameters. const double T_sym= fixed_parameters. const double T_hos= fixed_parameters. const double K=fixed_parameters.K; double capacity = n_hospitalised / K; capacity = std::min(1.0, capacity); const double p_h = cfr_tab[0]; const double p_d = cfr_tab[2]; const double p_s = parameter_set[Mode const double rrd = parameter_set[Mode // hospitalized - non-frail const int outpatient = Flow(rng_, pop. const int newdeathsH = static_cast(rn const int mild = outClinical - severe; const int hospitalize = static_cast _temp[age].I_p += startdist[age]; // } } return _temp; } void TempModel::GenerateDiseasedPopulat std::vector& seedarray, const { size_t start_age = 0; int n_susc = 0; for (size_t age = start_age; age < po { seedarray[age - start_age] = static_c n_susc += poparray[age].S; } // how many diseased is introduced in // as a proportion of number of Susce int startdz = static_cast(rng_-> //unsigned int startdist[seedarray.si std::vector startdist(s rng_->Multinomial(seedarray.size(), s for (size_t age = start_age; age < po int nseed = startdist[age - start_age poparray[age].S -= nseed; // take dis poparray[age].E += nseed; // put dise } } Status TempModel::Run(std::vector seed_pop = BuildPo std::vector> param parameter_fit[0][5] = fixedParameters_ std::vector poparray = B for (int tt{1}; tt < n_sim_steps; ++tt //initialize return value InfectionState infection_state; //identify the lock down if(tt > day_shut){ inLockdown = true; //introduce disease from background i if(!inLockdown && seedlist.seedmethod { //compute the total number of suscept GenerateDiseasedPopulation(poparray, } //compute the forces of infection std::vector lambda = Generate poparray, inLockdown); // step each agegroup through infecti for ( int age{0}; age < n_agegroup; + InfectionState new_spread = GenerateInfectionSpread(poparray[age] fixedParameters_[age],parameter_fit[a ageGroupData_.cfr_byage[age],lambda[a infection_state.deaths += new_spread. infection_state.hospital_deaths += ne infection_state.detected += new_sprea } status.pop_array.push_back(poparray); status.simulation.push_back(infection status.deaths.push_back(infection_sta status.hospital_deaths.push_back(infe } //save the population in each epi comp for ( int age{0}; age < n_agegroup; ++ status.ends.push_back(poparray[age]); } return status; } void TempModel::SetFixedParameters(cons { fixedParameters_ = BuildFixedParamete } InfectionState TempModel::GenerateInfec const int& n_hospitalised, params fix std::vector cfr_tab, double l { Compartments newpop(pop); // Fixed parameters const double T_lat= fixed_parameters. const double T_inf= fixed_parameters. const double T_rec= fixed_parameters. const double T_sym= fixed_parameters. const double T_hos= fixed_parameters. const double K=fixed_parameters.K; double capacity = n_hospitalised / K; capacity = std::min(1.0, capacity); const double p_h= cfr_tab[0]; const double p_d= cfr_tab[2]; const double p_s= parameter_set[Model const double rrd= parameter_set[Model // hospitalized const int outpatient = Flow(rng_, pop. const int newdeathsH = static_cast(rn const int mild = outClinical - severe; const int hospitalize = static_cast
src/TempModel.cpp: line 84-266 src/OriginalModel.cpp: line 84-247[1113]
size_t start_age = 0; int n_susc = 0; for (size_t age = start_age; age < po { seedarray[age - start_age] = static_c n_susc += poparray[age].S; } // how many diseased is introduced in // as a proportion of number of Susce int startdz = static_cast(rng_-> //unsigned int startdist[seedarray.si std::vector startdist(s rng_->Multinomial(seedarray.size(), s for (size_t age = start_age; age < po int nseed = startdist[age - start_age poparray[age].S -= nseed; // take dis poparray[age].E += nseed; // put dise } } Status TempModel::Run(std::vector seed_pop = BuildPo std::vector> param parameter_fit[0][5] = fixedParameters_ std::vector poparray = B for (int tt{1}; tt < n_sim_steps; ++tt //initialize return value InfectionState infection_state; //identify the lock down if(tt > day_shut){ inLockdown = true; //introduce disease from background i if(!inLockdown && seedlist.seedmethod { //compute the total number of suscept GenerateDiseasedPopulation(poparray, } //compute the forces of infection std::vector lambda = Generate poparray, inLockdown); // step each agegroup through infecti for ( int age{0}; age < n_agegroup; + InfectionState new_spread = GenerateInfectionSpread(poparray[age] fixedParameters_[age],parameter_fit[a ageGroupData_.cfr_byage[age],lambda[a infection_state.deaths += new_spread. infection_state.hospital_deaths += ne infection_state.detected += new_sprea } status.pop_array.push_back(poparray); status.simulation.push_back(infection status.deaths.push_back(infection_sta status.hospital_deaths.push_back(infe } //save the population in each epi comp for ( int age{0}; age < n_agegroup; ++ status.ends.push_back(poparray[age]); } return status; } void TempModel::SetFixedParameters(cons { fixedParameters_ = BuildFixedParamete } InfectionState TempModel::GenerateInfec const int& n_hospitalised, params fix std::vector cfr_tab, double l { Compartments newpop(pop); // Fixed parameters const double T_lat= fixed_parameters. const double T_inf= fixed_parameters. const double T_rec= fixed_parameters. const double T_sym= fixed_parameters. const double T_hos= fixed_parameters. const double K=fixed_parameters.K; double capacity = n_hospitalised / K; capacity = std::min(1.0, capacity); const double p_h= cfr_tab[0]; const double p_d= cfr_tab[2]; const double p_s= parameter_set[Model const double rrd= parameter_set[Model // hospitalized const int outpatient = Flow(rng_, pop. const int newdeathsH = static_cast(rn const int mild = outClinical - severe; const int hospitalize = static_cast size_t start_age = 1; int n_susc = 0; for (size_t age = start_age; age < po { seedarray[age - start_age] = static_c n_susc += poparray[age].S; } // how many diseased is introduced in // as a proportion of number of Susce // (not total population, only 20-70 int startdz = static_cast(rng_-> //unsigned int startdist[seedarray.si std::vector startdist(s rng_->Multinomial(seedarray.size(), s for (size_t age = start_age; age < po int nseed = startdist[age - start_age poparray[age].S -= nseed; // take dis poparray[age].E += nseed; // put dise } } Status OriginalModel::Run(std::vector seed_pop = BuildPo std::vector> param parameter_fit[0][5] = fixedParameters_ std::vector poparray = B for (int tt{1}; tt < n_sim_steps; ++tt //initialize return value InfectionState infection_state; //identify the lock down if(tt > day_shut){ inLockdown = true; //introduce disease from background i if(!inLockdown && seedlist.seedmethod { //compute the total number of suscept GenerateDiseasedPopulation(poparray, } //compute the forces of infection std::vector lambda = Generate poparray, inLockdown); // step each agegroup through infecti for ( int age{0}; age < n_agegroup; + InfectionState new_spread = GenerateInfectionSpread(poparray[age] fixedParameters_[age],parameter_fit[a ageGroupData_.cfr_byage[age], lambda[ infection_state.deaths += new_spread. infection_state.hospital_deaths += ne infection_state.detected += new_sprea } status.pop_array.push_back(poparray); status.simulation.push_back(infection status.deaths.push_back(infection_sta status.hospital_deaths.push_back(infe } //save the population in each epi comp for ( int age{0}; age < n_agegroup; ++ status.ends.push_back(poparray[age]); } return status; } void OriginalModel::SetFixedParameters( { fixedParameters_ = BuildFixedParamete } InfectionState OriginalModel::GenerateI const int& n_hospitalised, params fix std::vector cfr_tab, double l { Compartments newpop(pop); // Fixed parameters const double T_lat= fixed_parameters. const double T_inf= fixed_parameters. const double T_rec= fixed_parameters. const double T_sym= fixed_parameters. const double T_hos= fixed_parameters. const double K=fixed_parameters.K; double capacity = n_hospitalised / K; capacity = std::min(1.0, capacity); const double p_h = cfr_tab[0]; const double p_d = cfr_tab[2]; const double p_s = parameter_set[Mode const double rrd = parameter_set[Mode // hospitalized - non-frail const int outpatient = Flow(rng_, pop. const int newdeathsH = static_cast(rn const int mild = outClinical - severe; const int hospitalize = static_cast
src/OriginalModel.cpp: line 270-379 src/TempModel.cpp: line 274-381 [775]
const int infectious_t = Flow(rng_, p newpop.E_t -= infectious_t; newpop.I_t += infectious_t; // susceptible const int newinfection = Flow(rng_, p newpop.S -= newinfection; newpop.E += newinfection; pop = newpop; // Define infection state for this sp InfectionState infection_state; infection_state.deaths += (newdeathsH infection_state.hospital_deaths += ne infection_state.detected += (hospital return infection_state; } std::vector OriginalModel::Gene const AgeGroupData& age_data, const s { double p_i = parameter_set[ModelParame double p_hcw = parameter_set[ModelPara double c_hcw = parameter_set[ModelPara double d_val = parameter_set[ModelPara double q_val = parameter_set[ModelPara //lambda=rep(NA,nrow(pops)) int n_agegroup = age_data.waifw_norm.s std::vector lambda(n_agegroup) double quarantined = 0.0; // mean prop std::vector I_mat(n_agegroup); //contact matrix std::vector> waifw //age-dependent transmission rate std::vector> beta( if(shut) { for ( int from{0}; from < n_agegroup; { for ( int to{0}; to < n_agegroup; ++t { //contact network during shutdown per waifw[from][to] = (1.0-d_val) * age_d } } } for ( int from{0}; from < n_agegroup; for ( int to{0}; to < n_agegroup; ++t { if(waifw[from][to]>0) { quarantined += age_data.waifw_home[fr } else { quarantined += 0; } beta[from][to] = waifw[from][to] * p_ } } //mean proportion reduction in contac quarantined = 1 - (quarantined / stat //compute the pressure from infectiou //compute the pressure from hospitali for ( int from{0}; from < n_agegroup; if(from < (n_agegroup-1)) { //n-agegr // are considered those that are infe // asym are infectious pre-clinical a // sym are infectious plus those that int tot_asym = pops[from].I_p + stati int tot_sym = pops[from].I_t + pops[f I_mat[from] = static_cast(tot //normalisation shouldnt account for const int tot_pop = accumulate_compar I_mat[from] = static_cast(I_m } //sum up of number of hospitalised ca inf_hosp+= pops[from].H ; } //sum up infectious pressure from eac for ( int to{0}; to < (n_agegroup); + for(int from{0}; from < (n_agegroup-1 lambda[to] += ( beta[to][from]*I_mat[ } } const int tot_pop = accumulate_compar //int rem_pop = pops[n_agegroup-1][4] lambda[n_agegroup-1] = p_hcw * c_hcw return lambda; } } // namespace Model } // namespace EERAModel const int infectious_t = Flow(rng_, p newpop.E_t -= infectious_t; newpop.I_t += infectious_t; // susceptible const int newinfection = Flow(rng_, p newpop.S -= newinfection; newpop.E += newinfection; pop = newpop; // Define infection state for this sp InfectionState infection_state; infection_state.deaths += (newdeathsH infection_state.hospital_deaths += ne infection_state.detected += (hospital return infection_state; } std::vector TempModel::Generate const AgeGroupData& age_data, const s { double p_i = parameter_set[ModelParame double p_hcw = parameter_set[ModelPara double c_hcw = parameter_set[ModelPara double d_val = parameter_set[ModelPara double q_val = parameter_set[ModelPara int n_agegroup = age_data.waifw_norm.s std::vector lambda(n_agegroup) double quarantined = 0.0; // mean prop std::vector I_mat(n_agegroup); //contact matrix std::vector> waifw //age-dependent transmission rate std::vector> beta( if(shut) { for ( int from{0}; from < n_agegroup; { for ( int to{0}; to < n_agegroup; ++t { //contact network during shutdown per waifw[from][to] = (1.0-d_val) * age_d } } } for ( int from{0}; from < n_agegroup; for ( int to{0}; to < n_agegroup; ++t { if(waifw[from][to]>0) { quarantined += age_data.waifw_home[fr } else { quarantined += 0; } beta[from][to] = waifw[from][to] * p_ } } //mean proportion reduction in contac quarantined = 1 - (quarantined / stat //compute the pressure from infectiou //compute the pressure from hospitali for ( int from{0}; from < n_agegroup; if(from < (n_agegroup-1)) { //n-agegr // are considered those that are infe // asym are infectious pre-clinical a // sym are infectious plus those that int tot_asym = pops[from].I_p + stati int tot_sym = pops[from].I_t + pops[f I_mat[from] = static_cast(tot //normalisation shouldnt account for const int tot_pop = accumulate_compar I_mat[from] = static_cast(I_m } //sum up of number of hospitalised ca inf_hosp+= pops[from].H ; } //sum up infectious pressure from eac for ( int to{0}; to < (n_agegroup); + for(int from{0}; from < (n_agegroup-1 lambda[to] += ( beta[to][from]*I_mat[ } } const int tot_pop = accumulate_compar lambda[n_agegroup-1] = p_hcw * c_hcw return lambda; } } // namespace Model } // namespace EERAModel
src/TempModel.cpp: line 267-355 src/IrishModel.cpp: line 263-350 [579]
const int newsymptomatic = static_cast const int newasymptomatic = outLatent newpop.E -= outLatent; newpop.I_p += newsymptomatic; newpop.I1 += newasymptomatic; const int infectious_t = Flow(rng_, p newpop.E_t -= infectious_t; newpop.I_t += infectious_t; // susceptible const int newinfection = Flow(rng_, p newpop.S -= newinfection; newpop.E += newinfection; pop = newpop; // Define infection state for this sp InfectionState infection_state; infection_state.deaths += (newdeathsH infection_state.hospital_deaths += ne infection_state.detected += (hospital return infection_state; } std::vector TempModel::Generate const AgeGroupData& age_data, const s { double p_i = parameter_set[ModelParame double p_hcw = parameter_set[ModelPara double c_hcw = parameter_set[ModelPara double d_val = parameter_set[ModelPara double q_val = parameter_set[ModelPara int n_agegroup = age_data.waifw_norm.s std::vector lambda(n_agegroup) double quarantined = 0.0; // mean prop std::vector I_mat(n_agegroup); //contact matrix std::vector> waifw //age-dependent transmission rate std::vector> beta( if(shut) { for ( int from{0}; from < n_agegroup; { for ( int to{0}; to < n_agegroup; ++t { //contact network during shutdown per waifw[from][to] = (1.0-d_val) * age_d } } } for ( int from{0}; from < n_agegroup; for ( int to{0}; to < n_agegroup; ++t { if(waifw[from][to]>0) { quarantined += age_data.waifw_home[fr } else { quarantined += 0; } beta[from][to] = waifw[from][to] * p_ } } //mean proportion reduction in contac quarantined = 1 - (quarantined / stat //compute the pressure from infectiou //compute the pressure from hospitali for ( int from{0}; from < n_agegroup; if(from < (n_agegroup-1)) { //n-agegr // are considered those that are infe // asym are infectious pre-clinical a // sym are infectious plus those that int tot_asym = pops[from].I_p + stati const int newsymptomatic = static_cast const int newasymptomatic = outLatent newpop.E -= outLatent; newpop.I_p += newsymptomatic; newpop.I1 += newasymptomatic; const int infectious_t = Flow(rng_, p newpop.E_t -= infectious_t; newpop.I_t += infectious_t; // susceptible const int newinfection = Flow(rng_, p newpop.S -= newinfection; newpop.E += newinfection; pop = newpop; // Define infection state for this sp InfectionState infection_state; infection_state.deaths += (newdeathsH infection_state.hospital_deaths += ne infection_state.detected += (hospital return infection_state; } std::vector IrishModel::Generat const AgeGroupData& age_data, const s { double p_i = parameter_set[ModelParame double p_hcw = parameter_set[ModelPara double c_hcw = parameter_set[ModelPara double d_val = parameter_set[ModelPara double q_val = parameter_set[ModelPara int n_agegroup = age_data.waifw_norm.s std::vector lambda(n_agegroup) double quarantined = 0.0; // mean prop std::vector I_mat(n_agegroup); //contact matrix std::vector> waifw //age-dependent transmission rate std::vector> beta( if(shut) { for ( int from{0}; from < n_agegroup; { for ( int to{0}; to < n_agegroup; ++t { //contact network during shutdown per waifw[from][to] = (1.0-d_val) * age_d } } } for ( int from{0}; from < n_agegroup; for ( int to{0}; to < n_agegroup; ++t { if(waifw[from][to]>0) { quarantined += age_data.waifw_home[fr } else { quarantined += 0; } beta[from][to] = waifw[from][to] * p_ } } //mean proportion reduction in contac quarantined = 1 - (quarantined / stat //compute the pressure from infectiou //compute the pressure from hospitali for ( int from{0}; from < n_agegroup; if(from < (n_agegroup-1)) { //n-agegr // are considered those that are infe // asym are infectious pre-clinical a // sym are infectious plus those that int tot_asym = static_cast(pops[
src/OriginalModel.cpp: line 8-73 src/IrishModel.cpp: line 8-73 [392]
: rng_(rng) { fixedParameters_ = BuildFixedParamete observations.waifw_norm.size(), commo ); ageGroupData_ = AgeGroupData{ observations.waifw_norm, observations.waifw_home, observations.waifw_sdist, observations.cfr_byage, observations.pf_pop[commonParameters. }; int regionalPopulation = GetPopulatio observations, commonParameters.herd_i ); int healthCareWorkers = ComputeNumber regionalPopulation, commonParameters. ); ageNums_ = ComputeAgeNums( commonParameters.herd_id, regionalPop ); (*log) << "[Model settings]" << std:: (*log) << " Model Structure: Original (*log) << " Population size: " << reg (*log) << " Number of HCW: " << health } std::vector OriginalModel::Buil { unsigned int end_age = age_nums.size( unsigned int start_age = 1; std::vector _temp; for (unsigned int age = start_age; ag { _temp.push_back(static_cast(a } return _temp; } std::vector OriginalModel const seed& seedlist) { unsigned int distribution_size = 6; std::vector _temp(age_n for (unsigned int age = 0; age < age_ { //set up the starting population as f _temp[age].S = age_nums[age]; } if(seedlist.seedmethod != "background { std::vector startdist(distributi startdist[static_cast(rng_->Flat for (unsigned int age = 1; age < age_ { _temp[age].S -= startdist[age - 1]; / : rng_(rng) { fixedParameters_ = BuildFixedParamete observations.waifw_norm.size(), commo ); ageGroupData_ = AgeGroupData{ observations.waifw_norm, observations.waifw_home, observations.waifw_sdist, observations.cfr_byage, observations.pf_pop[commonParameters. }; int regionalPopulation = GetPopulatio observations, commonParameters.herd_i ); int healthCareWorkers = ComputeNumber regionalPopulation, commonParameters. ); ageNums_ = ComputeAgeNums( commonParameters.herd_id, regionalPop ); (*log) << "[Model settings]" << std:: (*log) << " Model Structure: Irish" < (*log) << " Population size: " << reg (*log) << " Number of HCW: " << health } std::vector IrishModel::BuildPo { unsigned int end_age = age_nums.size( unsigned int start_age = 0; std::vector _temp; for (unsigned int age = start_age; ag { _temp.push_back(static_cast(a } return _temp; } std::vector IrishModel::B const seed& seedlist) { unsigned int distribution_size = 7; std::vector _temp(age_n for (unsigned int age = 0; age < age_ { //set up the starting population as f _temp[age].S = age_nums[age]; } if(seedlist.seedmethod != "background { std::vector startdist(distributi startdist[static_cast(rng_->Flat for (unsigned int age = 0; age < age_ { _temp[age].S -= startdist[age]; // ta
src/TempModel.cpp: line 3-60 src/IrishModel.cpp: line 3-60 [326]
namespace EERAModel { namespace Model { TempModel::TempModel(const CommonModelI const ObservationsForModels& observat : rng_(rng) { fixedParameters_ = BuildFixedParamete observations.waifw_norm.size(), commo ); ageGroupData_ = AgeGroupData{ observations.waifw_norm, observations.waifw_home, observations.waifw_sdist, observations.cfr_byage, observations.pf_pop[commonParameters. }; int regionalPopulation = GetPopulatio observations, commonParameters.herd_i ); int healthCareWorkers = ComputeNumber regionalPopulation, commonParameters. ); ageNums_ = ComputeAgeNums( commonParameters.herd_id, regionalPop ); (*log) << "[Model settings]" << std:: (*log) << " Model Structure: Temporar (*log) << " Population size: " << reg (*log) << " Number of HCW: " << health } std::vector TempModel::BuildPop { unsigned int end_age = age_nums.size( unsigned int start_age = 0; std::vector _temp; for (unsigned int age = start_age; ag { _temp.push_back(static_cast(a } return _temp; } std::vector TempModel::Bu const seed& seedlist) { unsigned int distribution_size = 7; std::vector _temp(age_n for (size_t age = 0; age < age_nums.s namespace EERAModel { namespace Model { IrishModel::IrishModel(const CommonMode const ObservationsForModels& observat : rng_(rng) { fixedParameters_ = BuildFixedParamete observations.waifw_norm.size(), commo ); ageGroupData_ = AgeGroupData{ observations.waifw_norm, observations.waifw_home, observations.waifw_sdist, observations.cfr_byage, observations.pf_pop[commonParameters. }; int regionalPopulation = GetPopulatio observations, commonParameters.herd_i ); int healthCareWorkers = ComputeNumber regionalPopulation, commonParameters. ); ageNums_ = ComputeAgeNums( commonParameters.herd_id, regionalPop ); (*log) << "[Model settings]" << std:: (*log) << " Model Structure: Irish" < (*log) << " Population size: " << reg (*log) << " Number of HCW: " << health } std::vector IrishModel::BuildPo { unsigned int end_age = age_nums.size( unsigned int start_age = 0; std::vector _temp; for (unsigned int age = start_age; ag { _temp.push_back(static_cast(a } return _temp; } std::vector IrishModel::B const seed& seedlist) { unsigned int distribution_size = 7; std::vector _temp(age_n for (unsigned int age = 0; age < age_
src/IrishModel.cpp: line 3-60 src/TempModel.cpp: line 3-60 [326]
namespace EERAModel { namespace Model { IrishModel::IrishModel(const CommonMode const ObservationsForModels& observat : rng_(rng) { fixedParameters_ = BuildFixedParamete observations.waifw_norm.size(), commo ); ageGroupData_ = AgeGroupData{ observations.waifw_norm, observations.waifw_home, observations.waifw_sdist, observations.cfr_byage, observations.pf_pop[commonParameters. }; int regionalPopulation = GetPopulatio observations, commonParameters.herd_i ); int healthCareWorkers = ComputeNumber regionalPopulation, commonParameters. ); ageNums_ = ComputeAgeNums( commonParameters.herd_id, regionalPop ); (*log) << "[Model settings]" << std:: (*log) << " Model Structure: Irish" < (*log) << " Population size: " << reg (*log) << " Number of HCW: " << health } std::vector IrishModel::BuildPo { unsigned int end_age = age_nums.size( unsigned int start_age = 0; std::vector _temp; for (unsigned int age = start_age; ag { _temp.push_back(static_cast(a } return _temp; } std::vector IrishModel::B const seed& seedlist) { unsigned int distribution_size = 7; std::vector _temp(age_n for (unsigned int age = 0; age < age_ namespace EERAModel { namespace Model { TempModel::TempModel(const CommonModelI const ObservationsForModels& observat : rng_(rng) { fixedParameters_ = BuildFixedParamete observations.waifw_norm.size(), commo ); ageGroupData_ = AgeGroupData{ observations.waifw_norm, observations.waifw_home, observations.waifw_sdist, observations.cfr_byage, observations.pf_pop[commonParameters. }; int regionalPopulation = GetPopulatio observations, commonParameters.herd_i ); int healthCareWorkers = ComputeNumber regionalPopulation, commonParameters. ); ageNums_ = ComputeAgeNums( commonParameters.herd_id, regionalPop ); (*log) << "[Model settings]" << std:: (*log) << " Model Structure: Temporar (*log) << " Population size: " << reg (*log) << " Number of HCW: " << health } std::vector TempModel::BuildPop { unsigned int end_age = age_nums.size( unsigned int start_age = 0; std::vector _temp; for (unsigned int age = start_age; ag { _temp.push_back(static_cast(a } return _temp; } std::vector TempModel::Bu const seed& seedlist) { unsigned int distribution_size = 7; std::vector _temp(age_n for (size_t age = 0; age < age_nums.s
src/IrishModel.h: line 8-147 src/TempModel.h: line 8-146 [278]
namespace EERAModel { namespace Model { class IrishModel : public ModelInterfac { public: using Sptr = std::shared_ptr parame int n_sim_steps) override; /** * @brief Set the fixed parameters in * * @param paramlist Fixed model parame */ void SetFixedParameters(const params& private: /** * @brief Construct the population see * * The population seed is constructed * - The final age category (HCW) are * - The first age category (< 20yo) i * * @param age_nums Vector containing t * * @return Seed population */ static std::vector BuildPopul /** * @brief Construct the population arr * * Sets up an array for the population * also set up the age distribution of * * @param age_nums Vector containing t * @param seedlist Seed object * * @return Vector of vectors containin */ std::vector BuildPopula const seed& seedlist); /** * @brief Introduced diseased to the p * * Compute the total number of suscept * * @param poparray Population array to * @param seedarray Population seed ar * @param bkg_lambda Lambda for genera * @param structure Model structure id */ void GenerateDiseasedPopulation(std:: std::vector& seedarray, const /** * @brief Generate vector of lambda va * * Creates lambda values based on comp * * @param inf_hosp Number of hospitali * @param parameter_set Set of model p * @param u_val * @param age_data Age group data set * @param pops Population array contai * @param shut State of lockdown */ static std::vector GenerateFo const AgeGroupData& age_data, const s /** * @brief Generate an infection spread * * Creates an infection spread state a * * @param pop Particular population ag * @param n_hospitalised Number of peo * @param fixed_parameters Fixed model * @param parameter_set Variable model * @param cfr_tab Case Fatality Ratio * @param pf_val Frailty Probability * @param lambda Rate of spread */ InfectionState GenerateInfectionSprea params fixed_parameters, std::vector parameter_set, st double lambda); /** * @private * @brief Random number generator */ Random::RNGInterface::Sptr rng_; /** * @private * @brief Numbers inside each age grou */ std::vector ageNums_; /** * @private * @brief Distribution of population a */ AgeGroupData ageGroupData_; /** * @private * @brief Fixed model parameters */ std::vector fixedP }; } // namespace Model } // namespace EERAModel namespace EERAModel { namespace Model { class TempModel : public ModelInterface { public: using Sptr = std::shared_ptr parame /** * @brief Set the fixed parameters in * * @param paramlist Fixed model parame */ void SetFixedParameters(const params& private: /** * @brief Construct the population see * * The population seed is constructed * - The final age category (HCW) are * - The first age category (< 20yo) i * * @param age_nums Vector containing t * * @return Seed population */ static std::vector BuildPopul /** * @brief Construct the population arr * * Sets up an array for the population * also set up the age distribution of * * @param age_nums Vector containing t * @param seedlist Seed object * * @return Vector of vectors containin */ std::vector BuildPopula const seed& seedlist); /** * @brief Introduced diseased to the p * * Compute the total number of suscept * * @param poparray Population array to * @param seedarray Population seed ar * @param bkg_lambda Lambda for genera * @param structure Model structure id */ void GenerateDiseasedPopulation(std:: std::vector& seedarray, const /** * @brief Generate vector of lambda va * * Creates lambda values based on comp * * @param inf_hosp Number of hospitali * @param parameter_set Set of model p * @param u_val * @param age_data Age group data set * @param pops Population array contai * @param shut State of lockdown */ static std::vector GenerateFo const AgeGroupData& age_data, const s /** * @brief Generate an infection spread * * Creates an infection spread state a * * @param pop Particular population ag * @param n_hospitalised Number of peo * @param fixed_parameters Fixed model * @param parameter_set Variable model * @param cfr_tab Case Fatality Ratio * @param pf_val Frailty Probability * @param lambda Rate of spread */ InfectionState GenerateInfectionSprea params fixed_parameters, std::vector parameter_set, st double lambda); /** * @private * @brief Random number generator */ Random::RNGInterface::Sptr rng_; /** * @private * @brief Numbers inside each age grou */ std::vector ageNums_; /** * @private * @brief Distribution of population a */ AgeGroupData ageGroupData_; /** * @private * @brief Fixed model parameters */ std::vector fixedP }; } // namespace Model } // namespace EERAModel
src/TempModel.h: line 8-146 src/IrishModel.h: line 8-147 [278]
namespace EERAModel { namespace Model { class TempModel : public ModelInterface { public: using Sptr = std::shared_ptr parame /** * @brief Set the fixed parameters in * * @param paramlist Fixed model parame */ void SetFixedParameters(const params& private: /** * @brief Construct the population see * * The population seed is constructed * - The final age category (HCW) are * - The first age category (< 20yo) i * * @param age_nums Vector containing t * * @return Seed population */ static std::vector BuildPopul /** * @brief Construct the population arr * * Sets up an array for the population * also set up the age distribution of * * @param age_nums Vector containing t * @param seedlist Seed object * * @return Vector of vectors containin */ std::vector BuildPopula const seed& seedlist); /** * @brief Introduced diseased to the p * * Compute the total number of suscept * * @param poparray Population array to * @param seedarray Population seed ar * @param bkg_lambda Lambda for genera * @param structure Model structure id */ void GenerateDiseasedPopulation(std:: std::vector& seedarray, const /** * @brief Generate vector of lambda va * * Creates lambda values based on comp * * @param inf_hosp Number of hospitali * @param parameter_set Set of model p * @param u_val * @param age_data Age group data set * @param pops Population array contai * @param shut State of lockdown */ static std::vector GenerateFo const AgeGroupData& age_data, const s /** * @brief Generate an infection spread * * Creates an infection spread state a * * @param pop Particular population ag * @param n_hospitalised Number of peo * @param fixed_parameters Fixed model * @param parameter_set Variable model * @param cfr_tab Case Fatality Ratio * @param pf_val Frailty Probability * @param lambda Rate of spread */ InfectionState GenerateInfectionSprea params fixed_parameters, std::vector parameter_set, st double lambda); /** * @private * @brief Random number generator */ Random::RNGInterface::Sptr rng_; /** * @private * @brief Numbers inside each age grou */ std::vector ageNums_; /** * @private * @brief Distribution of population a */ AgeGroupData ageGroupData_; /** * @private * @brief Fixed model parameters */ std::vector fixedP }; } // namespace Model } // namespace EERAModel namespace EERAModel { namespace Model { class IrishModel : public ModelInterfac { public: using Sptr = std::shared_ptr parame int n_sim_steps) override; /** * @brief Set the fixed parameters in * * @param paramlist Fixed model parame */ void SetFixedParameters(const params& private: /** * @brief Construct the population see * * The population seed is constructed * - The final age category (HCW) are * - The first age category (< 20yo) i * * @param age_nums Vector containing t * * @return Seed population */ static std::vector BuildPopul /** * @brief Construct the population arr * * Sets up an array for the population * also set up the age distribution of * * @param age_nums Vector containing t * @param seedlist Seed object * * @return Vector of vectors containin */ std::vector BuildPopula const seed& seedlist); /** * @brief Introduced diseased to the p * * Compute the total number of suscept * * @param poparray Population array to * @param seedarray Population seed ar * @param bkg_lambda Lambda for genera * @param structure Model structure id */ void GenerateDiseasedPopulation(std:: std::vector& seedarray, const /** * @brief Generate vector of lambda va * * Creates lambda values based on comp * * @param inf_hosp Number of hospitali * @param parameter_set Set of model p * @param u_val * @param age_data Age group data set * @param pops Population array contai * @param shut State of lockdown */ static std::vector GenerateFo const AgeGroupData& age_data, const s /** * @brief Generate an infection spread * * Creates an infection spread state a * * @param pop Particular population ag * @param n_hospitalised Number of peo * @param fixed_parameters Fixed model * @param parameter_set Variable model * @param cfr_tab Case Fatality Ratio * @param pf_val Frailty Probability * @param lambda Rate of spread */ InfectionState GenerateInfectionSprea params fixed_parameters, std::vector parameter_set, st double lambda); /** * @private * @brief Random number generator */ Random::RNGInterface::Sptr rng_; /** * @private * @brief Numbers inside each age grou */ std::vector ageNums_; /** * @private * @brief Distribution of population a */ AgeGroupData ageGroupData_; /** * @private * @brief Fixed model parameters */ std::vector fixedP }; } // namespace Model } // namespace EERAModel
src/TempModel.cpp: line 355-381 src/OriginalModel.cpp: line 352-379[256]
int tot_asym = pops[from].I_p + stati int tot_sym = pops[from].I_t + pops[f I_mat[from] = static_cast(tot //normalisation shouldnt account for const int tot_pop = accumulate_compar I_mat[from] = static_cast(I_m } //sum up of number of hospitalised ca inf_hosp+= pops[from].H ; } //sum up infectious pressure from eac for ( int to{0}; to < (n_agegroup); + for(int from{0}; from < (n_agegroup-1 lambda[to] += ( beta[to][from]*I_mat[ } } const int tot_pop = accumulate_compar lambda[n_agegroup-1] = p_hcw * c_hcw return lambda; } } // namespace Model } // namespace EERAModel int tot_asym = pops[from].I_p + stati int tot_sym = pops[from].I_t + pops[f I_mat[from] = static_cast(tot //normalisation shouldnt account for const int tot_pop = accumulate_compar I_mat[from] = static_cast(I_m } //sum up of number of hospitalised ca inf_hosp+= pops[from].H ; } //sum up infectious pressure from eac for ( int to{0}; to < (n_agegroup); + for(int from{0}; from < (n_agegroup-1 lambda[to] += ( beta[to][from]*I_mat[ } } const int tot_pop = accumulate_compar //int rem_pop = pops[n_agegroup-1][4] lambda[n_agegroup-1] = p_hcw * c_hcw return lambda; } } // namespace Model } // namespace EERAModel
src/IrishModel.cpp: line 350-376 src/OriginalModel.cpp: line 352-379[244]
int tot_asym = static_cast(pops[ int tot_sym = pops[from].I_t + pops[f I_mat[from] = static_cast(tot //normalisation shouldnt account for const int tot_pop = accumulate_compar I_mat[from] = static_cast(I_m } //sum up of number of hospitalised ca inf_hosp+= pops[from].H ; } //sum up infectious pressure from eac for ( int to{0}; to < (n_agegroup); + for(int from{0}; from < (n_agegroup-1 lambda[to] += ( beta[to][from]*I_mat[ } } const int tot_pop = accumulate_compar lambda[n_agegroup-1] = p_hcw * c_hcw return lambda; } } // namespace Model } // namespace EERAModel int tot_asym = pops[from].I_p + stati int tot_sym = pops[from].I_t + pops[f I_mat[from] = static_cast(tot //normalisation shouldnt account for const int tot_pop = accumulate_compar I_mat[from] = static_cast(I_m } //sum up of number of hospitalised ca inf_hosp+= pops[from].H ; } //sum up infectious pressure from eac for ( int to{0}; to < (n_agegroup); + for(int from{0}; from < (n_agegroup-1 lambda[to] += ( beta[to][from]*I_mat[ } } const int tot_pop = accumulate_compar //int rem_pop = pops[n_agegroup-1][4] lambda[n_agegroup-1] = p_hcw * c_hcw return lambda; } } // namespace Model } // namespace EERAModel
src/IO.cpp: line 347-376 src/IO.cpp: line 378-409 [195]
ImportConsistencyCheck(scot_frail_fil return observations; } std::vector ReadPosteriorParame { // Temporary matrix to hold data from std::vector> line char delimiter = ','; lines = Utilities::read_csv(f // Select line from input file and st if (set_selection >= static_cast std::stringstream SetSelectError; SetSelectError << "Parameter set sele throw std::overflow_error(SetSelectEr } std::vector line_select = lin auto first = line_select.cbegin() + 1 auto last = line_select.cend(); /** @todo Replace with constant from const int nPar = 8; if ((last - first) != nPar) { std::stringstream PosteriorFileFormat PosteriorFileFormatError << "Please c throw std::runtime_error(PosteriorFil } std::vector parameter_sets(fi return parameter_sets; } std::vector ReadPredictionParam { // Temporary matrix to hold data from std::vector> line char delimiter = ','; lines = Utilities::read_csv(f // Select line from input file and st if (index >= static_cast(lines.s std::stringstream SetSelectError; SetSelectError << "Parameter set sele throw std::overflow_error(SetSelectEr } std::vector line_select = lin // Skip the index column auto first = line_select.cbegin() + 1 auto last = line_select.cend(); // There are 16 columns in the file: const int nPar = 16; if ((last - first) != nPar) { std::stringstream PosteriorFileFormat PosteriorFileFormatError << "Please c throw std::runtime_error(PosteriorFil }
src/OriginalModel.h: line 24-116 src/TempModel.h: line 24-115 [190]
OriginalModel(const CommonModelInputP Random::RNGInterface::Sptr rng, Utili /** * @brief Run the model with the given * * @param parameter_set: set of parame * @param seedlist: seeding method to * @param day_shut: day of the lock do * @param n_sim_steps: Number of steps * * @return Status of model after run */ Status Run(std::vector parame int n_sim_steps) override; /** * @brief Set the fixed parameters in * * @param paramlist Fixed model parame */ void SetFixedParameters(const params& private: /** * @brief Construct the population see * * The population seed is constructed * - The final age category (HCW) are * - The first age category (< 20yo) a * * @param age_nums Vector containing t * * @return Seed population */ static std::vector BuildPopul /** * @brief Construct the population arr * * Sets up an array for the population * also set up the age distribution of * * @param age_nums Vector containing t * @param seedlist Seed object * * @return Vector of vectors containin */ std::vector BuildPopula const seed& seedlist); /** * @brief Introduced diseased to the p * * Compute the total number of suscept * * @param poparray Population array to * @param seedarray Population seed ar * @param bkg_lambda Lambda for genera */ void GenerateDiseasedPopulation(std:: std::vector& seedarray, const /** * @brief Generate vector of lambda va * * Creates lambda values based on comp * * @param inf_hosp Number of hospitali * @param parameter_set Set of model p * @param u_val * @param age_data Age group data set * @param pops Population array contai * @param shut State of lockdown */ static std::vector GenerateFo const AgeGroupData& age_data, const s /** * @brief Generate an infection spread * * Creates an infection spread state a * * @param pop Particular population ag * @param n_hospitalised Number of peo * @param fixed_parameters Fixed model * @param parameter_set Variable model * @param cfr_tab Case Fatality Ratio * @param pf_val Frailty Probability * @param lambda Rate of spread */ InfectionState GenerateInfectionSprea const int& n_hospitalised, ::EERAMode TempModel(const CommonModelInputParam Random::RNGInterface::Sptr rng, Utili /** * @brief Run the model with the given * * @param parameter_set: set of parame * @param seedlist: seeding method to * @param day_shut: day of the lock do * @param n_sim_steps: Number of steps * * @return Status of model after run */ Status Run(std::vector parame /** * @brief Set the fixed parameters in * * @param paramlist Fixed model parame */ void SetFixedParameters(const params& private: /** * @brief Construct the population see * * The population seed is constructed * - The final age category (HCW) are * - The first age category (< 20yo) i * * @param age_nums Vector containing t * * @return Seed population */ static std::vector BuildPopul /** * @brief Construct the population arr * * Sets up an array for the population * also set up the age distribution of * * @param age_nums Vector containing t * @param seedlist Seed object * * @return Vector of vectors containin */ std::vector BuildPopula const seed& seedlist); /** * @brief Introduced diseased to the p * * Compute the total number of suscept * * @param poparray Population array to * @param seedarray Population seed ar * @param bkg_lambda Lambda for genera * @param structure Model structure id */ void GenerateDiseasedPopulation(std:: std::vector& seedarray, const /** * @brief Generate vector of lambda va * * Creates lambda values based on comp * * @param inf_hosp Number of hospitali * @param parameter_set Set of model p * @param u_val * @param age_data Age group data set * @param pops Population array contai * @param shut State of lockdown */ static std::vector GenerateFo const AgeGroupData& age_data, const s /** * @brief Generate an infection spread * * Creates an infection spread state a * * @param pop Particular population ag * @param n_hospitalised Number of peo * @param fixed_parameters Fixed model * @param parameter_set Variable model * @param cfr_tab Case Fatality Ratio * @param pf_val Frailty Probability * @param lambda Rate of spread */ InfectionState GenerateInfectionSprea
src/IO.cpp: line 289-310 src/IO.cpp: line 320-347 [157]
ImportConsistencyCheck(scot_ages_file //mean number of daily contacts per a (*log) << "\t- " << waifw_norm_file < observations.waifw_norm = Utilities:: unsigned int waifw_norm_rows = observ unsigned int waifw_norm_cols = observ ImportConsistencyCheck(waifw_norm_fil ImportConsistencyCheck(waifw_norm_fil //mean number of daily contacts per a (*log) << "\t- " << waifw_home_file < observations.waifw_home = Utilities:: unsigned int waifw_home_rows = observ unsigned int waifw_home_cols = observ ImportConsistencyCheck(waifw_home_fil ImportConsistencyCheck(waifw_home_fil ImportConsistencyCheck(waifw_sdist_fi //Upload cfr by age group //col0: p_h: probability of hospitali //col1: cfr: case fatality ratio //col2: p_d: probability of death, gi //rows are for each age group: [0] Un (*log) << "\t- " << cfr_byage_file << observations.cfr_byage = Utilities::r unsigned int cfr_rows = observations. unsigned int cfr_cols = observations. ImportConsistencyCheck(cfr_byage_file ImportConsistencyCheck(cfr_byage_file //Upload frailty probability p_f by a //columns are for each age group: [0] //rows are for each individual Health //last row is for Scotland (*log) << "\t- " << scot_frail_file < observations.pf_pop = Utilities::read unsigned int pf_pop_rows = observatio unsigned int pf_pop_cols = observatio ImportConsistencyCheck(scot_frail_fil ImportConsistencyCheck(scot_frail_fil
src/TempModel.cpp: line 60-83 src/IrishModel.cpp: line 60-83 [154]
for (size_t age = 0; age < age_nums.s { //set up the starting population as f _temp[age].S = age_nums[age]; } if(seedlist.seedmethod != "background { std::vector startdist(distributi startdist[static_cast(rng_->Flat for (unsigned int age = 0; age < age_ { _temp[age].S -= startdist[age]; // ta _temp[age].I_p += startdist[age]; // } } return _temp; } void TempModel::GenerateDiseasedPopulat std::vector& seedarray, const { for (unsigned int age = 0; age < age_ { //set up the starting population as f _temp[age].S = age_nums[age]; } if(seedlist.seedmethod != "background { std::vector startdist(distributi startdist[static_cast(rng_->Flat for (unsigned int age = 0; age < age_ { _temp[age].S -= startdist[age]; // ta _temp[age].I_p += startdist[age]; // } } return _temp; } void IrishModel::GenerateDiseasedPopula std::vector& seedarray, const {
src/IO.cpp: line 121-129 src/IO.cpp: line 130-138 [120]
inferenceConfig.tau = ReadNumberFromF inferenceConfig.prior_pinf_shape1 = R inferenceConfig.prior_pinf_shape2 = R inferenceConfig.prior_phcw_shape1 = R inferenceConfig.prior_phcw_shape2 = R inferenceConfig.prior_chcw_mean = Rea inferenceConfig.prior_d_shape1 = Read inferenceConfig.prior_d_shape2 = Read inferenceConfig.prior_q_shape1 = Read inferenceConfig.prior_q_shape2 = Read inferenceConfig.prior_lambda_shape1 = inferenceConfig.prior_lambda_shape2 = inferenceConfig.prior_ps_shape1 = Rea inferenceConfig.prior_ps_shape2 = Rea inferenceConfig.prior_rrd_shape1 = Re inferenceConfig.prior_rrd_shape2 = Re
src/IrishModel.cpp: line 60-73 src/OriginalModel.cpp: line 60-73 [105]
for (unsigned int age = 0; age < age_ { //set up the starting population as f _temp[age].S = age_nums[age]; } if(seedlist.seedmethod != "background { std::vector startdist(distributi startdist[static_cast(rng_->Flat for (unsigned int age = 0; age < age_ { _temp[age].S -= startdist[age]; // ta for (unsigned int age = 0; age < age_ { //set up the starting population as f _temp[age].S = age_nums[age]; } if(seedlist.seedmethod != "background { std::vector startdist(distributi startdist[static_cast(rng_->Flat for (unsigned int age = 1; age < age_ { _temp[age].S -= startdist[age - 1]; /
src/IniFile.cpp: line 292-308 src/IniFile.cpp: line 347-363 [103]
return Save(FileName,content); // Sav } return false; // In the event the file } bool CIniFile::UnCommentRecord(std::str { std::vector content; // Holds if (Load(FileName, content)) // Make s { auto iter = std::find_if(content.begi content.end(), CIniFile::RecordSectionKeyIs(SectionN if (iter == content.end()) { return f return Save(FileName,content); // Sav } return false; // In the event the file } bool CIniFile::DeleteRecord(std::string { std::vector content; // Holds if (Load(FileName, content)) // Make s { auto iter = std::find_if(content.begi content.end(), CIniFile::RecordSectionKeyIs(SectionN if (iter == content.end()) { return f
src/IO.cpp: line 594-602 src/IO.cpp: line 603-611 [99]
} void LogGitVersionInfo(Utilities::loggi { (*log) << "[Git Versioning]" << std:: (*log) << " Commit SHA: " << GitMetad (*log) << " Commit Date: " << GitMeta (*log) << " Tag: " << GitMetadata::Ta (*log) << " Uncommitted changes: " << } void LogDependencyVersionInfo(Utilities { (*log) << "[Dependency Versioning]" < (*log) << " Compiler id: " << Depende (*log) << " Compiler version: " << De (*log) << " CMake version: " << Depen (*log) << " GSL version: " << Depende
src/IrishModel.cpp: line 89-101 src/OriginalModel.cpp: line 88-101 [96]
seedarray[age - start_age] = static_c n_susc += poparray[age].S; } // how many diseased is introduced in // as a proportion of number of Susce int startdz = static_cast(rng_-> //unsigned int startdist[seedarray.si std::vector startdist(s rng_->Multinomial(seedarray.size(), s for (unsigned int age = start_age; ag seedarray[age - start_age] = static_c n_susc += poparray[age].S; } // how many diseased is introduced in // as a proportion of number of Susce // (not total population, only 20-70 int startdz = static_cast(rng_-> //unsigned int startdist[seedarray.si std::vector startdist(s rng_->Multinomial(seedarray.size(), s for (size_t age = start_age; age < po
src/OriginalModel.cpp: line 248-258 src/TempModel.cpp: line 239-267 [91]
newpop.I2 -= I_from2_to_3; newpop.I3 += I_from2_to_3; const int I_from1_to_2 = Flow(rng_, p newpop.I1 -= I_from1_to_2; newpop.I2 += I_from1_to_2; // infectious - pre-clinical const int outpreclin = Flow(rng_, pop. const int newsymptomatic = static_cast newpop.I_p -= showsymptoms; newpop.I_s1 += showsymptoms; // asymptomatic const int recoverI = Flow(rng_, pop.I newpop.I1 -= recoverI; newpop.R += recoverI; /* const int recoverI = Flow(rng_, pop.I newpop.I4 -= recoverI; newpop.R += recoverI; const int I_from3_to_4 = Flow(rng_, p newpop.I3 -= I_from3_to_4; newpop.I4 += I_from3_to_4; const int I_from2_to_3=Flow(rng_, pop newpop.I2 -= I_from2_to_3; newpop.I3 += I_from2_to_3; const int I_from1_to_2 = Flow(rng_, p newpop.I1 -= I_from1_to_2; newpop.I2 += I_from1_to_2; */ // latent const int outLatent = Flow(rng_, pop. const int newsymptomatic = static_cast
src/IniFile.cpp: line 279-289 src/IniFile.cpp: line 417-427 [90]
bool CIniFile::CommentRecord(CommentCha { std::vector content; // Holds if (Load(FileName, content)) // Make s { auto iter = std::find_if(content.begi content.end(), CIniFile::RecordSectionKeyIs(SectionN if (iter == content.end()) { return f bool CIniFile::SetRecordComments(std::s { std::vector content; // Holds if (Load(FileName, content)) // Make s { auto iter = std::find_if(content.begi content.end(), CIniFile::RecordSectionKeyIs(SectionN if (iter == content.end()) { return f
src/IO.cpp: line 275-289 src/IO.cpp: line 299-310 [86]
ImportConsistencyCheck(scot_data_file ImportConsistencyCheck(scot_data_file //Uploading population per age group //columns are for each individual Hea //last column is for Scotland //rows are for each age group: [0] Un (*log) << "\t- " << scot_ages_file << observations.age_pop = Utilities::rea unsigned int age_pop_rows = observati unsigned int age_pop_cols = observati ImportConsistencyCheck(scot_ages_file ImportConsistencyCheck(scot_ages_file ImportConsistencyCheck(waifw_norm_fil ImportConsistencyCheck(waifw_norm_fil //mean number of daily contacts per a (*log) << "\t- " << waifw_home_file < observations.waifw_home = Utilities:: unsigned int waifw_home_rows = observ unsigned int waifw_home_cols = observ ImportConsistencyCheck(waifw_home_fil ImportConsistencyCheck(waifw_home_fil
src/IniFile.cpp: line 161-171 src/IniFile.cpp: line 279-289 [79]
bool CIniFile::RecordExists(std::string { std::vector content; // Holds if (Load(FileName, content)) // Make s { auto iter = std::find_if(content.begi content.end(), CIniFile::RecordSectionKeyIs(SectionN if (iter == content.end()) { return f bool CIniFile::CommentRecord(CommentCha { std::vector content; // Holds if (Load(FileName, content)) // Make s { auto iter = std::find_if(content.begi content.end(), CIniFile::RecordSectionKeyIs(SectionN if (iter == content.end()) { return f
src/PredictionFramework.cpp: line 7-20 src/InferenceFramework.cpp: line 10-22[77]
namespace EERAModel { namespace Prediction { PredictionFramework::PredictionFramewor Model::ModelInterface::Sptr model, const PredictionConfig& config, Random::RNGInterface::Sptr rng, const std::string& outDir, Utilities::logging_stream::Sptr log) : model_(model), config_(config), rng_(rng), outDir_(outDir), log_(log) {} namespace EERAModel { namespace Inference { InferenceFramework::InferenceFramework( const InferenceConfig& inferenceConfi Random::RNGInterface::Sptr rng, const std::string& outDir, Utilities::logging_stream::Sptr log) : model_(model), inferenceConfig_(inferenceConfig), rng_(rng), outDir_(outDir), log_(log) {
src/IO.cpp: line 327-334 src/IO.cpp: line 340-347 [77]
(*log) << "\t- " << cfr_byage_file << observations.cfr_byage = Utilities::r unsigned int cfr_rows = observations. unsigned int cfr_cols = observations. ImportConsistencyCheck(cfr_byage_file ImportConsistencyCheck(cfr_byage_file (*log) << "\t- " << scot_frail_file < observations.pf_pop = Utilities::read unsigned int pf_pop_rows = observatio unsigned int pf_pop_cols = observatio ImportConsistencyCheck(scot_frail_fil ImportConsistencyCheck(scot_frail_fil
src/InferenceFramework.cpp: line 10-22 src/PredictionFramework.cpp: line 7-20[77]
namespace EERAModel { namespace Inference { InferenceFramework::InferenceFramework( const InferenceConfig& inferenceConfi Random::RNGInterface::Sptr rng, const std::string& outDir, Utilities::logging_stream::Sptr log) : model_(model), inferenceConfig_(inferenceConfig), rng_(rng), outDir_(outDir), log_(log) { namespace EERAModel { namespace Prediction { PredictionFramework::PredictionFramewor Model::ModelInterface::Sptr model, const PredictionConfig& config, Random::RNGInterface::Sptr rng, const std::string& outDir, Utilities::logging_stream::Sptr log) : model_(model), config_(config), rng_(rng), outDir_(outDir), log_(log) {}
src/IO.cpp: line 313-320 src/IO.cpp: line 327-334 [77]
(*log) << "\t- " << waifw_sdist_file observations.waifw_sdist = Utilities: unsigned int waifw_sdist_rows = obser unsigned int waifw_sdist_cols = obser ImportConsistencyCheck(waifw_sdist_fi ImportConsistencyCheck(waifw_sdist_fi (*log) << "\t- " << cfr_byage_file << observations.cfr_byage = Utilities::r unsigned int cfr_rows = observations. unsigned int cfr_cols = observations. ImportConsistencyCheck(cfr_byage_file ImportConsistencyCheck(cfr_byage_file
src/OriginalModel.cpp: line 259-270 src/TempModel.cpp: line 268-279 [76]
int newasymptomatic = outpreclin - new newpop.I_p -= outpreclin; newpop.I_s1 += newsymptomatic; newpop.I1 += newasymptomatic; // latent const int infectious = Flow(rng_, pop newpop.E -= infectious; newpop.I_p += infectious; const int infectious_t = Flow(rng_, p const int newasymptomatic = outLatent newpop.E -= outLatent; newpop.I_p += newsymptomatic; newpop.I1 += newasymptomatic; const int infectious_t = Flow(rng_, p newpop.E_t -= infectious_t; newpop.I_t += infectious_t; // susceptible const int newinfection = Flow(rng_, p
src/IO.cpp: line 585-588 src/IO.cpp: line 589-592 [72]
(*log) << " p_inf: " << config.poster (*log) << " p_hcw: " << config.poster (*log) << " c_hcw: " << config.poster (*log) << " d: " << config.posterior_ (*log) << " q: " << config.posterior_ (*log) << " p_s: " << config.posterio (*log) << " rrd: " << config.posterio (*log) << " intro: " << config.poster
src/IO.cpp: line 527-531 src/IO.cpp: line 531-535 [72]
os << particle.parameter_set[Model::M os << particle.parameter_set[Model::M os << particle.parameter_set[Model::M os << particle.parameter_set[Model::M os << particle.parameter_set[Model::M os << particle.parameter_set[Model::M os << particle.parameter_set[Model::M os << particle.parameter_set[Model::M os << particle.parameter_set[Model::M os << particle.weight << std::endl;
src/IO.cpp: line 616-619 src/IO.cpp: line 620-623 [71]
(*log) << " latent period (theta_l): (*log) << " pre-adult probability of (*log) << " pre-clinical period (thet (*log) << " asymptomatic period (thet (*log) << " symptomatic period (theta (*log) << " hospitalisation stay (the (*log) << " bed capacity at hospital (*log) << " relative infectiousness o
src/IO.cpp: line 630-637 src/IO.cpp: line 638-645 [68]
ss << comp.S << ", "; ss << comp.E << ", "; ss << comp.E_t << ", "; ss << comp.I_p << ", "; ss << comp.I_t << ", "; ss << comp.I1 << ", "; ss << comp.I2 << ", "; ss << comp.I3 << ", "; ss << comp.I4 << ", "; ss << comp.I_s1 << ", "; ss << comp.I_s2 << ", "; ss << comp.I_s3 << ", "; ss << comp.I_s4 << ", "; ss << comp.H << ", "; ss << comp.R << ", "; ss << comp.D;
src/IniFile.cpp: line 253-265 src/IniFile.cpp: line 291-303 [64]
iter->Value = Value; // Insert the co return Save(FileName,content); // Sav } return false; // In the event the file } bool CIniFile::RenameSection(std::strin { std::vector content; // Holds if (Load(FileName, content)) // Make s { iter->Commented = cc; // Change the C return Save(FileName,content); // Sav } return false; // In the event the file } bool CIniFile::UnCommentRecord(std::str { std::vector content; // Holds if (Load(FileName, content)) // Make s {
src/IniFile.cpp: line 317-325 src/IniFile.cpp: line 391-399 [61]
bool CIniFile::CommentSection(char& Com { std::vector content; // Holds if (Load(FileName, content)) // Make s { for(auto iter = content.begin(); iter { if(iter->Section == SectionName) { // bool CIniFile::SetSectionComments(std:: { std::vector content; // Holds if (Load(FileName, content)) // Make s { for(auto iter = content.begin(); iter { if((iter->Section == SectionName) &&
src/IniFile.cpp: line 345-358 src/IniFile.cpp: line 383-396 [60]
} } return Save(FileName,content); // Sav } return false; // In the event the file } bool CIniFile::DeleteRecord(std::string { std::vector content; // Holds if (Load(FileName, content)) // Make s { } } return Save(FileName,content); // Sav } return false; // In the event the file } bool CIniFile::SetSectionComments(std:: { std::vector content; // Holds if (Load(FileName, content)) // Make s {
src/IniFile.cpp: line 194-202 src/IniFile.cpp: line 281-289 [60]
std::vector content; // Holds if (Load(FileName, content)) // Make s { auto iter = std::find_if(content.begi content.end(), CIniFile::RecordSectionKeyIs(SectionN if (iter == content.end()) { return d std::vector content; // Holds if (Load(FileName, content)) // Make s { auto iter = std::find_if(content.begi content.end(), CIniFile::RecordSectionKeyIs(SectionN if (iter == content.end()) { return f
src/IO.cpp: line 130-133 src/IO.cpp: line 135-138 [60]
inferenceConfig.prior_q_shape1 = Read inferenceConfig.prior_q_shape2 = Read inferenceConfig.prior_lambda_shape1 = inferenceConfig.prior_lambda_shape2 = inferenceConfig.prior_ps_shape1 = Rea inferenceConfig.prior_ps_shape2 = Rea inferenceConfig.prior_rrd_shape1 = Re inferenceConfig.prior_rrd_shape2 = Re
src/IO.cpp: line 197-207 src/IO.cpp: line 241-251 [59]
return predictionConfig; } ObservationsForInference ReadInferenceO { ObservationsForInference observations (*log) << "Observations For Inference const std::string scot_data_file = co const std::string scot_deaths_file = return observations; } ObservationsForModels ReadModelObservat { ObservationsForModels observations; (*log) << "Observations For Models:" const std::string scot_data_file = co const std::string scot_ages_file = co
src/IniFile.h: line 44-45 src/IniFile.h: line 46-47 [59]
static bool SetRecordComments(std::str static bool SetSectionComments(std::st static bool SetValue(std::string& KeyN static bool UnCommentRecord(std::strin
src/IniFile.cpp: line 266-279 src/IniFile.cpp: line 323-335 [58]
for(auto iter = content.begin(); iter < content.end(); iter++) // Loop { if(iter->Section == OldSectionName) { iter->Section = NewSectionName; // No } } return Save(FileName,content); // Sav } return false; // In the event the file } bool CIniFile::CommentRecord(CommentCha for(auto iter = content.begin(); iter { if(iter->Section == SectionName) { // iter->Commented = CommentChar; // Cha } } return Save(FileName,content); // Sav } return false; // In the event the file } bool CIniFile::UnCommentSection(std::st
src/IO.cpp: line 582-585 src/IO.cpp: line 616-619 [56]
(*log) << " n_iterations: " << config (*log) << " n_sim_steps: " << config. (*log) << " parameter index: " << con (*log) << " p_inf: " << config.poster (*log) << " latent period (theta_l): (*log) << " pre-adult probability of (*log) << " pre-clinical period (thet (*log) << " asymptomatic period (thet
src/Dependencies.cpp.in: line 5-23 src/Git.cpp.in: line 33-44 [56]
std::string DependencyVersions::CMakeVe { return "@CMAKE_VERSION@"; } std::string DependencyVersions::Compile { return "@CMAKE_CXX_COMPILER_ID@"; } std::string DependencyVersions::Compile { return "@CMAKE_CXX_COMPILER_VERSION@" } std::string DependencyVersions::GSLVers { return "@GSL_VERSION@"; } std::string GitMetadata::AuthorName() { return "@GIT_AUTHOR_NAME@"; } std::string GitMetadata::AuthorEmail() return "@GIT_AUTHOR_EMAIL@"; } std::string GitMetadata::CommitSHA1() { return "@GIT_HEAD_SHA1@"; } std::string GitMetadata::CommitDate() { return "@GIT_COMMIT_DATE_ISO8601@"; }
src/OriginalModel.h: line 116-146 src/TempModel.h: line 116-146 [56]
const int& n_hospitalised, ::EERAMode std::vector parameter_set, st double lambda); /** * @private * @brief Random number generator */ Random::RNGInterface::Sptr rng_; /** * @private * @brief Numbers inside each age grou */ std::vector ageNums_; /** * @private * @brief Distribution of population a */ AgeGroupData ageGroupData_; /** * @private * @brief Fixed model parameters */ std::vector fixedP }; } // namespace Model } // namespace EERAModel params fixed_parameters, std::vector parameter_set, st double lambda); /** * @private * @brief Random number generator */ Random::RNGInterface::Sptr rng_; /** * @private * @brief Numbers inside each age grou */ std::vector ageNums_; /** * @private * @brief Distribution of population a */ AgeGroupData ageGroupData_; /** * @private * @brief Fixed model parameters */ std::vector fixedP }; } // namespace Model } // namespace EERAModel
src/IniFile.cpp: line 220-228 src/IniFile.cpp: line 415-422 [55]
} bool CIniFile::SetValue(std::string& Ke { std::vector content; // Holds if (Load(FileName, content)) // Make s { } bool CIniFile::SetRecordComments(std::s { std::vector content; // Holds if (Load(FileName, content)) // Make s {
src/IniFile.h: line 78-93 src/IniFile.h: line 94-109 [53]
} }; struct AscendingSectionSort { bool operator()(Record& Start, Record { return Start.Section < End.Section; } }; struct DescendingSectionSort { bool operator()(Record& Start, Record { return Start.Section > End.Section; } }; struct AscendingRecordSort { bool operator()(Record& Start, Record { return Start.Key < End.Key; } }; struct DescendingRecordSort { bool operator()(Record& Start, Record { return Start.Key > End.Key;
src/IniFile.h: line 41-43 src/IniFile.h: line 46-48 [53]
static bool RecordExists(std::string& static bool RenameSection(std::string& static bool SectionExists(std::string& static bool SetValue(std::string& KeyN static bool UnCommentRecord(std::strin static bool UnCommentSection(std::stri
src/IniFile.h: line 34-36 src/IniFile.h: line 41-43 [53]
static bool Create(const std::string& static bool DeleteRecord(std::string& static bool DeleteSection(std::string& static bool RecordExists(std::string& static bool RenameSection(std::string& static bool SectionExists(std::string&
src/Observations.cpp: line 38-43 src/Observations.h: line 67-73 [52]
ObsSelect SelectObservations(int& day_s const std::vector& timeStamps, const std::vector& regionalCases, const std::vector& regionalDeaths int time_back, Utilities::logging_stream::Sptr log) ObsSelect SelectObservations( int& day_shut, const std::vector& timeStamps, const std::vector& regionalCases, const std::vector& regionalDeaths int time_back, Utilities::logging_stream::Sptr log);
src/Observations.h: line 67-73 src/Observations.cpp: line 38-43 [52]
ObsSelect SelectObservations( int& day_shut, const std::vector& timeStamps, const std::vector& regionalCases, const std::vector& regionalDeaths int time_back, Utilities::logging_stream::Sptr log); ObsSelect SelectObservations(int& day_s const std::vector& timeStamps, const std::vector& regionalCases, const std::vector& regionalDeaths int time_back, Utilities::logging_stream::Sptr log)
src/IniFile.cpp: line 335-343 src/IniFile.cpp: line 391-399 [51]
bool CIniFile::UnCommentSection(std::st { std::vector content; // Holds if (Load(FileName, content)) // Make s { for(auto iter = content.begin(); iter { if(iter->Section == SectionName) { // bool CIniFile::SetSectionComments(std:: { std::vector content; // Holds if (Load(FileName, content)) // Make s { for(auto iter = content.begin(); iter { if((iter->Section == SectionName) &&
src/IrishModel.cpp: line 73-83 src/TempModel.cpp: line 73-83 [51]
_temp[age].S -= startdist[age]; // ta _temp[age].I_p += startdist[age]; // } } return _temp; } void IrishModel::GenerateDiseasedPopula std::vector& seedarray, const { _temp[age].S -= startdist[age]; // ta _temp[age].I_p += startdist[age]; // } } return _temp; } void TempModel::GenerateDiseasedPopulat std::vector& seedarray, const {
src/IniFile.cpp: line 402-411 src/IniFile.cpp: line 429-438 [51]
if (Comments.size() >= 2) // Is there { if (Comments.substr(Comments.size()-2 Comments += "\n"; // If not, add one } } iter->Comments = Comments; // Set the return Save(FileName,content); // Sav } if (Comments.size() >= 2) // Is there { if (Comments.substr(Comments.size()-2 Comments += "\n"; // If not, add one } } iter->Comments = Comments; // Set the return Save(FileName,content); // Sav }
src/ModelTypes.h: line 118-122 src/ModelTypes.h: line 135-139 [50]
std::vector> cases; std::vector> age_p std::vector> waifw std::vector> waifw std::vector> waifw std::vector> waifw std::vector> waifw std::vector> waifw std::vector> cfr_b std::vector pf_byage; /*!< Fra
src/IO.cpp: line 229-233 src/IO.cpp: line 235-239 [49]
unsigned int cases_rows = observation unsigned int cases_cols = observation ImportConsistencyCheck(scot_data_file ImportConsistencyCheck(scot_data_file unsigned int deaths_rows = observatio unsigned int deaths_cols = observatio ImportConsistencyCheck(scot_deaths_fi ImportConsistencyCheck(scot_deaths_fi
src/IO.cpp: line 235-239 src/IO.cpp: line 272-276 [49]
unsigned int deaths_rows = observatio unsigned int deaths_cols = observatio ImportConsistencyCheck(scot_deaths_fi ImportConsistencyCheck(scot_deaths_fi unsigned int cases_rows = observation unsigned int cases_cols = observation ImportConsistencyCheck(scot_data_file ImportConsistencyCheck(scot_data_file
src/IO.cpp: line 566-571 src/IO.cpp: line 577-582 [49]
} void LogSeedSettings(const seed& params { (*log) << "[Disease seeding settings] (*log) << " seeding method: "<< param } void LogPredictionConfig(const Predicti { (*log) << "[Prediction Configuration] (*log) << " n_iterations: " << config
src/IO.cpp: line 35-42 src/IO.cpp: line 104-111 [48]
parameters.nCfrCategories = ReadNumbe parameters.nCasesDays = ReadNumberFro return parameters; } seed ReadSeedSettings(const std::string { commonParameters.herd_id = ReadNumber commonParameters.totN_hcw = ReadNumbe return commonParameters; } InferenceConfig ReadInferenceConfig(con {
src/InferenceFramework.h: line 96-112 src/PredictionFramework.h: line 17-32[47]
class InferenceFramework { public: /** * @brief Framework constructor * * @param model Model interface * @param inferenceConfig Inference co * @param rng Seeded random number gen * @param outDir Outputs directory pat * @param log Logger */ InferenceFramework(Model::ModelInterf const InferenceConfig& inferenceConfi Random::RNGInterface::Sptr rng, const std::string& outDir, Utilities::logging_stream::Sptr log); class PredictionFramework { public: /** * @brief Framework constructor * * @param model Model interface * @param config Prediction configurat * @param rng Seeded random number gen * @param log Logger */ PredictionFramework(Model::ModelInter const PredictionConfig& config, Random::RNGInterface::Sptr rng, const std::string& outDir, Utilities::logging_stream::Sptr log);
src/PredictionFramework.h: line 17-32 src/InferenceFramework.h: line 96-112[47]
class PredictionFramework { public: /** * @brief Framework constructor * * @param model Model interface * @param config Prediction configurat * @param rng Seeded random number gen * @param log Logger */ PredictionFramework(Model::ModelInter const PredictionConfig& config, Random::RNGInterface::Sptr rng, const std::string& outDir, Utilities::logging_stream::Sptr log); class InferenceFramework { public: /** * @brief Framework constructor * * @param model Model interface * @param inferenceConfig Inference co * @param rng Seeded random number gen * @param outDir Outputs directory pat * @param log Logger */ InferenceFramework(Model::ModelInterf const InferenceConfig& inferenceConfi Random::RNGInterface::Sptr rng, const std::string& outDir, Utilities::logging_stream::Sptr log);
src/IO.cpp: line 439-440 src/IO.cpp: line 444-445 [46]
for (unsigned int var = 0; var < part WriteSimuRow(output_simu, particleLis for (unsigned int age = 0; age < part WriteInferenceEndsRow(output_ends, pa
src/IniFile.cpp: line 127-135 src/IniFile.cpp: line 445-453 [46]
std::vector data; // Hold std::vector content; // Holds if (Load(FileName, content)) // Make s { for (const auto& iContent : content) { if(iContent.Key.empty()) { // If ther data.push_back(iContent.Section); // std::vector data; // Holds the std::vector content; // Holds if (Load(FileName, content)) // Make s { for (const auto& iContent : content) { if(iContent.Key.empty()) { // If this data.push_back(iContent); // Add the
src/IniFile.cpp: line 359-363 src/IniFile.cpp: line 423-427 [45]
auto iter = std::find_if(content.begi content.end(), CIniFile::RecordSectionKeyIs(SectionN if (iter == content.end()) { return f auto iter = std::find_if(content.begi content.end(), CIniFile::RecordSectionKeyIs(SectionN if (iter == content.end()) { return f
src/IO.cpp: line 76-79 src/IO.cpp: line 79-82 [44]
std::string SettingsCategory("Fixed p paramlist.T_lat = ReadNumberFromFile< paramlist.juvp_s = ReadNumberFromFile paramlist.T_inf = ReadNumberFromFile< paramlist.T_inf = ReadNumberFromFile< paramlist.T_rec = ReadNumberFromFile< paramlist.T_sym = ReadNumberFromFile< paramlist.T_hos = ReadNumberFromFile<
src/Git.cpp.in: line 32-41 src/Dependencies.cpp.in: line 8-23 [43]
} std::string GitMetadata::AuthorName() { return "@GIT_AUTHOR_NAME@"; } std::string GitMetadata::AuthorEmail() return "@GIT_AUTHOR_EMAIL@"; } std::string GitMetadata::CommitSHA1() { return "@GIT_HEAD_SHA1@"; } } std::string DependencyVersions::Compile { return "@CMAKE_CXX_COMPILER_ID@"; } std::string DependencyVersions::Compile { return "@CMAKE_CXX_COMPILER_VERSION@" } std::string DependencyVersions::GSLVers { return "@GSL_VERSION@"; }
src/InferenceFramework.cpp: line 26-35 src/InferenceFramework.cpp: line 36-45[42]
std::vector flag1 = { inferenceConfig.prior_pinf_shape1, inferenceConfig.prior_phcw_shape1, inferenceConfig.prior_chcw_mean, inferenceConfig.prior_d_shape1, inferenceConfig.prior_q_shape1, inferenceConfig.prior_ps_shape1, inferenceConfig.prior_rrd_shape1, inferenceConfig.prior_lambda_shape1 }; std::vector flag2 = { inferenceConfig.prior_pinf_shape2, inferenceConfig.prior_phcw_shape2, inferenceConfig.prior_chcw_mean, inferenceConfig.prior_d_shape2, inferenceConfig.prior_q_shape2, inferenceConfig.prior_ps_shape2, inferenceConfig.prior_rrd_shape2, inferenceConfig.prior_lambda_shape2 };
src/ArgumentParser.cpp: line 79-84 src/ArgumentParser.cpp: line 87-92 [42]
(*log) << ((_args.structure == ModelS } else { (*log) << "Default" << std::endl; } (*log) << "\t" << "Mode: " << ((_args } else { (*log) << "Default" << std::endl; }
src/IO.cpp: line 588-590 src/IO.cpp: line 590-592 [42]
(*log) << " d: " << config.posterior_ (*log) << " q: " << config.posterior_ (*log) << " p_s: " << config.posterio (*log) << " p_s: " << config.posterio (*log) << " rrd: " << config.posterio (*log) << " intro: " << config.poster
src/main.cpp: line 48-55 src/main.cpp: line 88-93 [42]
std::string modelConfigDir(std::strin ObservationsForModels modelObservatio // Log the disease seed settings IO::LogSeedSettings(supplementaryPara // Select the model structure to use Model::ModelInterface::Sptr model; std::string configDir(std::string(ROO InferenceConfig inferenceConfig = IO: IO::LogFixedParameters(commonParamete Inference::InferenceFramework framewo
src/IniFile.h: line 40-41 src/IniFile.h: line 45-46 [42]
static std::string GetValue(std::strin static bool RecordExists(std::string& static bool SetSectionComments(std::st static bool SetValue(std::string& KeyN
src/IniFile.cpp: line 143-149 src/IniFile.cpp: line 191-197 [42]
std::vector CIniFile: { std::vector data; // Holds the std::vector content; // Holds if (Load(FileName, content)) // Make s { std::vector CIniFile: { std::vector data; // Holds the std::vector content; // Holds if (Load(FileName, content)) // Make s {
src/IniFile.cpp: line 174-181 src/IniFile.cpp: line 333-340 [41]
} bool CIniFile::SectionExists(std::strin { std::vector content; // Holds if (Load(FileName, content)) // Make s { } bool CIniFile::UnCommentSection(std::st { std::vector content; // Holds if (Load(FileName, content)) // Make s {
src/IO.cpp: line 250-253 src/IO.cpp: line 254-257 [40]
const std::string scot_data_file = co const std::string scot_ages_file = co const std::string waifw_norm_file = c const std::string waifw_home_file = c const std::string waifw_sdist_file = const std::string cfr_byage_file = co const std::string scot_frail_file = c const std::string settings_file = con
src/InferenceFramework.h: line 139-140 src/InferenceFramework.cpp: line 175-176[40]
void ModelSelect(EERAModel::particle& seed seedlist, int day_shut, const st void InferenceFramework::ModelSelect(EE seed seedlist, int day_shut, const std
src/InferenceParameters.cpp: line 14-19 src/InferenceParameters.cpp: line 43-48[40]
std::vector InferenceParameterG { std::vector parameterSet(Mode for (unsigned int i = 0; i < Model::M { const std::vector& kern { std::vector parameterSet(Mode for (unsigned int i = 0; i < Model::M {
src/InferenceFramework.cpp: line 175-176 src/InferenceFramework.h: line 139-140[40]
void InferenceFramework::ModelSelect(EE seed seedlist, int day_shut, const std void ModelSelect(EERAModel::particle& seed seedlist, int day_shut, const st
src/IO.h: line 186-208 src/IO.h: line 241-264 [39]
void WritePredictionFullHeader(std::ost /** * @brief Write header row for inferenc * * Writes inference end state file head * * @param os Stream to write the header */ void WriteInferenceEndsHeader(std::ostr /** * @brief Write data row for prediction * * Writes @p iter, @p day, @p age_group * * @param os Stream to write the row to * @param iter Iteration number * @param day Day number * @param age_group Age group number * @param comp Epidemiological compartm */ void WritePredictionFullRow(std::ostrea void WriteInferenceParticlesHeader(std: /** * @brief Write header row for predicti * * Writes prediction simulation file he * * @param os Stream to write the header */ void WriteSimuHeader(std::ostream& os); /** * @brief Write header row for predicti * * Writes @p iter, @p day, @p inc_case, * * @param os Stream to write the header * @param iter Iteration number * @param day Day number * @param inc_case Number of cases * @param inc_death_hospital Deaths in * @param inc_death Deaths */ void WriteSimuRow(std::ostream& os, int
src/IO.cpp: line 103-105 src/IO.cpp: line 117-120 [38]
commonParameters.paramlist = ReadFixe commonParameters.herd_id = ReadNumber commonParameters.totN_hcw = ReadNumbe inferenceConfig.paramlist = ReadFixed inferenceConfig.herd_id = ReadNumberF inferenceConfig.day_shut = ReadNumber
src/IO.cpp: line 270-275 src/IO.cpp: line 283-288 [37]
observations.cases = Utilities::read_ unsigned int cases_rows = observation unsigned int cases_cols = observation ImportConsistencyCheck(scot_data_file observations.age_pop = Utilities::rea unsigned int age_pop_rows = observati unsigned int age_pop_cols = observati ImportConsistencyCheck(scot_ages_file
src/IO.cpp: line 31-35 src/IO.cpp: line 117-121 [37]
std::string filePath(configDir + "/pa parameters.nHealthBoards = ReadNumber parameters.nAgeGroups = ReadNumberFro parameters.nCfrCategories = ReadNumbe inferenceConfig.paramlist = ReadFixed inferenceConfig.herd_id = ReadNumberF inferenceConfig.day_shut = ReadNumber inferenceConfig.tau = ReadNumberFromF
src/IO.cpp: line 531-533 src/IO.cpp: line 533-535 [36]
os << particle.parameter_set[Model::M os << particle.parameter_set[Model::M os << particle.parameter_set[Model::M os << particle.parameter_set[Model::M os << particle.parameter_set[Model::M os << particle.weight << std::endl;
src/ModelTypes.h: line 122-124 src/ModelTypes.h: line 135-137 [36]
std::vector> waifw std::vector> cfr_b std::vector > pf_p std::vector> waifw std::vector> waifw std::vector> waifw
src/IO.cpp: line 619-621 src/IO.cpp: line 621-623 [36]
(*log) << " asymptomatic period (thet (*log) << " symptomatic period (theta (*log) << " hospitalisation stay (the (*log) << " hospitalisation stay (the (*log) << " bed capacity at hospital (*log) << " relative infectiousness o
src/InferenceParameters.cpp: line 22-26 src/InferenceParameters.cpp: line 26-30[36]
parameterSet[i] = (double) rng_->Pois } else if (Model::ModelParameters::LAMB { parameterSet[i] = rng_->Flat(flag1_[i parameterSet[i] = rng_->Flat(flag1_[i } else if (Model::ModelParameters::RRD { parameterSet[i] = rng_->Gamma(flag1_[
src/IO.cpp: line 637-641 src/IO.cpp: line 641-645 [36]
ss << comp.I3 << ", "; ss << comp.I4 << ", "; ss << comp.I_s1 << ", "; ss << comp.I_s2 << ", "; ss << comp.I_s3 << ", "; ss << comp.I_s3 << ", "; ss << comp.I_s4 << ", "; ss << comp.H << ", "; ss << comp.R << ", "; ss << comp.D;
src/ModelCommon.cpp: line 54-56 src/ModelCommon.cpp: line 56-58 [36]
int _total = 0; _total += comp.S + comp.E + comp.E_t + _total += comp.I_t + comp.I1 + comp.I2 _total += comp.I_t + comp.I1 + comp.I2 _total += comp.I4 + comp.I_s1 + comp.I _total += comp.I_s4 + comp.H + comp.R
src/main.cpp: line 56-59 src/main.cpp: line 60-63 [35]
if (ModelStructureId::ORIGINAL == sup { model = std::make_shared else if (ModelStructureId::IRISH == s { model = std::make_shared
src/IO.cpp: line 550-555 src/IO.cpp: line 565-570 [35]
os << inc_death << std::endl; } void LogFixedParameters(const params& p { (*log) << "[Fixed parameter values]:\ (*log) << " Seed value: " << randomis } void LogSeedSettings(const seed& params { (*log) << "[Disease seeding settings]
src/IniFile.cpp: line 191-193 src/IniFile.cpp: line 260-262 [35]
std::vector CIniFile: { std::vector data; // Holds the bool CIniFile::RenameSection(std::strin { std::vector content; // Holds
src/IO.cpp: line 605-608 src/ArgumentParser.cpp: line 66-70 [34]
void LogDependencyVersionInfo(Utilities { (*log) << "[Dependency Versioning]" < (*log) << " Compiler id: " << Depende void ArgumentParser::logArguments(Utili { (*log) << "[Arguments]:" << std::endl (*log) << "\t" << "Command line: ";
src/ArgumentParser.cpp: line 66-70 src/IO.cpp: line 596-599 [34]
void ArgumentParser::logArguments(Utili { (*log) << "[Arguments]:" << std::endl (*log) << "\t" << "Command line: "; void LogGitVersionInfo(Utilities::loggi { (*log) << "[Git Versioning]" << std:: (*log) << " Commit SHA: " << GitMetad
src/IO.h: line 295-297 src/IO.h: line 297-299 [34]
SettingParseError << std::endl; SettingParseError << "Invalid value i SettingParseError << "Category: " << SettingParseError << "Category: " << SettingParseError << "Setting: " << S SettingParseError << "Value: " << Set
src/IO.h: line 73-94 src/IO.h: line 114-134 [33]
CommonModelInputParameters ReadCommonPa /** * @brief Read parameters for the infer * * @param configDir Directory containin * @param log Logger * * @return Inference parameters */ InferenceConfig ReadInferenceConfig(con /** * @brief Read prediction framework con * * @param configDir Directory containin * @param index Index of the parameter * @param log Logger * * @return Prediction configuration */ PredictionConfig ReadPredictionConfig(c std::vector ReadPredictionParam /** * @brief Read observations needed for * * @param configDir Directory containin * @param log Logger * * @return Observations needed for Infe */ ObservationsForInference ReadInferenceO /** * @brief Read observations needed for * * @param configDir Directory containin * @param log Logger * * @return Observations needed for all */ ObservationsForModels ReadModelObservat
src/Dependencies.h: line 18-34 src/Git.h: line 43-50 [33]
static std::string CMakeVersion(); /** * @brief Return the compiler id in us */ static std::string CompilerId(); /** * @brief Return the compiler version */ static std::string CompilerVersion(); /** * @brief Return the GSL version in us */ static std::string GSLVersion(); }; static std::string AuthorEmail(); // The commit SHA1. static std::string CommitSHA1(); // The ISO8601 commit date. static std::string CommitDate(); // The commit tag static std::string Tag(); };
src/InferenceParameters.cpp: line 8-11 src/InferenceParameters.h: line 46-50[33]
InferenceParameterGenerator::InferenceP Random::RNGInterface::Sptr rng, const std::vector& flag1, const std::vector& flag2) InferenceParameterGenerator( Random::RNGInterface::Sptr rng, const std::vector& flag1, const std::vector& flag2 );
src/IO.cpp: line 487-495 src/IO.cpp: line 499-507 [32]
} void WritePredictionFullHeader(std::ost { os << "iter, day, age_group, S, E, E_ " I1, I2, I3, I4, I_s1, I_s2, I_s3, I } void WriteInferenceEndsHeader(std::ostr } void WriteInferenceParticlesHeader(std: { os << "iter, nsse_cases, nsse_deaths, "p_hcw, c_hcw, d, q, p_s, rrd, lambda } void WritePredictionFullRow(std::ostrea
src/IO.cpp: line 220-221 src/IO.cpp: line 269-270 [32]
(*log) << "\t- " << scot_deaths_file observations.deaths = Utilities::read (*log) << "\t- " << scot_data_file << observations.cases = Utilities::read_
src/IO.cpp: line 463-465 src/IO.cpp: line 473-475 [32]
WriteSimuHeader(output_simu); for (unsigned int iter = 0; iter < st const Status& status = statuses[iter] WritePredictionFullHeader(output_full for (unsigned int iter = 0; iter < st const Status& status = statuses[iter]
src/IO.cpp: line 579-582 src/IO.cpp: line 596-599 [32]
void LogPredictionConfig(const Predicti { (*log) << "[Prediction Configuration] (*log) << " n_iterations: " << config void LogGitVersionInfo(Utilities::loggi { (*log) << "[Git Versioning]" << std:: (*log) << " Commit SHA: " << GitMetad
src/IO.cpp: line 213-214 src/IO.cpp: line 220-221 [32]
(*log) << "\t- " << scot_data_file << observations.cases = Utilities::read_ (*log) << "\t- " << scot_deaths_file observations.deaths = Utilities::read
src/IO.cpp: line 117-120 src/IO.cpp: line 141-143 [32]
inferenceConfig.paramlist = ReadFixed inferenceConfig.herd_id = ReadNumberF inferenceConfig.day_shut = ReadNumber inferenceConfig.kernelFactor = ReadNu inferenceConfig.nSim = ReadNumberFrom inferenceConfig.nParticleLimit = Read
src/IO.cpp: line 608-609 src/IO.cpp: line 610-611 [32]
(*log) << " Compiler id: " << Depende (*log) << " Compiler version: " << De (*log) << " CMake version: " << Depen (*log) << " GSL version: " << Depende
src/InferenceParameters.h: line 47-50 src/InferenceParameters.cpp: line 9-11[31]
Random::RNGInterface::Sptr rng, const std::vector& flag1, const std::vector& flag2 ); Random::RNGInterface::Sptr rng, const std::vector& flag1, const std::vector& flag2)
src/IO.h: line 114-134 src/IO.h: line 134-153 [31]
std::vector ReadPredictionParam /** * @brief Read observations needed for * * @param configDir Directory containin * @param log Logger * * @return Observations needed for Infe */ ObservationsForInference ReadInferenceO /** * @brief Read observations needed for * * @param configDir Directory containin * @param log Logger * * @return Observations needed for all */ ObservationsForModels ReadModelObservat ObservationsForModels ReadModelObservat /** * @brief Read seed settings from the p * * @param ParamsPath Path to INI file * @param log Logger * * @return Seed settings data structure */ seed ReadSeedSettings(const std::string /** * @brief Read the fixed model paramete * * @param ParamsPath Path to INI file * * @return Parameters data structure */ params ReadFixedModelParameters(const s
src/ModelTypes.h: line 42-45 src/ModelTypes.h: line 150-153 [31]
std::vector simu_outs; std::vector hospital_death_outs; std::vector death_outs; std::vector< Compartments > end_comps; std::vector simulation; /*!< Numb std::vector deaths; /*!< Overall std::vector hospital_deaths; /*!< std::vector ends; /*!< P
src/IniFile.cpp: line 417-417 src/IniFile.h: line 44-44 [31]
bool CIniFile::SetRecordComments(std::s static bool SetRecordComments(std::str
src/IniFile.cpp: line 238-242 src/IniFile.cpp: line 283-287 [31]
if(!RecordExists(KeyName,SectionName, { auto iter = std::find_if(content.begi content.end(), CIniFile::RecordSectionIs(SectionName if (Load(FileName, content)) // Make s { auto iter = std::find_if(content.begi content.end(), CIniFile::RecordSectionKeyIs(SectionN
src/IniFile.h: line 46-46 src/IniFile.cpp: line 223-223 [31]
static bool SetValue(std::string& KeyN bool CIniFile::SetValue(std::string& Ke
src/IO.cpp: line 419-419 src/IO.cpp: line 420-420 [31]
namefile_simu << (outDirPath + "/outp namefile_ends << (outDirPath + "/outp
src/IO.h: line 176-177 src/IO.cpp: line 454-454 [31]
void WritePredictionsToFiles(std::vecto const Utilities::logging_stream::Sptr void WritePredictionsToFiles(std::vecto
src/ModelTypes.h: line 15-22 src/ModelTypes.h: line 23-30 [31]
int S = 0; /*!< Number of susceptible int E = 0; /*!< Number of infected ind int E_t = 0; /*!< Number of exposed in int I_p = 0; /*!< Number of infected a int I_t = 0; /*!< Number of tested pos int I1 = 0; /*!< Number of infected an int I2 = 0; /*!< Number of infected an int I3 = 0; /*!< Number of infected an int I4 = 0; /*!< Number of infected an int I_s1 = 0; /*!< Number of infected int I_s2 = 0; /*!< Number of infected int I_s3 = 0; /*!< Number of infected int I_s4 = 0; /*!< Number of infected int H = 0; /*!< Number of infected ind int R = 0; /*!< Number of infected ind int D = 0; /*!< Number of dead individ
src/IO.cpp: line 454-454 src/IO.h: line 176-177 [31]
void WritePredictionsToFiles(std::vecto void WritePredictionsToFiles(std::vecto const Utilities::logging_stream::Sptr
src/OriginalModel.h: line 8-24 src/TempModel.h: line 8-24 [31]
namespace EERAModel { namespace Model { class OriginalModel : public ModelInter { public: using Sptr = std::shared_ptr namespace EERAModel { namespace Model { class TempModel : public ModelInterface { public: using Sptr = std::shared_ptr
src/IO.cpp: line 418-418 src/IO.cpp: line 419-419 [31]
namefile << (outDirPath + "/output_ab namefile_simu << (outDirPath + "/outp
src/ArgumentParser.cpp: line 21-25 src/ArgumentParser.cpp: line 27-30 [31]
TCLAP::ValuesConstraint TCLAP::ValueArg structur "Model structure. Can be original, ir true, "", &allowedStructures); TCLAP::ValueArg indexArg("i", "i false, 0, "integer"); TCLAP::ValueArg modeArg( true, "", &allowedModes); TCLAP::ValueArg dataLocA
src/IniFile.h: line 31-32 src/IniFile.h: line 44-45 [30]
static bool CommentRecord(CommentChar& static bool CommentSection(char& Comme static bool SetRecordComments(std::str static bool SetSectionComments(std::st
src/IO.cpp: line 135-136 src/IO.cpp: line 137-138 [30]
inferenceConfig.prior_ps_shape1 = Rea inferenceConfig.prior_ps_shape2 = Rea inferenceConfig.prior_rrd_shape1 = Re inferenceConfig.prior_rrd_shape2 = Re
src/IO.h: line 44-64 src/IO.h: line 64-83 [30]
void ImportConsistencyCheck(const std:: /** * @brief Import parameters used for va * * @param configDir Directory containin * * @return Validation parameters */ ValidationParameters ImportValidationPa /** * @brief Read supplementary parameters * * @param ParamsPath Path to INI file * @param log Logger * * @return Supplementary parameters */ SupplementaryInputParameters ReadSupple Utilities::logging_stream::Sptr log); Utilities::logging_stream::Sptr log); /** * @brief Read common model input param * * @param ParamsPath Path to INI file * * @return Common model input parameter */ CommonModelInputParameters ReadCommonPa /** * @brief Read parameters for the infer * * @param configDir Directory containin * @param log Logger * * @return Inference parameters */ InferenceConfig ReadInferenceConfig(con
src/IniFile.cpp: line 249-251 src/IniFile.cpp: line 285-287 [30]
auto iter = std::find_if(content.begi content.end(), CIniFile::RecordSectionKeyIs(SectionN auto iter = std::find_if(content.begi content.end(), CIniFile::RecordSectionKeyIs(SectionN
src/Random.cpp: line 11-17 src/Random.cpp: line 26-32 [30]
gsl_rng_set(r_, seed); } double RNG::Flat(double a, double b) { return gsl_ran_flat(r_, a, b); } return gsl_ran_poisson(r_, mu); } double RNG::Gamma(double a, double b) { return gsl_ran_gamma(r_, a, b); }
src/IniFile.cpp: line 123-127 src/IniFile.cpp: line 441-445 [30]
} std::vector CIniFile::GetS { std::vector data; // Hold } std::vector CIniFile: { std::vector data; // Holds the
src/IO.cpp: line 188-190 src/IO.cpp: line 191-193 [30]
predictionConfig.fixedParameters.T_la predictionConfig.fixedParameters.juvp predictionConfig.fixedParameters.T_in predictionConfig.fixedParameters.T_re predictionConfig.fixedParameters.T_sy predictionConfig.fixedParameters.T_ho
src/Observations.cpp: line 106-106 src/Observations.h: line 104-104 [29]
std::vector CorrectIncidence(const std::vector CorrectIncidence(const
src/Random.h: line 1-25 src/ModelCommon.h: line 1-32 [29]
#pragma once #include #include #include namespace EERAModel { /** * @brief Namespace containing objects * * This namespace contains a wrapper in * generation libraries in order for th * model functions. */ namespace Random { /** * @class RNGInterface * @brief Abstract interface to a rando */ class RNGInterface { public: using Sptr = std::shared_ptr #pragma once #include "ModelTypes.h" #include "Random.h" #include #include /** * @brief Namespace for the EERA COVID- * * This namespace includes functions an * initiate, run and evaluate the model */ namespace EERAModel { /** * @brief Namespace containing the mode * * This namespace contains functions wh * setup/parameters. */ namespace Model { /** * @class ModelInterface * @brief Abstract interface to a model */ class ModelInterface { public: using Sptr = std::shared_ptr
src/Observations.h: line 104-104 src/Observations.cpp: line 106-106 [29]
std::vector CorrectIncidence(const std::vector CorrectIncidence(const
src/IniFile.cpp: line 373-379 src/IniFile.cpp: line 391-397 [29]
bool CIniFile::DeleteSection(std::strin { std::vector content; // Holds if (Load(FileName, content)) // Make s { for(int i=static_cast(content.si bool CIniFile::SetSectionComments(std:: { std::vector content; // Holds if (Load(FileName, content)) // Make s { for(auto iter = content.begin(); iter
src/IO.cpp: line 572-574 src/IO.cpp: line 574-576 [29]
if (params.seedmethod == "random"){ (*log) << " number of seed: " << para } else if(params.seedmethod == "backg } else if(params.seedmethod == "backg (*log) << " duration of the high risk }
src/PredictionFramework.h: line 47-71 src/InferenceFramework.h: line 206-230[29]
Model::ModelInterface::Sptr model_; /** * @private * @brief Prediction configuration */ PredictionConfig config_; /** * @private * @brief Random number generator */ Random::RNGInterface::Sptr rng_; /** * @private * @brief Outputs directory path */ std::string outDir_; /** * @private * @brief Logger */ Utilities::logging_stream::Sptr log_; Model::ModelInterface::Sptr model_; /** * @private * @brief Inference configuration */ InferenceConfig inferenceConfig_; /** * @private * @brief Random number generator */ Random::RNGInterface::Sptr rng_; /** * @private * @brief Outputs directory path */ std::string outDir_; /** * @private * @brief Logger */ Utilities::logging_stream::Sptr log_;
src/ModelCommon.h: line 1-32 src/Random.h: line 1-25 [29]
#pragma once #include "ModelTypes.h" #include "Random.h" #include #include /** * @brief Namespace for the EERA COVID- * * This namespace includes functions an * initiate, run and evaluate the model */ namespace EERAModel { /** * @brief Namespace containing the mode * * This namespace contains functions wh * setup/parameters. */ namespace Model { /** * @class ModelInterface * @brief Abstract interface to a model */ class ModelInterface { public: using Sptr = std::shared_ptr #pragma once #include #include #include namespace EERAModel { /** * @brief Namespace containing objects * * This namespace contains a wrapper in * generation libraries in order for th * model functions. */ namespace Random { /** * @class RNGInterface * @brief Abstract interface to a rando */ class RNGInterface { public: using Sptr = std::shared_ptr
src/OriginalModel.cpp: line 6-7 src/OriginalModel.h: line 24-25 [29]
OriginalModel::OriginalModel(const Comm ObservationsForModels& observations, OriginalModel(const CommonModelInputP Random::RNGInterface::Sptr rng, Utili
src/IO.cpp: line 137-140 src/IO.cpp: line 140-142 [29]
inferenceConfig.prior_rrd_shape1 = Re inferenceConfig.prior_rrd_shape2 = Re inferenceConfig.nsteps = ReadNumberFr inferenceConfig.nsteps = ReadNumberFr inferenceConfig.kernelFactor = ReadNu inferenceConfig.nSim = ReadNumberFrom
src/ModelTypes.h: line 103-111 src/ModelTypes.h: line 111-119 [29]
int nCasesDays; }; /** * @brief Observations for Inference fr */ struct ObservationsForInference { std::vector> cases; std::vector> deaths; std::vector> deaths; }; /** * @brief Observations for Models */ struct ObservationsForModels { std::vector> cases; std::vector> age_p
src/InferenceFramework.h: line 206-230 src/PredictionFramework.h: line 47-71[29]
Model::ModelInterface::Sptr model_; /** * @private * @brief Inference configuration */ InferenceConfig inferenceConfig_; /** * @private * @brief Random number generator */ Random::RNGInterface::Sptr rng_; /** * @private * @brief Outputs directory path */ std::string outDir_; /** * @private * @brief Logger */ Utilities::logging_stream::Sptr log_; Model::ModelInterface::Sptr model_; /** * @private * @brief Prediction configuration */ PredictionConfig config_; /** * @private * @brief Random number generator */ Random::RNGInterface::Sptr rng_; /** * @private * @brief Outputs directory path */ std::string outDir_; /** * @private * @brief Logger */ Utilities::logging_stream::Sptr log_;
src/IO.cpp: line 181-186 src/IO.cpp: line 363-366 [28]
error_message << "Cannot locate poste throw std::runtime_error(error_messag } // The posterior parameters are colum std::vector modelParameters = SetSelectError << "Parameter set sele throw std::overflow_error(SetSelectEr } std::vector line_select = lin
src/IniFile.cpp: line 209-210 src/IniFile.cpp: line 260-261 [28]
std::string CIniFile::GetValue(std::str { bool CIniFile::RenameSection(std::strin {
src/IniFile.cpp: line 153-161 src/IniFile.cpp: line 452-461 [28]
(!iContent.Key.empty())) // but not t { data.push_back(iContent); } // Add } } return data; // Return the data } bool CIniFile::RecordExists(std::string if(iContent.Key.empty()) { // If this data.push_back(iContent); // Add the } } } return data; // Return the data } bool CIniFile::AddSection(std::string&
src/InferenceFramework.h: line 242-258 src/InferenceFramework.cpp: line 260-263[28]
InferenceParticleGenerator::Sptr infe }; /** * @brief Compute the Kernel Windows fo * * Calculates the kernel window (kernel * based on a set of previously accepte * * @param nPar Number of parameters to * @param particleList List of previous * @param kernelFactor Common kernel mu * * @return List of computed kernel wind */ std::vector ComputeKernel double kernelFactor); return close; } std::vector ComputeKernel
src/InferenceFramework.cpp: line 260-263 src/InferenceFramework.h: line 242-258[28]
return close; } std::vector ComputeKernel InferenceParticleGenerator::Sptr infe }; /** * @brief Compute the Kernel Windows fo * * Calculates the kernel window (kernel * based on a set of previously accepte * * @param nPar Number of parameters to * @param particleList List of previous * @param kernelFactor Common kernel mu * * @return List of computed kernel wind */ std::vector ComputeKernel double kernelFactor);
src/IO.cpp: line 223-227 src/IO.cpp: line 257-261 [28]
const std::string settings_file = con ValidationParameters validationParams int nHealthBoards = validationParams. int nCasesDays = validationParams.nCa const std::string settings_file = con ValidationParameters validationParame int nHealthBoards = validationParamet int nAgeGroups = validationParameters
src/IniFile.cpp: line 182-184 src/IniFile.cpp: line 240-242 [28]
auto iter = std::find_if(content.begi content.end(), CIniFile::RecordSectionIs(SectionName auto iter = std::find_if(content.begi content.end(), CIniFile::RecordSectionIs(SectionName
src/Git.cpp.in: line 42-46 src/Dependencies.cpp.in: line 5-13 [28]
std::string GitMetadata::CommitDate() { return "@GIT_COMMIT_DATE_ISO8601@"; } std::string GitMetadata::Tag() { return "@GIT_TAG@"; std::string DependencyVersions::CMakeVe { return "@CMAKE_VERSION@"; } std::string DependencyVersions::Compile { return "@CMAKE_CXX_COMPILER_ID@"; }
src/ModelTypes.h: line 135-136 src/ModelTypes.h: line 137-138 [27]
std::vector> waifw std::vector> waifw std::vector> waifw std::vector> cfr_b
src/IniFile.cpp: line 391-396 src/IniFile.cpp: line 417-422 [27]
bool CIniFile::SetSectionComments(std:: { std::vector content; // Holds if (Load(FileName, content)) // Make s { bool CIniFile::SetRecordComments(std::s { std::vector content; // Holds if (Load(FileName, content)) // Make s {
src/IO.cpp: line 524-527 src/IO.cpp: line 630-633 [27]
os << iter << ", "; os << particle.nsse_cases << ", "; os << particle.nsse_deaths << ", "; os << particle.parameter_set[Model::M ss << comp.S << ", "; ss << comp.E << ", "; ss << comp.E_t << ", "; ss << comp.I_p << ", ";
src/IO.cpp: line 82-84 src/IO.cpp: line 171-176 [27]
paramlist.T_hos = ReadNumberFromFile< paramlist.K = ReadNumberFromFile paramlist.inf_asym = ReadNumberFromFi predictionConfig.n_sim_steps = ReadNu sectionId, filePath); predictionConfig.n_iterations = ReadN sectionId, filePath); predictionConfig.index = index;
src/main.cpp: line 22-23 src/main.cpp: line 41-42 [27]
Utilities::logging_stream::Sptr logge IO::LogGitVersionInfo(logger); Random::RNG::Sptr rng = std::make_sha IO::LogRandomiserSettings(supplementa
src/Git.h: line 38-45 src/Dependencies.h: line 18-33 [27]
static bool AnyUncommittedChanges(); // The commit author's name. static std::string AuthorName(); // The commit author's email. static std::string AuthorEmail(); // The commit SHA1. static std::string CommitSHA1(); static std::string CMakeVersion(); /** * @brief Return the compiler id in us */ static std::string CompilerId(); /** * @brief Return the compiler version */ static std::string CompilerVersion(); /** * @brief Return the GSL version in us */ static std::string GSLVersion();
src/IO.cpp: line 507-512 src/IO.cpp: line 544-549 [27]
void WritePredictionFullRow(std::ostrea { os << iter << ", "; os << day << ", "; os << age_group << ", "; os << CompToString(comp) << std::endl int inc_death) { os << iter << ", "; os << day << ", "; os << inc_case << ", "; os << inc_death_hospital << ", ";
src/IO.cpp: line 84-91 src/IO.cpp: line 105-111 [27]
paramlist.inf_asym = ReadNumberFromFi return paramlist; } SupplementaryInputParameters ReadSupple Utilities::logging_stream::Sptr log) { commonParameters.totN_hcw = ReadNumbe return commonParameters; } InferenceConfig ReadInferenceConfig(con {
src/Observations.cpp: line 88-89 src/Observations.cpp: line 92-93 [27]
std::vector casesIncidence = Comp obs_selections.hospitalised = CorrectI std::vector deathsIncidence = Com obs_selections.deaths = CorrectInciden
src/IO.cpp: line 504-507 src/IO.cpp: line 540-543 [27]
"p_hcw, c_hcw, d, q, p_s, rrd, lambda } void WritePredictionFullRow(std::ostrea os << "iter, day, " << "inc_case, " < } void WriteSimuRow(std::ostream& os, int
src/Utilities.cpp: line 18-19 src/Utilities.cpp: line 25-26 [26]
return (stat(directory.c_str(), &buff } return (stat(file.c_str(), &buffer) = }
src/IO.cpp: line 112-117 src/IO.cpp: line 162-168 [26]
std::string ParamsPath(configDir + "/ InferenceConfig inferenceConfig; inferenceConfig.seedlist = ReadSeedSe inferenceConfig.paramlist = ReadFixed std::string filePath(configDir + "/pa PredictionConfig predictionConfig; predictionConfig.seedlist = ReadSeedS predictionConfig.day_shut = ReadNumbe
src/InferenceFramework.cpp: line 295-299 src/PredictionFramework.cpp: line 14-18[26]
InferenceParticleGenerator::InferencePa Random::RNGInterface::Sptr rng) : nInferenceParams_(nInferenceParams) kernelFactor_(kernelFactor), rng_(rng) {} const std::string& outDir, Utilities::logging_stream::Sptr log) : model_(model), config_(config), rng_(rng),
src/IniFile.cpp: line 327-335 src/IniFile.cpp: line 345-353 [26]
} } return Save(FileName,content); // Sav } return false; // In the event the file } bool CIniFile::UnCommentSection(std::st } } return Save(FileName,content); // Sav } return false; // In the event the file } bool CIniFile::DeleteRecord(std::string
src/IO.h: line 264-265 src/IO.cpp: line 543-544 [25]
void WriteSimuRow(std::ostream& os, int int inc_death); void WriteSimuRow(std::ostream& os, int int inc_death)
src/InferenceFramework.cpp: line 307-308 src/InferenceFramework.h: line 50-51[25]
particle InferenceParticleGenerator::Ge InferenceParameterGenerator::Sptr par particle GenerateNew(int smc, int sim const std::vector& previous
src/IO.h: line 313-323 src/IO.h: line 334-344 [25]
void LogFixedParameters(const params& p /** * @brief Log randomiser settings * * Log the settings of the configured r * * @param params Supplementary input pa * @param log Logger */ void LogRandomiserSettings(const Supple void LogSeedSettings(const seed& params /** * @brief Log prediction configuration * * Log the settings of a prediction run * * @param params Model input parameters * @param log Logger */ void LogPredictionConfig(const Predicti
src/InferenceFramework.h: line 50-51 src/InferenceFramework.cpp: line 307-308[25]
particle GenerateNew(int smc, int sim const std::vector& previous particle InferenceParticleGenerator::Ge InferenceParameterGenerator::Sptr par
src/IniFile.cpp: line 21-22 src/IniFile.cpp: line 79-80 [25]
std::ifstream inFile (FileName.c_str() if (!inFile.is_open()) { return false; std::ofstream outFile (FileName.c_str( if (!outFile.is_open()) { return false
src/InferenceParameters.h: line 1-46 src/InferenceFramework.h: line 1-28[25]
#pragma once #include #include #include "ModelTypes.h" #include "Random.h" namespace EERAModel { /** * @brief Namespace handling inference * * This namespace contains functions to * inference parameter sets which setup */ namespace Inference { /** * @class InferenceParameterGenerator * @brief Generate inference parameter * * Inference parameter sets are collect * epidemiological model within the inf * of the epidemiological model. Repeat * parameters result in different model * of disease spread in the world, then * part of the output from the inferenc * * Inference parameter sets can be gene * - An initial set of parameters can b * - Once the inference framework has b * subsequent sets can be generated fro * selected parameter set. */ class InferenceParameterGenerator { public: using Sptr = std::shared_ptr #pragma once #include "ModelCommon.h" #include "ModelTypes.h" #include "Random.h" #include "Utilities.h" #include "InferenceParameters.h" namespace EERAModel { namespace Inference { /** * @class InferenceParticleGenerator * @brief Generate inference particles */ class InferenceParticleGenerator { public: using Sptr = std::shared_ptr
src/IO.cpp: line 543-544 src/IO.h: line 264-265 [25]
void WriteSimuRow(std::ostream& os, int int inc_death) void WriteSimuRow(std::ostream& os, int int inc_death);
src/IO.cpp: line 420-422 src/IO.cpp: line 458-460 [25]
namefile_ends << (outDirPath + "/outp std::ofstream output_step (namefile.s namefile_full << (outDirPath + "/outp std::ofstream output_simu(namefile_si
src/InferenceFramework.h: line 1-28 src/InferenceParameters.h: line 1-46[25]
#pragma once #include "ModelCommon.h" #include "ModelTypes.h" #include "Random.h" #include "Utilities.h" #include "InferenceParameters.h" namespace EERAModel { namespace Inference { /** * @class InferenceParticleGenerator * @brief Generate inference particles */ class InferenceParticleGenerator { public: using Sptr = std::shared_ptr #pragma once #include #include #include "ModelTypes.h" #include "Random.h" namespace EERAModel { /** * @brief Namespace handling inference * * This namespace contains functions to * inference parameter sets which setup */ namespace Inference { /** * @class InferenceParameterGenerator * @brief Generate inference parameter * * Inference parameter sets are collect * epidemiological model within the inf * of the epidemiological model. Repeat * parameters result in different model * of disease spread in the world, then * part of the output from the inferenc * * Inference parameter sets can be gene * - An initial set of parameters can b * - Once the inference framework has b * subsequent sets can be generated fro * selected parameter set. */ class InferenceParameterGenerator { public: using Sptr = std::shared_ptr
src/IO.cpp: line 269-270 src/IO.cpp: line 282-283 [25]
(*log) << "\t- " << scot_data_file << observations.cases = Utilities::read_ (*log) << "\t- " << scot_ages_file << observations.age_pop = Utilities::rea
src/IO.cpp: line 415-415 src/IO.h: line 166-167 [24]
const std::vector& particle const std::vector const Utilities::logging_stream::Sptr&
src/IrishModel.cpp: line 86-89 src/OriginalModel.cpp: line 69-73 [24]
int n_susc = 0; for (unsigned int age = start_age; ag { seedarray[age - start_age] = static_c startdist[static_cast(rng_->Flat for (unsigned int age = 1; age < age_ { _temp[age].S -= startdist[age - 1]; /
src/InferenceParameters.cpp: line 41-43 src/InferenceParameters.h: line 73-76[24]
std::vector InferenceParameterG const std::vector& existingSe const std::vector& kern std::vector GenerateWeighted( const std::vector& existingSe const std::vector& kern );
src/IniFile.h: line 37-37 src/IniFile.h: line 40-40 [24]
static std::vector GetRecord(s static std::string GetValue(std::strin
src/ArgumentParser.cpp: line 42-43 src/ArgumentParser.cpp: line 44-45 [24]
if (Utilities::toUpper(structureArg.g _args.structure = ModelStructureId::I else if (Utilities::toUpper(structure _args.structure = ModelStructureId::T
src/IniFile.h: line 28-31 src/IniFile.h: line 42-44 [24]
CIniFile(); static bool AddSection(std::string& Se static bool CommentRecord(CommentChar& static bool RenameSection(std::string& static bool SectionExists(std::string& static bool SetRecordComments(std::str
src/IO.cpp: line 476-478 src/Utilities.h: line 37-38 [24]
const auto& pop_array = status.pop_ar for (unsigned int day = 0; day < pop_ double sum_sq=0.0; for (unsigned int xx = 0; xx < obsval.
src/IniFile.h: line 47-47 src/IniFile.cpp: line 161-161 [24]
static bool UnCommentRecord(std::strin bool CIniFile::RecordExists(std::string
src/IniFile.cpp: line 387-391 src/IniFile.cpp: line 413-417 [24]
} return false; // In the event the file } bool CIniFile::SetSectionComments(std:: } return false; // In the event the file } bool CIniFile::SetRecordComments(std::s
src/IO.cpp: line 512-515 src/IO.cpp: line 519-522 [24]
os << CompToString(comp) << std::endl } void WriteInferenceEndsRow(std::ostream os << CompToString(comp) << std::endl } void WriteInferenceParticlesRow(std::os
src/Random.h: line 37-44 src/Random.h: line 123-126 [24]
virtual double Flat(double a, double /** * @brief Multinomial distribution * * Return a random number from a multi */ virtual void Multinomial(size_t K, un virtual double Flat(double a, double /** @brief Multinomial distribution o virtual void Multinomial(size_t K, un
src/Utilities.h: line 37-38 src/IO.cpp: line 476-478 [24]
double sum_sq=0.0; for (unsigned int xx = 0; xx < obsval. const auto& pop_array = status.pop_ar for (unsigned int day = 0; day < pop_
src/ArgumentParser.h: line 71-73 src/ArgumentParser.h: line 77-79 [24]
bool runLocal() const {return _args.i std::string localSourceDir() const {r ModelStructureId modelStructure() con std::string outputDir() const {return
src/IniFile.cpp: line 366-373 src/IniFile.cpp: line 386-391 [24]
return Save(FileName,content); // Sav } return false; // In the event the file } bool CIniFile::DeleteSection(std::strin return Save(FileName,content); // Sav } return false; // In the event the file } bool CIniFile::SetSectionComments(std::
src/main.cpp: line 79-85 src/main.cpp: line 91-96 [24]
model->SetFixedParameters(predictionC Prediction::PredictionFramework frame rng, out_dir, logger); framework.Run(); } IO::LogFixedParameters(commonParamete Inference::InferenceFramework framewo framework.Run(); }
src/Observations.cpp: line 13-13 src/Observations.cpp: line 111-111 [24]
auto max_time_itr = std::find_if(regio if ( std::any_of(originalIncidence.beg
src/IO.h: line 166-167 src/IO.cpp: line 415-415 [24]
const std::vector const Utilities::logging_stream::Sptr& const std::vector& particle
src/IO.cpp: line 107-111 src/IO.cpp: line 197-201 [24]
return commonParameters; } InferenceConfig ReadInferenceConfig(con { return predictionConfig; } ObservationsForInference ReadInferenceO {