Changes in / [b1d8092:7ba324]
- Files:
-
- 2 added
- 17 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
configure.ac
rb1d8092 r7ba324 27 27 28 28 # Boost libraries 29 AX_BOOST_BASE([1.33.1])29 #AX_BOOST_BASE([1.33.1]) 30 30 #AX_BOOST_PROGRAM_OPTIONS 31 31 #AX_BOOST_FOREACH 32 32 #AX_BOOST_FILESYSTEM 33 AX_BOOST_THREAD33 #AX_BOOST_THREAD 34 34 #AX_BOOST_PROGRAM_OPTIONS 35 35 #AX_BOOST_SERIALIZATION -
src/Makefile.am
rb1d8092 r7ba324 12 12 13 13 PATTERNSOURCE = Patterns/Observer.cpp 14 PATTERNHEADER = Patterns/Observer.hpp Patterns/Cacheable.hpp14 PATTERNHEADER = Patterns/Observer.hpp 15 15 16 16 VIEWSOURCE = Views/View.cpp Views/StringView.cpp Views/MethodStringView.cpp Views/StreamStringView.cpp … … 23 23 UIHEADER = ${ACTIONSHEADER} ${VIEWHEADER} ${MENUHEADER} UIElements/TextUIFactory.hpp UIElements/MainWindow.hpp UIElements/TextWindow.hpp UIElements/Dialog.hpp UIElements/TextDialog.hpp 24 24 25 26 25 FACTORYSOURCE = UIElements/UIFactory.cpp 27 26 FACTORYHEADER = UIElements/UIFactory.hpp 28 27 29 # all these files are only used for legacy reasons while the transition is in progress30 # they are only needed to keep the program usable at any point of the transition and will be31 # deleted once everything is fully refactored32 LEGACYSOURCE = Legacy/oldmenu.cpp33 LEGACYHEADER = Legacy/oldmenu.hpp34 35 36 28 QTUIMOC_HEADER = UIElements/QT4/QTMainWindow.hpp UIElements/QT4/QTDialog.hpp Menu/QT4/QTMenu.hpp Views/QT4/QTMoleculesView.hpp Views/QT4/GLMoleculeView.hpp 37 29 QTUIMOC_TARGETS = QTMainWindow.moc.cpp QTMenu.moc.cpp QTDialog.moc.cpp QTMoleculesView.moc.cpp GLMoleculeView.moc.cpp 38 39 DESCRIPTORSOURCE = Descriptors/AtomDescriptor.cpp Descriptors/AtomIdDescriptor.cpp40 DESCRIPTORHEADER = Descriptors/AtomDescriptor.hpp Descriptors/AtomIdDescriptor.hpp41 30 42 31 QTUISOURCE = ${QTUIMOC_TARGETS} UIElements/QT4/QTMainWindow.cpp UIElements/QT4/QTDialog.cpp UIElements/QT4/QTUIFactory.cpp Menu/QT4/QTMenu.cpp Views/QT4/QTMoleculesView.cpp Views/QT4/GLMoleculeView.cpp … … 45 34 QTUI_DEFS = 46 35 47 SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} ${PATTERNSOURCE} ${DESCRIPTORSOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp info.cpp leastsquaremin.cpp linkedcell.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp World.cpp 48 HEADER = ${ANALYSISHEADER} ${ATOMHEADER} ${PATTERNHEADER} ${DESCRIPTORHEADER} ${LEGACYHEADER} bond.hpp bondgraph.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp errorlogger.hpp graph.hpp helpers.hpp info.hpp leastsquaremin.hpp linkedcell.hpp lists.hpp log.hpp logger.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp World.hpp 49 36 SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} ${PATTERNSOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp info.cpp leastsquaremin.cpp linkedcell.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp menu.cpp 37 HEADER = ${ANALYSISHEADER} ${ATOMHEADER} ${PATTERNHEADER} bond.hpp bondgraph.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp errorlogger.hpp graph.hpp helpers.hpp info.hpp leastsquaremin.hpp linkedcell.hpp lists.hpp log.hpp logger.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp menu.hpp 50 38 51 39 BOOST_LIB = $(BOOST_LDFLAGS) $(BOOST_MPL_LIB) 52 GUI_LIBS = ${QT_LDADD} ${QT_LIB_GUI} -lQtOpenGL ${GLU_LIBS}53 40 INCLUDES = -I$(top_srcdir)/src/unittests 54 41 … … 56 43 bin_PROGRAMS = molecuilder molecuildergui joiner analyzer 57 44 molecuilderdir = ${bindir} 58 59 #libmolecuilder_a_CXXFLAGS = -DNO_CACHING60 45 libmolecuilder_a_SOURCES = ${SOURCE} ${HEADER} 61 62 46 libmenu_a_SOURCES = ${UISOURCE} ${UIHEADER} 63 64 47 libgslwrapper_a_SOURCES = ${LINALGSOURCE} ${LINALGHEADER} 65 66 48 molecuilder_DATA = elements.db valence.db orbitals.db Hbonddistance.db Hbondangle.db 67 68 molecuilder_CXXFLAGS = $(BOOST_CPPFLAGS)69 #molecuilder_CXXFLAGS += -DNO_CACHING70 49 molecuilder_LDFLAGS = $(BOOST_LIB) 71 molecuilder_SOURCES = ${FACTORYSOURCE} ${LEGACYSOURCE}builder.cpp50 molecuilder_SOURCES = ${FACTORYSOURCE} menu.cpp builder.cpp 72 51 molecuilder_SOURCES += $(srcdir)/version.c 73 molecuilder_LDADD = libmolecuilder.a libgslwrapper.a libmenu.a ${BOOST_THREAD_LIB} 74 52 molecuilder_LDADD = libmolecuilder.a libgslwrapper.a libmenu.a 75 53 #Stuff for building the GUI using QT 76 molecuildergui_SOURCES = ${QTUISOURCE} ${FACTORYSOURCE} ${LEGACYSOURCE}builder.cpp54 molecuildergui_SOURCES = ${QTUISOURCE} ${FACTORYSOURCE} menu.cpp builder.cpp 77 55 molecuildergui_SOURCES += $(srcdir)/version.c 78 56 molecuildergui_CXXFLAGS = ${QT_CXXFLAGS} ${GLU_CXXFLAGS} -DUSE_GUI_QT 79 57 molecuildergui_LDFLAGS = $(BOOST_LIB) ${QT_LDFLAGS} ${GLU_LDFLAGS} 80 molecuildergui_LDADD = libmolecuilder.a libgslwrapper.a libmenu.a ${BOOST_THREAD_LIB} ${GUI_LIBS} 81 58 molecuildergui_LDADD = libmolecuilder.a libgslwrapper.a libmenu.a ${QT_LDADD} ${QT_LIB_GUI} -lQtOpenGL ${GLU_LIBS} 82 59 joiner_SOURCES = joiner.cpp datacreator.cpp parser.cpp datacreator.hpp helpers.hpp parser.hpp periodentafel.hpp 83 joiner_LDADD = libmolecuilder.a $(BOOST_LIB) ${BOOST_THREAD_LIB} 84 60 joiner_LDADD = libmolecuilder.a 85 61 analyzer_SOURCES = analyzer.cpp datacreator.cpp parser.cpp helpers.hpp periodentafel.hpp parser.hpp datacreator.hpp 86 analyzer_LDADD = libmolecuilder.a $(BOOST_LIB) ${BOOST_THREAD_LIB}62 analyzer_LDADD = libmolecuilder.a 87 63 88 64 #Rules needed for QT4 -
src/Patterns/Observer.cpp
rb1d8092 r7ba324 10 10 11 11 #include <iostream> 12 #include <cassert>13 12 14 13 using namespace std; … … 25 24 26 25 map<Observable*, int> Observable::depth; 27 m ap<Observable*,multimap<int,Observer*>*> Observable::callTable;26 multimap<Observable*,Observer*> Observable::callTable; 28 27 set<Observable*> Observable::busyObservables; 29 28 … … 53 52 } 54 53 55 Observable::_Observable_protector::_Observable_protector(Observable *_protege) :56 protege(_protege)57 {58 start_observer_internal(protege);59 }60 61 Observable::_Observable_protector::~_Observable_protector()62 {63 finish_observer_internal(protege);64 }65 66 54 /************* Notification mechanism for observables **************/ 67 55 56 typedef multimap<Observable*,Observer*>::iterator callIterator; 57 typedef pair<callIterator, callIterator> iteratorRange; 68 58 69 59 void Observable::notifyAll() { … … 74 64 // and call all observers 75 65 if(callTable.count(this)) { 76 // elements are stored sorted by keys in the multimap 77 // so iterating over it gives us a the callees sorted by 78 // the priorities 79 callees_t *callees = callTable[this]; 80 callees_t::iterator iter; 81 for(iter=callees->begin();iter!=callees->end();iter++){ 82 (*iter).second->update(this); 83 } 66 iteratorRange callerRange = callTable.equal_range(this); 67 callIterator iter; 68 for(iter=callerRange.first;iter!=callerRange.second;iter++){ 69 (*iter).second->update(this); 70 } 84 71 } 85 72 // done with notification, we can leave the set of busy subjects … … 110 97 111 98 // methods to sign-on and off 112 void Observable::signOn(Observer *target,int priority) { 113 assert(priority>=-20 && priority<=+20 && "Priority out of range [-20:+20]"); 99 void Observable::signOn(Observer *target) { 114 100 bool res = false; 115 callees_t *callees = 0; 116 if(callTable.count(this)){ 117 callees = callTable[this]; 118 } 119 else { 120 callees = new multimap<int,Observer*>; 121 callTable.insert(pair<Observable*,callees_t*>(this,callees)); 122 } 123 124 callees_t::iterator iter; 125 for(iter=callees->begin();iter!=callees->end();iter++){ 101 iteratorRange callerRange = callTable.equal_range(this); 102 callIterator iter; 103 for(iter=callerRange.first;iter!=callerRange.second;iter++){ 126 104 res |= ((*iter).second == target); 127 105 } 128 106 if(!res) 129 call ees->insert(pair<int,Observer*>(priority,target));107 callTable.insert(pair<Observable*,Observer*>(this,target)); 130 108 } 131 109 132 110 void Observable::signOff(Observer *target) { 133 assert(callTable.count(this) && "SignOff called for an Observable without Observers."); 134 callees_t *callees = callTable[this]; 135 callees_t::iterator iter; 136 for(iter=callees->begin();iter!=callees->end();iter++) { 111 iteratorRange callerRange = callTable.equal_range(this); 112 callIterator iter; 113 for(iter=callerRange.first;iter!=callerRange.second;iter++) { 137 114 if((*iter).second == target) 138 callees->erase(iter); 139 } 140 if(callees->empty()){ 141 callTable.erase(this); 142 delete callees; 115 callTable.erase(iter); 143 116 } 144 117 } … … 154 127 Observable::~Observable() 155 128 { 156 if(callTable.count(this)) { 157 // delete all entries for this observable 158 callees_t *callees = callTable[this]; 159 callees_t::iterator iter; 160 for(iter=callees->begin();iter!=callees->end();iter++){ 161 (*iter).second->subjectKilled(this); 162 } 163 callTable.erase(this); 164 delete callees; 129 // delete all entries for this observable 130 iteratorRange callerRange = callTable.equal_range(this); 131 callIterator iter; 132 for(iter=callerRange.first;iter!=callerRange.second;iter++){ 133 (*iter).second->subjectKilled(this); 165 134 } 135 callTable.erase(callerRange.first,callerRange.second); 166 136 } 167 137 -
src/Patterns/Observer.hpp
rb1d8092 r7ba324 16 16 * 17 17 * Observers register themselves with the observables to be notified when something changes. 18 * In the Observable code that changes attributes should be started with OBSERVE;. This macro19 * locks the observer mechanism while changes are done. At the end of the scope in which the20 * macro was placed the lock is released. When the last lock is released all changes are21 * propagated to the observers.18 * In the Observable code that changes attributes should be wrapped in 19 * START_OBSERVER ... END_OBSERVER blocks. If other methods are called that also contain 20 * Observation blocks from there, these functions wont trigger notifications. Only the end 21 * of the final observation block triggers the update of Observers. 22 22 * 23 23 * Each observerable can have sub-observables. When one of these sub-observables changes and … … 47 47 virtual ~Observable(); 48 48 49 virtual void signOn(Observer *target , int priority=0);49 virtual void signOn(Observer *target); 50 50 virtual void signOff(Observer *target); 51 51 … … 59 59 /** 60 60 * Internal method. 61 * Do not call directly. Use OBSERVEmacro instead61 * Do not call directly. Use START_OBSERVER macro instead 62 62 */ 63 63 static void start_observer_internal(Observable *publisher); 64 64 /** 65 65 * Internal method. 66 * Do not call directly. Use OBSERVEmacro instead66 * Do not call directly. Use FINISH_OBSERVER macro instead 67 67 */ 68 68 static void finish_observer_internal(Observable *publisher); 69 69 70 70 private: 71 typedef std::multimap<int,Observer*> callees_t;72 71 static std::map<Observable*, int> depth; 73 static std::m ap<Observable*,callees_t*> callTable;72 static std::multimap<Observable*,Observer*> callTable; 74 73 static std::set<Observable*> busyObservables; 75 76 // Structure for RAII-Style notification77 protected:78 class _Observable_protector {79 public:80 _Observable_protector(Observable *);81 ~_Observable_protector();82 private:83 Observable *protege;84 };85 74 }; 86 75 87 // extra macro is necessary to work with __LINE__ 88 #define PASTE(a,b) PASTE_HELPER(a,b) 89 #define PASTE_HELPER(a,b) a ## b 90 #define OBSERVE Observable::_Observable_protector PASTE(_scope_obs_protector_,__LINE__)(this) 91 // deprecated macros from before RAII was used 92 //#define START_OBSERVER Observable::start_observer_internal(this);do{do{}while(0) 93 //#define FINISH_OBSERVER }while(0);Observable::finish_observer_internal(this) 94 //#define RETURN_OBSERVER( retval ) do{Observable::finish_observer_internal(this); return (retval);}while(0) 76 77 78 #define START_OBSERVER Observable::start_observer_internal(this);do{do{}while(0) 79 #define FINISH_OBSERVER }while(0);Observable::finish_observer_internal(this) 95 80 #endif /* OBSERVER_HPP_ */ -
src/UIElements/TextWindow.cpp
rb1d8092 r7ba324 28 28 #include "periodentafel.hpp" 29 29 30 #include " Legacy/oldmenu.hpp"30 #include "../menu.hpp" 31 31 32 32 #include "Menu/Menu.hpp" -
src/atom.cpp
rb1d8092 r7ba324 13 13 #include "parser.hpp" 14 14 #include "vector.hpp" 15 #include "World.hpp"16 15 17 16 /************************************* Functions for class atom *************************************/ … … 22 21 atom::atom() : previous(NULL), next(NULL), father(this), sort(&nr) 23 22 { 24 World::get()->registerAtom(this);25 23 node = &x; // TesselPoint::x can only be referenced from here 26 24 }; … … 30 28 atom::atom(atom *pointer) : previous(NULL), next(NULL), father(pointer), sort(&nr) 31 29 { 32 World::get()->registerAtom(this);33 30 type = pointer->type; // copy element of atom 34 31 x.CopyVector(&pointer->x); // copy coordination … … 43 40 atom::~atom() 44 41 { 45 World::get()->unregisterAtom(this);46 42 unlink(this); 47 43 }; -
src/atom_particleinfo.cpp
rb1d8092 r7ba324 20 20 }; 21 21 22 int ParticleInfo::getId() {23 return nr;24 }25 26 22 ostream & operator << (ostream &ost, const ParticleInfo &a) 27 23 { -
src/atom_particleinfo.hpp
rb1d8092 r7ba324 35 35 ostream & operator << (ostream &ost) const; 36 36 37 virtual int getId();38 39 37 private: 40 38 }; -
src/builder.cpp
rb1d8092 r7ba324 76 76 #include "Actions/MethodAction.hpp" 77 77 #include "Actions/small_actions.hpp" 78 #include "World.hpp"79 78 #include "version.h" 80 79 … … 2167 2166 /********************************************** Main routine **************************************/ 2168 2167 2169 void cleanUp(config *configuration){2170 World::destroy();2171 delete(configuration);2172 Log() << Verbose(0) << "Maximum of allocated memory: "2173 << MemoryUsageObserver::getInstance()->getMaximumUsedMemory() << endl;2174 Log() << Verbose(0) << "Remaining non-freed memory: "2175 << MemoryUsageObserver::getInstance()->getUsedMemorySize() << endl;2176 MemoryUsageObserver::purgeInstance();2177 logger::purgeInstance();2178 errorLogger::purgeInstance();2179 UIFactory::purgeInstance();2180 ActionRegistry::purgeRegistry();2181 }2182 2183 2168 int main(int argc, char **argv) 2184 2169 { 2170 periodentafel *periode = new periodentafel; 2171 MoleculeListClass *molecules = new MoleculeListClass; 2185 2172 molecule *mol = NULL; 2186 2173 config *configuration = new config; … … 2193 2180 setVerbosity(0); 2194 2181 /* structure of ParseCommandLineOptions will be refactored later */ 2195 j = ParseCommandLineOptions(argc, argv, World::get()->getMolecules(), World::get()->getPeriode(), *configuration, ConfigFileName);2182 j = ParseCommandLineOptions(argc, argv, molecules, periode, *configuration, ConfigFileName); 2196 2183 switch (j){ 2197 2184 case 255: 2198 2185 case 2: 2199 2186 case 1: 2200 cleanUp(configuration); 2187 delete (molecules); 2188 delete (periode); 2189 delete (configuration); 2190 Log() << Verbose(0) << "Maximum of allocated memory: " << MemoryUsageObserver::getInstance()->getMaximumUsedMemory() << endl; 2191 Log() << Verbose(0) << "Remaining non-freed memory: " << MemoryUsageObserver::getInstance()->getUsedMemorySize() << endl; 2192 MemoryUsageObserver::getInstance()->purgeInstance(); 2193 logger::purgeInstance(); 2194 errorLogger::purgeInstance(); 2201 2195 return (j == 1 ? 0 : j); 2202 2196 default: 2203 2197 break; 2204 2198 } 2205 if( World::get()->numMolecules() == 0){2206 mol = World::get()->createMolecule();2199 if(molecules->ListOfMolecules.size() == 0){ 2200 mol = new molecule(periode); 2207 2201 if(mol->cell_size[0] == 0.){ 2208 2202 Log() << Verbose(0) << "enter lower tridiagonal form of basis matrix" << endl << endl; … … 2212 2206 } 2213 2207 } 2208 2214 2209 mol->ActiveFlag = true; 2210 molecules->insert(mol); 2215 2211 } 2216 2212 … … 2228 2224 UIFactory::makeUserInterface(UIFactory::Text); 2229 2225 #endif 2230 MainWindow *mainWindow = UIFactory::get()->makeMainWindow(populaters, World::get()->getMolecules(), configuration, World::get()->getPeriode(), ConfigFileName);2226 MainWindow *mainWindow = UIFactory::get()->makeMainWindow(populaters,molecules, configuration, periode, ConfigFileName); 2231 2227 mainWindow->display(); 2232 2228 … … 2234 2230 } 2235 2231 2236 if( World::get()->getPeriode()->StorePeriodentafel(configuration->databasepath))2232 if(periode->StorePeriodentafel(configuration->databasepath)) 2237 2233 Log() << Verbose(0) << "Saving of elements.db successful." << endl; 2238 2234 … … 2240 2236 Log() << Verbose(0) << "Saving of elements.db failed." << endl; 2241 2237 2242 cleanUp(configuration); 2238 delete (molecules); 2239 delete(periode); 2240 delete(configuration); 2241 2242 2243 2244 Log() << Verbose(0) << "Maximum of allocated memory: " 2245 << MemoryUsageObserver::getInstance()->getMaximumUsedMemory() << endl; 2246 Log() << Verbose(0) << "Remaining non-freed memory: " 2247 << MemoryUsageObserver::getInstance()->getUsedMemorySize() << endl; 2248 MemoryUsageObserver::purgeInstance(); 2249 logger::purgeInstance(); 2250 errorLogger::purgeInstance(); 2251 UIFactory::purgeInstance(); 2252 ActionRegistry::purgeRegistry(); 2243 2253 return (0); 2244 2254 } -
src/molecule.cpp
rb1d8092 r7ba324 6 6 7 7 #include <cstring> 8 #include <boost/bind.hpp>9 8 10 9 #include "atom.hpp" … … 33 32 first(new bond(start, end, 1, -1)), last(new bond(start, end, 1, -1)), MDSteps(0), AtomCount(0), 34 33 BondCount(0), ElementCount(0), NoNonHydrogen(0), NoNonBonds(0), NoCyclicBonds(0), BondDistance(0.), 35 ActiveFlag(false), IndexNr(-1), last_atom(0), InternalPointer(start), 36 formula(this,boost::bind(&molecule::calcFormula,this)) 34 ActiveFlag(false), IndexNr(-1), last_atom(0), InternalPointer(start) 37 35 { 38 36 // init atom chain list … … 71 69 72 70 void molecule::setName(const std::string _name){ 73 OBSERVE;71 START_OBSERVER; 74 72 strncpy(name,_name.c_str(),MAXSTRINGSIZE); 75 } 76 77 const std::string molecule::getFormula(){ 78 return *formula; 79 } 80 81 std::string molecule::calcFormula(){ 82 int Counts[MAX_ELEMENTS]; 83 stringstream sstr; 84 for (int j = 0; j<MAX_ELEMENTS;j++) 85 Counts[j] = 0; 86 for(atom *Walker = start; Walker != end; Walker = Walker->next) { 87 Counts[Walker->type->Z]++; 88 } 89 for(element* Elemental = elemente->end; Elemental != elemente->start; Elemental = Elemental->previous) { 90 if (Counts[Elemental->Z] != 0) 91 sstr << Elemental->symbol << Counts[Elemental->Z]; 92 } 93 return sstr.str(); 73 FINISH_OBSERVER; 94 74 } 95 75 … … 102 82 bool molecule::AddAtom(atom *pointer) 103 83 { 104 bool retval = false;105 OBSERVE;106 84 if (pointer != NULL) { 107 85 pointer->sort = &pointer->nr; … … 120 98 } 121 99 } 122 ret val =add(pointer, end);123 } 124 return retval;100 return add(pointer, end); 101 } else 102 return false; 125 103 }; 126 104 … … 132 110 atom * molecule::AddCopyAtom(atom *pointer) 133 111 { 134 atom *retval = NULL;135 OBSERVE;136 112 if (pointer != NULL) { 137 113 atom *walker = new atom(pointer); … … 143 119 NoNonHydrogen++; 144 120 AtomCount++; 145 ret val=walker;146 } 147 return retval;121 return walker; 122 } else 123 return NULL; 148 124 }; 149 125 … … 184 160 bool molecule::AddHydrogenReplacementAtom(bond *TopBond, atom *BottomOrigin, atom *TopOrigin, atom *TopReplacement, bool IsAngstroem) 185 161 { 186 bool AllWentWell = true; // flag gathering the boolean return value of molecule::AddAtom and other functions, as return value on exit187 OBSERVE;188 162 double bondlength; // bond length of the bond to be replaced/cut 189 163 double bondangle; // bond angle of the bond to be replaced/cut 190 164 double BondRescale; // rescale value for the hydrogen bond length 165 bool AllWentWell = true; // flag gathering the boolean return value of molecule::AddAtom and other functions, as return value on exit 191 166 bond *FirstBond = NULL, *SecondBond = NULL; // Other bonds in double bond case to determine "other" plane 192 167 atom *FirstOtherAtom = NULL, *SecondOtherAtom = NULL, *ThirdOtherAtom = NULL; // pointer to hydrogen atoms to be added … … 450 425 bool molecule::AddXYZFile(string filename) 451 426 { 452 453 427 istringstream *input = NULL; 454 428 int NumberOfAtoms = 0; // atom number in xyz read … … 464 438 return false; 465 439 466 OBSERVE;467 440 getline(xyzfile,line,'\n'); // Read numer of atoms in file 468 441 input = new istringstream(line); -
src/molecule.hpp
rb1d8092 r7ba324 33 33 #include "tesselation.hpp" 34 34 #include "Patterns/Observer.hpp" 35 #include "Patterns/Cacheable.hpp"36 35 37 36 /****************************************** forward declarations *****************************/ … … 106 105 char name[MAXSTRINGSIZE]; //!< arbitrary name 107 106 108 private:109 Cacheable<string> formula;110 111 107 public: 112 108 molecule(const periodentafel * const teil); … … 116 112 const std::string getName(); 117 113 void setName(const std::string); 118 const std::string getFormula();119 std::string calcFormula();120 114 121 115 // re-definition of virtual functions from PointCloud -
src/moleculelist.cpp
rb1d8092 r7ba324 50 50 void MoleculeListClass::insert(molecule *mol) 51 51 { 52 OBSERVE;52 START_OBSERVER; 53 53 mol->IndexNr = MaxIndex++; 54 54 ListOfMolecules.push_back(mol); 55 55 mol->signOn(this); 56 FINISH_OBSERVER; 56 57 }; 57 58 … … 891 892 892 893 void MoleculeListClass::createNewMolecule(periodentafel *periode) { 893 OBSERVE;894 START_OBSERVER; 894 895 molecule *mol = NULL; 895 896 mol = new molecule(periode); 896 897 insert(mol); 898 FINISH_OBSERVER; 897 899 }; 898 900 -
src/unittests/Makefile.am
rb1d8092 r7ba324 29 29 VectorUnitTest \ 30 30 ObserverTest \ 31 CacheableTest \ 32 DescriptorUnittest \ 33 ${MENUTESTS} 34 31 ${MENUTESTS} 32 33 35 34 check_PROGRAMS = $(TESTS) 36 35 noinst_PROGRAMS = $(TESTS) 37 36 38 GSLLIBS = ../libgslwrapper.a39 ALLLIBS = ../libmolecuilder.a ${GSLLIBS} $(BOOST_LIB) ${BOOST_THREAD_LIB}40 41 37 ActOnAllUnitTest_SOURCES = ../test/ActOnAllTest.hpp ActOnAllUnitTest.cpp ActOnAllUnitTest.hpp 42 ActOnAllUnitTest_LDADD = ${ALLLIBS}38 ActOnAllUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a 43 39 44 40 AnalysisBondsUnitTests_SOURCES = analysisbondsunittest.cpp analysisbondsunittest.hpp 45 AnalysisBondsUnitTests_LDADD = ${ALLLIBS}41 AnalysisBondsUnitTests_LDADD = ../libmolecuilder.a ../libgslwrapper.a 46 42 47 43 AnalysisCorrelationToPointUnitTest_SOURCES = analysis_correlation.hpp AnalysisCorrelationToPointUnitTest.cpp AnalysisCorrelationToPointUnitTest.hpp 48 AnalysisCorrelationToPointUnitTest_LDADD = ${ALLLIBS}44 AnalysisCorrelationToPointUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a 49 45 50 46 AnalysisCorrelationToSurfaceUnitTest_SOURCES = analysis_correlation.hpp AnalysisCorrelationToSurfaceUnitTest.cpp AnalysisCorrelationToSurfaceUnitTest.hpp 51 AnalysisCorrelationToSurfaceUnitTest_LDADD = ${ALLLIBS}47 AnalysisCorrelationToSurfaceUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a 52 48 53 49 AnalysisPairCorrelationUnitTest_SOURCES = analysis_correlation.hpp AnalysisPairCorrelationUnitTest.cpp AnalysisPairCorrelationUnitTest.hpp 54 AnalysisPairCorrelationUnitTest_LDADD = ${ALLLIBS}50 AnalysisPairCorrelationUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a 55 51 56 52 BondGraphUnitTest_SOURCES = bondgraphunittest.cpp bondgraphunittest.hpp 57 BondGraphUnitTest_LDADD = ${ALLLIBS}53 BondGraphUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a 58 54 59 55 GSLMatrixSymmetricUnitTest_SOURCES = gslmatrixsymmetricunittest.cpp gslmatrixsymmetricunittest.hpp 60 GSLMatrixSymmetricUnitTest_LDADD = ${GSLLIBS}56 GSLMatrixSymmetricUnitTest_LDADD = ../libgslwrapper.a 61 57 62 58 GSLMatrixUnitTest_SOURCES = gslmatrixunittest.cpp gslmatrixunittest.hpp 63 GSLMatrixUnitTest_LDADD = ${GSLLIBS}59 GSLMatrixUnitTest_LDADD = ../libgslwrapper.a 64 60 65 61 GSLVectorUnitTest_SOURCES = gslvectorunittest.cpp gslvectorunittest.hpp 66 GSLVectorUnitTest_LDADD = ${GSLLIBS}62 GSLVectorUnitTest_LDADD = ../libgslwrapper.a 67 63 68 64 InfoUnitTest_SOURCES = infounittest.cpp infounittest.hpp 69 InfoUnitTest_LDADD = ${ALLLIBS}65 InfoUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a 70 66 71 67 LinearSystemOfEquationsUnitTest_SOURCES = linearsystemofequationsunittest.cpp linearsystemofequationsunittest.hpp 72 LinearSystemOfEquationsUnitTest_LDADD = ${ALLLIBS}68 LinearSystemOfEquationsUnitTest_LDADD = ../libgslwrapper.a ../libmolecuilder.a 73 69 74 70 ListOfBondsUnitTest_SOURCES = listofbondsunittest.cpp listofbondsunittest.hpp 75 ListOfBondsUnitTest_LDADD = ${ALLLIBS}71 ListOfBondsUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a 76 72 77 73 LogUnitTest_SOURCES = logunittest.cpp logunittest.hpp 78 LogUnitTest_LDADD = ${ALLLIBS}74 LogUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a 79 75 80 76 MemoryAllocatorUnitTest_SOURCES = memoryallocatorunittest.cpp memoryallocatorunittest.hpp 81 MemoryAllocatorUnitTest_LDADD = ${ALLLIBS}77 MemoryAllocatorUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a 82 78 83 79 MemoryUsageObserverUnitTest_SOURCES = memoryusageobserverunittest.cpp memoryusageobserverunittest.hpp 84 MemoryUsageObserverUnitTest_LDADD = ${ALLLIBS}80 MemoryUsageObserverUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a 85 81 86 82 StackClassUnitTest_SOURCES = stackclassunittest.cpp stackclassunittest.hpp 87 StackClassUnitTest_LDADD = ${ALLLIBS}83 StackClassUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a 88 84 89 85 TesselationUnitTest_SOURCES = tesselationunittest.cpp tesselationunittest.hpp 90 TesselationUnitTest_LDADD = ${ALLLIBS}86 TesselationUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a 91 87 92 88 Tesselation_BoundaryTriangleUnitTest_SOURCES = tesselation_boundarytriangleunittest.cpp tesselation_boundarytriangleunittest.hpp 93 Tesselation_BoundaryTriangleUnitTest_LDADD = ${ALLLIBS}89 Tesselation_BoundaryTriangleUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a 94 90 95 91 Tesselation_InOutsideUnitTest_SOURCES = tesselation_insideoutsideunittest.cpp tesselation_insideoutsideunittest.hpp 96 Tesselation_InOutsideUnitTest_LDADD = ${ALLLIBS}92 Tesselation_InOutsideUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a 97 93 98 94 VectorUnitTest_SOURCES = vectorunittest.cpp vectorunittest.hpp 99 VectorUnitTest_LDADD = ${ALLLIBS}95 VectorUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a 100 96 101 97 ActionSequenceTest_SOURCES = ActionSequenceTest.cpp ActionSequenceTest.hpp 102 ActionSequenceTest_LDADD = ${ALLLIBS}../libmenu.a98 ActionSequenceTest_LDADD = ../libmolecuilder.a ../libmenu.a 103 99 104 100 ObserverTest_SOURCES = ObserverTest.cpp ObserverTest.hpp 105 ObserverTest_LDADD = ${ALLLIBS} 106 107 CacheableTest_SOURCES = CacheableTest.cpp CacheableTest.hpp 108 CacheableTest_LDADD = ${ALLLIBS} 109 110 DescriptorUnittest_SOURCES = DescriptorUnittest.cpp DescriptorUnittest.hpp 111 DescriptorUnittest_LDADD = ${ALLLIBS} 101 ObserverTest_LDADD = ../libmolecuilder.a 112 102 113 103 #AUTOMAKE_OPTIONS = parallel-tests -
src/unittests/ObserverTest.cpp
rb1d8092 r7ba324 39 39 public: 40 40 void changeMethod() { 41 OBSERVE; 42 int i; 43 i++; 41 START_OBSERVER; 42 int i; 43 i++; 44 FINISH_OBSERVER; 44 45 } 45 46 }; … … 48 49 public: 49 50 void changeMethod1() { 50 OBSERVE; 51 int i; 52 i++; 51 START_OBSERVER; 52 int i; 53 i++; 54 FINISH_OBSERVER; 53 55 } 54 56 55 57 void changeMethod2() { 56 OBSERVE;58 START_OBSERVER; 57 59 int i; 58 60 i++; 59 61 changeMethod1(); 62 FINISH_OBSERVER; 60 63 } 61 64 }; … … 71 74 } 72 75 void changeMethod() { 73 OBSERVE;76 START_OBSERVER; 74 77 int i; 75 78 i++; 76 79 subObservable->changeMethod(); 80 FINISH_OBSERVER; 77 81 } 78 82 SimpleObservable *subObservable;
Note:
See TracChangeset
for help on using the changeset viewer.