Changeset ab9a27 for src/Actions/MapOfActions.cpp
- Timestamp:
- Jul 22, 2010, 5:53:44 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:
- 0c9cc3
- Parents:
- ba7418
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/MapOfActions.cpp
rba7418 rab9a27 20 20 #include <iostream> 21 21 22 #include "atom.hpp" 22 23 #include "CommandLineParser.hpp" 24 #include "element.hpp" 23 25 #include "log.hpp" 26 #include "molecule.hpp" 24 27 #include "verbose.hpp" 25 28 … … 266 269 267 270 // value types for the actions 268 TypeMap["add-atom"] = Element;269 TypeMap["bond-file"] = String;270 TypeMap["bond-table"] = String;271 TypeMap["boundary"] = Vector;272 TypeMap["center-in-box"] = Box;273 TypeMap["change-box"] = Box;274 TypeMap["change-element"] = Element;275 TypeMap["change-molname"] = String;276 TypeMap["convex-envelope"] = Molecule;277 TypeMap["default-molname"] = String;278 TypeMap["depth-first-search"] = Double;279 TypeMap["element-db"] = String;280 TypeMap["fastparsing"] = Boolean;281 TypeMap["fill-molecule"] = String;282 TypeMap["fragment-mol"] = String;283 TypeMap["input"] = String;284 TypeMap["linear-interpolate"] = String;285 TypeMap["molecular-volume"] = Molecule;286 TypeMap["nonconvex-envelope"] = Molecule;287 TypeMap["output"] = None;288 TypeMap["parse-xyz"] = String;289 TypeMap["pair-correlation"] = String;290 TypeMap["principal-axis-system"] = Molecule;291 TypeMap["remove-atom"] = Atom;292 TypeMap["remove-sphere"] = Double;293 TypeMap["repeat-box"] = Vector;294 TypeMap["rotate-to-pas"] = Molecule;295 TypeMap["save-adjacency"] = String;296 TypeMap["save-bonds"] = String;297 TypeMap["save-temperature"] = String;298 TypeMap["scale-box"] = Vector;299 TypeMap["set-basis"] = String;300 TypeMap["set-output"] = ListOfString;301 TypeMap["subgraph-dissect"] = None;302 TypeMap["suspend-in-water"] = Double;303 TypeMap["translate-mol"] = Vector;304 TypeMap["verlet-integrate"] = String;305 TypeMap["verbose"] = Integer;271 TypeMap["add-atom"] = &typeid(element); 272 TypeMap["bond-file"] = &typeid(std::string); 273 TypeMap["bond-table"] = &typeid(std::string); 274 TypeMap["boundary"] = &typeid(VectorValue); 275 TypeMap["center-in-box"] = &typeid(BoxValue); 276 TypeMap["change-box"] = &typeid(BoxValue); 277 TypeMap["change-element"] = &typeid(element); 278 TypeMap["change-molname"] = &typeid(std::string); 279 TypeMap["convex-envelope"] = &typeid(molecule); 280 TypeMap["default-molname"] = &typeid(std::string); 281 TypeMap["depth-first-search"] = &typeid(double); 282 TypeMap["element-db"] = &typeid(std::string); 283 TypeMap["fastparsing"] = &typeid(bool); 284 TypeMap["fill-molecule"] = &typeid(std::string); 285 TypeMap["fragment-mol"] = &typeid(std::string); 286 TypeMap["input"] = &typeid(std::string); 287 TypeMap["linear-interpolate"] = &typeid(std::string); 288 TypeMap["molecular-volume"] = &typeid(molecule); 289 TypeMap["nonconvex-envelope"] = &typeid(molecule); 290 TypeMap["output"] = &typeid(void); 291 TypeMap["parse-xyz"] = &typeid(std::string); 292 TypeMap["pair-correlation"] = &typeid(std::string); 293 TypeMap["principal-axis-system"] = &typeid(molecule); 294 TypeMap["remove-atom"] = &typeid(atom); 295 TypeMap["remove-sphere"] = &typeid(double); 296 TypeMap["repeat-box"] = &typeid(VectorValue); 297 TypeMap["rotate-to-pas"] = &typeid(molecule); 298 TypeMap["save-adjacency"] = &typeid(std::string); 299 TypeMap["save-bonds"] = &typeid(std::string); 300 TypeMap["save-temperature"] = &typeid(std::string); 301 TypeMap["scale-box"] = &typeid(VectorValue); 302 TypeMap["set-basis"] = &typeid(std::string); 303 TypeMap["set-output"] = &typeid(std::vector<std::string>); 304 TypeMap["subgraph-dissect"] = &typeid(void); 305 TypeMap["suspend-in-water"] = &typeid(double); 306 TypeMap["translate-mol"] = &typeid(VectorValue); 307 TypeMap["verlet-integrate"] = &typeid(std::string); 308 TypeMap["verbose"] = &typeid(int); 306 309 307 310 // value types for the values 308 TypeMap["atom-by-id"] = Atom; 309 TypeMap["bin-output-file"] = String; 310 TypeMap["bin-end"] = Double; 311 TypeMap["bin-start"] = Double; 312 TypeMap["bin-width"] = Double; 313 TypeMap["convex-file"] = String; 314 TypeMap["distance"] = Double; 315 TypeMap["distances"] = Vector; 316 TypeMap["DoRotate"] = Boolean; 317 TypeMap["element"] = Element; 318 TypeMap["elements"] = ListOfElements; 319 TypeMap["end-step"] = Integer; 320 TypeMap["id-mapping"] = Boolean; 321 TypeMap["length"] = Double; 322 TypeMap["lengths"] = Vector; 323 TypeMap["MaxDistance"] = Double; 324 TypeMap["molecule-by-id"] = Molecule; 325 TypeMap["molecule-by-name"] = String; 326 TypeMap["nonconvex-file"] = String; 327 TypeMap["order"] = Integer; 328 TypeMap["output-file"] = String; 329 TypeMap["periodic"] = Boolean; 330 TypeMap["position"] = Vector; 331 TypeMap["sphere-radius"] = Double; 332 TypeMap["start-step"] = Integer; 311 TypeMap["atom-by-id"] = &typeid(atom); 312 TypeMap["bin-output-file"] = &typeid(std::string); 313 TypeMap["bin-end"] = &typeid(double); 314 TypeMap["bin-start"] = &typeid(double); 315 TypeMap["bin-width"] = &typeid(double); 316 TypeMap["convex-file"] = &typeid(std::string); 317 TypeMap["distance"] = &typeid(double); 318 TypeMap["distances"] = &typeid(VectorValue); 319 TypeMap["DoRotate"] = &typeid(bool); 320 TypeMap["element"] = &typeid(element); 321 TypeMap["elements"] = &typeid(std::vector<element *>); 322 TypeMap["end-step"] = &typeid(int); 323 TypeMap["id-mapping"] = &typeid(bool); 324 TypeMap["length"] = &typeid(double); 325 TypeMap["lengths"] = &typeid(VectorValue); 326 TypeMap["MaxDistance"] = &typeid(double); 327 TypeMap["molecule-by-id"] = &typeid(molecule); 328 TypeMap["molecule-by-name"] = &typeid(std::string); 329 TypeMap["nonconvex-file"] = &typeid(std::string); 330 TypeMap["order"] = &typeid(int); 331 TypeMap["output-file"] = &typeid(std::string); 332 TypeMap["periodic"] = &typeid(bool); 333 TypeMap["position"] = &typeid(VectorValue); 334 TypeMap["sphere-radius"] = &typeid(double); 335 TypeMap["start-step"] = &typeid(int); 336 337 TypeEnumMap[&typeid(int)] = Integer; 338 TypeEnumMap[&typeid(double)] = Double; 339 TypeEnumMap[&typeid(bool)] = Boolean; 340 TypeEnumMap[&typeid(std::string)] = String; 341 TypeEnumMap[&typeid(atom)] = Atom; 342 TypeEnumMap[&typeid(element)] = Element; 343 TypeEnumMap[&typeid(std::vector<element *>)] = ListOfElements; 344 TypeEnumMap[&typeid(molecule)] = Molecule; 345 TypeEnumMap[&typeid(VectorValue)] = Vector; 346 TypeEnumMap[&typeid(BoxValue)] = Box; 347 333 348 334 349 // default values for any action that needs one (always string!) 335 DefaultValue["bin-width"] = "0.5";336 DefaultValue["fastparsing"] = "0";337 DefaultValue["atom-by-id"] = "-1";338 DefaultValue["molecule-by-id"] = "-1";339 DefaultValue["periodic"] = "0";350 CurrentValue["bin-width"] = "0.5"; 351 CurrentValue["fastparsing"] = "0"; 352 CurrentValue["atom-by-id"] = "-1"; 353 CurrentValue["molecule-by-id"] = "-1"; 354 CurrentValue["periodic"] = "0"; 340 355 341 356 // put action into each menu category … … 537 552 } 538 553 539 540 554 /** Adds all options to the CommandLineParser. 541 555 * … … 548 562 if (hasValue(*OptionRunner)) { 549 563 DoLog(0) && (Log() << Verbose(0) << "Adding option " << *OptionRunner << " with type " << TypeMap[*OptionRunner] << " to CommandLineParser." << endl); 550 switch( (enum OptionTypes) TypeMap[*OptionRunner]) {564 switch(TypeEnumMap[TypeMap[*OptionRunner]]) { 551 565 default: 552 566 case None: … … 558 572 ListRunner->second->add_options() 559 573 (getKeyAndShortForm(*OptionRunner).c_str(), 560 DefaultValue.find(*OptionRunner) != DefaultValue.end() ?561 po::value< bool >()->default_value(atoi( DefaultValue[*OptionRunner].c_str())) :574 CurrentValue.find(*OptionRunner) != CurrentValue.end() ? 575 po::value< bool >()->default_value(atoi(CurrentValue[*OptionRunner].c_str())) : 562 576 po::value< bool >(), 563 577 getDescription(*OptionRunner).c_str()) … … 574 588 ListRunner->second->add_options() 575 589 (getKeyAndShortForm(*OptionRunner).c_str(), 576 DefaultValue.find(*OptionRunner) != DefaultValue.end() ?577 po::value< int >()->default_value(atoi( DefaultValue[*OptionRunner].c_str())) :590 CurrentValue.find(*OptionRunner) != CurrentValue.end() ? 591 po::value< int >()->default_value(atoi(CurrentValue[*OptionRunner].c_str())) : 578 592 po::value< int >(), 579 593 getDescription(*OptionRunner).c_str()) … … 590 604 ListRunner->second->add_options() 591 605 (getKeyAndShortForm(*OptionRunner).c_str(), 592 DefaultValue.find(*OptionRunner) != DefaultValue.end() ?593 po::value< double >()->default_value(atof( DefaultValue[*OptionRunner].c_str())) :606 CurrentValue.find(*OptionRunner) != CurrentValue.end() ? 607 po::value< double >()->default_value(atof(CurrentValue[*OptionRunner].c_str())) : 594 608 po::value< double >(), 595 609 getDescription(*OptionRunner).c_str()) … … 606 620 ListRunner->second->add_options() 607 621 (getKeyAndShortForm(*OptionRunner).c_str(), 608 DefaultValue.find(*OptionRunner) != DefaultValue.end() ?609 po::value< std::string >()->default_value( DefaultValue[*OptionRunner]) :622 CurrentValue.find(*OptionRunner) != CurrentValue.end() ? 623 po::value< std::string >()->default_value(CurrentValue[*OptionRunner]) : 610 624 po::value< std::string >(), 611 625 getDescription(*OptionRunner).c_str()) … … 622 636 ListRunner->second->add_options() 623 637 (getKeyAndShortForm(*OptionRunner).c_str(), 624 DefaultValue.find(*OptionRunner) != DefaultValue.end() ?625 po::value< int >()->default_value(atoi( DefaultValue[*OptionRunner].c_str())) :638 CurrentValue.find(*OptionRunner) != CurrentValue.end() ? 639 po::value< int >()->default_value(atoi(CurrentValue[*OptionRunner].c_str())) : 626 640 po::value< int >(), 627 641 getDescription(*OptionRunner).c_str()) … … 638 652 ListRunner->second->add_options() 639 653 (getKeyAndShortForm(*OptionRunner).c_str(), 640 DefaultValue.find(*OptionRunner) != DefaultValue.end() ?641 po::value< int >()->default_value(atoi( DefaultValue[*OptionRunner].c_str())) :654 CurrentValue.find(*OptionRunner) != CurrentValue.end() ? 655 po::value< int >()->default_value(atoi(CurrentValue[*OptionRunner].c_str())) : 642 656 po::value< int >(), 643 657 getDescription(*OptionRunner).c_str()) … … 654 668 ListRunner->second->add_options() 655 669 (getKeyAndShortForm(*OptionRunner).c_str(), 656 DefaultValue.find(*OptionRunner) != DefaultValue.end() ?657 po::value< int >()->default_value(atoi( DefaultValue[*OptionRunner].c_str())) :670 CurrentValue.find(*OptionRunner) != CurrentValue.end() ? 671 po::value< int >()->default_value(atoi(CurrentValue[*OptionRunner].c_str())) : 658 672 po::value< int >(), 659 673 getDescription(*OptionRunner).c_str()) … … 751 765 * \return type of the action 752 766 */ 753 enum MapOfActions::OptionTypesMapOfActions::getValueType(string actionname)754 { 755 return TypeMap[actionname] ;767 std::string MapOfActions::getValueType(string actionname) 768 { 769 return TypeMap[actionname]->name(); 756 770 } 757 771
Note:
See TracChangeset
for help on using the changeset viewer.