Skip to content

Commit

Permalink
UrbanPop (#86)
Browse files Browse the repository at this point in the history
* Removed demo ic_type.

* Removed unused function

* Made workgroup size and nborhood size into parameters.
Call Redistribute() after moving agents (particles).
Print current infections and deaths counts when running and showing the current day.
Added UrbanPop ic_type and urbanpop_filename parameters.

* Moved the Redistribute call to within the agentMove functions.
Added workgroup_size parameter to read_workerflow

* Moved function definitions from AgentContainer.H to the .cpp file, for all not setter/getter methods.

* Prefixed all AgentContainer variables with m_, as per coding standards

* Moved all functions and data structures that are specific to the census data ic_type into a separate CensusData class, in a separate file. All of the functions previously in Initialization.H/cpp were specific to census data and have thus been moved into the CensusData class.

* Removed geom from CensusData - not needed.

* Added python script for processing UrbanPop feather files.
Added header file for UrbanPop data.

* Fixed missing variable in auto-generated UrbanPop header file

* Added UrbanPop data processing files

* Added an option to produce a fixed set of initial infections to try minimize variation between runs.

* Changed work interaction model to bin by workgroup as well as community, which really speeds up CPUs-only runs

* Moved functionality for work interaction model into separate function to conform to same code structure as other interaction models

* Added updated AgentDefinitions file for isAtWork function. Removed unused variables.

* Updated InteractionModel makeBins to always make bins since agents could have been redistributed

* Go through infectious first for home interactions

* For the work interaction model, bin by workgroup plus community. This results in large speedups, especially for CPU only code. Also, when doing interactions, iterate through the infectious agents first, which is also faster, since most agents will be susceptible and fewer will be infectious. This requires atomic multiply for the prob_ptr for GPUs.

* Updated assert calls to avoid unused variables when not in debug mode.

* Changed code to use PTDType for work bins instead of PType, and removed extra AOS attribute from agents

* Use particle tile data for all binning

* Bin home interactions by nborhood and family cluster

* Enable daytime interactions

* Restructured nborhood binning - because of community interactions can't bin smaller than a community, but doing infectious then susceptible still helps performance

* Cleaned up interaction models

* Switched to GPU policy for building bins. Much faster on GPUs

* Implemented new binner for school interactions

* Trying to fix school interactions - should they be in the same nborhood? Work or home?

* Better matching of school interaction model with development branch

* Restructured interaction model to use a common templated function for work, home, school and nborhood. Much simpler code now.

* Always rebuild the bins - needed since redistribute changes the particle locations

* Fixed indentation

* Removed some unused variables, and fixed reference to SOA index for non-group in nborhood interactions.

* Renamed shadowed variables to avoid PR checks complaints.

* Simplified interaction model template by removing the ACT typename.
Switched binning policy from GPU to Serial, in order to preserve reproducibility for a given random seed.
Commented out the generic interaction model, which is never used.

* Moved makeBins from InteractionModel to InteractionModRandom because that is the only place it is used and it will be replaced soon.

* Added a parameter for the probability of an agent going on random travel

* Removed InteractionModRandom - random travel is now handled in nborhood interactions

* For the interaction models, compute the max group using a parallel reduction, and only do it once.

* Split nborhood interactions into separate models for work and home.
Save the DenseBins for interactions to member of the interaction model. Have an option to reuse without rebuilding. This is disabled at the moment because Redistribute changes the ordering of particles.

* Added command line option agent.fast to switch between fast implementation and slow. Currently this only switches between a serial and a GPU binning policy.

* Removed unused variable

* Fixed issue with double to Real conversion

* Remove managed memory from read_workerflow

* Fixed overflow when computing number of workgroups for teachers

* run assignTeachersAndWorkgroup on the host for now

* Added option for GPU policy binning to CensusData binning

* Removed some unused code and changed a checking loop to not use managed memory.

* Added a timer to the main loop output to track how long each time step takes

* Fixes to prevent triggering compiler warnings.

* Simplified binary interactions implementations with shared inline function.

* Further cleaned up interaction probabilities.

* Fixed issue where memory had to be managed

* Ensure that the display of number infected currently agrees with the actual number calculated after updating agents.

* Removed unused variables

* Use ParticleReal to overcome atomic multiply failure in commit check.

* Converted nborhood interaction models to use counting with exponents.

* Modified fast interactions for nborhoods to work on GPUs

* Added a function for getting the community number to reduce code duplication.
Added fast interactions for work.

* Added fast interactions for home

* Implemented alternative fast interactions for neighborhoods, work and home (school is not yet done). These implemenations count the number of infected in each category, and so avoid the n-squared computation.

* Added some comments to the fast work interactions to better explain the computation

* Implemented fast interactions for schools.

* Removed code for slow interactions - that is still available in the interactions-bin-by-workgroup branch.

* Removed unnecessary assert.

* Changed profile function names to differentiate various interaction models.

* Working implementation of urbanpop init agents

* Added workgroups to working agents

* Only do the urbanpop agent debug output when using managed memory

* Set the nborhood groups for all the urbanpop agents

* Ensure that families have the same neighborhood

* Added names for profiling functions in UrbanPop initialization. Allow loading of case data for UrbanPop.

* Added vectors and multifabs needed for initial infections to urbanpop class.

* Split infection initialization functions into separate file. Will reuse them for initial infections from urbanpop as well as census data.

* Initialize all components for urbanpop agents init.
Got initial infections working for UrbanPop data, although not perfectly because of community to mesh mismatch.

* Added educators to schools

* Removed need for unit mf from case initialization

* Include NAICS field in agent data and use it to define workgroups

* Removed assert that called a collective but was only called by one rank

* Added some comments to better understand the columns corresponding to the counts in the output file.

* Subdivide by NAICS for work interactions

* For UrbanPop, use population school grades, not nt_dt_grades.
Set no school to be 0, instead of -1

* Split IntIdx::school into school_grade and school_id, so that in UrbanPop students can be grouped by grade.
Added another attribute, IntIdx::school_closed to represent schools that are closed. The school_id cannot just be set to -1 to indicate closure because the school id needs to be saved for when the school reopens

* Separated the school transmission probabilities from the census-specific definition of school types by school id.

* Allocate teachers to schools by grade. Use grades from worker data.

* Add college interactions for separate transmission

* Assign educators to schools

* Make childcare grouping based on school id, not neighborhood. Create school transmission groups by grade (no impact on Census)

* Setup educators workgroup and nborhood to be determined by school id

* School grade 0 defines daycare/childcare, not the school_id.
Use the neighborhood + 1 for school id, because 0 is no school.
Don't do work interactions for agents at schools.

* Fixed bug for work nborhood interactions where age group 0 was using home nborhoods, even if they had been moved to the work nborhoods

* Use new NAICS codes from updated UrbanPop data.
Draw missing educators from the county level.

* Fixed bugs with new more detailed NAICS.
Made family and school indexes unique only to geoid, to avoid large arrays in interaction models.

* Get global max groups for home interactions to deal with CUDA effectively.
Set max_grid_size to 10 for urbanpop.

* Set correct pos values for x,y locations for urbanopop

* Enabled daytime interactions.

* Restructured urbanpop extract script and changed school ids to be unique to each geoid only, to limit max school id

* Fixed problems with tiling. Now it will set tiling by default if running on CPUs, and not set it if running on GPUs. This works without requiring TilingIfNotGPU() calls to every MFI iteration.
Fixed issue with UrbanPop initialization requiring managed memory - not longer required.
More efficient tracking of communities in interaction models - skip empty grid points to reduce count of communities.

* Fixed school allocations for census. School id of 0 means no school, and workgroups are not set for teachers because they don't interact at work as well as at school.

* Allow workgroup interactions for educators - the workgroup is the school.
Ensure UrbanPop work nborhood is the same as nborhood for non-workers so they can still interact during the day.

* Fix unused variable

* Fixed teacher allocations and some bugs. Added a print out of educator student ratios.

* Moved vector allocation for infected counts in interaction models out of loop to reduce overhead of allocation.

* Removed obsolete timing.

* Merged in changes to terms (latent, incubation)

* Cleaner implementation of lng/lat conversions to and from grid, and also use the correct lng/lat when moving to hospital locations

* Added NM census data and cases

* Added NM UrbanPop data

* Fixed NM inputs.nm paths for data files.

* Correctly initialize air travel for UrbanPop

* Replace integers with AgeGroup enums where possible.

* Added an additional age bracket.
Restructured hospital treatment and checking for death.

* Got the additional 50-64 age bracket working properly. For census data, assume 57% of previous age group 30to64 are under 50.

* Remove TilingIfNotGPU calls in loops - tiling is set globally once when not using GPUs. Setting it globally ensures there are no bugs caused by tiling in some loops and not others.

* Removed some commented debugging code

* Fixed disease parameters to make it so that the age effect can be an explicit option

* Removed redefinition of variable

* Add print out of age group counts

* Cleaned up options.

* Cleaned up some entries in the documentation

* if -> else if so that an agent doesn't enter more than one if-block

* renamed isHospitalized() and flag_hosp, etc for clarity

* Moved initial case settings into DiseaseParm structure since they are specific to diseases.

* Renamed enum value of 'random' which was triggering a compilation error

* Updated outputs: fixed switched Ventilator/ICU label and changed running program stdout details.

* making sure latent, incubation, & infection periods are never negative; also ensuring latent period is not greater than the incubation+infection period

* simplified the condition for latent period being smaller than incubation+infectious periods

* not using std::max since Clang complains!

* Removed unnecessary check for infected in hospital model

* incubation period should be less than the latent+infectious periods!

* Should be incubation period, not latent period.
Check if agent is in hospital before assigning hospital. This can happen in multiple diseases.

* Fixed error in debug build with Real check

* fixed the if condition for when hospitalization starts

* Created a function for setting an agent to infected, since that code is used both during updates and when initializing agents to be infected.

* Made sure code is robust to having different precisions for ParticleReal and Real.

* Added comments explaining every option in inputs.defaults

* Formatting and some modified comments

* Changed reduced_inf option to asymp_relative_inf - much clearer.
Automatically set t_hosp_offset to be 3 more than highest hospitalization days, singe this was not an accessible option on the command line.

* Add a stable mode and make it the default.

* change default

* Removed strains - this functionality is provided by multiple diseases

* Changed max_grid_size to max_box_size to make it clearer to those not very familiar with amrex terminology.

* Made the school ratio option used for census data into an array of values, one per school type

* Fixed new bug in teacher count initialization

* Default to using managed memory as that is required for the serial binning, which is required to get consistent results for a given random seed and so is set by default.

---------

Co-authored-by: Andrew Myers <[email protected]>
Co-authored-by: Debojyoti Ghosh <[email protected]>
  • Loading branch information
3 people authored Nov 15, 2024
1 parent 81241f5 commit 7c15756
Show file tree
Hide file tree
Showing 37 changed files with 5,762 additions and 1,641 deletions.
702 changes: 702 additions & 0 deletions UrbanPop-scripts/extract_urbanpop_feather.py

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions data/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Backtrace.*
output-*
out-*
26 changes: 26 additions & 0 deletions data/CaseData/nm-july4.cases
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
35001 353
35005 32
35006 29
35009 34
35013 254
35015 22
35017 5
35023 11
35025 70
35027 3
35028 1
35029 24
35031 119
35035 25
35037 1
35039 9
35041 13
35043 38
35045 100
35047 1
35049 35
35051 2
35053 1
35055 6
35057 16
35061 27
573 changes: 573 additions & 0 deletions data/CensusData/NM_TX_2010.dat

Large diffs are not rendered by default.

Binary file added data/UrbanPop/NM_35/urbanpop_nm.csv.gz
Binary file not shown.
1,963 changes: 1,963 additions & 0 deletions data/UrbanPop/NM_35/urbanpop_nm.idx

Large diffs are not rendered by default.

264 changes: 149 additions & 115 deletions docs/source/usage/how_to_run.rst

Large diffs are not rendered by default.

157 changes: 157 additions & 0 deletions examples/inputs.defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# The number of diseases
agent.number_of_diseases = 1
# A list of strings of the names of the diseases, one for each disease. Will default to disease00, disease01, ...
agent.disease_names = default00
# The type of initialization: census or urbanpop.
agent.ic_type = census
# The input data file for census ic_type.
# no default, must be set when ic_type is census
# agent.census_filename
# The input worker flow filename for census ic_type.
# no default, must be set when ic_type is census
# agent.worker_filename
# The number of agents in a neighborhood.
agent.nborhood_size = 500
# The number of agents in a workgroup.
agent.workgroup_size = 20
# The input data file for urbanpop ic_type. Do not include the extension. There must be two files, with extensions .csv and .idx.
# no default, must be set when ic_type = census
# agent.urbanpop_filename
# The input data file containing the airports.
# no default, must be set when agent.air_travel_int != -1
# agent.airports_filename
# The input data file containing air traffic.
# no defalut, must be set when agent.air_travel_int != -1
# agent.air_traffic_filename
# The nnumber of time steps (days) for the simulation.
agent.nsteps = 1
# The plotting interval in time steps; set to -1 for no plotting.
agent.plot_int = -1
# The time steps between random travel events; set to -1 for no random travel.
agent.random_travel_int = -1
# The probability of an agent traveling randomly in any travel event.
agent.random_travel_prob = 0.0001
# The time steps between air travel events; set to -1 for no air travel.
agent.air_travel_int = -1
# The time steps between writing aggregated data; set to -1 to disable writing.
agent.aggregated_diag_int = -1
# The prefix to use when writing aggregated data.
agent.aggregated_diag_prefix = cases
# The random seed used in the simulation.
agent.seed = 0
# The time step on which to start shelter-in-place; set to -1 to disable.
agent.shelter_start = -1
# The time steps that shelter-in-place lasts.
agent.shelter_length = 0
# The compliance rate for shelter-in-place, i.e. the probability of an agent actually sheltering.
agent.shelter_compliance = 0.95
# The probability of an agent withdrawing when first becoming symptomatic.
agent.symptomatic_withdraw_compliance = 0.95
# The compliance rate for children when schools are closed. This reduces the probability of transmission in the neighborhood.
agent.child_compliance = 0.5
# A factor for increasing transmission by children within households when schools are closed.
agent.child_HH_closure = 2
# The ratio of educators to students for school levels none, college, high, middle, elementary, daycare. Ignored for none.
# This is only used for the census data.
agent.student_teacher_ratio = 0 15 15 15 15 15
# The maximum grid size used for MPI domain decomposition. Adjusting this can change the computation time and load balance.
# if ic_type is census
# agent.max_box_size = 16
# if ic_type is urbanpop and using GPUs
# agent.max_box_size = 500
# if ic_type is urbanpop and not using GPUs
# agent.max_box_size = 100

# A list of file names, one per disease, each one of which will be the output for the counts of the statuses for that disease.
# defalut for one disease
diag.output_filename = output.dat
# default for multiple diseases
# diag.output_filename = output_[disease name].dat

# Disease options. Use disease.[key] = [value] with only one disease.
# Use disease_[disease name].[key] = [value] with multiple diseases.

# The process to set the initial cases. Random means allocate randomly, and file means allocate from a file of data inputs.
disease.initial_case_type = random
# Input data file containing initial cases, one per disease. Only used if the initial_case_type is random.
# no default, must be set when disease.initial_case_type = file for a single disease
# disease.case_filename
# The number of initial cases for each disease. Not needed when reading initial cases from files.
# no default, must be set for each disease when agent.initial_case_type = random for multiple diseases
# agent.nmu_initial_cases_[disease name]
# no default, must be set for each disease when disease_[disease name].initial_case_type = file for multiple diseases
# disease.case_filename_[disease name]
disease.num_initial_cases = 0
# no default, must be set for each disease when disease_[disease name].num_initial_cases = random for multiple diseases
# disease.num_initial_cases_[disease name] = 0

# Number of disease strains. Currently only one strain is supported.
disease.nstrain = 1
# Probability of transmission given contact.
disease.p_trans = 0.2
# Probability of being asymptomatic.
disease.p_asymp = 0.4
# Relative infectiousness of asymptomatic indivudals. Curnently not implemented.
disease.asymp_relative_inf = 0.75
# Vaccine efficacy. Not yet implemented; leave at 0.
disease.vac_eff = 0
# Mean length in days that agents are immune after recovery from an infection.
disease.immune_length_mean = 180
# Standard deviation in days.
disease.immune_length_std = 60
# Mean length in days from infection until an agent becomes infectious.
disease.latent_length_mean = 3.0
# Standard deviation in days.
disease.latent_length_std = 1.0
# Mean length in days for the time an agent is infectious.
disease.infectious_length_mean = 6.0
# Standard deviation in days.
disease.infectious_length_std = 1.0
# Mean length in days from the time of infectioun untli symptoms develop.
disease.incubation_length_mean = 5.0
# Standard deviation in days.
disease.incubation_length_std = 1.0

# Number of days in hospital for the age groups under 50, 50 to 64 and over 64.
disease.hospitalization_days = 3 8 7

# Transmission probabilites at the community level, for both work and home locations,
# for the age groups 0-4, 5-17, 18-29, 30-49, 50-64, 64+
disease.xmit_comm = 0.000018125 0.000054375 0.000145 0.000145 0.000145 0.0002175
# Transmission probabilites at the neighborhood level, for both work and home locations,
# for the age groups 0-4, 5-17, 18-29, 30-49, 50-64, 64+
disease.xmit_hood = 0.0000725 0.0002175 0.00058 0.00058 0.00058 0.00087
# Transmission probabilites at the household level, where the infectious agent is an adult,
# for the age groups 0-4, 5-17, 18-29, 30-49, 50-64, 64+
disease.xmit_hh_adult = 0.3 0.3 0.4 0.4 0.4 0.4
# Transmission probabilites at the household level, where the infectious agent is a child,
# for the age groups 0-4, 5-17, 18-29, 30-49, 50-64, 64+
disease.xmit_hh_child = 0.6 0.6 0.3 0.3 0.3 0.3
# Transmission probabilites at the neighborhood cluster level, where the infectious agent is an adult,
# for the age groups 0-4, 5-17, 18-29, 30-49, 50-64, 64+
disease.xmit_nc_adult = 0.04 0.04 0.05 0.05 0.05 0.05
# Transmission probabilites at the neighborhood cluster level, where the infectious agent is a child,
# for the age groups 0-4, 5-17, 18-29, 30-49, 50-64, 64+
disease.xmit_nc_child = 0.075 0.075 0.04 0.04 0.04 0.04
# Transmission probabilites within schools, where both agents are adults or both are children,
# for school levels none, college, high, middle, elementary, daycare. Ignored for none.
disease.xmit_school = 0 0.0315 0.0315 0.0375 0.0435 0.15
# Transmission probabilites within schools, where transmitter is an adult and receiver is a child,
# for school levels none, college, high, middle, elementary, daycare. Ignored for none.
disease.xmit_school_a2c = 0 0.0315 0.0315 0.0375 0.0435 0.15
# Transmission probabilites within schools, where transmitter is a child and receiver is an adult,
# for school levels none, college, high, middle, elementary, daycare. Ignored for none.
disease.xmit_school_c2a = 0 0.0315 0.0315 0.0375 0.0435 0.15

# Probability of hospitalization when disease symptoms first appear, for age groups 0-4, 5-17, 18-29, 30-49, 50-64, 64+
disease.CHR = 0.0104 0.0104 0.070 0.28 0.28 1.0
# Probability of moving from hospitalization to ICU, for age groups 0-4, 5-17, 18-29, 30-49, 50-64, 64+
disease.CIC = 0.24 0.24 0.24 0.36 0.36 0.35
# Probability of moving from ICU to ventilator, for age groups 0-4, 5-17, 18-29, 30-49, 50-64, 64+
disease.CVE = 0.12 0.12 0.12 0.22 0.22 0.22
# Probability of death when in hospital, for age groups 0-4, 5-17, 18-29, 30-49, 50-64, 64+
disease.hospCVF = 0 0 0 0 0 0
# Probability of death when in the ICU, for age groups 0-4, 5-17, 18-29, 30-49, 50-64, 64+
disease.icuCVF = 0 0 0 0 0 0.26
# Probability of death when on a ventilator, for age groups 0-4, 5-17, 18-29, 30-49, 50-64, 64+
disease.ventCVF = 0.20 0.20 0.20 0.45 0.45 1.0
35 changes: 35 additions & 0 deletions examples/inputs.nm
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# settings for the census input type
# agent.ic_type = "census"
agent.census_filename = "../CensusData/NM_TX_2010.dat"
agent.workerflow_filename = "../CensusData/US-wf.bin"

# settings for the urbanpop input type
# agent.ic_type = "urbanpop"
agent.urbanpop_filename = "../UrbanPop/NM_35/urbanpop_nm"

agent.nsteps = 70
#agent.seed = 11

disease.initial_case_type = "file"
disease.case_filename = "../CaseData/nm-july4.cases"

# agent.number_of_diseases = 2
# agent.disease_names = "covid" "flu"

# disease.initial_case_type = "random" "random"
# disease.num_initial_cases = 1000

# setting these results in simulations with similar outcomes between UrbanPop and Census
# disease.hospitalization_days = 6 6 6
# disease.CHR = 0.1 0.1 0.1 0.1 0.1 0.1
# disease.CIC = 0.3 0.3 0.3 0.3 0.3 0.3
# disease.CVE = 0.15 0.15 0.15 0.15 0.15 0.15
# disease.hospCVF = 0 0 0 0 0 0
# disease.icuCVF = 0 0 0 0 0 0.0
# disease.ventCVF = 0.3 0.3 0.3 0.3 0.3 0.3

# disease_flu.num_initial_cases = 100
# disease_flu.p_trans = 0.3
# disease_flu.latent_length_mean = 3.0
# disease_flu.infectious_length_mean = 3.0
# disease_flu.incubation_length_mean = 3.0
114 changes: 72 additions & 42 deletions src/AgentContainer.H
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,66 @@
#include <AMReX_Vector.H>

#include "AgentDefinitions.H"
#include "Utils.H"
#include "DiseaseParm.H"
#include "DiseaseStatus.H"
#include "HospitalModel.H"
#include "InteractionModelLibrary.H"
#include "AirTravelFlow.H"


struct LngLatToGrid {
Real min_lng, min_lat;
Real gspacing_x, gspacing_y;

LngLatToGrid (Real _min_lng, Real _min_lat, Real _gspacing_x, Real _gspacing_y) {
init(_min_lng, _min_lat, _gspacing_x, _gspacing_y);
}

LngLatToGrid () {}

void init (Real _min_lng, Real _min_lat, Real _gspacing_x, Real _gspacing_y) {
min_lng = _min_lng;
min_lat = _min_lat;
gspacing_x = _gspacing_x;
gspacing_y = _gspacing_y;
}

AMREX_GPU_HOST_DEVICE
void operator() (Real lng, Real lat, int &x, int &y) const {
Real rx = (lng - min_lng) / gspacing_x;
Real ry = (lat - min_lat) / gspacing_y;
x = static_cast<int>(rx + 0.001_rt);
y = static_cast<int>(ry + 0.001_rt);
}
};

/*! Convert grid coordinates to latitude and longitude for UrbanPop data */
struct GridToLngLat {
Real min_lng, min_lat;
Real gspacing_x, gspacing_y;

GridToLngLat (Real _min_lng, Real _min_lat, Real _gspacing_x, Real _gspacing_y) {
init(_min_lng, _min_lat, _gspacing_x, _gspacing_y);
}

GridToLngLat() {}

void init (Real _min_lng, Real _min_lat, Real _gspacing_x, Real _gspacing_y) {
min_lng = _min_lng;
min_lat = _min_lat;
gspacing_x = _gspacing_x;
gspacing_y = _gspacing_y;
}

AMREX_GPU_HOST_DEVICE
void operator() (int x, int y, Real &lng, Real &lat) const {
lng = (Real)x * gspacing_x + min_lng + 0.001_rt;
lat = (Real)y * gspacing_y + min_lat + 0.001_rt;
}
};


/*! \brief Derived class from ParticleContainer that defines agents and their functions */
class AgentContainer
: public amrex::ParticleContainer<0, 0, RealIdx::nattribs, IntIdx::nattribs>
Expand All @@ -46,7 +99,8 @@ public:
const amrex::BoxArray & a_ba,
const int & a_num_diseases,
const std::vector<std::string> & a_disease_names,
const bool fast);
const bool fast,
const short a_ic_type);

