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 |
} else if (strcasecmp(aVector[k], "-m") == 0) { |
} else if (strcasecmp(aVector[k], "-m") == 0) { |
113 |
ifstream infile; |
ifstream infile; |
114 |
CommentStream incomment(infile); |
CommentStream incomment(infile); |
227 |
if (k == aNumber - 1) |
if (k == aNumber - 1) |
228 |
this->showCorrectUsage(aVector[k]); |
this->showCorrectUsage(aVector[k]); |
229 |
k++; |
k++; |
230 |
srand(atoi(aVector[k])); |
seed[0] = atoi(aVector[k]); |
231 |
|
srand(seed[0]); |
232 |
|
//seedM = seed to set the metropolis acceptance in SA |
233 |
|
} else if (strcasecmp(aVector[k], "-seedM") == 0) { |
234 |
|
//JMB experimental setting of random number seed from the commandline |
235 |
|
//if the "seed" is also specified in the optinfo file then that will override |
236 |
|
//any seed that is specified on the commandline |
237 |
|
if (k == aNumber - 1) |
238 |
|
this->showCorrectUsage(aVector[k]); |
239 |
|
k++; |
240 |
|
seed[1] = atoi(aVector[k]); |
241 |
|
//seedP = seed to set the orden of evaluation of the parameter in SA |
242 |
|
} else if (strcasecmp(aVector[k], "-seedP") == 0) { |
243 |
|
//JMB experimental setting of random number seed from the commandline |
244 |
|
//if the "seed" is also specified in the optinfo file then that will override |
245 |
|
//any seed that is specified on the commandline |
246 |
|
if (k == aNumber - 1) |
247 |
|
this->showCorrectUsage(aVector[k]); |
248 |
|
k++; |
249 |
|
seed[2] = atoi(aVector[k]); |
250 |
|
|
251 |
} else if (strcasecmp(aVector[k], "-maxratio") == 0) { |
} else if (strcasecmp(aVector[k], "-maxratio") == 0) { |
252 |
//JMB experimental setting of maximum ratio of stock consumed in one timestep |
//JMB experimental setting of maximum ratio of stock consumed in one timestep |
260 |
|
|
261 |
k++; |
k++; |
262 |
} |
} |
263 |
|
|
264 |
|
if (seed[0] == 0) { |
265 |
|
seed[0] = unsigned(time(NULL)); |
266 |
|
if (seed[1] == 0) |
267 |
|
seed[1] = unsigned(time(NULL)); |
268 |
|
if (seed[2] == 0) |
269 |
|
seed[2] = unsigned(time(NULL)); |
270 |
|
} else { |
271 |
|
if (seed[1] == 0) |
272 |
|
seed[1] = seed[0]; |
273 |
|
if (seed[2] == 0) |
274 |
|
seed[2] = seed[0]; |
275 |
|
} |
276 |
|
|
277 |
|
|
278 |
|
|
279 |
|
|
280 |
} |
} |
281 |
|
|
282 |
void MainInfo::checkUsage(const char* const inputdir, const char* const workingdir) { |
void MainInfo::checkUsage(const char* const inputdir, const char* const workingdir) { |