Changes in / [8d6d31:8f4df1]


Ignore:
Location:
src
Files:
19 added
2 deleted
80 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/AnalysisAction/MolecularVolumeAction.cpp

    r8d6d31 r8f4df1  
    6060    LCList = new LinkedCell(mol, 10.);
    6161    config * const configuration = World::getInstance().getConfig();
    62     Boundaries *BoundaryPoints = NULL;
    6362    //FindConvexBorder(mol, BoundaryPoints, TesselStruct, LCList, argv[argptr]);
    6463    FindNonConvexBorder(mol, TesselStruct, LCList, 5., NULL);
  • src/Actions/AnalysisAction/PairCorrelationAction.cpp

    r8d6d31 r8f4df1  
    7070  double BinStart = 0.;
    7171  double BinWidth = 0.;
    72   molecule *Boundary = NULL;
    7372  string outputname;
    7473  string binoutputname;
  • src/Actions/AnalysisAction/PointCorrelationAction.cpp

    r8d6d31 r8f4df1  
    7171  double BinStart = 0.;
    7272  double BinWidth = 0.;
    73   molecule *Boundary = NULL;
    7473  string outputname;
    7574  string binoutputname;
  • src/Actions/AnalysisAction/PrincipalAxisSystemAction.cpp

    r8d6d31 r8f4df1  
    6262    // sum up inertia tensor
    6363    for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    64       Vector x = (*iter)->x;
     64      Vector x = (*iter)->getPosition();
    6565      x -= *CenterOfGravity;
    66       InertiaTensor.at(0,0) += (*iter)->type->mass*(x[1]*x[1] + x[2]*x[2]);
    67       InertiaTensor.at(0,1) += (*iter)->type->mass*(-x[0]*x[1]);
    68       InertiaTensor.at(0,2) += (*iter)->type->mass*(-x[0]*x[2]);
    69       InertiaTensor.at(1,0) += (*iter)->type->mass*(-x[1]*x[0]);
    70       InertiaTensor.at(1,1) += (*iter)->type->mass*(x[0]*x[0] + x[2]*x[2]);
    71       InertiaTensor.at(1,2) += (*iter)->type->mass*(-x[1]*x[2]);
    72       InertiaTensor.at(2,0) += (*iter)->type->mass*(-x[2]*x[0]);
    73       InertiaTensor.at(2,1) += (*iter)->type->mass*(-x[2]*x[1]);
    74       InertiaTensor.at(2,2) += (*iter)->type->mass*(x[0]*x[0] + x[1]*x[1]);
     66      const double mass = (*iter)->getType()->mass;
     67      InertiaTensor.at(0,0) += mass*(x[1]*x[1] + x[2]*x[2]);
     68      InertiaTensor.at(0,1) += mass*(-x[0]*x[1]);
     69      InertiaTensor.at(0,2) += mass*(-x[0]*x[2]);
     70      InertiaTensor.at(1,0) += mass*(-x[1]*x[0]);
     71      InertiaTensor.at(1,1) += mass*(x[0]*x[0] + x[2]*x[2]);
     72      InertiaTensor.at(1,2) += mass*(-x[1]*x[2]);
     73      InertiaTensor.at(2,0) += mass*(-x[2]*x[0]);
     74      InertiaTensor.at(2,1) += mass*(-x[2]*x[1]);
     75      InertiaTensor.at(2,2) += mass*(x[0]*x[0] + x[1]*x[1]);
    7576    }
    7677    // print InertiaTensor for debugging
  • src/Actions/AnalysisAction/SurfaceCorrelationAction.cpp

    r8d6d31 r8f4df1  
    111111  // find biggest molecule
    112112  std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules();
    113   int counter  = molecules.size();
    114113  LCList = new LinkedCell(Boundary, LCWidth);
    115114  FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL);
  • src/Actions/AtomAction/AddAction.cpp

    r8d6d31 r8f4df1  
    6161  // execute action
    6262  atom * first = World::getInstance().createAtom();
    63   first->type = elemental;
    64   first->x = position;
    65   DoLog(1) && (Log() << Verbose(1) << "Adding new atom with element " << first->type->name << " at " << (first->x) << "." << endl);
     63  first->setType(elemental);
     64  first->setPosition(position);
     65  DoLog(1) && (Log() << Verbose(1) << "Adding new atom with element " << first->getType()->name << " at " << (first->getPosition()) << "." << endl);
    6666  // TODO: remove when all of World's atoms are stored.
    6767  std::vector<molecule *> molecules = World::getInstance().getAllMolecules();
  • src/Actions/AtomAction/ChangeElementAction.cpp

    r8d6d31 r8f4df1  
    6161    mol = first->getMolecule();
    6262    first->removeFromMolecule(); // remove atom
    63     first->type = elemental;
     63    first->setType(elemental);
    6464    mol->AddAtom(first);  // add atom to ensure correctness of formula
    6565  }
  • src/Actions/FragmentationAction/SubgraphDissectionAction.cpp

    r8d6d31 r8f4df1  
    1010#include "Actions/FragmentationAction/SubgraphDissectionAction.hpp"
    1111#include "Actions/ActionRegistry.hpp"
     12#include "Descriptors/MoleculeDescriptor.hpp"
     13
    1214#include "atom.hpp"
     15#include "bond.hpp"
     16#include "bondgraph.hpp"
    1317#include "config.hpp"
    1418#include "Helpers/Log.hpp"
    1519#include "molecule.hpp"
    16 #include "Descriptors/MoleculeDescriptor.hpp"
    1720#include "stackclass.hpp"
    1821#include "World.hpp"
     
    5356  // @TODO rather do the dissection afterwards
    5457  MoleculeListClass *molecules = World::getInstance().getMolecules();
    55   molecules->DissectMoleculeIntoConnectedSubgraphs(World::getInstance().getPeriode(), World::getInstance().getConfig());
     58  config * const configuration = World::getInstance().getConfig();
     59
     60  // 0a. remove all present molecules
     61  vector<molecule *> allmolecules = World::getInstance().getAllMolecules();
     62  for (vector<molecule *>::iterator MolRunner = allmolecules.begin(); MolRunner != allmolecules.end(); ++MolRunner) {
     63    molecules->erase(*MolRunner);
     64    World::getInstance().destroyMolecule(*MolRunner);
     65  }
     66
     67  // 0b. remove all bonds and construct a molecule with all atoms
     68  molecule *mol = World::getInstance().createMolecule();
     69  vector <atom *> allatoms = World::getInstance().getAllAtoms();
     70  for(vector<atom *>::iterator AtomRunner = allatoms.begin(); AtomRunner != allatoms.end(); ++AtomRunner) {
     71    for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); !(*AtomRunner)->ListOfBonds.empty(); BondRunner = (*AtomRunner)->ListOfBonds.begin())
     72      delete(*BondRunner);
     73    mol->AddAtom(*AtomRunner);
     74  }
     75
     76  // 1. create the bond structure of the single molecule
     77  if (configuration->BG != NULL) {
     78    if (!configuration->BG->ConstructBondGraph(mol)) {
     79      World::getInstance().destroyMolecule(mol);
     80      DoeLog(1) && (eLog()<< Verbose(1) << "There are no bonds." << endl);
     81      return Action::failure;
     82    }
     83  } else {
     84    DoeLog(1) && (eLog()<< Verbose(1) << "There is no BondGraph class present to create bonds." << endl);
     85    return Action::failure;
     86  }
     87
     88  // 2. scan for connected subgraphs
     89  MoleculeLeafClass *Subgraphs = NULL;      // list of subgraphs from DFS analysis
     90  class StackClass<bond *> *BackEdgeStack = NULL;
     91  Subgraphs = mol->DepthFirstSearchAnalysis(BackEdgeStack);
     92  delete(BackEdgeStack);
     93  if ((Subgraphs == NULL) || (Subgraphs->next == NULL)) {
     94    World::getInstance().destroyMolecule(mol);
     95    DoeLog(1) && (eLog()<< Verbose(1) << "There are no atoms." << endl);
     96    return Action::failure;
     97  }
     98
     99  // 3. dissect (the following construct is needed to have the atoms not in the order of the DFS, but in
     100  // the original one as parsed in)
     101  // TODO: Optimize this, when molecules just contain pointer list of global atoms!
     102
     103  // 4a. create array of molecules to fill
     104  const int MolCount = Subgraphs->next->Count();
     105  char number[MAXSTRINGSIZE];
     106  molecule **moleculelist = new molecule *[MolCount];
     107  MoleculeLeafClass *MolecularWalker = Subgraphs;
     108  for (int i=0;i<MolCount;i++) {
     109    MolecularWalker = MolecularWalker->next;
     110    moleculelist[i] = World::getInstance().createMolecule();
     111    moleculelist[i]->ActiveFlag = true;
     112    strncpy(moleculelist[i]->name, mol->name, MAXSTRINGSIZE);
     113    if (MolCount > 1) {
     114      sprintf(number, "-%d", i+1);
     115      strncat(moleculelist[i]->name, number, MAXSTRINGSIZE - strlen(mol->name) - 1);
     116    }
     117    DoLog(1) && (Log() << Verbose(1) << "MolName is " << moleculelist[i]->name << ", id is " << moleculelist[i]->getId() << endl);
     118    for (molecule::iterator iter = MolecularWalker->Leaf->begin(); iter != MolecularWalker->Leaf->end(); ++iter) {
     119      DoLog(1) && (Log() << Verbose(1) << **iter << endl);
     120    }
     121    molecules->insert(moleculelist[i]);
     122  }
     123
     124  // 4b. create and fill map of which atom is associated to which connected molecule (note, counting starts at 1)
     125  int FragmentCounter = 0;
     126  map<int, atom *> AtomToFragmentMap;
     127  MolecularWalker = Subgraphs;
     128  while (MolecularWalker->next != NULL) {
     129    MolecularWalker = MolecularWalker->next;
     130    for (molecule::iterator iter = MolecularWalker->Leaf->begin(); !MolecularWalker->Leaf->empty(); iter = MolecularWalker->Leaf->begin()) {
     131      atom * Walker = *iter;
     132      DoLog(1) && (Log() << Verbose(1) << "Re-linking " << Walker << "..." << endl);
     133      MolecularWalker->Leaf->erase(iter);
     134      moleculelist[FragmentCounter]->AddAtom(Walker);    // counting starts at 1
     135    }
     136    FragmentCounter++;
     137  }
     138  // TODO: When DepthFirstSearchAnalysis does not use AddCopyAtom() anymore, we don't need to delete all original atoms.
     139  // 4d. destroy the original molecule
     140  for (molecule::iterator AtomRunner = mol->begin(); !mol->empty(); AtomRunner = mol->begin())
     141    World::getInstance().destroyAtom(*AtomRunner);
     142  World::getInstance().destroyMolecule(mol);
     143
     144  // 4d. we don't need to redo bonds, as they are connected subgraphs and still maintain their ListOfBonds, but we have to remove them from first..last list
     145  // TODO: check whether this is really not needed anymore
     146  // 4e. free Leafs
     147  MolecularWalker = Subgraphs;
     148  while (MolecularWalker->next != NULL) {
     149    MolecularWalker = MolecularWalker->next;
     150    delete(MolecularWalker->previous);
     151  }
     152  delete(MolecularWalker);
     153  delete[](moleculelist);
     154  DoLog(1) && (Log() << Verbose(1) << "I scanned " << FragmentCounter << " molecules." << endl);
     155
    56156  return Action::success;
    57157}
  • src/Actions/MoleculeAction/RotateAroundOriginByAngleAction.cpp

    r8d6d31 r8f4df1  
    9191
    9292    for (molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    93       *((*iter)->node) = RotationAxis.rotateVector(*((*iter)->node), alpha);
     93      (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), alpha));
    9494    }
    9595  }
     
    109109
    110110    for (molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    111       *((*iter)->node) = RotationAxis.rotateVector(*((*iter)->node), -state->alpha);
     111      (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), -state->alpha));
    112112    }
    113113  }
     
    127127
    128128    for (molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    129       *((*iter)->node) = RotationAxis.rotateVector(*((*iter)->node), state->alpha);
     129      (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), state->alpha));
    130130    }
    131131  }
  • src/Actions/MoleculeAction/RotateAroundSelfByAngleAction.cpp

    r8d6d31 r8f4df1  
    9696
    9797  for (molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    98     *((*iter)->node) = RotationAxis.rotateVector(*((*iter)->node), alpha);
     98    (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), alpha));
    9999  }
    100100  DoLog(0) && (Log() << Verbose(0) << "done." << endl);
     
    111111
    112112  for (molecule::iterator iter = state->mol->begin(); iter != state->mol->end(); ++iter) {
    113     *((*iter)->node) = RotationAxis.rotateVector(*((*iter)->node), -state->alpha);
     113    (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), -state->alpha));
    114114  }
    115115
     
    125125
    126126  for (molecule::iterator iter = state->mol->begin(); iter != state->mol->end(); ++iter) {
    127     *((*iter)->node) = RotationAxis.rotateVector(*((*iter)->node), state->alpha);
     127    (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), state->alpha));
    128128  }
    129129
  • src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.cpp

    r8d6d31 r8f4df1  
    8383    // sum up inertia tensor
    8484    for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    85       Vector x = (*iter)->x;
     85      Vector x = (*iter)->getPosition();
    8686      x -= *CenterOfGravity;
    87       InertiaTensor.at(0,0) += (*iter)->type->mass*(x[1]*x[1] + x[2]*x[2]);
    88       InertiaTensor.at(0,1) += (*iter)->type->mass*(-x[0]*x[1]);
    89       InertiaTensor.at(0,2) += (*iter)->type->mass*(-x[0]*x[2]);
    90       InertiaTensor.at(1,0) += (*iter)->type->mass*(-x[1]*x[0]);
    91       InertiaTensor.at(1,1) += (*iter)->type->mass*(x[0]*x[0] + x[2]*x[2]);
    92       InertiaTensor.at(1,2) += (*iter)->type->mass*(-x[1]*x[2]);
    93       InertiaTensor.at(2,0) += (*iter)->type->mass*(-x[2]*x[0]);
    94       InertiaTensor.at(2,1) += (*iter)->type->mass*(-x[2]*x[1]);
    95       InertiaTensor.at(2,2) += (*iter)->type->mass*(x[0]*x[0] + x[1]*x[1]);
     87      const double mass = (*iter)->getType()->mass;
     88      InertiaTensor.at(0,0) += mass*(x[1]*x[1] + x[2]*x[2]);
     89      InertiaTensor.at(0,1) += mass*(-x[0]*x[1]);
     90      InertiaTensor.at(0,2) += mass*(-x[0]*x[2]);
     91      InertiaTensor.at(1,0) += mass*(-x[1]*x[0]);
     92      InertiaTensor.at(1,1) += mass*(x[0]*x[0] + x[2]*x[2]);
     93      InertiaTensor.at(1,2) += mass*(-x[1]*x[2]);
     94      InertiaTensor.at(2,0) += mass*(-x[2]*x[0]);
     95      InertiaTensor.at(2,1) += mass*(-x[2]*x[1]);
     96      InertiaTensor.at(2,2) += mass*(x[0]*x[0] + x[1]*x[1]);
    9697    }
    9798    // print InertiaTensor for debugging
     
    121122
    122123    for (molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    123       *((*iter)->node) -= *CenterOfGravity;
    124       *((*iter)->node) = RotationAxis.rotateVector(*((*iter)->node), alpha);
    125       *((*iter)->node) += *CenterOfGravity;
     124      *(*iter) -= *CenterOfGravity;
     125      (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), alpha));
     126      *(*iter) += *CenterOfGravity;
    126127    }
    127128    DoLog(0) && (Log() << Verbose(0) << "done." << endl);
     
    133134    // sum up inertia tensor
    134135    for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    135       Vector x = (*iter)->x;
     136      Vector x = (*iter)->getPosition();
    136137      x -= *CenterOfGravity;
    137       InertiaTensor.at(0,0) += (*iter)->type->mass*(x[1]*x[1] + x[2]*x[2]);
    138       InertiaTensor.at(0,1) += (*iter)->type->mass*(-x[0]*x[1]);
    139       InertiaTensor.at(0,2) += (*iter)->type->mass*(-x[0]*x[2]);
    140       InertiaTensor.at(1,0) += (*iter)->type->mass*(-x[1]*x[0]);
    141       InertiaTensor.at(1,1) += (*iter)->type->mass*(x[0]*x[0] + x[2]*x[2]);
    142       InertiaTensor.at(1,2) += (*iter)->type->mass*(-x[1]*x[2]);
    143       InertiaTensor.at(2,0) += (*iter)->type->mass*(-x[2]*x[0]);
    144       InertiaTensor.at(2,1) += (*iter)->type->mass*(-x[2]*x[1]);
    145       InertiaTensor.at(2,2) += (*iter)->type->mass*(x[0]*x[0] + x[1]*x[1]);
     138      const double mass = (*iter)->getType()->mass;
     139      InertiaTensor.at(0,0) += mass*(x[1]*x[1] + x[2]*x[2]);
     140      InertiaTensor.at(0,1) += mass*(-x[0]*x[1]);
     141      InertiaTensor.at(0,2) += mass*(-x[0]*x[2]);
     142      InertiaTensor.at(1,0) += mass*(-x[1]*x[0]);
     143      InertiaTensor.at(1,1) += mass*(x[0]*x[0] + x[2]*x[2]);
     144      InertiaTensor.at(1,2) += mass*(-x[1]*x[2]);
     145      InertiaTensor.at(2,0) += mass*(-x[2]*x[0]);
     146      InertiaTensor.at(2,1) += mass*(-x[2]*x[1]);
     147      InertiaTensor.at(2,2) += mass*(x[0]*x[0] + x[1]*x[1]);
    146148      // print InertiaTensor for debugging
    147149      DoLog(0) && (Log() << Verbose(0) << "The inertia tensor is:" << InertiaTensor << endl);
  • src/Actions/TesselationAction/ConvexEnvelopeAction.cpp

    r8d6d31 r8f4df1  
    8484    DoLog(1) && (Log() << Verbose(1) << "Storing tecplot non-convex data in " << filenameNonConvex << "." << endl);
    8585    LCList = new LinkedCell(mol, 100.);
    86     Boundaries *BoundaryPoints = NULL;
    8786    //FindConvexBorder(mol, BoundaryPoints, TesselStruct, LCList, argv[argptr]);
    8887    // TODO: Beide Funktionen sollten streams anstelle des Filenamen benutzen, besser fuer unit tests
  • src/Actions/WorldAction/AddEmptyBoundaryAction.cpp

    r8d6d31 r8f4df1  
    6060  ASSERT(AllAtoms.size() > 0, "There must be atoms present for AddingEmptyBoundary.");
    6161  vector<atom *>::iterator AtomRunner = AllAtoms.begin();
    62   Min = (*AtomRunner)->x;
    63   Max = (*AtomRunner)->x;
     62  Min = (*AtomRunner)->getPosition();
     63  Max = (*AtomRunner)->getPosition();
    6464  for (; AtomRunner != AllAtoms.end(); ++AtomRunner) {
    6565    for (int i=0;i<NDIM;i++) {
    66       if ((*AtomRunner)->x[i] > Max[i])
    67         Max[i] = (*AtomRunner)->x[i];
    68       if ((*AtomRunner)->x[i] < Min[i])
    69         Min[i] = (*AtomRunner)->x[i];
     66      if ((*AtomRunner)->at(i) > Max[i])
     67        Max[i] = (*AtomRunner)->at(i);
     68      if ((*AtomRunner)->at(i) < Min[i])
     69        Min[i] = (*AtomRunner)->at(i);
    7070    }
    7171  }
     
    8484  AtomRunner = AllAtoms.begin();
    8585  for (; AtomRunner != AllAtoms.end(); ++AtomRunner)
    86     (*AtomRunner)->x -= Min - boundary;
     86    *(*AtomRunner) -= Min - boundary;
    8787  return Action::success;
    8888}
  • src/Actions/WorldAction/CenterOnEdgeAction.cpp

    r8d6d31 r8f4df1  
    5555  ASSERT(AllAtoms.size() > 0, "For CenteronEdge atoms must be present.");
    5656  vector<atom *>::iterator AtomRunner = AllAtoms.begin();
    57   Min = (*AtomRunner)->x;
    58   Max = (*AtomRunner)->x;
     57  Min = (*AtomRunner)->getPosition();
     58  Max = (*AtomRunner)->getPosition();
    5959  for (; AtomRunner != AllAtoms.end(); ++AtomRunner) {
    6060    for (int i=0;i<NDIM;i++) {
    61       if ((*AtomRunner)->x[i] > Max[i])
    62         Max[i] = (*AtomRunner)->x[i];
    63       if ((*AtomRunner)->x[i] < Min[i])
    64         Min[i] = (*AtomRunner)->x[i];
     61      if ((*AtomRunner)->at(i) > Max[i])
     62        Max[i] = (*AtomRunner)->at(i);
     63      if ((*AtomRunner)->at(i) < Min[i])
     64        Min[i] = (*AtomRunner)->at(i);
    6565    }
    6666  }
     
    7575  // translate all atoms, such that Min is aty (0,0,0)
    7676  for (vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner)
    77     (*AtomRunner)->x -= Min;
     77    *(*AtomRunner) -= Min;
    7878
    7979  return Action::success;
  • src/Actions/WorldAction/RemoveSphereOfAtomsAction.cpp

    r8d6d31 r8f4df1  
    6262  vector<molecule *> molecules = World::getInstance().getAllMolecules();
    6363  for (vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner) {
    64     if (point.DistanceSquared((*AtomRunner)->x) > radius*radius) { // distance to first above radius ...
     64    if ((*AtomRunner)->DistanceSquared(point) > radius*radius) { // distance to first above radius ...
     65//      cout << "Removing " << (*AtomRunner)->getType()->symbol << (*AtomRunner)->getId() << " at " << (*AtomRunner)->getPosition() << " as distance is " << sqrt((*AtomRunner)->DistanceSquared(point)) << endl;
    6566      // TODO: This is not necessary anymore when atoms are completely handled by World (create/destroy and load/save)
    6667      for (vector<molecule *>::iterator iter = molecules.begin();iter != molecules.end();++iter)
     
    6869      World::getInstance().destroyAtom(*AtomRunner);
    6970    }
     71//    else {
     72//      cout << "Keeping" << (*AtomRunner)->getType()->symbol << (*AtomRunner)->getId() << " at " << (*AtomRunner)->getPosition() << " as distance is " << sqrt((*AtomRunner)->DistanceSquared(point)) << endl;
     73//    }
    7074  }
    7175  return Action::success;
  • src/Actions/WorldAction/RepeatBoxAction.cpp

    r8d6d31 r8f4df1  
    2121#include <iostream>
    2222#include <string>
     23#include <vector>
    2324
    2425using namespace std;
     
    9091
    9192  molecule *newmol = NULL;
    92   Vector ** vectors = NULL;
     93  std::vector<Vector> vectors;
    9394  for (n[0] = 0; n[0] < Repeater[0]; n[0]++) {
    9495    y[0] = n[0];
     
    105106          if (count != 0) {  // if there is more than none
    106107            Elements = new const element *[count];
    107             vectors = new Vector *[count];
     108            vectors.resize(count);
    108109            j = 0;
    109110            for(molecule::iterator AtomRunner = mol->begin(); AtomRunner != mol->end(); ++AtomRunner) {
    110               Elements[j] = (*AtomRunner)->type;
    111               vectors[j] = &(*AtomRunner)->x;
     111              Elements[j] = (*AtomRunner)->getType();
     112              vectors[j] = (*AtomRunner)->getPosition();
    112113              j++;
    113114            }
     
    120121            for (int k=count;k--;) { // go through every atom of the original cell
    121122              Walker = World::getInstance().createAtom(); // create a new body
    122               Walker->x = (*vectors[k]) + x;
    123               Walker->type = Elements[k];  // insert original element
     123              Walker->setPosition((vectors[k]) + x);
     124              Walker->setType(Elements[k]);  // insert original element
    124125              cout << "new atom is " << *Walker << endl;
    125126              newmol->AddAtom(Walker);        // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...)
     
    127128            // free memory
    128129            delete[](Elements);
    129             delete[](vectors);
    130130          } else {
    131131            DoLog(1) && (Log() << Verbose(1) << "\t ... is empty." << endl);
  • src/Actions/WorldAction/ScaleBoxAction.cpp

    r8d6d31 r8f4df1  
    6060  vector<atom*> AllAtoms = World::getInstance().getAllAtoms();
    6161  for(vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner) {
    62     (*AtomRunner)->x.ScaleAll(x);
     62    (*AtomRunner)->ScaleAll(x);
    6363  }
    6464
  • src/AtomSet.hpp

    r8d6d31 r8f4df1  
    6565    workOnNodePointer(Function &_f) : f(_f){}
    6666    void operator()(atom *atom){
    67       if(atom->node)
    68         *atom->node = f(*atom->node);
     67      atom->setPosition(f(atom->getPosition()));
    6968    }
    7069    Function &f;
     
    7574inline void AtomSetMixin<Set>::translate(const Vector &translater){
    7675  BOOST_FOREACH(atom *atom,*this){
    77     if(atom->node){
    78       *(atom->node) += translater;
    79     }
     76    *(atom) += translater;
    8077  }
    8178}
  • src/Legacy/oldmenu.cpp

    r8d6d31 r8f4df1  
    8989        first = World::getInstance().createAtom();
    9090        std::vector<element *> elements;
    91         dialog->queryVector("Please enter coordinates: ",&first->x,World::getInstance().getDomain(), false);
     91        dialog->queryVector("Please enter coordinates: ",&first->AtomicPosition,World::getInstance().getDomain(), false);
    9292        dialog->queryElement("Please choose element: ",&elements);
    9393        if(dialog->display()){
    9494          if (elements.size() == 1) {
    95             first->type = elements.at(0);
     95            first->setType(elements.at(0));
    9696            mol->AddAtom(first);  // add to molecule
    9797          } else {
     
    113113          auto_ptr<Dialog> dialog(UIFactory::getInstance().makeDialog());
    114114          dialog->queryVector("Enter reference coordinates.",&x,World::getInstance().getDomain(), true);
    115           dialog->queryVector("Enter relative coordinates.",&first->x,World::getInstance().getDomain(), false);
     115          dialog->queryVector("Enter relative coordinates.",&first->AtomicPosition,World::getInstance().getDomain(), false);
    116116          if((aborted = !dialog->display())){
    117117            continue;
    118118          }
    119           first->x += x;
    120         } while (!aborted && !(valid = mol->CheckBounds((const Vector *)&first->x)));
     119          first->AtomicPosition += x;
     120        } while (!aborted && !(valid = mol->CheckBounds((const Vector *)&first->AtomicPosition)));
    121121        if(!aborted){
    122           first->type = periode->AskElement();  // give type
     122          first->AtomicElement = periode->AskElement();  // give type
    123123          mol->AddAtom(first);  // add to molecule
    124124        }
     
    136136          auto_ptr<Dialog> dialog(UIFactory::getInstance().makeDialog());
    137137          second = mol->AskAtom("Enter atom number: ");
    138           dialog->queryVector("Enter relative coordinates.",&first->x,World::getInstance().getDomain(), false);
     138          dialog->queryVector("Enter relative coordinates.",&first->AtomicPosition,World::getInstance().getDomain(), false);
    139139          dialog->display();
    140140          for (int i=NDIM;i--;) {
    141             first->x[i] += second->x[i];
     141            first->AtomicPosition[i] += second->AtomicPosition[i];
    142142          }
    143         } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
    144         first->type = periode->AskElement();  // give type
     143        } while (!(valid = mol->CheckBounds((const Vector *)&first->AtomicPosition)));
     144        first->AtomicElement = periode->AskElement();  // give type
    145145        mol->AddAtom(first);  // add to molecule
    146146      }
     
    152152        do {
    153153          if (!valid) {
    154             eLog() << Verbose(2) << "Resulting coordinates out of cell - " << first->x << endl;
     154            eLog() << Verbose(2) << "Resulting coordinates out of cell - " << first->AtomicPosition << endl;
    155155          }
    156156          Log() << Verbose(0) << "First, we need two atoms, the first atom is the central, while the second is the outer one." << endl;
     
    185185          */
    186186          // calc axis vector
    187           x= second->x - third->x;
     187          x= second->AtomicPosition - third->AtomicPosition;
    188188          x.Normalize();
    189189          Log() << Verbose(0) << "x: " << x << endl;
    190           z = Plane(second->x,third->x,fourth->x).getNormal();
     190          z = Plane(second->AtomicPosition,third->AtomicPosition,fourth->AtomicPosition).getNormal();
    191191          Log() << Verbose(0) << "z: " << z << endl;
    192192          y = Plane(x,z,0).getNormal();
     
    194194
    195195          // rotate vector around first angle
    196           first->x = x;
    197           first->x = Line(zeroVec,z).rotateVector(first->x,b - M_PI);
    198           Log() << Verbose(0) << "Rotated vector: " << first->x << endl,
     196          first->AtomicPosition = x;
     197          first->AtomicPosition = Line(zeroVec,z).rotateVector(first->AtomicPosition,b - M_PI);
     198          Log() << Verbose(0) << "Rotated vector: " << first->AtomicPosition << endl,
    199199          // remove the projection onto the rotation plane of the second angle
    200200          n = y;
    201           n.Scale(first->x.ScalarProduct(y));
     201          n.Scale(first->AtomicPosition.ScalarProduct(y));
    202202          Log() << Verbose(0) << "N1: " << n << endl;
    203           first->x -= n;
    204           Log() << Verbose(0) << "Subtracted vector: " << first->x << endl;
     203          first->AtomicPosition -= n;
     204          Log() << Verbose(0) << "Subtracted vector: " << first->AtomicPosition << endl;
    205205          n = z;
    206           n.Scale(first->x.ScalarProduct(z));
     206          n.Scale(first->AtomicPosition.ScalarProduct(z));
    207207          Log() << Verbose(0) << "N2: " << n << endl;
    208           first->x -= n;
    209           Log() << Verbose(0) << "2nd subtracted vector: " << first->x << endl;
     208          first->AtomicPosition -= n;
     209          Log() << Verbose(0) << "2nd subtracted vector: " << first->AtomicPosition << endl;
    210210
    211211          // rotate another vector around second angle
     
    215215
    216216          // add the two linear independent vectors
    217           first->x += n;
    218           first->x.Normalize();
    219           first->x.Scale(a);
    220           first->x += second->x;
    221 
    222           Log() << Verbose(0) << "resulting coordinates: " << first->x << endl;
    223         } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
    224         first->type = periode->AskElement();  // give type
     217          first->AtomicPosition += n;
     218          first->AtomicPosition.Normalize();
     219          first->AtomicPosition.Scale(a);
     220          first->AtomicPosition += second->AtomicPosition;
     221
     222          Log() << Verbose(0) << "resulting coordinates: " << first->AtomicPosition << endl;
     223        } while (!(valid = mol->CheckBounds((const Vector *)&first->AtomicPosition)));
     224        first->AtomicElement = periode->AskElement();  // give type
    225225        mol->AddAtom(first);  // add to molecule
    226226        break;
     
    239239          if (j != -1) {
    240240            second = mol->FindAtom(j);
    241             atoms[i++] = &(second->x);
     241            atoms[i++] = &(second->AtomicPosition);
    242242          }
    243243        } while ((j != -1) && (i<128));
    244244        if (i >= 2) {
    245           LSQdistance(first->x,(const Vector **)atoms, i);
    246 
    247           Log() << Verbose(0) << first->x;
    248           first->type = periode->AskElement();  // give type
     245          LSQdistance(first->AtomicPosition,(const Vector **)atoms, i);
     246
     247          Log() << Verbose(0) << first->AtomicPosition;
     248          first->AtomicElement = periode->AskElement();  // give type
    249249          mol->AddAtom(first);  // add to molecule
    250250        } else {
     
    338338      third = mol->AskAtom("Enter third atom: ");
    339339
    340       n = Plane(first->x,second->x,third->x).getNormal();
     340      n = Plane(first->AtomicPosition,second->AtomicPosition,third->AtomicPosition).getNormal();
    341341      break;
    342342    case 'b': // normal vector of mirror plane
     
    354354      second = mol->AskAtom("Enter second atom: ");
    355355
    356       n = first->x - second->x;
     356      n = first->AtomicPosition - second->AtomicPosition;
    357357      n.Normalize();
    358358      break;
     
    405405      third = mol->AskAtom("Enter third atom: ");
    406406
    407       n = Plane(first->x,second->x,third->x).getNormal();
     407      n = Plane(first->AtomicPosition,second->AtomicPosition,third->AtomicPosition).getNormal();
    408408      break;
    409409    case 'b': // normal vector of mirror plane
     
    421421      second = mol->AskAtom("Enter second atom: ");
    422422
    423       n = first->x - second->x;
     423      n = first->AtomicPosition - second->AtomicPosition;
    424424      n.Normalize();
    425425      break;
     
    464464        for (molecule::iterator iter = mol->begin(); iter != mol->end(); ) {
    465465          runner = iter++;
    466           if ((*runner)->x.DistanceSquared((*runner)->x) > tmp1*tmp1) // distance to first above radius ...
     466          if ((*runner)->AtomicPosition.DistanceSquared((*runner)->AtomicPosition) > tmp1*tmp1) // distance to first above radius ...
    467467            mol->RemoveAtom((*runner));
    468468        }
     
    479479      for (molecule::iterator iter = mol->begin(); iter != mol->end(); ) {
    480480        runner = iter++;
    481         if (((*runner)->x[axis] < tmp1) || ((*runner)->x[axis] > tmp2)) {// out of boundary ...
     481        if (((*runner)->AtomicPosition[axis] < tmp1) || ((*runner)->AtomicPosition[axis] > tmp2)) {// out of boundary ...
    482482          //Log() << Verbose(0) << "Atom " << *(*runner) << " with " << (*runner)->x.x[axis] << " on axis " << axis << " is out of bounds [" << tmp1 << "," << tmp2 << "]." << endl;
    483483          mol->RemoveAtom((*runner));
     
    526526
    527527      for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    528         Z = (*iter)->type->Z;
     528        Z = (*iter)->getType()->Z;
    529529        tmp1 = 0.;
    530530        if (first != (*iter)) {
    531           x = first->x - (*iter)->x;
     531          x = first->AtomicPosition - (*iter)->AtomicPosition;
    532532          tmp1 = x.Norm();
    533533        }
     
    536536      }
    537537      for (int i=MAX_ELEMENTS;i--;)
    538         if (min[i] != 0.) Log() << Verbose(0) << "Minimum Bond length between " << first->type->name << " Atom " << first->nr << " and next Ion of type " << (periode->FindElement(i))->name << ": " << min[i] << " a.u." << endl;
     538        if (min[i] != 0.) Log() << Verbose(0) << "Minimum Bond length between " << first->getType()->name << " Atom " << first->nr << " and next Ion of type " << (periode->FindElement(i))->name << ": " << min[i] << " a.u." << endl;
    539539      break;
    540540
     
    544544      for (int i=NDIM;i--;)
    545545        min[i] = 0.;
    546       x = first->x - second->x;
     546      x = first->AtomicPosition - second->AtomicPosition;
    547547      tmp1 = x.Norm();
    548548      Log() << Verbose(1) << "Distance vector is " << x << "." << "/n"
     
    556556      third  = mol->AskAtom("Enter last atom: ");
    557557      tmp1 = tmp2 = tmp3 = 0.;
    558       x = first->x - second->x;
    559       y = third->x - second->x;
     558      x = first->AtomicPosition - second->AtomicPosition;
     559      y = third->AtomicPosition - second->AtomicPosition;
    560560      Log() << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": ";
    561561      Log() << Verbose(0) << (acos(x.ScalarProduct(y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl;
     
    695695        minBond = 0.;
    696696        for (int i=NDIM;i--;)
    697           minBond += (first->x[i]-second->x[i])*(first->x[i] - second->x[i]);
     697          minBond += (first->AtomicPosition[i]-second->AtomicPosition[i])*(first->AtomicPosition[i] - second->AtomicPosition[i]);
    698698        minBond = sqrt(minBond);
    699         Log() << Verbose(0) << "Current Bond length between " << first->type->name << " Atom " << first->nr << " and " << second->type->name << " Atom " << second->nr << ": " << minBond << " a.u." << endl;
     699        Log() << Verbose(0) << "Current Bond length between " << first->getType()->name << " Atom " << first->nr << " and " << second->getType()->name << " Atom " << second->nr << ": " << minBond << " a.u." << endl;
    700700        Log() << Verbose(0) << "Enter new bond length [a.u.]: ";
    701701        cin >> bond;
    702702        for (int i=NDIM;i--;) {
    703           second->x[i] -= (second->x[i]-first->x[i])/minBond*(minBond-bond);
     703          second->AtomicPosition[i] -= (second->AtomicPosition[i]-first->AtomicPosition[i])/minBond*(minBond-bond);
    704704        }
    705705        //Log() << Verbose(0) << "New coordinates of Atom " << second->nr << " are: ";
     
    757757        cin >> Z;
    758758        first->setType(Z);
    759         Log() << Verbose(0) << "Atom " << first->nr << "'s element is " << first->type->name << "." << endl;
     759        Log() << Verbose(0) << "Atom " << first->nr << "'s element is " << first->getType()->name << "." << endl;
    760760      }
    761761      break;
     
    785785      j = 0;
    786786      for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    787         Elements[j] = (*iter)->type;
    788         vectors[j] = &(*iter)->x;
     787        Elements[j] = (*iter)->AtomicElement;
     788        vectors[j] = &(*iter)->AtomicPosition;
    789789        j++;
    790790      }
     
    798798        for (int k=count;k--;) { // go through every atom of the original cell
    799799          first = World::getInstance().createAtom(); // create a new body
    800           first->x = (*vectors[k]) + x;  // use coordinate of original atom
    801           first->type = Elements[k];  // insert original element
     800          first->AtomicPosition = (*vectors[k]) + x;  // use coordinate of original atom
     801          first->AtomicElement = Elements[k];  // insert original element
    802802          mol->AddAtom(first);        // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...)
    803803        }
  • src/LinearAlgebra/Makefile.am

    r8d6d31 r8f4df1  
    1717  Plane.cpp \
    1818  Space.cpp \
    19   Vector.cpp
     19  vector_ops.cpp \
     20  Vector.cpp \
     21  VectorInterface.cpp
    2022                           
    2123LINALGHEADER = \
     
    2729  Plane.hpp \
    2830  Space.hpp \
    29   Vector.hpp
     31  vector_ops.hpp \
     32  Vector.hpp \
     33  VectorInterface.hpp
    3034
    3135
  • src/LinearAlgebra/Vector.cpp

    r8d6d31 r8f4df1  
    5050  gsl_vector_set(content->content,1,x2);
    5151  gsl_vector_set(content->content,2,x3);
     52};
     53
     54/** Constructor of class vector.
     55 */
     56Vector::Vector(const double x[3])
     57{
     58  content = new VectorContent();
     59  gsl_vector_set(content->content,0,x[0]);
     60  gsl_vector_set(content->content,1,x[1]);
     61  gsl_vector_set(content->content,2,x[2]);
    5262};
    5363
  • src/LinearAlgebra/Vector.hpp

    r8d6d31 r8f4df1  
    3636  Vector();
    3737  Vector(const double x1, const double x2, const double x3);
     38  Vector(const double x[3]);
    3839  Vector(const Vector& src);
    3940  virtual ~Vector();
  • src/Makefile.am

    r8d6d31 r8f4df1  
    120120QTUI_DEFS =
    121121
     122TESSELATIONSOURCE = \
     123  BoundaryLineSet.cpp \
     124  BoundaryPointSet.cpp \
     125  BoundaryPolygonSet.cpp \
     126  BoundaryTriangleSet.cpp \
     127  CandidateForTesselation.cpp \
     128  PointCloud.cpp \
     129  tesselation.cpp \
     130  tesselationhelpers.cpp \
     131  TesselPoint.cpp
     132 
     133TESSELATIONHEADER = \
     134  BoundaryLineSet.hpp \
     135  BoundaryPointSet.hpp \
     136  BoundaryPolygonSet.hpp \
     137  BoundaryTriangleSet.hpp \
     138  CandidateForTesselation.hpp \
     139  PointCloud.hpp \
     140  tesselation.hpp \
     141  tesselationhelpers.hpp \
     142  TesselPoint.hpp
     143
    122144MOLECUILDERSOURCE = \
    123145  ${ANALYSISSOURCE} \
     
    125147  ${ATOMSOURCE} \
    126148  ${PATTERNSOURCE} \
    127   ${PARSERSOURCE} \
    128149  ${SHAPESOURCE} \
    129150  ${DESCRIPTORSOURCE} \
     151  ${TESSELATIONSOURCE} \
    130152  bond.cpp \
    131153  bondgraph.cpp \
     
    151173  parser.cpp \
    152174  periodentafel.cpp \
    153   tesselation.cpp \
    154   tesselationhelpers.cpp \
    155175  ThermoStatContainer.cpp \
    156176  triangleintersectionlist.cpp \
    157177  UIElements/UIFactory.cpp \
    158   vector_ops.cpp \
    159178  World.cpp
    160179
     
    163182  ${ACTIONSHEADER} \
    164183  ${ATOMHEADER} \
    165   ${PARSERHEADER} \
    166184  ${PATTERNHEADER} \
    167185  ${SHAPEHEADER} \
    168186  ${DESCRIPTORHEADER} \
     187  ${TESSELATIONHEADER} \
    169188  bond.hpp \
    170189  bondgraph.hpp \
     
    188207  periodentafel.hpp \
    189208  stackclass.hpp \
    190   tesselation.hpp \
    191   tesselationhelpers.hpp \
    192209  ThermoStatContainer.hpp \
    193210  triangleintersectionlist.hpp \
    194211  UIElements/UIFactory.hpp \
    195   vector_ops.hpp \
    196212  World.hpp
    197213
  • src/Parser/MpqcParser.cpp

    r8d6d31 r8f4df1  
    6262  // calculate center
    6363  for (vector<atom *>::iterator runner = allatoms.begin();runner != allatoms.end(); ++runner)
    64     center += (*runner)->x;
     64    center += (*runner)->getPosition();
    6565  center.Scale(1./allatoms.size());
    6666
     
    110110  // calculate center
    111111  for (vector<atom *>::iterator runner = allatoms.begin();runner != allatoms.end(); ++runner)
    112     center += (*runner)->x;
     112    center += (*runner)->getPosition();
    113113  center.Scale(1./allatoms.size());
    114114
  • src/Parser/PcpParser.cpp

    r8d6d31 r8f4df1  
    462462  PlaneWaveSpecifics.MaxPsiDouble = PlaneWaveSpecifics.PsiMaxNoDown = PlaneWaveSpecifics.PsiMaxNoUp = PlaneWaveSpecifics.PsiType = 0;
    463463  for (vector<atom *>::iterator runner = allatoms.begin(); runner != allatoms.end(); ++runner) {
    464     PlaneWaveSpecifics.MaxPsiDouble += (*runner)->type->NoValenceOrbitals;
     464    PlaneWaveSpecifics.MaxPsiDouble += (*runner)->getType()->NoValenceOrbitals;
    465465  }
    466466  cout << PlaneWaveSpecifics.MaxPsiDouble << endl;
     
    497497  // insert all found elements into the map
    498498  for (vector<atom *>::iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) {
    499     Inserter = PresentElements.insert(pair<int, int>((*AtomRunner)->type->Z, 1));
     499    Inserter = PresentElements.insert(pair<int, int>((*AtomRunner)->getType()->Z, 1));
    500500    if (!Inserter.second) // increase if present
    501501      Inserter.first->second += 1;
     
    528528  int nr = 0;
    529529  for (vector<atom *>::iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) {
    530     Inserter = ZtoCountMap.insert( pair<int, int>((*AtomRunner)->type->Z, 1) );
     530    Inserter = ZtoCountMap.insert( pair<int, int>((*AtomRunner)->getType()->Z, 1) );
    531531    if (!Inserter.second)
    532532      Inserter.first->second += 1;
    533     const int Z = (*AtomRunner)->type->Z;
     533    const int Z = (*AtomRunner)->getType()->Z;
    534534    *file << "Ion_Type" << ZtoIndexMap[Z] << "_" << ZtoCountMap[Z] << "\t"  << fixed << setprecision(9) << showpoint;
    535     *file << (*AtomRunner)->x[0] << "\t" << (*AtomRunner)->x[1] << "\t" << (*AtomRunner)->x[2];
     535    *file << (*AtomRunner)->at(0) << "\t" << (*AtomRunner)->at(1) << "\t" << (*AtomRunner)->at(2);
    536536    *file << "\t" << (*AtomRunner)->FixedIon;
    537     if ((*AtomRunner)->v.Norm() > MYEPSILON)
    538       *file << "\t" << scientific << setprecision(6) << (*AtomRunner)->v[0] << "\t" << (*AtomRunner)->v[1] << "\t" << (*AtomRunner)->v[2] << "\t";
     537    if ((*AtomRunner)->AtomicVelocity.Norm() > MYEPSILON)
     538      *file << "\t" << scientific << setprecision(6) << (*AtomRunner)->AtomicVelocity[0] << "\t" << (*AtomRunner)->AtomicVelocity[1] << "\t" << (*AtomRunner)->AtomicVelocity[2] << "\t";
    539539    *file << " # molecule nr " << nr++ << endl;
    540540  }
  • src/Parser/TremoloParser.cpp

    r8d6d31 r8f4df1  
    143143      case TremoloKey::x :
    144144        // for the moment, assume there are always three dimensions
    145         *file << currentAtom->x[0] << "\t";
    146         *file << currentAtom->x[1] << "\t";
    147         *file << currentAtom->x[2] << "\t";
     145        *file << currentAtom->at(0) << "\t";
     146        *file << currentAtom->at(1) << "\t";
     147        *file << currentAtom->at(2) << "\t";
    148148        break;
    149149      case TremoloKey::u :
    150150        // for the moment, assume there are always three dimensions
    151         *file << currentAtom->v[0] << "\t";
    152         *file << currentAtom->v[1] << "\t";
    153         *file << currentAtom->v[2] << "\t";
     151        *file << currentAtom->AtomicVelocity[0] << "\t";
     152        *file << currentAtom->AtomicVelocity[1] << "\t";
     153        *file << currentAtom->AtomicVelocity[2] << "\t";
    154154        break;
    155155      case TremoloKey::Type :
     
    228228  string word;
    229229  int oldId;
     230  double tmp;
    230231
    231232  lineStream << line;
     
    235236      case TremoloKey::x :
    236237        // for the moment, assume there are always three dimensions
    237         lineStream >> newAtom->x[0];
    238         lineStream >> newAtom->x[1];
    239         lineStream >> newAtom->x[2];
     238        for (int i=0;i<NDIM;i++) {
     239          lineStream >> tmp;
     240          newAtom->set(i, tmp);
     241        }
    240242        break;
    241243      case TremoloKey::u :
    242244        // for the moment, assume there are always three dimensions
    243         lineStream >> newAtom->v[0];
    244         lineStream >> newAtom->v[1];
    245         lineStream >> newAtom->v[2];
     245        lineStream >> newAtom->AtomicVelocity[0];
     246        lineStream >> newAtom->AtomicVelocity[1];
     247        lineStream >> newAtom->AtomicVelocity[2];
    246248        break;
    247249      case TremoloKey::Type :
  • src/Parser/XyzParser.cpp

    r8d6d31 r8f4df1  
    4242  int numberOfAtoms;
    4343  char commentBuffer[512], type[3];
     44  double tmp;
    4445
    4546  // the first line tells number of atoms, the second line is always a comment
     
    5354  for (int i = 0; i < numberOfAtoms; i++) {
    5455    newAtom = World::getInstance().createAtom();
    55     *file >> type >> ws >> newAtom->x[0] >> ws >> newAtom->x[1] >> ws >> newAtom->x[2];
     56    *file >> type;
     57    for (int j=0;j<NDIM;j++) {
     58      *file >> tmp;
     59      newAtom->set(j, tmp);
     60    }
    5661    newAtom->setType(World::getInstance().getPeriode()->FindElement(type));
    5762    newmol->AddAtom(newAtom);
     
    8186  vector<atom*> atoms = World::getInstance().getAllAtoms();
    8287  for(vector<atom*>::iterator it = atoms.begin(); it != atoms.end(); it++) {
    83     *file << noshowpoint << (*it)->getType()->symbol << "\t" << (*it)->x[0] << "\t" << (*it)->x[1] << "\t" << (*it)->x[2] << endl;
     88    *file << noshowpoint << (*it)->getType()->symbol << "\t" << (*it)->at(0) << "\t" << (*it)->at(1) << "\t" << (*it)->at(2) << endl;
    8489  }
    8590}
  • src/UIElements/QT4/QTDialog.cpp

    r8d6d31 r8f4df1  
    481481    parent(_parent)
    482482{
    483   const Matrix& M = World::getInstance().getDomain().getM();
    484   const char *coords[3] = {"x:","y:","z:"};
    485483  mainLayout= new QHBoxLayout();
    486484  titleLabel = new QLabel(QString(getTitle().c_str()));
     
    515513    parent(_parent)
    516514{
    517   const Matrix& M = World::getInstance().getDomain().getM();
    518   const char *coords[3] = {"x:","y:","z:"};
    519515  mainLayout= new QHBoxLayout();
    520516  titleLabel = new QLabel(QString(getTitle().c_str()));
  • src/UIElements/TextUI/TextDialog.cpp

    r8d6d31 r8f4df1  
    525525    }
    526526  }
     527
    527528  return true;
    528529}
  • src/analysis_bonds.cpp

    r8d6d31 r8f4df1  
    6060  int AtomNo = 0;
    6161  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    62     if ((*iter)->type == type1)
     62    if ((*iter)->getType() == type1)
    6363      for (BondList::const_iterator BondRunner = (*iter)->ListOfBonds.begin(); BondRunner != (*iter)->ListOfBonds.end(); BondRunner++)
    64         if ((*BondRunner)->GetOtherAtom((*iter))->type == type2) {
     64        if ((*BondRunner)->GetOtherAtom((*iter))->getType() == type2) {
    6565          const double distance = (*BondRunner)->GetDistanceSquared();
    6666          if (Min > distance)
     
    8787 * \return angle between \a *first and \a *second, both relative to origin at \a *origin.
    8888 */
    89 double CalculateAngle(Vector *first, Vector *central, Vector *second)
     89double CalculateAngle(const Vector &first, const Vector &central, const Vector &second)
    9090{
    9191  Vector OHBond;
    9292  Vector OOBond;
    9393
    94   OHBond = (*first) - (*central);
    95   OOBond = (*second) - (*central);
     94  OHBond = first - central;
     95  OOBond = second - central;
    9696  const double angle = OHBond.Angle(OOBond);
    9797  return angle;
     
    110110
    111111  // check angle
    112   if (CalculateAngle(&Hydrogen->x, &Oxygen->x, &OtherOxygen->x) < M_PI*(30./180.)) {
     112  if (CalculateAngle(Hydrogen->getPosition(), Oxygen->getPosition(), OtherOxygen->getPosition()) < M_PI*(30./180.)) {
    113113    return true;
    114114  } else {
     
    138138        molecule::iterator Runner = (*MolRunner)->begin();
    139139        for(;Runner!=(*MolRunner)->end();++Runner){
    140           if (((*Walker)->type->Z  == 8) && ((*Runner)->type->Z  == 8)) {
     140          if (((*Walker)->getType()->Z  == 8) && ((*Runner)->getType()->Z  == 8)) {
    141141            // check distance
    142             const double distance = (*Runner)->x.DistanceSquared((*Walker)->x);
     142            const double distance = (*Runner)->DistanceSquared(*(*Walker));
    143143            if ((distance > MYEPSILON) && (distance < HBRIDGEDISTANCE*HBRIDGEDISTANCE)) { // distance >0 means  different atoms
    144144              // on other atom(Runner) we check for bond to interface element and
     
    152152                atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Runner);
    153153                // if hydrogen, check angle to be greater(!) than 30 degrees
    154                 if (OtherAtom->type->Z == 1) {
    155                   const double angle = CalculateAngle(&OtherAtom->x, &(*Runner)->x, &(*Walker)->x);
     154                if (OtherAtom->getType()->Z == 1) {
     155                  const double angle = CalculateAngle(OtherAtom->getPosition(), (*Runner)->getPosition(), (*Walker)->getPosition());
    156156                  OtherHydrogenFlag = OtherHydrogenFlag && (angle > M_PI*(30./180.) + MYEPSILON);
    157157                  Otherangle += angle;
    158158                  OtherHydrogens++;
    159159                }
    160                 InterfaceFlag = InterfaceFlag || (OtherAtom->type == InterfaceElement);
    161                 Interface2Flag = Interface2Flag || (OtherAtom->type == Interface2Element);
     160                InterfaceFlag = InterfaceFlag || (OtherAtom->getType() == InterfaceElement);
     161                Interface2Flag = Interface2Flag || (OtherAtom->getType() == Interface2Element);
    162162              }
    163163              DoLog(1) && (Log() << Verbose(1) << "Otherangle is " << Otherangle << " for " << OtherHydrogens << " hydrogens." << endl);
     
    177177                for (BondList::const_iterator BondRunner = (*Walker)->ListOfBonds.begin(); BondRunner != (*Walker)->ListOfBonds.end(); BondRunner++) {
    178178                  atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Walker);
    179                   if (OtherAtom->type->Z == 1) {
     179                  if (OtherAtom->getType()->Z == 1) {
    180180                    // check angle
    181181                    if (CheckHydrogenBridgeBondAngle(*Walker, OtherAtom, *Runner)) {
    182                       DoLog(1) && (Log() << Verbose(1) << (*Walker)->getName() << ", " << OtherAtom->getName() << " and " << (*Runner)->getName() << " has a hydrogen bridge bond with distance " << sqrt(distance) << " and angle " << CalculateAngle(&OtherAtom->x, &(*Walker)->x, &(*Runner)->x)*(180./M_PI) << "." << endl);
     182                      DoLog(1) && (Log() << Verbose(1) << (*Walker)->getName() << ", " << OtherAtom->getName() << " and " << (*Runner)->getName() << " has a hydrogen bridge bond with distance " << sqrt(distance) << " and angle " << CalculateAngle(OtherAtom->getPosition(), (*Walker)->getPosition(), (*Runner)->getPosition())*(180./M_PI) << "." << endl);
    183183                      count++;
    184184                      break;
     
    210210    for(;Walker!=(*MolWalker)->end();++Walker){
    211211      atom * theAtom = *Walker;
    212       if ((theAtom->type == first) || (theAtom->type == second)) {  // first element matches
     212      if ((theAtom->getType() == first) || (theAtom->getType() == second)) {  // first element matches
    213213        for (BondList::const_iterator BondRunner = theAtom->ListOfBonds.begin(); BondRunner != theAtom->ListOfBonds.end(); BondRunner++) {
    214214          atom * const OtherAtom = (*BondRunner)->GetOtherAtom(theAtom);
    215           if (((OtherAtom->type == first) || (OtherAtom->type == second)) && (theAtom->nr < OtherAtom->nr)) {
     215          if (((OtherAtom->getType() == first) || (OtherAtom->getType() == second)) && (theAtom->nr < OtherAtom->nr)) {
    216216            count++;
    217217            DoLog(1) && (Log() << Verbose(1) << first->name << "-" << second->name << " bond found between " << *Walker << " and " << *OtherAtom << "." << endl);
     
    246246    for(;Walker!=(*MolWalker)->end();++Walker){
    247247      atom *theAtom = *Walker;
    248       if (theAtom->type == second) {  // first element matches
     248      if (theAtom->getType() == second) {  // first element matches
    249249        for (int i=0;i<2;i++)
    250250          MatchFlag[i] = false;
     
    252252          atom * const OtherAtom = (*BondRunner)->GetOtherAtom(theAtom);
    253253          for (int i=0;i<2;i++)
    254             if ((!MatchFlag[i]) && (OtherAtom->type == ElementArray[i])) {
     254            if ((!MatchFlag[i]) && (OtherAtom->getType() == ElementArray[i])) {
    255255              MatchFlag[i] = true;
    256256              break;  // each bonding atom can match at most one element we are looking for
  • src/analysis_correlation.cpp

    r8d6d31 r8f4df1  
    1111#include <iomanip>
    1212
     13#include "BoundaryTriangleSet.hpp"
    1314#include "analysis_correlation.hpp"
    1415#include "element.hpp"
     
    7475          if ((*iter)->getId() < (*runner)->getId()){
    7576            for (set <pair<element *, element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)
    76               if ((PairRunner->first == (**iter).type) && (PairRunner->second == (**runner).type)) {
    77                 distance = domain.periodicDistance(*(*iter)->node,*(*runner)->node);
     77              if ((PairRunner->first == (**iter).getType()) && (PairRunner->second == (**runner).getType())) {
     78                distance = domain.periodicDistance((*iter)->getPosition(),(*runner)->getPosition());
    7879                //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl;
    7980                outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) );
     
    137138    for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
    138139      DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
    139       periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3
     140      periodicX = FullInverseMatrix * ((*iter)->getPosition()); // x now in [0,1)^3
    140141      // go through every range in xyz and get distance
    141142      for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
     
    149150                  if ((*iter)->getId() < (*runner)->getId()){
    150151                    for (set <pair<element *, element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)
    151                       if ((PairRunner->first == (**iter).type) && (PairRunner->second == (**runner).type)) {
    152                         periodicOtherX = FullInverseMatrix * (*(*runner)->node); // x now in [0,1)^3
     152                      if ((PairRunner->first == (**iter).getType()) && (PairRunner->second == (**runner).getType())) {
     153                        periodicOtherX = FullInverseMatrix * ((*runner)->getPosition()); // x now in [0,1)^3
    153154                        // go through every range in xyz and get distance
    154155                        for (Othern[0]=-ranges[0]; Othern[0] <= ranges[0]; Othern[0]++)
     
    196197      DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
    197198      for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
    198         if ((*type == NULL) || ((*iter)->type == *type)) {
    199           distance = domain.periodicDistance(*(*iter)->node,*point);
     199        if ((*type == NULL) || ((*iter)->getType() == *type)) {
     200          distance = domain.periodicDistance((*iter)->getPosition(),*point);
    200201          DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl);
    201202          outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> ((*iter), point) ) );
     
    237238      DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
    238239      for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
    239         if ((*type == NULL) || ((*iter)->type == *type)) {
    240           periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3
     240        if ((*type == NULL) || ((*iter)->getType() == *type)) {
     241          periodicX = FullInverseMatrix * ((*iter)->getPosition()); // x now in [0,1)^3
    241242          // go through every range in xyz and get distance
    242243          for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
     
    284285      DoLog(3) && (Log() << Verbose(3) << "\tCurrent atom is " << *(*iter) << "." << endl);
    285286      for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
    286         if ((*type == NULL) || ((*iter)->type == *type)) {
    287           TriangleIntersectionList Intersections((*iter)->node,Surface,LC);
     287        if ((*type == NULL) || ((*iter)->getType() == *type)) {
     288          TriangleIntersectionList Intersections((*iter)->getPosition(),Surface,LC);
    288289          distance = Intersections.GetSmallestDistance();
    289290          triangle = Intersections.GetClosestTriangle();
     
    335336      DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
    336337      for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
    337         if ((*type == NULL) || ((*iter)->type == *type)) {
    338           periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3
     338        if ((*type == NULL) || ((*iter)->getType() == *type)) {
     339          periodicX = FullInverseMatrix * ((*iter)->getPosition()); // x now in [0,1)^3
    339340          // go through every range in xyz and get distance
    340341          ShortestDistance = -1.;
     
    343344              for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {
    344345                checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX);
    345                 TriangleIntersectionList Intersections(&checkX,Surface,LC);
     346                TriangleIntersectionList Intersections(checkX,Surface,LC);
    346347                distance = Intersections.GetSmallestDistance();
    347348                triangle = Intersections.GetClosestTriangle();
     
    411412    *file << runner->first;
    412413    for (int i=0;i<NDIM;i++)
    413       *file << "\t" << setprecision(8) << (runner->second.first->node->at(i) - runner->second.second->at(i));
     414      *file << "\t" << setprecision(8) << (runner->second.first->at(i) - runner->second.second->at(i));
    414415    *file << endl;
    415416  }
     
    426427  if (!map->empty())
    427428    for (CorrelationToSurfaceMap::const_iterator runner = map->begin(); runner != map->end(); ++runner) {
    428       *file << setprecision(8) << runner->first << "\t" << *(runner->second.first) << "\t" << *(runner->second.second) << endl;
    429     }
    430 };
    431 
     429      *file << setprecision(8) << runner->first << "\t";
     430      *file << *(runner->second.first) << "\t";
     431      *file << *(runner->second.second) << endl;
     432    }
     433};
     434
  • src/atom.cpp

    r8d6d31 r8f4df1  
    2828atom::atom() :
    2929  father(this), sort(&nr), mol(0)
    30 {
    31   node = &x;  // TesselPoint::x can only be referenced from here
    32 };
     30{};
    3331
    3432/** Constructor of class atom.
     
    3735    ParticleInfo(pointer),father(pointer), sort(&nr)
    3836{
    39   type = pointer->type;  // copy element of atom
    40   x = pointer->x; // copy coordination
    41   v = pointer->v; // copy velocity
     37  setType(pointer->getType());  // copy element of atom
     38  setPosition(pointer->getPosition()); // copy coordination
     39  AtomicVelocity = pointer->AtomicVelocity; // copy velocity
    4240  FixedIon = pointer->FixedIon;
    43   node = &x;
    4441  mol = 0;
    4542};
     
    4946  res->father = this;
    5047  res->sort = &res->nr;
    51   res->type = type;
    52   res->x = this->x;
    53   res->v = this->v;
     48  res->setType(getType());
     49  res->setPosition(this->getPosition());
     50  res->AtomicVelocity = this->AtomicVelocity;
    5451  res->FixedIon = FixedIon;
    55   res->node = &x;
    5652  res->mol = 0;
    5753  World::getInstance().registerAtom(res);
     
    121117bool atom::IsInShape(const Shape& shape) const
    122118{
    123   return shape.isInside(*node);
     119  return shape.isInside(getPosition());
    124120};
    125121
     
    146142  if (out != NULL) {
    147143    *out << "Ion_Type" << ElementNo << "_" << AtomNo << "\t"  << fixed << setprecision(9) << showpoint;
    148     *out << x[0] << "\t" << x[1] << "\t" << x[2];
     144    *out << at(0) << "\t" << at(1) << "\t" << at(2);
    149145    *out << "\t" << FixedIon;
    150     if (v.Norm() > MYEPSILON)
    151       *out << "\t" << scientific << setprecision(6) << v[0] << "\t" << v[1] << "\t" << v[2] << "\t";
     146    if (AtomicVelocity.Norm() > MYEPSILON)
     147      *out << "\t" << scientific << setprecision(6) << AtomicVelocity[0] << "\t" << AtomicVelocity[1] << "\t" << AtomicVelocity[2] << "\t";
    152148    if (comment != NULL)
    153149      *out << " # " << comment << endl;
     
    168164bool atom::OutputArrayIndexed(ostream * const out,const enumeration<const element*> &elementLookup, int *AtomNo, const char *comment) const
    169165{
    170   AtomNo[type->Z]++;  // increment number
    171   if (out != NULL) {
    172     cout << "Looking for atom with element " << *type << endl;
    173     ASSERT(elementLookup.there.find(type)!=elementLookup.there.end(),"Type of this atom was not in the formula upon enumeration");
    174     *out << "Ion_Type" << elementLookup.there.find(type)->second << "_" << AtomNo[type->Z] << "\t"  << fixed << setprecision(9) << showpoint;
    175     *out << x[0] << "\t" << x[1] << "\t" << x[2];
     166  AtomNo[getType()->Z]++;  // increment number
     167  if (out != NULL) {
     168    const element *elemental = getType();
     169    cout << "Looking for atom with element " << *elemental << endl;
     170    ASSERT(elementLookup.there.find(elemental)!=elementLookup.there.end(),"Type of this atom was not in the formula upon enumeration");
     171    *out << "Ion_Type" << elementLookup.there.find(elemental)->second << "_" << AtomNo[elemental->Z] << "\t"  << fixed << setprecision(9) << showpoint;
     172    *out << at(0) << "\t" << at(1) << "\t" << at(2);
    176173    *out << "\t" << FixedIon;
    177     if (v.Norm() > MYEPSILON)
    178       *out << "\t" << scientific << setprecision(6) << v[0] << "\t" << v[1] << "\t" << v[2] << "\t";
     174    if (AtomicVelocity.Norm() > MYEPSILON)
     175      *out << "\t" << scientific << setprecision(6) << AtomicVelocity[0] << "\t" << AtomicVelocity[1] << "\t" << AtomicVelocity[2] << "\t";
    179176    if (comment != NULL)
    180177      *out << " # " << comment << endl;
     
    193190{
    194191  if (out != NULL) {
    195     *out << type->symbol << "\t" << x[0] << "\t" << x[1] << "\t" << x[2] << "\t" << endl;
     192    *out << getType()->symbol << "\t" << at(0) << "\t" << at(1) << "\t" << at(2) << "\t" << endl;
    196193    return true;
    197194  } else
     
    208205bool atom::OutputTrajectory(ofstream * const out, const int *ElementNo, int *AtomNo, const int step) const
    209206{
    210   AtomNo[type->Z]++;
    211   if (out != NULL) {
    212     *out << "Ion_Type" << ElementNo[type->Z] << "_" << AtomNo[type->Z] << "\t"  << fixed << setprecision(9) << showpoint;
     207  AtomNo[getType()->Z]++;
     208  if (out != NULL) {
     209    *out << "Ion_Type" << ElementNo[getType()->Z] << "_" << AtomNo[getType()->Z] << "\t"  << fixed << setprecision(9) << showpoint;
    213210    *out << Trajectory.R.at(step)[0] << "\t" << Trajectory.R.at(step)[1] << "\t" << Trajectory.R.at(step)[2];
    214211    *out << "\t" << FixedIon;
     
    231228{
    232229  if (out != NULL) {
    233     *out << type->symbol << "\t";
     230    *out << getType()->symbol << "\t";
    234231    *out << Trajectory.R.at(step)[0] << "\t";
    235232    *out << Trajectory.R.at(step)[1] << "\t";
     
    247244void atom::OutputMPQCLine(ostream * const out, const Vector *center, int *AtomNo = NULL) const
    248245{
    249   *out << "\t\t" << type->symbol << " [ " << x[0]-center->at(0) << "\t" << x[1]-center->at(1) << "\t" << x[2]-center->at(2) << " ]" << endl;
     246  Vector recentered(getPosition());
     247  recentered -= *center;
     248  *out << "\t\t" << getType()->symbol << " [ " << recentered[0] << "\t" << recentered[1] << "\t" << recentered[2] << " ]" << endl;
    250249  if (AtomNo != NULL)
    251250    *AtomNo++;
     
    270269double atom::DistanceSquaredToVector(const Vector &origin) const
    271270{
    272   return origin.DistanceSquared(x);
     271  return DistanceSquared(origin);
    273272};
    274273
     
    279278double atom::DistanceToVector(const Vector &origin) const
    280279{
    281   return origin.distance(x);
     280  return distance(origin);
    282281};
    283282
     
    294293};
    295294
     295std::ostream & atom::operator << (std::ostream &ost) const
     296{
     297  ParticleInfo::operator<<(ost);
     298  ost << "," << getPosition();
     299  return ost;
     300}
     301
     302std::ostream & operator << (std::ostream &ost, const atom &a)
     303{
     304  a.ParticleInfo::operator<<(ost);
     305  ost << "," << a.getPosition();
     306  return ost;
     307}
    296308
    297309bool operator < (atom &a, atom &b)
  • src/atom.hpp

    r8d6d31 r8f4df1  
    2222#include <vector>
    2323
     24#include "Helpers/helpers.hpp"
    2425#include "atom_atominfo.hpp"
    2526#include "atom_bondedparticle.hpp"
     
    2728#include "atom_particleinfo.hpp"
    2829#include "atom_trajectoryparticle.hpp"
    29 #include "tesselation.hpp"
     30#include "TesselPoint.hpp"
    3031#include "types.hpp"
    3132
     
    4243 * Class incorporates position, type
    4344 */
    44 class atom : public TesselPoint, public TrajectoryParticle, public GraphNode, public BondedParticle, public virtual ParticleInfo, public virtual AtomInfo {
     45class atom : public TrajectoryParticle, public GraphNode, public BondedParticle, public TesselPoint {
    4546  friend atom* NewAtom(atomId_t);
    4647  friend void  DeleteAtom(atom*);
     
    9495   void removeFromMolecule();
    9596
     97   // Output operator
     98   std::ostream & operator << (std::ostream &ost) const;
     99
    96100  protected:
    97101
     
    120124
    121125/**
     126 * Global output operator for class atom.
     127 */
     128std::ostream & operator << (std::ostream &ost, const atom &_atom);
     129
     130/**
    122131 * internal method used by the world. Do not use if you don't know what you are doing.
    123132 * You might get burned...
  • src/atom_atominfo.cpp

    r8d6d31 r8f4df1  
    1010#include "periodentafel.hpp"
    1111#include "World.hpp"
     12#include "element.hpp"
    1213#include "atom_atominfo.hpp"
    1314
    1415/** Constructor of class AtomInfo.
    1516 */
    16 AtomInfo::AtomInfo() : type(NULL) {};
     17AtomInfo::AtomInfo() : AtomicElement(NULL) {};
     18
     19/** Copy constructor of class AtomInfo.
     20 */
     21AtomInfo::AtomInfo(const AtomInfo &_atom) : AtomicPosition(_atom.AtomicPosition), AtomicElement(_atom.AtomicElement) {};
     22
     23AtomInfo::AtomInfo(const VectorInterface &_v) : AtomicPosition(_v.getPosition()), AtomicElement(NULL)
     24{};
    1725
    1826/** Destructor of class AtomInfo.
     
    2230};
    2331
    24 const element *AtomInfo::getType(){
    25   return type;
     32const element *AtomInfo::getType() const
     33{
     34  return AtomicElement;
     35}
     36
     37const double& AtomInfo::operator[](size_t i) const
     38{
     39  return AtomicPosition[i];
     40}
     41
     42const double& AtomInfo::at(size_t i) const
     43{
     44  return AtomicPosition.at(i);
     45}
     46
     47void AtomInfo::set(size_t i, const double value)
     48{
     49  AtomicPosition.at(i) = value;
     50}
     51
     52const Vector& AtomInfo::getPosition() const
     53{
     54  return AtomicPosition;
    2655}
    2756
    2857void AtomInfo::setType(const element* _type) {
    29   type = _type;
     58  AtomicElement = _type;
    3059}
    3160
    32 void AtomInfo::setType(int Z) {
     61void AtomInfo::setType(const int Z) {
    3362  const element *elem = World::getInstance().getPeriode()->FindElement(Z);
    3463  setType(elem);
    3564}
     65
     66void AtomInfo::setPosition(const Vector& _vector)
     67{
     68  AtomicPosition = _vector;
     69  //cout << "AtomInfo::setPosition: " << getType()->symbol << " at " << getPosition() << endl;
     70}
     71
     72const VectorInterface& AtomInfo::operator+=(const Vector& b)
     73{
     74  AtomicPosition += b;
     75  return *this;
     76}
     77
     78const VectorInterface& AtomInfo::operator-=(const Vector& b)
     79{
     80  AtomicPosition -= b;
     81  return *this;
     82}
     83
     84Vector const AtomInfo::operator+(const Vector& b) const
     85{
     86  Vector a(AtomicPosition);
     87  a += b;
     88  return a;
     89}
     90
     91Vector const AtomInfo::operator-(const Vector& b) const
     92{
     93  Vector a(AtomicPosition);
     94  a -= b;
     95  return a;
     96}
     97
     98double AtomInfo::distance(const Vector &point) const
     99{
     100  return AtomicPosition.distance(point);
     101}
     102
     103double AtomInfo::DistanceSquared(const Vector &y) const
     104{
     105  return AtomicPosition.DistanceSquared(y);
     106}
     107
     108double AtomInfo::distance(const VectorInterface &_atom) const
     109{
     110  return _atom.distance(AtomicPosition);
     111}
     112
     113double AtomInfo::DistanceSquared(const VectorInterface &_atom) const
     114{
     115  return _atom.DistanceSquared(AtomicPosition);
     116}
     117
     118VectorInterface &AtomInfo::operator=(const Vector& _vector)
     119{
     120  AtomicPosition = _vector;
     121  return *this;
     122}
     123
     124void AtomInfo::ScaleAll(const double *factor)
     125{
     126  AtomicPosition.ScaleAll(factor);
     127}
     128
     129void AtomInfo::ScaleAll(const Vector &factor)
     130{
     131  AtomicPosition.ScaleAll(factor);
     132}
     133
     134void AtomInfo::Scale(const double factor)
     135{
     136  AtomicPosition.Scale(factor);
     137}
     138
     139void AtomInfo::Zero()
     140{
     141  AtomicPosition.Zero();
     142}
     143
     144void AtomInfo::One(const double one)
     145{
     146  AtomicPosition.One(one);
     147}
     148
     149void AtomInfo::LinearCombinationOfVectors(const Vector &x1, const Vector &x2, const Vector &x3, const double * const factors)
     150{
     151  AtomicPosition.LinearCombinationOfVectors(x1,x2,x3,factors);
     152}
     153
     154const AtomInfo& operator*=(AtomInfo& a, const double m)
     155{
     156  a.Scale(m);
     157  return a;
     158}
     159
     160AtomInfo const operator*(const AtomInfo& a, const double m)
     161{
     162  AtomInfo copy(a);
     163  copy *= m;
     164  return copy;
     165}
     166
     167AtomInfo const operator*(const double m, const AtomInfo& a)
     168{
     169  AtomInfo copy(a);
     170  copy *= m;
     171  return copy;
     172}
     173
     174std::ostream & AtomInfo::operator << (std::ostream &ost) const
     175{
     176  return (ost << getPosition());
     177}
     178
     179std::ostream & operator << (std::ostream &ost, const AtomInfo &a)
     180{
     181  ost << a;
     182  return ost;
     183}
     184
  • src/atom_atominfo.hpp

    r8d6d31 r8f4df1  
    2020
    2121#include "LinearAlgebra/Vector.hpp"
     22#include "LinearAlgebra/VectorInterface.hpp"
    2223
    2324/****************************************** forward declarations *****************************/
    2425
     26class AtomInfo;
    2527class element;
     28class Matrix;
    2629
    2730/********************************************** declarations *******************************/
    2831
    29 class AtomInfo {
     32class AtomInfo : public VectorInterface {
     33
    3034public:
    31   Vector x;       //!< coordinate vector of atom, giving last position within cell
    32   Vector v;       //!< velocity vector of atom, giving last velocity within cell
    33   Vector F;       //!< Force vector of atom, giving last force within cell
    34   const element *type;  //!< pointing to element
     35  Vector AtomicVelocity;       //!< velocity vector of atom, giving last velocity within cell
     36  Vector AtomicForce;       //!< Force vector of atom, giving last force within cell
    3537
    3638  AtomInfo();
    37   ~AtomInfo();
     39  AtomInfo(const AtomInfo &_atom);
     40  AtomInfo(const VectorInterface &_v);
     41  virtual ~AtomInfo();
    3842
    39   const element *getType();
     43  const element *getType() const;
    4044  void setType(const element *);
    41   void setType(int);
     45  void setType(const int);
     46
     47  ///// manipulation of the atomic position
     48
     49  // Accessors ussually come in pairs... and sometimes even more than that
     50  const double& operator[](size_t i) const;
     51  const double& at(size_t i) const;
     52  void set(size_t i, const double value);
     53  const Vector& getPosition() const;
     54
     55  // Assignment operator
     56  void setPosition(const Vector& _vector);
     57  class VectorInterface &operator=(const Vector& _vector);
     58
     59  // operators for mathematical operations
     60  const VectorInterface& operator+=(const Vector& b);
     61  const VectorInterface& operator-=(const Vector& b);
     62  Vector const operator+(const Vector& b) const;
     63  Vector const operator-(const Vector& b) const;
     64
     65  void Zero();
     66  void One(const double one);
     67  void LinearCombinationOfVectors(const Vector &x1, const Vector &x2, const Vector &x3, const double * const factors);
     68
     69  double distance(const Vector &point) const;
     70  double DistanceSquared(const Vector &y) const;
     71  double distance(const VectorInterface &_atom) const;
     72  double DistanceSquared(const VectorInterface &_atom) const;
     73
     74  void ScaleAll(const double *factor);
     75  void ScaleAll(const Vector &factor);
     76  void Scale(const double factor);
     77
     78  std::ostream & operator << (std::ostream &ost) const;
    4279
    4380private:
     81  Vector AtomicPosition;       //!< coordinate vector of atom, giving last position within cell
     82  const element *AtomicElement;  //!< pointing to element
    4483};
    4584
     85std::ostream & operator << (std::ostream &ost, const AtomInfo &a);
     86
     87const AtomInfo& operator*=(AtomInfo& a, const double m);
     88AtomInfo const operator*(const AtomInfo& a, const double m);
     89AtomInfo const operator*(const double m, const AtomInfo& a);
     90
    4691#endif /* ATOM_ATOMINFO_HPP_ */
  • src/atom_bondedparticle.cpp

    r8d6d31 r8f4df1  
    152152  NoBonds = CountBonds();
    153153  //Log() << Verbose(3) << "Walker " << *this << ": " << (int)this->type->NoValenceOrbitals << " > " << NoBonds << "?" << endl;
    154   if ((int)(type->NoValenceOrbitals) > NoBonds) { // we have a mismatch, check all bonding partners for mismatch
     154  if ((int)(getType()->NoValenceOrbitals) > NoBonds) { // we have a mismatch, check all bonding partners for mismatch
    155155    for (BondList::const_iterator Runner = ListOfBonds.begin(); Runner != ListOfBonds.end(); (++Runner)) {
    156156      OtherWalker = (*Runner)->GetOtherAtom(this);
    157157      OtherNoBonds = OtherWalker->CountBonds();
    158158      //Log() << Verbose(3) << "OtherWalker " << *OtherWalker << ": " << (int)OtherWalker->type->NoValenceOrbitals << " > " << OtherNoBonds << "?" << endl;
    159       if ((int)(OtherWalker->type->NoValenceOrbitals) > OtherNoBonds) { // check if possible candidate
     159      if ((int)(OtherWalker->getType()->NoValenceOrbitals) > OtherNoBonds) { // check if possible candidate
    160160        if ((CandidateBond == NULL) || (ListOfBonds.size() > OtherWalker->ListOfBonds.size())) { // pick the one with fewer number of bonds first
    161161          CandidateBond = (*Runner);
     
    189189};
    190190
     191std::ostream & BondedParticle::operator << (std::ostream &ost) const
     192{
     193  ParticleInfo::operator<<(ost);
     194  ost << "," << getPosition();
     195  return ost;
     196}
     197
     198std::ostream & operator << (std::ostream &ost, const BondedParticle &a)
     199{
     200  a.ParticleInfo::operator<<(ost);
     201  ost << "," << a.getPosition();
     202  return ost;
     203}
     204
  • src/atom_bondedparticle.hpp

    r8d6d31 r8f4df1  
    4949  void OutputOrder(ofstream *file) const;
    5050
     51  std::ostream & operator << (std::ostream &ost) const;
     52
    5153private:
    5254
    5355};
    5456
     57std::ostream & operator << (std::ostream &ost, const BondedParticle &a);
    5558
    5659#endif /* ATOM_BONDEDPARTICLE_HPP_ */
  • src/atom_bondedparticleinfo.hpp

    r8d6d31 r8f4df1  
    3636
    3737  BondedParticleInfo();
    38   ~BondedParticleInfo();
     38  virtual ~BondedParticleInfo();
    3939
    4040private:
  • src/atom_graphnodeinfo.hpp

    r8d6d31 r8f4df1  
    3737
    3838  GraphNodeInfo();
    39   ~GraphNodeInfo();
     39  virtual ~GraphNodeInfo();
    4040private:
    4141
  • src/atom_particleinfo.cpp

    r8d6d31 r8f4df1  
    3838ostream & operator << (ostream &ost, const ParticleInfo &a)
    3939{
    40   ost << "[" << a.getName() << "|" << &a << "]";
     40  ost << a.getName();
    4141  return ost;
    4242};
     
    4444ostream & ParticleInfo::operator << (ostream &ost) const
    4545{
    46   ost << "[" << name << "|" << this << "]";
     46  ost << getName();
    4747  return ost;
    4848};
  • src/atom_particleinfo.hpp

    r8d6d31 r8f4df1  
    3232  ParticleInfo();
    3333  ParticleInfo(ParticleInfo*);
    34   ~ParticleInfo();
     34  virtual ~ParticleInfo();
    3535
    3636  const std::string& getName() const;
  • src/atom_trajectoryparticle.cpp

    r8d6d31 r8f4df1  
    3838{
    3939  for (int i=NDIM;i--;)
    40     *temperature += type->mass * Trajectory.U.at(step)[i]* Trajectory.U.at(step)[i];
     40    *temperature += getType()->mass * Trajectory.U.at(step)[i]* Trajectory.U.at(step)[i];
    4141};
    4242
     
    6565  for(int d=0;d<NDIM;d++) {
    6666    Trajectory.U.at(Step)[d] -= CoGVelocity->at(d);
    67     *ActualTemp += 0.5 * type->mass * Trajectory.U.at(Step)[d] * Trajectory.U.at(Step)[d];
     67    *ActualTemp += 0.5 * getType()->mass * Trajectory.U.at(Step)[d] * Trajectory.U.at(Step)[d];
    6868  }
    6969};
     
    113113    Trajectory.R.at(NextStep)[d] = Trajectory.R.at(NextStep-1)[d];
    114114    Trajectory.R.at(NextStep)[d] += configuration->Deltat*(Trajectory.U.at(NextStep-1)[d]);     // s(t) = s(0) + v * deltat + 1/2 a * deltat^2
    115     Trajectory.R.at(NextStep)[d] += 0.5*configuration->Deltat*configuration->Deltat*(Trajectory.F.at(NextStep)[d]/type->mass);     // F = m * a and s =
     115    Trajectory.R.at(NextStep)[d] += 0.5*configuration->Deltat*configuration->Deltat*(Trajectory.F.at(NextStep)[d]/getType()->mass);     // F = m * a and s =
    116116  }
    117117  // Update U
    118118  for (int d=0; d<NDIM; d++) {
    119119    Trajectory.U.at(NextStep)[d] = Trajectory.U.at(NextStep-1)[d];
    120     Trajectory.U.at(NextStep)[d] += configuration->Deltat * (Trajectory.F.at(NextStep)[d]+Trajectory.F.at(NextStep-1)[d]/type->mass); // v = F/m * t
     120    Trajectory.U.at(NextStep)[d] += configuration->Deltat * (Trajectory.F.at(NextStep)[d]+Trajectory.F.at(NextStep-1)[d]/getType()->mass); // v = F/m * t
    121121  }
    122122  // Update R (and F)
     
    137137void TrajectoryParticle::SumUpKineticEnergy( int Step, double *TotalMass, Vector *TotalVelocity ) const
    138138{
    139   *TotalMass += type->mass;  // sum up total mass
     139  *TotalMass += getType()->mass;  // sum up total mass
    140140  for(int d=0;d<NDIM;d++) {
    141     TotalVelocity->at(d) += Trajectory.U.at(Step)[d]*type->mass;
     141    TotalVelocity->at(d) += Trajectory.U.at(Step)[d]*getType()->mass;
    142142  }
    143143};
     
    154154    for (int d=0; d<NDIM; d++) {
    155155      U[d] *= ScaleTempFactor;
    156       *ekin += 0.5*type->mass * U[d]*U[d];
     156      *ekin += 0.5*getType()->mass * U[d]*U[d];
    157157    }
    158158};
     
    170170    for (int d=0; d<NDIM; d++) {
    171171      *G += U[d] * F[d];
    172       *E += U[d]*U[d]*type->mass;
     172      *E += U[d]*U[d]*getType()->mass;
    173173    }
    174174};
     
    185185  if (FixedIon == 0) // even FixedIon moves, only not by other's forces
    186186    for (int d=0; d<NDIM; d++) {
    187       U[d] += configuration->Deltat/type->mass * ( (G_over_E) * (U[d]*type->mass) );
    188       *ekin += type->mass * U[d]*U[d];
     187      U[d] += configuration->Deltat/getType()->mass * ( (G_over_E) * (U[d]*getType()->mass) );
     188      *ekin += getType()->mass * U[d]*U[d];
    189189    }
    190190};
     
    198198void TrajectoryParticle::Thermostat_Langevin(int Step, gsl_rng * r, double *ekin, config *configuration)
    199199{
    200   double sigma  = sqrt(configuration->Thermostats->TargetTemp/type->mass); // sigma = (k_b T)/m (Hartree/atomicmass = atomiclength/atomictime)
     200  double sigma  = sqrt(configuration->Thermostats->TargetTemp/getType()->mass); // sigma = (k_b T)/m (Hartree/atomicmass = atomiclength/atomictime)
    201201  Vector &U = Trajectory.U.at(Step);
    202202  if (FixedIon == 0) { // even FixedIon moves, only not by other's forces
     
    211211    }
    212212    for (int d=0; d<NDIM; d++)
    213       *ekin += 0.5*type->mass * U[d]*U[d];
     213      *ekin += 0.5*getType()->mass * U[d]*U[d];
    214214  }
    215215};
     
    227227    for (int d=0; d<NDIM; d++) {
    228228      U[d] *= sqrt(1+(configuration->Deltat/configuration->Thermostats->TempFrequency)*(ScaleTempFactor-1));
    229       *ekin += 0.5*type->mass * U[d]*U[d];
     229      *ekin += 0.5*getType()->mass * U[d]*U[d];
    230230    }
    231231  }
     
    241241  if (FixedIon == 0) { // even FixedIon moves, only not by other's forces
    242242    for (int d=0; d<NDIM; d++) {
    243       *delta_alpha += U[d]*U[d]*type->mass;
     243      *delta_alpha += U[d]*U[d]*getType()->mass;
    244244    }
    245245  }
     
    256256  if (FixedIon == 0) { // even FixedIon moves, only not by other's forces
    257257    for (int d=0; d<NDIM; d++) {
    258         U[d] += configuration->Deltat/type->mass * (configuration->Thermostats->alpha * (U[d] * type->mass));
    259         *ekin += (0.5*type->mass) * U[d]*U[d];
     258        U[d] += configuration->Deltat/getType()->mass * (configuration->Thermostats->alpha * (U[d] * getType()->mass));
     259        *ekin += (0.5*getType()->mass) * U[d]*U[d];
    260260      }
    261261  }
    262262};
     263
     264
     265std::ostream & TrajectoryParticle::operator << (std::ostream &ost) const
     266{
     267  ParticleInfo::operator<<(ost);
     268  ost << "," << getPosition();
     269  return ost;
     270}
     271
     272std::ostream & operator << (std::ostream &ost, const TrajectoryParticle &a)
     273{
     274  a.ParticleInfo::operator<<(ost);
     275  ost << "," << a.getPosition();
     276  return ost;
     277}
     278
  • src/atom_trajectoryparticle.hpp

    r8d6d31 r8f4df1  
    6363  void Thermostat_NoseHoover_scale(int Step, double *ekin, config *configuration);
    6464
     65  std::ostream & operator << (std::ostream &ost) const;
     66
    6567private:
    66 
    6768};
    6869
     70ostream & operator << (ostream &ost, const TrajectoryParticle &a);
    6971
    7072#endif /* ATOM_TRAJECTORYPARTICLE_HPP_ */
  • src/atom_trajectoryparticleinfo.hpp

    r8d6d31 r8f4df1  
    3636
    3737  TrajectoryParticleInfo();
    38   ~TrajectoryParticleInfo();
     38  virtual ~TrajectoryParticleInfo();
    3939
    4040private:
  • src/bond.cpp

    r8d6d31 r8f4df1  
    77#include "Helpers/MemDebug.hpp"
    88
     9#include "Helpers/Log.hpp"
    910#include "Helpers/Verbose.hpp"
    1011#include "atom.hpp"
     
    3536{
    3637  if ((left != NULL) && (right != NULL)) {
    37     if ((left->type != NULL) && (left->type->Z == 1))
     38    if ((left->getType() != NULL) && (left->getType()->Z == 1))
    3839      HydrogenBond++;
    39     if ((right->type != NULL) && (right->type->Z == 1))
     40    if ((right->getType() != NULL) && (right->getType()->Z == 1))
    4041      HydrogenBond++;
    4142  }
     
    126127double bond::GetDistance() const
    127128{
    128   return (leftatom->node->distance(*rightatom->node));
     129  return (leftatom->distance(*rightatom));
    129130};
    130131
     
    134135double bond::GetDistanceSquared() const
    135136{
    136   return (leftatom->node->DistanceSquared(*rightatom->node));
     137  return (leftatom->DistanceSquared(*rightatom));
    137138};
  • src/bondgraph.cpp

    r8d6d31 r8f4df1  
    128128
    129129  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    130     if ((*iter)->type->CovalentRadius > max_distance)
    131       max_distance = (*iter)->type->CovalentRadius;
     130    if ((*iter)->getType()->CovalentRadius > max_distance)
     131      max_distance = (*iter)->getType()->CovalentRadius;
    132132  }
    133133  max_distance *= 2.;
     
    145145void BondGraph::CovalentMinMaxDistance(BondedParticle * const Walker, BondedParticle * const OtherWalker, double &MinDistance, double &MaxDistance, bool IsAngstroem)
    146146{
    147   MinDistance = OtherWalker->type->CovalentRadius + Walker->type->CovalentRadius;
     147  MinDistance = OtherWalker->getType()->CovalentRadius + Walker->getType()->CovalentRadius;
    148148  MinDistance *= (IsAngstroem) ? 1. : 1. / AtomicLengthToAngstroem;
    149149  MaxDistance = MinDistance + BONDTHRESHOLD;
     
    166166    CovalentMinMaxDistance(Walker, OtherWalker, MinDistance, MaxDistance, IsAngstroem);
    167167  } else {
    168     MinDistance = GetBondLength(Walker->type->Z-1, OtherWalker->type->Z-1);
     168    MinDistance = GetBondLength(Walker->getType()->Z-1, OtherWalker->getType()->Z-1);
    169169    MinDistance *= (IsAngstroem) ? 1. : 1. / AtomicLengthToAngstroem;
    170170    MaxDistance = MinDistance + BONDTHRESHOLD;
  • src/boundary.cpp

    r8d6d31 r8f4df1  
    77
    88#include "Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.hpp"
     9#include "BoundaryPointSet.hpp"
     10#include "BoundaryLineSet.hpp"
     11#include "BoundaryTriangleSet.hpp"
     12#include "CandidateForTesselation.hpp"
     13//#include "TesselPoint.hpp"
    914#include "World.hpp"
    1015#include "atom.hpp"
     
    8792              if (Neighbour == BoundaryPoints[axis].end()) // make it wrap around
    8893                Neighbour = BoundaryPoints[axis].begin();
    89               DistanceVector = runner->second.second->x - Neighbour->second.second->x;
     94              DistanceVector = (runner->second.second->getPosition()) - (Neighbour->second.second->getPosition());
    9095              do { // seek for neighbour pair where it flips
    9196                  OldComponent = DistanceVector[Othercomponent];
     
    9398                  if (Neighbour == BoundaryPoints[axis].end()) // make it wrap around
    9499                    Neighbour = BoundaryPoints[axis].begin();
    95                   DistanceVector = runner->second.second->x - Neighbour->second.second->x;
     100                  DistanceVector = (runner->second.second->getPosition()) - (Neighbour->second.second->getPosition());
    96101                  //Log() << Verbose(2) << "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "." << endl;
    97102                } while ((runner != Neighbour) && (fabs(OldComponent / fabs(
     
    105110                  //Log() << Verbose(1) << "The pair, where the sign of OtherComponent flips, is: " << *(Neighbour->second.second) << " and " << *(OtherNeighbour->second.second) << "." << endl;
    106111                  // now we have found the pair: Neighbour and OtherNeighbour
    107                   OtherVector = runner->second.second->x - OtherNeighbour->second.second->x;
     112                  OtherVector = (runner->second.second->getPosition()) - (OtherNeighbour->second.second->getPosition());
    108113                  //Log() << Verbose(1) << "Distances to Neighbour and OtherNeighbour are " << DistanceVector.x[component] << " and " << OtherVector.x[component] << "." << endl;
    109114                  //Log() << Verbose(1) << "OtherComponents to Neighbour and OtherNeighbour are " << DistanceVector.x[Othercomponent] << " and " << OtherVector.x[Othercomponent] << "." << endl;
     
    173178    // 3b. construct set of all points, transformed into cylindrical system and with left and right neighbours
    174179    for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    175       ProjectedVector = (*iter)->x - (*MolCenter);
     180      ProjectedVector = (*iter)->getPosition() - (*MolCenter);
    176181      ProjectedVector.ProjectOntoPlane(AxisVector);
    177182
     
    199204          DoLog(2) && (Log() << Verbose(2) << "Keeping new vector due to larger projected distance " << ProjectedVectorNorm << "." << endl);
    200205        } else if (fabs(ProjectedVectorNorm - BoundaryTestPair.first->second.first) < MYEPSILON) {
    201           helper = (*iter)->x;
    202           helper -= *MolCenter;
     206          helper = (*iter)->getPosition() - (*MolCenter);
    203207          const double oldhelperNorm = helper.NormSquared();
    204           helper = BoundaryTestPair.first->second.second->x - (*MolCenter);
     208          helper = BoundaryTestPair.first->second.second->getPosition() - (*MolCenter);
    205209          if (helper.NormSquared() < oldhelperNorm) {
    206210            BoundaryTestPair.first->second.second = (*iter);
     
    255259        {
    256260          Vector SideA, SideB, SideC, SideH;
    257           SideA = left->second.second->x - (*MolCenter);
     261          SideA = left->second.second->getPosition() - (*MolCenter);
    258262          SideA.ProjectOntoPlane(AxisVector);
    259263          //          Log() << Verbose(1) << "SideA: " << SideA << endl;
    260264
    261           SideB = right->second.second->x -(*MolCenter);
     265          SideB = right->second.second->getPosition() -(*MolCenter);
    262266          SideB.ProjectOntoPlane(AxisVector);
    263267          //          Log() << Verbose(1) << "SideB: " << SideB << endl;
    264268
    265           SideC = left->second.second->x - right->second.second->x;
     269          SideC = left->second.second->getPosition() - right->second.second->getPosition();
    266270          SideC.ProjectOntoPlane(AxisVector);
    267271          //          Log() << Verbose(1) << "SideC: " << SideC << endl;
    268272
    269           SideH = runner->second.second->x -(*MolCenter);
     273          SideH = runner->second.second->getPosition() -(*MolCenter);
    270274          SideH.ProjectOntoPlane(AxisVector);
    271275          //          Log() << Verbose(1) << "SideH: " << SideH << endl;
     
    701705  // sum up the atomic masses
    702706  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    703       totalmass += (*iter)->type->mass;
     707      totalmass += (*iter)->getType()->mass;
    704708  }
    705709  DoLog(0) && (Log() << Verbose(0) << "RESULT: The summed mass is " << setprecision(10) << totalmass << " atomicmassunit." << endl);
     
    857861
    858862          // ... and put at new position
    859           Inserter = (*iter)->x;
     863          Inserter = (*iter)->getPosition();
    860864          if (DoRandomRotation)
    861865            Inserter *= Rotations;
     
    882886            // copy atom ...
    883887            CopyAtoms[(*iter)->nr] = (*iter)->clone();
    884             CopyAtoms[(*iter)->nr]->x = Inserter;
     888            (*CopyAtoms[(*iter)->nr]).setPosition(Inserter);
    885889            Filling->AddAtom(CopyAtoms[(*iter)->nr]);
    886             DoLog(4) && (Log() << Verbose(4) << "Filling atom " << **iter << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[(*iter)->nr]->x) << "." << endl);
     890            DoLog(1) && (Log() << Verbose(1) << "Filling atom " << **iter << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[(*iter)->nr]->getPosition()) << "." << endl);
    887891          } else {
    888892            DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is inner point, within boundary or outside of MaxDistance." << endl);
  • src/config.cpp

    r8d6d31 r8f4df1  
    439439    map<int, atom *> LinearList;
    440440    atom *neues = NULL;
     441    Vector position;
    441442    if (!FastParsing) {
    442443      // parse in trajectories
     
    452453              AtomList[i][j] = neues;
    453454              LinearList[ FileBuffer->LineMapping[FileBuffer->CurrentLine] ] = neues;
    454               neues->type = elementhash[i]; // find element type
     455              neues->setType(elementhash[i]); // find element type
    455456            } else
    456457              neues = AtomList[i][j];
    457458            status = (status &&
    458                     ParseForParameter(verbose,FileBuffer, keyword, 0, 1, 1, double_type, &neues->x[0], 1, (repetition == 0) ? critical : optional) &&
    459                     ParseForParameter(verbose,FileBuffer, keyword, 0, 2, 1, double_type, &neues->x[1], 1, (repetition == 0) ? critical : optional) &&
    460                     ParseForParameter(verbose,FileBuffer, keyword, 0, 3, 1, double_type, &neues->x[2], 1, (repetition == 0) ? critical : optional) &&
     459                    ParseForParameter(verbose,FileBuffer, keyword, 0, 1, 1, double_type, &position[0], 1, (repetition == 0) ? critical : optional) &&
     460                    ParseForParameter(verbose,FileBuffer, keyword, 0, 2, 1, double_type, &position[1], 1, (repetition == 0) ? critical : optional) &&
     461                    ParseForParameter(verbose,FileBuffer, keyword, 0, 3, 1, double_type, &position[2], 1, (repetition == 0) ? critical : optional) &&
    461462                    ParseForParameter(verbose,FileBuffer, keyword, 0, 4, 1, int_type, &neues->FixedIon, 1, (repetition == 0) ? critical : optional));
    462             if (!status) break;
     463            if (!status)
     464              break;
     465            neues ->setPosition(position);
    463466
    464467            // check size of vectors
     
    472475            // put into trajectories list
    473476            for (int d=0;d<NDIM;d++)
    474               neues->Trajectory.R.at(repetition)[d] = neues->x[d];
     477              neues->Trajectory.R.at(repetition)[d] = neues->at(d);
    475478
    476479            // parse velocities if present
    477             if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 5, 1, double_type, &neues->v[0], 1,optional))
    478               neues->v[0] = 0.;
    479             if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 6, 1, double_type, &neues->v[1], 1,optional))
    480               neues->v[1] = 0.;
    481             if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 7, 1, double_type, &neues->v[2], 1,optional))
    482               neues->v[2] = 0.;
     480            if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 5, 1, double_type, &neues->AtomicVelocity[0], 1,optional))
     481              neues->AtomicVelocity[0] = 0.;
     482            if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 6, 1, double_type, &neues->AtomicVelocity[1], 1,optional))
     483              neues->AtomicVelocity[1] = 0.;
     484            if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 7, 1, double_type, &neues->AtomicVelocity[2], 1,optional))
     485              neues->AtomicVelocity[2] = 0.;
    483486            for (int d=0;d<NDIM;d++)
    484               neues->Trajectory.U.at(repetition)[d] = neues->v[d];
     487              neues->Trajectory.U.at(repetition)[d] = neues->AtomicVelocity[d];
    485488
    486489            // parse forces if present
     
    531534            AtomList[i][j] = neues;
    532535            LinearList[ FileBuffer->LineMapping[FileBuffer->CurrentLine] ] = neues;
    533             neues->type = elementhash[i]; // find element type
     536            neues->setType(elementhash[i]); // find element type
    534537          } else
    535538            neues = AtomList[i][j];
    536539          // then parse for each atom the coordinates as often as present
    537           ParseForParameter(verbose,FileBuffer, keyword, 0, 1, 1, double_type, &neues->x[0], repetition,critical);
    538           ParseForParameter(verbose,FileBuffer, keyword, 0, 2, 1, double_type, &neues->x[1], repetition,critical);
    539           ParseForParameter(verbose,FileBuffer, keyword, 0, 3, 1, double_type, &neues->x[2], repetition,critical);
     540          ParseForParameter(verbose,FileBuffer, keyword, 0, 1, 1, double_type, &position[0], repetition,critical);
     541          ParseForParameter(verbose,FileBuffer, keyword, 0, 2, 1, double_type, &position[1], repetition,critical);
     542          ParseForParameter(verbose,FileBuffer, keyword, 0, 3, 1, double_type, &position[2], repetition,critical);
     543          neues->setPosition(position);
    540544          ParseForParameter(verbose,FileBuffer, keyword, 0, 4, 1, int_type, &neues->FixedIon, repetition,critical);
    541           if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 5, 1, double_type, &neues->v[0], repetition,optional))
    542             neues->v[0] = 0.;
    543           if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 6, 1, double_type, &neues->v[1], repetition,optional))
    544             neues->v[1] = 0.;
    545           if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 7, 1, double_type, &neues->v[2], repetition,optional))
    546             neues->v[2] = 0.;
     545          if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 5, 1, double_type, &neues->AtomicVelocity[0], repetition,optional))
     546            neues->AtomicVelocity[0] = 0.;
     547          if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 6, 1, double_type, &neues->AtomicVelocity[1], repetition,optional))
     548            neues->AtomicVelocity[1] = 0.;
     549          if(!ParseForParameter(verbose,FileBuffer, keyword, 0, 7, 1, double_type, &neues->AtomicVelocity[2], repetition,optional))
     550            neues->AtomicVelocity[2] = 0.;
    547551          // here we don't care if forces are present (last in trajectories is always equal to current position)
    548           neues->type = elementhash[i]; // find element type
     552          neues->setType(elementhash[i]); // find element type
    549553          mol->AddAtom(neues);
    550554        }
     
    10091013        istringstream input2(zeile);
    10101014        atom *neues = World::getInstance().createAtom();
    1011         input2 >> neues->x[0]; // x
    1012         input2 >> neues->x[1]; // y
    1013         input2 >> neues->x[2]; // z
     1015        double tmp;
     1016        for (int j=0;j<NDIM;j++) {
     1017          input2 >> tmp;
     1018          neues->set(j,tmp);
     1019        }
    10141020        input2 >> l;
    1015         neues->type = elementhash[No]; // find element type
     1021        neues->setType(elementhash[No]); // find element type
    10161022        mol->AddAtom(neues);
    10171023      }
     
    12791285    AtomNo = 0;
    12801286    for (molecule::const_iterator iter = (*MolRunner)->begin(); iter != (*MolRunner)->end(); ++iter) {
    1281       sprintf(name, "%2s%2d",(*iter)->type->symbol, elementNo[(*iter)->type->Z]);
    1282       elementNo[(*iter)->type->Z] = (elementNo[(*iter)->type->Z]+1) % 100;   // confine to two digits
     1287      sprintf(name, "%2s%2d",(*iter)->getType()->symbol, elementNo[(*iter)->getType()->Z]);
     1288      elementNo[(*iter)->getType()->Z] = (elementNo[(*iter)->getType()->Z]+1) % 100;   // confine to two digits
    12831289      fprintf(f,
    12841290             "ATOM %6u %-4s %4s%c%4u    %8.3f%8.3f%8.3f%6.2f%6.2f      %4s%2s%2s\n",
     
    12881294             'a'+(unsigned char)(AtomNo % 26),           /* letter for chain */
    12891295             MolNo,         /* residue sequence number */
    1290              (*iter)->node->at(0),                 /* position X in Angstroem */
    1291              (*iter)->node->at(1),                 /* position Y in Angstroem */
    1292              (*iter)->node->at(2),                 /* position Z in Angstroem */
    1293              (double)(*iter)->type->Valence,         /* occupancy */
    1294              (double)(*iter)->type->NoValenceOrbitals,          /* temperature factor */
     1296             (*iter)->at(0),                 /* position X in Angstroem */
     1297             (*iter)->at(1),                 /* position Y in Angstroem */
     1298             (*iter)->at(2),                 /* position Z in Angstroem */
     1299             (double)(*iter)->getType()->Valence,         /* occupancy */
     1300             (double)(*iter)->getType()->NoValenceOrbitals,          /* temperature factor */
    12951301             "0",            /* segment identifier */
    1296              (*iter)->type->symbol,    /* element symbol */
     1302             (*iter)->getType()->symbol,    /* element symbol */
    12971303             "0");           /* charge */
    12981304      AtomNo++;
     
    13321338  AtomNo = 0;
    13331339  for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    1334     sprintf(name, "%2s%2d",(*iter)->type->symbol, elementNo[(*iter)->type->Z]);
    1335     elementNo[(*iter)->type->Z] = (elementNo[(*iter)->type->Z]+1) % 100;   // confine to two digits
     1340    sprintf(name, "%2s%2d",(*iter)->getType()->symbol, elementNo[(*iter)->getType()->Z]);
     1341    elementNo[(*iter)->getType()->Z] = (elementNo[(*iter)->getType()->Z]+1) % 100;   // confine to two digits
    13361342    fprintf(f,
    13371343           "ATOM %6u %-4s %4s%c%4u    %8.3f%8.3f%8.3f%6.2f%6.2f      %4s%2s%2s\n",
     
    13411347           'a'+(unsigned char)(AtomNo % 26),           /* letter for chain */
    13421348           0,         /* residue sequence number */
    1343            (*iter)->node->at(0),                 /* position X in Angstroem */
    1344            (*iter)->node->at(1),                 /* position Y in Angstroem */
    1345            (*iter)->node->at(2),                 /* position Z in Angstroem */
    1346            (double)(*iter)->type->Valence,         /* occupancy */
    1347            (double)(*iter)->type->NoValenceOrbitals,          /* temperature factor */
     1349           (*iter)->at(0),                 /* position X in Angstroem */
     1350           (*iter)->at(1),                 /* position Y in Angstroem */
     1351           (*iter)->at(2),                 /* position Z in Angstroem */
     1352           (double)(*iter)->getType()->Valence,         /* occupancy */
     1353           (double)(*iter)->getType()->NoValenceOrbitals,          /* temperature factor */
    13481354           "0",            /* segment identifier */
    1349            (*iter)->type->symbol,    /* element symbol */
     1355           (*iter)->getType()->symbol,    /* element symbol */
    13501356           "0");           /* charge */
    13511357    AtomNo++;
     
    13901396    *output << mol->name << "\t";
    13911397    *output << 0 << "\t";
    1392     *output << (*iter)->node->at(0) << "\t" << (*iter)->node->at(1) << "\t" << (*iter)->node->at(2) << "\t";
    1393     *output << static_cast<double>((*iter)->type->Valence) << "\t";
    1394     *output << (*iter)->type->symbol << "\t";
     1398    *output << (*iter)->at(0) << "\t" << (*iter)->at(1) << "\t" << (*iter)->at(2) << "\t";
     1399    *output << static_cast<double>((*iter)->getType()->Valence) << "\t";
     1400    *output << (*iter)->getType()->symbol << "\t";
    13951401    for (BondList::iterator runner = (*iter)->ListOfBonds.begin(); runner != (*iter)->ListOfBonds.end(); runner++)
    13961402      *output << (*runner)->GetOtherAtom(*iter)->nr << "\t";
     
    14621468        *output << (*MolWalker)->name << "\t";
    14631469        *output << MolCounter+1 << "\t";
    1464         *output << (*iter)->node->at(0) << "\t" << (*iter)->node->at(1) << "\t" << (*iter)->node->at(2) << "\t";
    1465         *output << (double)(*iter)->type->Valence << "\t";
    1466         *output << (*iter)->type->symbol << "\t";
     1470        *output << (*iter)->at(0) << "\t" << (*iter)->at(1) << "\t" << (*iter)->at(2) << "\t";
     1471        *output << (double)(*iter)->getType()->Valence << "\t";
     1472        *output << (*iter)->getType()->symbol << "\t";
    14671473        for (BondList::iterator runner = (*iter)->ListOfBonds.begin(); runner != (*iter)->ListOfBonds.end(); runner++)
    14681474          *output << LocalNotoGlobalNoMap[ (*runner)->GetOtherAtom((*iter))->getId() ] << "\t";
  • src/ellipsoid.cpp

    r8d6d31 r8f4df1  
    1515#include <set>
    1616
     17#include "BoundaryPointSet.hpp"
    1718#include "boundary.hpp"
    1819#include "ellipsoid.hpp"
     
    304305              if ((current != PickedAtomNrs.end()) && (*current == index)) {
    305306                Candidate = (*Runner);
    306                 DoLog(2) && (Log() << Verbose(2) << "Current picked node is " << **Runner << " with index " << index << "." << endl);
    307                 x[PointsPicked++] = *Candidate->node;    // we have one more atom picked
     307                DoLog(2) && (Log() << Verbose(2) << "Current picked node is " << (*Runner)->getName() << " with index " << index << "." << endl);
     308                x[PointsPicked++] = Candidate->getPosition();    // we have one more atom picked
    308309                current++;    // next pre-picked atom
    309310              }
     
    351352      //Log() << Verbose(3) << "Current node is " << *Runner->second->node << " with " << value << " ... " << threshold << ": ";
    352353      if (value > threshold) {
    353         x[PointsPicked] = (*Runner->second->node->node);
     354        x[PointsPicked] = (Runner->second->node->getPosition());
    354355        PointsPicked++;
    355356        //Log() << Verbose(0) << "IN." << endl;
     
    388389  Center.Zero();
    389390  for (PointMap::iterator Runner = T->PointsOnBoundary.begin(); Runner != T->PointsOnBoundary.end(); Runner++)
    390     Center += (*Runner->second->node->node);
     391    Center += (Runner->second->node->getPosition());
    391392  Center.Scale(1./T->PointsOnBoundaryCount);
    392393  DoLog(1) && (Log() << Verbose(1) << "Center is at " << Center << "." << endl);
  • src/linkedcell.cpp

    r8d6d31 r8f4df1  
    5656  Walker = set->GetPoint();
    5757  for (int i=0;i<NDIM;i++) {
    58     max[i] = Walker->node->at(i);
    59     min[i] = Walker->node->at(i);
     58    max[i] = Walker->at(i);
     59    min[i] = Walker->at(i);
    6060  }
    6161  set->GoToFirst();
     
    6363    Walker = set->GetPoint();
    6464    for (int i=0;i<NDIM;i++) {
    65       if (max[i] < Walker->node->at(i))
    66         max[i] = Walker->node->at(i);
    67       if (min[i] > Walker->node->at(i))
    68         min[i] = Walker->node->at(i);
     65      if (max[i] < Walker->at(i))
     66        max[i] = Walker->at(i);
     67      if (min[i] > Walker->at(i))
     68        min[i] = Walker->at(i);
    6969    }
    7070    set->GoToNext();
     
    9696    Walker = set->GetPoint();
    9797    for (int i=0;i<NDIM;i++) {
    98       n[i] = static_cast<int>(floor((Walker->node->at(i) - min[i])/RADIUS));
     98      n[i] = static_cast<int>(floor((Walker->at(i) - min[i])/RADIUS));
    9999    }
    100100    index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2];
     
    130130  LinkedNodes::iterator Runner = set->begin();
    131131  for (int i=0;i<NDIM;i++) {
    132     max[i] = (*Runner)->node->at(i);
    133     min[i] = (*Runner)->node->at(i);
     132    max[i] = (*Runner)->at(i);
     133    min[i] = (*Runner)->at(i);
    134134  }
    135135  for (LinkedNodes::iterator Runner = set->begin(); Runner != set->end(); Runner++) {
    136136    Walker = *Runner;
    137137    for (int i=0;i<NDIM;i++) {
    138       if (max[i] < Walker->node->at(i))
    139         max[i] = Walker->node->at(i);
    140       if (min[i] > Walker->node->at(i))
    141         min[i] = Walker->node->at(i);
     138      if (max[i] < Walker->at(i))
     139        max[i] = Walker->at(i);
     140      if (min[i] > Walker->at(i))
     141        min[i] = Walker->at(i);
    142142    }
    143143  }
     
    167167    Walker = *Runner;
    168168    for (int i=0;i<NDIM;i++) {
    169       n[i] = static_cast<int>(floor((Walker->node->at(i) - min[i])/RADIUS));
     169      n[i] = static_cast<int>(floor((Walker->at(i) - min[i])/RADIUS));
    170170    }
    171171    index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2];
     
    248248 * \return Vector is inside bounding box - true, else - false
    249249 */
    250 bool LinkedCell::SetIndexToVector(const Vector * const x) const
     250bool LinkedCell::SetIndexToVector(const Vector & x) const
    251251{
    252252  for (int i=0;i<NDIM;i++)
    253     n[i] = (int)floor((x->at(i) - min[i])/RADIUS);
     253    n[i] = (int)floor((x.at(i) - min[i])/RADIUS);
    254254
    255255  return CheckBounds();
     
    264264  bool status = false;
    265265  for (int i=0;i<NDIM;i++) {
    266     n[i] = static_cast<int>(floor((Walker->node->at(i) - min[i])/RADIUS));
     266    n[i] = static_cast<int>(floor((Walker->at(i) - min[i])/RADIUS));
    267267  }
    268268  index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2];
     
    404404      Walker = *Runner;
    405405      //Log() << Verbose(1) << "Current neighbour is at " << *Walker->node << "." << endl;
    406       if ((center->DistanceSquared(*Walker->node) - radiusSquared) < MYEPSILON) {
     406      if ((Walker->DistanceSquared(*center) - radiusSquared) < MYEPSILON) {
    407407        TesselList->push_back(Walker);
    408408      }
  • src/linkedcell.hpp

    r8d6d31 r8f4df1  
    6060    const LinkedCell::LinkedNodes* GetRelativeToCurrentCell(const int relative[NDIM])const ;
    6161    bool SetIndexToNode(const TesselPoint * const Walker)const ;
    62     bool SetIndexToVector(const Vector * const x)const ;
     62    bool SetIndexToVector(const Vector &x)const ;
    6363    double SetClosestIndexToOutsideVector(const Vector * const x) const;
    6464    bool CheckBounds()const ;
  • src/molecule.cpp

    r8d6d31 r8f4df1  
    157157  atomIds.erase( atom->getId() );
    158158  atoms.remove( atom );
    159   formula-=atom->type;
     159  formula-=atom->getType();
    160160  atom->removeFromMolecule();
    161161  return iter;
     
    169169    atomIds.erase( key->getId() );
    170170    atoms.remove( key );
    171     formula-=key->type;
     171    formula-=key->getType();
    172172    key->removeFromMolecule();
    173173  }
     
    191191  if (res.second) { // push atom if went well
    192192    atoms.push_back(key);
    193     formula+=key->type;
     193    formula+=key->getType();
    194194    return pair<iterator,bool>(molecule::iterator(--end()),res.second);
    195195  } else {
     
    212212  if (pointer != NULL) {
    213213    pointer->sort = &pointer->nr;
    214     if (pointer->type != NULL) {
    215       formula += pointer->type;
    216       if (pointer->type->Z != 1)
     214    if (pointer->getType() != NULL) {
     215      formula += pointer->getType();
     216      if (pointer->getType()->Z != 1)
    217217        NoNonHydrogen++;
    218218      if(pointer->getName() == "Unknown"){
    219219        stringstream sstr;
    220         sstr << pointer->type->symbol << pointer->nr+1;
     220        sstr << pointer->getType()->symbol << pointer->nr+1;
    221221        pointer->setName(sstr.str());
    222222      }
     
    239239  if (pointer != NULL) {
    240240    atom *walker = pointer->clone();
    241     formula += walker->type;
     241    formula += walker->getType();
    242242    walker->setName(pointer->getName());
    243243    walker->nr = last_atom++;  // increase number within molecule
    244244    insert(walker);
    245     if ((pointer->type != NULL) && (pointer->type->Z != 1))
     245    if ((pointer->getType() != NULL) && (pointer->getType()->Z != 1))
    246246      NoNonHydrogen++;
    247247    retval=walker;
     
    301301//  Log() << Verbose(3) << "Begin of AddHydrogenReplacementAtom." << endl;
    302302  // create vector in direction of bond
    303   InBondvector = TopReplacement->x - TopOrigin->x;
     303  InBondvector = TopReplacement->getPosition() - TopOrigin->getPosition();
    304304  bondlength = InBondvector.Norm();
    305305
     
    313313    Orthovector1.Zero();
    314314    for (int i=NDIM;i--;) {
    315       l = TopReplacement->x[i] - TopOrigin->x[i];
     315      l = TopReplacement->at(i) - TopOrigin->at(i);
    316316      if (fabs(l) > BondDistance) { // is component greater than bond distance
    317317        Orthovector1[i] = (l < 0) ? -1. : +1.;
     
    328328  InBondvector.Normalize();
    329329  // get typical bond length and store as scale factor for later
    330   ASSERT(TopOrigin->type != NULL, "AddHydrogenReplacementAtom: element of TopOrigin is not given.");
    331   BondRescale = TopOrigin->type->HBondDistance[TopBond->BondDegree-1];
     330  ASSERT(TopOrigin->getType() != NULL, "AddHydrogenReplacementAtom: element of TopOrigin is not given.");
     331  BondRescale = TopOrigin->getType()->HBondDistance[TopBond->BondDegree-1];
    332332  if (BondRescale == -1) {
    333333    DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond distance in replacing bond (" << TopOrigin->getName() << "<->" << TopReplacement->getName() << ") of degree " << TopBond->BondDegree << "!" << endl);
     
    343343    case 1:
    344344      FirstOtherAtom = World::getInstance().createAtom();    // new atom
    345       FirstOtherAtom->type = elemente->FindElement(1);  // element is Hydrogen
    346       FirstOtherAtom->v = TopReplacement->v; // copy velocity
     345      FirstOtherAtom->setType(1);  // element is Hydrogen
     346      FirstOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
    347347      FirstOtherAtom->FixedIon = TopReplacement->FixedIon;
    348       if (TopReplacement->type->Z == 1) { // neither rescale nor replace if it's already hydrogen
     348      if (TopReplacement->getType()->Z == 1) { // neither rescale nor replace if it's already hydrogen
    349349        FirstOtherAtom->father = TopReplacement;
    350350        BondRescale = bondlength;
     
    353353      }
    354354      InBondvector *= BondRescale;   // rescale the distance vector to Hydrogen bond length
    355       FirstOtherAtom->x = TopOrigin->x; // set coordination to origin ...
    356       FirstOtherAtom->x += InBondvector;  // ... and add distance vector to replacement atom
     355      FirstOtherAtom->setPosition(TopOrigin->getPosition() + InBondvector); // set coordination to origin and add distance vector to replacement atom
    357356      AllWentWell = AllWentWell && AddAtom(FirstOtherAtom);
    358357//      Log() << Verbose(4) << "Added " << *FirstOtherAtom << " at: ";
     
    387386        // determine the plane of these two with the *origin
    388387        try {
    389           Orthovector1 =Plane(TopOrigin->x, FirstOtherAtom->x, SecondOtherAtom->x).getNormal();
     388          Orthovector1 =Plane(TopOrigin->getPosition(), FirstOtherAtom->getPosition(), SecondOtherAtom->getPosition()).getNormal();
    390389        }
    391390        catch(LinearDependenceException &excp){
     
    408407      FirstOtherAtom = World::getInstance().createAtom();
    409408      SecondOtherAtom = World::getInstance().createAtom();
    410       FirstOtherAtom->type = elemente->FindElement(1);
    411       SecondOtherAtom->type = elemente->FindElement(1);
    412       FirstOtherAtom->v = TopReplacement->v; // copy velocity
     409      FirstOtherAtom->setType(1);
     410      SecondOtherAtom->setType(1);
     411      FirstOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
    413412      FirstOtherAtom->FixedIon = TopReplacement->FixedIon;
    414       SecondOtherAtom->v = TopReplacement->v; // copy velocity
     413      SecondOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
    415414      SecondOtherAtom->FixedIon = TopReplacement->FixedIon;
    416415      FirstOtherAtom->father = NULL;  // we are just an added hydrogen with no father
    417416      SecondOtherAtom->father = NULL;  //  we are just an added hydrogen with no father
    418       bondangle = TopOrigin->type->HBondAngle[1];
     417      bondangle = TopOrigin->getType()->HBondAngle[1];
    419418      if (bondangle == -1) {
    420419        DoeLog(1) && (eLog()<< Verbose(1) << "There is no typical hydrogen bond angle in replacing bond (" << TopOrigin->getName() << "<->" << TopReplacement->getName() << ") of degree " << TopBond->BondDegree << "!" << endl);
     
    430429//      Log() << Verbose(0) << endl;
    431430//      Log() << Verbose(3) << "Half the bond angle is " << bondangle << ", sin and cos of it: " << sin(bondangle) << ", " << cos(bondangle) << endl;
    432       FirstOtherAtom->x.Zero();
    433       SecondOtherAtom->x.Zero();
     431      FirstOtherAtom->Zero();
     432      SecondOtherAtom->Zero();
    434433      for(int i=NDIM;i--;) { // rotate by half the bond angle in both directions (InBondvector is bondangle = 0 direction)
    435         FirstOtherAtom->x[i] = InBondvector[i] * cos(bondangle) + Orthovector1[i] * (sin(bondangle));
    436         SecondOtherAtom->x[i] = InBondvector[i] * cos(bondangle) + Orthovector1[i] * (-sin(bondangle));
    437       }
    438       FirstOtherAtom->x *= BondRescale;  // rescale by correct BondDistance
    439       SecondOtherAtom->x *= BondRescale;
     434        FirstOtherAtom->set(i, InBondvector[i] * cos(bondangle) + Orthovector1[i] * (sin(bondangle)));
     435        SecondOtherAtom->set(i, InBondvector[i] * cos(bondangle) + Orthovector1[i] * (-sin(bondangle)));
     436      }
     437      FirstOtherAtom->Scale(BondRescale);  // rescale by correct BondDistance
     438      SecondOtherAtom->Scale(BondRescale);
    440439      //Log() << Verbose(3) << "ReScaleCheck: " << FirstOtherAtom->x.Norm() << " and " << SecondOtherAtom->x.Norm() << "." << endl;
    441       for(int i=NDIM;i--;) { // and make relative to origin atom
    442         FirstOtherAtom->x[i] += TopOrigin->x[i];
    443         SecondOtherAtom->x[i] += TopOrigin->x[i];
    444       }
     440      *FirstOtherAtom += TopOrigin->getPosition();
     441      *SecondOtherAtom += TopOrigin->getPosition();
    445442      // ... and add to molecule
    446443      AllWentWell = AllWentWell && AddAtom(FirstOtherAtom);
     
    464461      SecondOtherAtom = World::getInstance().createAtom();
    465462      ThirdOtherAtom = World::getInstance().createAtom();
    466       FirstOtherAtom->type = elemente->FindElement(1);
    467       SecondOtherAtom->type = elemente->FindElement(1);
    468       ThirdOtherAtom->type = elemente->FindElement(1);
    469       FirstOtherAtom->v = TopReplacement->v; // copy velocity
     463      FirstOtherAtom->setType(1);
     464      SecondOtherAtom->setType(1);
     465      ThirdOtherAtom->setType(1);
     466      FirstOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
    470467      FirstOtherAtom->FixedIon = TopReplacement->FixedIon;
    471       SecondOtherAtom->v = TopReplacement->v; // copy velocity
     468      SecondOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
    472469      SecondOtherAtom->FixedIon = TopReplacement->FixedIon;
    473       ThirdOtherAtom->v = TopReplacement->v; // copy velocity
     470      ThirdOtherAtom->AtomicVelocity = TopReplacement->AtomicVelocity; // copy velocity
    474471      ThirdOtherAtom->FixedIon = TopReplacement->FixedIon;
    475472      FirstOtherAtom->father = NULL;  //  we are just an added hydrogen with no father
     
    494491
    495492      // create correct coordination for the three atoms
    496       alpha = (TopOrigin->type->HBondAngle[2])/180.*M_PI/2.;  // retrieve triple bond angle from database
     493      alpha = (TopOrigin->getType()->HBondAngle[2])/180.*M_PI/2.;  // retrieve triple bond angle from database
    497494      l = BondRescale;        // desired bond length
    498495      b = 2.*l*sin(alpha);    // base length of isosceles triangle
     
    505502      factors[1] = f;
    506503      factors[2] = 0.;
    507       FirstOtherAtom->x.LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
     504      FirstOtherAtom->LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
    508505      factors[1] = -0.5*f;
    509506      factors[2] = g;
    510       SecondOtherAtom->x.LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
     507      SecondOtherAtom->LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
    511508      factors[2] = -g;
    512       ThirdOtherAtom->x.LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
     509      ThirdOtherAtom->LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
    513510
    514511      // rescale each to correct BondDistance
     
    518515
    519516      // and relative to *origin atom
    520       FirstOtherAtom->x += TopOrigin->x;
    521       SecondOtherAtom->x += TopOrigin->x;
    522       ThirdOtherAtom->x += TopOrigin->x;
     517      *FirstOtherAtom += TopOrigin->getPosition();
     518      *SecondOtherAtom += TopOrigin->getPosition();
     519      *ThirdOtherAtom += TopOrigin->getPosition();
    523520
    524521      // ... and add to molecule
     
    596593    *item >> x[1];
    597594    *item >> x[2];
    598     Walker->type = elemente->FindElement(shorthand);
    599     if (Walker->type == NULL) {
     595    Walker->setType(elemente->FindElement(shorthand));
     596    if (Walker->getType() == NULL) {
    600597      DoeLog(1) && (eLog()<< Verbose(1) << "Could not parse the element at line: '" << line << "', setting to H.");
    601       Walker->type = elemente->FindElement(1);
     598      Walker->setType(1);
    602599    }
    603600    if (Walker->Trajectory.R.size() <= (unsigned int)MDSteps) {
     
    606603      Walker->Trajectory.F.resize(MDSteps+10);
    607604    }
     605    Walker->setPosition(Vector(x));
    608606    for(j=NDIM;j--;) {
    609       Walker->x[j] = x[j];
    610607      Walker->Trajectory.R.at(MDSteps-1)[j] = x[j];
    611608      Walker->Trajectory.U.at(MDSteps-1)[j] = 0;
     
    702699  atom1->RegisterBond(Binder);
    703700  atom2->RegisterBond(Binder);
    704   if ((atom1->type != NULL) && (atom1->type->Z != 1) && (atom2->type != NULL) && (atom2->type->Z != 1))
     701  if ((atom1->getType() != NULL) && (atom1->getType()->Z != 1) && (atom2->getType() != NULL) && (atom2->getType()->Z != 1))
    705702    NoNonBonds++;
    706703
     
    776773  ASSERT(pointer, "Null pointer passed to molecule::RemoveAtom().");
    777774  OBSERVE;
    778   formula-=pointer->type;
     775  formula-=pointer->getType();
    779776  RemoveBonds(pointer);
    780777  erase(pointer);
     
    790787  if (pointer == NULL)
    791788    return false;
    792   formula-=pointer->type;
     789  formula-=pointer->getType();
    793790  erase(pointer);
    794791  return true;
     
    972969  for (molecule::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) {
    973970    (*iter)->nr = i;   // update number in molecule (for easier referencing in FragmentMolecule lateron)
    974     if ((*iter)->type->Z != 1) // count non-hydrogen atoms whilst at it
     971    if ((*iter)->getType()->Z != 1) // count non-hydrogen atoms whilst at it
    975972      NoNonHydrogen++;
    976973    stringstream sstr;
    977     sstr << (*iter)->type->symbol << (*iter)->nr+1;
     974    sstr << (*iter)->getType()->symbol << (*iter)->nr+1;
    978975    (*iter)->setName(sstr.str());
    979976    DoLog(3) && (Log() << Verbose(3) << "Naming atom nr. " << (*iter)->nr << " " << (*iter)->getName() << "." << endl);
  • src/molecule.hpp

    r8d6d31 r8f4df1  
    164164  bool IsEmpty() const ;
    165165  bool IsEnd() const ;
    166 
    167   // templates for allowing global manipulation of all vectors
    168   template <typename res> void ActOnAllVectors( res (Vector::*f)() ) const;
    169   template <typename res> void ActOnAllVectors( res (Vector::*f)() const) const;
    170   template <typename res, typename T> void ActOnAllVectors( res (Vector::*f)(T), T t ) const;
    171   template <typename res, typename T> void ActOnAllVectors( res (Vector::*f)(T) const, T t ) const;
    172   template <typename res, typename T> void ActOnAllVectors( res (Vector::*f)(T&), T &t ) const;
    173   template <typename res, typename T> void ActOnAllVectors( res (Vector::*f)(T&) const, T &t ) const;
    174   template <typename res, typename T, typename U> void ActOnAllVectors( res (Vector::*f)(T, U), T t, U u ) const;
    175   template <typename res, typename T, typename U> void ActOnAllVectors( res (Vector::*f)(T, U) const, T t, U u ) const;
    176   template <typename res, typename T, typename U, typename V> void ActOnAllVectors( res (Vector::*f)(T, U, V), T t, U u, V v) const;
    177   template <typename res, typename T, typename U, typename V> void ActOnAllVectors( res (Vector::*f)(T, U, V) const, T t, U u, V v) const;
    178166
    179167  // templates for allowing global manipulation of molecule with each atom as single argument
  • src/molecule_dynamics.cpp

    r8d6d31 r8f4df1  
    513513      Sprinter = mol->AddCopyAtom((*iter));
    514514      for (int n=NDIM;n--;) {
    515         Sprinter->x[n] = (*iter)->Trajectory.R.at(startstep)[n] + (PermutationMap[(*iter)->nr]->Trajectory.R.at(endstep)[n] - (*iter)->Trajectory.R.at(startstep)[n])*((double)step/(double)MaxSteps);
     515        Sprinter->set(n, (*iter)->Trajectory.R.at(startstep)[n] + (PermutationMap[(*iter)->nr]->Trajectory.R.at(endstep)[n] - (*iter)->Trajectory.R.at(startstep)[n])*((double)step/(double)MaxSteps));
    516516        // add to Trajectories
    517517        //Log() << Verbose(3) << step << ">=" << MDSteps-1 << endl;
  • src/molecule_fragmentation.cpp

    r8d6d31 r8f4df1  
    451451      for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    452452    #ifdef ADDHYDROGEN
    453         if ((*iter)->type->Z != 1) // skip hydrogen
     453        if ((*iter)->getType()->Z != 1) // skip hydrogen
    454454    #endif
    455455        {
     
    471471    for(molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    472472  #ifdef ADDHYDROGEN
    473       if ((*iter)->type->Z != 1) // skip hydrogen
     473      if ((*iter)->getType()->Z != 1) // skip hydrogen
    474474  #endif
    475475      {
     
    880880  for (KeySet::iterator runner = Leaf->begin(); runner != Leaf->end(); runner++) {
    881881    Runner = FindAtom((*runner));
    882     if (Runner->type->Z != 1) { // skip all those added hydrogens when re-filling snake stack
     882    if (Runner->getType()->Z != 1) { // skip all those added hydrogens when re-filling snake stack
    883883      if (ShortestPathList[(*runner)] > SP) {  // remove the oldest one with longest shortest path
    884884        SP = ShortestPathList[(*runner)];
     
    969969    ++iter;
    970970#ifdef ADDHYDROGEN
    971     while ((iter != Leaf->end()) && ((*iter)->type->Z == 1)){ // skip added hydrogen
     971    while ((iter != Leaf->end()) && ((*iter)->getType()->Z == 1)){ // skip added hydrogen
    972972      iter++;
    973973    }
     
    13471347        if ((RestrictedKeySet.find(OtherWalker->nr) != RestrictedKeySet.end())
    13481348  #ifdef ADDHYDROGEN
    1349          && (OtherWalker->type->Z != 1)
     1349         && (OtherWalker->getType()->Z != 1)
    13501350  #endif
    13511351                                                              ) {  // skip hydrogens and restrict to fragment
     
    17411741        Binder = (*BondRunner);
    17421742        for (int i=NDIM;i--;) {
    1743           tmp = fabs(Binder->leftatom->x[i] - Binder->rightatom->x[i]);
     1743          tmp = fabs(Binder->leftatom->at(i) - Binder->rightatom->at(i));
    17441744          //Log() << Verbose(3) << "Checking " << i << "th distance of " << *Binder->leftatom << " to " << *Binder->rightatom << ": " << tmp << "." << endl;
    17451745          if (tmp > BondDistance) {
     
    17551755      // create translation vector from their periodically modified distance
    17561756      for (int i=NDIM;i--;) {
    1757         tmp = Binder->leftatom->x[i] - Binder->rightatom->x[i];
     1757        tmp = Binder->leftatom->at(i) - Binder->rightatom->at(i);
    17581758        if (fabs(tmp) > BondDistance)
    17591759          Translationvector[i] = (tmp < 0) ? +1. : -1.;
     
    17701770        //Log() << Verbose (3) << "Current Walker is: " << *Walker << "." << endl;
    17711771        ColorList[Walker->nr] = black;    // mark as explored
    1772         Walker->x += Translationvector; // translate
     1772        *Walker += Translationvector; // translate
    17731773        for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) {
    17741774          if ((*Runner) != Binder) {
  • src/molecule_geometry.cpp

    r8d6d31 r8f4df1  
    4848
    4949  // go through all atoms
    50   ActOnAllVectors( &Vector::SubtractVector, *Center);
    51   ActOnAllVectors( &Vector::SubtractVector, *CenterBox);
     50  BOOST_FOREACH(atom* iter, atoms){
     51    *iter -= *Center;
     52    *iter -= *CenterBox;
     53  }
    5254  atoms.transformNodes(boost::bind(&Box::WrapPeriodically,domain,_1));
    5355
     
    6668  Box &domain = World::getInstance().getDomain();
    6769
     70  // go through all atoms
    6871  atoms.transformNodes(boost::bind(&Box::WrapPeriodically,domain,_1));
    6972
     
    8386  if (iter != end()) { //list not empty?
    8487    for (int i=NDIM;i--;) {
    85       max->at(i) = (*iter)->x[i];
    86       min->at(i) = (*iter)->x[i];
     88      max->at(i) = (*iter)->at(i);
     89      min->at(i) = (*iter)->at(i);
    8790    }
    8891    for (; iter != end(); ++iter) {// continue with second if present
    8992      //(*iter)->Output(1,1,out);
    9093      for (int i=NDIM;i--;) {
    91         max->at(i) = (max->at(i) < (*iter)->x[i]) ? (*iter)->x[i] : max->at(i);
    92         min->at(i) = (min->at(i) > (*iter)->x[i]) ? (*iter)->x[i] : min->at(i);
     94        max->at(i) = (max->at(i) < (*iter)->at(i)) ? (*iter)->at(i) : max->at(i);
     95        min->at(i) = (min->at(i) > (*iter)->at(i)) ? (*iter)->at(i) : min->at(i);
    9396      }
    9497    }
     
    121124    for (; iter != end(); ++iter) {  // continue with second if present
    122125      Num++;
    123       Center += (*iter)->x;
     126      Center += (*iter)->getPosition();
    124127    }
    125128    Center.Scale(-1./(double)Num); // divide through total number (and sign for direction)
     
    143146    for (; iter != end(); ++iter) {  // continue with second if present
    144147      Num++;
    145       (*a) += (*iter)->x;
     148      (*a) += (*iter)->getPosition();
    146149    }
    147150    a->Scale(1./(double)Num); // divide through total mass (and sign for direction)
     
    176179  if (iter != end()) {   //list not empty?
    177180    for (; iter != end(); ++iter) {  // continue with second if present
    178       Num += (*iter)->type->mass;
    179       tmp = (*iter)->type->mass * (*iter)->x;
     181      Num += (*iter)->getType()->mass;
     182      tmp = (*iter)->getType()->mass * (*iter)->getPosition();
    180183      (*a) += tmp;
    181184    }
     
    221224    for (int j=0;j<MDSteps;j++)
    222225      (*iter)->Trajectory.R.at(j).ScaleAll(*factor);
    223     (*iter)->x.ScaleAll(*factor);
     226    (*iter)->ScaleAll(*factor);
    224227  }
    225228};
     
    233236    for (int j=0;j<MDSteps;j++)
    234237      (*iter)->Trajectory.R.at(j) += (*trans);
    235     (*iter)->x += (*trans);
     238    *(*iter) += (*trans);
    236239  }
    237240};
     
    246249
    247250  // go through all atoms
    248   ActOnAllVectors( &Vector::AddVector, *trans);
     251  BOOST_FOREACH(atom* iter, atoms){
     252    *iter += *trans;
     253  }
    249254  atoms.transformNodes(boost::bind(&Box::WrapPeriodically,domain,_1));
    250255
     
    278283    for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    279284#ifdef ADDHYDROGEN
    280       if ((*iter)->type->Z != 1) {
     285      if ((*iter)->getType()->Z != 1) {
    281286#endif
    282         Testvector = inversematrix * (*iter)->x;
     287        Testvector = inversematrix * (*iter)->getPosition();
    283288        Translationvector.Zero();
    284289        for (BondList::const_iterator Runner = (*iter)->ListOfBonds.begin(); Runner != (*iter)->ListOfBonds.end(); (++Runner)) {
    285290         if ((*iter)->nr < (*Runner)->GetOtherAtom((*iter))->nr) // otherwise we shift one to, the other fro and gain nothing
    286291            for (int j=0;j<NDIM;j++) {
    287               tmp = (*iter)->x[j] - (*Runner)->GetOtherAtom(*iter)->x[j];
     292              tmp = (*iter)->at(j) - (*Runner)->GetOtherAtom(*iter)->at(j);
    288293              if ((fabs(tmp)) > BondDistance) {
    289294                flag = false;
     
    303308        // now also change all hydrogens
    304309        for (BondList::const_iterator Runner = (*iter)->ListOfBonds.begin(); Runner != (*iter)->ListOfBonds.end(); (++Runner)) {
    305           if ((*Runner)->GetOtherAtom((*iter))->type->Z == 1) {
    306             Testvector = inversematrix * (*Runner)->GetOtherAtom((*iter))->x;
     310          if ((*Runner)->GetOtherAtom((*iter))->getType()->Z == 1) {
     311            Testvector = inversematrix * (*Runner)->GetOtherAtom((*iter))->getPosition();
    307312            Testvector += Translationvector;
    308313            Testvector *= matrix;
     
    335340  DoLog(1) && (Log() << Verbose(1) << "Z-X-angle: " << alpha << " ... ");
    336341  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    337     tmp = (*iter)->x[0];
    338     (*iter)->x[0] =  cos(alpha) * tmp + sin(alpha) * (*iter)->x[2];
    339     (*iter)->x[2] = -sin(alpha) * tmp + cos(alpha) * (*iter)->x[2];
     342    tmp = (*iter)->at(0);
     343    (*iter)->set(0,  cos(alpha) * tmp + sin(alpha) * (*iter)->at(2));
     344    (*iter)->set(2, -sin(alpha) * tmp + cos(alpha) * (*iter)->at(2));
    340345    for (int j=0;j<MDSteps;j++) {
    341346      tmp = (*iter)->Trajectory.R.at(j)[0];
     
    354359  DoLog(1) && (Log() << Verbose(1) << "Z-Y-angle: " << alpha << " ... ");
    355360  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    356     tmp = (*iter)->x[1];
    357     (*iter)->x[1] =  cos(alpha) * tmp + sin(alpha) * (*iter)->x[2];
    358     (*iter)->x[2] = -sin(alpha) * tmp + cos(alpha) * (*iter)->x[2];
     361    tmp = (*iter)->at(1);
     362    (*iter)->set(1,  cos(alpha) * tmp + sin(alpha) * (*iter)->at(2));
     363    (*iter)->set(2, -sin(alpha) * tmp + cos(alpha) * (*iter)->at(2));
    359364    for (int j=0;j<MDSteps;j++) {
    360365      tmp = (*iter)->Trajectory.R.at(j)[1];
     
    394399  // go through all atoms
    395400  for (molecule::const_iterator iter = par->mol->begin(); iter != par->mol->end(); ++iter) {
    396     if ((*iter)->type == ((struct lsq_params *)params)->type) { // for specific type
    397       c = (*iter)->x - a;
     401    if ((*iter)->getType() == ((struct lsq_params *)params)->type) { // for specific type
     402      c = (*iter)->getPosition() - a;
    398403      t = c.ScalarProduct(b);           // get direction parameter
    399404      d = t*b;       // and create vector
  • src/molecule_graph.cpp

    r8d6d31 r8f4df1  
    184184                          //Log() << Verbose(1) << "Checking distance " << OtherWalker->x.PeriodicDistanceSquared(&(Walker->x), cell_size) << " against typical bond length of " << bonddistance*bonddistance << "." << endl;
    185185                          (BG->*minmaxdistance)(Walker, OtherWalker, MinDistance, MaxDistance, IsAngstroem);
    186                           const double distance = domain.periodicDistanceSquared(OtherWalker->x,Walker->x);
     186                          const double distance = domain.periodicDistanceSquared(OtherWalker->getPosition(),Walker->getPosition());
    187187                          const bool status = (distance <= MaxDistance * MaxDistance) && (distance >= MinDistance * MinDistance);
    188188//                          Log() << Verbose(1) << "MinDistance is " << MinDistance << " and MaxDistance is " << MaxDistance << "." << endl;
     
    737737        OtherAtom = (*Runner)->GetOtherAtom(Walker);
    738738#ifdef ADDHYDROGEN
    739         if (OtherAtom->type->Z != 1) {
     739        if (OtherAtom->getType()->Z != 1) {
    740740#endif
    741741        DoLog(2) && (Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->getName() << " for bond " << *(*Runner) << "." << endl);
  • src/molecule_template.hpp

    r8d6d31 r8f4df1  
    1919/********************************************** declarations *******************************/
    2020
    21 // ================== Acting on all Vectors ========================== //
    22 
    23 // zero arguments
    24 template <typename res> void molecule::ActOnAllVectors( res (Vector::*f)() ) const
    25     {
    26   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    27     (((*iter)->node)->*f)();
    28   }
    29 };
    30 template <typename res> void molecule::ActOnAllVectors( res (Vector::*f)() const ) const
    31     {
    32   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    33     (((*iter)->node)->*f)();
    34   }
    35 };
    36 // one argument
    37 template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T), T t ) const
    38 {
    39   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    40     (((*iter)->node)->*f)(t);
    41   }
    42 };
    43 template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T) const, T t ) const
    44 {
    45   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    46     (((*iter)->node)->*f)(t);
    47   }
    48 };
    49 template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T&), T &t ) const
    50 {
    51   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    52     (((*iter)->node)->*f)(t);
    53   }
    54 };
    55 template <typename res, typename T> void molecule::ActOnAllVectors( res (Vector::*f)(T&) const, T &t ) const
    56 {
    57   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    58     (((*iter)->node)->*f)(t);
    59   }
    60 };
    61 // two arguments
    62 template <typename res, typename T, typename U> void molecule::ActOnAllVectors( res (Vector::*f)(T, U), T t, U u ) const
    63 {
    64   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    65     (((*iter)->node)->*f)(t, u);
    66   }
    67 };
    68 template <typename res, typename T, typename U> void molecule::ActOnAllVectors( res (Vector::*f)(T, U) const, T t, U u ) const
    69 {
    70   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    71     (((*iter)->node)->*f)(t, u);
    72   }
    73 };
    74 // three arguments
    75 template <typename res, typename T, typename U, typename V> void molecule::ActOnAllVectors( res (Vector::*f)(T, U, V), T t, U u, V v) const
    76 {
    77   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    78     (((*iter)->node)->*f)(t, u, v);
    79   }
    80 };
    81 template <typename res, typename T, typename U, typename V> void molecule::ActOnAllVectors( res (Vector::*f)(T, U, V) const, T t, U u, V v) const
    82 {
    83   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    84     (((*iter)->node)->*f)(t, u, v);
    85   }
    86 };
    8721
    8822// ========================= Summing over each Atoms =================================== //
     
    370304  int inc = 1;
    371305  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    372     (*Setor) (&array[((*iter)->type->*index)], &inc);
     306    (*Setor) (&array[((*iter)->getType()->*index)], &inc);
    373307  }
    374308};
     
    376310{
    377311  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    378     (*Setor) (&array[((*iter)->type->*index)], &value);
     312    (*Setor) (&array[((*iter)->getType()->*index)], &value);
    379313  }
    380314};
     
    382316{
    383317  for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    384     (*Setor) (&array[((*iter)->type->*index)], value);
     318    (*Setor) (&array[((*iter)->getType()->*index)], value);
    385319  }
    386320};
  • src/moleculelist.cpp

    r8d6d31 r8f4df1  
    182182      size=0.;
    183183      for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) {
    184         counts[(*iter)->type->getNumber()]++;
    185         if ((*iter)->x.DistanceSquared(Origin) > size)
    186           size = (*iter)->x.DistanceSquared(Origin);
     184        counts[(*iter)->getType()->getNumber()]++;
     185        if ((*iter)->DistanceSquared(Origin) > size)
     186          size = (*iter)->DistanceSquared(Origin);
    187187      }
    188188      // output Index, Name, number of atoms, chemical formula
     
    354354  for (molecule::const_iterator iter = srcmol->begin(); iter != srcmol->end(); ++iter) {
    355355    DoLog(2) && (Log() << Verbose(2) << "INFO: Current Walker is " << **iter << "." << endl);
    356     if (!TesselStruct->IsInnerPoint((*iter)->x, LCList)) {
     356    if (!TesselStruct->IsInnerPoint((*iter)->getPosition(), LCList)) {
    357357      CopyAtoms[(*iter)->nr] = (*iter)->clone();
    358358      mol->AddAtom(CopyAtoms[(*iter)->nr]);
     
    501501    for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) {
    502502      //Log() << Verbose(1) << "(*iter): " << *(*iter) << " with first bond " << *((*iter)->ListOfBonds.begin()) << "." << endl;
    503       if (((*iter)->type->Z == 1) && (((*iter)->father == NULL)
    504           || ((*iter)->father->type->Z != 1))) { // if it's a hydrogen
     503      if (((*iter)->getType()->Z == 1) && (((*iter)->father == NULL)
     504          || ((*iter)->father->getType()->Z != 1))) { // if it's a hydrogen
    505505        for (molecule::const_iterator runner = (*ListRunner)->begin(); runner != (*ListRunner)->end(); ++runner) {
    506506          //Log() << Verbose(2) << "Runner: " << *(*runner) << " with first bond " << *((*iter)->ListOfBonds.begin()) << "." << endl;
    507507          // 3. take every other hydrogen that is the not the first and not bound to same bonding partner
    508508          Binder = *((*runner)->ListOfBonds.begin());
    509           if (((*runner)->type->Z == 1) && ((*runner)->nr > (*iter)->nr) && (Binder->GetOtherAtom((*runner)) != Binder->GetOtherAtom((*iter)))) { // (hydrogens have only one bonding partner!)
     509          if (((*runner)->getType()->Z == 1) && ((*runner)->nr > (*iter)->nr) && (Binder->GetOtherAtom((*runner)) != Binder->GetOtherAtom((*iter)))) { // (hydrogens have only one bonding partner!)
    510510            // 4. evaluate the morse potential for each matrix component and add up
    511             distance = (*runner)->x.distance((*iter)->x);
     511            distance = (*runner)->distance(*(*iter));
    512512            //Log() << Verbose(0) << "Fragment " << (*ListRunner)->name << ": " << *(*runner) << "<= " << distance << "=>" << *(*iter) << ":" << endl;
    513513            for (int k = 0; k < a; k++) {
     
    599599        if ((*ListRunner)->hasElement((*elemIter).first)) { // if this element got atoms
    600600          for(molecule::iterator atomIter = (*ListRunner)->begin(); atomIter !=(*ListRunner)->end();++atomIter){
    601             if ((*atomIter)->type->getNumber() == (*elemIter).first) {
     601            if ((*atomIter)->getType()->getNumber() == (*elemIter).first) {
    602602              if (((*atomIter)->GetTrueFather() != NULL) && ((*atomIter)->GetTrueFather() != (*atomIter))) {// if there is a rea
    603603                //Log() << Verbose(0) << "Walker is " << *Walker << " with true father " << *( Walker->GetTrueFather()) << ", it
     
    10891089        if (AtomMask[Father->nr]) // apply mask
    10901090#ifdef ADDHYDROGEN
    1091           if ((*iter)->type->Z != 1) // skip hydrogen
     1091          if ((*iter)->getType()->Z != 1) // skip hydrogen
    10921092#endif
    10931093          RootStack[FragmentCounter].push_front((*iter)->nr);
  • src/tesselation.cpp

    r8d6d31 r8f4df1  
    1313#include "Helpers/helpers.hpp"
    1414#include "Helpers/Info.hpp"
     15#include "BoundaryPointSet.hpp"
     16#include "BoundaryLineSet.hpp"
     17#include "BoundaryTriangleSet.hpp"
     18#include "BoundaryPolygonSet.hpp"
     19#include "TesselPoint.hpp"
     20#include "CandidateForTesselation.hpp"
     21#include "PointCloud.hpp"
    1522#include "linkedcell.hpp"
    1623#include "Helpers/Log.hpp"
     
    2027#include "LinearAlgebra/Vector.hpp"
    2128#include "LinearAlgebra/Line.hpp"
    22 #include "vector_ops.hpp"
     29#include "LinearAlgebra/vector_ops.hpp"
    2330#include "Helpers/Verbose.hpp"
    2431#include "LinearAlgebra/Plane.hpp"
     
    2734
    2835class molecule;
    29 
    30 // ======================================== Points on Boundary =================================
    31 
    32 /** Constructor of BoundaryPointSet.
    33  */
    34 BoundaryPointSet::BoundaryPointSet() :
    35   LinesCount(0), value(0.), Nr(-1)
    36 {
    37   Info FunctionInfo(__func__);
    38   DoLog(1) && (Log() << Verbose(1) << "Adding noname." << endl);
    39 }
    40 ;
    41 
    42 /** Constructor of BoundaryPointSet with Tesselpoint.
    43  * \param *Walker TesselPoint this boundary point represents
    44  */
    45 BoundaryPointSet::BoundaryPointSet(TesselPoint * const Walker) :
    46   LinesCount(0), node(Walker), value(0.), Nr(Walker->nr)
    47 {
    48   Info FunctionInfo(__func__);
    49   DoLog(1) && (Log() << Verbose(1) << "Adding Node " << *Walker << endl);
    50 }
    51 ;
    52 
    53 /** Destructor of BoundaryPointSet.
    54  * Sets node to NULL to avoid removing the original, represented TesselPoint.
    55  * \note When removing point from a class Tesselation, use RemoveTesselationPoint()
    56  */
    57 BoundaryPointSet::~BoundaryPointSet()
    58 {
    59   Info FunctionInfo(__func__);
    60   //Log() << Verbose(0) << "Erasing point nr. " << Nr << "." << endl;
    61   if (!lines.empty())
    62     DoeLog(2) && (eLog() << Verbose(2) << "Memory Leak! I " << *this << " am still connected to some lines." << endl);
    63   node = NULL;
    64 }
    65 ;
    66 
    67 /** Add a line to the LineMap of this point.
    68  * \param *line line to add
    69  */
    70 void BoundaryPointSet::AddLine(BoundaryLineSet * const line)
    71 {
    72   Info FunctionInfo(__func__);
    73   DoLog(1) && (Log() << Verbose(1) << "Adding " << *this << " to line " << *line << "." << endl);
    74   if (line->endpoints[0] == this) {
    75     lines.insert(LinePair(line->endpoints[1]->Nr, line));
    76   } else {
    77     lines.insert(LinePair(line->endpoints[0]->Nr, line));
    78   }
    79   LinesCount++;
    80 }
    81 ;
    82 
    83 /** output operator for BoundaryPointSet.
    84  * \param &ost output stream
    85  * \param &a boundary point
    86  */
    87 ostream & operator <<(ostream &ost, const BoundaryPointSet &a)
    88 {
    89   ost << "[" << a.Nr << "|" << a.node->getName() << " at " << *a.node->node << "]";
    90   return ost;
    91 }
    92 ;
    93 
    94 // ======================================== Lines on Boundary =================================
    95 
    96 /** Constructor of BoundaryLineSet.
    97  */
    98 BoundaryLineSet::BoundaryLineSet() :
    99   Nr(-1)
    100 {
    101   Info FunctionInfo(__func__);
    102   for (int i = 0; i < 2; i++)
    103     endpoints[i] = NULL;
    104 }
    105 ;
    106 
    107 /** Constructor of BoundaryLineSet with two endpoints.
    108  * Adds line automatically to each endpoints' LineMap
    109  * \param *Point[2] array of two boundary points
    110  * \param number number of the list
    111  */
    112 BoundaryLineSet::BoundaryLineSet(BoundaryPointSet * const Point[2], const int number)
    113 {
    114   Info FunctionInfo(__func__);
    115   // set number
    116   Nr = number;
    117   // set endpoints in ascending order
    118   SetEndpointsOrdered(endpoints, Point[0], Point[1]);
    119   // add this line to the hash maps of both endpoints
    120   Point[0]->AddLine(this); //Taken out, to check whether we can avoid unwanted double adding.
    121   Point[1]->AddLine(this); //
    122   // set skipped to false
    123   skipped = false;
    124   // clear triangles list
    125   DoLog(0) && (Log() << Verbose(0) << "New Line with endpoints " << *this << "." << endl);
    126 }
    127 ;
    128 
    129 /** Constructor of BoundaryLineSet with two endpoints.
    130  * Adds line automatically to each endpoints' LineMap
    131  * \param *Point1 first boundary point
    132  * \param *Point2 second boundary point
    133  * \param number number of the list
    134  */
    135 BoundaryLineSet::BoundaryLineSet(BoundaryPointSet * const Point1, BoundaryPointSet * const Point2, const int number)
    136 {
    137   Info FunctionInfo(__func__);
    138   // set number
    139   Nr = number;
    140   // set endpoints in ascending order
    141   SetEndpointsOrdered(endpoints, Point1, Point2);
    142   // add this line to the hash maps of both endpoints
    143   Point1->AddLine(this); //Taken out, to check whether we can avoid unwanted double adding.
    144   Point2->AddLine(this); //
    145   // set skipped to false
    146   skipped = false;
    147   // clear triangles list
    148   DoLog(0) && (Log() << Verbose(0) << "New Line with endpoints " << *this << "." << endl);
    149 }
    150 ;
    151 
    152 /** Destructor for BoundaryLineSet.
    153  * Removes itself from each endpoints' LineMap, calling RemoveTrianglePoint() when point not connected anymore.
    154  * \note When removing lines from a class Tesselation, use RemoveTesselationLine()
    155  */
    156 BoundaryLineSet::~BoundaryLineSet()
    157 {
    158   Info FunctionInfo(__func__);
    159   int Numbers[2];
    160 
    161   // get other endpoint number of finding copies of same line
    162   if (endpoints[1] != NULL)
    163     Numbers[0] = endpoints[1]->Nr;
    164   else
    165     Numbers[0] = -1;
    166   if (endpoints[0] != NULL)
    167     Numbers[1] = endpoints[0]->Nr;
    168   else
    169     Numbers[1] = -1;
    170 
    171   for (int i = 0; i < 2; i++) {
    172     if (endpoints[i] != NULL) {
    173       if (Numbers[i] != -1) { // as there may be multiple lines with same endpoints, we have to go through each and find in the endpoint's line list this line set
    174         pair<LineMap::iterator, LineMap::iterator> erasor = endpoints[i]->lines.equal_range(Numbers[i]);
    175         for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++)
    176           if ((*Runner).second == this) {
    177             //Log() << Verbose(0) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;
    178             endpoints[i]->lines.erase(Runner);
    179             break;
    180           }
    181       } else { // there's just a single line left
    182         if (endpoints[i]->lines.erase(Nr)) {
    183           //Log() << Verbose(0) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;
    184         }
    185       }
    186       if (endpoints[i]->lines.empty()) {
    187         //Log() << Verbose(0) << *endpoints[i] << " has no more lines it's attached to, erasing." << endl;
    188         if (endpoints[i] != NULL) {
    189           delete (endpoints[i]);
    190           endpoints[i] = NULL;
    191         }
    192       }
    193     }
    194   }
    195   if (!triangles.empty())
    196     DoeLog(2) && (eLog() << Verbose(2) << "Memory Leak! I " << *this << " am still connected to some triangles." << endl);
    197 }
    198 ;
    199 
    200 /** Add triangle to TriangleMap of this boundary line.
    201  * \param *triangle to add
    202  */
    203 void BoundaryLineSet::AddTriangle(BoundaryTriangleSet * const triangle)
    204 {
    205   Info FunctionInfo(__func__);
    206   DoLog(0) && (Log() << Verbose(0) << "Add " << triangle->Nr << " to line " << *this << "." << endl);
    207   triangles.insert(TrianglePair(triangle->Nr, triangle));
    208 }
    209 ;
    210 
    211 /** Checks whether we have a common endpoint with given \a *line.
    212  * \param *line other line to test
    213  * \return true - common endpoint present, false - not connected
    214  */
    215 bool BoundaryLineSet::IsConnectedTo(const BoundaryLineSet * const line) const
    216 {
    217   Info FunctionInfo(__func__);
    218   if ((endpoints[0] == line->endpoints[0]) || (endpoints[1] == line->endpoints[0]) || (endpoints[0] == line->endpoints[1]) || (endpoints[1] == line->endpoints[1]))
    219     return true;
    220   else
    221     return false;
    222 }
    223 ;
    224 
    225 /** Checks whether the adjacent triangles of a baseline are convex or not.
    226  * We sum the two angles of each height vector with respect to the center of the baseline.
    227  * If greater/equal M_PI than we are convex.
    228  * \param *out output stream for debugging
    229  * \return true - triangles are convex, false - concave or less than two triangles connected
    230  */
    231 bool BoundaryLineSet::CheckConvexityCriterion() const
    232 {
    233   Info FunctionInfo(__func__);
    234   double angle = CalculateConvexity();
    235   if (angle > -MYEPSILON) {
    236     DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Angle is greater than pi: convex." << endl);
    237     return true;
    238   } else {
    239     DoLog(0) && (Log() << Verbose(0) << "REJECT: Angle is less than pi: concave." << endl);
    240     return false;
    241   }
    242 }
    243 
    244 
    245 /** Calculates the angle between two triangles with respect to their normal vector.
    246  * We sum the two angles of each height vector with respect to the center of the baseline.
    247  * \return angle > 0 then convex, if < 0 then concave
    248  */
    249 double BoundaryLineSet::CalculateConvexity() const
    250 {
    251   Info FunctionInfo(__func__);
    252   Vector BaseLineCenter, BaseLineNormal, BaseLine, helper[2], NormalCheck;
    253   // get the two triangles
    254   if (triangles.size() != 2) {
    255     DoeLog(0) && (eLog() << Verbose(0) << "Baseline " << *this << " is connected to less than two triangles, Tesselation incomplete!" << endl);
    256     return true;
    257   }
    258   // check normal vectors
    259   // have a normal vector on the base line pointing outwards
    260   //Log() << Verbose(0) << "INFO: " << *this << " has vectors at " << *(endpoints[0]->node->node) << " and at " << *(endpoints[1]->node->node) << "." << endl;
    261   BaseLineCenter = (1./2.)*((*endpoints[0]->node->node) + (*endpoints[1]->node->node));
    262   BaseLine = (*endpoints[0]->node->node) - (*endpoints[1]->node->node);
    263 
    264   //Log() << Verbose(0) << "INFO: Baseline is " << BaseLine << " and its center is at " << BaseLineCenter << "." << endl;
    265 
    266   BaseLineNormal.Zero();
    267   NormalCheck.Zero();
    268   double sign = -1.;
    269   int i = 0;
    270   class BoundaryPointSet *node = NULL;
    271   for (TriangleMap::const_iterator runner = triangles.begin(); runner != triangles.end(); runner++) {
    272     //Log() << Verbose(0) << "INFO: NormalVector of " << *(runner->second) << " is " << runner->second->NormalVector << "." << endl;
    273     NormalCheck += runner->second->NormalVector;
    274     NormalCheck *= sign;
    275     sign = -sign;
    276     if (runner->second->NormalVector.NormSquared() > MYEPSILON)
    277       BaseLineNormal = runner->second->NormalVector;   // yes, copy second on top of first
    278     else {
    279       DoeLog(0) && (eLog() << Verbose(0) << "Triangle " << *runner->second << " has zero normal vector!" << endl);
    280     }
    281     node = runner->second->GetThirdEndpoint(this);
    282     if (node != NULL) {
    283       //Log() << Verbose(0) << "INFO: Third node for triangle " << *(runner->second) << " is " << *node << " at " << *(node->node->node) << "." << endl;
    284       helper[i] = (*node->node->node) - BaseLineCenter;
    285       helper[i].MakeNormalTo(BaseLine);  // we want to compare the triangle's heights' angles!
    286       //Log() << Verbose(0) << "INFO: Height vector with respect to baseline is " << helper[i] << "." << endl;
    287       i++;
    288     } else {
    289       DoeLog(1) && (eLog() << Verbose(1) << "I cannot find third node in triangle, something's wrong." << endl);
    290       return true;
    291     }
    292   }
    293   //Log() << Verbose(0) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl;
    294   if (NormalCheck.NormSquared() < MYEPSILON) {
    295     DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Normalvectors of both triangles are the same: convex." << endl);
    296     return true;
    297   }
    298   BaseLineNormal.Scale(-1.);
    299   double angle = GetAngle(helper[0], helper[1], BaseLineNormal);
    300   return (angle - M_PI);
    301 }
    302 
    303 /** Checks whether point is any of the two endpoints this line contains.
    304  * \param *point point to test
    305  * \return true - point is of the line, false - is not
    306  */
    307 bool BoundaryLineSet::ContainsBoundaryPoint(const BoundaryPointSet * const point) const
    308 {
    309   Info FunctionInfo(__func__);
    310   for (int i = 0; i < 2; i++)
    311     if (point == endpoints[i])
    312       return true;
    313   return false;
    314 }
    315 ;
    316 
    317 /** Returns other endpoint of the line.
    318  * \param *point other endpoint
    319  * \return NULL - if endpoint not contained in BoundaryLineSet::lines, or pointer to BoundaryPointSet otherwise
    320  */
    321 class BoundaryPointSet *BoundaryLineSet::GetOtherEndpoint(const BoundaryPointSet * const point) const
    322 {
    323   Info FunctionInfo(__func__);
    324   if (endpoints[0] == point)
    325     return endpoints[1];
    326   else if (endpoints[1] == point)
    327     return endpoints[0];
    328   else
    329     return NULL;
    330 }
    331 ;
    332 
    333 /** Returns other triangle of the line.
    334  * \param *point other endpoint
    335  * \return NULL - if triangle not contained in BoundaryLineSet::triangles, or pointer to BoundaryTriangleSet otherwise
    336  */
    337 class BoundaryTriangleSet *BoundaryLineSet::GetOtherTriangle(const BoundaryTriangleSet * const triangle) const
    338 {
    339   Info FunctionInfo(__func__);
    340   if (triangles.size() == 2) {
    341     for (TriangleMap::const_iterator TriangleRunner = triangles.begin(); TriangleRunner != triangles.end(); ++TriangleRunner)
    342       if (TriangleRunner->second != triangle)
    343         return TriangleRunner->second;
    344   }
    345   return NULL;
    346 }
    347 ;
    348 
    349 /** output operator for BoundaryLineSet.
    350  * \param &ost output stream
    351  * \param &a boundary line
    352  */
    353 ostream & operator <<(ostream &ost, const BoundaryLineSet &a)
    354 {
    355   ost << "[" << a.Nr << "|" << a.endpoints[0]->node->getName() << " at " << *a.endpoints[0]->node->node << "," << a.endpoints[1]->node->getName() << " at " << *a.endpoints[1]->node->node << "]";
    356   return ost;
    357 }
    358 ;
    359 
    360 // ======================================== Triangles on Boundary =================================
    361 
    362 /** Constructor for BoundaryTriangleSet.
    363  */
    364 BoundaryTriangleSet::BoundaryTriangleSet() :
    365   Nr(-1)
    366 {
    367   Info FunctionInfo(__func__);
    368   for (int i = 0; i < 3; i++) {
    369     endpoints[i] = NULL;
    370     lines[i] = NULL;
    371   }
    372 }
    373 ;
    374 
    375 /** Constructor for BoundaryTriangleSet with three lines.
    376  * \param *line[3] lines that make up the triangle
    377  * \param number number of triangle
    378  */
    379 BoundaryTriangleSet::BoundaryTriangleSet(class BoundaryLineSet * const line[3], const int number) :
    380   Nr(number)
    381 {
    382   Info FunctionInfo(__func__);
    383   // set number
    384   // set lines
    385   for (int i = 0; i < 3; i++) {
    386     lines[i] = line[i];
    387     lines[i]->AddTriangle(this);
    388   }
    389   // get ascending order of endpoints
    390   PointMap OrderMap;
    391   for (int i = 0; i < 3; i++) {
    392     // for all three lines
    393     for (int j = 0; j < 2; j++) { // for both endpoints
    394       OrderMap.insert(pair<int, class BoundaryPointSet *> (line[i]->endpoints[j]->Nr, line[i]->endpoints[j]));
    395       // and we don't care whether insertion fails
    396     }
    397   }
    398   // set endpoints
    399   int Counter = 0;
    400   DoLog(0) && (Log() << Verbose(0) << "New triangle " << Nr << " with end points: " << endl);
    401   for (PointMap::iterator runner = OrderMap.begin(); runner != OrderMap.end(); runner++) {
    402     endpoints[Counter] = runner->second;
    403     DoLog(0) && (Log() << Verbose(0) << " " << *endpoints[Counter] << endl);
    404     Counter++;
    405   }
    406   ASSERT(Counter >= 3,"We have a triangle with only two distinct endpoints!");
    407 };
    408 
    409 
    410 /** Destructor of BoundaryTriangleSet.
    411  * Removes itself from each of its lines' LineMap and removes them if necessary.
    412  * \note When removing triangles from a class Tesselation, use RemoveTesselationTriangle()
    413  */
    414 BoundaryTriangleSet::~BoundaryTriangleSet()
    415 {
    416   Info FunctionInfo(__func__);
    417   for (int i = 0; i < 3; i++) {
    418     if (lines[i] != NULL) {
    419       if (lines[i]->triangles.erase(Nr)) {
    420         //Log() << Verbose(0) << "Triangle Nr." << Nr << " erased in line " << *lines[i] << "." << endl;
    421       }
    422       if (lines[i]->triangles.empty()) {
    423         //Log() << Verbose(0) << *lines[i] << " is no more attached to any triangle, erasing." << endl;
    424         delete (lines[i]);
    425         lines[i] = NULL;
    426       }
    427     }
    428   }
    429   //Log() << Verbose(0) << "Erasing triangle Nr." << Nr << " itself." << endl;
    430 }
    431 ;
    432 
    433 /** Calculates the normal vector for this triangle.
    434  * Is made unique by comparison with \a OtherVector to point in the other direction.
    435  * \param &OtherVector direction vector to make normal vector unique.
    436  */
    437 void BoundaryTriangleSet::GetNormalVector(const Vector &OtherVector)
    438 {
    439   Info FunctionInfo(__func__);
    440   // get normal vector
    441   NormalVector = Plane(*(endpoints[0]->node->node),
    442                        *(endpoints[1]->node->node),
    443                        *(endpoints[2]->node->node)).getNormal();
    444 
    445   // make it always point inward (any offset vector onto plane projected onto normal vector suffices)
    446   if (NormalVector.ScalarProduct(OtherVector) > 0.)
    447     NormalVector.Scale(-1.);
    448   DoLog(1) && (Log() << Verbose(1) << "Normal Vector is " << NormalVector << "." << endl);
    449 }
    450 ;
    451 
    452 /** Finds the point on the triangle \a *BTS through which the line defined by \a *MolCenter and \a *x crosses.
    453  * We call Vector::GetIntersectionWithPlane() to receive the intersection point with the plane
    454  * Thus we test if it's really on the plane and whether it's inside the triangle on the plane or not.
    455  * The latter is done as follows: We calculate the cross point of one of the triangle's baseline with the line
    456  * given by the intersection and the third basepoint. Then, we check whether it's on the baseline (i.e. between
    457  * the first two basepoints) or not.
    458  * \param *out output stream for debugging
    459  * \param *MolCenter offset vector of line
    460  * \param *x second endpoint of line, minus \a *MolCenter is directional vector of line
    461  * \param *Intersection intersection on plane on return
    462  * \return true - \a *Intersection contains intersection on plane defined by triangle, false - zero vector if outside of triangle.
    463  */
    464 
    465 bool BoundaryTriangleSet::GetIntersectionInsideTriangle(const Vector * const MolCenter, const Vector * const x, Vector * const Intersection) const
    466 {
    467   Info FunctionInfo(__func__);
    468   Vector CrossPoint;
    469   Vector helper;
    470 
    471   try {
    472     Line centerLine = makeLineThrough(*MolCenter, *x);
    473     *Intersection = Plane(NormalVector, *(endpoints[0]->node->node)).GetIntersection(centerLine);
    474 
    475     DoLog(1) && (Log() << Verbose(1) << "INFO: Triangle is " << *this << "." << endl);
    476     DoLog(1) && (Log() << Verbose(1) << "INFO: Line is from " << *MolCenter << " to " << *x << "." << endl);
    477     DoLog(1) && (Log() << Verbose(1) << "INFO: Intersection is " << *Intersection << "." << endl);
    478 
    479     if (Intersection->DistanceSquared(*endpoints[0]->node->node) < MYEPSILON) {
    480       DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with first endpoint." << endl);
    481       return true;
    482     }   else if (Intersection->DistanceSquared(*endpoints[1]->node->node) < MYEPSILON) {
    483       DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with second endpoint." << endl);
    484       return true;
    485     }   else if (Intersection->DistanceSquared(*endpoints[2]->node->node) < MYEPSILON) {
    486       DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with third endpoint." << endl);
    487       return true;
    488     }
    489     // Calculate cross point between one baseline and the line from the third endpoint to intersection
    490     int i = 0;
    491     do {
    492       Line line1 = makeLineThrough(*(endpoints[i%3]->node->node),*(endpoints[(i+1)%3]->node->node));
    493       Line line2 = makeLineThrough(*(endpoints[(i+2)%3]->node->node),*Intersection);
    494       CrossPoint = line1.getIntersection(line2);
    495       helper = (*endpoints[(i+1)%3]->node->node) - (*endpoints[i%3]->node->node);
    496       CrossPoint -= (*endpoints[i%3]->node->node);  // cross point was returned as absolute vector
    497       const double s = CrossPoint.ScalarProduct(helper)/helper.NormSquared();
    498       DoLog(1) && (Log() << Verbose(1) << "INFO: Factor s is " << s << "." << endl);
    499       if ((s < -MYEPSILON) || ((s-1.) > MYEPSILON)) {
    500         DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << "outside of triangle." << endl);
    501         return false;
    502       }
    503       i++;
    504     } while (i < 3);
    505     DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " inside of triangle." << endl);
    506     return true;
    507   }
    508   catch (MathException &excp) {
    509     Log() << Verbose(1) << excp;
    510     DoeLog(1) && (eLog() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl);
    511     return false;
    512   }
    513 }
    514 ;
    515 
    516 /** Finds the point on the triangle to the point \a *x.
    517  * We call Vector::GetIntersectionWithPlane() with \a * and the center of the triangle to receive an intersection point.
    518  * Then we check the in-plane part (the part projected down onto plane). We check whether it crosses one of the
    519  * boundary lines. If it does, we return this intersection as closest point, otherwise the projected point down.
    520  * Thus we test if it's really on the plane and whether it's inside the triangle on the plane or not.
    521  * The latter is done as follows: We calculate the cross point of one of the triangle's baseline with the line
    522  * given by the intersection and the third basepoint. Then, we check whether it's on the baseline (i.e. between
    523  * the first two basepoints) or not.
    524  * \param *x point
    525  * \param *ClosestPoint desired closest point inside triangle to \a *x, is absolute vector
    526  * \return Distance squared between \a *x and closest point inside triangle
    527  */
    528 double BoundaryTriangleSet::GetClosestPointInsideTriangle(const Vector * const x, Vector * const ClosestPoint) const
    529 {
    530   Info FunctionInfo(__func__);
    531   Vector Direction;
    532 
    533   // 1. get intersection with plane
    534   DoLog(1) && (Log() << Verbose(1) << "INFO: Looking for closest point of triangle " << *this << " to " << *x << "." << endl);
    535   GetCenter(&Direction);
    536   try {
    537     Line l = makeLineThrough(*x, Direction);
    538     *ClosestPoint = Plane(NormalVector, *(endpoints[0]->node->node)).GetIntersection(l);
    539   }
    540   catch (MathException &excp) {
    541     (*ClosestPoint) = (*x);
    542   }
    543 
    544   // 2. Calculate in plane part of line (x, intersection)
    545   Vector InPlane = (*x) - (*ClosestPoint); // points from plane intersection to straight-down point
    546   InPlane.ProjectOntoPlane(NormalVector);
    547   InPlane += *ClosestPoint;
    548 
    549   DoLog(2) && (Log() << Verbose(2) << "INFO: Triangle is " << *this << "." << endl);
    550   DoLog(2) && (Log() << Verbose(2) << "INFO: Line is from " << Direction << " to " << *x << "." << endl);
    551   DoLog(2) && (Log() << Verbose(2) << "INFO: In-plane part is " << InPlane << "." << endl);
    552 
    553   // Calculate cross point between one baseline and the desired point such that distance is shortest
    554   double ShortestDistance = -1.;
    555   bool InsideFlag = false;
    556   Vector CrossDirection[3];
    557   Vector CrossPoint[3];
    558   Vector helper;
    559   for (int i = 0; i < 3; i++) {
    560     // treat direction of line as normal of a (cut)plane and the desired point x as the plane offset, the intersect line with point
    561     Direction = (*endpoints[(i+1)%3]->node->node) - (*endpoints[i%3]->node->node);
    562     // calculate intersection, line can never be parallel to Direction (is the same vector as PlaneNormal);
    563     Line l = makeLineThrough(*(endpoints[i%3]->node->node), *(endpoints[(i+1)%3]->node->node));
    564     CrossPoint[i] = Plane(Direction, InPlane).GetIntersection(l);
    565     CrossDirection[i] = CrossPoint[i] - InPlane;
    566     CrossPoint[i] -= (*endpoints[i%3]->node->node);  // cross point was returned as absolute vector
    567     const double s = CrossPoint[i].ScalarProduct(Direction)/Direction.NormSquared();
    568     DoLog(2) && (Log() << Verbose(2) << "INFO: Factor s is " << s << "." << endl);
    569     if ((s >= -MYEPSILON) && ((s-1.) <= MYEPSILON)) {
    570           CrossPoint[i] += (*endpoints[i%3]->node->node);  // make cross point absolute again
    571       DoLog(2) && (Log() << Verbose(2) << "INFO: Crosspoint is " << CrossPoint[i] << ", intersecting BoundaryLine between " << *endpoints[i % 3]->node->node << " and " << *endpoints[(i + 1) % 3]->node->node << "." << endl);
    572       const double distance = CrossPoint[i].DistanceSquared(*x);
    573       if ((ShortestDistance < 0.) || (ShortestDistance > distance)) {
    574         ShortestDistance = distance;
    575         (*ClosestPoint) = CrossPoint[i];
    576       }
    577     } else
    578       CrossPoint[i].Zero();
    579   }
    580   InsideFlag = true;
    581   for (int i = 0; i < 3; i++) {
    582     const double sign = CrossDirection[i].ScalarProduct(CrossDirection[(i + 1) % 3]);
    583     const double othersign = CrossDirection[i].ScalarProduct(CrossDirection[(i + 2) % 3]);
    584 
    585     if ((sign > -MYEPSILON) && (othersign > -MYEPSILON)) // have different sign
    586       InsideFlag = false;
    587   }
    588   if (InsideFlag) {
    589     (*ClosestPoint) = InPlane;
    590     ShortestDistance = InPlane.DistanceSquared(*x);
    591   } else { // also check endnodes
    592     for (int i = 0; i < 3; i++) {
    593       const double distance = x->DistanceSquared(*endpoints[i]->node->node);
    594       if ((ShortestDistance < 0.) || (ShortestDistance > distance)) {
    595         ShortestDistance = distance;
    596         (*ClosestPoint) = (*endpoints[i]->node->node);
    597       }
    598     }
    599   }
    600   DoLog(1) && (Log() << Verbose(1) << "INFO: Closest Point is " << *ClosestPoint << " with shortest squared distance is " << ShortestDistance << "." << endl);
    601   return ShortestDistance;
    602 }
    603 ;
    604 
    605 /** Checks whether lines is any of the three boundary lines this triangle contains.
    606  * \param *line line to test
    607  * \return true - line is of the triangle, false - is not
    608  */
    609 bool BoundaryTriangleSet::ContainsBoundaryLine(const BoundaryLineSet * const line) const
    610 {
    611   Info FunctionInfo(__func__);
    612   for (int i = 0; i < 3; i++)
    613     if (line == lines[i])
    614       return true;
    615   return false;
    616 }
    617 ;
    618 
    619 /** Checks whether point is any of the three endpoints this triangle contains.
    620  * \param *point point to test
    621  * \return true - point is of the triangle, false - is not
    622  */
    623 bool BoundaryTriangleSet::ContainsBoundaryPoint(const BoundaryPointSet * const point) const
    624 {
    625   Info FunctionInfo(__func__);
    626   for (int i = 0; i < 3; i++)
    627     if (point == endpoints[i])
    628       return true;
    629   return false;
    630 }
    631 ;
    632 
    633 /** Checks whether point is any of the three endpoints this triangle contains.
    634  * \param *point TesselPoint to test
    635  * \return true - point is of the triangle, false - is not
    636  */
    637 bool BoundaryTriangleSet::ContainsBoundaryPoint(const TesselPoint * const point) const
    638 {
    639   Info FunctionInfo(__func__);
    640   for (int i = 0; i < 3; i++)
    641     if (point == endpoints[i]->node)
    642       return true;
    643   return false;
    644 }
    645 ;
    646 
    647 /** Checks whether three given \a *Points coincide with triangle's endpoints.
    648  * \param *Points[3] pointer to BoundaryPointSet
    649  * \return true - is the very triangle, false - is not
    650  */
    651 bool BoundaryTriangleSet::IsPresentTupel(const BoundaryPointSet * const Points[3]) const
    652 {
    653   Info FunctionInfo(__func__);
    654   DoLog(1) && (Log() << Verbose(1) << "INFO: Checking " << Points[0] << "," << Points[1] << "," << Points[2] << " against " << endpoints[0] << "," << endpoints[1] << "," << endpoints[2] << "." << endl);
    655   return (((endpoints[0] == Points[0]) || (endpoints[0] == Points[1]) || (endpoints[0] == Points[2])) && ((endpoints[1] == Points[0]) || (endpoints[1] == Points[1]) || (endpoints[1] == Points[2])) && ((endpoints[2] == Points[0]) || (endpoints[2] == Points[1]) || (endpoints[2] == Points[2])
    656 
    657   ));
    658 }
    659 ;
    660 
    661 /** Checks whether three given \a *Points coincide with triangle's endpoints.
    662  * \param *Points[3] pointer to BoundaryPointSet
    663  * \return true - is the very triangle, false - is not
    664  */
    665 bool BoundaryTriangleSet::IsPresentTupel(const BoundaryTriangleSet * const T) const
    666 {
    667   Info FunctionInfo(__func__);
    668   return (((endpoints[0] == T->endpoints[0]) || (endpoints[0] == T->endpoints[1]) || (endpoints[0] == T->endpoints[2])) && ((endpoints[1] == T->endpoints[0]) || (endpoints[1] == T->endpoints[1]) || (endpoints[1] == T->endpoints[2])) && ((endpoints[2] == T->endpoints[0]) || (endpoints[2] == T->endpoints[1]) || (endpoints[2] == T->endpoints[2])
    669 
    670   ));
    671 }
    672 ;
    673 
    674 /** Returns the endpoint which is not contained in the given \a *line.
    675  * \param *line baseline defining two endpoints
    676  * \return pointer third endpoint or NULL if line does not belong to triangle.
    677  */
    678 class BoundaryPointSet *BoundaryTriangleSet::GetThirdEndpoint(const BoundaryLineSet * const line) const
    679 {
    680   Info FunctionInfo(__func__);
    681   // sanity check
    682   if (!ContainsBoundaryLine(line))
    683     return NULL;
    684   for (int i = 0; i < 3; i++)
    685     if (!line->ContainsBoundaryPoint(endpoints[i]))
    686       return endpoints[i];
    687   // actually, that' impossible :)
    688   return NULL;
    689 }
    690 ;
    691 
    692 /** Returns the baseline which does not contain the given boundary point \a *point.
    693  * \param *point endpoint which is neither endpoint of the desired line
    694  * \return pointer to desired third baseline
    695  */
    696 class BoundaryLineSet *BoundaryTriangleSet::GetThirdLine(const BoundaryPointSet * const point) const
    697 {
    698   Info FunctionInfo(__func__);
    699   // sanity check
    700   if (!ContainsBoundaryPoint(point))
    701     return NULL;
    702   for (int i = 0; i < 3; i++)
    703     if (!lines[i]->ContainsBoundaryPoint(point))
    704       return lines[i];
    705   // actually, that' impossible :)
    706   return NULL;
    707 }
    708 ;
    709 
    710 /** Calculates the center point of the triangle.
    711  * Is third of the sum of all endpoints.
    712  * \param *center central point on return.
    713  */
    714 void BoundaryTriangleSet::GetCenter(Vector * const center) const
    715 {
    716   Info FunctionInfo(__func__);
    717   center->Zero();
    718   for (int i = 0; i < 3; i++)
    719     (*center) += (*endpoints[i]->node->node);
    720   center->Scale(1. / 3.);
    721   DoLog(1) && (Log() << Verbose(1) << "INFO: Center is at " << *center << "." << endl);
    722 }
    723 
    724 /**
    725  * gets the Plane defined by the three triangle Basepoints
    726  */
    727 Plane BoundaryTriangleSet::getPlane() const{
    728   ASSERT(endpoints[0] && endpoints[1] && endpoints[2], "Triangle not fully defined");
    729 
    730   return Plane(*endpoints[0]->node->node,
    731                *endpoints[1]->node->node,
    732                *endpoints[2]->node->node);
    733 }
    734 
    735 Vector BoundaryTriangleSet::getEndpoint(int i) const{
    736   ASSERT(i>=0 && i<3,"Index of Endpoint out of Range");
    737 
    738   return *endpoints[i]->node->node;
    739 }
    740 
    741 string BoundaryTriangleSet::getEndpointName(int i) const{
    742   ASSERT(i>=0 && i<3,"Index of Endpoint out of Range");
    743 
    744   return endpoints[i]->node->getName();
    745 }
    746 
    747 /** output operator for BoundaryTriangleSet.
    748  * \param &ost output stream
    749  * \param &a boundary triangle
    750  */
    751 ostream &operator <<(ostream &ost, const BoundaryTriangleSet &a)
    752 {
    753   ost << "[" << a.Nr << "|" << a.getEndpointName(0) << "," << a.getEndpointName(1) << "," << a.getEndpointName(2) << "]";
    754   //  ost << "[" << a.Nr << "|" << a.endpoints[0]->node->Name << " at " << *a.endpoints[0]->node->node << ","
    755   //      << a.endpoints[1]->node->Name << " at " << *a.endpoints[1]->node->node << "," << a.endpoints[2]->node->Name << " at " << *a.endpoints[2]->node->node << "]";
    756   return ost;
    757 }
    758 ;
    759 
    760 // ======================================== Polygons on Boundary =================================
    761 
    762 /** Constructor for BoundaryPolygonSet.
    763  */
    764 BoundaryPolygonSet::BoundaryPolygonSet() :
    765   Nr(-1)
    766 {
    767   Info FunctionInfo(__func__);
    768 }
    769 ;
    770 
    771 /** Destructor of BoundaryPolygonSet.
    772  * Just clears endpoints.
    773  * \note When removing triangles from a class Tesselation, use RemoveTesselationTriangle()
    774  */
    775 BoundaryPolygonSet::~BoundaryPolygonSet()
    776 {
    777   Info FunctionInfo(__func__);
    778   endpoints.clear();
    779   DoLog(1) && (Log() << Verbose(1) << "Erasing polygon Nr." << Nr << " itself." << endl);
    780 }
    781 ;
    782 
    783 /** Calculates the normal vector for this triangle.
    784  * Is made unique by comparison with \a OtherVector to point in the other direction.
    785  * \param &OtherVector direction vector to make normal vector unique.
    786  * \return allocated vector in normal direction
    787  */
    788 Vector * BoundaryPolygonSet::GetNormalVector(const Vector &OtherVector) const
    789 {
    790   Info FunctionInfo(__func__);
    791   // get normal vector
    792   Vector TemporaryNormal;
    793   Vector *TotalNormal = new Vector;
    794   PointSet::const_iterator Runner[3];
    795   for (int i = 0; i < 3; i++) {
    796     Runner[i] = endpoints.begin();
    797     for (int j = 0; j < i; j++) { // go as much further
    798       Runner[i]++;
    799       if (Runner[i] == endpoints.end()) {
    800         DoeLog(0) && (eLog() << Verbose(0) << "There are less than three endpoints in the polygon!" << endl);
    801         performCriticalExit();
    802       }
    803     }
    804   }
    805   TotalNormal->Zero();
    806   int counter = 0;
    807   for (; Runner[2] != endpoints.end();) {
    808     TemporaryNormal = Plane(*((*Runner[0])->node->node),
    809                             *((*Runner[1])->node->node),
    810                             *((*Runner[2])->node->node)).getNormal();
    811     for (int i = 0; i < 3; i++) // increase each of them
    812       Runner[i]++;
    813     (*TotalNormal) += TemporaryNormal;
    814   }
    815   TotalNormal->Scale(1. / (double) counter);
    816 
    817   // make it always point inward (any offset vector onto plane projected onto normal vector suffices)
    818   if (TotalNormal->ScalarProduct(OtherVector) > 0.)
    819     TotalNormal->Scale(-1.);
    820   DoLog(1) && (Log() << Verbose(1) << "Normal Vector is " << *TotalNormal << "." << endl);
    821 
    822   return TotalNormal;
    823 }
    824 ;
    825 
    826 /** Calculates the center point of the triangle.
    827  * Is third of the sum of all endpoints.
    828  * \param *center central point on return.
    829  */
    830 void BoundaryPolygonSet::GetCenter(Vector * const center) const
    831 {
    832   Info FunctionInfo(__func__);
    833   center->Zero();
    834   int counter = 0;
    835   for(PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) {
    836     (*center) += (*(*Runner)->node->node);
    837     counter++;
    838   }
    839   center->Scale(1. / (double) counter);
    840   DoLog(1) && (Log() << Verbose(1) << "Center is at " << *center << "." << endl);
    841 }
    842 
    843 /** Checks whether the polygons contains all three endpoints of the triangle.
    844  * \param *triangle triangle to test
    845  * \return true - triangle is contained polygon, false - is not
    846  */
    847 bool BoundaryPolygonSet::ContainsBoundaryTriangle(const BoundaryTriangleSet * const triangle) const
    848 {
    849   Info FunctionInfo(__func__);
    850   return ContainsPresentTupel(triangle->endpoints, 3);
    851 }
    852 ;
    853 
    854 /** Checks whether the polygons contains both endpoints of the line.
    855  * \param *line line to test
    856  * \return true - line is of the triangle, false - is not
    857  */
    858 bool BoundaryPolygonSet::ContainsBoundaryLine(const BoundaryLineSet * const line) const
    859 {
    860   Info FunctionInfo(__func__);
    861   return ContainsPresentTupel(line->endpoints, 2);
    862 }
    863 ;
    864 
    865 /** Checks whether point is any of the three endpoints this triangle contains.
    866  * \param *point point to test
    867  * \return true - point is of the triangle, false - is not
    868  */
    869 bool BoundaryPolygonSet::ContainsBoundaryPoint(const BoundaryPointSet * const point) const
    870 {
    871   Info FunctionInfo(__func__);
    872   for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) {
    873     DoLog(0) && (Log() << Verbose(0) << "Checking against " << **Runner << endl);
    874     if (point == (*Runner)) {
    875       DoLog(0) && (Log() << Verbose(0) << " Contained." << endl);
    876       return true;
    877     }
    878   }
    879   DoLog(0) && (Log() << Verbose(0) << " Not contained." << endl);
    880   return false;
    881 }
    882 ;
    883 
    884 /** Checks whether point is any of the three endpoints this triangle contains.
    885  * \param *point TesselPoint to test
    886  * \return true - point is of the triangle, false - is not
    887  */
    888 bool BoundaryPolygonSet::ContainsBoundaryPoint(const TesselPoint * const point) const
    889 {
    890   Info FunctionInfo(__func__);
    891   for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++)
    892     if (point == (*Runner)->node) {
    893       DoLog(0) && (Log() << Verbose(0) << " Contained." << endl);
    894       return true;
    895     }
    896   DoLog(0) && (Log() << Verbose(0) << " Not contained." << endl);
    897   return false;
    898 }
    899 ;
    900 
    901 /** Checks whether given array of \a *Points coincide with polygons's endpoints.
    902  * \param **Points pointer to an array of BoundaryPointSet
    903  * \param dim dimension of array
    904  * \return true - set of points is contained in polygon, false - is not
    905  */
    906 bool BoundaryPolygonSet::ContainsPresentTupel(const BoundaryPointSet * const * Points, const int dim) const
    907 {
    908   Info FunctionInfo(__func__);
    909   int counter = 0;
    910   DoLog(1) && (Log() << Verbose(1) << "Polygon is " << *this << endl);
    911   for (int i = 0; i < dim; i++) {
    912     DoLog(1) && (Log() << Verbose(1) << " Testing endpoint " << *Points[i] << endl);
    913     if (ContainsBoundaryPoint(Points[i])) {
    914       counter++;
    915     }
    916   }
    917 
    918   if (counter == dim)
    919     return true;
    920   else
    921     return false;
    922 }
    923 ;
    924 
    925 /** Checks whether given PointList coincide with polygons's endpoints.
    926  * \param &endpoints PointList
    927  * \return true - set of points is contained in polygon, false - is not
    928  */
    929 bool BoundaryPolygonSet::ContainsPresentTupel(const PointSet &endpoints) const
    930 {
    931   Info FunctionInfo(__func__);
    932   size_t counter = 0;
    933   DoLog(1) && (Log() << Verbose(1) << "Polygon is " << *this << endl);
    934   for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) {
    935     DoLog(1) && (Log() << Verbose(1) << " Testing endpoint " << **Runner << endl);
    936     if (ContainsBoundaryPoint(*Runner))
    937       counter++;
    938   }
    939 
    940   if (counter == endpoints.size())
    941     return true;
    942   else
    943     return false;
    944 }
    945 ;
    946 
    947 /** Checks whether given set of \a *Points coincide with polygons's endpoints.
    948  * \param *P pointer to BoundaryPolygonSet
    949  * \return true - is the very triangle, false - is not
    950  */
    951 bool BoundaryPolygonSet::ContainsPresentTupel(const BoundaryPolygonSet * const P) const
    952 {
    953   return ContainsPresentTupel((const PointSet) P->endpoints);
    954 }
    955 ;
    956 
    957 /** Gathers all the endpoints' triangles in a unique set.
    958  * \return set of all triangles
    959  */
    960 TriangleSet * BoundaryPolygonSet::GetAllContainedTrianglesFromEndpoints() const
    961 {
    962   Info FunctionInfo(__func__);
    963   pair<TriangleSet::iterator, bool> Tester;
    964   TriangleSet *triangles = new TriangleSet;
    965 
    966   for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++)
    967     for (LineMap::const_iterator Walker = (*Runner)->lines.begin(); Walker != (*Runner)->lines.end(); Walker++)
    968       for (TriangleMap::const_iterator Sprinter = (Walker->second)->triangles.begin(); Sprinter != (Walker->second)->triangles.end(); Sprinter++) {
    969         //Log() << Verbose(0) << " Testing triangle " << *(Sprinter->second) << endl;
    970         if (ContainsBoundaryTriangle(Sprinter->second)) {
    971           Tester = triangles->insert(Sprinter->second);
    972           if (Tester.second)
    973             DoLog(0) && (Log() << Verbose(0) << "Adding triangle " << *(Sprinter->second) << endl);
    974         }
    975       }
    976 
    977   DoLog(1) && (Log() << Verbose(1) << "The Polygon of " << endpoints.size() << " endpoints has " << triangles->size() << " unique triangles in total." << endl);
    978   return triangles;
    979 }
    980 ;
    981 
    982 /** Fills the endpoints of this polygon from the triangles attached to \a *line.
    983  * \param *line lines with triangles attached
    984  * \return true - polygon contains endpoints, false - line was NULL
    985  */
    986 bool BoundaryPolygonSet::FillPolygonFromTrianglesOfLine(const BoundaryLineSet * const line)
    987 {
    988   Info FunctionInfo(__func__);
    989   pair<PointSet::iterator, bool> Tester;
    990   if (line == NULL)
    991     return false;
    992   DoLog(1) && (Log() << Verbose(1) << "Filling polygon from line " << *line << endl);
    993   for (TriangleMap::const_iterator Runner = line->triangles.begin(); Runner != line->triangles.end(); Runner++) {
    994     for (int i = 0; i < 3; i++) {
    995       Tester = endpoints.insert((Runner->second)->endpoints[i]);
    996       if (Tester.second)
    997         DoLog(1) && (Log() << Verbose(1) << "  Inserting endpoint " << *((Runner->second)->endpoints[i]) << endl);
    998     }
    999   }
    1000 
    1001   return true;
    1002 }
    1003 ;
    1004 
    1005 /** output operator for BoundaryPolygonSet.
    1006  * \param &ost output stream
    1007  * \param &a boundary polygon
    1008  */
    1009 ostream &operator <<(ostream &ost, const BoundaryPolygonSet &a)
    1010 {
    1011   ost << "[" << a.Nr << "|";
    1012   for (PointSet::const_iterator Runner = a.endpoints.begin(); Runner != a.endpoints.end();) {
    1013     ost << (*Runner)->node->getName();
    1014     Runner++;
    1015     if (Runner != a.endpoints.end())
    1016       ost << ",";
    1017   }
    1018   ost << "]";
    1019   return ost;
    1020 }
    1021 ;
    1022 
    1023 // =========================================================== class TESSELPOINT ===========================================
    1024 
    1025 /** Constructor of class TesselPoint.
    1026  */
    1027 TesselPoint::TesselPoint()
    1028 {
    1029   //Info FunctionInfo(__func__);
    1030   node = NULL;
    1031   nr = -1;
    1032 }
    1033 ;
    1034 
    1035 /** Destructor for class TesselPoint.
    1036  */
    1037 TesselPoint::~TesselPoint()
    1038 {
    1039   //Info FunctionInfo(__func__);
    1040 }
    1041 ;
    1042 
    1043 /** Prints LCNode to screen.
    1044  */
    1045 ostream & operator <<(ostream &ost, const TesselPoint &a)
    1046 {
    1047   ost << "[" << a.getName() << "|" << *a.node << "]";
    1048   return ost;
    1049 }
    1050 ;
    1051 
    1052 /** Prints LCNode to screen.
    1053  */
    1054 ostream & TesselPoint::operator <<(ostream &ost)
    1055 {
    1056   Info FunctionInfo(__func__);
    1057   ost << "[" << (nr) << "|" << this << "]";
    1058   return ost;
    1059 }
    1060 ;
    1061 
    1062 // =========================================================== class POINTCLOUD ============================================
    1063 
    1064 /** Constructor of class PointCloud.
    1065  */
    1066 PointCloud::PointCloud()
    1067 {
    1068   //Info FunctionInfo(__func__);
    1069 }
    1070 ;
    1071 
    1072 /** Destructor for class PointCloud.
    1073  */
    1074 PointCloud::~PointCloud()
    1075 {
    1076   //Info FunctionInfo(__func__);
    1077 }
    1078 ;
    1079 
    1080 // ============================ CandidateForTesselation =============================
    1081 
    1082 /** Constructor of class CandidateForTesselation.
    1083  */
    1084 CandidateForTesselation::CandidateForTesselation(BoundaryLineSet* line) :
    1085   BaseLine(line), ThirdPoint(NULL), T(NULL), ShortestAngle(2. * M_PI), OtherShortestAngle(2. * M_PI)
    1086 {
    1087   Info FunctionInfo(__func__);
    1088 }
    1089 ;
    1090 
    1091 /** Constructor of class CandidateForTesselation.
    1092  */
    1093 CandidateForTesselation::CandidateForTesselation(TesselPoint *candidate, BoundaryLineSet* line, BoundaryPointSet* point, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) :
    1094   BaseLine(line), ThirdPoint(point), T(NULL), ShortestAngle(2. * M_PI), OtherShortestAngle(2. * M_PI)
    1095 {
    1096         Info FunctionInfo(__func__);
    1097   OptCenter = OptCandidateCenter;
    1098   OtherOptCenter = OtherOptCandidateCenter;
    1099 };
    1100 
    1101 
    1102 /** Destructor for class CandidateForTesselation.
    1103  */
    1104 CandidateForTesselation::~CandidateForTesselation()
    1105 {
    1106 }
    1107 ;
    1108 
    1109 /** Checks validity of a given sphere of a candidate line.
    1110  * Sphere must touch all candidates and the baseline endpoints and there must be no other atoms inside.
    1111  * \param RADIUS radius of sphere
    1112  * \param *LC LinkedCell structure with other atoms
    1113  * \return true - sphere is valid, false - sphere contains other points
    1114  */
    1115 bool CandidateForTesselation::CheckValidity(const double RADIUS, const LinkedCell *LC) const
    1116 {
    1117   Info FunctionInfo(__func__);
    1118 
    1119   const double radiusSquared = RADIUS * RADIUS;
    1120   list<const Vector *> VectorList;
    1121   VectorList.push_back(&OptCenter);
    1122   //VectorList.push_back(&OtherOptCenter);  // don't check the other (wrong) center
    1123 
    1124   if (!pointlist.empty())
    1125     DoLog(1) && (Log() << Verbose(1) << "INFO: Checking whether sphere contains candidate list and baseline " << *BaseLine->endpoints[0] << "<->" << *BaseLine->endpoints[1] << " only ..." << endl);
    1126   else
    1127     DoLog(1) && (Log() << Verbose(1) << "INFO: Checking whether sphere with no candidates contains baseline " << *BaseLine->endpoints[0] << "<->" << *BaseLine->endpoints[1] << " only ..." << endl);
    1128   // check baseline for OptCenter and OtherOptCenter being on sphere's surface
    1129   for (list<const Vector *>::const_iterator VRunner = VectorList.begin(); VRunner != VectorList.end(); ++VRunner) {
    1130     for (int i = 0; i < 2; i++) {
    1131       const double distance = fabs((*VRunner)->DistanceSquared(*BaseLine->endpoints[i]->node->node) - radiusSquared);
    1132       if (distance > HULLEPSILON) {
    1133         DoeLog(1) && (eLog() << Verbose(1) << "Endpoint " << *BaseLine->endpoints[i] << " is out of sphere at " << *(*VRunner) << " by " << distance << "." << endl);
    1134         return false;
    1135       }
    1136     }
    1137   }
    1138 
    1139   // check Candidates for OptCenter and OtherOptCenter being on sphere's surface
    1140   for (TesselPointList::const_iterator Runner = pointlist.begin(); Runner != pointlist.end(); ++Runner) {
    1141     const TesselPoint *Walker = *Runner;
    1142     for (list<const Vector *>::const_iterator VRunner = VectorList.begin(); VRunner != VectorList.end(); ++VRunner) {
    1143       const double distance = fabs((*VRunner)->DistanceSquared(*Walker->node) - radiusSquared);
    1144       if (distance > HULLEPSILON) {
    1145         DoeLog(1) && (eLog() << Verbose(1) << "Candidate " << *Walker << " is out of sphere at " << *(*VRunner) << " by " << distance << "." << endl);
    1146         return false;
    1147       } else {
    1148         DoLog(1) && (Log() << Verbose(1) << "Candidate " << *Walker << " is inside by " << distance << "." << endl);
    1149       }
    1150     }
    1151   }
    1152 
    1153   DoLog(1) && (Log() << Verbose(1) << "INFO: Checking whether sphere contains no others points ..." << endl);
    1154   bool flag = true;
    1155   for (list<const Vector *>::const_iterator VRunner = VectorList.begin(); VRunner != VectorList.end(); ++VRunner) {
    1156     // get all points inside the sphere
    1157     TesselPointList *ListofPoints = LC->GetPointsInsideSphere(RADIUS, (*VRunner));
    1158 
    1159     DoLog(1) && (Log() << Verbose(1) << "The following atoms are inside sphere at " << (*VRunner) << ":" << endl);
    1160     for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner)
    1161       DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->distance(*(*VRunner)) << "." << endl);
    1162 
    1163     // remove baseline's endpoints and candidates
    1164     for (int i = 0; i < 2; i++) {
    1165       DoLog(1) && (Log() << Verbose(1) << "INFO: removing baseline tesselpoint " << *BaseLine->endpoints[i]->node << "." << endl);
    1166       ListofPoints->remove(BaseLine->endpoints[i]->node);
    1167     }
    1168     for (TesselPointList::const_iterator Runner = pointlist.begin(); Runner != pointlist.end(); ++Runner) {
    1169       DoLog(1) && (Log() << Verbose(1) << "INFO: removing candidate tesselpoint " << *(*Runner) << "." << endl);
    1170       ListofPoints->remove(*Runner);
    1171     }
    1172     if (!ListofPoints->empty()) {
    1173       DoeLog(1) && (eLog() << Verbose(1) << "CheckValidity: There are still " << ListofPoints->size() << " points inside the sphere." << endl);
    1174       flag = false;
    1175       DoeLog(1) && (eLog() << Verbose(1) << "External atoms inside of sphere at " << *(*VRunner) << ":" << endl);
    1176       for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner)
    1177         DoeLog(1) && (eLog() << Verbose(1) << "  " << *(*Runner) << " at distance " << setprecision(13) << (*Runner)->node->distance(*(*VRunner)) << setprecision(6) << "." << endl);
    1178 
    1179       // check with animate_sphere.tcl VMD script
    1180       if (ThirdPoint != NULL) {
    1181         DoeLog(1) && (eLog() << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " " << ThirdPoint->Nr + 1 << " " << RADIUS << " " << OldCenter[0] << " " << OldCenter[1] << " " << OldCenter[2] << " " << (*VRunner)->at(0) << " " << (*VRunner)->at(1) << " " << (*VRunner)->at(2) << endl);
    1182       } else {
    1183         DoeLog(1) && (eLog() << Verbose(1) << "Check by: ... missing third point ..." << endl);
    1184         DoeLog(1) && (eLog() << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " ??? " << RADIUS << " " << OldCenter[0] << " " << OldCenter[1] << " " << OldCenter[2] << " " << (*VRunner)->at(0) << " " << (*VRunner)->at(1) << " " << (*VRunner)->at(2) << endl);
    1185       }
    1186     }
    1187     delete (ListofPoints);
    1188 
    1189   }
    1190   return flag;
    1191 }
    1192 ;
    1193 
    1194 /** output operator for CandidateForTesselation.
    1195  * \param &ost output stream
    1196  * \param &a boundary line
    1197  */
    1198 ostream & operator <<(ostream &ost, const CandidateForTesselation &a)
    1199 {
    1200   ost << "[" << a.BaseLine->Nr << "|" << a.BaseLine->endpoints[0]->node->getName() << "," << a.BaseLine->endpoints[1]->node->getName() << "] with ";
    1201   if (a.pointlist.empty())
    1202     ost << "no candidate.";
    1203   else {
    1204     ost << "candidate";
    1205     if (a.pointlist.size() != 1)
    1206       ost << "s ";
    1207     else
    1208       ost << " ";
    1209     for (TesselPointList::const_iterator Runner = a.pointlist.begin(); Runner != a.pointlist.end(); Runner++)
    1210       ost << *(*Runner) << " ";
    1211     ost << " at angle " << (a.ShortestAngle) << ".";
    1212   }
    1213 
    1214   return ost;
    1215 }
    1216 ;
    1217 
    1218 // =========================================================== class TESSELATION ===========================================
    121936
    122037/** Constructor of class Tesselation.
     
    125471  int num = 0;
    125572  for (GoToFirst(); (!IsEnd()); GoToNext()) {
    1256     (*Center) += (*GetPoint()->node);
     73    (*Center) += (GetPoint()->getPosition());
    125774    num++;
    125875  }
     
    1337154      C++;
    1338155      for (; C != PointsOnBoundary.end(); C++) {
    1339         tmp = A->second->node->node->DistanceSquared(*B->second->node->node);
     156        tmp = A->second->node->DistanceSquared(B->second->node->getPosition());
    1340157        distance = tmp * tmp;
    1341         tmp = A->second->node->node->DistanceSquared(*C->second->node->node);
     158        tmp = A->second->node->DistanceSquared(C->second->node->getPosition());
    1342159        distance += tmp * tmp;
    1343         tmp = B->second->node->node->DistanceSquared(*C->second->node->node);
     160        tmp = B->second->node->DistanceSquared(C->second->node->getPosition());
    1344161        distance += tmp * tmp;
    1345162        DistanceMMap.insert(DistanceMultiMapPair(distance, pair<PointMap::iterator, PointMap::iterator> (B, C)));
     
    1360177    // 2. next, we have to check whether all points reside on only one side of the triangle
    1361178    // 3. construct plane vector
    1362     PlaneVector = Plane(*A->second->node->node,
    1363                         *baseline->second.first->second->node->node,
    1364                         *baseline->second.second->second->node->node).getNormal();
     179    PlaneVector = Plane(A->second->node->getPosition(),
     180                        baseline->second.first->second->node->getPosition(),
     181                        baseline->second.second->second->node->getPosition()).getNormal();
    1365182    DoLog(2) && (Log() << Verbose(2) << "Plane vector of candidate triangle is " << PlaneVector << endl);
    1366183    // 4. loop over all points
     
    1372189        continue;
    1373190      // 4a. project onto plane vector
    1374       TrialVector = (*checker->second->node->node);
    1375       TrialVector.SubtractVector(*A->second->node->node);
     191      TrialVector = (checker->second->node->getPosition() - A->second->node->getPosition());
    1376192      distance = TrialVector.ScalarProduct(PlaneVector);
    1377193      if (fabs(distance) < 1e-4) // we need to have a small epsilon around 0 which is still ok
     
    1389205      }
    1390206      // 4d. Check whether the point is inside the triangle (check distance to each node
    1391       tmp = checker->second->node->node->DistanceSquared(*A->second->node->node);
     207      tmp = checker->second->node->DistanceSquared(A->second->node->getPosition());
    1392208      int innerpoint = 0;
    1393       if ((tmp < A->second->node->node->DistanceSquared(*baseline->second.first->second->node->node)) && (tmp < A->second->node->node->DistanceSquared(*baseline->second.second->second->node->node)))
     209      if ((tmp < A->second->node->DistanceSquared(baseline->second.first->second->node->getPosition())) && (tmp < A->second->node->DistanceSquared(baseline->second.second->second->node->getPosition())))
    1394210        innerpoint++;
    1395       tmp = checker->second->node->node->DistanceSquared(*baseline->second.first->second->node->node);
    1396       if ((tmp < baseline->second.first->second->node->node->DistanceSquared(*A->second->node->node)) && (tmp < baseline->second.first->second->node->node->DistanceSquared(*baseline->second.second->second->node->node)))
     211      tmp = checker->second->node->DistanceSquared(baseline->second.first->second->node->getPosition());
     212      if ((tmp < baseline->second.first->second->node->DistanceSquared(A->second->node->getPosition())) && (tmp < baseline->second.first->second->node->DistanceSquared(baseline->second.second->second->node->getPosition())))
    1397213        innerpoint++;
    1398       tmp = checker->second->node->node->DistanceSquared(*baseline->second.second->second->node->node);
    1399       if ((tmp < baseline->second.second->second->node->node->DistanceSquared(*baseline->second.first->second->node->node)) && (tmp < baseline->second.second->second->node->node->DistanceSquared(*A->second->node->node)))
     214      tmp = checker->second->node->DistanceSquared(baseline->second.second->second->node->getPosition());
     215      if ((tmp < baseline->second.second->second->node->DistanceSquared(baseline->second.first->second->node->getPosition())) && (tmp < baseline->second.second->second->node->DistanceSquared(A->second->node->getPosition())))
    1400216        innerpoint++;
    1401217      // 4e. If so, break 4. loop and continue with next candidate in 1. loop
     
    1478294        // prepare some auxiliary vectors
    1479295        Vector BaseLineCenter, BaseLine;
    1480         BaseLineCenter = 0.5 * ((*baseline->second->endpoints[0]->node->node) +
    1481                                 (*baseline->second->endpoints[1]->node->node));
    1482         BaseLine = (*baseline->second->endpoints[0]->node->node) - (*baseline->second->endpoints[1]->node->node);
     296        BaseLineCenter = 0.5 * ((baseline->second->endpoints[0]->node->getPosition()) +
     297                                (baseline->second->endpoints[1]->node->getPosition()));
     298        BaseLine = (baseline->second->endpoints[0]->node->getPosition()) - (baseline->second->endpoints[1]->node->getPosition());
    1483299
    1484300        // offset to center of triangle
     
    1498314        // project center vector onto triangle plane (points from intersection plane-NormalVector to plane-CenterVector intersection)
    1499315        PropagationVector = Plane(BaseLine, NormalVector,0).getNormal();
    1500         TempVector = CenterVector - (*baseline->second->endpoints[0]->node->node); // TempVector is vector on triangle plane pointing from one baseline egde towards center!
     316        TempVector = CenterVector - (baseline->second->endpoints[0]->node->getPosition()); // TempVector is vector on triangle plane pointing from one baseline egde towards center!
    1501317        //Log() << Verbose(0) << "Projection of propagation onto temp: " << PropagationVector.Projection(&TempVector) << "." << endl;
    1502318        if (PropagationVector.ScalarProduct(TempVector) > 0) // make sure normal propagation vector points outward from baseline
     
    1511327
    1512328            // first check direction, so that triangles don't intersect
    1513             VirtualNormalVector = (*target->second->node->node) - BaseLineCenter;
     329            VirtualNormalVector = (target->second->node->getPosition()) - BaseLineCenter;
    1514330            VirtualNormalVector.ProjectOntoPlane(NormalVector);
    1515331            TempAngle = VirtualNormalVector.Angle(PropagationVector);
     
    1540356
    1541357            // check for linear dependence
    1542             TempVector = (*baseline->second->endpoints[0]->node->node) - (*target->second->node->node);
    1543             helper = (*baseline->second->endpoints[1]->node->node) - (*target->second->node->node);
     358            TempVector = (baseline->second->endpoints[0]->node->getPosition()) - (target->second->node->getPosition());
     359            helper = (baseline->second->endpoints[1]->node->getPosition()) - (target->second->node->getPosition());
    1544360            helper.ProjectOntoPlane(TempVector);
    1545361            if (fabs(helper.NormSquared()) < MYEPSILON) {
     
    1550366            // in case NOT both were found, create virtually this triangle, get its normal vector, calculate angle
    1551367            flag = true;
    1552             VirtualNormalVector = Plane(*(baseline->second->endpoints[0]->node->node),
    1553                                         *(baseline->second->endpoints[1]->node->node),
    1554                                         *(target->second->node->node)).getNormal();
    1555             TempVector = (1./3.) * ((*baseline->second->endpoints[0]->node->node) +
    1556                                     (*baseline->second->endpoints[1]->node->node) +
    1557                                     (*target->second->node->node));
     368            VirtualNormalVector = Plane((baseline->second->endpoints[0]->node->getPosition()),
     369                                        (baseline->second->endpoints[1]->node->getPosition()),
     370                                        (target->second->node->getPosition())).getNormal();
     371            TempVector = (1./3.) * ((baseline->second->endpoints[0]->node->getPosition()) +
     372                                    (baseline->second->endpoints[1]->node->getPosition()) +
     373                                    (target->second->node->getPosition()));
    1558374            TempVector -= (*Center);
    1559375            // make it always point outward
     
    1569385            } else if (fabs(SmallestAngle - TempAngle) < MYEPSILON) { // check the angle to propagation, both possible targets are in one plane! (their normals have same angle)
    1570386              // hence, check the angles to some normal direction from our base line but in this common plane of both targets...
    1571               helper = (*target->second->node->node) - BaseLineCenter;
     387              helper = (target->second->node->getPosition()) - BaseLineCenter;
    1572388              helper.ProjectOntoPlane(BaseLine);
    1573389              // ...the one with the smaller angle is the better candidate
    1574               TempVector = (*target->second->node->node) - BaseLineCenter;
     390              TempVector = (target->second->node->getPosition()) - BaseLineCenter;
    1575391              TempVector.ProjectOntoPlane(VirtualNormalVector);
    1576392              TempAngle = TempVector.Angle(helper);
    1577               TempVector = (*winner->second->node->node) - BaseLineCenter;
     393              TempVector = (winner->second->node->getPosition()) - BaseLineCenter;
    1578394              TempVector.ProjectOntoPlane(VirtualNormalVector);
    1579395              if (TempAngle < TempVector.Angle(helper)) {
     
    1614430            BLS[2] = LineChecker[1]->second;
    1615431          BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
    1616           BTS->GetCenter(&helper);
     432          BTS->GetCenter(helper);
    1617433          helper -= (*Center);
    1618434          helper *= -1;
     
    1662478    DoLog(0) && (Log() << Verbose(0) << "Current point is " << *Walker << "." << endl);
    1663479    // get the next triangle
    1664     triangles = FindClosestTrianglesToVector(Walker->node, BoundaryPoints);
     480    triangles = FindClosestTrianglesToVector(Walker->getPosition(), BoundaryPoints);
    1665481    if (triangles != NULL)
    1666482      BTS = triangles->front();
     
    1676492    DoLog(0) && (Log() << Verbose(0) << "Closest triangle is " << *BTS << "." << endl);
    1677493    // get the intersection point
    1678     if (BTS->GetIntersectionInsideTriangle(Center, Walker->node, &Intersection)) {
     494    if (BTS->GetIntersectionInsideTriangle(*Center, Walker->getPosition(), Intersection)) {
    1679495      DoLog(0) && (Log() << Verbose(0) << "We have an intersection at " << Intersection << "." << endl);
    1680496      // we have the intersection, check whether in- or outside of boundary
    1681       if ((Center->DistanceSquared(*Walker->node) - Center->DistanceSquared(Intersection)) < -MYEPSILON) {
     497      if ((Center->DistanceSquared(Walker->getPosition()) - Center->DistanceSquared(Intersection)) < -MYEPSILON) {
    1682498        // inside, next!
    1683499        DoLog(0) && (Log() << Verbose(0) << *Walker << " is inside wrt triangle " << *BTS << "." << endl);
     
    2086902  DoLog(1) && (Log() << Verbose(1) << "The following atoms are inside sphere at " << CandidateLine.OtherOptCenter << ":" << endl);
    2087903  for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner)
    2088     DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->distance(CandidateLine.OtherOptCenter) << "." << endl);
     904    DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->distance(CandidateLine.OtherOptCenter) << "." << endl);
    2089905
    2090906  // remove triangles's endpoints
     
    2102918    DoLog(1) && (Log() << Verbose(1) << "External atoms inside of sphere at " << CandidateLine.OtherOptCenter << ":" << endl);
    2103919    for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner)
    2104       DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->distance(CandidateLine.OtherOptCenter) << "." << endl);
     920      DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->distance(CandidateLine.OtherOptCenter) << "." << endl);
    2105921  }
    2106922  delete (ListofPoints);
     
    22571073        if (List != NULL) {
    22581074          for (LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
    2259             if ((*Runner)->node->at(map[0]) > maxCoordinate[map[0]]) {
    2260               DoLog(1) && (Log() << Verbose(1) << "New maximal for axis " << map[0] << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl);
    2261               maxCoordinate[map[0]] = (*Runner)->node->at(map[0]);
     1075            if ((*Runner)->at(map[0]) > maxCoordinate[map[0]]) {
     1076              DoLog(1) && (Log() << Verbose(1) << "New maximal for axis " << map[0] << " node is " << *(*Runner) << " at " << (*Runner)->getPosition() << "." << endl);
     1077              maxCoordinate[map[0]] = (*Runner)->at(map[0]);
    22621078              MaxPoint[map[0]] = (*Runner);
    22631079            }
     
    22951111
    22961112    // construct center of circle
    2297     CircleCenter = 0.5 * ((*BaseLine->endpoints[0]->node->node) + (*BaseLine->endpoints[1]->node->node));
     1113    CircleCenter = 0.5 * ((BaseLine->endpoints[0]->node->getPosition()) + (BaseLine->endpoints[1]->node->getPosition()));
    22981114
    22991115    // construct normal vector of circle
    2300     CirclePlaneNormal = (*BaseLine->endpoints[0]->node->node) - (*BaseLine->endpoints[1]->node->node);
     1116    CirclePlaneNormal = (BaseLine->endpoints[0]->node->getPosition()) - (BaseLine->endpoints[1]->node->getPosition());
    23011117
    23021118    double radius = CirclePlaneNormal.NormSquared();
     
    25151331
    25161332  // construct center of circle
    2517   CircleCenter = 0.5 * ((*CandidateLine.BaseLine->endpoints[0]->node->node) +
    2518                         (*CandidateLine.BaseLine->endpoints[1]->node->node));
     1333  CircleCenter = 0.5 * ((CandidateLine.BaseLine->endpoints[0]->node->getPosition()) +
     1334                        (CandidateLine.BaseLine->endpoints[1]->node->getPosition()));
    25191335
    25201336  // construct normal vector of circle
    2521   CirclePlaneNormal = (*CandidateLine.BaseLine->endpoints[0]->node->node) -
    2522                       (*CandidateLine.BaseLine->endpoints[1]->node->node);
     1337  CirclePlaneNormal = (CandidateLine.BaseLine->endpoints[0]->node->getPosition()) -
     1338                      (CandidateLine.BaseLine->endpoints[1]->node->getPosition());
    25231339
    25241340  // calculate squared radius of circle
     
    25361352    // construct SearchDirection and an "outward pointer"
    25371353    SearchDirection = Plane(RelativeSphereCenter, CirclePlaneNormal,0).getNormal();
    2538     helper = CircleCenter - (*ThirdPoint->node->node);
     1354    helper = CircleCenter - (ThirdPoint->node->getPosition());
    25391355    if (helper.ScalarProduct(SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards!
    25401356      SearchDirection.Scale(-1.);
     
    26111427  for (TesselPointList::iterator Runner = CandidateLine.pointlist.begin(); Runner != CandidateLine.pointlist.end(); Runner++)
    26121428    SetOfNeighbours.insert(*Runner);
    2613   TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(&SetOfNeighbours, TurningPoint, CandidateLine.BaseLine->endpoints[1]->node->node);
     1429  TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(&SetOfNeighbours, TurningPoint, CandidateLine.BaseLine->endpoints[1]->node->getPosition());
    26141430
    26151431  DoLog(0) && (Log() << Verbose(0) << "List of Candidates for Turning Point " << *TurningPoint << ":" << endl);
     
    27121528
    27131529  // create normal vector
    2714   BTS->GetCenter(&Center);
     1530  BTS->GetCenter(Center);
    27151531  Center -= CandidateLine.OptCenter;
    27161532  BTS->SphereCenter = CandidateLine.OptCenter;
     
    27911607
    27921608  // create normal vector
    2793   BTS->GetCenter(&Center);
     1609  BTS->GetCenter(Center);
    27941610  Center.SubtractVector(*OptCenter);
    27951611  BTS->SphereCenter = *OptCenter;
     
    28371653  Vector DistanceToIntersection[2], BaseLine;
    28381654  double distance[2];
    2839   BaseLine = (*Base->endpoints[1]->node->node) - (*Base->endpoints[0]->node->node);
     1655  BaseLine = (Base->endpoints[1]->node->getPosition()) - (Base->endpoints[0]->node->getPosition());
    28401656  for (int i = 0; i < 2; i++) {
    2841     DistanceToIntersection[i] = (*ClosestPoint) - (*Base->endpoints[i]->node->node);
     1657    DistanceToIntersection[i] = (*ClosestPoint) - (Base->endpoints[i]->node->getPosition());
    28421658    distance[i] = BaseLine.ScalarProduct(DistanceToIntersection[i]);
    28431659  }
     
    29191735
    29201736  // calculate volume
    2921   volume = CalculateVolumeofGeneralTetraeder(*Base->endpoints[1]->node->node, *OtherBase->endpoints[0]->node->node, *OtherBase->endpoints[1]->node->node, *Base->endpoints[0]->node->node);
     1737  volume = CalculateVolumeofGeneralTetraeder(Base->endpoints[1]->node->getPosition(), OtherBase->endpoints[0]->node->getPosition(), OtherBase->endpoints[1]->node->getPosition(), Base->endpoints[0]->node->getPosition());
    29221738
    29231739  // delete the temporary other base line and the closest points
     
    31251941
    31261942              OrthogonalizedOben = Oben;
    3127               aCandidate = (*a->node) - (*Candidate->node);
     1943              aCandidate = (a->getPosition()) - (Candidate->getPosition());
    31281944              OrthogonalizedOben.ProjectOntoPlane(aCandidate);
    31291945              OrthogonalizedOben.Normalize();
     
    31321948              OrthogonalizedOben.Scale(scaleFactor);
    31331949
    3134               Center = 0.5 * ((*Candidate->node) + (*a->node));
     1950              Center = 0.5 * ((Candidate->getPosition()) + (a->getPosition()));
    31351951              Center += OrthogonalizedOben;
    31361952
    3137               AngleCheck = Center - (*a->node);
     1953              AngleCheck = Center - (a->getPosition());
    31381954              norm = aCandidate.Norm();
    31391955              // second point shall have smallest angle with respect to Oben vector
     
    32202036
    32212037  // construct center of circle
    3222   CircleCenter = 0.5 * ((*CandidateLine.BaseLine->endpoints[0]->node->node) +
    3223                         (*CandidateLine.BaseLine->endpoints[1]->node->node));
     2038  CircleCenter = 0.5 * ((CandidateLine.BaseLine->endpoints[0]->node->getPosition()) +
     2039                        (CandidateLine.BaseLine->endpoints[1]->node->getPosition()));
    32242040
    32252041  // construct normal vector of circle
    3226   CirclePlaneNormal = (*CandidateLine.BaseLine->endpoints[0]->node->node) -
    3227                       (*CandidateLine.BaseLine->endpoints[1]->node->node);
     2042  CirclePlaneNormal = (CandidateLine.BaseLine->endpoints[0]->node->getPosition()) -
     2043                      (CandidateLine.BaseLine->endpoints[1]->node->getPosition());
    32282044
    32292045  RelativeOldSphereCenter = OldSphereCenter - CircleCenter;
     
    32522068
    32532069      // get cell for the starting point
    3254       if (LC->SetIndexToVector(&CircleCenter)) {
     2070      if (LC->SetIndexToVector(CircleCenter)) {
    32552071        for (int i = 0; i < NDIM; i++) // store indices of this cell
    32562072          N[i] = LC->n[i];
     
    32822098
    32832099                  // find center on the plane
    3284                   GetCenterofCircumcircle(&NewPlaneCenter, *CandidateLine.BaseLine->endpoints[0]->node->node, *CandidateLine.BaseLine->endpoints[1]->node->node, *Candidate->node);
     2100                  GetCenterofCircumcircle(NewPlaneCenter, CandidateLine.BaseLine->endpoints[0]->node->getPosition(), CandidateLine.BaseLine->endpoints[1]->node->getPosition(), Candidate->getPosition());
    32852101                  DoLog(1) && (Log() << Verbose(1) << "INFO: NewPlaneCenter is " << NewPlaneCenter << "." << endl);
    32862102
    32872103                  try {
    3288                     NewNormalVector = Plane(*(CandidateLine.BaseLine->endpoints[0]->node->node),
    3289                                             *(CandidateLine.BaseLine->endpoints[1]->node->node),
    3290                                             *(Candidate->node)).getNormal();
     2104                    NewNormalVector = Plane((CandidateLine.BaseLine->endpoints[0]->node->getPosition()),
     2105                                            (CandidateLine.BaseLine->endpoints[1]->node->getPosition()),
     2106                                            (Candidate->getPosition())).getNormal();
    32912107                    DoLog(1) && (Log() << Verbose(1) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl);
    3292                     radius = CandidateLine.BaseLine->endpoints[0]->node->node->DistanceSquared(NewPlaneCenter);
     2108                    radius = CandidateLine.BaseLine->endpoints[0]->node->DistanceSquared(NewPlaneCenter);
    32932109                    DoLog(1) && (Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl);
    32942110                    DoLog(1) && (Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl);
    32952111                    DoLog(1) && (Log() << Verbose(1) << "INFO: Radius of CircumCenterCircle is " << radius << "." << endl);
    32962112                    if (radius < RADIUS * RADIUS) {
    3297                       otherradius = CandidateLine.BaseLine->endpoints[1]->node->node->DistanceSquared(NewPlaneCenter);
     2113                      otherradius = CandidateLine.BaseLine->endpoints[1]->node->DistanceSquared(NewPlaneCenter);
    32982114                      if (fabs(radius - otherradius) < HULLEPSILON) {
    32992115                        // construct both new centers
     
    34222238 * \return map of BoundaryPointSet of closest points sorted by squared distance or NULL.
    34232239 */
    3424 DistanceToPointMap * Tesselation::FindClosestBoundaryPointsToVector(const Vector *x, const LinkedCell* LC) const
     2240DistanceToPointMap * Tesselation::FindClosestBoundaryPointsToVector(const Vector &x, const LinkedCell* LC) const
    34252241{
    34262242  Info FunctionInfo(__func__);
     
    34502266            FindPoint = PointsOnBoundary.find((*Runner)->nr);
    34512267            if (FindPoint != PointsOnBoundary.end()) {
    3452               points->insert(DistanceToPointPair(FindPoint->second->node->node->DistanceSquared(*x), FindPoint->second));
     2268              points->insert(DistanceToPointPair(FindPoint->second->node->DistanceSquared(x), FindPoint->second));
    34532269              DoLog(1) && (Log() << Verbose(1) << "INFO: Putting " << *FindPoint->second << " into the list." << endl);
    34542270            }
     
    34742290 * \return closest BoundaryLineSet or NULL in degenerate case.
    34752291 */
    3476 BoundaryLineSet * Tesselation::FindClosestBoundaryLineToVector(const Vector *x, const LinkedCell* LC) const
     2292BoundaryLineSet * Tesselation::FindClosestBoundaryLineToVector(const Vector &x, const LinkedCell* LC) const
    34772293{
    34782294  Info FunctionInfo(__func__);
     
    34852301
    34862302  // for each point, check its lines, remember closest
    3487   DoLog(1) && (Log() << Verbose(1) << "Finding closest BoundaryLine to " << *x << " ... " << endl);
     2303  DoLog(1) && (Log() << Verbose(1) << "Finding closest BoundaryLine to " << x << " ... " << endl);
    34882304  BoundaryLineSet *ClosestLine = NULL;
    34892305  double MinDistance = -1.;
     
    34942310    for (LineMap::iterator LineRunner = Runner->second->lines.begin(); LineRunner != Runner->second->lines.end(); LineRunner++) {
    34952311      // calculate closest point on line to desired point
    3496       helper = 0.5 * ((*(LineRunner->second)->endpoints[0]->node->node) +
    3497                       (*(LineRunner->second)->endpoints[1]->node->node));
    3498       Center = (*x) - helper;
    3499       BaseLine = (*(LineRunner->second)->endpoints[0]->node->node) -
    3500                  (*(LineRunner->second)->endpoints[1]->node->node);
     2312      helper = 0.5 * (((LineRunner->second)->endpoints[0]->node->getPosition()) +
     2313                      ((LineRunner->second)->endpoints[1]->node->getPosition()));
     2314      Center = (x) - helper;
     2315      BaseLine = ((LineRunner->second)->endpoints[0]->node->getPosition()) -
     2316                 ((LineRunner->second)->endpoints[1]->node->getPosition());
    35012317      Center.ProjectOntoPlane(BaseLine);
    35022318      const double distance = Center.NormSquared();
    35032319      if ((ClosestLine == NULL) || (distance < MinDistance)) {
    35042320        // additionally calculate intersection on line (whether it's on the line section or not)
    3505         helper = (*x) - (*(LineRunner->second)->endpoints[0]->node->node) - Center;
     2321        helper = (x) - ((LineRunner->second)->endpoints[0]->node->getPosition()) - Center;
    35062322        const double lengthA = helper.ScalarProduct(BaseLine);
    3507         helper = (*x) - (*(LineRunner->second)->endpoints[1]->node->node) - Center;
     2323        helper = (x) - ((LineRunner->second)->endpoints[1]->node->getPosition()) - Center;
    35082324        const double lengthB = helper.ScalarProduct(BaseLine);
    35092325        if (lengthB * lengthA < 0) { // if have different sign
     
    35342350 * \return BoundaryTriangleSet of nearest triangle or NULL.
    35352351 */
    3536 TriangleList * Tesselation::FindClosestTrianglesToVector(const Vector *x, const LinkedCell* LC) const
     2352TriangleList * Tesselation::FindClosestTrianglesToVector(const Vector &x, const LinkedCell* LC) const
    35372353{
    35382354  Info FunctionInfo(__func__);
     
    35452361
    35462362  // for each point, check its lines, remember closest
    3547   DoLog(1) && (Log() << Verbose(1) << "Finding closest BoundaryTriangle to " << *x << " ... " << endl);
     2363  DoLog(1) && (Log() << Verbose(1) << "Finding closest BoundaryTriangle to " << x << " ... " << endl);
    35482364  LineSet ClosestLines;
    35492365  double MinDistance = 1e+16;
     
    35552371    for (LineMap::iterator LineRunner = Runner->second->lines.begin(); LineRunner != Runner->second->lines.end(); LineRunner++) {
    35562372
    3557       BaseLine = (*(LineRunner->second)->endpoints[0]->node->node) -
    3558                  (*(LineRunner->second)->endpoints[1]->node->node);
     2373      BaseLine = ((LineRunner->second)->endpoints[0]->node->getPosition()) -
     2374                 ((LineRunner->second)->endpoints[1]->node->getPosition());
    35592375      const double lengthBase = BaseLine.NormSquared();
    35602376
    3561       BaseLineIntersection = (*x) - (*(LineRunner->second)->endpoints[0]->node->node);
     2377      BaseLineIntersection = (x) - ((LineRunner->second)->endpoints[0]->node->getPosition());
    35622378      const double lengthEndA = BaseLineIntersection.NormSquared();
    35632379
    3564       BaseLineIntersection = (*x) - (*(LineRunner->second)->endpoints[1]->node->node);
     2380      BaseLineIntersection = (x) - ((LineRunner->second)->endpoints[1]->node->getPosition());
    35652381      const double lengthEndB = BaseLineIntersection.NormSquared();
    35662382
     
    35802396      } else { // intersection is closer, calculate
    35812397        // calculate closest point on line to desired point
    3582         BaseLineIntersection = (*x) - (*(LineRunner->second)->endpoints[1]->node->node);
     2398        BaseLineIntersection = (x) - ((LineRunner->second)->endpoints[1]->node->getPosition());
    35832399        Center = BaseLineIntersection;
    35842400        Center.ProjectOntoPlane(BaseLine);
     
    36212437 * \return list of BoundaryTriangleSet of nearest triangles or NULL.
    36222438 */
    3623 class BoundaryTriangleSet * Tesselation::FindClosestTriangleToVector(const Vector *x, const LinkedCell* LC) const
     2439class BoundaryTriangleSet * Tesselation::FindClosestTriangleToVector(const Vector &x, const LinkedCell* LC) const
    36242440{
    36252441  Info FunctionInfo(__func__);
     
    36362452  double MinAlignment = 2. * M_PI;
    36372453  for (TriangleList::iterator Runner = triangles->begin(); Runner != triangles->end(); Runner++) {
    3638     (*Runner)->GetCenter(&Center);
    3639     helper = (*x) - Center;
     2454    (*Runner)->GetCenter(Center);
     2455    helper = (x) - Center;
    36402456    const double Alignment = helper.Angle((*Runner)->NormalVector);
    36412457    if (Alignment < MinAlignment) {
     
    36632479{
    36642480  Info FunctionInfo(__func__);
    3665   TriangleIntersectionList Intersections(&Point, this, LC);
     2481  TriangleIntersectionList Intersections(Point, this, LC);
    36662482
    36672483  return Intersections.IsInside();
     
    37032519  }
    37042520
    3705   triangle->GetCenter(&Center);
     2521  triangle->GetCenter(Center);
    37062522  DoLog(2) && (Log() << Verbose(2) << "INFO: Central point of the triangle is " << Center << "." << endl);
    37072523  DistanceToCenter = Center - Point;
     
    37142530    Center = Point - triangle->NormalVector; // points towards MolCenter
    37152531    DoLog(1) && (Log() << Verbose(1) << "INFO: Calling Intersection with " << Center << " and " << DistanceToCenter << "." << endl);
    3716     if (triangle->GetIntersectionInsideTriangle(&Center, &DistanceToCenter, &Intersection)) {
     2532    if (triangle->GetIntersectionInsideTriangle(Center, DistanceToCenter, Intersection)) {
    37172533      DoLog(1) && (Log() << Verbose(1) << Point << " is inner point: sufficiently close to boundary, " << Intersection << "." << endl);
    37182534      return 0.;
     
    37232539  } else {
    37242540    // calculate smallest distance
    3725     distance = triangle->GetClosestPointInsideTriangle(&Point, &Intersection);
     2541    distance = triangle->GetClosestPointInsideTriangle(Point, Intersection);
    37262542    DoLog(1) && (Log() << Verbose(1) << "Closest point on triangle is " << Intersection << "." << endl);
    37272543
     
    37472563{
    37482564  Info FunctionInfo(__func__);
    3749   TriangleIntersectionList Intersections(&Point, this, LC);
     2565  TriangleIntersectionList Intersections(Point, this, LC);
    37502566
    37512567  return Intersections.GetSmallestDistance();
     
    37622578{
    37632579  Info FunctionInfo(__func__);
    3764   TriangleIntersectionList Intersections(&Point, this, LC);
     2580  TriangleIntersectionList Intersections(Point, this, LC);
    37652581
    37662582  return Intersections.GetClosestTriangle();
     
    38392655 * @return list of the all points linked to the provided one
    38402656 */
    3841 TesselPointList * Tesselation::GetCircleOfConnectedTriangles(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference) const
     2657TesselPointList * Tesselation::GetCircleOfConnectedTriangles(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector &Reference) const
    38422658{
    38432659  Info FunctionInfo(__func__);
     
    38712687
    38722688  // construct one orthogonal vector
    3873   if (Reference != NULL) {
    3874     AngleZero = (*Reference) - (*Point->node);
    3875     AngleZero.ProjectOntoPlane(PlaneNormal);
    3876   }
    3877   if ((Reference == NULL) || (AngleZero.NormSquared() < MYEPSILON)) {
    3878     DoLog(1) && (Log() << Verbose(1) << "Using alternatively " << *(*SetOfNeighbours->begin())->node << " as angle 0 referencer." << endl);
    3879     AngleZero = (*(*SetOfNeighbours->begin())->node) - (*Point->node);
     2689  AngleZero = (Reference) - (Point->getPosition());
     2690  AngleZero.ProjectOntoPlane(PlaneNormal);
     2691  if ((AngleZero.NormSquared() < MYEPSILON)) {
     2692    DoLog(1) && (Log() << Verbose(1) << "Using alternatively " << (*SetOfNeighbours->begin())->getPosition() << " as angle 0 referencer." << endl);
     2693    AngleZero = ((*SetOfNeighbours->begin())->getPosition()) - (Point->getPosition());
    38802694    AngleZero.ProjectOntoPlane(PlaneNormal);
    38812695    if (AngleZero.NormSquared() < MYEPSILON) {
     
    38932707  // go through all connected points and calculate angle
    38942708  for (TesselPointSet::iterator listRunner = SetOfNeighbours->begin(); listRunner != SetOfNeighbours->end(); listRunner++) {
    3895     helper = (*(*listRunner)->node) - (*Point->node);
     2709    helper = ((*listRunner)->getPosition()) - (Point->getPosition());
    38962710    helper.ProjectOntoPlane(PlaneNormal);
    38972711    double angle = GetAngle(helper, AngleZero, OrthogonalVector);
     
    39152729 * @param *SetOfNeighbours all points for which the angle should be calculated
    39162730 * @param *Point of which get all connected points
    3917  * @param *Reference Reference vector for zero angle or NULL for no preference
     2731 * @param *Reference Reference vector for zero angle or (0,0,0) for no preference
    39182732 * @return list of the all points linked to the provided one
    39192733 */
    3920 TesselPointList * Tesselation::GetCircleOfSetOfPoints(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference) const
     2734TesselPointList * Tesselation::GetCircleOfSetOfPoints(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector &Reference) const
    39212735{
    39222736  Info FunctionInfo(__func__);
     
    39422756  }
    39432757
    3944   DoLog(1) && (Log() << Verbose(1) << "INFO: Point is " << *Point << " and Reference is " << *Reference << "." << endl);
     2758  DoLog(1) && (Log() << Verbose(1) << "INFO: Point is " << *Point << " and Reference is " << Reference << "." << endl);
    39452759  // calculate central point
    39462760  TesselPointSet::const_iterator TesselA = SetOfNeighbours->begin();
     
    39522766  int counter = 0;
    39532767  while (TesselC != SetOfNeighbours->end()) {
    3954     helper = Plane(*((*TesselA)->node),
    3955                    *((*TesselB)->node),
    3956                    *((*TesselC)->node)).getNormal();
     2768    helper = Plane(((*TesselA)->getPosition()),
     2769                   ((*TesselB)->getPosition()),
     2770                   ((*TesselC)->getPosition())).getNormal();
    39572771    DoLog(0) && (Log() << Verbose(0) << "Making normal vector out of " << *(*TesselA) << ", " << *(*TesselB) << " and " << *(*TesselC) << ":" << helper << endl);
    39582772    counter++;
     
    39742788
    39752789  // construct one orthogonal vector
    3976   if (Reference != NULL) {
    3977     AngleZero = (*Reference) - (*Point->node);
     2790  if (!Reference.IsZero()) {
     2791    AngleZero = (Reference) - (Point->getPosition());
    39782792    AngleZero.ProjectOntoPlane(PlaneNormal);
    39792793  }
    3980   if ((Reference == NULL) || (AngleZero.NormSquared() < MYEPSILON )) {
    3981     DoLog(1) && (Log() << Verbose(1) << "Using alternatively " << *(*SetOfNeighbours->begin())->node << " as angle 0 referencer." << endl);
    3982     AngleZero = (*(*SetOfNeighbours->begin())->node) - (*Point->node);
     2794  if ((Reference.IsZero()) || (AngleZero.NormSquared() < MYEPSILON )) {
     2795    DoLog(1) && (Log() << Verbose(1) << "Using alternatively " << (*SetOfNeighbours->begin())->getPosition() << " as angle 0 referencer." << endl);
     2796    AngleZero = ((*SetOfNeighbours->begin())->getPosition()) - (Point->getPosition());
    39832797    AngleZero.ProjectOntoPlane(PlaneNormal);
    39842798    if (AngleZero.NormSquared() < MYEPSILON) {
     
    39972811  pair<map<double, TesselPoint*>::iterator, bool> InserterTest;
    39982812  for (TesselPointSet::iterator listRunner = SetOfNeighbours->begin(); listRunner != SetOfNeighbours->end(); listRunner++) {
    3999     helper = (*(*listRunner)->node) - (*Point->node);
     2813    helper = ((*listRunner)->getPosition()) - (Point->getPosition());
    40002814    helper.ProjectOntoPlane(PlaneNormal);
    40012815    double angle = GetAngle(helper, AngleZero, OrthogonalVector);
     
    42423056
    42433057  // copy old location for the volume
    4244   OldPoint = (*point->node->node);
     3058  OldPoint = (point->node->getPosition());
    42453059
    42463060  // get list of connected points
     
    43053119          StartNode--;
    43063120          //Log() << Verbose(3) << "INFO: StartNode is " << **StartNode << "." << endl;
    4307           Point = (*(*StartNode)->node) - (*(*MiddleNode)->node);
     3121          Point = ((*StartNode)->getPosition()) - ((*MiddleNode)->getPosition());
    43083122          StartNode = MiddleNode;
    43093123          StartNode++;
     
    43113125            StartNode = connectedPath->begin();
    43123126          //Log() << Verbose(3) << "INFO: EndNode is " << **StartNode << "." << endl;
    4313           Reference = (*(*StartNode)->node) - (*(*MiddleNode)->node);
    4314           OrthogonalVector = (*(*MiddleNode)->node) - OldPoint;
     3127          Reference = ((*StartNode)->getPosition()) - ((*MiddleNode)->getPosition());
     3128          OrthogonalVector = ((*MiddleNode)->getPosition()) - OldPoint;
    43153129          OrthogonalVector.MakeNormalTo(Reference);
    43163130          angle = GetAngle(Point, Reference, OrthogonalVector);
     
    43673181        AddTesselationTriangle();
    43683182        // calculate volume summand as a general tetraeder
    4369         volume += CalculateVolumeofGeneralTetraeder(*TPS[0]->node->node, *TPS[1]->node->node, *TPS[2]->node->node, OldPoint);
     3183        volume += CalculateVolumeofGeneralTetraeder(TPS[0]->node->getPosition(), TPS[1]->node->getPosition(), TPS[2]->node->getPosition(), OldPoint);
    43703184        // advance number
    43713185        count++;
     
    47523566  // find nearest boundary point
    47533567  class TesselPoint *BackupPoint = NULL;
    4754   class TesselPoint *NearestPoint = FindClosestTesselPoint(point->node, BackupPoint, LC);
     3568  class TesselPoint *NearestPoint = FindClosestTesselPoint(point->getPosition(), BackupPoint, LC);
    47553569  class BoundaryPointSet *NearestBoundaryPoint = NULL;
    47563570  PointMap::iterator PointRunner;
     
    47733587  class BoundaryLineSet *BestLine = NULL;
    47743588  for (LineMap::iterator Runner = NearestBoundaryPoint->lines.begin(); Runner != NearestBoundaryPoint->lines.end(); Runner++) {
    4775     BaseLine = (*Runner->second->endpoints[0]->node->node) -
    4776                (*Runner->second->endpoints[1]->node->node);
    4777     CenterToPoint = 0.5 * ((*Runner->second->endpoints[0]->node->node) +
    4778                            (*Runner->second->endpoints[1]->node->node));
    4779     CenterToPoint -= (*point->node);
     3589    BaseLine = (Runner->second->endpoints[0]->node->getPosition()) -
     3590               (Runner->second->endpoints[1]->node->getPosition());
     3591    CenterToPoint = 0.5 * ((Runner->second->endpoints[0]->node->getPosition()) +
     3592                           (Runner->second->endpoints[1]->node->getPosition()));
     3593    CenterToPoint -= (point->getPosition());
    47803594    angle = CenterToPoint.Angle(BaseLine);
    47813595    if (fabs(angle - M_PI/2.) < fabs(BestAngle - M_PI/2.)) {
  • src/tesselation.hpp

    r8d6d31 r8f4df1  
    22 * tesselation.hpp
    33 *
    4  *  The tesselation class is meant to contain the envelope (concave, convex or neither) of a set of Vectors. As we actually mean this stuff for atoms, we have to encapsulate it all a bit.
     4 *  The tesselation class is meant to contain the envelope (concave, convex or neither) of a set of Vectors.
     5 *  As we actually mean this stuff for atoms, we have to encapsulate it all a bit.
    56 *
    67 *  Created on: Aug 3, 2009
     
    2526#include <stack>
    2627
     28#include "BoundaryMaps.hpp"
     29#include "PointCloud.hpp"
     30#include "TesselPoint.hpp"
    2731#include "atom_particleinfo.hpp"
    2832#include "Helpers/helpers.hpp"
    2933#include "LinearAlgebra/Vector.hpp"
     34
    3035
    3136/****************************************** forward declarations *****************************/
     
    3439class BoundaryLineSet;
    3540class BoundaryTriangleSet;
     41class CandidateForTesselation;
    3642class LinkedCell;
    37 class TesselPoint;
    38 class PointCloud;
    3943class Tesselation;
    4044class Plane;
     
    5357// ======================================================= some template functions =========================================
    5458
    55 #define IndexToIndex map <int, int>
    56 
    57 #define PointMap map < int, class BoundaryPointSet * >
    58 #define PointSet set < class BoundaryPointSet * >
    59 #define PointList list < class BoundaryPointSet * >
    60 #define PointPair pair < int, class BoundaryPointSet * >
    61 #define PointTestPair pair < PointMap::iterator, bool >
    62 
    63 #define CandidateList list <class CandidateForTesselation *>
    64 #define CandidateMap map <class BoundaryLineSet *, class CandidateForTesselation *>
    65 
    66 #define LineMap multimap < int, class BoundaryLineSet * >
    67 #define LineSet set < class BoundaryLineSet * >
    68 #define LineList list < class BoundaryLineSet * >
    69 #define LinePair pair < int, class BoundaryLineSet * >
    70 #define LineTestPair pair < LineMap::iterator, bool >
    71 
    72 #define TriangleMap map < int, class BoundaryTriangleSet * >
    73 #define TriangleSet set < class BoundaryTriangleSet * >
    74 #define TriangleList list < class BoundaryTriangleSet * >
    75 #define TrianglePair pair < int, class BoundaryTriangleSet * >
    76 #define TriangleTestPair pair < TrianglePair::iterator, bool >
    77 
    78 #define PolygonMap map < int, class BoundaryPolygonSet * >
    79 #define PolygonSet set < class BoundaryPolygonSet * >
    80 #define PolygonList list < class BoundaryPolygonSet * >
    81 
    82 #define DistanceToPointMap multimap <double, class BoundaryPointSet * >
    83 #define DistanceToPointPair pair <double, class BoundaryPointSet * >
    84 
    85 #define DistanceMultiMap multimap <double, pair < PointMap::iterator, PointMap::iterator> >
    86 #define DistanceMultiMapPair pair <double, pair < PointMap::iterator, PointMap::iterator> >
    87 
    88 #define TesselPointList list <TesselPoint *>
    89 #define TesselPointSet set <TesselPoint *>
    90 
    91 #define ListOfTesselPointList list<list <TesselPoint *> *>
    92 
    93 enum centers {Opt, OtherOpt};
    94 
    9559/********************************************** declarations *******************************/
    96 
    97 template <typename T> void SetEndpointsOrdered(T endpoints[2], T endpoint1, T endpoint2)
    98 {
    99   if (endpoint1->Nr < endpoint2->Nr) {
    100     endpoints[0] = endpoint1;
    101     endpoints[1] = endpoint2;
    102   } else {
    103     endpoints[0] = endpoint2;
    104     endpoints[1] = endpoint1;
    105   }
    106 };
    107 
    108 // ======================================================== class BoundaryPointSet =========================================
    109 
    110 class BoundaryPointSet {
    111   public:
    112     BoundaryPointSet();
    113     BoundaryPointSet(TesselPoint * const Walker);
    114     ~BoundaryPointSet();
    115 
    116     void AddLine(BoundaryLineSet * const line);
    117 
    118     LineMap lines;
    119     int LinesCount;
    120     TesselPoint *node;
    121     double value;
    122     int Nr;
    123 };
    124 
    125 ostream & operator << (ostream &ost, const BoundaryPointSet &a);
    126 
    127 // ======================================================== class BoundaryLineSet ==========================================
    128 
    129 class BoundaryLineSet {
    130   public:
    131     BoundaryLineSet();
    132     BoundaryLineSet(BoundaryPointSet * const Point[2], const int number);
    133     BoundaryLineSet(BoundaryPointSet * const Point1, BoundaryPointSet * const Point2, const int number);
    134     ~BoundaryLineSet();
    135 
    136     void AddTriangle(BoundaryTriangleSet * const triangle);
    137     bool IsConnectedTo(const BoundaryLineSet * const line) const;
    138     bool ContainsBoundaryPoint(const BoundaryPointSet * const point) const;
    139     bool CheckConvexityCriterion() const;
    140     double CalculateConvexity() const;
    141     class BoundaryPointSet *GetOtherEndpoint(const BoundaryPointSet * const point) const;
    142     class BoundaryTriangleSet *GetOtherTriangle(const BoundaryTriangleSet * const triangle) const;
    143 
    144     class BoundaryPointSet *endpoints[2];
    145     TriangleMap triangles;
    146     int Nr;
    147     bool skipped;
    148 };
    149 
    150 ostream & operator << (ostream &ost, const BoundaryLineSet &a);
    151 
    152 // ======================================================== class BoundaryTriangleSet =======================================
    153 
    154 class BoundaryTriangleSet {
    155   public:
    156     BoundaryTriangleSet();
    157     BoundaryTriangleSet(class BoundaryLineSet * const line[3], const int number);
    158     ~BoundaryTriangleSet();
    159 
    160     void GetNormalVector(const Vector &NormalVector);
    161     void GetCenter(Vector * const center) const;
    162     bool GetIntersectionInsideTriangle(const Vector * const MolCenter, const Vector * const x, Vector * const Intersection) const;
    163     double GetClosestPointInsideTriangle(const Vector * const x, Vector * const ClosestPoint) const;
    164     bool ContainsBoundaryLine(const BoundaryLineSet * const line) const;
    165     bool ContainsBoundaryPoint(const BoundaryPointSet * const point) const;
    166     bool ContainsBoundaryPoint(const TesselPoint * const point) const;
    167     class BoundaryPointSet *GetThirdEndpoint(const BoundaryLineSet * const line) const;
    168     class BoundaryLineSet *GetThirdLine(const BoundaryPointSet * const point) const;
    169     bool IsPresentTupel(const BoundaryPointSet * const Points[3]) const;
    170     bool IsPresentTupel(const BoundaryTriangleSet * const T) const;
    171 
    172     Plane getPlane() const;
    173     Vector getEndpoint(int) const;
    174     std::string getEndpointName(int) const;
    175 
    176     class BoundaryPointSet *endpoints[3];
    177     class BoundaryLineSet *lines[3];
    178     Vector NormalVector;
    179     Vector SphereCenter;
    180     int Nr;
    181 
    182   private:
    183 
    184 };
    185 
    186 ostream & operator << (ostream &ost, const BoundaryTriangleSet &a);
    187 
    188 
    189 // ======================================================== class BoundaryTriangleSet =======================================
    190 
    191 /** Set of BoundaryPointSet.
    192  * This is just meant as a container for a group of endpoints, extending the node, line, triangle concept. However, this has
    193  * only marginally something to do with the tesselation. Hence, there is no incorporation into the bookkeeping of the Tesselation
    194  * class (i.e. no allocation, no deletion).
    195  * \note we assume that the set of endpoints reside (more or less) on a plane.
    196  */
    197 class BoundaryPolygonSet {
    198   public:
    199     BoundaryPolygonSet();
    200     ~BoundaryPolygonSet();
    201 
    202     Vector * GetNormalVector(const Vector &NormalVector) const;
    203     void GetCenter(Vector *center) const;
    204     bool ContainsBoundaryLine(const BoundaryLineSet * const line) const;
    205     bool ContainsBoundaryPoint(const BoundaryPointSet * const point) const;
    206     bool ContainsBoundaryPoint(const TesselPoint * const point) const;
    207     bool ContainsBoundaryTriangle(const BoundaryTriangleSet * const point) const;
    208     bool ContainsPresentTupel(const BoundaryPointSet * const * Points, const int dim) const;
    209     bool ContainsPresentTupel(const BoundaryPolygonSet * const P) const;
    210     bool ContainsPresentTupel(const PointSet &endpoints) const;
    211     TriangleSet * GetAllContainedTrianglesFromEndpoints() const;
    212     bool FillPolygonFromTrianglesOfLine(const BoundaryLineSet * const line);
    213 
    214     PointSet endpoints;
    215     int Nr;
    216 };
    217 
    218 ostream & operator << (ostream &ost, const BoundaryPolygonSet &a);
    219 
    220 // =========================================================== class TESSELPOINT ===========================================
    221 
    222 /** Is a single point of the set of Vectors, also a super-class to be inherited and and its functions to be implemented.
    223  */
    224 class TesselPoint : virtual public ParticleInfo {
    225 public:
    226   TesselPoint();
    227   virtual ~TesselPoint();
    228 
    229   Vector *node;   // pointer to position of the dot in space
    230 
    231   virtual ostream & operator << (ostream &ost);
    232 };
    233 
    234 ostream & operator << (ostream &ost, const TesselPoint &a);
    235 
    236 // =========================================================== class POINTCLOUD ============================================
    237 
    238 /** Super-class for all point clouds structures, also molecules. They have to inherit this structure and implement the virtual function to access the Vectors.
    239  * This basically encapsulates a list structure.
    240  */
    241 class PointCloud {
    242 public:
    243   PointCloud();
    244   virtual ~PointCloud();
    245 
    246   virtual const char * const GetName() const { return "unknown"; };
    247   virtual Vector *GetCenter() const { return NULL; };
    248   virtual TesselPoint *GetPoint() const { return NULL; };
    249   virtual int GetMaxId() const { return 0; };
    250   virtual void GoToNext() const {};
    251   virtual void GoToFirst() const {};
    252   virtual bool IsEmpty() const { return true; };
    253   virtual bool IsEnd() const { return true; };
    254 };
    255 
    256 // ======================================================== class CandidateForTesselation =========================================
    257 
    258 class CandidateForTesselation {
    259   public :
    260   CandidateForTesselation(BoundaryLineSet* currentBaseLine);
    261   CandidateForTesselation(TesselPoint* candidate, BoundaryLineSet* currentBaseLine, BoundaryPointSet *point, Vector OptCandidateCenter, Vector OtherOptCandidateCenter);
    262   ~CandidateForTesselation();
    263 
    264   bool CheckValidity(const double RADIUS, const LinkedCell *LC) const;
    265 
    266   TesselPointList pointlist;
    267   const BoundaryLineSet * BaseLine;
    268   const BoundaryPointSet * ThirdPoint;
    269   const BoundaryTriangleSet *T;
    270   Vector OldCenter;
    271   Vector OptCenter;
    272   Vector OtherOptCenter;
    273   double ShortestAngle;
    274   double OtherShortestAngle;
    275 };
    276 
    277 ostream & operator <<(ostream &ost, const  CandidateForTesselation &a);
    27860
    27961// =========================================================== class TESSELATION ===========================================
     
    28971    void AddTesselationPoint(TesselPoint* Candidate, const int n);
    29072    void SetTesselationPoint(TesselPoint* Candidate, const int n) const;
    291     void AddTesselationLine(const Vector * const OptCenter, const BoundaryPointSet * const candidate, class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
     73    void AddTesselationLine(const Vector * OptCenter, const BoundaryPointSet * const candidate, class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
    29274    void AddNewTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
    29375    void AddExistingTesselationTriangleLine(class BoundaryLineSet *FindLine, int n);
     
    330112    ListOfTesselPointList * GetPathsOfConnectedPoints(const TesselPoint* const Point) const;
    331113    ListOfTesselPointList * GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const;
    332     TesselPointList * GetCircleOfSetOfPoints(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference = NULL) const;
    333     TesselPointList * GetCircleOfConnectedTriangles(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference) const;
     114    TesselPointList * GetCircleOfSetOfPoints(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector &Reference) const;
     115    TesselPointList * GetCircleOfConnectedTriangles(TesselPointSet *SetOfNeighbours, const TesselPoint* const Point, const Vector &Reference) const;
    334116    class BoundaryPointSet * GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const;
    335117    TriangleList * FindTriangles(const TesselPoint* const Points[3]) const;
    336     TriangleList * FindClosestTrianglesToVector(const Vector *x, const LinkedCell* LC) const;
    337     BoundaryTriangleSet * FindClosestTriangleToVector(const Vector *x, const LinkedCell* LC) const;
     118    TriangleList * FindClosestTrianglesToVector(const Vector &x, const LinkedCell* LC) const;
     119    BoundaryTriangleSet * FindClosestTriangleToVector(const Vector &x, const LinkedCell* LC) const;
    338120    bool IsInnerPoint(const Vector &Point, const LinkedCell* const LC) const;
    339121    double GetDistanceSquaredToTriangle(const Vector &Point, const BoundaryTriangleSet* const triangle) const;
     
    341123    BoundaryTriangleSet * GetClosestTriangleOnSurface(const Vector &Point, const LinkedCell* const LC) const;
    342124    bool AddBoundaryPoint(TesselPoint * Walker, const int n);
    343     DistanceToPointMap * FindClosestBoundaryPointsToVector(const Vector *x, const LinkedCell* LC) const;
    344     BoundaryLineSet * FindClosestBoundaryLineToVector(const Vector *x, const LinkedCell* LC) const;
     125    DistanceToPointMap * FindClosestBoundaryPointsToVector(const Vector &x, const LinkedCell* LC) const;
     126    BoundaryLineSet * FindClosestBoundaryLineToVector(const Vector &x, const LinkedCell* LC) const;
    345127
    346128    // print for debugging
  • src/tesselationhelpers.cpp

    r8d6d31 r8f4df1  
    1010#include <fstream>
    1111
     12#include "BoundaryLineSet.hpp"
     13#include "BoundaryPointSet.hpp"
     14#include "BoundaryPolygonSet.hpp"
     15#include "BoundaryTriangleSet.hpp"
     16#include "CandidateForTesselation.hpp"
    1217#include "Helpers/Info.hpp"
    1318#include "linkedcell.hpp"
     
    1823#include "LinearAlgebra/Vector.hpp"
    1924#include "LinearAlgebra/Line.hpp"
    20 #include "vector_ops.hpp"
     25#include "LinearAlgebra/vector_ops.hpp"
    2126#include "Helpers/Verbose.hpp"
    2227#include "LinearAlgebra/Plane.hpp"
     
    144149 * \param *c third point
    145150 */
    146 void GetCenterofCircumcircle(Vector * const Center, const Vector &a, const Vector &b, const Vector &c)
     151void GetCenterofCircumcircle(Vector &Center, const Vector &a, const Vector &b, const Vector &c)
    147152{
    148153        Info FunctionInfo(__func__);
     
    156161  helper[2] = SideC.NormSquared()*(SideA.NormSquared()+SideB.NormSquared() - SideC.NormSquared());
    157162
    158   Center->Zero();
    159   *Center += helper[0] * a;
    160   *Center += helper[1] * b;
    161   *Center += helper[2] * c;
    162   Center->Scale(1./(helper[0]+helper[1]+helper[2]));
    163   Log() << Verbose(1) << "INFO: Center (2nd algo) is at " << *Center << "." << endl;
     163  Center.Zero();
     164  Center += helper[0] * a;
     165  Center += helper[1] * b;
     166  Center += helper[2] * c;
     167  Center.Scale(1./(helper[0]+helper[1]+helper[2]));
     168  Log() << Verbose(1) << "INFO: Center (2nd algo) is at " << Center << "." << endl;
    164169};
    165170
     
    388393 * @return point which is second closest to the provided one
    389394 */
    390 TesselPoint* FindSecondClosestTesselPoint(const Vector* Point, const LinkedCell* const LC)
     395TesselPoint* FindSecondClosestTesselPoint(const Vector& Point, const LinkedCell* const LC)
    391396{
    392397        Info FunctionInfo(__func__);
     
    412417        if (List != NULL) {
    413418          for (LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
    414             helper = (*Point) - (*(*Runner)->node);
     419            helper = (Point) - ((*Runner)->getPosition());
    415420            double currentNorm = helper. Norm();
    416421            if (currentNorm < distance) {
     
    441446 * @return point which is closest to the provided one, NULL if none found
    442447 */
    443 TesselPoint* FindClosestTesselPoint(const Vector* Point, TesselPoint *&SecondPoint, const LinkedCell* const LC)
     448TesselPoint* FindClosestTesselPoint(const Vector& Point, TesselPoint *&SecondPoint, const LinkedCell* const LC)
    444449{
    445450        Info FunctionInfo(__func__);
     
    465470        if (List != NULL) {
    466471          for (LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
    467             helper = (*Point) - (*(*Runner)->node);
     472            helper = (Point) - ((*Runner)->getPosition());
    468473            double currentNorm = helper.NormSquared();
    469474            if (currentNorm < distance) {
     
    503508        Info FunctionInfo(__func__);
    504509  // construct the plane of the two baselines (i.e. take both their directional vectors)
    505   Vector Baseline = (*Base->endpoints[1]->node->node) - (*Base->endpoints[0]->node->node);
    506   Vector OtherBaseline = (*OtherBase->endpoints[1]->node->node) - (*OtherBase->endpoints[0]->node->node);
     510  Vector Baseline = (Base->endpoints[1]->node->getPosition()) - (Base->endpoints[0]->node->getPosition());
     511  Vector OtherBaseline = (OtherBase->endpoints[1]->node->getPosition()) - (OtherBase->endpoints[0]->node->getPosition());
    507512  Vector Normal = Baseline;
    508513  Normal.VectorProduct(OtherBaseline);
     
    511516
    512517  // project one offset point of OtherBase onto this plane (and add plane offset vector)
    513   Vector NewOffset = (*OtherBase->endpoints[0]->node->node) - (*Base->endpoints[0]->node->node);
     518  Vector NewOffset = (OtherBase->endpoints[0]->node->getPosition()) - (Base->endpoints[0]->node->getPosition());
    514519  NewOffset.ProjectOntoPlane(Normal);
    515   NewOffset += (*Base->endpoints[0]->node->node);
     520  NewOffset += (Base->endpoints[0]->node->getPosition());
    516521  Vector NewDirection = NewOffset + OtherBaseline;
    517522
    518523  // calculate the intersection between this projected baseline and Base
    519524  Vector *Intersection = new Vector;
    520   Line line1 = makeLineThrough(*(Base->endpoints[0]->node->node),*(Base->endpoints[1]->node->node));
     525  Line line1 = makeLineThrough((Base->endpoints[0]->node->getPosition()),(Base->endpoints[1]->node->getPosition()));
    521526  Line line2 = makeLineThrough(NewOffset, NewDirection);
    522527  *Intersection = line1.getIntersection(line2);
    523   Normal = (*Intersection) - (*Base->endpoints[0]->node->node);
     528  Normal = (*Intersection) - (Base->endpoints[0]->node->getPosition());
    524529  DoLog(1) && (Log() << Verbose(1) << "Found closest point on " << *Base << " at " << *Intersection << ", factor in line is " << fabs(Normal.ScalarProduct(Baseline)/Baseline.NormSquared()) << "." << endl);
    525530
     
    566571      *vrmlfile << "Sphere {" << endl << "  "; // 2 is sphere type
    567572      for (i=0;i<NDIM;i++)
    568         *vrmlfile << Walker->node->at(i)-center->at(i) << " ";
     573        *vrmlfile << Walker->at(i)-center->at(i) << " ";
    569574      *vrmlfile << "\t0.1\t1. 1. 1." << endl; // radius 0.05 and white as colour
    570575      cloud->GoToNext();
     
    576581      for (i=0;i<3;i++) { // print each node
    577582        for (int j=0;j<NDIM;j++)  // and for each node all NDIM coordinates
    578           *vrmlfile << TriangleRunner->second->endpoints[i]->node->node->at(j)-center->at(j) << " ";
     583          *vrmlfile << TriangleRunner->second->endpoints[i]->node->at(j)-center->at(j) << " ";
    579584        *vrmlfile << "\t";
    580585      }
     
    603608    Vector *center = cloud->GetCenter();
    604609    // make the circumsphere's center absolute again
    605     Vector helper = (1./3.) * ((*Tess->LastTriangle->endpoints[0]->node->node) +
    606                                (*Tess->LastTriangle->endpoints[1]->node->node) +
    607                                (*Tess->LastTriangle->endpoints[2]->node->node));
     610    Vector helper = (1./3.) * ((Tess->LastTriangle->endpoints[0]->node->getPosition()) +
     611                               (Tess->LastTriangle->endpoints[1]->node->getPosition()) +
     612                               (Tess->LastTriangle->endpoints[2]->node->getPosition()));
    608613    helper -= (*center);
    609614    // and add to file plus translucency object
     
    638643      *rasterfile << "2" << endl << "  ";  // 2 is sphere type
    639644      for (int j=0;j<NDIM;j++) { // and for each node all NDIM coordinates
    640         const double tmp = Walker->node->at(j)-center->at(j);
     645        const double tmp = Walker->at(j)-center->at(j);
    641646        *rasterfile << ((fabs(tmp) < MYEPSILON) ? 0 : tmp) << " ";
    642647      }
     
    651656      for (i=0;i<3;i++) {  // print each node
    652657        for (int j=0;j<NDIM;j++) { // and for each node all NDIM coordinates
    653           const double tmp = TriangleRunner->second->endpoints[i]->node->node->at(j)-center->at(j);
     658          const double tmp = TriangleRunner->second->endpoints[i]->node->at(j)-center->at(j);
    654659          *rasterfile << ((fabs(tmp) < MYEPSILON) ? 0 : tmp) << " ";
    655660        }
     
    705710      LookupList[Walker->nr] = Counter++;
    706711      for (int i=0;i<NDIM;i++) {
    707         const double tmp = Walker->node->at(i);
     712        const double tmp = Walker->at(i);
    708713        *tecplot << ((fabs(tmp) < MYEPSILON) ? 0 : tmp) << " ";
    709714      }
     
    754759    TriangleSet *triangles = TesselStruct->GetAllTriangles(PointRunner->second);
    755760    for (TriangleSet::iterator TriangleRunner = triangles->begin(); TriangleRunner != triangles->end(); ++TriangleRunner) {
    756       totalarea += CalculateAreaofGeneralTriangle(*(*TriangleRunner)->endpoints[0]->node->node, *(*TriangleRunner)->endpoints[1]->node->node, *(*TriangleRunner)->endpoints[2]->node->node);
     761      totalarea += CalculateAreaofGeneralTriangle((*TriangleRunner)->endpoints[0]->node->getPosition() , (*TriangleRunner)->endpoints[1]->node->getPosition() , (*TriangleRunner)->endpoints[2]->node->getPosition());
    757762    }
    758763    ConcavityPerLine *= totalarea;
     
    763768      line = (*TriangleRunner)->GetThirdLine(PointRunner->second);
    764769      triangle = line->GetOtherTriangle(*TriangleRunner);
    765       area = CalculateAreaofGeneralTriangle(*triangle->endpoints[0]->node->node, *triangle->endpoints[1]->node->node, *triangle->endpoints[2]->node->node);
    766       area += CalculateAreaofGeneralTriangle(*(*TriangleRunner)->endpoints[0]->node->node, *(*TriangleRunner)->endpoints[1]->node->node, *(*TriangleRunner)->endpoints[2]->node->node);
     770      area = CalculateAreaofGeneralTriangle(triangle->endpoints[0]->node->getPosition() , triangle->endpoints[1]->node->getPosition() , triangle->endpoints[2]->node->getPosition());
     771      area += CalculateAreaofGeneralTriangle((*TriangleRunner)->endpoints[0]->node->getPosition() , (*TriangleRunner)->endpoints[1]->node->getPosition() , (*TriangleRunner)->endpoints[2]->node->getPosition());
    767772      area *= -line->CalculateConvexity();
    768773      if (area > 0)
     
    797802    distance = 0.;
    798803    for (TriangleMap::const_iterator TriangleRunner = Convex->TrianglesOnBoundary.begin(); TriangleRunner != Convex->TrianglesOnBoundary.end(); TriangleRunner++) {
    799       const double CurrentDistance = Convex->GetDistanceSquaredToTriangle(*PointRunner->second->node->node, TriangleRunner->second);
     804      const double CurrentDistance = Convex->GetDistanceSquaredToTriangle(PointRunner->second->node->getPosition() , TriangleRunner->second);
    800805      if (CurrentDistance < distance)
    801806        distance = CurrentDistance;
  • src/tesselationhelpers.hpp

    r8d6d31 r8f4df1  
    2929class BoundaryLineSet;
    3030class BoundaryTriangleSet;
     31class BoundaryPolygonSet;
     32class CandidateForTesselation;
    3133class LinkedCell;
    3234class TesselPoint;
     
    3739/********************************************** definitions *********************************/
    3840
    39 #define HULLEPSILON 1e-9 //!< TODO: Get rid of HULLEPSILON, points to numerical instabilities
    40 
    4141/********************************************** declarations *******************************/
    4242
    43 void GetSphere(Vector * const Center, const Vector &a, const Vector &b, const Vector &c, const double RADIUS);
    44 void GetCenterOfSphere(Vector* const Center, const Vector &a, const Vector &b, const Vector &c, Vector * const NewUmkreismittelpunkt, const Vector* const Direction, const Vector* const AlternativeDirection, const double HalfplaneIndicator, const double AlternativeIndicator, const double alpha, const double beta, const double gamma, const double RADIUS, const double Umkreisradius);
    45 void GetCenterofCircumcircle(Vector * const Center, const Vector &a, const Vector &b, const Vector &c);
     43void GetSphere(Vector & Center, const Vector &a, const Vector &b, const Vector &c, const double RADIUS);
     44void GetCenterOfSphere(Vector& Center, const Vector &a, const Vector &b, const Vector &c, Vector &NewUmkreismittelpunkt, const Vector &Direction, const Vector* const AlternativeDirection, const double HalfplaneIndicator, const double AlternativeIndicator, const double alpha, const double beta, const double gamma, const double RADIUS, const double Umkreisradius);
     45void GetCenterofCircumcircle(Vector & Center, const Vector &a, const Vector &b, const Vector &c);
    4646double GetPathLengthonCircumCircle(const Vector &CircleCenter, const Vector &CirclePlaneNormal, const double CircleRadius, const Vector &NewSphereCenter, const Vector &OldSphereCenter, const Vector &NormalVector, const Vector &SearchDirection);
    4747double CalculateVolumeofGeneralTetraeder(const Vector &a, const Vector &b, const Vector &c, const Vector &d);
     
    5151bool CheckLineCriteriaForDegeneratedTriangle(const BoundaryPointSet * const nodes[3]);
    5252bool SortCandidates(const CandidateForTesselation* candidate1, const CandidateForTesselation *candidate2);
    53 TesselPoint* FindClosestTesselPoint(const Vector* Point, TesselPoint *&SecondPoint, const LinkedCell* const LC);
    54 TesselPoint* FindSecondClosestTesselPoint(const Vector*, const LinkedCell* const LC);
     53TesselPoint* FindClosestTesselPoint(const Vector & Point, TesselPoint *&SecondPoint, const LinkedCell* const LC);
     54TesselPoint* FindSecondClosestTesselPoint(const Vector &, const LinkedCell* const LC);
    5555Vector * GetClosestPointBetweenLine(const BoundaryLineSet * const Base, const BoundaryLineSet * const OtherBase);
    5656
     
    6161void CalculateConcavityPerBoundaryPoint(const Tesselation * const TesselStruct);
    6262void CalculateConstrictionPerBoundaryPoint(const Tesselation * const TesselStruct, const Tesselation * const Convex);
    63 double DistanceToTrianglePlane(const Vector *x, const BoundaryTriangleSet * const triangle);
     63double DistanceToTrianglePlane(const Vector &x, const BoundaryTriangleSet * const triangle);
    6464
    6565bool CheckListOfBaselines(const Tesselation * const TesselStruct);
  • src/triangleintersectionlist.cpp

    r8d6d31 r8f4df1  
    1616
    1717#include "Helpers/Info.hpp"
     18#include "BoundaryMaps.hpp"
     19#include "BoundaryPointSet.hpp"
     20#include "BoundaryLineSet.hpp"
     21#include "BoundaryTriangleSet.hpp"
    1822#include "tesselation.hpp"
    1923#include "LinearAlgebra/Vector.hpp"
     
    2327 *
    2428 */
    25 TriangleIntersectionList::TriangleIntersectionList(const Vector *x, const Tesselation *surface, const LinkedCell* LC) :
     29TriangleIntersectionList::TriangleIntersectionList(const Vector &x, const Tesselation *surface, const LinkedCell* LC) :
    2630  Point(x),
    2731  Tess(surface),
     
    7074  }
    7175  // return reference, if none can be found
    72   return *Point;
     76  return Point;
    7377};
    7478
     
    99103  if (runner != IntersectionList.end()) {
    100104    // if we have found one, check Scalarproduct between the vector
    101     Vector TestVector = (*Point) - (*(*runner).second);
     105    Vector TestVector = (Point) - (*(*runner).second);
    102106    if (fabs(TestVector.NormSquared()) < MYEPSILON) //
    103107      return true;
     
    138142    // get intersection with triangle plane
    139143    Intersection = new Vector;
    140     (*TriangleRunner)->GetClosestPointInsideTriangle(Point, Intersection);
    141     //Log() << Verbose(1) << "Intersection between " << *Point << " and " << **TriangleRunner << " is at " << *Intersection << "." << endl;
     144    (*TriangleRunner)->GetClosestPointInsideTriangle(Point, *Intersection);
     145    //Log() << Verbose(1) << "Intersection between " << Point << " and " << **TriangleRunner << " is at " << *Intersection << "." << endl;
    142146    IntersectionList.insert( pair<BoundaryTriangleSet *, Vector * > (*TriangleRunner, Intersection) );
    143147  }
     
    151155  if (DistanceList.empty())
    152156    for (TriangleVectorMap::const_iterator runner = IntersectionList.begin(); runner != IntersectionList.end(); runner++)
    153       DistanceList.insert( pair<double, BoundaryTriangleSet *> (Point->distance(*(*runner).second), (*runner).first) );
     157      DistanceList.insert( pair<double, BoundaryTriangleSet *> (Point.distance(*(*runner).second), (*runner).first) );
    154158
    155159  //for (DistanceTriangleMap::const_iterator runner = DistanceList.begin(); runner != DistanceList.end(); runner++)
  • src/triangleintersectionlist.hpp

    r8d6d31 r8f4df1  
    3939{
    4040public:
    41   TriangleIntersectionList(const Vector *x, const Tesselation *surface, const LinkedCell* LC);
     41  TriangleIntersectionList(const Vector &x, const Tesselation *surface, const LinkedCell* LC);
    4242  ~TriangleIntersectionList();
    4343
     
    5252  void FillDistanceList() const;
    5353
    54   const Vector *Point;
     54  const Vector &Point;
    5555  const Tesselation *Tess;
    5656  const LinkedCell *Vicinity;
  • src/unittests/AnalysisCorrelationToPointUnitTest.cpp

    r8d6d31 r8f4df1  
    5353  TestMolecule = World::getInstance().createMolecule();
    5454  Walker = World::getInstance().createAtom();
    55   Walker->type = hydrogen;
    56   *Walker->node = Vector(1., 0., 1. );
     55  Walker->setType(hydrogen);
     56  Walker->setPosition(Vector(1., 0., 1. ));
    5757  TestMolecule->AddAtom(Walker);
    5858  Walker = World::getInstance().createAtom();
    59   Walker->type = hydrogen;
    60   *Walker->node = Vector(0., 1., 1. );
     59  Walker->setType(hydrogen);
     60  Walker->setPosition(Vector(0., 1., 1. ));
    6161  TestMolecule->AddAtom(Walker);
    6262  Walker = World::getInstance().createAtom();
    63   Walker->type = hydrogen;
    64   *Walker->node = Vector(1., 1., 0. );
     63  Walker->setType(hydrogen);
     64  Walker->setPosition(Vector(1., 1., 0. ));
    6565  TestMolecule->AddAtom(Walker);
    6666  Walker = World::getInstance().createAtom();
    67   Walker->type = hydrogen;
    68   *Walker->node = Vector(0., 0., 0. );
     67  Walker->setType(hydrogen);
     68  Walker->setPosition(Vector(0., 0., 0. ));
    6969  TestMolecule->AddAtom(Walker);
    7070
  • src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp

    r8d6d31 r8f4df1  
    4444  ASSERT_DO(Assert::Throw);
    4545
     46  setVerbosity(5);
     47
    4648  atom *Walker = NULL;
    4749
     
    6264
    6365  Walker = World::getInstance().createAtom();
    64   Walker->type = hydrogen;
    65   *Walker->node = Vector(1., 0., 1. );
    66   TestSurfaceMolecule->AddAtom(Walker);
    67 
    68   Walker = World::getInstance().createAtom();
    69   Walker->type = hydrogen;
    70   *Walker->node = Vector(0., 1., 1. );
    71   TestSurfaceMolecule->AddAtom(Walker);
    72 
    73   Walker = World::getInstance().createAtom();
    74   Walker->type = hydrogen;
    75   *Walker->node = Vector(1., 1., 0. );
    76   TestSurfaceMolecule->AddAtom(Walker);
    77 
    78   Walker = World::getInstance().createAtom();
    79   Walker->type = hydrogen;
    80   *Walker->node = Vector(0., 0., 0. );
     66  Walker->setType(hydrogen);
     67  Walker->setPosition(Vector(1., 0., 1. ));
     68  TestSurfaceMolecule->AddAtom(Walker);
     69
     70  Walker = World::getInstance().createAtom();
     71  Walker->setType(hydrogen);
     72  Walker->setPosition(Vector(0., 1., 1. ));
     73  TestSurfaceMolecule->AddAtom(Walker);
     74
     75  Walker = World::getInstance().createAtom();
     76  Walker->setType(hydrogen);
     77  Walker->setPosition(Vector(1., 1., 0. ));
     78  TestSurfaceMolecule->AddAtom(Walker);
     79
     80  Walker = World::getInstance().createAtom();
     81  Walker->setType(hydrogen);
     82  Walker->setPosition(Vector(0., 0., 0. ));
    8183  TestSurfaceMolecule->AddAtom(Walker);
    8284
     
    9597  TestSurfaceMolecule = World::getInstance().createMolecule();
    9698  Walker = World::getInstance().createAtom();
    97   Walker->type = carbon;
    98   *Walker->node = Vector(4., 0., 4. );
    99   TestSurfaceMolecule->AddAtom(Walker);
    100 
    101   Walker = World::getInstance().createAtom();
    102   Walker->type = carbon;
    103   *Walker->node = Vector(0., 4., 4. );
    104   TestSurfaceMolecule->AddAtom(Walker);
    105 
    106   Walker = World::getInstance().createAtom();
    107   Walker->type = carbon;
    108   *Walker->node = Vector(4., 4., 0. );
     99  Walker->setType(carbon);
     100  Walker->setPosition(Vector(4., 0., 4. ));
     101  TestSurfaceMolecule->AddAtom(Walker);
     102
     103  Walker = World::getInstance().createAtom();
     104  Walker->setType(carbon);
     105  Walker->setPosition(Vector(0., 4., 4. ));
     106  TestSurfaceMolecule->AddAtom(Walker);
     107
     108  Walker = World::getInstance().createAtom();
     109  Walker->setType(carbon);
     110  Walker->setPosition(Vector(4., 4., 0. ));
    109111  TestSurfaceMolecule->AddAtom(Walker);
    110112
    111113  // add inner atoms
    112114  Walker = World::getInstance().createAtom();
    113   Walker->type = carbon;
    114   *Walker->node = Vector(0.5, 0.5, 0.5 );
     115  Walker->setType(carbon);
     116  Walker->setPosition(Vector(0.5, 0.5, 0.5 ));
    115117  TestSurfaceMolecule->AddAtom(Walker);
    116118
  • src/unittests/AnalysisPairCorrelationUnitTest.cpp

    r8d6d31 r8f4df1  
    5858  TestMolecule = World::getInstance().createMolecule();
    5959  Walker = World::getInstance().createAtom();
    60   Walker->type = hydrogen;
    61   *Walker->node = Vector(1., 0., 1. );
     60  Walker->setType(hydrogen);
     61  Walker->setPosition(Vector(1., 0., 1. ));
    6262  TestMolecule->AddAtom(Walker);
    6363  Walker = World::getInstance().createAtom();
    64   Walker->type = hydrogen;
    65   *Walker->node = Vector(0., 1., 1. );
     64  Walker->setType(hydrogen);
     65  Walker->setPosition(Vector(0., 1., 1. ));
    6666  TestMolecule->AddAtom(Walker);
    6767  Walker = World::getInstance().createAtom();
    68   Walker->type = hydrogen;
    69   *Walker->node = Vector(1., 1., 0. );
     68  Walker->setType(hydrogen);
     69  Walker->setPosition(Vector(1., 1., 0. ));
    7070  TestMolecule->AddAtom(Walker);
    7171  Walker = World::getInstance().createAtom();
    72   Walker->type = hydrogen;
    73   *Walker->node = Vector(0., 0., 0. );
     72  Walker->setType(hydrogen);
     73  Walker->setPosition(Vector(0., 0., 0. ));
    7474  TestMolecule->AddAtom(Walker);
    7575
  • src/unittests/CountBondsUnitTest.cpp

    r8d6d31 r8f4df1  
    5454  Walker = World::getInstance().createAtom();
    5555  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    56   Walker->type = hydrogen;
    57   *Walker->node = Vector(-0.2418, 0.9350, 0. );
     56  Walker->setType(hydrogen);
     57  Walker->setPosition(Vector(-0.2418, 0.9350, 0. ));
    5858  TestMolecule1->AddAtom(Walker);
    5959  Walker = World::getInstance().createAtom();
    6060  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    61   Walker->type = hydrogen;
    62   *Walker->node = Vector(0.9658, 0., 0. );
     61  Walker->setType(hydrogen);
     62  Walker->setPosition(Vector(0.9658, 0., 0. ));
    6363  TestMolecule1->AddAtom(Walker);
    6464  Walker = World::getInstance().createAtom();
    6565  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    66   Walker->type = oxygen;
    67   *Walker->node = Vector(0., 0., 0. );
     66  Walker->setType(oxygen);
     67  Walker->setPosition(Vector(0., 0., 0. ));
    6868  TestMolecule1->AddAtom(Walker);
    6969
     
    7272  Walker = World::getInstance().createAtom();
    7373  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    74   Walker->type = hydrogen;
    75   *Walker->node = Vector(-0.2418, 0.9350, 0. );
     74  Walker->setType(hydrogen);
     75  Walker->setPosition(Vector(-0.2418, 0.9350, 0. ));
    7676  TestMolecule2->AddAtom(Walker);
    7777  Walker = World::getInstance().createAtom();
    7878  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    79   Walker->type = hydrogen;
    80   *Walker->node = Vector(0.9658, 0., 0. );
     79  Walker->setType(hydrogen);
     80  Walker->setPosition(Vector(0.9658, 0., 0. ));
    8181  TestMolecule2->AddAtom(Walker);
    8282  Walker = World::getInstance().createAtom();
    8383  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    84   Walker->type = oxygen;
    85   *Walker->node = Vector(0., 0., 0. );
     84  Walker->setType(oxygen);
     85  Walker->setPosition(Vector(0., 0., 0. ));
    8686  TestMolecule2->AddAtom(Walker);
    8787
  • src/unittests/LinkedCellUnitTest.cpp

    r8d6d31 r8f4df1  
    5050        Walker = World::getInstance().createAtom();
    5151        CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    52         Walker->type = hydrogen;
    53         *Walker->node = Vector(x, y, z );
     52        Walker->setType(hydrogen);
     53        Walker->setPosition(Vector(x, y, z ));
    5454        TestMolecule->AddAtom(Walker);
    5555      }
     
    192192  atom *newAtom = World::getInstance().createAtom();
    193193  newAtom->setName("test");
    194   newAtom->x= Vector(1,1,1);
     194  newAtom->setPosition(Vector(1,1,1));
    195195  CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(newAtom) );
    196196  World::getInstance().destroyAtom(newAtom);
     
    199199  newAtom = World::getInstance().createAtom();
    200200  newAtom->setName("test");
    201   newAtom->x = Vector(0,-1,0);
     201  newAtom->setPosition(Vector(0,-1,0));
    202202  CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(newAtom) );
    203203  World::getInstance().destroyAtom(newAtom);
     
    216216      for (double z=0.5;z<3;z+=1.) {
    217217        tester = Vector(x,y,z);
    218         CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToVector(&tester) );
     218        CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToVector(tester) );
    219219      }
    220220  // check corners of each cell
     
    224224        tester= Vector(x,y,z);
    225225        cout << "Tester is at " << tester << "." << endl;
    226         CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToVector(&tester) );
     226        CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToVector(tester) );
    227227      }
    228228  // check out of bounds
     
    232232        tester = Vector(x,y,z);
    233233        cout << "The following test is supposed to fail and produce an ERROR." << endl;
    234         CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToVector(&tester) );
     234        CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToVector(tester) );
    235235      }
    236236  // check nonsense vectors
    237237  tester= Vector(-423598,3245978,29349);
    238238  cout << "The following test is supposed to fail and produce an ERROR." << endl;
    239   CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToVector(&tester) );
     239  CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToVector(tester) );
    240240};
    241241
     
    249249
    250250  tester= Vector(0.5,0.5,0.5);
    251   LC->SetIndexToVector(&tester);
     251  LC->SetIndexToVector(tester);
    252252  LC->GetNeighbourBounds(lower, upper);
    253253  for (int i=0;i<NDIM;i++)
     
    268268  // get all atoms
    269269  tester= Vector(1.5,1.5,1.5);
    270   CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(&tester) );
     270  CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) );
    271271  ListOfPoints = LC->GetallNeighbours();
    272272  size = ListOfPoints->size();
     
    285285  // get all atoms in one corner
    286286  tester= Vector(0.5, 0.5, 0.5);
    287   CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(&tester) );
     287  CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) );
    288288  ListOfPoints = LC->GetallNeighbours();
    289289  size=ListOfPoints->size();
    290290  CPPUNIT_ASSERT_EQUAL( (size_t)8, size );
    291291  for(molecule::iterator iter = TestMolecule->begin(); iter != TestMolecule->end(); ++iter){
    292     if (((*iter)->x[0] <2) && ((*iter)->x[1] <2) && ((*iter)->x[2] <2)) {
     292    if (((*iter)->at(0) <2) && ((*iter)->at(1) <2) && ((*iter)->at(2) <2)) {
    293293      ListOfPoints->remove(*iter);
    294294      size--;
     
    303303  // get all atoms from one corner
    304304  tester = Vector(0.5, 0.5, 0.5);
    305   CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(&tester) );
     305  CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) );
    306306  ListOfPoints = LC->GetallNeighbours(3);
    307307  size=ListOfPoints->size();
     
    329329  // get all points around central arom with radius 1.
    330330  tester= Vector(1.5,1.5,1.5);
    331   CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(&tester) );
     331  CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) );
    332332  ListOfPoints = LC->GetPointsInsideSphere(1., &tester);
    333333  size = ListOfPoints->size();
    334334  CPPUNIT_ASSERT_EQUAL( (size_t)7, size );
    335335  for(molecule::iterator iter = TestMolecule->begin(); iter!=TestMolecule->end();++iter){
    336     if (((*iter)->x.DistanceSquared(tester) - 1.) < MYEPSILON ) {
     336    if (((*iter)->DistanceSquared(tester) - 1.) < MYEPSILON ) {
    337337      ListOfPoints->remove(*iter);
    338338      size--;
  • src/unittests/ParserUnitTest.cpp

    r8d6d31 r8f4df1  
    208208  input << Tremolo_Atomdata2;
    209209  testParser->load(&input);
    210   CPPUNIT_ASSERT(World::getInstance().getAtom(AtomByType(1))->x[0] == 3.0);
     210  CPPUNIT_ASSERT(World::getInstance().getAtom(AtomByType(1))->at(0) == 3.0);
    211211  input.clear();
    212212}
     
    219219  input << Tremolo_velocity;
    220220  testParser->load(&input);
    221   CPPUNIT_ASSERT(World::getInstance().getAtom(AtomByType(1))->v[0] == 3.0);
     221  CPPUNIT_ASSERT(World::getInstance().getAtom(AtomByType(1))->AtomicVelocity[0] == 3.0);
    222222  input.clear();
    223223}
     
    271271  // with the maximum number of fields and minimal information, default values are printed
    272272  atom* newAtom = World::getInstance().createAtom();
    273   newAtom->type = World::getInstance().getPeriode()->FindElement(1);
     273  newAtom->setType(1);
    274274  testParser->setFieldsForSave("x=3 u=3 F stress Id neighbors=5 imprData GroupMeasureTypeNo Type extType name resName chainID resSeq occupancy tempFactor segID Charge charge GrpTypeNo torsion");
    275275  testParser->save(&output);
     
    304304  atom *Walker = NULL;
    305305  Walker = World::getInstance().createAtom();
    306   Walker->type = World::getInstance().getPeriode()->FindElement(8);
    307   Walker->x = Vector(0,0,0);
     306  Walker->setType(8);
     307  Walker->setPosition(Vector(0,0,0));
    308308  Walker = World::getInstance().createAtom();
    309   Walker->type = World::getInstance().getPeriode()->FindElement(1);
    310   Walker->x = Vector(0.758602,0,0.504284);
     309  Walker->setType(1);
     310  Walker->setPosition(Vector(0.758602,0,0.504284));
    311311  Walker = World::getInstance().createAtom();
    312   Walker->type = World::getInstance().getPeriode()->FindElement(1);
    313   Walker->x = Vector(0.758602,0,-0.504284);
     312  Walker->setType(1);
     313  Walker->setPosition(Vector(0.758602,0,-0.504284));
    314314  CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms());
    315315
  • src/unittests/analysisbondsunittest.cpp

    r8d6d31 r8f4df1  
    1616#include <cstring>
    1717
    18 #include "World.hpp"
    1918#include "analysis_bonds.hpp"
    2019#include "analysisbondsunittest.hpp"
     
    2524#include "molecule.hpp"
    2625#include "periodentafel.hpp"
     26#include "LinearAlgebra/Vector.hpp"
    2727#include "World.hpp"
    2828
     
    5252  Walker = World::getInstance().createAtom();
    5353  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    54   Walker->type = hydrogen;
    55   *Walker->node = Vector(1.5, 0., 1.5 );
     54  Walker->setType(hydrogen);
     55  Walker->setPosition(Vector(1.5, 0., 1.5 ));
    5656  TestMolecule->AddAtom(Walker);
    5757  Walker = World::getInstance().createAtom();
    5858  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    59   Walker->type = hydrogen;
    60   *Walker->node = Vector(0., 1.5, 1.5 );
     59  Walker->setType(hydrogen);
     60  Walker->setPosition(Vector(0., 1.5, 1.5 ));
    6161  TestMolecule->AddAtom(Walker);
    6262  Walker = World::getInstance().createAtom();
    6363  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    64   Walker->type = hydrogen;
    65   *Walker->node = Vector(1.5, 1.5, 0. );
     64  Walker->setType(hydrogen);
     65  Walker->setPosition(Vector(1.5, 1.5, 0. ));
    6666  TestMolecule->AddAtom(Walker);
    6767  Walker = World::getInstance().createAtom();
    6868  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    69   Walker->type = hydrogen;
    70   *Walker->node = Vector(0., 0., 0. );
     69  Walker->setType(hydrogen);
     70  Walker->setPosition(Vector(0., 0., 0. ));
    7171  TestMolecule->AddAtom(Walker);
    7272  Walker = World::getInstance().createAtom();
    7373  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    74   Walker->type = carbon;
    75   *Walker->node = Vector(0.5, 0.5, 0.5 );
     74  Walker->setType(carbon);
     75  Walker->setPosition(Vector(0.5, 0.5, 0.5 ));
    7676  TestMolecule->AddAtom(Walker);
    7777
  • src/unittests/bondgraphunittest.cpp

    r8d6d31 r8f4df1  
    5454  Walker = World::getInstance().createAtom();
    5555  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    56   Walker->type = carbon;
    57   *Walker->node = Vector(1., 0., 1. );
     56  Walker->setType(carbon);
     57  Walker->setPosition(Vector(1., 0., 1. ));
    5858  TestMolecule->AddAtom(Walker);
    5959
    6060  Walker = World::getInstance().createAtom();
    6161  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    62   Walker->type = carbon;
    63   *Walker->node = Vector(0., 1., 1. );
     62  Walker->setType(carbon);
     63  Walker->setPosition(Vector(0., 1., 1. ));
    6464  TestMolecule->AddAtom(Walker);
    6565
    6666  Walker = World::getInstance().createAtom();
    6767  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    68   Walker->type = carbon;
    69   *Walker->node = Vector(1., 1., 0. );
     68  Walker->setType(carbon);
     69  Walker->setPosition(Vector(1., 1., 0. ));
    7070  TestMolecule->AddAtom(Walker);
    7171
    7272  Walker = World::getInstance().createAtom();
    7373  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    74   Walker->type = carbon;
    75   *Walker->node = Vector(0., 0., 0. );
     74  Walker->setType(carbon);
     75  Walker->setPosition(Vector(0., 0., 0. ));
    7676  TestMolecule->AddAtom(Walker);
    7777
  • src/unittests/listofbondsunittest.cpp

    r8d6d31 r8f4df1  
    4747  Walker = World::getInstance().createAtom();
    4848  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    49   Walker->type = hydrogen;
    50   *Walker->node = Vector(1., 0., 1. );
    51   TestMolecule->AddAtom(Walker);
    52   Walker = World::getInstance().createAtom();
    53   CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    54   Walker->type = hydrogen;
    55   *Walker->node = Vector(0., 1., 1. );
    56   TestMolecule->AddAtom(Walker);
    57   Walker = World::getInstance().createAtom();
    58   CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    59   Walker->type = hydrogen;
    60   *Walker->node = Vector(1., 1., 0. );
    61   TestMolecule->AddAtom(Walker);
    62   Walker = World::getInstance().createAtom();
    63   CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
    64   Walker->type = hydrogen;
    65   *Walker->node = Vector(0., 0., 0. );
     49  Walker->setType(hydrogen);
     50  Walker->setPosition(Vector(1., 0., 1. ));
     51  TestMolecule->AddAtom(Walker);
     52  Walker = World::getInstance().createAtom();
     53  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
     54  Walker->setType(hydrogen);
     55  Walker->setPosition(Vector(0., 1., 1. ));
     56  TestMolecule->AddAtom(Walker);
     57  Walker = World::getInstance().createAtom();
     58  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
     59  Walker->setType(hydrogen);
     60  Walker->setPosition(Vector(1., 1., 0. ));
     61  TestMolecule->AddAtom(Walker);
     62  Walker = World::getInstance().createAtom();
     63  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
     64  Walker->setType(hydrogen);
     65  Walker->setPosition(Vector(0., 0., 0. ));
    6666  TestMolecule->AddAtom(Walker);
    6767
  • src/unittests/tesselation_boundarytriangleunittest.cpp

    r8d6d31 r8f4df1  
    1313
    1414#include <cstring>
     15#include <iostream>
    1516
    1617#include "defs.hpp"
    17 #include "tesselation.hpp"
     18#include "TesselPoint.hpp"
     19#include "BoundaryPointSet.hpp"
     20#include "BoundaryLineSet.hpp"
     21#include "BoundaryTriangleSet.hpp"
     22#include "CandidateForTesselation.hpp"
    1823#include "tesselation_boundarytriangleunittest.hpp"
    1924
     
    3641  // create nodes
    3742  tesselpoints[0] = new TesselPoint;
    38   tesselpoints[0]->node = new Vector(0., 0., 0.);
     43  tesselpoints[0]->setPosition(Vector(0., 0., 0.));
    3944  tesselpoints[0]->setName("1");
    4045  tesselpoints[0]->nr = 1;
    4146  points[0] = new BoundaryPointSet(tesselpoints[0]);
    4247  tesselpoints[1] = new TesselPoint;
    43   tesselpoints[1]->node = new Vector(0., 1., 0.);
     48  tesselpoints[1]->setPosition(Vector(0., 1., 0.));
    4449  tesselpoints[1]->setName("2");
    4550  tesselpoints[1]->nr = 2;
    4651  points[1] = new BoundaryPointSet(tesselpoints[1]);
    4752  tesselpoints[2] = new TesselPoint;
    48   tesselpoints[2]->node = new Vector(1., 0., 0.);
     53  tesselpoints[2]->setPosition(Vector(1., 0., 0.));
    4954  tesselpoints[2]->setName("3");
    5055  tesselpoints[2]->nr = 3;
     
    6772  for (int i=0;i<3;++i) {
    6873    // TesselPoint does not delete its vector as it only got a reference
    69     delete tesselpoints[i]->node;
    7074    delete tesselpoints[i];
    7175  }
     
    8387  // simple test on y line
    8488  Point = Vector(-1.,0.5,0.);
    85   CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     89  CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    8690  Point = Vector(0.,0.5,0.);
    8791  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
    8892  Point = Vector(-4.,0.5,0.);
    89   CPPUNIT_ASSERT_EQUAL( 16., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     93  CPPUNIT_ASSERT_EQUAL( 16., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    9094  Point = Vector(0.,0.5,0.);
    9195  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    9397  // simple test on x line
    9498  Point = Vector(0.5,-1.,0.);
    95   CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     99  CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    96100  Point = Vector(0.5,0.,0.);
    97101  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
    98102  Point = Vector(0.5,-6.,0.);
    99   CPPUNIT_ASSERT_EQUAL( 36., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     103  CPPUNIT_ASSERT_EQUAL( 36., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    100104  Point = Vector(0.5,0.,0.);
    101105  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    103107  // simple test on slanted line
    104108  Point = Vector(1.,1.,0.);
    105   CPPUNIT_ASSERT_EQUAL( 0.5, triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     109  CPPUNIT_ASSERT_EQUAL( 0.5, triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    106110  Point = Vector(0.5,0.5,0.);
    107111  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
    108112  Point = Vector(5.,5.,0.);
    109   CPPUNIT_ASSERT_EQUAL( 40.5, triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     113  CPPUNIT_ASSERT_EQUAL( 40.5, triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    110114  Point = Vector(0.5,0.5,0.);
    111115  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    113117  // simple test on first node
    114118  Point = Vector(-1.,-1.,0.);
    115   CPPUNIT_ASSERT_EQUAL( 2., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     119  CPPUNIT_ASSERT_EQUAL( 2., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    116120  Point = Vector(0.,0.,0.);
    117121  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    119123  // simple test on second node
    120124  Point = Vector(0.,2.,0.);
    121   CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     125  CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    122126  Point = Vector(0.,1.,0.);
    123127  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    125129  // simple test on third node
    126130  Point = Vector(2.,0.,0.);
    127   CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     131  CPPUNIT_ASSERT_EQUAL( 1., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    128132  Point = Vector(1.,0.,0.);
    129133  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    139143  // straight down/up
    140144  Point = Vector(1./3.,1./3.,+5.);
    141   CPPUNIT_ASSERT_EQUAL( 25. , triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     145  CPPUNIT_ASSERT_EQUAL( 25. , triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    142146  Point = Vector(1./3.,1./3.,0.);
    143147  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
    144148  Point = Vector(1./3.,1./3.,-5.);
    145   CPPUNIT_ASSERT_EQUAL( 25. , triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     149  CPPUNIT_ASSERT_EQUAL( 25. , triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    146150  Point = Vector(1./3.,1./3.,0.);
    147151  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    149153  // simple test on y line
    150154  Point = Vector(-1.,0.5,+2.);
    151   CPPUNIT_ASSERT_EQUAL( 5., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     155  CPPUNIT_ASSERT_EQUAL( 5., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    152156  Point = Vector(0.,0.5,0.);
    153157  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
    154158  Point = Vector(-1.,0.5,-3.);
    155   CPPUNIT_ASSERT_EQUAL( 10., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     159  CPPUNIT_ASSERT_EQUAL( 10., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    156160  Point = Vector(0.,0.5,0.);
    157161  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    159163  // simple test on x line
    160164  Point = Vector(0.5,-1.,+1.);
    161   CPPUNIT_ASSERT_EQUAL( 2., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     165  CPPUNIT_ASSERT_EQUAL( 2., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    162166  Point = Vector(0.5,0.,0.);
    163167  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
    164168  Point = Vector(0.5,-1.,-2.);
    165   CPPUNIT_ASSERT_EQUAL( 5., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     169  CPPUNIT_ASSERT_EQUAL( 5., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    166170  Point = Vector(0.5,0.,0.);
    167171  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    169173  // simple test on slanted line
    170174  Point = Vector(1.,1.,+3.);
    171   CPPUNIT_ASSERT_EQUAL( 9.5, triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     175  CPPUNIT_ASSERT_EQUAL( 9.5, triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    172176  Point = Vector(0.5,0.5,0.);
    173177  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
    174178  Point = Vector(1.,1.,-4.);
    175   CPPUNIT_ASSERT_EQUAL( 16.5, triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     179  CPPUNIT_ASSERT_EQUAL( 16.5, triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    176180  Point = Vector(0.5,0.5,0.);
    177181  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    179183  // simple test on first node
    180184  Point = Vector(-1.,-1.,5.);
    181   CPPUNIT_ASSERT_EQUAL( 27., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     185  CPPUNIT_ASSERT_EQUAL( 27., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    182186  Point = Vector(0.,0.,0.);
    183187  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    185189  // simple test on second node
    186190  Point = Vector(0.,2.,5.);
    187   CPPUNIT_ASSERT_EQUAL( 26., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     191  CPPUNIT_ASSERT_EQUAL( 26., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    188192  Point = Vector(0.,1.,0.);
    189193  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
     
    191195  // simple test on third node
    192196  Point = Vector(2.,0.,5.);
    193   CPPUNIT_ASSERT_EQUAL( 26., triangle->GetClosestPointInsideTriangle(&Point, &TestIntersection) );
     197  CPPUNIT_ASSERT_EQUAL( 26., triangle->GetClosestPointInsideTriangle(Point, TestIntersection) );
    194198  Point = Vector(1.,0.,0.);
    195199  CPPUNIT_ASSERT_EQUAL( true , Point == TestIntersection );
  • src/unittests/tesselation_boundarytriangleunittest.hpp

    r8d6d31 r8f4df1  
    1515#include "linkedcell.hpp"
    1616#include "tesselation.hpp"
     17
     18class TesselPoint;
    1719
    1820/********************************************** Test classes **************************************/
  • src/unittests/tesselation_insideoutsideunittest.cpp

    r8d6d31 r8f4df1  
    1313
    1414#include <cstring>
     15#include <iostream>
    1516
    1617#include "defs.hpp"
    17 #include "tesselation.hpp"
     18#include "TesselPoint.hpp"
     19#include "BoundaryLineSet.hpp"
     20#include "BoundaryTriangleSet.hpp"
     21#include "CandidateForTesselation.hpp"
    1822#include "tesselation_insideoutsideunittest.hpp"
    1923#include "Helpers/Verbose.hpp"
     
    3034CPPUNIT_TEST_SUITE_REGISTRATION( TesselationInOutsideTest );
    3135
    32 
    3336void TesselationInOutsideTest::setUp()
    3437{
     
    3841  class TesselPoint *Walker;
    3942  Walker = new TesselPoint;
    40   Walker->node = new Vector(0., 0., 0.);
     43  Walker->setPosition(Vector(0., 0., 0.));
    4144  Walker->setName("1");
    4245  Walker->nr = 1;
    4346  Corners.push_back(Walker);
    4447  Walker = new TesselPoint;
    45   Walker->node = new Vector(0., 1., 0.);
     48  Walker->setPosition(Vector(0., 1., 0.));
    4649  Walker->setName("2");
    4750  Walker->nr = 2;
    4851  Corners.push_back(Walker);
    4952  Walker = new TesselPoint;
    50   Walker->node = new Vector(1., 0., 0.);
     53  Walker->setPosition(Vector(1., 0., 0.));
    5154  Walker->setName("3");
    5255  Walker->nr = 3;
    5356  Corners.push_back(Walker);
    5457  Walker = new TesselPoint;
    55   Walker->node = new Vector(1., 1., 0.);
     58  Walker->setPosition(Vector(1., 1., 0.));
    5659  Walker->setName("4");
    5760  Walker->nr = 4;
    5861  Corners.push_back(Walker);
    5962  Walker = new TesselPoint;
    60   Walker->node = new Vector(0., 0., 1.);
     63  Walker->setPosition(Vector(0., 0., 1.));
    6164  Walker->setName("5");
    6265  Walker->nr = 5;
    6366  Corners.push_back(Walker);
    6467  Walker = new TesselPoint;
    65   Walker->node = new Vector(0., 1., 1.);
     68  Walker->setPosition(Vector(0., 1., 1.));
    6669  Walker->setName("6");
    6770  Walker->nr = 6;
    6871  Corners.push_back(Walker);
    6972  Walker = new TesselPoint;
    70   Walker->node = new Vector(1., 0., 1.);
     73  Walker->setPosition(Vector(1., 0., 1.));
    7174  Walker->setName("7");
    7275  Walker->nr = 7;
    7376  Corners.push_back(Walker);
    7477  Walker = new TesselPoint;
    75   Walker->node = new Vector(1., 1., 1.);
     78  Walker->setPosition(Vector(1., 1., 1.));
    7679  Walker->setName("8");
    7780  Walker->nr = 8;
     
    130133  delete(LinkedList);
    131134  delete(TesselStruct);
    132   for (LinkedCell::LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++) {
    133     delete((*Runner)->node);
     135  for (LinkedCell::LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++)
    134136    delete(*Runner);
    135   }
    136137  Corners.clear();
    137138  logger::purgeInstance();
  • src/unittests/tesselationunittest.cpp

    r8d6d31 r8f4df1  
    1616
    1717#include "defs.hpp"
    18 #include "tesselation.hpp"
     18#include "TesselPoint.hpp"
     19#include "BoundaryLineSet.hpp"
     20#include "BoundaryTriangleSet.hpp"
     21#include "CandidateForTesselation.hpp"
    1922#include "tesselationunittest.hpp"
    2023
     
    3639  class TesselPoint *Walker;
    3740  Walker = new TesselPoint;
    38   Walker->node = new Vector(1., 0., -1.);
     41  Walker->setPosition(Vector(1., 0., -1.));
    3942  Walker->setName("1");
    4043  Walker->nr = 1;
    4144  Corners.push_back(Walker);
    4245  Walker = new TesselPoint;
    43   Walker->node = new Vector(-1., 1., -1.);
     46  Walker->setPosition(Vector(-1., 1., -1.));
    4447  Walker->setName("2");
    4548  Walker->nr = 2;
    4649  Corners.push_back(Walker);
    4750  Walker = new TesselPoint;
    48   Walker->node = new Vector(-1., -1., -1.);
     51  Walker->setPosition(Vector(-1., -1., -1.));
    4952  Walker->setName("3");
    5053  Walker->nr = 3;
    5154  Corners.push_back(Walker);
    5255  Walker = new TesselPoint;
    53   Walker->node = new Vector(-1., 0., 1.);
     56  Walker->setPosition(Vector(-1., 0., 1.));
    5457  Walker->setName("4");
    5558  Walker->nr = 4;
     
    101104  delete(LinkedList);
    102105  delete(TesselStruct);
    103   for (LinkedCell::LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++) {
    104     delete((*Runner)->node);
     106  for (LinkedCell::LinkedNodes::iterator Runner = Corners.begin(); Runner != Corners.end(); Runner++)
    105107    delete(*Runner);
    106   }
    107108  Corners.clear();
    108109  logger::purgeInstance();
  • src/unittests/vectorunittest.cpp

    r8d6d31 r8f4df1  
    1616#include "Helpers/Log.hpp"
    1717#include "LinearAlgebra/Vector.hpp"
    18 #include "vector_ops.hpp"
     18#include "LinearAlgebra/vector_ops.hpp"
    1919#include "vectorunittest.hpp"
    2020#include "LinearAlgebra/Plane.hpp"
     
    5252  errorLogger::purgeInstance();
    5353};
     54
     55/** UnitTest for Constructors and Vector::IsZero() and Vector::IsOne().
     56 */
     57void VectorTest::AssignmentTest()
     58{
     59  // test with zero
     60  zero.at(0) = 0;
     61  zero.at(1) = 0;
     62  zero.at(2) = 0;
     63  double zero_array[3] = {0., 0., 0.};
     64
     65  CPPUNIT_ASSERT_EQUAL( zero, Vector(0,0,0));
     66  CPPUNIT_ASSERT_EQUAL( zero, Vector(0.,0.,0.));
     67  CPPUNIT_ASSERT_EQUAL( zero, Vector(zero_array[0], zero_array[1], zero_array[2]));
     68  CPPUNIT_ASSERT_EQUAL( zero, Vector(zero_array));
     69
     70  // test with unit
     71  unit.at(0) = 1;
     72  unit.at(1) = 0;
     73  unit.at(2) = 0;
     74  double unit_array[3] = {1., 0., 0.};
     75
     76  CPPUNIT_ASSERT_EQUAL( unit, Vector(1,0,0));
     77  CPPUNIT_ASSERT_EQUAL( unit, Vector(1.,0.,0.));
     78  CPPUNIT_ASSERT_EQUAL( unit, Vector(unit_array[0], unit_array[1], unit_array[2]));
     79  CPPUNIT_ASSERT_EQUAL( unit, Vector(unit_array));
     80
     81  // test with two
     82  two.at(0) = 2;
     83  two.at(1) = 1;
     84  two.at(2) = 0;
     85  double two_array[3] = {2., 1., 0.};
     86
     87  CPPUNIT_ASSERT_EQUAL( two, Vector(2,1,0));
     88  CPPUNIT_ASSERT_EQUAL( two, Vector(2.,1.,0.));
     89  CPPUNIT_ASSERT_EQUAL( two, Vector(two_array[0], two_array[1], two_array[2]));
     90  CPPUNIT_ASSERT_EQUAL( two, Vector(two_array));
     91
     92  // test with three
     93  three.at(0) = 1;
     94  three.at(1) = 2;
     95  three.at(2) = 3;
     96  double three_array[3] = {1., 2., 3.};
     97
     98  CPPUNIT_ASSERT_EQUAL( three, Vector(1,2,3));
     99  CPPUNIT_ASSERT_EQUAL( three, Vector(1.,2.,3.));
     100  CPPUNIT_ASSERT_EQUAL( three, Vector(three_array[0], three_array[1], three_array[2]));
     101  CPPUNIT_ASSERT_EQUAL( three, Vector(three_array));
     102}
    54103
    55104/** UnitTest for Constructors and Vector::IsZero() and Vector::IsOne().
  • src/unittests/vectorunittest.hpp

    r8d6d31 r8f4df1  
    1818{
    1919    CPPUNIT_TEST_SUITE( VectorTest) ;
     20    CPPUNIT_TEST ( AssignmentTest );
    2021    CPPUNIT_TEST ( UnityTest );
    2122    CPPUNIT_TEST ( SimpleAlgebraTest );
     
    3334    void tearDown();
    3435
     36    void AssignmentTest();
    3537    void UnityTest();
    3638    void OperatorAlgebraTest();
Note: See TracChangeset for help on using the changeset viewer.