void morningCommute(amrex::MultiFab&);

Expand Down Expand Up @@ -108,62 +162,36 @@ public:
return m_num_diseases;
}

/* Since read_workerflow update worker status Unit-wise and not community-wise - Get total teacher needed for each unit */
inline const amrex::Gpu::DeviceVector<int>& getUnitTeacherCounts() const {
return m_unit_teacher_counts_d;
}
inline const amrex::Gpu::DeviceVector<int>& getCommDayCrTeacherCounts() const {
return m_comm_teacher_counts_daycr_d;
}
inline const amrex::Gpu::DeviceVector<int>& getCommHighTeacherCounts() const {
return m_comm_teacher_counts_high_d;
}
inline const amrex::Gpu::DeviceVector<int>& getCommMiddleTeacherCounts() const {
return m_comm_teacher_counts_middle_d;
}
inline const amrex::Gpu::DeviceVector<int>& getCommElem3TeacherCounts() const {
return m_comm_teacher_counts_elem3_d;
}
inline const amrex::Gpu::DeviceVector<int>& getCommElem4TeacherCounts() const {
return m_comm_teacher_counts_elem4_d;
}
inline const amrex::Gpu::DeviceVector<int>& getCommTeacherCounts() const {
return m_comm_teacher_counts_total_d;
}

