Gadget
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
stochasticdata.h
Go to the documentation of this file.
1 #ifndef stochasticdata_h
2 #define stochasticdata_h
3 
4 #include "doublevector.h"
5 #include "intvector.h"
6 #include "parameter.h"
7 #include "parametervector.h"
8 #include "charptrvector.h"
9 #include "commentstream.h"
10 #include "initialinputfile.h"
11 #include "gadget.h"
12 
13 #ifdef GADGET_NETWORK
14 #include "mpi.h"
15 #include "slavecommunication.h"
16 #endif
17 
23 public:
33  StochasticData(const char* const filename, int p);
38  StochasticData(const char* const filename);
42  virtual ~StochasticData();
47  void readNextLine();
52  int isDataLeft() { return readInfo->isDataLeft(); };
57  int numVariables() const { return values.Size(); };
62  int numSwitches() const { return switches.Size(); };
67  int isOptGiven() const;
73  int getOptFlag(int i) const;
79  double getValue(int i) const { return values[i]; };
85  double getLowerBound(int i) const { return lowerbound[i]; };
91  double getUpperBound(int i) const { return upperbound[i]; };
97  Parameter getSwitch(int i) const { return switches[i]; };
98 #ifdef GADGET_NETWORK
102  void readFromNetwork();
107  void sendDataToNetwork(double score);
111  void readNextLineFromNetwork();
116  int getDataFromNetwork() { return getdata; };
117 #endif
118 protected:
146  int netrun;
147 #ifdef GADGET_NETWORK
151  SlaveCommunication* slave;
155  double* dataFromMaster;
159  int getdata;
160 #endif
161 };
162 
163 #endif
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 isDataLeft()
This function will check to see if there is more data to read in the input file.
Definition: initialinputfile.cc:6
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
The class SlaveCommunication handles netcommunication for a slave process communicating with a master...
Definition: slavecommunication.h:16
This is the class used to get values for the variables used in the model simulation....
Definition: stochasticdata.h:22
double getUpperBound(int i) const
This function will return the upper bound for a switch in the input file.
Definition: stochasticdata.h:91
int netrun
This is the flag to denote whether gadget is running in network mode or not.
Definition: stochasticdata.h:146
int getOptFlag(int i) const
This function will return the optimising flag for a switch in the input file.
Definition: stochasticdata.cc:86
InitialInputFile * readInfo
This is the InitialInputFile used to read from file the initial values and bounds of the parameters f...
Definition: stochasticdata.h:97
DoubleVector values
This is the DoubleVector used to store the values of the parameters read from file.
Definition: stochasticdata.h:130
double getLowerBound(int i) const
This function will return the lower bound for a switch in the input file.
Definition: stochasticdata.h:85
DoubleVector upperbound
This is the DoubleVector used to store the upper bounds of the parameters read from file.
Definition: stochasticdata.h:138
Parameter getSwitch(int i) const
This function will return the paramter name for a switch in the input file.
Definition: stochasticdata.h:97
int numSwitches() const
This function will return the number of switches read from the input file.
Definition: stochasticdata.h:62
ParameterVector switches
This is the ParameterVector used to store the parameters read from file.
Definition: stochasticdata.h:126
int isDataLeft()
This function will check to see if there is more data to read in the input file.
Definition: stochasticdata.h:52
DoubleVector lowerbound
This is the DoubleVector used to store the lower bounds of the parameters read from file.
Definition: stochasticdata.h:134
void readNextLine()
This function will read the next line of data from the input file.
Definition: stochasticdata.cc:78
virtual ~StochasticData()
This is the default StochasticData destructor.
Definition: stochasticdata.cc:63
double getValue(int i) const
This function will return the value of a switch in the input file.
Definition: stochasticdata.h:79
int isOptGiven() const
This function will check to see if optimising flags have been specified in the input file.
Definition: stochasticdata.cc:92
int numVariables() const
This function will return the number of variables read from the input file.
Definition: stochasticdata.h:57
StochasticData()
This is the default StochasticData constructor.
Definition: stochasticdata.cc:52
IntVector optimise
This is the IntVector used to store the flag to denote whether to optimise the parameters read from f...
Definition: stochasticdata.h:142