FRED
|
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: Population.h 00010 // 00011 00012 #ifndef _FRED_POPULATION_H 00013 #define _FRED_POPULATION_H 00014 00015 #include "Global.h" 00016 #include "Demographics.h" 00017 00018 class Person; 00019 class Disease; 00020 class Antivirals; 00021 class AV_Manager; 00022 class Vaccine_Manager; 00023 00024 using namespace std; 00025 #include <map> 00026 #include <vector> 00027 typedef map <Person*, bool> ChangeMap; 00028 00029 class Population { 00030 public: 00031 00035 Population(); 00036 ~Population(); 00037 00041 void get_parameters(); 00042 00047 void setup(); 00048 00052 void quality_control(); 00053 00060 void print(int incremental=0, int day=0); 00061 00065 void end_of_run(); 00066 00071 void update(int day); 00072 00077 void report(int day); 00078 00083 Disease * get_disease(int disease_id); 00084 00088 int get_pop_size() { return pop_size; } 00089 00090 //Mitigation Managers 00094 AV_Manager * get_av_manager(){ return av_manager; } 00095 00099 Vaccine_Manager * get_vaccine_manager() { return vacc_manager;} 00100 00104 void add_person(Person * per); 00105 00109 void delete_person(Person * per); 00110 00116 void prepare_to_die(int day, Person *per); 00117 00123 void prepare_to_give_birth(int day, Person *per); 00124 00129 Person * get_person(int n) { return pop[n]; } 00130 00131 // Modifiers on the entire pop; 00132 // void apply_residual_immunity(Disease *disease) {} 00133 00134 // track those agents that have changed since the last incremental dump 00139 void set_changed(Person *p); 00140 00144 void assign_classrooms(); 00145 00149 void assign_offices(); 00150 00155 void get_network_stats(char *directory); 00156 00160 void read_population(); 00161 00168 void report_birth(int day, Person *per) const; 00169 00176 void report_death(int day, Person *per) const; 00177 00182 char * get_pstring(int id); 00183 00187 void print_age_distribution(char *dir, char * date_string, int run); 00188 00192 Person * select_random_person(); 00193 00198 static int get_next_id(); 00199 00200 private: 00201 vector <Person *> pop; // list of all agents 00202 vector <Person *> graveyard; // list of all dead agents 00203 vector <Person *> death_list; // list agents to die today 00204 vector <Person *> maternity_list; // list agents to give birth today 00205 int pop_size; 00206 Disease *disease; 00207 double **mutation_prob; 00208 map<Person *,int> pop_map; 00209 ChangeMap incremental_changes; // incremental "list" (actually a C++ map) 00210 // of those agents whose stats 00211 // have changed since the last history dump 00212 ChangeMap never_changed; // agents who have *never* changed 00213 00214 static char popfile[256]; 00215 static char profilefile[256]; 00216 static char pop_outfile[256]; 00217 static char output_population_date_match[256]; 00218 static int output_population; 00219 static bool is_initialized; 00220 static int next_id; 00221 00222 //Mitigation Managers 00223 AV_Manager *av_manager; 00224 Vaccine_Manager *vacc_manager; 00225 00229 void clear_static_arrays(); 00230 00235 void write_population_output_file(int day); 00236 00237 }; 00238 00239 #endif // _FRED_POPULATION_H