Paramotopy
parallel parameter homotopy through bertini
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
datagatherer.cpp
Go to the documentation of this file.
1 //contains the datagatherer class.
2 
3 #include "datagatherer.hpp"
4 
5 
6 
7 
8 //constructs a file name for reading/writing
9 boost::filesystem::path datagatherer::MakeTargetFilename(std::string filename)
10 {
11  boost::filesystem::path tmppath = this->DataCollectedbase_dir;
12  tmppath /= filename;
13 
14 
15  std::stringstream ss;
16  ss << this->slavemap[filename].filecount;
17  tmppath += ss.str();
18  return tmppath;
19 }
20 
21 
22 
23 void datagatherer::SlaveSetup(ProgSettings & paramotopy_settings,
24  runinfo & paramotopy_info,
25  int myid,
26  boost::filesystem::path called_dir){
27 
28 
29 
30  datagatherer slavegatherer;
32 
33 
34  settingmap::iterator iter;
35  for (iter=paramotopy_settings.settings["SaveFiles"].begin(); iter!=paramotopy_settings.settings["SaveFiles"].end(); ++iter){
36  if (iter->second.intvalue==1) {
37  std::string tmpstr = iter->first;
38  if (paramotopy_settings.settings["mode"]["standardstep2"].intvalue==0 && tmpstr.compare("real_solutions") == 0){
39  tmpstr = "real_finite_solutions";
40  }
42  }
43  }
44 
45 
46  this->buffersize = paramotopy_settings.settings["system"]["buffersize"].intvalue;
47  this->newfilethreshold = paramotopy_settings.settings["files"]["newfilethreshold"].intvalue;
48  this->numvariables = paramotopy_info.numvariables;
49 
50 
51 
52  //make data file location
53  this->DataCollectedbase_dir = called_dir;
54  this->DataCollectedbase_dir/= paramotopy_info.location;
55  this->DataCollectedbase_dir/= "step2/DataCollected/c";
56 
57 
58  std::stringstream myss;
59  myss << myid;
60  this->DataCollectedbase_dir += myss.str();
61  myss.clear(); myss.str("");
62 
63 
64 
65 
66  if (paramotopy_settings.settings["mode"]["standardstep2"].intvalue==0){
67  this->real_filename = "real_finite_solutions";
68  this->standardstep2 = 0;
69  }
70  else{
71  this->real_filename = "real_solutions";
72  this->standardstep2 = 1;
73  }
74 
75 
76  this->ParamNames = paramotopy_info.ParameterNames;
77 
78 
79 }
80 
81 
82 
83 bool datagatherer::SlaveCollectAndWriteData(double current_params[],
84  ProgSettings & paramotopy_settings,
85  timer & process_timer){
86 
87 
88 
89  // Collect the Data
90  std::map< std::string, fileinfo> ::iterator iter;
91  for (iter = this->slavemap.begin(); iter!= this->slavemap.end(); ++iter){
92 
93  //get data from file
94 #ifdef timingstep2
95  process_timer.press_start("read");
96 #endif
97 
98  if (paramotopy_settings.settings["mode"]["main_mode"].intvalue==1 && iter->first.compare(this->real_filename)==0) { //1: continuous loop for search
99 
100  datagatherer::AppendOnlyPosReal(iter->first, // the file name
101  current_params,
102  paramotopy_settings);
103 
104 
105  }
106  else {//0: basic mode
107 
108  datagatherer::AppendData(iter->first, // the file name
109  current_params);
110  }
111 
112 
113 
114 #ifdef timingstep2
115  process_timer.add_time("read");
116 #endif
117 
118 
119  //if big enough
120  if ( int(iter->second.runningfile.size()) > this->buffersize){
121 
122 
123  iter->second.filesize += int(iter->second.runningfile.size());
124 
125 #ifdef timingstep2
126  process_timer.press_start("write");
127 #endif
128 
129  datagatherer::WriteData(iter->second.runningfile,
130  datagatherer::MakeTargetFilename(iter->first));
131 
132 #ifdef timingstep2
133  process_timer.add_time("write");
134 #endif
135  iter->second.runningfile.clear();//reset the string
136  if (iter->second.filesize > this->newfilethreshold) { //update the file count
137  iter->second.filecount++;
138  iter->second.filesize = 0;
139  }
140  }
141 
142 
143  }
144 
145 
146 
147  return true;
148 }
149 
150 
151 
152 
153 
154 
155 void datagatherer::AppendOnlyPosReal(std::string orig_filename,
156  double *current_params,
157  ProgSettings & paramotopy_settings)
158 {
159  //this function will operate on any *_solutions file
160 
161 
162  std::string cline = "";
163  std::stringstream outstring;
164 
165 
166 
167 
168  std::ifstream fin(orig_filename.c_str());
169 
170  if (!fin.is_open()) {
171  std::cerr << "failed to open file '" << orig_filename << "' to read data" << std::endl;
172  MPI_Abort(MPI_COMM_WORLD,-42);
173  }
174 
175  std::vector< std::vector < std::pair< std::string, std::string > > > solutions_this_point = datagatherer::ParseSolutionsFile_ActualSolutions(fin);
176  fin.close();
177 
178  //now have the solutions in numerical form!
179 
180 
181  //the search condition goes here.
182  int tmp_num_found_solns = 0;
183  std::stringstream converter, current_point_data;
184  for (int ii=0; ii<int(solutions_this_point.size()); ++ii) {
185 
186 
187  int is_soln = 1;
188  for (int jj=0; (jj<this->numvariables) && (is_soln); ++jj) {
189  double comparitor_real, comparitor_imag;
190  converter << solutions_this_point[ii][jj].first << solutions_this_point[ii][jj].second;
191  converter >> comparitor_real >> comparitor_imag;
192  converter.clear(); converter.str("");
193 
194 
195  if (comparitor_real<0 || fabs(comparitor_imag)>1e-8 ) {
196  is_soln = 0;
197  }
198 
199  }
200 
201 
202  if (is_soln==1) {
203  for (int jj=0; jj<this->numvariables; ++jj) {
204  current_point_data << solutions_this_point[ii][jj].first << " " << solutions_this_point[ii][jj].second << "\n";
205  }
206  current_point_data << "\n";
207  tmp_num_found_solns++;
208  }
209 
210 
211 
212  }
213 
214  bool meets_upper_thresh;
215 
216  if (paramotopy_settings.settings["mode"]["search_numposrealthreshold_upper"].intvalue==-1){
217  meets_upper_thresh = true;
218  }
219  else{
220  meets_upper_thresh = (tmp_num_found_solns<=paramotopy_settings.settings["mode"]["search_numposrealthreshold_upper"].intvalue);
221  }
222 
223 
224  bool meets_lower_thresh = (tmp_num_found_solns>=paramotopy_settings.settings["mode"]["search_numposrealthreshold_lower"].intvalue);
225 
226  if (meets_lower_thresh && meets_upper_thresh) {
227 
228  outstring << current_params[2*int(ParamNames.size())] << "\n";
229 
230  for (int ii = 0; ii < int(ParamNames.size());++ii){
231  outstring.precision(16);
232  outstring << current_params[2*ii] << " ";
233  outstring.precision(16);
234  outstring << current_params[2*ii+1] << " ";
235  }
236  outstring << "\n";
237 
238  outstring << tmp_num_found_solns << "\n\n";
239  outstring << current_point_data.str();
240 
241  slavemap[orig_filename].num_found_solns = tmp_num_found_solns;
242  slavemap[orig_filename].runningfile.append(outstring.str());
243 
244 
245  }
246  else
247  {
248  slavemap[orig_filename].num_found_solns = 0;
249  }
250 
251 
252 
253 
254 }
255 
256 
257 
258 
259 void datagatherer::AppendData(std::string orig_filename,
260  double *current_params){
261 
262 
263  std::string cline = "";
264  std::stringstream outstring;
265  std::ifstream fin(orig_filename.c_str());
266 
267  if (!fin.is_open()) {
268  std::cerr << "failed to open file '" << orig_filename << "' to read data" << std::endl;
269  exit(-42);
270  }
271 
272 
273  outstring << current_params[2*int(ParamNames.size())] << "\n";
274 
275  for (int ii = 0; ii < int(ParamNames.size());++ii){
276  outstring.precision(16);
277  outstring << current_params[2*ii] << " " << current_params[2*ii+1] << " ";
278  }
279  outstring << "\n";
280  while(getline(fin,cline)){
281  outstring << cline << "\n";
282  }
283  fin.close();
284 
285  slavemap[orig_filename].num_found_solns = 0;
286  slavemap[orig_filename].runningfile.append(outstring.str());
287 
288 
289  return;
290 }
291 
293 
294  std::map<std::string, fileinfo>::iterator iter;
295 
296  for (iter=this->slavemap.begin(); iter!=this->slavemap.end(); iter++) {
297  datagatherer::WriteData(iter->second.runningfile,
298  datagatherer::MakeTargetFilename(iter->first));
299  }
300 
301 }
302 
303 void datagatherer::WriteData(std::string outstring,
304  boost::filesystem::path target_file)
305 {
306 
307 
308  std::ofstream fout;
309  // test if file target file is open
310 
311 
312  if (boost::filesystem::exists(target_file)){ // if it can see the 'finished' file
313  fout.open(target_file.string().c_str(),std::ios::app);
314 
315  }
316  else{
317 
318  fout.open(target_file.string().c_str());
319  for (int ii = 0; ii < int(this->ParamNames.size());++ii){
320  fout << this->ParamNames[ii] << (ii != int(this->ParamNames.size())-1? " ": "\n");
321  }
322  }
323 
324  if (!fout.is_open()) {
325  std::cerr << "failed to open target dataout file '" << target_file.string() << "'\n";
326  exit(-41);
327  }
328 
329  fout << outstring;
330  fout.close();
331 }
332 
333 
334 
335 
336 
337 
338 
339 bool datagatherer::GatherDataForFails(std::vector< point > terminal_fails,
340  std::vector< point > & successful_resolves)
341 {
342 //TODO: add proper sanity check
343 
344 
345  GetFilesToParse(this->run_to_analyze, this->gather_savefiles, this->gather_parser_indices); //in para_aux_funcs
346  //sets the gather_savefiles and gather_parser_indices, based on the c1 folder
347 
348  std::vector< boost::filesystem::path > folders_with_data = GetFoldersForData(run_to_analyze);
349 
350  for (int ii=0;ii<int(gather_savefiles.size());++ii){
352  }
353 
354  //at this point, we should have the run_to_analyze/gathered_data/finalized folder, which will contain exactly one file for each of the user-specified saved files, in order, with all the data for the run. just need to parse it.
355 
356  boost::filesystem::path folder_with_data = this->run_to_analyze;
357  folder_with_data /= "gathered_data/finalized";
358 
359  std::vector < point > current_data = datagatherer::GatherFinalizedDataToMemory(folder_with_data);
360 
361 
362 
363  successful_resolves = CompareInitial_Gathered(terminal_fails, current_data);
364 
365 
366 
367 
368 
369  return true;
370 }
371 
372 
373 
374 
375 
376 std::vector< point > datagatherer::CompareInitial_Gathered(std::vector< point > terminal_fails, std::vector< point > current_data)
377 {
378  std::vector< point > successful_resolves;
379 
380 
381 
382  if (terminal_fails.size() == current_data.size()) {
383 // std::cout << "no points successfully resolved" << std::endl;
384  }
385  else{
386  std::vector< int > flag_if_success;
387  flag_if_success.resize(current_data.size());
388 
389  for (int ii=0; ii<int(current_data.size()); ++ii) {
390  flag_if_success[ii]=1;
391  } // seed the vector
392 
393 
394  successful_resolves.resize(current_data.size()-terminal_fails.size());
395 
396  for (int ii=0; ii<int(terminal_fails.size()); ++ii) {
397  flag_if_success[terminal_fails[ii].index] = 0;
398  }
399 
400  int counter=0;
401  for (int ii=0; ii<int(current_data.size()); ++ii) {
402  if (flag_if_success[ii]==1){
403  successful_resolves[counter].index = current_data[ii].index;
404  successful_resolves[counter].collected_data = current_data[ii].collected_data;
405 
406  counter++;
407  }
408  }
409  }
410 
411 
412  return successful_resolves;
413 }
414 
415 
417 std::vector < point > datagatherer::GatherFinalizedDataToMemory(boost::filesystem::path folder_with_data)
418 {
419 
420 
421  std::map <std::string, std::vector< point > > temp_point_storage;
422  std::vector< point > master_point_storage;
423 
424 
425  for (int ii = 0; ii< int(this->gather_savefiles.size()); ++ii) {
426 
427  boost::filesystem::path currentfile = folder_with_data;
428  currentfile /= this->gather_savefiles[ii] + "0";
429  std::vector < point > gathered_data;
430 
431  //std::cout << "opening file " << currentfile.string() << " to read data" << std::endl;//remove me?
432  std::ifstream datafile(currentfile.string().c_str());
433 
434  if (!datafile.is_open()) {
435  std::cerr << "failed to open " << currentfile.string() << std::endl;
436  return master_point_storage;
437  }
438 
439  std::string tmpstr;
440 
441  getline(datafile,tmpstr); //waste the parameter names
442  int index;
443  std::string data;
444  while (!datagatherer::ReadPoint(datafile, index, data, gather_parser_indices[ii])) {
445  point tmppoint;
446  tmppoint.index = index;
447  tmppoint.collected_data[gather_savefiles[ii]] = data;
448  gathered_data.push_back(tmppoint);
449  }
450  datafile.close();
451 
452  std::sort(gathered_data.begin(), gathered_data.end()); //pick up here tomorrow morning.
453  temp_point_storage[gather_savefiles[ii]] = gathered_data;
454  }
455 
456  master_point_storage.resize(temp_point_storage[gather_savefiles[0]].size());
457 
458 
459  //now put them together, return.
460 
461  for (int ii=0; ii< int (temp_point_storage[gather_savefiles[0]].size()); ++ii) {
462  point tmppoint;
463  tmppoint.index = temp_point_storage[gather_savefiles[0]][ii].index;
464 
465  for (int jj=0; jj< int(gather_savefiles.size()); ++jj){
466  tmppoint.collected_data[gather_savefiles[jj]] = temp_point_storage[gather_savefiles[jj]][ii].collected_data[gather_savefiles[jj]];
467  }
468  master_point_storage[ii] = tmppoint;
469  }
470 
471  std::sort(master_point_storage.begin(), master_point_storage.end());
472 
473 
474  return master_point_storage;
475 }
476 
477 
478 
479 
480 
481 
482 
483 
484 
486 
487  boost::filesystem::path run_to_analyze = datagatherer::GetAvailableRuns();
488  if (run_to_analyze.string()=="") {
489  return;
490  }
491 
493  //get the file type to analyze
495 
496 
497 
498 
499 
500  GetFilesToParse(run_to_analyze, this->gather_savefiles, this->gather_parser_indices); //in para_aux_funcs
501  //sets the gather_savefiles and gather_parser_indices, based on the c1 folder
502 
503  std::vector< boost::filesystem::path > folders_with_data = GetFoldersForData(run_to_analyze);
504 
505  for (int ii=0;ii<int(gather_savefiles.size());++ii){
506  std::cout << "collecting " << gather_savefiles[ii] << std::endl;
507  datagatherer::CollectSpecificFiles(gather_savefiles[ii], folders_with_data, run_to_analyze,
508  gather_parser_indices[ii], true);
509 
510  }
511 
512 
513  return;
514 }
515 
516 
517 
518 
519 
520 
521 void datagatherer::CollectSpecificFiles(std::string file_to_gather,
522  std::vector < boost::filesystem::path > folders_with_data,
523  boost::filesystem::path run_to_analyze, int parser_index, bool mergefailed)
524 {
525 
526 
527  //now need to merge-sort method of gathering data, since the data is distributed in a collection of folders and files, in monotone order. we will do this in files, since the data may be larger than available ram.
528  boost::filesystem::path output_folder_name = "unset_folder_name";
529  int output_folder_index = -1;
530 
531  boost::filesystem::path base_output_folder_name = run_to_analyze;
532  base_output_folder_name /= "gathered_data";
533  boost::filesystem::create_directory(base_output_folder_name);
534 
535 
536 
537  std::vector< bool> current_folders_are_basic, next_folders_are_basic;
538 
539  std::vector< boost::filesystem::path > next_folders = folders_with_data; // seed
540  std::vector< boost::filesystem::path > current_folders;
541 
542  for (int ii=0; ii<int(folders_with_data.size()); ++ii) {
543  next_folders_are_basic.push_back(true);
544  }
545 
546  int current_num_folders;
547  int level = 0;
548  while (next_folders.size()>1){
549 
550  current_folders = next_folders;
551  current_num_folders = current_folders.size();
552  current_folders_are_basic = next_folders_are_basic;
553 
554  next_folders.clear();
555  next_folders_are_basic.clear();
556 
557 
558  for (int jj=0; jj< ( current_num_folders - (current_num_folders%2) ) ; jj=jj+2) {
559  datagatherer::IncrementOutputFolder(output_folder_name, base_output_folder_name, output_folder_index);
560  boost::filesystem::create_directory(output_folder_name);
561 // std::cout << "merging " << current_folders[jj] << " " << current_folders[jj+1] << " lvl " << level << " iteration " << jj/2+1 << std::endl;
562  datagatherer::MergeFolders( file_to_gather, current_folders[jj], current_folders[jj+1], output_folder_name,parser_index);
563 
564 
565  next_folders_are_basic.push_back(false);
566  next_folders.push_back(output_folder_name); //put on the list for next level of sorting
567 
568  if ( current_folders_are_basic[jj]==false ) { //if not on the first level (that is, to leave the raw unsorted data intact), remove the data.
569  boost::filesystem::remove_all(current_folders[jj]); //remove the previous step's files
570  // i reiterate how awesome the boost library is.
571  }
572 
573  if ( current_folders_are_basic[jj+1]==false ) { //if not on the first level (that is, to leave the raw unsorted data intact), remove the data.
574  boost::filesystem::remove_all(current_folders[jj+1]); //remove the previous step's files
575  // i reiterate how awesome the boost library is.
576  }
577 
578 
579  }
580 
581  if ( ( (current_num_folders%2) == 1) ) { //if there is an odd man out.
582  next_folders.push_back(current_folders[current_num_folders-1]); // put the last folder on (-1) for zero indexing
583  if (current_folders_are_basic[current_num_folders-1]==true) {
584  next_folders_are_basic.push_back(true);
585  }
586  }
587  level++;
588  }
589 
590  boost::filesystem::path source_folder;
591  source_folder = next_folders[0]; // set this for finalizing.
592  bool source_folder_is_basic = next_folders_are_basic[0];
593 
594 
595  datagatherer::finalize_run_to_file(file_to_gather, source_folder, base_output_folder_name, parser_index, mergefailed);
596 
597 
598  if (source_folder_is_basic==false) {
599  boost::filesystem::remove_all(source_folder); //remove the previous step's files
600  }
601  return;
602 }
603 
604 
605 
606 
607 std::map< int, point > datagatherer::ReadSuccessfulResolves(){
608 
609  std::map< int, point > successful_resolves;
610 
611 
612  boost::filesystem::path filetoopen = this->base_dir;
613  filetoopen /= "failure_analysis/resolved_file";
614 
615  if (!boost::filesystem::exists(filetoopen)) {
616  std::cout << filetoopen.string() << " does not exist, for reading in successful re-solves." << std::endl;
617  return successful_resolves;
618  }
619 
620  std::string resolved_file_name; // read from a file, and converted into boost::filesystem::path
621 
622  std::ifstream sourcefile(filetoopen.string().c_str());
623  getline(sourcefile,resolved_file_name);
624  sourcefile.close();
625 
626 
627  filetoopen = resolved_file_name; // convert to boost::filesystem::path
628 
629 
630  if (!boost::filesystem::exists(filetoopen)) {
631  std::cerr << "file " << filetoopen.string() << " doesn't exist, even though it should." << std::endl;
632  return successful_resolves;
633  }
634 
635 
636  sourcefile.open(resolved_file_name.c_str());
637 
638  std::string tmpstr;
639  std::stringstream converter;
640  int num_attempted_resolves;
641 
642 
643  getline(sourcefile,tmpstr);
644  converter << tmpstr;
645  converter >> num_attempted_resolves;
646 
647  std::map < std::string, int > parsermap;
648  parsermap["real_solutions"] = 1;
649  parsermap["nonsingular_solutions"] = 1;
650  parsermap["singular_solutions"] = 1;
651  parsermap["raw_data"] = -1;
652  parsermap["raw_solutions"] = -1;
653  parsermap["main_data"] = -1;
654  parsermap["midpath_data"] = -1;
655  parsermap["failed_paths"] = 2;
656 
657 
658  for (int ii=0; ii<num_attempted_resolves; ++ii) {
659  point tmppoint;
660  int next_index, num_files_to_collect;
661  std::string next_data;
662  std::stringstream converter;
663  getline(sourcefile,tmpstr);
664  converter << tmpstr;
665  converter >> next_index;
666  converter >> num_files_to_collect;
667 
668  converter.clear();
669  converter.str("");
670 
671  tmppoint.index = next_index;
672 
673  if (num_files_to_collect>0) {
674  std::vector< std::string > filename;
675  filename.resize(num_files_to_collect);
676  getline(sourcefile, tmpstr);
677  converter << tmpstr;
678  for (int jj = 0; jj<num_files_to_collect; ++jj) {
679  converter >> filename[jj];
680  }
681 
682 
683  for (int kk=0; kk<num_files_to_collect; ++kk) {
684  ReadPoint(sourcefile, tmppoint.collected_data[filename[kk]], parsermap[filename[kk]]);
685  }
686  }
687 
688 
689  successful_resolves[next_index] = tmppoint;
690 
691 
692  }
693 
694  sourcefile.close();
695 
696  return successful_resolves;
697 
698 
699 
700 }
701 
702 
703 void datagatherer::WriteUnsuccessfulResolves(std::map< int, point> successful_resolves){
704 
705  std::map<int, point>::iterator iter;
706 
707  boost::filesystem::path persistentfails_name = this->base_dir;
708  persistentfails_name /= "gathered_data/finalized/persistent_fails";
709 
710  std::ofstream persistentfails(persistentfails_name.string().c_str());
711  if (!persistentfails.is_open()) {
712  std::cerr << "failed to open " << persistentfails_name.string() << std::endl;
713  return;
714  }
715 
716  for (iter=successful_resolves.begin(); iter!=successful_resolves.end(); iter++) {
717  if (iter->second.collected_data.size()==0) {
718  persistentfails << iter->first << "\n";
719  }
720  }
721 
722  persistentfails.close();
723  return;
724 }
725 
726 
727 void datagatherer::finalize_run_to_file(std::string file_to_gather,
728  boost::filesystem::path source_folder,
729  boost::filesystem::path base_output_folder_name,
730  int parser_index, bool mergefailed)
731 {
732 
733 
734  boost::filesystem::path output_file_name = base_output_folder_name;
735  output_file_name /= "finalized";
736 
737 
738  boost::filesystem::create_directory(output_file_name);
739 
740  output_file_name /= file_to_gather;
741  output_file_name += "0";
742 
743  boost::filesystem::remove(output_file_name);//remove the old file
744 
745 
746 
747  std::string expression = "^"; //specify beginning of string
748  expression.append(file_to_gather);
749  std::vector < boost::filesystem::path > filelist = FindFiles(source_folder, expression); //this function is in para_aux_funcs
750 
751 
752  std::ofstream output_file(output_file_name.c_str());
753  std::string tmpstr;
754 
755 
756  //initialize
757  int previous_index = -1;
758  int next_index = 0;
759  std::string next_data = "";
760 
761 
762  std::map< int, point > successful_resolves;
763  if (mergefailed) {
764  successful_resolves = datagatherer::ReadSuccessfulResolves();
765  datagatherer::WriteUnsuccessfulResolves(successful_resolves);
766  }
767 
768  bool passed_check = true;
769 
770 
771 
772 
773 
774  for (int ii=0; ii< int(filelist.size()); ++ii) {
775 
776  // MEN addition
777  // create a std::vector<int> lookupinfo where lookupinfo[i] = byte # of first location
778  // to be used by the ReadPoint function, in the sense that ifstream.seekg(bytelocation) can be called
779  // either in ReadPoint function, or beforehand, as the input file stream is passed by reference
780  // to that particular function
781 
782  int bytecount = 0;
783  std::vector<int> lookupinfo;
784 
785  std::ifstream sourcefile(filelist[ii].c_str());
786 
787  if (!sourcefile.is_open()) {
788  std::cerr << "error: " << filelist[ii] << " failed to open" << std::endl;
789  }
790 
791  getline(sourcefile,tmpstr); // waste the parameter line
792  if (ii==0) {
793  output_file << tmpstr << "\n";
794  }
795  bytecount+=tmpstr.size() + 1; // + 1 for the new line char
796  lookupinfo.push_back(bytecount);
797 
798  while (! (datagatherer::ReadPoint(sourcefile, next_index, next_data, parser_index)) ) {
799 
800  bytecount+=next_data.size() + 1; // + 1 for the new line char
801  // take into account the number of bytes to write the line number
802 
803  std::stringstream ss_ni;
804  ss_ni << next_index;
805  bytecount+=ss_ni.str().size(); // do I need one more for new line ... we'll see . . .
806 
807  lookupinfo.push_back(bytecount); // this assumes we have success in everything and no index mismatch
808 
809  //check the integrity of the data
810  if (next_index!=(previous_index+1)){
811  std::cerr << "index mismatch, filename " << file_to_gather << ", with indices " << previous_index << " & " << next_index << std::endl;
812  passed_check = false;
813  }
814 
815  if (mergefailed) {
816  datagatherer::CheckForResolvedFailedPoint(file_to_gather,next_index,next_data,successful_resolves);
817  }
818 
819  output_file << next_index << "\n" << next_data;
820  previous_index = next_index;
821  } // end while
822 
823 
824 
825  if (passed_check){ // this is just passed_check for the currentfile index (i.e. only nonsingular_solutions1 and not nonsingular_solutions2
826  // note that the ^ regular expression is used, so in order to avoid finding this lookup table as a possible file that contains bertini output info sorted
827  // the file should now be lookup_(filelist[ii].c_str()), i.e. like loopup_nonsingular_solutions0
828  boost::filesystem::path output_lookup = base_output_folder_name;
829  boost::filesystem::path filename = filelist[ii].filename();
830 
831  output_lookup /= "finalized";
832  output_lookup /= "lookup_";
833  output_lookup += filename;
834 
835  // write the lookup table file
836 
837  std::ofstream fout_lookup(output_lookup.c_str());
838  for (int mm = 0; mm < lookupinfo.size(); ++mm){
839  fout_lookup << lookupinfo[mm] << "\n";
840  }
841  fout_lookup.close();
842 
843  }
844  else{
845 
846  // note that the ^ regular expression is used, so in order to avoid finding this lookup table as a possible file that contains bertini output info sorted
847  // the file should now be lookup_(filelist[ii].c_str()), i.e. like loopup_nonsingular_solutions0
848  boost::filesystem::path output_lookup = base_output_folder_name;
849  boost::filesystem::path filename = filelist[ii].filename();
850 
851  output_lookup /= "finalized";
852  output_lookup /= "lookup_";
853  output_lookup += filename;
854  // remove the lookup table file
855  boost::filesystem::remove(output_lookup);
856 
857  }
858  sourcefile.close();
859 
860 
861  } // end for
862 
863 
864  output_file.close();
865 
866  std::cout << "done finalizing file " << file_to_gather << "." << std::endl;
867 
868  if (passed_check) {
869  std::cout << "passed integrity check for in-orderness of points." << std::endl;
870 
871  }
872  else{
873  std::cout << "failed integrity check. one or more points were out of order or missing." << std::endl;
874  std::cout << "todo: keep record of missing points" << std::endl; //remove me when completed
875  }
876 
877 
878  return;
879 }
880 
881 
882 void datagatherer::CheckForResolvedFailedPoint(std::string file_to_gather,
883  int next_index,std::string & next_data,
884  std::map< int, point> successful_resolves)
885 {
886 
887  // attempt to find point with the same index.
888  if (successful_resolves.find(next_index) ==successful_resolves.end()) {
889  //did not find
890  return;
891  }
892  else{
893  //did find!
894 
895  //check for data
896  if (successful_resolves[next_index].collected_data.find(file_to_gather)!=successful_resolves[next_index].collected_data.end() ){
897  next_data = successful_resolves[next_index].collected_data[file_to_gather];
898  std::cout << next_index << " replaced with resolved data." << std::endl;
899  }
900  else{
901  //found point, but no data. must have been a persistent fail. simply return.
902  return;
903  }
904  }
905 
906  return;
907 }
908 
909 boost::filesystem::path datagatherer::GetAvailableRuns(){
911  //get the runs available
913 
914  boost::filesystem::path run_to_analyze = "";
915 
916  std::vector< boost::filesystem::path > found_runs = FindDirectories(this->fundamental_dir, "^run");
917  std::vector< boost::filesystem::path > completed_runs;
918 
919 
920  int completed_counter = 0;
921  for (int ii = 0; ii<int(found_runs.size()); ii++){
922  if ( TestIfFinished(found_runs[ii])==true){ // in para_aux_funcs
923 
924  completed_runs.push_back(found_runs[ii]);
925  std::cout << completed_counter << ": " << found_runs[ii].string() << "\n";
926  completed_counter++;
927  }
928  else{
929 
930  }
931  }
932 
933  if (completed_counter==0){
934  std::cout << "found no completed runs. sorry.\n";
935  return run_to_analyze;
936  }
937 
938 
939  if (completed_counter==1){
940  run_to_analyze = completed_runs[0];
941  }
942  else{
943  int choice = get_int_choice("which run?\n: ",0,completed_counter-1);
944  run_to_analyze = completed_runs[choice];
945  }
946 
947  return run_to_analyze;
948 }
949 
950 
951 
952 
953 void datagatherer::MergeFolders(std::string file_to_gather, boost::filesystem::path left_folder,
954  boost::filesystem::path right_folder, boost::filesystem::path output_folder_name, int parser_index)
955 {
956 
957  std::stringstream converter;
958 
959  boost::filesystem::path output_file_name = output_folder_name;
960  output_file_name /= file_to_gather += "0";
961 
962  //std::cout << "opening file " << output_file_name << " to write data" << std::endl; //remove me
963  std::ofstream outputfile(output_file_name.c_str());
964 
965  if (!outputfile.is_open()) {
966  std::cerr << "outputfile " << output_file_name << " failed to open for writing results of merge." << std::endl;
967  }
968 
969 
970 
971  std::string expression = "^"; //specify the beginning of the string (regex)
972  expression.append(file_to_gather);
973 
974  int file_index_left = 0, file_index_right = 0;//, file_index_output = -1;
975 
976  int next_index_left, next_index_right;//, parameter_index_left= -2, parameter_index_right = -2, current_index=-1;
977 
978  std::string output_buffer;
979 
980  std::vector < boost::filesystem::path > filelist_left = FindFiles(left_folder, expression); //this function is in para_aux_funcs
981  std::vector < boost::filesystem::path > filelist_right = FindFiles(right_folder, expression); //this function is in para_aux_funcs
982 
983 
984  if (filelist_left.size()==0) {
985  std::cerr << "folder to merge '" << left_folder.string() << "' had no data files!" << std::endl;
986  return;
987  }
988  if (filelist_right.size()==0) {
989  std::cerr << "folder to merge '" << right_folder.string() << "' had no data files!" << std::endl;
990  return;
991  }
992 
993 
994  std::string tmp_left, tmp_right; //temporary strings for holding data.
995  std::string next_data_left, next_data_right;
996 
997  std::ifstream datafile_left( filelist_left[0].c_str());
998  std::ifstream datafile_right(filelist_right[0].c_str());
999 
1000  if (!datafile_left.is_open()) {
1001  std::cerr << filelist_left[0] << " failed to open for merging" << std::endl;
1002  }
1003  if (!datafile_right.is_open()) {
1004  std::cerr << filelist_right[0] << " failed to open for merging" << std::endl;
1005  }
1006 
1007  getline(datafile_left,tmp_left);//read the parameters
1008  getline(datafile_right,tmp_right);//read the parameters. even "empty" data files contain this line.
1009 
1010 
1011  bool keep_going_left, keep_going_right, next_read_left, next_read_right;
1012 
1013 
1014 
1015  if (datafile_left.eof()) {
1016  keep_going_left = false;
1017  }
1018  else{
1019  keep_going_left = true;
1020  next_read_left = true; // to seed the merge
1021  }
1022 
1023  if (datafile_right.eof()) {
1024  keep_going_right = false;
1025  }
1026  else{
1027  keep_going_right = true; // to seed the merge
1028  next_read_right = true;
1029  }
1030 
1031 
1032  output_buffer.append(tmp_left); //make the top line be the parameter names, to conform to the standard
1033  output_buffer.append("\n");
1034 
1035 
1036  while ( 1 ) {
1037 
1038 
1039  if (next_read_left){ // read the left file
1040  datagatherer::ReadPoint(datafile_left, next_index_left, next_data_left, parser_index);
1041  }
1042  if (next_read_right) { //read the right file
1043  datagatherer::ReadPoint(datafile_right, next_index_right, next_data_right, parser_index);
1044  }
1045 
1046 
1047  while ( datafile_left.eof() && keep_going_left ) {
1048  keep_going_left = datagatherer::endoffile_stuff(datafile_left,file_index_left,filelist_left);
1049  datagatherer::ReadPoint(datafile_left, next_index_left, next_data_left, parser_index);
1050  }
1051  while (datafile_right.eof() && keep_going_right ) {
1052  keep_going_right = datagatherer::endoffile_stuff(datafile_right,file_index_right,filelist_right);
1053  datagatherer::ReadPoint(datafile_right, next_index_right, next_data_right, parser_index);
1054  }
1055 
1056 
1057 
1058 
1059  if ( (!keep_going_left) || (!keep_going_right) ){
1060 
1061 
1062  //append the last point
1063  if (!keep_going_left) {
1064 
1065  converter << next_index_right;
1066  output_buffer.append(converter.str());
1067  converter.clear();
1068  converter.str("");
1069  output_buffer.append("\n");
1070  output_buffer.append(next_data_right);
1071  }
1072 
1073 
1074  if (!keep_going_right){
1075 
1076  converter << next_index_left;
1077  output_buffer.append(converter.str());
1078  converter.clear();
1079  converter.str("");
1080  output_buffer.append("\n");
1081  output_buffer.append(next_data_left);
1082  }
1083 
1084 
1085  break; //break the while loop
1086  }
1087 
1088 
1089 
1090 
1091 
1092  if (next_index_left< next_index_right) {
1093  converter << next_index_left;
1094  output_buffer.append(converter.str());
1095  converter.clear();
1096  converter.str("");
1097  output_buffer.append("\n");
1098  output_buffer.append(next_data_left);
1099  next_read_left = true;
1100  next_read_right = false;
1101  }
1102  else{ // next_index_right < next_index_left
1103  converter << next_index_right;
1104  output_buffer.append(converter.str());
1105  converter.clear();
1106  converter.str("");
1107  output_buffer.append("\n");
1108  output_buffer.append(next_data_right);
1109  next_read_left = false;
1110  next_read_right = true;
1111  }
1112 
1113 
1114 
1115  if (output_buffer.size()>67108864) {
1116 
1117  outputfile << output_buffer;
1118  output_buffer = "";
1119  }
1120 
1121 
1122  }//re: while
1123 
1124 
1125 
1126 
1127 
1128  //now may have one file to keep reading
1129  if (keep_going_left) {
1130  datagatherer::rest_of_files(datafile_left, output_buffer, outputfile, filelist_left, file_index_left, parser_index);
1131  }
1132 
1133  if (keep_going_right) {
1134  datagatherer::rest_of_files(datafile_right, output_buffer, outputfile, filelist_right, file_index_right, parser_index);
1135  }
1136 
1137 
1138 
1139  //dump the rest of the buffer into the file
1140  outputfile << output_buffer;
1141  outputfile.close();
1142 
1143  return;
1144 }
1145 
1146 
1147 
1148 
1149 
1150 
1151 
1152 void datagatherer::rest_of_files(std::ifstream & datafile, std::string & output_buffer,
1153  std::ofstream & outputfile, std::vector < boost::filesystem::path > filelist,
1154  int file_index, int parser_index)
1155 {
1156  std::string tmpstr;
1157  std::stringstream converter;
1158  std::string next_data = "";
1159  int next_index;
1160 
1161  //still have one file to read which is open, plus others that may be not yet read.
1162  while (! (datagatherer::ReadPoint(datafile, next_index, next_data, parser_index)) ) {
1163  converter << next_index << "\n";
1164  output_buffer.append(converter.str());
1165  converter.clear();
1166  converter.str("");
1167  output_buffer.append(next_data);
1168 
1169 
1170  if (output_buffer.size()>67108864){
1171  outputfile << output_buffer;
1172  output_buffer = "";
1173  }
1174 
1175  }
1176 
1177  datafile.close();
1178 
1179 
1180  for (int ii=file_index+1; ii < int(filelist.size()); ++ii) {
1181 
1182  datafile.open(filelist[ii].c_str());
1183  getline(datafile,tmpstr); // waste the parameter name line
1184 
1185  while (! (datagatherer::ReadPoint(datafile, next_index, next_data, parser_index)) ) {
1186  converter << next_index << "\n";
1187  output_buffer.append(converter.str());
1188  converter.clear();
1189  converter.str("");
1190  output_buffer.append(next_data);
1191 
1192 
1193  if (output_buffer.size()>67108864){
1194  outputfile << output_buffer;
1195  output_buffer = "";
1196  }
1197  }
1198  datafile.close();
1199  }
1200 
1201 
1202  return;
1203 }
1204 
1205 
1206 bool datagatherer::endoffile_stuff(std::ifstream & datafile, int & file_index, std::vector < boost::filesystem::path > filelist){
1207  std::string tmpstr;
1208  datafile.close();
1209  file_index++;
1210  if (file_index+1>int(filelist.size())) { // the +1 is to compensate for zero-centered indexing...
1211  return false;
1212  }
1213  else{
1214  std::cout << "opening " << filelist[file_index] << std::endl;
1215  datafile.open(filelist[file_index].c_str());
1216 
1217  if (!datafile.is_open()) {
1218  std::cerr << "failed to open " << filelist[file_index] << " to read for data" << std::endl;
1219  }
1220 
1221  getline(datafile,tmpstr); //waste the top line (parameter names)
1222  return true;
1223  }
1224 
1225 }
1226 
1227 bool datagatherer::ReadPoint(std::ifstream & fin, std::string & data, int parser_index){
1228 
1229 
1230  std::string tmpstr;
1231  std::stringstream converter;
1232 
1233 
1234  getline(fin, data); //gets the parameter line
1235  data.append("\n");
1236  switch (parser_index) {
1237  case 1:
1238  data.append(datagatherer::ParseSolutionsFile(fin));
1239  break;
1240 
1241  case 2:
1242  data.append(datagatherer::ParseFailedPaths(fin));
1243  break;
1244 
1245  default:
1246  std::cerr << "invalid parser index " << parser_index << std::endl; // this should never happen
1247  break;
1248 
1249  }
1250 
1251  if (fin.eof()){
1252  return true;
1253  }
1254 
1255 
1256  return false;
1257 
1258 }
1259 
1260 
1261 bool datagatherer::ReadPoint(std::ifstream & fin, int & next_index, std::string & data, int parser_index){
1262  std::string tmpstr;
1263  std::stringstream converter;
1264 
1265  getline(fin, tmpstr); //get the line number
1266 
1267 
1268 
1269  converter << tmpstr;
1270  converter >> next_index;
1271  converter.clear();
1272  converter.str("");
1273 
1274  getline(fin, data); //gets the parameter line
1275  data.append("\n");
1276  switch (parser_index) {
1277  case 1:
1278  data.append(datagatherer::ParseSolutionsFile(fin));
1279  break;
1280 
1281  case 2:
1282  data.append(datagatherer::ParseFailedPaths(fin));
1283  break;
1284 
1285  default:
1286  std::cerr << "invalid parser index " << parser_index << std::endl; // this should never happen
1287  break;
1288 
1289  }
1290 
1291  if (fin.eof()){
1292  return true;
1293  }
1294 
1295 
1296  return false;
1297 
1298 }
1299 
1300 std::vector< std::vector < std::pair< std::string, std::string > > > datagatherer::ParseSolutionsFile_ActualSolutions(std::ifstream & fin)
1301 {
1302 
1303  std::string tmpstr;
1304  int number_of_solutions;
1305  std::stringstream converter;
1306 
1307 
1308 
1309  //create the main structure
1310  std::vector< std::vector < std::pair< std::string, std::string > > > solutions;
1311 
1312 
1313  // first we read in the number of solutions.
1314  getline(fin,tmpstr);
1315  converter << tmpstr; //get the number of solutions from the top of the file
1316  converter >> number_of_solutions;
1317 
1318  converter.clear(); converter.str(""); //reset
1319 
1320 
1321  getline(fin,tmpstr); //burn one line
1322 
1323 
1324  for (int solution_counter = 0; solution_counter < number_of_solutions; ++solution_counter) {
1325  std::vector < std::pair< std::string, std::string > > temporary_solution;//allocate the solution.
1326  //read in each solution
1327 
1328  for (int variable_counter = 0; variable_counter < this->numvariables; ++variable_counter) {
1329  std::pair < std::string, std::string > temporary_coordinates;
1330 
1331  getline(fin,tmpstr);
1332  converter << tmpstr;
1333 
1334  converter >> temporary_coordinates.first;
1335  converter >> temporary_coordinates.second;
1336  temporary_solution.push_back(temporary_coordinates);
1337  converter.clear(); converter.str(""); //reset
1338 
1339  }
1340 
1341  solutions.push_back(temporary_solution);
1342 
1343  getline(fin,tmpstr); // read the line separating solutions.
1344 
1345 
1346  }
1347 
1348 
1349 
1350  return solutions;
1351 }
1352 
1353 
1354 
1355 
1356 
1357 std::string datagatherer::ParseSolutionsFile(std::ifstream & fin){ //std::vector< std::vector < std::pair< std::string, std::string > > >
1358 
1359  std::stringstream converter;
1360  std::stringstream solutions_file;
1361  std::string tmpstr;
1362  int number_of_solutions;
1363  if (!getline(fin,tmpstr)){
1364  return "";
1365  }
1366 
1367 
1368  // first we read in the number of solutions.
1369 
1370 
1371  converter << tmpstr; //get the line number
1372  converter >> number_of_solutions;
1373  converter.clear(); //reset
1374  converter.str("");
1375  solutions_file << tmpstr << "\n";
1376  getline(fin,tmpstr); //burn one line
1377  solutions_file << tmpstr << "\n";
1378 
1379 
1380  for (int solution_counter = 0; solution_counter < number_of_solutions; ++solution_counter) {
1381 
1382  for (int variable_counter = 0; variable_counter < this->numvariables; ++variable_counter) {
1383  std::pair < std::string, std::string > temporary_coordinates;
1384 
1385  getline(fin,tmpstr);
1386  solutions_file << tmpstr << "\n";
1387 
1388  }
1389 
1390 
1391  getline(fin,tmpstr); // read the line separating solutions.
1392  solutions_file << tmpstr << "\n";
1393 
1394  }
1395 
1396 
1397 
1398  return solutions_file.str();
1399 }
1400 
1401 
1402 
1403 
1405 std::string datagatherer::ParseFailedPaths(std::ifstream & fin){
1406  int tempfailnum = 0;
1407  std::string tmpstr;
1408 
1409  std::stringstream faily_mcfailfail;
1410 
1411  while (1) {
1412 
1413  getline(fin,tmpstr);
1414  faily_mcfailfail << tmpstr << "\n";
1415  if (tmpstr.length()==0) { // if do not have a solution
1416  break;
1417  }
1418  else { //have a soln
1419  for (int i=0; i<3+this->numvariables; ++i) {
1420  getline(fin,tmpstr);
1421  faily_mcfailfail << tmpstr << "\n";
1422  }
1423  tempfailnum++;
1424  }
1425  }
1426  return faily_mcfailfail.str();
1427 }
1428 
1429 
1430 
1431 
1432 //used to control the output folder name for data gathering
1433 void datagatherer::IncrementOutputFolder(boost::filesystem::path & output_folder_name,
1434  boost::filesystem::path base_output_folder_name, int & output_folder_index)
1435 {
1436  std::stringstream converter;
1437 
1438  output_folder_index = (output_folder_index+1); //will start with 1 (since index starts at 0, and increment at start...);
1439  output_folder_name = base_output_folder_name;
1440  output_folder_name /= "tmp";
1441  converter << output_folder_index;
1442  output_folder_name += converter.str();
1443 
1444 
1445 
1446  return;
1447 }
1448 
1449 
1450 
1451 
1452 std::vector< boost::filesystem::path > datagatherer::GetFoldersForData(boost::filesystem::path dir){
1453 
1454  std::vector< boost::filesystem::path > foldervector;
1455 
1456 
1457  //read in folder file.
1458  boost::filesystem::path foldername = dir;
1459  foldername /= "folders";
1460  std::ifstream folderstream;
1461  folderstream.open(foldername.c_str());
1462 
1463  if (!folderstream.is_open()) {
1464  std::cerr << "failed to open file to read folders " << foldername.string() << std::endl;
1465  }
1466  else{
1467  std::string tmpstr;
1468 
1469 
1470  while (getline(folderstream,tmpstr)) {
1471  foldervector.push_back(boost::filesystem::path(tmpstr));
1472  }
1473  folderstream.close();
1474  }
1475 
1476  return foldervector;
1477 }
1478 
1479 
1480 
1481 void DataManagementMainMenu(runinfo & paramotopy_info){
1482 
1483  datagatherer lets_gather_some_data(paramotopy_info.base_dir, paramotopy_info.fundamental_dir,paramotopy_info.numvariables);
1484 
1485  std::stringstream menu;
1486 
1487  menu << "\n\nData Management Options\n\n" //
1488  << "1) Change Run Folder\n" //make menu
1489  << "2) Gather Data\n"
1490  << "*\n"
1491  << "0) Go Back\n"
1492  << "\n: ";
1493  int choice = -1001;
1494  while (choice!=0) {
1495 
1496 
1497  choice = get_int_choice(menu.str(),0,2);//display menu, get choice
1498 
1499  switch (choice) {
1500  case 0:
1501  break;
1502 
1503  case 1:
1504  paramotopy_info.ScanData();
1505  break;
1506 
1507  case 2:
1508 
1509  lets_gather_some_data.GatherDataFromMenu();
1510  break;
1511 
1512 
1513  default:
1514  std::cout << "somehow an unacceptable entry submitted :(\n";
1515  break;
1516  }
1517 
1518  }
1519 
1520 
1521  return;
1522 
1523 }
1524 
1525 
1526 
1527 
1528 
1529 
void MergeFolders(std::string file_to_gather, boost::filesystem::path left_folder, boost::filesystem::path right_folder, boost::filesystem::path output_folder_name, int parser_index)
void ScanData()
Definition: runinfo.cpp:1461
int numvariables
Definition: runinfo.hpp:60
std::map< int, point > ReadSuccessfulResolves()
std::vector< int > gather_parser_indices
bool ReadPoint(std::ifstream &fin, std::string &data, int parser_index)
void GatherDataFromMenu()
boost::filesystem::path base_dir
Definition: runinfo.hpp:77
std::vector< point > GatherFinalizedDataToMemory(boost::filesystem::path folder_with_data)
std::map< std::string, fileinfo > slavemap
boost::filesystem::path DataCollectedbase_dir
std::vector< std::string > ParamNames
boost::filesystem::path GetAvailableRuns()
boost::filesystem::path fundamental_dir
Definition: runinfo.hpp:74
std::string real_filename
std::vector< boost::filesystem::path > GetFoldersForData(boost::filesystem::path dir)
std::vector< boost::filesystem::path > FindDirectories(boost::filesystem::path, std::string expression)
void AppendOnlyPosReal(std::string orig_filename, double *current_params, ProgSettings &paramotopy_settings)
Class containing parameter values, index, and collected data.
Definition: point.hpp:32
bool TestIfFinished(boost::filesystem::path &path_to_check)
std::vector< std::string > gather_savefiles
std::vector< boost::filesystem::path > FindFiles(boost::filesystem::path dir, std::string expression)
bool GatherDataForFails(std::vector< point > terminal_fails, std::vector< point > &successful_resolves)
std::string ParseFailedPaths(std::ifstream &fin)
the parser for the failed_paths file type, which is output from bertini.
void rest_of_files(std::ifstream &datafile, std::string &output_buffer, std::ofstream &outputfile, std::vector< boost::filesystem::path > filelist, int file_index, int parser_index)
std::vector< point > CompareInitial_Gathered(std::vector< point > terminal_fails, std::vector< point > current_data)
boost::filesystem::path MakeTargetFilename(std::string filename)
Definition: datagatherer.cpp:9
std::vector< std::vector< std::pair< std::string, std::string > > > ParseSolutionsFile_ActualSolutions(std::ifstream &fin)
bool SlaveCollectAndWriteData(double *current_params, ProgSettings &paramotopy_settings, timer &process_timer)
void CollectSpecificFiles(std::string file_to_gather, std::vector< boost::filesystem::path > folders_with_data, boost::filesystem::path run_to_analyze, int parser_index, bool mergefailed)
int get_int_choice(std::string display_string, int min_value, int max_value)
void WriteData(std::string outstring, boost::filesystem::path target_file)
void IncrementOutputFolder(boost::filesystem::path &output_folder_name, boost::filesystem::path base_output_folder_name, int &output_folder_index)
void GetFilesToParse(boost::filesystem::path run_to_analyze, std::vector< std::string > &gather_savefiles, std::vector< int > &gather_parser_indices)
boost::filesystem::path base_dir
bool endoffile_stuff(std::ifstream &datafile, int &file_index, std::vector< boost::filesystem::path > filelist)
void SlaveSetup(ProgSettings &paramotopy_settings, runinfo &paramotopy_info, int myid, boost::filesystem::path called_dir)
void DataManagementMainMenu(runinfo &paramotopy_info)
void add_file_to_save(std::string filename)
std::string ParseSolutionsFile(std::ifstream &fin)
void CheckForResolvedFailedPoint(std::string file_to_gather, int next_index, std::string &next_data, std::map< int, point > successful_resolves)
std::vector< std::string > ParameterNames
Definition: runinfo.hpp:104
std::map< std::string, std::string > collected_data
Definition: point.hpp:48
boost::filesystem::path location
Definition: runinfo.hpp:71
void WriteAllData()
void finalize_run_to_file(std::string file_to_gather, boost::filesystem::path source_folder, boost::filesystem::path base_output_folder_name, int parser_index, bool mergefailed)
Class for gathering data, from failed path analysis, and from completed runs.
void WriteUnsuccessfulResolves(std::map< int, point > successful_resolves)
categorymap settings
void add_time(const std::string timer_name)
Definition: timing.cpp:12
A class that stores the general program settings of Paramotopy.
long long index
Definition: point.hpp:38
A class for the input file parser.
Definition: runinfo.hpp:41
void AppendData(std::string orig_filename, double *current_params)
boost::filesystem::path fundamental_dir
void press_start(const std::string timer_name)
Definition: timing.cpp:5
Capable of timing arbitrary categories of processes, using a map of timer_data's. ...
Definition: timing.hpp:71
boost::filesystem::path run_to_analyze