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: Timestep_Map.h 00010 // 00011 00012 #ifndef _FRED_TIMESTEP_MAP_H 00013 #define _FRED_TIMESTEP_MAP_H 00014 00015 #include "Global.h" 00016 #include <stdio.h> 00017 #include <map> 00018 00019 using namespace std; 00020 00021 class Timestep_Map { 00022 // The Day Map class is an input structure to hold a list of values 00023 // that are indexed by timesteps, this is used for values that 00024 // need to be changed on certain timesteps throughout the simulation 00025 // Based on David Galloway's initial seeding. 00026 00027 // A Timestep_Map is to be specified in a seperate file 00028 // If a Timestep_Map is specified with [] on the end, it is assumed to 00029 // be disease specific 00030 00031 // This structure is designed so that if there is a specification in the 00032 // input that specifies "none" as the keyword, the structure is empty. 00033 00034 // The input keyword will be the name of the structure_file. So if the 00035 // name of the Map is passed as "primary_cases", the param keyword will 00036 // be "primary_cases_file". 00037 00038 // The format of the file is as such 00039 // 0 100 00040 // 1 0 00041 // Should be interpreted as 100 on timestep 0, 0 on timestep 1 and beyond 00042 // 00043 // 0 100 00044 // 100 0 00045 // Should be interpreted as 100 for timestep 0 - 99, and 0 on timestep 100 and above 00046 // Updated: Shawn Brown 00047 00048 public: 00049 Timestep_Map(); 00050 Timestep_Map(string _name); 00051 ~Timestep_Map(); 00052 00053 // Utility Members 00054 int get_value_for_timestep(int ts, int offset); // returns the value for the given timestep - delay 00055 bool is_empty() const { return values->empty(); } 00056 virtual void print(); 00057 00058 virtual void read_map(); 00059 00060 protected: 00061 map <int, int>* values; // Map structure that holds <ts, value> 00062 string name; // Name of the map 00063 char map_file_name[255]; 00064 int current_value; // Holds the current value of th map. 00065 }; 00066 00067 #endif // _FRED_TIMESTEP_MAP_H