Skip to content

Commit

Permalink
Updated outputs: fixed switched Ventilator/ICU label and changed runn…
Browse files Browse the repository at this point in the history
…ing program stdout details.
  • Loading branch information
stevenhofmeyr committed Nov 2, 2024
1 parent 1a391bb commit 70ed0ac
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
4 changes: 4 additions & 0 deletions src/AgentContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,9 @@ void AgentContainer::generateCellData (MultiFab& mf /*!< MultiFab with at least
Returns a vector with 5 components corresponding to each value of #Status; each element is
the total number of agents at a step with the corresponding #Status (in that order).
Status list: 0 - never, 1 - infected, 2 - immune, 3 - susceptible, 4 - dead, 5 - exposed, 6 - asymptomatic,
7 - presymptomatic, 8 - symptomatic
*/
std::array<Long, 9> AgentContainer::getTotals (const int a_d /*!< disease index */) {
BL_PROFILE("getTotals");
Expand All @@ -779,6 +782,7 @@ std::array<Long, 9> AgentContainer::getTotals (const int a_d /*!< disease index
int s[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
auto status = ptd.m_runtime_idata[i0(a_d)+IntIdxDisease::status][i];


AMREX_ALWAYS_ASSERT(status >= 0);
AMREX_ALWAYS_ASSERT(status <= 4);

Expand Down
3 changes: 1 addition & 2 deletions src/DiseaseParm.H
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ struct DiseaseParm
a_t_hosp = 0.0;
a_ICU = 0;
a_ventilator = 0;
Real p_hosp = m_CHR[a_age_group];
if (amrex::Random(a_reng) < p_hosp) {
if (amrex::Random(a_reng) < m_CHR[a_age_group]) {
if (a_age_group == AgeGroups::o65) a_t_hosp = m_t_hosp[AgeGroups_Hosp::o65];
else if (a_age_group == AgeGroups::a50to64) a_t_hosp = m_t_hosp[AgeGroups_Hosp::a50to64];
else a_t_hosp = m_t_hosp[AgeGroups_Hosp::u50];
Expand Down
4 changes: 2 additions & 2 deletions src/DiseaseStatus.H
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ void DiseaseStatus<AC,ACT,ACTD,A>::updateAgents(AC& a_agents, /*!< Agent contain
ParallelFor( np, [=] AMREX_GPU_DEVICE (int i) noexcept
{
if (flag_hosp_ptr[i] == 1) {
AMREX_ALWAYS_ASSERT(!isHospitalized(i, ptd));
assign_hospital( i, hosp_i_ptr, hosp_j_ptr, ptd);
// could have already been assignedto a hospital from another disease
if (!isHospitalized(i, ptd)) assign_hospital( i, hosp_i_ptr, hosp_j_ptr, ptd);
}
});

Expand Down
13 changes: 7 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ void runAgent ()
<< std::setw(12) << "Recovered"
<< std::setw(12) << "Deaths"
<< std::setw(15) << "Hospitalized"
<< std::setw(15) << "Ventilated"
<< std::setw(12) << "ICU"
<< std::setw(15) << "ICU"
<< std::setw(12) << "Ventilated"
<< std::setw(12) << "Exposed"
<< std::setw(15) << "Asymptomatic"
<< std::setw(15) << "Presymptomatic"
Expand Down Expand Up @@ -425,12 +425,13 @@ void runAgent ()

std::chrono::duration<double> elapsed_time = std::chrono::high_resolution_clock::now() - start_time;

Print() << "[Day " << cur_time << " " << std::fixed << std::setprecision(1) << elapsed_time.count() << "s] ";
Print() << "[Day " << cur_time << " " << std::fixed << std::setprecision(1) << elapsed_time.count() << "s] infected: ";
for (int d = 0; d < params.num_diseases; d++) {
if (d > 0) Print() << "; ";
Print() << params.disease_names[d] << ": " << num_infected[d] << " infected, " << cumulative_deaths[d] << " deaths";
if (d > 0) Print() << ", ";
Print() << params.disease_names[d] << " " << num_infected[d];
}
Print() << "\n";
// the cumulative deaths are not tracked separately for each disease
Print() << "; deaths: " << cumulative_deaths[0] << "\n";

cur_time += 1.0_rt; // time step is one day
}
Expand Down

0 comments on commit 70ed0ac

Please sign in to comment.