/*! \brief return the symptomatic withdrawal status */
inline int symptomaticWithdraw() const {
return m_symptomatic_withdraw;
}

/*! \brief return the symptomatic withdrawal compliance */
inline amrex::Real symptomaticWithdrawCompliance() const {
return m_symptomatic_withdraw_compliance;
}

void printStudentTeacherCounts() const;

void printAgeGroupCounts() const;

amrex::iMultiFab m_student_counts;
amrex::Gpu::DeviceVector<int> m_unit_teacher_counts_d;
amrex::Gpu::DeviceVector<int> m_comm_teacher_counts_total_d;
amrex::Gpu::DeviceVector<int> m_comm_teacher_counts_high_d;
amrex::Gpu::DeviceVector<int> m_comm_teacher_counts_middle_d;
amrex::Gpu::DeviceVector<int> m_comm_teacher_counts_elem3_d;
amrex::Gpu::DeviceVector<int> m_comm_teacher_counts_elem4_d;
amrex::Gpu::DeviceVector<int> m_comm_teacher_counts_daycr_d;
std::vector<long> m_student_teacher_ratios = {20, 20, 20, 20, 20, 1000000000}; // ignore daycare teachers since daycare interaction isnt handled yet!
/// Used only for Census data. A ratio for each school type: none, college, high, middle, elem, daycare
int m_student_teacher_ratio[SchoolType::total] = {0, 15, 15, 15, 15, 15};

