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] Diff of /trunk/gadget/maininfo.cc
[mareframe] / trunk / gadget / maininfo.cc Repository:
ViewVC logotype

Diff of /trunk/gadget/maininfo.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 10, Wed Jun 10 13:01:42 2015 UTC revision 11, Thu Jul 23 19:00:38 2015 UTC
# Line 41  Line 41 
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    
# Line 78  Line 78 
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[]) {
# Line 87  Line 91 
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) {
# Line 101  Line 109 
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;
# Line 220  Line 231 
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
# Line 234  Line 264 
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) {

Legend:
Removed from v.10  
changed lines
  Added in v.11

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

Powered By FusionForge