Changes in / [19dfdf:3fa16b]
- Files:
-
- 246 added
- 3 deleted
- 126 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile.am
r19dfdf r3fa16b 23 23 cd doc && $(MAKE) doxygen-doc 24 24 25 guicheck: 26 cd tests && $(MAKE) guicheck 25 27 extracheck: 26 28 cd tests && $(MAKE) extracheck -
configure.ac
r19dfdf r3fa16b 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/atlocal 432 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 429 436 AC_CONFIG_TESTDIR(tests/JobMarket) 430 437 AC_CONFIG_FILES([ -
doc/userguide/userguide.xml
r19dfdf r3fa16b 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. If 968 you want to fill up their valence by a slew of hydrogen atoms 969 residing on a sphere around this atom, use this action.</para> 970 971 <programlisting> 972 ... --saturate-atoms 973 </programlisting> 974 975 <para>A number of hydrogen atoms is added. The number corrresponding 976 to the valence of each selected atom. They are placed in the same 977 distance to this atom and approximately with same distance to their 978 nearest neighbors.</para> 979 </section> 980 964 981 <section xml:id='atoms.translate-atom'> 965 982 <title xml:id='atoms.translate-atom.title'>Translating atoms</title> … … 1133 1150 </section> 1134 1151 1135 <section xml:id='bond.add -bond'>1136 <title xml:id='bond.add -bond.title'>Adding a bond manually</title>1152 <section xml:id='bond.adds-bond'> 1153 <title xml:id='bond.adds-bond.title'>Adding a bond manually</title> 1137 1154 1138 1155 <para>When the automatically created adjacency or bond graph 1139 1156 contains faulty bonds or lacks some, you can add them 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 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 1147 1174 </title> 1148 1175 … … 1150 1177 bond.</para> 1151 1178 1152 <programlisting>... --remove-bond</programlisting> 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> 1153 1183 </section> 1154 1184 … … 2511 2541 <programlisting>... -v 4</programlisting> 2512 2542 </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 not 2548 actually executed. You may bracket a certain set of actions by 2549 putting --dry-run before and --no-dry-run afterwards. Then, all 2550 action in between will be looked at but not executed, i.e. they 2551 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 a 2554 hydrogen atom at position (5,5,5) inside the aforementioned dry run 2555 statements. Hence, no hydrogen atom is added but the add action is 2556 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-run 2562 </programlisting> 2563 2564 </section> 2513 2565 2514 2566 <section xml:id='various.element-db'> -
src/Actions/ActionQueue.cpp
r19dfdf r3fa16b 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 70 run_thread_isIdle(true), 71 #endif 72 dryrun_flag(false) 72 73 { 73 74 // channels of observable … … 109 110 #ifndef HAVE_ACTION_THREAD 110 111 try { 111 newaction->call(); 112 if (!isDryRun(newaction)) 113 newaction->call(); 112 114 lastActionOk = true; 113 115 } catch(ActionFailureException &e) { … … 175 177 LOG(0, "Calling Action " << actionqueue[CurrentAction]->getName() << " ... "); 176 178 try { 177 actionqueue[CurrentAction]->call(); 179 if (!isDryRun(actionqueue[CurrentAction])) 180 actionqueue[CurrentAction]->call(); 178 181 pushStatus("SUCCESS: Action "+actionqueue[CurrentAction]->getName()+" successful."); 179 182 lastActionOk = true; … … 380 383 } 381 384 385 bool ActionQueue::isDryRun(const Action *_nextaction) const 386 { 387 bool status = dryrun_flag; 388 status &= (_nextaction->getName() != "no-dry-run"); 389 return status; 390 } 382 391 383 392 CONSTRUCT_SINGLETON(ActionQueue) -
src/Actions/ActionQueue.hpp
r19dfdf r3fa16b 40 40 class ActionRegistry; 41 41 class ActionTrait; 42 class DryRunAdvocate; 42 43 43 44 namespace Queuedetail { … … 178 179 { return StatusList; } 179 180 181 /** Getter for isDryRun state flag. 182 * 183 * \return true - ActionQueue does not execute Actions but skips, false - else 184 */ 185 bool getDryRun() const 186 { return dryrun_flag; } 187 180 188 private: 181 189 //!> grant Action access to internal history functions. … … 183 191 //!> grant CommandLineParser access to stop and clearQueue() 184 192 friend class ::CommandLineParser; 193 //!> grant Advocate access to setting dryrun 194 friend class DryRunAdvocate; 185 195 186 196 /** Wrapper function to add state to ActionHistory. … … 255 265 void insertAction(Action *_action, enum Action::QueryOptions state); 256 266 267 /** Sets the current state of the \a isDryRun flag. 268 * 269 * \param _dryrun true - Actions will not get executed anymore, false - else 270 */ 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_flag 277 * \return true - dryrun_flag set and \a _nextaction is not unsetting dry run 278 */ 279 bool isDryRun(const Action *_nextaction) const; 280 257 281 private: 258 282 /** Private cstor for ActionQueue. … … 309 333 //!> internal list of status messages from Actions for UIs to display 310 334 ActionStatusList StatusList; 335 336 //!> internal flag whether to call or skip actions (i.e. do a dry run) 337 bool dryrun_flag; 311 338 }; 312 339 namespace Queuedetail { -
src/Actions/ActionSequence.cpp
r19dfdf r3fa16b 37 37 #include "Actions/ActionSequence.hpp" 38 38 #include "Actions/Action.hpp" 39 #include "Actions/ActionExceptions.hpp" 39 40 #include "UIElements/Dialog.hpp" 40 41 … … 53 54 { 54 55 // we need to override copy cstor as we have pointer referenced objects 55 for(actionSet:: iterator it=actions.begin(); it!=actions.end(); it++){56 for(actionSet::const_iterator it=_other.actions.begin(); it!=_other.actions.end(); it++){ 56 57 actions.push_back((*it)->clone()); 57 58 } … … 119 120 // we bypass the normal call 120 121 ActionState::ptr state = (*it)->performCall(); 122 if (state == Action::failure) 123 throw ActionFailureException() << ActionNameString((*it)->getName()); 121 124 states.push_back(state); 122 125 } -
src/Actions/ActionSequence.hpp
r19dfdf r3fa16b 19 19 #include <deque> 20 20 21 class ActionSequenceTest; 22 21 23 namespace MoleCuilder { 22 24 … … 27 29 { 28 30 friend class MakroAction; 31 //!> grant unit test access to private sequence 32 friend class ::ActionSequenceTest; 29 33 public: 30 34 typedef std::deque<Action*> actionSet; -
src/Actions/Action_impl_pre.hpp
r19dfdf r3fa16b 175 175 << "\"" << toPythonString(params. \ 176 176 BOOST_PP_SEQ_ELEM(n, paramreferences) \ 177 .get ()) \177 .getUnvalidated()) \ 178 178 << "\""; 179 179 -
src/Actions/BondAction/BondAddAction.cpp
r19dfdf r3fa16b 57 57 ActionState::ptr BondAddAction::performCall() { 58 58 // check preconditions 59 if (World::getInstance().countSelectedAtoms() != 2) { 60 STATUS("Exactly two atoms must be selected for BondAction Add."); 59 World& world = World::getInstance(); 60 if (world.countSelectedAtoms() <= 1) { 61 STATUS("There must be at least two atoms selected for BondAction Add."); 61 62 return Action::failure; 62 63 } 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."); 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."); 66 79 return Action::failure; 67 80 } 68 81 69 82 // create undo 70 BondAddState *UndoState = new BondAddState( selected_atoms[0]->getId(), selected_atoms[1]->getId(), params);83 BondAddState *UndoState = new BondAddState(bondPairIds, params); 71 84 72 85 // execute action 73 selected_atoms[0]->addBond(WorldTime::getTime(), selected_atoms[1]); 74 ASSERT( selected_atoms[0]->IsBondedTo(WorldTime::getTime(), selected_atoms[1]), 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), 75 95 "BondAddAction::performCall() - adding bond in between " 76 +toString(*selected_atoms[0])+" and "+toString(*selected_atoms[1])+" failed."); 96 +toString(*firstatom)+" and "+toString(*secondatom)+" failed."); 97 } 77 98 78 99 return ActionState::ptr(UndoState); … … 83 104 84 105 // 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 "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)+"."); 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 } 95 120 } 96 121 … … 102 127 103 128 // 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 "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)+"."); 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 } 114 143 } 115 144 -
src/Actions/BondAction/BondAddAction.def
r19dfdf r3fa16b 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; 10 14 11 15 // i.e. there is an integer with variable name Z that can be found in … … 20 24 #undef paramvalids 21 25 22 #define statetypes ( atomId_t)(atomId_t)23 #define statereferences ( firstId)(secondId)26 #define statetypes (bondPairIds_t) 27 #define statereferences (bondPairIds) 24 28 25 29 // some defines for all the names, you may use ACTION, STATE and PARAMS … … 28 32 #define MENUPOSITION 1 29 33 #define ACTIONNAME Add 30 #define TOKEN "add-bond "34 #define TOKEN "add-bonds" 31 35 32 36 // finally the information stored in the ActionTrait specialization 33 #define DESCRIPTION "add bond in between twoselected atoms"37 #define DESCRIPTION "add bonds in between any number of selected atoms" 34 38 #undef SHORTFORM -
src/Actions/BondAction/BondRemoveAction.cpp
r19dfdf r3fa16b 57 57 ActionState::ptr BondRemoveAction::performCall() { 58 58 // check preconditions 59 if (World::getInstance().countSelectedAtoms() != 2) { 60 STATUS("Exactly two atoms must be selected for BondAction Remove."); 59 World& world = World::getInstance(); 60 if (world.countSelectedAtoms() <= 1) { 61 STATUS("At least two atoms must be selected for BondAction Remove."); 61 62 return Action::failure; 62 63 } 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."); 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."); 66 79 return Action::failure; 67 80 } 68 81 69 82 // create undo 70 BondRemoveState *UndoState = new BondRemoveState( selected_atoms[0]->getId(), selected_atoms[1]->getId(), params);83 BondRemoveState *UndoState = new BondRemoveState(bondPairIds, params); 71 84 72 85 // execute action 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."); 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 } 77 98 78 99 return ActionState::ptr(UndoState); … … 82 103 BondRemoveState *state = assert_cast<BondRemoveState*>(_state.get()); 83 104 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)+"."); 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 } 95 119 } 96 120 … … 101 125 BondRemoveState *state = assert_cast<BondRemoveState*>(_state.get()); 102 126 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)+"."); 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 } 114 141 } 115 142 -
src/Actions/BondAction/BondRemoveAction.def
r19dfdf r3fa16b 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; 9 14 10 15 // i.e. there is an integer with variable name Z that can be found in … … 19 24 #undef paramvalids 20 25 21 #define statetypes ( atomId_t)(atomId_t)22 #define statereferences ( firstId)(secondId)26 #define statetypes (bondPairIds_t) 27 #define statereferences (bondPairIds) 23 28 24 29 // some defines for all the names, you may use ACTION, STATE and PARAMS … … 27 32 #define MENUPOSITION 2 28 33 #define ACTIONNAME Remove 29 #define TOKEN "remove-bond "34 #define TOKEN "remove-bonds" 30 35 31 36 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "remove the bond in between twoselected atoms"37 #define DESCRIPTION "remove all bonds present between selected atoms" 33 38 #undef SHORTFORM -
src/Actions/CommandAction/LoadSessionAction.cpp
r19dfdf r3fa16b 58 58 59 59 #ifdef HAVE_PYTHON 60 if (executePythonScript (params.filename.get().string()))60 if (executePythonScriptFile(params.filename.get())) 61 61 return Action::success; 62 62 else { -
src/Actions/CommandAction/VerboseAction.cpp
r19dfdf r3fa16b 52 52 unsigned int oldverbosity = getVerbosity(); 53 53 54 // prepare undo state 55 CommandVerboseState *UndoState = new CommandVerboseState(oldverbosity, params); 56 54 57 if (oldverbosity != params.verbosity.get()) { 55 // prepare undo state56 CommandVerboseState *UndoState = new CommandVerboseState(oldverbosity, params);57 58 // set new verbosity 58 59 setVerbosity(params.verbosity.get()); 59 60 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;64 63 } 64 return ActionState::ptr(UndoState); 65 65 } 66 66 -
src/Actions/FragmentationAction/FragmentationAction.cpp
r19dfdf r3fa16b 129 129 BondGraph *BG = World::getInstance().getBondGraph(); 130 130 World::AtomComposite Set = World::getInstance().getAllAtoms(AtomsBySelection()); 131 BG->CorrectBondDegree(Set); 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."); 132 136 } 133 137 -
src/Actions/FragmentationAction/FragmentationAutomationAction.cpp
r19dfdf r3fa16b 134 134 // Phase One: obtain ids 135 135 mpqccontroller.requestIds(NumberJobs); 136 if (mpqccontroller.getExitflag() != 0) 137 return Action::failure; 136 138 137 139 // Phase Two: add MPQCJobs and send … … 159 161 wait_thread.join(); 160 162 stop(); 163 if (mpqccontroller.getExitflag() != 0) 164 return Action::failure; 165 161 166 mpqccontroller.getResults(shortrangedata); 167 if (mpqccontroller.getExitflag() != 0) 168 return Action::failure; 162 169 163 170 Exitflag += mpqccontroller.getExitflag(); … … 189 196 mpqccontroller.run(); 190 197 stop(); 198 if (mpqccontroller.getExitflag() != 0) 199 return Action::failure; 191 200 192 201 // get back the results and place them in shortrangedata … … 195 204 "FragmentationFragmentationAutomationAction::performCall() - number of converted results " 196 205 +toString(shortrangedata.size())+" and number of jobs "+toString(NumberJobs)+ " differ."); 206 if (mpqccontroller.getExitflag() != 0) 207 return Action::failure; 197 208 198 209 Exitflag += mpqccontroller.getExitflag(); … … 234 245 const size_t NoJobs = shortrangedata.size()+full_sample.size(); 235 246 vmgcontroller.requestIds(2*NoJobs); 247 if (vmgcontroller.getExitflag() != 0) 248 return Action::failure; 236 249 237 250 // Phase Five a: create VMGJobs for electronic charge distribution … … 254 267 // Phase Six a: calculate result 255 268 vmgcontroller.waitforResults(NoJobs); 269 if (vmgcontroller.getExitflag() != 0) 270 return Action::failure; 256 271 vmgcontroller.getResults(longrangedata); 257 272 ASSERT( NoJobs == longrangedata.size(), … … 282 297 // Phase Six b: calculate result 283 298 vmgcontroller.waitforResults(NoJobs); 299 if (vmgcontroller.getExitflag() != 0) 300 return Action::failure; 284 301 vmgcontroller.getResults(longrangedata_both); 285 302 ASSERT( NoJobs == longrangedata_both.size(), … … 287 304 +toString(full_sample.size())+"="+toString(NoJobs) 288 305 +" and second VMGresults "+toString(longrangedata_both.size())+" don't match."); 306 if (vmgcontroller.getExitflag() != 0) 307 return Action::failure; 289 308 Exitflag += vmgcontroller.getExitflag(); 290 309 -
src/Actions/FragmentationAction/MolecularDynamicsAction.cpp
r19dfdf r3fa16b 54 54 55 55 // static instances 56 ActionSequence FragmentationMolecularDynamicsAction:: actions;56 ActionSequence FragmentationMolecularDynamicsAction::prototype_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 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"))); 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"))); 73 74 isPrepared = true; 74 75 } … … 77 78 { 78 79 // empty sequence 79 while ( actions.removeLastAction() != NULL);80 while (prototype_actions.removeLastAction() != NULL); 80 81 isPrepared = false; 81 82 } … … 106 107 #endif 107 108 removeAction(std::string("create-adjacency")); 109 110 #ifndef NDEBUG 111 status &= 112 #endif 113 removeAction(std::string("correct-bonddegree")); 108 114 109 115 #ifndef NDEBUG -
src/Actions/FragmentationAction/StructuralOptimizationAction.cpp
r19dfdf r3fa16b 54 54 55 55 // static instances 56 ActionSequence FragmentationStructuralOptimizationAction:: actions;56 ActionSequence FragmentationStructuralOptimizationAction::prototype_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 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"))); 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"))); 73 74 isPrepared = true; 74 75 } … … 77 78 { 78 79 // empty sequence 79 while ( actions.removeLastAction() != NULL);80 while (prototype_actions.removeLastAction() != NULL); 80 81 isPrepared = false; 81 82 } … … 106 107 #endif 107 108 removeAction(std::string("create-adjacency")); 109 110 #ifndef NDEBUG 111 status &= 112 #endif 113 removeAction(std::string("correct-bonddegree")); 108 114 109 115 #ifndef NDEBUG -
src/Actions/GlobalListOfActions.hpp
r19dfdf r3fa16b 35 35 (AtomRemove) \ 36 36 (AtomRotateAroundOriginByAngle) \ 37 (AtomSaturate) \ 37 38 (AtomSaveSelectedAtoms) \ 38 39 (AtomTranslate) \ … … 40 41 (BondAdd) \ 41 42 (BondRemove) \ 43 (CommandDryRun) \ 42 44 (CommandElementDb) \ 43 45 (CommandBondLengthTable) \ … … 45 47 (CommandHelp) \ 46 48 (CommandHelpRedistribute) \ 49 (CommandNoDryRun) \ 47 50 (CommandSetRandomNumbersEngine) \ 48 51 (CommandSetRandomNumbersDistribution) \ -
src/Actions/GraphAction/SubgraphDissectionAction.cpp
r19dfdf r3fa16b 58 58 59 59 // static instances 60 ActionSequence GraphSubgraphDissectionAction:: actions;60 ActionSequence GraphSubgraphDissectionAction::prototype_actions; 61 61 bool GraphSubgraphDissectionAction::isPrepared = false; 62 62 63 63 void GraphSubgraphDissectionAction::prepare(ActionRegistry &AR) 64 64 { 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")));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"))); 71 71 isPrepared = true; 72 72 } … … 75 75 { 76 76 // empty sequence 77 while ( actions.removeLastAction() != NULL);77 while (prototype_actions.removeLastAction() != NULL); 78 78 isPrepared = false; 79 79 } -
src/Actions/Makefile.am
r19dfdf r3fa16b 41 41 Actions/Calculation.hpp \ 42 42 Actions/Calculation_impl.hpp \ 43 Actions/DryRunAdvocate.hpp \ 43 44 Actions/ErrorAction.hpp \ 44 45 Actions/GlobalListOfActions.hpp \ … … 150 151 Actions/AtomAction/RemoveAction.cpp \ 151 152 Actions/AtomAction/RotateAroundOriginByAngleAction.cpp \ 153 Actions/AtomAction/SaturateAction.cpp \ 152 154 Actions/AtomAction/SaveSelectedAtomsAction.cpp \ 153 155 Actions/AtomAction/TranslateAction.cpp \ … … 159 161 Actions/AtomAction/RemoveAction.hpp \ 160 162 Actions/AtomAction/RotateAroundOriginByAngleAction.hpp \ 163 Actions/AtomAction/SaturateAction.hpp \ 161 164 Actions/AtomAction/SaveSelectedAtomsAction.hpp \ 162 165 Actions/AtomAction/TranslateAction.hpp \ … … 168 171 Actions/AtomAction/RemoveAction.def \ 169 172 Actions/AtomAction/RotateAroundOriginByAngleAction.def \ 173 Actions/AtomAction/SaturateAction.def \ 170 174 Actions/AtomAction/SaveSelectedAtomsAction.def \ 171 175 Actions/AtomAction/TranslateAction.def \ … … 184 188 CMDACTIONSOURCE = \ 185 189 Actions/CommandAction/BondLengthTableAction.cpp \ 190 Actions/CommandAction/DryRunAction.cpp \ 186 191 Actions/CommandAction/ElementDbAction.cpp \ 187 192 Actions/CommandAction/FastParsingAction.cpp \ 188 193 Actions/CommandAction/HelpAction.cpp \ 189 194 Actions/CommandAction/HelpRedistributeAction.cpp \ 195 Actions/CommandAction/NoDryRunAction.cpp \ 190 196 Actions/CommandAction/StoreSessionAction.cpp \ 191 197 Actions/CommandAction/VerboseAction.cpp \ … … 194 200 CMDACTIONHEADER = \ 195 201 Actions/CommandAction/BondLengthTableAction.hpp \ 202 Actions/CommandAction/DryRunAction.hpp \ 196 203 Actions/CommandAction/ElementDbAction.hpp \ 197 204 Actions/CommandAction/FastParsingAction.hpp \ 198 205 Actions/CommandAction/HelpAction.hpp \ 199 206 Actions/CommandAction/HelpRedistributeAction.hpp \ 207 Actions/CommandAction/NoDryRunAction.hpp \ 200 208 Actions/CommandAction/StoreSessionAction.hpp \ 201 209 Actions/CommandAction/VerboseAction.hpp \ … … 204 212 CMDACTIONDEFS = \ 205 213 Actions/CommandAction/BondLengthTableAction.def \ 214 Actions/CommandAction/DryRunAction.def \ 206 215 Actions/CommandAction/ElementDbAction.def \ 207 216 Actions/CommandAction/FastParsingAction.def \ 208 217 Actions/CommandAction/HelpAction.def \ 209 218 Actions/CommandAction/HelpRedistributeAction.def \ 219 Actions/CommandAction/NoDryRunAction.def \ 210 220 Actions/CommandAction/StoreSessionAction.def \ 211 221 Actions/CommandAction/VerboseAction.def \ -
src/Actions/MakroAction.cpp
r19dfdf r3fa16b 60 60 ActionSequence::stateSet states; 61 61 }; 62 63 MakroAction::MakroAction(const MakroAction &_instance) : 64 Action(_instance.Traits), 65 actions(_instance.actions) 66 {} 62 67 63 68 MakroAction::MakroAction(const ActionTrait &_trait,ActionSequence& _actions) : -
src/Actions/MakroAction.hpp
r19dfdf r3fa16b 18 18 19 19 #include "Actions/Action.hpp" 20 #include "Actions/ActionSequence.hpp" 21 22 class ActionSequenceTest; 20 23 21 24 namespace MoleCuilder { 22 25 class ActionRegistry; 23 class ActionSequence;24 26 25 27 /** … … 30 32 class MakroAction : public Action 31 33 { 34 //!> grant unit test access to sequence 35 friend class ::ActionSequenceTest; 32 36 public: 37 MakroAction(const MakroAction &_instance); 33 38 MakroAction(const ActionTrait &_trait,ActionSequence& _actions); 34 39 virtual ~MakroAction(); … … 78 83 Dialog *fillDialog(Dialog *dialog); 79 84 85 //!> this points to the instance of a specific MakroAction, we need to ref for callAll() 80 86 ActionSequence &actions; 81 87 }; -
src/Actions/MakroAction_impl_header.hpp
r19dfdf r3fa16b 263 263 //!> flag to check whether actions have been prepared 264 264 static bool isPrepared; 265 //!> sequence of actions for this macro action 266 static ActionSequence actions; 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; 267 269 268 270 private: -
src/Actions/MakroAction_impl_pre.hpp
r19dfdf r3fa16b 263 263 // =========== constructor =========== 264 264 ACTION::ACTION () : 265 MakroAction(ActionTraits< ACTION >(), actions) 265 MakroAction(ActionTraits< ACTION >(), actions), 266 actions(prototype_actions) 266 267 {} 267 268 … … 294 295 Action* ACTION::clone(enum QueryOptions flag) const 295 296 { 296 if (flag == Interactive) 297 return new ACTION(); 298 else 299 return new ACTION(*this); 297 return new ACTION(); 300 298 } 301 299 -
src/Actions/MoleculeAction/TranslateAction.cpp
r19dfdf r3fa16b 56 56 57 57 // static instances 58 ActionSequence MoleculeTranslateAction:: actions;58 ActionSequence MoleculeTranslateAction::prototype_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 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")));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"))); 69 69 isPrepared = true; 70 70 } … … 73 73 { 74 74 // empty sequence 75 while ( actions.removeLastAction() != NULL);75 while (prototype_actions.removeLastAction() != NULL); 76 76 isPrepared = false; 77 77 } -
src/Actions/ParserAction/SetParserParametersAction.cpp
r19dfdf r3fa16b 66 66 // obtain information 67 67 std::stringstream newparamstream; 68 const std::vector< std::string> keyvalues = params.newparams.get();68 const std::vector< KeyValuePair > 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< std::string> keyvalues = state->params.newparams.get();92 const std::vector< KeyValuePair > 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
r19dfdf r3fa16b 13 13 #include "Parameters/Validators/Specific/KeyValueValidator.hpp" 14 14 #include "Parameters/Validators/Specific/ParserTypeValidator.hpp" 15 #include "Parameters/Specifics/KeyValuePair.hpp" 15 16 16 17 // i.e. there is an integer with variable name Z that can be found in 17 18 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 18 19 // "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value 19 #define paramtypes (std::string)(std::vector< std::string>)20 #define paramtypes (std::string)(std::vector<KeyValuePair>) 20 21 #define paramtokens ("set-parser-parameters")("parser-parameters") 21 22 #define paramdescriptions ("name of the parser to change")("parameter (key = value;)") … … 24 25 #define paramvalids \ 25 26 (ParserTypeValidator())\ 26 (STLVectorValidator< std::vector< std::string> >(1, 99, KeyValueValidator()))27 (STLVectorValidator< std::vector<KeyValuePair> >(1, 99, KeyValueValidator())) 27 28 28 29 #define statetypes (std::string) -
src/Actions/RandomNumbersAction/SetRandomNumbersDistributionAction.def
r19dfdf r3fa16b 11 11 #include "Parameters/Validators/Specific/RandomNumberValidators.hpp" 12 12 #include "Parameters/Validators/Specific/KeyValueValidator.hpp" 13 #include "Parameters/Specifics/KeyValuePair.hpp" 13 14 14 15 // i.e. there is an integer with variable name Z that can be found in 15 16 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 16 17 // "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value 17 #define paramtypes (std::string)( std::string)18 #define paramtypes (std::string)(KeyValuePair) 18 19 #define paramtokens ("set-random-number-distribution")("random-number-distribution-parameters") 19 20 #define paramdescriptions ("name of the distribution from boost::random")("parameter set for requested distribution") 20 #define paramdefaults (NOPARAM_DEFAULT)(PARAM_DEFAULT( std::string("p=-1")))21 #define paramdefaults (NOPARAM_DEFAULT)(PARAM_DEFAULT(KeyValuePair("p=-1"))) 21 22 #define paramreferences (distribution_type)(parameters) 22 23 #define paramvalids \ -
src/Actions/RandomNumbersAction/SetRandomNumbersEngineAction.def
r19dfdf r3fa16b 10 10 #include "Parameters/Validators/Specific/RandomNumberValidators.hpp" 11 11 #include "Parameters/Validators/Specific/KeyValueValidator.hpp" 12 #include "Parameters/Specifics/KeyValuePair.hpp" 12 13 13 14 // i.e. there is an integer with variable name Z that can be found in 14 15 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 15 16 // "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value 16 #define paramtypes (std::string)( std::string)17 #define paramtypes (std::string)(KeyValuePair) 17 18 #define paramtokens ("set-random-number-engine")("random-number-engine-parameters") 18 19 #define paramdescriptions ("name of the pseudo-random engine from boost::random")("seed of the pseudo-random number sequence") 19 #define paramdefaults (NOPARAM_DEFAULT)(PARAM_DEFAULT( std::string("seed=-1")))20 #define paramdefaults (NOPARAM_DEFAULT)(PARAM_DEFAULT(KeyValuePair("seed=-1"))) 20 21 #define paramreferences (engine_type)(parameters) 21 22 #define paramvalids \ -
src/Actions/SelectionAction/Atoms/PopAtomsAction.cpp
r19dfdf r3fa16b 63 63 ActionState::ptr SelectionPopAtomsAction::performUndo(ActionState::ptr _state) { 64 64 SelectionPopAtomsState *state = static_cast<SelectionPopAtomsState *>(_state.get()); 65 LOG(1, "P opping atom selection.");65 LOG(1, "Pushing atom selection."); 66 66 World::getInstance().pushAtomSelection(); 67 67 -
src/Actions/SelectionAction/Atoms/PushAtomsAction.cpp
r19dfdf r3fa16b 54 54 55 55 ActionState::ptr SelectionPushAtomsAction::performUndo(ActionState::ptr _state) { 56 LOG(1, "P ushing atom selection.");56 LOG(1, "Popping atom selection."); 57 57 World::getInstance().popAtomSelection(); 58 58 -
src/Actions/SelectionAction/Molecules/MoleculeOfAtomAction.cpp
r19dfdf r3fa16b 55 55 ActionState::ptr SelectionMoleculeOfAtomAction::performCall() { 56 56 std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules(); 57 LOG(1, "Selecting molecule to currently selected atoms .");57 LOG(1, "Selecting molecule to currently selected atoms: " << World::getInstance().countSelectedAtoms()); 58 58 World::getInstance().selectAllMolecules(MoleculesByAtomSelection()); 59 59 LOG(0, World::getInstance().countSelectedMolecules() << " molecules selected."); -
src/Actions/UndoRedoHelpers.cpp
r19dfdf r3fa16b 131 131 { 132 132 bool status = true; 133 for(std::vector< BondInfo >::const_iterator iter = bonds.begin();134 iter != bonds.end(); ++iter)135 if (!(*iter).RecreateBond()) 133 std::vector< BondInfo >::const_iterator iter = bonds.begin(); 134 for(;iter != bonds.end(); ++iter) { 135 if (!(*iter).RecreateBond()) { 136 136 status = false; 137 break; 138 } 139 } 140 if (!status) { 141 // remove all added bonds again 142 for(std::vector< BondInfo >::const_iterator removeiter = bonds.begin(); 143 removeiter != iter; ++removeiter) { 144 removeiter->RemoveBond(); 145 } 146 } 137 147 return status; 138 148 } -
src/Actions/Values.cpp
r19dfdf r3fa16b 37 37 #include "CodePatterns/Assert.hpp" 38 38 39 #include "Box.hpp" 39 40 #include "LinearAlgebra/BoxVector.hpp" 40 41 #include "LinearAlgebra/RealSpaceMatrix.hpp" 41 42 #include "LinearAlgebra/Vector.hpp" 42 #include "Box.hpp"43 43 44 44 #include "Values.hpp" -
src/Actions/Values.hpp
r19dfdf r3fa16b 15 15 16 16 #include "LinearAlgebra/defs.hpp" 17 18 #include <string> 17 19 18 20 class Box; … … 45 47 }; 46 48 49 #endif /* VALUES_HPP_ */ 47 50 48 #endif /* VALUES_HPP_ */ -
src/Actions/toCLIString.cpp
r19dfdf r3fa16b 40 40 #include "LinearAlgebra/RealSpaceMatrix.hpp" 41 41 #include "LinearAlgebra/Vector.hpp" 42 #include "Parameters/Specifics/KeyValuePair.hpp" 43 44 #include "Actions/toPythonString.hpp" 42 45 43 46 template <> … … 65 68 << _value.at(2,0) << "," 66 69 << _value.at(2,1) << "," 67 << _value.at(2,2) << "\""; 70 << _value.at(2,2) 71 << "\""; 68 72 return output.str(); 69 73 } … … 73 77 { 74 78 std::stringstream output; 75 output << "\"" << _value[0] << "," << _value[1] << "," << _value[2]<< "\"";79 output << "\"" << toPythonString(_value) << "\""; 76 80 return output.str(); 77 81 } … … 84 88 return output.str(); 85 89 } 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
r19dfdf r3fa16b 21 21 22 22 class element; 23 struct KeyValuePair; 23 24 class RealSpaceMatrix; 24 25 class Vector; … … 77 78 template <> const std::string toCLIString( const std::string& _value); 78 79 80 template <> const std::string toCLIString( const KeyValuePair& _value); 81 79 82 #endif /* TOCLISTRING_HPP_ */ -
src/Actions/toPythonString.cpp
r19dfdf r3fa16b 41 41 #include "LinearAlgebra/Vector.hpp" 42 42 43 #include "Parameters/Specifics/KeyValuePair.hpp" 44 43 45 template <> 44 46 const std::string toPythonString( const boost::filesystem::path & _value) … … 52 54 std::stringstream output; 53 55 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; 54 70 return output.str(); 55 71 } -
src/Actions/toPythonString.hpp
r19dfdf r3fa16b 21 21 22 22 class element; 23 struct KeyValuePair; 23 24 class RealSpaceMatrix; 24 25 class Vector; … … 71 72 template <> const std::string toPythonString( const boost::filesystem::path & _value); 72 73 74 template <> const std::string toPythonString( const KeyValuePair& _value); 75 73 76 template <> const std::string toPythonString( const RealSpaceMatrix& _value); 74 77 -
src/Actions/unittests/ActionSequenceUnitTest.cpp
r19dfdf r3fa16b 301 301 ActionSequence *sequence = new ActionSequence(); 302 302 ActionTrait wasCalledTrait("wasCalledActionStub"); 303 wasCalledActionStub *wasCalled1 = new wasCalledActionStub(wasCalledTrait); 304 wasCalledActionStub *wasCalled2 = new wasCalledActionStub(wasCalledTrait); 305 sequence->addAction(wasCalled1); 306 sequence->addAction(wasCalled2); 303 sequence->addAction(new wasCalledActionStub(wasCalledTrait)); 304 sequence->addAction(new wasCalledActionStub(wasCalledTrait)); 307 305 308 306 ActionTrait MakroTrait("Test MakroAction"); 309 307 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()); 310 312 311 313 act.call(); 312 314 313 CPPUNIT_ASSERT_EQUAL(true,wasCalled1->wasCalled()); 314 CPPUNIT_ASSERT_EQUAL(true,wasCalled2->wasCalled()); 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()); 315 319 316 320 ActionQueue::getInstance().undoLast(); 317 321 318 CPPUNIT_ASSERT_EQUAL(false,wasCalled1->wasCalled()); 319 CPPUNIT_ASSERT_EQUAL(false,wasCalled2->wasCalled()); 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()); 320 326 321 327 delete sequence; -
src/Actions/unittests/stubs/DummyUI.hpp
r19dfdf r3fa16b 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 queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> &, 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 = ""){}; 50 51 }; 51 52 -
src/Atom/AtomicInfo.cpp
r19dfdf r3fa16b 34 34 35 35 #include "CodePatterns/MemDebug.hpp" 36 37 #include "CodePatterns/Log.hpp" 36 38 37 39 #include "atom.hpp" … … 71 73 "Atom "+toString(_atom.getId())+" is not associated with any molecule."); 72 74 MolId = mol->getId(); 75 // accumulate bond info 76 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 } 73 84 } 74 85 … … 101 112 } 102 113 114 // set bonds 115 for (std::vector<BondInfo>::const_iterator bonditer = bonds.begin(); 116 bonditer != bonds.end(); ++bonditer) 117 (*bonditer).RecreateBond(); 118 103 119 // setting molecule 104 120 molecule * const _mol = World::getInstance().getMolecule(MoleculeById(MolId)); -
src/Atom/AtomicInfo.hpp
r19dfdf r3fa16b 16 16 #include "LinearAlgebra/Vector.hpp" 17 17 #include "types.hpp" 18 19 #include <vector> 20 21 #include "Bond/BondInfo.hpp" 18 22 19 23 class atom; … … 45 49 atomId_t Id; 46 50 int Nr; 51 std::vector<BondInfo> bonds; 47 52 }; 48 53 -
src/Bond/BondInfo.cpp
r19dfdf r3fa16b 61 61 atom * const rightatom = World::getInstance().getAtom(AtomById(rightid)); 62 62 if ((leftatom == NULL) || (rightatom == NULL)) { 63 ELOG(1, "Either of the two atoms " << leftid << " or "64 << rightid << " does not existsin the world.");63 // LOG(3, "DEBUG: Either of the two atoms " << leftid << " or " 64 // << rightid << " does not exist 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 73 68 const BondList &rightbonds = rightatom->getListOfBonds(); 74 if (std::find_if(rightbonds.begin(), rightbonds.end(), predicate) != rightbonds.end()) 75 return false; 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 } 76 79 77 80 // create bond … … 81 84 return true; 82 85 } 86 87 void BondInfo::RemoveBond() const 88 { 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
r19dfdf r3fa16b 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 39 44 //!> id of left bond partner 40 45 atomId_t leftid; -
src/Bond/bond.cpp
r19dfdf r3fa16b 125 125 * \return true if it is either bond::leftatom or bond::rightatom, false otherwise 126 126 */ 127 bool bond::Contains (const int number) const127 bool bond::ContainsNr(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 atom 134 * \return true if it is either bond::leftatom or bond::rightatom, false otherwise 135 */ 136 bool bond::ContainsId(const atomId_t number) const 137 { 138 return ((leftatom->getId() == number) || (rightatom->getId() == number)); 130 139 }; 131 140 -
src/Bond/bond.hpp
r19dfdf r3fa16b 19 19 20 20 #include <boost/shared_ptr.hpp> 21 22 #include "types.hpp" 21 23 22 24 #include "Bond/bond_observable.hpp" … … 51 53 52 54 bool Contains(const ParticleInfo * const ptr) const; 53 bool Contains(const int nr) const; 55 bool ContainsNr(const int nr) const; 56 bool ContainsId(const atomId_t nr) const; 54 57 double GetDistance() const; 55 58 double GetDistanceSquared() const; -
src/Fragmentation/Automation/MPQCCommandFragmentController.cpp
r19dfdf r3fa16b 59 59 unsigned int MPQCCommandFragmentController::nextid = 0; 60 60 61 boolMPQCCommandFragmentController::addJobsFromQueue(61 unsigned int MPQCCommandFragmentController::addJobsFromQueue( 62 62 const MPQCData::DoLongrange_t _DoLongrange, 63 63 const MPQCData::DoValenceOnly_t _DoValenceOnly, -
src/Fragmentation/Automation/MPQCCommandFragmentController.hpp
r19dfdf r3fa16b 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 rue - jobs obtained, false - queue empty55 * \return the number of jobs added to queue 56 56 */ 57 booladdJobsFromQueue(57 unsigned int addJobsFromQueue( 58 58 const MPQCData::DoLongrange_t _DoLongrange, 59 59 const MPQCData::DoValenceOnly_t _DoValenceOnly, -
src/Fragmentation/Automation/ResultContainer_impl.hpp
r19dfdf r3fa16b 55 55 for(;resultiter != fragmentresults.end(); ++resultiter, ++dataiter) { 56 56 const JobId_t _id = (*resultiter)->getId(); 57 if ((*resultiter)->exitflag == 0) { 57 58 #ifndef NDEBUG 58 std::pair<typename std::map<JobId_t, T>::iterator, bool> inserter =59 std::pair<typename std::map<JobId_t, T>::iterator, bool> inserter = 59 60 #endif 60 IdData.insert( std::make_pair( _id, *dataiter) ); 61 ASSERT( inserter.second, 62 "ResultContainer::insertResults() - result id " 63 +toString(inserter.first->first)+" already present."); 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 } 64 66 } 65 67 ASSERT( dataiter == fragmentData.end(), -
src/Fragmentation/Automation/SpecificFragmentController_ReceiveResultContainer_impl.hpp
r19dfdf r3fa16b 52 52 // wait but receive all results that are already done 53 53 size_t NoReceivedResults = 0; 54 while (NoReceivedResults != NoExpectedResults) { 54 while ((NoReceivedResults != NoExpectedResults) 55 && (callback.getExitflag() == 0)) { 55 56 // wait a bit 56 57 boost::asio::deadline_timer timer(io_service); … … 60 61 callback.checkResults(callback.host, callback.port); 61 62 callback.RunService("Checking on results"); 63 if (callback.getExitflag() != 0) 64 break; 62 65 63 66 const std::pair<size_t, size_t> JobStatus = callback.getJobStatus(); -
src/Fragmentation/Exporters/unittests/Makefile.am
r19dfdf r3fa16b 18 18 19 19 TESTS += $(FRAGMENTATIONEXPORTERSTESTS) 20 XFAIL_TESTS += SphericalPointDistributionUnitTest 20 21 check_PROGRAMS += $(FRAGMENTATIONEXPORTERSTESTS) 21 22 noinst_PROGRAMS += $(FRAGMENTATIONEXPORTERSTESTS) … … 44 45 45 46 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
r19dfdf r3fa16b 10 10 Fragmentation/Exporters/SaturatedFragment.cpp \ 11 11 Fragmentation/Exporters/SaturationDistanceMaximizer.cpp \ 12 Fragmentation/Exporters/SphericalPointDistribution.cpp \ 13 Fragmentation/Exporters/SphericalPointDistribution_getPoints.cpp \ 12 14 Fragmentation/Homology/FragmentEdge.cpp \ 13 15 Fragmentation/Homology/FragmentNode.cpp \ … … 38 40 Fragmentation/Exporters/SaturatedFragment.hpp \ 39 41 Fragmentation/Exporters/SaturationDistanceMaximizer.hpp \ 42 Fragmentation/Exporters/SphericalPointDistribution.hpp \ 40 43 Fragmentation/Homology/FragmentEdge.hpp \ 41 44 Fragmentation/Homology/FragmentNode.hpp \ -
src/Fragmentation/PowerSetGenerator.cpp
r19dfdf r3fa16b 131 131 for (TouchedList_t::const_iterator iter = TouchedList.begin(); 132 132 iter != TouchedList.end(); ++iter) { 133 if ((*Binder)->Contains (*iter)) // if we added this very endpiece133 if ((*Binder)->ContainsNr(*iter)) // if we added this very endpiece 134 134 SetDimension++; 135 135 } -
src/Fragmentation/Summation/Containers/MPQCData.cpp
r19dfdf r3fa16b 52 52 MPQCData::MPQCData() : 53 53 DoLongrange(DontSampleDensity), 54 DoValenceOnly(Do ValenceOnly)54 DoValenceOnly(DoSampleValenceOnly) 55 55 {} 56 56 -
src/Graph/BondGraph.cpp
r19dfdf r3fa16b 473 473 } 474 474 475 bool BondGraph::checkBondDegree(const deltaatoms_t &allatoms) const 476 { 477 deltaatoms_t deltaatoms; 478 return (gatherAllDeltaAtoms(allatoms, deltaatoms) == 0); 479 } 480 475 481 476 482 int BondGraph::calculateBondDegree(const deltaatoms_t &allatoms) const -
src/Graph/BondGraph.hpp
r19dfdf r3fa16b 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 atoms 364 * @return true - bond degrees match valency, false - bond degree correction is needed 365 */ 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) const 371 { 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 361 378 /** correct bond degree by comparing valence and bond degree. 362 379 * correct Bond degree of each bond by checking both bond partners for a mismatch between valence and current sum of bond degrees, … … 472 489 } 473 490 491 bool checkBondDegree(const std::set<atom *> &allatoms) const; 492 474 493 /** Calculates the bond degree for each atom on the set. 475 494 * -
src/Parameters/Makefile.am
r19dfdf r3fa16b 43 43 Parameters/ValueAsString.hpp \ 44 44 Parameters/ValueInterface.hpp \ 45 Parameters/Specifics/KeyValuePair.hpp \ 45 46 Parameters/Specifics/Value_atom.hpp \ 46 47 Parameters/Specifics/Value_element.hpp \ -
src/Parameters/Parameter.hpp
r19dfdf r3fa16b 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); 55 56 void set(const T & _value) throw(ParameterValueException); 56 57 bool isSet() const -
src/Parameters/Parameter_impl.hpp
r19dfdf r3fa16b 186 186 } 187 187 188 189 /** Catch call to value.getUnvalidated() to add exception information. 190 * 191 * @return parameter value as string 192 */ 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 } 188 203 189 204 /** Catch call to value.get() to add exception information. -
src/Parameters/Validators/Specific/KeyValueValidator.cpp
r19dfdf r3fa16b 38 38 #include "KeyValueValidator.hpp" 39 39 40 bool KeyValueValidator::isValid(const std::string& _value) const40 bool KeyValueValidator::isValid(const KeyValuePair & _value) const 41 41 { 42 42 size_t keyvaluestart = 0; … … 66 66 } 67 67 68 bool KeyValueValidator::operator==(const Validator< std::string> &_instance) const68 bool KeyValueValidator::operator==(const Validator<KeyValuePair> &_instance) const 69 69 { 70 70 const KeyValueValidator *inst = … … 76 76 } 77 77 78 Validator< std::string>* KeyValueValidator::clone() const78 Validator< KeyValuePair >* KeyValueValidator::clone() const 79 79 { 80 Validator< std::string> *inst =80 Validator< KeyValuePair > *inst = 81 81 new KeyValueValidator(); 82 82 return inst; -
src/Parameters/Validators/Specific/KeyValueValidator.hpp
r19dfdf r3fa16b 15 15 #endif 16 16 17 #include <string> 18 17 #include "Parameters/Specifics/KeyValuePair.hpp" 19 18 #include "Parameters/Validators/Validator.hpp" 20 19 … … 22 21 * concatenation of the following pattern "...=...;" 23 22 */ 24 class KeyValueValidator : public Validator< std::string>23 class KeyValueValidator : public Validator<KeyValuePair> 25 24 { 26 bool isValid(const std::string& _value) const;27 bool operator==(const Validator< std::string> &_instance) const;28 Validator< std::string>* clone() const;25 bool isValid(const KeyValuePair & _value) const; 26 bool operator==(const Validator<KeyValuePair> &_instance) const; 27 Validator< KeyValuePair >* clone() const; 29 28 }; 30 29 -
src/Parameters/Value.hpp
r19dfdf r3fa16b 77 77 // functions for ValueInterface 78 78 bool isValid(const T &_value) const throw(ParameterValidatorException); 79 const T & getUnvalidated() const throw(ParameterValueException); 79 80 const T & get() const throw(ParameterValueException); 80 81 void set(const T & _value) throw(ParameterException); -
src/Parameters/ValueInterface.hpp
r19dfdf r3fa16b 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; 33 34 virtual void set(const T & _value) throw(ParameterException)=0; 34 35 virtual bool isSet() const=0; -
src/Parameters/Value_impl.hpp
r19dfdf r3fa16b 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 validation 127 * 128 * @return value 129 */ 130 template <class T> 131 inline const T & Value<T>::getUnvalidated() const throw(ParameterValueException) 132 { 122 133 if (!ValueSet) throw ParameterValueException(); 123 134 return value; -
src/Python/PythonScripting.cpp
r19dfdf r3fa16b 39 39 #include "CodePatterns/MemDebug.hpp" 40 40 41 bool executePythonScript (const std::string &pythonfilename_string)41 bool executePythonScriptFile(const boost::filesystem::path &pythonfilename) 42 42 { 43 boost::filesystem::path pythonfilename(pythonfilename_string);44 43 if (exists(pythonfilename)) { 45 44 // parse in and execute the local and global config.py … … 61 60 std::string pythonscript( std::istreambuf_iterator<char>(pythonfile), 62 61 (std::istreambuf_iterator<char>()) ); 63 std::string enveloped_script("print \"BEGIN of "+pythonfilename _string+":\"\n");62 std::string enveloped_script("print \"BEGIN of "+pythonfilename.string()+":\"\n"); 64 63 enveloped_script += pythonscript; 65 enveloped_script += std::string("print \"END of "+pythonfilename _string+":\"\n");64 enveloped_script += std::string("print \"END of "+pythonfilename.string()+":\"\n"); 66 65 67 66 boost::python::handle<> ignored(( PyRun_String( enveloped_script.c_str(), … … 78 77 return false; 79 78 } 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
r19dfdf r3fa16b 15 15 16 16 #include <string> 17 #include <boost/filesystem/path.hpp> 17 18 18 bool executePythonScript(const std::string &pythonfilename_string); 19 bool executePythonScriptFile(const boost::filesystem::path &pythonfilename); 20 bool executePythonScript(const std::string &python_string, const std::string &python_scripttitle); 19 21 20 22 #endif /* PYTHONSCRIPTING_HPP_ */ -
src/Python/PythonScripting_impl.hpp
r19dfdf r3fa16b 6 6 */ 7 7 8 #ifndef PYTHONSCRIPTING_ HPP_9 #define PYTHONSCRIPTING_ HPP_8 #ifndef PYTHONSCRIPTING_IMPL_HPP_ 9 #define PYTHONSCRIPTING_IMPL_HPP_ 10 10 11 11 … … 131 131 132 132 133 #endif /* PYTHONSCRIPTING_ HPP_ */133 #endif /* PYTHONSCRIPTING_IMPL_HPP_ */ -
src/UIElements/CommandLineUI/CommandLineDialog.cpp
r19dfdf r3fa16b 136 136 } 137 137 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)); 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)); 140 146 } 141 147 -
src/UIElements/CommandLineUI/CommandLineDialog.hpp
r19dfdf r3fa16b 34 34 35 35 virtual void queryEmpty(const std::string ="", const std::string = ""); 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; 36 37 protected: 38 67 39 class EmptyCommandLineQuery; 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; 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 82 71 }; 83 72 -
src/UIElements/CommandLineUI/CommandLineParser.cpp
r19dfdf r3fa16b 52 52 #include "CommandLineParser.hpp" 53 53 #include "CommandLineParser_validate.hpp" 54 #include "Parameters/Specifics/KeyValuePair.hpp" 54 55 #include "World.hpp" 55 56 … … 402 403 ; 403 404 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;415 405 case TypeEnumContainer::RealSpaceMatrixType: 416 406 OptionList->add_options() … … 419 409 // po::value < RealSpaceMatrixValue >()->default_value(boost::lexical_cast<BoxValue>(currentOption->getDefaultValue().c_str())) : 420 410 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(), 421 431 currentOption->getDescription().c_str()) 422 432 ; -
src/UIElements/CommandLineUI/CommandLineParser_validate.cpp
r19dfdf r3fa16b 42 42 #include "Actions/Values.hpp" 43 43 #include "CommandLineParser_validate.hpp" 44 #include "Parameters/Specifics/KeyValuePair.hpp" 44 45 45 46 /** boost::program_options validator specialization for VectorValue. … … 157 158 void validate(boost::any& v, const std::vector<std::string>& values, boost::filesystem::path *, int) 158 159 { 159 boost::filesystem::path filename; 160 161 std::cerr << "boost::filesystem::path validator used." << std::endl; 160 // std::cerr << "boost::filesystem::path validator used." << std::endl; 161 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; 162 212 163 213 // split comma-separated values 164 if (values.size() != 1) { 165 std::cerr << "Not one file but " << values.size() << " given " << std::endl; 214 if (values.size() > 1) { 166 215 #if BOOST_VERSION < 104200 167 216 throw boost::program_options::validation_error("Unequal to one file given"); … … 171 220 boost::program_options::validation_error::at_least_one_value_required, 172 221 std::string("value"), 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") 222 std::string("vector<KeyValuePair>") 180 223 ); 181 224 } 182 225 #endif 183 } 184 filename = values.at(0); 185 v = boost::any(boost::filesystem::path(filename)); 186 } 187 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 < 104200 230 throw boost::program_options::validation_error("Invalid KeyValue given"); 231 #else 232 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 #endif 238 } 239 } 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); 245 } -
src/UIElements/CommandLineUI/CommandLineParser_validate.hpp
r19dfdf r3fa16b 22 22 #include <boost/lexical_cast.hpp> 23 23 24 struct KeyValuePair; 24 25 class RealSpaceMatrixValue; 25 26 class VectorValue; 26 27 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); 27 30 void validate(boost::any& v, const std::vector<std::string>& values, VectorValue *, int); 28 31 void validate(boost::any& v, const std::vector<std::string>& values, RealSpaceMatrixValue *, int); -
src/UIElements/CommandLineUI/Query/CommandLineQuery.hpp
r19dfdf r3fa16b 24 24 }; 25 25 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 }; 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" 32 32 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 }; 33 #include <boost/preprocessor/facilities/empty.hpp> 39 34 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 }; 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 46 42 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 }; 43 #include "Dialog_impl_undef.hpp" 44 /* End of preprocessor code piece */ 53 45 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 };172 46 173 47 #endif /* COMMANDLINEQUERY_HPP_ */ -
src/UIElements/CommandLineUI/TypeEnumContainer.cpp
r19dfdf r3fa16b 51 51 #include "Element/element.hpp" 52 52 #include "molecule.hpp" 53 #include "Parameters/Specifics/KeyValuePair.hpp" 53 54 #include "RandomNumbers/RandomNumberDistribution_Parameters.hpp" 54 55 … … 81 82 TypeEnumMap[&typeid(const element *)] = ElementType; 82 83 TypeEnumMap[&typeid(std::vector<const element *>)] = ListOfElementsType; 83 TypeEnumMap[&typeid(RandomNumberDistribution_Parameters)] = RandomNumberDistribution_ParametersType; 84 TypeEnumMap[&typeid(KeyValuePair)] = KeyValueType; 85 TypeEnumMap[&typeid(std::vector<KeyValuePair>)] = ListOfKeyValuesType; 84 86 85 87 // for debugging: list all stored types -
src/UIElements/CommandLineUI/TypeEnumContainer.hpp
r19dfdf r3fa16b 46 46 ElementType, 47 47 ListOfElementsType, 48 RandomNumberDistribution_ParametersType, 49 RealSpaceMatrixType 48 RealSpaceMatrixType, 49 KeyValueType, 50 ListOfKeyValuesType 50 51 }; 51 52 -
src/UIElements/Dialog.cpp
r19dfdf r3fa16b 135 135 }*/ 136 136 137 template <> void Dialog::query<bool>(Parameter<bool> ¶m, const std::string title, const std::string description) 138 { 139 queryBoolean(param, title, description); 140 } 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" 141 142 142 template <> void Dialog::query<int>(Parameter<int> ¶m, const std::string title, const std::string description) 143 { 144 queryInt(param, title, description); 145 } 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); } 146 152 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 } 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 151 159 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 } 160 #undef dialog_definition 156 161 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 } 162 #include "Dialog_impl_undef.hpp" 163 /* End of preprocessor code piece */ 161 164 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 } 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 //} 241 169 242 170 /************************** Query Infrastructure ************************/ -
src/UIElements/Dialog.hpp
r19dfdf r3fa16b 22 22 #include "LinearAlgebra/RealSpaceMatrix.hpp" 23 23 #include "LinearAlgebra/Vector.hpp" 24 #include "RandomNumbers/RandomNumberDistribution_Parameters.hpp"25 24 #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 32 31 33 32 /** Dialog is one of the two main classes of the UIFactory base class. … … 133 132 * Due to the three present UI interfaces we have to add a specific Query for each, here 134 133 * is a list: 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 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 143 139 * -# add CommandLineDialog::...Query, TextDialog::...Query, QtDialog::...Query 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 140 * -# TypeEnumContainer add new type to query. Make the Type name match with the token 147 141 * -# CommandLineParser::AddOptionToParser() add new type to query 148 142 * -# CommandLineParser_valdiates.[ch]pp: If given above as a new type 149 143 * 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 thus 146 * does not fit into the preprocessor magic scheme (on the plus side it also serves 147 * as a kind of visualization of what the preprocessor actually does). 150 148 * 151 149 */ … … 159 157 160 158 virtual void queryEmpty(const std::string ="", const std::string = "")=0; 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; 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 */ 182 178 183 179 virtual bool display(); … … 286 282 }; 287 283 288 289 284 #endif /* DIALOG_HPP_ */ -
src/UIElements/Makefile.am
r19dfdf r3fa16b 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 \ 20 22 UIElements/CommandLineUI/Query/RealSpaceMatrixCommandLineQuery.cpp \ 21 23 UIElements/CommandLineUI/Query/StringCommandLineQuery.cpp \ … … 25 27 UIElements/CommandLineUI/Query/VectorCommandLineQuery.cpp \ 26 28 UIElements/CommandLineUI/Query/VectorsCommandLineQuery.cpp \ 27 UIElements/CommandLineUI/Query/RandomNumberDistribution_ParametersCommandLineQuery.cpp \28 29 UIElements/CommandLineUI/CommandLineDialog.cpp \ 29 30 UIElements/CommandLineUI/CommandLineParser.cpp \ … … 90 91 UIElements/TextUI/Query/MoleculesTextQuery.cpp \ 91 92 UIElements/TextUI/Query/MoleculeTextQuery.cpp \ 93 UIElements/TextUI/Query/KeyValuePairTextQuery.cpp \ 94 UIElements/TextUI/Query/KeyValuePairsTextQuery.cpp \ 92 95 UIElements/TextUI/Query/RealSpaceMatrixTextQuery.cpp \ 93 96 UIElements/TextUI/Query/StringTextQuery.cpp \ … … 97 100 UIElements/TextUI/Query/VectorTextQuery.cpp \ 98 101 UIElements/TextUI/Query/VectorsTextQuery.cpp \ 99 UIElements/TextUI/Query/RandomNumberDistribution_ParametersTextQuery.cpp \100 102 UIElements/TextUI/TextDialog.cpp \ 101 103 UIElements/TextUI/TextStatusIndicator.cpp \ … … 138 140 ${VIEWHEADER} \ 139 141 UIElements/Dialog.hpp \ 142 UIElements/Dialog_impl_pre.hpp \ 143 UIElements/Dialog_impl_undef.hpp \ 144 UIElements/GlobalListOfParameterQueries.hpp \ 140 145 UIElements/MainWindow.hpp 141 146 … … 156 161 UIElements/Qt4/Query/MoleculesQtQuery.cpp \ 157 162 UIElements/Qt4/Query/QtQueryList.cpp \ 163 UIElements/Qt4/Query/KeyValuePairQtQuery.cpp \ 164 UIElements/Qt4/Query/KeyValuePairsQtQuery.cpp \ 158 165 UIElements/Qt4/Query/RealSpaceMatrixQtQuery.cpp \ 159 166 UIElements/Qt4/Query/StringQtQuery.cpp \ … … 163 170 UIElements/Qt4/Query/VectorQtQuery.cpp \ 164 171 UIElements/Qt4/Query/VectorsQtQuery.cpp \ 165 UIElements/Qt4/Query/RandomNumberDistribution_ParametersQtQuery.cpp \166 172 UIElements/Qt4/QtMainWindow.cpp \ 167 173 UIElements/Qt4/QtDialog.cpp \ -
src/UIElements/Qt4/QtDialog.cpp
r19dfdf r3fa16b 197 197 } 198 198 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)); 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)); 202 207 } 203 208 -
src/UIElements/Qt4/QtDialog.hpp
r19dfdf r3fa16b 35 35 36 36 virtual void queryEmpty(const std::string ="", const std::string = ""); 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 = "");37 38 /** With the following boost::preprocessor code we generate virtual function 39 * 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 types 47 #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type 48 #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_declaration 53 #undef SUFFIX 54 #endif 55 56 #include "Dialog_impl_undef.hpp" 57 /* End of preprocessor code piece */ 58 58 59 59 virtual bool display(); … … 62 62 63 63 protected: 64 class AtomQtQuery; 65 class AtomsQtQuery; 66 class BooleanQtQuery; 67 class RealSpaceMatrixQtQuery; 68 class DoubleQtQuery; 69 class DoublesQtQuery; 70 class ElementQtQuery; 71 class ElementsQtQuery; 64 72 65 class EmptyQtQuery; 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; 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 */ 86 86 87 87 private: -
src/UIElements/Qt4/QtMainWindow.cpp
r19dfdf r3fa16b 78 78 #include "Actions/WorldAction/OutputAsAction.hpp" 79 79 80 #include "version.h" 80 81 81 82 using namespace MoleCuilder; … … 85 86 { 86 87 Q_INIT_RESOURCE(icons); 88 setWindowTitle(MOLECUILDERVERSION); 87 89 theApp->setWindowIcon(QIcon(QPixmap(":/molecuildergui_logo.png"))); 88 90 QCoreApplication::setOrganizationName("ins"); -
src/UIElements/Qt4/QtUIFactory.cpp
r19dfdf r3fa16b 33 33 #endif 34 34 35 #include <cassert> 35 36 #include <iostream> 36 #include <cassert> 37 #include <fstream> 38 #include <string.h> 39 40 #include <boost/filesystem/path.hpp> 37 41 38 42 #include <Qt/qapplication.h> … … 43 47 #include "UIElements/Qt4/QtDialog.hpp" 44 48 49 // boost::python uses placement new which is incompatible with MemDebug. 50 #ifdef HAVE_PYTHON 51 #include "Python/PythonScripting.hpp" 52 #endif 53 45 54 #include "CodePatterns/MemDebug.hpp" 46 55 47 #include "version.h"48 56 #include "Helpers/defs.hpp" 49 57 50 58 using namespace std; 51 59 52 QtUIFactory::QtUIFactory() : 53 argc(1) 60 QtUIFactory::QtUIFactory(int _argc, char **_argv) : 61 argc(1), 62 argv(new char*[1]), 63 testlauncher_Interrupted(false), 64 testlauncher_thread(NULL) 54 65 { 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); 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 } 60 93 } 61 94 62 95 QtUIFactory::~QtUIFactory() 63 96 { 64 //delete app; 65 delete [] argv[0]; 66 delete [] argv; 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; 67 108 } 68 109 … … 75 116 } 76 117 77 QtUIFactory::description::description() : 78 UIFactory::factoryDescription("Qt4") 118 QtUIFactory::description::description(int _argc, char **_argv) : 119 UIFactory::factoryDescription("Qt4"), 120 argc(_argc), 121 argv(_argv) 79 122 {} 80 123 … … 83 126 84 127 UIFactory* QtUIFactory::description::makeFactory(){ 85 return new QtUIFactory( );128 return new QtUIFactory(argc, argv); 86 129 } 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) const 137 { 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 script 144 std::cout << "TESTLAUNCHER: Launching script " << *scriptiter 145 << (_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 signal 170 std::cout << "TESTLAUNCHER: Quitting" << std::endl; 171 app->quit(); 172 } 173 174 void QtUIFactory::testlauncher_sleep(const boost::posix_time::time_duration& _period) const 175 { 176 try { 177 // first sleep for four seconds 178 #if BOOST_VERSION < 105000 179 testlauncher_thread->sleep(boost::get_system_time() + _period); 180 #else 181 boost::this_thread::sleep_for(boost::chrono::seconds(4)); 182 #endif 183 } catch(boost::thread_interrupted &e) { 184 LOG(2, "INFO: testlauncher thread has received stop signal."); 185 } 186 } -
src/UIElements/Qt4/QtUIFactory.hpp
r19dfdf r3fa16b 17 17 #include "UIElements/UIFactory.hpp" 18 18 19 #include <boost/thread.hpp> 20 #include <string> 21 #include <vector> 22 19 23 class QApplication; 20 24 … … 30 34 31 35 struct description : public UIFactory::factoryDescription { 32 description( );36 description(int _argc, char **_argv); 33 37 virtual ~description(); 34 38 35 39 virtual UIFactory* makeFactory(); 36 }; 40 41 private: 42 int argc; 43 char **argv; 44 }; 37 45 virtual std::string getUIName(){ return "Qt4"; } 38 46 47 static bool isTestMode(const char *_argument); 48 39 49 protected: 40 QtUIFactory( );50 QtUIFactory(int _argc, char **_argv); 41 51 42 52 private: 43 // faked command line arguments 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 44 61 int argc; 45 62 char **argv; 46 QApplication *app; 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; 47 69 }; 48 70 -
src/UIElements/Qt4/Query/QtQuery.hpp
r19dfdf r3fa16b 17 17 #include <Qt/qwidget.h> 18 18 #include "Qt4/QtDialog.hpp" 19 #include "QtQueryList.hpp" 20 19 21 #include "Parameters/Parameter.hpp" 20 #include "QtQueryList.hpp"21 22 22 23 class QHBoxLayout; … … 300 301 }; 301 302 303 class QtDialog::KeyValuePairQtQuery : public QWidget, public QtQuery<KeyValuePair> { 304 Q_OBJECT 305 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_OBJECT 324 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 302 339 class QtDialog::StringQtQuery : public QWidget, public QtQuery<std::string> { 303 340 Q_OBJECT … … 411 448 }; 412 449 413 class QtDialog::RandomNumberDistribution_ParametersQtQuery : public QWidget, public QtQuery<RandomNumberDistribution_Parameters> {414 Q_OBJECT415 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 431 450 #endif /* QTQUERY_HPP_ */ -
src/UIElements/Qt4/Query/QtQueryList.hpp
r19dfdf r3fa16b 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 queryRandomNumberDistribution_Parameters(Parameter<RandomNumberDistribution_Parameters> &, 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 145 147 private: 146 148 QtQueryListUntyped *parent; -
src/UIElements/TextUI/Query/TextQuery.hpp
r19dfdf r3fa16b 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 75 19 class TextDialog::EmptyTextQuery : public Dialog::EmptyQuery { 76 20 public: … … 80 24 }; 81 25 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 };88 26 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 }; 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" 95 33 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 }; 34 #include <boost/preprocessor/facilities/empty.hpp> 102 35 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 }; 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 109 43 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 }; 44 #include "Dialog_impl_undef.hpp" 45 /* End of preprocessor code piece */ 116 46 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 };172 47 173 48 #endif /* TEXTQUERY_HPP_ */ -
src/UIElements/TextUI/TextDialog.cpp
r19dfdf r3fa16b 134 134 } 135 135 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)); 136 void TextDialog::queryKeyValuePair(Parameter<KeyValuePair> ¶m, const std::string title, const std::string description) 137 { 138 registerQuery(new KeyValuePairTextQuery(param, title,description)); 138 139 } 139 140 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 } 140 145 141 146 /************************** Query Infrastructure ************************/ -
src/UIElements/TextUI/TextDialog.hpp
r19dfdf r3fa16b 22 22 class element; 23 23 class molecule; 24 class KeyValuePair; 24 25 class RealSpaceMatrix; 25 26 class Vector; … … 32 33 33 34 virtual void queryEmpty(const std::string ="", const std::string = ""); 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 = "");35 36 /** With the following boost::preprocessor code we generate virtual function 37 * 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 types 45 #if defined GLOBALLISTOFPARAMETERQUERIES_Token && defined GLOBALLISTOFPARAMETERQUERIES_Type 46 #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_declaration 51 #undef SUFFIX 52 #endif 53 54 #include "Dialog_impl_undef.hpp" 55 /* End of preprocessor code piece */ 55 56 56 57 protected: 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; 58 67 59 class EmptyTextQuery; 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; 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 82 81 }; 83 82 -
src/UIElements/Views/Qt4/QDebugStream.hpp
r19dfdf r3fa16b 33 33 { 34 34 public: 35 QDebugStream(std::ostream &stream, QTextEdit* text_edit) : m_stream(stream) 35 QDebugStream(std::ostream &stream, QTextEdit* text_edit) : 36 m_stream(stream), 37 printing(false) 36 38 { 37 39 log_window = text_edit; … … 54 56 { 55 57 if (v == '\n') { 58 while (printing); 59 printing = true; 56 60 log_window->append(m_string.c_str()); 57 61 qDebug() << m_string.c_str(); 58 62 m_string.erase(m_string.begin(), m_string.end()); 63 printing = false; 59 64 } else 60 65 m_string += v; … … 65 70 virtual std::streamsize xsputn(const char *p, std::streamsize n) 66 71 { 72 while (printing); 73 printing = true; 67 74 m_string.append(p, p + n); 75 printing = false; 68 76 69 77 size_t pos = 0; … … 72 80 if (pos != std::string::npos) { 73 81 std::string tmp(m_string.begin(), m_string.begin() + pos); 82 while (printing); 83 printing = true; 74 84 log_window->append(tmp.c_str()); 75 85 qDebug() << tmp.c_str(); 76 86 m_string.erase(m_string.begin(), m_string.begin() + pos + 1); 87 printing = false; 77 88 } 78 89 } … … 86 97 std::string m_string; 87 98 99 bool printing; 100 88 101 QTextEdit* log_window; 89 102 }; -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject.cpp
r19dfdf r3fa16b 169 169 painter->modelViewMatrix().push(); 170 170 painter->modelViewMatrix().translate(m_position); 171 if (m_rotationAngle != 0.0f) 172 painter->modelViewMatrix().rotate(m_rotationAngle, m_rotationVector); 171 173 if ((m_scaleX != 1.0f) || (m_scaleY != 1.0f) || (m_scaleZ != 1.0f)) 172 174 painter->modelViewMatrix().scale(m_scaleX, m_scaleY, m_scaleZ); 173 if (m_rotationAngle != 0.0f)174 painter->modelViewMatrix().rotate(m_rotationAngle, m_rotationVector);175 175 176 176 // Apply the material and effect to the painter. -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.cpp
r19dfdf r3fa16b 329 329 } 330 330 } 331 if (DoResetPosition) {331 if (DoResetPosition) 332 332 resetPosition(); 333 if (DoResetWidth) 334 resetWidth(); 335 if ((DoResetPosition) || (DoResetWidth)) 333 336 emit changed(); 334 }335 if (DoResetWidth) {336 resetWidth();337 emit changed();338 }339 337 } 340 338 -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp
r19dfdf r3fa16b 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 if (minradius < 1.) 74 minradius = 1.; 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.); 75 85 76 86 QGeometryData geo; … … 457 467 painter->modelViewMatrix().push(); 458 468 painter->modelViewMatrix().translate(m_position); 469 if (m_rotationAngle != 0.0f) 470 painter->modelViewMatrix().rotate(m_rotationAngle, m_rotationVector); 459 471 if ((m_scaleX != 1.0f) || (m_scaleY != 1.0f) || (m_scaleZ != 1.0f)) 460 472 painter->modelViewMatrix().scale(m_scaleX, m_scaleY, m_scaleZ); 461 if (m_rotationAngle != 0.0f)462 painter->modelViewMatrix().rotate(m_rotationAngle, m_rotationVector);463 473 464 474 // Draw a box around the mesh, if selected. -
src/World.cpp
r19dfdf r3fa16b 48 48 #include "Descriptors/AtomDescriptor.hpp" 49 49 #include "Descriptors/AtomDescriptor_impl.hpp" 50 #include "Descriptors/AtomIdDescriptor.hpp" 50 51 #include "Descriptors/AtomSelectionDescriptor.hpp" 51 52 #include "Descriptors/MoleculeDescriptor.hpp" 52 53 #include "Descriptors/MoleculeDescriptor_impl.hpp" 54 #include "Descriptors/MoleculeIdDescriptor.hpp" 53 55 #include "Descriptors/MoleculeSelectionDescriptor.hpp" 54 56 #include "Descriptors/SelectiveConstIterator_impl.hpp" … … 226 228 const atom * const Walker = (*bonditer)->leftatom; 227 229 const atom * const OtherWalker = (*bonditer)->rightatom; 228 const_cast<atom *>(Walker)->addBond(_deststep, const_cast<atom *>(OtherWalker)); 230 bond::ptr const _bond = 231 const_cast<atom *>(Walker)->addBond(_deststep, const_cast<atom *>(OtherWalker)); 232 _bond->setDegree((*bonditer)->getDegree()); 229 233 } 230 234 } … … 559 563 OBSERVE; 560 564 NOTIFY(SelectionChanged); 561 selectedAtoms = selectedAtoms_Stack.top(); 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); 562 570 selectedAtoms_Stack.pop(); 563 571 } … … 566 574 OBSERVE; 567 575 NOTIFY(SelectionChanged); 568 selectedAtoms_Stack.push( selectedAtoms ); 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 ); 569 582 selectedAtoms.clear(); 570 583 } … … 703 716 OBSERVE; 704 717 NOTIFY(SelectionChanged); 705 selectedMolecules = selectedMolecules_Stack.top(); 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); 706 723 selectedMolecules_Stack.pop(); 707 724 } … … 710 727 OBSERVE; 711 728 NOTIFY(SelectionChanged); 712 selectedMolecules_Stack.push( selectedMolecules ); 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 ); 713 737 selectedMolecules.clear(); 714 738 } -
src/World.hpp
r19dfdf r3fa16b 491 491 AtomSet atoms; 492 492 AtomSet selectedAtoms; 493 std::stack<AtomSet> selectedAtoms_Stack; 493 typedef std::vector<atomId_t> atomIdsVector_t; 494 std::stack<atomIdsVector_t> selectedAtoms_Stack; 494 495 /** 495 496 * stores the pool for all available AtomIds below currAtomId … … 501 502 MoleculeSet molecules; 502 503 MoleculeSet selectedMolecules; 503 std::stack<MoleculeSet> selectedMolecules_Stack; 504 typedef std::vector<moleculeId_t> moleculeIdsVector_t; 505 std::stack<moleculeIdsVector_t> selectedMolecules_Stack; 504 506 /** 505 507 * stores the pool for all available AtomIds below currAtomId -
src/builder_init.cpp
r19dfdf r3fa16b 126 126 // if we have python, autoexecute a molecuilder script in current folder 127 127 #ifdef HAVE_PYTHON 128 const std::string pythonfilename_string("./molecuilder.py");129 executePythonScript (pythonfilename_string);128 const boost::filesystem::path pythonfilename("./molecuilder.py"); 129 executePythonScriptFile(pythonfilename); 130 130 #endif 131 131 132 132 // handle remaining arguments by CommandLineParser 133 if (argc>1) { 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 ) { 134 139 LOG(0, "Setting UI to CommandLine."); 135 140 CommandLineParser::getInstance().InitializeCommandArguments(); … … 139 144 } else { 140 145 // In the interactive mode, we can leave the user the choice in case of error 141 ASSERT_DO(Assert::Ask);142 146 #ifdef USE_GUI_QT 147 if ((argc>1) && (QtUIFactory::isTestMode(argv[1]))) 148 ASSERT_DO(Assert::Abort); 149 else 150 ASSERT_DO(Assert::Ask); 143 151 LOG(0, "Setting UI to Qt4."); 144 UIFactory::registerFactory(new QtUIFactory::description( ));152 UIFactory::registerFactory(new QtUIFactory::description(argc, argv)); 145 153 UIFactory::makeUserInterface("Qt4"); 146 154 #else 155 ASSERT_DO(Assert::Ask); 147 156 LOG(0, "Setting UI to Text."); 148 157 cout << MOLECUILDERVERSION << endl; -
tests/Calculations/testsuite-calculations-1_2-dimethoxyethane.at
r19dfdf r3fa16b 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 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) 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) 48 49 49 50 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-1_2-dimethylbenzene.at
r19dfdf r3fa16b 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 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) 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) 48 49 49 50 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-2-methylcyclohexanone.at
r19dfdf r3fa16b 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 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) 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) 48 49 49 50 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-N_N-dimethylacetamide.at
r19dfdf r3fa16b 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 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) 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) 48 49 49 50 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-anthracene.at
r19dfdf r3fa16b 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 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) 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) 48 49 49 50 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-benzene.at
r19dfdf r3fa16b 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 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) 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) 48 49 49 50 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-cholesterol.at
r19dfdf r3fa16b 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 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) 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) 48 49 49 50 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-coronene.at
r19dfdf r3fa16b 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 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) 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) 48 49 49 50 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-cycloheptane.at
r19dfdf r3fa16b 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 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) 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) 48 49 49 50 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-dimethyl_bromomalonate.at
r19dfdf r3fa16b 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 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) 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) 48 49 49 50 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-glucose.at
r19dfdf r3fa16b 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 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) 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) 48 49 49 50 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-heptan.at
r19dfdf r3fa16b 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 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) 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) 48 49 49 50 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-isoleucine.at
r19dfdf r3fa16b 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 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) 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) 48 49 49 50 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-mpqc.at
r19dfdf r3fa16b 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 32 35 AT_CLEANUP -
tests/Calculations/testsuite-calculations-naphthalene.at
r19dfdf r3fa16b 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 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) 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) 48 49 49 50 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-neohexane.at
r19dfdf r3fa16b 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 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) 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) 48 49 49 50 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-phenanthrene.at
r19dfdf r3fa16b 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 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) 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) 48 49 49 50 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-proline.at
r19dfdf r3fa16b 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 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) 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) 48 49 49 50 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-putrescine.at
r19dfdf r3fa16b 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 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) 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) 48 49 49 50 AT_CLEANUP 50 -
tests/Calculations/testsuite-calculations-tartaric_acid.at
r19dfdf r3fa16b 45 45 --fragment-resultfile ${FILENAME}_results.dat], 46 46 0, [stdout], [stderr]) 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) 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) 48 49 49 50 AT_CLEANUP 50 -
tests/Makefile.am
r19dfdf r3fa16b 4 4 Calculations \ 5 5 CodeChecks \ 6 GuiChecks \ 6 7 regression \ 7 8 Fragmentations \ … … 10 11 JobMarket 11 12 12 .PHONY: extracheck installextracheck13 .PHONY: extracheck guicheck installextracheck 13 14 15 guicheck: 16 cd GuiChecks && $(MAKE) guicheck 14 17 extracheck: 15 18 cd Calculations && $(MAKE) extracheck -
tests/regression/Atoms/testsuite-atoms.at
r19dfdf r3fa16b 44 44 # mirror atoms 45 45 m4_include([Atoms/Mirror/testsuite-atoms-mirror.at]) 46 47 # saturate atoms 48 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
r19dfdf r3fa16b 19 19 20 20 AT_SETUP([Bond - adding bond]) 21 AT_KEYWORDS([bond add-bond ])21 AT_KEYWORDS([bond add-bonds]) 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 ], 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])25 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --add-bonds], 0, [ignore], [ignore]) 26 AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Add/post/$file], 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 undo])31 AT_KEYWORDS([bond add-bonds 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 --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])35 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --add-bonds --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]) 37 37 AT_CLEANUP 38 38 39 39 40 40 AT_SETUP([Bond - adding bond with Redo]) 41 AT_KEYWORDS([bond add-bond redo])41 AT_KEYWORDS([bond add-bonds 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 --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])45 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --add-bonds --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]) 47 47 AT_CLEANUP -
tests/regression/Bond/Remove/testsuite-bond-remove.at
r19dfdf r3fa16b 19 19 20 20 AT_SETUP([Bond - removing bond]) 21 AT_KEYWORDS([bond remove-bond ])21 AT_KEYWORDS([bond remove-bonds]) 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 ], 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])25 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --remove-bonds], 0, [ignore], [ignore]) 26 AT_CHECK([diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/tests/regression/Bond/Remove/post/$file], 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 undo])31 AT_KEYWORDS([bond remove-bonds 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 --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])35 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --remove-bonds --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]) 37 37 AT_CLEANUP 38 38 39 39 40 40 AT_SETUP([Bond - removing bond with Redo]) 41 AT_KEYWORDS([bond remove-bond redo])41 AT_KEYWORDS([bond remove-bonds 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 --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])45 AT_CHECK([../../molecuilder -i $file -o pdb --select-atom-by-id 0 1 --remove-bonds --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]) 47 47 AT_CLEANUP -
tests/regression/Bond/testsuite-bond.at
r19dfdf r3fa16b 20 20 # add bond 21 21 m4_include([Bond/Add/testsuite-bond-add.at]) 22 m4_include([Bond/Add/testsuite-bond-add_multiple.at]) 22 23 23 24 # remove bond 24 25 m4_include([Bond/Remove/testsuite-bond-remove.at]) 26 m4_include([Bond/Remove/testsuite-bond-remove_multiple.at]) -
tests/regression/Makefile.am
r19dfdf r3fa16b 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 \ 42 44 $(srcdir)/Atoms/Translation/testsuite-atoms-translation.at \ 43 45 $(srcdir)/Atoms/TranslationToOrigin/testsuite-atoms-translation-to-origin.at \ 44 46 $(srcdir)/Bond/testsuite-bond.at \ 45 47 $(srcdir)/Bond/Add/testsuite-bond-add.at \ 48 $(srcdir)/Bond/Add/testsuite-bond-add_multiple.at \ 46 49 $(srcdir)/Bond/Remove/testsuite-bond-remove.at \ 50 $(srcdir)/Bond/Remove/testsuite-bond-remove_multiple.at \ 47 51 $(srcdir)/Analysis/testsuite-analysis.at \ 48 52 $(srcdir)/Analysis/DipoleAngularCorrelation/testsuite-analysis-dipole-angular-correlation.at \ … … 112 116 $(srcdir)/Options/testsuite-options.at \ 113 117 $(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 \ 114 121 $(srcdir)/Options/ElementsDb/testsuite-options-no-elements-db.at \ 115 122 $(srcdir)/Options/ElementsDb/testsuite-options-elements-db.at \ -
tests/regression/Molecules/Remove/post/water_box.pdb
r19dfdf r3fa16b 1 REMARK created by molecuilder on Fri Dec 12 19:01:22 2014, time step 01 REMARK created by molecuilder on Tue Feb 10 10:29:29 2015, 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 3 27 CONECT 2 1 28 CONECT 3 1 26 29 CONECT 4 5 6 27 30 CONECT 5 4 28 31 CONECT 6 4 32 CONECT 7 8 9 33 CONECT 8 7 34 CONECT 9 7 29 35 CONECT 10 11 12 30 36 CONECT 11 10 -
tests/regression/Options/FastParsing/testsuite-options-fast-parsing.at
r19dfdf r3fa16b 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, 2 42 , [ignore]) 41 AT_CHECK([grep -c "I won't parse trajectories" stdout], 0, [ignore]) 43 42 44 43 AT_CLEANUP -
tests/regression/Options/testsuite-options.at
r19dfdf r3fa16b 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 run 57 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.