- Timestamp:
- Sep 19, 2013, 8:23:52 PM (11 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:
- 27d0bc
- Parents:
- 9b56f34
- git-author:
- Frederik Heber <heber@…> (08/26/13 08:23:15)
- git-committer:
- Frederik Heber <heber@…> (09/19/13 20:23:52)
- Location:
- src
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/Action.hpp
r9b56f34 r477012 174 174 virtual void outputAsCLI(std::ostream &ost) const=0; 175 175 176 /** Prints what would be necessary to add the Action from a Python script 177 * 178 * \param ost output stream to print to 179 * \param prefix package prefix to be used 180 */ 181 virtual void outputAsPython(std::ostream &ost, const std::string &prefix) const=0; 182 176 183 /** 177 184 * Traits resemble all necessary information that "surrounds" an action, such as -
src/Actions/ActionQueue.cpp
r9b56f34 r477012 106 106 } 107 107 108 void ActionQueue::outputAsPython(std::ostream &output) const 109 { 110 const std::string prefix("pyMoleCuilder"); 111 output << "import " << prefix << std::endl; 112 output << "% ========================== Stored Session BEGIN ==========================" << std::endl; 113 for (ActionQueue_t::const_iterator iter = queue.begin(); 114 iter != queue.end(); 115 ++iter) { 116 // skip store-session in printed list 117 if ((*iter)->getName() != std::string("store-session")) 118 (*iter)->outputAsPython(output, prefix); 119 } 120 output << "% =========================== Stored Session END ===========================" << std::endl; 121 } 122 108 123 const ActionTrait& ActionQueue::getActionsTrait(const std::string &name) const 109 124 { -
src/Actions/ActionQueue.hpp
r9b56f34 r477012 96 96 void outputAsCLI(std::ostream &output) const; 97 97 98 /** Print the current contents of the queue as Python instantiated list of Actions. 99 * 100 * This is useful for storing the current session. 101 * 102 * \param output output stream to print to 103 */ 104 void outputAsPython(std::ostream &output) const; 105 98 106 /** Undoes last called Action. 99 107 * -
src/Actions/ActionSequence.cpp
r9b56f34 r477012 166 166 } 167 167 } 168 169 void ActionSequence::outputAsPython(std::ostream &ost, const std::string &prefix) const 170 { 171 for(std::deque<Action*>::const_iterator it=actions.begin();it!=actions.end();++it) 172 (*it)->outputAsPython(ost, prefix); 173 } -
src/Actions/ActionSequence.hpp
r9b56f34 r477012 45 45 46 46 void outputAsCLI(std::ostream &ost) const; 47 void outputAsPython(std::ostream &ost, const std::string &prefix) const; 47 48 48 49 protected: -
src/Actions/Action_impl_header.hpp
r9b56f34 r477012 213 213 214 214 void outputAsCLI(std::ostream &ost) const; 215 void outputAsPython(std::ostream &ost, const std::string &prefix) const; 215 216 216 217 struct PARAMS : ActionParameters { -
src/Actions/Action_impl_pre.hpp
r9b56f34 r477012 148 148 #define outputAsCLI_print(z,n,output) \ 149 149 output << \ 150 BOOST_PP_IF(n, BOOST_PP_STRINGIZE( ) , BOOST_PP_STRINGIZE()) \151 << "--"<< \150 BOOST_PP_IF(n, " --", "--") \ 151 << \ 152 152 BOOST_PP_SEQ_ELEM(n, paramtokens) \ 153 153 << " \"" << toCLIString(params. \ … … 162 162 == getName()) \ 163 163 booltoken = false; 164 165 // prints command line call for this Action for paramtypes with tokens 166 #define outputAsPython_print(z,n,output) \ 167 output << \ 168 BOOST_PP_IF(n, ", ", "") \ 169 << "\"" << toCLIString(params. \ 170 BOOST_PP_SEQ_ELEM(n, paramreferences) \ 171 .get()) \ 172 << "\""; 164 173 165 174 // print an initialiser list, i.e. "var( token, valid (,default) )(,)" … … 315 324 } 316 325 326 // =========== output as PYTHON =========== 327 void ACTION::outputAsPython(std::ostream &ost, const std::string &prefix) const { 328 // print prefix and action command 329 ost << prefix << "." << BOOST_PP_STRINGIZE( COMMAND ) << "("; 330 // then print option along with each argument if set 331 #if defined paramtypes && defined paramreferences && BOOST_PP_NOT_EQUAL(MAXPARAMTYPES,0) 332 #define BOOST_PP_LOCAL_MACRO(n) outputAsPython_print(~, n, ost) 333 #define BOOST_PP_LOCAL_LIMITS (0, MAXPARAMTYPES-1) 334 #include BOOST_PP_LOCAL_ITERATE() 335 #endif 336 ost << ")" << std::endl; 337 } 338 317 339 // =========== time the action =========== 318 340 // we need this here to have the correct function name -
src/Actions/Calculation.hpp
r9b56f34 r477012 43 43 44 44 virtual void outputAsCLI(std::ostream &ost) const; 45 virtual void outputAsPython(std::ostream &ost, const std::string &prefix) const; 45 46 46 47 /** -
src/Actions/Calculation_impl.hpp
r9b56f34 r477012 72 72 } 73 73 74 template<typename T> 75 void Calculation<T>::outputAsPython(std::ostream &ost, const std::string &prefix) const 76 {} 77 74 78 // methods for calculation infrastructure 75 79 -
src/Actions/ErrorAction.cpp
r9b56f34 r477012 82 82 void ErrorAction::outputAsCLI(std::ostream &ost) const 83 83 {} 84 85 void ErrorAction::outputAsPython(std::ostream &ost, const std::string &prefix) const 86 {} -
src/Actions/ErrorAction.hpp
r9b56f34 r477012 30 30 31 31 void outputAsCLI(std::ostream &ost) const; 32 void outputAsPython(std::ostream &ost, const std::string &prefix) const; 32 33 33 34 private: -
src/Actions/MakroAction.cpp
r9b56f34 r477012 132 132 actions.outputAsCLI(ost); 133 133 } 134 135 void MakroAction::outputAsPython(std::ostream &ost, const std::string &prefix) const 136 { 137 actions.outputAsCLI(ost); 138 } -
src/Actions/MakroAction.hpp
r9b56f34 r477012 38 38 39 39 virtual void outputAsCLI(std::ostream &ost) const; 40 virtual void outputAsPython(std::ostream &ost, const std::string &prefix) const; 40 41 41 42 // must be called after all primitive actions are present -
src/Actions/MakroAction_impl_header.hpp
r9b56f34 r477012 219 219 220 220 void outputAsCLI(std::ostream &ost) const; 221 void outputAsPython(std::ostream &ost, const std::string &prefix) const; 221 222 222 223 struct PARAMS : ActionParameters { -
src/Actions/MakroAction_impl_pre.hpp
r9b56f34 r477012 146 146 #define outputAsCLI_print(z,n,output) \ 147 147 output << \ 148 BOOST_PP_IF(n, BOOST_PP_STRINGIZE( ) , BOOST_PP_STRINGIZE()) \149 << "--"<< \148 BOOST_PP_IF(n, " --", "--") \ 149 << \ 150 150 BOOST_PP_SEQ_ELEM(n, paramtokens) \ 151 151 << " \"" << toCLIString(params. \ … … 160 160 == getName()) \ 161 161 booltoken = false; 162 163 // prints command line call for this Action for paramtypes with tokens 164 #define outputAsPython_print(z,n,output) \ 165 output << \ 166 BOOST_PP_IF(n, ", ", "") \ 167 << "\"" << toCLIString(params. \ 168 BOOST_PP_SEQ_ELEM(n, paramreferences) \ 169 .get()) \ 170 << "\""; 162 171 163 172 // print an initialiser list, i.e. "var( token, valid (,default) )(,)" … … 314 323 } 315 324 325 // =========== output as PYTHTON =========== 326 void ACTION::outputAsPython(std::ostream &ost, const std::string &prefix) const { 327 // print prefix and action command 328 ost << prefix << "." << BOOST_PP_STRINGIZE( COMMAND ) << "("; 329 // then print option along with each argument if set 330 #if defined paramtypes && defined paramreferences && BOOST_PP_NOT_EQUAL(MAXPARAMTYPES,0) 331 #define BOOST_PP_LOCAL_MACRO(n) outputAsCLI_print(~, n, ost) 332 #define BOOST_PP_LOCAL_LIMITS (0, MAXPARAMTYPES-1) 333 #include BOOST_PP_LOCAL_ITERATE() 334 #endif 335 ost << ")" << std::endl; 336 } 337 316 338 // =========== time the action =========== 317 339 // we need this here to have the correct function name -
src/Actions/ManipulateAtomsProcess.cpp
r9b56f34 r477012 87 87 {} 88 88 89 void ManipulateAtomsProcess::outputAsPython(std::ostream &ost, const std::string &prefix) const 90 {} 91 89 92 void ManipulateAtomsProcess::doManipulate(World *world){ 90 93 setMaxSteps(world->numAtoms()); -
src/Actions/ManipulateAtomsProcess.hpp
r9b56f34 r477012 39 39 40 40 void outputAsCLI(std::ostream &ost) const; 41 void outputAsPython(std::ostream &ost, const std::string &prefix) const; 41 42 42 43 virtual void doManipulate(World *); -
src/Actions/MethodAction.cpp
r9b56f34 r477012 79 79 } 80 80 81 bool MethodAction::shouldUndo(){ 82 return true; 83 } 84 81 85 void MethodAction::outputAsCLI(std::ostream &ost) const 82 86 {} 83 87 84 bool MethodAction::shouldUndo(){ 85 return true; 86 } 88 void MethodAction::outputAsPython(std::ostream &ost, const std::string &prefix) const 89 {} -
src/Actions/MethodAction.hpp
r9b56f34 r477012 35 35 36 36 void outputAsCLI(std::ostream &ost) const; 37 void outputAsPython(std::ostream &ost, const std::string &prefix) const; 37 38 38 39 protected: -
src/Actions/Reaction.hpp
r9b56f34 r477012 43 43 44 44 virtual void outputAsCLI(std::ostream &ost) const; 45 virtual void outputAsPython(std::ostream &ost, const std::string &prefix) const; 45 46 46 47 /** -
src/Actions/Reaction_impl.hpp
r9b56f34 r477012 69 69 {} 70 70 71 template<typename T> 72 void Reaction<T>::outputAsPython(std::ostream &ost, const std::string &prefix) const 73 {} 74 71 75 // methods for calculation infrastructure 72 76 -
src/Actions/Reaction_impl_header.hpp
r9b56f34 r477012 207 207 208 208 void outputAsCLI(std::ostream &ost) const; 209 void outputAsPython(std::ostream &ost, const std::string &prefix) const; 209 210 210 211 virtual RETURNTYPE * doCalc(); -
src/Actions/Reaction_impl_pre.hpp
r9b56f34 r477012 130 130 #define outputAsCLI_print(z,n,output) \ 131 131 output << \ 132 BOOST_PP_IF(n, BOOST_PP_STRINGIZE( ) , BOOST_PP_STRINGIZE()) \133 << "--"<< \132 BOOST_PP_IF(n, " --", "--") \ 133 << \ 134 134 BOOST_PP_SEQ_ELEM(n, paramtokens) \ 135 135 << " \"" << toCLIString(params. \ … … 144 144 == getName()) \ 145 145 booltoken = false; 146 147 // prints command line call for this Action for paramtypes with tokens 148 #define outputAsPython_print(z,n,output) \ 149 output << \ 150 BOOST_PP_IF(n, ", ", "") \ 151 << "\"" << toCLIString(params. \ 152 BOOST_PP_SEQ_ELEM(n, paramreferences) \ 153 .get()) \ 154 << "\""; 146 155 147 156 // prints set/queryCurrentValue (command) for paramreferences and paramtokens … … 221 230 #include BOOST_PP_LOCAL_ITERATE() 222 231 #endif 232 } 233 234 // =========== output as PYTHTON =========== 235 void REACTION::outputAsPython(std::ostream &ost, const std::string &prefix) const { 236 // print prefix and action command 237 ost << prefix << "." << BOOST_PP_STRINGIZE( COMMAND ) << "("; 238 // then print option along with each argument if set 239 #if defined paramtypes && defined paramreferences && BOOST_PP_NOT_EQUAL(MAXPARAMTYPES,0) 240 #define BOOST_PP_LOCAL_MACRO(n) outputAsCLI_print(~, n, ost) 241 #define BOOST_PP_LOCAL_LIMITS (0, MAXPARAMTYPES-1) 242 #include BOOST_PP_LOCAL_ITERATE() 243 #endif 244 ost << ")" << std::endl; 223 245 } 224 246 -
src/Actions/unittests/ActionSequenceUnitTest.cpp
r9b56f34 r477012 87 87 void outputAsCLI(std::ostream &ost) const 88 88 {} 89 void outputAsPython(std::ostream &ost, const std::string &prefix) const 90 {} 89 91 }; 90 92 … … 118 120 void outputAsCLI(std::ostream &ost) const 119 121 {} 122 void outputAsPython(std::ostream &ost, const std::string &prefix) const 123 {} 120 124 }; 121 125 … … 151 155 } 152 156 void outputAsCLI(std::ostream &ost) const 157 {} 158 void outputAsPython(std::ostream &ost, const std::string &prefix) const 153 159 {} 154 160 bool wasCalled(){ -
src/UIElements/Menu/TextMenu/TxMenuLeaveAction.cpp
r9b56f34 r477012 74 74 {} 75 75 76 void TxMenu::LeaveAction::outputAsPython(std::ostream &ost, const std::string &prefix) const 77 {} 78 76 79 /** Internal function to construct the dialog. 77 80 * We do not need this function as there is no dialog to construct. -
src/UIElements/Menu/TextMenu/TxMenuLeaveAction.hpp
r9b56f34 r477012 34 34 35 35 void outputAsCLI(std::ostream &ost) const; 36 void outputAsPython(std::ostream &ost, const std::string &prefix) const; 36 37 37 38 protected:
Note:
See TracChangeset
for help on using the changeset viewer.