Changeset 120f8b for molecuilder/src/builder.cpp
- Timestamp:
- Feb 16, 2010, 5:26:59 PM (16 years ago)
- Children:
- b53a7e
- Parents:
- 323177
- File:
-
- 1 edited
-
molecuilder/src/builder.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/builder.cpp
r323177 r120f8b 76 76 #include "Actions/MethodAction.hpp" 77 77 #include "Actions/small_actions.hpp" 78 #include "World.hpp" 78 79 #include "version.h" 79 80 … … 2164 2165 /********************************************** Main routine **************************************/ 2165 2166 2167 void cleanUp(config *configuration){ 2168 World::destroy(); 2169 delete(configuration); 2170 Log() << Verbose(0) << "Maximum of allocated memory: " 2171 << MemoryUsageObserver::getInstance()->getMaximumUsedMemory() << endl; 2172 Log() << Verbose(0) << "Remaining non-freed memory: " 2173 << MemoryUsageObserver::getInstance()->getUsedMemorySize() << endl; 2174 MemoryUsageObserver::purgeInstance(); 2175 logger::purgeInstance(); 2176 errorLogger::purgeInstance(); 2177 UIFactory::purgeInstance(); 2178 ActionRegistry::purgeRegistry(); 2179 } 2180 2166 2181 int main(int argc, char **argv) 2167 2182 { 2168 periodentafel *periode = new periodentafel;2169 MoleculeListClass *molecules = new MoleculeListClass;2170 2183 molecule *mol = NULL; 2171 2184 config *configuration = new config; … … 2178 2191 setVerbosity(0); 2179 2192 /* structure of ParseCommandLineOptions will be refactored later */ 2180 j = ParseCommandLineOptions(argc, argv, molecules, periode, *configuration, ConfigFileName);2193 j = ParseCommandLineOptions(argc, argv, World::get()->getMolecules(), World::get()->getPeriode(), *configuration, ConfigFileName); 2181 2194 switch (j){ 2182 2195 case 255: 2183 2196 case 2: 2184 2197 case 1: 2185 delete (molecules); 2186 delete (periode); 2187 delete (configuration); 2188 Log() << Verbose(0) << "Maximum of allocated memory: " << MemoryUsageObserver::getInstance()->getMaximumUsedMemory() << endl; 2189 Log() << Verbose(0) << "Remaining non-freed memory: " << MemoryUsageObserver::getInstance()->getUsedMemorySize() << endl; 2190 MemoryUsageObserver::getInstance()->purgeInstance(); 2191 logger::purgeInstance(); 2192 errorLogger::purgeInstance(); 2198 cleanUp(configuration); 2193 2199 return (j == 1 ? 0 : j); 2194 2200 default: 2195 2201 break; 2196 2202 } 2197 if( molecules->ListOfMolecules.size() == 0){2198 mol = new molecule(periode);2203 if(World::get()->numMolecules() == 0){ 2204 mol = World::get()->createMolecule(); 2199 2205 if(mol->cell_size[0] == 0.){ 2200 2206 Log() << Verbose(0) << "enter lower tridiagonal form of basis matrix" << endl << endl; … … 2204 2210 } 2205 2211 } 2206 2207 2212 mol->ActiveFlag = true; 2208 molecules->insert(mol);2209 2213 } 2210 2214 … … 2218 2222 2219 2223 UIFactory::makeUserInterface(UIFactory::Text); 2220 MainWindow *mainWindow = UIFactory::get()->makeMainWindow(populaters, molecules, configuration, periode, ConfigFileName);2224 MainWindow *mainWindow = UIFactory::get()->makeMainWindow(populaters,World::get()->getMolecules(), configuration, World::get()->getPeriode(), ConfigFileName); 2221 2225 mainWindow->display(); 2222 2226 delete mainWindow; 2223 2227 } 2224 2228 2225 if( periode->StorePeriodentafel(configuration->databasepath))2229 if(World::get()->getPeriode()->StorePeriodentafel(configuration->databasepath)) 2226 2230 Log() << Verbose(0) << "Saving of elements.db successful." << endl; 2227 2231 … … 2229 2233 Log() << Verbose(0) << "Saving of elements.db failed." << endl; 2230 2234 2231 delete (molecules); 2232 delete(periode); 2233 delete(configuration); 2234 2235 2236 2237 Log() << Verbose(0) << "Maximum of allocated memory: " 2238 << MemoryUsageObserver::getInstance()->getMaximumUsedMemory() << endl; 2239 Log() << Verbose(0) << "Remaining non-freed memory: " 2240 << MemoryUsageObserver::getInstance()->getUsedMemorySize() << endl; 2241 MemoryUsageObserver::purgeInstance(); 2242 logger::purgeInstance(); 2243 errorLogger::purgeInstance(); 2244 UIFactory::purgeInstance(); 2245 ActionRegistry::purgeRegistry(); 2235 cleanUp(configuration); 2246 2236 return (0); 2247 2237 }
Note:
See TracChangeset
for help on using the changeset viewer.
