Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/builder.cpp

    raac3ef rd56640  
    7474#include "Menu/ActionMenuItem.hpp"
    7575#include "Actions/ActionRegistry.hpp"
     76#include "Actions/ActionHistory.hpp"
    7677#include "Actions/MethodAction.hpp"
    7778#include "Actions/small_actions.hpp"
     
    14321433     }
    14331434     if (mol == NULL) {
    1434        mol = new molecule(periode);
     1435       mol = World::getInstance().createMolecule();
    14351436       mol->ActiveFlag = true;
    14361437       if (ConfigFileName != NULL)
     
    14811482                SaveFlag = true;
    14821483                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();
    14841485                first->type = periode->FindElement(atoi(argv[argptr]));
    14851486                if (first->type != NULL)
     
    15931594                }
    15941595                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]));
    15961597                FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL);
    15971598                int ranges[NDIM] = {1,1,1};
     
    16341635                Log() << Verbose(1) << "Filling Box with water molecules." << endl;
    16351636                // construct water molecule
    1636                 molecule *filler = new molecule(periode);
     1637                molecule *filler = World::getInstance().createMolecule();
    16371638                molecule *Filling = NULL;
    16381639                atom *second = NULL, *third = NULL;
     
    16411642//                first->x.Zero();
    16421643//                filler->AddAtom(first);
    1643                 first = new atom();
     1644                first = World::getInstance().createAtom();
    16441645                first->type = periode->FindElement(1);
    16451646                first->x.Init(0.441, -0.143, 0.);
    16461647                filler->AddAtom(first);
    1647                 second = new atom();
     1648                second = World::getInstance().createAtom();
    16481649                second->type = periode->FindElement(1);
    16491650                second->x.Init(-0.464, 1.137, 0.0);
    16501651                filler->AddAtom(second);
    1651                 third = new atom();
     1652                third = World::getInstance().createAtom();
    16521653                third->type = periode->FindElement(8);
    16531654                third->x.Init(-0.464, 0.177, 0.);
     
    16641665                  molecules->insert(Filling);
    16651666                }
    1666                 delete(filler);
     1667                World::getInstance().destroyMolecule(filler);
    16671668                argptr+=6;
    16681669              }
     
    20702071                  int faktor = atoi(argv[argptr++]);
    20712072                  int count;
    2072                   element ** Elements;
     2073                  const element ** Elements;
    20732074                  Vector ** vectors;
    20742075                  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;
    20762077                    faktor = 1;
    20772078                  }
     
    20792080                  if (mol->AtomCount != 0) {  // if there is more than none
    20802081                    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];
    20822083                    vectors = new Vector *[count];
    20832084                    j = 0;
     
    20972098                      x.AddVector(&y); // per factor one cell width further
    20982099                      for (int k=count;k--;) { // go through every atom of the original cell
    2099                         first = new atom(); // create a new body
     2100                        first = World::getInstance().createAtom(); // create a new body
    21002101                        first->x.CopyVector(vectors[k]);  // use coordinate of original atom
    21012102                        first->x.AddVector(&x);      // translate the coordinates
     
    21682169void cleanUp(config *configuration){
    21692170  UIFactory::purgeInstance();
    2170   World::destroy();
     2171  World::purgeInstance();
    21712172  delete(configuration);
    21722173  Log() << Verbose(0) <<  "Maximum of allocated memory: "
     
    21772178  logger::purgeInstance();
    21782179  errorLogger::purgeInstance();
    2179   ActionRegistry::purgeRegistry();
     2180  ActionRegistry::purgeInstance();
    21802181}
    21812182
     
    21902191    char *ConfigFileName = NULL;
    21912192    int j;
     2193
    21922194    setVerbosity(0);
     2195    // need to init the history before any action is created
     2196    ActionHistory::init();
    21932197    /* 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);
    21952199    switch (j){
    21962200        case 255:
     
    22022206            break;
    22032207    }
    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;
    22062212        if(mol->cell_size[0] == 0.){
    22072213            Log() << Verbose(0) << "enter lower tridiagonal form of basis matrix" << endl << endl;
     
    22232229
    22242230      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);
    22262232      mainWindow->display();
    22272233      delete mainWindow;
    22282234    }
    22292235
    2230     if(World::get()->getPeriode()->StorePeriodentafel(configuration->databasepath))
     2236    if(World::getInstance().getPeriode()->StorePeriodentafel(configuration->databasepath))
    22312237        Log() << Verbose(0) << "Saving of elements.db successful." << endl;
    22322238
Note: See TracChangeset for help on using the changeset viewer.