Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Mareframe
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[mareframe] Annotation of /trunk/gadget/initialinputfile.h
[mareframe] / trunk / gadget / initialinputfile.h Repository:
ViewVC logotype

Annotation of /trunk/gadget/initialinputfile.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

1 : agomez 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 :    
10 :     /**
11 :     * \class InitialInputFile
12 :     * \brief This is the class used to get and store initial values for the variables used in the model simulation from an input file
13 :     */
14 :     class InitialInputFile {
15 :     public:
16 :     /**
17 :     * \brief This is the default InitialInputFile constructor
18 :     * \param filename is the name of the file to read the initial parameter values from
19 :     */
20 :     InitialInputFile(const char* const filename);
21 :     /**
22 :     * \brief This is the default InitialInputFile destructor
23 :     */
24 :     ~InitialInputFile();
25 :     /**
26 :     * \brief This function will return a copy of the data read from the input file
27 :     * \param sw is the ParameterVector that will contain a copy of the names
28 :     * \param val is the DoubleVector that will contain a copy of the values
29 :     * \param low is the DoubleVector that will contain a copy of the lower bounds
30 :     * \param upp is the DoubleVector that will contain a copy of the upper bounds
31 :     * \param opt is the IntVector that will contain a copy of the optimise flags
32 :     */
33 :     void getVectors(ParameterVector& sw, DoubleVector& val,
34 :     DoubleVector& low, DoubleVector& upp, IntVector& opt);
35 :     /**
36 :     * \brief This function will return a copy of the value of the variables
37 :     * \param val is the DoubleVector that will contain a copy of the values
38 :     */
39 :     void getValues(DoubleVector& val);
40 :     /**
41 :     * \brief This function will return a copy of the names of the variables
42 :     * \param sw is the ParameterVector that will contain a copy of the names
43 :     */
44 :     void getSwitches(ParameterVector& sw);
45 :     /**
46 :     * \brief This is the function that will read the next line of the data from the input file
47 :     * \note This function is only used when the data is in the 'repeated values' format
48 :     */
49 :     void readNextLine();
50 :     /**
51 :     * \brief This is the function that will read the data from the input file
52 :     */
53 :     void readFromFile();
54 :     /**
55 :     * \brief This function will check to see if there is more data to read in the input file
56 :     * \return 1 if there is more data to read from the input file, 0 otherwise
57 :     */
58 :     int isDataLeft();
59 :     /**
60 :     * \brief This function will return the number of switches read from the input file
61 :     * \return number of switches
62 :     */
63 :     int numSwitches() const { return switches.Size(); };
64 :     /**
65 :     * \brief This function will return the number of variables read from the input file
66 :     * \return number of variables
67 :     */
68 :     int numVariables() const { return values.Size(); };
69 :     /**
70 :     * \brief This function will return the value of the flag used to denote that the 'repeated values' format is used in the input file
71 :     * \return repeatedValues
72 :     */
73 :     int isRepeatedValues() { return repeatedValues; };
74 :     /**
75 :     * \brief This function will return the optimising flag for a switch in the input file
76 :     * \param i is the index for the switch
77 :     * \return optimise flag for the switch
78 :     */
79 :     int getOptimise(int i) const { return optimise[i]; };
80 :     /**
81 :     * \brief This function will return the value of a switch in the input file
82 :     * \param i is the index for the switch
83 :     * \return value of the switch
84 :     */
85 :     double getValue(int i) const { return values[i]; };
86 :     /**
87 :     * \brief This function will return the lower bound for a switch in the input file
88 :     * \param i is the index for the switch
89 :     * \return lower bound for the switch
90 :     */
91 :     double getLower(int i) const { return lowerbound[i]; };
92 :     /**
93 :     * \brief This function will return the upper bound for a switch in the input file
94 :     * \param i is the index for the switch
95 :     * \return upper bound for the switch
96 :     */
97 :     double getUpper(int i) const { return upperbound[i]; };
98 :     /**
99 :     * \brief This function will return the paramter name for a switch in the input file
100 :     * \param i is the index for the switch
101 :     * \return parameter name for the switch
102 :     */
103 :     Parameter getSwitch(int i) const { return switches[i]; };
104 :     private:
105 :     /**
106 :     * \brief This is the function that will read the header information from the input file
107 :     */
108 :     void readHeader();
109 :     /**
110 :     * \brief This is the CommentStream to read the initial values data from
111 :     */
112 :     CommentStream infile;
113 :     /**
114 :     * \brief This is the ifstream to read the initial values data from
115 :     */
116 :     ifstream tmpinfile;
117 :     /**
118 :     * \brief This is the ParameterVector used to store the parameters read from file
119 :     */
120 :     ParameterVector switches;
121 :     /**
122 :     * \brief This is the DoubleVector used to store the values of the parameters read from file
123 :     */
124 :     DoubleVector values;
125 :     /**
126 :     * \brief This is the DoubleVector used to store the lower bounds of the parameters read from file
127 :     */
128 :     DoubleVector lowerbound;
129 :     /**
130 :     * \brief This is the DoubleVector used to store the upper bounds of the parameters read from file
131 :     */
132 :     DoubleVector upperbound;
133 :     /**
134 :     * \brief This is the IntVector used to store the flag to denote whether to optimise the parameters read from file
135 :     */
136 :     IntVector optimise;
137 :     /**
138 :     * \brief This is the flag used to denote whether the data is in the 'repeated values' format or not
139 :     */
140 :     int repeatedValues;
141 :     };
142 :    
143 :     #endif

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge