Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/builder.cpp

    rd56640 raac3ef  
    7474#include "Menu/ActionMenuItem.hpp"
    7575#include "Actions/ActionRegistry.hpp"
    76 #include "Actions/ActionHistory.hpp"
    7776#include "Actions/MethodAction.hpp"
    7877#include "Actions/small_actions.hpp"
     
    14331432     }
    14341433     if (mol == NULL) {
    1435        mol = World::getInstance().createMolecule();
     1434       mol = new molecule(periode);
    14361435       mol->ActiveFlag = true;
    14371436       if (ConfigFileName != NULL)
     
    14821481                SaveFlag = true;
    14831482                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;
    14851484                first->type = periode->FindElement(atoi(argv[argptr]));
    14861485                if (first->type != NULL)
     
    15941593                }
    15951594                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]));
    15971596                FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL);
    15981597                int ranges[NDIM] = {1,1,1};
     
    16351634                Log() << Verbose(1) << "Filling Box with water molecules." << endl;
    16361635                // construct water molecule
    1637                 molecule *filler = World::getInstance().createMolecule();
     1636                molecule *filler = new molecule(periode);
    16381637                molecule *Filling = NULL;
    16391638                atom *second = NULL, *third = NULL;
     
    16421641//                first->x.Zero();
    16431642//                filler->AddAtom(first);
    1644                 first = World::getInstance().createAtom();
     1643                first = new atom();
    16451644                first->type = periode->FindElement(1);
    16461645                first->x.Init(0.441, -0.143, 0.);
    16471646                filler->AddAtom(first);
    1648                 second = World::getInstance().createAtom();
     1647                second = new atom();
    16491648                second->type = periode->FindElement(1);
    16501649                second->x.Init(-0.464, 1.137, 0.0);
    16511650                filler->AddAtom(second);
    1652                 third = World::getInstance().createAtom();
     1651                third = new atom();
    16531652                third->type = periode->FindElement(8);
    16541653                third->x.Init(-0.464, 0.177, 0.);
     
    16651664                  molecules->insert(Filling);
    16661665                }
    1667                 World::getInstance().destroyMolecule(filler);
     1666                delete(filler);
    16681667                argptr+=6;
    16691668              }
     
    20712070                  int faktor = atoi(argv[argptr++]);
    20722071                  int count;
    2073                   const element ** Elements;
     2072                  element ** Elements;
    20742073                  Vector ** vectors;
    20752074                  if (faktor < 1) {
    2076                     eLog() << Verbose(1) << "Repetition factor must be greater than 1!" << endl;
     2075                    eLog() << Verbose(1) << "Repetition factor mus be greater than 1!" << endl;
    20772076                    faktor = 1;
    20782077                  }
     
    20802079                  if (mol->AtomCount != 0) {  // if there is more than none
    20812080                    count = mol->AtomCount;   // is changed becausing of adding, thus has to be stored away beforehand
    2082                     Elements = new const element *[count];
     2081                    Elements = new element *[count];
    20832082                    vectors = new Vector *[count];
    20842083                    j = 0;
     
    20982097                      x.AddVector(&y); // per factor one cell width further
    20992098                      for (int k=count;k--;) { // go through every atom of the original cell
    2100                         first = World::getInstance().createAtom(); // create a new body
     2099                        first = new atom(); // create a new body
    21012100                        first->x.CopyVector(vectors[k]);  // use coordinate of original atom
    21022101                        first->x.AddVector(&x);      // translate the coordinates
     
    21692168void cleanUp(config *configuration){
    21702169  UIFactory::purgeInstance();
    2171   World::purgeInstance();
     2170  World::destroy();
    21722171  delete(configuration);
    21732172  Log() << Verbose(0) <<  "Maximum of allocated memory: "
     
    21782177  logger::purgeInstance();
    21792178  errorLogger::purgeInstance();
    2180   ActionRegistry::purgeInstance();
     2179  ActionRegistry::purgeRegistry();
    21812180}
    21822181
     
    21912190    char *ConfigFileName = NULL;
    21922191    int j;
    2193 
    21942192    setVerbosity(0);
    2195     // need to init the history before any action is created
    2196     ActionHistory::init();
    21972193    /* structure of ParseCommandLineOptions will be refactored later */
    2198     j = ParseCommandLineOptions(argc, argv,  World::getInstance().getMolecules(), World::getInstance().getPeriode(), *configuration, ConfigFileName);
     2194    j = ParseCommandLineOptions(argc, argv,  World::get()->getMolecules(), World::get()->getPeriode(), *configuration, ConfigFileName);
    21992195    switch (j){
    22002196        case 255:
     
    22062202            break;
    22072203    }
    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();
    22122206        if(mol->cell_size[0] == 0.){
    22132207            Log() << Verbose(0) << "enter lower tridiagonal form of basis matrix" << endl << endl;
     
    22292223
    22302224      UIFactory::makeUserInterface(UIFactory::Text);
    2231       MainWindow *mainWindow = UIFactory::getInstance().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);
    22322226      mainWindow->display();
    22332227      delete mainWindow;
    22342228    }
    22352229
    2236     if(World::getInstance().getPeriode()->StorePeriodentafel(configuration->databasepath))
     2230    if(World::get()->getPeriode()->StorePeriodentafel(configuration->databasepath))
    22372231        Log() << Verbose(0) << "Saving of elements.db successful." << endl;
    22382232
Note: See TracChangeset for help on using the changeset viewer.