Changeset 10aee4 for src/Actions/ActionRegistry.cpp
- Timestamp:
- Aug 5, 2015, 7:12:24 AM (9 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:
- c307ba
- Parents:
- 94232b
- git-author:
- Frederik Heber <heber@…> (08/03/15 09:25:02)
- git-committer:
- Frederik Heber <heber@…> (08/05/15 07:12:24)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/ActionRegistry.cpp
r94232b r10aee4 62 62 //std::cout << "ActionRegistry::ActionRegistry() called, instance is " << this << "." << std::endl; 63 63 fillRegistry(); 64 prepareAllMakroActions(); 64 65 fillOptionRegistry(); 65 66 completely_instatiated = true; … … 75 76 // add all MakroActions: PLEASE adhere to the alphabetical ordering 76 77 { 77 MakroAction * presentAction = 78 dynamic_cast<MakroAction *>(getActionByName("molecular-dynamics")); 79 ASSERT( presentAction != NULL, 80 "ActionRegistry::fillRegistry() - makro action has not been registered."); 81 presentAction->unprepare(*this); 82 } 83 { 84 MakroAction * presentAction = 85 dynamic_cast<MakroAction *>(getActionByName("optimize-structure")); 86 ASSERT( presentAction != NULL, 87 "ActionRegistry::fillRegistry() - makro action has not been registered."); 88 presentAction->unprepare(*this); 89 } 90 { 91 MakroAction * presentAction = 92 dynamic_cast<MakroAction *>(getActionByName("subgraph-dissection")); 93 ASSERT( presentAction != NULL, 94 "ActionRegistry::fillRegistry() - makro action has not been registered."); 95 presentAction->unprepare(*this); 96 } 97 { 98 MakroAction * presentAction = 99 dynamic_cast<MakroAction *>(getActionByName("translate-molecules")); 100 ASSERT( presentAction != NULL, 101 "ActionRegistry::fillRegistry() - makro action has not been registered."); 102 presentAction->unprepare(*this); 78 MakroAction & presentAction = 79 const_cast<MakroAction &>( 80 dynamic_cast<const MakroAction &>(getActionByName("molecular-dynamics"))); 81 presentAction.unprepare(*this); 82 } 83 { 84 MakroAction & presentAction = 85 const_cast<MakroAction &>( 86 dynamic_cast<const MakroAction &>(getActionByName("optimize-structure"))); 87 presentAction.unprepare(*this); 88 } 89 { 90 MakroAction & presentAction = 91 const_cast<MakroAction &>( 92 dynamic_cast<const MakroAction &>(getActionByName("subgraph-dissection"))); 93 presentAction.unprepare(*this); 94 } 95 { 96 MakroAction & presentAction = 97 const_cast<MakroAction &>( 98 dynamic_cast<const MakroAction &>(getActionByName("translate-molecules"))); 99 presentAction.unprepare(*this); 103 100 } 104 101 … … 124 121 #include BOOST_PP_LOCAL_ITERATE() 125 122 #undef instance_print 126 123 } 124 125 void ActionRegistry::prepareAllMakroActions() 126 { 127 127 // now prepare each macro action that require presence of all primitive ones 128 128 { 129 MakroAction * presentAction = 130 dynamic_cast<MakroAction *>(getActionByName("subgraph-dissection")); 131 ASSERT( presentAction != NULL, 132 "ActionRegistry::fillRegistry() - makro action has not been registered."); 133 presentAction->prepare(*this); 134 } 135 { 136 MakroAction * presentAction = 137 dynamic_cast<MakroAction *>(getActionByName("molecular-dynamics")); 138 ASSERT( presentAction != NULL, 139 "ActionRegistry::fillRegistry() - makro action has not been registered."); 140 presentAction->prepare(*this); 141 } 142 { 143 MakroAction * presentAction = 144 dynamic_cast<MakroAction *>(getActionByName("optimize-structure")); 145 ASSERT( presentAction != NULL, 146 "ActionRegistry::fillRegistry() - makro action has not been registered."); 147 presentAction->prepare(*this); 148 } 149 { 150 MakroAction * presentAction = 151 dynamic_cast<MakroAction *>(getActionByName("translate-molecules")); 152 ASSERT( presentAction != NULL, 153 "ActionRegistry::fillRegistry() - makro action has not been registered."); 154 presentAction->prepare(*this); 129 MakroAction & presentAction = 130 const_cast<MakroAction &>( 131 dynamic_cast<const MakroAction &>(getActionByName("subgraph-dissection"))); 132 presentAction.prepare(*this); 133 } 134 { 135 MakroAction & presentAction = 136 const_cast<MakroAction &>( 137 dynamic_cast<const MakroAction &>(getActionByName("molecular-dynamics"))); 138 presentAction.prepare(*this); 139 } 140 { 141 MakroAction & presentAction = 142 const_cast<MakroAction &>( 143 dynamic_cast<const MakroAction &>(getActionByName("optimize-structure"))); 144 presentAction.prepare(*this); 145 } 146 { 147 MakroAction & presentAction = 148 const_cast<MakroAction &>( 149 dynamic_cast<const MakroAction &>(getActionByName("translate-molecules"))); 150 presentAction.prepare(*this); 155 151 } 156 152 } … … 227 223 /** Just passes on call to Registry<Action>::getByName(). 228 224 * \param name name of Action 229 * \return pointer to Action 230 */ 231 Action* ActionRegistry::getActionByName(const std::string &name) 232 { 233 return getByName(name); 225 * \return const ref to Action 226 */ 227 const Action& ActionRegistry::getActionByName(const std::string &name) 228 { 229 Action * const action = getByName(name); 230 ASSERT( action != NULL, 231 "ActionRegistry::getActionByName() - action "+name+" not present!"); 232 return *action; 234 233 } 235 234
Note:
See TracChangeset
for help on using the changeset viewer.