Paramotopy
parallel parameter homotopy through bertini
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
runinfo.cpp
Go to the documentation of this file.
1 //contains the runinfo class
2 
3 #include "runinfo.hpp"
4 
5 
7  // set the step1path to the string location
8  // set various file names to the appropriate file names
9  boost::filesystem::path step1path(this->location);
10  step1path /= ("step1"); //concatenation in boost
11  boost::filesystem::path nonsingular_solutions = step1path;
12  nonsingular_solutions /= ("nonsingular_solutions");
13  // test if we are finished with a run
14  if (boost::filesystem::exists(nonsingular_solutions)){ // if it can see the 'finished' file
15  // Redo the step1 or not. User choice.
16  if (get_int_choice("found completed previous step1 run.\nremove, or bail out?\n0) bail out\n1) remove and continue\n: ",0,1)==1){
17  boost::filesystem::remove_all( step1path );
19  }
20  else{
21  // Tell the user we are returning to the main menu without doing a step 1 run.
22  std::cout << "returning to paramotopy main menu without running step one"
23  << std::endl;
24  return false;
25  }
26 
27  } // if there is no nonsingular file, ii.e. run is not done
28  else{
29  typedef std::vector< boost::filesystem::path > vec;
30  vec v;
31  // not sure what this is doing ... boost stuff -- men
32  copy(boost::filesystem::directory_iterator(step1path), boost::filesystem::directory_iterator(), back_inserter(v));
33  for (vec::const_iterator it (v.begin()); it != v.end(); ++it)
34  {
35  boost::filesystem::remove( *it );
36  }
37  }
38 
39  return true;
40 }
41 
42 
43 //reads in the entire paramotopy input file to memory, and puts it in the string called 'paramotopy_file'
45  // set the filename to null
46  this->paramotopy_file = "";
47  std::string tmpstr;
48  std::ifstream fin;
49  fin.open(this->inputfilename.c_str());
50  // test if the user given input file exists
51  if (!fin.is_open()) {
52  std::cerr << "failed to open paramotopy_input_file " << this->inputfilename << "for reading" << std::endl;
53  }
54  // if the file exists,
55  // then put the input file into memory into paramotopy_file
56  while (getline(fin,tmpstr)) {
57  this->paramotopy_file.append(tmpstr);
58  this->paramotopy_file.append("\n");
59  }
60  fin.close();
61 
62  return;
63 }
64 
65 
66 
67 //writes the original paramotopy input file, in its entirety, to the current run folder.
68 //
69 //assumes that you are in the original directory
70 void runinfo::WriteOriginalParamotopy(boost::filesystem::path dir){
71 
72  boost::filesystem::path filetoopen = dir;
73  filetoopen /= "paramotopy_input_file";
74 
75  std::ofstream fout;
76  fout.open(filetoopen.c_str());
77  if (!fout.is_open()) {
78  std::cerr << "writing paramotopy file " << filetoopen.string() << " failed." << std::endl;
79  }
80  fout << this->paramotopy_file;
81  fout.close();
82 
83 
84  filetoopen = dir;
85  filetoopen /= "inputfilename";
86  fout.open(filetoopen.c_str());
87  if (!fout.is_open()) {
88  std::cerr << "writing inputfilename file " << filetoopen.string() << " failed." << std::endl;
89  }
90  fout << this->inputfilename.string();
91  fout.close();
92  return;
93 }
94 
95 
96 //this function writes a modified paramotopy file, derived from the original, which is used in step2 failure analysis, to make the input file use a program-generated user-defined file of parameter points, which consist of the failed points.
97 void runinfo::WriteModifiedParamotopy(boost::filesystem::path dir, int iteration){
98 
99  boost::filesystem::path filetoopen = dir;
100  std::stringstream paramotopy_file_str;
101 
102  paramotopy_file_str << this->numfunct << " " << this->numvargroup << " " << this->numparam << " " << this->numconsts << "\n";
103  for (int ii=0; ii < this->numfunct; ++ii) {
104  paramotopy_file_str << this->Functions[ii] << "\n";
105  }
106  for (int ii=0; ii < this->numvargroup; ++ii) {
107  paramotopy_file_str << this->VarGroups[ii] << "\n";
108  }
109  if (this->numconsts > 0) {
110  paramotopy_file_str << this->Constants[0] << "\n";
111 
112  for (int ii=0; ii < this->numconsts; ++ii) {
113  paramotopy_file_str << this->ConstantNames[ii] << "\n";
114  }
115  }
116 
117  paramotopy_file_str << "1\n";
118  paramotopy_file_str << "failed_points" << iteration << "\n";
119 
120 
121  for (int ii = 0; ii < this->numparam; ++ii) {
122  paramotopy_file_str << this->ParameterNames[ii] << "\n";
123  }
124 
125  paramotopy_file_str << this->CustomLines << "\n"; //added 121127 dab puts in the last lines of the paramotopy file.
126 
127 
128  std::ofstream fout;
129  filetoopen /= "paramotopy_input_file";
130  fout.open(filetoopen.c_str());
131  fout << paramotopy_file_str.str();
132  fout.close();
133 
134  return;
135 }
136 
137 
138 
140  //todo: rewrite this using boost
141 
142 
143  this->base_dir = "bfiles_";
144  base_dir += this->inputfilename.filename();
145 
147 
148 
149  boost::filesystem::path prefix_path(inputfilename);
150 
151  prefix = prefix_path.root_name();
152  //std::cout << "prefix" << prefix << "\n";
153  return;
154 }
155 
156 
157 
158 
159 
160 
161 
162 
164 
165  location = "unsetlocation";
166  std::cout << "todo: setlocation whatnot\n";
167 }
168 
169 
170 
171 
172 
173 
174 std::string runinfo::WriteInputStepOne(ProgSettings paramotopy_settings){
175  // Write the input section of the bertini step1 input file.
176  std::stringstream inputfilestream;
177  inputfilestream.precision(15);
178 
179 
180  inputfilestream << "\nINPUT\n";
181  runinfo::MakeVariableGroups(inputfilestream, paramotopy_settings);
182  runinfo::MakeDeclareConstants(inputfilestream);
183  runinfo::MakeDeclareFunctions(inputfilestream);
184  runinfo::MakeConstants(inputfilestream);
185  runinfo::MakeCustomLines(inputfilestream);
186  runinfo::MakeFunctions(inputfilestream);
187  inputfilestream << "\nEND;\n";
188 
189  return inputfilestream.str();
190 }
191 
192 
193 std::string runinfo::WriteInputStepTwo(std::vector<std::pair<double, double> > tmprandomvalues,
194  bool standardstep2){
195 
196  // Write the input portion of the step 2 bertini input file.
197  std::stringstream inputfilestream;
198  inputfilestream.precision(15);
199 
200  inputfilestream << "\nINPUT\n\n";
201  // Variable Group portion
202  inputfilestream << "variable";
203  if (!standardstep2){
204  inputfilestream << "_group ";
205  }
206  else{
207  inputfilestream << " ";
208  }
209  for (int ii = 0; ii < int(VarGroups.size());++ii){
210  inputfilestream << VarGroups[ii]
211  << ( ii != numvargroup-1? ",":";\n\n" );
212 
213 
214  }
215 
216 
217  // constant portion for here and rand in the parameter homotopy
218  if (standardstep2){ // normal parameter run
219 
220 
221  inputfilestream << "constant ";
222  for (int ii = 0; ii < numparam;++ii){
223  inputfilestream << "rand" << ParameterNames[ii]
224  << (ii!= numparam-1?",":";\n");
225  }
226  inputfilestream << "constant ";
227  for (int ii = 0; ii < numparam;++ii){
228  inputfilestream << "here" << ParameterNames[ii]
229  << (ii!= numparam -1?",":";\n");
230  }
231 
232 
233  // user given constants
234  if (Constants.size()!=0){
235  inputfilestream << Constants[0] << "\n";
236  }
237 
238  // Define Path Variable and the parameter homotopies
239 
240  inputfilestream << "pathvariable t;\n"
241  << "parameter ";
242  for (int ii =0;ii < numparam;++ii){
243  inputfilestream << ParameterNames[ii] << (ii!= numparam-1?",":";\n");
244  }
245 
246  // Declare Functions
247  runinfo::MakeDeclareFunctions(inputfilestream); // writes the line "function f1, f2, f3,....."
248  runinfo::MakeConstantsStep2(tmprandomvalues,inputfilestream, standardstep2); // actually write the values for here and rand
249 
250 
251 
252 
253  //print the user-supplied custom stuffs.
254  runinfo::MakeCustomLines(inputfilestream);
255 
256  //print the actual function definitions
257  runinfo::MakeFunctions(inputfilestream);
258  inputfilestream << "END;\n";
259  }
260  else{ // just leave all the parameters as constants, and update the num.out file accordingly
261 
262  inputfilestream << "constant ";
263  for (int ii = 0; ii < numparam;++ii){
264  inputfilestream << ParameterNames[ii]
265  << (ii!= numparam-1?",":";\n");
266  }
267 
268  // user given constants
269  if (Constants.size()!=0){
270  inputfilestream << Constants[0] << "\n";
271  }
272 
273 
274  // Declare Functions
275  runinfo::MakeDeclareFunctions(inputfilestream);
276 
277 
278  runinfo::MakeConstantsStep2(tmprandomvalues,inputfilestream, standardstep2);
279 
280  //print the user-supplied custom stuffs.
281  runinfo::MakeCustomLines(inputfilestream);
282 
283  //print the actual function definitions
284 
285 
286  runinfo::MakeFunctions(inputfilestream);
287  inputfilestream << "END;\n";
288 
289 
290 
291  }
292  return inputfilestream.str();
293 }
294 
295 
296 
297 
298 //for getting file name
300 
301  bool finfound = false;
302  std::string filename;
303 
304  while (!finfound) {
305 
306  std::cout << "Enter the input file's name. (% cancels when applicable)\n: ";
307  filename = getAlphaNumeric_WithSpaces();
308 
309  size_t found=filename.find('%');
310  if (found!=std::string::npos) {
311  if ( (int(found) == 0) && boost::filesystem::exists(this->inputfilename)) { // if already have a good one, and user wants to bail out.
312  std::cout << "canceling load.\n" << std::endl;
313  filename = this->inputfilename.string();
314  break;
315  }
316  }
317 
318  if (boost::filesystem::exists(filename)){
319  finfound = true;
320  }
321  else {
322  std::cout << "could not open a file of that name... try again.\n";
323  }
324  }
325 
326  inputfilename = filename;
327 
329 
330  return;
331 }
332 
333 void runinfo::GetInputFileName(boost::filesystem::path suppliedfilename){
334 
335  if (boost::filesystem::exists(suppliedfilename)){ // if it can see the 'finished' file
336  this->inputfilename = suppliedfilename;
337  }
338  else{
339  std::cout << "Unable to find file of supplied name (" << suppliedfilename << ").\n";
341  }
343 
344  return;
345 }
346 
347 
348 
350  std::ofstream fout;
351  fout.precision(16);
352 
353  boost::filesystem::path randpointfilename = base_dir;
354  randpointfilename /= "randompoints_step1";
355  fout.open(randpointfilename.c_str());
356 
357  if (!fout.is_open()) {
358  std::cerr << "failed to open " << randpointfilename << " to write random points\n";
359  }
360  // write the random points
361  for (int ii = 0; ii < numparam; ++ii){
362  fout << RandomValues[ii].first << " "
363  << RandomValues[ii].second << "\n";
364  }
365 
366  fout.close();
367 }
368 
370  // menu option for saving the random points, asks the user for a file name
371  // to save the random start points.
372  std::string randpointfilename;
373  std::cout << "Enter the filename you want to save the random start points to : ";
374 
375  randpointfilename = getAlphaNumeric_WithSpaces();
376 
377  std::ofstream fout;
378  fout.precision(16);
379  fout.open(randpointfilename.c_str());
380 
381  for (int ii = 0; ii < numparam; ++ii){
382  fout << RandomValues[ii].first << " "
383  << RandomValues[ii].second << "\n";
384  }
385  fout.close();
386 
387  return;
388 }
389 
390 
391 
393  std::string randfilename;
394  int cancelthis = 0;
395 
396  std::ifstream fin;
397 
398 
399  while ( !fin.is_open() ) {
400  std::cout << "Enter the filename of the random points you"
401  << " want to load (% to cancel): ";
402  randfilename = getAlphaNumeric_WithSpaces();
403 
404  size_t found=randfilename.find('%');
405  if (found!=std::string::npos) {
406  if ( int(found) == 0) {
407  std::cout << "canceling load.\n" << std::endl;
408  cancelthis = 1;
409  break;
410  }
411 
412  }
413 
414 
415  fin.open(randfilename.c_str());
416  }
417 
418  if (!cancelthis) {
419 
420  std::string mytemp;
421  int ccount=0;
422  std::cout << "\n\n";
423  while(getline(fin,mytemp)){
424  std::stringstream myss;
425  myss << mytemp;
426  double crandreal;
427  double crandimaginary;
428  myss >> crandreal;
429  myss >> crandimaginary;
430  RandomValues[ccount].first = crandreal;
431  RandomValues[ccount].second = crandimaginary;
432  std::cout << ParameterNames[ccount]
433  << " = "
434  << RandomValues[ccount].first
435  << " + "
436  << RandomValues[ccount].second
437  << "*I\n";
438  ++ccount;
439  }
440  std::cout << "\n";
441  fin.close();
442  }
443 
444 
445  runinfo::PrintRandom();//in random.cpp
446 
447  return;
448 }
449 
450 
452  bool loadedrandom = false;
453  RandomValues.clear();
454 
455  boost::filesystem::path randomfilename = base_dir;
456 
457  randomfilename /= "randompoints_step1";
458 
459 
460  if (boost::filesystem::exists(randomfilename)) {
461 
462 
463  std::ifstream fin;
464  fin.open(randomfilename.c_str());
465 
466  if (!fin.is_open()) {
467  std::cerr << "failed to open " << randomfilename << " to read previous random values" << std::endl;
468  return loadedrandom;
469  }
470  else{
471 
472  std::string tmpstr;
473  int ccount=0;
474  while(getline(fin,tmpstr)){
475  std::stringstream myss;
476  myss << tmpstr;
477  std::pair<double,double> crand;
478  myss >> crand.first;
479  myss >> crand.second;
480  RandomValues.push_back(crand);
481 
482  ++ccount;
483  }
484  fin.close();
485 
486  if (int(RandomValues.size()) == numparam){
487  loadedrandom = true;
488  std::cout << "loaded previous random values at " << randomfilename << std::endl;
489  }
490  else{
491  std::cout << "tried to read the previous random values and failed.\n"
492  << "there were " << RandomValues.size() << " read values, and " << numparam << " necessary values"
493  << std::endl;
494  }
495 
496  }
497  }
498 
499  return loadedrandom;
500 }
501 
503 
504  MTRand drand(time(0));
505  int randchoice;
506  std::stringstream menu;
507 
508  menu << "1) Default range [0 to 1)\n"
509  << "2) User-specified range\n"
510  << "Enter in if you would like to use the standard \n"
511  << "default range for random floats or if you would \n"
512  << "like to specify the range : ";
513 
514  randchoice = get_int_choice(menu.str(), 1, 2);
515  if (randchoice == 1){
517  }
518  if (randchoice == 2){
519 
520  int paramrandchoice = 1;
521  while (paramrandchoice != 0){
522  std::cout << "0 - Done specifying random values\n";
523  for (int ii = 0; ii < numparam;++ii){
524  std::cout << ii+1 << " - " << ParameterNames[ii]
525  << "\n";
526  }
527  paramrandchoice = get_int_choice("Enter the parameter you want to rerandomize : ",0,numparam);
528 
529  if (paramrandchoice !=0){
530  std::cout << "Enter a low range followed "
531  << "by a high range for the"
532  << " real and imaginary parts "
533  << "of the chosen parameter."
534  << "\n";
535 
536  double creallow;
537  double crealhigh;
538  double cimaginarylow;
539  double cimaginaryhigh;
540  std::cout << "\n" << "Real Low : ";
541  creallow = getDouble();
542  std::cout << "Real High : ";
543  crealhigh = getDouble();
544  std::cout << "Imaginary Low : ";
545  cimaginarylow = getDouble();
546  std::cout << "Imaginary High : ";
547  cimaginaryhigh = getDouble();
548  double crandreal = drand();
549  double crandimaginary = drand();
550  crandreal*=(crealhigh-creallow);
551  crandimaginary*=(cimaginaryhigh-cimaginarylow);
552  crandreal+=creallow;
553  crandimaginary+=cimaginarylow;
554  RandomValues[paramrandchoice-1].first=crandreal;
555  RandomValues[paramrandchoice-1].second=crandimaginary;
556  }
557  }
558  }
559  runinfo::PrintRandom();//in random.cpp
560 
561 
562 }
563 
564 
565 
566 
568 
569  std::cout << "The random initial values for the parameters are : \n";
570  for (int ii = 0; ii < int(ParameterNames.size());++ii){
571  std::cout << ParameterNames[ii] << " = " << RandomValues[ii].first
572  << " + " << RandomValues[ii].second << "*I\n";
573 
574  }
575  std::cout << std::endl;
576  return;
577 }
578 
580 
581  if (this->userdefined){
582 
583 
584  boost::filesystem::path fileloc(this->base_dir);
585  boost::filesystem::create_directories(fileloc);
586  fileloc /= "mc";
587 
588  boost::filesystem::path mcfile(this->mcfname);
589  if (!boost::filesystem::exists(mcfile)) {
590  std::cerr << "mcfile specified by the input file does not exist..."
591  << std::endl;
592  std::cerr << "mcfile: " << mcfile << "\n";
593  return;
594  }
595 
596 
597  std::string thecommand = "cp ";
598  thecommand.append(this->mcfname);
599  thecommand.append(" ");
600  thecommand.append(fileloc.string());
601  std::cout << thecommand << std::endl;
602  system(thecommand.c_str()); // replace this by non-system command;
603 
604 
605 
606 
607  }
608 }
609 
610 //this is the function to be called in step2.
611 void runinfo::ParseData(boost::filesystem::path dir){
613  boost::filesystem::path filetoopen = dir;
614  filetoopen /= "paramotopy_input_file";
615 
616  std::ifstream fin;
617  fin.open(filetoopen.c_str());
618  if (!fin.is_open()) {
619  std::cerr << "failed to open paramotopy input file " << filetoopen << std::endl;
620  std::exit(1);
621  }
622  // call the main function to parse the data
624 
625  fin.close();
626  // temporary output of the parsed data
627 
628  // make the random values
630 
631  return;
632 
633 }
634 
635 //this is the function to parse an input file to memory.
639 
640  std::ifstream fin;
641  fin.open(inputfilename.c_str());
642  if (!fin.is_open()) {
643  std::cerr << "failed to open paramotopy input file " << inputfilename << std::endl;
644  }
645  // call the main function to parse the data.
647  fin.close();
648 
649 
650  // temporary output of the parsed data
651 
652 
654 }
655 
656 void runinfo::ParseDataGuts(std::ifstream & fin){
657  runinfo::ReadSizes(fin);
660 
661  if (this->numconsts!=0){
663  }
664 
666 
667  std::string tmp;
668  std::stringstream ss;
669  getline(fin,tmp);
670  ss << tmp;
671  ss >> this->userdefined;
672  if (userdefined){
673  std::string paramfilename;
674 
675  getline(fin, paramfilename);
678 
679  // copy user defined file to bfiles_filename/mc
680 
682  std::stringstream blabla;
683  blabla << prefix;
684  blabla << "/" << paramfilename;
685  mcfname = paramfilename;
686 
687  }
688  else{
693  }
694 
696 
697  GetNumVariables();
698 
699  return;
700 
701 }
702 
703 void runinfo::ReadCustomLines(std::ifstream & fin){
704 
705  this-> CustomLines.clear();
706  CustomLines = "";
707 
708  std::string tmpstr;
709 
710  while (getline(fin, tmpstr)) {
711  this-> CustomLines.append(tmpstr);
712  this-> CustomLines.append("\n");
713  }
714 
715  return;
716 }
717 
718 //part of the suite of parse input functions, reads the top line of paramotopy input file.
719 void runinfo::ReadSizes(std::ifstream & fin){
720  numfunct = 0;
721  numvargroup = 0;
722  numparam = 0;
723  numconsts = 0;
724 
725  std::string tmp;
726  getline(fin,tmp);
727  std::stringstream ss;
728  ss << tmp;
729  ss >> numfunct;
730  ss >> numvargroup;
731  ss >> numparam;
732  ss >> numconsts;
733 }
734 
735 
736 
737 //part of the suite of parse input functions, reads the parameter declarations.
738 void runinfo::ReadParameters(std::ifstream & fin){
739  Parameters.clear();
740  for (int ii = 0; ii < numparam; ++ii){
741  std::string tmp;
742  getline(fin,tmp);
743  Parameters.push_back(tmp);
744  }
745  return;
746 }
747 
748 
749 
751  RandomValues.clear();
752  MTRand drand(time(0));
753  for (int ii = 0; ii < numparam;++ii){
754  double creal = double(drand());
755  double cimaginary = double(drand());
756  RandomValues.push_back(std::pair<double,double>(creal,cimaginary));
757  }
758 
759 
760  return;
761 }
762 
763 
764 void runinfo::MakeRandomValues(std::vector< std::pair< std::pair< double, double >,
765  std::pair< double, double > > > RandomRanges){
766 
767  RandomValues.clear();
768  // make the random values with the specified ranges.
769  MTRand drand(time(0));
770  for (int ii = 0; ii < int(RandomRanges.size()); ++ii){
771  double crandreal = drand();
772  double crandimaginary = drand();
773  crandreal*=(RandomRanges[ii].first.second
774  - RandomRanges[ii].first.first);
775  crandreal+=RandomRanges[ii].first.first;
776  crandimaginary*=(RandomRanges[ii].second.second
777  -RandomRanges[ii].second.first);
778  crandimaginary+=RandomRanges[ii].second.first;
779  RandomValues.push_back(std::pair<double,double>(crandreal,
780  crandimaginary));
781 
782  }
783 
784  return;
785 }
786 
787 
788 std::vector<std::pair<double, double> > runinfo::MakeRandomValues(int seed_value){
789  std::vector<std::pair<double, double> > NewRandomValues;
790 
791  MTRand drand(seed_value);
792 
793 
794  // for (int ii = 1; ii < fabs(ceil(42*drand())); ++ii){
795  // drand();
796  // }
797 
798  for (int ii = 0; ii < numparam;++ii){
799  NewRandomValues.push_back(std::pair<double,double>( double(drand()),double(drand()) ));
800  }
801 
802 
803  return NewRandomValues;
804 
805 }
806 
807 
808 
809 
810 
811 //read the random values from the step1.
813 
814  std::stringstream myss;
815  std::ifstream fin;
816  boost::filesystem::path randfilename = this->location;
817  randfilename /= "randstart";
818  fin.open(randfilename.c_str());
819 
820  if (!fin.is_open()) {
821  std::cout << "failed to open randfilename: " << randfilename << "\n";
822  exit(731);
823  }
824 
825  int ccount=0;
826  std::string mytemp;
827  while(getline(fin,mytemp)){
828  std::stringstream myss;
829  myss << mytemp;
830  double crandreal;
831  double crandimaginary;
832  myss >> crandreal;
833  myss >> crandimaginary;
834  this->RandomValues[ccount].first = crandreal;
835  this->RandomValues[ccount].second = crandimaginary;
836  ++ccount;
837  }
838  std::cout << std::endl;
839  fin.close();
840  //end get random values
841 
842 }
843 
844 
845 
846 //part of the suite of parse input functions, reads the functions from the paramotopy input file
847 void runinfo::ReadFunctions(std::ifstream & fin){
848  Functions.clear();
849  for (int ii = 0; ii < numfunct; ++ii){
850  std::string tmp;
851  getline(fin,tmp);
852  Functions.push_back(tmp);
853  }
854  return;
855 }
856 
857 
858 
859 //part of the suite of parse input functions, reads the variable groups from paramotopy input file
860 void runinfo::ReadVarGroups(std::ifstream & fin){
861  VarGroups.clear();
862  for (int ii = 0; ii < numvargroup; ++ii){
863  std::string tmp;
864  getline(fin,tmp);
865  VarGroups.push_back(tmp);
866  }
867  return;
868 }
869 
870 
871 
872 //part of the suite of parse input functions, reads the constants
873 void runinfo::ReadConstants(std::ifstream & fin){
874  Constants.clear();
875  std::string tmp;
876  getline(fin,tmp);
877  Constants.push_back(tmp);
878  return;
879 }
880 
881 
882 //part of the suite of parse input functions, reads the constants
883 void runinfo::ReadConstantStrings(std::ifstream & fin){
884  ConstantNames.clear();
885  for (int ii = 0; ii < numconsts;++ii){
886  std::string tmp;
887  getline(fin,tmp);
888  ConstantNames.push_back(tmp);
889  }
890  return;
891 }
892 
893 
895 
896  int count = 0;
897  size_t comma_found;
898 
899  for (int ii=0; ii<numvargroup; ++ii) {
900  count++;
901  comma_found = VarGroups[ii].find(",");
902  while ( comma_found != std::string::npos ) {
903  count++;
904  comma_found = VarGroups[ii].find(",",comma_found+1,1);
905  }
906  }
907  numvariables = count;
908  return;
909 }
910 
911 
912 
913 void runinfo::MakeFunctions(std::stringstream & inputfilestream){
914  inputfilestream << "\n";
915  for (int ii = 0; ii < numfunct;++ii){
916  inputfilestream << "f" << ii+1
917  << " = "
918  << Functions[ii]
919  << ";\n";
920 
921  }
922 }
923 
924 
925 
926 //writes variable groups to stringstream for bertini input file.
927 void runinfo::MakeVariableGroups(std::stringstream & fout, ProgSettings paramotopy_settings){
928 
929  if (paramotopy_settings.settings["step1bertini"]["USERHOMOTOPY"].value() == "1"){
930  fout << "\n";
931  fout << "variable ";
932  for (int ii = 0; ii < numvargroup; ++ii){
933  fout << VarGroups[ii];
934  fout << (ii != numvargroup - 1 ? ", " : "");
935  }
936  fout << ";\n";
937 
938  }
939  else{
940  for (int ii = 0; ii < numvargroup;++ii){
941  fout << "\n";
942  fout << "variable_group ";
943  fout << VarGroups[ii];
944  fout << ";";
945  }
946 
947  }
948 }
949 
950 
951 //writes constant declarations to stringsteam, for writing to file
952 void runinfo::MakeDeclareConstants(std::stringstream & fout){
953  fout << "\n";
954  fout << "constant ";
955  for (int ii = 0; ii < int(this->ParameterNames.size());++ii){
956  fout << this->ParameterNames[ii]
957  << (ii != int(this->ParameterNames.size())-1?",":";\n");
958 
959  }
960  if (this->Constants.size()!=0){
961  fout << this->Constants[0]
962  << "\n";
963  }
964 }
965 
966 
967 //writes the function declaration to mutable stringstream, for writing to file for bertini later.
968 void runinfo::MakeDeclareFunctions(std::stringstream & inputfilestream){
969  inputfilestream << "function ";
970  for (int ii = 1; ii <=numfunct;++ii){
971  inputfilestream << "f" << ii;
972  if (ii != numfunct){
973  inputfilestream << ", ";
974  }
975  else{
976  inputfilestream << ";\n";
977  }
978  }
979  return;
980 }
981 
982 
983 void runinfo::MakeConstants(std::stringstream & fout){
984 
985  for (int ii = 0; ii < int(this->RandomValues.size());++ii){
986  fout << this->ParameterNames[ii]
987  << " = "
988  << this->RandomValues[ii].first
989  << " + "
990  << this->RandomValues[ii].second
991  << "*I;\n";
992  }
993 
994  for (int ii = 0; ii < int(ConstantNames.size());++ii){
995  fout << "\n" << this->ConstantNames[ii];
996  }
997  fout << "\n";
998 }
999 
1000 
1001 void runinfo::MakeCustomLines(std::stringstream & inputfilestream){
1002 
1003  inputfilestream << "\n\n" << this->CustomLines;
1004 
1005  return;
1006 }
1007 
1008 
1009 void runinfo::MakeConstantsStep2(std::vector<std::pair<double, double> > CurrentValues, std::stringstream & inputfilestream, bool standardstep2){
1010 
1011 
1012  if (standardstep2){
1013  for (int ii = 0; ii < int(this->ParameterNames.size()); ++ii){
1014  inputfilestream << "rand"
1015  << this->ParameterNames[ii]
1016  << " = "
1017  << this->RandomValues[ii].first << " + " << this->RandomValues[ii].second
1018  << "*I;\n";
1019  }
1020 
1021  for (int ii = 0; ii < int(this->ParameterNames.size()); ++ii){
1022  inputfilestream << "here"
1023  << this->ParameterNames[ii]
1024  << " = "
1025  << CurrentValues[ii].first << " + " << CurrentValues[ii].second
1026  << "*I;\n";
1027  }
1028 
1029 
1030 
1031  for (int ii = 0; ii < int(this->ParameterNames.size()); ++ii){
1032  inputfilestream << this->ParameterNames[ii]
1033  << "= t*rand"
1034  << this->ParameterNames[ii]
1035  << " + (1-t)*here"
1036  << this->ParameterNames[ii]
1037  << ";\n";
1038  }
1039 
1040 
1041  for (int ii = 0; ii < int(this->ConstantNames.size());++ii){
1042  inputfilestream << this->ConstantNames[ii]
1043  << "\n";
1044  }
1045 
1046 
1047  }
1048  else{
1049  for (int ii = 0; ii < int(this->ParameterNames.size()); ++ii){
1050  inputfilestream << this->ParameterNames[ii]
1051  << " = "
1052  << this->RandomValues[ii].first << " + " << this->RandomValues[ii].second
1053  << "*I;\n";
1054  }
1055  for (int ii = 0; ii < int(this->ConstantNames.size());++ii){
1056  inputfilestream << this->ConstantNames[ii]
1057  << "\n";
1058  }
1059 
1060 
1061  }
1062  return;
1063 }
1064 
1065 
1066 
1067 
1068 
1069 
1070 void runinfo::MakeValues(std::ifstream & fin){
1071 
1072  this->NumMeshPoints.clear();
1073  Values.clear();
1074 
1075  std::string temp;
1076  int lcount = 0;
1077  while(getline(fin,temp)){
1078  std::vector< std::pair<double, double> > CValue;
1079  std::stringstream ss;
1080  ss << temp;
1081  for (int ii = 0; ii < numparam;++ii){
1082  double creal;
1083  double cimaginary;
1084  ss >> creal;
1085  ss >> cimaginary;
1086  CValue.push_back(std::pair<double, double>(creal,cimaginary));
1087  }
1088  ++lcount;
1089 
1090  Values.push_back(CValue);
1091  }
1092  std::cout << "line count = " << lcount << "\n\n";
1093  return;
1094 }
1095 
1096 
1097 
1098 
1099 
1101 
1102  if (this->userdefined!=0) {
1103  std::cout << "attempting to set bounds in a non-computer-generated" << std::endl;
1104  exit(-12);
1105  }
1106 
1107  this->BoundsLeft.clear();
1108  this->BoundsRight.clear();
1109  // parse the parameter string per line
1110  for (int ii = 0; ii < int(Parameters.size());++ii){
1111  std::string temp;
1112  std::stringstream ss;
1113  ss << Parameters[ii];
1114  ss >> temp; // pull the name off the string
1115 
1116  // values given by lep, rep, and # of mesh points
1117  double lepr; // left end point real
1118  double lepi; // right end point real
1119  double repr; //
1120  double repi;
1121 
1122  ss >> lepr;
1123  ss >> lepi;
1124  ss >> repr;
1125  ss >> repi;
1126  this->BoundsLeft.push_back(std::pair< double, double> (lepr, lepi));
1127  this->BoundsRight.push_back(std::pair< double, double> (repr, repi));
1128  }
1129  return;
1130 
1131 
1132 
1133 }
1134 //sets the Values and NumMeshPoints variables in the runinfo class
1136 
1137  this->NumMeshPoints.clear();
1138  this->Values.clear();
1139 
1140 
1141  // parse the parameter string per line
1142  for (int ii = 0; ii < int(Parameters.size());++ii){
1143  std::string temp;
1144  // bool userdefined;
1145 
1146  std::stringstream ss;
1147  ss << Parameters[ii];
1148  ss >> temp;
1149  // ss >> userdefined;
1150  // if (!userdefined){
1151  // values given by lep, rep, and # of mesh points
1152  double lepr; // left end point real
1153  double lepi; // right end point real
1154  double repr; //
1155  double repi;
1156  int meshpoints;
1157  std::vector< std::pair<double,double> > currentmesh;
1158  ss >> lepr;
1159  ss >> lepi;
1160  ss >> repr;
1161  ss >> repi;
1162  ss >> meshpoints;
1163 
1164  this->NumMeshPoints.push_back(meshpoints); // add the number of meshpoints to the vector keeping track
1165  double stepr = (repr - lepr)/(meshpoints-1);
1166  double stepi = (repi - lepi)/(meshpoints+1);
1167  double currentr = lepr;
1168  double currenti = lepi;
1169  for (int jj = 0; jj < meshpoints;++jj){
1170  currentmesh.push_back(std::pair<double,double>(currentr,currenti)); // set the temp value
1171  currentr+=stepr;
1172  currenti+=stepi;
1173  }
1174  this->Values.push_back(currentmesh);// add to the Values vector.
1175 
1176 
1177  // fin.close();
1178 
1179  }
1180  return;
1181 }
1182 
1183 
1184 //given a vector of strings to parse, makes and returns a vector of parameter names
1186 
1187  ParameterNames.clear();
1188  for (int ii = 0; ii < numparam;++ii){
1189  std::stringstream ss;
1190  ss << Parameters[ii];
1191  std::string paramname;
1192  ss >> paramname;
1193  ParameterNames.push_back(paramname);
1194  }
1195 
1196  return;
1197 }
1198 
1199 
1200 
1202 
1203  std::cout << "nfunc " << numfunct << std::endl;
1204  for (int ii=0; ii<numfunct; ++ii) {
1205  std::cout << Functions[ii] << std::endl;
1206  }
1207 
1208  std::cout << "nvargrp " << numvargroup << std::endl;
1209  for (int ii=0; ii<numvargroup; ++ii) {
1210  std::cout << VarGroups[ii] << std::endl;
1211  }
1212 
1213  std::cout << "nparam " << numparam << std::endl;
1214  for (int ii=0; ii<numparam; ++ii) {
1215  std::cout << Parameters[ii] << std::endl;
1216  }
1217  for (int ii=0; ii<numparam; ++ii) {
1218  std::cout << "name " << ParameterNames[ii] << std::endl;
1219  }
1220 
1221 
1222  std::cout << "nconst " << numconsts << std::endl;
1223  for (int ii=0; ii<numconsts; ++ii) {
1224  std::cout << ConstantNames[ii] << std::endl;
1225  }
1226  if (numconsts>0) {
1227  std::cout << Constants[0] << std::endl;
1228  }
1229 
1230 
1231 
1232  std::cout << "base_dir " << base_dir << " "
1233  << "inputfilename " << inputfilename << "\n";
1234 
1235  std::cout << "base_dir " << base_dir << " "
1236  << "inputfilename " << inputfilename << std::endl;
1237 
1238  std::cout << "nvar " << numvariables << std::endl;
1239  if (userdefined==1) {
1240  std::cout << "userdefined, with mcfname: " << mcfname << std::endl;
1241  }
1242  else{
1243  std::cout << "computer-generated mesh." << std::endl;
1244  }
1245 
1246  if ( int(this->CustomLines.size()>0) ) {
1247  std::cout << "custom lines: " << this->CustomLines << std::endl;
1248  }
1249 
1250  return;
1251 }
1252 
1253 
1254 
1255 
1256 
1257 
1258 
1259 
1260 
1261 
1262 
1263 
1264 
1265 
1267 //
1268 //
1269 // data management
1270 //
1271 //
1273 
1274 
1275 
1276 
1277 
1278 
1279 
1280 
1281 
1282 
1283 
1284 
1285 //tests if step2 finished.
1286 //todo: rewrite using boost
1288  bool finished = false;
1289 
1290  boost::filesystem::path finishedfile = this->base_dir;
1291  finishedfile /= "step2finished";
1292 
1293 
1294  if (boost::filesystem::exists(finishedfile) ){ // if it can see the 'finished' file
1295  finished = true;
1296  }
1297  return finished;
1298 }
1299 
1300 
1301 
1302 
1303 
1304 
1306 //
1307 //
1308 // functions for managing data folders.
1309 //
1312 
1313 
1314 
1316  updated = time(NULL);
1317  runinfo::save();
1318  return;
1319 }
1320 
1321 
1323 
1325  base_dir /= "run0";
1326 
1327  run_number = 0;
1328  initiated = time(0);
1329  updated = time(0);
1330 
1331 
1332  return;
1333 }
1334 
1335 
1336 void runinfo::SetBaseDirManual(std::vector< boost::filesystem::path > found_runs){
1337  time_t wheninitiated, whenupdated; //for display
1338 
1339 
1340  std::cout << "the following are your options for data folders:\n\n";
1341  std::cout << " name date modified\n";
1342  for (int ii = 0; ii<int(found_runs.size()); ++ii) {
1343  std::string tmpdir = found_runs[ii].string();
1344  tmpdir.append("/info.xml");
1345  int tmprun = 0;
1346  get_run_xml(tmpdir,tmprun,wheninitiated,whenupdated);
1347 
1348  std::cout << ii << ": " << found_runs[ii].string();
1349  for (int jj=0; jj<(20 - int(found_runs[ii].string().length())); ++jj) {
1350  std::cout << " ";
1351  }
1352  std::cout << ctime(&whenupdated);
1353  }
1354 
1355  std::cout << found_runs.size() << ": " << "make new folder\n" << std::endl;
1356 
1357  int choice = get_int_choice("which folder to use?\n\n: ",0,found_runs.size());
1358 
1359  std::cout << choice << " " << found_runs.size() << "\n";
1360 
1361  if (choice<int(found_runs.size())) {
1362 
1363  base_dir = found_runs[choice].string();
1364  std::cout << "loading old directory " << base_dir << "\n";
1365 
1366  boost::filesystem::path fname = base_dir;
1367  fname /= "info.xml";
1368  runinfo::load(fname);//gets the run number, initiation date, and last time updated.
1369  made_new_folder = false;
1370  }
1371  else{
1372  std::cout << "making new directory\n";
1373  runinfo::SetBaseDirNew(found_runs);
1374 
1375  }
1376 
1377 
1378 
1379  return;
1380 
1381 }
1382 
1383 
1384 
1385 void runinfo::SetBaseDirNew(std::vector< boost::filesystem::path> found_runs){
1386  //get highest number, increment, set base dir and stuff
1387 
1388  int max_run_number = -101;
1389 
1390  time_t wheninitiated, whenupdated;
1391  int run;
1392 
1393  for (int ii=0; ii<int(found_runs.size()); ++ii) {
1394  std::string tmpdir = found_runs[ii].string();
1395  tmpdir.append("/info.xml");
1396  get_run_xml(tmpdir,run,wheninitiated,whenupdated);
1397  if (run > max_run_number){
1398  max_run_number = run;
1399  }
1400  }
1401 
1402  run_number = max_run_number+1;
1403  initiated = time(0);
1404  updated = time(0);
1405 
1407  base_dir /= "run";
1408  std::stringstream ss;
1409  ss << run_number;
1410  base_dir += ss.str();
1411 
1412  boost::filesystem::create_directories(base_dir);
1413  runinfo::save();
1414 
1415  made_new_folder = true;
1416  return;
1417 }
1418 
1419 
1420 
1421 void runinfo::SetBaseDirMostRecent(std::vector< boost::filesystem::path> found_runs){
1422  //get highest number, increment, set base dir and stuff
1423 
1424  time_t most_recent = -1;
1425  boost::filesystem::path tmpdir;
1426  time_t wheninitiated, whenupdated;
1427  int tmprun;
1428  int runindex = 0;
1429 
1430  std::cout << "\n name date modified\n\n";
1431 
1432  for (int ii=0; ii<int(found_runs.size()); ++ii) {
1433  tmpdir = found_runs[ii];
1434  tmpdir /= "info.xml";
1435  get_run_xml(tmpdir,tmprun,wheninitiated,whenupdated);
1436 
1437  std::cout << found_runs[ii].string();
1438  for (int jj=0; jj<(20 - int(found_runs[ii].string().length())); ++jj) {
1439  std::cout << " ";
1440  }
1441  std::cout << ctime ( &whenupdated );
1442  if (whenupdated > most_recent){
1443  most_recent = whenupdated;
1444  runindex = ii;
1445  }
1446 
1447  }
1448 
1449  std::cout << std::endl;
1450  tmpdir = found_runs[runindex];
1451 
1452  base_dir = tmpdir;
1453 
1454  tmpdir /= "info.xml";
1455  runinfo::load(tmpdir);
1456 
1457  return;
1458 }
1459 
1460 
1462  std::cout << "Output directory is now: " << base_dir << std::endl;
1463 
1464  std::vector< boost::filesystem::path > found_runs = FindDirectories(fundamental_dir, "^run");
1465 
1466  if (found_runs.size()==0) {
1467  std::cout << "found no previous data, starting new folder\n";
1469  made_new_folder = true;
1470  }
1471  else {
1472  runinfo::SetBaseDirManual(found_runs);
1473  }
1474 
1475  runinfo::save();
1476 
1477 
1478  return;
1479 }
1480 
1481 void runinfo::AutoScanData(const int preferred_behaviour){
1482 
1483  std::vector< boost::filesystem::path > found_runs = FindDirectories(fundamental_dir, "^run");
1484 
1485  if (found_runs.size()==0) {
1486  std::cout << "found no previous data, starting new folder\n";
1488  }
1489  else {
1490  switch (preferred_behaviour) {
1491  case 1:
1492  std::cout << "setting base_dir most_recent\n";
1493  runinfo::SetBaseDirMostRecent(found_runs);
1494 
1495  break;
1496 
1497  case 2:
1498  std::cout << "Setting base dir new\n";
1499  runinfo::SetBaseDirNew(found_runs);
1500  std::cout << base_dir << "\n";
1501  break;
1502 
1503  case 3:
1504  std::cout << "setting basedir manually\n";
1505  runinfo::SetBaseDirManual(found_runs);
1506  break;
1507 
1508  default:
1509  break;
1510  }
1511  }
1512 
1513  std::cout << "run folder set to " << base_dir << std::endl;
1514  runinfo::save();
1515 
1516 
1517  return;
1518 }
1519 
1520 
1521 
1522 
1523 
1524 
1525 //saves the run info to an xml file
1527  TiXmlDocument* doc = new TiXmlDocument;
1528  TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" );
1529 
1530  doc->LinkEndChild( decl );
1531 
1532  TiXmlElement * root = new TiXmlElement("run_info");
1533  //categorymap::iterator iter;
1534 
1535  TiXmlText* txt;
1536  std::stringstream ss;
1537 
1538 
1539  TiXmlElement * value_name1 = new TiXmlElement( "run_number" );
1540  ss << run_number;
1541  txt = new TiXmlText( ss.str().c_str() );
1542  ss.clear();
1543  ss.str("");
1544  value_name1->LinkEndChild(txt);
1545 
1546  TiXmlElement * value_name2 = new TiXmlElement( "initiated" );
1547  ss << initiated;
1548  txt = new TiXmlText( ss.str().c_str() );
1549  ss.clear();
1550  ss.str("");
1551  value_name2->LinkEndChild(txt);
1552 
1553  TiXmlElement * value_name3 = new TiXmlElement( "updated" );
1554  time_t currtime = time(NULL);
1555  ss << currtime;
1556  txt = new TiXmlText( ss.str().c_str() );
1557  ss.clear();
1558  ss.str("");
1559  value_name3->LinkEndChild(txt);
1560 
1561  root->LinkEndChild(value_name1);
1562  root->LinkEndChild(value_name2);
1563  root->LinkEndChild(value_name3);
1564 
1565 
1566  doc->LinkEndChild( root );
1567 
1568  boost::filesystem::create_directories(base_dir);
1569 
1570  boost::filesystem::path filename = base_dir;
1571  filename /= "info.xml";
1572  //save it
1573  if(doc->SaveFile(filename.c_str())){
1574 
1575  }
1576  else{
1577  //couldn't save for some reason. this may be a problem on queued systems?
1578  std::cout << "run info *failed* to save to " << filename.string() << "!\n";
1579  };
1580 
1581 
1582  return;
1583 }
1584 
1585 
1586 void runinfo::load(boost::filesystem::path filename){
1587  int tmp_run=0;
1588  time_t tmp_initiated=-2, tmp_updated=-1;
1589 
1590  get_run_xml(filename,tmp_run,tmp_initiated,tmp_updated);
1591  run_number = tmp_run;
1592  initiated = tmp_initiated;
1593  updated = time(NULL);
1594 
1595  return;
1596 }
1597 
1598 
1599 //returns via reference the run number, time initiated, and time updated, of a run.
1600 void runinfo::get_run_xml(boost::filesystem::path filename, int & run, time_t & wheninitiated, time_t & whenupdated){
1601 
1602  TiXmlDocument* doc = new TiXmlDocument(filename.string().c_str());
1603 
1604  bool doc_loaded = doc->LoadFile();
1605  if (!doc_loaded){
1606 
1607  }
1608  else{
1609  TiXmlHandle hDoc(doc);
1610  TiXmlElement* pElem;
1611  TiXmlHandle hRoot(0);
1612 
1613  pElem=hDoc.FirstChildElement().Element();
1614  // should always have a valid root but handle gracefully if it doesn't
1615 
1616  if (!pElem) {
1617  std::cerr << "bad xml file for this run.\n";
1618  }
1619  else{
1620 
1621  std::stringstream ss;
1622 
1623  std::string main_name =pElem->Value(); //unused?
1624  hRoot=TiXmlHandle(pElem); // the handle for the data we will be reading
1625 
1626  TiXmlElement* qElem = hRoot.FirstChild("run_number").Element(); //read the name
1627  const char *numberText=qElem->GetText();
1628  ss << numberText;
1629  ss >> run;
1630  ss.clear();
1631  ss.str("");
1632 
1633  qElem = hRoot.FirstChild("initiated").Element(); //read the name
1634  const char *initiatedText=qElem->GetText();
1635  ss << initiatedText;
1636  ss >> wheninitiated;
1637  ss.clear();
1638  ss.str("");
1639 
1640 
1641  qElem = hRoot.FirstChild("updated").Element(); //read the name
1642  const char *updatedText=qElem->GetText();
1643  ss << updatedText;
1644  ss >> whenupdated;
1645  ss.clear();
1646  ss.str("");
1647 
1648 
1649  }
1650  }
1651 
1652  return;
1653 }
void MakeRandomValues()
Definition: runinfo.cpp:750
void MakeDeclareFunctions(std::stringstream &inputstringstream)
Definition: runinfo.cpp:968
void ReadSizes(std::ifstream &fin)
Definition: runinfo.cpp:719
void SetBaseDirManual(std::vector< boost::filesystem::path > found_runs)
Definition: runinfo.cpp:1336
void GetOriginalParamotopy()
Definition: runinfo.cpp:44
void ScanData()
Definition: runinfo.cpp:1461
void MakeValues()
Definition: runinfo.cpp:1135
std::vector< std::pair< double, double > > RandomValues
Definition: runinfo.hpp:130
void PrintRandom()
Definition: runinfo.cpp:567
void ReadConstantStrings(std::ifstream &fin)
Definition: runinfo.cpp:883
int numvariables
Definition: runinfo.hpp:60
void LoadRandom()
Definition: runinfo.cpp:392
std::string getAlphaNumeric_WithSpaces()
std::vector< int > NumMeshPoints
Definition: runinfo.hpp:124
void MakeFunctions(std::stringstream &inputstringstream)
Definition: runinfo.cpp:913
void load(boost::filesystem::path filename)
Definition: runinfo.cpp:1586
boost::filesystem::path base_dir
Definition: runinfo.hpp:77
void SetLocation()
Definition: runinfo.cpp:163
bool userdefined
Definition: runinfo.hpp:119
std::string paramotopy_file
Definition: runinfo.hpp:87
void MakeCustomLines(std::stringstream &inputfilestream)
Definition: runinfo.cpp:1001
boost::filesystem::path fundamental_dir
Definition: runinfo.hpp:74
int numfunct
Definition: runinfo.hpp:58
void WriteOriginalParamotopy(boost::filesystem::path dir)
Definition: runinfo.cpp:70
void ReadVarGroups(std::ifstream &fin)
Definition: runinfo.cpp:860
void WriteRandomValues()
Definition: runinfo.cpp:349
void ParseData()
Definition: runinfo.cpp:636
void UpdateAndSave()
Definition: runinfo.cpp:1315
double getDouble()
void MakeDeclareConstants(std::stringstream &fout)
Definition: runinfo.cpp:952
std::vector< boost::filesystem::path > FindDirectories(boost::filesystem::path, std::string expression)
void DisplayAllValues()
Definition: runinfo.cpp:1201
bool CheckRunStepOne()
Definition: runinfo.cpp:6
void ReadParameters(std::ifstream &fin)
Definition: runinfo.cpp:738
time_t initiated
Definition: runinfo.hpp:82
void mkdirstep1()
Definition: runinfo.hpp:180
int numparam
Definition: runinfo.hpp:64
std::string WriteInputStepTwo(std::vector< std::pair< double, double > > tmprandomvalues, bool standardstep2)
Definition: runinfo.cpp:193
void save()
Definition: runinfo.cpp:1526
void GetNumVariables()
Definition: runinfo.cpp:894
void ParseDataGuts(std::ifstream &fin)
Definition: runinfo.cpp:656
void make_base_dir_name()
Definition: runinfo.cpp:139
void ReadConstants(std::ifstream &fin)
Definition: runinfo.cpp:873
void ReadCustomLines(std::ifstream &fin)
Definition: runinfo.cpp:703
std::string WriteInputStepOne(ProgSettings paramotopy_settings)
Definition: runinfo.cpp:174
void MakeParameterNames()
Definition: runinfo.cpp:1185
void SetRandom()
Definition: runinfo.cpp:502
int get_int_choice(std::string display_string, int min_value, int max_value)
int numconsts
Definition: runinfo.hpp:67
std::vector< std::string > Parameters
Definition: runinfo.hpp:102
void SetBaseDirNew(std::vector< boost::filesystem::path > found_runs)
Definition: runinfo.cpp:1385
void MakeConstants(std::stringstream &fout)
Definition: runinfo.cpp:983
std::string mcfname
Definition: runinfo.hpp:122
std::string CustomLines
Definition: runinfo.hpp:110
int numvargroup
Definition: runinfo.hpp:62
void get_run_xml(boost::filesystem::path filename, int &run, time_t &wheninitiated, time_t &whenupdated)
Definition: runinfo.cpp:1600
std::vector< std::string > ParameterNames
Definition: runinfo.hpp:104
bool test_if_finished()
Definition: runinfo.cpp:1287
std::vector< std::string > VarGroups
Definition: runinfo.hpp:100
boost::filesystem::path inputfilename
Definition: runinfo.hpp:90
boost::filesystem::path prefix
Definition: runinfo.hpp:92
boost::filesystem::path location
Definition: runinfo.hpp:71
void AutoScanData(const int preferred_behaviour)
Definition: runinfo.cpp:1481
void SetBaseDirMostRecent(std::vector< boost::filesystem::path > found_runs)
Definition: runinfo.cpp:1421
int run_number
Definition: runinfo.hpp:80
categorymap settings
A class that stores the general program settings of Paramotopy.
std::vector< std::string > Functions
Definition: runinfo.hpp:98
void MakeVariableGroups(std::stringstream &fout, ProgSettings paramotopy_settings)
Definition: runinfo.cpp:927
bool GetPrevRandom()
Definition: runinfo.cpp:451
void CopyUserDefinedFile()
Definition: runinfo.cpp:579
std::vector< std::string > ConstantNames
Definition: runinfo.hpp:108
void GetInputFileName()
Definition: runinfo.cpp:299
void MakeConstantsStep2(std::vector< std::pair< double, double > > CurrentValues, std::stringstream &inputfilestream, bool standardstep2)
Definition: runinfo.cpp:1009
void MakeBounds()
Definition: runinfo.cpp:1100
std::vector< std::vector< std::pair< double, double > > > Values
Definition: runinfo.hpp:113
bool made_new_folder
Definition: runinfo.hpp:218
void GetRandomValues()
Definition: runinfo.cpp:812
void SetBaseDirZero()
Definition: runinfo.cpp:1322
time_t updated
Definition: runinfo.hpp:84
void ReadFunctions(std::ifstream &fin)
Definition: runinfo.cpp:847
void SaveRandom()
Definition: runinfo.cpp:369
std::vector< std::pair< double, double > > BoundsLeft
Definition: runinfo.hpp:115
void WriteModifiedParamotopy(boost::filesystem::path dir, int iteration)
Definition: runinfo.cpp:97
std::vector< std::string > Constants
Definition: runinfo.hpp:106
std::vector< std::pair< double, double > > BoundsRight
Definition: runinfo.hpp:116