FRED
Epidemic.h
00001 /*
00002   Copyright 2009 by the University of Pittsburgh
00003   Licensed under the Academic Free License version 3.0
00004   See the file "LICENSE" for more information
00005 */
00006 
00007 //
00008 //
00009 // File: Epidemic.h
00010 //
00011 
00012 #ifndef _FRED_EPIDEMIC_H
00013 #define _FRED_EPIDEMIC_H
00014 
00015 #include "Global.h"
00016 #include <set>
00017 #include <map>
00018 #include <vector>
00019 
00020 using namespace std;
00021 
00022 class Disease;
00023 class Person;
00024 class Timestep_Map;
00025 class Multistrain_Timestep_Map;
00026 class Place;
00027 
00028 class Epidemic {
00029 public:
00030   Epidemic(Disease * str, Timestep_Map *);
00031   ~Epidemic();
00032   
00037   void print_stats(int day);
00038 
00044   void add_infectious_place(Place *p, char type);
00045 
00049   void get_infectious_places(int day);
00050 
00054   double get_attack_rate() { return attack_rate; }
00055 
00056   void get_primary_infections(int day);
00057   void transmit(int day);
00058 
00062   int get_clinical_incidents() { return clinical_incidents; }
00063 
00067   int get_total_clinical_incidents() { return total_clinical_incidents; }
00068 
00072   double get_clinical_attack_rate() { return clinical_attack_rate; }
00073 
00077   int get_incident_infections() { return incident_infections; }
00078 
00082   int get_total_incidents() { return total_incidents; }
00083 
00084   void become_susceptible(Person *person);
00085   void become_unsusceptible(Person *person);
00086   void become_exposed(Person *person);
00087   void become_infectious(Person *person);
00088   void become_uninfectious(Person *person);
00089   void become_symptomatic(Person *person);
00090   void become_removed(Person *person, bool susceptible, bool infectious, bool symptomatic);
00091   void become_immune(Person *person, bool susceptible, bool infectious, bool symptomatic);
00092 
00093   void find_infectious_places(int day, int dis);
00094   void add_susceptibles_to_infectious_places(int day, int dis);
00095   void increment_infectee_count(int day) { infectees[day]++; }
00096 
00097   // static methods
00098   static void update(int day);
00099   static void transmit_infection(int day);
00100   static void get_visitors_to_infectious_places(int day);
00101 
00102 private:
00103   Disease * disease;
00104   int id;
00105   int N;                                      // current population size
00106   int N_init;                                 // initial population size
00107   typedef pair<Person *,int> person_pair;
00108   struct person_pair_comparator {
00109     bool operator()(const person_pair A, const person_pair B) const  {
00110       return A.second < B.second;
00111     }
00112   };
00113 
00114   Timestep_Map* primary_cases_map;
00115   set <person_pair, person_pair_comparator> susceptible_list;
00116   set <person_pair, person_pair_comparator> infectious_list;
00117   vector <Place *> inf_households;
00118   vector <Place *> inf_neighborhoods;
00119   vector <Place *> inf_classrooms;
00120   vector <Place *> inf_schools;
00121   vector <Place *> inf_workplaces;
00122   vector <Place *> inf_offices;
00123   double attack_rate;
00124   double clinical_attack_rate;
00125   int clinical_incidents;
00126   int total_clinical_incidents;
00127   int incident_infections;
00128   int total_incidents;
00129   int * new_cases;
00130   int * infectees;
00131   double RR;                                    // reproductive rate
00132   int cohort_size;
00133   int exposed_count;
00134   int symptomatic_count;
00135   int removed_count;
00136   int immune_count;
00137   map<int, int> incidence;
00138   map<int, int> prevalence;
00139 };
00140 
00141 #endif // _FRED_EPIDEMIC_H
 All Classes Functions