Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/Actions/WorldAction/RepeatBoxAction.cpp

    r952f38 rbf3817  
    55 *      Author: heber
    66 */
     7
     8// include config.h
     9#ifdef HAVE_CONFIG_H
     10#include <config.h>
     11#endif
    712
    813#include "Helpers/MemDebug.hpp"
     
    2126#include <iostream>
    2227#include <string>
     28#include <vector>
    2329
    2430using namespace std;
     
    9096
    9197  molecule *newmol = NULL;
    92   Vector ** vectors = NULL;
     98  std::vector<Vector> vectors;
    9399  for (n[0] = 0; n[0] < Repeater[0]; n[0]++) {
    94100    y[0] = n[0];
     
    105111          if (count != 0) {  // if there is more than none
    106112            Elements = new const element *[count];
    107             vectors = new Vector *[count];
     113            vectors.resize(count);
    108114            j = 0;
    109115            for(molecule::iterator AtomRunner = mol->begin(); AtomRunner != mol->end(); ++AtomRunner) {
    110               Elements[j] = (*AtomRunner)->type;
    111               vectors[j] = &(*AtomRunner)->x;
     116              Elements[j] = (*AtomRunner)->getType();
     117              vectors[j] = (*AtomRunner)->getPosition();
    112118              j++;
    113119            }
     
    120126            for (int k=count;k--;) { // go through every atom of the original cell
    121127              Walker = World::getInstance().createAtom(); // create a new body
    122               Walker->x = (*vectors[k]) + x;
    123               Walker->type = Elements[k];  // insert original element
     128              Walker->setPosition((vectors[k]) + x);
     129              Walker->setType(Elements[k]);  // insert original element
    124130              cout << "new atom is " << *Walker << endl;
    125131              newmol->AddAtom(Walker);        // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...)
     
    127133            // free memory
    128134            delete[](Elements);
    129             delete[](vectors);
    130135          } else {
    131136            DoLog(1) && (Log() << Verbose(1) << "\t ... is empty." << endl);
Note: See TracChangeset for help on using the changeset viewer.