Changeset 7f1b51 for src/Actions
- Timestamp:
- Sep 15, 2014, 3:05:28 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:
- 7e1a88
- Parents:
- b73545 (diff), 8859b5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/Actions
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/Action.cpp
rb73545 r7f1b51 127 127 128 128 Dialog * Action::createDialog(){ 129 Dialog *dialog = UIFactory::getInstance().makeDialog( );129 Dialog *dialog = UIFactory::getInstance().makeDialog(Traits.getName()); 130 130 return fillDialog(dialog); 131 131 } -
src/Actions/ActionQueue.cpp
rb73545 r7f1b51 55 55 using namespace MoleCuilder; 56 56 57 const Action* ActionQueue::_lastchangedaction = NULL; 58 57 59 ActionQueue::ActionQueue() : 60 Observable("ActionQueue"), 58 61 AR(new ActionRegistry()), 59 62 history(new ActionHistory), … … 66 69 run_thread_isIdle(true) 67 70 #endif 68 {} 71 { 72 // channels of observable 73 Channels *OurChannel = new Channels; 74 NotificationChannels.insert( std::make_pair(static_cast<Observable *>(this), OurChannel) ); 75 // add instance for each notification type 76 for (size_t type = 0; type < NotificationType_MAX; ++type) 77 OurChannel->addChannel(type); 78 } 69 79 70 80 ActionQueue::~ActionQueue() … … 88 98 void ActionQueue::queueAction(const Action * const _action, enum Action::QueryOptions state) 89 99 { 100 OBSERVE; 101 NOTIFY(ActionQueued); 90 102 Action *newaction = _action->clone(state); 91 103 newaction->prepare(state); … … 118 130 mtx_queue.unlock(); 119 131 #endif 132 _lastchangedaction = newaction; 120 133 } 121 134 -
src/Actions/ActionQueue.hpp
rb73545 r7f1b51 16 16 #include "CodePatterns/Singleton.hpp" 17 17 18 #include "CodePatterns/Observer/Channels.hpp" 19 #include "CodePatterns/Observer/Observable.hpp" 18 20 19 21 #ifdef HAVE_ACTION_THREAD … … 38 40 class ActionRegistry; 39 41 class ActionTrait; 42 43 namespace Queuedetail { 44 template <class T> const T* lastChanged() 45 { 46 ASSERT(0, "Queuedetail::lastChanged() - only specializations may be used."); 47 return NULL; 48 } 49 } 40 50 41 51 /** This class combines the whole handling of Actions into a single class. … … 44 54 * automatically queued and placed into a History after execution. 45 55 */ 46 class ActionQueue : public Singleton<ActionQueue> 56 class ActionQueue : public Singleton<ActionQueue>, public Observable 47 57 { 48 58 friend class Singleton<ActionQueue>; … … 51 61 typedef std::vector< Action * > ActionQueue_t; 52 62 63 //!> channels for this observable 64 enum NotificationType { 65 ActionQueued, // new action was queued 66 NotificationType_MAX // denotes the maximum of available notification types 67 }; 68 69 //>! access to last changed element (atom or molecule) 70 template <class T> const T* lastChanged() const 71 { return Queuedetail::lastChanged<T>(); } 72 53 73 /** Queues the Action with \a name to be called. 54 74 * … … 222 242 ~ActionQueue(); 223 243 244 private: 245 friend const Action *Queuedetail::lastChanged<Action>(); 246 static const Action *_lastchangedaction; 247 224 248 //!> ActionRegistry to spawn new actions 225 249 ActionRegistry *AR; … … 260 284 ActionStatusList StatusList; 261 285 }; 286 namespace Queuedetail { 287 template <> inline const Action* lastChanged<Action>() { return ActionQueue::_lastchangedaction; } 288 } 262 289 263 290 }; -
src/Actions/Action_impl_pre.hpp
rb73545 r7f1b51 111 111 ) 112 112 #endif 113 #ifdef paramdescriptions 114 BOOST_PP_ASSERT_MSG(BOOST_PP_EQUAL(MAXPARAMTYPES, BOOST_PP_SEQ_SIZE(paramdescriptions)),\ 115 ERROR: There are not the same number of "paramtokens" and "paramdescriptions" in: __FILE__ \ 116 ) 117 #endif 113 118 114 119 #ifdef statetypes … … 143 148 ,\ 144 149 BOOST_PP_SEQ_ELEM(n, paramtokens)\ 145 , Traits.getDescription()\ 150 ,\ 151 BOOST_PP_SEQ_ELEM(n, paramdescriptions)\ 146 152 ); 147 153 -
src/Actions/CommandAction/BondLengthTableAction.def
rb73545 r7f1b51 10 10 #include "Graph/BondGraph.hpp" 11 11 12 #include "Parameters/Validators/Ops_Validator.hpp" 12 13 #include "Parameters/Validators/Specific/FilePresentValidator.hpp" 14 #include "Parameters/Validators/Specific/FileSuffixValidator.hpp" 13 15 14 16 // i.e. there is an integer with variable name Z that can be found in … … 21 23 #define paramreferences (BondGraphFileName) 22 24 #define paramvalids \ 23 (FilePresentValidator() )25 (FilePresentValidator() && (FileSuffixValidator("dat") || FileSuffixValidator("db"))) 24 26 25 27 #define statetypes (std::string) -
src/Actions/CommandAction/ElementDbAction.def
rb73545 r7f1b51 9 9 #include <sstream> 10 10 11 #include "Parameters/Validators/Ops_Validator.hpp" 11 12 #include "Parameters/Validators/Specific/FilePresentValidator.hpp" 12 13 -
src/Actions/CommandAction/LoadSessionAction.def
rb73545 r7f1b51 9 9 #include <boost/filesystem/path.hpp> 10 10 11 #include "Parameters/Validators/Ops_Validator.hpp" 11 12 #include "Parameters/Validators/Specific/FilePresentValidator.hpp" 13 #include "Parameters/Validators/Specific/FileSuffixValidator.hpp" 12 14 13 15 // i.e. there is an integer with variable name Z that can be found in … … 20 22 #define paramreferences (filename) 21 23 #define paramvalids \ 22 (FilePresentValidator() )24 (FilePresentValidator() && FileSuffixValidator("py")) 23 25 24 26 #undef statetypes -
src/Actions/CommandAction/StoreSessionAction.def
rb73545 r7f1b51 11 11 12 12 #include "Parameters/Validators/DummyValidator.hpp" 13 #include "Parameters/Validators/Ops_Validator.hpp" 14 #include "Parameters/Validators/Specific/FileSuffixValidator.hpp" 13 15 #include "Parameters/Validators/Specific/SessionTypeValidator.hpp" 14 16 … … 22 24 #define paramreferences (filename)(sessiontype) 23 25 #define paramvalids \ 24 ( DummyValidator< boost::filesystem::path >()) \26 (FileSuffixValidator("py") || FileSuffixValidator("sh") || FileSuffixValidator("bat")) \ 25 27 (SessionTypeValidator()) 26 28 -
src/Actions/FragmentationAction/ClearFragmentationResultsAction.def
rb73545 r7f1b51 7 7 8 8 // all includes and forward declarations necessary for non-integral types below 9 #include <boost/filesystem/path.hpp>10 #include <vector>11 12 #include "Parameters/Validators/RangeValidator.hpp"13 #include "Parameters/Validators/Ops_Validator.hpp"14 #include "Parameters/Validators/STLVectorValidator.hpp"15 #include "Parameters/Validators/Specific/ParserFileValidator.hpp"16 #include "Parameters/Validators/Specific/FilePresentValidator.hpp"17 9 18 10 // i.e. there is an integer with variable name Z that can be found in -
src/Actions/FragmentationAction/MolecularDynamicsAction.cpp
rb73545 r7f1b51 65 65 actions.addAction(AR.getActionByName(std::string("output"))); 66 66 actions.addAction(AR.getActionByName(std::string("clear-fragment-results"))); 67 actions.addAction(AR.getActionByName(std::string("destroy-adjacency"))); 68 actions.addAction(AR.getActionByName(std::string("create-adjacency"))); 69 actions.addAction(AR.getActionByName(std::string("update-molecules"))); 67 70 actions.addAction(AR.getActionByName(std::string("fragment-molecule"))); 68 71 actions.addAction(AR.getActionByName(std::string("fragment-automation"))); … … 91 94 "FragmentationMolecularDynamicsAction::performCall() - output not found in ActionSequence."); 92 95 } 96 // don't recreate bond graph if not desired 97 if (params.DontCreateGraphEachStep.get()) { 98 #ifndef NDEBUG 99 bool status = true; 100 status &= 101 #endif 102 removeAction(std::string("destroy-adjacency")); 103 104 #ifndef NDEBUG 105 status &= 106 #endif 107 removeAction(std::string("create-adjacency")); 108 109 #ifndef NDEBUG 110 status &= 111 #endif 112 removeAction(std::string("update-molecules")); 113 ASSERT( status, 114 "FragmentationStructuralOptimizationAction::performCall() - at least one graph action not found in ActionSequence."); 115 } 93 116 // and call 94 117 ActionState::ptr state(MakroAction::performCall()); -
src/Actions/FragmentationAction/MolecularDynamicsAction.def
rb73545 r7f1b51 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 13 // "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value 14 #define paramtypes (unsigned int)(bool) 15 #define paramtokens ("steps")("output-every-step") 16 #define paramdescriptions ("numer of MD steps to perform")("whether World should be written after every step, useful if integration might hang") 17 #define paramdefaults (NOPARAM_DEFAULT)(PARAM_DEFAULT("0")) 18 #define paramreferences (steps)(DoOutput) 14 #define paramtypes (unsigned int)(bool)(bool) 15 #define paramtokens ("steps")("output-every-step")("keep-bondgraph") 16 #define paramdescriptions ("numer of MD steps to perform")("whether World should be written after every step, useful if integration might hang")("whether the bond graph should be kept the same during each step and not updated") 17 #define paramdefaults (NOPARAM_DEFAULT)(PARAM_DEFAULT("0"))(PARAM_DEFAULT("0")) 18 #define paramreferences (steps)(DoOutput)(DontCreateGraphEachStep) 19 19 #define paramvalids \ 20 20 (NotZeroValidator< unsigned int >()) \ 21 (DummyValidator<bool>()) \ 21 22 (DummyValidator<bool>()) 22 23 -
src/Actions/FragmentationAction/StructuralOptimizationAction.cpp
rb73545 r7f1b51 62 62 // present. If not, we still copy the position cleanly into a new step where then 63 63 // forces are set according to summed fragmentary contributions. This is much cleaner. 64 actions.addAction(AR.getActionByName(std::string("destroy-adjacency"))); 65 actions.addAction(AR.getActionByName(std::string("create-adjacency"))); 66 actions.addAction(AR.getActionByName(std::string("update-molecules"))); 64 67 actions.addAction(AR.getActionByName(std::string("fragment-molecule"))); 65 68 actions.addAction(AR.getActionByName(std::string("fragment-automation"))); … … 91 94 "FragmentationStructuralOptimizationAction::performCall() - output not found in ActionSequence."); 92 95 } 96 // don't recreate bond graph if not desired 97 if (params.DontCreateGraphEachStep.get()) { 98 #ifndef NDEBUG 99 bool status = true; 100 status &= 101 #endif 102 removeAction(std::string("destroy-adjacency")); 103 104 #ifndef NDEBUG 105 status &= 106 #endif 107 removeAction(std::string("create-adjacency")); 108 109 #ifndef NDEBUG 110 status &= 111 #endif 112 removeAction(std::string("update-molecules")); 113 ASSERT( status, 114 "FragmentationStructuralOptimizationAction::performCall() - at least one graph action not found in ActionSequence."); 115 } 93 116 // and call 94 117 ActionState::ptr state(MakroAction::performCall()); -
src/Actions/FragmentationAction/StructuralOptimizationAction.def
rb73545 r7f1b51 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 13 // "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value 14 #define paramtypes (unsigned int)(bool) 15 #define paramtokens ("steps")("output-every-step") 16 #define paramdescriptions ("numer of MD steps to perform")("whether we should update the timestep in each descent step sp as to visualize the minimisation") 17 #define paramdefaults (NOPARAM_DEFAULT)(PARAM_DEFAULT("0")) 18 #define paramreferences (steps)(DoOutput) 14 #define paramtypes (unsigned int)(bool)(bool) 15 #define paramtokens ("steps")("output-every-step")("keep-bondgraph") 16 #define paramdescriptions ("numer of MD steps to perform")("whether we should update the timestep in each descent step sp as to visualize the minimisation")("whether the bond graph should be kept the same during each step and not updated") 17 #define paramdefaults (NOPARAM_DEFAULT)(PARAM_DEFAULT("0"))(PARAM_DEFAULT("0")) 18 #define paramreferences (steps)(DoOutput)(DontCreateGraphEachStep) 19 19 #define paramvalids \ 20 20 (NotZeroValidator< unsigned int >()) \ 21 (DummyValidator<bool>()) \ 21 22 (DummyValidator<bool>()) 22 23 -
src/Actions/GraphAction/CorrectBondDegreeAction.cpp
rb73545 r7f1b51 106 106 BG->CorrectBondDegree(Set); 107 107 108 // give info109 size_t BondCount = 0;110 std::vector<molecule *> molecules = World::getInstance().getAllMolecules();111 for (std::vector<molecule *>::const_iterator iter = molecules.begin();112 iter != molecules.end(); ++iter)113 BondCount += (*iter)->getBondCount();114 LOG(0, "STATUS: Recognized " << BondCount << " bonds.");115 116 108 return ActionState::ptr(UndoState); 117 109 } -
src/Actions/MoleculeAction/ForceAnnealingAction.def
rb73545 r7f1b51 7 7 8 8 // all includes and forward declarations necessary for non-integral types below 9 #include <boost/filesystem/path.hpp> 10 9 11 #include "Parameters/Validators/DummyValidator.hpp" 10 12 #include "Parameters/Validators/GenericValidators.hpp" 11 13 #include "Parameters/Validators/Ops_Validator.hpp" 12 #include "Parameters/Validators/Specific/FilePresentValidator.hpp"13 14 14 15 // i.e. there is an integer with variable name Z that can be found in -
src/Actions/MoleculeAction/VerletIntegrationAction.def
rb73545 r7f1b51 8 8 // all includes and forward declarations necessary for non-integral types below 9 9 #include "LinearAlgebra/Vector.hpp" 10 #include <boost/filesystem/path.hpp> 10 11 #include <vector> 11 12 typedef std::vector<Vector> Vectors_t; … … 14 15 #include "Parameters/Validators/GenericValidators.hpp" 15 16 #include "Parameters/Validators/Ops_Validator.hpp" 16 #include "Parameters/Validators/Specific/FilePresentValidator.hpp"17 17 18 18 // i.e. there is an integer with variable name Z that can be found in -
src/Actions/PotentialAction/FitPotentialAction.def
rb73545 r7f1b51 18 18 #include "Parameters/Validators/Specific/ElementValidator.hpp" 19 19 #include "Parameters/Validators/Specific/EmptyStringValidator.hpp" 20 #include "Parameters/Validators/Specific/FileSuffixValidator.hpp" 20 21 #include "Parameters/Validators/Specific/FilePresentValidator.hpp" 21 22 #include "Parameters/Validators/Specific/PotentialTypeValidator.hpp" … … 26 27 #define paramtypes (boost::filesystem::path)(std::string)(boost::filesystem::path)(std::vector<const element *>)(std::vector<const element *>)(unsigned int)(double) 27 28 #define paramtokens ("training-file")("potential-type")("potential-file")("potential-charges")("fragment-charges")("take-best-of")("set-threshold") 28 #define paramdescriptions ("optional file to write training data to")("potential type to fit")(" potential file specifying multiple potentials to fit")("charges specifying the potential")("charges specifying the fragment")("take the best among this many approximations")("Require L2 error to be smaller than threshold, overrides number of attempts")29 #define paramdescriptions ("optional file to write training data to")("potential type to fit")("optional potential file specifying multiple potentials to fit")("charges specifying the potential")("charges specifying the fragment")("take the best among this many approximations")("Require L2 error to be smaller than threshold, overrides number of attempts") 29 30 #define paramdefaults (PARAM_DEFAULT(""))(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(PARAM_DEFAULT(3))(PARAM_DEFAULT(1.)) 30 31 #define paramreferences (training_file)(potentialtype)(potential_file)(charges)(fragment)(best_of_howmany)(threshold) … … 32 33 (DummyValidator<boost::filesystem::path>()) \ 33 34 (EmptyStringValidator() || PotentialTypeValidator()) \ 34 ( DummyValidator<boost::filesystem::path>()) \35 (!FilePresentValidator() || FileSuffixValidator("potentials")) \ 35 36 (STLVectorValidator< std::vector<const element *> >(0,99, ElementValidator())) \ 36 37 (STLVectorValidator< std::vector<const element *> >(1,99, ElementValidator())) \ -
src/Actions/unittests/stubs/DummyUI.hpp
rb73545 r7f1b51 21 21 { 22 22 public: 23 DummyDialog(){} 23 DummyDialog(const std::string &_title) : 24 Dialog(_title) 25 {} 24 26 virtual ~DummyDialog(){} 25 27 … … 53 55 virtual ~DummyUIFactory(){} 54 56 55 virtual Dialog* makeDialog( ){return new DummyDialog;}57 virtual Dialog* makeDialog(const std::string &_title){return new DummyDialog(_title);} 56 58 virtual MainWindow* makeMainWindow(){return 0;} 57 59
Note:
See TracChangeset
for help on using the changeset viewer.