Skip to content

Commit

Permalink
Merge branch 'development' of github.com:AMReX-Codes/ExaEpi into deve…
Browse files Browse the repository at this point in the history
…lopment
  • Loading branch information
atmyers committed Jan 9, 2024
2 parents d6e09b7 + 5d5c6d5 commit c10aa5f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 23 deletions.
2 changes: 1 addition & 1 deletion docs/source/install/cmake.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ or by adding arguments with ``-D<OPTION>=<VALUE>`` to the first CMake call, e.g.

.. code-block:: bash
cmake -S . -B build -DAMReX_COMPUTE=CUDA
cmake -S . -B build -DAMReX_GPU_BACKEND=CUDA
2 changes: 1 addition & 1 deletion etc/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
print(ad["immune"].sum())
print(ad["previously_infected"].sum())

plt.pcolormesh(ad["total"].reshape(3000, 3000))
plt.pcolormesh(ad["total"].reshape(ds.domain_dimensions[0:2]))
plt.savefig("test")
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 c10aa5f

Please sign in to comment.