Changes in / [3fa16b:19dfdf]
- Files:
-
- 3 added
- 246 deleted
- 126 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile.am
r3fa16b r19dfdf 23 23 cd doc && $(MAKE) doxygen-doc 24 24 25 guicheck:26 cd tests && $(MAKE) guicheck27 25 extracheck: 28 26 cd tests && $(MAKE) extracheck -
configure.ac
r3fa16b r19dfdf 427 427 AC_CONFIG_FILES([tests/Fragmentations/molecuilder], [chmod +x tests/Fragmentations/molecuilder]) 428 428 429 AC_CONFIG_TESTDIR(tests/GuiChecks)430 AC_CONFIG_FILES([431 tests/GuiChecks/atlocal432 tests/GuiChecks/Makefile])433 AC_CONFIG_FILES([tests/GuiChecks/molecuilder], [chmod +x tests/GuiChecks/molecuilder])434 AC_CONFIG_FILES([tests/GuiChecks/molecuilderguitest], [chmod +x tests/GuiChecks/molecuilderguitest])435 436 429 AC_CONFIG_TESTDIR(tests/JobMarket) 437 430 AC_CONFIG_FILES([ -
doc/userguide/userguide.xml
r3fa16b r19dfdf 962 962 </section> 963 963 964 <section xml:id='atoms.saturate-atom'>965 <title xml:id='atoms.saturate-atom.title'>Saturating atoms</title>966 967 <para>Newly instantiated atoms have no bonds to any other atom. If968 you want to fill up their valence by a slew of hydrogen atoms969 residing on a sphere around this atom, use this action.</para>970 971 <programlisting>972 ... --saturate-atoms973 </programlisting>974 975 <para>A number of hydrogen atoms is added. The number corrresponding976 to the valence of each selected atom. They are placed in the same977 distance to this atom and approximately with same distance to their978 nearest neighbors.</para>979 </section>980 981 964 <section xml:id='atoms.translate-atom'> 982 965 <title xml:id='atoms.translate-atom.title'>Translating atoms</title> … … 1150 1133 </section> 1151 1134 1152 <section xml:id='bond.add s-bond'>1153 <title xml:id='bond.add s-bond.title'>Adding a bond manually</title>1135 <section xml:id='bond.add-bond'> 1136 <title xml:id='bond.add-bond.title'>Adding a bond manually</title> 1154 1137 1155 1138 <para>When the automatically created adjacency or bond graph 1156 1139 contains faulty bonds or lacks some, you can add them manually. 1157 </para> 1158 1159 <programlisting>... --add-bonds</programlisting> 1160 1161 <para>If two atoms are selected, the single bond in between, if not 1162 present, is added. If more than two atoms are selected, than the 1163 bond between any pair of these is added.</para> 1164 <note><para>This is especially useful in conjunction with the 1165 fragmentation scheme. If you want to know the contribution from 1166 certain fragments whose subgraph is not connected you can simply 1167 make the associated subset of atoms connected by selecting all 1168 bonds and adding the bonds.</para> 1169 </note> 1170 </section> 1171 1172 <section xml:id='bond.remove-bonds'> 1173 <title xml:id='bond.remove-bonds.title'>Removing a bond manually 1140 First, you must have selected two atoms.</para> 1141 1142 <programlisting>... --add-bond</programlisting> 1143 </section> 1144 1145 <section xml:id='bond.remove-bond'> 1146 <title xml:id='bond.remove-bond.title'>Removing a bond manually 1174 1147 </title> 1175 1148 … … 1177 1150 bond.</para> 1178 1151 1179 <programlisting>... --remove-bonds</programlisting> 1180 1181 <para>Similarly, if more than two atoms are selected, then all bonds 1182 found between any pair of these is removed.</para> 1152 <programlisting>... --remove-bond</programlisting> 1183 1153 </section> 1184 1154 … … 2541 2511 <programlisting>... -v 4</programlisting> 2542 2512 </section> 2543 2544 <section xml:id='various.dry-run'>2545 <title xml:id='various.dry-run.title'>Dry runs</title>2546 2547 <para>A "dry run" refers to a test run where commands are not2548 actually executed. You may bracket a certain set of actions by2549 putting --dry-run before and --no-dry-run afterwards. Then, all2550 action in between will be looked at but not executed, i.e. they2551 make it to the history but nothing is changed in the World.</para>2552 2553 <para>As an example, the following listing contains the adding of a2554 hydrogen atom at position (5,5,5) inside the aforementioned dry run2555 statements. Hence, no hydrogen atom is added but the add action is2556 stored in the history and will make it to a stored session.</para>2557 2558 <programlisting>2559 ... --dry-run \2560 --add-atom 1 --domain-position "5,5,5"2561 --no-dry-run2562 </programlisting>2563 2564 </section>2565 2513 2566 2514 <section xml:id='various.element-db'> -
src/Actions/ActionQueue.cpp
r3fa16b r19dfdf 63 63 history(new ActionHistory), 64 64 #ifndef HAVE_ACTION_THREAD 65 lastActionOk(true) ,65 lastActionOk(true) 66 66 #else 67 67 CurrentAction(0), 68 68 lastActionOk(true), 69 69 run_thread(boost::bind(&ActionQueue::run, this)), 70 run_thread_isIdle(true), 71 #endif 72 dryrun_flag(false) 70 run_thread_isIdle(true) 71 #endif 73 72 { 74 73 // channels of observable … … 110 109 #ifndef HAVE_ACTION_THREAD 111 110 try { 112 if (!isDryRun(newaction)) 113 newaction->call(); 111 newaction->call(); 114 112 lastActionOk = true; 115 113 } catch(ActionFailureException &e) { … … 177 175 LOG(0, "Calling Action " << actionqueue[CurrentAction]->getName() << " ... "); 178 176 try { 179 if (!isDryRun(actionqueue[CurrentAction])) 180 actionqueue[CurrentAction]->call(); 177 actionqueue[CurrentAction]->call(); 181 178 pushStatus("SUCCESS: Action "+actionqueue[CurrentAction]->getName()+" successful."); 182 179 lastActionOk = true; … … 383 380 } 384 381 385 bool ActionQueue::isDryRun(const Action *_nextaction) const386 {387 bool status = dryrun_flag;388 status &= (_nextaction->getName() != "no-dry-run");389 return status;390 }391 382 392 383 CONSTRUCT_SINGLETON(ActionQueue) -
src/Actions/ActionQueue.hpp
r3fa16b r19dfdf 40 40 class ActionRegistry; 41 41 class ActionTrait; 42 class DryRunAdvocate;43 42 44 43 namespace Queuedetail { … … 179 178 { return StatusList; } 180 179 181 /** Getter for isDryRun state flag.182 *183 * \return true - ActionQueue does not execute Actions but skips, false - else184 */185 bool getDryRun() const186 { return dryrun_flag; }187 188 180 private: 189 181 //!> grant Action access to internal history functions. … … 191 183 //!> grant CommandLineParser access to stop and clearQueue() 192 184 friend class ::CommandLineParser; 193 //!> grant Advocate access to setting dryrun194 friend class DryRunAdvocate;195 185 196 186 /** Wrapper function to add state to ActionHistory. … … 265 255 void insertAction(Action *_action, enum Action::QueryOptions state); 266 256 267 /** Sets the current state of the \a isDryRun flag.268 *269 * \param _dryrun true - Actions will not get executed anymore, false - else270 */271 void setDryRun(const bool _dryrun)272 { dryrun_flag = _dryrun; }273 274 /** Checks whether next Action should be skipped or not.275 *276 * \param _nextaction next action to execute to inspect whether it unsets dryrun_flag277 * \return true - dryrun_flag set and \a _nextaction is not unsetting dry run278 */279 bool isDryRun(const Action *_nextaction) const;280 281 257 private: 282 258 /** Private cstor for ActionQueue. … … 333 309 //!> internal list of status messages from Actions for UIs to display 334 310 ActionStatusList StatusList; 335 336 //!> internal flag whether to call or skip actions (i.e. do a dry run)337 bool dryrun_flag;338 311 }; 339 312 namespace Queuedetail { -
src/Actions/ActionSequence.cpp
r3fa16b r19dfdf 37 37 #include "Actions/ActionSequence.hpp" 38 38 #include "Actions/Action.hpp" 39 #include "Actions/ActionExceptions.hpp"40 39 #include "UIElements/Dialog.hpp" 41 40 … … 54 53 { 55 54 // we need to override copy cstor as we have pointer referenced objects 56 for(actionSet:: const_iterator it=_other.actions.begin(); it!=_other.actions.end(); it++){55 for(actionSet::iterator it=actions.begin(); it!=actions.end(); it++){ 57 56 actions.push_back((*it)->clone()); 58 57 } … … 120 119 // we bypass the normal call 121 120 ActionState::ptr state = (*it)->performCall(); 122 if (state == Action::failure)123 throw ActionFailureException() << ActionNameString((*it)->getName());124 121 states.push_back(state); 125 122 } -
src/Actions/ActionSequence.hpp
r3fa16b r19dfdf 19 19 #include <deque> 20 20 21 class ActionSequenceTest;22 23 21 namespace MoleCuilder { 24 22 … … 29 27 { 30 28 friend class MakroAction; 31 //!> grant unit test access to private sequence32 friend class ::ActionSequenceTest;33 29 public: 34 30 typedef std::deque<Action*> actionSet; -
src/Actions/Action_impl_pre.hpp
r3fa16b r19dfdf 175 175 << "\"" << toPythonString(params. \ 176 176 BOOST_PP_SEQ_ELEM(n, paramreferences) \ 177 .get Unvalidated()) \177 .get()) \ 178 178 << "\""; 179 179 -
src/Actions/BondAction/BondAddAction.cpp
r3fa16b r19dfdf 57 57 ActionState::ptr BondAddAction::performCall() { 58 58 // check preconditions 59 World& world = World::getInstance(); 60 if (world.countSelectedAtoms() <= 1) { 61 STATUS("There must be at least two atoms selected for BondAction Add."); 59 if (World::getInstance().countSelectedAtoms() != 2) { 60 STATUS("Exactly two atoms must be selected for BondAction Add."); 62 61 return Action::failure; 63 62 } 64 65 bondPairIds_t bondPairIds; 66 for (World::AtomSelectionConstIterator firstiter = world.beginAtomSelection(); 67 firstiter != world.endAtomSelection(); ++firstiter) { 68 for (World::AtomSelectionConstIterator seconditer = firstiter; 69 seconditer != world.endAtomSelection(); ++seconditer) { 70 if (firstiter == seconditer) 71 continue; 72 if (!(firstiter->second)->IsBondedTo(WorldTime::getTime(), seconditer->second)) 73 bondPairIds.push_back( 74 std::make_pair((firstiter->second)->getId(), (seconditer->second)->getId())); 75 } 76 } 77 if (bondPairIds.empty()) { 78 STATUS("All bonds are already present."); 63 const std::vector<atom *> selected_atoms = World::getInstance().getSelectedAtoms(); 64 if (selected_atoms[0]->IsBondedTo(WorldTime::getTime(), selected_atoms[1])) { 65 STATUS("There already is a bond in between the two selected atoms."); 79 66 return Action::failure; 80 67 } 81 68 82 69 // create undo 83 BondAddState *UndoState = new BondAddState( bondPairIds, params);70 BondAddState *UndoState = new BondAddState(selected_atoms[0]->getId(), selected_atoms[1]->getId(), params); 84 71 85 72 // execute action 86 for (bondPairIds_t::const_iterator iter = bondPairIds.begin(); 87 iter != bondPairIds.end(); ++iter) { 88 atom *firstatom = world.getAtom(AtomById(iter->first)); 89 atom *secondatom = world.getAtom(AtomById(iter->second)); 90 ASSERT((firstatom != NULL) && (secondatom != NULL), 91 "BondAddAction::performCall() - at least one of the ids " 92 +toString(iter->first)+" or "+toString(iter->second)+" is not present."); 93 firstatom->addBond(WorldTime::getTime(), secondatom); 94 ASSERT( firstatom->IsBondedTo(WorldTime::getTime(), secondatom), 73 selected_atoms[0]->addBond(WorldTime::getTime(), selected_atoms[1]); 74 ASSERT( selected_atoms[0]->IsBondedTo(WorldTime::getTime(), selected_atoms[1]), 95 75 "BondAddAction::performCall() - adding bond in between " 96 +toString(*firstatom)+" and "+toString(*secondatom)+" failed."); 97 } 76 +toString(*selected_atoms[0])+" and "+toString(*selected_atoms[1])+" failed."); 98 77 99 78 return ActionState::ptr(UndoState); … … 104 83 105 84 // check whether bond already existed 106 World& world = World::getInstance(); 107 for (bondPairIds_t::const_iterator iter = state->bondPairIds.begin(); 108 iter != state->bondPairIds.end(); ++iter) { 109 atom *firstatom = world.getAtom(AtomById(iter->first)); 110 atom *secondatom = world.getAtom(AtomById(iter->second)); 111 ASSERT((firstatom != NULL) && (secondatom != NULL), 112 "BondAddAction::performCall() - at least one of the ids " 113 +toString(iter->first)+" or "+toString(iter->second)+" is not present."); 114 if (firstatom->IsBondedTo(WorldTime::getTime(), secondatom)) { 115 firstatom->removeBond(WorldTime::getTime(), secondatom); 116 } else { 117 ELOG(2, "There is no bond in between "+toString(iter->first) 118 +" and "+toString(iter->second)+"."); 119 } 85 atom * const first = World::getInstance().getAtom(AtomById(state->firstId)); 86 atom * const second = World::getInstance().getAtom(AtomById(state->secondId)); 87 ASSERT((first != NULL) && (second != NULL), 88 "BondAddAction::performUndo() - at least one of the ids " 89 +toString(state->firstId)+" or "+toString(state->secondId)+" is not present."); 90 if (first->IsBondedTo(WorldTime::getTime(), second)) { 91 first->removeBond(WorldTime::getTime(), second); 92 } else { 93 ELOG(2, "There is no bond in between "+toString(state->firstId) 94 +" and "+toString(state->secondId)+"."); 120 95 } 121 96 … … 127 102 128 103 // check whether bond already existed 129 World& world = World::getInstance(); 130 for (bondPairIds_t::const_iterator iter = state->bondPairIds.begin(); 131 iter != state->bondPairIds.end(); ++iter) { 132 atom * const firstatom = world.getAtom(AtomById(iter->first)); 133 atom * const secondatom = world.getAtom(AtomById(iter->second)); 134 ASSERT((firstatom != NULL) && (secondatom != NULL), 135 "BondAddAction::performCall() - at least one of the ids " 136 +toString(iter->first)+" or "+toString(iter->second)+" is not present."); 137 if (!firstatom->IsBondedTo(WorldTime::getTime(), secondatom)) { 138 firstatom->addBond(WorldTime::getTime(), secondatom); 139 } else { 140 ELOG(2, "There is already a bond in between "+toString(iter->first) 141 +" and "+toString(iter->second)+"."); 142 } 104 atom * const first = World::getInstance().getAtom(AtomById(state->firstId)); 105 atom * const second = World::getInstance().getAtom(AtomById(state->secondId)); 106 ASSERT((first != NULL) && (second != NULL), 107 "BondAddAction::performRedo() - at least one of the ids " 108 +toString(state->firstId)+" or "+toString(state->secondId)+" is not present."); 109 if (!first->IsBondedTo(WorldTime::getTime(), second)) { 110 first->addBond(WorldTime::getTime(), second); 111 } else { 112 ELOG(2, "There is already a bond in between "+toString(state->firstId) 113 +" and "+toString(state->secondId)+"."); 143 114 } 144 115 -
src/Actions/BondAction/BondAddAction.def
r3fa16b r19dfdf 8 8 // all includes and forward declarations necessary for non-integral types below 9 9 #include "types.hpp" 10 #include <vector>11 #include <utility>12 13 typedef std::vector<std::pair<atomId_t,atomId_t> > bondPairIds_t;14 10 15 11 // i.e. there is an integer with variable name Z that can be found in … … 24 20 #undef paramvalids 25 21 26 #define statetypes ( bondPairIds_t)27 #define statereferences ( bondPairIds)22 #define statetypes (atomId_t)(atomId_t) 23 #define statereferences (firstId)(secondId) 28 24 29 25 // some defines for all the names, you may use ACTION, STATE and PARAMS … … 32 28 #define MENUPOSITION 1 33 29 #define ACTIONNAME Add 34 #define TOKEN "add-bond s"30 #define TOKEN "add-bond" 35 31 36 32 // finally the information stored in the ActionTrait specialization 37 #define DESCRIPTION "add bond s in between any number ofselected atoms"33 #define DESCRIPTION "add bond in between two selected atoms" 38 34 #undef SHORTFORM -
src/Actions/BondAction/BondRemoveAction.cpp
r3fa16b r19dfdf 57 57 ActionState::ptr BondRemoveAction::performCall() { 58 58 // check preconditions 59 World& world = World::getInstance(); 60 if (world.countSelectedAtoms() <= 1) { 61 STATUS("At least two atoms must be selected for BondAction Remove."); 59 if (World::getInstance().countSelectedAtoms() != 2) { 60 STATUS("Exactly two atoms must be selected for BondAction Remove."); 62 61 return Action::failure; 63 62 } 64 65 bondPairIds_t bondPairIds; 66 for (World::AtomSelectionConstIterator firstiter = world.beginAtomSelection(); 67 firstiter != world.endAtomSelection(); ++firstiter) { 68 for (World::AtomSelectionConstIterator seconditer = firstiter; 69 seconditer != world.endAtomSelection(); ++seconditer) { 70 if (firstiter == seconditer) 71 continue; 72 if ((firstiter->second)->IsBondedTo(WorldTime::getTime(), seconditer->second)) 73 bondPairIds.push_back( 74 std::make_pair((firstiter->second)->getId(), (seconditer->second)->getId())); 75 } 76 } 77 if (bondPairIds.empty()) { 78 STATUS("No bonds are present."); 63 const std::vector<atom *> selected_atoms = World::getInstance().getSelectedAtoms(); 64 if (!selected_atoms[0]->IsBondedTo(WorldTime::getTime(), selected_atoms[1])) { 65 STATUS("There is no bond in between the two selected atoms."); 79 66 return Action::failure; 80 67 } 81 68 82 69 // create undo 83 BondRemoveState *UndoState = new BondRemoveState( bondPairIds, params);70 BondRemoveState *UndoState = new BondRemoveState(selected_atoms[0]->getId(), selected_atoms[1]->getId(), params); 84 71 85 72 // execute action 86 for (bondPairIds_t::const_iterator iter = bondPairIds.begin(); 87 iter != bondPairIds.end(); ++iter) { 88 atom *firstatom = world.getAtom(AtomById(iter->first)); 89 atom *secondatom = world.getAtom(AtomById(iter->second)); 90 ASSERT((firstatom != NULL) && (secondatom != NULL), 91 "BondAddAction::performCall() - at least one of the ids " 92 +toString(iter->first)+" or "+toString(iter->second)+" is not present."); 93 firstatom->removeBond(WorldTime::getTime(), secondatom); 94 ASSERT( !firstatom->IsBondedTo(WorldTime::getTime(), secondatom), 95 "BondAddAction::performCall() - adding bond in between " 96 +toString(*firstatom)+" and "+toString(*secondatom)+" failed."); 97 } 73 selected_atoms[0]->removeBond(WorldTime::getTime(), selected_atoms[1]); 74 ASSERT( !selected_atoms[0]->IsBondedTo(WorldTime::getTime(), selected_atoms[1]), 75 "BondRemoveAction::performCall() - removing bond in between " 76 +toString(*selected_atoms[0])+" and "+toString(*selected_atoms[1])+" failed."); 98 77 99 78 return ActionState::ptr(UndoState); … … 103 82 BondRemoveState *state = assert_cast<BondRemoveState*>(_state.get()); 104 83 105 World& world = World::getInstance(); 106 for (bondPairIds_t::const_iterator iter = state->bondPairIds.begin(); 107 iter != state->bondPairIds.end(); ++iter) { 108 atom * const firstatom = world.getAtom(AtomById(iter->first)); 109 atom * const secondatom = world.getAtom(AtomById(iter->second)); 110 ASSERT((firstatom != NULL) && (secondatom != NULL), 111 "BondAddAction::performCall() - at least one of the ids " 112 +toString(iter->first)+" or "+toString(iter->second)+" is not present."); 113 if (!firstatom->IsBondedTo(WorldTime::getTime(), secondatom)) { 114 firstatom->addBond(WorldTime::getTime(), secondatom); 115 } else { 116 ELOG(2, "There is already a bond in between "+toString(iter->first) 117 +" and "+toString(iter->second)+"."); 118 } 84 // check whether bond already existed 85 atom * const first = World::getInstance().getAtom(AtomById(state->firstId)); 86 atom * const second = World::getInstance().getAtom(AtomById(state->secondId)); 87 ASSERT((first != NULL) && (second != NULL), 88 "BondRemoveAction::performUndo() - at least one of the ids " 89 +toString(state->firstId)+" or "+toString(state->secondId)+" is not present."); 90 if (!first->IsBondedTo(WorldTime::getTime(), second)) { 91 first->addBond(WorldTime::getTime(), second); 92 } else { 93 ELOG(2, "There is already a bond in between "+toString(state->firstId) 94 +" and "+toString(state->secondId)+"."); 119 95 } 120 96 … … 125 101 BondRemoveState *state = assert_cast<BondRemoveState*>(_state.get()); 126 102 127 World& world = World::getInstance(); 128 for (bondPairIds_t::const_iterator iter = state->bondPairIds.begin(); 129 iter != state->bondPairIds.end(); ++iter) { 130 atom *firstatom = world.getAtom(AtomById(iter->first)); 131 atom *secondatom = world.getAtom(AtomById(iter->second)); 132 ASSERT((firstatom != NULL) && (secondatom != NULL), 133 "BondAddAction::performCall() - at least one of the ids " 134 +toString(iter->first)+" or "+toString(iter->second)+" is not present."); 135 if (firstatom->IsBondedTo(WorldTime::getTime(), secondatom)) { 136 firstatom->removeBond(WorldTime::getTime(), secondatom); 137 } else { 138 ELOG(2, "There is no bond in between "+toString(iter->first) 139 +" and "+toString(iter->second)+"."); 140 } 103 // check whether bond already existed 104 atom * const first = World::getInstance().getAtom(AtomById(state->firstId)); 105 atom * const second = World::getInstance().getAtom(AtomById(state->secondId)); 106 ASSERT((first != NULL) && (second != NULL), 107 "BondRemoveAction::performRedo() - at least one of the ids " 108 +toString(state->firstId)+" or "+toString(state->secondId)+" is not present."); 109 if (first->IsBondedTo(WorldTime::getTime(), second)) { 110 first->removeBond(WorldTime::getTime(), second); 111 } else { 112 ELOG(2, "There is no bond in between "+toString(state->firstId) 113 +" and "+toString(state->secondId)+"."); 141 114 } 142 115 -
src/Actions/BondAction/BondRemoveAction.def
r3fa16b r19dfdf 7 7 8 8 // all includes and forward declarations necessary for non-integral types below 9 #include "types.hpp"10 #include <vector>11 #include <utility>12 13 typedef std::vector<std::pair<atomId_t,atomId_t> > bondPairIds_t;14 9 15 10 // i.e. there is an integer with variable name Z that can be found in … … 24 19 #undef paramvalids 25 20 26 #define statetypes ( bondPairIds_t)27 #define statereferences ( bondPairIds)21 #define statetypes (atomId_t)(atomId_t) 22 #define statereferences (firstId)(secondId) 28 23 29 24 // some defines for all the names, you may use ACTION, STATE and PARAMS … … 32 27 #define MENUPOSITION 2 33 28 #define ACTIONNAME Remove 34 #define TOKEN "remove-bond s"29 #define TOKEN "remove-bond" 35 30 36 31 // finally the information stored in the ActionTrait specialization 37 #define DESCRIPTION "remove all bonds present betweenselected atoms"32 #define DESCRIPTION "remove the bond in between two selected atoms" 38 33 #undef SHORTFORM -
src/Actions/CommandAction/LoadSessionAction.cpp
r3fa16b r19dfdf 58 58 59 59 #ifdef HAVE_PYTHON 60 if (executePythonScript File(params.filename.get()))60 if (executePythonScript(params.filename.get().string())) 61 61 return Action::success; 62 62 else { -
src/Actions/CommandAction/VerboseAction.cpp
r3fa16b r19dfdf 52 52 unsigned int oldverbosity = getVerbosity(); 53 53 54 // prepare undo state55 CommandVerboseState *UndoState = new CommandVerboseState(oldverbosity, params);56 57 54 if (oldverbosity != params.verbosity.get()) { 55 // prepare undo state 56 CommandVerboseState *UndoState = new CommandVerboseState(oldverbosity, params); 58 57 // set new verbosity 59 58 setVerbosity(params.verbosity.get()); 60 59 LOG(0, "Setting verbosity from " << oldverbosity << " to " << params.verbosity.get() << "."); 60 return ActionState::ptr(UndoState); 61 61 } else { 62 62 LOG(0, "Verbosity remains unchanged at " << oldverbosity << "."); 63 return Action::success; 63 64 } 64 return ActionState::ptr(UndoState);65 65 } 66 66 -
src/Actions/FragmentationAction/FragmentationAction.cpp
r3fa16b r19dfdf 129 129 BondGraph *BG = World::getInstance().getBondGraph(); 130 130 World::AtomComposite Set = World::getInstance().getAllAtoms(AtomsBySelection()); 131 // check whether bond graph is correct 132 if (!BG->checkBondDegree(Set)) 133 BG->CorrectBondDegree(Set); 134 else 135 LOG(1, "INFO: Bond degrees all valid, not correcting."); 131 BG->CorrectBondDegree(Set); 136 132 } 137 133 -
src/Actions/FragmentationAction/FragmentationAutomationAction.cpp
r3fa16b r19dfdf 134 134 // Phase One: obtain ids 135 135 mpqccontroller.requestIds(NumberJobs); 136 if (mpqccontroller.getExitflag() != 0)137 return Action::failure;138 136 139 137 // Phase Two: add MPQCJobs and send … … 161 159 wait_thread.join(); 162 160 stop(); 163 if (mpqccontroller.getExitflag() != 0)164 return Action::failure;165 166 161 mpqccontroller.getResults(shortrangedata); 167 if (mpqccontroller.getExitflag() != 0)168 return Action::failure;169 162 170 163 Exitflag += mpqccontroller.getExitflag(); … … 196 189 mpqccontroller.run(); 197 190 stop(); 198 if (mpqccontroller.getExitflag() != 0)199 return Action::failure;200 191 201 192 // get back the results and place them in shortrangedata … … 204 195 "FragmentationFragmentationAutomationAction::performCall() - number of converted results " 205 196 +toString(shortrangedata.size())+" and number of jobs "+toString(NumberJobs)+ " differ."); 206 if (mpqccontroller.getExitflag() != 0)207 return Action::failure;208 197 209 198 Exitflag += mpqccontroller.getExitflag(); … … 245 234 const size_t NoJobs = shortrangedata.size()+full_sample.size(); 246 235 vmgcontroller.requestIds(2*NoJobs); 247 if (vmgcontroller.getExitflag() != 0)248 return Action::failure;249 236 250 237 // Phase Five a: create VMGJobs for electronic charge distribution … … 267 254 // Phase Six a: calculate result 268 255 vmgcontroller.waitforResults(NoJobs); 269 if (vmgcontroller.getExitflag() != 0)270 return Action::failure;271 256 vmgcontroller.getResults(longrangedata); 272 257 ASSERT( NoJobs == longrangedata.size(), … … 297 282 // Phase Six b: calculate result 298 283 vmgcontroller.waitforResults(NoJobs); 299 if (vmgcontroller.getExitflag() != 0)300 return Action::failure;301 284 vmgcontroller.getResults(longrangedata_both); 302 285 ASSERT( NoJobs == longrangedata_both.size(), … … 304 287 +toString(full_sample.size())+"="+toString(NoJobs) 305 288 +" and second VMGresults "+toString(longrangedata_both.size())+" don't match."); 306 if (vmgcontroller.getExitflag() != 0)307 return Action::failure;308 289 Exitflag += vmgcontroller.getExitflag(); 309 290 -
src/Actions/FragmentationAction/MolecularDynamicsAction.cpp
r3fa16b r19dfdf 54 54 55 55 // static instances 56 ActionSequence FragmentationMolecularDynamicsAction:: prototype_actions;56 ActionSequence FragmentationMolecularDynamicsAction::actions; 57 57 bool FragmentationMolecularDynamicsAction::isPrepared = false; 58 58 … … 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 prototype_actions.addAction(AR.getActionByName(std::string("verlet-integration"))); 65 prototype_actions.addAction(AR.getActionByName(std::string("output"))); 66 prototype_actions.addAction(AR.getActionByName(std::string("clear-fragment-results"))); 67 prototype_actions.addAction(AR.getActionByName(std::string("destroy-adjacency"))); 68 prototype_actions.addAction(AR.getActionByName(std::string("create-adjacency"))); 69 prototype_actions.addAction(AR.getActionByName(std::string("correct-bonddegree"))); 70 prototype_actions.addAction(AR.getActionByName(std::string("update-molecules"))); 71 prototype_actions.addAction(AR.getActionByName(std::string("fragment-molecule"))); 72 prototype_actions.addAction(AR.getActionByName(std::string("fragment-automation"))); 73 prototype_actions.addAction(AR.getActionByName(std::string("analyse-fragment-results"))); 64 actions.addAction(AR.getActionByName(std::string("verlet-integration"))); 65 actions.addAction(AR.getActionByName(std::string("output"))); 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"))); 70 actions.addAction(AR.getActionByName(std::string("fragment-molecule"))); 71 actions.addAction(AR.getActionByName(std::string("fragment-automation"))); 72 actions.addAction(AR.getActionByName(std::string("analyse-fragment-results"))); 74 73 isPrepared = true; 75 74 } … … 78 77 { 79 78 // empty sequence 80 while ( prototype_actions.removeLastAction() != NULL);79 while (actions.removeLastAction() != NULL); 81 80 isPrepared = false; 82 81 } … … 107 106 #endif 108 107 removeAction(std::string("create-adjacency")); 109 110 #ifndef NDEBUG111 status &=112 #endif113 removeAction(std::string("correct-bonddegree"));114 108 115 109 #ifndef NDEBUG -
src/Actions/FragmentationAction/StructuralOptimizationAction.cpp
r3fa16b r19dfdf 54 54 55 55 // static instances 56 ActionSequence FragmentationStructuralOptimizationAction:: prototype_actions;56 ActionSequence FragmentationStructuralOptimizationAction::actions; 57 57 bool FragmentationStructuralOptimizationAction::isPrepared = false; 58 58 … … 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 prototype_actions.addAction(AR.getActionByName(std::string("destroy-adjacency"))); 65 prototype_actions.addAction(AR.getActionByName(std::string("create-adjacency"))); 66 prototype_actions.addAction(AR.getActionByName(std::string("correct-bonddegree"))); 67 prototype_actions.addAction(AR.getActionByName(std::string("update-molecules"))); 68 prototype_actions.addAction(AR.getActionByName(std::string("fragment-molecule"))); 69 prototype_actions.addAction(AR.getActionByName(std::string("fragment-automation"))); 70 prototype_actions.addAction(AR.getActionByName(std::string("analyse-fragment-results"))); 71 prototype_actions.addAction(AR.getActionByName(std::string("force-annealing"))); 72 prototype_actions.addAction(AR.getActionByName(std::string("output"))); 73 prototype_actions.addAction(AR.getActionByName(std::string("clear-fragment-results"))); 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"))); 67 actions.addAction(AR.getActionByName(std::string("fragment-molecule"))); 68 actions.addAction(AR.getActionByName(std::string("fragment-automation"))); 69 actions.addAction(AR.getActionByName(std::string("analyse-fragment-results"))); 70 actions.addAction(AR.getActionByName(std::string("force-annealing"))); 71 actions.addAction(AR.getActionByName(std::string("output"))); 72 actions.addAction(AR.getActionByName(std::string("clear-fragment-results"))); 74 73 isPrepared = true; 75 74 } … … 78 77 { 79 78 // empty sequence 80 while ( prototype_actions.removeLastAction() != NULL);79 while (actions.removeLastAction() != NULL); 81 80 isPrepared = false; 82 81 } … … 107 106 #endif 108 107 removeAction(std::string("create-adjacency")); 109 110 #ifndef NDEBUG111 status &=112 #endif113 removeAction(std::string("correct-bonddegree"));114 108 115 109 #ifndef NDEBUG -
src/Actions/GlobalListOfActions.hpp
r3fa16b r19dfdf 35 35 (AtomRemove) \ 36 36 (AtomRotateAroundOriginByAngle) \ 37 (AtomSaturate) \38 37 (AtomSaveSelectedAtoms) \ 39 38 (AtomTranslate) \ … … 41 40 (BondAdd) \ 42 41 (BondRemove) \ 43 (CommandDryRun) \44 42 (CommandElementDb) \ 45 43 (CommandBondLengthTable) \ … … 47 45 (CommandHelp) \ 48 46 (CommandHelpRedistribute) \ 49 (CommandNoDryRun) \50 47 (CommandSetRandomNumbersEngine) \ 51 48 (CommandSetRandomNumbersDistribution) \ -
src/Actions/GraphAction/SubgraphDissectionAction.cpp
r3fa16b r19dfdf 58 58 59 59 // static instances 60 ActionSequence GraphSubgraphDissectionAction:: prototype_actions;60 ActionSequence GraphSubgraphDissectionAction::actions; 61 61 bool GraphSubgraphDissectionAction::isPrepared = false; 62 62 63 63 void GraphSubgraphDissectionAction::prepare(ActionRegistry &AR) 64 64 { 65 prototype_actions.addAction(AR.getActionByName(std::string("push-atom-selection")));66 prototype_actions.addAction(AR.getActionByName(std::string("select-all-atoms")));67 prototype_actions.addAction(AR.getActionByName(std::string("destroy-adjacency")));68 prototype_actions.addAction(AR.getActionByName(std::string("create-adjacency")));69 prototype_actions.addAction(AR.getActionByName(std::string("update-molecules")));70 prototype_actions.addAction(AR.getActionByName(std::string("pop-atom-selection")));65 actions.addAction(AR.getActionByName(std::string("push-atom-selection"))); 66 actions.addAction(AR.getActionByName(std::string("select-all-atoms"))); 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"))); 70 actions.addAction(AR.getActionByName(std::string("pop-atom-selection"))); 71 71 isPrepared = true; 72 72 } … … 75 75 { 76 76 // empty sequence 77 while ( prototype_actions.removeLastAction() != NULL);77 while (actions.removeLastAction() != NULL); 78 78 isPrepared = false; 79 79 } -
src/Actions/Makefile.am
r3fa16b r19dfdf 41 41 Actions/Calculation.hpp \ 42 42 Actions/Calculation_impl.hpp \ 43 Actions/DryRunAdvocate.hpp \44 43 Actions/ErrorAction.hpp \ 45 44 Actions/GlobalListOfActions.hpp \ … … 151 150 Actions/AtomAction/RemoveAction.cpp \ 152 151 Actions/AtomAction/RotateAroundOriginByAngleAction.cpp \ 153 Actions/AtomAction/SaturateAction.cpp \154 152 Actions/AtomAction/SaveSelectedAtomsAction.cpp \ 155 153 Actions/AtomAction/TranslateAction.cpp \ … … 161 159 Actions/AtomAction/RemoveAction.hpp \ 162 160 Actions/AtomAction/RotateAroundOriginByAngleAction.hpp \ 163 Actions/AtomAction/SaturateAction.hpp \164 161 Actions/AtomAction/SaveSelectedAtomsAction.hpp \ 165 162 Actions/AtomAction/TranslateAction.hpp \ … … 171 168 Actions/AtomAction/RemoveAction.def \ 172 169 Actions/AtomAction/RotateAroundOriginByAngleAction.def \ 173 Actions/AtomAction/SaturateAction.def \174 170 Actions/AtomAction/SaveSelectedAtomsAction.def \ 175 171 Actions/AtomAction/TranslateAction.def \ … … 188 184 CMDACTIONSOURCE = \ 189 185 Actions/CommandAction/BondLengthTableAction.cpp \ 190 Actions/CommandAction/DryRunAction.cpp \191 186 Actions/CommandAction/ElementDbAction.cpp \ 192 187 Actions/CommandAction/FastParsingAction.cpp \ 193 188 Actions/CommandAction/HelpAction.cpp \ 194 189 Actions/CommandAction/HelpRedistributeAction.cpp \ 195 Actions/CommandAction/NoDryRunAction.cpp \196 190 Actions/CommandAction/StoreSessionAction.cpp \ 197 191 Actions/CommandAction/VerboseAction.cpp \ … … 200 194 CMDACTIONHEADER = \ 201 195 Actions/CommandAction/BondLengthTableAction.hpp \ 202 Actions/CommandAction/DryRunAction.hpp \203 196 Actions/CommandAction/ElementDbAction.hpp \ 204 197 Actions/CommandAction/FastParsingAction.hpp \ 205 198 Actions/CommandAction/HelpAction.hpp \ 206 199 Actions/CommandAction/HelpRedistributeAction.hpp \ 207 Actions/CommandAction/NoDryRunAction.hpp \208 200 Actions/CommandAction/StoreSessionAction.hpp \ 209 201 Actions/CommandAction/VerboseAction.hpp \ … … 212 204 CMDACTIONDEFS = \ 213 205 Actions/CommandAction/BondLengthTableAction.def \ 214 Actions/CommandAction/DryRunAction.def \215 206 Actions/CommandAction/ElementDbAction.def \ 216 207 Actions/CommandAction/FastParsingAction.def \ 217 208 Actions/CommandAction/HelpAction.def \ 218 209 Actions/CommandAction/HelpRedistributeAction.def \ 219 Actions/CommandAction/NoDryRunAction.def \220 210 Actions/CommandAction/StoreSessionAction.def \ 221 211 Actions/CommandAction/VerboseAction.def \ -
src/Actions/MakroAction.cpp
r3fa16b r19dfdf 60 60 ActionSequence::stateSet states; 61 61 }; 62 63 MakroAction::MakroAction(const MakroAction &_instance) :64 Action(_instance.Traits),65 actions(_instance.actions)66 {}67 62 68 63 MakroAction::MakroAction(const ActionTrait &_trait,ActionSequence& _actions) : -
src/Actions/MakroAction.hpp
r3fa16b r19dfdf 18 18 19 19 #include "Actions/Action.hpp" 20 #include "Actions/ActionSequence.hpp"21 22 class ActionSequenceTest;23 20 24 21 namespace MoleCuilder { 25 22 class ActionRegistry; 23 class ActionSequence; 26 24 27 25 /** … … 32 30 class MakroAction : public Action 33 31 { 34 //!> grant unit test access to sequence35 friend class ::ActionSequenceTest;36 32 public: 37 MakroAction(const MakroAction &_instance);38 33 MakroAction(const ActionTrait &_trait,ActionSequence& _actions); 39 34 virtual ~MakroAction(); … … 83 78 Dialog *fillDialog(Dialog *dialog); 84 79 85 //!> this points to the instance of a specific MakroAction, we need to ref for callAll()86 80 ActionSequence &actions; 87 81 }; -
src/Actions/MakroAction_impl_header.hpp
r3fa16b r19dfdf 263 263 //!> flag to check whether actions have been prepared 264 264 static bool isPrepared; 265 //!> sequence of prototype actions for this macro action 266 static ActionSequence prototype_actions; 267 //!> sequence of actions for this specific instance 268 ActionSequence actions; 265 //!> sequence of actions for this macro action 266 static ActionSequence actions; 269 267 270 268 private: -
src/Actions/MakroAction_impl_pre.hpp
r3fa16b r19dfdf 263 263 // =========== constructor =========== 264 264 ACTION::ACTION () : 265 MakroAction(ActionTraits< ACTION >(), actions), 266 actions(prototype_actions) 265 MakroAction(ActionTraits< ACTION >(), actions) 267 266 {} 268 267 … … 295 294 Action* ACTION::clone(enum QueryOptions flag) const 296 295 { 297 return new ACTION(); 296 if (flag == Interactive) 297 return new ACTION(); 298 else 299 return new ACTION(*this); 298 300 } 299 301 -
src/Actions/MoleculeAction/TranslateAction.cpp
r3fa16b r19dfdf 56 56 57 57 // static instances 58 ActionSequence MoleculeTranslateAction:: prototype_actions;58 ActionSequence MoleculeTranslateAction::actions; 59 59 bool MoleculeTranslateAction::isPrepared = false; 60 60 … … 63 63 // we simply have to select all the molecule's atoms and use the respective 64 64 // translate Action 65 prototype_actions.addAction(AR.getActionByName(std::string("push-atom-selection")));66 prototype_actions.addAction(AR.getActionByName(std::string("select-molecules-atoms")));67 prototype_actions.addAction(AR.getActionByName(std::string("translate-atoms")));68 prototype_actions.addAction(AR.getActionByName(std::string("pop-atom-selection")));65 actions.addAction(AR.getActionByName(std::string("push-atom-selection"))); 66 actions.addAction(AR.getActionByName(std::string("select-molecules-atoms"))); 67 actions.addAction(AR.getActionByName(std::string("translate-atoms"))); 68 actions.addAction(AR.getActionByName(std::string("pop-atom-selection"))); 69 69 isPrepared = true; 70 70 } … … 73 73 { 74 74 // empty sequence 75 while ( prototype_actions.removeLastAction() != NULL);75 while (actions.removeLastAction() != NULL); 76 76 isPrepared = false; 77 77 } -
src/Actions/ParserAction/SetParserParametersAction.cpp
r3fa16b r19dfdf 66 66 // obtain information 67 67 std::stringstream newparamstream; 68 const std::vector< KeyValuePair> keyvalues = params.newparams.get();68 const std::vector< std::string > keyvalues = params.newparams.get(); 69 69 std::for_each(keyvalues.begin(), keyvalues.end(), newparamstream << boost::lambda::_1 << ";"); 70 70 newparamstream >> *parameters; … … 90 90 FormatParser_Parameters *parser = FormatParserStorage::getInstance().get(type).parameters; 91 91 std::stringstream newparamstream; 92 const std::vector< KeyValuePair> keyvalues = state->params.newparams.get();92 const std::vector< std::string > keyvalues = state->params.newparams.get(); 93 93 std::for_each(keyvalues.begin(), keyvalues.end(), newparamstream << boost::lambda::_1 << ";"); 94 94 newparamstream >> *parser; -
src/Actions/ParserAction/SetParserParametersAction.def
r3fa16b r19dfdf 13 13 #include "Parameters/Validators/Specific/KeyValueValidator.hpp" 14 14 #include "Parameters/Validators/Specific/ParserTypeValidator.hpp" 15 #include "Parameters/Specifics/KeyValuePair.hpp"16 15 17 16 // i.e. there is an integer with variable name Z that can be found in 18 17 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 19 18 // "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value 20 #define paramtypes (std::string)(std::vector< KeyValuePair>)19 #define paramtypes (std::string)(std::vector<std::string>) 21 20 #define paramtokens ("set-parser-parameters")("parser-parameters") 22 21 #define paramdescriptions ("name of the parser to change")("parameter (key = value;)") … … 25 24 #define paramvalids \ 26 25 (ParserTypeValidator())\ 27 (STLVectorValidator< std::vector< KeyValuePair> >(1, 99, KeyValueValidator()))26 (STLVectorValidator< std::vector<std::string> >(1, 99, KeyValueValidator())) 28 27 29 28 #define statetypes (std::string) -
src/Actions/RandomNumbersAction/SetRandomNumbersDistributionAction.def
r3fa16b r19dfdf 11 11 #include "Parameters/Validators/Specific/RandomNumberValidators.hpp" 12 12 #include "Parameters/Validators/Specific/KeyValueValidator.hpp" 13 #include "Parameters/Specifics/KeyValuePair.hpp"14 13 15 14 // i.e. there is an integer with variable name Z that can be found in 16 15 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 17 16 // "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value 18 #define paramtypes (std::string)( KeyValuePair)17 #define paramtypes (std::string)(std::string) 19 18 #define paramtokens ("set-random-number-distribution")("random-number-distribution-parameters") 20 19 #define paramdescriptions ("name of the distribution from boost::random")("parameter set for requested distribution") 21 #define paramdefaults (NOPARAM_DEFAULT)(PARAM_DEFAULT( KeyValuePair("p=-1")))20 #define paramdefaults (NOPARAM_DEFAULT)(PARAM_DEFAULT(std::string("p=-1"))) 22 21 #define paramreferences (distribution_type)(parameters) 23 22 #define paramvalids \ -
src/Actions/RandomNumbersAction/SetRandomNumbersEngineAction.def
r3fa16b r19dfdf 10 10 #include "Parameters/Validators/Specific/RandomNumberValidators.hpp" 11 11 #include "Parameters/Validators/Specific/KeyValueValidator.hpp" 12 #include "Parameters/Specifics/KeyValuePair.hpp"13 12 14 13 // i.e. there is an integer with variable name Z that can be found in 15 14 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 16 15 // "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value 17 #define paramtypes (std::string)( KeyValuePair)16 #define paramtypes (std::string)(std::string) 18 17 #define paramtokens ("set-random-number-engine")("random-number-engine-parameters") 19 18 #define paramdescriptions ("name of the pseudo-random engine from boost::random")("seed of the pseudo-random number sequence") 20 #define paramdefaults (NOPARAM_DEFAULT)(PARAM_DEFAULT( KeyValuePair("seed=-1")))19 #define paramdefaults (NOPARAM_DEFAULT)(PARAM_DEFAULT(std::string("seed=-1"))) 21 20 #define paramreferences (engine_type)(parameters) 22 21 #define paramvalids \ -
src/Actions/SelectionAction/Atoms/PopAtomsAction.cpp
r3fa16b r19dfdf 63 63 ActionState::ptr SelectionPopAtomsAction::performUndo(ActionState::ptr _state) { 64 64 SelectionPopAtomsState *state = static_cast<SelectionPopAtomsState *>(_state.get()); 65 LOG(1, "P ushing atom selection.");65 LOG(1, "Popping atom selection."); 66 66 World::getInstance().pushAtomSelection(); 67 67 -
src/Actions/SelectionAction/Atoms/PushAtomsAction.cpp
r3fa16b r19dfdf 54 54 55 55 ActionState::ptr SelectionPushAtomsAction::performUndo(ActionState::ptr _state) { 56 LOG(1, "P opping atom selection.");56 LOG(1, "Pushing atom selection."); 57 57 World::getInstance().popAtomSelection(); 58 58 -
src/Actions/SelectionAction/Molecules/MoleculeOfAtomAction.cpp
r3fa16b r19dfdf 55 55 ActionState::ptr SelectionMoleculeOfAtomAction::performCall() { 56 56 std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules(); 57 LOG(1, "Selecting molecule to currently selected atoms : " << World::getInstance().countSelectedAtoms());57 LOG(1, "Selecting molecule to currently selected atoms."); 58 58 World::getInstance().selectAllMolecules(MoleculesByAtomSelection()); 59 59 LOG(0, World::getInstance().countSelectedMolecules() << " molecules selected."); -
src/Actions/UndoRedoHelpers.cpp
r3fa16b r19dfdf 131 131 { 132 132 bool status = true; 133 std::vector< BondInfo >::const_iterator iter = bonds.begin();134 for(;iter != bonds.end(); ++iter) {135 if (!(*iter).RecreateBond()) {133 for(std::vector< BondInfo >::const_iterator iter = bonds.begin(); 134 iter != bonds.end(); ++iter) 135 if (!(*iter).RecreateBond()) 136 136 status = false; 137 break;138 }139 }140 if (!status) {141 // remove all added bonds again142 for(std::vector< BondInfo >::const_iterator removeiter = bonds.begin();143 removeiter != iter; ++removeiter) {144 removeiter->RemoveBond();145 }146 }147 137 return status; 148 138 } -
src/Actions/Values.cpp
r3fa16b r19dfdf 37 37 #include "CodePatterns/Assert.hpp" 38 38 39 #include "Box.hpp"40 39 #include "LinearAlgebra/BoxVector.hpp" 41 40 #include "LinearAlgebra/RealSpaceMatrix.hpp" 42 41 #include "LinearAlgebra/Vector.hpp" 42 #include "Box.hpp" 43 43 44 44 #include "Values.hpp" -
src/Actions/Values.hpp
r3fa16b r19dfdf 15 15 16 16 #include "LinearAlgebra/defs.hpp" 17 18 #include <string>19 17 20 18 class Box; … … 47 45 }; 48 46 47 49 48 #endif /* VALUES_HPP_ */ 50 -
src/Actions/toCLIString.cpp
r3fa16b r19dfdf 40 40 #include "LinearAlgebra/RealSpaceMatrix.hpp" 41 41 #include "LinearAlgebra/Vector.hpp" 42 #include "Parameters/Specifics/KeyValuePair.hpp"43 44 #include "Actions/toPythonString.hpp"45 42 46 43 template <> … … 68 65 << _value.at(2,0) << "," 69 66 << _value.at(2,1) << "," 70 << _value.at(2,2) 71 << "\""; 67 << _value.at(2,2) << "\""; 72 68 return output.str(); 73 69 } … … 77 73 { 78 74 std::stringstream output; 79 output << "\"" << toPythonString(_value)<< "\"";75 output << "\"" << _value[0] << "," << _value[1] << "," << _value[2] << "\""; 80 76 return output.str(); 81 77 } … … 88 84 return output.str(); 89 85 } 90 91 template <>92 const std::string toCLIString( const KeyValuePair& _value)93 {94 std::stringstream output;95 output << "\"" << toPythonString(_value) << "\"";96 return output.str();97 } -
src/Actions/toCLIString.hpp
r3fa16b r19dfdf 21 21 22 22 class element; 23 struct KeyValuePair;24 23 class RealSpaceMatrix; 25 24 class Vector; … … 78 77 template <> const std::string toCLIString( const std::string& _value); 79 78 80 template <> const std::string toCLIString( const KeyValuePair& _value);81 82 79 #endif /* TOCLISTRING_HPP_ */ -
src/Actions/toPythonString.cpp
r3fa16b r19dfdf 41 41 #include "LinearAlgebra/Vector.hpp" 42 42 43 #include "Parameters/Specifics/KeyValuePair.hpp"44 45 43 template <> 46 44 const std::string toPythonString( const boost::filesystem::path & _value) … … 54 52 std::stringstream output; 55 53 output << _value.getAtomicNumber(); 56 return output.str();57 }58 59 template <>60 const std::string toPythonString( const KeyValuePair & _value)61 {62 std::stringstream output;63 const char semicolon(';');64 const size_t semicolon_pos = _value.find_last_of(semicolon, std::string::npos);65 const size_t final_equality_pos = _value.find('=', semicolon_pos);66 output << _value;67 if ((semicolon_pos == std::string::npos)68 || (final_equality_pos != std::string::npos))69 output << semicolon;70 54 return output.str(); 71 55 } -
src/Actions/toPythonString.hpp
r3fa16b r19dfdf 21 21 22 22 class element; 23 struct KeyValuePair;24 23 class RealSpaceMatrix; 25 24 class Vector; … … 72 71 template <> const std::string toPythonString( const boost::filesystem::path & _value); 73 72 74 template <> const std::string toPythonString( const KeyValuePair& _value);75 76 73 template <> const std::string toPythonString( const RealSpaceMatrix& _value); 77 74 -
src/Actions/unittests/ActionSequenceUnitTest.cpp
r3fa16b r19dfdf 301 301 ActionSequence *sequence = new ActionSequence(); 302 302 ActionTrait wasCalledTrait("wasCalledActionStub"); 303 sequence->addAction(new wasCalledActionStub(wasCalledTrait)); 304 sequence->addAction(new wasCalledActionStub(wasCalledTrait)); 303 wasCalledActionStub *wasCalled1 = new wasCalledActionStub(wasCalledTrait); 304 wasCalledActionStub *wasCalled2 = new wasCalledActionStub(wasCalledTrait); 305 sequence->addAction(wasCalled1); 306 sequence->addAction(wasCalled2); 305 307 306 308 ActionTrait MakroTrait("Test MakroAction"); 307 309 MakroAction act(MakroTrait,*sequence); 308 wasCalledActionStub *wasCalled1 =309 static_cast<wasCalledActionStub *>(act.actions.actions.front());310 wasCalledActionStub *wasCalled2 =311 static_cast<wasCalledActionStub *>(act.actions.actions.back());312 310 313 311 act.call(); 314 312 315 CPPUNIT_ASSERT_EQUAL(true, 316 static_cast<wasCalledActionStub *>(act.actions.actions.front())->wasCalled()); 317 CPPUNIT_ASSERT_EQUAL(true, 318 static_cast<wasCalledActionStub *>(act.actions.actions.back())->wasCalled()); 313 CPPUNIT_ASSERT_EQUAL(true,wasCalled1->wasCalled()); 314 CPPUNIT_ASSERT_EQUAL(true,wasCalled2->wasCalled()); 319 315 320 316 ActionQueue::getInstance().undoLast(); 321 317 322 CPPUNIT_ASSERT_EQUAL(false, 323 static_cast<wasCalledActionStub *>(act.actions.actions.front())->wasCalled()); 324 CPPUNIT_ASSERT_EQUAL(false, 325 static_cast<wasCalledActionStub *>(act.actions.actions.back())->wasCalled()); 318 CPPUNIT_ASSERT_EQUAL(false,wasCalled1->wasCalled()); 319 CPPUNIT_ASSERT_EQUAL(false,wasCalled2->wasCalled()); 326 320 327 321 delete sequence; -
src/Actions/unittests/stubs/DummyUI.hpp
r3fa16b r19dfdf 47 47 virtual void queryFile(Parameter<boost::filesystem::path> &, const std::string ="", const std::string = ""){}; 48 48 virtual void queryFiles(Parameter< std::vector<boost::filesystem::path> > &, const std::string ="", const std::string = ""){}; 49 virtual void queryKeyValuePair(Parameter<KeyValuePair> &, const std::string ="", const std::string = ""){}; 50 virtual void queryKeyValuePairs(Parameter<std::vector<KeyValuePair> > &, const std::string ="", const std::string = ""){}; 49 virtual void queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> &, const std::string ="", const std::string = ""){}; 51 50 }; 52 51 -
src/Atom/AtomicInfo.cpp
r3fa16b r19dfdf 34 34 35 35 #include "CodePatterns/MemDebug.hpp" 36 37 #include "CodePatterns/Log.hpp"38 36 39 37 #include "atom.hpp" … … 73 71 "Atom "+toString(_atom.getId())+" is not associated with any molecule."); 74 72 MolId = mol->getId(); 75 // accumulate bond info76 const BondList &ListOfBonds = _atom.getListOfBonds();77 bonds.reserve(ListOfBonds.size());78 for (BondList::const_iterator bonditer = ListOfBonds.begin();79 bonditer != ListOfBonds.end(); ++bonditer) {80 const BondInfo bondinfo(*bonditer);81 bonds.push_back(bondinfo);82 LOG(3, "DEBUG: Storing info for bond " << bondinfo.leftid << "<->" << bondinfo.rightid);83 }84 73 } 85 74 … … 112 101 } 113 102 114 // set bonds115 for (std::vector<BondInfo>::const_iterator bonditer = bonds.begin();116 bonditer != bonds.end(); ++bonditer)117 (*bonditer).RecreateBond();118 119 103 // setting molecule 120 104 molecule * const _mol = World::getInstance().getMolecule(MoleculeById(MolId)); -
src/Atom/AtomicInfo.hpp
r3fa16b r19dfdf 16 16 #include "LinearAlgebra/Vector.hpp" 17 17 #include "types.hpp" 18 19 #include <vector>20 21 #include "Bond/BondInfo.hpp"22 18 23 19 class atom; … … 49 45 atomId_t Id; 50 46 int Nr; 51 std::vector<BondInfo> bonds;52 47 }; 53 48 -
src/Bond/BondInfo.cpp
r3fa16b r19dfdf 61 61 atom * const rightatom = World::getInstance().getAtom(AtomById(rightid)); 62 62 if ((leftatom == NULL) || (rightatom == NULL)) { 63 // LOG(3, "DEBUG:Either of the two atoms " << leftid << " or "64 // << rightid << " does not existin the world.");63 ELOG(1, "Either of the two atoms " << leftid << " or " 64 << rightid << " does not exists in the world."); 65 65 return false; 66 66 } 67 67 const BondList &leftbonds = leftatom->getListOfBonds(); 68 boost::function< bool (const bond::ptr )> predicate = 69 boost::bind(static_cast<bool (bond::*)(const int) const>(&bond::Contains), _1, rightid); 70 if (std::find_if(leftbonds.begin(), leftbonds.end(), predicate) != leftbonds.end()) 71 return false; 72 68 73 const BondList &rightbonds = rightatom->getListOfBonds(); 69 boost::function< bool (const bond::ptr )> leftpredicate = 70 boost::bind(static_cast<bool (bond::*)(const atomId_t) const>(&bond::ContainsId), _1, rightid); 71 boost::function< bool (const bond::ptr )> rightpredicate = 72 boost::bind(static_cast<bool (bond::*)(const atomId_t) const>(&bond::ContainsId), _1, leftid); 73 if ((std::find_if(leftbonds.begin(), leftbonds.end(), leftpredicate) != leftbonds.end()) 74 || (std::find_if(rightbonds.begin(), rightbonds.end(), rightpredicate) != rightbonds.end())) { 75 // LOG(3, "DEBUG: Bond between atoms " << leftid << " or "111 76 // << rightid << " is already present in the world."); 77 return true; 78 } 74 if (std::find_if(rightbonds.begin(), rightbonds.end(), predicate) != rightbonds.end()) 75 return false; 79 76 80 77 // create bond … … 84 81 return true; 85 82 } 86 87 void BondInfo::RemoveBond() const88 {89 atom * leftatom = World::getInstance().getAtom(AtomById(leftid));90 atom * rightatom = World::getInstance().getAtom(AtomById(rightid));91 leftatom->removeBond(rightatom);92 } -
src/Bond/BondInfo.hpp
r3fa16b r19dfdf 37 37 bool RecreateBond() const; 38 38 39 /** Removes the bond whose state is contained in this BondInfo.40 *41 */42 void RemoveBond() const;43 44 39 //!> id of left bond partner 45 40 atomId_t leftid; -
src/Bond/bond.cpp
r3fa16b r19dfdf 125 125 * \return true if it is either bond::leftatom or bond::rightatom, false otherwise 126 126 */ 127 bool bond::Contains Nr(const int number) const127 bool bond::Contains(const int number) const 128 128 { 129 129 return ((leftatom->getNr() == number) || (rightatom->getNr() == number)); 130 };131 132 /** Checks if an atom exists in a bond.133 * \param Nr index of atom134 * \return true if it is either bond::leftatom or bond::rightatom, false otherwise135 */136 bool bond::ContainsId(const atomId_t number) const137 {138 return ((leftatom->getId() == number) || (rightatom->getId() == number));139 130 }; 140 131 -
src/Bond/bond.hpp
r3fa16b r19dfdf 19 19 20 20 #include <boost/shared_ptr.hpp> 21 22 #include "types.hpp"23 21 24 22 #include "Bond/bond_observable.hpp" … … 53 51 54 52 bool Contains(const ParticleInfo * const ptr) const; 55 bool ContainsNr(const int nr) const; 56 bool ContainsId(const atomId_t nr) const; 53 bool Contains(const int nr) const; 57 54 double GetDistance() const; 58 55 double GetDistanceSquared() const; -
src/Fragmentation/Automation/MPQCCommandFragmentController.cpp
r3fa16b r19dfdf 59 59 unsigned int MPQCCommandFragmentController::nextid = 0; 60 60 61 unsigned intMPQCCommandFragmentController::addJobsFromQueue(61 bool MPQCCommandFragmentController::addJobsFromQueue( 62 62 const MPQCData::DoLongrange_t _DoLongrange, 63 63 const MPQCData::DoValenceOnly_t _DoValenceOnly, -
src/Fragmentation/Automation/MPQCCommandFragmentController.hpp
r3fa16b r19dfdf 53 53 * \param _DoValenceOnly whether to sample just the valence or the total elctron and nuclei density 54 54 * \param _command command to pass to jobs for execution 55 * \return t he number of jobs added to queue55 * \return true - jobs obtained, false - queue empty 56 56 */ 57 unsigned intaddJobsFromQueue(57 bool addJobsFromQueue( 58 58 const MPQCData::DoLongrange_t _DoLongrange, 59 59 const MPQCData::DoValenceOnly_t _DoValenceOnly, -
src/Fragmentation/Automation/ResultContainer_impl.hpp
r3fa16b r19dfdf 55 55 for(;resultiter != fragmentresults.end(); ++resultiter, ++dataiter) { 56 56 const JobId_t _id = (*resultiter)->getId(); 57 if ((*resultiter)->exitflag == 0) {58 57 #ifndef NDEBUG 59 58 std::pair<typename std::map<JobId_t, T>::iterator, bool> inserter = 60 59 #endif 61 IdData.insert( std::make_pair( _id, *dataiter) ); 62 ASSERT( inserter.second, 63 "ResultContainer::insertResults() - result id " 64 +toString(inserter.first->first)+" already present."); 65 } 60 IdData.insert( std::make_pair( _id, *dataiter) ); 61 ASSERT( inserter.second, 62 "ResultContainer::insertResults() - result id " 63 +toString(inserter.first->first)+" already present."); 66 64 } 67 65 ASSERT( dataiter == fragmentData.end(), -
src/Fragmentation/Automation/SpecificFragmentController_ReceiveResultContainer_impl.hpp
r3fa16b r19dfdf 52 52 // wait but receive all results that are already done 53 53 size_t NoReceivedResults = 0; 54 while ((NoReceivedResults != NoExpectedResults) 55 && (callback.getExitflag() == 0)) { 54 while (NoReceivedResults != NoExpectedResults) { 56 55 // wait a bit 57 56 boost::asio::deadline_timer timer(io_service); … … 61 60 callback.checkResults(callback.host, callback.port); 62 61 callback.RunService("Checking on results"); 63 if (callback.getExitflag() != 0)64 break;65 62 66 63 const std::pair<size_t, size_t> JobStatus = callback.getJobStatus(); -
src/Fragmentation/Exporters/unittests/Makefile.am
r3fa16b r19dfdf 18 18 19 19 TESTS += $(FRAGMENTATIONEXPORTERSTESTS) 20 XFAIL_TESTS += SphericalPointDistributionUnitTest21 20 check_PROGRAMS += $(FRAGMENTATIONEXPORTERSTESTS) 22 21 noinst_PROGRAMS += $(FRAGMENTATIONEXPORTERSTESTS) … … 45 44 46 45 SaturationDistanceMaximizerUnitTest_SOURCES = \ 46 ../Fragmentation/Exporters/unittests/SaturationDistanceMaximizerUnitTest.cpp \ 47 47 ../Fragmentation/Exporters/unittests/SaturationDistanceMaximizerUnitTest.hpp \ 48 48 ../Fragmentation/Exporters/unittests/stubs/SaturatedBondStub.cpp … … 51 51 $(top_builddir)/LinearAlgebra/src/LinearAlgebra/libLinearAlgebra.la \ 52 52 ${FRAGMENTATIONEXPORTERSLIBS} 53 53 54 54 55 55 #AUTOMAKE_OPTIONS = parallel-tests -
src/Fragmentation/Makefile.am
r3fa16b r19dfdf 10 10 Fragmentation/Exporters/SaturatedFragment.cpp \ 11 11 Fragmentation/Exporters/SaturationDistanceMaximizer.cpp \ 12 Fragmentation/Exporters/SphericalPointDistribution.cpp \13 Fragmentation/Exporters/SphericalPointDistribution_getPoints.cpp \14 12 Fragmentation/Homology/FragmentEdge.cpp \ 15 13 Fragmentation/Homology/FragmentNode.cpp \ … … 40 38 Fragmentation/Exporters/SaturatedFragment.hpp \ 41 39 Fragmentation/Exporters/SaturationDistanceMaximizer.hpp \ 42 Fragmentation/Exporters/SphericalPointDistribution.hpp \43 40 Fragmentation/Homology/FragmentEdge.hpp \ 44 41 Fragmentation/Homology/FragmentNode.hpp \ -
src/Fragmentation/PowerSetGenerator.cpp
r3fa16b r19dfdf 131 131 for (TouchedList_t::const_iterator iter = TouchedList.begin(); 132 132 iter != TouchedList.end(); ++iter) { 133 if ((*Binder)->Contains Nr(*iter)) // if we added this very endpiece133 if ((*Binder)->Contains(*iter)) // if we added this very endpiece 134 134 SetDimension++; 135 135 } -
src/Fragmentation/Summation/Containers/MPQCData.cpp
r3fa16b r19dfdf 52 52 MPQCData::MPQCData() : 53 53 DoLongrange(DontSampleDensity), 54 DoValenceOnly(Do SampleValenceOnly)54 DoValenceOnly(DoValenceOnly) 55 55 {} 56 56 -
src/Graph/BondGraph.cpp
r3fa16b r19dfdf 473 473 } 474 474 475 bool BondGraph::checkBondDegree(const deltaatoms_t &allatoms) const476 {477 deltaatoms_t deltaatoms;478 return (gatherAllDeltaAtoms(allatoms, deltaatoms) == 0);479 }480 481 475 482 476 int BondGraph::calculateBondDegree(const deltaatoms_t &allatoms) const -
src/Graph/BondGraph.hpp
r3fa16b r19dfdf 359 359 } 360 360 361 /** Checks whether the bond degree for each atom on the set matches with its valency.362 *363 * @param Set Range with atoms364 * @return true - bond degrees match valency, false - bond degree correction is needed365 */366 template <class container_type,367 class iterator_type,368 class const_iterator_type>369 bool checkBondDegree(370 AtomSetMixin<container_type,iterator_type,const_iterator_type> &Set) const371 {372 std::set<atom *> allatoms;373 for(iterator_type AtomRunner = Set.begin(); AtomRunner != Set.end(); ++AtomRunner)374 allatoms.insert(*AtomRunner);375 return checkBondDegree(allatoms);376 }377 378 361 /** correct bond degree by comparing valence and bond degree. 379 362 * correct Bond degree of each bond by checking both bond partners for a mismatch between valence and current sum of bond degrees, … … 489 472 } 490 473 491 bool checkBondDegree(const std::set<atom *> &allatoms) const;492 493 474 /** Calculates the bond degree for each atom on the set. 494 475 * -
src/Parameters/Makefile.am
r3fa16b r19dfdf 43 43 Parameters/ValueAsString.hpp \ 44 44 Parameters/ValueInterface.hpp \ 45 Parameters/Specifics/KeyValuePair.hpp \46 45 Parameters/Specifics/Value_atom.hpp \ 47 46 Parameters/Specifics/Value_element.hpp \ -
src/Parameters/Parameter.hpp
r3fa16b r19dfdf 53 53 bool isValid(const T &_value) const throw(ParameterValidatorException); 54 54 const T & get() const throw(ParameterValueException); 55 const T & getUnvalidated() const throw(ParameterValueException);56 55 void set(const T & _value) throw(ParameterValueException); 57 56 bool isSet() const -
src/Parameters/Parameter_impl.hpp
r3fa16b r19dfdf 186 186 } 187 187 188 189 /** Catch call to value.getUnvalidated() to add exception information.190 *191 * @return parameter value as string192 */193 template<typename T>194 inline const T & Parameter<T>::getUnvalidated() const throw(ParameterValueException)195 {196 try {197 return value.getUnvalidated();198 } catch(ParameterException &e) {199 e << ParameterName(ParameterInterface::getName());200 throw;201 }202 }203 188 204 189 /** Catch call to value.get() to add exception information. -
src/Parameters/Validators/Specific/KeyValueValidator.cpp
r3fa16b r19dfdf 38 38 #include "KeyValueValidator.hpp" 39 39 40 bool KeyValueValidator::isValid(const KeyValuePair& _value) const40 bool KeyValueValidator::isValid(const std::string & _value) const 41 41 { 42 42 size_t keyvaluestart = 0; … … 66 66 } 67 67 68 bool KeyValueValidator::operator==(const Validator< KeyValuePair> &_instance) const68 bool KeyValueValidator::operator==(const Validator<std::string> &_instance) const 69 69 { 70 70 const KeyValueValidator *inst = … … 76 76 } 77 77 78 Validator< KeyValuePair>* KeyValueValidator::clone() const78 Validator< std::string >* KeyValueValidator::clone() const 79 79 { 80 Validator< KeyValuePair> *inst =80 Validator< std::string > *inst = 81 81 new KeyValueValidator(); 82 82 return inst; -
src/Parameters/Validators/Specific/KeyValueValidator.hpp
r3fa16b r19dfdf 15 15 #endif 16 16 17 #include "Parameters/Specifics/KeyValuePair.hpp" 17 #include <string> 18 18 19 #include "Parameters/Validators/Validator.hpp" 19 20 … … 21 22 * concatenation of the following pattern "...=...;" 22 23 */ 23 class KeyValueValidator : public Validator< KeyValuePair>24 class KeyValueValidator : public Validator<std::string> 24 25 { 25 bool isValid(const KeyValuePair& _value) const;26 bool operator==(const Validator< KeyValuePair> &_instance) const;27 Validator< KeyValuePair>* clone() const;26 bool isValid(const std::string & _value) const; 27 bool operator==(const Validator<std::string> &_instance) const; 28 Validator< std::string >* clone() const; 28 29 }; 29 30 -
src/Parameters/Value.hpp
r3fa16b r19dfdf 77 77 // functions for ValueInterface 78 78 bool isValid(const T &_value) const throw(ParameterValidatorException); 79 const T & getUnvalidated() const throw(ParameterValueException);80 79 const T & get() const throw(ParameterValueException); 81 80 void set(const T & _value) throw(ParameterException); -
src/Parameters/ValueInterface.hpp
r3fa16b r19dfdf 31 31 virtual bool isValid(const T & _value) const throw(ParameterValidatorException)=0; 32 32 virtual const T & get() const throw(ParameterValueException)=0; 33 virtual const T & getUnvalidated() const throw(ParameterValueException)=0;34 33 virtual void set(const T & _value) throw(ParameterException)=0; 35 34 virtual bool isSet() const=0; -
src/Parameters/Value_impl.hpp
r3fa16b r19dfdf 120 120 { 121 121 if (!isValid(value)) throw ParameterValueException(); 122 if (!ValueSet) throw ParameterValueException();123 return value;124 }125 126 /** Getter of value without any validation127 *128 * @return value129 */130 template <class T>131 inline const T & Value<T>::getUnvalidated() const throw(ParameterValueException)132 {133 122 if (!ValueSet) throw ParameterValueException(); 134 123 return value; -
src/Python/PythonScripting.cpp
r3fa16b r19dfdf 39 39 #include "CodePatterns/MemDebug.hpp" 40 40 41 bool executePythonScript File(const boost::filesystem::path &pythonfilename)41 bool executePythonScript(const std::string &pythonfilename_string) 42 42 { 43 boost::filesystem::path pythonfilename(pythonfilename_string); 43 44 if (exists(pythonfilename)) { 44 45 // parse in and execute the local and global config.py … … 60 61 std::string pythonscript( std::istreambuf_iterator<char>(pythonfile), 61 62 (std::istreambuf_iterator<char>()) ); 62 std::string enveloped_script("print \"BEGIN of "+pythonfilename .string()+":\"\n");63 std::string enveloped_script("print \"BEGIN of "+pythonfilename_string+":\"\n"); 63 64 enveloped_script += pythonscript; 64 enveloped_script += std::string("print \"END of "+pythonfilename .string()+":\"\n");65 enveloped_script += std::string("print \"END of "+pythonfilename_string+":\"\n"); 65 66 66 67 boost::python::handle<> ignored(( PyRun_String( enveloped_script.c_str(), … … 77 78 return false; 78 79 } 79 80 bool executePythonScript(const std::string &python_string, const std::string &python_scripttitle)81 {82 try {83 PyImport_AppendInittab( "pyMoleCuilder", &initpyMoleCuilder );84 85 Py_Initialize();86 87 boost::python::object main_module((88 boost::python::handle<>(boost::python::borrowed(PyImport_AddModule("__main__")))));89 90 boost::python::object main_namespace = main_module.attr("__dict__");91 92 boost::python::object molecuilder_module( (boost::python::handle<>(PyImport_ImportModule("pyMoleCuilder"))) );93 main_namespace["pyMoleCuilder"] = molecuilder_module;94 95 std::string enveloped_script("print \"BEGIN of "+python_scripttitle+":\"\n");96 enveloped_script += python_string+std::string("\n");97 enveloped_script += std::string("print \"END of "+python_scripttitle+":\"\n");98 99 boost::python::handle<> ignored(( PyRun_String( enveloped_script.c_str(),100 Py_file_input,101 main_namespace.ptr(),102 main_namespace.ptr() ) ));103 104 } catch( boost::python::error_already_set ) {105 PyErr_Print();106 return false;107 }108 return true;109 } -
src/Python/PythonScripting.hpp
r3fa16b r19dfdf 15 15 16 16 #include <string> 17 #include <boost/filesystem/path.hpp>18 17 19 bool executePythonScriptFile(const boost::filesystem::path &pythonfilename); 20 bool executePythonScript(const std::string &python_string, const std::string &python_scripttitle); 18 bool executePythonScript(const std::string &pythonfilename_string); 21 19 22 20 #endif /* PYTHONSCRIPTING_HPP_ */ -
src/Python/PythonScripting_impl.hpp
r3fa16b r19dfdf 6 6 */ 7 7 8 #ifndef PYTHONSCRIPTING_ IMPL_HPP_9 #define PYTHONSCRIPTING_ IMPL_HPP_8 #ifndef PYTHONSCRIPTING_HPP_ 9 #define PYTHONSCRIPTING_HPP_ 10 10 11 11 … … 131 131 132 132 133 #endif /* PYTHONSCRIPTING_ IMPL_HPP_ */133 #endif /* PYTHONSCRIPTING_HPP_ */ -
src/UIElements/CommandLineUI/CommandLineDialog.cpp
r3fa16b r19dfdf 136 136 } 137 137 138 void CommandLineDialog::queryKeyValuePair(Parameter<KeyValuePair> ¶m, const std::string title, const std::string description) 139 { 140 registerQuery(new KeyValuePairCommandLineQuery(param, title,description)); 141 } 142 143 void CommandLineDialog::queryKeyValuePairs(Parameter< std::vector<KeyValuePair> > ¶m, const std::string title, const std::string description) 144 { 145 registerQuery(new KeyValuePairsCommandLineQuery(param, title,description)); 138 void CommandLineDialog::queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> ¶m, const std::string title, const std::string description){ 139 registerQuery(new RandomNumberDistribution_ParametersCommandLineQuery(param, title, description)); 146 140 } 147 141 -
src/UIElements/CommandLineUI/CommandLineDialog.hpp
r3fa16b r19dfdf 34 34 35 35 virtual void queryEmpty(const std::string ="", const std::string = ""); 36 37 protected: 38 36 virtual void queryInt(Parameter<int> &, const std::string ="", const std::string = ""); 37 virtual void queryInts(Parameter<std::vector<int> > &, const std::string ="", const std::string = ""); 38 virtual void queryUnsignedInt(Parameter<unsigned int> &, const std::string ="", const std::string = ""); 39 virtual void queryUnsignedInts(Parameter<std::vector<unsigned int> > &, const std::string ="", const std::string = ""); 40 virtual void queryBoolean(Parameter<bool> &, const std::string ="", const std::string = ""); 41 virtual void queryString(Parameter<std::string> &, const std::string ="", const std::string = ""); 42 virtual void queryStrings(Parameter<std::vector<std::string> > &, const std::string ="", const std::string = ""); 43 virtual void queryDouble(Parameter<double> &, const std::string ="", const std::string = ""); 44 virtual void queryDoubles(Parameter<std::vector<double> > &, const std::string ="", const std::string = ""); 45 virtual void queryAtom(Parameter<const atom *> &, const std::string ="", const std::string = ""); 46 virtual void queryAtoms(Parameter<std::vector<const atom *> > &, const std::string ="", const std::string = ""); 47 virtual void queryMolecule(Parameter<const molecule *> &, const std::string ="", const std::string = ""); 48 virtual void queryMolecules(Parameter<std::vector<const molecule *> > &, const std::string ="", const std::string = ""); 49 virtual void queryVector(Parameter<Vector> &, const std::string ="", const std::string = ""); 50 virtual void queryVectors(Parameter<std::vector<Vector> > &, const std::string ="", const std::string = ""); 51 virtual void queryRealSpaceMatrix(Parameter<RealSpaceMatrix> &, const std::string ="", const std::string = ""); 52 virtual void queryElement(Parameter<const element *> &, const std::string ="", const std::string = ""); 53 virtual void queryElements(Parameter<std::vector<const element *> > &, const std::string ="", const std::string = ""); 54 virtual void queryFile(Parameter<boost::filesystem::path> &, const std::string ="", const std::string = ""); 55 virtual void queryFiles(Parameter<std::vector< boost::filesystem::path> > &, const std::string ="", const std::string = ""); 56 virtual void queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> &, const std::string ="", const std::string = ""); 57 // specialized stuff for command line queries 58 // all placed into Query/CommandLineQuery.hpp 59 // !please adhere to alphabetical ordering! 60 class AtomCommandLineQuery; 61 class AtomsCommandLineQuery; 62 class BooleanCommandLineQuery; 63 class DoubleCommandLineQuery; 64 class DoublesCommandLineQuery; 65 class ElementCommandLineQuery; 66 class ElementsCommandLineQuery; 39 67 class EmptyCommandLineQuery; 40 41 /** With the following boost::preprocessor code we generate virtual function 42 * definitions and forward declarations for all desired query types in the 43 * CommandLineUI specialization of class Dialog. 44 */ 45 #include "UIElements/GlobalListOfParameterQueries.hpp" 46 #include "UIElements/Dialog_impl_pre.hpp" 47 48 #include <boost/preprocessor/facilities/empty.hpp> 49 50 // iterate over all parameter query types for query declarations 51 #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type 52 #define SUFFIX BOOST_PP_EMPTY() 53 #define BOOST_PP_LOCAL_MACRO(n) dialog_declaration(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, GLOBALLISTOFPARAMETERQUERIES_Type) 54 #define BOOST_PP_LOCAL_LIMITS (0, MAXPARAMETERTOKENS-1) 55 #include BOOST_PP_LOCAL_ITERATE() 56 #undef dialog_declaration 57 #undef SUFFIX 58 #endif 59 60 // iterate over all parameter query types for forward declarations 61 #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type 62 #define BOOST_PP_LOCAL_MACRO(n) forward_declaration(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, CommandLineQuery) 63 #define BOOST_PP_LOCAL_LIMITS (0, MAXPARAMETERTOKENS-1) 64 #include BOOST_PP_LOCAL_ITERATE() 65 #undef forward_declaration 66 #endif 67 68 #include "Dialog_impl_undef.hpp" 69 /* End of preprocessor code piece */ 70 68 class FileCommandLineQuery; 69 class FilesCommandLineQuery; 70 class IntCommandLineQuery; 71 class IntsCommandLineQuery; 72 class MoleculeCommandLineQuery; 73 class MoleculesCommandLineQuery; 74 class RealSpaceMatrixCommandLineQuery; 75 class StringCommandLineQuery; 76 class StringsCommandLineQuery; 77 class UnsignedIntCommandLineQuery; 78 class UnsignedIntsCommandLineQuery; 79 class VectorCommandLineQuery; 80 class VectorsCommandLineQuery; 81 class RandomNumberDistribution_ParametersCommandLineQuery; 71 82 }; 72 83 -
src/UIElements/CommandLineUI/CommandLineParser.cpp
r3fa16b r19dfdf 52 52 #include "CommandLineParser.hpp" 53 53 #include "CommandLineParser_validate.hpp" 54 #include "Parameters/Specifics/KeyValuePair.hpp"55 54 #include "World.hpp" 56 55 … … 403 402 ; 404 403 break; 404 case TypeEnumContainer::RandomNumberDistribution_ParametersType: 405 OptionList->add_options() 406 (currentOption->getKeyAndShortForm().c_str(), 407 currentOption->hasDefaultValue() ? 408 (_DefaultAsImplicit ? 409 po::value < std::string >()->implicit_value(boost::lexical_cast< std::string >(currentOption->getDefaultValue().c_str())) : 410 po::value < std::string >()->default_value(boost::lexical_cast< std::string >(currentOption->getDefaultValue().c_str()))) : 411 po::value < std::string >(), 412 currentOption->getDescription().c_str()) 413 ; 414 break; 405 415 case TypeEnumContainer::RealSpaceMatrixType: 406 416 OptionList->add_options() … … 409 419 // po::value < RealSpaceMatrixValue >()->default_value(boost::lexical_cast<BoxValue>(currentOption->getDefaultValue().c_str())) : 410 420 po::value < RealSpaceMatrixValue >(), 411 currentOption->getDescription().c_str())412 ;413 break;414 case TypeEnumContainer::KeyValueType:415 OptionList->add_options()416 (currentOption->getKeyAndShortForm().c_str(),417 currentOption->hasDefaultValue() ?418 (_DefaultAsImplicit ?419 po::value < KeyValuePair >()->implicit_value(boost::lexical_cast< KeyValuePair >(currentOption->getDefaultValue().c_str())) :420 po::value < KeyValuePair >()->default_value(boost::lexical_cast< KeyValuePair >(currentOption->getDefaultValue().c_str()))) :421 po::value < KeyValuePair >(),422 currentOption->getDescription().c_str())423 ;424 break;425 case TypeEnumContainer::ListOfKeyValuesType:426 OptionList->add_options()427 (currentOption->getKeyAndShortForm().c_str(),428 // currentOption->hasDefaultValue() ?429 // po::value < std::vector<KeyValuePair> >()->default_value(boost::lexical_cast< std::vector<KeyValuePair> >(currentOption->getDefaultValue().c_str())) :430 po::value < std::vector<KeyValuePair> >()->multitoken(),431 421 currentOption->getDescription().c_str()) 432 422 ; -
src/UIElements/CommandLineUI/CommandLineParser_validate.cpp
r3fa16b r19dfdf 42 42 #include "Actions/Values.hpp" 43 43 #include "CommandLineParser_validate.hpp" 44 #include "Parameters/Specifics/KeyValuePair.hpp"45 44 46 45 /** boost::program_options validator specialization for VectorValue. … … 158 157 void validate(boost::any& v, const std::vector<std::string>& values, boost::filesystem::path *, int) 159 158 { 160 // std::cerr << "boost::filesystem::path validator used." << std::endl;159 boost::filesystem::path filename; 161 160 162 // Make sure no previous assignment to 'a' was made. 163 boost::program_options::validators::check_first_occurrence(v); 164 // Extract the first string from 'values'. If there is more than 165 // one string, it's an error, and exception will be thrown. 166 const std::string& s = boost::program_options::validators::get_single_string(values); 167 168 v = boost::any(boost::filesystem::path(s)); 169 } 170 171 /** boost::program_options validator specialization for boost::filesystem::path. 172 * \param &v reference for return value 173 * \param &values string vector of scanned options 174 * \param * 175 * \param 176 * 177 */ 178 void validate(boost::any& v, const std::vector<std::string>& values, KeyValuePair *, int) 179 { 180 // std::cerr << "KeyValuePair validator used." << std::endl; 181 182 // Make sure no previous assignment to 'a' was made. 183 boost::program_options::validators::check_first_occurrence(v); 184 // Extract the first string from 'values'. If there is more than 185 // one string, it's an error, and exception will be thrown. 186 const std::string& s = boost::program_options::validators::get_single_string(values); 187 188 if (s.find("=") == std::string::npos) { 189 #if BOOST_VERSION < 104200 190 throw boost::program_options::validation_error("Invalid KeyValue given"); 191 #else 192 throw boost::program_options::validation_error( 193 boost::program_options::validation_error::invalid_option_value, 194 std::string("value"), 195 std::string("vector<KeyValuePair>") 196 ); 197 #endif 198 } 199 v = boost::any(KeyValuePair(s)); 200 } 201 202 /** boost::program_options validator specialization for boost::filesystem::path. 203 * \param &v reference for return value 204 * \param &values string vector of scanned options 205 * \param * 206 * \param 207 * 208 */ 209 void validate(boost::any& v, const std::vector<std::string>& values, std::vector<KeyValuePair> *, int) 210 { 211 // std::cerr << "vector<KeyValuePair> validator used." << std::endl; 161 std::cerr << "boost::filesystem::path validator used." << std::endl; 212 162 213 163 // split comma-separated values 214 if (values.size() > 1) { 164 if (values.size() != 1) { 165 std::cerr << "Not one file but " << values.size() << " given " << std::endl; 215 166 #if BOOST_VERSION < 104200 216 167 throw boost::program_options::validation_error("Unequal to one file given"); … … 220 171 boost::program_options::validation_error::at_least_one_value_required, 221 172 std::string("value"), 222 std::string("vector<KeyValuePair>") 173 std::string("boost::filesystem::path") 174 ); 175 } else { 176 throw boost::program_options::validation_error( 177 boost::program_options::validation_error::multiple_values_not_allowed, 178 std::string("value"), 179 std::string("boost::filesystem::path") 223 180 ); 224 181 } 225 182 #endif 226 for (std::vector<std::string>::const_iterator iter = values.begin();227 iter != values.end();++iter)228 if ((*iter).find("=") == std::string::npos) {229 #if BOOST_VERSION < 104200230 throw boost::program_options::validation_error("Invalid KeyValue given");231 #else232 throw boost::program_options::validation_error(233 boost::program_options::validation_error::invalid_option_value,234 std::string("value"),235 std::string("vector<KeyValuePair>")236 );237 #endif238 }239 183 } 240 std::vector<KeyValuePair> temp; 241 for (std::vector<std::string>::const_iterator iter = values.begin(); 242 iter != values.end();++iter) 243 temp.push_back(KeyValuePair(*iter)); 244 v = boost::any(temp); 184 filename = values.at(0); 185 v = boost::any(boost::filesystem::path(filename)); 245 186 } 187 -
src/UIElements/CommandLineUI/CommandLineParser_validate.hpp
r3fa16b r19dfdf 22 22 #include <boost/lexical_cast.hpp> 23 23 24 struct KeyValuePair;25 24 class RealSpaceMatrixValue; 26 25 class VectorValue; 27 26 28 void validate(boost::any& v, const std::vector<std::string>& values, KeyValuePair *, int);29 void validate(boost::any& v, const std::vector<std::string>& values, std::vector<KeyValuePair> *, int);30 27 void validate(boost::any& v, const std::vector<std::string>& values, VectorValue *, int); 31 28 void validate(boost::any& v, const std::vector<std::string>& values, RealSpaceMatrixValue *, int); -
src/UIElements/CommandLineUI/Query/CommandLineQuery.hpp
r3fa16b r19dfdf 24 24 }; 25 25 26 /** With the following boost::preprocessor code we generate forward declarations 27 * of query class for all desired query types in the Qt specialization class of 28 * Dialog.29 */30 #include "UIElements/GlobalListOfParameterQueries.hpp" 31 #include "UIElements/Dialog_impl_pre.hpp" 26 class CommandLineDialog::IntCommandLineQuery : public Dialog::TQuery<int> { 27 public: 28 IntCommandLineQuery(Parameter<int> &_param, const std::string &_title, const std::string &_description = ""); 29 virtual ~IntCommandLineQuery(); 30 virtual bool handle(); 31 }; 32 32 33 #include <boost/preprocessor/facilities/empty.hpp> 33 class CommandLineDialog::IntsCommandLineQuery : public Dialog::TQuery<std::vector<int> > { 34 public: 35 IntsCommandLineQuery(Parameter<std::vector<int> > &_param, const std::string &_title, const std::string &_description = ""); 36 virtual ~IntsCommandLineQuery(); 37 virtual bool handle(); 38 }; 34 39 35 // iterate over all parameter query types for forward declarations 36 #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type 37 #define BOOST_PP_LOCAL_MACRO(n) queryclass_definition(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, GLOBALLISTOFPARAMETERQUERIES_Type, CommandLine) 38 #define BOOST_PP_LOCAL_LIMITS (0, MAXPARAMETERTOKENS-1) 39 #include BOOST_PP_LOCAL_ITERATE() 40 #undef queryclass_definition 41 #endif 40 class CommandLineDialog::UnsignedIntCommandLineQuery : public Dialog::TQuery<unsigned int> { 41 public: 42 UnsignedIntCommandLineQuery(Parameter<unsigned int> &_param, const std::string &_title, const std::string &_description = ""); 43 virtual ~UnsignedIntCommandLineQuery(); 44 virtual bool handle(); 45 }; 42 46 43 #include "Dialog_impl_undef.hpp" 44 /* End of preprocessor code piece */ 47 class CommandLineDialog::UnsignedIntsCommandLineQuery : public Dialog::TQuery<std::vector<unsigned int> > { 48 public: 49 UnsignedIntsCommandLineQuery(Parameter<std::vector<unsigned int> > &_param, const std::string &_title, const std::string &_description = ""); 50 virtual ~UnsignedIntsCommandLineQuery(); 51 virtual bool handle(); 52 }; 45 53 54 class CommandLineDialog::BooleanCommandLineQuery : public Dialog::TQuery<bool> { 55 public: 56 BooleanCommandLineQuery(Parameter<bool> &_param, const std::string &_title, const std::string &_description = ""); 57 virtual ~BooleanCommandLineQuery(); 58 virtual bool handle(); 59 }; 60 61 class CommandLineDialog::DoubleCommandLineQuery : public Dialog::TQuery<double> { 62 public: 63 DoubleCommandLineQuery(Parameter<double> &_param, const std::string &_title, const std::string &_description = ""); 64 virtual ~DoubleCommandLineQuery(); 65 virtual bool handle(); 66 }; 67 68 class CommandLineDialog::DoublesCommandLineQuery : public Dialog::TQuery<std::vector<double> > { 69 public: 70 DoublesCommandLineQuery(Parameter<std::vector<double> > &_param, const std::string &_title, const std::string &_description = ""); 71 virtual ~DoublesCommandLineQuery(); 72 virtual bool handle(); 73 }; 74 75 class CommandLineDialog::StringCommandLineQuery : public Dialog::TQuery<std::string> { 76 public: 77 StringCommandLineQuery(Parameter<std::string> &_param, const std::string &_title, const std::string &_description = ""); 78 virtual ~StringCommandLineQuery(); 79 virtual bool handle(); 80 }; 81 82 class CommandLineDialog::StringsCommandLineQuery : public Dialog::TQuery<std::vector<std::string> > { 83 public: 84 StringsCommandLineQuery(Parameter<std::vector<std::string> > &_param, const std::string &_title, const std::string &_description = ""); 85 virtual ~StringsCommandLineQuery(); 86 virtual bool handle(); 87 }; 88 89 class CommandLineDialog::AtomCommandLineQuery : public Dialog::TQuery<const atom *> { 90 public: 91 AtomCommandLineQuery(Parameter<const atom *> &_param, const std::string &_title, const std::string &_description = ""); 92 virtual ~AtomCommandLineQuery(); 93 virtual bool handle(); 94 }; 95 96 class CommandLineDialog::AtomsCommandLineQuery : public Dialog::TQuery<std::vector<const atom*> > { 97 public: 98 AtomsCommandLineQuery(Parameter<std::vector<const atom *> > &_param, const std::string &_title, const std::string &_description = ""); 99 virtual ~AtomsCommandLineQuery(); 100 virtual bool handle(); 101 }; 102 103 class CommandLineDialog::MoleculeCommandLineQuery : public Dialog::TQuery<const molecule *> { 104 public: 105 MoleculeCommandLineQuery(Parameter<const molecule *> &_param, const std::string &_title, const std::string &_description = ""); 106 virtual ~MoleculeCommandLineQuery(); 107 virtual bool handle(); 108 }; 109 110 class CommandLineDialog::MoleculesCommandLineQuery : public Dialog::TQuery<std::vector<const molecule*> > { 111 public: 112 MoleculesCommandLineQuery(Parameter<std::vector<const molecule *> > &_param, const std::string &_title, const std::string &_description = ""); 113 virtual ~MoleculesCommandLineQuery(); 114 virtual bool handle(); 115 }; 116 117 class CommandLineDialog::VectorCommandLineQuery : public Dialog::TQuery<Vector> { 118 public: 119 VectorCommandLineQuery(Parameter<Vector> &_param, const std::string &_title, const std::string &_description = ""); 120 virtual ~VectorCommandLineQuery(); 121 virtual bool handle(); 122 }; 123 124 class CommandLineDialog::VectorsCommandLineQuery : public Dialog::TQuery<std::vector<Vector> > { 125 public: 126 VectorsCommandLineQuery(Parameter<std::vector<Vector> > &_param, const std::string &_title, const std::string &_description = ""); 127 virtual ~VectorsCommandLineQuery(); 128 virtual bool handle(); 129 }; 130 131 class CommandLineDialog::RealSpaceMatrixCommandLineQuery : public Dialog::TQuery<RealSpaceMatrix> { 132 public: 133 RealSpaceMatrixCommandLineQuery(Parameter<RealSpaceMatrix> &_param, const std::string &_title, const std::string &_description = ""); 134 virtual ~RealSpaceMatrixCommandLineQuery(); 135 virtual bool handle(); 136 }; 137 138 class CommandLineDialog::ElementCommandLineQuery : public Dialog::TQuery<const element *> { 139 public: 140 ElementCommandLineQuery(Parameter<const element *> &_param, const std::string &_title, const std::string &_description = ""); 141 virtual ~ElementCommandLineQuery(); 142 virtual bool handle(); 143 }; 144 145 class CommandLineDialog::ElementsCommandLineQuery : public Dialog::TQuery<std::vector<const element *> > { 146 public: 147 ElementsCommandLineQuery(Parameter<std::vector<const element *> > &_param, const std::string &_title, const std::string &_description = ""); 148 virtual ~ElementsCommandLineQuery(); 149 virtual bool handle(); 150 }; 151 152 class CommandLineDialog::FileCommandLineQuery : public Dialog::TQuery<boost::filesystem::path> { 153 public: 154 FileCommandLineQuery(Parameter<boost::filesystem::path> &_param, const std::string &_title, const std::string &_description = ""); 155 virtual ~FileCommandLineQuery(); 156 virtual bool handle(); 157 }; 158 159 class CommandLineDialog::FilesCommandLineQuery : public Dialog::TQuery<std::vector<boost::filesystem::path> > { 160 public: 161 FilesCommandLineQuery(Parameter<std::vector< boost::filesystem::path> > ¶m, const std::string &_title, const std::string &_description = ""); 162 virtual ~FilesCommandLineQuery(); 163 virtual bool handle(); 164 }; 165 166 class CommandLineDialog::RandomNumberDistribution_ParametersCommandLineQuery : public Dialog::TQuery<RandomNumberDistribution_Parameters> { 167 public: 168 RandomNumberDistribution_ParametersCommandLineQuery(Parameter<RandomNumberDistribution_Parameters> &_param, const std::string &_title, const std::string &_description = ""); 169 virtual ~RandomNumberDistribution_ParametersCommandLineQuery(); 170 virtual bool handle(); 171 }; 46 172 47 173 #endif /* COMMANDLINEQUERY_HPP_ */ -
src/UIElements/CommandLineUI/TypeEnumContainer.cpp
r3fa16b r19dfdf 51 51 #include "Element/element.hpp" 52 52 #include "molecule.hpp" 53 #include "Parameters/Specifics/KeyValuePair.hpp"54 53 #include "RandomNumbers/RandomNumberDistribution_Parameters.hpp" 55 54 … … 82 81 TypeEnumMap[&typeid(const element *)] = ElementType; 83 82 TypeEnumMap[&typeid(std::vector<const element *>)] = ListOfElementsType; 84 TypeEnumMap[&typeid(KeyValuePair)] = KeyValueType; 85 TypeEnumMap[&typeid(std::vector<KeyValuePair>)] = ListOfKeyValuesType; 83 TypeEnumMap[&typeid(RandomNumberDistribution_Parameters)] = RandomNumberDistribution_ParametersType; 86 84 87 85 // for debugging: list all stored types -
src/UIElements/CommandLineUI/TypeEnumContainer.hpp
r3fa16b r19dfdf 46 46 ElementType, 47 47 ListOfElementsType, 48 RealSpaceMatrixType, 49 KeyValueType, 50 ListOfKeyValuesType 48 RandomNumberDistribution_ParametersType, 49 RealSpaceMatrixType 51 50 }; 52 51 -
src/UIElements/Dialog.cpp
r3fa16b r19dfdf 135 135 }*/ 136 136 137 /** With the following boost::preprocessor code we generate template 138 * specializations for each desired query types in the abstract class Dialog. 139 */ 140 #include "UIElements/GlobalListOfParameterQueries.hpp" 141 #include "UIElements/Dialog_impl_pre.hpp" 142 143 // print a template body 144 #define dialog_definition(z,n,TOKENLIST,TYPELIST) \ 145 template <> void Dialog::query< \ 146 BOOST_PP_SEQ_ELEM(n, TYPELIST) \ 147 >(Parameter< \ 148 BOOST_PP_SEQ_ELEM(n, TYPELIST) \ 149 > ¶m, const std::string title, const std::string description) { \ 150 BOOST_PP_CAT(query, BOOST_PP_SEQ_ELEM(n, TOKENLIST)) \ 151 (param, title, description); } 152 153 // print template specialization for every query type 154 #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type 155 #define BOOST_PP_LOCAL_MACRO(n) dialog_definition(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, GLOBALLISTOFPARAMETERQUERIES_Type) 156 #define BOOST_PP_LOCAL_LIMITS (0, MAXPARAMETERTOKENS-1) 157 #include BOOST_PP_LOCAL_ITERATE() 158 #endif 159 160 #undef dialog_definition 161 162 #include "Dialog_impl_undef.hpp" 163 /* End of preprocessor code piece */ 164 165 //template <> void Dialog::query< std::vector<KeyValuePair> >(Parameter< std::vector<KeyValuePair> > ¶m, const std::string title, const std::string description) 166 //{ 167 // queryKeyValuePairs(param, title, description); 168 //} 137 template <> void Dialog::query<bool>(Parameter<bool> ¶m, const std::string title, const std::string description) 138 { 139 queryBoolean(param, title, description); 140 } 141 142 template <> void Dialog::query<int>(Parameter<int> ¶m, const std::string title, const std::string description) 143 { 144 queryInt(param, title, description); 145 } 146 147 template <> void Dialog::query< std::vector<int> >(Parameter<std::vector<int> > ¶m, const std::string title, const std::string description) 148 { 149 queryInts(param, title, description); 150 } 151 152 template <> void Dialog::query<unsigned int>(Parameter<unsigned int> ¶m, const std::string title, const std::string description) 153 { 154 queryUnsignedInt(param, title, description); 155 } 156 157 template <> void Dialog::query< std::vector<unsigned int> >(Parameter<std::vector<unsigned int> > ¶m, const std::string title, const std::string description) 158 { 159 queryUnsignedInts(param, title, description); 160 } 161 162 template <> void Dialog::query<double>(Parameter<double> ¶m, const std::string title, const std::string description) 163 { 164 queryDouble(param, title, description); 165 } 166 167 template <> void Dialog::query< std::vector<double> >(Parameter<std::vector<double> > ¶m, const std::string title, const std::string description) 168 { 169 queryDoubles(param, title, description); 170 } 171 172 template <> void Dialog::query<std::string>(Parameter<std::string> ¶m, const std::string title, const std::string description) 173 { 174 queryString(param, title, description); 175 } 176 177 template <> void Dialog::query< std::vector<std::string> >(Parameter<std::vector<std::string> > ¶m, const std::string title, const std::string description) 178 { 179 queryStrings(param, title, description); 180 } 181 182 template <> void Dialog::query<const atom *>(Parameter<const atom *> ¶m, const std::string title, const std::string description) 183 { 184 queryAtom(param, title, description); 185 } 186 187 template <> void Dialog::query< std::vector<const atom *> >(Parameter<std::vector<const atom *> > ¶m, const std::string title, const std::string description) 188 { 189 queryAtoms(param, title, description); 190 } 191 192 template <> void Dialog::query<const molecule *>(Parameter<const molecule *> ¶m, const std::string title, const std::string description) 193 { 194 queryMolecule(param, title, description); 195 } 196 197 template <> void Dialog::query< std::vector<const molecule *> >(Parameter<std::vector<const molecule *> > ¶m, const std::string title, const std::string description) 198 { 199 queryMolecules(param, title, description); 200 } 201 202 template <> void Dialog::query<Vector>(Parameter<Vector> ¶m, const std::string title, const std::string description) 203 { 204 queryVector(param, title, description); 205 } 206 207 template <> void Dialog::query< std::vector<Vector> >(Parameter<std::vector<Vector> > ¶m, const std::string title, const std::string description) 208 { 209 queryVectors(param, title, description); 210 } 211 212 template <> void Dialog::query<RealSpaceMatrix>(Parameter<RealSpaceMatrix> ¶m, const std::string title, const std::string description) 213 { 214 queryRealSpaceMatrix(param, title, description); 215 } 216 217 template <> void Dialog::query<const element *>(Parameter<const element *> ¶m, const std::string title, const std::string description) 218 { 219 queryElement(param, title, description); 220 } 221 222 template <> void Dialog::query< std::vector<const element *> >(Parameter<std::vector<const element *> > ¶m, const std::string title, const std::string description) 223 { 224 queryElements(param, title, description); 225 } 226 227 template <> void Dialog::query< boost::filesystem::path >(Parameter<boost::filesystem::path> ¶m, const std::string title, const std::string description) 228 { 229 queryFile(param, title, description); 230 } 231 232 template <> void Dialog::query< std::vector<boost::filesystem::path> >(Parameter<std::vector< boost::filesystem::path> > ¶m, const std::string title, const std::string description) 233 { 234 queryFiles(param, title, description); 235 } 236 237 template <> void Dialog::query< RandomNumberDistribution_Parameters >(Parameter<RandomNumberDistribution_Parameters> ¶m, const std::string title, const std::string description) 238 { 239 queryRandomNumberDistribution_Parameters(param, title, description); 240 } 169 241 170 242 /************************** Query Infrastructure ************************/ -
src/UIElements/Dialog.hpp
r3fa16b r19dfdf 22 22 #include "LinearAlgebra/RealSpaceMatrix.hpp" 23 23 #include "LinearAlgebra/Vector.hpp" 24 #include "RandomNumbers/RandomNumberDistribution_Parameters.hpp" 24 25 #include "Parameters/Parameter.hpp" 25 #include "Parameters/Specifics/KeyValuePair.hpp"26 26 27 27 class atom; … … 29 29 class element; 30 30 class molecule; 31 31 32 32 33 /** Dialog is one of the two main classes of the UIFactory base class. … … 132 133 * Due to the three present UI interfaces we have to add a specific Query for each, here 133 134 * is a list: 134 * -# add a token (i.e. a unique name for the query parameter) and its type to the 135 * global list in \ref GlobalListOfParameterQueries.hpp. This will via boost 136 * preprocessor magic add definitions and some intermediatr template specializations. 137 * -# add a specialization for each of the UI interfaces of Dialog::...Query class. 138 * -# add class declaration of QtDialog::...Query in \ref QtQuery.hpp 135 * -# add ValueStorage::setCurrentValue() and ValueStorage::queryCurrentValue() for 136 * both types 137 * -# add Dialog::query...() 138 * -# add Dialog::query<>() specialization calling the above function 139 * -# add CommandLineDialog::query...(), TextDialog::query...(), and QtDialog::query...(), 140 * i.e. for each of the three interface 141 * -# add empty definition DummyDialog::query...() to the stub for Action unittests in DummUI.hpp. 142 * -# add Dialog::...Query class with tmp value of desired type 139 143 * -# add CommandLineDialog::...Query, TextDialog::...Query, QtDialog::...Query 140 * -# TypeEnumContainer add new type to query. Make the Type name match with the token 144 * -# you probably also need a QtDialog::...QueryPipe() to handle the signal/slot stuff, 145 * Qt's moc does not like nested classes. Hence, this has to go extra. 146 * -# TypeEnumContainer add new type to query 141 147 * -# CommandLineParser::AddOptionToParser() add new type to query 142 148 * -# CommandLineParser_valdiates.[ch]pp: If given above as a new type 143 149 * program_options::value, define and implement a validate() function here. 144 *145 * Note that the Empty..Query is always specificly present as it has not type and thus146 * does not fit into the preprocessor magic scheme (on the plus side it also serves147 * as a kind of visualization of what the preprocessor actually does).148 150 * 149 151 */ … … 157 159 158 160 virtual void queryEmpty(const std::string ="", const std::string = "")=0; 159 160 /** With the following boost::preprocessor code we generate virtual function 161 * definitions for all desired query types in the abstract class Dialog. 162 */ 163 #include "UIElements/GlobalListOfParameterQueries.hpp" 164 #include "UIElements/Dialog_impl_pre.hpp" 165 166 // iterate over all parameter query types 167 #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type 168 #define SUFFIX =0 169 #define BOOST_PP_LOCAL_MACRO(n) dialog_declaration(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, GLOBALLISTOFPARAMETERQUERIES_Type) 170 #define BOOST_PP_LOCAL_LIMITS (0, MAXPARAMETERTOKENS-1) 171 #include BOOST_PP_LOCAL_ITERATE() 172 #undef dialog_declaration 173 #undef SUFFIX 174 #endif 175 176 #include "Dialog_impl_undef.hpp" 177 /* End of preprocessor code piece */ 161 virtual void queryBoolean(Parameter<bool> &, const std::string ="", const std::string = "")=0; 162 virtual void queryInt(Parameter<int> &, const std::string ="", const std::string = "")=0; 163 virtual void queryInts(Parameter<std::vector<int> > &, const std::string ="", const std::string = "")=0; 164 virtual void queryUnsignedInt(Parameter<unsigned int> &, const std::string ="", const std::string = "")=0; 165 virtual void queryUnsignedInts(Parameter<std::vector<unsigned int> > &, const std::string ="", const std::string = "")=0; 166 virtual void queryDouble(Parameter<double> &, const std::string ="", const std::string = "")=0; 167 virtual void queryDoubles(Parameter<std::vector<double> > &, const std::string ="", const std::string = "")=0; 168 virtual void queryString(Parameter<std::string> &, const std::string ="", const std::string = "")=0; 169 virtual void queryStrings(Parameter<std::vector<std::string> > &, const std::string ="", const std::string = "")=0; 170 virtual void queryAtom(Parameter<const atom *> &, const std::string = "", const std::string = "")=0; 171 virtual void queryAtoms(Parameter<std::vector<const atom *> > &, const std::string = "", const std::string = "")=0; 172 virtual void queryMolecule(Parameter<const molecule *> &, const std::string ="", const std::string = "")=0; 173 virtual void queryMolecules(Parameter<std::vector<const molecule *> > &, const std::string ="", const std::string = "")=0; 174 virtual void queryVector(Parameter<Vector> &, const std::string ="", const std::string = "")=0; 175 virtual void queryVectors(Parameter<std::vector<Vector> > &, const std::string ="", const std::string = "")=0; 176 virtual void queryRealSpaceMatrix(Parameter<RealSpaceMatrix> &, const std::string ="", const std::string = "")=0; 177 virtual void queryElement(Parameter<const element *> &, const std::string ="", const std::string = "")=0; 178 virtual void queryElements(Parameter<std::vector<const element *> > &, const std::string ="", const std::string = "")=0; 179 virtual void queryFile(Parameter<boost::filesystem::path> &, const std::string ="", const std::string = "")=0; 180 virtual void queryFiles(Parameter< std::vector<boost::filesystem::path> > &, const std::string ="", const std::string = "")=0; 181 virtual void queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> &, const std::string ="", const std::string = "")=0; 178 182 179 183 virtual bool display(); … … 282 286 }; 283 287 288 284 289 #endif /* DIALOG_HPP_ */ -
src/UIElements/Makefile.am
r3fa16b r19dfdf 18 18 UIElements/CommandLineUI/Query/MoleculeCommandLineQuery.cpp \ 19 19 UIElements/CommandLineUI/Query/MoleculesCommandLineQuery.cpp \ 20 UIElements/CommandLineUI/Query/KeyValuePairCommandLineQuery.cpp \21 UIElements/CommandLineUI/Query/KeyValuePairsCommandLineQuery.cpp \22 20 UIElements/CommandLineUI/Query/RealSpaceMatrixCommandLineQuery.cpp \ 23 21 UIElements/CommandLineUI/Query/StringCommandLineQuery.cpp \ … … 27 25 UIElements/CommandLineUI/Query/VectorCommandLineQuery.cpp \ 28 26 UIElements/CommandLineUI/Query/VectorsCommandLineQuery.cpp \ 27 UIElements/CommandLineUI/Query/RandomNumberDistribution_ParametersCommandLineQuery.cpp \ 29 28 UIElements/CommandLineUI/CommandLineDialog.cpp \ 30 29 UIElements/CommandLineUI/CommandLineParser.cpp \ … … 91 90 UIElements/TextUI/Query/MoleculesTextQuery.cpp \ 92 91 UIElements/TextUI/Query/MoleculeTextQuery.cpp \ 93 UIElements/TextUI/Query/KeyValuePairTextQuery.cpp \94 UIElements/TextUI/Query/KeyValuePairsTextQuery.cpp \95 92 UIElements/TextUI/Query/RealSpaceMatrixTextQuery.cpp \ 96 93 UIElements/TextUI/Query/StringTextQuery.cpp \ … … 100 97 UIElements/TextUI/Query/VectorTextQuery.cpp \ 101 98 UIElements/TextUI/Query/VectorsTextQuery.cpp \ 99 UIElements/TextUI/Query/RandomNumberDistribution_ParametersTextQuery.cpp \ 102 100 UIElements/TextUI/TextDialog.cpp \ 103 101 UIElements/TextUI/TextStatusIndicator.cpp \ … … 140 138 ${VIEWHEADER} \ 141 139 UIElements/Dialog.hpp \ 142 UIElements/Dialog_impl_pre.hpp \143 UIElements/Dialog_impl_undef.hpp \144 UIElements/GlobalListOfParameterQueries.hpp \145 140 UIElements/MainWindow.hpp 146 141 … … 161 156 UIElements/Qt4/Query/MoleculesQtQuery.cpp \ 162 157 UIElements/Qt4/Query/QtQueryList.cpp \ 163 UIElements/Qt4/Query/KeyValuePairQtQuery.cpp \164 UIElements/Qt4/Query/KeyValuePairsQtQuery.cpp \165 158 UIElements/Qt4/Query/RealSpaceMatrixQtQuery.cpp \ 166 159 UIElements/Qt4/Query/StringQtQuery.cpp \ … … 170 163 UIElements/Qt4/Query/VectorQtQuery.cpp \ 171 164 UIElements/Qt4/Query/VectorsQtQuery.cpp \ 165 UIElements/Qt4/Query/RandomNumberDistribution_ParametersQtQuery.cpp \ 172 166 UIElements/Qt4/QtMainWindow.cpp \ 173 167 UIElements/Qt4/QtDialog.cpp \ -
src/UIElements/Qt4/QtDialog.cpp
r3fa16b r19dfdf 197 197 } 198 198 199 void QtDialog::queryKeyValuePair(Parameter<KeyValuePair> ¶m, const std::string title, const std::string description) 200 { 201 registerQuery(new KeyValuePairQtQuery(param, title,description,inputLayout,this)); 202 } 203 204 void QtDialog::queryKeyValuePairs(Parameter< std::vector<KeyValuePair> > ¶m, const std::string title, const std::string description) 205 { 206 registerQuery(new KeyValuePairsQtQuery(param, title,description,inputLayout,this)); 199 void QtDialog::queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> ¶m, const std::string title, const std::string description) 200 { 201 registerQuery(new RandomNumberDistribution_ParametersQtQuery(param,title,description,inputLayout,this)); 207 202 } 208 203 -
src/UIElements/Qt4/QtDialog.hpp
r3fa16b r19dfdf 35 35 36 36 virtual void queryEmpty(const std::string ="", const std::string = ""); 37 38 /** With the following boost::preprocessor code we generate virtual function39 * definitions for all desired query types in the abstract class Dialog.40 */41 #include "UIElements/GlobalListOfParameterQueries.hpp" 42 #include "UIElements/Dialog_impl_pre.hpp" 43 44 #include <boost/preprocessor/facilities/empty.hpp>45 46 // iterate over all parameter query types47 #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type48 #define SUFFIX BOOST_PP_EMPTY()49 #define BOOST_PP_LOCAL_MACRO(n) dialog_declaration(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, GLOBALLISTOFPARAMETERQUERIES_Type)50 #define BOOST_PP_LOCAL_LIMITS (0, MAXPARAMETERTOKENS-1)51 #include BOOST_PP_LOCAL_ITERATE()52 #undef dialog_declaration53 #undef SUFFIX54 #endif55 56 #include "Dialog_impl_undef.hpp" 57 /* End of preprocessor code piece */37 virtual void queryBoolean(Parameter<bool> &, const std::string ="", const std::string = ""); 38 virtual void queryInt(Parameter<int> &, const std::string ="", const std::string = ""); 39 virtual void queryInts(Parameter<std::vector<int> > &, const std::string ="", const std::string = ""); 40 virtual void queryUnsignedInt(Parameter<unsigned int> &, const std::string ="", const std::string = ""); 41 virtual void queryUnsignedInts(Parameter<std::vector<unsigned int> > &, const std::string ="", const std::string = ""); 42 virtual void queryDouble(Parameter<double> &, const std::string ="", const std::string = ""); 43 virtual void queryDoubles(Parameter<std::vector<double> > &, const std::string ="", const std::string = ""); 44 virtual void queryString(Parameter<std::string> &, const std::string ="", const std::string = ""); 45 virtual void queryStrings(Parameter<std::vector<std::string> > &, const std::string ="", const std::string = ""); 46 virtual void queryAtom(Parameter<const atom *> &, const std::string ="", const std::string = ""); 47 virtual void queryAtoms(Parameter<std::vector<const atom *> > &, const std::string ="", const std::string = ""); 48 virtual void queryMolecule(Parameter<const molecule *> &, const std::string ="", const std::string = ""); 49 virtual void queryMolecules(Parameter<std::vector<const molecule *> > &, const std::string ="", const std::string = ""); 50 virtual void queryVector(Parameter<Vector> &, const std::string ="", const std::string = ""); 51 virtual void queryVectors(Parameter<std::vector<Vector> > &, const std::string ="", const std::string = ""); 52 virtual void queryRealSpaceMatrix(Parameter<RealSpaceMatrix> &, const std::string ="", const std::string = ""); 53 virtual void queryElement(Parameter<const element *> &, const std::string ="", const std::string = ""); 54 virtual void queryElements(Parameter<std::vector<const element *> > &, const std::string ="", const std::string = ""); 55 virtual void queryFile(Parameter<boost::filesystem::path> &, const std::string ="", const std::string = ""); 56 virtual void queryFiles(Parameter<std::vector< boost::filesystem::path> > &, const std::string ="", const std::string = ""); 57 virtual void queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> &, const std::string ="", const std::string = ""); 58 58 59 59 virtual bool display(); … … 62 62 63 63 protected: 64 64 class AtomQtQuery; 65 class AtomsQtQuery; 66 class BooleanQtQuery; 67 class RealSpaceMatrixQtQuery; 68 class DoubleQtQuery; 69 class DoublesQtQuery; 70 class ElementQtQuery; 71 class ElementsQtQuery; 65 72 class EmptyQtQuery; 66 67 /** With the following boost::preprocessor code we generate forward declarations 68 * of query class for all desired query types in the Qt specialization class of 69 * Dialog. 70 */ 71 #include "UIElements/GlobalListOfParameterQueries.hpp" 72 #include "UIElements/Dialog_impl_pre.hpp" 73 74 #include <boost/preprocessor/facilities/empty.hpp> 75 76 // iterate over all parameter query types for forward declarations 77 #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type 78 #define BOOST_PP_LOCAL_MACRO(n) forward_declaration(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, QtQuery) 79 #define BOOST_PP_LOCAL_LIMITS (0, MAXPARAMETERTOKENS-1) 80 #include BOOST_PP_LOCAL_ITERATE() 81 #undef forward_declaration 82 #endif 83 84 #include "Dialog_impl_undef.hpp" 85 /* End of preprocessor code piece */ 73 class FileQtQuery; 74 class FilesQtQuery; 75 class IntQtQuery; 76 class IntsQtQuery; 77 class MoleculeQtQuery; 78 class MoleculesQtQuery; 79 class StringQtQuery; 80 class StringsQtQuery; 81 class UnsignedIntQtQuery; 82 class UnsignedIntsQtQuery; 83 class VectorQtQuery; 84 class VectorsQtQuery; 85 class RandomNumberDistribution_ParametersQtQuery; 86 86 87 87 private: -
src/UIElements/Qt4/QtMainWindow.cpp
r3fa16b r19dfdf 78 78 #include "Actions/WorldAction/OutputAsAction.hpp" 79 79 80 #include "version.h"81 80 82 81 using namespace MoleCuilder; … … 86 85 { 87 86 Q_INIT_RESOURCE(icons); 88 setWindowTitle(MOLECUILDERVERSION);89 87 theApp->setWindowIcon(QIcon(QPixmap(":/molecuildergui_logo.png"))); 90 88 QCoreApplication::setOrganizationName("ins"); -
src/UIElements/Qt4/QtUIFactory.cpp
r3fa16b r19dfdf 33 33 #endif 34 34 35 #include <iostream> 35 36 #include <cassert> 36 #include <iostream>37 #include <fstream>38 #include <string.h>39 40 #include <boost/filesystem/path.hpp>41 37 42 38 #include <Qt/qapplication.h> … … 47 43 #include "UIElements/Qt4/QtDialog.hpp" 48 44 49 // boost::python uses placement new which is incompatible with MemDebug.50 #ifdef HAVE_PYTHON51 #include "Python/PythonScripting.hpp"52 #endif53 54 45 #include "CodePatterns/MemDebug.hpp" 55 46 47 #include "version.h" 56 48 #include "Helpers/defs.hpp" 57 49 58 50 using namespace std; 59 51 60 QtUIFactory::QtUIFactory(int _argc, char **_argv) : 61 argc(1), 62 argv(new char*[1]), 63 testlauncher_Interrupted(false), 64 testlauncher_thread(NULL) 52 QtUIFactory::QtUIFactory() : 53 argc(1) 65 54 { 66 67 // check whether we are in test mode 68 if ((_argc > 1) && (isTestMode(_argv[1]))) { 69 #ifdef HAVE_BOOST_THREAD_HPP 70 std::vector<std::string> scripts; 71 scripts.reserve(_argc-1); 72 for (int i=2;i<_argc;++i) 73 scripts.push_back(std::string(_argv[i])); 74 75 // check for line-by-line execution 76 const bool SingleLineStepping = (strncmp(&_argv[1][6], "single", 6) == 0); 77 78 // prepare an extra thread 79 std::cout << "TESTLAUNCHER: Preparing " << std::endl; 80 testlauncher_thread = new boost::thread( 81 boost::bind(&QtUIFactory::testrun, this, scripts, SingleLineStepping)); 82 #else 83 std::cerr << "Boost::thread support missing! Cannot launch test scripts.\n"; 84 #endif 85 // use fake commands to not pass test stuff 86 const int length = strlen(_argv[0]); 87 argv[0] = new char[length]; 88 strncpy(_argv[0],_argv[0], length); 89 app = new QApplication(argc,argv); 90 } else { 91 app = new QApplication(_argc,_argv); 92 } 55 // For now we just fake the command line parameters to make QT happy 56 argv = new char*[1]; 57 argv[0] = new char[256]; 58 strcpy(argv[0],MOLECUILDERVERSION); 59 app = new QApplication(argc,argv); 93 60 } 94 61 95 62 QtUIFactory::~QtUIFactory() 96 63 { 97 if (testlauncher_thread != NULL) { 98 // notify testlauncher_thread thread that we wish to terminate 99 testlauncher_thread->interrupt(); 100 // wait till it ends 101 testlauncher_thread->join(); 102 // and remove 103 delete testlauncher_thread; 104 } 105 // free fake command line argument arrays 106 delete[] argv[0]; 107 delete[] argv; 64 //delete app; 65 delete [] argv[0]; 66 delete [] argv; 108 67 } 109 68 … … 116 75 } 117 76 118 QtUIFactory::description::description(int _argc, char **_argv) : 119 UIFactory::factoryDescription("Qt4"), 120 argc(_argc), 121 argv(_argv) 77 QtUIFactory::description::description() : 78 UIFactory::factoryDescription("Qt4") 122 79 {} 123 80 … … 126 83 127 84 UIFactory* QtUIFactory::description::makeFactory(){ 128 return new QtUIFactory( argc, argv);85 return new QtUIFactory(); 129 86 } 130 131 bool QtUIFactory::isTestMode(const char *_argument)132 {133 return (strncmp(_argument,"--test", 6) == 0);134 }135 136 void QtUIFactory::testrun(const std::vector<std::string> _scripts, const bool _singleLineStepping) const137 {138 std::cout << "TESTLAUNCHER: Waiting for GUI to set up" << std::endl;139 testlauncher_sleep(boost::posix_time::seconds(3));140 141 std::vector<std::string>::const_iterator scriptiter = _scripts.begin();142 do {143 // then launch script144 std::cout << "TESTLAUNCHER: Launching script " << *scriptiter145 << (_singleLineStepping ? " line by line." : ".") <<std::endl;146 if (_singleLineStepping) {147 boost::filesystem::path scriptfilename(*scriptiter);148 ASSERT( boost::filesystem::exists(scriptfilename),149 "QtUIFactory::testrun() - given testmode script file "150 +toString(scriptfilename.string())+" does not exist.");151 std::ifstream scriptfile(scriptfilename.string().c_str());152 std::string scriptfile_line;153 const std::string testmode("testmode, line nr.");154 unsigned int line_nr = 0;155 while(std::getline(scriptfile, scriptfile_line)) {156 std::string scriptname = testmode+toString(++line_nr);157 executePythonScript(scriptfile_line, scriptname);158 }159 } else {160 executePythonScriptFile(*scriptiter);161 }162 ++scriptiter;163 164 std::cout << "TESTLAUNCHER: Sleeping after script" << std::endl;165 testlauncher_sleep(boost::posix_time::seconds(1.5));166 167 } while ((scriptiter != _scripts.end()) && (!testlauncher_Interrupted));168 169 // send quit signal170 std::cout << "TESTLAUNCHER: Quitting" << std::endl;171 app->quit();172 }173 174 void QtUIFactory::testlauncher_sleep(const boost::posix_time::time_duration& _period) const175 {176 try {177 // first sleep for four seconds178 #if BOOST_VERSION < 105000179 testlauncher_thread->sleep(boost::get_system_time() + _period);180 #else181 boost::this_thread::sleep_for(boost::chrono::seconds(4));182 #endif183 } catch(boost::thread_interrupted &e) {184 LOG(2, "INFO: testlauncher thread has received stop signal.");185 }186 } -
src/UIElements/Qt4/QtUIFactory.hpp
r3fa16b r19dfdf 17 17 #include "UIElements/UIFactory.hpp" 18 18 19 #include <boost/thread.hpp>20 #include <string>21 #include <vector>22 23 19 class QApplication; 24 20 … … 34 30 35 31 struct description : public UIFactory::factoryDescription { 36 description( int _argc, char **_argv);32 description(); 37 33 virtual ~description(); 38 34 39 35 virtual UIFactory* makeFactory(); 40 41 private: 42 int argc; 43 char **argv; 44 }; 36 }; 45 37 virtual std::string getUIName(){ return "Qt4"; } 46 38 47 static bool isTestMode(const char *_argument);48 49 39 protected: 50 QtUIFactory( int _argc, char **_argv);40 QtUIFactory(); 51 41 52 42 private: 53 54 void testrun(const std::vector<std::string> _scripts, const bool _singleLineStepping = false) const; 55 56 void testlauncher_sleep(const boost::posix_time::time_duration& _period) const; 57 58 private: 59 QApplication *app; 60 43 // faked command line arguments 61 44 int argc; 62 45 char **argv; 63 64 //!> internal flag to tell testlauncher_thread to stop 65 mutable bool testlauncher_Interrupted; 66 67 //!> internal thread to call Actions 68 boost::thread *testlauncher_thread; 46 QApplication *app; 69 47 }; 70 48 -
src/UIElements/Qt4/Query/QtQuery.hpp
r3fa16b r19dfdf 17 17 #include <Qt/qwidget.h> 18 18 #include "Qt4/QtDialog.hpp" 19 #include "Parameters/Parameter.hpp" 19 20 #include "QtQueryList.hpp" 20 21 #include "Parameters/Parameter.hpp"22 21 23 22 class QHBoxLayout; … … 301 300 }; 302 301 303 class QtDialog::KeyValuePairQtQuery : public QWidget, public QtQuery<KeyValuePair> {304 Q_OBJECT305 public:306 KeyValuePairQtQuery(Parameter<KeyValuePair> &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);307 virtual ~KeyValuePairQtQuery();308 309 public slots:310 void onUpdate(const QString&);311 void onUpdateCombo(int index);312 313 private:314 QBoxLayout *parent;315 QBoxLayout *thisLayout;316 QLabel *titleLabel;317 QLineEdit *inputBox;318 QComboBox *comboBox;319 Dialog *dialog;320 };321 322 class QtDialog::KeyValuePairsQtQuery : public QWidget, public QtQuery<std::vector<KeyValuePair> >, public QtQueryList<KeyValuePair> {323 Q_OBJECT324 public:325 KeyValuePairsQtQuery(Parameter<std::vector<KeyValuePair> > &, const std::string &_title, const std::string &description, QBoxLayout *_parent,Dialog *_dialog);326 virtual ~KeyValuePairsQtQuery();327 328 virtual void onSubUpdate();329 330 public slots:331 void onAddElement();332 void onRemoveElement();333 void onElementSelected();334 335 private:336 KeyValuePairQtQuery *subQuery;337 };338 339 302 class QtDialog::StringQtQuery : public QWidget, public QtQuery<std::string> { 340 303 Q_OBJECT … … 448 411 }; 449 412 413 class QtDialog::RandomNumberDistribution_ParametersQtQuery : public QWidget, public QtQuery<RandomNumberDistribution_Parameters> { 414 Q_OBJECT 415 public: 416 RandomNumberDistribution_ParametersQtQuery(Parameter<RandomNumberDistribution_Parameters> &, const std::string &_title, const std::string &_description,QBoxLayout *,Dialog *); 417 virtual ~RandomNumberDistribution_ParametersQtQuery(); 418 419 public slots: 420 void onUpdate(); 421 422 private: 423 QBoxLayout *parent; 424 QHBoxLayout *thisLayout; 425 QLabel *titleLabel; 426 QTextEdit *inputBox; 427 QPushButton *okButton; 428 Dialog *dialog; 429 }; 430 450 431 #endif /* QTQUERY_HPP_ */ -
src/UIElements/Qt4/Query/QtQueryList.hpp
r3fa16b r19dfdf 142 142 virtual void queryFile(Parameter<boost::filesystem::path> &, const std::string = "", const std::string = ""){} 143 143 virtual void queryFiles(Parameter<std::vector< boost::filesystem::path> > &, const std::string = "", const std::string = ""){} 144 virtual void queryKeyValuePair(Parameter<KeyValuePair> &, const std::string = "", const std::string = ""){} 145 virtual void queryKeyValuePairs(Parameter<std::vector<KeyValuePair> > &, const std::string = "", const std::string = ""){} 146 144 virtual void queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> &, const std::string = "", const std::string = ""){} 147 145 private: 148 146 QtQueryListUntyped *parent; -
src/UIElements/TextUI/Query/TextQuery.hpp
r3fa16b r19dfdf 17 17 #include "TextUI/TextDialog.hpp" 18 18 19 class TextDialog::AtomTextQuery : public Dialog::TQuery<const atom *> { 20 public: 21 AtomTextQuery(Parameter<const atom *> &, const std::string &_title, const std::string &_description = NULL); 22 virtual ~AtomTextQuery(); 23 virtual bool handle(); 24 }; 25 26 class TextDialog::AtomsTextQuery : public Dialog::TQuery<std::vector<const atom *> > { 27 public: 28 AtomsTextQuery(Parameter<std::vector<const atom *> > &, const std::string &_title, const std::string &_description = NULL); 29 virtual ~AtomsTextQuery(); 30 virtual bool handle(); 31 }; 32 33 class TextDialog::BooleanTextQuery : public Dialog::TQuery<bool> { 34 public: 35 BooleanTextQuery(Parameter<bool> &, const std::string &_title, const std::string &_description = NULL); 36 virtual ~BooleanTextQuery(); 37 virtual bool handle(); 38 }; 39 40 class TextDialog::RealSpaceMatrixTextQuery : public Dialog::TQuery<RealSpaceMatrix> { 41 public: 42 RealSpaceMatrixTextQuery(Parameter<RealSpaceMatrix> &, const std::string &_title, const std::string &_description = NULL); 43 virtual ~RealSpaceMatrixTextQuery(); 44 virtual bool handle(); 45 }; 46 47 class TextDialog::DoubleTextQuery : public Dialog::TQuery<double> { 48 public: 49 DoubleTextQuery(Parameter<double> &, const std::string &_title, const std::string &_description = NULL); 50 virtual ~DoubleTextQuery(); 51 virtual bool handle(); 52 }; 53 54 class TextDialog::DoublesTextQuery : public Dialog::TQuery<std::vector<double> > { 55 public: 56 DoublesTextQuery(Parameter<std::vector<double> > &, const std::string &_title, const std::string &_description = NULL); 57 virtual ~DoublesTextQuery(); 58 virtual bool handle(); 59 }; 60 61 class TextDialog::ElementTextQuery : public Dialog::TQuery<const element *> { 62 public: 63 ElementTextQuery(Parameter<const element *> &, const std::string &_title, const std::string &_description = NULL); 64 virtual ~ElementTextQuery(); 65 virtual bool handle(); 66 }; 67 68 class TextDialog::ElementsTextQuery : public Dialog::TQuery<std::vector<const element *> > { 69 public: 70 ElementsTextQuery(Parameter<std::vector<const element *> > &, const std::string &_title, const std::string &_description = NULL); 71 virtual ~ElementsTextQuery(); 72 virtual bool handle(); 73 }; 74 19 75 class TextDialog::EmptyTextQuery : public Dialog::EmptyQuery { 20 76 public: … … 24 80 }; 25 81 82 class TextDialog::FileTextQuery : public Dialog::TQuery<boost::filesystem::path> { 83 public: 84 FileTextQuery(Parameter<boost::filesystem::path> &, const std::string &_title, const std::string &_description = NULL); 85 virtual ~FileTextQuery(); 86 virtual bool handle(); 87 }; 26 88 27 /** With the following boost::preprocessor code we generate forward declarations 28 * of query class for all desired query types in the Qt specialization class of 29 * Dialog.30 */31 #include "UIElements/GlobalListOfParameterQueries.hpp" 32 #include "UIElements/Dialog_impl_pre.hpp" 89 class TextDialog::FilesTextQuery : public Dialog::TQuery<std::vector<boost::filesystem::path> > { 90 public: 91 FilesTextQuery(Parameter<std::vector< boost::filesystem::path> > ¶m, const std::string &_title, const std::string &_description = NULL); 92 virtual ~FilesTextQuery(); 93 virtual bool handle(); 94 }; 33 95 34 #include <boost/preprocessor/facilities/empty.hpp> 96 class TextDialog::IntTextQuery : public Dialog::TQuery<int> { 97 public: 98 IntTextQuery(Parameter<int> &, const std::string &_title, const std::string &_description = NULL); 99 virtual ~IntTextQuery(); 100 virtual bool handle(); 101 }; 35 102 36 // iterate over all parameter query types for forward declarations 37 #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type 38 #define BOOST_PP_LOCAL_MACRO(n) queryclass_definition(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, GLOBALLISTOFPARAMETERQUERIES_Type, Text) 39 #define BOOST_PP_LOCAL_LIMITS (0, MAXPARAMETERTOKENS-1) 40 #include BOOST_PP_LOCAL_ITERATE() 41 #undef queryclass_definition 42 #endif 103 class TextDialog::IntsTextQuery : public Dialog::TQuery<std::vector<int> > { 104 public: 105 IntsTextQuery(Parameter<std::vector<int> > &, const std::string &_title, const std::string &_description = NULL); 106 virtual ~IntsTextQuery(); 107 virtual bool handle(); 108 }; 43 109 44 #include "Dialog_impl_undef.hpp" 45 /* End of preprocessor code piece */ 110 class TextDialog::MoleculeTextQuery : public Dialog::TQuery<const molecule *> { 111 public: 112 MoleculeTextQuery(Parameter<const molecule *> &, const std::string &_title, const std::string &_description = NULL); 113 virtual ~MoleculeTextQuery(); 114 virtual bool handle(); 115 }; 46 116 117 class TextDialog::MoleculesTextQuery : public Dialog::TQuery<std::vector<const molecule *> > { 118 public: 119 MoleculesTextQuery(Parameter<std::vector<const molecule *> > &, const std::string &_title, const std::string &_description = NULL); 120 virtual ~MoleculesTextQuery(); 121 virtual bool handle(); 122 }; 123 124 class TextDialog::StringTextQuery : public Dialog::TQuery<std::string> { 125 public: 126 StringTextQuery(Parameter<std::string> &, const std::string &_title, const std::string &_description = NULL); 127 virtual ~StringTextQuery(); 128 virtual bool handle(); 129 }; 130 131 class TextDialog::StringsTextQuery : public Dialog::TQuery<std::vector<std::string> > { 132 public: 133 StringsTextQuery(Parameter<std::vector<std::string> > &, const std::string &_title, const std::string &_description = NULL); 134 virtual ~StringsTextQuery(); 135 virtual bool handle(); 136 }; 137 138 class TextDialog::UnsignedIntTextQuery : public Dialog::TQuery<unsigned int> { 139 public: 140 UnsignedIntTextQuery(Parameter<unsigned int> &, const std::string &_title, const std::string &_description = NULL); 141 virtual ~UnsignedIntTextQuery(); 142 virtual bool handle(); 143 }; 144 145 class TextDialog::UnsignedIntsTextQuery : public Dialog::TQuery<std::vector<unsigned int> > { 146 public: 147 UnsignedIntsTextQuery(Parameter<std::vector<unsigned int> > &, const std::string &_title, const std::string &_description = NULL); 148 virtual ~UnsignedIntsTextQuery(); 149 virtual bool handle(); 150 }; 151 152 class TextDialog::VectorTextQuery : public Dialog::TQuery<Vector> { 153 public: 154 VectorTextQuery(Parameter<Vector> &, const std::string &_title, const std::string &_description = NULL); 155 virtual ~VectorTextQuery(); 156 virtual bool handle(); 157 }; 158 159 class TextDialog::VectorsTextQuery : public Dialog::TQuery<std::vector<Vector> > { 160 public: 161 VectorsTextQuery(Parameter<std::vector<Vector> > &, const std::string &_title, const std::string &_description = NULL); 162 virtual ~VectorsTextQuery(); 163 virtual bool handle(); 164 }; 165 166 class TextDialog::RandomNumberDistribution_ParametersTextQuery : public Dialog::TQuery<RandomNumberDistribution_Parameters> { 167 public: 168 RandomNumberDistribution_ParametersTextQuery(Parameter<RandomNumberDistribution_Parameters> &, const std::string &_title, const std::string &_description = NULL); 169 virtual ~RandomNumberDistribution_ParametersTextQuery(); 170 virtual bool handle(); 171 }; 47 172 48 173 #endif /* TEXTQUERY_HPP_ */ -
src/UIElements/TextUI/TextDialog.cpp
r3fa16b r19dfdf 134 134 } 135 135 136 void TextDialog::queryKeyValuePair(Parameter<KeyValuePair> ¶m, const std::string title, const std::string description) 137 { 138 registerQuery(new KeyValuePairTextQuery(param, title,description)); 136 void TextDialog::queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> &_param, const std::string title, const std::string description){ 137 registerQuery(new RandomNumberDistribution_ParametersTextQuery(_param, title,description)); 139 138 } 140 139 141 void TextDialog::queryKeyValuePairs(Parameter< std::vector<KeyValuePair> > ¶m, const std::string title, const std::string description)142 {143 registerQuery(new KeyValuePairsTextQuery(param, title,description));144 }145 140 146 141 /************************** Query Infrastructure ************************/ -
src/UIElements/TextUI/TextDialog.hpp
r3fa16b r19dfdf 22 22 class element; 23 23 class molecule; 24 class KeyValuePair;25 24 class RealSpaceMatrix; 26 25 class Vector; … … 33 32 34 33 virtual void queryEmpty(const std::string ="", const std::string = ""); 35 36 /** With the following boost::preprocessor code we generate virtual function37 * definitions for all desired query types in the abstract class Dialog.38 */39 #include "UIElements/GlobalListOfParameterQueries.hpp" 40 #include "UIElements/Dialog_impl_pre.hpp" 41 42 #include <boost/preprocessor/facilities/empty.hpp>43 44 // iterate over all parameter query types45 #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type46 #define SUFFIX BOOST_PP_EMPTY()47 #define BOOST_PP_LOCAL_MACRO(n) dialog_declaration(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, GLOBALLISTOFPARAMETERQUERIES_Type)48 #define BOOST_PP_LOCAL_LIMITS (0, MAXPARAMETERTOKENS-1)49 #include BOOST_PP_LOCAL_ITERATE()50 #undef dialog_declaration51 #undef SUFFIX52 #endif53 54 #include "Dialog_impl_undef.hpp" 55 /* End of preprocessor code piece */34 virtual void queryBoolean(Parameter<bool> &, const std::string ="", const std::string = ""); 35 virtual void queryInt(Parameter<int> &, const std::string ="", const std::string = ""); 36 virtual void queryInts(Parameter<std::vector<int> > &, const std::string ="", const std::string = ""); 37 virtual void queryUnsignedInt(Parameter<unsigned int> &, const std::string ="", const std::string = ""); 38 virtual void queryUnsignedInts(Parameter<std::vector<unsigned int> > &, const std::string ="", const std::string = ""); 39 virtual void queryString(Parameter<std::string> &, const std::string ="", const std::string = ""); 40 virtual void queryStrings(Parameter<std::vector<std::string> > &, const std::string ="", const std::string = ""); 41 virtual void queryDouble(Parameter<double> &, const std::string ="", const std::string = ""); 42 virtual void queryDoubles(Parameter<std::vector<double> > &, const std::string ="", const std::string = ""); 43 virtual void queryAtom(Parameter<const atom *> &, const std::string = "",std::string = ""); 44 virtual void queryAtoms(Parameter<std::vector<const atom *> > &, const std::string = "",std::string = ""); 45 virtual void queryMolecule(Parameter<const molecule *> &, const std::string = "",std::string = ""); 46 virtual void queryMolecules(Parameter<std::vector<const molecule *> > &, const std::string = "",std::string = ""); 47 virtual void queryVector(Parameter<Vector> &, const std::string ="", const std::string = ""); 48 virtual void queryVectors(Parameter<std::vector<Vector> > &, const std::string ="", const std::string = ""); 49 virtual void queryRealSpaceMatrix(Parameter<RealSpaceMatrix> &, const std::string ="", const std::string = ""); 50 virtual void queryElement(Parameter<const element *> &, const std::string ="", const std::string = ""); 51 virtual void queryElements(Parameter<std::vector<const element *> > &, const std::string ="", const std::string = ""); 52 virtual void queryFile(Parameter<boost::filesystem::path> &, const std::string ="", const std::string = ""); 53 virtual void queryFiles(Parameter<std::vector<boost::filesystem::path> > &, const std::string ="", const std::string = ""); 54 virtual void queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> &, const std::string ="", const std::string = ""); 56 55 57 56 protected: 58 57 // specialized stuff for text queries 58 // all placed into Query/TextQuery.hpp 59 // !please adhere to alphabetical ordering! 60 class AtomTextQuery; 61 class AtomsTextQuery; 62 class BooleanTextQuery; 63 class DoubleTextQuery; 64 class DoublesTextQuery; 65 class ElementTextQuery; 66 class ElementsTextQuery; 59 67 class EmptyTextQuery; 60 61 /** With the following boost::preprocessor code we generate forward declarations 62 * of query class for all desired query types in the Qt specialization class of 63 * Dialog. 64 */ 65 #include "UIElements/GlobalListOfParameterQueries.hpp" 66 #include "UIElements/Dialog_impl_pre.hpp" 67 68 #include <boost/preprocessor/facilities/empty.hpp> 69 70 // iterate over all parameter query types for forward declarations 71 #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type 72 #define BOOST_PP_LOCAL_MACRO(n) forward_declaration(~, n, GLOBALLISTOFPARAMETERQUERIES_Token, TextQuery) 73 #define BOOST_PP_LOCAL_LIMITS (0, MAXPARAMETERTOKENS-1) 74 #include BOOST_PP_LOCAL_ITERATE() 75 #undef forward_declaration 76 #endif 77 78 #include "Dialog_impl_undef.hpp" 79 /* End of preprocessor code piece */ 80 68 class FileTextQuery; 69 class FilesTextQuery; 70 class IntTextQuery; 71 class IntsTextQuery; 72 class MoleculeTextQuery; 73 class MoleculesTextQuery; 74 class RealSpaceMatrixTextQuery; 75 class StringTextQuery; 76 class StringsTextQuery; 77 class UnsignedIntTextQuery; 78 class UnsignedIntsTextQuery; 79 class VectorTextQuery; 80 class VectorsTextQuery; 81 class RandomNumberDistribution_ParametersTextQuery; 81 82 }; 82 83 -
src/UIElements/Views/Qt4/QDebugStream.hpp
r3fa16b r19dfdf 33 33 { 34 34 public: 35 QDebugStream(std::ostream &stream, QTextEdit* text_edit) : 36 m_stream(stream), 37 printing(false) 35 QDebugStream(std::ostream &stream, QTextEdit* text_edit) : m_stream(stream) 38 36 { 39 37 log_window = text_edit; … … 56 54 { 57 55 if (v == '\n') { 58 while (printing);59 printing = true;60 56 log_window->append(m_string.c_str()); 61 57 qDebug() << m_string.c_str(); 62 58 m_string.erase(m_string.begin(), m_string.end()); 63 printing = false;64 59 } else 65 60 m_string += v; … … 70 65 virtual std::streamsize xsputn(const char *p, std::streamsize n) 71 66 { 72 while (printing);73 printing = true;74 67 m_string.append(p, p + n); 75 printing = false;76 68 77 69 size_t pos = 0; … … 80 72 if (pos != std::string::npos) { 81 73 std::string tmp(m_string.begin(), m_string.begin() + pos); 82 while (printing);83 printing = true;84 74 log_window->append(tmp.c_str()); 85 75 qDebug() << tmp.c_str(); 86 76 m_string.erase(m_string.begin(), m_string.begin() + pos + 1); 87 printing = false;88 77 } 89 78 } … … 97 86 std::string m_string; 98 87 99 bool printing;100 101 88 QTextEdit* log_window; 102 89 }; -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject.cpp
r3fa16b r19dfdf 169 169 painter->modelViewMatrix().push(); 170 170 painter->modelViewMatrix().translate(m_position); 171 if ((m_scaleX != 1.0f) || (m_scaleY != 1.0f) || (m_scaleZ != 1.0f)) 172 painter->modelViewMatrix().scale(m_scaleX, m_scaleY, m_scaleZ); 171 173 if (m_rotationAngle != 0.0f) 172 174 painter->modelViewMatrix().rotate(m_rotationAngle, m_rotationVector); 173 if ((m_scaleX != 1.0f) || (m_scaleY != 1.0f) || (m_scaleZ != 1.0f))174 painter->modelViewMatrix().scale(m_scaleX, m_scaleY, m_scaleZ);175 175 176 176 // Apply the material and effect to the painter. -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.cpp
r3fa16b r19dfdf 329 329 } 330 330 } 331 if (DoResetPosition) 331 if (DoResetPosition) { 332 332 resetPosition(); 333 if (DoResetWidth) 333 emit changed(); 334 } 335 if (DoResetWidth) { 334 336 resetWidth(); 335 if ((DoResetPosition) || (DoResetWidth))336 337 emit changed(); 338 } 337 339 } 338 340 -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp
r3fa16b r19dfdf 71 71 double minradius = 2.; // TODO: set to maximum bond length value 72 72 LOG(3, "DEBUG: Molecule fits into sphere of radius " << minradius); 73 // check minimum bond radius in molecule 74 double minlength = std::numeric_limits<double>::max(); 75 for (molecule::const_iterator iter = molref->begin(); 76 iter != molref->end(); ++iter) { 77 const BondList &ListOfBonds = (*iter)->getListOfBonds(); 78 for (BondList::const_iterator bonditer = ListOfBonds.begin(); 79 bonditer != ListOfBonds.end(); ++bonditer) { 80 const double bond_distance = (*bonditer)->GetDistance(); 81 minlength = std::min(bond_distance, minlength); 82 } 83 } 84 minradius = std::max( std::max(minradius, minlength), 1.); 73 if (minradius < 1.) 74 minradius = 1.; 85 75 86 76 QGeometryData geo; … … 467 457 painter->modelViewMatrix().push(); 468 458 painter->modelViewMatrix().translate(m_position); 459 if ((m_scaleX != 1.0f) || (m_scaleY != 1.0f) || (m_scaleZ != 1.0f)) 460 painter->modelViewMatrix().scale(m_scaleX, m_scaleY, m_scaleZ); 469 461 if (m_rotationAngle != 0.0f) 470 462 painter->modelViewMatrix().rotate(m_rotationAngle, m_rotationVector); 471 if ((m_scaleX != 1.0f) || (m_scaleY != 1.0f) || (m_scaleZ != 1.0f))472 painter->modelViewMatrix().scale(m_scaleX, m_scaleY, m_scaleZ);473 463 474 464 // Draw a box around the mesh, if selected. -
src/World.cpp
r3fa16b r19dfdf 48 48 #include "Descriptors/AtomDescriptor.hpp" 49 49 #include "Descriptors/AtomDescriptor_impl.hpp" 50 #include "Descriptors/AtomIdDescriptor.hpp"51 50 #include "Descriptors/AtomSelectionDescriptor.hpp" 52 51 #include "Descriptors/MoleculeDescriptor.hpp" 53 52 #include "Descriptors/MoleculeDescriptor_impl.hpp" 54 #include "Descriptors/MoleculeIdDescriptor.hpp"55 53 #include "Descriptors/MoleculeSelectionDescriptor.hpp" 56 54 #include "Descriptors/SelectiveConstIterator_impl.hpp" … … 228 226 const atom * const Walker = (*bonditer)->leftatom; 229 227 const atom * const OtherWalker = (*bonditer)->rightatom; 230 bond::ptr const _bond = 231 const_cast<atom *>(Walker)->addBond(_deststep, const_cast<atom *>(OtherWalker)); 232 _bond->setDegree((*bonditer)->getDegree()); 228 const_cast<atom *>(Walker)->addBond(_deststep, const_cast<atom *>(OtherWalker)); 233 229 } 234 230 } … … 563 559 OBSERVE; 564 560 NOTIFY(SelectionChanged); 565 const atomIdsVector_t atomids = selectedAtoms_Stack.top(); 566 boost::function<void (const atomId_t)> IdSelector = 567 boost::bind(static_cast<void (World::*)(const atomId_t)>(&World::selectAtom), this, _1); 568 selectedAtoms.clear(); 569 std::for_each(atomids.begin(),atomids.end(), IdSelector); 561 selectedAtoms = selectedAtoms_Stack.top(); 570 562 selectedAtoms_Stack.pop(); 571 563 } … … 574 566 OBSERVE; 575 567 NOTIFY(SelectionChanged); 576 atomIdsVector_t atomids(countSelectedAtoms(), (atomId_t)-1); 577 std::copy( 578 MapKeyIterator<AtomSelectionConstIterator>(beginAtomSelection()), 579 MapKeyIterator<AtomSelectionConstIterator>(endAtomSelection()), 580 atomids.begin()); 581 selectedAtoms_Stack.push( atomids ); 568 selectedAtoms_Stack.push( selectedAtoms ); 582 569 selectedAtoms.clear(); 583 570 } … … 716 703 OBSERVE; 717 704 NOTIFY(SelectionChanged); 718 const moleculeIdsVector_t moleculeids = selectedMolecules_Stack.top(); 719 boost::function<void (const moleculeId_t)> IdSelector = 720 boost::bind(static_cast<void (World::*)(const moleculeId_t)>(&World::selectMolecule), this, _1); 721 selectedMolecules.clear(); 722 std::for_each(moleculeids.begin(),moleculeids.end(), IdSelector); 705 selectedMolecules = selectedMolecules_Stack.top(); 723 706 selectedMolecules_Stack.pop(); 724 707 } … … 727 710 OBSERVE; 728 711 NOTIFY(SelectionChanged); 729 moleculeIdsVector_t moleculeids(countSelectedMolecules(), (moleculeId_t)-1); 730 boost::function<moleculeId_t (const molecule*)> IdRetriever = 731 boost::bind(&molecule::getId, _1); 732 std::copy( 733 MapKeyIterator<MoleculeSelectionConstIterator>(beginMoleculeSelection()), 734 MapKeyIterator<MoleculeSelectionConstIterator>(endMoleculeSelection()), 735 moleculeids.begin()); 736 selectedMolecules_Stack.push( moleculeids ); 712 selectedMolecules_Stack.push( selectedMolecules ); 737 713 selectedMolecules.clear(); 738 714 } -
src/World.hpp
r3fa16b r19dfdf 491 491 AtomSet atoms; 492 492 AtomSet selectedAtoms; 493 typedef std::vector<atomId_t> atomIdsVector_t; 494 std::stack<atomIdsVector_t> selectedAtoms_Stack; 493 std::stack<AtomSet> selectedAtoms_Stack; 495 494 /** 496 495 * stores the pool for all available AtomIds below currAtomId … … 502 501 MoleculeSet molecules; 503 502 MoleculeSet selectedMolecules; 504 typedef std::vector<moleculeId_t> moleculeIdsVector_t; 505 std::stack<moleculeIdsVector_t> selectedMolecules_Stack; 503 std::stack<MoleculeSet> selectedMolecules_Stack; 506 504 /** 507 505 * stores the pool for all available AtomIds below currAtomId -
src/builder_init.cpp
r3fa16b r19dfdf 126 126 // if we have python, autoexecute a molecuilder script in current folder 127 127 #ifdef HAVE_PYTHON 128 const boost::filesystem::path pythonfilename("./molecuilder.py");129 executePythonScript File(pythonfilename);128 const std::string pythonfilename_string("./molecuilder.py"); 129 executePythonScript(pythonfilename_string); 130 130 #endif 131 131 132 132 // handle remaining arguments by CommandLineParser 133 // first argument of "--test" initializes special molecuilder gui test mode 134 if ((argc>1) 135 #ifdef USE_GUI_QT 136 && !QtUIFactory::isTestMode(argv[1]) 137 #endif 138 ) { 133 if (argc>1) { 139 134 LOG(0, "Setting UI to CommandLine."); 140 135 CommandLineParser::getInstance().InitializeCommandArguments(); … … 144 139 } else { 145 140 // In the interactive mode, we can leave the user the choice in case of error 141 ASSERT_DO(Assert::Ask); 146 142 #ifdef USE_GUI_QT 147 if ((argc>1) && (QtUIFactory::isTestMode(argv[1])))148 ASSERT_DO(Assert::Abort);149 else150 ASSERT_DO(Assert::Ask);151 143 LOG(0, "Setting UI to Qt4."); 152 UIFactory::registerFactory(new QtUIFactory::description( argc, argv));144 UIFactory::registerFactory(new QtUIFactory::description()); 153 145 UIFactory::makeUserInterface("Qt4"); 154 146 #else 155 ASSERT_DO(Assert::Ask);156 147 LOG(0, "Setting UI to Text."); 157 148 cout << MOLECUILDERVERSION << endl; -
tests/Calculations/testsuite-calculations-1_2-dimethoxyethane.at
r3fa16b r19dfdf 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr]) 48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0) 49 48 50 49 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-1_2-dimethylbenzene.at
r3fa16b r19dfdf 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr]) 48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0) 49 48 50 49 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-2-methylcyclohexanone.at
r3fa16b r19dfdf 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr]) 48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0) 49 48 50 49 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-N_N-dimethylacetamide.at
r3fa16b r19dfdf 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr]) 48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0) 49 48 50 49 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-anthracene.at
r3fa16b r19dfdf 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr]) 48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0) 49 48 50 49 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-benzene.at
r3fa16b r19dfdf 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr]) 48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0) 49 48 50 49 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-cholesterol.at
r3fa16b r19dfdf 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr]) 48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0) 49 48 50 49 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-coronene.at
r3fa16b r19dfdf 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr]) 48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0) 49 48 50 49 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-cycloheptane.at
r3fa16b r19dfdf 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr]) 48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0) 49 48 50 49 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-dimethyl_bromomalonate.at
r3fa16b r19dfdf 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr]) 48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0) 49 48 50 49 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-glucose.at
r3fa16b r19dfdf 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr]) 48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0) 49 48 50 49 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-heptan.at
r3fa16b r19dfdf 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr]) 48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0) 49 48 50 49 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-isoleucine.at
r3fa16b r19dfdf 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr]) 48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0) 49 48 50 49 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-mpqc.at
r3fa16b r19dfdf 30 30 ignore, 31 31 ignore) 32 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr])33 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0)34 35 32 AT_CLEANUP -
tests/Calculations/testsuite-calculations-naphthalene.at
r3fa16b r19dfdf 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr]) 48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0) 49 48 50 49 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-neohexane.at
r3fa16b r19dfdf 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr]) 48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0) 49 48 50 49 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-phenanthrene.at
r3fa16b r19dfdf 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr]) 48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0) 49 48 50 49 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-proline.at
r3fa16b r19dfdf 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr]) 48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0) 49 48 50 49 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-putrescine.at
r3fa16b r19dfdf 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr]) 48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0) 49 48 50 49 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-tartaric_acid.at
r3fa16b r19dfdf 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk '{print $2}'], 0, [stdout], [stderr]) 48 AT_CHECK([cat stdout | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($1 - energy)/energy) > 1e-5) exit(1)}'], 0) 47 AT_CHECK([tail -n 1 ${FILENAME}_Energy.dat | awk -v energy=$ENERGY 'function abs(x){return ((x < 0.0) ? -x : x)} {if (abs(($2 - energy)/energy) > 1e-5) exit(1)}'], 0) 49 48 50 49 AT_CLEANUP 50 -
tests/Makefile.am
r3fa16b r19dfdf 4 4 Calculations \ 5 5 CodeChecks \ 6 GuiChecks \7 6 regression \ 8 7 Fragmentations \ … … 11 10 JobMarket 12 11 13 .PHONY: extracheck guicheckinstallextracheck12 .PHONY: extracheck installextracheck 14 13 15 guicheck:16 cd GuiChecks && $(MAKE) guicheck17 14 extracheck: 18 15 cd Calculations && $(MAKE) extracheck -
tests/regression/Atoms/testsuite-atoms.at
r3fa16b r19dfdf 44 44 # mirror atoms 45 45 m4_include([Atoms/Mirror/testsuite-atoms-mirror.at]) 46 47 # saturate atoms48 m4_include([Atoms/Saturate/testsuite-atoms-saturate_carbon.at])49 m4_include([Atoms/Saturate/testsuite-atoms-saturate_nitrogen.at]) -
tests/regression/Bond/Add/testsuite-bond-add.at
r3fa16b r19dfdf 19 19 20 20 AT_SETUP([Bond - adding bond]) 21 AT_KEYWORDS([bond add-bond s])21 AT_KEYWORDS([bond add-bond]) 22 22 file=test.pdb 23 23 AT_CHECK([cp -f ${abs_top_srcdir}/tests/regression/Bond/Add/pre/$file $file], 0, [ignore], [ignore]) 24 24 AT_CHECK([chmod +w $file], 0, [ignore], [ignore]) 25 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --add-bond s], 0, [ignore], [ignore])26 AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Add/post/ $file], 0, [ignore], [ignore])25 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --add-bond], 0, [ignore], [ignore]) 26 AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Add/post/test.pdb], 0, [ignore], [ignore]) 27 27 AT_CLEANUP 28 28 29 29 30 30 AT_SETUP([Bond - adding bond with Undo]) 31 AT_KEYWORDS([bond add-bond sundo])31 AT_KEYWORDS([bond add-bond undo]) 32 32 file=test.pdb 33 33 AT_CHECK([cp -f ${abs_top_srcdir}/tests/regression/Bond/Add/pre/$file $file], 0, [ignore], [ignore]) 34 34 AT_CHECK([chmod +w $file], 0, [ignore], [ignore]) 35 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --add-bond s--undo], 0, [ignore], [ignore])36 AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Add/pre/ $file], 0, [ignore], [ignore])35 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --add-bond --undo], 0, [ignore], [ignore]) 36 AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Add/pre/test.pdb], 0, [ignore], [ignore]) 37 37 AT_CLEANUP 38 38 39 39 40 40 AT_SETUP([Bond - adding bond with Redo]) 41 AT_KEYWORDS([bond add-bond sredo])41 AT_KEYWORDS([bond add-bond redo]) 42 42 file=test.pdb 43 43 AT_CHECK([cp -f ${abs_top_srcdir}/tests/regression/Bond/Add/pre/$file $file], 0, [ignore], [ignore]) 44 44 AT_CHECK([chmod +w $file], 0, [ignore], [ignore]) 45 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --add-bond s--undo --redo], 0, [ignore], [ignore])46 AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Add/post/ $file], 0, [ignore], [ignore])45 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --add-bond --undo --redo], 0, [ignore], [ignore]) 46 AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Add/post/test.pdb], 0, [ignore], [ignore]) 47 47 AT_CLEANUP -
tests/regression/Bond/Remove/testsuite-bond-remove.at
r3fa16b r19dfdf 19 19 20 20 AT_SETUP([Bond - removing bond]) 21 AT_KEYWORDS([bond remove-bond s])21 AT_KEYWORDS([bond remove-bond]) 22 22 file=test.pdb 23 23 AT_CHECK([cp -f ${abs_top_srcdir}/tests/regression/Bond/Remove/pre/$file $file], 0, [ignore], [ignore]) 24 24 AT_CHECK([chmod +w $file], 0, [ignore], [ignore]) 25 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --remove-bond s], 0, [ignore], [ignore])26 AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Remove/post/ $file], 0, [ignore], [ignore])25 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --remove-bond], 0, [ignore], [ignore]) 26 AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Remove/post/test.pdb], 0, [ignore], [ignore]) 27 27 AT_CLEANUP 28 28 29 29 30 30 AT_SETUP([Bond - removing bond with Undo]) 31 AT_KEYWORDS([bond remove-bond sundo])31 AT_KEYWORDS([bond remove-bond undo]) 32 32 file=test.pdb 33 33 AT_CHECK([cp -f ${abs_top_srcdir}/tests/regression/Bond/Remove/pre/$file $file], 0, [ignore], [ignore]) 34 34 AT_CHECK([chmod +w $file], 0, [ignore], [ignore]) 35 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --remove-bond s--undo], 0, [ignore], [ignore])36 AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Remove/pre/ $file], 0, [ignore], [ignore])35 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --remove-bond --undo], 0, [ignore], [ignore]) 36 AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Remove/pre/test.pdb], 0, [ignore], [ignore]) 37 37 AT_CLEANUP 38 38 39 39 40 40 AT_SETUP([Bond - removing bond with Redo]) 41 AT_KEYWORDS([bond remove-bond sredo])41 AT_KEYWORDS([bond remove-bond redo]) 42 42 file=test.pdb 43 43 AT_CHECK([cp -f ${abs_top_srcdir}/tests/regression/Bond/Remove/pre/$file $file], 0, [ignore], [ignore]) 44 44 AT_CHECK([chmod +w $file], 0, [ignore], [ignore]) 45 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --remove-bond s--undo --redo], 0, [ignore], [ignore])46 AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Remove/post/ $file], 0, [ignore], [ignore])45 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --remove-bond --undo --redo], 0, [ignore], [ignore]) 46 AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Remove/post/test.pdb], 0, [ignore], [ignore]) 47 47 AT_CLEANUP -
tests/regression/Bond/testsuite-bond.at
r3fa16b r19dfdf 20 20 # add bond 21 21 m4_include([Bond/Add/testsuite-bond-add.at]) 22 m4_include([Bond/Add/testsuite-bond-add_multiple.at])23 22 24 23 # remove bond 25 24 m4_include([Bond/Remove/testsuite-bond-remove.at]) 26 m4_include([Bond/Remove/testsuite-bond-remove_multiple.at]) -
tests/regression/Makefile.am
r3fa16b r19dfdf 40 40 $(srcdir)/Atoms/RemoveSphere/testsuite-atoms-remove-sphere.at \ 41 41 $(srcdir)/Atoms/SaveSelectedAtoms/testsuite-atoms-save-selected-atoms.at \ 42 $(srcdir)/Atoms/Saturate/testsuite-atoms-saturate_carbon.at \43 $(srcdir)/Atoms/Saturate/testsuite-atoms-saturate_nitrogen.at \44 42 $(srcdir)/Atoms/Translation/testsuite-atoms-translation.at \ 45 43 $(srcdir)/Atoms/TranslationToOrigin/testsuite-atoms-translation-to-origin.at \ 46 44 $(srcdir)/Bond/testsuite-bond.at \ 47 45 $(srcdir)/Bond/Add/testsuite-bond-add.at \ 48 $(srcdir)/Bond/Add/testsuite-bond-add_multiple.at \49 46 $(srcdir)/Bond/Remove/testsuite-bond-remove.at \ 50 $(srcdir)/Bond/Remove/testsuite-bond-remove_multiple.at \51 47 $(srcdir)/Analysis/testsuite-analysis.at \ 52 48 $(srcdir)/Analysis/DipoleAngularCorrelation/testsuite-analysis-dipole-angular-correlation.at \ … … 116 112 $(srcdir)/Options/testsuite-options.at \ 117 113 $(srcdir)/Options/BondLengthTable/testsuite-options-bond-length-table.at \ 118 $(srcdir)/Options/DryRun/testsuite-options-dryrun.at \119 $(srcdir)/Options/DryRun/testsuite-options-dryrun-storesession.at \120 $(srcdir)/Options/DryRun/testsuite-options-no-dryrun.at \121 114 $(srcdir)/Options/ElementsDb/testsuite-options-no-elements-db.at \ 122 115 $(srcdir)/Options/ElementsDb/testsuite-options-elements-db.at \ -
tests/regression/Molecules/Remove/post/water_box.pdb
r3fa16b r19dfdf 1 REMARK created by molecuilder on Tue Feb 10 10:29:29 2015, time step 01 REMARK created by molecuilder on Fri Dec 12 19:01:22 2014, time step 0 2 2 ATOM 1 O01 0non 01 1.590 2.000 2.000 0.00 0.00 O 0 3 3 ATOM 2 H01 0non 01 2.205 2.000 2.774 0.00 0.00 H 0 … … 24 24 ATOM 23 H01 0non 08 6.205 6.000 6.774 0.00 0.00 H 0 25 25 ATOM 24 H02 0non 08 6.205 6.000 5.226 0.00 0.00 H 0 26 CONECT 1 2 327 CONECT 2 128 CONECT 3 129 26 CONECT 4 5 6 30 27 CONECT 5 4 31 28 CONECT 6 4 32 CONECT 7 8 933 CONECT 8 734 CONECT 9 735 29 CONECT 10 11 12 36 30 CONECT 11 10 -
tests/regression/Options/FastParsing/testsuite-options-fast-parsing.at
r3fa16b r19dfdf 39 39 40 40 AT_CHECK([../../molecuilder -i test.conf -n 1 --undo --redo], 0, [stdout], [stderr]) 41 AT_CHECK([grep -c "I won't parse trajectories" stdout], 0, [ignore]) 41 AT_CHECK([grep -c "I won't parse trajectories" stdout], 0, 2 42 , [ignore]) 42 43 43 44 AT_CLEANUP -
tests/regression/Options/testsuite-options.at
r3fa16b r19dfdf 53 53 m4_include([Options/Session/testsuite-options-store-session-python.at]) 54 54 m4_include([Options/Session/testsuite-options-load-session-python.at]) 55 56 # test dry run57 m4_include([Options/DryRun/testsuite-options-dryrun.at])58 m4_include([Options/DryRun/testsuite-options-no-dryrun.at])59 m4_include([Options/DryRun/testsuite-options-dryrun-storesession.at])
Note:
See TracChangeset
for help on using the changeset viewer.