Changes in / [b295ca:41e15b]
- Files:
-
- 41 added
- 18 deleted
- 220 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/Action.cpp
rb295ca r41e15b 20 20 #include "Helpers/MemDebug.hpp" 21 21 22 #include <iostream> 22 23 #include <string> 23 24 … … 25 26 #include "Actions/ActionRegistry.hpp" 26 27 #include "Actions/ActionHistory.hpp" 28 #include "Actions/OptionRegistry.hpp" 29 #include "Actions/OptionTrait.hpp" 27 30 #include "Exceptions/MissingValueException.hpp" 28 31 #include "UIElements/Dialog.hpp" 32 #include "Helpers/Assert.hpp" 29 33 #include "Helpers/MemDebug.hpp" 30 34 #include "UIElements/UIFactory.hpp" … … 43 47 Action::state_ptr Action::failure = getEmptyState(); 44 48 45 Action::Action( std::string _name,bool _doRegister) :46 name(_name)49 Action::Action(const ActionTraits &_Traits, bool _doRegister) : 50 Traits(_Traits) 47 51 { 52 // register with ActionRegistry 48 53 if(_doRegister){ 49 54 ActionRegistry::getInstance().registerInstance(this); 55 } 56 57 // register with OptionRegistry 58 for (ActionTraits::options_const_iterator optioniter = Traits.getBeginIter(); 59 optioniter != Traits.getEndIter(); 60 ++optioniter) { 61 // options may have been re-used by other Actions, so check beforehand whether adding is needed 62 if (!OptionRegistry::getInstance().isOptionPresentByName((optioniter->first))) { 63 OptionRegistry::getInstance().registerInstance(optioniter->second); 64 } else { // if present, ASSERT that types coincide 65 OptionTrait const * const PresentOption = OptionRegistry::getInstance().getOptionByName(optioniter->first); 66 ASSERT(PresentOption->getType() == optioniter->second->getType(), 67 ("Action::Action() - option to add "+ 68 std::string(optioniter->first)+ 69 " of Action "+ 70 std::string(getName())+ 71 " is already present with different type!" 72 ) 73 ); 74 } 50 75 } 51 76 } … … 55 80 56 81 const string Action::getName(){ 57 return name;82 return Traits.getName(); 58 83 } 59 84 … … 104 129 return true; 105 130 } 131 -
src/Actions/Action.hpp
rb295ca r41e15b 11 11 #include <string> 12 12 #include <boost/shared_ptr.hpp> 13 14 /** Used in .def files in paramdefaults define to set that no default value exists. 15 * We define NODEFAULT here, as it is used in .def files and needs to be present 16 * before these are included. 17 */ 18 #define NODEFAULT std::string() 13 19 14 20 // forward declaration … … 17 23 class ActionSequence; 18 24 class Dialog; 25 26 #include "Actions/ActionTraits.hpp" 19 27 20 28 /** … … 294 302 */ 295 303 304 296 305 /** 297 306 * Base class for all actions. … … 319 328 * be registered with the ActionRegistry. If the Action is registered the name of the 320 329 * Action needs to be unique for all Actions that are registered. 321 */ 322 Action(std::string _name,bool _doRegister=true); 330 * 331 * \note NO reference for \a _Traits as we do have to copy it, otherwise _Traits would have 332 * to be present throughout the program's run. 333 * 334 * \param Traits information class to this action 335 * \param _doRegister whether to register with ActionRegistry 336 */ 337 Action(const ActionTraits &_Traits, bool _doRegister=true); 323 338 virtual ~Action(); 324 339 … … 363 378 * Returns the name of the Action. 364 379 */ 365 virtual const std::string getName(); 380 const std::string getName(); 381 382 /** 383 * Traits resemble all necessary information that "surrounds" an action, such as 384 * its name (for ActionRegistry and as ref from string to instance and vice versa), 385 * which menu, which position, what parameters, their types, if it is itself a 386 * parameter and so on ... 387 * 388 * Note that is important that we do not use a reference here. We want to copy the 389 * information in the Action's constructor and have it contained herein. Hence, we 390 * also have our own copy constructor for ActionTraits. Information should be 391 * encapsulated in the Action, no more references to the outside than absolutely 392 * necessary. 393 */ 394 const ActionTraits Traits; 366 395 367 396 protected: … … 440 469 */ 441 470 virtual state_ptr performRedo(state_ptr)=0; 442 443 std::string name;444 471 }; 445 472 -
src/Actions/ActionHistory.cpp
rb295ca r41e15b 20 20 #include "Helpers/MemDebug.hpp" 21 21 22 #include "Action History.hpp"22 #include "Actions/ActionHistory.hpp" 23 23 24 24 #include <iostream> … … 26 26 #include "Patterns/Singleton_impl.hpp" 27 27 #include "Helpers/Assert.hpp" 28 #include "Helpers/MemDebug.hpp"29 30 using namespace std;31 28 32 29 ActionHistory::ActionHistory() … … 72 69 ActionHistory *hist = new ActionHistory(); 73 70 setInstance(hist); 74 new UndoAction(hist);75 new RedoAction(hist);76 71 } 77 72 … … 80 75 /****************** Contained actions *******************/ 81 76 82 const char ActionHistory::UndoAction::NAME[] = "undo";83 84 ActionHistory::UndoAction::UndoAction(ActionHistory *_hist) :85 Action(NAME),86 hist(_hist)87 {}88 89 ActionHistory::UndoAction::~UndoAction(){}90 91 bool ActionHistory::UndoAction::canUndo(){92 return false;93 }94 95 bool ActionHistory::UndoAction::shouldUndo(){96 return false;97 }98 99 bool ActionHistory::UndoAction::isActive(){100 return hist->hasUndo();101 }102 103 void ActionHistory::UndoAction::getParametersfromValueStorage()104 {}105 106 Dialog* ActionHistory::UndoAction::fillDialog(Dialog *dialog){107 ASSERT(dialog,"No Dialog given when filling action dialog");108 return dialog;109 }110 111 Action::state_ptr ActionHistory::UndoAction::performCall(){112 std::cout << "Undo" << std::endl;113 hist->undoLast();114 return Action::success;115 }116 117 Action::state_ptr ActionHistory::UndoAction::performUndo(Action::state_ptr){118 ASSERT(0,"Cannot undo an undo (should use redo for this");119 return Action::success;120 }121 122 Action::state_ptr ActionHistory::UndoAction::performRedo(Action::state_ptr){123 ASSERT(0,"Cannot redo an undo");124 return Action::success;125 }126 127 const char ActionHistory::RedoAction::NAME[] = "redo";128 129 ActionHistory::RedoAction::RedoAction(ActionHistory *_hist) :130 Action(NAME),131 hist(_hist)132 {}133 134 ActionHistory::RedoAction::~RedoAction(){}135 136 bool ActionHistory::RedoAction::canUndo(){137 return false;138 }139 140 bool ActionHistory::RedoAction::shouldUndo(){141 return false;142 }143 144 bool ActionHistory::RedoAction::isActive(){145 return hist->hasRedo();146 }147 148 void ActionHistory::RedoAction::getParametersfromValueStorage()149 {}150 151 Dialog* ActionHistory::RedoAction::fillDialog(Dialog *dialog){152 ASSERT(dialog,"No Dialog given when filling action dialog");153 return dialog;154 }155 156 Action::state_ptr ActionHistory::RedoAction::performCall(){157 std::cout << "Redo" << std::endl;158 hist->redoLast();159 return Action::success;160 }161 162 Action::state_ptr ActionHistory::RedoAction::performUndo(Action::state_ptr){163 ASSERT(0,"Cannot undo a redo (should use undo for this");164 return Action::success;165 }166 167 Action::state_ptr ActionHistory::RedoAction::performRedo(Action::state_ptr){168 ASSERT(0,"Cannot redo a redo");169 return Action::success;170 } -
src/Actions/ActionHistory.hpp
rb295ca r41e15b 14 14 15 15 #include "Actions/Action.hpp" 16 #include "Actions/RedoAction.hpp" 17 #include "Actions/UndoAction.hpp" 16 18 17 19 … … 27 29 Action *action; 28 30 Action::state_ptr state; 29 };30 31 class UndoAction : public Action {32 public:33 UndoAction(ActionHistory*);34 virtual ~UndoAction();35 36 virtual bool canUndo();37 virtual bool shouldUndo();38 39 virtual bool isActive();40 protected:41 virtual Dialog * fillDialog(Dialog *dialog);42 private:43 virtual void getParametersfromValueStorage();44 virtual Action::state_ptr performCall();45 virtual Action::state_ptr performUndo(Action::state_ptr);46 virtual Action::state_ptr performRedo(Action::state_ptr);47 48 ActionHistory *hist;49 50 static const char NAME[];51 };52 53 class RedoAction : public Action {54 public:55 RedoAction(ActionHistory*);56 virtual ~RedoAction();57 58 virtual bool canUndo();59 virtual bool shouldUndo();60 61 virtual bool isActive();62 63 protected:64 virtual Dialog * fillDialog(Dialog *dialog);65 private:66 virtual void getParametersfromValueStorage();67 virtual Action::state_ptr performCall();68 virtual Action::state_ptr performUndo(Action::state_ptr);69 virtual Action::state_ptr performRedo(Action::state_ptr);70 71 ActionHistory *hist;72 73 static const char NAME[];74 31 }; 75 32 -
src/Actions/ActionRegistry.cpp
rb295ca r41e15b 47 47 * \return true - Action instance present, false - not 48 48 */ 49 bool ActionRegistry::isActionPresentByName(const std::string name) 49 bool ActionRegistry::isActionPresentByName(const std::string name) const 50 50 { 51 51 return isPresentByName(name); 52 52 } 53 53 54 /** Returns the last present action position in the requested menu. 55 * \param &token token of the menu 56 * \return last used position 57 */ 58 int ActionRegistry::getLastPosition(const std::string &token) const 59 { 60 int position = 0; 61 for (const_iterator iter = getBeginIter(); 62 iter != getEndIter(); 63 ++iter) { 64 const std::string &MenuName = (iter->second)->Traits.getMenuName(); 65 const int &MenuPosition = (iter->second)->Traits.getMenuPosition(); 66 if ((MenuName == token) && (position < MenuPosition)) 67 position = MenuPosition; 68 } 69 return position; 70 } 71 72 54 73 CONSTRUCT_SINGLETON(ActionRegistry) 55 74 CONSTRUCT_REGISTRY(Action) -
src/Actions/ActionRegistry.hpp
rb295ca r41e15b 30 30 public: 31 31 Action* getActionByName(const std::string name); 32 bool isActionPresentByName(const std::string name); 32 bool isActionPresentByName(const std::string name) const; 33 int getLastPosition(const std::string &MenuName) const; 33 34 34 35 private: -
src/Actions/Action_impl_header.hpp
rb295ca r41e15b 20 20 #include <boost/preprocessor/seq/transform.hpp> 21 21 22 // some derived names 22 #include <iostream> 23 #include <typeinfo> 24 25 #include "Actions/ActionTraits.hpp" 26 #include "Actions/OptionTrait.hpp" 27 #include "Actions/ValueStorage.hpp" 28 29 // some derived names: if CATEGORY is not given, we don't prefix with it 30 #ifdef CATEGORY 23 31 #define ACTION BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Action)) 24 32 #define COMMAND BOOST_PP_CAT(CATEGORY, ACTIONNAME) 25 33 #define PARAMS BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Parameters)) 26 34 #else 35 #define ACTION BOOST_PP_CAT(ACTIONNAME, Action) 36 #define COMMAND ACTIONNAME 37 #define PARAMS BOOST_PP_CAT(ACTIONNAME, Parameters) 38 #endif 27 39 // check if no lists given 28 40 #ifndef paramtypes … … 33 45 34 46 // check user has given name and category 35 #ifndef CATEGORY36 ERROR: No "CATEGORY" defined in: __FILE__37 #endif38 39 47 #ifndef ACTIONNAME 40 48 ERROR: No "ACTIONNAME" defined in: __FILE__ … … 50 58 BOOST_PP_ASSERT_MSG(BOOST_PP_EQUAL(MAXPARAMTYPES, BOOST_PP_SEQ_SIZE(paramreferences)),\ 51 59 ERROR: There are not the same number of "paramtokens" and "paramreferences" in: __FILE__ \ 60 ) 61 #endif 62 #ifdef paramdescriptions 63 BOOST_PP_ASSERT_MSG(BOOST_PP_EQUAL(MAXPARAMTYPES, BOOST_PP_SEQ_SIZE(paramdescriptions)),\ 64 ERROR: There are not the same number of "paramtokens" and "paramdescriptions" in: __FILE__ \ 65 ) 66 #endif 67 68 // check for mandatory defines 69 #ifndef DESCRIPTION 70 BOOST_PP_ASSERT_MSG(0, \ 71 "ERROR: Description is mandatory for Actions, here for ACTION " \ 72 ) 73 #endif 74 75 // check if paramdefaults is given, otherwise fill list with NODEFAULT 76 // this does not work: paramdefaults has to be completely defined before 77 // being used within option_print (used as an array there and not as 78 // some function call still to be expanded) 79 //#define paramdefaults (NODEFAULT) 80 //#define tempvalue(z,n,value) 81 // BOOST_PP_CAT(value,(NODEFAULT)) 82 //BOOST_PP_REPEAT(tempvalue, MAXPARAMTYPES, paramdefaults) 83 //#undef tempvalue 84 //#else 85 86 // if present, check if correct number of arguments 87 #ifdef paramdefaults 88 BOOST_PP_ASSERT_MSG(BOOST_PP_EQUAL(MAXPARAMTYPES, BOOST_PP_SEQ_SIZE(paramdefaults)),\ 89 ERROR: There are not the same number of "paramtokens" and "paramdefaults" in: __FILE__ \ 52 90 ) 53 91 #endif … … 64 102 BOOST_PP_SEQ_ELEM(n, TYPELIST) \ 65 103 BOOST_PP_SEQ_ELEM(n, VARLIST) 104 105 // prints Options.insert 106 #ifdef paramdefaults 107 #define option_print(z,n,unused, unused2) \ 108 tester = Options. insert (\ 109 std::pair< std::string, OptionTrait *> ( \ 110 BOOST_PP_SEQ_ELEM(n, paramtokens), \ 111 new OptionTrait(\ 112 BOOST_PP_SEQ_ELEM(n, paramtokens), \ 113 &typeid( BOOST_PP_SEQ_ELEM(n, paramtypes) ), \ 114 BOOST_PP_SEQ_ELEM(n, paramdescriptions), \ 115 BOOST_PP_SEQ_ELEM(n, paramdefaults) )\ 116 )\ 117 ); \ 118 ASSERT(tester.second, "ActionTrait<ACTION>::ActionTrait<ACTION>() option token present twice!"); 119 #else 120 #define option_print(z,n,unused, unused2) \ 121 tester = Options. insert (\ 122 std::pair< std::string, OptionTrait *> ( \ 123 BOOST_PP_SEQ_ELEM(n, paramtokens), \ 124 new OptionTrait(\ 125 BOOST_PP_SEQ_ELEM(n, paramtokens), \ 126 &typeid( BOOST_PP_SEQ_ELEM(n, paramtypes) ), \ 127 BOOST_PP_SEQ_ELEM(n, paramdescriptions), \ 128 NODEFAULT )\ 129 )\ 130 ); \ 131 ASSERT(tester.second, "ActionTrait<ACTION>::ActionTrait<ACTION>() option token present twice!"); 132 #endif 66 133 67 134 #if defined paramtypes && defined paramreferences … … 75 142 #endif 76 143 144 class ACTION; 145 146 template <> 147 class ActionTrait<ACTION> : public ActionTraits { 148 public: 149 ActionTrait() : 150 #ifndef SHORTFORM 151 ActionTraits(OptionTrait(TOKEN, &typeid(void), DESCRIPTION, std::string())) 152 #else 153 ActionTraits(OptionTrait(TOKEN, &typeid(void), DESCRIPTION, std::string(), SHORTFORM)) 154 #endif /* SHORTFORM */ 155 { 156 // initialize remainder of action info 157 #ifdef MENUNAME 158 MenuTitle = MENUNAME; 159 #endif 160 #ifdef MENUPOSITION 161 MenuPosition = MENUPOSITION; 162 #endif 163 164 // initialize action's options 165 std::pair< ActionTraits::options_iterator, bool > tester; 166 #ifdef paramtokens 167 #define BOOST_PP_LOCAL_MACRO(n) option_print(~, n, ~, ) 168 #define BOOST_PP_LOCAL_LIMITS (0, MAXPARAMTYPES-1) 169 #include BOOST_PP_LOCAL_ITERATE() 170 #endif 171 // associate action's short form also with option 172 #ifdef SHORTFORM 173 if (Options.find(TOKEN) != Options.end()) 174 Options[TOKEN]->setShortForm(std::string(SHORTFORM)); 175 #endif /* SHORTFORM */ 176 //std::cout << "ActionTrait<ACTION>::ActionTrait() with " << getName() << ", type " << getTypeName() << " and description " << getDescription() << std::endl; 177 } 178 179 ~ActionTrait() {} 180 }; 181 77 182 class ACTION : public Action { 78 friend79 183 #if defined paramtypes && defined paramreferences 80 void COMMAND(184 friend void COMMAND( 81 185 #define BOOST_PP_LOCAL_MACRO(n) type_list(~, n, paramtypes, paramreferences) 82 186 #define BOOST_PP_LOCAL_LIMITS (0, MAXPARAMTYPES-1) … … 94 198 bool shouldUndo(); 95 199 96 virtual const std::string getName();97 98 200 struct PARAMS : ActionParameters { 99 201 #if defined paramtypes && defined paramreferences … … 111 213 virtual Action::state_ptr performUndo(Action::state_ptr); 112 214 virtual Action::state_ptr performRedo(Action::state_ptr); 113 114 static const char NAME[];115 215 }; 116 216 … … 118 218 #undef paramtokens 119 219 #undef paramreferences 220 #undef paramdescriptions 221 #undef paramdefaults 120 222 #undef MAXPARAMTYPES 121 223 #undef statetypes … … 130 232 #undef ACTIONNAME 131 233 #undef CATEGORY 234 #undef MENUNAME 235 #undef MENUPOSITION 132 236 #undef TOKEN 237 238 #undef DESCRIPTION 239 #undef SHORTFORM -
src/Actions/Action_impl_pre.hpp
rb295ca r41e15b 42 42 #include <boost/preprocessor/seq/transform.hpp> 43 43 44 // some derived names 44 // some derived names: if CATEGORY is not given, we don't prefix with it 45 #ifdef CATEGORY 45 46 #define ACTION BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Action)) 46 47 #define COMMAND BOOST_PP_CAT(CATEGORY, ACTIONNAME) 47 48 #define STATE BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, State)) 48 49 #define PARAMS BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Parameters)) 50 #else 51 #define ACTION BOOST_PP_CAT(ACTIONNAME, Action) 52 #define COMMAND ACTIONNAME 53 #define STATE BOOST_PP_CAT(ACTIONNAME, State) 54 #define PARAMS BOOST_PP_CAT(ACTIONNAME, Parameters) 55 #endif 56 #define INSTANCE BOOST_PP_CAT(this_, BOOST_PP_CAT(ACTIONNAME, _instance)) 49 57 50 58 // check if no lists given … … 61 69 62 70 // check user has given name and category 63 #ifndef CATEGORY64 ERROR: No "CATEGORY" defined in: __FILE__65 #endif66 67 71 #ifndef ACTIONNAME 68 72 ERROR: No "ACTIONNAME" defined in: __FILE__ … … 110 114 >(\ 111 115 BOOST_PP_SEQ_ELEM(n, paramtokens)\ 112 , ValueStorage::getInstance().getDescription(\ 113 BOOST_PP_SEQ_ELEM(n, paramtokens)\ 114 )); 116 , Traits.getDescription()\ 117 ); 115 118 116 119 // prints set/queryCurrentValue (command) for paramreferences and paramtokens … … 125 128 #include "Actions/ActionRegistry.hpp" 126 129 #include "UIElements/Dialog.hpp" 127 #include "Actions/ValueStorage.hpp" 128 130 131 #ifdef paramtokens 132 #define statenecessary 1 133 #endif 134 #ifndef statetokens 135 #define statenecessary 1 136 #endif 129 137 130 138 // =========== memento to remember the state when undoing =========== 139 #ifdef statenecessary 131 140 class STATE : public ActionState { 132 141 public: … … 154 163 ACTION::PARAMS params; 155 164 }; 156 157 // =========== name of action =========== 158 const char ACTION::NAME[] = TOKEN; 165 #endif /* statenecessary */ 166 167 // (const) prototype to be placed into the ActionRegistry (must be deleted by registry itself) 168 const ACTION INSTANCE; 159 169 160 170 // =========== constructor =========== 161 171 ACTION::ACTION () : 162 Action( NAME)172 Action(ActionTrait<ACTION>()) 163 173 {} 164 174 165 175 // =========== destructor =========== 166 176 ACTION::~ACTION () 167 {} 177 { 178 //std::cout << "Action ACTION is being destroyed." << std::endl; 179 } 168 180 169 181 // =========== fill a dialog =========== … … 171 183 ASSERT(dialog,"No Dialog given when filling actionname's dialog"); 172 184 #if BOOST_PP_EQUAL(MAXPARAMTYPES,0) 173 dialog->queryEmpty( NAME, ValueStorage::getInstance().getDescription(NAME));185 dialog->queryEmpty(TOKEN, Traits.getDescription()); 174 186 #else 175 187 #define BOOST_PP_LOCAL_MACRO(n) dialog_print(~, n, ~) … … 192 204 { 193 205 ACTION::PARAMS params; 194 Action *ToCall = ActionRegistry::getInstance().getActionByName( ACTION::NAME); //->clone(params);206 Action *ToCall = ActionRegistry::getInstance().getActionByName( TOKEN ); //->clone(params); 195 207 #if BOOST_PP_NOT_EQUAL(MAXPARAMTYPES,0) 196 208 #define BOOST_PP_LOCAL_MACRO(n) value_print(~, n, setCurrentValue, ) … … 223 235 #undef PARAMS 224 236 #undef STATE 237 #undef INSTANCE 225 238 226 239 #undef ACTIONNAME -
src/Actions/AnalysisAction/MolecularVolumeAction.cpp
rb295ca r41e15b 82 82 return true; 83 83 } 84 85 const string AnalysisMolecularVolumeAction::getName() {86 return NAME;87 }88 84 /** =========== end of function ====================== */ -
src/Actions/AnalysisAction/MolecularVolumeAction.def
rb295ca r41e15b 10 10 // i.e. there is an integer with variable name Z that can be found in 11 11 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 12 // "undefine" if no parameters are required 13 //#define paramtypes (int) 14 //#define paramreferences (molID) 15 //#define paramtokens (NAME) 12 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 13 #undef paramtypes 14 #undef paramreferences 15 #undef paramtokens 16 #undef paramdescriptions 17 #undef paramdefaults 16 18 17 19 // some defines for all the names, you may use ACTION, STATE and PARAMS 18 20 #define CATEGORY Analysis 21 #define MENUNAME "analysis" 22 #define MENUPOSITION 1 19 23 #define ACTIONNAME MolecularVolume 20 24 #define TOKEN "molecular-volume" 21 25 26 // finally the information stored in the ActionTrait specialization 27 #define DESCRIPTION "calculate the volume of a given molecule" 28 #undef SHORTFORM -
src/Actions/AnalysisAction/PairCorrelationAction.cpp
rb295ca r41e15b 54 54 55 55 // execute action 56 output.open(params.outputname. c_str());57 binoutput.open(params.binoutputname. c_str());56 output.open(params.outputname.string().c_str()); 57 binoutput.open(params.binoutputname.string().c_str()); 58 58 PairCorrelationMap *correlationmap = NULL; 59 59 std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules(); … … 87 87 return true; 88 88 } 89 90 const string AnalysisPairCorrelationAction::getName() {91 return NAME;92 }93 89 /** =========== end of function ====================== */ -
src/Actions/AnalysisAction/PairCorrelationAction.def
rb295ca r41e15b 13 13 // i.e. there is an integer with variable name Z that can be found in 14 14 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 15 // "undefine" if no parameters are required 16 #define paramtypes (std::vector<const element *>)(double)(double)(double)( std::string)(std::string)(bool)15 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 16 #define paramtypes (std::vector<const element *>)(double)(double)(double)(boost::filesystem::path)(boost::filesystem::path)(bool) 17 17 #define paramreferences (elements)(BinStart)(BinWidth)(BinEnd)(outputname)(binoutputname)(periodic) 18 18 #define paramtokens ("elements")("bin-start")("bin-width")("bin-end")("output-file")("bin-output-file")("periodic") 19 #define paramdescriptions ("set of elements")("start of the first bin")("width of the bins")("start of the last bin")("name of the output file")("name of the bin output file")("system is constraint to periodic boundary conditions") 20 #define paramdefaults (NODEFAULT)(NODEFAULT)("0.5")(NODEFAULT)(NODEFAULT)(NODEFAULT)("0") 19 21 20 22 // some defines for all the names, you may use ACTION, STATE and PARAMS 21 23 #define CATEGORY Analysis 24 #define MENUNAME "analysis" 25 #define MENUPOSITION 2 22 26 #define ACTIONNAME PairCorrelation 23 27 #define TOKEN "pair-correlation" 28 29 // finally the information stored in the ActionTrait specialization 30 #define DESCRIPTION "pair correlation analysis between two elements" 31 #define SHORTFORM "C" -
src/Actions/AnalysisAction/PointCorrelationAction.cpp
rb295ca r41e15b 56 56 57 57 // execute action 58 output.open(params.outputname. c_str());59 binoutput.open(params.binoutputname. c_str());58 output.open(params.outputname.string().c_str()); 59 binoutput.open(params.binoutputname.string().c_str()); 60 60 cout << "Point to correlate to is " << params.Point << endl; 61 61 CorrelationToPointMap *correlationmap = NULL; … … 92 92 return true; 93 93 } 94 95 const string AnalysisPointCorrelationAction::getName() {96 return NAME;97 }98 94 /** =========== end of function ====================== */ -
src/Actions/AnalysisAction/PointCorrelationAction.def
rb295ca r41e15b 15 15 // i.e. there is an integer with variable name Z that can be found in 16 16 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 17 // "undefine" if no parameters are required 18 #define paramtypes (std::vector<const element *>)(Vector)(double)(double)(double)( std::string)(std::string)(bool)17 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 18 #define paramtypes (std::vector<const element *>)(Vector)(double)(double)(double)(boost::filesystem::path)(boost::filesystem::path)(bool) 19 19 #define paramreferences (elements)(Point)(BinStart)(BinWidth)(BinEnd)(outputname)(binoutputname)(periodic) 20 20 #define paramtokens ("elements")("position")("bin-start")("bin-width")("bin-end")("output-file")("bin-output-file")("periodic") 21 #define paramdescriptions ("set of elements")("position in R^3 space")("start of the first bin")("width of the bins")("start of the last bin")("name of the output file")("name of the bin output file")("system is constraint to periodic boundary conditions") 22 #define paramdefaults (NODEFAULT)(NODEFAULT)(NODEFAULT)("0.5")(NODEFAULT)(NODEFAULT)(NODEFAULT)("0") 21 23 22 24 // some defines for all the names, you may use ACTION, STATE and PARAMS 23 25 #define CATEGORY Analysis 26 #define MENUNAME "analysis" 27 #define MENUPOSITION 3 24 28 #define ACTIONNAME PointCorrelation 25 29 #define TOKEN "point-correlation" 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "pair correlation analysis between element and point" 33 #undef SHORTFORM -
src/Actions/AnalysisAction/PrincipalAxisSystemAction.cpp
rb295ca r41e15b 86 86 return true; 87 87 } 88 89 const string AnalysisPrincipalAxisSystemAction::getName() {90 return NAME;91 }92 88 /** =========== end of function ====================== */ -
src/Actions/AnalysisAction/PrincipalAxisSystemAction.def
rb295ca r41e15b 1 #undef paramdescriptions 2 #undef paramdefaults 1 3 /* 2 4 * PrincipalAxisSystemAction.def … … 10 12 // i.e. there is an integer with variable name Z that can be found in 11 13 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 12 // "undefine" if no parameters are required 14 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 15 #undef paramtypes 16 #undef paramreferences 17 #undef paramtokens 18 #undef paramdescriptions 19 #undef paramdefaults 13 20 14 21 // some defines for all the names, you may use ACTION, STATE and PARAMS 15 22 #define CATEGORY Analysis 23 #define MENUNAME "analysis" 24 #define MENUPOSITION 5 16 25 #define ACTIONNAME PrincipalAxisSystem 17 26 #define TOKEN "principal-axis-system" 27 28 // finally the information stored in the ActionTrait specialization 29 #define DESCRIPTION "calculate the principal axis system of the specified molecule" 30 #undef SHORTFORM -
src/Actions/AnalysisAction/SurfaceCorrelationAction.cpp
rb295ca r41e15b 55 55 56 56 // execute action 57 output.open(params.outputname. c_str());58 binoutput.open(params.binoutputname. c_str());57 output.open(params.outputname.string().c_str()); 58 binoutput.open(params.binoutputname.string().c_str()); 59 59 ASSERT(params.Boundary != NULL, "No molecule specified for SurfaceCorrelation."); 60 60 const double radius = 4.; … … 114 114 return true; 115 115 } 116 117 const string AnalysisSurfaceCorrelationAction::getName() {118 return NAME;119 }120 116 /** =========== end of function ====================== */ -
src/Actions/AnalysisAction/SurfaceCorrelationAction.def
rb295ca r41e15b 14 14 // i.e. there is an integer with variable name Z that can be found in 15 15 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 16 // "undefine" if no parameters are required 17 #define paramtypes (std::vector<const element *>)( molecule *)(double)(double)(double)(std::string)(std::string)(bool)16 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 17 #define paramtypes (std::vector<const element *>)(const molecule *)(double)(double)(double)(boost::filesystem::path)(boost::filesystem::path)(bool) 18 18 #define paramreferences (elements)(Boundary)(BinStart)(BinWidth)(BinEnd)(outputname)(binoutputname)(periodic) 19 19 #define paramtokens ("elements")("molecule-by-id")("bin-start")("bin-width")("bin-end")("output-file")("bin-output-file")("periodic") 20 #define paramdescriptions ("set of elements")("index of a molecule")("start of the first bin")("width of the bins")("start of the last bin")("name of the output file")("name of the bin output file")("system is constraint to periodic boundary conditions") 21 #define paramdefaults (NODEFAULT)(NODEFAULT)(NODEFAULT)("0.5")(NODEFAULT)(NODEFAULT)(NODEFAULT)("0") 20 22 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Analysis 25 #define MENUNAME "analysis" 26 #define MENUPOSITION 4 23 27 #define ACTIONNAME SurfaceCorrelation 24 28 #define TOKEN "surface-correlation" 29 30 // finally the information stored in the ActionTrait specialization 31 #define DESCRIPTION "pair correlation analysis between element and surface" 32 #undef SHORTFORM -
src/Actions/AtomAction/AddAction.cpp
rb295ca r41e15b 93 93 return true; 94 94 } 95 96 const string AtomAddAction::getName() {97 return NAME;98 }99 95 /** =========== end of function ====================== */ -
src/Actions/AtomAction/AddAction.def
rb295ca r41e15b 13 13 // i.e. there is an integer with variable name Z that can be found in 14 14 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 15 // "undefine" if no parameters are required 15 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 16 16 #define paramtypes (const element *)(BoxVector) 17 #define paramtokens (ACTION::NAME)("position") 17 #define paramtokens ("add-atom")("domain-position") 18 #define paramdescriptions ("element of new atom")("position within current domain") 18 19 #define paramreferences (elemental)(position) 20 #define paramdefaults (NODEFAULT)(NODEFAULT) 19 21 20 22 #define statetypes (const atomId_t) … … 23 25 // some defines for all the names, you may use ACTION, STATE and PARAMS 24 26 #define CATEGORY Atom 27 #define MENUNAME "atom" 28 #define MENUPOSITION 1 25 29 #define ACTIONNAME Add 26 30 #define TOKEN "add-atom" 31 32 // finally the information stored in the ActionTrait specialization 33 #define DESCRIPTION "add atom of specified element" 34 #define SHORTFORM "a" -
src/Actions/AtomAction/ChangeElementAction.cpp
rb295ca r41e15b 105 105 return true; 106 106 } 107 108 const string AtomChangeElementAction::getName() {109 return NAME;110 }111 107 /** =========== end of function ====================== */ -
src/Actions/AtomAction/ChangeElementAction.def
rb295ca r41e15b 12 12 // i.e. there is an integer with variable name Z that can be found in 13 13 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 14 // "undefine" if no parameters are required 14 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 15 15 #define paramtypes (const element *) 16 #define paramtokens (ACTION::NAME) 16 #define paramtokens ("change-element") 17 #define paramdescriptions ("new the element of atom") 18 #undef paramdefaults 17 19 #define paramreferences (elemental) 18 20 … … 22 24 // some defines for all the names, you may use ACTION, STATE and PARAMS 23 25 #define CATEGORY Atom 26 #define MENUNAME "atom" 27 #define MENUPOSITION 2 24 28 #define ACTIONNAME ChangeElement 25 29 #define TOKEN "change-element" 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "change the element of an atom" 33 #define SHORTFORM "E" -
src/Actions/AtomAction/RemoveAction.cpp
rb295ca r41e15b 107 107 return true; 108 108 } 109 110 const string AtomRemoveAction::getName() {111 return NAME;112 }113 109 /** =========== end of function ====================== */ -
src/Actions/AtomAction/RemoveAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 14 #undef paramtypes 15 15 #undef paramtokens 16 #undef paramdescriptions 17 #undef paramdefaults 16 18 #undef paramreferences 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Atom 25 #define MENUNAME "atom" 26 #define MENUPOSITION 3 23 27 #define ACTIONNAME Remove 24 28 #define TOKEN "remove-atom" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "remove a specified atom" 33 #define SHORTFORM "r" -
src/Actions/AtomAction/RotateAroundOriginByAngleAction.cpp
rb295ca r41e15b 98 98 return true; 99 99 } 100 101 const string AtomRotateAroundOriginByAngleAction::getName() {102 return NAME;103 }104 100 /** =========== end of function ====================== */ -
src/Actions/AtomAction/RotateAroundOriginByAngleAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (double) (Vector) 15 #define paramtokens (AtomRotateAroundOriginByAngleAction::NAME) ("position") 16 #define paramreferences (angle) (Axis) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (double)(Vector) 15 #define paramtokens ("rotate-origin")("position") 16 #define paramdescriptions ("rotation angle")("position in R^3 space") 17 #undef paramdefaults 18 #define paramreferences (angle)(Axis) 17 19 18 20 #define statetypes (std::vector<atom*>) … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Atom 25 #define MENUNAME "atom" 26 #define MENUPOSITION 5 23 27 #define ACTIONNAME RotateAroundOriginByAngle 24 28 #define TOKEN "rotate-origin" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "rotate selected atoms by a specific angle around origin" 33 #undef SHORTFORM -
src/Actions/AtomAction/TranslateAction.cpp
rb295ca r41e15b 88 88 return true; 89 89 } 90 91 const string AtomTranslateAction::getName() {92 return NAME;93 }94 90 /** =========== end of function ====================== */ -
src/Actions/AtomAction/TranslateAction.def
rb295ca r41e15b 7 7 8 8 // all includes and forward declarations necessary for non-integral types below 9 #include "Actions/Values.hpp" 9 10 #include "LinearAlgebra/Vector.hpp" 10 11 11 12 // i.e. there is an integer with variable name Z that can be found in 12 13 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (Vector) (bool) 15 #define paramtokens (AtomTranslateAction::NAME) ("periodic") 16 #define paramreferences (x) (periodic) 14 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 15 #define paramtypes (Vector)(bool) 16 #define paramtokens ("translate-atoms")("periodic") 17 #define paramdescriptions ("translation vector")("system is constraint to periodic boundary conditions") 18 #define paramreferences (x)(periodic) 19 #define paramdefaults (NODEFAULT)("0") 17 20 18 21 #define statetypes (std::vector<atom*>) … … 21 24 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 25 #define CATEGORY Atom 26 #define MENUNAME "atom" 27 #define MENUPOSITION 4 23 28 #define ACTIONNAME Translate 24 29 #define TOKEN "translate-atoms" 25 30 31 32 // finally the information stored in the ActionTrait specialization 33 #define DESCRIPTION "translate all selected atoms by given vector" 34 #define SHORTFORM "t" -
src/Actions/AtomsCalculation.hpp
rb295ca r41e15b 17 17 { 18 18 public: 19 AtomsCalculation(boost::function<T(atom*)> op, std::string name,AtomDescriptor descr);19 AtomsCalculation(boost::function<T(atom*)> op,const ActionTraits &_trait,AtomDescriptor descr); 20 20 virtual ~AtomsCalculation(); 21 21 -
src/Actions/AtomsCalculation_impl.hpp
rb295ca r41e15b 15 15 16 16 template<typename T> 17 AtomsCalculation<T>::AtomsCalculation(boost::function<T(atom*)> _op, std::string name,AtomDescriptor _descr) :18 Calculation<std::vector<T> >(0, name,false),17 AtomsCalculation<T>::AtomsCalculation(boost::function<T(atom*)> _op,const ActionTraits &_trait,AtomDescriptor _descr) : 18 Calculation<std::vector<T> >(0,_trait,false), 19 19 descr(_descr), 20 20 op(_op) -
src/Actions/Calculation.hpp
rb295ca r41e15b 21 21 { 22 22 public: 23 Calculation(int _maxSteps, std::string _name, bool _doRegister=true);23 Calculation(int _maxSteps, const ActionTraits &_trait, bool _doRegister=true); 24 24 virtual ~Calculation(); 25 25 -
src/Actions/Calculation_impl.hpp
rb295ca r41e15b 14 14 15 15 template<typename T> 16 Calculation<T>::Calculation(int _maxSteps, std::string _name, bool _doRegister) :17 Process(_maxSteps,_ name,_doRegister),16 Calculation<T>::Calculation(int _maxSteps, const ActionTraits &_trait, bool _doRegister) : 17 Process(_maxSteps,_trait,_doRegister), 18 18 result(0), 19 19 done(false) -
src/Actions/CommandAction/BondLengthTableAction.cpp
rb295ca r41e15b 47 47 if (configuration->BG == NULL) { 48 48 configuration->BG = new BondGraph(configuration->GetIsAngstroem()); 49 if ((!params.BondGraphFileName.empty()) && (configuration->BG->LoadBondLengthTable(params.BondGraphFileName ))) {49 if ((!params.BondGraphFileName.empty()) && (configuration->BG->LoadBondLengthTable(params.BondGraphFileName.string()))) { 50 50 DoLog(0) && (Log() << Verbose(0) << "Bond length table loaded successfully." << endl); 51 51 return Action::success; … … 81 81 return false; 82 82 } 83 84 const string CommandBondLengthTableAction::getName() {85 return NAME;86 }87 83 /** =========== end of function ====================== */ -
src/Actions/CommandAction/BondLengthTableAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (std::string) 15 #define paramtokens (CommandBondLengthTableAction::NAME) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (boost::filesystem::path) 15 #define paramtokens ("bond-table") 16 #define paramdescriptions ("name of the bond length table file") 17 #undef paramdefaults 16 18 #define paramreferences (BondGraphFileName) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Command 25 #define MENUNAME "command" 26 #define MENUPOSITION 1 23 27 #define ACTIONNAME BondLengthTable 24 28 #define TOKEN "bond-table" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "specifying a table file with specific bond lengths to use in bond structure analysis" 33 #define SHORTFORM "g" -
src/Actions/CommandAction/ElementDbAction.cpp
rb295ca r41e15b 46 46 // TODO: Make databasepath a std::string 47 47 config *configuration = World::getInstance().getConfig(); 48 strcpy(configuration->databasepath, params.databasepath. c_str());48 strcpy(configuration->databasepath, params.databasepath.branch_path().string().c_str()); 49 49 50 50 // load table … … 82 82 return false; 83 83 } 84 85 const string CommandElementDbAction::getName() {86 return NAME;87 }88 84 /** =========== end of function ====================== */ -
src/Actions/CommandAction/ElementDbAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (std::string) 15 #define paramtokens (CommandElementDbAction::NAME) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (boost::filesystem::path) 15 #define paramtokens ("element-db") 16 #define paramdescriptions ("path where the element databases can be found") 17 #undef paramdefaults 16 18 #define paramreferences (databasepath) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Command 25 #define MENUNAME "command" 26 #define MENUPOSITION 2 23 27 #define ACTIONNAME ElementDb 24 28 #define TOKEN "element-db" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "specify the path to a different element databases" 33 #define SHORTFORM "e" -
src/Actions/CommandAction/FastParsingAction.cpp
rb295ca r41e15b 84 84 return true; 85 85 } 86 87 const string CommandFastParsingAction::getName() {88 return NAME;89 }90 86 /** =========== end of function ====================== */ -
src/Actions/CommandAction/FastParsingAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 14 #define paramtypes (bool) 15 #define paramtokens (CommandFastParsingAction::NAME) 15 #define paramtokens ("fastparsing") 16 #define paramdescriptions ("setting whether trajectories shall be parsed completely (n) or just first step (y)") 17 #undef paramdefaults 16 18 #define paramreferences (fastparsing) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Command 25 #define MENUNAME "command" 26 #define MENUPOSITION 3 23 27 #define ACTIONNAME FastParsing 24 28 #define TOKEN "fastparsing" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "setting whether trajectories shall be parsed completely (n) or just first step (y)" 33 #define SHORTFORM "n" -
src/Actions/CommandAction/HelpAction.cpp
rb295ca r41e15b 19 19 20 20 #include "Helpers/MemDebug.hpp" 21 22 #include "CommandLineParser.hpp"23 21 24 22 #include <iostream> … … 55 53 return false; 56 54 } 57 58 const string CommandHelpAction::getName() {59 return NAME;60 }61 55 /** =========== end of function ====================== */ -
src/Actions/CommandAction/HelpAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 14 #undef paramtypes 15 15 #undef paramtokens 16 #undef paramdescriptions 17 #undef paramdefaults 16 18 #undef paramreferences 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Command 25 #define MENUNAME "command" 26 #define MENUPOSITION 4 23 27 #define ACTIONNAME Help 24 28 #define TOKEN "help" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "help screen" 33 #define SHORTFORM "h" -
src/Actions/CommandAction/VerboseAction.cpp
rb295ca r41e15b 76 76 return true; 77 77 } 78 79 const string CommandVerboseAction::getName() {80 return NAME;81 }82 78 /** =========== end of function ====================== */ -
src/Actions/CommandAction/VerboseAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 14 #define paramtypes (int) 15 #define paramtokens (CommandVerboseAction::NAME) 15 #define paramtokens ("verbose") 16 #define paramdescriptions ("set verbosity level") 17 #undef paramdefaults 16 18 #define paramreferences (verbosity) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Command 25 #define MENUNAME "command" 26 #define MENUPOSITION 5 23 27 #define ACTIONNAME Verbose 24 28 #define TOKEN "verbose" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "set verbosity level" 33 #define SHORTFORM "v" -
src/Actions/CommandAction/VersionAction.cpp
rb295ca r41e15b 55 55 return false; 56 56 } 57 58 const string CommandVersionAction::getName() {59 return NAME;60 }61 57 /** =========== end of function ====================== */ -
src/Actions/CommandAction/VersionAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 14 #undef paramtypes 15 15 #undef paramtokens 16 #undef paramdescriptions 17 #undef paramdefaults 16 18 #undef paramreferences 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Command 25 #define MENUNAME "command" 26 #define MENUPOSITION 6 23 27 #define ACTIONNAME Version 24 28 #define TOKEN "version" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "show version" 33 #define SHORTFORM "V" -
src/Actions/CommandAction/WarrantyAction.cpp
rb295ca r41e15b 19 19 20 20 #include "Helpers/MemDebug.hpp" 21 22 #include "CommandLineParser.hpp"23 21 24 22 #include <iostream> … … 61 59 return false; 62 60 } 63 64 const string CommandWarrantyAction::getName() {65 return NAME;66 }67 61 /** =========== end of function ====================== */ -
src/Actions/CommandAction/WarrantyAction.def
rb295ca r41e15b 10 10 // i.e. there is an integer with variable name Z that can be found in 11 11 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 12 // "undefine" if no parameters are required 12 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 13 13 #undef paramtypes 14 14 #undef paramtokens 15 #undef paramdescriptions 16 #undef paramdefaults 15 17 #undef paramreferences 16 18 … … 20 22 // some defines for all the names, you may use ACTION, STATE and PARAMS 21 23 #define CATEGORY Command 24 #define MENUNAME "command" 25 #define MENUPOSITION 7 22 26 #define ACTIONNAME Warranty 23 27 #define TOKEN "warranty" 24 28 29 30 // finally the information stored in the ActionTrait specialization 31 #define DESCRIPTION "statement concerning warranty of the software" 32 #undef SHORTFORM -
src/Actions/ErrorAction.cpp
rb295ca r41e15b 29 29 using namespace std; 30 30 31 ErrorAction::ErrorAction( string _name,const char * _errorMsg,bool _doRegister) :32 Action(_ name,_doRegister),31 ErrorAction::ErrorAction(const ActionTraits &_trait,const char * _errorMsg,bool _doRegister) : 32 Action(_trait,_doRegister), 33 33 errorMsg(_errorMsg) 34 34 { -
src/Actions/ErrorAction.hpp
rb295ca r41e15b 15 15 { 16 16 public: 17 ErrorAction( std::string _name,const char * _errorMsg,bool _doRegister=true);17 ErrorAction(const ActionTraits &_trait,const char * _errorMsg,bool _doRegister=true); 18 18 virtual ~ErrorAction(); 19 19 -
src/Actions/FragmentationAction/ConstructBondGraphAction.cpp
rb295ca r41e15b 174 174 return false; 175 175 } 176 177 const string FragmentationConstructBondGraphAction::getName() {178 return NAME;179 }180 176 /** =========== end of function ====================== */ -
src/Actions/FragmentationAction/ConstructBondGraphAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 14 #undef paramtypes 15 15 #undef paramtokens 16 #undef paramdescriptions 17 #undef paramdefaults 16 18 #undef paramreferences 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Fragmentation 25 #define MENUNAME "fragmentation" 26 #define MENUPOSITION 1 23 27 #define ACTIONNAME ConstructBondGraph 24 28 #define TOKEN "construct-bondgraph" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "construct the bond graph of the selected atoms" 33 #undef SHORTFORM -
src/Actions/FragmentationAction/DepthFirstSearchAction.cpp
rb295ca r41e15b 91 91 return true; 92 92 } 93 94 const string FragmentationDepthFirstSearchAction::getName() {95 return NAME;96 }97 93 /** =========== end of function ====================== */ -
src/Actions/FragmentationAction/DepthFirstSearchAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 14 #define paramtypes (double) 15 #define paramtokens (FragmentationDepthFirstSearchAction::NAME) 15 #define paramtokens ("depth-first-search") 16 #define paramdescriptions ("maximum distance to look for neighbors") 17 #undef paramdefaults 16 18 #define paramreferences (distance) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Fragmentation 25 #define MENUNAME "fragmentation" 26 #define MENUPOSITION 2 23 27 #define ACTIONNAME DepthFirstSearch 24 28 #define TOKEN "depth-first-search" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "Depth-First Search analysis of the molecular system" 33 #define SHORTFORM "D" -
src/Actions/FragmentationAction/FragmentationAction.cpp
rb295ca r41e15b 82 82 return true; 83 83 } 84 85 const string FragmentationFragmentationAction::getName() {86 return NAME;87 }88 84 /** =========== end of function ====================== */ -
src/Actions/FragmentationAction/FragmentationAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (std::string) (double) (int) 15 #define paramtokens (FragmentationFragmentationAction::NAME) ("distance") ("order") 16 #define paramreferences (path) (distance) (order) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (std::string)(double)(int) 15 #define paramtokens ("fragment-mol")("distance")("order") 16 #define paramdescriptions ("path to where the fragment configurations shall be stored")("distance in space")("order of a discretization, dissection, ...") 17 #undef paramdefaults 18 #define paramreferences (path)(distance)(order) 17 19 18 20 #undef statetypes … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Fragmentation 25 #define MENUNAME "fragmentation" 26 #define MENUPOSITION 3 23 27 #define ACTIONNAME Fragmentation 24 28 #define TOKEN "fragment-mol" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "create for a given molecule into fragments up to given order" 33 #define SHORTFORM "f" -
src/Actions/FragmentationAction/SubgraphDissectionAction.cpp
rb295ca r41e15b 212 212 return true; 213 213 } 214 215 const string FragmentationSubgraphDissectionAction::getName() {216 return NAME;217 }218 214 /** =========== end of function ====================== */ -
src/Actions/FragmentationAction/SubgraphDissectionAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 14 #undef paramtypes 15 15 #undef paramtokens 16 #undef paramdescriptions 17 #undef paramdefaults 16 18 #undef paramreferences 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Fragmentation 25 #define MENUNAME "fragmentation" 26 #define MENUPOSITION 4 23 27 #define ACTIONNAME SubgraphDissection 24 28 #define TOKEN "subgraph-dissect" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "dissect the molecular system into molecules representing disconnected subgraphs" 33 #define SHORTFORM "I" -
src/Actions/Makefile.am
rb295ca r41e15b 17 17 ${TESSELATIONACTIONSOURCE} \ 18 18 ${WORLDACTIONSOURCE} \ 19 MapOfActions.cpp \ 19 RedoAction.cpp \ 20 UndoAction.cpp \ 20 21 ValueStorage.cpp 21 22 … … 30 31 ${TESSELATIONACTIONHEADER} \ 31 32 ${WORLDACTIONHEADER} \ 32 MapOfActions.hpp \33 33 ValueStorage.hpp \ 34 34 Values.hpp -
src/Actions/MakroAction.cpp
rb295ca r41e15b 41 41 }; 42 42 43 MakroAction::MakroAction( string _name,ActionSequence* _actions,bool _doRegister) :44 Action(_ name,_doRegister),43 MakroAction::MakroAction(const ActionTraits &_trait,ActionSequence* _actions,bool _doRegister) : 44 Action(_trait,_doRegister), 45 45 actions(_actions) 46 46 { -
src/Actions/MakroAction.hpp
rb295ca r41e15b 23 23 { 24 24 public: 25 MakroAction( std::string _name,ActionSequence* _actions,bool _doRegister=true);25 MakroAction(const ActionTraits &_trait,ActionSequence* _actions,bool _doRegister=true); 26 26 virtual ~MakroAction(); 27 27 -
src/Actions/ManipulateAtomsProcess.cpp
rb295ca r41e15b 29 29 using namespace std; 30 30 31 ManipulateAtomsProcess::ManipulateAtomsProcess(boost::function<void(atom*)> _operation, AtomDescriptor _descr, 32 std::string _name,bool _doRegister) : 33 Process(0,_name,_doRegister), 31 ManipulateAtomsProcess::ManipulateAtomsProcess( 32 boost::function<void(atom*)> _operation, 33 AtomDescriptor _descr, 34 const ActionTraits &_trait, 35 bool _doRegister) : 36 Process(0,_trait,_doRegister), 34 37 descr(_descr), 35 38 operation(_operation) -
src/Actions/ManipulateAtomsProcess.hpp
rb295ca r41e15b 20 20 { 21 21 public: 22 ManipulateAtomsProcess(boost::function<void(atom*)> _operation, AtomDescriptor descr, std::string _name,bool _doRegister=true);22 ManipulateAtomsProcess(boost::function<void(atom*)> _operation, AtomDescriptor descr,const ActionTraits &_trait,bool _doRegister=true); 23 23 virtual ~ManipulateAtomsProcess(); 24 24 -
src/Actions/MethodAction.cpp
rb295ca r41e15b 29 29 using namespace std; 30 30 31 MethodAction::MethodAction( string _name,boost::function<void()> _executeMethod,bool _doRegister) :32 Action(_ name,_doRegister),31 MethodAction::MethodAction(const ActionTraits &_trait,boost::function<void()> _executeMethod,bool _doRegister) : 32 Action(_trait,_doRegister), 33 33 executeMethod(_executeMethod) 34 34 { -
src/Actions/MethodAction.hpp
rb295ca r41e15b 20 20 { 21 21 public: 22 MethodAction( std::string _name,boost::function<void()> _executeMethod,bool _doRegister=true);22 MethodAction(const ActionTraits &_trait,boost::function<void()> _executeMethod,bool _doRegister=true); 23 23 virtual ~MethodAction(); 24 24 virtual bool canUndo(); -
src/Actions/MoleculeAction/BondFileAction.cpp
rb295ca r41e15b 46 46 mol = World::getInstance().beginMoleculeSelection()->second; 47 47 DoLog(0) && (Log() << Verbose(0) << "Parsing bonds from " << params.bondfile << "." << endl); 48 ifstream input(params.bondfile. c_str());48 ifstream input(params.bondfile.string().c_str()); 49 49 mol->CreateAdjacencyListFromDbondFile(&input); 50 50 input.close(); … … 75 75 return false; 76 76 } 77 78 const string MoleculeBondFileAction::getName() {79 return NAME;80 }81 77 /** =========== end of function ====================== */ -
src/Actions/MoleculeAction/BondFileAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (std::string) 15 #define paramtokens (MoleculeBondFileAction::NAME) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (boost::filesystem::path) 15 #define paramtokens ("bond-file") 16 #define paramdescriptions ("name of the bond file") 17 #undef paramdefaults 16 18 #define paramreferences (bondfile) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Molecule 25 #define MENUNAME "molecule" 26 #define MENUPOSITION 1 23 27 #define ACTIONNAME BondFile 24 28 #define TOKEN "bond-file" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "parse bond structure from dbond file" 33 #define SHORTFORM "A" -
src/Actions/MoleculeAction/ChangeNameAction.cpp
rb295ca r41e15b 71 71 return true; 72 72 } 73 74 const string MoleculeChangeNameAction::getName() {75 return NAME;76 }77 73 /** =========== end of function ====================== */ -
src/Actions/MoleculeAction/ChangeNameAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 14 #define paramtypes (std::string) 15 #define paramtokens (MoleculeChangeNameAction::NAME) 15 #define paramtokens ("change-molname") 16 #define paramdescriptions ("new name of molecule") 17 #undef paramdefaults 16 18 #define paramreferences (name) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Molecule 25 #define MENUNAME "molecule" 26 #define MENUPOSITION 3 23 27 #define ACTIONNAME ChangeName 24 28 #define TOKEN "change-molname" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "change the name of a molecule" 33 #undef SHORTFORM -
src/Actions/MoleculeAction/CopyAction.cpp
rb295ca r41e15b 91 91 return true; 92 92 } 93 94 const string MoleculeCopyAction::getName() {95 return NAME;96 }97 93 /** =========== end of function ====================== */ -
src/Actions/MoleculeAction/CopyAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (molecule *) (Vector) 15 #define paramtokens (MoleculeCopyAction::NAME) ("position") 16 #define paramreferences (mol) (position) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (const molecule *)(Vector) 15 #define paramtokens ("copy-molecule")("position") 16 #define paramdescriptions ("molecule to copy")("position in R^3 space") 17 #undef paramdefaults 18 #define paramreferences (mol)(position) 17 19 18 20 #define statetypes (molecule *) … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Molecule 25 #define MENUNAME "molecule" 26 #define MENUPOSITION 2 23 27 #define ACTIONNAME Copy 24 28 #define TOKEN "copy-molecule" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "copies a molecule with all atoms and bonds" 33 #undef SHORTFORM -
src/Actions/MoleculeAction/FillVoidWithMoleculeAction.cpp
rb295ca r41e15b 54 54 // construct water molecule 55 55 molecule *filler = World::getInstance().createMolecule(); 56 std::string FilenameSuffix = params.fillername.s ubstr(params.fillername.find_last_of('.')+1, params.fillername.length());56 std::string FilenameSuffix = params.fillername.string().substr(params.fillername.string().find_last_of('.')+1, params.fillername.string().length()); 57 57 ifstream input; 58 input.open(params.fillername. c_str());58 input.open(params.fillername.string().c_str()); 59 59 switch (FormatParserStorage::getInstance().getTypeFromSuffix(FilenameSuffix)) { 60 60 case mpqc: … … 95 95 for (; iter != World::getInstance().moleculeEnd(); ++iter) 96 96 filler = *iter; // get last molecule 97 filler->SetNameFromFilename(params.fillername. c_str());97 filler->SetNameFromFilename(params.fillername.string().c_str()); 98 98 World::getInstance().getConfig()->BG->ConstructBondGraph(filler); 99 99 … … 128 128 return false; 129 129 } 130 131 const string MoleculeFillVoidWithMoleculeAction::getName() {132 return NAME;133 }134 130 /** =========== end of function ====================== */ -
src/Actions/MoleculeAction/FillVoidWithMoleculeAction.def
rb295ca r41e15b 12 12 // i.e. there is an integer with variable name Z that can be found in 13 13 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 14 // "undefine" if no parameters are required 15 #define paramtypes (std::string) (Vector) (Vector) (bool) 16 #define paramtokens (MoleculeFillVoidWithMoleculeAction::NAME) ("distances") ("lengths") ("DoRotate") 17 #define paramreferences (fillername) (distances) (lengths) (DoRotate) 14 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 15 #define paramtypes (boost::filesystem::path)(Vector)(Vector)(bool) 16 #define paramtokens ("fill-void")("distances")("lengths")("DoRotate") 17 #define paramdescriptions ("name of xyz file of filler molecule")("list of three of distances in space, one for each axis direction")("list of three of lengths in space, one for each axis direction")("whether to rotate or not") 18 #undef paramdefaults 19 #define paramreferences (fillername)(distances)(lengths)(DoRotate) 18 20 19 21 #undef statetypes … … 22 24 // some defines for all the names, you may use ACTION, STATE and PARAMS 23 25 #define CATEGORY Molecule 26 #define MENUNAME "molecule" 27 #define MENUPOSITION 5 24 28 #define ACTIONNAME FillVoidWithMolecule 25 29 #define TOKEN "fill-void" 26 30 31 32 // finally the information stored in the ActionTrait specialization 33 #define DESCRIPTION "fill void space of box with a filler molecule" 34 #undef SHORTFORM -
src/Actions/MoleculeAction/FillWithMoleculeAction.cpp
rb295ca r41e15b 48 48 // construct water molecule 49 49 molecule *filler = World::getInstance().createMolecule(); 50 if (!filler->AddXYZFile(params.fillername )) {50 if (!filler->AddXYZFile(params.fillername.string())) { 51 51 DoeLog(0) && (eLog()<< Verbose(0) << "Could not parse filler molecule from " << params.fillername << "." << endl); 52 52 } 53 filler->SetNameFromFilename(params.fillername. c_str());53 filler->SetNameFromFilename(params.fillername.string().c_str()); 54 54 molecule *Filling = NULL; 55 55 // atom *first = NULL, *second = NULL, *third = NULL; … … 110 110 return false; 111 111 } 112 113 const string MoleculeFillWithMoleculeAction::getName() {114 return NAME;115 }116 112 /** =========== end of function ====================== */ -
src/Actions/MoleculeAction/FillWithMoleculeAction.def
rb295ca r41e15b 12 12 // i.e. there is an integer with variable name Z that can be found in 13 13 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 14 // "undefine" if no parameters are required 15 #define paramtypes (std::string) (Vector) (Vector) (double) (bool) 16 #define paramtokens (MoleculeFillWithMoleculeAction::NAME) ("distances") ("lengths") ("MaxDistance") ("DoRotate") 17 #define paramreferences (fillername) (distances) (lengths) (MaxDistance) (DoRotate) 14 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 15 #define paramtypes (boost::filesystem::path)(Vector)(Vector)(double)(bool) 16 #define paramtokens ("fill-molecule")("distances")("lengths")("MaxDistance")("DoRotate") 17 #define paramdescriptions ("name of xyz file of filler molecule")("list of three of distances in space, one for each axis direction")("list of three of lengths in space, one for each axis direction")("maximum spatial distance")("whether to rotate or not") 18 #undef paramdefaults 19 #define paramreferences (fillername)(distances)(lengths)(MaxDistance)(DoRotate) 18 20 19 21 #undef statetypes … … 22 24 // some defines for all the names, you may use ACTION, STATE and PARAMS 23 25 #define CATEGORY Molecule 26 #define MENUNAME "molecule" 27 #define MENUPOSITION 4 24 28 #define ACTIONNAME FillWithMolecule 25 29 #define TOKEN "fill-molecule" 26 30 31 32 // finally the information stored in the ActionTrait specialization 33 #define DESCRIPTION "fill around molecules' surface with a filler molecule" 34 #define SHORTFORM "F" 35 -
src/Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.cpp
rb295ca r41e15b 50 50 if (params.IdMapping) 51 51 DoLog(1) && (Log() << Verbose(1) << "Using Identity for the permutation map." << endl); 52 if (!mol->LinearInterpolationBetweenConfiguration(params.start, params.end, params.filename , *(World::getInstance().getConfig()), params.IdMapping))52 if (!mol->LinearInterpolationBetweenConfiguration(params.start, params.end, params.filename.branch_path().string(), *(World::getInstance().getConfig()), params.IdMapping)) 53 53 DoLog(2) && (Log() << Verbose(2) << "Could not store " << params.filename << " files." << endl); 54 54 else … … 79 79 return false; 80 80 } 81 82 const string MoleculeLinearInterpolationofTrajectoriesAction::getName() {83 return NAME;84 }85 81 /** =========== end of function ====================== */ -
src/Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (std::string) (int) (int) (bool) 15 #define paramtokens (MoleculeLinearInterpolationofTrajectoriesAction::NAME) ("start-step") ("end-step") ("id-mapping") 16 #define paramreferences (filename) (start) (end) (IdMapping) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (boost::filesystem::path)(int)(int)(bool) 15 #define paramtokens ("linear-interpolate")("start-step")("end-step")("id-mapping") 16 #define paramdescriptions ("path where to store the intermediate configurations")("first or start step")("last or end step")("whether the identity shall be used in mapping atoms onto atoms or not") 17 #undef paramdefaults 18 #define paramreferences (filename)(start)(end)(IdMapping) 17 19 18 20 #undef statetypes … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Molecule 25 #define MENUNAME "molecule" 26 #define MENUPOSITION 6 23 27 #define ACTIONNAME LinearInterpolationofTrajectories 24 28 #define TOKEN "linear-interpolate" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "linear interpolation in discrete steps between start and end position of a molecule" 33 #define SHORTFORM "L" -
src/Actions/MoleculeAction/RotateAroundSelfByAngleAction.cpp
rb295ca r41e15b 107 107 return true; 108 108 } 109 110 const string MoleculeRotateAroundSelfByAngleAction::getName() {111 return NAME;112 }113 109 /** =========== end of function ====================== */ -
src/Actions/MoleculeAction/RotateAroundSelfByAngleAction.def
rb295ca r41e15b 12 12 // i.e. there is an integer with variable name Z that can be found in 13 13 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 14 // "undefine" if no parameters are required 15 #define paramtypes (double) (Vector) 16 #define paramtokens (MoleculeRotateAroundSelfByAngleAction::NAME) ("position") 17 #define paramreferences (angle) (Axis) 14 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 15 #define paramtypes (double)(Vector) 16 #define paramtokens ("rotate-self")("position") 17 #define paramdescriptions ("rotation angle")("position in R^3 space") 18 #undef paramdefaults 19 #define paramreferences (angle)(Axis) 18 20 19 21 #define statetypes (molecule * const) … … 22 24 // some defines for all the names, you may use ACTION, STATE and PARAMS 23 25 #define CATEGORY Molecule 26 #define MENUNAME "molecule" 27 #define MENUPOSITION 8 24 28 #define ACTIONNAME RotateAroundSelfByAngle 25 29 #define TOKEN "rotate-self" 26 30 31 32 // finally the information stored in the ActionTrait specialization 33 #define DESCRIPTION "rotates molecules by a specific angle around own center of gravity" 34 #undef SHORTFORM -
src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.cpp
rb295ca r41e15b 152 152 return false; 153 153 } 154 155 const string MoleculeRotateToPrincipalAxisSystemAction::getName() {156 return NAME;157 }158 154 /** =========== end of function ====================== */ -
src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.def
rb295ca r41e15b 7 7 8 8 // all includes and forward declarations necessary for non-integral types below 9 #include "Actions/Values.hpp" 9 10 #include "LinearAlgebra/Vector.hpp" 11 10 12 class MoleculeListClass; 11 13 12 14 // i.e. there is an integer with variable name Z that can be found in 13 15 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 14 // "undefine" if no parameters are required 16 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 15 17 #define paramtypes (Vector) 16 #define paramtokens (MoleculeRotateToPrincipalAxisSystemAction::NAME) 18 #define paramtokens ("rotate-to-pas") 19 #define paramdescriptions ("vector to which to align the biggest eigenvector with") 20 #undef paramdefaults 17 21 #define paramreferences (Axis) 18 22 … … 22 26 // some defines for all the names, you may use ACTION, STATE and PARAMS 23 27 #define CATEGORY Molecule 28 #define MENUNAME "molecule" 29 #define MENUPOSITION 9 24 30 #define ACTIONNAME RotateToPrincipalAxisSystem 25 31 #define TOKEN "rotate-to-pas" 26 32 33 34 // finally the information stored in the ActionTrait specialization 35 #define DESCRIPTION "calculate the principal axis system of the specified molecule and rotate specified axis to align with main axis" 36 #define SHORTFORM "m" -
src/Actions/MoleculeAction/SaveAdjacencyAction.cpp
rb295ca r41e15b 51 51 World::getInstance().getConfig()->BG->ConstructBondGraph(mol); 52 52 // TODO: sollte stream nicht filename benutzen, besser fuer unit test 53 mol->StoreAdjacencyToFile(params.adjacencyfile );53 mol->StoreAdjacencyToFile(params.adjacencyfile.leaf(), params.adjacencyfile.branch_path().string()); 54 54 } 55 55 return Action::success; … … 77 77 return false; 78 78 } 79 80 const string MoleculeSaveAdjacencyAction::getName() {81 return NAME;82 }83 79 /** =========== end of function ====================== */ -
src/Actions/MoleculeAction/SaveAdjacencyAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (std::string) 15 #define paramtokens (MoleculeSaveAdjacencyAction::NAME) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (boost::filesystem::path) 15 #define paramtokens ("save-adjacency") 16 #define paramdescriptions ("name of the adjacency file to write to") 17 #undef paramdefaults 16 18 #define paramreferences (adjacencyfile) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Molecule 25 #define MENUNAME "molecule" 26 #define MENUPOSITION 10 23 27 #define ACTIONNAME SaveAdjacency 24 28 #define TOKEN "save-adjacency" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "store adjacency of each atom to file" 33 #define SHORTFORM "J" -
src/Actions/MoleculeAction/SaveBondsAction.cpp
rb295ca r41e15b 51 51 World::getInstance().getConfig()->BG->ConstructBondGraph(mol); 52 52 // TODO: sollte stream, nicht filenamen direkt nutzen, besser fuer unit tests 53 mol->StoreBondsToFile(params.bondsfile );53 mol->StoreBondsToFile(params.bondsfile.leaf(), params.bondsfile.branch_path().string()); 54 54 } 55 55 return Action::success; … … 77 77 return false; 78 78 } 79 80 const string MoleculeSaveBondsAction::getName() {81 return NAME;82 }83 79 /** =========== end of function ====================== */ -
src/Actions/MoleculeAction/SaveBondsAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (std::string) 15 #define paramtokens (MoleculeSaveBondsAction::NAME) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (boost::filesystem::path) 15 #define paramtokens ("save-bonds") 16 #define paramdescriptions ("name of the bonds file to write to") 17 #undef paramdefaults 16 18 #define paramreferences (bondsfile) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Molecule 25 #define MENUNAME "molecule" 26 #define MENUPOSITION 11 23 27 #define ACTIONNAME SaveBonds 24 28 #define TOKEN "save-bonds" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "save bonds to dbond type file" 33 #define SHORTFORM "j" -
src/Actions/MoleculeAction/SaveTemperatureAction.cpp
rb295ca r41e15b 47 47 DoLog(1) && (Log() << Verbose(1) << "Storing temperatures in " << params.temperaturefile << "." << endl); 48 48 ofstream output; 49 output.open(params.temperaturefile. c_str(), ios::trunc);49 output.open(params.temperaturefile.string().c_str(), ios::trunc); 50 50 if (output.fail() || !mol->OutputTemperatureFromTrajectories((ofstream * const) &output, 0, mol->MDSteps)) 51 51 DoLog(2) && (Log() << Verbose(2) << "File could not be written." << endl); … … 78 78 return false; 79 79 } 80 81 const string MoleculeSaveTemperatureAction::getName() {82 return NAME;83 }84 80 /** =========== end of function ====================== */ -
src/Actions/MoleculeAction/SaveTemperatureAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (std::string) 15 #define paramtokens (MoleculeSaveTemperatureAction::NAME) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (boost::filesystem::path) 15 #define paramtokens ("save-temperature") 16 #define paramdescriptions ("name of the temperature file to write to") 17 #undef paramdefaults 16 18 #define paramreferences (temperaturefile) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Molecule 25 #define MENUNAME "molecule" 26 #define MENUPOSITION 12 23 27 #define ACTIONNAME SaveTemperature 24 28 #define TOKEN "save-temperature" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "save the temperature per time step to file" 33 #define SHORTFORM "S" -
src/Actions/MoleculeAction/SuspendInWaterAction.cpp
rb295ca r41e15b 77 77 return false; 78 78 } 79 80 const string MoleculeSuspendInWaterAction::getName() {81 return NAME;82 }83 79 /** =========== end of function ====================== */ -
src/Actions/MoleculeAction/SuspendInWaterAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 14 #define paramtypes (double) 15 #define paramtokens (MoleculeSuspendInWaterAction::NAME) 15 #define paramtokens ("suspend-in-water") 16 #define paramdescriptions ("desired final density") 17 #undef paramdefaults 16 18 #define paramreferences (density) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Molecule 25 #define MENUNAME "molecule" 26 #define MENUPOSITION 13 23 27 #define ACTIONNAME SuspendInWater 24 28 #define TOKEN "suspend-in-water" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "suspend the given molecule in water such that in the domain the mean density is as specified" 33 #define SHORTFORM "u" -
src/Actions/MoleculeAction/VerletIntegrationAction.cpp
rb295ca r41e15b 48 48 // TODO: sollte besser stream nutzen, nicht filename direkt (es sei denn, ist prefix), besser fuer unit test 49 49 char outputname[MAXSTRINGSIZE]; 50 strcpy(outputname, params.forcesfile. c_str());50 strcpy(outputname, params.forcesfile.string().c_str()); 51 51 if (!mol->VerletForceIntegration(outputname, *(World::getInstance().getConfig()), 0)) 52 52 DoLog(2) && (Log() << Verbose(2) << "File " << params.forcesfile << " not found." << endl); … … 78 78 return false; 79 79 } 80 81 const string MoleculeVerletIntegrationAction::getName() {82 return NAME;83 }84 80 /** =========== end of function ====================== */ -
src/Actions/MoleculeAction/VerletIntegrationAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (std::string) 15 #define paramtokens (MoleculeVerletIntegrationAction::NAME) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (boost::filesystem::path) 15 #define paramtokens ("verlet-integrate") 16 #define paramdescriptions ("perform verlet integration of a given force file") 17 #undef paramdefaults 16 18 #define paramreferences (forcesfile) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Molecule 25 #define MENUNAME "molecule" 26 #define MENUPOSITION 14 23 27 #define ACTIONNAME VerletIntegration 24 28 #define TOKEN "verlet-integrate" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "perform verlet integration of a given force file" 33 #define SHORTFORM "P" -
src/Actions/ParserAction/LoadXyzAction.cpp
rb295ca r41e15b 38 38 getParametersfromValueStorage(); 39 39 40 DoLog(1) && (Log() << Verbose(1) << "Parsing xyz file for new atoms." << endl);40 DoLog(1) && (Log() << Verbose(1) << "Parsing xyz file " << params.filename << " for new atoms." << endl); 41 41 // parse xyz file 42 42 ifstream input; 43 input.open(params.filename. c_str());43 input.open(params.filename.string().c_str()); 44 44 if (!input.fail()) { 45 45 XyzParser parser; // briefly instantiate a parser which is removed at end of focus … … 73 73 return false; 74 74 } 75 76 const string ParserLoadXyzAction::getName() {77 return NAME;78 }79 75 /** =========== end of function ====================== */ -
src/Actions/ParserAction/LoadXyzAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (std::string) 15 #define paramtokens (ParserLoadXyzAction::NAME) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (boost::filesystem::path) 15 #define paramtokens ("parse-xyz") 16 #define paramdescriptions ("name of xyz file") 17 #undef paramdefaults 16 18 #define paramreferences (filename) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Parser 25 #define MENUNAME "parser" 26 #define MENUPOSITION 1 23 27 #define ACTIONNAME LoadXyz 24 28 #define TOKEN "parse-xyz" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "parse xyz file into World" 33 #define SHORTFORM "p" -
src/Actions/ParserAction/SaveXyzAction.cpp
rb295ca r41e15b 20 20 #include "Helpers/MemDebug.hpp" 21 21 22 #include "Helpers/Log.hpp" 23 #include "Helpers/Verbose.hpp" 22 24 #include "Parser/XyzParser.hpp" 23 #include "atom.hpp"24 #include "molecule.hpp"25 25 26 26 #include <iostream> … … 41 41 getParametersfromValueStorage(); 42 42 43 DoLog(1) && (Log() << Verbose(1) << "Storing xyz file " << params.filename << "." << endl); 43 44 // store xyz file 44 45 ofstream output; 45 output.open(params.filename. c_str());46 if (!output.fail()) 46 output.open(params.filename.string().c_str()); 47 if (!output.fail()) { 47 48 parser.save(&output); 49 } else { 50 DoeLog(1) && (eLog() << Verbose(1) << "Could not open file " << params.filename << "." << endl); 51 } 48 52 output.close(); 49 53 return Action::failure; … … 73 77 return false; 74 78 } 75 76 const string ParserSaveXyzAction::getName() {77 return NAME;78 }79 79 /** =========== end of function ====================== */ -
src/Actions/ParserAction/SaveXyzAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (std::string) 15 #define paramtokens (ParserSaveXyzAction::NAME) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (boost::filesystem::path) 15 #define paramtokens ("store-xyz") 16 #define paramdescriptions ("file name of xyz file") 17 #undef paramdefaults 16 18 #define paramreferences (filename) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Parser 25 #define MENUNAME "parser" 26 #define MENUPOSITION 2 23 27 #define ACTIONNAME SaveXyz 24 #define TOKEN " SaveXyz"28 #define TOKEN "store-xyz" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "save world as xyz file" 33 #undef SHORTFORM -
src/Actions/Process.cpp
rb295ca r41e15b 24 24 using namespace std; 25 25 26 Process::Process(int _maxSteps, std::string _name, bool _doRegister) :27 Action(_ name,_doRegister),26 Process::Process(int _maxSteps, const ActionTraits &_trait, bool _doRegister) : 27 Action(_trait,_doRegister), 28 28 Observable("Process"), 29 29 maxSteps(_maxSteps), -
src/Actions/Process.hpp
rb295ca r41e15b 40 40 { 41 41 public: 42 Process(int _maxSteps, std::string _name, bool _doRegister=true);42 Process(int _maxSteps, const ActionTraits &_trait, bool _doRegister=true); 43 43 virtual ~Process(); 44 44 -
src/Actions/SelectionAction/AllAtomsAction.cpp
rb295ca r41e15b 72 72 return true; 73 73 } 74 75 const string SelectionAllAtomsAction::getName() {76 return NAME;77 }78 74 /** =========== end of function ====================== */ -
src/Actions/SelectionAction/AllAtomsAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 14 #undef paramtypes 15 15 #undef paramtokens 16 #undef paramdescriptions 17 #undef paramdefaults 16 18 #undef paramreferences 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Selection 25 #define MENUNAME "selection" 26 #define MENUPOSITION 3 23 27 #define ACTIONNAME AllAtoms 24 28 #define TOKEN "select-all-atoms" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "select all atoms" 33 #undef SHORTFORM -
src/Actions/SelectionAction/AllAtomsInsideCuboidAction.cpp
rb295ca r41e15b 86 86 return true; 87 87 } 88 89 const string SelectionAllAtomsInsideCuboidAction::getName() {90 return NAME;91 }92 88 /** =========== end of function ====================== */ -
src/Actions/SelectionAction/AllAtomsInsideCuboidAction.def
rb295ca r41e15b 7 7 8 8 // all includes and forward declarations necessary for non-integral types below 9 #include "Actions/Values.hpp" 10 9 11 class Vector; 10 12 11 13 // i.e. there is an integer with variable name Z that can be found in 12 14 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (Vector) (Vector) (double) (double) (double) 15 #define paramtokens (SelectionAllAtomsInsideCuboidAction::NAME) ("position") ("angle-x") ("angle-y") ("angle-z") 16 #define paramreferences (extension) (position) (Xangle) (Yangle) (Zangle) 15 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 16 #define paramtypes (Vector)(Vector)(double)(double)(double) 17 #define paramtokens ("select-atoms-inside-cuboid")("position")("angle-x")("angle-y")("angle-z") 18 #define paramdescriptions ("dimensions of cuboid")("position in R^3 space")("angle of a rotation around x axis")("angle of a rotation around y axis")("angle of a rotation around z axis") 19 #undef paramdefaults 20 #define paramreferences (extension)(position)(Xangle)(Yangle)(Zangle) 17 21 18 22 #define statetypes (std::vector<atom*>) … … 21 25 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 26 #define CATEGORY Selection 27 #define MENUNAME "selection" 28 #define MENUPOSITION 7 23 29 #define ACTIONNAME AllAtomsInsideCuboid 24 30 #define TOKEN "select-atoms-inside-cuboid" 25 31 32 33 // finally the information stored in the ActionTrait specialization 34 #define DESCRIPTION "select all atoms inside a cuboid" 35 #undef SHORTFORM -
src/Actions/SelectionAction/AllAtomsInsideSphereAction.cpp
rb295ca r41e15b 80 80 return true; 81 81 } 82 83 const string SelectionAllAtomsInsideSphereAction::getName() {84 return NAME;85 }86 82 /** =========== end of function ====================== */ -
src/Actions/SelectionAction/AllAtomsInsideSphereAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (double) (Vector) 15 #define paramtokens (SelectionAllAtomsInsideSphereAction::NAME) ("position") 16 #define paramreferences (radius) (position) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (double)(Vector) 15 #define paramtokens ("select-atoms-inside-sphere")("position") 16 #define paramdescriptions ("sphere radius")("position in R^3 space") 17 #undef paramdefaults 18 #define paramreferences (radius)(position) 17 19 18 20 #define statetypes (std::vector<atom*>) … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Selection 25 #define MENUNAME "selection" 26 #define MENUPOSITION 8 23 27 #define ACTIONNAME AllAtomsInsideSphere 24 28 #define TOKEN "select-atoms-inside-sphere" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "select all atoms inside a sphere" 33 #undef SHORTFORM -
src/Actions/SelectionAction/AllAtomsOfMoleculeAction.cpp
rb295ca r41e15b 74 74 return true; 75 75 } 76 77 const string SelectionAllAtomsOfMoleculeAction::getName() {78 return NAME;79 }80 76 /** =========== end of function ====================== */ -
src/Actions/SelectionAction/AllAtomsOfMoleculeAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (molecule *) 15 #define paramtokens (SelectionAllAtomsOfMoleculeAction::NAME) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (const molecule *) 15 #define paramtokens ("select-molecules-atoms") 16 #define paramdescriptions ("molecule to select") 17 #undef paramdefaults 16 18 #define paramreferences (mol) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Selection 25 #define MENUNAME "selection" 26 #define MENUPOSITION 12 23 27 #define ACTIONNAME AllAtomsOfMolecule 24 28 #define TOKEN "select-molecules-atoms" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "select all atoms of a molecule" 33 #undef SHORTFORM -
src/Actions/SelectionAction/AllMoleculesAction.cpp
rb295ca r41e15b 72 72 return true; 73 73 } 74 75 const string SelectionAllMoleculesAction::getName() {76 return NAME;77 }78 74 /** =========== end of function ====================== */ -
src/Actions/SelectionAction/AllMoleculesAction.def
rb295ca r41e15b 10 10 // i.e. there is an integer with variable name Z that can be found in 11 11 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 12 // "undefine" if no parameters are required 12 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 13 13 #undef paramtypes 14 14 #undef paramtokens 15 #undef paramdescriptions 16 #undef paramdefaults 15 17 #undef paramreferences 16 18 … … 20 22 // some defines for all the names, you may use ACTION, STATE and PARAMS 21 23 #define CATEGORY Selection 24 #define MENUNAME "selection" 25 #define MENUPOSITION 4 22 26 #define ACTIONNAME AllMolecules 23 27 #define TOKEN "select-all-molecules" 24 28 29 30 // finally the information stored in the ActionTrait specialization 31 #define DESCRIPTION "select all molecules" 32 #undef SHORTFORM -
src/Actions/SelectionAction/AtomByElementAction.cpp
rb295ca r41e15b 74 74 return true; 75 75 } 76 77 const string SelectionAtomByElementAction::getName() {78 return NAME;79 }80 76 /** =========== end of function ====================== */ -
src/Actions/SelectionAction/AtomByElementAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 14 #define paramtypes (const element*) 15 #define paramtokens (SelectionAtomByElementAction::NAME) 15 #define paramtokens ("select-atom-by-element") 16 #define paramdescriptions ("element") 17 #undef paramdefaults 16 18 #define paramreferences (elemental) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Selection 25 #define MENUNAME "selection" 26 #define MENUPOSITION 5 23 27 #define ACTIONNAME AtomByElement 24 28 #define TOKEN "select-atom-by-element" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "select an atom by element" 33 #undef SHORTFORM -
src/Actions/SelectionAction/AtomByIdAction.cpp
rb295ca r41e15b 74 74 return true; 75 75 } 76 77 const string SelectionAtomByIdAction::getName() {78 return NAME;79 }80 76 /** =========== end of function ====================== */ -
src/Actions/SelectionAction/AtomByIdAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (atom*) 15 #define paramtokens (SelectionAtomByIdAction::NAME) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (const atom*) 15 #define paramtokens ("select-atom-by-id") 16 #define paramdescriptions ("atom index") 17 #undef paramdefaults 16 18 #define paramreferences (Walker) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Selection 25 #define MENUNAME "selection" 26 #define MENUPOSITION 6 23 27 #define ACTIONNAME AtomById 24 28 #define TOKEN "select-atom-by-id" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "select an atom by index" 33 #undef SHORTFORM -
src/Actions/SelectionAction/ClearAllAtomsAction.cpp
rb295ca r41e15b 72 72 return true; 73 73 } 74 75 const string SelectionClearAllAtomsAction::getName() {76 return NAME;77 }78 74 /** =========== end of function ====================== */ -
src/Actions/SelectionAction/ClearAllAtomsAction.def
rb295ca r41e15b 10 10 // i.e. there is an integer with variable name Z that can be found in 11 11 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 12 // "undefine" if no parameters are required 12 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 13 13 #undef paramtypes 14 14 #undef paramtokens 15 #undef paramdescriptions 16 #undef paramdefaults 15 17 #undef paramreferences 16 18 … … 20 22 // some defines for all the names, you may use ACTION, STATE and PARAMS 21 23 #define CATEGORY Selection 24 #define MENUNAME "selection" 25 #define MENUPOSITION 1 22 26 #define ACTIONNAME ClearAllAtoms 23 27 #define TOKEN "clear-atom-selection" 24 28 29 30 // finally the information stored in the ActionTrait specialization 31 #define DESCRIPTION "clear the atom selection" 32 #undef SHORTFORM -
src/Actions/SelectionAction/ClearAllMoleculesAction.cpp
rb295ca r41e15b 72 72 return true; 73 73 } 74 75 const string SelectionClearAllMoleculesAction::getName() {76 return NAME;77 }78 74 /** =========== end of function ====================== */ -
src/Actions/SelectionAction/ClearAllMoleculesAction.def
rb295ca r41e15b 10 10 // i.e. there is an integer with variable name Z that can be found in 11 11 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 12 // "undefine" if no parameters are required 12 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 13 13 #undef paramtypes 14 14 #undef paramtokens 15 #undef paramdescriptions 16 #undef paramdefaults 15 17 #undef paramreferences 16 18 … … 20 22 // some defines for all the names, you may use ACTION, STATE and PARAMS 21 23 #define CATEGORY Selection 24 #define MENUNAME "selection" 25 #define MENUPOSITION 2 22 26 #define ACTIONNAME ClearAllMolecules 23 27 #define TOKEN "clear-molecule-selection" 24 28 29 30 // finally the information stored in the ActionTrait specialization 31 #define DESCRIPTION "clear the molecule selection" 32 #undef SHORTFORM -
src/Actions/SelectionAction/MoleculeByFormulaAction.cpp
rb295ca r41e15b 77 77 return true; 78 78 } 79 80 const string SelectionMoleculeByFormulaAction::getName() {81 return NAME;82 }83 79 /** =========== end of function ====================== */ -
src/Actions/SelectionAction/MoleculeByFormulaAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 14 #define paramtypes (std::string) 15 #define paramtokens (SelectionMoleculeByFormulaAction::NAME) 15 #define paramtokens ("select-molecule-by-formula") 16 #define paramdescriptions ("chemical formula") 17 #undef paramdefaults 16 18 #define paramreferences (formula) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Selection 25 #define MENUNAME "selection" 26 #define MENUPOSITION 10 23 27 #define ACTIONNAME MoleculeByFormula 24 28 #define TOKEN "select-molecule-by-formula" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "select a molecule by chemical formula" 33 #undef SHORTFORM -
src/Actions/SelectionAction/MoleculeByIdAction.cpp
rb295ca r41e15b 74 74 return true; 75 75 } 76 77 const string SelectionMoleculeByIdAction::getName() {78 return NAME;79 }80 76 /** =========== end of function ====================== */ -
src/Actions/SelectionAction/MoleculeByIdAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (molecule*) 15 #define paramtokens (SelectionMoleculeByIdAction::NAME) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (const molecule*) 15 #define paramtokens ("select-molecule-by-id") 16 #define paramdescriptions ("molecule index") 17 #undef paramdefaults 16 18 #define paramreferences (mol) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Selection 25 #define MENUNAME "selection" 26 #define MENUPOSITION 9 23 27 #define ACTIONNAME MoleculeById 24 28 #define TOKEN "select-molecule-by-id" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "select a molecule by index" 33 #undef SHORTFORM -
src/Actions/SelectionAction/MoleculeOfAtomAction.cpp
rb295ca r41e15b 72 72 return true; 73 73 } 74 75 const string SelectionMoleculeOfAtomAction::getName() {76 return NAME;77 }78 74 /** =========== end of function ====================== */ -
src/Actions/SelectionAction/MoleculeOfAtomAction.def
rb295ca r41e15b 10 10 // i.e. there is an integer with variable name Z that can be found in 11 11 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 12 // "undefine" if no parameters are required 13 #define paramtypes (atom*) 14 #define paramtokens (SelectionMoleculeOfAtomAction::NAME) 12 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 13 #define paramtypes (const atom*) 14 #define paramtokens ("select-molecule-of-atom") 15 #define paramdescriptions ("one atom of desired molecule") 16 #undef paramdefaults 15 17 #define paramreferences (Walker) 16 18 … … 20 22 // some defines for all the names, you may use ACTION, STATE and PARAMS 21 23 #define CATEGORY Selection 24 #define MENUNAME "selection" 25 #define MENUPOSITION 11 22 26 #define ACTIONNAME MoleculeOfAtom 23 27 #define TOKEN "select-molecule-of-atom" 24 28 29 30 // finally the information stored in the ActionTrait specialization 31 #define DESCRIPTION "select a molecule to which a given atom belongs" 32 #undef SHORTFORM -
src/Actions/SelectionAction/NotAllAtomsAction.cpp
rb295ca r41e15b 72 72 return true; 73 73 } 74 75 const string SelectionNotAllAtomsAction::getName() {76 return NAME;77 }78 74 /** =========== end of function ====================== */ -
src/Actions/SelectionAction/NotAllAtomsAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 14 #undef paramtypes 15 15 #undef paramtokens 16 #undef paramdescriptions 17 #undef paramdefaults 16 18 #undef paramreferences 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Selection 25 #define MENUNAME "selection" 26 #define MENUPOSITION 13 23 27 #define ACTIONNAME NotAllAtoms 24 28 #define TOKEN "unselect-all-atoms" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "unselect all atoms" 33 #undef SHORTFORM -
src/Actions/SelectionAction/NotAllAtomsInsideCuboidAction.cpp
rb295ca r41e15b 86 86 return true; 87 87 } 88 89 const string SelectionNotAllAtomsInsideCuboidAction::getName() {90 return NAME;91 }92 88 /** =========== end of function ====================== */ -
src/Actions/SelectionAction/NotAllAtomsInsideCuboidAction.def
rb295ca r41e15b 7 7 8 8 // all includes and forward declarations necessary for non-integral types below 9 #include "Actions/Values.hpp" 10 9 11 class Vector; 10 12 11 13 // i.e. there is an integer with variable name Z that can be found in 12 14 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (Vector) (Vector) (double) (double) (double) 15 #define paramtokens (SelectionNotAllAtomsInsideCuboidAction::NAME) ("position") ("angle-x") ("angle-y") ("angle-z") 16 #define paramreferences (extension) (position) (Xangle) (Yangle) (Zangle) 15 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 16 #define paramtypes (Vector)(Vector)(double)(double)(double) 17 #define paramtokens ("unselect-atoms-inside-cuboid")("position")("angle-x")("angle-y")("angle-z") 18 #define paramdescriptions ("dimension of cuboid")("position in R^3 space")("angle of a rotation around x axis")("angle of a rotation around y axis")("angle of a rotation around z axis") 19 #undef paramdefaults 20 #define paramreferences (extension)(position)(Xangle)(Yangle)(Zangle) 17 21 18 22 #define statetypes (std::vector<atom*>) … … 21 25 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 26 #define CATEGORY Selection 27 #define MENUNAME "selection" 28 #define MENUPOSITION 17 23 29 #define ACTIONNAME NotAllAtomsInsideCuboid 24 30 #define TOKEN "unselect-atoms-inside-cuboid" 25 31 32 33 // finally the information stored in the ActionTrait specialization 34 #define DESCRIPTION "unselect all atoms inside a cuboid" 35 #undef SHORTFORM -
src/Actions/SelectionAction/NotAllAtomsInsideSphereAction.cpp
rb295ca r41e15b 80 80 return true; 81 81 } 82 83 const string SelectionNotAllAtomsInsideSphereAction::getName() {84 return NAME;85 }86 82 /** =========== end of function ====================== */ -
src/Actions/SelectionAction/NotAllAtomsInsideSphereAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (double) (Vector) 15 #define paramtokens (SelectionNotAllAtomsInsideSphereAction::NAME) ("position") 16 #define paramreferences (radius) (position) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (double)(Vector) 15 #define paramtokens ("unselect-atoms-inside-sphere")("position") 16 #define paramdescriptions ("radius of sphere")("position in R^3 space") 17 #undef paramdefaults 18 #define paramreferences (radius)(position) 17 19 18 20 #define statetypes (std::vector<atom*>) … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Selection 25 #define MENUNAME "selection" 26 #define MENUPOSITION 18 23 27 #define ACTIONNAME NotAllAtomsInsideSphere 24 28 #define TOKEN "unselect-atoms-inside-sphere" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "unselect all atoms inside a sphere" 33 #undef SHORTFORM -
src/Actions/SelectionAction/NotAllAtomsOfMoleculeAction.cpp
rb295ca r41e15b 74 74 return true; 75 75 } 76 77 const string SelectionNotAllAtomsOfMoleculeAction::getName() {78 return NAME;79 }80 76 /** =========== end of function ====================== */ -
src/Actions/SelectionAction/NotAllAtomsOfMoleculeAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (molecule*) 15 #define paramtokens (SelectionNotAllAtomsOfMoleculeAction::NAME) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (const molecule*) 15 #define paramtokens ("unselect-molecules-atoms") 16 #define paramdescriptions ("molecule") 17 #undef paramdefaults 16 18 #define paramreferences (mol) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Selection 25 #define MENUNAME "selection" 26 #define MENUPOSITION 22 23 27 #define ACTIONNAME NotAllAtomsOfMolecule 24 28 #define TOKEN "unselect-molecules-atoms" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "unselect all atoms of a molecule" 33 #undef SHORTFORM -
src/Actions/SelectionAction/NotAllMoleculesAction.cpp
rb295ca r41e15b 72 72 return true; 73 73 } 74 75 const string SelectionNotAllMoleculesAction::getName() {76 return NAME;77 }78 74 /** =========== end of function ====================== */ -
src/Actions/SelectionAction/NotAllMoleculesAction.def
rb295ca r41e15b 10 10 // i.e. there is an integer with variable name Z that can be found in 11 11 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 12 // "undefine" if no parameters are required 12 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 13 13 #undef paramtypes 14 14 #undef paramtokens 15 #undef paramdescriptions 16 #undef paramdefaults 15 17 #undef paramreferences 16 18 … … 20 22 // some defines for all the names, you may use ACTION, STATE and PARAMS 21 23 #define CATEGORY Selection 24 #define MENUNAME "selection" 25 #define MENUPOSITION 14 22 26 #define ACTIONNAME NotAllMolecules 23 27 #define TOKEN "unselect-all-molecules" 24 28 29 30 // finally the information stored in the ActionTrait specialization 31 #define DESCRIPTION "unselect all molecules" 32 #undef SHORTFORM -
src/Actions/SelectionAction/NotAtomByElementAction.cpp
rb295ca r41e15b 74 74 return true; 75 75 } 76 77 const string SelectionNotAtomByElementAction::getName() {78 return NAME;79 }80 76 /** =========== end of function ====================== */ -
src/Actions/SelectionAction/NotAtomByElementAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 14 #define paramtypes (const element*) 15 #define paramtokens (SelectionNotAtomByElementAction::NAME) 15 #define paramtokens ("unselect-atom-by-element") 16 #define paramdescriptions ("element") 17 #undef paramdefaults 16 18 #define paramreferences (elemental) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Selection 25 #define MENUNAME "selection" 26 #define MENUPOSITION 15 23 27 #define ACTIONNAME NotAtomByElement 24 28 #define TOKEN "unselect-atom-by-element" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "unselect an atom by element" 33 #undef SHORTFORM -
src/Actions/SelectionAction/NotAtomByIdAction.cpp
rb295ca r41e15b 74 74 return true; 75 75 } 76 77 const string SelectionNotAtomByIdAction::getName() {78 return NAME;79 }80 76 /** =========== end of function ====================== */ -
src/Actions/SelectionAction/NotAtomByIdAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (atom*) 15 #define paramtokens (SelectionNotAtomByIdAction::NAME) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (const atom*) 15 #define paramtokens ("unselect-atom-by-id") 16 #define paramdescriptions ("atom index") 17 #undef paramdefaults 16 18 #define paramreferences (Walker) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Selection 25 #define MENUNAME "selection" 26 #define MENUPOSITION 16 23 27 #define ACTIONNAME NotAtomById 24 28 #define TOKEN "unselect-atom-by-id" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "unselect an atom by index" 33 #undef SHORTFORM -
src/Actions/SelectionAction/NotMoleculeByFormulaAction.cpp
rb295ca r41e15b 77 77 return true; 78 78 } 79 80 const string SelectionNotMoleculeByFormulaAction::getName() {81 return NAME;82 }83 79 /** =========== end of function ====================== */ -
src/Actions/SelectionAction/NotMoleculeByFormulaAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 14 #define paramtypes (std::string) 15 #define paramtokens (SelectionNotMoleculeByFormulaAction::NAME) 15 #define paramtokens ("unselect-molecule-by-formula") 16 #define paramdescriptions ("chemical formula") 17 #undef paramdefaults 16 18 #define paramreferences (formula) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Selection 25 #define MENUNAME "selection" 26 #define MENUPOSITION 19 23 27 #define ACTIONNAME NotMoleculeByFormula 24 28 #define TOKEN "unselect-molecule-by-formula" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "unselect a molecule by chemical formula" 33 #undef SHORTFORM -
src/Actions/SelectionAction/NotMoleculeByIdAction.cpp
rb295ca r41e15b 74 74 return true; 75 75 } 76 77 const string SelectionNotMoleculeByIdAction::getName() {78 return NAME;79 }80 76 /** =========== end of function ====================== */ -
src/Actions/SelectionAction/NotMoleculeByIdAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (molecule*) 15 #define paramtokens (SelectionNotMoleculeByIdAction::NAME) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (const molecule*) 15 #define paramtokens ("unselect-molecule-by-id") 16 #define paramdescriptions ("molecule index") 17 #undef paramdefaults 16 18 #define paramreferences (mol) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Selection 25 #define MENUNAME "selection" 26 #define MENUPOSITION 20 23 27 #define ACTIONNAME NotMoleculeById 24 28 #define TOKEN "unselect-molecule-by-id" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "unselect a molecule by index" 33 #undef SHORTFORM -
src/Actions/SelectionAction/NotMoleculeOfAtomAction.cpp
rb295ca r41e15b 72 72 return true; 73 73 } 74 75 const string SelectionNotMoleculeOfAtomAction::getName() {76 return NAME;77 }78 74 /** =========== end of function ====================== */ -
src/Actions/SelectionAction/NotMoleculeOfAtomAction.def
rb295ca r41e15b 10 10 // i.e. there is an integer with variable name Z that can be found in 11 11 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 12 // "undefine" if no parameters are required 13 #define paramtypes (atom*) 14 #define paramtokens (SelectionNotMoleculeOfAtomAction::NAME) 12 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 13 #define paramtypes (const atom*) 14 #define paramtokens ("unselect-molecule-of-atom") 15 #define paramdescriptions ("one atom of desired molecule") 16 #undef paramdefaults 15 17 #define paramreferences (Walker) 16 18 … … 20 22 // some defines for all the names, you may use ACTION, STATE and PARAMS 21 23 #define CATEGORY Selection 24 #define MENUNAME "selection" 25 #define MENUPOSITION 21 22 26 #define ACTIONNAME NotMoleculeOfAtom 23 27 #define TOKEN "unselect-molecule-of-atom" 24 28 29 30 // finally the information stored in the ActionTrait specialization 31 #define DESCRIPTION "unselect a molecule to which a given atom belongs" 32 #undef SHORTFORM -
src/Actions/TesselationAction/ConvexEnvelopeAction.cpp
rb295ca r41e15b 59 59 //FindConvexBorder(mol, BoundaryPoints, TesselStruct, LCList, argv[argptr]); 60 60 // TODO: Beide Funktionen sollten streams anstelle des Filenamen benutzen, besser fuer unit tests 61 FindNonConvexBorder(mol, TesselStruct, LCList, 50., params.filenameNonConvex. c_str());61 FindNonConvexBorder(mol, TesselStruct, LCList, 50., params.filenameNonConvex.string().c_str()); 62 62 //RemoveAllBoundaryPoints(TesselStruct, mol, argv[argptr]); 63 const double volumedifference = ConvexizeNonconvexEnvelope(TesselStruct, mol, params.filenameConvex. c_str());63 const double volumedifference = ConvexizeNonconvexEnvelope(TesselStruct, mol, params.filenameConvex.string().c_str()); 64 64 const double clustervolume = VolumeOfConvexEnvelope(TesselStruct, configuration); 65 65 DoLog(0) && (Log() << Verbose(0) << "The tesselated volume area is " << clustervolume << " " << (configuration->GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl); … … 95 95 return false; 96 96 } 97 98 const string TesselationConvexEnvelopeAction::getName() {99 return NAME;100 }101 97 /** =========== end of function ====================== */ -
src/Actions/TesselationAction/ConvexEnvelopeAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (std::string) (std::string) 15 #define paramtokens ("convex-file") ("nonconvex-file") 16 #define paramreferences (filenameConvex) (filenameNonConvex) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (boost::filesystem::path)(boost::filesystem::path) 15 #define paramtokens ("convex-file")("nonconvex-file") 16 #define paramdescriptions ("filename of the convex envelope")("filename of the non-convex envelope") 17 #undef paramdefaults 18 #define paramreferences (filenameConvex)(filenameNonConvex) 17 19 18 20 #undef statetypes … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Tesselation 25 #define MENUNAME "tesselation" 26 #define MENUPOSITION 1 23 27 #define ACTIONNAME ConvexEnvelope 24 28 #define TOKEN "convex-envelope" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "create the convex envelope for a molecule" 33 #define SHORTFORM "x" -
src/Actions/TesselationAction/NonConvexEnvelopeAction.cpp
rb295ca r41e15b 56 56 start = clock(); 57 57 LCList = new LinkedCell(*Boundary, params.SphereRadius*2.); 58 Success = FindNonConvexBorder(Boundary, T, LCList, params.SphereRadius, params.filename. c_str());58 Success = FindNonConvexBorder(Boundary, T, LCList, params.SphereRadius, params.filename.string().c_str()); 59 59 //FindDistributionOfEllipsoids(T, &LCList, N, number, params.filename.c_str()); 60 60 end = clock(); … … 90 90 return false; 91 91 } 92 93 const string TesselationNonConvexEnvelopeAction::getName() {94 return NAME;95 }96 92 /** =========== end of function ====================== */ -
src/Actions/TesselationAction/NonConvexEnvelopeAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (double) (std::string) 15 #define paramtokens (TesselationNonConvexEnvelopeAction::NAME) ("nonconvex-file") 16 #define paramreferences (SphereRadius) (filename) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (double)(boost::filesystem::path) 15 #define paramtokens ("nonconvex-envelope")("nonconvex-file") 16 #define paramdescriptions ("radius of the rolling sphere")("filename of the non-convex envelope") 17 #undef paramdefaults 18 #define paramreferences (SphereRadius)(filename) 17 19 18 20 #undef statetypes … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY Tesselation 25 #define MENUNAME "tesselation" 26 #define MENUPOSITION 2 23 27 #define ACTIONNAME NonConvexEnvelope 24 28 #define TOKEN "nonconvex-envelope" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "create the non-convex envelope for a molecule" 33 #define SHORTFORM "N" -
src/Actions/ValueStorage.cpp
rb295ca r41e15b 20 20 #include "Helpers/MemDebug.hpp" 21 21 22 #include "ValueStorage.hpp"23 22 #include "Patterns/Singleton_impl.hpp" 24 23 24 #include "Actions/OptionTrait.hpp" 25 #include "Actions/OptionRegistry.hpp" 26 #include "Actions/Values.hpp" 27 #include "Actions/ValueStorage.hpp" 28 #include "Descriptors/AtomIdDescriptor.hpp" 29 #include "Descriptors/MoleculeIdDescriptor.hpp" 30 #include "Helpers/Log.hpp" 31 #include "Helpers/Verbose.hpp" 32 #include "LinearAlgebra/BoxVector.hpp" 33 #include "LinearAlgebra/Matrix.hpp" 34 #include "LinearAlgebra/Vector.hpp" 35 #include "atom.hpp" 36 #include "Box.hpp" 37 #include "element.hpp" 38 #include "molecule.hpp" 39 #include "periodentafel.hpp" 40 #include "World.hpp" 41 25 42 ValueStorage::ValueStorage() : 26 MapOfActions_instance(MapOfActions::getInstance())43 OptionRegistry_instance(OptionRegistry::getInstance()) 27 44 {}; 28 45 29 46 ValueStorage::~ValueStorage() {}; 30 47 31 std::string ValueStorage::getDescription(std::string actionname) { 32 return MapOfActions::getInstance().getDescription(actionname); 48 49 bool ValueStorage::isCurrentValuePresent(const char *name) const 50 { 51 return (CurrentValueMap.find(name) != CurrentValueMap.end()); 52 } 53 54 void ValueStorage::queryCurrentValue(const char * name, const atom * &_T) 55 { 56 int atomID = -1; 57 if (typeid( atom *) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { 58 if (CurrentValueMap.find(name) == CurrentValueMap.end()) 59 throw MissingValueException(__FILE__, __LINE__); 60 atomID = lexical_cast<int>(CurrentValueMap[name].c_str()); 61 CurrentValueMap.erase(name); 62 } else if (typeid( const atom *) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { 63 if (CurrentValueMap.find(name) == CurrentValueMap.end()) 64 throw MissingValueException(__FILE__, __LINE__); 65 atomID = lexical_cast<int>(CurrentValueMap[name].c_str()); 66 CurrentValueMap.erase(name); 67 } else 68 throw IllegalTypeException(__FILE__,__LINE__); 69 _T = World::getInstance().getAtom(AtomById(atomID)); 70 } 71 72 void ValueStorage::queryCurrentValue(const char * name, const element * &_T) { 73 int Z = -1; 74 if (typeid(const element *) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { 75 if (CurrentValueMap.find(name) == CurrentValueMap.end()) 76 throw MissingValueException(__FILE__, __LINE__); 77 Z = lexical_cast<int>(CurrentValueMap[name].c_str()); 78 CurrentValueMap.erase(name); 79 } else 80 throw IllegalTypeException(__FILE__,__LINE__); 81 _T = World::getInstance().getPeriode()->FindElement(Z); 82 } 83 84 void ValueStorage::queryCurrentValue(const char * name, const molecule * &_T) { 85 int molID = -1; 86 if (typeid( const molecule *) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { 87 if (CurrentValueMap.find(name) == CurrentValueMap.end()) 88 throw MissingValueException(__FILE__, __LINE__); 89 molID = lexical_cast<int>(CurrentValueMap[name].c_str()); 90 CurrentValueMap.erase(name); 91 } else 92 throw IllegalTypeException(__FILE__,__LINE__); 93 _T = World::getInstance().getMolecule(MoleculeById(molID)); 94 } 95 96 void ValueStorage::queryCurrentValue(const char * name, class Box &_T) { 97 Matrix M; 98 double tmp; 99 if (typeid( Box ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { 100 if (CurrentValueMap.find(name) == CurrentValueMap.end()) 101 throw MissingValueException(__FILE__, __LINE__); 102 std::istringstream stream(CurrentValueMap[name]); 103 stream >> tmp; 104 M.set(0,0,tmp); 105 stream >> tmp; 106 M.set(0,1,tmp); 107 M.set(1,0,tmp); 108 stream >> tmp; 109 M.set(0,2,tmp); 110 M.set(2,0,tmp); 111 stream >> tmp; 112 M.set(1,1,tmp); 113 stream >> tmp; 114 M.set(1,2,tmp); 115 M.set(2,1,tmp); 116 stream >> tmp; 117 M.set(2,2,tmp); 118 _T = M; 119 CurrentValueMap.erase(name); 120 } else 121 throw IllegalTypeException(__FILE__,__LINE__); 122 } 123 124 void ValueStorage::queryCurrentValue(const char * name, class Vector &_T) { 125 if (typeid( Vector ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { 126 std::istringstream stream(CurrentValueMap[name]); 127 CurrentValueMap.erase(name); 128 stream >> _T[0]; 129 stream >> _T[1]; 130 stream >> _T[2]; 131 } else 132 throw IllegalTypeException(__FILE__,__LINE__); 133 } 134 135 void ValueStorage::queryCurrentValue(const char * name, class BoxVector &_T) { 136 if (typeid( BoxVector ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { 137 std::istringstream stream(CurrentValueMap[name]); 138 CurrentValueMap.erase(name); 139 stream >> _T[0]; 140 stream >> _T[1]; 141 stream >> _T[2]; 142 } else 143 throw IllegalTypeException(__FILE__,__LINE__); 144 } 145 146 void ValueStorage::queryCurrentValue(const char * name, std::vector<const atom *>&_T) 147 { 148 int atomID = -1; 149 atom *Walker = NULL; 150 if (typeid( std::vector<const atom *> ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { 151 if (CurrentValueMap.find(name) == CurrentValueMap.end()) 152 throw MissingValueException(__FILE__, __LINE__); 153 std::istringstream stream(CurrentValueMap[name]); 154 CurrentValueMap.erase(name); 155 while (!stream.fail()) { 156 stream >> atomID >> ws; 157 Walker = World::getInstance().getAtom(AtomById(atomID)); 158 if (Walker != NULL) 159 _T.push_back(Walker); 160 atomID = -1; 161 Walker = NULL; 162 } 163 } else 164 throw IllegalTypeException(__FILE__,__LINE__); 165 } 166 167 void ValueStorage::queryCurrentValue(const char * name, std::vector<const element *>&_T) 168 { 169 int Z = -1; 170 const element *elemental = NULL; 171 if (typeid( std::vector<const element *> ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { 172 if (CurrentValueMap.find(name) == CurrentValueMap.end()) 173 throw MissingValueException(__FILE__, __LINE__); 174 std::istringstream stream(CurrentValueMap[name]); 175 CurrentValueMap.erase(name); 176 while (!stream.fail()) { 177 stream >> Z >> ws; 178 elemental = World::getInstance().getPeriode()->FindElement(Z); 179 if (elemental != NULL) 180 _T.push_back(elemental); 181 Z = -1; 182 } 183 } else 184 throw IllegalTypeException(__FILE__,__LINE__); 185 } 186 187 void ValueStorage::queryCurrentValue(const char * name, std::vector<const molecule *>&_T) 188 { 189 int molID = -1; 190 molecule *mol = NULL; 191 if (typeid( std::vector<const molecule *> ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { 192 if (CurrentValueMap.find(name) == CurrentValueMap.end()) 193 throw MissingValueException(__FILE__, __LINE__); 194 std::istringstream stream(CurrentValueMap[name]); 195 CurrentValueMap.erase(name); 196 while (!stream.fail()) { 197 stream >> molID >> ws; 198 mol = World::getInstance().getMolecule(MoleculeById(molID)); 199 if (mol != NULL) 200 _T.push_back(mol); 201 molID = -1; 202 mol = NULL; 203 } 204 } else 205 throw IllegalTypeException(__FILE__,__LINE__); 206 } 207 208 void ValueStorage::queryCurrentValue(const char * name, boost::filesystem::path&_T) 209 { 210 std::string tmp; 211 if (typeid( boost::filesystem::path ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { 212 if (CurrentValueMap.find(name) == CurrentValueMap.end()) 213 throw MissingValueException(__FILE__, __LINE__); 214 std::istringstream stream(CurrentValueMap[name]); 215 CurrentValueMap.erase(name); 216 if (!stream.fail()) { 217 stream >> tmp >> ws; 218 _T = tmp; 219 } 220 } else 221 throw IllegalTypeException(__FILE__,__LINE__); 222 } 223 224 void ValueStorage::setCurrentValue(const char * name, const atom * &_T) 225 { 226 if (typeid( const atom *) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { 227 std::ostringstream stream; 228 stream << _T->getId(); 229 CurrentValueMap[name] = stream.str(); 230 } else 231 throw IllegalTypeException(__FILE__,__LINE__); 232 } 233 234 void ValueStorage::setCurrentValue(const char * name, const element * &_T) 235 { 236 if (typeid( const element *) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { 237 std::ostringstream stream; 238 stream << _T->getAtomicNumber(); 239 CurrentValueMap[name] = stream.str(); 240 } else 241 throw IllegalTypeException(__FILE__,__LINE__); 242 } 243 244 void ValueStorage::setCurrentValue(const char * name, const molecule * &_T) 245 { 246 if (typeid( const molecule *) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { 247 std::ostringstream stream; 248 stream << _T->getId(); 249 CurrentValueMap[name] = stream.str(); 250 } else 251 throw IllegalTypeException(__FILE__,__LINE__); 252 } 253 254 void ValueStorage::setCurrentValue(const char * name, class Box &_T) 255 { 256 const Matrix &M = _T.getM(); 257 if (typeid( Box ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { 258 std::ostringstream stream; 259 stream << M.at(0,0) << " "; 260 stream << M.at(0,1) << " "; 261 stream << M.at(0,2) << " "; 262 stream << M.at(1,1) << " "; 263 stream << M.at(1,2) << " "; 264 stream << M.at(2,2) << " "; 265 CurrentValueMap[name] = stream.str(); 266 } else 267 throw IllegalTypeException(__FILE__,__LINE__); 268 } 269 270 void ValueStorage::setCurrentValue(const char * name, class Vector &_T) 271 { 272 if (typeid( Vector ) == *(OptionRegistry_instance.getOptionByName(name)->getType())){ 273 std::ostringstream stream; 274 stream << _T[0] << " "; 275 stream << _T[1] << " "; 276 stream << _T[2] << " "; 277 CurrentValueMap[name] = stream.str(); 278 } else if (typeid( BoxVector ) == *(OptionRegistry_instance.getOptionByName(name)->getType())){ 279 std::ostringstream stream; 280 stream << _T[0] << " "; 281 stream << _T[1] << " "; 282 stream << _T[2] << " "; 283 CurrentValueMap[name] = stream.str(); 284 } else 285 throw IllegalTypeException(__FILE__,__LINE__); 286 } 287 288 void ValueStorage::setCurrentValue(const char * name, std::vector<const atom *>&_T) 289 { 290 if (typeid( std::vector<const atom *> ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { 291 std::ostringstream stream; 292 for (std::vector<const atom *>::const_iterator iter = _T.begin(); iter != _T.end(); ++iter) { 293 stream << (*iter)->getId() << " "; 294 } 295 CurrentValueMap[name] = stream.str(); 296 } else 297 throw IllegalTypeException(__FILE__,__LINE__); 298 } 299 300 void ValueStorage::setCurrentValue(const char * name, std::vector<const element *>&_T) 301 { 302 if (typeid( std::vector<const element *> ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { 303 std::ostringstream stream; 304 for (std::vector<const element *>::const_iterator iter = _T.begin(); iter != _T.end(); ++iter) { 305 stream << (*iter)->getAtomicNumber() << " "; 306 } 307 CurrentValueMap[name] = stream.str(); 308 } else 309 throw IllegalTypeException(__FILE__,__LINE__); 310 } 311 312 void ValueStorage::setCurrentValue(const char * name, std::vector<const molecule *>&_T) 313 { 314 if (typeid( std::vector<const molecule *> ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { 315 std::ostringstream stream; 316 for (std::vector<const molecule *>::const_iterator iter = _T.begin(); iter != _T.end(); ++iter) { 317 stream << (*iter)->getId() << " "; 318 } 319 CurrentValueMap[name] = stream.str(); 320 } else 321 throw IllegalTypeException(__FILE__,__LINE__); 322 } 323 324 void ValueStorage::setCurrentValue(const char * name, boost::filesystem::path &_T) 325 { 326 if (typeid( boost::filesystem::path ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { 327 std::ostringstream stream; 328 stream << _T.string(); 329 CurrentValueMap[name] = stream.str(); 330 } else 331 throw IllegalTypeException(__FILE__,__LINE__); 332 } 333 334 const std::string ValueStorage::getCurrentValue(std::string actionname) { 335 return CurrentValueMap[actionname]; 33 336 } 34 337 -
src/Actions/ValueStorage.hpp
rb295ca r41e15b 9 9 #define VALUESTORAGE_HPP_ 10 10 11 #include "Actions/MapOfActions.hpp" 11 #include <boost/filesystem.hpp> 12 #include <boost/lexical_cast.hpp> 13 #include <boost/program_options.hpp> 14 15 #include <map> 16 #include <set> 17 #include <vector> 18 #include <typeinfo> 19 20 #include "Actions/OptionTrait.hpp" 21 #include "Actions/OptionRegistry.hpp" 22 #include "Exceptions/IllegalTypeException.hpp" 23 #include "Exceptions/MissingValueException.hpp" 24 #include "Helpers/Assert.hpp" 25 #include "Patterns/Singleton.hpp" 26 27 class MapOfActionsTest; 28 29 class Box; 30 class atom; 31 class element; 32 class molecule; 33 class Vector; 34 35 namespace po = boost::program_options; 36 37 using boost::lexical_cast; 38 12 39 #include "Patterns/Singleton.hpp" 13 40 … … 21 48 22 49 public: 50 51 bool isCurrentValuePresent(const char *name) const; 52 void queryCurrentValue(const char * name, const atom * &_T); 53 void queryCurrentValue(const char * name, const element * &_T); 54 void queryCurrentValue(const char * name, const molecule * &_T); 55 void queryCurrentValue(const char * name, class Box &_T); 56 void queryCurrentValue(const char * name, class Vector &_T); 57 void queryCurrentValue(const char * name, class BoxVector &_T); 58 void queryCurrentValue(const char * name, std::vector<const atom *>&_T); 59 void queryCurrentValue(const char * name, std::vector<const element *>&_T); 60 void queryCurrentValue(const char * name, std::vector<const molecule *>&_T); 61 void queryCurrentValue(const char * name, boost::filesystem::path&_T); 62 23 63 /** Gets a value from the storage 24 64 * If the value is not present, an ASSERT is thrown unless optional is set to true. … … 27 67 * \return true - value present, false - value not present (only given when optional set to true) 28 68 */ 29 template <typename T> bool queryCurrentValue(const char *name, T &_T, const bool optional = false) { 30 if (optional) { 31 if (!MapOfActions_instance.isCurrentValuePresent(name)) 32 return false; 33 } 34 MapOfActions_instance.queryCurrentValue(name, _T); 35 return true; 69 template<typename T> void queryCurrentValue(const char * name, T &_T) 70 { 71 if (typeid( T ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { // constructor of type_info is private, hence can only store by ref or ptr 72 if (CurrentValueMap.find(name) == CurrentValueMap.end()) 73 throw MissingValueException(__FILE__, __LINE__); 74 _T = lexical_cast<T>(CurrentValueMap[name].c_str()); 75 CurrentValueMap.erase(name); 76 } else 77 throw IllegalTypeException(__FILE__,__LINE__); 36 78 } 79 template<typename T> void queryCurrentValue(const char * name, std::vector<T> &_T) 80 { 81 T temp; 82 if (typeid( std::vector<T> ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { // constructor of type_info is private, hence can only store by ref or ptr 83 if (CurrentValueMap.find(name) == CurrentValueMap.end()) 84 throw MissingValueException(__FILE__, __LINE__); 85 std::istringstream stream(CurrentValueMap[name]); 86 CurrentValueMap.erase(name); 87 while (!stream.fail()) { 88 stream >> temp >> std::ws; 89 _T.push_back(temp); 90 } 91 } else 92 throw IllegalTypeException(__FILE__,__LINE__); 93 } 94 95 void setCurrentValue(const char * name, const atom * &_T); 96 void setCurrentValue(const char * name, const element * &_T); 97 void setCurrentValue(const char * name, const molecule * &_T); 98 void setCurrentValue(const char * name, class Box &_T); 99 void setCurrentValue(const char * name, class Vector &_T); 100 void setCurrentValue(const char * name, std::vector<const atom *>&_T); 101 void setCurrentValue(const char * name, std::vector<const element *>&_T); 102 void setCurrentValue(const char * name, std::vector<const molecule *>&_T); 103 void setCurrentValue(const char * name, boost::filesystem::path&_T); 37 104 38 105 /** Sets a value in the storage. … … 40 107 * \param _T value 41 108 */ 42 template <typename T> void setCurrentValue(const char *name, T &_T) { 43 MapOfActions_instance.setCurrentValue(name, _T); 109 template<class T> void setCurrentValue(const char * name, T &_T) 110 { 111 std::ostringstream stream; 112 if (typeid( T ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { // constructor of type_info is private, hence can only store by ref or ptr 113 stream << _T; 114 CurrentValueMap[name] = stream.str(); 115 } else 116 throw IllegalTypeException(__FILE__,__LINE__); 117 } 118 /** Sets a value in the storage. 119 * \param name key of value 120 * \param _T value 121 */ 122 template<class T> void setCurrentValue(const char * name, std::vector<T> &_T) 123 { 124 std::ostringstream stream; 125 if (typeid( std::vector<T> ) == *(OptionRegistry_instance.getOptionByName(name)->getType())) { // constructor of type_info is private, hence can only store by ref or ptr 126 std::ostringstream stream; 127 for (typename std::vector<T>::const_iterator iter = _T.begin(); iter != _T.end(); ++iter) { 128 stream << (*iter) << " "; 129 } 130 CurrentValueMap[name] = stream.str(); 131 } else 132 throw IllegalTypeException(__FILE__,__LINE__); 44 133 } 45 134 46 /** Obtain a descriptive text for a given key. 47 * \param actionname key 48 * \return text describing the key's contents 49 */ 50 std::string getDescription(std::string actionname); 135 const std::string getCurrentValue(std::string actionname); 51 136 52 137 protected: … … 54 139 ~ValueStorage(); 55 140 56 MapOfActions &MapOfActions_instance; 141 std::map<std::string, std::string> CurrentValueMap; 142 143 OptionRegistry &OptionRegistry_instance; 57 144 }; 58 145 -
src/Actions/WorldAction/AddEmptyBoundaryAction.cpp
rb295ca r41e15b 98 98 return false; 99 99 } 100 101 const string WorldAddEmptyBoundaryAction::getName() {102 return NAME;103 }104 100 /** =========== end of function ====================== */ -
src/Actions/WorldAction/AddEmptyBoundaryAction.def
rb295ca r41e15b 7 7 8 8 // all includes and forward declarations necessary for non-integral types below 9 #include "Actions/Values.hpp" 9 10 #include "LinearAlgebra/Vector.hpp" 10 11 11 12 // i.e. there is an integer with variable name Z that can be found in 12 13 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 15 #define paramtypes (Vector) 15 #define paramtokens (WorldAddEmptyBoundaryAction::NAME) 16 #define paramtokens ("boundary") 17 #define paramdescriptions ("desired minimum distance to boundary for each axis over all atoms") 18 #undef paramdefaults 16 19 #define paramreferences (boundary) 17 20 … … 21 24 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 25 #define CATEGORY World 26 #define MENUNAME "world" 27 #define MENUPOSITION 1 23 28 #define ACTIONNAME AddEmptyBoundary 24 29 #define TOKEN "boundary" 25 30 31 32 // finally the information stored in the ActionTrait specialization 33 #define DESCRIPTION "change box to add an empty boundary around all atoms" 34 #define SHORTFORM "c" -
src/Actions/WorldAction/BoundInBoxAction.cpp
rb295ca r41e15b 69 69 return false; 70 70 } 71 72 const string WorldBoundInBoxAction::getName() {73 return NAME;74 }75 71 /** =========== end of function ====================== */ -
src/Actions/WorldAction/BoundInBoxAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 14 #undef paramtypes 15 15 #undef paramtokens 16 #undef paramdescriptions 17 #undef paramdefaults 16 18 #undef paramreferences 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY World 25 #define MENUNAME "world" 26 #define MENUPOSITION 2 23 27 #define ACTIONNAME BoundInBox 24 28 #define TOKEN "bound-in-box" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "bound all atoms in the domain" 33 #undef SHORTFORM -
src/Actions/WorldAction/CenterInBoxAction.cpp
rb295ca r41e15b 71 71 return false; 72 72 } 73 74 const string WorldCenterInBoxAction::getName() {75 return NAME;76 }77 73 /** =========== end of function ====================== */ -
src/Actions/WorldAction/CenterInBoxAction.def
rb295ca r41e15b 7 7 8 8 // all includes and forward declarations necessary for non-integral types below 9 #include "Actions/Values.hpp" 9 10 #include "Box.hpp" 10 11 11 12 // i.e. there is an integer with variable name Z that can be found in 12 13 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 15 #define paramtypes (Box) 15 #define paramtokens (WorldCenterInBoxAction::NAME) 16 #define paramtokens ("center-in-box") 17 #define paramdescriptions ("symmetric matrix of new domain") 18 #undef paramdefaults 16 19 #define paramreferences (cell_size) 17 20 … … 21 24 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 25 #define CATEGORY World 26 #define MENUNAME "world" 27 #define MENUPOSITION 3 23 28 #define ACTIONNAME CenterInBox 24 29 #define TOKEN "center-in-box" 25 30 31 32 // finally the information stored in the ActionTrait specialization 33 #define DESCRIPTION "center all atoms in the domain" 34 #define SHORTFORM "b" -
src/Actions/WorldAction/CenterOnEdgeAction.cpp
rb295ca r41e15b 94 94 return false; 95 95 } 96 97 const string WorldCenterOnEdgeAction::getName() {98 return NAME;99 }100 96 /** =========== end of function ====================== */ -
src/Actions/WorldAction/CenterOnEdgeAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 14 #undef paramtypes 15 15 #undef paramtokens 16 #undef paramdescriptions 17 #undef paramdefaults 16 18 #undef paramreferences 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY World 25 #define MENUNAME "world" 26 #define MENUPOSITION 4 23 27 #define ACTIONNAME CenterOnEdge 24 28 #define TOKEN "center-edge" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "center edge of all atoms on (0,0,0)" 33 #define SHORTFORM "O" -
src/Actions/WorldAction/ChangeBoxAction.cpp
rb295ca r41e15b 68 68 return false; 69 69 } 70 71 const string WorldChangeBoxAction::getName() {72 return NAME;73 }74 70 /** =========== end of function ====================== */ -
src/Actions/WorldAction/ChangeBoxAction.def
rb295ca r41e15b 7 7 8 8 // all includes and forward declarations necessary for non-integral types below 9 #include "Actions/Values.hpp" 9 10 #include "Box.hpp" 10 11 11 12 // i.e. there is an integer with variable name Z that can be found in 12 13 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 15 #define paramtypes (Box) 15 #define paramtokens (WorldChangeBoxAction::NAME) 16 #define paramtokens ("change-box") 17 #define paramdescriptions ("symmetrc matrix of the new simulation domain") 18 #undef paramdefaults 16 19 #define paramreferences (cell_size) 17 20 … … 21 24 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 25 #define CATEGORY World 26 #define MENUNAME "world" 27 #define MENUPOSITION 5 23 28 #define ACTIONNAME ChangeBox 24 29 #define TOKEN "change-box" 25 30 31 32 // finally the information stored in the ActionTrait specialization 33 #define DESCRIPTION "change the symmetrc matrix of the simulation domain" 34 #define SHORTFORM "B" -
src/Actions/WorldAction/InputAction.cpp
rb295ca r41e15b 104 104 return false; 105 105 } 106 107 const string WorldInputAction::getName() {108 return NAME;109 }110 106 /** =========== end of function ====================== */ -
src/Actions/WorldAction/InputAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 14 #define paramtypes (boost::filesystem::path) 15 #define paramtokens (WorldInputAction::NAME) 15 #define paramtokens ("input") 16 #define paramdescriptions ("name of input files") 17 #undef paramdefaults 16 18 #define paramreferences (filename) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY World 25 #define MENUNAME "world" 26 #define MENUPOSITION 6 23 27 #define ACTIONNAME Input 24 28 #define TOKEN "input" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "specify input files" 33 #define SHORTFORM "i" -
src/Actions/WorldAction/OutputAction.cpp
rb295ca r41e15b 66 66 return false; 67 67 } 68 69 const string WorldOutputAction::getName() {70 return NAME;71 }72 68 /** =========== end of function ====================== */ -
src/Actions/WorldAction/OutputAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 14 #undef paramtypes 15 15 #undef paramtokens 16 #undef paramdescriptions 17 #undef paramdefaults 16 18 #undef paramreferences 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY World 25 #define MENUNAME "world" 26 #define MENUPOSITION 7 23 27 #define ACTIONNAME Output 24 28 #define TOKEN "output" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "write output files" 33 #undef SHORTFORM -
src/Actions/WorldAction/RepeatBoxAction.cpp
rb295ca r41e15b 148 148 return false; 149 149 } 150 151 const string WorldRepeatBoxAction::getName() {152 return NAME;153 }154 150 /** =========== end of function ====================== */ -
src/Actions/WorldAction/RepeatBoxAction.def
rb295ca r41e15b 7 7 8 8 // all includes and forward declarations necessary for non-integral types below 9 #include "Actions/Values.hpp" 9 10 #include "LinearAlgebra/Vector.hpp" 10 11 11 12 // i.e. there is an integer with variable name Z that can be found in 12 13 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 15 #define paramtypes (Vector) 15 #define paramtokens (WorldRepeatBoxAction::NAME) 16 #define paramtokens ("repeat-box") 17 #define paramdescriptions ("number of copies to create per axis") 18 #undef paramdefaults 16 19 #define paramreferences (Repeater) 17 20 … … 21 24 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 25 #define CATEGORY World 26 #define MENUNAME "world" 27 #define MENUPOSITION 8 23 28 #define ACTIONNAME RepeatBox 24 29 #define TOKEN "repeat-box" 25 30 31 32 // finally the information stored in the ActionTrait specialization 33 #define DESCRIPTION "create periodic copies of the simulation box per axis" 34 #define SHORTFORM "d" -
src/Actions/WorldAction/ScaleBoxAction.cpp
rb295ca r41e15b 86 86 return false; 87 87 } 88 89 const string WorldScaleBoxAction::getName() {90 return NAME;91 }92 88 /** =========== end of function ====================== */ -
src/Actions/WorldAction/ScaleBoxAction.def
rb295ca r41e15b 7 7 8 8 // all includes and forward declarations necessary for non-integral types below 9 #include "Actions/Values.hpp" 9 10 #include "LinearAlgebra/Vector.hpp" 10 11 11 12 // i.e. there is an integer with variable name Z that can be found in 12 13 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 15 #define paramtypes (Vector) 15 #define paramtokens (WorldScaleBoxAction::NAME) 16 #define paramtokens ("scale-box") 17 #define paramdescriptions ("scaling factor for each axis") 18 #undef paramdefaults 16 19 #define paramreferences (Scaler) 17 20 … … 21 24 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 25 #define CATEGORY World 26 #define MENUNAME "world" 27 #define MENUPOSITION 9 23 28 #define ACTIONNAME ScaleBox 24 29 #define TOKEN "scale-box" 25 30 31 32 // finally the information stored in the ActionTrait specialization 33 #define DESCRIPTION "scale box and atomic positions inside" 34 #define SHORTFORM "s" -
src/Actions/WorldAction/SetDefaultNameAction.cpp
rb295ca r41e15b 73 73 return true; 74 74 } 75 76 const string WorldSetDefaultNameAction::getName() {77 return NAME;78 }79 75 /** =========== end of function ====================== */ -
src/Actions/WorldAction/SetDefaultNameAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 14 #define paramtypes (std::string) 15 #define paramtokens (WorldSetDefaultNameAction::NAME) 15 #define paramtokens ("default-molname") 16 #define paramdescriptions ("new default name of new molecules") 17 #undef paramdefaults 16 18 #define paramreferences (newname) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY World 25 #define MENUNAME "world" 26 #define MENUPOSITION 10 23 27 #define ACTIONNAME SetDefaultName 24 28 #define TOKEN "default-molname" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "set the default name of new molecules" 33 #define SHORTFORM "X" -
src/Actions/WorldAction/SetGaussianBasisAction.cpp
rb295ca r41e15b 73 73 return true; 74 74 } 75 76 const string WorldSetGaussianBasisAction::getName() {77 return NAME;78 }79 75 /** =========== end of function ====================== */ -
src/Actions/WorldAction/SetGaussianBasisAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 14 #define paramtypes (std::string) 15 #define paramtokens (WorldSetGaussianBasisAction::NAME) 15 #define paramtokens ("set-basis") 16 #define paramdescriptions ("name of the gaussian basis set for MPQC") 17 #undef paramdefaults 16 18 #define paramreferences (newname) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY World 25 #define MENUNAME "world" 26 #define MENUPOSITION 11 23 27 #define ACTIONNAME SetGaussianBasis 24 28 #define TOKEN "set-basis" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "set the name of the gaussian basis set for MPQC" 33 #define SHORTFORM "M" -
src/Actions/WorldAction/SetOutputFormatsAction.cpp
rb295ca r41e15b 71 71 return false; 72 72 } 73 74 const string WorldSetOutputFormatsAction::getName() {75 return NAME;76 }77 73 /** =========== end of function ====================== */ -
src/Actions/WorldAction/SetOutputFormatsAction.def
rb295ca r41e15b 11 11 // i.e. there is an integer with variable name Z that can be found in 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 // "undefine" if no parameters are required 14 #define paramtypes (vector<std::string>) 15 #define paramtokens (WorldSetOutputFormatsAction::NAME) 13 // "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value 14 #define paramtypes (std::vector<std::string>) 15 #define paramtokens ("set-output") 16 #define paramdescriptions ("specify output formats") 17 #undef paramdefaults 16 18 #define paramreferences (FormatList) 17 19 … … 21 23 // some defines for all the names, you may use ACTION, STATE and PARAMS 22 24 #define CATEGORY World 25 #define MENUNAME "world" 26 #define MENUPOSITION 12 23 27 #define ACTIONNAME SetOutputFormats 24 28 #define TOKEN "set-output" 25 29 30 31 // finally the information stored in the ActionTrait specialization 32 #define DESCRIPTION "specify output formats" 33 #define SHORTFORM "o" -
src/Helpers/Assert.cpp
rb295ca r41e15b 74 74 75 75 bool Assert::_my_assert::check(const char* condition, 76 const char*message,76 std::string message, 77 77 const char* filename, 78 78 const int line, -
src/Helpers/Assert.hpp
rb295ca r41e15b 180 180 * 181 181 * <ul> 182 * <li> <H4> How can I add values to the failure message of ASSERT(), e.g. I want to say that above "i" 183 * failed to be zero, with i == ...?</H4> 184 * This can be done in the following way: 185 * @code 186 * ASSERT(!i,"i was not zero but "+std::string(i)+"after incrementing"); 187 * @endcode 188 * Note that this works because std::string() in the middle requires the const char arrays on both ends 189 * to be converted to string and eventually, the whole text is again cast to const char * form. 182 190 * <li> <H4> ASSERT() is broken. When I abort the program it says something about an 183 191 * "Illegal instruction"</H4> … … 300 308 public: 301 309 static bool check(const char* condition, 302 const char*message,310 std::string message, 303 311 const char* filename, 304 312 const int line, -
src/Makefile.am
rb295ca r41e15b 39 39 Actions/ActionRegistry.cpp \ 40 40 Actions/ActionSequence.cpp \ 41 Actions/ActionTraits.cpp \ 41 42 Actions/ErrorAction.cpp \ 42 43 Actions/MakroAction.cpp \ 43 44 Actions/ManipulateAtomsProcess.cpp \ 44 45 Actions/MethodAction.cpp \ 46 Actions/OptionRegistry.cpp \ 47 Actions/OptionTrait.cpp \ 45 48 Actions/Process.cpp 46 49 … … 50 53 Actions/ActionRegistry.hpp \ 51 54 Actions/ActionSequence.hpp \ 55 Actions/ActionTraits.hpp \ 52 56 Actions/Calculation.hpp \ 53 57 Actions/Calculation_impl.hpp \ … … 55 59 Actions/MakroAction.hpp \ 56 60 Actions/ManipulateAtomsProcess.hpp \ 57 Actions/MapOfActions.hpp \58 61 Actions/MethodAction.hpp \ 62 Actions/OptionRegistry.hpp \ 63 Actions/OptionTrait.hpp \ 59 64 Actions/Process.hpp 60 65 … … 123 128 UIElements/Qt4/QtMainWindow.hpp \ 124 129 UIElements/Menu/Qt4/QtMenu.hpp \ 130 UIElements/Menu/Qt4/QtMenuPipe.hpp \ 125 131 UIElements/Views/Qt4/QtWorldView.hpp \ 126 132 UIElements/Views/Qt4/GLMoleculeView.hpp \ … … 165 171 UIElements/Qt4/QtDialog.cpp \ 166 172 UIElements/Qt4/QtUIFactory.cpp \ 167 UIElements/Menu/Qt4/QtMenu .cpp \173 UIElements/Menu/Qt4/QtMenuPipe.cpp \ 168 174 UIElements/Views/Qt4/QtWorldView.cpp \ 169 175 UIElements/Views/Qt4/GLMoleculeView.cpp \ … … 213 219 boundary.cpp \ 214 220 Box.cpp \ 215 CommandLineParser.cpp \216 221 config.cpp \ 217 222 ConfigFileBuffer.cpp \ … … 251 256 boundary.hpp \ 252 257 Box.hpp \ 253 CommandLineParser.hpp \254 258 config.hpp \ 255 259 ConfigFileBuffer.hpp \ -
src/Patterns/Registry.hpp
rb295ca r41e15b 2 2 * Registry.hpp 3 3 * 4 * Based on Registry<Action>by Till Crueger.4 * Based on initial ActionRegistry code by Till Crueger. 5 5 * 6 6 * The registry pattern is basically just a singleton map, wherein instantiations … … 21 21 * <h1> Registry Howto </h1> 22 22 * 23 * The registry is a class where instances of other classes are stored and be retrieved24 * when desired. For this purpose a registry should always be a singleton (i.e. use both25 * this registry and the singleton pattern to declare a registry class). It basically26 * is simply a singleton container of a map, where the pointers to the class instances are27 * stored by a string key and can be retrieved thereby.23 * The Registry is a class where instances of other classes are stored and be retrieved 24 * by a string token when desired. For this purpose a Registry should always be a singleton 25 * (i.e. use both this Registry and the Singleton pattern to declare a Registry class). It 26 * basically is simply a singleton container of a map, where the pointers to the class 27 * instances are stored by a string key and can be retrieved thereby. 28 28 * 29 * The available functions are, if your class to be stored in registry is foo : 29 * The available functions are as follows if your class instances to be stored in Registry 30 * are of type 'foo': 30 31 * 31 32 * - <code>foo* Registry<foo>::getByName()</code> : returns the instance of a specific … … 58 59 ~Registry(); 59 60 60 T* getByName(const std::string name); 61 bool isPresentByName(const std::string name); 61 typedef typename std::map<const std::string,T*> instance_map; 62 typedef typename std::map<const std::string,T*>::iterator iterator; 63 typedef typename std::map<const std::string,T*>::const_iterator const_iterator; 64 65 T* getByName(const std::string name) const; 66 bool isPresentByName(const std::string name) const; 62 67 void registerInstance(T*); 63 68 void unregisterInstance(T*); 69 void cleanup(); 64 70 65 typename std::map<const std::string,T*>::iterator getBeginIter();66 typename std::map<const std::string,T*>::const_iterator getBeginIter() const;67 typename std::map<const std::string,T*>::iterator getEndIter();68 typename std::map<const std::string,T*>::const_iterator getEndIter() const;71 iterator getBeginIter(); 72 const_iterator getBeginIter() const; 73 iterator getEndIter(); 74 const_iterator getEndIter() const; 69 75 70 76 private: 71 typename std::map<const std::string,T*>InstanceMap;77 instance_map InstanceMap; 72 78 }; 73 79 -
src/Patterns/Registry_impl.hpp
rb295ca r41e15b 15 15 16 16 #include "Helpers/Assert.hpp" 17 #include <ios fwd>17 #include <iostream> 18 18 19 19 /** Constructor for class Registry. … … 25 25 */ 26 26 template <class T> Registry<T>::~Registry() 27 { 28 typename std::map<const std::string,T*>::iterator iter; 29 for(iter=InstanceMap.begin();iter!=InstanceMap.end();++iter) { 30 delete iter->second; 31 } 32 InstanceMap.clear(); 33 } 27 {} 34 28 35 29 /** Returns pointer to an instance named by \a name. … … 37 31 * \return pointer to instance 38 32 */ 39 template <class T> T* Registry<T>::getByName(const std::string name){ 40 typename std::map<const std::string,T*>::iterator iter; 33 template <class T> T* Registry<T>::getByName(const std::string name) const 34 { 35 typename std::map<const std::string,T*>::const_iterator iter; 41 36 iter = InstanceMap.find(name); 42 ASSERT(iter!=InstanceMap.end(),"Query for an instance not stored in registry");37 ASSERT(iter!=InstanceMap.end(),"Query for an instance "+name+" not stored in registry"); 43 38 return iter->second; 44 39 } … … 47 42 * \note This is needed as Registry<T>::getByName() ASSERT()s that instance is in std::map. 48 43 * \param name name of instance 49 * \return true - vpresent, false - instance absent44 * \return true - present, false - instance absent 50 45 */ 51 template <class T>bool Registry<T>::isPresentByName(const std::string name){ 52 typename std::map<const std::string,T*>::iterator iter; 46 template <class T>bool Registry<T>::isPresentByName(const std::string name) const 47 { 48 typename std::map<const std::string,T*>::const_iterator iter; 53 49 iter = InstanceMap.find(name); 54 50 return iter!=InstanceMap.end(); … … 60 56 template <class T>void Registry<T>::registerInstance(T* instance){ 61 57 std::pair<typename std::map<const std::string,T*>::iterator,bool> ret; 62 // cout << "Trying to register instance with name " << instance->getName() << "." <<endl;58 //std::cout << "Trying to register instance of type " << typeid(T).name() << " with name " << instance->getName() << "." << std::endl; 63 59 ret = InstanceMap.insert(typename std::pair<const std::string,T*>(instance->getName(),instance)); 64 ASSERT(ret.second,"Two instances with the same name added to registry");60 ASSERT(ret.second,"Two instances with the same name "+instance->getName()+" added to registry"); 65 61 } 66 62 … … 69 65 */ 70 66 template <class T>void Registry<T>::unregisterInstance(T* instance){ 71 // cout << "Unregistering instance with name " << instance->getName() << "." <<endl;67 //std::cout << "Unregistering instance of type " << typeid(T).name() << " with name " << instance->getName() << "." << std::endl; 72 68 InstanceMap.erase(instance->getName()); 73 69 } 70 71 /** Removes every instance from the registry. 72 */ 73 template <class T>void Registry<T>::cleanup() 74 { 75 typename std::map<const std::string,T*>::iterator iter; 76 for(iter=InstanceMap.begin();iter!=InstanceMap.end();++iter) { 77 delete iter->second; 78 } 79 InstanceMap.clear(); 80 } 81 74 82 75 83 /** Returns an iterator pointing to the start of the std::map of instance's. … … 128 136 * at a chosen place. 129 137 */ 130 #define CONSTRUCT_REGISTRY( name) \131 template name* Registry<name>::getByName(const std::string name); \132 template bool Registry< name>::isPresentByName(const std::string name); \133 template void Registry< name>::registerInstance(name*); \134 template void Registry< name>::unregisterInstance(name*); \135 template std::map<const std::string, name*>::iterator Registry<name>::getBeginIter(); \136 template std::map<const std::string, name*>::const_iterator Registry<name>::getBeginIter() const; \137 template std::map<const std::string, name*>::iterator Registry<name>::getEndIter(); \138 template std::map<const std::string, name*>::const_iterator Registry<name>::getEndIter() const;138 #define CONSTRUCT_REGISTRY(InstanceType) \ 139 template InstanceType* Registry<InstanceType>::getByName(const std::string) const; \ 140 template bool Registry<InstanceType>::isPresentByName(const std::string) const; \ 141 template void Registry<InstanceType>::registerInstance(InstanceType*); \ 142 template void Registry<InstanceType>::unregisterInstance(InstanceType*); \ 143 template std::map<const std::string,InstanceType*>::iterator Registry<InstanceType>::getBeginIter(); \ 144 template std::map<const std::string,InstanceType*>::const_iterator Registry<InstanceType>::getBeginIter() const; \ 145 template std::map<const std::string,InstanceType*>::iterator Registry<InstanceType>::getEndIter(); \ 146 template std::map<const std::string,InstanceType*>::const_iterator Registry<InstanceType>::getEndIter() const; 139 147 140 148 -
src/UIElements/CommandLineUI/CommandLineWindow.cpp
rb295ca r41e15b 26 26 27 27 #include "Actions/Action.hpp" 28 #include "Actions/MapOfActions.hpp"29 28 #include "Actions/ActionRegistry.hpp" 30 29 31 #include " CommandLineParser.hpp"30 #include "UIElements/CommandLineUI/CommandLineParser.hpp" 32 31 33 32 #include <iostream> … … 38 37 CommandLineWindow::CommandLineWindow() 39 38 { 40 // create and register all command line callable actions41 MapOfActions::getInstance().populateActions();42 43 39 // Add status indicators etc... 44 40 statusIndicator = new CommandLineStatusIndicator(); -
src/UIElements/CommandLineUI/Query/AtomCommandLineQuery.cpp
rb295ca r41e15b 26 26 #include "CommandLineUI/CommandLineDialog.hpp" 27 27 28 #include "CommandLine Parser.hpp"28 #include "CommandLineUI/CommandLineParser.hpp" 29 29 #include "Helpers/Log.hpp" 30 30 #include "Helpers/Verbose.hpp" -
src/UIElements/CommandLineUI/Query/AtomsCommandLineQuery.cpp
rb295ca r41e15b 24 24 #include "CommandLineUI/CommandLineDialog.hpp" 25 25 26 #include "CommandLineUI/CommandLineParser.hpp" 26 27 #include "Helpers/Log.hpp" 27 28 #include "Helpers/Verbose.hpp" 28 #include "CommandLineParser.hpp"29 29 #include "World.hpp" 30 30 -
src/UIElements/CommandLineUI/Query/BooleanCommandLineQuery.cpp
rb295ca r41e15b 22 22 #include "CommandLineUI/CommandLineDialog.hpp" 23 23 24 #include "CommandLineUI/CommandLineParser.hpp" 24 25 #include "Helpers/Log.hpp" 25 26 #include "Helpers/Verbose.hpp" 26 #include "CommandLineParser.hpp"27 27 28 28 CommandLineDialog::BooleanCommandLineQuery::BooleanCommandLineQuery(string title, string _description) : -
src/UIElements/CommandLineUI/Query/BoxCommandLineQuery.cpp
rb295ca r41e15b 23 23 24 24 #include "Actions/Values.hpp" 25 #include "CommandLineUI/CommandLineParser.hpp" 25 26 #include "Helpers/Log.hpp" 26 27 #include "Helpers/Verbose.hpp" 27 28 #include "LinearAlgebra/Matrix.hpp" 28 #include "CommandLineParser.hpp"29 29 30 30 CommandLineDialog::BoxCommandLineQuery::BoxCommandLineQuery(string title, string _description) : -
src/UIElements/CommandLineUI/Query/DoubleCommandLineQuery.cpp
rb295ca r41e15b 22 22 #include "CommandLineUI/CommandLineDialog.hpp" 23 23 24 #include "CommandLineUI/CommandLineParser.hpp" 24 25 #include "Helpers/Log.hpp" 25 26 #include "Helpers/Verbose.hpp" 26 #include "CommandLineParser.hpp"27 27 28 28 -
src/UIElements/CommandLineUI/Query/DoublesCommandLineQuery.cpp
rb295ca r41e15b 22 22 #include "CommandLineUI/CommandLineDialog.hpp" 23 23 24 #include "CommandLineUI/CommandLineParser.hpp" 24 25 #include "Helpers/Log.hpp" 25 26 #include "Helpers/Verbose.hpp" 26 #include "CommandLineParser.hpp"27 27 28 28 CommandLineDialog::DoublesCommandLineQuery::DoublesCommandLineQuery(string title, string _description) : -
src/UIElements/CommandLineUI/Query/ElementCommandLineQuery.cpp
rb295ca r41e15b 22 22 #include "CommandLineUI/CommandLineDialog.hpp" 23 23 24 #include "CommandLineUI/CommandLineParser.hpp" 24 25 #include "Helpers/Log.hpp" 25 26 #include "Helpers/Verbose.hpp" 26 #include "CommandLineParser.hpp"27 27 #include "element.hpp" 28 28 #include "periodentafel.hpp" -
src/UIElements/CommandLineUI/Query/ElementsCommandLineQuery.cpp
rb295ca r41e15b 22 22 #include "CommandLineUI/CommandLineDialog.hpp" 23 23 24 #include "CommandLineUI/CommandLineParser.hpp" 24 25 #include "Helpers/Log.hpp" 25 26 #include "Helpers/Verbose.hpp" 26 #include "CommandLineParser.hpp"27 27 #include "element.hpp" 28 28 #include "periodentafel.hpp" -
src/UIElements/CommandLineUI/Query/EmptyCommandLineQuery.cpp
rb295ca r41e15b 24 24 #include "CommandLineUI/CommandLineDialog.hpp" 25 25 26 #include "CommandLineUI/CommandLineParser.hpp" 26 27 #include "Helpers/Log.hpp" 27 28 #include "Helpers/Verbose.hpp" 28 #include "CommandLineParser.hpp"29 29 30 30 CommandLineDialog::EmptyCommandLineQuery::EmptyCommandLineQuery(string title, string _description) : -
src/UIElements/CommandLineUI/Query/FileCommandLineQuery.cpp
rb295ca r41e15b 22 22 #include "CommandLineUI/CommandLineDialog.hpp" 23 23 24 #include "CommandLineUI/CommandLineParser.hpp" 24 25 #include "Helpers/Log.hpp" 25 26 #include "Helpers/Verbose.hpp" 26 #include "CommandLineParser.hpp"27 27 28 28 CommandLineDialog::FileCommandLineQuery::FileCommandLineQuery(string title, string _description) : -
src/UIElements/CommandLineUI/Query/IntCommandLineQuery.cpp
rb295ca r41e15b 22 22 #include "CommandLineUI/CommandLineDialog.hpp" 23 23 24 #include "CommandLineUI/CommandLineParser.hpp" 24 25 #include "Helpers/Log.hpp" 25 26 #include "Helpers/Verbose.hpp" 26 #include "CommandLineParser.hpp"27 27 28 28 CommandLineDialog::IntCommandLineQuery::IntCommandLineQuery(string title, string _description) : -
src/UIElements/CommandLineUI/Query/IntsCommandLineQuery.cpp
rb295ca r41e15b 22 22 #include "CommandLineUI/CommandLineDialog.hpp" 23 23 24 #include "CommandLineUI/CommandLineParser.hpp" 24 25 #include "Helpers/Log.hpp" 25 26 #include "Helpers/Verbose.hpp" 26 #include "CommandLineParser.hpp"27 27 28 28 CommandLineDialog::IntsCommandLineQuery::IntsCommandLineQuery(string title, string _description) : -
src/UIElements/CommandLineUI/Query/MoleculeCommandLineQuery.cpp
rb295ca r41e15b 24 24 #include "CommandLineUI/CommandLineDialog.hpp" 25 25 26 #include "CommandLineUI/CommandLineParser.hpp" 26 27 #include "Helpers/Log.hpp" 27 28 #include "Helpers/Verbose.hpp" 28 #include "CommandLineParser.hpp"29 29 30 30 CommandLineDialog::MoleculeCommandLineQuery::MoleculeCommandLineQuery(string title, string _description) : -
src/UIElements/CommandLineUI/Query/MoleculesCommandLineQuery.cpp
rb295ca r41e15b 24 24 #include "CommandLineUI/CommandLineDialog.hpp" 25 25 26 #include "CommandLineUI/CommandLineParser.hpp" 26 27 #include "Helpers/Log.hpp" 27 28 #include "Helpers/Verbose.hpp" 28 #include "CommandLineParser.hpp"29 29 #include "World.hpp" 30 30 -
src/UIElements/CommandLineUI/Query/StringCommandLineQuery.cpp
rb295ca r41e15b 22 22 #include "CommandLineUI/CommandLineDialog.hpp" 23 23 24 #include "CommandLineUI/CommandLineParser.hpp" 24 25 #include "Helpers/Log.hpp" 25 26 #include "Helpers/Verbose.hpp" 26 #include "CommandLineParser.hpp"27 27 28 28 CommandLineDialog::StringCommandLineQuery::StringCommandLineQuery(string title, string _description) : -
src/UIElements/CommandLineUI/Query/StringsCommandLineQuery.cpp
rb295ca r41e15b 22 22 #include "CommandLineUI/CommandLineDialog.hpp" 23 23 24 #include "CommandLineUI/CommandLineParser.hpp" 24 25 #include "Helpers/Log.hpp" 25 26 #include "Helpers/Verbose.hpp" 26 #include "CommandLineParser.hpp"27 27 28 28 CommandLineDialog::StringsCommandLineQuery::StringsCommandLineQuery(string title, string _description) : … … 34 34 bool CommandLineDialog::StringsCommandLineQuery::handle() { 35 35 if (CommandLineParser::getInstance().vm.count(getTitle())) { 36 tmp = CommandLineParser::getInstance().vm[getTitle()].as< vector<string> >();36 tmp = CommandLineParser::getInstance().vm[getTitle()].as< std::vector<std::string> >(); 37 37 return true; 38 38 } else { -
src/UIElements/CommandLineUI/Query/VectorCommandLineQuery.cpp
rb295ca r41e15b 23 23 24 24 #include "Actions/Values.hpp" 25 #include "CommandLineUI/CommandLineParser.hpp" 25 26 #include "Helpers/Log.hpp" 26 27 #include "Helpers/Verbose.hpp" 27 #include "CommandLineParser.hpp"28 28 #include "LinearAlgebra/Vector.hpp" 29 29 #include "Box.hpp" -
src/UIElements/CommandLineUI/Query/VectorsCommandLineQuery.cpp
rb295ca r41e15b 25 25 26 26 #include "Actions/Values.hpp" 27 #include "CommandLineUI/CommandLineParser.hpp" 27 28 #include "Helpers/Log.hpp" 28 29 #include "Helpers/Verbose.hpp" 29 #include "CommandLineParser.hpp"30 30 #include "World.hpp" 31 31 -
src/UIElements/Dialog.cpp
rb295ca r41e15b 126 126 } 127 127 128 template <> void Dialog::query< atom *>(const char *token, std::string description)128 template <> void Dialog::query<const atom *>(const char *token, std::string description) 129 129 { 130 130 queryAtom(token, description); 131 131 } 132 132 133 template <> void Dialog::query< std::vector< atom *> >(const char *token, std::string description)133 template <> void Dialog::query< std::vector<const atom *> >(const char *token, std::string description) 134 134 { 135 135 queryAtoms(token, description); 136 136 } 137 137 138 template <> void Dialog::query< molecule *>(const char *token, std::string description)138 template <> void Dialog::query<const molecule *>(const char *token, std::string description) 139 139 { 140 140 queryMolecule(token, description); 141 141 } 142 142 143 template <> void Dialog::query< std::vector< molecule *> >(const char *token, std::string description)143 template <> void Dialog::query< std::vector<const molecule *> >(const char *token, std::string description) 144 144 { 145 145 queryMolecules(token, description); -
src/UIElements/Dialog.hpp
rb295ca r41e15b 33 33 * string, but also advanced types such as element, molecule or Vector. There 34 34 * is also an empty query for displaying text. 35 * 36 * Note that the templatization of Dialog::query() allows for easy implementation 37 * of new types that correspond to/are derived from old ones. 38 * 39 * <H3>How do Dialogs operate?</H3> 40 * 41 * Dialogs are initiated by Action::FillDialog() function calls. Within Action::Call() 42 * a dialog is created and passed on to FillDialog(), which is specialized in each 43 * specific Action to ask for the specific parameter it needs. 44 * 45 * Dialogs are derived for each of the UI types 46 * -# CommandLineDialog 47 * -# QtDialog 48 * -# TextDialog 49 * 50 * This "asking" for parameters is done via the Query class. There are four types 51 * of Query types: 52 * -# Query, members in class Dialog 53 * -# CommandLineQuery, members in class CommandLineDialog 54 * -# QtQuery, members in class QtDialog 55 * -# TextQuery, members in class TextDialog 56 * Each embodies a certain way of asking the user for the specific type of parameter 57 * needed, e.g. a file via the TextMenu interface would be done in member functions of 58 * TextDialog::FileTextQuery. 59 * 60 * 61 * Generally, the sequence of events is as follows: 62 * -# Action::fillDialog() calls upon Dialog::query<T> for some type T, let's say T 63 * stands for double 64 * -# Dialog::query<double> call a function queryDouble() 65 * -# depending on the currently used UIFactory, the Dialog above is actually either 66 * of the three specialized types, let's say CommandLine. And we see that within 67 * CommandLineDialog we have the respective method ueryDouble() that registers 68 * a new instance of the class CommandLineDialog::DoubleCommandLineQuery. 69 * -# The Query's are first registered, as multiple parameters may be needed for 70 * a single Action and we don't want the popping up of a dialog window for each 71 * alone. Rather, we want to merge the Query's into a single Dialog. Therefore, 72 * they are first registered and then executed in sequence. This is done in 73 * Dialog::display(), i.e. when the dialog is finally shown to the user. 74 * -# Then each of the registered Query's, here our CommandLineDialog:: 75 * DoubleCommandLineQuery, constructor is called. 76 * -# This will call the constructor of its base class, where the actual value 77 * is stored and later stored into the ValueStorage class by 78 * Dialog::Query::setResult(). 79 * -# Also, e.g. for the Qt interface, the buttons, labels and so forth are 80 * created and added to the dialog. 81 * -# Now the users enters information for each UI something different happens: 82 * -# CommandLine: The actual value retrieval is done by the CommandLineParser and 83 * the boost::program_options library, the value is stored therein for the moment. 84 * (see here: http://www.boost.org/doc/libs/1_44_0/doc/html/program_options/) 85 * -# TextMenu: The value is requested via std::cin from the user. 86 * -# QtMenu: The users enters the value in a Dialog. Due to Qt necessities a 87 * Pipe class obtains the value from the Dialog with Qt's signal/slot mechanism 88 * and put it into Dialog::...Query value. 89 * -# in our case DoubleCommandLineQuery::handle() will be called. The value is 90 * retrieved and put into Dialog::DoubleQuery::tmp 91 * -# Finally, for each Query, also Dialog::DoubleQuery, setResult() is called which 92 * puts the value as a string into the ValueStorage under a given token that is 93 * associated with a type (and thereby we assure type-safety). 94 * 95 * <H3>Regarding derived types of types with already present queries</H3> 96 * 97 * Example: We have got a derived Vector class, called BoxVector, that is by any means 98 * a Vector but with one difference: it is always bound to lie within the current domain. 99 * With regards to type-casting it to and from a string however, nothing is different 100 * between Vector and BoxVector. 101 * 102 * So, do we need a new Query for this? 103 * No. 104 * 105 * We just have to do this: 106 * -# add a specialization of Dialog::query<BoxVector> where queryVector()is used. 107 * @code 108 * template <> void Dialog::query<BoxVector>(const char *token, std::string description) { 109 * queryVector(token, false, description); 110 * } 111 * @endcode 112 * -# make sure that 113 * -# ValueStorage::setCurrentValue() the specialization for class Vector has an 114 * if case also for BoxVector and does something appropriate. 115 * -# ValueStorage::queryCurrentValue() has another specialization doing the same 116 * as for Vector but for BoxVector in its signature. 117 * 118 * And that's all. 119 * 120 * 121 * <H3>Adding new queries</H3> 122 * 123 * Check first whether you really need a new query or whether we can derive it and re-use 124 * one of the present ones. 125 * 126 * Due to the three present UI interfaces we have to add a specific Query for each, here 127 * is a list: 128 * -# add ValueStorage::setCurrentValue() and ValueStorage::queryCurrentValue() for 129 * both types 130 * -# add Dialog::query...() 131 * -# add Dialog::query<>() specialization calling the above function 132 * -# add CommandLineDialog::query...(), TextDialog::query...(), and QtDialog::query...(), 133 * i.e. for each of the three interface 134 * -# add Dialog::...Query class with tmp value of desired type 135 * -# add CommandLineDialog::...Query, TextDialog::...Query, QtDialog::...Query 136 * -# you probably also need a QtDialog::...QueryPipe() to handle the signal/slot stuff, 137 * Qt's moc does not like nested classes. Hence, this has to go extra. 138 * 35 139 */ 36 140 class Dialog … … 210 314 virtual void setResult(); 211 315 protected: 212 molecule *tmp;316 const molecule *tmp; 213 317 }; 214 318 … … 220 324 virtual void setResult(); 221 325 protected: 222 molecule * temp;223 std::vector< molecule *> tmp;326 const molecule * temp; 327 std::vector<const molecule *> tmp; 224 328 }; 225 329 … … 231 335 virtual void setResult(); 232 336 protected: 233 atom *tmp;337 const atom *tmp; 234 338 }; 235 339 … … 241 345 virtual void setResult(); 242 346 protected: 243 atom *temp;244 std::vector< atom *> tmp;347 const atom *temp; 348 std::vector<const atom *> tmp; 245 349 }; 246 350 -
src/UIElements/Makefile.am
rb295ca r41e15b 19 19 MENUSOURCE = \ 20 20 Menu/Menu.cpp \ 21 Menu/TextMenu.cpp \ 22 Menu/MenuItem.cpp \ 23 Menu/SubMenuItem.cpp \ 24 Menu/ActionMenuItem.cpp \ 25 Menu/SeperatorItem.cpp \ 26 Menu/DisplayMenuItem.cpp 27 21 Menu/MenuDescription.cpp \ 22 Menu/MenuInterface.cpp 23 28 24 MENUHEADER = \ 29 25 Menu/Menu.hpp \ 30 Menu/TextMenu.hpp \ 31 Menu/MenuItem.hpp \ 32 Menu/SubMenuItem.hpp \ 33 Menu/ActionMenuItem.hpp \ 34 Menu/SeperatorItem.hpp \ 35 Menu/DisplayMenuItem.hpp 26 Menu/MenuDescription.hpp \ 27 Menu/MenuInterface.hpp 28 29 TEXTMENUSOURCE = \ 30 Menu/TextMenu/TxMenu.cpp \ 31 Menu/TextMenu/MenuItem.cpp \ 32 Menu/TextMenu/SubMenuItem.cpp \ 33 Menu/TextMenu/ActionMenuItem.cpp \ 34 Menu/TextMenu/SeperatorItem.cpp \ 35 Menu/TextMenu/DisplayMenuItem.cpp 36 37 TEXTMENUHEADER = \ 38 Menu/TextMenu/TextMenu.hpp \ 39 Menu/TextMenu/TxMenu.hpp \ 40 Menu/TextMenu/MenuItem.hpp \ 41 Menu/TextMenu/SubMenuItem.hpp \ 42 Menu/TextMenu/ActionMenuItem.hpp \ 43 Menu/TextMenu/SeperatorItem.hpp \ 44 Menu/TextMenu/DisplayMenuItem.hpp 36 45 37 46 UISOURCE = \ … … 39 48 ${COMMANDLINEUISOURCE} \ 40 49 ${MENUSOURCE} \ 50 ${TEXTMENUSOURCE} \ 41 51 ${TEXTUISOURCE} \ 42 52 ${VIEWSOURCE} \ … … 67 77 ${COMMANDLINEUIHEADER} \ 68 78 ${MENUHEADER} \ 79 ${TEXTMENUHEADER} \ 69 80 ${TEXTUIHEADER} \ 70 81 ${VIEWHEADER} \ … … 121 132 CommandLineUI/Query/VectorsCommandLineQuery.cpp \ 122 133 CommandLineUI/CommandLineDialog.cpp \ 134 CommandLineUI/CommandLineParser.cpp \ 123 135 CommandLineUI/CommandLineStatusIndicator.cpp \ 124 136 CommandLineUI/CommandLineUIFactory.cpp \ 125 CommandLineUI/CommandLineWindow.cpp 137 CommandLineUI/CommandLineWindow.cpp \ 138 CommandLineUI/TypeEnumContainer.cpp 139 126 140 COMMANDLINEUIHEADER = \ 127 141 CommandLineUI/CommandLineDialog.hpp \ 142 CommandLineUI/CommandLineParser.hpp \ 128 143 CommandLineUI/CommandLineStatusIndicator.hpp \ 129 144 CommandLineUI/CommandLineUIFactory.hpp \ 130 CommandLineUI/CommandLineWindow.hpp 145 CommandLineUI/CommandLineWindow.hpp \ 146 CommandLineUI/TypeEnumContainer.cpp 131 147 132 148 lib_LTLIBRARIES = libMolecuilderUI-@MOLECUILDER_API_VERSION@.la -
src/UIElements/Menu/Menu.cpp
rb295ca r41e15b 20 20 #include "Helpers/MemDebug.hpp" 21 21 22 #include "Menu.hpp"22 #include <iostream> 23 23 24 Menu::Menu() 24 #include "Actions/ActionRegistry.hpp" 25 #include "Actions/Action.hpp" 26 #include "Actions/ActionTraits.hpp" 27 #include "Menu/Menu.hpp" 28 29 /** Constructor of class Menu. 30 * \param &_name name of menu 31 */ 32 Menu::Menu(const std::string &_name) : 33 MenuInterface(_name), 34 name(_name), 35 TopPosition(0), 36 LastItem(NoItem) 37 {} 38 39 /** Destructor of class Menu. 40 * 41 */ 42 Menu::~Menu() 43 {} 44 45 /** Initialiser for class Menu. 46 * Fills menus with items. 47 */ 48 void Menu::init() 25 49 { 26 // TODO Auto-generated constructor stub27 50 populate(); 51 populateActions(); 28 52 } 29 53 30 Menu::~Menu() 54 /** Initializing function. 55 * Inserts Menus and Actions obtained from MenuDescription and 56 * ActionRegistry. 57 */ 58 void Menu::populate() 31 59 { 32 // TODO Auto-generated destructor stub 60 // go through all menus and create them 61 62 bool CompleteFlag = false; // indicates whether all menus have been added 63 bool PossibleMissingFlag = false; // indicates whether a separator is missing 64 while (!CompleteFlag) { 65 CompleteFlag = true; 66 PossibleMissingFlag = false; 67 for(MenuDescription::const_iterator iter = menudescriptions.getBeginIter(); 68 iter != menudescriptions.getEndIter(); 69 ++iter) { 70 // skip when already present 71 if (!isPresent(iter->first)) { 72 // have some short refs to infos 73 const std::string &MenuName = iter->first; 74 const std::string &TopName = iter->second.first; 75 const int &MenuPosition = iter->second.second; 76 std::cout << "MenuName is " << MenuName 77 << ", TopName is " << TopName 78 << " and Position is " << MenuPosition 79 << std::endl; 80 81 // does it belong to us? 82 if (TopName == name) { 83 if (MenuPosition-1 == TopPosition) { 84 Menu::addSubmenu(MenuName, MenuPosition); 85 CompleteFlag = false; 86 } 87 // is there a menuposition specified that we have not reached yet? 88 if (MenuPosition-1 > TopPosition) 89 PossibleMissingFlag = true; 90 } 91 } 92 } 93 if (PossibleMissingFlag && (CompleteFlag)) { 94 Menu::addSeparator(); 95 CompleteFlag = false; // pass once more as there should be a menu to come 96 } 97 } 33 98 } 99 100 /** Fills this menu with all Actions that belong to it. 101 */ 102 void Menu::populateActions() 103 { 104 // go through all actions and add those beloning to this menu 105 ActionRegistry &AR = ActionRegistry::getInstance(); 106 for (ActionRegistry::const_iterator iter = AR.getBeginIter(); 107 iter != AR.getEndIter(); 108 ++iter) { 109 const std::string &MenuName = iter->second->Traits.getMenuName(); 110 if (MenuName == name) { 111 const std::string &ActionName = iter->first; 112 Menu::addAction(ActionName); 113 } 114 } 115 } 116 117 void Menu::addAction(const std::string &ActionName) 118 { 119 LastItem = ActionItem; 120 addActionItem(ActionName, ActionName); 121 } 122 123 void Menu::addSeparator() 124 { 125 std::cout << "Creating separator at position " << TopPosition << std::endl; 126 ASSERT( LastItem != SeparatorItem, 127 "Menu::populate() - adding another separator after a separator!"); 128 LastItem = SeparatorItem; 129 addSeparatorItem(); 130 TopPosition++; 131 } 132 133 void Menu::addSubmenu(const std::string &MenuName, const int MenuPosition) 134 { 135 std::cout << "Creating top-level menu " << MenuName 136 << " at position " << TopPosition << std::endl; 137 ASSERT (!isPresent(MenuName), 138 "Menu::addSubmenu() - trying to add menu "+MenuName+" with already present token!"); 139 addSubmenuItem(MenuName, menudescriptions.getDescription(MenuName)); 140 DuplicatesList.insert(MenuName); 141 LastItem = MenuItem; 142 TopPosition = MenuPosition; 143 } 144 145 bool Menu::isPresent(const std::string &token) 146 { 147 return (DuplicatesList.find(token) != DuplicatesList.end()); 148 } -
src/UIElements/Menu/Menu.hpp
rb295ca r41e15b 9 9 #define MENU_MENU_H_ 10 10 11 using namespace std; 11 #include <set> 12 #include <string> 12 13 13 class MenuItem; 14 #include "Menu/MenuInterface.hpp" 15 #include "Menu/MenuDescription.hpp" 14 16 15 /** 16 * Base class for all Types of menus17 * contains basic abstract functionality to add Items, remove Items and display the menu17 /** Base class for all Types of menus. 18 * Here, we simply initialize the menus. Via the MenuInterface wrapper we may 19 * access the adding of items for each specific menu in a uniform manner. 18 20 * 19 * TODO: Make sure all items are only added once. 21 * Note that this Class is never to be used directly but only via derived 22 * specializations. 20 23 */ 21 class Menu 24 class Menu : virtual public MenuInterface 22 25 { 23 26 public: 24 Menu();27 explicit Menu(const std::string &name); 25 28 virtual ~Menu(); 26 29 30 void init(); 27 31 28 /** 29 * Adding and removing should be handled by the items. 30 */ 31 virtual void addItem(MenuItem*)=0; 32 /** 33 * Adding and removing should be handled by the items. 34 */ 35 virtual void removeItem(MenuItem*)=0; 36 virtual void display()=0; 32 protected: 33 // Unique name of the menu for identification. 34 const std::string name; 35 36 // populater function that adds all menu items 37 void populate(); 38 void populateActions(); 37 39 38 40 private: 41 void addAction(const std::string &ActionName); 42 void addSeparator(); 43 void addSubmenu(const std::string &MenuName, const int MenuPosition); 44 bool isPresent(const std::string &token); 45 46 enum ItemType {ActionItem, MenuItem, SeparatorItem, NoItem}; 47 48 int TopPosition; // current position to add 49 MenuDescription menudescriptions; // contains the menu tree and description to each item 50 enum ItemType LastItem; // check whether separator followed separator 51 std::set <std::string> DuplicatesList; // is used to check for duplicates 39 52 }; 40 53 -
src/UIElements/Menu/Qt4/QtMenu.hpp
rb295ca r41e15b 2 2 * QtMenu.hpp 3 3 * 4 * Created on: Jan 15, 20105 * Author: crueger4 * Created on: Nov 5, 2010 5 * Author: heber 6 6 */ 7 7 8 #ifndef QTMENU_HPP_9 #define QTMENU_HPP_8 #ifndef MENUINTERFACEQT_HPP_ 9 #define MENUINTERFACEQT_HPP_ 10 10 11 #include <Qt/qaction.h> 12 13 #include <iostream> 11 14 #include <list> 12 13 #include <QtGui/QMenu> 14 #include <QtCore/QObject> 15 #include <map> 16 #include <string> 15 17 16 18 #include "Menu/Menu.hpp" 19 #include "Menu/MenuInterface.hpp" 20 #include "Menu/Qt4/QtMenuPipe.hpp" 17 21 18 class QtMenuPipe; 22 /** QtMenu is a specialization of MenuInterface to Qt-like menus. 23 * I.e. with this interface we can access QMenu and QMenuBar. 24 * (The latter is the reason why we have to add this additional wrapping layer). 25 */ 26 template <class T> 27 class QtMenu : virtual public MenuInterface, public Menu 28 { 29 public: 30 explicit QtMenu(const std::string &_token) : 31 MenuInterface(_token), 32 Menu(_token), 33 MenuInstance(new T(QString(getNameWithAccelerator(_token).c_str()))), 34 deleteMenu(true) 35 {} 19 36 20 class QtMenu : public QMenu, public Menu 21 { 22 Q_OBJECT 37 QtMenu(T *_Menu, const std::string &_token) : 38 MenuInterface(_token), 39 Menu(_token), 40 MenuInstance(_Menu), 41 deleteMenu(false) 42 {} 23 43 24 public: 25 QtMenu(const char *); 26 virtual ~QtMenu(); 44 virtual ~QtMenu() 45 { 46 for(std::list<QtMenuPipe*>::iterator it=plumbing.begin(); it != plumbing.end(); it++) 47 delete (*it); 27 48 28 virtual void addItem(MenuItem*); 29 virtual void removeItem(MenuItem*); 30 virtual void display(); 49 if (deleteMenu) 50 delete MenuInstance; 51 } 52 53 T * const getMenuInstance() 54 { 55 return MenuInstance; 56 } 57 58 protected: 59 // We need to have a reference of the Menu, as Qt returns reference to added menu as well 60 T *MenuInstance; 61 62 /** Puts Qt's token, the ampersand, in front of the accelerator char in the menu name. 63 * \param ActionName Action of menu 64 * \return name with ampersand added at the right place 65 */ 66 std::string getNameWithAccelerator(const std::string &ActionName) 67 { 68 std::string newname; 69 bool Inserted = false; 70 std::pair < MenuShortcutMap::iterator, bool > Inserter; 71 for (std::string::const_iterator CharRunner = ActionName.begin(); 72 CharRunner != ActionName.end(); 73 ++CharRunner) { 74 std::cout << "Current char is " << *CharRunner << std::endl; 75 if (!Inserted) { 76 Inserter = ShortcutMap.insert( 77 std::pair<char, std::string > (*CharRunner, ActionName) 78 ); 79 if (Inserter.second) { 80 std::cout << "Accelerator is " << *CharRunner << std::endl; 81 newname += '&'; 82 Inserted = true; 83 } 84 } 85 newname += *CharRunner; 86 } 87 return newname; 88 } 89 31 90 private: 32 list<QtMenuPipe*> plumbing; 91 bool deleteMenu; 92 std::list<QtMenuPipe*> plumbing; 93 94 typedef std::map <char, std::string> MenuShortcutMap; 95 MenuShortcutMap ShortcutMap; 96 97 virtual void addActionItem(const std::string &token, const std::string &description) 98 { 99 QAction *action = MenuInstance->addAction(QString(getNameWithAccelerator(description).c_str())); 100 QtMenuPipe *pipe = new QtMenuPipe(token,action); 101 QObject::connect(action, SIGNAL(triggered()),pipe,SLOT(called())); 102 plumbing.push_back(pipe); 103 } 104 105 virtual void addSeparatorItem() 106 { 107 MenuInstance->addSeparator(); 108 } 109 110 virtual void addSubmenuItem(const std::string &token, const std::string &description) 111 { 112 QMenu *Menu = MenuInstance->addMenu(QString(token.c_str())); 113 QtMenu<QMenu> *NewMenu = new QtMenu<QMenu>(Menu, token); 114 NewMenu->init(); 115 } 116 33 117 }; 34 118 35 // This handles the plumbing from QT to internal Items 36 // Slots from QT are redirected to internal methods. 37 // This way methods can be used where no QT is available 38 class QtMenuPipe : public QObject { 39 Q_OBJECT 40 public: 41 QtMenuPipe(MenuItem*,QAction*); 42 virtual ~QtMenuPipe(); 43 public slots: 44 void called(); 45 private: 46 MenuItem *theItem; 47 QAction *theAction; 48 }; 49 50 #endif /* QTMENU_HPP_ */ 119 #endif /* MENUINTERFACEQT_HPP_ */ -
src/UIElements/Qt4/Pipe/AtomQtQueryPipe.cpp
rb295ca r41e15b 27 27 28 28 29 AtomQtQueryPipe::AtomQtQueryPipe( atom **_content, QtDialog *_dialog, QComboBox *_theBox) :29 AtomQtQueryPipe::AtomQtQueryPipe(const atom **_content, QtDialog *_dialog, QComboBox *_theBox) : 30 30 content(_content), 31 31 dialog(_dialog), -
src/UIElements/Qt4/Pipe/AtomsQtQueryPipe.cpp
rb295ca r41e15b 29 29 30 30 31 AtomsQtQueryPipe::AtomsQtQueryPipe(std::vector< atom *>*_content, QtDialog *_dialog, QListWidget *_theList) :31 AtomsQtQueryPipe::AtomsQtQueryPipe(std::vector<const atom *>*_content, QtDialog *_dialog, QListWidget *_theList) : 32 32 content(_content), 33 33 dialog(_dialog), … … 41 41 // clear target and put all atoms therein 42 42 (*content).clear(); 43 for (std::set< atom *>::iterator iter = currentList.begin(); iter != currentList.end(); ++iter)43 for (std::set<const atom *>::iterator iter = currentList.begin(); iter != currentList.end(); ++iter) 44 44 (*content).push_back(*iter); 45 45 dialog->update(); -
src/UIElements/Qt4/Pipe/MoleculeQtQueryPipe.cpp
rb295ca r41e15b 26 26 27 27 28 MoleculeQtQueryPipe::MoleculeQtQueryPipe( molecule **_content, QtDialog *_dialog, QComboBox *_theBox) :28 MoleculeQtQueryPipe::MoleculeQtQueryPipe(const molecule **_content, QtDialog *_dialog, QComboBox *_theBox) : 29 29 content(_content), 30 30 dialog(_dialog), -
src/UIElements/Qt4/Pipe/MoleculesQtQueryPipe.cpp
rb295ca r41e15b 28 28 29 29 30 MoleculesQtQueryPipe::MoleculesQtQueryPipe(std::vector< molecule *>*_content, QtDialog *_dialog, QComboBox *_theBox) :30 MoleculesQtQueryPipe::MoleculesQtQueryPipe(std::vector<const molecule *>*_content, QtDialog *_dialog, QComboBox *_theBox) : 31 31 content(_content), 32 32 dialog(_dialog), -
src/UIElements/Qt4/QtDialog.hpp
rb295ca r41e15b 445 445 Q_OBJECT 446 446 public: 447 AtomQtQueryPipe( atom **_content, QtDialog *_dialog, QComboBox *_theBox);447 AtomQtQueryPipe(const atom **_content, QtDialog *_dialog, QComboBox *_theBox); 448 448 virtual ~AtomQtQueryPipe(); 449 449 … … 452 452 453 453 private: 454 atom **content;454 const atom **content; 455 455 QtDialog *dialog; 456 456 QComboBox *theBox; … … 462 462 Q_OBJECT 463 463 public: 464 AtomsQtQueryPipe(std::vector< atom *>*_content, QtDialog *_dialog, QListWidget *_theList);464 AtomsQtQueryPipe(std::vector<const atom *>*_content, QtDialog *_dialog, QListWidget *_theList); 465 465 virtual ~AtomsQtQueryPipe(); 466 466 … … 471 471 472 472 private: 473 std::vector< atom *>*content;474 std::map<int, atom *> lookup;475 std::set< atom *> currentList;473 std::vector<const atom *>*content; 474 std::map<int, const atom *> lookup; 475 std::set<const atom *> currentList; 476 476 QtDialog *dialog; 477 477 QListWidget *theList; … … 482 482 Q_OBJECT 483 483 public: 484 MoleculeQtQueryPipe( molecule **_content, QtDialog *_dialog, QComboBox *_theBox);484 MoleculeQtQueryPipe(const molecule **_content, QtDialog *_dialog, QComboBox *_theBox); 485 485 virtual ~MoleculeQtQueryPipe(); 486 486 … … 489 489 490 490 private: 491 molecule **content;491 const molecule **content; 492 492 QtDialog *dialog; 493 493 QComboBox *theBox; … … 498 498 Q_OBJECT 499 499 public: 500 MoleculesQtQueryPipe(std::vector< molecule *>*_content, QtDialog *_dialog, QComboBox *_theBox);500 MoleculesQtQueryPipe(std::vector<const molecule *>*_content, QtDialog *_dialog, QComboBox *_theBox); 501 501 virtual ~MoleculesQtQueryPipe(); 502 502 … … 505 505 506 506 private: 507 std::vector< molecule *>*content;507 std::vector<const molecule *>*content; 508 508 QtDialog *dialog; 509 509 QComboBox *theBox; -
src/UIElements/Qt4/QtMainWindow.cpp
rb295ca r41e15b 38 38 #include "Actions/Action.hpp" 39 39 #include "Actions/ActionRegistry.hpp" 40 #include "Actions/MapOfActions.hpp" 41 #include "Menu/Menu.hpp" 40 #include "Actions/ValueStorage.hpp" 42 41 #include "Menu/Qt4/QtMenu.hpp" 43 #include "Menu/ActionMenuItem.hpp"44 42 #include "Views/Qt4/QtWorldView.hpp" 45 43 #include "Views/Qt4/GLMoleculeView.hpp" 46 44 #include "Views/Qt4/QtMoleculeView.hpp" 47 45 #include "Views/Qt4/QtStatusBar.hpp" 48 49 using namespace std;50 46 51 47 QtMainWindow::QtMainWindow(QApplication *_theApp) : … … 60 56 molecule3dDisplay = new GLMoleculeView(); 61 57 62 MenuBar = menuBar(); 63 64 std::map <std::string, QtMenu *> NametoTextMenuMap; 65 // go through all menus and create them 66 QtMenu *Menu = NULL; 67 for(std::map<std::string, std::pair<std::string,std::string> >::iterator iter = MapOfActions::getInstance().MenuDescription.begin(); iter != MapOfActions::getInstance().MenuDescription.end(); ++iter) { 68 cout << "Creating menu " << iter->first << endl; 69 Menu = new QtMenu(iter->first.c_str()); 70 MenuBar->addMenu(Menu); 71 NametoTextMenuMap.insert( pair <std::string, QtMenu *> (iter->first, Menu) ); 72 //new SubMenuItem(getSuitableShortForm(iter->first),iter->second.first,main_menu,Menu); 73 } 74 75 // populate all actions 76 MapOfActions::getInstance().populateActions(); 77 78 // go through all actions and add them to its menu 79 for (std::map <std::string, QtMenu *>::iterator MenuRunner = NametoTextMenuMap.begin(); MenuRunner != NametoTextMenuMap.end(); ++MenuRunner) { 80 cout << "Creating Action " << MenuRunner->first << " in menu " << MenuRunner->second << endl; 81 populateMenu(MenuRunner->second, MenuRunner->first); 82 } 58 MainMenu = new QtMenu<QMenuBar>(menuBar(), ""); 59 MainMenu->init(); 83 60 84 61 setCentralWidget(splitter1); … … 98 75 { 99 76 menuBar()->clear(); 100 delete editMoleculesMenu;101 77 } 102 78 … … 106 82 } 107 83 108 char QtMainWindow::getSuitableShortForm(set <char> &ShortcutList, const std::string name) const109 {110 for (std::string::const_iterator CharRunner = name.begin(); CharRunner != name.end(); ++CharRunner) {111 if (ShortcutList.find(*CharRunner) == ShortcutList.end())112 return *CharRunner;113 }114 DoeLog(1) && (eLog() << Verbose(1) << "Could not find a suitable shortform for TextWindow::getSuitableShortForm()." << endl);115 return ((char)(ShortcutList.size() % 10) + '0');116 }117 118 void QtMainWindow::populateMenu(QtMenu* Menu, const std::string &MenuName)119 {120 Action *ActionItem = NULL;121 set <char> ShortcutList;122 // through all actions for this menu123 std::pair < std::multimap <std::string, std::string>::iterator, std::multimap <std::string, std::string>::iterator > MenuActions = MapOfActions::getInstance().MenuContainsActionMap.equal_range(MenuName);124 for (std::multimap <std::string, std::string>::const_iterator MenuRunner = MenuActions.first; MenuRunner != MenuActions.second; ++MenuRunner) {125 cout << " Adding " << MenuRunner->second << " to submenu " << MenuName << endl;126 ActionItem = ActionRegistry::getInstance().getActionByName(MenuRunner->second);127 new ActionMenuItem(getSuitableShortForm(ShortcutList, MenuRunner->second),MapOfActions::getInstance().getDescription(MenuRunner->second).c_str(),Menu,ActionItem);128 }129 // finally add default quit item130 //Action *returnFromAction = new TextMenu::LeaveAction(Menu);131 //MenuItem *returnFromItem = new ActionMenuItem('q',"return to Main menu",Menu,returnFromAction);132 //Menu->addDefault(returnFromItem);133 } -
src/UIElements/Qt4/QtMainWindow.hpp
rb295ca r41e15b 12 12 #include <QtGui/QMainWindow> 13 13 14 #include <map> 14 15 #include <set> 16 17 #include "Menu/Qt4/QtMenu.hpp" 15 18 16 19 class QtWorldView; 17 20 class StringView; 18 class QtMenu;19 21 class GLMoleculeView; 20 22 class QtMoleculeView; … … 31 33 virtual void display(); 32 34 33 char getSuitableShortForm(std::set <char> &ShortcutList, const std::string name) const;34 void populateMenu(QtMenu* Menu, const std::string &MenuName);35 35 36 36 private: … … 38 38 QApplication *theApp; 39 39 QtWorldView *worldDisplay; 40 QtMenu *editMoleculesMenu;41 40 GLMoleculeView *molecule3dDisplay; 42 41 QtMoleculeView *moleculeDisplay; 43 42 QtStatusBar *statusBar; 44 Q MenuBar *MenuBar;43 QtMenu<QMenuBar> *MainMenu; 45 44 46 45 }; -
src/UIElements/TextUI/TextWindow.cpp
rb295ca r41e15b 21 21 22 22 #include <boost/bind.hpp> 23 #include <boost/shared_ptr.hpp> 23 24 24 #include "Menu/ Menu.hpp"25 #include "Menu/TextMenu .hpp"26 #include "Menu/ ActionMenuItem.hpp"27 #include "Menu/ SeperatorItem.hpp"28 #include "Menu/ DisplayMenuItem.hpp"29 #include "Menu/ SubMenuItem.hpp"25 #include "Menu/TextMenu/TextMenu.hpp" 26 #include "Menu/TextMenu/TxMenu.hpp" 27 #include "Menu/TextMenu/ActionMenuItem.hpp" 28 #include "Menu/TextMenu/SeperatorItem.hpp" 29 #include "Menu/TextMenu/DisplayMenuItem.hpp" 30 #include "Menu/TextMenu/SubMenuItem.hpp" 30 31 #include "TextUI/TextStatusIndicator.hpp" 31 32 #include "TextUI/TextWindow.hpp" 32 #include "Actions/MapOfActions.hpp"33 33 #include "Actions/MethodAction.hpp" 34 34 #include "Actions/ErrorAction.hpp" 35 35 #include "Actions/ActionRegistry.hpp" 36 #include "Actions/ActionTraits.hpp" 36 37 #include "Parser/ChangeTracker.hpp" 37 38 #include "Views/StreamStringView.hpp" … … 55 56 TextWindow::TextWindow() 56 57 { 57 map <std::string, TextMenu *> NametoTextMenuMap;58 std::set <char> ShortcutList;58 // build the main menu 59 main_menu = new TextMenu<TxMenu>(std::cout, ""); 59 60 // reserve s for save and q for quite 60 ShortcutList.insert('s'); 61 ShortcutList.insert('q'); 62 63 // populate all actions 64 MapOfActions::getInstance().populateActions(); 65 66 // build the main menu 67 main_menu = new TextMenu(Log() << Verbose(0), "Main Menu"); 61 main_menu->reserveShortcut('s', "output"); 62 main_menu->reserveShortcut('q', "quit"); 68 63 69 64 moleculeView = new StreamStringView(boost::bind(&MoleculeListClass::Enumerate,World::getInstance().getMolecules(),_1)); 70 new DisplayMenuItem(main_menu ,moleculeView,"Molecule List");65 new DisplayMenuItem(main_menu->getMenuInstance(),moleculeView,"Molecule List"); 71 66 72 new SeperatorItem(main_menu );67 new SeperatorItem(main_menu->getMenuInstance()); 73 68 74 Action* undoAction = ActionRegistry::getInstance().getActionByName("undo"); 75 new ActionMenuItem(getSuitableShortForm(ShortcutList,"Undo last operation"),"Undo last operation",main_menu,undoAction); 69 main_menu->init(); 76 70 77 Action* redoAction = ActionRegistry::getInstance().getActionByName("redo"); 78 new ActionMenuItem(getSuitableShortForm(ShortcutList,"Redo last operation"),"Redo last operation",main_menu,redoAction); 79 80 new SeperatorItem(main_menu); 81 82 for(map<std::string, pair<std::string,std::string> >::iterator iter = MapOfActions::getInstance().MenuDescription.begin(); iter != MapOfActions::getInstance().MenuDescription.end(); ++iter) { 83 TextMenu *Menu = new TextMenu(Log() << Verbose(0), iter->second.second); 84 NametoTextMenuMap.insert( pair <std::string, TextMenu *> (iter->first, Menu) ); 85 new SubMenuItem(getSuitableShortForm(ShortcutList,iter->first),iter->second.first.c_str(),main_menu,Menu); 86 } 87 88 new SeperatorItem(main_menu); 71 new SeperatorItem(main_menu->getMenuInstance()); 89 72 90 73 // save has reserved key 's' 91 Action *saveConfigAction = ActionRegistry::getInstance().getActionByName("output");92 new ActionMenuItem('s',"save current setup to config files",main_menu ,saveConfigAction);74 // Action *saveConfigAction = ActionRegistry::getInstance().getActionByName("output"); 75 new ActionMenuItem('s',"save current setup to config files",main_menu->getMenuInstance(),"output"); 93 76 94 quitAction = new MethodAction("quitAction",boost::bind(&TextMenu::doQuit,main_menu),false); 95 new ActionMenuItem('q',"quit",main_menu,quitAction); 96 97 // quit has reserved key 'q' 98 // go through all menus and create them 99 for (map <std::string, TextMenu *>::iterator MenuRunner = NametoTextMenuMap.begin(); MenuRunner != NametoTextMenuMap.end(); ++MenuRunner) 100 populateMenu(MenuRunner->second, MenuRunner->first); 77 // create a specific quit action for this UI and store in registry 78 ActionTraits quitTrait(OptionTrait("quit", &typeid(void), "quits the program")); 79 quitAction = new MethodAction(quitTrait,boost::bind(&TxMenu::doQuit,main_menu->getMenuInstance()),true); 80 new ActionMenuItem('q',"quit",main_menu->getMenuInstance(),"quit"); 101 81 102 82 // Add status indicators etc... 103 104 83 statusIndicator = new TextStatusIndicator(); 105 84 } … … 107 86 TextWindow::~TextWindow() 108 87 { 109 delete quitAction; 88 for (std::list<Action *>::iterator iter = returnFromActions.begin(); !returnFromActions.empty(); ++iter) 89 delete (*iter); 90 returnFromActions.clear(); 110 91 delete moleculeView; 111 92 delete statusIndicator; … … 117 98 } 118 99 119 char TextWindow::getSuitableShortForm(std::set <char> &ShortcutList, const std::string name) const120 {121 for (std::string::const_iterator CharRunner = name.begin(); CharRunner != name.end(); ++CharRunner) {122 if (ShortcutList.find(*CharRunner) == ShortcutList.end()) {123 ShortcutList.insert(*CharRunner);124 return *CharRunner;125 }126 }127 // if no letter matches, take digits128 int i=0;129 for (;i<10;++i) {130 if (ShortcutList.find((char)i + '0') == ShortcutList.end())131 break;132 }133 if (i != 10) {134 ShortcutList.insert((char)i + '0');135 return ((char)i + '0');136 } else {137 DoeLog(1) && (eLog() << Verbose(1) << "Could not find a suitable shortform for " << name << "." << endl);138 return '#';139 }140 }141 142 void TextWindow::populateMenu(TextMenu* Menu, const std::string &MenuName)143 {144 Action *ActionItem = NULL;145 set <char> ShortcutList;146 // reserve 'q' for quit147 ShortcutList.insert('q');148 // through all actions for this menu149 pair < multimap <std::string, std::string>::iterator, multimap <std::string, std::string>::iterator > MenuActions = MapOfActions::getInstance().MenuContainsActionMap.equal_range(MenuName);150 for (multimap <std::string, std::string>::const_iterator MenuRunner = MenuActions.first; MenuRunner != MenuActions.second; ++MenuRunner) {151 ActionItem = ActionRegistry::getInstance().getActionByName(MenuRunner->second);152 new ActionMenuItem(getSuitableShortForm(ShortcutList, MenuRunner->second),MapOfActions::getInstance().getDescription(MenuRunner->second).c_str(),Menu,ActionItem);153 }154 // finally add default quit item155 Action *returnFromAction = new TextMenu::LeaveAction(Menu);156 MenuItem *returnFromItem = new ActionMenuItem('q',"return to Main menu",Menu,returnFromAction);157 Menu->addDefault(returnFromItem);158 } -
src/UIElements/TextUI/TextWindow.hpp
rb295ca r41e15b 14 14 #include <set> 15 15 16 class TextMenu; 16 #include "Menu/TextMenu/TextMenu.hpp" 17 17 18 class Action; 18 19 class StringView; 19 20 class TextStatusIndicator; 21 class TxMenu; 20 22 21 23 … … 29 31 30 32 private: 31 // populaters 32 char getSuitableShortForm(std::set <char> &ShortcutList, const std::string name) const; 33 void populateMenu(TextMenu* Menu, const std::string &name); 34 35 TextMenu *main_menu; 33 TextMenu<TxMenu> *main_menu; 36 34 37 35 // some actions only needed in textMenus 36 std::list<Action *> returnFromActions; 38 37 Action *quitAction; 39 38 // all views that are contained in the main Menu -
src/World.cpp
rb295ca r41e15b 34 34 #include "Descriptors/MoleculeDescriptor_impl.hpp" 35 35 #include "Descriptors/SelectiveIterator_impl.hpp" 36 #include "Actions/ActionTraits.hpp" 36 37 #include "Actions/ManipulateAtomsProcess.hpp" 37 38 #include "Helpers/Assert.hpp" … … 245 246 246 247 ManipulateAtomsProcess* World::manipulateAtoms(boost::function<void(atom*)> op,std::string name,AtomDescriptor descr){ 247 return new ManipulateAtomsProcess(op, descr,name,true); 248 ActionTraits manipulateTrait(name); 249 return new ManipulateAtomsProcess(op, descr,manipulateTrait,false); 248 250 } 249 251 … … 535 537 } 536 538 537 void World::selectAtom(atom *atom){ 538 ASSERT(atom,"Invalid pointer in selection of atom"); 539 selectedAtoms[atom->getId()]=atom; 540 } 541 542 void World::selectAtom(atomId_t id){ 539 void World::selectAtom(const atom *_atom){ 540 // atom * is unchanged in this function, but we do store entity as changeable 541 ASSERT(_atom,"Invalid pointer in selection of atom"); 542 selectedAtoms[_atom->getId()]=const_cast<atom *>(_atom); 543 } 544 545 void World::selectAtom(const atomId_t id){ 543 546 ASSERT(atoms.count(id),"Atom Id selected that was not in the world"); 544 547 selectedAtoms[id]=atoms[id]; … … 548 551 internal_AtomIterator begin = getAtomIter_internal(descr); 549 552 internal_AtomIterator end = atomEnd_internal(); 550 void (World::*func)( atom*) = &World::selectAtom; // needed for type resolution of overloaded function553 void (World::*func)(const atom*) = &World::selectAtom; // needed for type resolution of overloaded function 551 554 for_each(begin,end,bind1st(mem_fun(func),this)); // func is select... see above 552 555 } 553 556 554 void World::selectAtomsOfMolecule( molecule *_mol){557 void World::selectAtomsOfMolecule(const molecule *_mol){ 555 558 ASSERT(_mol,"Invalid pointer to molecule in selection of Atoms of Molecule"); 556 559 // need to make it const to get the fast iterators 557 560 const molecule *mol = _mol; 558 void (World::*func)( atom*) = &World::selectAtom; // needed for type resolution of overloaded function561 void (World::*func)(const atom*) = &World::selectAtom; // needed for type resolution of overloaded function 559 562 for_each(mol->begin(),mol->end(),bind1st(mem_fun(func),this)); // func is select... see above 560 563 } 561 564 562 void World::selectAtomsOfMolecule( moleculeId_t id){565 void World::selectAtomsOfMolecule(const moleculeId_t id){ 563 566 ASSERT(molecules.count(id),"No molecule with the given id upon Selection of atoms from molecule"); 564 567 selectAtomsOfMolecule(molecules[id]); 565 568 } 566 569 567 void World::unselectAtom( atom *atom){568 ASSERT( atom,"Invalid pointer in unselection of atom");569 unselectAtom( atom->getId());570 } 571 572 void World::unselectAtom( atomId_t id){570 void World::unselectAtom(const atom *_atom){ 571 ASSERT(_atom,"Invalid pointer in unselection of atom"); 572 unselectAtom(_atom->getId()); 573 } 574 575 void World::unselectAtom(const atomId_t id){ 573 576 ASSERT(atoms.count(id),"Atom Id unselected that was not in the world"); 574 577 selectedAtoms.erase(id); … … 578 581 internal_AtomIterator begin = getAtomIter_internal(descr); 579 582 internal_AtomIterator end = atomEnd_internal(); 580 void (World::*func)( atom*) = &World::unselectAtom; // needed for type resolution of overloaded function583 void (World::*func)(const atom*) = &World::unselectAtom; // needed for type resolution of overloaded function 581 584 for_each(begin,end,bind1st(mem_fun(func),this)); // func is unselect... see above 582 585 } 583 586 584 void World::unselectAtomsOfMolecule( molecule *_mol){587 void World::unselectAtomsOfMolecule(const molecule *_mol){ 585 588 ASSERT(_mol,"Invalid pointer to molecule in selection of Atoms of Molecule"); 586 589 // need to make it const to get the fast iterators 587 590 const molecule *mol = _mol; 588 void (World::*func)( atom*) = &World::unselectAtom; // needed for type resolution of overloaded function591 void (World::*func)(const atom*) = &World::unselectAtom; // needed for type resolution of overloaded function 589 592 for_each(mol->begin(),mol->end(),bind1st(mem_fun(func),this)); // func is unsselect... see above 590 593 } 591 594 592 void World::unselectAtomsOfMolecule( moleculeId_t id){595 void World::unselectAtomsOfMolecule(const moleculeId_t id){ 593 596 ASSERT(molecules.count(id),"No molecule with the given id upon Selection of atoms from molecule"); 594 597 unselectAtomsOfMolecule(molecules[id]); … … 602 605 } 603 606 604 bool World::isSelected( atom *atom) const {605 return selectedAtoms.find( atom->getId()) != selectedAtoms.end();607 bool World::isSelected(const atom *_atom) const { 608 return selectedAtoms.find(_atom->getId()) != selectedAtoms.end(); 606 609 } 607 610 … … 622 625 } 623 626 624 void World::selectMolecule(molecule *mol){ 625 ASSERT(mol,"Invalid pointer to molecule in selection"); 626 selectedMolecules[mol->getId()]=mol; 627 } 628 629 void World::selectMolecule(moleculeId_t id){ 627 void World::selectMolecule(const molecule *_mol){ 628 // molecule * is unchanged in this function, but we do store entity as changeable 629 ASSERT(_mol,"Invalid pointer to molecule in selection"); 630 selectedMolecules[_mol->getId()]=const_cast<molecule *>(_mol); 631 } 632 633 void World::selectMolecule(const moleculeId_t id){ 630 634 ASSERT(molecules.count(id),"Molecule Id selected that was not in the world"); 631 635 selectedMolecules[id]=molecules[id]; … … 635 639 internal_MoleculeIterator begin = getMoleculeIter_internal(descr); 636 640 internal_MoleculeIterator end = moleculeEnd_internal(); 637 void (World::*func)( molecule*) = &World::selectMolecule; // needed for type resolution of overloaded function641 void (World::*func)(const molecule*) = &World::selectMolecule; // needed for type resolution of overloaded function 638 642 for_each(begin,end,bind1st(mem_fun(func),this)); // func is select... see above 639 643 } 640 644 641 void World::selectMoleculeOfAtom( atom *atom){642 ASSERT( atom,"Invalid atom pointer in selection of MoleculeOfAtom");643 molecule *mol= atom->getMolecule();645 void World::selectMoleculeOfAtom(const atom *_atom){ 646 ASSERT(_atom,"Invalid atom pointer in selection of MoleculeOfAtom"); 647 molecule *mol=_atom->getMolecule(); 644 648 // the atom might not be part of a molecule 645 649 if(mol){ … … 648 652 } 649 653 650 void World::selectMoleculeOfAtom( atomId_t id){654 void World::selectMoleculeOfAtom(const atomId_t id){ 651 655 ASSERT(atoms.count(id),"No such atom with given ID in selection of Molecules of Atom");\ 652 656 selectMoleculeOfAtom(atoms[id]); 653 657 } 654 658 655 void World::unselectMolecule( molecule *mol){656 ASSERT( mol,"invalid pointer in unselection of molecule");657 unselectMolecule( mol->getId());658 } 659 660 void World::unselectMolecule( moleculeId_t id){659 void World::unselectMolecule(const molecule *_mol){ 660 ASSERT(_mol,"invalid pointer in unselection of molecule"); 661 unselectMolecule(_mol->getId()); 662 } 663 664 void World::unselectMolecule(const moleculeId_t id){ 661 665 ASSERT(molecules.count(id),"No such molecule with ID in unselection"); 662 666 selectedMolecules.erase(id); … … 666 670 internal_MoleculeIterator begin = getMoleculeIter_internal(descr); 667 671 internal_MoleculeIterator end = moleculeEnd_internal(); 668 void (World::*func)( molecule*) = &World::unselectMolecule; // needed for type resolution of overloaded function672 void (World::*func)(const molecule*) = &World::unselectMolecule; // needed for type resolution of overloaded function 669 673 for_each(begin,end,bind1st(mem_fun(func),this)); // func is unselect... see above 670 674 } 671 675 672 void World::unselectMoleculeOfAtom( atom *atom){673 ASSERT( atom,"Invalid atom pointer in selection of MoleculeOfAtom");674 molecule *mol= atom->getMolecule();676 void World::unselectMoleculeOfAtom(const atom *_atom){ 677 ASSERT(_atom,"Invalid atom pointer in selection of MoleculeOfAtom"); 678 molecule *mol=_atom->getMolecule(); 675 679 // the atom might not be part of a molecule 676 680 if(mol){ … … 679 683 } 680 684 681 void World::unselectMoleculeOfAtom( atomId_t id){685 void World::unselectMoleculeOfAtom(const atomId_t id){ 682 686 ASSERT(atoms.count(id),"No such atom with given ID in selection of Molecules of Atom");\ 683 687 unselectMoleculeOfAtom(atoms[id]); … … 691 695 } 692 696 693 bool World::isSelected( molecule *mol) const {694 return selectedMolecules.find( mol->getId()) != selectedMolecules.end();697 bool World::isSelected(const molecule *_mol) const { 698 return selectedMolecules.find(_mol->getId()) != selectedMolecules.end(); 695 699 } 696 700 -
src/World.hpp
rb295ca r41e15b 19 19 20 20 #include "types.hpp" 21 #include "Actions/ActionTraits.hpp" 21 22 #include "Descriptors/SelectiveIterator.hpp" 22 23 #include "Patterns/Observer.hpp" … … 111 112 * menus, be kept around for later use etc. 112 113 */ 113 template<typename T> AtomsCalculation<T>* calcOnAtoms(boost::function<T(atom*)>, std::string,AtomDescriptor);114 template<typename T> AtomsCalculation<T>* calcOnAtoms(boost::function<T(atom*)>, std::string);114 template<typename T> AtomsCalculation<T>* calcOnAtoms(boost::function<T(atom*)>,const ActionTraits &_trait,AtomDescriptor); 115 template<typename T> AtomsCalculation<T>* calcOnAtoms(boost::function<T(atom*)>,const ActionTraits &_trait); 115 116 116 117 /** … … 269 270 /******** Selections of molecules and Atoms *************/ 270 271 void clearAtomSelection(); 271 void selectAtom( atom*);272 void selectAtom( atomId_t);272 void selectAtom(const atom*); 273 void selectAtom(const atomId_t); 273 274 void selectAllAtoms(AtomDescriptor); 274 void selectAtomsOfMolecule( molecule*);275 void selectAtomsOfMolecule( moleculeId_t);276 void unselectAtom( atom*);277 void unselectAtom( atomId_t);275 void selectAtomsOfMolecule(const molecule*); 276 void selectAtomsOfMolecule(const moleculeId_t); 277 void unselectAtom(const atom*); 278 void unselectAtom(const atomId_t); 278 279 void unselectAllAtoms(AtomDescriptor); 279 void unselectAtomsOfMolecule( molecule*);280 void unselectAtomsOfMolecule( moleculeId_t);280 void unselectAtomsOfMolecule(const molecule*); 281 void unselectAtomsOfMolecule(const moleculeId_t); 281 282 size_t countSelectedAtoms() const; 282 bool isSelected( atom *_atom) const;283 bool isSelected(const atom *_atom) const; 283 284 const std::vector<atom *> getSelectedAtoms() const; 284 285 285 286 void clearMoleculeSelection(); 286 void selectMolecule( molecule*);287 void selectMolecule( moleculeId_t);287 void selectMolecule(const molecule*); 288 void selectMolecule(const moleculeId_t); 288 289 void selectAllMolecules(MoleculeDescriptor); 289 void selectMoleculeOfAtom( atom*);290 void selectMoleculeOfAtom( atomId_t);291 void unselectMolecule( molecule*);292 void unselectMolecule( moleculeId_t);290 void selectMoleculeOfAtom(const atom*); 291 void selectMoleculeOfAtom(const atomId_t); 292 void unselectMolecule(const molecule*); 293 void unselectMolecule(const moleculeId_t); 293 294 void unselectAllMolecules(MoleculeDescriptor); 294 void unselectMoleculeOfAtom( atom*);295 void unselectMoleculeOfAtom( atomId_t);295 void unselectMoleculeOfAtom(const atom*); 296 void unselectMoleculeOfAtom(const atomId_t); 296 297 size_t countSelectedMolecules() const; 297 bool isSelected( molecule *_mol) const;298 bool isSelected(const molecule *_mol) const; 298 299 const std::vector<molecule *> getSelectedMolecules() const; 299 300 -
src/World_calculations.hpp
rb295ca r41e15b 14 14 15 15 template<typename T> 16 AtomsCalculation<T>* World::calcOnAtoms(boost::function<T(atom*)> op, std::string name,AtomDescriptor descr){17 return new AtomsCalculation<T>(op, name,descr);16 AtomsCalculation<T>* World::calcOnAtoms(boost::function<T(atom*)> op,const ActionTraits &_trait,AtomDescriptor descr){ 17 return new AtomsCalculation<T>(op,_trait,descr); 18 18 } 19 19 20 20 template<typename T> 21 AtomsCalculation<T>* World::calcOnAtoms(boost::function<T(atom*)> op, std::string name) {22 return calcOnAtoms<T>(op, name,AllAtoms());21 AtomsCalculation<T>* World::calcOnAtoms(boost::function<T(atom*)> op,const ActionTraits &_trait) { 22 return calcOnAtoms<T>(op,_trait,AllAtoms()); 23 23 } 24 24 -
src/builder.cpp
rb295ca r41e15b 76 76 77 77 #include "bondgraph.hpp" 78 #include "CommandLineParser.hpp"79 78 #include "config.hpp" 80 79 #include "Helpers/Log.hpp" … … 85 84 #include "UIElements/TextUI/TextUIFactory.hpp" 86 85 #include "UIElements/CommandLineUI/CommandLineUIFactory.hpp" 86 #include "UIElements/CommandLineUI/CommandLineParser.hpp" 87 87 #ifdef USE_GUI_QT 88 88 #include "UIElements/Qt4/QtUIFactory.hpp" … … 90 90 #include "UIElements/MainWindow.hpp" 91 91 #include "UIElements/Dialog.hpp" 92 #include "Menu/ActionMenuItem.hpp"92 //#include "Menu/ActionMenuItem.hpp" 93 93 #include "Helpers/Verbose.hpp" 94 94 #include "World.hpp" … … 96 96 #include "Actions/ActionRegistry.hpp" 97 97 #include "Actions/ActionHistory.hpp" 98 #include "Actions/MapOfActions.hpp"99 98 100 99 #include "Parser/ChangeTracker.hpp" … … 119 118 errorLogger::purgeInstance(); 120 119 UIFactory::purgeInstance(); 121 MapOfActions::purgeInstance();120 ValueStorage::purgeInstance(); 122 121 CommandLineParser::purgeInstance(); 123 122 ActionRegistry::purgeInstance(); 123 OptionRegistry::purgeInstance(); 124 124 ActionHistory::purgeInstance(); 125 125 #ifdef LOG_OBSERVER … … 174 174 // handle remaining arguments by CommandLineParser 175 175 if (argc>1) { 176 MapOfActions::getInstance().AddOptionsToParser(); 177 map <std::string, std::string> ShortFormToActionMap = MapOfActions::getInstance().getShortFormToActionMap(); 178 CommandLineParser::getInstance().Run(argc,argv, ShortFormToActionMap); 176 CommandLineParser::getInstance().InitializeCommandArguments(); 177 CommandLineParser::getInstance().Run(argc,argv); 179 178 DoLog(0) && (Log() << Verbose(0) << "Setting UI to CommandLine." << endl); 180 179 UIFactory::registerFactory(new CommandLineUIFactory::description()); -
src/molecule.cpp
rb295ca r41e15b 640 640 * \return copy of molecule 641 641 */ 642 molecule *molecule::CopyMolecule() 642 molecule *molecule::CopyMolecule() const 643 643 { 644 644 molecule *copy = World::getInstance().createMolecule(); … … 648 648 649 649 // copy all bonds 650 for(molecule:: iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)651 for(BondList:: iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner)650 for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) 651 for(BondList::const_iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner) 652 652 if ((*BondRunner)->leftatom == *AtomRunner) { 653 653 bond *Binder = (*BondRunner); … … 874 874 * \param *out output stream 875 875 */ 876 bool molecule::Output(ostream * const output) 876 bool molecule::Output(ostream * const output) const 877 877 { 878 878 if (output == NULL) { … … 891 891 * \param *out output stream 892 892 */ 893 bool molecule::OutputTrajectories(ofstream * const output) 893 bool molecule::OutputTrajectories(ofstream * const output) const 894 894 { 895 895 if (output == NULL) { -
src/molecule.hpp
rb295ca r41e15b 66 66 struct EvaluatePotential 67 67 { 68 int startstep; 69 int endstep; 70 atom **PermutationMap; 68 int startstep; //!< start configuration (MDStep in atom::trajectory) 69 int endstep; //!< end configuration (MDStep in atom::trajectory) 70 atom **PermutationMap; //!< gives target ptr for each atom, array of size molecule::AtomCount (this is "x" in \f$ V^{con}(x) \f$ ) 71 71 DistanceMap **DistanceList; //!< distance list of each atom to each atom 72 72 DistanceMap::iterator *StepList; //!< iterator to ascend through NearestNeighbours \a **DistanceList 73 int *DoubleList; 73 int *DoubleList; //!< count of which sources want to move to this target, basically the injective measure (>1 -> not injective) 74 74 DistanceMap::iterator *DistanceIterators; //!< marks which was the last picked target as injective candidate with smallest distance 75 bool IsAngstroem; 76 double *PenaltyConstants; 75 bool IsAngstroem; //!< whether coordinates are in angstroem (true) or bohrradius (false) 76 double *PenaltyConstants; //!< penalty constant in front of each term 77 77 }; 78 78 … … 80 80 * Class incorporates number of types 81 81 */ 82 class molecule : public PointCloud , public Observable { 82 class molecule : public PointCloud, public Observable 83 { 83 84 friend molecule *NewMolecule(); 84 85 friend void DeleteMolecule(molecule *); 85 86 86 87 88 89 90 91 92 93 94 95 96 97 98 int MDSteps;//!< The number of MD steps in Trajectories99 100 int BondCount;//!< number of atoms, brought up-to-date by CountBonds()101 mutable int NoNonHydrogen;//!< number of non-hydrogen atoms in molecule102 mutable int NoNonBonds;//!< number of non-hydrogen bonds in molecule103 mutable int NoCyclicBonds;//!< number of cyclic bonds in molecule, by DepthFirstSearchAnalysis()104 double BondDistance;//!< typical bond distance used in CreateAdjacencyList() and furtheron105 bool ActiveFlag;//!< in a MoleculeListClass used to discern active from inactive molecules106 107 int IndexNr;//!< index of molecule in a MoleculeListClass108 char name[MAXSTRINGSIZE];//!< arbitrary name109 110 111 112 Cacheable<int>AtomCount;113 114 115 116 117 118 119 87 public: 88 typedef ATOMSET(std::list) atomSet; 89 typedef std::set<atomId_t> atomIdSet; 90 typedef ObservedIterator<atomSet> iterator; 91 typedef atomSet::const_iterator const_iterator; 92 93 const periodentafel * const elemente; //!< periodic table with each element 94 // old deprecated atom handling 95 //atom *start; //!< start of atom list 96 //atom *end; //!< end of atom list 97 //bond *first; //!< start of bond list 98 //bond *last; //!< end of bond list 99 int MDSteps; //!< The number of MD steps in Trajectories 100 //int AtomCount; //!< number of atoms, brought up-to-date by CountAtoms() 101 int BondCount; //!< number of atoms, brought up-to-date by CountBonds() 102 mutable int NoNonHydrogen; //!< number of non-hydrogen atoms in molecule 103 mutable int NoNonBonds; //!< number of non-hydrogen bonds in molecule 104 mutable int NoCyclicBonds; //!< number of cyclic bonds in molecule, by DepthFirstSearchAnalysis() 105 double BondDistance; //!< typical bond distance used in CreateAdjacencyList() and furtheron 106 bool ActiveFlag; //!< in a MoleculeListClass used to discern active from inactive molecules 107 //Vector Center; //!< Center of molecule in a global box 108 int IndexNr; //!< index of molecule in a MoleculeListClass 109 char name[MAXSTRINGSIZE]; //!< arbitrary name 110 111 private: 112 Formula formula; 113 Cacheable<int> AtomCount; 114 moleculeId_t id; 115 atomSet atoms; //<!list of atoms 116 atomIdSet atomIds; //<!set of atomic ids to check uniqueness of atoms 117 protected: 118 //void CountAtoms(); 119 /** 120 * this iterator type should be used for internal variables, \ 120 121 * since it will not lock 121 */ 122 typedef atomSet::iterator internal_iterator; 123 124 125 molecule(const periodentafel * const teil); 126 virtual ~molecule(); 127 122 */ 123 typedef atomSet::iterator internal_iterator; 124 125 molecule(const periodentafel * const teil); 126 virtual ~molecule(); 128 127 129 128 public: … … 151 150 bool empty() const; 152 151 size_t size() const; 153 const_iterator erase( const_iterator loc);154 const_iterator erase( atom * key);155 const_iterator find ( atom * key) const;156 pair<iterator, bool> insert ( atom * const key);152 const_iterator erase(const_iterator loc); 153 const_iterator erase(atom * key); 154 const_iterator find(atom * key) const; 155 pair<iterator, bool> insert(atom * const key); 157 156 bool containsAtom(atom* key); 158 159 157 160 158 // re-definition of virtual functions from PointCloud 161 159 const char * const GetName() const; 162 Vector *GetCenter() const 163 TesselPoint *GetPoint() const 160 Vector *GetCenter() const; 161 TesselPoint *GetPoint() const; 164 162 int GetMaxId() const; 165 void GoToNext() const 166 void GoToFirst() const 167 bool IsEmpty() const 168 bool IsEnd() const 163 void GoToNext() const; 164 void GoToFirst() const; 165 bool IsEmpty() const; 166 bool IsEnd() const; 169 167 170 168 /// remove atoms from molecule. … … 181 179 bool RemoveBond(bond *pointer); 182 180 bool RemoveBonds(atom *BondPartner); 183 bool hasBondStructure() ;181 bool hasBondStructure() const; 184 182 unsigned int CountBonds() const; 185 183 … … 213 211 double MinimiseConstrainedPotential(atom **&permutation, int startstep, int endstep, bool IsAngstroem); 214 212 void EvaluateConstrainedForces(int startstep, int endstep, atom **PermutationMap, ForceMatrix *Force); 215 bool LinearInterpolationBetweenConfiguration(int startstep, int endstep, std::string &prefix, config &configuration, bool MapByIdentity);216 213 bool LinearInterpolationBetweenConfiguration(int startstep, int endstep, std::string prefix, config &configuration, bool MapByIdentity); 214 217 215 bool CheckBounds(const Vector *x) const; 218 216 void GetAlignvector(struct lsq_params * par) const; … … 220 218 /// Initialising routines in fragmentation 221 219 void CreateAdjacencyListFromDbondFile(ifstream *output); 222 void CreateAdjacencyList(double bonddistance, bool IsAngstroem, void 220 void CreateAdjacencyList(double bonddistance, bool IsAngstroem, void(BondGraph::*f)(BondedParticle * const , BondedParticle * const , double &, double &, bool), BondGraph *BG = NULL); 223 221 int CorrectBondDegree() const; 224 222 void OutputBondsList() const; … … 226 224 void OutputGraphInfoPerAtom() const; 227 225 void OutputGraphInfoPerBond() const; 228 229 226 230 227 // Graph analysis … … 240 237 bond * CopyBond(atom *left, atom *right, bond *CopyBond); 241 238 242 243 molecule *CopyMolecule(); 239 molecule *CopyMolecule() const; 244 240 molecule* CopyMoleculeFromSubRegion(const Shape&) const; 245 241 … … 247 243 int FragmentMolecule(int Order, std::string &prefix); 248 244 bool CheckOrderAtSite(bool *AtomMask, Graph *GlobalKeySetList, int Order, int *MinimumRingSize, std::string path = ""); 249 bool StoreBondsToFile(std::string &filename, std::string path = "");250 bool StoreAdjacencyToFile(std::string &filename, std::string path = "");245 bool StoreBondsToFile(std::string filename, std::string path = ""); 246 bool StoreAdjacencyToFile(std::string filename, std::string path = ""); 251 247 bool CheckAdjacencyFileAgainstMolecule(std::string &path, atom **ListOfAtoms); 252 248 bool ParseOrderAtSiteFromFile(std::string &path); … … 269 265 270 266 // Output routines. 271 bool Output(std::ostream * const output) ;272 bool OutputTrajectories(ofstream * const output) ;267 bool Output(std::ostream * const output) const; 268 bool OutputTrajectories(ofstream * const output) const; 273 269 void OutputListOfBonds() const; 274 270 bool OutputXYZ(ofstream * const output) const; … … 280 276 void flipActiveFlag(); 281 277 282 278 private: 283 279 void init_DFS(struct DFSAccounting&) const; 284 int last_atom; 285 mutable internal_iterator InternalPointer; 280 int last_atom; //!< number given to last atom 281 mutable internal_iterator InternalPointer; //!< internal pointer for PointCloud 286 282 }; 287 283 … … 291 287 /** A list of \a molecule classes. 292 288 */ 293 class MoleculeListClass : public Observable { 294 public: 295 MoleculeList ListOfMolecules; //!< List of the contained molecules 296 int MaxIndex; 289 class MoleculeListClass : public Observable 290 { 291 public: 292 MoleculeList ListOfMolecules; //!< List of the contained molecules 293 int MaxIndex; 297 294 298 295 MoleculeListClass(World *world); … … 318 315 void eraseMolecule(); 319 316 320 317 private: 321 318 World *world; //!< The world this List belongs to. Needed to avoid deadlocks in the destructor 322 319 }; 323 320 324 325 321 /** A leaf for a tree of \a molecule class 326 322 * Wraps molecules in a tree structure 327 323 */ 328 class MoleculeLeafClass { 329 public: 330 molecule *Leaf; //!< molecule of this leaf 331 //MoleculeLeafClass *UpLeaf; //!< Leaf one level up 332 //MoleculeLeafClass *DownLeaf; //!< First leaf one level down 333 MoleculeLeafClass *previous; //!< Previous leaf on this level 334 MoleculeLeafClass *next; //!< Next leaf on this level 324 class MoleculeLeafClass 325 { 326 public: 327 molecule *Leaf; //!< molecule of this leaf 328 //MoleculeLeafClass *UpLeaf; //!< Leaf one level up 329 //MoleculeLeafClass *DownLeaf; //!< First leaf one level down 330 MoleculeLeafClass *previous; //!< Previous leaf on this level 331 MoleculeLeafClass *next; //!< Next leaf on this level 335 332 336 333 //MoleculeLeafClass(MoleculeLeafClass *Up, MoleculeLeafClass *Previous); … … 347 344 }; 348 345 349 350 346 #endif /*MOLECULES_HPP_*/ 351 347 -
src/molecule_dynamics.cpp
rb295ca r41e15b 498 498 * \return true - success in writing step files, false - error writing files or only one step in molecule::Trajectories 499 499 */ 500 bool molecule::LinearInterpolationBetweenConfiguration(int startstep, int endstep, std::string &prefix, config &configuration, bool MapByIdentity)500 bool molecule::LinearInterpolationBetweenConfiguration(int startstep, int endstep, std::string prefix, config &configuration, bool MapByIdentity) 501 501 { 502 502 // TODO: rewrite permutationMaps using enumeration objects -
src/molecule_graph.cpp
rb295ca r41e15b 233 233 * \return true - bonds present, false - no bonds 234 234 */ 235 bool molecule::hasBondStructure() 236 { 237 for(molecule:: iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)235 bool molecule::hasBondStructure() const 236 { 237 for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) 238 238 if (!(*AtomRunner)->ListOfBonds.empty()) 239 239 return true; … … 1056 1056 * \return true - file written successfully, false - writing failed 1057 1057 */ 1058 bool molecule::StoreAdjacencyToFile(std::string &filename, std::string path)1058 bool molecule::StoreAdjacencyToFile(std::string filename, std::string path) 1059 1059 { 1060 1060 ofstream AdjacencyFile; … … 1088 1088 * \return true - file written successfully, false - writing failed 1089 1089 */ 1090 bool molecule::StoreBondsToFile(std::string &filename, std::string path)1090 bool molecule::StoreBondsToFile(std::string filename, std::string path) 1091 1091 { 1092 1092 ofstream BondFile; -
src/unittests/ActionSequenceTest.cpp
rb295ca r41e15b 44 44 { 45 45 public: 46 canUndoActionStub(): Action("canUndoActionStub",false){} 46 canUndoActionStub(const ActionTraits &_trait): 47 Action(_trait,false){} 47 48 virtual ~canUndoActionStub(){} 48 49 … … 75 76 { 76 77 public: 77 cannotUndoActionStub() : Action("cannotUndoActionStub",false){} 78 cannotUndoActionStub(const ActionTraits &_trait) : 79 Action(_trait,false){} 78 80 virtual ~cannotUndoActionStub(){} 79 81 … … 106 108 { 107 109 public: 108 wasCalledActionStub( ) :109 Action( "wasCalledActionStub",false),110 wasCalledActionStub(const ActionTraits &_trait) : 111 Action(_trait,false), 110 112 called(false) 111 113 {} … … 153 155 UIFactory::makeUserInterface("Dummy"); 154 156 // create some necessary stubs used in this test 155 positive1 = new canUndoActionStub(); 156 positive2 = new canUndoActionStub(); 157 negative1 = new cannotUndoActionStub(); 158 negative2 = new cannotUndoActionStub(); 159 160 shouldCall1 = new wasCalledActionStub(); 161 shouldCall2 = new wasCalledActionStub(); 162 shouldNotCall1 = new wasCalledActionStub(); 163 shouldNotCall2 = new wasCalledActionStub(); 157 ActionTraits canUndoTrait("canUndoActionStub"); 158 ActionTraits cannotUndoTrait("cannotUndoActionStub"); 159 positive1 = new canUndoActionStub(canUndoTrait); 160 positive2 = new canUndoActionStub(canUndoTrait); 161 negative1 = new cannotUndoActionStub(cannotUndoTrait); 162 negative2 = new cannotUndoActionStub(cannotUndoTrait); 163 164 ActionTraits wasCalledTrait("wasCalledActionStub"); 165 shouldCall1 = new wasCalledActionStub(wasCalledTrait); 166 shouldCall2 = new wasCalledActionStub(wasCalledTrait); 167 shouldNotCall1 = new wasCalledActionStub(wasCalledTrait); 168 shouldNotCall2 = new wasCalledActionStub(wasCalledTrait); 164 169 165 170 } … … 254 259 void ActionSequenceTest::doesUndoTest(){ 255 260 ActionSequence *sequence = new ActionSequence(); 256 wasCalledActionStub *wasCalled1 = new wasCalledActionStub(); 257 wasCalledActionStub *wasCalled2 = new wasCalledActionStub(); 261 ActionTraits wasCalledTrait("wasCalledActionStub"); 262 wasCalledActionStub *wasCalled1 = new wasCalledActionStub(wasCalledTrait); 263 wasCalledActionStub *wasCalled2 = new wasCalledActionStub(wasCalledTrait); 258 264 sequence->addAction(wasCalled1); 259 265 sequence->addAction(wasCalled2); 260 266 261 MakroAction act("Test MakroAction",sequence,false); 267 ActionTraits MakroTrait("Test MakroAction"); 268 MakroAction act(MakroTrait,sequence,false); 262 269 263 270 act.call(); -
src/unittests/Makefile.am
rb295ca r41e15b 32 32 manipulateAtomsTest \ 33 33 MatrixUnittest \ 34 MenuDescriptionUnitTest \ 34 35 MoleculeDescriptorTest \ 35 36 ObserverTest \ … … 37 38 periodentafelTest \ 38 39 PlaneUnittest \ 40 Registry \ 39 41 ShapeUnittest \ 40 42 SingletonTest \ … … 90 92 MatrixUnittest.cpp \ 91 93 manipulateAtomsTest.cpp \ 94 MenuDescriptionUnitTest.cpp \ 92 95 MoleculeDescriptorTest.cpp \ 93 96 ObserverTest.cpp \ … … 95 98 periodentafelTest.cpp \ 96 99 PlaneUnittest.cpp \ 100 RegistryUnitTest.cpp \ 97 101 ShapeUnittest.cpp \ 98 102 SingletonTest.cpp \ … … 128 132 manipulateAtomsTest.hpp \ 129 133 MatrixUnittest.hpp \ 134 MenuDescriptionUnitTest.hpp \ 130 135 MoleculeDescriptorTest.hpp \ 136 ObserverTest.hpp \ 131 137 periodentafelTest.hpp \ 132 138 ParserUnitTest.hpp \ 133 139 PlaneUnittest.hpp \ 134 ObserverTest.hpp \140 RegistryUnitTest.hpp \ 135 141 SingletonTest.hpp \ 136 142 stackclassunittest.hpp \ … … 213 219 MatrixUnittest_LDADD = ${ALLLIBS} 214 220 221 MenuDescriptionUnitTest_SOURCES = UnitTestMain.cpp MenuDescriptionUnitTest.cpp MenuDescriptionUnitTest.hpp 222 MenuDescriptionUnitTest_LDADD = ${ALLLIBS} 223 215 224 MoleculeDescriptorTest_SOURCES = UnitTestMain.cpp MoleculeDescriptorTest.cpp MoleculeDescriptorTest.hpp 216 225 MoleculeDescriptorTest_LDADD = ${ALLLIBS} … … 228 237 PlaneUnittest_LDADD = ${ALLLIBS} 229 238 239 Registry_SOURCES = UnitTestMain.cpp RegistryUnitTest.cpp RegistryUnitTest.hpp 240 Registry_LDADD = ${ALLLIBS} 241 230 242 ShapeUnittest_SOURCES = UnitTestMain.cpp ShapeUnittest.cpp ShapeUnittest.hpp 231 243 ShapeUnittest_LDADD = ${ALLLIBS} -
src/unittests/atomsCalculationTest.cpp
rb295ca r41e15b 31 31 #include "Actions/AtomsCalculation_impl.hpp" 32 32 #include "Actions/ActionRegistry.hpp" 33 #include "Actions/ActionTraits.hpp" 33 34 34 35 #include "World.hpp" … … 88 89 89 90 void atomsCalculationTest::testCalculateSimple(){ 90 AtomsCalculation<atomId_t> *calc = World::getInstance().calcOnAtoms<atomId_t>(boost::bind(&atom::getId,_1),"FOO",AllAtoms()); 91 ActionTraits FooTrait("FOO"); 92 AtomsCalculation<atomId_t> *calc = World::getInstance().calcOnAtoms<atomId_t>(boost::bind(&atom::getId,_1),FooTrait,AllAtoms()); 91 93 std::vector<atomId_t> allIds = (*calc)(); 92 94 CPPUNIT_ASSERT(hasAllIds(allIds,atomIds)); … … 95 97 96 98 void atomsCalculationTest::testCalculateExcluded(){ 99 ActionTraits FooTrait("FOO"); 97 100 atomId_t excluded = atomIds[ATOM_COUNT/2]; 98 AtomsCalculation<atomId_t> *calc = World::getInstance().calcOnAtoms<atomId_t>(boost::bind(&atom::getId,_1), "FOO",AllAtoms() && !AtomById(excluded));101 AtomsCalculation<atomId_t> *calc = World::getInstance().calcOnAtoms<atomId_t>(boost::bind(&atom::getId,_1),FooTrait,AllAtoms() && !AtomById(excluded)); 99 102 std::vector<atomId_t> allIds = (*calc)(); 100 103 std::set<atomId_t> excluded_set; -
tests/regression/testsuite-simple_configuration.at
rb295ca r41e15b 26 26 AT_SETUP([Simple configuration - adding atom]) 27 27 AT_KEYWORDS([configuration]) 28 AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ -o mpqc pcp xyz -a 1 -- position "10., 10., 10."], 0, [ignore], [ignore])28 AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ -o mpqc pcp xyz -a 1 --domain-position "10., 10., 10."], 0, [ignore], [ignore]) 29 29 AT_CHECK([file=test.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore]) 30 30 AT_CHECK([file=test.in; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore]) 31 31 AT_CHECK([file=test.xyz; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore]) 32 AT_CHECK([../../molecuilder -i test2.conf -e ${abs_top_srcdir}/src/ -o mpqc pcp xyz -a 1 -- position "0., 0., -1."], 134, [ignore], [ignore])32 AT_CHECK([../../molecuilder -i test2.conf -e ${abs_top_srcdir}/src/ -o mpqc pcp xyz -a 1 --domain-position "0., 0., -1."], 134, [ignore], [ignore]) 33 33 AT_CLEANUP 34 34 AT_SETUP([Simple configuration - adding atom with Undo/Redo]) 35 35 AT_KEYWORDS([configuration]) 36 AT_CHECK([../../molecuilder -i empty.conf -o pcp -a 1 -- position "10., 10., 10." --undo], 0, [ignore], [ignore])36 AT_CHECK([../../molecuilder -i empty.conf -o pcp -a 1 --domain-position "10., 10., 10." --undo], 0, [ignore], [ignore]) 37 37 AT_CHECK([file=empty.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore]) 38 AT_CHECK([../../molecuilder -i test.conf -o mpqc pcp xyz -a 1 -- position "10., 10., 10." --undo --redo], 0, [ignore], [ignore])38 AT_CHECK([../../molecuilder -i test.conf -o mpqc pcp xyz -a 1 --domain-position "10., 10., 10." --undo --redo], 0, [ignore], [ignore]) 39 39 AT_CHECK([file=test.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore]) 40 40 AT_CHECK([file=test.in; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore])
Note:
See TracChangeset
for help on using the changeset viewer.