Changes in src/builder.cpp [aac3ef:d56640]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/builder.cpp
raac3ef rd56640 74 74 #include "Menu/ActionMenuItem.hpp" 75 75 #include "Actions/ActionRegistry.hpp" 76 #include "Actions/ActionHistory.hpp" 76 77 #include "Actions/MethodAction.hpp" 77 78 #include "Actions/small_actions.hpp" … … 1432 1433 } 1433 1434 if (mol == NULL) { 1434 mol = new molecule(periode);1435 mol = World::getInstance().createMolecule(); 1435 1436 mol->ActiveFlag = true; 1436 1437 if (ConfigFileName != NULL) … … 1481 1482 SaveFlag = true; 1482 1483 Log() << Verbose(1) << "Adding new atom with element " << argv[argptr] << " at (" << argv[argptr+1] << "," << argv[argptr+2] << "," << argv[argptr+3] << "), "; 1483 first = new atom;1484 first = World::getInstance().createAtom(); 1484 1485 first->type = periode->FindElement(atoi(argv[argptr])); 1485 1486 if (first->type != NULL) … … 1593 1594 } 1594 1595 LCList = new LinkedCell(Boundary, 2.*radius); 1595 element *elemental = periode->FindElement((const int) atoi(argv[argptr]));1596 const element *elemental = periode->FindElement((atomicNumber_t) atoi(argv[argptr])); 1596 1597 FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL); 1597 1598 int ranges[NDIM] = {1,1,1}; … … 1634 1635 Log() << Verbose(1) << "Filling Box with water molecules." << endl; 1635 1636 // construct water molecule 1636 molecule *filler = new molecule(periode);1637 molecule *filler = World::getInstance().createMolecule(); 1637 1638 molecule *Filling = NULL; 1638 1639 atom *second = NULL, *third = NULL; … … 1641 1642 // first->x.Zero(); 1642 1643 // filler->AddAtom(first); 1643 first = new atom();1644 first = World::getInstance().createAtom(); 1644 1645 first->type = periode->FindElement(1); 1645 1646 first->x.Init(0.441, -0.143, 0.); 1646 1647 filler->AddAtom(first); 1647 second = new atom();1648 second = World::getInstance().createAtom(); 1648 1649 second->type = periode->FindElement(1); 1649 1650 second->x.Init(-0.464, 1.137, 0.0); 1650 1651 filler->AddAtom(second); 1651 third = new atom();1652 third = World::getInstance().createAtom(); 1652 1653 third->type = periode->FindElement(8); 1653 1654 third->x.Init(-0.464, 0.177, 0.); … … 1664 1665 molecules->insert(Filling); 1665 1666 } 1666 delete(filler);1667 World::getInstance().destroyMolecule(filler); 1667 1668 argptr+=6; 1668 1669 } … … 2070 2071 int faktor = atoi(argv[argptr++]); 2071 2072 int count; 2072 element ** Elements;2073 const element ** Elements; 2073 2074 Vector ** vectors; 2074 2075 if (faktor < 1) { 2075 eLog() << Verbose(1) << "Repetition factor mus be greater than 1!" << endl;2076 eLog() << Verbose(1) << "Repetition factor must be greater than 1!" << endl; 2076 2077 faktor = 1; 2077 2078 } … … 2079 2080 if (mol->AtomCount != 0) { // if there is more than none 2080 2081 count = mol->AtomCount; // is changed becausing of adding, thus has to be stored away beforehand 2081 Elements = new element *[count];2082 Elements = new const element *[count]; 2082 2083 vectors = new Vector *[count]; 2083 2084 j = 0; … … 2097 2098 x.AddVector(&y); // per factor one cell width further 2098 2099 for (int k=count;k--;) { // go through every atom of the original cell 2099 first = new atom(); // create a new body2100 first = World::getInstance().createAtom(); // create a new body 2100 2101 first->x.CopyVector(vectors[k]); // use coordinate of original atom 2101 2102 first->x.AddVector(&x); // translate the coordinates … … 2168 2169 void cleanUp(config *configuration){ 2169 2170 UIFactory::purgeInstance(); 2170 World:: destroy();2171 World::purgeInstance(); 2171 2172 delete(configuration); 2172 2173 Log() << Verbose(0) << "Maximum of allocated memory: " … … 2177 2178 logger::purgeInstance(); 2178 2179 errorLogger::purgeInstance(); 2179 ActionRegistry::purge Registry();2180 ActionRegistry::purgeInstance(); 2180 2181 } 2181 2182 … … 2190 2191 char *ConfigFileName = NULL; 2191 2192 int j; 2193 2192 2194 setVerbosity(0); 2195 // need to init the history before any action is created 2196 ActionHistory::init(); 2193 2197 /* structure of ParseCommandLineOptions will be refactored later */ 2194 j = ParseCommandLineOptions(argc, argv, World::get ()->getMolecules(), World::get()->getPeriode(), *configuration, ConfigFileName);2198 j = ParseCommandLineOptions(argc, argv, World::getInstance().getMolecules(), World::getInstance().getPeriode(), *configuration, ConfigFileName); 2195 2199 switch (j){ 2196 2200 case 255: … … 2202 2206 break; 2203 2207 } 2204 if(World::get()->numMolecules() == 0){ 2205 mol = World::get()->createMolecule(); 2208 if(World::getInstance().numMolecules() == 0){ 2209 mol = World::getInstance().createMolecule(); 2210 World::getInstance().getMolecules()->insert(mol); 2211 cout << "Molecule created" << endl; 2206 2212 if(mol->cell_size[0] == 0.){ 2207 2213 Log() << Verbose(0) << "enter lower tridiagonal form of basis matrix" << endl << endl; … … 2223 2229 2224 2230 UIFactory::makeUserInterface(UIFactory::Text); 2225 MainWindow *mainWindow = UIFactory::get ()->makeMainWindow(populaters,World::get()->getMolecules(), configuration, World::get()->getPeriode(), ConfigFileName);2231 MainWindow *mainWindow = UIFactory::getInstance().makeMainWindow(populaters,World::getInstance().getMolecules(), configuration, World::getInstance().getPeriode(), ConfigFileName); 2226 2232 mainWindow->display(); 2227 2233 delete mainWindow; 2228 2234 } 2229 2235 2230 if(World::get ()->getPeriode()->StorePeriodentafel(configuration->databasepath))2236 if(World::getInstance().getPeriode()->StorePeriodentafel(configuration->databasepath)) 2231 2237 Log() << Verbose(0) << "Saving of elements.db successful." << endl; 2232 2238
Note:
See TracChangeset
for help on using the changeset viewer.