Changeset f4d063
- Timestamp:
- Dec 16, 2010, 5:32:23 PM (14 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:
- ad7270
- Parents:
- c77ac8
- git-author:
- Frederik Heber <heber@…> (12/15/10 15:54:40)
- git-committer:
- Frederik Heber <heber@…> (12/16/10 17:32:23)
- Location:
- src
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Helpers/MemDebug.cpp
rc77ac8 rf4d063 380 380 // mark the block as not in the list (will be changed by addEntry) 381 381 entry->isIgnored = true; 382 Memory::addEntry(entry); 382 if (line != 0) { // indicator that we do not know the source 383 Memory::addEntry(entry); 384 } 383 385 384 386 // get the checksum... … … 424 426 // mark the block as not in the list (will be changed by addEntry) 425 427 entry->isIgnored = true; 426 Memory::addEntry(entry); 428 if (line != 0) { // indicator that we do not know the source 429 Memory::addEntry(entry); 430 } 427 431 428 432 // get the checksum... -
src/Helpers/MemDebug.hpp
rc77ac8 rf4d063 52 52 #include <boost/shared_ptr.hpp> 53 53 #include <boost/function.hpp> 54 #include <boost/program_options.hpp>55 54 56 55 -
src/Makefile.am
rc77ac8 rf4d063 317 317 #molecuilder_CXXFLAGS += -DNO_CACHING 318 318 molecuilder_LDFLAGS = $(BOOST_LIB) 319 molecuilder_SOURCES = builder.cpp 319 molecuilder_SOURCES = builder.cpp builder_init.cpp builder_init.hpp 320 320 molecuilder_LDADD = \ 321 321 UIElements/libMolecuilderUI-@MOLECUILDER_API_VERSION@.la \ … … 329 329 330 330 #Stuff for building the GUI using Qt 331 molecuildergui_SOURCES = builder.cpp 331 molecuildergui_SOURCES = builder.cpp builder_init.cpp builder_init.hpp 332 332 molecuildergui_CXXFLAGS = $(BOOST_CPPFLAGS) -DUSE_GUI_QT 333 333 molecuildergui_LDFLAGS = $(BOOST_LIB) -
src/builder.cpp
rc77ac8 rf4d063 73 73 #endif 74 74 75 #include "Helpers/MemDebug.hpp" 76 77 #include "bondgraph.hpp" 78 #include "config.hpp" 79 #include "Helpers/Log.hpp" 80 #include "molecule.hpp" 81 #include "periodentafel.hpp" 82 #include "tesselationhelpers.hpp" 83 #include "UIElements/UIFactory.hpp" 84 #include "UIElements/Menu/MenuDescription.hpp" 85 #include "UIElements/TextUI/TextUIFactory.hpp" 86 #include "UIElements/CommandLineUI/CommandLineUIFactory.hpp" 87 #include "UIElements/CommandLineUI/CommandLineParser.hpp" 88 #ifdef USE_GUI_QT 89 #include "UIElements/Qt4/QtUIFactory.hpp" 90 #endif 91 #include "UIElements/MainWindow.hpp" 92 #include "UIElements/Dialog.hpp" 93 //#include "Menu/ActionMenuItem.hpp" 94 #include "Helpers/Verbose.hpp" 95 #include "World.hpp" 96 97 #include "Actions/ActionRegistry.hpp" 98 #include "Actions/ActionHistory.hpp" 99 100 #include "Parser/ChangeTracker.hpp" 101 #include "Parser/FormatParserStorage.hpp" 102 103 #include "UIElements/UIFactory.hpp" 104 #include "UIElements/TextUI/TextUIFactory.hpp" 105 #include "UIElements/CommandLineUI/CommandLineUIFactory.hpp" 106 #include "UIElements/MainWindow.hpp" 107 #include "UIElements/Dialog.hpp" 108 109 #include "version.h" 110 75 #include "builder_init.hpp" 111 76 112 77 /********************************************** Main routine **************************************/ 113 78 114 /** In this function all dynamicly allocated member variables to static/global115 * variables are added to the ignore list of Memory/MemDebug.116 *117 * Use this to prevent their listing in the Memory::getState() at the end of the118 * program. Check with valgrind that truely no memory leak occurs!119 */120 void AddStaticEntitiestoIgnoreList()121 {122 // zeroVec and unitVec are global variables (on the stack) but vectorContent123 // within is situated on the heap and has to be ignored124 Memory::ignore(zeroVec.get());125 Memory::ignore(unitVec[0].get());126 Memory::ignore(unitVec[1].get());127 Memory::ignore(unitVec[2].get());128 }129 130 /** Cleans all singleton instances in an orderly fashion.131 * C++ does not guarantee any specific sequence of removal of single instances132 * which have static/global variables. Some singletons depend on others hence we133 * acertain a specific ordering here, which is is used via the atexit() hook.134 */135 void cleanUp(){136 FormatParserStorage::purgeInstance();137 ChangeTracker::purgeInstance();138 World::purgeInstance();139 MenuDescription::purgeInstance();140 UIFactory::purgeInstance();141 ValueStorage::purgeInstance();142 CommandLineParser::purgeInstance();143 ActionRegistry::purgeInstance();144 OptionRegistry::purgeInstance();145 ActionHistory::purgeInstance();146 // we have to remove these two static as otherwise their boost::shared_ptrs are still present147 Action::removeStaticStateEntities();148 // put some static variables' dynamic contents on the Memory::ignore map to avoid their149 // admonishing lateron150 AddStaticEntitiestoIgnoreList();151 logger::purgeInstance();152 errorLogger::purgeInstance();153 #ifdef LOG_OBSERVER154 cout << observerLog().getLog();155 #endif156 Memory::getState();157 }158 159 void dumpMemory(){160 ofstream ost("molecuilder.memdump");161 Memory::dumpMemory(ost);162 }163 164 79 int main(int argc, char **argv) 165 80 { 166 // while we are non interactive, we want to abort from asserts 167 ASSERT_DO(Assert::Abort); 168 ASSERT_HOOK(dumpMemory); 169 string line; 170 char **Arguments = NULL; 171 int ArgcSize = 0; 172 int ExitFlag = 0; 173 bool ArgumentsCopied = false; 174 std::string BondGraphFileName("\n"); 81 initGeneral(); 175 82 176 // print version check and copyright notice 177 cout << MOLECUILDERVERSION << endl; 178 cout << "MoleCuilder comes with ABSOLUTELY NO WARRANTY; for details type" << endl; 179 cout << "`molecuilder --warranty'." << endl; 180 cout << "`MoleCuilder - to create and alter molecular systems." << endl; 181 cout << "Copyright (C) 2010 University Bonn. All rights reserved." << endl; 83 initUI(argc,argv); 182 84 183 setVerbosity(0); 184 // need to init the history before any action is created 185 ActionHistory::init(); 85 doUI(); 186 86 187 // from this moment on, we need to be sure to deeinitialize in the correct order 188 // this is handled by the cleanup function 189 atexit(cleanUp); 190 191 // Parse command line options and if present create respective UI 192 { 193 // construct bond graph 194 if (World::getInstance().getConfig()->BG == NULL) { 195 World::getInstance().getConfig()->BG = new BondGraph(World::getInstance().getConfig()->GetIsAngstroem()); 196 if (World::getInstance().getConfig()->BG->LoadBondLengthTable(BondGraphFileName)) { 197 DoLog(0) && (Log() << Verbose(0) << "Bond length table loaded successfully." << endl); 198 } else { 199 DoeLog(1) && (eLog()<< Verbose(1) << "Bond length table loading failed." << endl); 200 } 201 } 202 // handle remaining arguments by CommandLineParser 203 if (argc>1) { 204 CommandLineParser::getInstance().InitializeCommandArguments(); 205 CommandLineParser::getInstance().Run(argc,argv); 206 DoLog(0) && (Log() << Verbose(0) << "Setting UI to CommandLine." << endl); 207 UIFactory::registerFactory(new CommandLineUIFactory::description()); 208 UIFactory::makeUserInterface("CommandLine"); 209 } else { 210 // In the interactive mode, we can leave the user the choice in case of error 211 ASSERT_DO(Assert::Ask); 212 #ifdef USE_GUI_QT 213 DoLog(0) && (Log() << Verbose(0) << "Setting UI to Qt4." << endl); 214 UIFactory::registerFactory(new QtUIFactory::description()); 215 UIFactory::makeUserInterface("Qt4"); 216 #else 217 DoLog(0) && (Log() << Verbose(0) << "Setting UI to Text." << endl); 218 cout << MOLECUILDERVERSION << endl; 219 UIFactory::registerFactory(new TextUIFactory::description()); 220 UIFactory::makeUserInterface("Text"); 221 #endif 222 } 223 } 224 225 { 226 MainWindow *mainWindow = UIFactory::getInstance().makeMainWindow(); 227 mainWindow->display(); 228 delete mainWindow; 229 } 230 231 FormatParserStorage::getInstance().SaveAll(); 232 ChangeTracker::getInstance().saveStatus(); 233 234 // free the new argv 235 if (ArgumentsCopied) { 236 for (int i=0; i<ArgcSize;i++) 237 delete[](Arguments[i]); 238 delete[](Arguments); 239 } 240 //delete[](ConfigFileName); 241 242 ExitFlag = World::getInstance().getExitFlag(); 243 return (ExitFlag == 1 ? 0 : ExitFlag); 87 return saveAll(); 244 88 } 245 89
Note:
See TracChangeset
for help on using the changeset viewer.