Gadget
initialinputfile.h
Go to the documentation of this file.
1 #ifndef initialinputfile_h
2 #define initialinputfile_h
3 
4 #include "charptrvector.h"
5 #include "parametervector.h"
6 #include "doublevector.h"
7 #include "intvector.h"
8 #include "commentstream.h"
9 
15 public:
20  InitialInputFile(const char* const filename);
34  DoubleVector& low, DoubleVector& upp, IntVector& opt);
39  void getValues(DoubleVector& val);
44  void getSwitches(ParameterVector& sw);
49  void readNextLine();
53  void readFromFile();
58  int isDataLeft();
63  int numSwitches() const { return switches.Size(); };
68  int numVariables() const { return values.Size(); };
73  int isRepeatedValues() { return repeatedValues; };
79  int getOptimise(int i) const { return optimise[i]; };
85  double getValue(int i) const { return values[i]; };
91  double getLower(int i) const { return lowerbound[i]; };
97  double getUpper(int i) const { return upperbound[i]; };
103  Parameter getSwitch(int i) const { return switches[i]; };
104 private:
108  void readHeader();
112  CommentStream infile;
116  ifstream tmpinfile;
120  ParameterVector switches;
124  DoubleVector values;
128  DoubleVector lowerbound;
132  DoubleVector upperbound;
136  IntVector optimise;
140  int repeatedValues;
141 };
142 
143 #endif
This is the class used to strip comments (and whitespace) from any input stream.
Definition: commentstream.h:40
This class implements a dynamic vector of double values.
Definition: doublevector.h:11
int Size() const
This will return the size of the vector.
Definition: doublevector.h:55
This is the class used to get and store initial values for the variables used in the model simulation...
Definition: initialinputfile.h:14
int numSwitches() const
This function will return the number of switches read from the input file.
Definition: initialinputfile.h:63
void readNextLine()
This is the function that will read the next line of the data from the input file.
Definition: initialinputfile.cc:188
Parameter getSwitch(int i) const
This function will return the paramter name for a switch in the input file.
Definition: initialinputfile.h:103
void getSwitches(ParameterVector &sw)
This function will return a copy of the names of the variables.
Definition: initialinputfile.cc:29
~InitialInputFile()
This is the default InitialInputFile destructor.
Definition: initialinputfile.cc:40
void readFromFile()
This is the function that will read the data from the input file.
Definition: initialinputfile.cc:107
int isRepeatedValues()
This function will return the value of the flag used to denote that the 'repeated values' format is u...
Definition: initialinputfile.h:73
InitialInputFile(const char *const filename)
This is the default InitialInputFile constructor.
Definition: initialinputfile.cc:33
int isDataLeft()
This function will check to see if there is more data to read in the input file.
Definition: initialinputfile.cc:6
double getLower(int i) const
This function will return the lower bound for a switch in the input file.
Definition: initialinputfile.h:91
int numVariables() const
This function will return the number of variables read from the input file.
Definition: initialinputfile.h:68
int getOptimise(int i) const
This function will return the optimising flag for a switch in the input file.
Definition: initialinputfile.h:79
void getValues(DoubleVector &val)
This function will return a copy of the value of the variables.
Definition: initialinputfile.cc:25
void getVectors(ParameterVector &sw, DoubleVector &val, DoubleVector &low, DoubleVector &upp, IntVector &opt)
This function will return a copy of the data read from the input file.
Definition: initialinputfile.cc:15
double getUpper(int i) const
This function will return the upper bound for a switch in the input file.
Definition: initialinputfile.h:97
double getValue(int i) const
This function will return the value of a switch in the input file.
Definition: initialinputfile.h:85
This class implements a dynamic vector of int values.
Definition: intvector.h:11
This class implements a dynamic vector of Parameter values.
Definition: parametervector.h:12
int Size() const
This will return the size of the vector.
Definition: parametervector.h:49
This is the class used to store the name of a variable used in the model simulation.
Definition: parameter.h:11