Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
atmyers committed Dec 12, 2023
1 parent 2fee1b0 commit e33f618
Showing 1 changed file with 15 additions and 21 deletions.
36 changes: 15 additions & 21 deletions src/Initialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,9 @@ namespace Initialization

Gpu::Device::streamSynchronize();
num_infected += num_infected_d.dataValue();
if(num_infected>=ninfect) {
break;
}
if (num_infected >= ninfect) {
break;
}
}

ParallelDescriptor::ReduceIntSum(num_infected);
Expand All @@ -268,35 +268,29 @@ namespace Initialization
const CaseData& cases, const DemographicData& demo)
{
BL_PROFILE("setInitialCases");
/*
amrex::Vector<int> FIPS_code_to_i(57000, -1);
for (int i = 0; i < demo.FIPS.size(); ++i) {
FIPS_code_to_i[demo.FIPS[i]] = i;
printf("Unit %d has FIPS %d and num Comm %d and population %d\n", i, demo.FIPS[i], demo.Start[i+1]-demo.Start[i], demo.Population[i]);
}
*/

std::map<std::pair<int, int>, amrex::DenseBins<AgentContainer::ParticleType> > bin_map;

int ntry = 5;
int ninf = 0;
for (int ihub = 0; ihub < cases.N_hubs; ++ihub) {
if (cases.Size_hubs[ihub] > 0) {
int FIPS = cases.FIPS_hubs[ihub];
std::vector<int> units;
units.resize(0);
for (int i = 0; i < demo.Nunit; ++i) if(demo.FIPS[i]==FIPS)units.push_back(i);
std::vector<int> units;
units.resize(0);
for (int i = 0; i < demo.Nunit; ++i) if(demo.FIPS[i]==FIPS)units.push_back(i);
//int unit = FIPS_code_to_i[FIPS];
if (units.size() > 0) {
printf("Infecting %d people in FIPS %d\n", cases.Size_hubs[ihub], FIPS);
int u=0;
int i=0;
while(i < cases.Size_hubs[ihub]) {
int nSuccesses= infect_random_community(pc, unit_mf, FIPS_mf, comm_mf, bin_map, cases, demo, units[u], ntry);
printf("Infecting %d people in FIPS %d\n", cases.Size_hubs[ihub], FIPS);
int u=0;
int i=0;
while (i < cases.Size_hubs[ihub]) {
int nSuccesses= infect_random_community(pc, unit_mf, FIPS_mf, comm_mf, bin_map, cases, demo, units[u], ntry);
ninf += nSuccesses;
i+= nSuccesses;
u=(u+1)%units.size(); //sometimes we infect fewer than ntry, but switch to next unit anyway
i+= nSuccesses;
u=(u+1)%units.size(); //sometimes we infect fewer than ntry, but switch to next unit anyway
}
amrex::Print() << "Infected " << i<< "total " << ninf << " after processing FIPS " << FIPS<< " \n";
amrex::Print() << "Infected " << i<< " total " << ninf << " after processing FIPS " << FIPS<< " \n";
}
}
}
Expand Down

0 comments on commit e33f618

Please sign in to comment.