41 |
} |
} |
42 |
|
|
43 |
MainInfo::MainInfo() |
MainInfo::MainInfo() |
44 |
: givenOptInfo(0), givenInitialParam(0), runoptimise(0), |
: givenOptInfo(0), givenInitialParam(0), runoptimise(0), runomp(0), |
45 |
runstochastic(0), runnetwork(0), runprint(1), forceprint(0), |
runstochastic(0), runnetwork(0), runprint(1), forceprint(0), |
46 |
printInitialInfo(0), printFinalInfo(0), printLogLevel(0), maxratio(0.95) { |
printInitialInfo(0), printFinalInfo(0), printLogLevel(0), maxratio(0.95) { |
47 |
|
|
78 |
delete[] strMainGadgetFile; |
delete[] strMainGadgetFile; |
79 |
strMainGadgetFile = NULL; |
strMainGadgetFile = NULL; |
80 |
} |
} |
81 |
|
if (seed != NULL) { |
82 |
|
delete[] seed; |
83 |
|
seed = NULL; |
84 |
|
} |
85 |
} |
} |
86 |
|
|
87 |
void MainInfo::read(int aNumber, char* const aVector[]) { |
void MainInfo::read(int aNumber, char* const aVector[]) { |
91 |
return; |
return; |
92 |
} |
} |
93 |
|
|
94 |
|
seed = new unsigned[3]; |
95 |
|
seed[0] = 0; |
96 |
|
seed[1] = 0; |
97 |
|
seed[2] = 0; |
98 |
int k = 1; |
int k = 1; |
99 |
while (k < aNumber) { |
while (k < aNumber) { |
100 |
if (strcasecmp(aVector[k], "-l") == 0) { |
if (strcasecmp(aVector[k], "-l") == 0) { |
109 |
|
|
110 |
} else if (strcasecmp(aVector[k], "-s") == 0) { |
} else if (strcasecmp(aVector[k], "-s") == 0) { |
111 |
runstochastic = 1; |
runstochastic = 1; |
112 |
|
//FIXME |
113 |
|
}else if (strcasecmp(aVector[k], "-omp") == 0) { |
114 |
|
runomp = 1; |
115 |
|
|
116 |
} else if (strcasecmp(aVector[k], "-m") == 0) { |
} else if (strcasecmp(aVector[k], "-m") == 0) { |
117 |
ifstream infile; |
ifstream infile; |
231 |
if (k == aNumber - 1) |
if (k == aNumber - 1) |
232 |
this->showCorrectUsage(aVector[k]); |
this->showCorrectUsage(aVector[k]); |
233 |
k++; |
k++; |
234 |
srand(atoi(aVector[k])); |
seed[0] = atoi(aVector[k]); |
235 |
|
srand(seed[0]); |
236 |
|
//FIXME |
237 |
|
} else if (strcasecmp(aVector[k], "-seedM") == 0) { |
238 |
|
//JMB experimental setting of random number seed from the commandline |
239 |
|
//if the "seed" is also specified in the optinfo file then that will override |
240 |
|
//any seed that is specified on the commandline |
241 |
|
if (k == aNumber - 1) |
242 |
|
this->showCorrectUsage(aVector[k]); |
243 |
|
k++; |
244 |
|
seed[1] = atoi(aVector[k]); |
245 |
|
|
246 |
|
} else if (strcasecmp(aVector[k], "-seedP") == 0) { |
247 |
|
//JMB experimental setting of random number seed from the commandline |
248 |
|
//if the "seed" is also specified in the optinfo file then that will override |
249 |
|
//any seed that is specified on the commandline |
250 |
|
if (k == aNumber - 1) |
251 |
|
this->showCorrectUsage(aVector[k]); |
252 |
|
k++; |
253 |
|
seed[2] = atoi(aVector[k]); |
254 |
|
|
255 |
} else if (strcasecmp(aVector[k], "-maxratio") == 0) { |
} else if (strcasecmp(aVector[k], "-maxratio") == 0) { |
256 |
//JMB experimental setting of maximum ratio of stock consumed in one timestep |
//JMB experimental setting of maximum ratio of stock consumed in one timestep |
264 |
|
|
265 |
k++; |
k++; |
266 |
} |
} |
267 |
|
|
268 |
|
if (seed[0] == 0) { |
269 |
|
seed[0] = unsigned(time(NULL)); |
270 |
|
if (seed[1] == 0) |
271 |
|
seed[1] = unsigned(time(NULL)); |
272 |
|
if (seed[2] == 0) |
273 |
|
seed[2] = unsigned(time(NULL)); |
274 |
|
} else { |
275 |
|
if (seed[1] == 0) |
276 |
|
seed[1] = seed[0]; |
277 |
|
if (seed[2] == 0) |
278 |
|
seed[2] = seed[0]; |
279 |
|
} |
280 |
|
|
281 |
|
|
282 |
|
|
283 |
|
|
284 |
} |
} |
285 |
|
|
286 |
void MainInfo::checkUsage(const char* const inputdir, const char* const workingdir) { |
void MainInfo::checkUsage(const char* const inputdir, const char* const workingdir) { |