5 {
"real_solutions",
"nonsingular_solutions",
"singular_solutions",
"raw_data",
"raw_solutions",
"main_data",
"midpath_data" };
28 std::stringstream config;
30 config <<
"CONFIG\n%this config automatically generated by paramotopy\n\n";
31 settingmap::iterator iter;
32 for (iter=
settings[
"step1bertini"].begin(); iter !=
settings[
"step1bertini"].end(); iter++){
33 std::string setting_name = (*iter).first;
34 config << setting_name <<
": "
35 <<
settings[
"step1bertini"][setting_name].value() <<
";\n";
51 std::stringstream config;
53 config <<
"CONFIG\n%this config automatically generated by paramotopy\n\n";
55 settingmap::iterator iter;
57 for (iter=
settings[
"step2bertini"].begin(); iter !=
settings[
"step2bertini"].end(); iter++){
58 std::string setting_name = (*iter).first;
59 config << setting_name <<
": "
60 <<
settings[
"step2bertini"][setting_name].value() <<
";\n";
62 if (this->
settings[
"mode"][
"standardstep2"].intvalue==1){
64 config <<
"USERHOMOTOPY: 1;\n";
78 std::stringstream config;
80 config <<
"CONFIG\n%this config automatically generated by paramotopy\n\n";
82 settingmap::iterator iter;
84 for (iter=
settings[
"PathFailureBertiniCurrent"].begin(); iter !=
settings[
"PathFailureBertiniCurrent"].end(); iter++){
85 std::string setting_name = (*iter).first;
86 config << setting_name <<
": "
87 <<
settings[
"PathFailureBertiniCurrent"][setting_name].value() <<
";\n";
89 if (this->
settings[
"mode"][
"standardstep2"].intvalue==1){
91 config <<
"USERHOMOTOPY: 1;\n";
112 settings[
"PathFailureBertiniCurrent"][
"TRACKTOLBEFOREEG"].doubvalue = 0.1*
settings[
"PathFailureBertiniCurrent"][
"TRACKTOLBEFOREEG"].doubvalue;
113 settings[
"PathFailureBertiniCurrent"][
"TRACKTOLDURINGEG"].doubvalue = 0.1*
settings[
"PathFailureBertiniCurrent"][
"TRACKTOLDURINGEG"].doubvalue;
114 settings[
"PathFailureBertiniCurrent"][
"FINALTOL"].doubvalue = 0.1*
settings[
"PathFailureBertiniCurrent"][
"FINALTOL"].doubvalue;
124 settings[
"PathFailureBertiniBase"].clear();
125 settingmap::iterator iter;
127 for (iter=
settings[
"step2bertini"].begin(); iter !=
settings[
"step2bertini"].end(); iter++){
128 std::string setting_name = (*iter).first;
129 switch (
settings[
"step2bertini"][setting_name].type) {
131 setValue(
"PathFailureBertiniBase",setting_name,
settings[
"step2bertini"][setting_name].value());
134 setValue(
"PathFailureBertiniBase",setting_name,
settings[
"step2bertini"][setting_name].intvalue);
137 setValue(
"PathFailureBertiniBase",setting_name,
settings[
"step2bertini"][setting_name].doubvalue);
151 settings[
"PathFailureBertiniCurrent"].clear();
152 settingmap::iterator iter;
154 for (iter=
settings[
"PathFailureBertiniBase"].begin(); iter !=
settings[
"PathFailureBertiniBase"].end(); iter++){
155 std::string setting_name = (*iter).first;
156 switch (
settings[
"PathFailureBertiniBase"][setting_name].type) {
158 setValue(
"PathFailureBertiniCurrent",setting_name,
settings[
"PathFailureBertiniBase"][setting_name].value());
161 setValue(
"PathFailureBertiniCurrent",setting_name,
settings[
"PathFailureBertiniBase"][setting_name].intvalue);
164 setValue(
"PathFailureBertiniCurrent",setting_name,
settings[
"PathFailureBertiniBase"][setting_name].doubvalue);
190 setValue(
"files",
"writemeshtomc",
int(0));
191 setValue(
"files",
"customtmplocation",0);
192 setValue(
"files",
"tempfilelocation",boost::filesystem::path(
"."));
193 setValue(
"files",
"newfilethreshold",67108864);
195 setValue(
"system",
"buffersize",65536);
209 setValue(
"SaveFiles",
"nonsingular_solutions",1);
210 setValue(
"SaveFiles",
"real_solutions",1);
213 setValue(
"parallelism",
"usemachine",
int(0));
214 setValue(
"parallelism",
"parallel",
int(1));
215 setValue(
"parallelism",
"architecture",std::string(
"mpiexec"));
216 setValue(
"parallelism",
"numprocs",
int(2));
217 setValue(
"parallelism",
"numfilesatatime",100);
219 setValue(
"files",
"newrandom_newfolder",0);
220 setValue(
"files",
"previousdatamethod",1);
221 setValue(
"files",
"deletetmpfilesatend",1);
224 setValue(
"mode",
"startfilename",std::string(
"nonsingular_solutions"));
234 setValue(
"step1bertini",
"TRACKTOLBEFOREEG",1e-5);
235 setValue(
"step1bertini",
"TRACKTOLDURINGEG",1e-6);
236 setValue(
"step1bertini",
"FINALTOL",1e-11);
237 setValue(
"step1bertini",
"IMAGTHRESHOLD",1e-8);
247 setValue(
"step2bertini",
"TRACKTOLBEFOREEG",1e-5);
248 setValue(
"step2bertini",
"TRACKTOLDURINGEG",1e-6);
249 setValue(
"step2bertini",
"FINALTOL",1e-11);
250 setValue(
"step2bertini",
"IMAGTHRESHOLD",1e-8);
256 settings[
"PathFailureBertiniBase"].clear();
258 setValue(
"PathFailureBertiniBase",
"TRACKTOLBEFOREEG",1e-5);
259 setValue(
"PathFailureBertiniBase",
"TRACKTOLDURINGEG",1e-6);
260 setValue(
"PathFailureBertiniBase",
"FINALTOL",1e-11);
261 setValue(
"PathFailureBertiniBase",
"IMAGTHRESHOLD",1e-8);
268 setValue(
"PathFailure",
"newrandommethod",1);
269 setValue(
"PathFailure",
"tightentolerances",1);
270 setValue(
"PathFailure",
"maxautoiterations",1);
280 switch (settingcase) {
359 std::cout <<
"GetPref code not yet written for case " << settingcase <<
"\n";
369 bool made_changes =
false;
371 std::stringstream menustream;
372 std::map<std::string,std::pair< int, std::string > >::iterator iter;
374 static std::map< std::string,std::pair< int, std::string> > main_required_values;
377 main_required_values[
"architecture"].first = 001; main_required_values[
"architecture"].second =
"parallelism";
378 main_required_values[
"parallel"].first = 002; main_required_values[
"parallel"].second =
"parallelism";
379 main_required_values[
"numfilesatatime"].first = 003; main_required_values[
"numfilesatatime"].second =
"parallelism";
382 main_required_values[
"writemeshtomc"].first = 102; main_required_values[
"writemeshtomc"].second =
"files";
383 main_required_values[
"deletetmpfilesatend"].first = 103; main_required_values[
"deletetmpfilesatend"].second =
"files";
384 main_required_values[
"previousdatamethod"].first = 105; main_required_values[
"previousdatamethod"].second =
"files";
385 main_required_values[
"newrandom_newfolder"].first = 106; main_required_values[
"newrandom_newfolder"].second =
"files";
386 main_required_values[
"saveprogresseverysomany"].first = 107; main_required_values[
"saveprogresseverysomany"].second =
"files";
387 main_required_values[
"newfilethreshold"].first = 108; main_required_values[
"newfilethreshold"].second =
"files";
388 main_required_values[
"tempfilelocation"].first = 109; main_required_values[
"tempfilelocation"].second =
"files";
395 main_required_values[
"standardstep2"].first = 201; main_required_values[
"standardstep2"].second =
"mode";
396 main_required_values[
"main_mode"].first = 202; main_required_values[
"main_mode"].second =
"mode";
397 main_required_values[
"startfilename"].first = 203; main_required_values[
"startfilename"].second =
"mode";
405 main_required_values[
"bertinilocation"].first = 300; main_required_values[
"bertinilocation"].second =
"system";
406 main_required_values[
"step2location"].first = 301; main_required_values[
"step2location"].second =
"system";
407 main_required_values[
"stifle"].first = 302; main_required_values[
"stifle"].second =
"system";
408 main_required_values[
"buffersize"].first = 303; main_required_values[
"buffersize"].second =
"system";
411 for (iter=main_required_values.begin(); iter != main_required_values.end(); iter++) {
412 if (
settings[(*iter).second.second].find( (*iter).first) ==
settings[(*iter).second.second].end() )
434 std::string path_to_detect;
435 std::cout <<
"please supply the path to " << program_name <<
". (% cancels) \n: \n";
440 found=path_to_detect.find(
'%');
441 if ( (
int(found)==0) ) {
445 boost::filesystem::path temp_path(path_to_detect);
446 temp_path /= program_name;
447 while (! boost::filesystem::exists(temp_path)) {
448 std::cout << program_name <<
" program not found at " << temp_path.string() <<
". please supply the path (% cancels)\n: \n";
450 found=path_to_detect.find(
'%');
451 if ( (
int(found)==0) ) {
454 temp_path = boost::filesystem::path(path_to_detect);
455 temp_path /= program_name;
458 boost::filesystem::path final_path = boost::filesystem::canonical(boost::filesystem::absolute(path_to_detect));
460 setValue(category_name,setting_name,final_path);
462 std::cout << program_name <<
" location set to " << final_path.string() << std::endl;
469 bool found_program =
false;
473 boost::filesystem::path stored_location(
settings[category_name][setting_name].pathvalue);
474 stored_location /= program_name;
475 if (boost::filesystem::exists(stored_location)){
476 stored_location = boost::filesystem::canonical(boost::filesystem::absolute(stored_location));
477 setValue(category_name,setting_name,stored_location.parent_path());
478 found_program =
true;
484 if (found_program ==
false ){
485 boost::filesystem::path here =
"./";
486 here /= program_name;
488 if (boost::filesystem::exists(here)){
489 here = boost::filesystem::absolute(here);
490 setValue(category_name,setting_name,here.parent_path());
491 found_program =
true;
496 temp_path = getenv (
"PATH");
497 if (temp_path!=NULL){
498 std::string path = std::string(temp_path);
504 found = path.find(
':');
505 while (found!=std::string::npos) {
506 boost::filesystem::path path_to_detect(path.substr(0,found));
507 path = path.substr(found+1,path.length()-found);
508 found = path.find(
':');
509 path_to_detect /= program_name;
510 if (boost::filesystem::exists(path_to_detect)){
513 setValue(category_name,setting_name,path_to_detect.parent_path());
514 found_program =
true;
524 std::cerr <<
"unable to scan $PATH for step2.\n";
531 if (found_program ==
false){
532 std::string path_to_detect;
533 std::cout << program_name <<
" program not found in current directory or PATH.\nplease supply the path to " << program_name <<
".\n: ";
535 boost::filesystem::path temp_path(path_to_detect);
536 temp_path /= program_name;
537 while (! boost::filesystem::exists(temp_path)) {
538 std::cout << program_name <<
" program not found at that location. please supply the path: \n";
540 temp_path = boost::filesystem::path(path_to_detect);
541 temp_path /= program_name;
543 setValue(category_name,setting_name,boost::filesystem::path(path_to_detect) );
547 boost::filesystem::path final_path = boost::filesystem::canonical(boost::filesystem::absolute(
settings[category_name][setting_name].pathvalue));
549 setValue(category_name,setting_name,final_path);
568 while (selection!=0){
569 std::cout <<
"\n\nPossible files to save:\n\n";
575 std::cout <<
"*\n" << 0 <<
") Done.\n";
576 selection =
get_int_choice(
"Select the file you would like to save : ",0,NUMPOSSIBLE_SAVEFILES);
628 TiXmlDocument* doc =
new TiXmlDocument;
629 TiXmlDeclaration* decl =
new TiXmlDeclaration(
"1.0",
"",
"" );
631 doc->LinkEndChild( decl );
633 TiXmlElement * root =
new TiXmlElement(
"paramotopy_preferences");
634 categorymap::iterator iter;
642 doc->LinkEndChild( root );
645 if(doc->SaveFile(save_filename.string().c_str())){
650 std::cout <<
"preferences *failed* to save to " << save_filename.string() <<
"!\n";
660 TiXmlText* setting_name;
661 TiXmlText* setting_value;
662 TiXmlText* setting_type;
664 std::stringstream ss;
667 TiXmlElement * category_name =
new TiXmlElement( catname.c_str() );
669 settingmap::iterator iter;
670 for (iter=curr_settings.begin(); iter != curr_settings.end(); iter++){
671 TiXmlElement* setting_elmnt =
new TiXmlElement(
"setting");
673 const std::string & key=(*iter).first;
674 const std::string & type=(*iter).second.typestr();
675 const std::string & value=(*iter).second.value();
679 setting_name =
new TiXmlText(key.c_str());
680 setting_value =
new TiXmlText(value.c_str());
681 setting_type =
new TiXmlText(type.c_str());
684 TiXmlElement* name_elmnt =
new TiXmlElement(
"name");
685 name_elmnt->LinkEndChild(setting_name);
686 TiXmlElement* value_elmnt =
new TiXmlElement(
"value");
687 value_elmnt->LinkEndChild(setting_value);
688 TiXmlElement* type_elmnt =
new TiXmlElement(
"type");
689 type_elmnt->LinkEndChild(setting_type);
691 setting_elmnt->LinkEndChild(name_elmnt );
692 setting_elmnt->LinkEndChild(value_elmnt );
693 setting_elmnt->LinkEndChild( type_elmnt);
696 category_name->LinkEndChild(setting_elmnt);
700 root->LinkEndChild(category_name);
711 if (boost::filesystem::exists(pFilename)) {
712 load_filename = pFilename;
716 std::cout <<
"failed to find the desired settings file" << pFilename << std::endl;
718 if (boost::filesystem::exists(load_filename)) {
735 boost::filesystem::path defaultsettings(getenv(
"HOME"));
736 defaultsettings /=
".paramotopy/defaultprefs.xml";
737 return defaultsettings;
743 boost::filesystem::path settingsfilename(getenv(
"HOME"));
744 settingsfilename /=
".paramotopy/";
745 settingsfilename /= newfilename;
746 settingsfilename +=
"prefs.xml";
747 return settingsfilename;
753 boost::filesystem::path load_filename;
755 boost::filesystem::path source_folder = getenv(
"HOME");
756 source_folder /=
".paramotopy";
758 std::string expression =
"prefs.xml\\z";
759 expression.append(
"");
760 std::vector < boost::filesystem::path > filelist =
FindFiles(source_folder, expression);
763 std::stringstream menu;
766 menu <<
"found these preferences file:\n-----------------\n0) current (no change)\n";
767 for (
int ii=0; ii<int(filelist.size()); ii++) {
768 boost::filesystem::path temppath = filelist[ii];
770 menu << ii+1 <<
") " << temppath.filename() << std::endl;
772 menu <<
"--------\nwhich to load?";
800 bool changesmade=
false, load_defaults =
false, doc_loaded =
false;
816 boost::filesystem::path load_filename;
823 if (this->
filename.string().size()==0) {
828 if (found_a_file==0 || found_a_file==2) {
833 std::cout <<
"loading preferences from " << load_filename.string() <<
"\n";
834 TiXmlDocument* doc =
new TiXmlDocument(load_filename.string().c_str());
835 doc_loaded = doc->LoadFile();
840 load_defaults =
true;
844 TiXmlHandle hDoc(doc);
846 TiXmlHandle hRoot(0);
849 pElem=hDoc.FirstChildElement().Element();
853 std::cerr <<
"bad xml file for prefs. :( todo: check for backup\n";
854 load_defaults =
true;
858 std::string main_name =pElem->Value();
860 hRoot=TiXmlHandle(pElem);
862 TiXmlElement* catElem=hRoot.FirstChild().Element();
863 for (catElem; catElem; catElem=catElem->NextSiblingElement()) {
878 std::cout <<
"setting preferences to defaults.\n";
891 if (made_changes_required_values) {
921 std::stringstream ss;
926 TiXmlElement* pElem=hRoot.FirstChild( catname.c_str() ).FirstChild().Element();
927 for( pElem; pElem; pElem=pElem->NextSiblingElement())
929 TiXmlHandle setting_handle(pElem);
932 TiXmlElement* qElem = setting_handle.FirstChild(
"name").Element();
933 const char *nameText=qElem->GetText();
935 qElem = setting_handle.FirstChild(
"value").Element();
936 const char *valueText=qElem->GetText();
938 qElem = setting_handle.FirstChild(
"type").Element();
939 const char *typeText=qElem->GetText();
942 if (nameText && valueText && typeText)
978 std::cout <<
"bad type set somehow, from xml prefs file.\n"
979 <<
"cat: " << catname <<
" name: " << nameText <<
" type: " << type << std::endl;
1006 std::stringstream menu;
1007 menu <<
"\n\nManage Path Failure Bertini:\n\n"
1008 <<
"1) Change Setting\n"
1009 <<
"2) Remove Setting\n"
1010 <<
"3) Add Setting\n"
1011 <<
"4) Reset to Default Path Failure Bertini Settings\n"
1012 <<
"5) Import From current Step2 Settings\n"
1039 settings[
"PathFailureBertiniBase"].clear();
1044 settings[
"PathFailureBertiniBase"].clear();
1049 std::cout <<
"somehow an unacceptable entry submitted :(\n";
1061 std::string setting_name =
"neverusethisname";
1065 std::cout <<
"what is the exact name of setting? % cancels\n: ";
1068 boost::to_upper(setting_name);
1070 found=setting_name.find(
'%');
1071 if ( (
haveSetting(category_name,setting_name)) || (
int(found)==0) ) {
1076 if (
int(found)==0) {
1077 std::cout <<
"canceling\n";
1084 std::cout <<
"new value\n:";
1085 std::string newvalue;
1088 std::stringstream converter;
1091 switch (
settings[category_name][setting_name].type) {
1093 setValue(category_name,setting_name,newvalue);
1096 converter << newvalue;
1098 setValue(category_name,setting_name,intie);
1101 converter << newvalue;
1102 converter >> doubie;
1103 setValue(category_name,setting_name,doubie);
1115 std::string setting_name =
"neverusethisname";
1118 std::cout <<
"what is the exact name of setting? % cancels\n: ";
1121 boost::to_upper(setting_name);
1123 size_t found=setting_name.find(
'%');
1124 if (
int(found)==0 ) {
1125 std::cout <<
"canceling\n";
1131 std::stringstream prompt;
1132 prompt <<
"what is the type of "
1134 <<
"?\n 0 = string\n 1 = integer / 0-1 bool\n 2= float/double\n\n:";
1138 std::cout <<
"enter setting value" << std::endl <<
": ";
1142 std::stringstream converter;
1143 converter << newvalue;
1148 setValue(category_name,setting_name,converter.str());
1152 setValue(category_name,setting_name,intie);
1155 converter >> doubie;
1156 setValue(category_name,setting_name,doubie);
1168 std::string setting_name =
"neverusethisname";
1174 std::cout <<
"what is the exact name of setting? % cancels\n";
1177 boost::to_upper(setting_name);
1179 found=setting_name.find(
'%');
1180 if ( (
haveSetting(category_name,setting_name)) || (
int(found)==0) ) {
1181 std::cout <<
"no setting of that name." << std::endl;
1186 if (
int(found)==0) {
1187 std::cout <<
"canceling\n";
1192 settings[category_name].erase(setting_name);
1203 settingmap::iterator iter;
1205 int max_name_length = 0;
1206 for (iter=
settings[category_name].begin(); iter !=
settings[category_name].end(); iter++){
1207 std::string setting_name = (*iter).first;
1208 if (
int(setting_name.size())>max_name_length) {
1209 max_name_length = int(setting_name.size());
1215 std::cout <<
"\n\n" << category_name <<
" current settings:\n"
1217 for (
int i=0; i< max_name_length+min_dist-9; ++i) {
1220 std::cout <<
"-value-\n";
1221 for (iter=
settings[category_name].begin(); iter !=
settings[category_name].end(); iter++){
1222 std::string setting_name = (*iter).first;
1223 std::cout << setting_name;
1224 for (
int i=0; i<(max_name_length+min_dist-int(setting_name.length())); ++i) {
1227 std::cout <<
settings[category_name][(*iter).first].value() <<
"\n";
1256 std::stringstream menu;
1258 menu <<
"\n\n\nPreferences Main Menu:\n\n"
1259 <<
"1) Bertini settings\n"
1260 <<
"2) Solver Modes\n"
1261 <<
"3) Path failure resolution\n"
1262 <<
"4) Parallelism\n"
1263 <<
"5) Set files to save\n"
1264 <<
"6) System Settings\n"
1266 <<
"8) MetaSettings\n"
1267 <<
"*\n0) return to paramotopy\n"
1312 std::cout <<
"somehow an unacceptable entry submitted to MainMenu :(\n";
1322 std::stringstream menu;
1325 menu <<
"\n\nBertini Settings:\n\n"
1326 <<
"1) Step 1 Settings\n"
1327 <<
"2) Step 2 Settings\n"
1328 <<
"3) Path Failure Bertini Settings\n"
1354 std::cout <<
"somehow an unacceptable entry submitted to BertiniMenu\n";
1368 std::stringstream menu;
1371 menu <<
"\n\nSolver Mode Settings:\n\n"
1372 <<
"1) Brute-force -vs- Search.\n"
1373 <<
"2) Standard step2 run.\n"
1374 <<
"3) File to use for step2 start file\n"
1404 std::cout <<
"somehow an unacceptable entry submitted to SolverModeMenu\n";
1417 std::stringstream menu;
1423 int upper_limit = 1;
1424 menu <<
"\n\nSearch Settings:\n\n";
1429 if (this->
settings[
"mode"][
"main_mode"].intvalue==1) {
1431 <<
"1) Turn Search Mode Off.\n"
1432 <<
"2) Max num searches\t\t" <<
settings[
"mode"][
"search_iterations"].value() <<
"\n"
1433 <<
"3) Desired number solutions\t" <<
settings[
"mode"][
"search_desirednumber"].value() <<
"\n"
1434 <<
"4) Submode -- thresholding for number of posreal\n";
1437 if (this->
settings[
"mode"][
"search_submode"].intvalue==1) {
1439 <<
"5) Threshold number for number of posreal solutions at a point\t"
1440 << this->
settings[
"mode"][
"search_numposrealthreshold_lower"].intvalue
1441 <<
" <= numsolns <= ";
1443 if (this->
settings[
"mode"][
"search_numposrealthreshold_upper"].intvalue==-1) {
1446 menu << this->
settings[
"mode"][
"search_numposrealthreshold_upper"].intvalue;
1455 <<
"1) Turn Search Mode On.\n";
1474 if (this->
settings[
"mode"][
"main_mode"].intvalue==1) {
1480 if (this->
settings[
"mode"].find(
"search_iterations") ==
settings[
"mode"].end() )
1486 if (this->
settings[
"mode"].find(
"search_desirednumber") ==
settings[
"mode"].end() )
1517 std::cout <<
"somehow an unacceptable entry submitted to SearchMenu\n";
1527 std::stringstream menu;
1530 menu <<
"\n\nSystem Settings:\n\n"
1531 <<
"1) Stifle Step2 Output\n"
1532 <<
"2) Change Buffer Size\n"
1533 <<
"3) Set location of bertini executable\n"
1534 <<
"4) Set location of step2 executable\n"
1568 std::cout <<
"somehow an unacceptable entry submitted to SystemMenu\n";
1578 std::stringstream menu;
1580 menu <<
"\n\nFiles, &c:\n\n"
1581 <<
"1) Which folder to load at startup\n"
1582 <<
"2) Generation of random values when creating new folder\n"
1583 <<
"3) Set temp file location / Use ramdisk for temp files\n"
1584 <<
"4) Max data file Size / New file threshold\n"
1585 <<
"5) Deletion of temp files at end of run\n"
1586 <<
"6) Generation of mc mesh file for non-user-def runs\n"
1628 std::cout <<
"somehow an unacceptable entry submitted to FileMenu\n";
1640 std::stringstream menu;
1643 menu <<
"\n\nParallelism:\n\n"
1644 <<
"1) Switch Parallel On/Off, and consequential others\n"
1645 <<
"2) Number of Files to send to workers at a time\n"
1646 <<
"3) Machinefile\n"
1647 <<
"4) Architecture / calling\n"
1648 <<
"5) Number of processors used\n"
1684 std::cout <<
"somehow an unacceptable entry submitted :(\n";
1693 std::stringstream menu;
1695 menu <<
"\n\nStep1 Settings:\n\n"
1696 <<
"1) Change Setting\n"
1697 <<
"2) Remove Setting\n"
1698 <<
"3) Add Setting\n"
1699 <<
"4) Reset to Default Settings\n"
1731 std::cout <<
"somehow an unacceptable entry submitted :(\n";
1745 std::stringstream menu;
1746 menu <<
"\n\nBasic Step2 Settings:\n\n"
1748 <<
"1) Change Setting\n"
1749 <<
"2) Remove Setting\n"
1750 <<
"3) Add Setting\n"
1751 <<
"4) Reset to Default Settings\n"
1783 std::cout <<
"somehow an unacceptable entry submitted :(\n";
1795 std::stringstream menu;
1796 menu <<
"\n\nPath Failure Settings:\n\n"
1797 <<
"1) Choose random-start-point Method\n"
1798 <<
"2) Tolerance Tightening\n"
1799 <<
"3) Set Num Iterations\n"
1800 <<
"5) Manage Bertini Settings\n"
1801 <<
"7) Reset fully to Default path failure Settings\n"
1833 settings[
"PathFailureBertiniBase"].clear();
1851 std::stringstream menu;
1852 menu <<
"\n\nFiles to Save:\n\n"
1853 <<
"1) Change Files to Save\n"
1882 std::stringstream menu;
1883 menu <<
"\n\nMeta Settings:\n\n"
1884 <<
"1) Load a set of settings\n"
1885 <<
"2) Save current settings as default\n"
1886 <<
"3) Save the system settings to file\n"
1906 std::cout <<
"Saved preferences to " << this->
filename <<
"\n";
1964 std::stringstream menustream;
1966 menustream <<
"Run Parallel?\n"
1969 <<
"Enter choice : ";
1973 setValue(
"parallelism",
"parallel",0);
1975 setValue(
"parallelism",
"parallel",1);
1982 setValue(
"parallelism",
"numfilesatatime",1);
1991 std::stringstream menustream;
1993 menustream <<
"Select your command for running parallel processes:\n"
1996 <<
"2) other... (you will enter your own command [sadly not calling pattern yet :( ])\n:";
2007 std::cout <<
"enter your own command:\n";
2015 setValue(
"parallelism",
"architecture",valstr);
2021 std::string valstr =
"";
2022 int valint =
get_int_choice(
"Does your machine use a machinefile?\n0) No.\n1) Yes.\n: ",0,1);
2028 boost::filesystem::path home(getenv(
"HOME"));
2032 std::cout <<
"Enter the machine file to be used, relative to your home directory: (% cancels)" << std::endl;
2035 if (
settings[
"parallelism"].find(
"machinefile") !=
settings[
"parallelism"].end()) {
2036 std::cout <<
" enter @ to use previous machinefile " << this->
settings[
"parallelism"][
"machinefile"].value() << std::endl;
2044 found=valstr.find(
'%');
2045 if ( (
int(found)==0) && (
settings[
"parallelism"].find(
"usemachine") !=
settings[
"parallelism"].end()) ) {
2049 found=valstr.find(
'@');
2050 if ( (
settings[
"parallelism"].find(
"machinefile") !=
settings[
"parallelism"].end()) && (
int(found)==0) ) {
2051 valstr = this->
settings[
"parallelism"][
"machinefile"].value();
2054 boost::filesystem::path testme = home;
2057 if (boost::filesystem::exists(testme)) {
2061 std::cout <<
"cannot find that file." << std::endl;
2067 setValue(
"parallelism",
"machinefile",valstr);
2070 setValue(
"parallelism",
"usemachine",valint);
2076 setValue(
"parallelism",
"numprocs",
get_int_choice(
"Enter the number of processes to be run: ",0,9000000));
2082 int valint =
get_int_choice(
"Enter step2 number of files at a time per processor: (0 for default of 100)",0,9000000);
2085 setValue(
"parallelism",
"numfilesatatime",100);
2088 setValue(
"parallelism",
"numfilesatatime",valint);
2094 int val =
get_int_choice(
"Delete temp files at end of runs? (0 for no, 1 for yes)\n:",0,1);
2095 setValue(
"files",
"deletetmpfilesatend",val);
2102 std::stringstream menustream;
2104 setValue(
"files",
"saveprogresseverysomany",1);
2111 int val =
get_int_choice(
"Threshold in bytes for new data file \n (press 0 for default of 67108864 = 2^26): ",0,2147483647);
2113 setValue(
"files",
"newfilethreshold",67108864);
2116 setValue(
"files",
"newfilethreshold",val);
2122 std::stringstream menustream;
2123 int val =
get_int_choice(
"How many KB should step2 buffer before writing data to disk? (max 65536K = 64MB)\n (press 0 for default of 64K): ",0,65536);
2136 std::stringstream menustream;
2138 std::vector< boost::filesystem::path > tmpfile_location_possibilities;
2140 std::vector< boost::filesystem::path > standard_places_to_look;
2141 standard_places_to_look.push_back(
"/dev/shm");
2142 standard_places_to_look.push_back(
"/tmp");
2144 if (
get_int_choice(
"Would you like to use a custom location for temp files?\n0) No.\n1) Yes.\n: ",0,1)==1){
2146 setValue(
"files",
"customtmplocation",1);
2147 for (
int ii=0; ii<int(standard_places_to_look.size()); ++ii) {
2148 if (boost::filesystem::exists(standard_places_to_look[ii])){
2149 tmpfile_location_possibilities.push_back(standard_places_to_look[ii]);
2153 if (tmpfile_location_possibilities.size()>0){
2154 std::cout <<
"Found these possibilities:\n\n";
2156 for (
int ii = 0; ii< int(tmpfile_location_possibilities.size()); ++ii) {
2157 std::cout << ii <<
": " << tmpfile_location_possibilities[ii].string() << std::endl;
2159 std::cout <<
"-or-\n" << tmpfile_location_possibilities.size() <<
": specify your own location. (will not check it exists or even works) todo: perform these checks\n\n";
2161 int choice=
get_int_choice(
": ",0,tmpfile_location_possibilities.size());
2162 if (choice==
int(tmpfile_location_possibilities.size())) {
2163 std::string tmplocation;
2164 std::cout <<
"where should the root directory for temp files be?\n: " << std::endl;
2166 setValue(
"files",
"tempfilelocation",boost::filesystem::path(tmplocation));
2169 setValue(
"files",
"tempfilelocation",standard_places_to_look[choice]);
2173 std::string tmplocation;
2174 std::cout <<
"Did not find any of the standard places to look for shared memory access :(\n\n";
2175 std::cout <<
"where should the root directory for temp files be? (% cancels, and chooses not to use ramdisk)\n: " << std::endl;
2177 found=tmplocation.find(
'%');
2178 if ( (
int(found)==0) ) {
2179 setValue(
"files",
"customtmplocation",0);
2180 setValue(
"files",
"tempfilelocation",boost::filesystem::path(
"."));
2183 setValue(
"files",
"tempfilelocation",boost::filesystem::path(tmplocation));
2191 setValue(
"files",
"customtmplocation",0);
2192 setValue(
"files",
"tempfilelocation",boost::filesystem::path(
"."));
2202 std::stringstream menustream;
2204 setValue(
"system",
"stifle",
get_int_choice(
"Stifle step2 output (to /dev/null) ?\n0) No.\n1) Yes.\n:",0,1));
2213 setValue(
"files",
"writemeshtomc",
get_int_choice(
"would you like to produce an mc file during step2, when using computer-generated mesh?",0,1));
2223 std::stringstream menu;
2225 <<
"How many points/solutions of desired type do you want?\n\n"
2226 <<
" (Max value 1e6)\n"
2232 setValue(
"mode",
"search_desirednumber",choice);
2242 std::stringstream menu;
2244 <<
"What is the max number of point searches?\n\n"
2245 <<
"0 for default of 100K. Max value 1e8\n"
2252 setValue(
"mode",
"search_iterations",
int(1e5));
2255 setValue(
"mode",
"search_iterations",
int(choice));
2269 std::stringstream menu;
2272 <<
"0) total number of posreal solutions\n"
2273 <<
"1) points with at least/most ___ solutions\n"
2278 setValue(
"mode",
"search_submode",choice);
2281 if (this->
settings[
"mode"].find(
"search_numposrealthreshold_lower") ==
settings[
"mode"].end() ||
2282 this->
settings[
"mode"].find(
"search_numposrealthreshold_upper") ==
settings[
"mode"].end())
2288 setValue(
"mode",
"search_numposrealthreshold_upper",
int(1));
2289 setValue(
"mode",
"search_numposrealthreshold_lower",
int(1));
2299 std::stringstream menu;
2301 <<
"What is LOWER threshold number of posreal solutions for valid point? (max 1e6)\n"
2306 setValue(
"mode",
"search_numposrealthreshold_lower",choice);
2311 <<
"What is UPPER threshold number of posreal solutions for valid point? (max 1e6)\n"
2312 <<
"-1 is no limit\n"
2316 setValue(
"mode",
"search_numposrealthreshold_upper",choice);
2326 std::stringstream menu;
2328 <<
"Which primary mode?\n\n"
2329 <<
"0) Brute force, solve for all parameter points\n"
2330 <<
"1) Search for posreal solutions in a space\n"
2346 if (this->
settings[
"mode"][
"main_mode"].intvalue==1) {
2347 setValue(
"SaveFiles",
"real_solutions",1);
2349 if (this->
settings[
"mode"].find(
"search_iterations") ==
settings[
"mode"].end() )
2355 if (this->
settings[
"mode"].find(
"search_desirednumber") ==
settings[
"mode"].end() )
2361 if (this->
settings[
"mode"].find(
"search_submode") ==
settings[
"mode"].end() )
2380 std::stringstream menu;
2381 menu <<
"Which method for the Step 2 run?\n\n"
2382 <<
"0) Total Degree Step 2\n"
2383 <<
"1) Standard Step 2\n"
2386 setValue(
"mode",
"standardstep2", choice);
2393 std::stringstream menu;
2395 <<
"What to do at startup for folders?\n\n"
2396 <<
"1) Use most recently used folder\n"
2397 <<
"2) Make new folder\n"
2398 <<
"3) Prompt if found previous folder\n"
2402 setValue(
"files",
"previousdatamethod",choice);
2410 std::stringstream menu;
2412 <<
"Which file to use for the start for step2?\n\n"
2413 <<
"1) nonsingular_solutions\n"
2414 <<
"2) finite_solutions\n"
2420 setValue(
"mode",
"startfilename",std::string(
"nonsingular_solutions"));
2423 setValue(
"mode",
"startfilename",std::string(
"finite_solutions"));
2439 std::stringstream menu;
2441 <<
"If you make a new folder with program running do you want\n"
2442 <<
"to automatically create new random values, or keep previous?\n"
2443 <<
"0) no (keep old)\n"
2444 <<
"1) yes (make new)\n"
2449 setValue(
"files",
"newrandom_newfolder",choice);
2461 int choice =
get_int_choice(
"use a new random start point for each resolve? 0 no, 1 yes\n: ",0,1);
2462 setValue(
"PathFailure",
"newrandommethod",choice);
2469 int choice =
get_int_choice(
"Tighten tolerance by 10x each iteration? 0 no, 1 yes\n: ",0,1);
2470 setValue(
"PathFailure",
"tightentolerances",choice);
2475 int choice =
get_int_choice(
"How many iterations to perform per re-run?\n: ",1,99999);
2476 setValue(
"PathFailure",
"maxautoiterations",choice);
void GetProgramLocationManual(std::string program_name, std::string category_name, std::string setting_name)
void GetTightenTolerancesPathFailure()
std::string WriteConfigFail()
static const char *const possible_savefiles[NUMPOSSIBLE_SAVEFILES]
void ChangeSetting(std::string category_name)
std::string replace_tilde_with_home(std::string workwithme)
std::string getAlphaNumeric()
void DisplayCurrentSettings(std::string category_name)
std::string getAlphaNumeric_WithSpaces()
void FindProgram(std::string program_name, std::string category_name, std::string setting_name)
void RequiredSettingsSwitcharoo(int settingcase)
void default_main_values()
int check_for_existing_prefs_auto(boost::filesystem::path &load_filename, boost::filesystem::path pFilename)
void SetSearchIterations()
void set_path_failure_settings_from_steptwo()
void GetDataFolderMethod()
void SetSearchDesiredNumber()
void default_path_failure_settings()
void GetWriteMCFileUserDef()
std::vector< boost::filesystem::path > FindFiles(boost::filesystem::path dir, std::string expression)
void default_basic_bertini_values_steptwo()
bool haveSetting(std::string category_name, std::string setting_name)
int get_int_choice(std::string display_string, int min_value, int max_value)
void RemoveSetting(std::string category_name)
int SaveCategoryToXml(std::string catname, settingmap curr_settings, TiXmlElement *root)
boost::filesystem::path filename
boost::filesystem::path default_name()
static const char *const mandatory_savefiles[NUMMANDATORY_SAVEFILES]
void set_path_failure_settings()
std::string WriteConfigStepOne()
int ReadCategoryFromXml(std::string catname, TiXmlHandle hroot)
void AddSetting(std::string category_name)
boost::filesystem::path make_settings_name(boost::filesystem::path basename)
void default_basic_bertini_values_pathfailure()
void default_basic_bertini_values_stepone()
void ManagePathFailureBertini()
std::map< std::string, setting > settingmap
std::string WriteConfigStepTwo()
void GetTemporaryFileLocation()
void SetSearchPosRealThresh()
void GetNewRandomAtNewFolder()
void setValue(std::string categoryName, std::string settingName, std::string settingValue)