int m_num_diseases; /*!< Number of diseases */
std::vector<std::string> m_disease_names; /*!< names of the diseases */

protected:
int m_symptomatic_withdraw = 1; /*!< whether symptomatic agents withdraw or not */
amrex::iMultiFab comm_mf;

LngLatToGrid lnglat_to_grid;
GridToLngLat grid_to_lnglat;

short ic_type;

protected:
amrex::Real m_shelter_compliance = 0.95_rt; /*!< Shelter-in-place compliance rate */
amrex::Real m_symptomatic_withdraw_compliance = 0.95_rt; /*!< Symptomatic withdrawal compliance rate */

std::vector<DiseaseParm*> m_h_parm; /*!< Disease parameters */
std::vector<DiseaseParm*> m_d_parm; /*!< Disease parameters (GPU device) */

std::map<std::string, IntModel*> m_interactions; /*!< Map of interaction models */
std::map<ExaEpi::InteractionNames, IntModel*> m_interactions; /*!< Map of interaction models */
std::unique_ptr<HospitalModel<PCType, PTDType, PType>> m_hospital; /*!< hospital model */

/*! Flag to indicate if agents are at work */
Expand All @@ -175,7 +203,7 @@ protected:
Array<int, IntIdx::nattribs> max_attribute_values;

/*! \brief queries if a given interaction type (model) is available */
inline bool haveInteractionModel( const std::string& a_mod_name ) const {
inline bool haveInteractionModel (ExaEpi::InteractionNames a_mod_name) const {
return (m_interactions.find(a_mod_name) != m_interactions.end());
}

Expand All @@ -185,4 +213,6 @@ protected:

using AgentIterator = typename AgentContainer::ParIterType;



#endif
Loading

0 comments on commit 7c15756

Please sign in to comment.