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