Changeset a8188d for src/Actions/MapOfActions.cpp
- Timestamp:
- Oct 30, 2010, 6:44:28 PM (14 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 4885f85
- Parents:
- df32ee
- git-author:
- Frederik Heber <heber@…> (10/26/10 09:20:41)
- git-committer:
- Frederik Heber <heber@…> (10/30/10 18:44:28)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/MapOfActions.cpp
rdf32ee ra8188d 28 28 #include "Patterns/Singleton_impl.hpp" 29 29 30 #include <boost/filesystem.hpp> 30 31 #include <boost/lexical_cast.hpp> 31 32 #include <boost/optional.hpp> 32 33 #include <boost/program_options.hpp> 33 #include <boost/filesystem.hpp>34 34 35 35 #include <iostream> … … 480 480 481 481 // default values for any action that needs one (always string!) 482 CurrentValue ["bin-width"] = "0.5";483 CurrentValue ["fastparsing"] = "0";484 CurrentValue ["periodic"] = "0";482 CurrentValueMap["bin-width"] = "0.5"; 483 CurrentValueMap["fastparsing"] = "0"; 484 CurrentValueMap["periodic"] = "0"; 485 485 486 486 // put action into each menu category … … 691 691 bool MapOfActions::isCurrentValuePresent(const char *name) const 692 692 { 693 return (CurrentValue .find(name) != CurrentValue.end());693 return (CurrentValueMap.find(name) != CurrentValueMap.end()); 694 694 } 695 695 … … 698 698 int atomID = -1; 699 699 if (typeid( atom ) == *TypeMap[name]) { 700 if (CurrentValue .find(name) == CurrentValue.end())700 if (CurrentValueMap.find(name) == CurrentValueMap.end()) 701 701 throw MissingValueException(__FILE__, __LINE__); 702 atomID = lexical_cast<int>(CurrentValue [name].c_str());703 CurrentValue .erase(name);702 atomID = lexical_cast<int>(CurrentValueMap[name].c_str()); 703 CurrentValueMap.erase(name); 704 704 } else 705 705 throw IllegalTypeException(__FILE__,__LINE__); … … 710 710 int Z = -1; 711 711 if (typeid(const element ) == *TypeMap[name]) { 712 if (CurrentValue .find(name) == CurrentValue.end())712 if (CurrentValueMap.find(name) == CurrentValueMap.end()) 713 713 throw MissingValueException(__FILE__, __LINE__); 714 Z = lexical_cast<int>(CurrentValue [name].c_str());715 CurrentValue .erase(name);714 Z = lexical_cast<int>(CurrentValueMap[name].c_str()); 715 CurrentValueMap.erase(name); 716 716 } else 717 717 throw IllegalTypeException(__FILE__,__LINE__); … … 722 722 int molID = -1; 723 723 if (typeid( molecule ) == *TypeMap[name]) { 724 if (CurrentValue .find(name) == CurrentValue.end())724 if (CurrentValueMap.find(name) == CurrentValueMap.end()) 725 725 throw MissingValueException(__FILE__, __LINE__); 726 molID = lexical_cast<int>(CurrentValue [name].c_str());727 CurrentValue .erase(name);726 molID = lexical_cast<int>(CurrentValueMap[name].c_str()); 727 CurrentValueMap.erase(name); 728 728 } else 729 729 throw IllegalTypeException(__FILE__,__LINE__); … … 735 735 double tmp; 736 736 if (typeid( BoxValue ) == *TypeMap[name]) { 737 if (CurrentValue .find(name) == CurrentValue.end())737 if (CurrentValueMap.find(name) == CurrentValueMap.end()) 738 738 throw MissingValueException(__FILE__, __LINE__); 739 std::istringstream stream(CurrentValue [name]);739 std::istringstream stream(CurrentValueMap[name]); 740 740 stream >> tmp; 741 741 M.set(0,0,tmp); … … 754 754 M.set(2,2,tmp); 755 755 _T = M; 756 CurrentValue .erase(name);756 CurrentValueMap.erase(name); 757 757 } else 758 758 throw IllegalTypeException(__FILE__,__LINE__); … … 761 761 void MapOfActions::queryCurrentValue(const char * name, class Vector &_T) { 762 762 if (typeid( VectorValue ) == *TypeMap[name]) { 763 std::istringstream stream(CurrentValue [name]);764 CurrentValue .erase(name);763 std::istringstream stream(CurrentValueMap[name]); 764 CurrentValueMap.erase(name); 765 765 stream >> _T[0]; 766 766 stream >> _T[1]; … … 772 772 void MapOfActions::queryCurrentValue(const char * name, class BoxVector &_T) { 773 773 if (typeid( VectorValue ) == *TypeMap[name]) { 774 std::istringstream stream(CurrentValue [name]);775 CurrentValue .erase(name);774 std::istringstream stream(CurrentValueMap[name]); 775 CurrentValueMap.erase(name); 776 776 stream >> _T[0]; 777 777 stream >> _T[1]; … … 786 786 atom *Walker = NULL; 787 787 if (typeid( std::vector<atom *> ) == *TypeMap[name]) { 788 if (CurrentValue .find(name) == CurrentValue.end())788 if (CurrentValueMap.find(name) == CurrentValueMap.end()) 789 789 throw MissingValueException(__FILE__, __LINE__); 790 std::istringstream stream(CurrentValue [name]);791 CurrentValue .erase(name);790 std::istringstream stream(CurrentValueMap[name]); 791 CurrentValueMap.erase(name); 792 792 while (!stream.fail()) { 793 793 stream >> atomID >> ws; … … 807 807 const element *elemental = NULL; 808 808 if (typeid( std::vector<const element *> ) == *TypeMap[name]) { 809 if (CurrentValue .find(name) == CurrentValue.end())809 if (CurrentValueMap.find(name) == CurrentValueMap.end()) 810 810 throw MissingValueException(__FILE__, __LINE__); 811 std::istringstream stream(CurrentValue [name]);812 CurrentValue .erase(name);811 std::istringstream stream(CurrentValueMap[name]); 812 CurrentValueMap.erase(name); 813 813 while (!stream.fail()) { 814 814 stream >> Z >> ws; … … 827 827 molecule *mol = NULL; 828 828 if (typeid( std::vector<molecule *> ) == *TypeMap[name]) { 829 if (CurrentValue .find(name) == CurrentValue.end())829 if (CurrentValueMap.find(name) == CurrentValueMap.end()) 830 830 throw MissingValueException(__FILE__, __LINE__); 831 std::istringstream stream(CurrentValue [name]);832 CurrentValue .erase(name);831 std::istringstream stream(CurrentValueMap[name]); 832 CurrentValueMap.erase(name); 833 833 while (!stream.fail()) { 834 834 stream >> molID >> ws; … … 847 847 std::string tmp; 848 848 if (typeid( boost::filesystem::path ) == *TypeMap[name]) { 849 if (CurrentValue .find(name) == CurrentValue.end())849 if (CurrentValueMap.find(name) == CurrentValueMap.end()) 850 850 throw MissingValueException(__FILE__, __LINE__); 851 std::istringstream stream(CurrentValue [name]);852 CurrentValue .erase(name);851 std::istringstream stream(CurrentValueMap[name]); 852 CurrentValueMap.erase(name); 853 853 if (!stream.fail()) { 854 854 stream >> tmp >> ws; … … 859 859 } 860 860 861 862 861 void MapOfActions::setCurrentValue(const char * name, class atom * &_T) 863 862 { … … 865 864 std::ostringstream stream; 866 865 stream << _T->getId(); 867 CurrentValue [name] = stream.str();866 CurrentValueMap[name] = stream.str(); 868 867 } else 869 868 throw IllegalTypeException(__FILE__,__LINE__); … … 875 874 std::ostringstream stream; 876 875 stream << _T->getAtomicNumber(); 877 CurrentValue [name] = stream.str();876 CurrentValueMap[name] = stream.str(); 878 877 } else 879 878 throw IllegalTypeException(__FILE__,__LINE__); … … 885 884 std::ostringstream stream; 886 885 stream << _T->getId(); 887 CurrentValue [name] = stream.str();886 CurrentValueMap[name] = stream.str(); 888 887 } else 889 888 throw IllegalTypeException(__FILE__,__LINE__); … … 901 900 stream << M.at(1,2) << " "; 902 901 stream << M.at(2,2) << " "; 903 CurrentValue [name] = stream.str();902 CurrentValueMap[name] = stream.str(); 904 903 } else 905 904 throw IllegalTypeException(__FILE__,__LINE__); … … 913 912 stream << _T[1] << " "; 914 913 stream << _T[2] << " "; 915 CurrentValue [name] = stream.str();914 CurrentValueMap[name] = stream.str(); 916 915 } else 917 916 throw IllegalTypeException(__FILE__,__LINE__); … … 925 924 stream << _T[1] << " "; 926 925 stream << _T[2] << " "; 927 CurrentValue [name] = stream.str();926 CurrentValueMap[name] = stream.str(); 928 927 } else 929 928 throw IllegalTypeException(__FILE__,__LINE__); … … 937 936 stream << (*iter)->getId() << " "; 938 937 } 939 CurrentValue [name] = stream.str();938 CurrentValueMap[name] = stream.str(); 940 939 } else 941 940 throw IllegalTypeException(__FILE__,__LINE__); … … 949 948 stream << (*iter)->getAtomicNumber() << " "; 950 949 } 951 CurrentValue [name] = stream.str();950 CurrentValueMap[name] = stream.str(); 952 951 } else 953 952 throw IllegalTypeException(__FILE__,__LINE__); … … 961 960 stream << (*iter)->getId() << " "; 962 961 } 963 CurrentValue [name] = stream.str();962 CurrentValueMap[name] = stream.str(); 964 963 } else 965 964 throw IllegalTypeException(__FILE__,__LINE__); … … 971 970 std::ostringstream stream; 972 971 stream << _T.string(); 973 CurrentValue [name] = stream.str();972 CurrentValueMap[name] = stream.str(); 974 973 } else 975 974 throw IllegalTypeException(__FILE__,__LINE__); … … 1082 1081 ListRunner->second->add_options() 1083 1082 (getKeyAndShortForm(*OptionRunner).c_str(), 1084 CurrentValue .find(*OptionRunner) != CurrentValue.end() ?1085 po::value< bool >()->default_value(lexical_cast<int>(CurrentValue [*OptionRunner].c_str())) :1083 CurrentValueMap.find(*OptionRunner) != CurrentValueMap.end() ? 1084 po::value< bool >()->default_value(lexical_cast<int>(CurrentValueMap[*OptionRunner].c_str())) : 1086 1085 po::value< bool >(), 1087 1086 getDescription(*OptionRunner).c_str()) … … 1105 1104 ListRunner->second->add_options() 1106 1105 (getKeyAndShortForm(*OptionRunner).c_str(), 1107 CurrentValue .find(*OptionRunner) != CurrentValue.end() ?1108 po::value< int >()->default_value(lexical_cast<int>(CurrentValue [*OptionRunner].c_str())) :1106 CurrentValueMap.find(*OptionRunner) != CurrentValueMap.end() ? 1107 po::value< int >()->default_value(lexical_cast<int>(CurrentValueMap[*OptionRunner].c_str())) : 1109 1108 po::value< int >(), 1110 1109 getDescription(*OptionRunner).c_str()) … … 1121 1120 ListRunner->second->add_options() 1122 1121 (getKeyAndShortForm(*OptionRunner).c_str(), 1123 CurrentValue .find(*OptionRunner) != CurrentValue.end() ?1124 po::value< double >()->default_value(lexical_cast<double>(CurrentValue [*OptionRunner].c_str())) :1122 CurrentValueMap.find(*OptionRunner) != CurrentValueMap.end() ? 1123 po::value< double >()->default_value(lexical_cast<double>(CurrentValueMap[*OptionRunner].c_str())) : 1125 1124 po::value< double >(), 1126 1125 getDescription(*OptionRunner).c_str()) … … 1137 1136 ListRunner->second->add_options() 1138 1137 (getKeyAndShortForm(*OptionRunner).c_str(), 1139 CurrentValue .find(*OptionRunner) != CurrentValue.end() ?1140 po::value< std::string >()->default_value(CurrentValue [*OptionRunner]) :1138 CurrentValueMap.find(*OptionRunner) != CurrentValueMap.end() ? 1139 po::value< std::string >()->default_value(CurrentValueMap[*OptionRunner]) : 1141 1140 po::value< std::string >(), 1142 1141 getDescription(*OptionRunner).c_str()) … … 1167 1166 ListRunner->second->add_options() 1168 1167 (getKeyAndShortForm(*OptionRunner).c_str(), 1169 CurrentValue .find(*OptionRunner) != CurrentValue.end() ?1170 po::value< int >()->default_value(lexical_cast<int>(CurrentValue [*OptionRunner].c_str())) :1168 CurrentValueMap.find(*OptionRunner) != CurrentValueMap.end() ? 1169 po::value< int >()->default_value(lexical_cast<int>(CurrentValueMap[*OptionRunner].c_str())) : 1171 1170 po::value< int >(), 1172 1171 getDescription(*OptionRunner).c_str()) … … 1183 1182 ListRunner->second->add_options() 1184 1183 (getKeyAndShortForm(*OptionRunner).c_str(), 1185 CurrentValue .find(*OptionRunner) != CurrentValue.end() ?1186 po::value< int >()->default_value(lexical_cast<int>(CurrentValue [*OptionRunner].c_str())) :1184 CurrentValueMap.find(*OptionRunner) != CurrentValueMap.end() ? 1185 po::value< int >()->default_value(lexical_cast<int>(CurrentValueMap[*OptionRunner].c_str())) : 1187 1186 po::value< int >(), 1188 1187 getDescription(*OptionRunner).c_str())
Note:
See TracChangeset
for help on using the changeset viewer.