Changeset b1d8092
- Timestamp:
- Feb 17, 2010, 11:15:27 AM (15 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 326a43b
- Parents:
- 7ba324 (diff), 354859 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 15 added
- 14 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
configure.ac
r7ba324 rb1d8092 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/Legacy/oldmenu.cpp
r7ba324 rb1d8092 7 7 */ 8 8 9 #include " menu.hpp"9 #include "Legacy/oldmenu.hpp" 10 10 #include "analysis_correlation.hpp" 11 11 #include "atom.hpp" -
src/Makefile.am
r7ba324 rb1d8092 12 12 13 13 PATTERNSOURCE = Patterns/Observer.cpp 14 PATTERNHEADER = Patterns/Observer.hpp 14 PATTERNHEADER = Patterns/Observer.hpp Patterns/Cacheable.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 25 26 FACTORYSOURCE = UIElements/UIFactory.cpp 26 27 FACTORYHEADER = UIElements/UIFactory.hpp 27 28 29 # all these files are only used for legacy reasons while the transition is in progress 30 # they are only needed to keep the program usable at any point of the transition and will be 31 # deleted once everything is fully refactored 32 LEGACYSOURCE = Legacy/oldmenu.cpp 33 LEGACYHEADER = Legacy/oldmenu.hpp 34 35 28 36 QTUIMOC_HEADER = UIElements/QT4/QTMainWindow.hpp UIElements/QT4/QTDialog.hpp Menu/QT4/QTMenu.hpp Views/QT4/QTMoleculesView.hpp Views/QT4/GLMoleculeView.hpp 29 37 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.cpp 40 DESCRIPTORHEADER = Descriptors/AtomDescriptor.hpp Descriptors/AtomIdDescriptor.hpp 30 41 31 42 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 … … 34 45 QTUI_DEFS = 35 46 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 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 38 50 39 51 BOOST_LIB = $(BOOST_LDFLAGS) $(BOOST_MPL_LIB) 52 GUI_LIBS = ${QT_LDADD} ${QT_LIB_GUI} -lQtOpenGL ${GLU_LIBS} 40 53 INCLUDES = -I$(top_srcdir)/src/unittests 41 54 … … 43 56 bin_PROGRAMS = molecuilder molecuildergui joiner analyzer 44 57 molecuilderdir = ${bindir} 58 59 #libmolecuilder_a_CXXFLAGS = -DNO_CACHING 45 60 libmolecuilder_a_SOURCES = ${SOURCE} ${HEADER} 61 46 62 libmenu_a_SOURCES = ${UISOURCE} ${UIHEADER} 63 47 64 libgslwrapper_a_SOURCES = ${LINALGSOURCE} ${LINALGHEADER} 65 48 66 molecuilder_DATA = elements.db valence.db orbitals.db Hbonddistance.db Hbondangle.db 67 68 molecuilder_CXXFLAGS = $(BOOST_CPPFLAGS) 69 #molecuilder_CXXFLAGS += -DNO_CACHING 49 70 molecuilder_LDFLAGS = $(BOOST_LIB) 50 molecuilder_SOURCES = ${FACTORYSOURCE} menu.cppbuilder.cpp71 molecuilder_SOURCES = ${FACTORYSOURCE} ${LEGACYSOURCE} builder.cpp 51 72 molecuilder_SOURCES += $(srcdir)/version.c 52 molecuilder_LDADD = libmolecuilder.a libgslwrapper.a libmenu.a 73 molecuilder_LDADD = libmolecuilder.a libgslwrapper.a libmenu.a ${BOOST_THREAD_LIB} 74 53 75 #Stuff for building the GUI using QT 54 molecuildergui_SOURCES = ${QTUISOURCE} ${FACTORYSOURCE} menu.cppbuilder.cpp76 molecuildergui_SOURCES = ${QTUISOURCE} ${FACTORYSOURCE} ${LEGACYSOURCE} builder.cpp 55 77 molecuildergui_SOURCES += $(srcdir)/version.c 56 78 molecuildergui_CXXFLAGS = ${QT_CXXFLAGS} ${GLU_CXXFLAGS} -DUSE_GUI_QT 57 79 molecuildergui_LDFLAGS = $(BOOST_LIB) ${QT_LDFLAGS} ${GLU_LDFLAGS} 58 molecuildergui_LDADD = libmolecuilder.a libgslwrapper.a libmenu.a ${QT_LDADD} ${QT_LIB_GUI} -lQtOpenGL ${GLU_LIBS} 80 molecuildergui_LDADD = libmolecuilder.a libgslwrapper.a libmenu.a ${BOOST_THREAD_LIB} ${GUI_LIBS} 81 59 82 joiner_SOURCES = joiner.cpp datacreator.cpp parser.cpp datacreator.hpp helpers.hpp parser.hpp periodentafel.hpp 60 joiner_LDADD = libmolecuilder.a 83 joiner_LDADD = libmolecuilder.a $(BOOST_LIB) ${BOOST_THREAD_LIB} 84 61 85 analyzer_SOURCES = analyzer.cpp datacreator.cpp parser.cpp helpers.hpp periodentafel.hpp parser.hpp datacreator.hpp 62 analyzer_LDADD = libmolecuilder.a 86 analyzer_LDADD = libmolecuilder.a $(BOOST_LIB) ${BOOST_THREAD_LIB} 63 87 64 88 #Rules needed for QT4 -
src/Patterns/Observer.cpp
r7ba324 rb1d8092 10 10 11 11 #include <iostream> 12 #include <cassert> 12 13 13 14 using namespace std; … … 24 25 25 26 map<Observable*, int> Observable::depth; 26 m ultimap<Observable*,Observer*> Observable::callTable;27 map<Observable*,multimap<int,Observer*>*> Observable::callTable; 27 28 set<Observable*> Observable::busyObservables; 28 29 … … 52 53 } 53 54 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 54 66 /************* Notification mechanism for observables **************/ 55 67 56 typedef multimap<Observable*,Observer*>::iterator callIterator;57 typedef pair<callIterator, callIterator> iteratorRange;58 68 59 69 void Observable::notifyAll() { … … 64 74 // and call all observers 65 75 if(callTable.count(this)) { 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 } 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 } 71 84 } 72 85 // done with notification, we can leave the set of busy subjects … … 97 110 98 111 // methods to sign-on and off 99 void Observable::signOn(Observer *target) { 112 void Observable::signOn(Observer *target,int priority) { 113 assert(priority>=-20 && priority<=+20 && "Priority out of range [-20:+20]"); 100 114 bool res = false; 101 iteratorRange callerRange = callTable.equal_range(this); 102 callIterator iter; 103 for(iter=callerRange.first;iter!=callerRange.second;iter++){ 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++){ 104 126 res |= ((*iter).second == target); 105 127 } 106 128 if(!res) 107 call Table.insert(pair<Observable*,Observer*>(this,target));129 callees->insert(pair<int,Observer*>(priority,target)); 108 130 } 109 131 110 132 void Observable::signOff(Observer *target) { 111 iteratorRange callerRange = callTable.equal_range(this); 112 callIterator iter; 113 for(iter=callerRange.first;iter!=callerRange.second;iter++) { 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++) { 114 137 if((*iter).second == target) 115 callTable.erase(iter); 138 callees->erase(iter); 139 } 140 if(callees->empty()){ 141 callTable.erase(this); 142 delete callees; 116 143 } 117 144 } … … 127 154 Observable::~Observable() 128 155 { 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); 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; 134 165 } 135 callTable.erase(callerRange.first,callerRange.second);136 166 } 137 167 -
src/Patterns/Observer.hpp
r7ba324 rb1d8092 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 wrapped in19 * START_OBSERVER ... END_OBSERVER blocks. If other methods are called that also contain20 * Observation blocks from there, these functions wont trigger notifications. Only the end21 * of the final observation block triggers the update of Observers.18 * In the Observable code that changes attributes should be started with OBSERVE;. This macro 19 * locks the observer mechanism while changes are done. At the end of the scope in which the 20 * macro was placed the lock is released. When the last lock is released all changes are 21 * propagated to the 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 );49 virtual void signOn(Observer *target, int priority=0); 50 50 virtual void signOff(Observer *target); 51 51 … … 59 59 /** 60 60 * Internal method. 61 * Do not call directly. Use START_OBSERVERmacro instead61 * Do not call directly. Use OBSERVE 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 FINISH_OBSERVERmacro instead66 * Do not call directly. Use OBSERVE 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; 71 72 static std::map<Observable*, int> depth; 72 static std::m ultimap<Observable*,Observer*> callTable;73 static std::map<Observable*,callees_t*> callTable; 73 74 static std::set<Observable*> busyObservables; 75 76 // Structure for RAII-Style notification 77 protected: 78 class _Observable_protector { 79 public: 80 _Observable_protector(Observable *); 81 ~_Observable_protector(); 82 private: 83 Observable *protege; 84 }; 74 85 }; 75 86 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) 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) 80 95 #endif /* OBSERVER_HPP_ */ -
src/UIElements/TextWindow.cpp
r7ba324 rb1d8092 28 28 #include "periodentafel.hpp" 29 29 30 #include " ../menu.hpp"30 #include "Legacy/oldmenu.hpp" 31 31 32 32 #include "Menu/Menu.hpp" -
src/atom.cpp
r7ba324 rb1d8092 13 13 #include "parser.hpp" 14 14 #include "vector.hpp" 15 #include "World.hpp" 15 16 16 17 /************************************* Functions for class atom *************************************/ … … 21 22 atom::atom() : previous(NULL), next(NULL), father(this), sort(&nr) 22 23 { 24 World::get()->registerAtom(this); 23 25 node = &x; // TesselPoint::x can only be referenced from here 24 26 }; … … 28 30 atom::atom(atom *pointer) : previous(NULL), next(NULL), father(pointer), sort(&nr) 29 31 { 32 World::get()->registerAtom(this); 30 33 type = pointer->type; // copy element of atom 31 34 x.CopyVector(&pointer->x); // copy coordination … … 40 43 atom::~atom() 41 44 { 45 World::get()->unregisterAtom(this); 42 46 unlink(this); 43 47 }; -
src/atom_particleinfo.cpp
r7ba324 rb1d8092 20 20 }; 21 21 22 int ParticleInfo::getId() { 23 return nr; 24 } 25 22 26 ostream & operator << (ostream &ost, const ParticleInfo &a) 23 27 { -
src/atom_particleinfo.hpp
r7ba324 rb1d8092 35 35 ostream & operator << (ostream &ost) const; 36 36 37 virtual int getId(); 38 37 39 private: 38 40 }; -
src/builder.cpp
r7ba324 rb1d8092 76 76 #include "Actions/MethodAction.hpp" 77 77 #include "Actions/small_actions.hpp" 78 #include "World.hpp" 78 79 #include "version.h" 79 80 … … 2166 2167 /********************************************** Main routine **************************************/ 2167 2168 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 2168 2183 int main(int argc, char **argv) 2169 2184 { 2170 periodentafel *periode = new periodentafel;2171 MoleculeListClass *molecules = new MoleculeListClass;2172 2185 molecule *mol = NULL; 2173 2186 config *configuration = new config; … … 2180 2193 setVerbosity(0); 2181 2194 /* structure of ParseCommandLineOptions will be refactored later */ 2182 j = ParseCommandLineOptions(argc, argv, molecules, periode, *configuration, ConfigFileName);2195 j = ParseCommandLineOptions(argc, argv, World::get()->getMolecules(), World::get()->getPeriode(), *configuration, ConfigFileName); 2183 2196 switch (j){ 2184 2197 case 255: 2185 2198 case 2: 2186 2199 case 1: 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(); 2200 cleanUp(configuration); 2195 2201 return (j == 1 ? 0 : j); 2196 2202 default: 2197 2203 break; 2198 2204 } 2199 if( molecules->ListOfMolecules.size() == 0){2200 mol = new molecule(periode);2205 if(World::get()->numMolecules() == 0){ 2206 mol = World::get()->createMolecule(); 2201 2207 if(mol->cell_size[0] == 0.){ 2202 2208 Log() << Verbose(0) << "enter lower tridiagonal form of basis matrix" << endl << endl; … … 2206 2212 } 2207 2213 } 2208 2209 2214 mol->ActiveFlag = true; 2210 molecules->insert(mol);2211 2215 } 2212 2216 … … 2224 2228 UIFactory::makeUserInterface(UIFactory::Text); 2225 2229 #endif 2226 MainWindow *mainWindow = UIFactory::get()->makeMainWindow(populaters, molecules, configuration, periode, ConfigFileName);2230 MainWindow *mainWindow = UIFactory::get()->makeMainWindow(populaters,World::get()->getMolecules(), configuration, World::get()->getPeriode(), ConfigFileName); 2227 2231 mainWindow->display(); 2228 2232 … … 2230 2234 } 2231 2235 2232 if( periode->StorePeriodentafel(configuration->databasepath))2236 if(World::get()->getPeriode()->StorePeriodentafel(configuration->databasepath)) 2233 2237 Log() << Verbose(0) << "Saving of elements.db successful." << endl; 2234 2238 … … 2236 2240 Log() << Verbose(0) << "Saving of elements.db failed." << endl; 2237 2241 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(); 2242 cleanUp(configuration); 2253 2243 return (0); 2254 2244 } -
src/molecule.cpp
r7ba324 rb1d8092 6 6 7 7 #include <cstring> 8 #include <boost/bind.hpp> 8 9 9 10 #include "atom.hpp" … … 32 33 first(new bond(start, end, 1, -1)), last(new bond(start, end, 1, -1)), MDSteps(0), AtomCount(0), 33 34 BondCount(0), ElementCount(0), NoNonHydrogen(0), NoNonBonds(0), NoCyclicBonds(0), BondDistance(0.), 34 ActiveFlag(false), IndexNr(-1), last_atom(0), InternalPointer(start) 35 ActiveFlag(false), IndexNr(-1), last_atom(0), InternalPointer(start), 36 formula(this,boost::bind(&molecule::calcFormula,this)) 35 37 { 36 38 // init atom chain list … … 69 71 70 72 void molecule::setName(const std::string _name){ 71 START_OBSERVER;73 OBSERVE; 72 74 strncpy(name,_name.c_str(),MAXSTRINGSIZE); 73 FINISH_OBSERVER; 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(); 74 94 } 75 95 … … 82 102 bool molecule::AddAtom(atom *pointer) 83 103 { 104 bool retval = false; 105 OBSERVE; 84 106 if (pointer != NULL) { 85 107 pointer->sort = &pointer->nr; … … 98 120 } 99 121 } 100 ret urnadd(pointer, end);101 } else102 return false;122 retval = add(pointer, end); 123 } 124 return retval; 103 125 }; 104 126 … … 110 132 atom * molecule::AddCopyAtom(atom *pointer) 111 133 { 134 atom *retval = NULL; 135 OBSERVE; 112 136 if (pointer != NULL) { 113 137 atom *walker = new atom(pointer); … … 119 143 NoNonHydrogen++; 120 144 AtomCount++; 121 ret urnwalker;122 } else123 return NULL;145 retval=walker; 146 } 147 return retval; 124 148 }; 125 149 … … 160 184 bool molecule::AddHydrogenReplacementAtom(bond *TopBond, atom *BottomOrigin, atom *TopOrigin, atom *TopReplacement, bool IsAngstroem) 161 185 { 186 bool AllWentWell = true; // flag gathering the boolean return value of molecule::AddAtom and other functions, as return value on exit 187 OBSERVE; 162 188 double bondlength; // bond length of the bond to be replaced/cut 163 189 double bondangle; // bond angle of the bond to be replaced/cut 164 190 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 exit166 191 bond *FirstBond = NULL, *SecondBond = NULL; // Other bonds in double bond case to determine "other" plane 167 192 atom *FirstOtherAtom = NULL, *SecondOtherAtom = NULL, *ThirdOtherAtom = NULL; // pointer to hydrogen atoms to be added … … 425 450 bool molecule::AddXYZFile(string filename) 426 451 { 452 427 453 istringstream *input = NULL; 428 454 int NumberOfAtoms = 0; // atom number in xyz read … … 438 464 return false; 439 465 466 OBSERVE; 440 467 getline(xyzfile,line,'\n'); // Read numer of atoms in file 441 468 input = new istringstream(line); -
src/molecule.hpp
r7ba324 rb1d8092 33 33 #include "tesselation.hpp" 34 34 #include "Patterns/Observer.hpp" 35 #include "Patterns/Cacheable.hpp" 35 36 36 37 /****************************************** forward declarations *****************************/ … … 105 106 char name[MAXSTRINGSIZE]; //!< arbitrary name 106 107 108 private: 109 Cacheable<string> formula; 110 107 111 public: 108 112 molecule(const periodentafel * const teil); … … 112 116 const std::string getName(); 113 117 void setName(const std::string); 118 const std::string getFormula(); 119 std::string calcFormula(); 114 120 115 121 // re-definition of virtual functions from PointCloud -
src/moleculelist.cpp
r7ba324 rb1d8092 50 50 void MoleculeListClass::insert(molecule *mol) 51 51 { 52 START_OBSERVER;52 OBSERVE; 53 53 mol->IndexNr = MaxIndex++; 54 54 ListOfMolecules.push_back(mol); 55 55 mol->signOn(this); 56 FINISH_OBSERVER;57 56 }; 58 57 … … 892 891 893 892 void MoleculeListClass::createNewMolecule(periodentafel *periode) { 894 START_OBSERVER;893 OBSERVE; 895 894 molecule *mol = NULL; 896 895 mol = new molecule(periode); 897 896 insert(mol); 898 FINISH_OBSERVER;899 897 }; 900 898 -
src/unittests/Makefile.am
r7ba324 rb1d8092 29 29 VectorUnitTest \ 30 30 ObserverTest \ 31 ${MENUTESTS} 32 33 31 CacheableTest \ 32 DescriptorUnittest \ 33 ${MENUTESTS} 34 34 35 check_PROGRAMS = $(TESTS) 35 36 noinst_PROGRAMS = $(TESTS) 36 37 38 GSLLIBS = ../libgslwrapper.a 39 ALLLIBS = ../libmolecuilder.a ${GSLLIBS} $(BOOST_LIB) ${BOOST_THREAD_LIB} 40 37 41 ActOnAllUnitTest_SOURCES = ../test/ActOnAllTest.hpp ActOnAllUnitTest.cpp ActOnAllUnitTest.hpp 38 ActOnAllUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a42 ActOnAllUnitTest_LDADD = ${ALLLIBS} 39 43 40 44 AnalysisBondsUnitTests_SOURCES = analysisbondsunittest.cpp analysisbondsunittest.hpp 41 AnalysisBondsUnitTests_LDADD = ../libmolecuilder.a ../libgslwrapper.a45 AnalysisBondsUnitTests_LDADD = ${ALLLIBS} 42 46 43 47 AnalysisCorrelationToPointUnitTest_SOURCES = analysis_correlation.hpp AnalysisCorrelationToPointUnitTest.cpp AnalysisCorrelationToPointUnitTest.hpp 44 AnalysisCorrelationToPointUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a48 AnalysisCorrelationToPointUnitTest_LDADD = ${ALLLIBS} 45 49 46 50 AnalysisCorrelationToSurfaceUnitTest_SOURCES = analysis_correlation.hpp AnalysisCorrelationToSurfaceUnitTest.cpp AnalysisCorrelationToSurfaceUnitTest.hpp 47 AnalysisCorrelationToSurfaceUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a51 AnalysisCorrelationToSurfaceUnitTest_LDADD = ${ALLLIBS} 48 52 49 53 AnalysisPairCorrelationUnitTest_SOURCES = analysis_correlation.hpp AnalysisPairCorrelationUnitTest.cpp AnalysisPairCorrelationUnitTest.hpp 50 AnalysisPairCorrelationUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a54 AnalysisPairCorrelationUnitTest_LDADD = ${ALLLIBS} 51 55 52 56 BondGraphUnitTest_SOURCES = bondgraphunittest.cpp bondgraphunittest.hpp 53 BondGraphUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a57 BondGraphUnitTest_LDADD = ${ALLLIBS} 54 58 55 59 GSLMatrixSymmetricUnitTest_SOURCES = gslmatrixsymmetricunittest.cpp gslmatrixsymmetricunittest.hpp 56 GSLMatrixSymmetricUnitTest_LDADD = ../libgslwrapper.a60 GSLMatrixSymmetricUnitTest_LDADD = ${GSLLIBS} 57 61 58 62 GSLMatrixUnitTest_SOURCES = gslmatrixunittest.cpp gslmatrixunittest.hpp 59 GSLMatrixUnitTest_LDADD = ../libgslwrapper.a63 GSLMatrixUnitTest_LDADD = ${GSLLIBS} 60 64 61 65 GSLVectorUnitTest_SOURCES = gslvectorunittest.cpp gslvectorunittest.hpp 62 GSLVectorUnitTest_LDADD = ../libgslwrapper.a66 GSLVectorUnitTest_LDADD = ${GSLLIBS} 63 67 64 68 InfoUnitTest_SOURCES = infounittest.cpp infounittest.hpp 65 InfoUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a69 InfoUnitTest_LDADD = ${ALLLIBS} 66 70 67 71 LinearSystemOfEquationsUnitTest_SOURCES = linearsystemofequationsunittest.cpp linearsystemofequationsunittest.hpp 68 LinearSystemOfEquationsUnitTest_LDADD = ../libgslwrapper.a ../libmolecuilder.a72 LinearSystemOfEquationsUnitTest_LDADD = ${ALLLIBS} 69 73 70 74 ListOfBondsUnitTest_SOURCES = listofbondsunittest.cpp listofbondsunittest.hpp 71 ListOfBondsUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a75 ListOfBondsUnitTest_LDADD = ${ALLLIBS} 72 76 73 77 LogUnitTest_SOURCES = logunittest.cpp logunittest.hpp 74 LogUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a78 LogUnitTest_LDADD = ${ALLLIBS} 75 79 76 80 MemoryAllocatorUnitTest_SOURCES = memoryallocatorunittest.cpp memoryallocatorunittest.hpp 77 MemoryAllocatorUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a81 MemoryAllocatorUnitTest_LDADD = ${ALLLIBS} 78 82 79 83 MemoryUsageObserverUnitTest_SOURCES = memoryusageobserverunittest.cpp memoryusageobserverunittest.hpp 80 MemoryUsageObserverUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a84 MemoryUsageObserverUnitTest_LDADD = ${ALLLIBS} 81 85 82 86 StackClassUnitTest_SOURCES = stackclassunittest.cpp stackclassunittest.hpp 83 StackClassUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a87 StackClassUnitTest_LDADD = ${ALLLIBS} 84 88 85 89 TesselationUnitTest_SOURCES = tesselationunittest.cpp tesselationunittest.hpp 86 TesselationUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a90 TesselationUnitTest_LDADD = ${ALLLIBS} 87 91 88 92 Tesselation_BoundaryTriangleUnitTest_SOURCES = tesselation_boundarytriangleunittest.cpp tesselation_boundarytriangleunittest.hpp 89 Tesselation_BoundaryTriangleUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a93 Tesselation_BoundaryTriangleUnitTest_LDADD = ${ALLLIBS} 90 94 91 95 Tesselation_InOutsideUnitTest_SOURCES = tesselation_insideoutsideunittest.cpp tesselation_insideoutsideunittest.hpp 92 Tesselation_InOutsideUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a96 Tesselation_InOutsideUnitTest_LDADD = ${ALLLIBS} 93 97 94 98 VectorUnitTest_SOURCES = vectorunittest.cpp vectorunittest.hpp 95 VectorUnitTest_LDADD = ../libmolecuilder.a ../libgslwrapper.a99 VectorUnitTest_LDADD = ${ALLLIBS} 96 100 97 101 ActionSequenceTest_SOURCES = ActionSequenceTest.cpp ActionSequenceTest.hpp 98 ActionSequenceTest_LDADD = ../libmolecuilder.a../libmenu.a102 ActionSequenceTest_LDADD = ${ALLLIBS} ../libmenu.a 99 103 100 104 ObserverTest_SOURCES = ObserverTest.cpp ObserverTest.hpp 101 ObserverTest_LDADD = ../libmolecuilder.a 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} 102 112 103 113 #AUTOMAKE_OPTIONS = parallel-tests -
src/unittests/ObserverTest.cpp
r7ba324 rb1d8092 39 39 public: 40 40 void changeMethod() { 41 START_OBSERVER; 42 int i; 43 i++; 44 FINISH_OBSERVER; 41 OBSERVE; 42 int i; 43 i++; 45 44 } 46 45 }; … … 49 48 public: 50 49 void changeMethod1() { 51 START_OBSERVER; 52 int i; 53 i++; 54 FINISH_OBSERVER; 50 OBSERVE; 51 int i; 52 i++; 55 53 } 56 54 57 55 void changeMethod2() { 58 START_OBSERVER;56 OBSERVE; 59 57 int i; 60 58 i++; 61 59 changeMethod1(); 62 FINISH_OBSERVER;63 60 } 64 61 }; … … 74 71 } 75 72 void changeMethod() { 76 START_OBSERVER;73 OBSERVE; 77 74 int i; 78 75 i++; 79 76 subObservable->changeMethod(); 80 FINISH_OBSERVER;81 77 } 82 78 SimpleObservable *subObservable;
Note:
See TracChangeset
for help on using the changeset viewer.