Changes in / [3a0b38:5ae39c]


Ignore:
Files:
7 added
52 edited

Legend:

Unmodified
Added
Removed
  • src/Makefile.am

    r3a0b38 r5ae39c  
    55ANALYSISHEADER = analysis_bonds.hpp analysis_correlation.hpp
    66
    7 SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp leastsquaremin.cpp linkedcell.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp
    8 HEADER = ${ANALYSISHEADER} ${ATOMHEADER} bond.hpp bondgraph.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp errorlogger.hpp graph.hpp helpers.hpp leastsquaremin.hpp linkedcell.hpp lists.hpp log.hpp logger.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp
     7SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp info.cpp leastsquaremin.cpp linkedcell.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp
     8HEADER = ${ANALYSISHEADER} ${ATOMHEADER} bond.hpp bondgraph.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp errorlogger.hpp graph.hpp helpers.hpp info.hpp leastsquaremin.hpp linkedcell.hpp lists.hpp log.hpp logger.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp
    99
    1010BOOST_LIB = $(BOOST_LDFLAGS) $(BOOST_MPL_LIB)
  • src/analysis_correlation.hpp

    r3a0b38 r5ae39c  
    7272  if (map == NULL) {
    7373    eLog() << Verbose(0) << "Nothing to min/max, map is NULL!" << endl;
     74    performCriticalExit();
    7475    return;
    7576  }
     
    107108  if (map == NULL) {
    108109    eLog() << Verbose(0) << "Nothing to bin, is NULL!" << endl;
     110    performCriticalExit();
    109111    return outmap;
    110112  }
  • src/analyzer.cpp

    r3a0b38 r5ae39c  
    9494  if (!Hcorrection.ParseFragmentMatrix(argv[1], "", HCORRECTIONSUFFIX,0,0)) {
    9595    NoHCorrection = true;
    96     Log() << Verbose(0) << "No HCorrection file found, skipping these." << endl;
     96    eLog() << Verbose(2) << "No HCorrection file found, skipping these." << endl;
    9797  }
    9898 
     
    100100  if (!Hessian.ParseFragmentMatrix(argv[1], dir, HessianSuffix,0,0)) {
    101101    NoHessian = true;
    102     Log() << Verbose(0) << "No Hessian file found, skipping these." << endl;
     102    eLog() << Verbose(2) << "No Hessian file found, skipping these." << endl;
    103103  }
    104104  if (!Time.ParseFragmentMatrix(argv[1], dir, TimeSuffix, 10,1)) {
    105105    NoTime = true;
    106     Log() << Verbose(0) << "No speed file found, skipping these." << endl;
     106    eLog() << Verbose(2) << "No speed file found, skipping these." << endl;
    107107  }
    108108  if (periode != NULL) { // also look for PAS values
  • src/atom_bondedparticle.cpp

    r3a0b38 r5ae39c  
    4444void BondedParticle::OutputBondOfAtom() const
    4545{
    46   Log() << Verbose(4) << "Atom " << Name << "/" << nr << " with " << ListOfBonds.size() << " bonds: ";
     46  Log() << Verbose(4) << "Atom " << Name << "/" << nr << " with " << ListOfBonds.size() << " bonds: " << endl;
    4747  int TotalDegree = 0;
    4848  for (BondList::const_iterator Runner = ListOfBonds.begin(); Runner != ListOfBonds.end(); ++Runner) {
    49     Log() << Verbose(0) << **Runner << "\t";
     49    Log() << Verbose(4) << **Runner << endl;
    5050    TotalDegree += (*Runner)->BondDegree;
    5151  }
    52   Log() << Verbose(0) << " -- TotalDegree: " << TotalDegree << endl;
     52  Log() << Verbose(4) << " -- TotalDegree: " << TotalDegree << endl;
    5353};
    5454
     
    7575      status = true;
    7676    } else {
    77       Log() << Verbose(1) << "ERROR: " << *Binder << " does not contain " << *this << "." << endl;
     77      eLog() << Verbose(1) << *Binder << " does not contain " << *this << "." << endl;
    7878    }
    7979  } else {
    80     Log() << Verbose(1) << "ERROR: Binder is " << Binder << "." << endl;
     80    eLog() << Verbose(1) << "Binder is " << Binder << "." << endl;
    8181  }
    8282  return status;
     
    9494      status = true;
    9595    } else {
    96       Log() << Verbose(1) << "ERROR: " << *Binder << " does not contain " << *this << "." << endl;
     96      eLog() << Verbose(1) << *Binder << " does not contain " << *this << "." << endl;
    9797    }
    9898  } else {
    99     Log() << Verbose(1) << "ERROR: Binder is " << Binder << "." << endl;
     99    eLog() << Verbose(1) << "Binder is " << Binder << "." << endl;
    100100  }
    101101  return status;
     
    121121  bond *CandidateBond = NULL;
    122122
     123  NoBonds = CountBonds();
    123124  //Log() << Verbose(3) << "Walker " << *this << ": " << (int)this->type->NoValenceOrbitals << " > " << NoBonds << "?" << endl;
    124   NoBonds = CountBonds();
    125125  if ((int)(type->NoValenceOrbitals) > NoBonds) { // we have a mismatch, check all bonding partners for mismatch
    126126    for (BondList::const_iterator Runner = ListOfBonds.begin(); Runner != ListOfBonds.end(); (++Runner)) {
    127127      OtherWalker = (*Runner)->GetOtherAtom(this);
    128128      OtherNoBonds = OtherWalker->CountBonds();
    129       //Log() << Verbose(3) << "OtherWalker " << *OtherWalker << ": " << (int)OtherWalker->type->NoValenceOrbitals << " > " << NoBonds << "?" << endl;
    130       if ((int)(OtherWalker->type->NoValenceOrbitals) > NoBonds) { // check if possible candidate
     129      //Log() << Verbose(3) << "OtherWalker " << *OtherWalker << ": " << (int)OtherWalker->type->NoValenceOrbitals << " > " << OtherNoBonds << "?" << endl;
     130      if ((int)(OtherWalker->type->NoValenceOrbitals) > OtherNoBonds) { // check if possible candidate
    131131        if ((CandidateBond == NULL) || (ListOfBonds.size() > OtherWalker->ListOfBonds.size())) { // pick the one with fewer number of bonds first
    132132          CandidateBond = (*Runner);
     
    137137    if ((CandidateBond != NULL)) {
    138138      CandidateBond->BondDegree++;
    139       Log() << Verbose(2) << "Increased bond degree for bond " << *CandidateBond << "." << endl;
     139      //Log() << Verbose(2) << "Increased bond degree for bond " << *CandidateBond << "." << endl;
    140140    } else {
    141       //Log() << Verbose(2) << "Could not find correct degree for atom " << *this << "." << endl;
     141      eLog() << Verbose(2) << "Could not find correct degree for atom " << *this << "." << endl;
    142142      FalseBondDegree++;
    143143    }
  • src/atom_graphnode.cpp

    r3a0b38 r5ae39c  
    2929  Log() << Verbose(2) << "Atom " << Name << " is " << ((SeparationVertex) ? "a" : "not a") << " separation vertex, components are ";
    3030  OutputComponentNumber();
    31   Log() << Verbose(0) << " with Lowpoint " << LowpointNr << " and Graph Nr. " << GraphNr << "." << endl;
     31  Log() << Verbose(3) << " with Lowpoint " << LowpointNr << " and Graph Nr. " << GraphNr << "." << endl;
    3232};
    3333
     
    4040  if (ComponentNr != NULL) {
    4141    for (int i=0; ComponentNr[i] != -1; i++)
    42       Log() << Verbose(0) << ComponentNr[i] << " ";
     42      Log() << Verbose(2) << ComponentNr[i] << " ";
    4343  }
    4444};
  • src/atom_trajectoryparticle.cpp

    r3a0b38 r5ae39c  
    203203        U[d] = gsl_ran_gaussian (r, sigma);
    204204      }
    205       Log() << Verbose(0) << sqrt(U[0]*U[0]+U[1]*U[1]+U[2]*U[2]) << endl;
     205      Log() << Verbose(2) << sqrt(U[0]*U[0]+U[1]*U[1]+U[2]*U[2]) << endl;
    206206    }
    207207    for (int d=0; d<NDIM; d++)
  • src/bond.cpp

    r3a0b38 r5ae39c  
    6363  if(rightatom == Atom)
    6464    return leftatom;
    65   eLog() << Verbose(0) << "Bond " << *this << " does not contain atom " << *Atom << "!" << endl;
     65  eLog() << Verbose(1) << "Bond " << *this << " does not contain atom " << *Atom << "!" << endl;
    6666  return NULL;
    6767};
     
    9999bool bond::MarkUsed(const enum Shading color) {
    100100  if (Used == black) {
    101     eLog() << Verbose(0) << "ERROR: Bond " << this << " was already marked black!." << endl;
     101    eLog() << Verbose(1) << "Bond " << this << " was already marked black!." << endl;
    102102    return false;
    103103  } else {
  • src/bondgraph.cpp

    r3a0b38 r5ae39c  
    153153{
    154154  if (BondLengthMatrix == NULL) {// safety measure if no matrix has been parsed yet
    155     eLog() << Verbose(1) << "WARNING:  BondLengthMatrixMinMaxDistance() called without having parsed the bond length matrix yet!" << endl;
     155    eLog() << Verbose(2) << "BondLengthMatrixMinMaxDistance() called without having parsed the bond length matrix yet!" << endl;
    156156    CovalentMinMaxDistance(Walker, OtherWalker, MinDistance, MaxDistance, IsAngstroem);
    157157  } else {
  • src/boundary.cpp

    r3a0b38 r5ae39c  
    1010#include "element.hpp"
    1111#include "helpers.hpp"
     12#include "info.hpp"
    1213#include "linkedcell.hpp"
    1314#include "log.hpp"
     
    3334double *GetDiametersOfCluster(const Boundaries *BoundaryPtr, const molecule *mol, Tesselation *&TesselStruct, const bool IsAngstroem)
    3435{
     36        Info FunctionInfo(__func__);
    3537  // get points on boundary of NULL was given as parameter
    3638  bool BoundaryFreeFlag = false;
     
    5355  } else {
    5456    BoundaryPoints = BoundaryPtr;
    55     Log() << Verbose(1) << "Using given boundary points set." << endl;
     57    Log() << Verbose(0) << "Using given boundary points set." << endl;
    5658  }
    5759  // determine biggest "diameter" of cluster for each axis
     
    6769          //Log() << Verbose(1) << "Current component is " << component << ", Othercomponent is " << Othercomponent << "." << endl;
    6870          for (Boundaries::const_iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) {
    69               //Log() << Verbose(2) << "Current runner is " << *(runner->second.second) << "." << endl;
     71              //Log() << Verbose(1) << "Current runner is " << *(runner->second.second) << "." << endl;
    7072              // seek for the neighbours pair where the Othercomponent sign flips
    7173              Neighbour = runner;
     
    8284                  DistanceVector.CopyVector(&runner->second.second->x);
    8385                  DistanceVector.SubtractVector(&Neighbour->second.second->x);
    84                   //Log() << Verbose(3) << "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "." << endl;
     86                  //Log() << Verbose(2) << "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "." << endl;
    8587                } while ((runner != Neighbour) && (fabs(OldComponent / fabs(
    8688                  OldComponent) - DistanceVector.x[Othercomponent] / fabs(
     
    9193                    OtherNeighbour = BoundaryPoints[axis].end();
    9294                  OtherNeighbour--;
    93                   //Log() << Verbose(2) << "The pair, where the sign of OtherComponent flips, is: " << *(Neighbour->second.second) << " and " << *(OtherNeighbour->second.second) << "." << endl;
     95                  //Log() << Verbose(1) << "The pair, where the sign of OtherComponent flips, is: " << *(Neighbour->second.second) << " and " << *(OtherNeighbour->second.second) << "." << endl;
    9496                  // now we have found the pair: Neighbour and OtherNeighbour
    9597                  OtherVector.CopyVector(&runner->second.second->x);
    9698                  OtherVector.SubtractVector(&OtherNeighbour->second.second->x);
    97                   //Log() << Verbose(2) << "Distances to Neighbour and OtherNeighbour are " << DistanceVector.x[component] << " and " << OtherVector.x[component] << "." << endl;
    98                   //Log() << Verbose(2) << "OtherComponents to Neighbour and OtherNeighbour are " << DistanceVector.x[Othercomponent] << " and " << OtherVector.x[Othercomponent] << "." << endl;
     99                  //Log() << Verbose(1) << "Distances to Neighbour and OtherNeighbour are " << DistanceVector.x[component] << " and " << OtherVector.x[component] << "." << endl;
     100                  //Log() << Verbose(1) << "OtherComponents to Neighbour and OtherNeighbour are " << DistanceVector.x[Othercomponent] << " and " << OtherVector.x[Othercomponent] << "." << endl;
    99101                  // do linear interpolation between points (is exact) to extract exact intersection between Neighbour and OtherNeighbour
    100102                  w1 = fabs(OtherVector.x[Othercomponent]);
     
    103105                      * OtherVector.x[component]) / (w1 + w2));
    104106                  // mark if it has greater diameter
    105                   //Log() << Verbose(2) << "Comparing current greatest " << GreatestDiameter[component] << " to new " << tmp << "." << endl;
     107                  //Log() << Verbose(1) << "Comparing current greatest " << GreatestDiameter[component] << " to new " << tmp << "." << endl;
    106108                  GreatestDiameter[component] = (GreatestDiameter[component]
    107109                      > tmp) ? GreatestDiameter[component] : tmp;
    108110                } //else
    109               //Log() << Verbose(2) << "Saw no sign flip, probably top or bottom node." << endl;
     111              //Log() << Verbose(1) << "Saw no sign flip, probably top or bottom node." << endl;
    110112            }
    111113        }
     
    135137Boundaries *GetBoundaryPoints(const molecule *mol, Tesselation *&TesselStruct)
    136138{
     139        Info FunctionInfo(__func__);
    137140  atom *Walker = NULL;
    138141  PointMap PointsOnBoundary;
     
    149152  double angle = 0.;
    150153
    151   Log() << Verbose(1) << "Finding all boundary points." << endl;
    152154  // 3a. Go through every axis
    153155  for (int axis = 0; axis < NDIM; axis++) {
     
    176178        angle = 0.; // otherwise it's a vector in Axis Direction and unimportant for boundary issues
    177179
    178       //Log() << Verbose(0) << "Checking sign in quadrant : " << ProjectedVector.Projection(&AngleReferenceNormalVector) << "." << endl;
     180      //Log() << Verbose(1) << "Checking sign in quadrant : " << ProjectedVector.Projection(&AngleReferenceNormalVector) << "." << endl;
    179181      if (ProjectedVector.ScalarProduct(&AngleReferenceNormalVector) > 0) {
    180182        angle = 2. * M_PI - angle;
    181183      }
    182       Log() << Verbose(2) << "Inserting " << *Walker << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl;
     184      Log() << Verbose(1) << "Inserting " << *Walker << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl;
    183185      BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, DistancePair (radius, Walker)));
    184186      if (!BoundaryTestPair.second) { // same point exists, check first r, then distance of original vectors to center of gravity
     
    210212    // printing all inserted for debugging
    211213    //    {
    212     //      Log() << Verbose(2) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl;
     214    //      Log() << Verbose(1) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl;
    213215    //      int i=0;
    214216    //      for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) {
     
    249251          SideA.SubtractVector(MolCenter);
    250252          SideA.ProjectOntoPlane(&AxisVector);
    251           //          Log() << Verbose(0) << "SideA: ";
    252           //          SideA.Output(out);
    253           //          Log() << Verbose(0) << endl;
     253          //          Log() << Verbose(1) << "SideA: " << SideA << endl;
    254254
    255255          SideB.CopyVector(&right->second.second->x);
    256256          SideB.SubtractVector(MolCenter);
    257257          SideB.ProjectOntoPlane(&AxisVector);
    258           //          Log() << Verbose(0) << "SideB: ";
    259           //          SideB.Output(out);
    260           //          Log() << Verbose(0) << endl;
     258          //          Log() << Verbose(1) << "SideB: " << SideB << endl;
    261259
    262260          SideC.CopyVector(&left->second.second->x);
    263261          SideC.SubtractVector(&right->second.second->x);
    264262          SideC.ProjectOntoPlane(&AxisVector);
    265           //          Log() << Verbose(0) << "SideC: ";
    266           //          SideC.Output(out);
    267           //          Log() << Verbose(0) << endl;
     263          //          Log() << Verbose(1) << "SideC: " << SideC << endl;
    268264
    269265          SideH.CopyVector(&runner->second.second->x);
    270266          SideH.SubtractVector(MolCenter);
    271267          SideH.ProjectOntoPlane(&AxisVector);
    272           //          Log() << Verbose(0) << "SideH: ";
    273           //          SideH.Output(out);
    274           //          Log() << Verbose(0) << endl;
     268          //          Log() << Verbose(1) << "SideH: " << SideH << endl;
    275269
    276270          // calculate each length
     
    285279          const double delta = SideC.Angle(&SideH);
    286280          const double MinDistance = a * sin(beta) / (sin(delta)) * (((alpha < M_PI / 2.) || (gamma < M_PI / 2.)) ? 1. : -1.);
    287           //Log() << Verbose(2) << " I calculated: a = " << a << ", h = " << h << ", beta(" << left->second.second->Name << "," << left->second.second->Name << "-" << right->second.second->Name << ") = " << beta << ", delta(" << left->second.second->Name << "," << runner->second.second->Name << ") = " << delta << ", Min = " << MinDistance << "." << endl;
     281          //Log() << Verbose(1) << " I calculated: a = " << a << ", h = " << h << ", beta(" << left->second.second->Name << "," << left->second.second->Name << "-" << right->second.second->Name << ") = " << beta << ", delta(" << left->second.second->Name << "," << runner->second.second->Name << ") = " << delta << ", Min = " << MinDistance << "." << endl;
    288282          Log() << Verbose(1) << "Checking CoG distance of runner " << *runner->second.second << " " << h << " against triangle's side length spanned by (" << *left->second.second << "," << *right->second.second << ") of " << MinDistance << "." << endl;
    289283          if ((fabs(h / fabs(h) - MinDistance / fabs(MinDistance)) < MYEPSILON) && ((h - MinDistance)) < -MYEPSILON) {
     
    311305void FindConvexBorder(const molecule* mol, Tesselation *&TesselStruct, const LinkedCell *LCList, const char *filename)
    312306{
     307        Info FunctionInfo(__func__);
    313308  bool BoundaryFreeFlag = false;
    314309  Boundaries *BoundaryPoints = NULL;
    315 
    316   Log() << Verbose(1) << "Begin of FindConvexBorder" << endl;
    317310
    318311  if (TesselStruct != NULL) // free if allocated
     
    325318      BoundaryPoints = GetBoundaryPoints(mol, TesselStruct);
    326319  } else {
    327       Log() << Verbose(1) << "Using given boundary points set." << endl;
     320      Log() << Verbose(0) << "Using given boundary points set." << endl;
    328321  }
    329322
     
    331324  for (int axis=0; axis < NDIM; axis++)
    332325    {
    333       Log() << Verbose(2) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl;
     326      Log() << Verbose(1) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl;
    334327      int i=0;
    335328      for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) {
     
    347340    for (Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++)
    348341        if (!TesselStruct->AddBoundaryPoint(runner->second.second, 0))
    349           Log() << Verbose(3) << "WARNING: Point " << *(runner->second.second) << " is already present!" << endl;
    350 
    351   Log() << Verbose(2) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl;
     342          eLog() << Verbose(2) << "Point " << *(runner->second.second) << " is already present!" << endl;
     343
     344  Log() << Verbose(0) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl;
    352345  // now we have the whole set of edge points in the BoundaryList
    353346
     
    367360  // 3c. check whether all atoms lay inside the boundary, if not, add to boundary points, segment triangle into three with the new point
    368361  if (!TesselStruct->InsertStraddlingPoints(mol, LCList))
    369     Log() << Verbose(1) << "Insertion of straddling points failed!" << endl;
    370 
    371   Log() << Verbose(2) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " intermediate triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl;
     362    eLog() << Verbose(1) << "Insertion of straddling points failed!" << endl;
     363
     364  Log() << Verbose(0) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " intermediate triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl;
    372365
    373366  // 4. Store triangles in tecplot file
     
    406399        // flip the line
    407400        if (TesselStruct->PickFarthestofTwoBaselines(line) == 0.)
    408           Log() << Verbose(1) << "ERROR: Correction of concave baselines failed!" << endl;
     401          eLog() << Verbose(1) << "Correction of concave baselines failed!" << endl;
    409402        else {
    410403          TesselStruct->FlipBaseline(line);
     
    419412//    Log() << Verbose(1) << "Correction of concave tesselpoints failed!" << endl;
    420413
    421   Log() << Verbose(2) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl;
     414  Log() << Verbose(0) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl;
    422415
    423416  // 4. Store triangles in tecplot file
     
    445438  if (BoundaryFreeFlag)
    446439    delete[] (BoundaryPoints);
    447 
    448   Log() << Verbose(1) << "End of FindConvexBorder" << endl;
    449440};
    450441
     
    458449bool RemoveAllBoundaryPoints(class Tesselation *&TesselStruct, const molecule * const mol, const char * const filename)
    459450{
     451        Info FunctionInfo(__func__);
    460452  int i=0;
    461453  char number[MAXSTRINGSIZE];
    462454
    463455  if ((TesselStruct == NULL) || (TesselStruct->PointsOnBoundary.empty())) {
    464     Log() << Verbose(2) << "ERROR: TesselStruct is empty." << endl;
     456    eLog() << Verbose(1) << "TesselStruct is empty." << endl;
    465457    return false;
    466458  }
     
    468460  PointMap::iterator PointRunner;
    469461  while (!TesselStruct->PointsOnBoundary.empty()) {
    470     Log() << Verbose(2) << "Remaining points are: ";
     462    Log() << Verbose(1) << "Remaining points are: ";
    471463    for (PointMap::iterator PointSprinter = TesselStruct->PointsOnBoundary.begin(); PointSprinter != TesselStruct->PointsOnBoundary.end(); PointSprinter++)
    472464      Log() << Verbose(0) << *(PointSprinter->second) << "\t";
     
    511503double ConvexizeNonconvexEnvelope(class Tesselation *&TesselStruct, const molecule * const mol, const char * const filename)
    512504{
     505        Info FunctionInfo(__func__);
    513506  double volume = 0;
    514507  class BoundaryPointSet *point = NULL;
     
    524517  int run = 0;
    525518
    526   Log() << Verbose(0) << "Begin of ConvexizeNonconvexEnvelope" << endl;
    527 
    528519  // check whether there is something to work on
    529520  if (TesselStruct == NULL) {
    530     Log() << Verbose(1) << "ERROR: TesselStruct is empty!" << endl;
     521    eLog() << Verbose(1) << "TesselStruct is empty!" << endl;
    531522    return volume;
    532523  }
     
    547538      for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) {
    548539        line = LineRunner->second;
    549         Log() << Verbose(2) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;
     540        Log() << Verbose(1) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;
    550541        if (!line->CheckConvexityCriterion()) {
    551542          // remove the point if needed
     
    612603
    613604  // end
    614   Log() << Verbose(1) << "Volume is " << volume << "." << endl;
    615   Log() << Verbose(0) << "End of ConvexizeNonconvexEnvelope" << endl;
     605  Log() << Verbose(0) << "Volume is " << volume << "." << endl;
    616606  return volume;
    617607};
     
    627617double VolumeOfConvexEnvelope(class Tesselation *TesselStruct, class config *configuration)
    628618{
     619        Info FunctionInfo(__func__);
    629620  bool IsAngstroem = configuration->GetIsAngstroem();
    630621  double volume = 0.;
     
    633624
    634625  // 6a. Every triangle forms a pyramid with the center of gravity as its peak, sum up the volumes
    635   Log() << Verbose(1)
    636       << "Calculating the volume of the pyramids formed out of triangles and center of gravity."
    637       << endl;
    638626  for (TriangleMap::iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++)
    639627    { // go through every triangle, calculate volume of its pyramid with CoG as peak
     
    650638      const double h = x.Norm(); // distance of CoG to triangle
    651639      const double PyramidVolume = (1. / 3.) * G * h; // this formula holds for _all_ pyramids (independent of n-edge base or (not) centered peak)
    652       Log() << Verbose(2) << "Area of triangle is " << setprecision(10) << G << " "
     640      Log() << Verbose(1) << "Area of triangle is " << setprecision(10) << G << " "
    653641          << (IsAngstroem ? "angstrom" : "atomiclength") << "^2, height is "
    654642          << h << " and the volume is " << PyramidVolume << " "
     
    672660void StoreTrianglesinFile(const molecule * const mol, const Tesselation *&TesselStruct, const char *filename, const char *extraSuffix)
    673661{
     662        Info FunctionInfo(__func__);
    674663  // 4. Store triangles in tecplot file
    675664  if (filename != NULL) {
     
    679668      OutputName.append(TecplotSuffix);
    680669      ofstream *tecplot = new ofstream(OutputName.c_str());
    681       WriteTecplotFile(tecplot, TesselStruct, mol, 0);
     670      WriteTecplotFile(tecplot, TesselStruct, mol, -1);
    682671      tecplot->close();
    683672      delete(tecplot);
     
    706695void PrepareClustersinWater(config *configuration, molecule *mol, double ClusterVolume, double celldensity)
    707696{
     697        Info FunctionInfo(__func__);
    708698  bool IsAngstroem = true;
    709699  double *GreatestDiameter = NULL;
     
    756746  Log() << Verbose(1) << "Minimum volume of the convex envelope contained in a rectangular box is " << minimumvolume << " atomicmassunit/" << (IsAngstroem ? "angstrom" : "atomiclength") << "^3." << endl;
    757747  if (minimumvolume > cellvolume) {
    758     eLog() << Verbose(0) << "ERROR: the containing box already has a greater volume than the envisaged cell volume!" << endl;
     748    eLog() << Verbose(1) << "the containing box already has a greater volume than the envisaged cell volume!" << endl;
    759749    Log() << Verbose(0) << "Setting Box dimensions to minimum possible, the greatest diameters." << endl;
    760750    for (int i = 0; i < NDIM; i++)
     
    806796molecule * FillBoxWithMolecule(MoleculeListClass *List, molecule *filler, config &configuration, double distance[NDIM], double RandomAtomDisplacement, double RandomMolDisplacement, bool DoRandomRotation)
    807797{
     798        Info FunctionInfo(__func__);
    808799  molecule *Filling = new molecule(filler->elemente);
    809800  Vector CurrentPosition;
     
    823814  class Tesselation *TesselStruct[List->ListOfMolecules.size()];
    824815
    825   Log() << Verbose(0) << "Begin of FillBoxWithMolecule" << endl;
    826 
    827816  i=0;
    828817  for (MoleculeList::iterator ListRunner = List->ListOfMolecules.begin(); ListRunner != List->ListOfMolecules.end(); ListRunner++) {
     
    849838  for(int i=0;i<NDIM;i++) {
    850839    N[i] = (int) ceil(1./FillerDistance.x[i]);
    851     Log() << Verbose(0) << N[i];
     840    Log() << Verbose(1) << N[i];
    852841    if (i != NDIM-1)
    853       Log() << Verbose(0)<< ", ";
     842      Log() << Verbose(1)<< ", ";
    854843    else
    855       Log() << Verbose(0) << "." << endl;
     844      Log() << Verbose(1) << "." << endl;
    856845  }
    857846
     
    870859          // get linked cell list
    871860          if (TesselStruct[i] == NULL) {
    872             Log() << Verbose(1) << "ERROR: TesselStruct of " << (*ListRunner) << " is NULL. Didn't we pre-create it?" << endl;
     861            eLog() << Verbose(1) << "TesselStruct of " << (*ListRunner) << " is NULL. Didn't we pre-create it?" << endl;
    873862            FillIt = false;
    874863          } else {
     
    885874          for (int i=0;i<NDIM;i++)
    886875            FillerTranslations.x[i] = RandomMolDisplacement*(rand()/(RAND_MAX/2.) - 1.);
    887           Log() << Verbose(3) << "INFO: Translating this filler by " << FillerTranslations << "." << endl;
     876          Log() << Verbose(2) << "INFO: Translating this filler by " << FillerTranslations << "." << endl;
    888877
    889878          // go through all atoms
     
    946935        delete(TesselStruct[i]);
    947936  }
    948   Log() << Verbose(0) << "End of FillBoxWithMolecule" << endl;
    949 
    950937  return Filling;
    951938};
     
    959946 * \param RADIUS radius of the virtual sphere
    960947 * \param *filename filename prefix for output of vertex data
    961  */
    962 void FindNonConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LCList, const double RADIUS, const char *filename = NULL)
     948 * \return true - tesselation successful, false - tesselation failed
     949 */
     950bool FindNonConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LCList, const double RADIUS, const char *filename = NULL)
    963951{
     952        Info FunctionInfo(__func__);
    964953  bool freeLC = false;
    965   LineMap::iterator baseline;
     954  bool status = false;
     955  CandidateForTesselation *baseline;
    966956  LineMap::iterator testline;
    967   bool OneLoopWithoutSuccessFlag = false;  // marks whether we went once through all baselines without finding any without two triangles
     957  bool OneLoopWithoutSuccessFlag = true;  // marks whether we went once through all baselines without finding any without two triangles
    968958  bool TesselationFailFlag = false;
    969 
    970   Log() << Verbose(1) << "Entering search for non convex hull. " << endl;
     959  BoundaryTriangleSet *T = NULL;
     960
    971961  if (TesselStruct == NULL) {
    972962    Log() << Verbose(1) << "Allocating Tesselation struct ..." << endl;
     
    978968  }
    979969
    980   Log() << Verbose(0) << "Begin of FindNonConvexBorder\n";
    981 
    982970  // initialise Linked Cell
    983971  if (LCList == NULL) {
     
    990978
    991979  // 2. expand from there
    992   baseline = TesselStruct->LinesOnBoundary.begin();
    993   baseline++; // skip first line
    994   while ((baseline != TesselStruct->LinesOnBoundary.end()) || (OneLoopWithoutSuccessFlag)) {
    995     if (baseline->second->triangles.size() == 1) {
    996       // 3. find next triangle
    997       TesselationFailFlag = TesselStruct->FindNextSuitableTriangle(*(baseline->second), *(((baseline->second->triangles.begin()))->second), RADIUS, LCList); //the line is there, so there is a triangle, but only one.
    998       OneLoopWithoutSuccessFlag = OneLoopWithoutSuccessFlag || TesselationFailFlag;
    999       if (!TesselationFailFlag)
    1000         eLog() << Verbose(0) << "WARNING: FindNextSuitableTriangle failed." << endl;
    1001 
    1002       // write temporary envelope
    1003       if (filename != NULL) {
    1004         if ((DoSingleStepOutput && ((TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration
    1005           TesselStruct->Output(filename, mol);
    1006         }
     980  while ((!TesselStruct->OpenLines.empty()) && (OneLoopWithoutSuccessFlag)) {
     981    // 2a. fill all new OpenLines
     982    Log() << Verbose(1) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for candidates:" << endl;
     983    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++)
     984      Log() << Verbose(2) << *(Runner->second) << endl;
     985
     986    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) {
     987      baseline = Runner->second;
     988      if (baseline->pointlist.empty()) {
     989        T = (((baseline->BaseLine->triangles.begin()))->second);
     990        Log() << Verbose(1) << "Finding best candidate for open line " << *baseline->BaseLine << " of triangle " << *T << endl;
     991        TesselationFailFlag = TesselStruct->FindNextSuitableTriangle(*baseline, *T, RADIUS, LCList); //the line is there, so there is a triangle, but only one.
    1007992      }
    1008       baseline = TesselStruct->LinesOnBoundary.end();
    1009       Log() << Verbose(2) << "Baseline set to end." << endl;
    1010     } else {
    1011       //Log() << Verbose(1) << "Line " << *baseline->second << " has " << baseline->second->triangles.size() << " triangles adjacent" << endl;
    1012       if (baseline->second->triangles.size() != 2)
    1013         Log() << Verbose(1) << "ERROR: TESSELATION FINISHED WITH INVALID TRIANGLE COUNT!" << endl;
    1014     }
    1015 
    1016     if ((baseline == TesselStruct->LinesOnBoundary.end()) && (OneLoopWithoutSuccessFlag)) {
    1017       baseline = TesselStruct->LinesOnBoundary.begin();   // restart if we reach end due to newly inserted lines
     993    }
     994
     995    // 2b. search for smallest ShortestAngle among all candidates
     996    double ShortestAngle = 4.*M_PI;
     997    Log() << Verbose(1) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for the best candidates:" << endl;
     998    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++)
     999      Log() << Verbose(2) << *(Runner->second) << endl;
     1000
     1001    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) {
     1002      if (Runner->second->ShortestAngle < ShortestAngle) {
     1003        baseline = Runner->second;
     1004        ShortestAngle = baseline->ShortestAngle;
     1005        //Log() << Verbose(1) << "New best candidate is " << *baseline->BaseLine << " with point " << *baseline->point << " and angle " << baseline->ShortestAngle << endl;
     1006      }
     1007    }
     1008    if ((ShortestAngle == 4.*M_PI) || (baseline->pointlist.empty()))
    10181009      OneLoopWithoutSuccessFlag = false;
    1019     }
    1020     baseline++;
    1021   }
    1022   // check envelope for consistency
    1023   CheckListOfBaselines(TesselStruct);
    1024 
    1025   // look whether all points are inside of the convex envelope, otherwise add them via degenerated triangles
    1026   //->InsertStraddlingPoints(mol, LCList);
     1010    else {
     1011      TesselStruct->AddCandidateTriangle(*baseline);
     1012    }
     1013
     1014    // write temporary envelope
     1015    if (filename != NULL) {
     1016      if ((DoSingleStepOutput && ((TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration
     1017        TesselStruct->Output(filename, mol);
     1018      }
     1019    }
     1020  }
     1021//  // check envelope for consistency
     1022//  status = CheckListOfBaselines(TesselStruct);
     1023//
     1024//  // look whether all points are inside of the convex envelope, otherwise add them via degenerated triangles
     1025//  //->InsertStraddlingPoints(mol, LCList);
    10271026//  mol->GoToFirst();
    10281027//  class TesselPoint *Runner = NULL;
     
    10391038//  }
    10401039
    1041   // Purges surplus triangles.
    1042   TesselStruct->RemoveDegeneratedTriangles();
     1040//  // Purges surplus triangles.
     1041//  TesselStruct->RemoveDegeneratedTriangles();
    10431042
    10441043  // check envelope for consistency
    1045   CheckListOfBaselines(TesselStruct);
     1044  status = CheckListOfBaselines(TesselStruct);
    10461045
    10471046  // write final envelope
     
    10511050  if (freeLC)
    10521051    delete(LCList);
    1053   Log() << Verbose(0) << "End of FindNonConvexBorder\n";
     1052
     1053  return status;
    10541054};
    10551055
     
    10631063Vector* FindEmbeddingHole(MoleculeListClass *mols, molecule *srcmol)
    10641064{
     1065        Info FunctionInfo(__func__);
    10651066  Vector *Center = new Vector;
    10661067  Center->Zero();
  • src/boundary.hpp

    r3a0b38 r5ae39c  
    3535
    3636#define DEBUG 1
    37 #define DoSingleStepOutput 0
     37#define DoSingleStepOutput 1
    3838#define SingleStepWidth 1
    3939
     
    5353Vector* FindEmbeddingHole(MoleculeListClass *mols, molecule *srcmol);
    5454void FindNextSuitablePoint(class BoundaryTriangleSet *BaseTriangle, class BoundaryLineSet *BaseLine, atom*& OptCandidate, Vector *OptCandidateCenter, double *ShortestAngle, const double RADIUS, LinkedCell *LC);
    55 void FindNonConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LC, const double RADIUS, const char *tempbasename);
     55bool FindNonConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LC, const double RADIUS, const char *tempbasename);
    5656Boundaries *GetBoundaryPoints(const molecule *mol, Tesselation *&TesselStruct);
    5757double * GetDiametersOfCluster(const Boundaries *BoundaryPtr, const molecule *mol, Tesselation *&TesselStruct, const bool IsAngstroem);
  • src/builder.cpp

    r3a0b38 r5ae39c  
    9595  switch (choice) {
    9696    default:
    97       Log() << Verbose(0) << "Not a valid choice." << endl;
     97      eLog() << Verbose(2) << "Not a valid choice." << endl;
    9898      break;
    9999      case 'a': // absolute coordinates of atom
     
    109109        valid = true;
    110110        do {
    111           if (!valid) Log() << Verbose(0) << "Resulting position out of cell." << endl;
     111          if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl;
    112112          Log() << Verbose(0) << "Enter reference coordinates." << endl;
    113113          x.AskPosition(mol->cell_size, true);
     
    125125        valid = true;
    126126        do {
    127           if (!valid) Log() << Verbose(0) << "Resulting position out of cell." << endl;
     127          if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl;
    128128          second = mol->AskAtom("Enter atom number: ");
    129129          Log() << Verbose(0) << "Enter relative coordinates." << endl;
     
    142142        do {
    143143          if (!valid) {
    144             Log() << Verbose(0) << "Resulting coordinates out of cell - ";
    145             first->x.Output();
    146             Log() << Verbose(0) << endl;
     144            eLog() << Verbose(2) << "Resulting coordinates out of cell - " << first->x << endl;
    147145          }
    148146          Log() << Verbose(0) << "First, we need two atoms, the first atom is the central, while the second is the outer one." << endl;
     
    671669  Log() << Verbose(0) << "===============================================" << endl;
    672670  if (molecules->NumberOfActiveMolecules() > 1)
    673     Log() << Verbose(0) << "WARNING: There is more than one molecule active! Atoms will be added to each." << endl;
     671    eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl;
    674672  Log() << Verbose(0) << "INPUT: ";
    675673  cin >> choice;
     
    794792  Log() << Verbose(0) << "===============================================" << endl;
    795793  if (molecules->NumberOfActiveMolecules() > 1)
    796     Log() << Verbose(0) << "WARNING: There is more than one molecule active! Atoms will be added to each." << endl;
     794    eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl;
    797795  Log() << Verbose(0) << "INPUT: ";
    798796  cin >> choice;
     
    827825          }
    828826          if (count != j)
    829             Log() << Verbose(0) << "ERROR: AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl;
     827            eLog() << Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl;
    830828          x.Zero();
    831829          y.Zero();
     
    11721170  else {
    11731171    eLog() << Verbose(0) << "I don't have anything to test on ... ";
     1172    performCriticalExit();
    11741173    return;
    11751174  }
     
    12481247  ofstream output;
    12491248  molecule *mol = new molecule(periode);
     1249  mol->SetNameFromFilename(ConfigFileName);
    12501250
    12511251  if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) {
    1252     eLog() << Verbose(0) << "WARNING: config is found under different path then stated in config file::defaultpath!" << endl;
     1252    eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl;
    12531253  }
    12541254
     
    13541354
    13551355  if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) {
    1356     eLog() << Verbose(0) << "WARNING: config is found under different path then stated in config file::defaultpath!" << endl;
     1356    eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl;
    13571357  }
    13581358
     
    13861386  int argptr;
    13871387  molecule *mol = NULL;
    1388   string BondGraphFileName("");
     1388  string BondGraphFileName("\n");
     1389  int verbosity = 0;
    13891390  strncpy(configuration.databasepath, LocalPath, MAXSTRINGSIZE-1);
    13901391
     
    14321433            Log() << Verbose(0) << "\t-T x1 x2 x3\tTranslate periodically all atoms by this vector (x1,x2,x3)." << endl;
    14331434            Log() << Verbose(0) << "\t-u rho\tsuspend in water solution and output necessary cell lengths, average density rho and repetition." << endl;
    1434             Log() << Verbose(0) << "\t-v/-V\t\tGives version information." << endl;
     1435            Log() << Verbose(0) << "\t-v\t\tsets verbosity (more is more)." << endl;
     1436            Log() << Verbose(0) << "\t-V\t\tGives version information." << endl;
    14351437            Log() << Verbose(0) << "Note: config files must not begin with '-' !" << endl;
    14361438            return (1);
    14371439            break;
    14381440          case 'v':
     1441            while (argv[argptr-1][verbosity+1] == 'v') {
     1442              verbosity++;
     1443            }
     1444            setVerbosity(verbosity);
     1445            Log() << Verbose(0) << "Setting verbosity to " << verbosity << "." << endl;
     1446            break;
    14391447          case 'V':
    14401448            Log() << Verbose(0) << argv[0] << " " << VERSIONSTRING << endl;
     
    14451453            if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    14461454              eLog() << Verbose(0) << "Not enough or invalid arguments for specifying element db: -e <db file>" << endl;
     1455              performCriticalExit();
    14471456            } else {
    14481457              Log() << Verbose(0) << "Using " << argv[argptr] << " as elements database." << endl;
     
    14541463            if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    14551464              eLog() << Verbose(0) << "Not enough or invalid arguments for specifying bond length table: -g <table file>" << endl;
     1465              performCriticalExit();
    14561466            } else {
    14571467              BondGraphFileName = argv[argptr];
     
    15301540       mol = new molecule(periode);
    15311541       mol->ActiveFlag = true;
     1542       if (ConfigFileName != NULL)
     1543         mol->SetNameFromFilename(ConfigFileName);
    15321544       molecules->insert(mol);
     1545     }
     1546     if (configuration.BG == NULL) {
     1547       configuration.BG = new BondGraph(configuration.GetIsAngstroem());
     1548       if ((BondGraphFileName.empty()) && (configuration.BG->LoadBondLengthTable(BondGraphFileName))) {
     1549         Log() << Verbose(0) << "Bond length table loaded successfully." << endl;
     1550       } else {
     1551         eLog() << Verbose(1) << "Bond length table loading failed." << endl;
     1552       }
    15331553     }
    15341554
     
    15461566                ExitFlag = 255;
    15471567                eLog() << Verbose(0) << "Not enough arguments for parsing: -p <xyz file>" << endl;
     1568                performCriticalExit();
    15481569              } else {
    15491570                SaveFlag = true;
     
    15531574                else {
    15541575                  Log() << Verbose(2) << "File found and parsed." << endl;
     1576                  // @TODO rather do the dissection afterwards
     1577//                  mol->SetNameFromFilename(argv[argptr]);
     1578//                  molecules->ListOfMolecules.remove(mol);
     1579//                  molecules->DissectMoleculeIntoConnectedSubgraphs(mol,&configuration);
     1580//                  delete(mol);
     1581//                  if (molecules->ListOfMolecules.size() != 0) {
     1582//                    for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     1583//                      if ((*ListRunner)->ActiveFlag) {
     1584//                        mol = *ListRunner;
     1585//                        break;
     1586//                      }
     1587//                  }
    15551588                  configPresent = present;
    15561589                }
     
    15621595                ExitFlag = 255;
    15631596                eLog() << Verbose(0) << "Not enough or invalid arguments for adding atom: -a <element> <x> <y> <z>" << endl;
     1597                performCriticalExit();
    15641598              } else {
    15651599                SaveFlag = true;
     
    15901624                ExitFlag = 255;
    15911625                eLog() << Verbose(0) << "Not enough or invalid arguments given for setting MPQC basis: -B <basis name>" << endl;
     1626                performCriticalExit();
    15921627              } else {
    15931628                configuration.basis = argv[argptr];
     
    16341669                ExitFlag = 255;
    16351670                eLog() << Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C <Z> <output> <bin output>" << endl;
     1671                performCriticalExit();
    16361672              } else {
    16371673                SaveFlag = false;
     
    16801716                ExitFlag = 255;
    16811717                eLog() << Verbose(0) << "Not enough or invalid arguments given for changing element: -E <atom nr.> <element>" << endl;
     1718                performCriticalExit();
    16821719              } else {
    16831720                SaveFlag = true;
     
    16931730                ExitFlag = 255;
    16941731                eLog() << Verbose(0) << "Not enough or invalid arguments given for filling box with water: -F <dist_x> <dist_y> <dist_z> <randatom> <randmol> <DoRotate>" << endl;
     1732                performCriticalExit();
    16951733              } else {
    16961734                SaveFlag = true;
     
    17311769                ExitFlag =255;
    17321770                eLog() << Verbose(0) << "Missing source file for bonds in molecule: -A <bond sourcefile>" << endl;
     1771                performCriticalExit();
    17331772              } else {
    17341773                Log() << Verbose(0) << "Parsing bonds from " << argv[argptr] << "." << endl;
     
    17441783                ExitFlag = 255;
    17451784                eLog() << Verbose(0) << "Not enough or invalid arguments given for non-convex envelope: -o <radius> <tecplot output file>" << endl;
     1785                performCriticalExit();
    17461786              } else {
    17471787                class Tesselation *T = NULL;
    17481788                const LinkedCell *LCList = NULL;
    1749                 string filename(argv[argptr+1]);
    1750                 filename.append(".csv");
    1751                 Log() << Verbose(0) << "Evaluating non-convex envelope.";
     1789                molecule * Boundary = NULL;
     1790                //string filename(argv[argptr+1]);
     1791                //filename.append(".csv");
     1792                Log() << Verbose(0) << "Evaluating non-convex envelope of biggest molecule.";
    17521793                Log() << Verbose(1) << "Using rolling ball of radius " << atof(argv[argptr]) << " and storing tecplot data in " << argv[argptr+1] << "." << endl;
     1794                // find biggest molecule
     1795                int counter  = 0;
     1796                for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
     1797                  (*BigFinder)->CountAtoms();
     1798                  if ((Boundary == NULL) || (Boundary->AtomCount < (*BigFinder)->AtomCount)) {
     1799                    Boundary = *BigFinder;
     1800                  }
     1801                  counter++;
     1802                }
     1803                Log() << Verbose(1) << "Biggest molecule has " << Boundary->AtomCount << " atoms." << endl;
    17531804                start = clock();
    1754                 LCList = new LinkedCell(mol, atof(argv[argptr])*2.);
    1755                 FindNonConvexBorder(mol, T, LCList, atof(argv[argptr]), argv[argptr+1]);
     1805                LCList = new LinkedCell(Boundary, atof(argv[argptr])*2.);
     1806                if (!FindNonConvexBorder(Boundary, T, LCList, atof(argv[argptr]), argv[argptr+1]))
     1807                  ExitFlag = 255;
    17561808                //FindDistributionOfEllipsoids(T, &LCList, N, number, filename.c_str());
    17571809                end = clock();
    17581810                Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
    17591811                delete(LCList);
     1812                delete(T);
    17601813                argptr+=2;
    17611814              }
     
    17661819                ExitFlag = 255;
    17671820                eLog() << Verbose(0) << "Not enough or invalid arguments given for storing tempature: -S <temperature file>" << endl;
     1821                performCriticalExit();
    17681822              } else {
    17691823                Log() << Verbose(1) << "Storing temperatures in " << argv[argptr] << "." << endl;
     
    17831837                ExitFlag = 255;
    17841838                eLog() << Verbose(0) << "Not enough or invalid arguments given for storing tempature: -L <step0> <step1> <prefix> <identity mapping?>" << endl;
     1839                performCriticalExit();
    17851840              } else {
    17861841                SaveFlag = true;
     
    18001855                ExitFlag = 255;
    18011856                eLog() << Verbose(0) << "Not enough or invalid arguments given for parsing and integrating forces: -P <forces file>" << endl;
     1857                performCriticalExit();
    18021858              } else {
    18031859                SaveFlag = true;
     
    18151871                ExitFlag = 255;
    18161872                eLog() << Verbose(0) << "Not enough or invalid arguments given for removing atoms: -R <id> <distance>" << endl;
     1873                performCriticalExit();
    18171874              } else {
    18181875                SaveFlag = true;
     
    18301887                  }
    18311888                } else {
    1832                   eLog() << Verbose(0) << "Removal failed due to missing atoms on molecule or wrong id." << endl;
     1889                  eLog() << Verbose(1) << "Removal failed due to missing atoms on molecule or wrong id." << endl;
    18331890                }
    18341891                argptr+=2;
     
    18401897                ExitFlag = 255;
    18411898                eLog() << Verbose(0) << "Not enough or invalid arguments given for translation: -t <x> <y> <z>" << endl;
     1899                performCriticalExit();
    18421900              } else {
    18431901                if (ExitFlag == 0) ExitFlag = 1;
     
    18551913                ExitFlag = 255;
    18561914                eLog() << Verbose(0) << "Not enough or invalid arguments given for periodic translation: -T <x> <y> <z>" << endl;
     1915                performCriticalExit();
    18571916              } else {
    18581917                if (ExitFlag == 0) ExitFlag = 1;
     
    18701929                ExitFlag = 255;
    18711930                eLog() << Verbose(0) << "Not enough or invalid arguments given for scaling: -s <factor_x> [factor_y] [factor_z]" << endl;
     1931                performCriticalExit();
    18721932              } else {
    18731933                SaveFlag = true;
     
    18931953                ExitFlag = 255;
    18941954                eLog() << Verbose(0) << "Not enough or invalid arguments given for centering in box: -b <xx> <xy> <xz> <yy> <yz> <zz>" << endl;
     1955                performCriticalExit();
    18951956              } else {
    18961957                SaveFlag = true;
     
    19101971                ExitFlag = 255;
    19111972                eLog() << Verbose(0) << "Not enough or invalid arguments given for bounding in box: -B <xx> <xy> <xz> <yy> <yz> <zz>" << endl;
     1973                performCriticalExit();
    19121974              } else {
    19131975                SaveFlag = true;
     
    19271989                ExitFlag = 255;
    19281990                eLog() << Verbose(0) << "Not enough or invalid arguments given for centering with boundary: -c <boundary_x> <boundary_y> <boundary_z>" << endl;
     1991                performCriticalExit();
    19291992              } else {
    19301993                SaveFlag = true;
     
    19602023                ExitFlag = 255;
    19612024                eLog() << Verbose(0) << "Not enough or invalid arguments given for removing atoms: -r <id>" << endl;
     2025                performCriticalExit();
    19622026              } else {
    19632027                SaveFlag = true;
     
    19732037                ExitFlag = 255;
    19742038                eLog() << Verbose(0) << "Not enough or invalid arguments for fragmentation: -f <max. bond distance> <bond order>" << endl;
     2039                performCriticalExit();
    19752040              } else {
    19762041                Log() << Verbose(0) << "Fragmenting molecule with bond distance " << argv[argptr] << " angstroem, order of " << argv[argptr+1] << "." << endl;
     
    19912056              j = atoi(argv[argptr++]);
    19922057              if ((j<0) || (j>1)) {
    1993                 eLog() << Verbose(1) << "ERROR: Argument of '-m' should be either 0 for no-rotate or 1 for rotate." << endl;
     2058                eLog() << Verbose(1) << "Argument of '-m' should be either 0 for no-rotate or 1 for rotate." << endl;
    19942059                j = 0;
    19952060              }
     
    20062071                ExitFlag = 255;
    20072072                eLog() << Verbose(0) << "Not enough or invalid arguments given for convex envelope: -o <convex output file> <non-convex output file>" << endl;
     2073                performCriticalExit();
    20082074              } else {
    20092075                class Tesselation *TesselStruct = NULL;
     
    20302096                ExitFlag = 255;
    20312097                eLog() << Verbose(0) << "Not enough or invalid arguments given for suspension with specified volume: -U <volume> <density>" << endl;
    2032                 volume = -1; // for case 'u': don't print error again
     2098                performCriticalExit();
    20332099              } else {
    20342100                volume = atof(argv[argptr++]);
     
    20412107                  ExitFlag = 255;
    20422108                  eLog() << Verbose(0) << "Not enough arguments given for suspension: -u <density>" << endl;
     2109                  performCriticalExit();
    20432110              } else {
    20442111                double density;
     
    20472114                density = atof(argv[argptr++]);
    20482115                if (density < 1.0) {
    2049                   eLog() << Verbose(0) << "Density must be greater than 1.0g/cm^3 !" << endl;
     2116                  eLog() << Verbose(1) << "Density must be greater than 1.0g/cm^3 !" << endl;
    20502117                  density = 1.3;
    20512118                }
     
    20532120//                  repetition[i] = atoi(argv[argptr++]);
    20542121//                  if (repetition[i] < 1)
    2055 //                    eLog() << Verbose(0) << "ERROR: repetition value must be greater 1!" << endl;
     2122//                    eLog() << Verbose(1) << "repetition value must be greater 1!" << endl;
    20562123//                  repetition[i] = 1;
    20572124//                }
     
    20642131                ExitFlag = 255;
    20652132                eLog() << Verbose(0) << "Not enough or invalid arguments given for repeating cells: -d <repeat_x> <repeat_y> <repeat_z>" << endl;
     2133                performCriticalExit();
    20662134              } else {
    20672135                SaveFlag = true;
     
    20722140                  Vector ** vectors;
    20732141                  if (faktor < 1) {
    2074                     eLog() << Verbose(0) << "ERROR: Repetition faktor mus be greater than 1!" << endl;
     2142                    eLog() << Verbose(1) << "Repetition factor mus be greater than 1!" << endl;
    20752143                    faktor = 1;
    20762144                  }
     
    20892157                    }
    20902158                    if (count != j)
    2091                       Log() << Verbose(0) << "ERROR: AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl;
     2159                      eLog() << Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl;
    20922160                    x.Zero();
    20932161                    y.Zero();
     
    21542222  int j;
    21552223
    2156   setVerbosity(2);
     2224  setVerbosity(0);
    21572225
    21582226  // =========================== PARSE COMMAND LINE OPTIONS ====================================
  • src/config.cpp

    r3a0b38 r5ae39c  
    7272  file= new ifstream(filename);
    7373  if (file == NULL) {
    74     eLog() << Verbose(0) << "ERROR: config file " << filename << " missing!" << endl;
     74    eLog() << Verbose(1) << "config file " << filename << " missing!" << endl;
    7575    return;
    7676  }
     
    8787  // allocate buffer's 1st dimension
    8888  if (buffer != NULL) {
    89     eLog() << Verbose(0) << "ERROR: FileBuffer->buffer is not NULL!" << endl;
     89    eLog() << Verbose(1) << "FileBuffer->buffer is not NULL!" << endl;
    9090    return;
    9191  } else
     
    143143  if (LineMapping == NULL) {
    144144    eLog() << Verbose(0) << "map pointer is NULL: " << LineMapping << endl;
     145    performCriticalExit();
    145146    return;
    146147  }
     
    156157    if (CurrentLine+nr < NoLines)
    157158      LineMapping[CurrentLine+(nr++)] = runner->second;
    158     else
     159    else {
    159160      eLog() << Verbose(0) << "config::MapIonTypesInBuffer - NoAtoms is wrong: We are past the end of the file!" << endl;
     161      performCriticalExit();
     162    }
    160163  }
    161164}
     
    653656{
    654657  if (FileBuffer != NULL) {
    655     eLog() << Verbose(1) << "WARNING: deleting present FileBuffer in PrepareFileBuffer()." << endl;
     658    eLog() << Verbose(2) << "deleting present FileBuffer in PrepareFileBuffer()." << endl;
    656659    delete(FileBuffer);
    657660  }
     
    686689  if (MaxTypes == 0) {
    687690    eLog() << Verbose(0) << "There are no atoms according to MaxTypes in this config file." << endl;
     691    performCriticalExit();
    688692  } else {
    689693    // prescan number of ions per type
     
    704708    if (!ParseForParameter(verbose,FileBuffer, (const char*)name, 1, 1, 1, int_type, &value[0], 1, critical)) {
    705709      eLog() << Verbose(0) << "There are no atoms in the config file!" << endl;
     710      performCriticalExit();
    706711      return;
    707712    }
     
    847852  ifstream *file = new ifstream(filename);
    848853  if (file == NULL) {
    849     eLog() << Verbose(0) << "ERROR: config file " << filename << " missing!" << endl;
     854    eLog() << Verbose(1) << "config file " << filename << " missing!" << endl;
    850855    return;
    851856  }
     
    10511056
    10521057  // 2. parse the bond graph file if given
    1053   BG = new BondGraph(IsAngstroem);
    1054   if (BG->LoadBondLengthTable(BondGraphFileName)) {
    1055     Log() << Verbose(0) << "Bond length table loaded successfully." << endl;
    1056   } else {
    1057     Log() << Verbose(0) << "Bond length table loading failed." << endl;
     1058  if (BG == NULL) {
     1059    BG = new BondGraph(IsAngstroem);
     1060    if (BG->LoadBondLengthTable(BondGraphFileName)) {
     1061      Log() << Verbose(0) << "Bond length table loaded successfully." << endl;
     1062    } else {
     1063      eLog() << Verbose(1) << "Bond length table loading failed." << endl;
     1064    }
    10581065  }
    10591066
    10601067  // 3. parse the molecule in
    10611068  LoadMolecule(mol, FileBuffer, periode, FastParsing);
     1069  mol->SetNameFromFilename(filename);
    10621070  mol->ActiveFlag = true;
     1071  MolList->insert(mol);
    10631072
    10641073  // 4. dissect the molecule into connected subgraphs
    1065   MolList->DissectMoleculeIntoConnectedSubgraphs(mol,this);
     1074  // don't do this here ...
     1075  //MolList->DissectMoleculeIntoConnectedSubgraphs(mol,this);
    10661076
    10671077  delete(mol);
     
    10801090  ifstream *file = new ifstream(filename);
    10811091  if (file == NULL) {
    1082     eLog() << Verbose(0) << "ERROR: config file " << filename << " missing!" << endl;
     1092    eLog() << Verbose(1) << "config file " << filename << " missing!" << endl;
    10831093    return;
    10841094  }
  • src/ellipsoid.cpp

    r3a0b38 r5ae39c  
    241241    x = new Vector[PointsToPick];
    242242  } else {
    243     eLog() << Verbose(2) << "WARNING: Given pointer to vector array seems already allocated." << endl;
     243    eLog() << Verbose(2) << "Given pointer to vector array seems already allocated." << endl;
    244244  }
    245245
     
    341341    x = new Vector[PointsToPick];
    342342  } else {
    343     eLog() << Verbose(2) << "WARNING: Given pointer to vector array seems already allocated." << endl;
     343    eLog() << Verbose(2) << "Given pointer to vector array seems already allocated." << endl;
    344344  }
    345345
  • src/errorlogger.cpp

    r3a0b38 r5ae39c  
    8282  l.nix->clear();
    8383  if (v.DoOutput(verbosityLevel)) {
    84     v.print(cout);
    8584    switch(v.Verbosity) {
    8685      case 0:
    87         cout << "CRITICAL: ";
     86        cerr << "CRITICAL: ";
    8887        break;
    8988      case 1:
    90         cout << "ERROR: ";
     89        cerr << "ERROR: ";
    9190        break;
    9291      case 2:
    93         cout << "WARNING: ";
     92        cerr << "WARNING: ";
    9493        break;
    9594      default:
    9695        break;
    9796    }
     97    v.print(cerr);
    9898    return cerr;
    9999  } else
     
    105105  l->nix->clear();
    106106  if (v.DoOutput(verbosityLevel)) {
    107     v.print(cout);
    108107    switch(v.Verbosity) {
    109108      case 0:
    110         cout << "CRITICAL: ";
     109        cerr << "CRITICAL: ";
    111110        break;
    112111      case 1:
    113         cout << "ERROR: ";
     112        cerr << "ERROR: ";
    114113        break;
    115114      case 2:
    116         cout << "WARNING: ";
     115        cerr << "WARNING: ";
    117116        break;
    118117      default:
    119118        break;
    120119    }
     120    v.print(cerr);
    121121    return cerr;
    122122  } else
  • src/helpers.hpp

    r3a0b38 r5ae39c  
    111111  if (LookupTable == NULL) {
    112112    eLog() << Verbose(0) << "LookupTable memory allocation failed!" << endl;
     113    performCriticalExit();
    113114    status = false;
    114115  } else {
  • src/linkedcell.cpp

    r3a0b38 r5ae39c  
    4747  Log() << Verbose(1) << "Begin of LinkedCell" << endl;
    4848  if (set->IsEmpty()) {
    49     eLog() << Verbose(0) << "ERROR: set contains no linked cell nodes!" << endl;
     49    eLog() << Verbose(1) << "set contains no linked cell nodes!" << endl;
    5050    return;
    5151  }
     
    7979  Log() << Verbose(2) << "Allocating cells ... ";
    8080  if (LC != NULL) {
    81     Log() << Verbose(1) << "ERROR: Linked Cell list is already allocated, I do nothing." << endl;
     81    eLog() << Verbose(1) << "Linked Cell list is already allocated, I do nothing." << endl;
    8282    return;
    8383  }
     
    122122  Log() << Verbose(1) << "Begin of LinkedCell" << endl;
    123123  if (set->empty()) {
    124     eLog() << Verbose(0) << "ERROR: set contains no linked cell nodes!" << endl;
     124    eLog() << Verbose(1) << "set contains no linked cell nodes!" << endl;
    125125    return;
    126126  }
     
    151151  Log() << Verbose(2) << "Allocating cells ... ";
    152152  if (LC != NULL) {
    153     Log() << Verbose(1) << "ERROR: Linked Cell list is already allocated, I do nothing." << endl;
     153    eLog() << Verbose(1) << "Linked Cell list is already allocated, I do nothing." << endl;
    154154    return;
    155155  }
     
    199199    status = status && ((n[i] >=0) && (n[i] < N[i]));
    200200  if (!status)
    201   eLog() << Verbose(0) << "ERROR: indices are out of bounds!" << endl;
     201  eLog() << Verbose(1) << "indices are out of bounds!" << endl;
    202202  return status;
    203203};
     
    260260    return status;
    261261  } else {
    262     eLog() << Verbose(1) << "ERROR: Node at " << *Walker << " is out of bounds." << endl;
     262    eLog() << Verbose(1) << "Node at " << *Walker << " is out of bounds." << endl;
    263263    return false;
    264264  }
  • src/memoryusageobserver.cpp

    r3a0b38 r5ae39c  
    8888
    8989  if (current == memoryUsers.end()) {
    90     Log() << Verbose(0) << "WARNING: There is non-tracked memory to be freed. Pointer "
     90    eLog() << Verbose(2) << "There is non-tracked memory to be freed. Pointer "
    9191      << pointer << " is not registered by MemoryUsageObserver: ";
    9292    if (msg != NULL)
  • src/molecule.cpp

    r3a0b38 r5ae39c  
    192192  BondRescale = TopOrigin->type->HBondDistance[TopBond->BondDegree-1];
    193193  if (BondRescale == -1) {
    194     eLog() << Verbose(3) << "ERROR: There is no typical hydrogen bond distance in replacing bond (" << TopOrigin->Name << "<->" << TopReplacement->Name << ") of degree " << TopBond->BondDegree << "!" << endl;
     194    eLog() << Verbose(1) << "There is no typical hydrogen bond distance in replacing bond (" << TopOrigin->Name << "<->" << TopReplacement->Name << ") of degree " << TopBond->BondDegree << "!" << endl;
    195195    return false;
    196196    BondRescale = bondlength;
     
    235235            SecondOtherAtom = (*Runner)->GetOtherAtom(TopOrigin);
    236236          } else {
    237             Log() << Verbose(3) << "WARNING: Detected more than four bonds for atom " << TopOrigin->Name;
     237            eLog() << Verbose(2) << "Detected more than four bonds for atom " << TopOrigin->Name;
    238238          }
    239239        }
     
    272272      bondangle = TopOrigin->type->HBondAngle[1];
    273273      if (bondangle == -1) {
    274         Log() << Verbose(3) << "ERROR: There is no typical hydrogen bond angle in replacing bond (" << TopOrigin->Name << "<->" << TopReplacement->Name << ") of degree " << TopBond->BondDegree << "!" << endl;
     274        eLog() << Verbose(1) << "There is no typical hydrogen bond angle in replacing bond (" << TopOrigin->Name << "<->" << TopReplacement->Name << ") of degree " << TopBond->BondDegree << "!" << endl;
    275275        return false;
    276276        bondangle = 0;
     
    394394      break;
    395395    default:
    396       eLog() << Verbose(0) << "ERROR: BondDegree does not state single, double or triple bond!" << endl;
     396      eLog() << Verbose(1) << "BondDegree does not state single, double or triple bond!" << endl;
    397397      AllWentWell = false;
    398398      break;
     
    445445    Walker->type = elemente->FindElement(shorthand);
    446446    if (Walker->type == NULL) {
    447       eLog() << Verbose(0) << "Could not parse the element at line: '" << line << "', setting to H.";
     447      eLog() << Verbose(1) << "Could not parse the element at line: '" << line << "', setting to H.";
    448448      Walker->type = elemente->FindElement(1);
    449449    }
     
    541541    add(Binder, last);
    542542  } else {
    543     eLog() << Verbose(1) << "ERROR: Could not add bond between " << atom1->Name << " and " << atom2->Name << " as one or both are not present in the molecule." << endl;
     543    eLog() << Verbose(1) << "Could not add bond between " << atom1->Name << " and " << atom2->Name << " as one or both are not present in the molecule." << endl;
    544544  }
    545545  return Binder;
     
    619619    AtomCount--;
    620620  } else
    621     eLog() << Verbose(0) << "ERROR: Atom " << pointer->Name << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl;
     621    eLog() << Verbose(1) << "Atom " << pointer->Name << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl;
    622622  if (ElementsInMolecule[pointer->type->Z] == 0)  // was last atom of this element?
    623623    ElementCount--;
     
    637637    ElementsInMolecule[pointer->type->Z]--; // decrease number of atom of this element
    638638  else
    639     eLog() << Verbose(0) << "ERROR: Atom " << pointer->Name << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl;
     639    eLog() << Verbose(1) << "Atom " << pointer->Name << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl;
    640640  if (ElementsInMolecule[pointer->type->Z] == 0)  // was last atom of this element?
    641641    ElementCount--;
  • src/molecule.hpp

    r3a0b38 r5ae39c  
    106106
    107107  // re-definition of virtual functions from PointCloud
     108  const char * const GetName() const;
    108109  Vector *GetCenter() const ;
    109110  TesselPoint *GetPoint() const ;
  • src/molecule_dynamics.cpp

    r3a0b38 r5ae39c  
    307307    if (Params.DoubleList[i] > 1) {
    308308      eLog() << Verbose(0) << "Failed to create an injective PermutationMap!" << endl;
    309       exit(1);
     309      performCriticalExit();
    310310    }
    311311  Log() << Verbose(1) << "done." << endl;
     
    428428            }
    429429            if (Potential > Params.PenaltyConstants[2]) {
    430               eLog() << Verbose(0) << "ERROR: The two-step permutation procedure did not maintain injectivity!" << endl;
     430              eLog() << Verbose(1) << "The two-step permutation procedure did not maintain injectivity!" << endl;
    431431              exit(255);
    432432            }
    433433            //Log() << Verbose(0) << endl;
    434434          } else {
    435             eLog() << Verbose(0) << "ERROR: " << *Runner << " was not the owner of " << *Sprinter << "!" << endl;
     435            eLog() << Verbose(1) << *Runner << " was not the owner of " << *Sprinter << "!" << endl;
    436436            exit(255);
    437437          }
     
    569569    if (!Force.ParseMatrix(file, 0,0,0)) {
    570570      eLog() << Verbose(0) << "Could not parse Force Matrix file " << file << "." << endl;
     571      performCriticalExit();
    571572      return false;
    572573    }
    573574    if (Force.RowCounter[0] != AtomCount) {
    574575      eLog() << Verbose(0) << "Mismatch between number of atoms in file " << Force.RowCounter[0] << " and in molecule " << AtomCount << "." << endl;
     576      performCriticalExit();
    575577      return false;
    576578    }
  • src/molecule_fragmentation.cpp

    r3a0b38 r5ae39c  
    111111        if (!testGraphInsert.second) {
    112112          eLog() << Verbose(0) << "KeySet file must be corrupt as there are two equal key sets therein!" << endl;
     113          performCriticalExit();
    113114        }
    114115      }
     
    211212  } else {
    212213    eLog() << Verbose(0) << "Unable to open " << line << " for writing keysets!" << endl;
     214    performCriticalExit();
    213215    status = false;
    214216  }
     
    368370    } else {
    369371      eLog() << Verbose(0) << "Atom No. " << (*runner).second.first << " was not found in this molecule." << endl;
     372      performCriticalExit();
    370373    }
    371374  }
     
    441444    // transmorph graph keyset list into indexed KeySetList
    442445    if (GlobalKeySetList == NULL) {
    443       Log() << Verbose(1) << "ERROR: Given global key set list (graph) is NULL!" << endl;
     446      eLog() << Verbose(1) << "Given global key set list (graph) is NULL!" << endl;
    444447      return false;
    445448    }
     
    449452    map<int, pair<double,int> > *AdaptiveCriteriaList = ScanAdaptiveFileIntoMap(path, *IndexKeySetList); // (Root No., (Value, Order)) !
    450453    if (AdaptiveCriteriaList->empty()) {
    451       eLog() << Verbose(0) << "Unable to parse file, incrementing all." << endl;
     454      eLog() << Verbose(2) << "Unable to parse file, incrementing all." << endl;
    452455      while (Walker->next != end) {
    453456        Walker = Walker->next;
     
    638641        MolecularWalker->Leaf->FragmentBOSSANOVA(FragmentList[FragmentCounter], RootStack[FragmentCounter], MinimumRingSize);
    639642      } else {
    640         eLog() << Verbose(0) << "Subgraph " << MolecularWalker << " has no atoms!" << endl;
     643        eLog() << Verbose(1) << "Subgraph " << MolecularWalker << " has no atoms!" << endl;
    641644      }
    642645      FragmentCounter++;  // next fragment list
     
    898901      }
    899902    } else {
    900       Log() << Verbose(0) << "ERROR: Son " << Runner->Name << " has father " << FatherOfRunner->Name << " but its entry in SonList is " << SonList[FatherOfRunner->nr] << "!" << endl;
     903      eLog() << Verbose(1) << "Son " << Runner->Name << " has father " << FatherOfRunner->Name << " but its entry in SonList is " << SonList[FatherOfRunner->nr] << "!" << endl;
    901904    }
    902905    if ((LonelyFlag) && (Leaf->AtomCount > 1)) {
     
    11331136        Log() << Verbose(0) << endl;
    11341137        //if (!CheckForConnectedSubgraph(FragmentSearch->FragmentSet))
    1135           //Log() << Verbose(0) << "ERROR: The found fragment is not a connected subgraph!" << endl;
     1138          //eLog() << Verbose(1) << "The found fragment is not a connected subgraph!" << endl;
    11361139        InsertFragmentIntoGraph(FragmentSearch);
    11371140      }
  • src/molecule_graph.cpp

    r3a0b38 r5ae39c  
    926926        break; // breaking here will not cause error!
    927927    }
    928     if (i == vertex->ListOfBonds.size())
     928    if (i == vertex->ListOfBonds.size()) {
    929929      eLog() << Verbose(0) << "Error: All Component entries are already occupied!" << endl;
    930   } else
     930      performCriticalExit();
     931    }
     932  } else {
    931933    eLog() << Verbose(0) << "Error: Given vertex is NULL!" << endl;
     934    performCriticalExit();
     935  }
    932936}
    933937;
     
    11141118  if (ReferenceStack->IsEmpty()) {
    11151119    eLog() << Verbose(0) << "ReferenceStack is empty!" << endl;
     1120    performCriticalExit();
    11161121    return false;
    11171122  }
  • src/molecule_pointcloud.cpp

    r3a0b38 r5ae39c  
    1313/************************************* Functions for class molecule *********************************/
    1414
     15/** Returns a name for this point cloud, here the molecule's name.
     16 * \return name of point cloud
     17 */
     18const char * const molecule::GetName() const
     19{
     20  return name;
     21};
    1522
    1623/** Determine center of all atoms.
  • src/moleculelist.cpp

    r3a0b38 r5ae39c  
    311311  Tesselation *TesselStruct = NULL;
    312312  if ((srcmol == NULL) || (mol == NULL)) {
    313     Log() << Verbose(1) << "ERROR: Either fixed or variable molecule is given as NULL." << endl;
     313    eLog() << Verbose(1) << "Either fixed or variable molecule is given as NULL." << endl;
    314314    return false;
    315315  }
     
    319319  FindNonConvexBorder(mol, TesselStruct, (const LinkedCell *&)LCList, 4., NULL);
    320320  if (TesselStruct == NULL) {
    321     Log() << Verbose(1) << "ERROR: Could not tesselate the fixed molecule." << endl;
     321    eLog() << Verbose(1) << "Could not tesselate the fixed molecule." << endl;
    322322    return false;
    323323  }
     
    402402  input.open(line.c_str());
    403403  if (input == NULL) {
    404     eLog() << Verbose(0) << endl << "Unable to open " << line << ", is the directory correct?"
    405         << endl;
     404    eLog() << Verbose(0) << endl << "Unable to open " << line << ", is the directory correct?" << endl;
     405    performCriticalExit();
    406406    return false;
    407407  }
     
    442442    if (input == NULL) {
    443443      eLog() << Verbose(0) << endl << "Unable to open " << line << ", is the directory correct?" << endl;
     444      performCriticalExit();
    444445      return false;
    445446    }
     
    643644    if (path != NULL)
    644645      strcpy(PathBackup, path);
    645     else
     646    else {
    646647      eLog() << Verbose(0) << "OutputConfigForListOfFragments: NULL default path obtained from config!" << endl;
     648      performCriticalExit();
     649    }
    647650
    648651    // correct periodic
     
    757760  // 4a. create array of molecules to fill
    758761  const int MolCount = Subgraphs->next->Count();
     762  char number[MAXSTRINGSIZE];
    759763  molecule **molecules = Malloc<molecule *>(MolCount, "config::Load() - **molecules");
    760764  for (int i=0;i<MolCount;i++) {
    761765    molecules[i] = (molecule*) new molecule(mol->elemente);
    762766    molecules[i]->ActiveFlag = true;
     767    strncpy(molecules[i]->name, mol->name, MAXSTRINGSIZE);
     768    if (MolCount > 1) {
     769      sprintf(number, "-%d", i+1);
     770      strncat(molecules[i]->name, number, MAXSTRINGSIZE - strlen(mol->name) - 1);
     771    }
     772    cout << "MolName is " << molecules[i]->name << endl;
    763773    insert(molecules[i]);
    764774  }
     
    797807    }
    798808  }
    799   // 4d. we don't need to redo bonds, as they are connected subgraphs and still maintained their ListOfBonds, but we have to remove them from first..last list
     809  // 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
    800810  bond *Binder = mol->first;
    801811  while (mol->first->next != mol->last) {
  • src/parser.cpp

    r3a0b38 r5ae39c  
    159159  if (input == NULL) {
    160160    eLog() << Verbose(0) << endl << "Unable to open " << name << ", is the directory correct?" << endl;
     161    performCriticalExit();
    161162    return false;
    162163  }
     
    179180  //Log() << Verbose(0) << line.str() << endl;
    180181  //Log() << Verbose(0) << "ColumnCounter[" << MatrixNr << "]: " << ColumnCounter[MatrixNr] << "." << endl;
    181   if (ColumnCounter[MatrixNr] == 0)
     182  if (ColumnCounter[MatrixNr] == 0) {
    182183    eLog() << Verbose(0) << "ColumnCounter[" << MatrixNr << "]: " << ColumnCounter[MatrixNr] << " from file " << name << ", this is probably an error!" << endl;
     184    performCriticalExit();
     185  }
    183186 
    184187  // scan rest for number of rows/lines
     
    193196  }
    194197  //Log() << Verbose(0) << "RowCounter[" << MatrixNr << "]: " << RowCounter[MatrixNr] << " from file " << name << "." << endl;
    195   if (RowCounter[MatrixNr] == 0)
     198  if (RowCounter[MatrixNr] == 0) {
    196199    eLog() << Verbose(0) << "RowCounter[" << MatrixNr << "]: " << RowCounter[MatrixNr] << " from file " << name << ", this is probably an error!" << endl;
     200    performCriticalExit();
     201  }
    197202
    198203  // allocate matrix if it's not zero dimension in one direction
     
    226231    }
    227232  } else {
    228     eLog() << Verbose(0) << "ERROR: Matrix nr. " << MatrixNr << " has column and row count of (" << ColumnCounter[MatrixNr] << "," << RowCounter[MatrixNr] << "), could not allocate nor parse!" << endl;
     233    eLog() << Verbose(1) << "Matrix nr. " << MatrixNr << " has column and row count of (" << ColumnCounter[MatrixNr] << "," << RowCounter[MatrixNr] << "), could not allocate nor parse!" << endl;
    229234  }
    230235  input.close();
     
    428433              if (m > RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ]) {
    429434                eLog() << Verbose(0) << "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment]   << " current force index " << m << " is greater than " << RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl;
     435                performCriticalExit();
    430436                return false;
    431437              }
     
    471477    if (output == NULL) {
    472478      eLog() << Verbose(0) << "Unable to open output energy file " << line.str() << "!" << endl;
     479      performCriticalExit();
    473480      return false;
    474481    }
     
    500507  if (output == NULL) {
    501508    eLog() << Verbose(0) << "Unable to open output matrix file " << line.str() << "!" << endl;
     509    performCriticalExit();
    502510    return false;
    503511  }
     
    656664      if (j > RowCounter[MatrixCounter]) {
    657665        eLog() << Verbose(0) << "Current force index " << j << " is greater than " << RowCounter[MatrixCounter] << "!" << endl;
     666        performCriticalExit();
    658667        return false;
    659668      }
     
    793802      if (j > RowCounter[MatrixCounter]) {
    794803        eLog() << Verbose(0) << "Current hessian index " << j << " is greater than " << RowCounter[MatrixCounter] << ", where i=" << i << ", Order=" << Order << ", l=" << l << " and FragmentNr=" << FragmentNr << "!" << endl;
     804        performCriticalExit();
    795805        return false;
    796806      }
     
    800810          if (k > ColumnCounter[MatrixCounter]) {
    801811            eLog() << Verbose(0) << "Current hessian index " << k << " is greater than " << ColumnCounter[MatrixCounter] << ", where m=" << m << ", j=" << j << ", i=" << i << ", Order=" << Order << ", l=" << l << " and FragmentNr=" << FragmentNr << "!" << endl;
     812            performCriticalExit();
    802813            return false;
    803814          }
     
    852863              if (m > RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ]) {
    853864                eLog() << Verbose(0) << "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment]   << " current row index " << m << " is greater than " << RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl;
     865                performCriticalExit();
    854866                return false;
    855867              }
     
    869881                  if (n > ColumnCounter[ KeySets.OrderSet[Order][CurrentFragment] ]) {
    870882                    eLog() << Verbose(0) << "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment]   << " current column index " << n << " is greater than " << ColumnCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl;
     883                    performCriticalExit();
    871884                    return false;
    872885                  }
  • src/periodentafel.cpp

    r3a0b38 r5ae39c  
    313313
    314314  if (!otherstatus)
    315     eLog() << Verbose(0) << "WARNING: Something went wrong while parsing the other databases!" << endl;
     315    eLog() << Verbose(2) << "Something went wrong while parsing the other databases!" << endl;
    316316
    317317  return status;
  • src/stackclass.hpp

    r3a0b38 r5ae39c  
    7272    return true;
    7373  } else {
    74     eLog() << Verbose(0) << "ERROR: Stack is full, " << "Stack: CurrentLastEntry " << CurrentLastEntry<< "\tCurrentFirstEntry " << CurrentFirstEntry << "\tNextFreeField " << NextFreeField << "\tEntryCount " << EntryCount << "!" << endl;
     74    eLog() << Verbose(1) << "Stack is full, " << "Stack: CurrentLastEntry " << CurrentLastEntry<< "\tCurrentFirstEntry " << CurrentFirstEntry << "\tNextFreeField " << NextFreeField << "\tEntryCount " << EntryCount << "!" << endl;
    7575    return false;
    7676  }
     
    8787    Walker = StackList[CurrentFirstEntry];
    8888    if (Walker == NULL)
    89       eLog() << Verbose(0) << "ERROR: Stack's field is empty!" << endl;
     89      eLog() << Verbose(1) << "Stack's field is empty!" << endl;
    9090    StackList[CurrentFirstEntry] = NULL;
    9191    if (CurrentFirstEntry != CurrentLastEntry) { // hasn't last item been popped as well?
     
    9696    }
    9797  } else
    98     eLog() << Verbose(0) << "ERROR: Stack is empty!" << endl;
     98    eLog() << Verbose(1) << "Stack is empty!" << endl;
    9999  return Walker;
    100100};
     
    111111    StackList[CurrentLastEntry] = NULL;
    112112    if (Walker == NULL)
    113       eLog() << Verbose(0) << "ERROR: Stack's field is empty!" << endl;
     113      eLog() << Verbose(1) << "Stack's field is empty!" << endl;
    114114    NextFreeField = CurrentLastEntry;
    115115    if (CurrentLastEntry != CurrentFirstEntry)  // has there been more than one item on stack
    116116      CurrentLastEntry = (CurrentLastEntry + (EntryCount-1)) % EntryCount; // step back from current free field to last (modulo does not work in -1, thus go EntryCount-1 instead)
    117117  } else {
    118     eLog() << Verbose(0) << "ERROR: Stack is empty!" << endl;
     118    eLog() << Verbose(1) << "Stack is empty!" << endl;
    119119  }
    120120  return Walker;
     
    151151    } while (i!=NextFreeField);
    152152  else
    153     eLog() << Verbose(0) << "ERROR: Stack is already empty!" << endl;
     153    eLog() << Verbose(1) << "Stack is already empty!" << endl;
    154154  if (found) {
    155155    NextFreeField = CurrentLastEntry;
  • src/tesselation.cpp

    r3a0b38 r5ae39c  
    99
    1010#include "helpers.hpp"
     11#include "info.hpp"
    1112#include "linkedcell.hpp"
    1213#include "log.hpp"
     
    2223/** Constructor of BoundaryPointSet.
    2324 */
    24 BoundaryPointSet::BoundaryPointSet()
    25 {
    26   LinesCount = 0;
    27   Nr = -1;
    28   value = 0.;
     25BoundaryPointSet::BoundaryPointSet() :
     26    LinesCount(0),
     27    value(0.),
     28    Nr(-1)
     29{
     30        Info FunctionInfo(__func__);
     31        Log() << Verbose(1) << "Adding noname." << endl;
    2932};
    3033
     
    3235 * \param *Walker TesselPoint this boundary point represents
    3336 */
    34 BoundaryPointSet::BoundaryPointSet(TesselPoint * Walker)
    35 {
    36   node = Walker;
    37   LinesCount = 0;
    38   Nr = Walker->nr;
    39   value = 0.;
     37BoundaryPointSet::BoundaryPointSet(TesselPoint * Walker) :
     38  LinesCount(0),
     39  node(Walker),
     40  value(0.),
     41  Nr(Walker->nr)
     42{
     43        Info FunctionInfo(__func__);
     44  Log() << Verbose(1) << "Adding Node " << *Walker << endl;
    4045};
    4146
     
    4651BoundaryPointSet::~BoundaryPointSet()
    4752{
    48   //Log() << Verbose(5) << "Erasing point nr. " << Nr << "." << endl;
     53        Info FunctionInfo(__func__);
     54  //Log() << Verbose(0) << "Erasing point nr. " << Nr << "." << endl;
    4955  if (!lines.empty())
    50     eLog() << Verbose(0) << "WARNING: Memory Leak! I " << *this << " am still connected to some lines." << endl;
     56    eLog() << Verbose(2) << "Memory Leak! I " << *this << " am still connected to some lines." << endl;
    5157  node = NULL;
    5258};
     
    5763void BoundaryPointSet::AddLine(class BoundaryLineSet *line)
    5864{
    59   Log() << Verbose(6) << "Adding " << *this << " to line " << *line << "."
     65        Info FunctionInfo(__func__);
     66  Log() << Verbose(1) << "Adding " << *this << " to line " << *line << "."
    6067      << endl;
    6168  if (line->endpoints[0] == this)
     
    8592/** Constructor of BoundaryLineSet.
    8693 */
    87 BoundaryLineSet::BoundaryLineSet()
    88 {
     94BoundaryLineSet::BoundaryLineSet() :
     95    Nr(-1)
     96{
     97        Info FunctionInfo(__func__);
    8998  for (int i = 0; i < 2; i++)
    9099    endpoints[i] = NULL;
    91   Nr = -1;
    92100};
    93101
     
    99107BoundaryLineSet::BoundaryLineSet(class BoundaryPointSet *Point[2], const int number)
    100108{
     109        Info FunctionInfo(__func__);
    101110  // set number
    102111  Nr = number;
     
    106115  Point[0]->AddLine(this); //Taken out, to check whether we can avoid unwanted double adding.
    107116  Point[1]->AddLine(this); //
     117  // set skipped to false
     118  skipped = false;
    108119  // clear triangles list
    109   Log() << Verbose(5) << "New Line with endpoints " << *this << "." << endl;
     120  Log() << Verbose(0) << "New Line with endpoints " << *this << "." << endl;
    110121};
    111122
     
    116127BoundaryLineSet::~BoundaryLineSet()
    117128{
     129        Info FunctionInfo(__func__);
    118130  int Numbers[2];
    119131
     
    134146        for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++)
    135147          if ((*Runner).second == this) {
    136             //Log() << Verbose(5) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;
     148            //Log() << Verbose(0) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;
    137149            endpoints[i]->lines.erase(Runner);
    138150            break;
     
    140152      } else { // there's just a single line left
    141153        if (endpoints[i]->lines.erase(Nr)) {
    142           //Log() << Verbose(5) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;
     154          //Log() << Verbose(0) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;
    143155        }
    144156      }
    145157      if (endpoints[i]->lines.empty()) {
    146         //Log() << Verbose(5) << *endpoints[i] << " has no more lines it's attached to, erasing." << endl;
     158        //Log() << Verbose(0) << *endpoints[i] << " has no more lines it's attached to, erasing." << endl;
    147159        if (endpoints[i] != NULL) {
    148160          delete(endpoints[i]);
     
    153165  }
    154166  if (!triangles.empty())
    155     eLog() << Verbose(0) << "WARNING: Memory Leak! I " << *this << " am still connected to some triangles." << endl;
     167    eLog() << Verbose(2) << "Memory Leak! I " << *this << " am still connected to some triangles." << endl;
    156168};
    157169
     
    161173void BoundaryLineSet::AddTriangle(class BoundaryTriangleSet *triangle)
    162174{
    163   Log() << Verbose(6) << "Add " << triangle->Nr << " to line " << *this << "." << endl;
     175        Info FunctionInfo(__func__);
     176  Log() << Verbose(0) << "Add " << triangle->Nr << " to line " << *this << "." << endl;
    164177  triangles.insert(TrianglePair(triangle->Nr, triangle));
    165178};
     
    171184bool BoundaryLineSet::IsConnectedTo(class BoundaryLineSet *line)
    172185{
     186        Info FunctionInfo(__func__);
    173187  if ((endpoints[0] == line->endpoints[0]) || (endpoints[1] == line->endpoints[0]) || (endpoints[0] == line->endpoints[1]) || (endpoints[1] == line->endpoints[1]))
    174188    return true;
     
    185199bool BoundaryLineSet::CheckConvexityCriterion()
    186200{
     201        Info FunctionInfo(__func__);
    187202  Vector BaseLineCenter, BaseLineNormal, BaseLine, helper[2], NormalCheck;
    188203  // get the two triangles
    189204  if (triangles.size() != 2) {
    190     Log() << Verbose(1) << "ERROR: Baseline " << *this << " is connected to less than two triangles, Tesselation incomplete!" << endl;
     205    eLog() << Verbose(0) << "Baseline " << *this << " is connected to less than two triangles, Tesselation incomplete!" << endl;
    191206    return true;
    192207  }
    193208  // check normal vectors
    194209  // have a normal vector on the base line pointing outwards
    195   //Log() << Verbose(3) << "INFO: " << *this << " has vectors at " << *(endpoints[0]->node->node) << " and at " << *(endpoints[1]->node->node) << "." << endl;
     210  //Log() << Verbose(0) << "INFO: " << *this << " has vectors at " << *(endpoints[0]->node->node) << " and at " << *(endpoints[1]->node->node) << "." << endl;
    196211  BaseLineCenter.CopyVector(endpoints[0]->node->node);
    197212  BaseLineCenter.AddVector(endpoints[1]->node->node);
     
    199214  BaseLine.CopyVector(endpoints[0]->node->node);
    200215  BaseLine.SubtractVector(endpoints[1]->node->node);
    201   //Log() << Verbose(3) << "INFO: Baseline is " << BaseLine << " and its center is at " << BaseLineCenter << "." << endl;
     216  //Log() << Verbose(0) << "INFO: Baseline is " << BaseLine << " and its center is at " << BaseLineCenter << "." << endl;
    202217
    203218  BaseLineNormal.Zero();
     
    207222  class BoundaryPointSet *node = NULL;
    208223  for(TriangleMap::iterator runner = triangles.begin(); runner != triangles.end(); runner++) {
    209     //Log() << Verbose(3) << "INFO: NormalVector of " << *(runner->second) << " is " << runner->second->NormalVector << "." << endl;
     224    //Log() << Verbose(0) << "INFO: NormalVector of " << *(runner->second) << " is " << runner->second->NormalVector << "." << endl;
    210225    NormalCheck.AddVector(&runner->second->NormalVector);
    211226    NormalCheck.Scale(sign);
     
    214229      BaseLineNormal.CopyVector(&runner->second->NormalVector);   // yes, copy second on top of first
    215230    else {
    216       Log() << Verbose(1) << "CRITICAL: Triangle " << *runner->second << " has zero normal vector!" << endl;
    217       exit(255);
     231      eLog() << Verbose(0) << "Triangle " << *runner->second << " has zero normal vector!" << endl;
    218232    }
    219233    node = runner->second->GetThirdEndpoint(this);
    220234    if (node != NULL) {
    221       //Log() << Verbose(3) << "INFO: Third node for triangle " << *(runner->second) << " is " << *node << " at " << *(node->node->node) << "." << endl;
     235      //Log() << Verbose(0) << "INFO: Third node for triangle " << *(runner->second) << " is " << *node << " at " << *(node->node->node) << "." << endl;
    222236      helper[i].CopyVector(node->node->node);
    223237      helper[i].SubtractVector(&BaseLineCenter);
    224238      helper[i].MakeNormalVector(&BaseLine);  // we want to compare the triangle's heights' angles!
    225       //Log() << Verbose(4) << "INFO: Height vector with respect to baseline is " << helper[i] << "." << endl;
     239      //Log() << Verbose(0) << "INFO: Height vector with respect to baseline is " << helper[i] << "." << endl;
    226240      i++;
    227241    } else {
    228       //Log() << Verbose(2) << "ERROR: I cannot find third node in triangle, something's wrong." << endl;
     242      eLog() << Verbose(1) << "I cannot find third node in triangle, something's wrong." << endl;
    229243      return true;
    230244    }
    231245  }
    232   //Log() << Verbose(3) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl;
     246  //Log() << Verbose(0) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl;
    233247  if (NormalCheck.NormSquared() < MYEPSILON) {
    234     Log() << Verbose(3) << "ACCEPT: Normalvectors of both triangles are the same: convex." << endl;
     248    Log() << Verbose(0) << "ACCEPT: Normalvectors of both triangles are the same: convex." << endl;
    235249    return true;
    236250  }
     
    238252  double angle = GetAngle(helper[0], helper[1], BaseLineNormal);
    239253  if ((angle - M_PI) > -MYEPSILON) {
    240     Log() << Verbose(3) << "ACCEPT: Angle is greater than pi: convex." << endl;
     254    Log() << Verbose(0) << "ACCEPT: Angle is greater than pi: convex." << endl;
    241255    return true;
    242256  } else {
    243     Log() << Verbose(3) << "REJECT: Angle is less than pi: concave." << endl;
     257    Log() << Verbose(0) << "REJECT: Angle is less than pi: concave." << endl;
    244258    return false;
    245259  }
     
    252266bool BoundaryLineSet::ContainsBoundaryPoint(class BoundaryPointSet *point)
    253267{
     268        Info FunctionInfo(__func__);
    254269  for(int i=0;i<2;i++)
    255270    if (point == endpoints[i])
     
    264279class BoundaryPointSet *BoundaryLineSet::GetOtherEndpoint(class BoundaryPointSet *point)
    265280{
     281        Info FunctionInfo(__func__);
    266282  if (endpoints[0] == point)
    267283    return endpoints[1];
     
    286302/** Constructor for BoundaryTriangleSet.
    287303 */
    288 BoundaryTriangleSet::BoundaryTriangleSet()
    289 {
     304BoundaryTriangleSet::BoundaryTriangleSet() :
     305  Nr(-1)
     306{
     307        Info FunctionInfo(__func__);
    290308  for (int i = 0; i < 3; i++)
    291309    {
     
    293311      lines[i] = NULL;
    294312    }
    295   Nr = -1;
    296313};
    297314
     
    300317 * \param number number of triangle
    301318 */
    302 BoundaryTriangleSet::BoundaryTriangleSet(class BoundaryLineSet *line[3], int number)
    303 {
     319BoundaryTriangleSet::BoundaryTriangleSet(class BoundaryLineSet *line[3], int number) :
     320  Nr(number)
     321{
     322        Info FunctionInfo(__func__);
    304323  // set number
    305   Nr = number;
    306324  // set lines
    307   Log() << Verbose(5) << "New triangle " << Nr << ":" << endl;
    308   for (int i = 0; i < 3; i++)
    309     {
    310       lines[i] = line[i];
    311       lines[i]->AddTriangle(this);
    312     }
     325  for (int i = 0; i < 3; i++) {
     326    lines[i] = line[i];
     327    lines[i]->AddTriangle(this);
     328  }
    313329  // get ascending order of endpoints
    314   map<int, class BoundaryPointSet *> OrderMap;
     330  PointMap OrderMap;
    315331  for (int i = 0; i < 3; i++)
    316332    // for all three lines
    317     for (int j = 0; j < 2; j++)
    318       { // for both endpoints
    319         OrderMap.insert(pair<int, class BoundaryPointSet *> (
    320             line[i]->endpoints[j]->Nr, line[i]->endpoints[j]));
    321         // and we don't care whether insertion fails
    322       }
     333    for (int j = 0; j < 2; j++) { // for both endpoints
     334      OrderMap.insert(pair<int, class BoundaryPointSet *> (
     335          line[i]->endpoints[j]->Nr, line[i]->endpoints[j]));
     336      // and we don't care whether insertion fails
     337    }
    323338  // set endpoints
    324339  int Counter = 0;
    325   Log() << Verbose(6) << " with end points ";
    326   for (map<int, class BoundaryPointSet *>::iterator runner = OrderMap.begin(); runner
    327       != OrderMap.end(); runner++)
    328     {
    329       endpoints[Counter] = runner->second;
    330       Log() << Verbose(0) << " " << *endpoints[Counter];
    331       Counter++;
    332     }
    333   if (Counter < 3)
    334     {
    335       eLog() << Verbose(0) << "ERROR! We have a triangle with only two distinct endpoints!"
    336           << endl;
    337       //exit(1);
    338     }
    339   Log() << Verbose(0) << "." << endl;
     340  Log() << Verbose(0) << "New triangle " << Nr << " with end points: " << endl;
     341  for (PointMap::iterator runner = OrderMap.begin(); runner != OrderMap.end(); runner++) {
     342    endpoints[Counter] = runner->second;
     343    Log() << Verbose(0) << " " << *endpoints[Counter] << endl;
     344    Counter++;
     345  }
     346  if (Counter < 3) {
     347    eLog() << Verbose(0) << "We have a triangle with only two distinct endpoints!" << endl;
     348    performCriticalExit();
     349  }
    340350};
    341351
     
    346356BoundaryTriangleSet::~BoundaryTriangleSet()
    347357{
     358        Info FunctionInfo(__func__);
    348359  for (int i = 0; i < 3; i++) {
    349360    if (lines[i] != NULL) {
    350361      if (lines[i]->triangles.erase(Nr)) {
    351         //Log() << Verbose(5) << "Triangle Nr." << Nr << " erased in line " << *lines[i] << "." << endl;
     362        //Log() << Verbose(0) << "Triangle Nr." << Nr << " erased in line " << *lines[i] << "." << endl;
    352363      }
    353364      if (lines[i]->triangles.empty()) {
    354           //Log() << Verbose(5) << *lines[i] << " is no more attached to any triangle, erasing." << endl;
     365          //Log() << Verbose(0) << *lines[i] << " is no more attached to any triangle, erasing." << endl;
    355366          delete (lines[i]);
    356367          lines[i] = NULL;
     
    358369    }
    359370  }
    360   //Log() << Verbose(5) << "Erasing triangle Nr." << Nr << " itself." << endl;
     371  //Log() << Verbose(0) << "Erasing triangle Nr." << Nr << " itself." << endl;
    361372};
    362373
     
    367378void BoundaryTriangleSet::GetNormalVector(Vector &OtherVector)
    368379{
     380        Info FunctionInfo(__func__);
    369381  // get normal vector
    370382  NormalVector.MakeNormalVector(endpoints[0]->node->node, endpoints[1]->node->node, endpoints[2]->node->node);
     
    373385  if (NormalVector.ScalarProduct(&OtherVector) > 0.)
    374386    NormalVector.Scale(-1.);
     387  Log() << Verbose(1) << "Normal Vector is " << NormalVector << "." << endl;
    375388};
    376389
     
    389402bool BoundaryTriangleSet::GetIntersectionInsideTriangle(Vector *MolCenter, Vector *x, Vector *Intersection)
    390403{
     404        Info FunctionInfo(__func__);
    391405  Vector CrossPoint;
    392406  Vector helper;
    393407
    394408  if (!Intersection->GetIntersectionWithPlane(&NormalVector, endpoints[0]->node->node, MolCenter, x)) {
    395     Log() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl;
     409    eLog() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl;
    396410    return false;
    397411  }
     
    409423  } while (CrossPoint.NormSquared() < MYEPSILON);
    410424  if (i==3) {
    411     Log() << Verbose(1) << "ERROR: Could not find any cross points, something's utterly wrong here!" << endl;
    412     exit(255);
     425    eLog() << Verbose(0) << "Could not find any cross points, something's utterly wrong here!" << endl;
    413426  }
    414427  CrossPoint.SubtractVector(endpoints[i%3]->node->node);  // cross point was returned as absolute vector
     
    429442bool BoundaryTriangleSet::ContainsBoundaryLine(class BoundaryLineSet *line)
    430443{
     444        Info FunctionInfo(__func__);
    431445  for(int i=0;i<3;i++)
    432446    if (line == lines[i])
     
    441455bool BoundaryTriangleSet::ContainsBoundaryPoint(class BoundaryPointSet *point)
    442456{
     457        Info FunctionInfo(__func__);
    443458  for(int i=0;i<3;i++)
    444459    if (point == endpoints[i])
     
    453468bool BoundaryTriangleSet::ContainsBoundaryPoint(class TesselPoint *point)
    454469{
     470        Info FunctionInfo(__func__);
    455471  for(int i=0;i<3;i++)
    456472    if (point == endpoints[i]->node)
     
    465481bool BoundaryTriangleSet::IsPresentTupel(class BoundaryPointSet *Points[3])
    466482{
     483        Info FunctionInfo(__func__);
    467484  return (((endpoints[0] == Points[0])
    468485            || (endpoints[0] == Points[1])
     
    486503bool BoundaryTriangleSet::IsPresentTupel(class BoundaryTriangleSet *T)
    487504{
     505        Info FunctionInfo(__func__);
    488506  return (((endpoints[0] == T->endpoints[0])
    489507            || (endpoints[0] == T->endpoints[1])
     
    507525class BoundaryPointSet *BoundaryTriangleSet::GetThirdEndpoint(class BoundaryLineSet *line)
    508526{
     527        Info FunctionInfo(__func__);
    509528  // sanity check
    510529  if (!ContainsBoundaryLine(line))
     
    523542void BoundaryTriangleSet::GetCenter(Vector *center)
    524543{
     544        Info FunctionInfo(__func__);
    525545  center->Zero();
    526546  for(int i=0;i<3;i++)
     
    535555ostream &operator <<(ostream &ost, const BoundaryTriangleSet &a)
    536556{
    537   ost << "[" << a.Nr << "|" << a.endpoints[0]->node->Name << " at " << *a.endpoints[0]->node->node << ","
    538       << a.endpoints[1]->node->Name << " at " << *a.endpoints[1]->node->node << "," << a.endpoints[2]->node->Name << " at " << *a.endpoints[2]->node->node << "]";
     557  ost << "[" << a.Nr << "|" << a.endpoints[0]->node->Name << "," << a.endpoints[1]->node->Name << "," << a.endpoints[2]->node->Name << "]";
     558//  ost << "[" << a.Nr << "|" << a.endpoints[0]->node->Name << " at " << *a.endpoints[0]->node->node << ","
     559//      << a.endpoints[1]->node->Name << " at " << *a.endpoints[1]->node->node << "," << a.endpoints[2]->node->Name << " at " << *a.endpoints[2]->node->node << "]";
    539560  return ost;
    540561};
     
    546567TesselPoint::TesselPoint()
    547568{
     569  Info FunctionInfo(__func__);
    548570  node = NULL;
    549571  nr = -1;
     
    555577TesselPoint::~TesselPoint()
    556578{
     579  Info FunctionInfo(__func__);
    557580};
    558581
     
    569592ostream & TesselPoint::operator << (ostream &ost)
    570593{
    571   ost << "[" << (Name) << "|" << this << "]";
     594        Info FunctionInfo(__func__);
     595  ost << "[" << (nr) << "|" << this << "]";
    572596  return ost;
    573597};
     
    580604PointCloud::PointCloud()
    581605{
    582 
     606        Info FunctionInfo(__func__);
    583607};
    584608
     
    587611PointCloud::~PointCloud()
    588612{
    589 
     613        Info FunctionInfo(__func__);
    590614};
    591615
     
    594618/** Constructor of class CandidateForTesselation.
    595619 */
    596 CandidateForTesselation::CandidateForTesselation(TesselPoint *candidate, BoundaryLineSet* line, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) {
    597   point = candidate;
    598   BaseLine = line;
     620CandidateForTesselation::CandidateForTesselation (BoundaryLineSet* line) :
     621  BaseLine(line),
     622  ShortestAngle(2.*M_PI),
     623  OtherShortestAngle(2.*M_PI)
     624{
     625        Info FunctionInfo(__func__);
     626};
     627
     628
     629/** Constructor of class CandidateForTesselation.
     630 */
     631CandidateForTesselation::CandidateForTesselation (TesselPoint *candidate, BoundaryLineSet* line, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) :
     632    BaseLine(line),
     633    ShortestAngle(2.*M_PI),
     634    OtherShortestAngle(2.*M_PI)
     635{
     636        Info FunctionInfo(__func__);
    599637  OptCenter.CopyVector(&OptCandidateCenter);
    600638  OtherOptCenter.CopyVector(&OtherOptCandidateCenter);
     
    604642 */
    605643CandidateForTesselation::~CandidateForTesselation() {
    606   point = NULL;
    607644  BaseLine = NULL;
    608645};
    609646
     647/** output operator for CandidateForTesselation.
     648 * \param &ost output stream
     649 * \param &a boundary line
     650 */
     651ostream & operator <<(ostream &ost, const  CandidateForTesselation &a)
     652{
     653  ost << "[" << a.BaseLine->Nr << "|" << a.BaseLine->endpoints[0]->node->Name << "," << a.BaseLine->endpoints[1]->node->Name << "] with ";
     654  if (a.pointlist.empty())
     655    ost << "no candidate.";
     656  else {
     657    ost << "candidate";
     658    if (a.pointlist.size() != 1)
     659      ost << "s ";
     660    else
     661      ost << " ";
     662    for (TesselPointList::const_iterator Runner = a.pointlist.begin(); Runner != a.pointlist.end(); Runner++)
     663      ost << *(*Runner) << " ";
     664    ost << " at angle " << (a.ShortestAngle)<< ".";
     665  }
     666
     667  return ost;
     668};
     669
     670
    610671// =========================================================== class TESSELATION ===========================================
    611672
    612673/** Constructor of class Tesselation.
    613674 */
    614 Tesselation::Tesselation()
    615 {
    616   PointsOnBoundaryCount = 0;
    617   LinesOnBoundaryCount = 0;
    618   TrianglesOnBoundaryCount = 0;
    619   InternalPointer = PointsOnBoundary.begin();
    620   LastTriangle = NULL;
    621   TriangleFilesWritten = 0;
     675Tesselation::Tesselation() :
     676  PointsOnBoundaryCount(0),
     677  LinesOnBoundaryCount(0),
     678  TrianglesOnBoundaryCount(0),
     679  LastTriangle(NULL),
     680  TriangleFilesWritten(0),
     681  InternalPointer(PointsOnBoundary.begin())
     682{
     683        Info FunctionInfo(__func__);
    622684}
    623685;
     
    628690Tesselation::~Tesselation()
    629691{
    630   Log() << Verbose(1) << "Free'ing TesselStruct ... " << endl;
     692        Info FunctionInfo(__func__);
     693  Log() << Verbose(0) << "Free'ing TesselStruct ... " << endl;
    631694  for (TriangleMap::iterator runner = TrianglesOnBoundary.begin(); runner != TrianglesOnBoundary.end(); runner++) {
    632695    if (runner->second != NULL) {
     
    634697      runner->second = NULL;
    635698    } else
    636       eLog() << Verbose(1) << "ERROR: The triangle " << runner->first << " has already been free'd." << endl;
    637   }
    638   Log() << Verbose(1) << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl;
     699      eLog() << Verbose(1) << "The triangle " << runner->first << " has already been free'd." << endl;
     700  }
     701  Log() << Verbose(0) << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl;
    639702}
    640703;
     
    645708Vector * Tesselation::GetCenter(ofstream *out) const
    646709{
     710        Info FunctionInfo(__func__);
    647711  Vector *Center = new Vector(0.,0.,0.);
    648712  int num=0;
     
    660724TesselPoint * Tesselation::GetPoint() const
    661725{
     726        Info FunctionInfo(__func__);
    662727  return (InternalPointer->second->node);
    663728};
     
    668733TesselPoint * Tesselation::GetTerminalPoint() const
    669734{
     735        Info FunctionInfo(__func__);
    670736  PointMap::const_iterator Runner = PointsOnBoundary.end();
    671737  Runner--;
     
    678744void Tesselation::GoToNext() const
    679745{
     746        Info FunctionInfo(__func__);
    680747  if (InternalPointer != PointsOnBoundary.end())
    681748    InternalPointer++;
     
    687754void Tesselation::GoToPrevious() const
    688755{
     756        Info FunctionInfo(__func__);
    689757  if (InternalPointer != PointsOnBoundary.begin())
    690758    InternalPointer--;
     
    696764void Tesselation::GoToFirst() const
    697765{
     766        Info FunctionInfo(__func__);
    698767  InternalPointer = PointsOnBoundary.begin();
    699768};
     
    704773void Tesselation::GoToLast() const
    705774{
     775        Info FunctionInfo(__func__);
    706776  InternalPointer = PointsOnBoundary.end();
    707777  InternalPointer--;
     
    713783bool Tesselation::IsEmpty() const
    714784{
     785        Info FunctionInfo(__func__);
    715786  return (PointsOnBoundary.empty());
    716787};
     
    721792bool Tesselation::IsEnd() const
    722793{
     794        Info FunctionInfo(__func__);
    723795  return (InternalPointer == PointsOnBoundary.end());
    724796};
     
    733805Tesselation::GuessStartingTriangle()
    734806{
     807        Info FunctionInfo(__func__);
    735808  // 4b. create a starting triangle
    736809  // 4b1. create all distances
     
    779852          baseline->second.first->second->node->node,
    780853          baseline->second.second->second->node->node);
    781       Log() << Verbose(2) << "Plane vector of candidate triangle is ";
    782       PlaneVector.Output();
    783       Log() << Verbose(0) << endl;
     854      Log() << Verbose(2) << "Plane vector of candidate triangle is " << PlaneVector << endl;
    784855      // 4. loop over all points
    785856      double sign = 0.;
     
    797868          if (fabs(distance) < 1e-4) // we need to have a small epsilon around 0 which is still ok
    798869            continue;
    799           Log() << Verbose(3) << "Projection of " << checker->second->node->Name
    800               << " yields distance of " << distance << "." << endl;
     870          Log() << Verbose(2) << "Projection of " << checker->second->node->Name << " yields distance of " << distance << "." << endl;
    801871          tmp = distance / fabs(distance);
    802872          // 4b. Any have different sign to than before? (i.e. would lie outside convex hull with this starting triangle)
     
    851921      if (checker == PointsOnBoundary.end())
    852922        {
    853           Log() << Verbose(0) << "Looks like we have a candidate!" << endl;
     923          Log() << Verbose(2) << "Looks like we have a candidate!" << endl;
    854924          break;
    855925        }
     
    881951  else
    882952    {
    883       Log() << Verbose(1) << "No starting triangle found." << endl;
    884       exit(255);
     953      eLog() << Verbose(0) << "No starting triangle found." << endl;
    885954    }
    886955}
     
    902971void Tesselation::TesselateOnBoundary(const PointCloud * const cloud)
    903972{
     973        Info FunctionInfo(__func__);
    904974  bool flag;
    905975  PointMap::iterator winner;
     
    920990        // get peak point with respect to this base line's only triangle
    921991        BTS = baseline->second->triangles.begin()->second; // there is only one triangle so far
    922         Log() << Verbose(2) << "Current baseline is between " << *(baseline->second) << "." << endl;
     992        Log() << Verbose(0) << "Current baseline is between " << *(baseline->second) << "." << endl;
    923993        for (int i = 0; i < 3; i++)
    924994          if ((BTS->endpoints[i] != baseline->second->endpoints[0]) && (BTS->endpoints[i] != baseline->second->endpoints[1]))
    925995            peak = BTS->endpoints[i];
    926         Log() << Verbose(3) << " and has peak " << *peak << "." << endl;
     996        Log() << Verbose(1) << " and has peak " << *peak << "." << endl;
    927997
    928998        // prepare some auxiliary vectors
     
    9391009          CenterVector.AddVector(BTS->endpoints[i]->node->node);
    9401010        CenterVector.Scale(1. / 3.);
    941         Log() << Verbose(4) << "CenterVector of base triangle is " << CenterVector << endl;
     1011        Log() << Verbose(2) << "CenterVector of base triangle is " << CenterVector << endl;
    9421012
    9431013        // normal vector of triangle
     
    9461016        BTS->GetNormalVector(NormalVector);
    9471017        NormalVector.CopyVector(&BTS->NormalVector);
    948         Log() << Verbose(4) << "NormalVector of base triangle is " << NormalVector << endl;
     1018        Log() << Verbose(2) << "NormalVector of base triangle is " << NormalVector << endl;
    9491019
    9501020        // vector in propagation direction (out of triangle)
     
    9531023        TempVector.CopyVector(&CenterVector);
    9541024        TempVector.SubtractVector(baseline->second->endpoints[0]->node->node); // TempVector is vector on triangle plane pointing from one baseline egde towards center!
    955         //Log() << Verbose(2) << "Projection of propagation onto temp: " << PropagationVector.Projection(&TempVector) << "." << endl;
     1025        //Log() << Verbose(0) << "Projection of propagation onto temp: " << PropagationVector.Projection(&TempVector) << "." << endl;
    9561026        if (PropagationVector.ScalarProduct(&TempVector) > 0) // make sure normal propagation vector points outward from baseline
    9571027          PropagationVector.Scale(-1.);
    958         Log() << Verbose(4) << "PropagationVector of base triangle is " << PropagationVector << endl;
     1028        Log() << Verbose(2) << "PropagationVector of base triangle is " << PropagationVector << endl;
    9591029        winner = PointsOnBoundary.end();
    9601030
     
    9621032        for (PointMap::iterator target = PointsOnBoundary.begin(); target != PointsOnBoundary.end(); target++) {
    9631033          if ((target->second != baseline->second->endpoints[0]) && (target->second != baseline->second->endpoints[1])) { // don't take the same endpoints
    964             Log() << Verbose(3) << "Target point is " << *(target->second) << ":" << endl;
     1034            Log() << Verbose(1) << "Target point is " << *(target->second) << ":" << endl;
    9651035
    9661036            // first check direction, so that triangles don't intersect
     
    9691039            VirtualNormalVector.ProjectOntoPlane(&NormalVector);
    9701040            TempAngle = VirtualNormalVector.Angle(&PropagationVector);
    971             Log() << Verbose(4) << "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "." << endl;
     1041            Log() << Verbose(2) << "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "." << endl;
    9721042            if (TempAngle > (M_PI/2.)) { // no bends bigger than Pi/2 (90 degrees)
    973               Log() << Verbose(4) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", bad direction!" << endl;
     1043              Log() << Verbose(2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", bad direction!" << endl;
    9741044              continue;
    9751045            } else
    976               Log() << Verbose(4) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", good direction!" << endl;
     1046              Log() << Verbose(2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", good direction!" << endl;
    9771047
    9781048            // check first and second endpoint (if any connecting line goes to target has at least not more than 1 triangle)
     
    9801050            LineChecker[1] = baseline->second->endpoints[1]->lines.find(target->first);
    9811051            if (((LineChecker[0] != baseline->second->endpoints[0]->lines.end()) && (LineChecker[0]->second->triangles.size() == 2))) {
    982               Log() << Verbose(4) << *(baseline->second->endpoints[0]) << " has line " << *(LineChecker[0]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[0]->second->triangles.size() << " triangles." << endl;
     1052              Log() << Verbose(2) << *(baseline->second->endpoints[0]) << " has line " << *(LineChecker[0]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[0]->second->triangles.size() << " triangles." << endl;
    9831053              continue;
    9841054            }
    9851055            if (((LineChecker[1] != baseline->second->endpoints[1]->lines.end()) && (LineChecker[1]->second->triangles.size() == 2))) {
    986               Log() << Verbose(4) << *(baseline->second->endpoints[1]) << " has line " << *(LineChecker[1]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[1]->second->triangles.size() << " triangles." << endl;
     1056              Log() << Verbose(2) << *(baseline->second->endpoints[1]) << " has line " << *(LineChecker[1]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[1]->second->triangles.size() << " triangles." << endl;
    9871057              continue;
    9881058            }
     
    10011071            helper.ProjectOntoPlane(&TempVector);
    10021072            if (fabs(helper.NormSquared()) < MYEPSILON) {
    1003               Log() << Verbose(4) << "Chosen set of vectors is linear dependent." << endl;
     1073              Log() << Verbose(2) << "Chosen set of vectors is linear dependent." << endl;
    10041074              continue;
    10051075            }
     
    10181088            // calculate angle
    10191089            TempAngle = NormalVector.Angle(&VirtualNormalVector);
    1020             Log() << Verbose(4) << "NormalVector is " << VirtualNormalVector << " and the angle is " << TempAngle << "." << endl;
     1090            Log() << Verbose(2) << "NormalVector is " << VirtualNormalVector << " and the angle is " << TempAngle << "." << endl;
    10211091            if ((SmallestAngle - TempAngle) > MYEPSILON) { // set to new possible winner
    10221092              SmallestAngle = TempAngle;
    10231093              winner = target;
    1024               Log() << Verbose(4) << "New winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;
     1094              Log() << Verbose(2) << "New winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;
    10251095            } else if (fabs(SmallestAngle - TempAngle) < MYEPSILON) { // check the angle to propagation, both possible targets are in one plane! (their normals have same angle)
    10261096              // hence, check the angles to some normal direction from our base line but in this common plane of both targets...
     
    10401110                SmallestAngle = TempAngle;
    10411111                winner = target;
    1042                 Log() << Verbose(4) << "New winner " << *winner->second->node << " due to smaller angle " << TempAngle << " to propagation direction." << endl;
     1112                Log() << Verbose(2) << "New winner " << *winner->second->node << " due to smaller angle " << TempAngle << " to propagation direction." << endl;
    10431113              } else
    1044                 Log() << Verbose(4) << "Keeping old winner " << *winner->second->node << " due to smaller angle to propagation direction." << endl;
     1114                Log() << Verbose(2) << "Keeping old winner " << *winner->second->node << " due to smaller angle to propagation direction." << endl;
    10451115            } else
    1046               Log() << Verbose(4) << "Keeping old winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;
     1116              Log() << Verbose(2) << "Keeping old winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;
    10471117          }
    10481118        } // end of loop over all boundary points
     
    10501120        // 5b. The point of the above whose triangle has the greatest angle with the triangle the current line belongs to (it only belongs to one, remember!): New triangle
    10511121        if (winner != PointsOnBoundary.end()) {
    1052           Log() << Verbose(2) << "Winning target point is " << *(winner->second) << " with angle " << SmallestAngle << "." << endl;
     1122          Log() << Verbose(0) << "Winning target point is " << *(winner->second) << " with angle " << SmallestAngle << "." << endl;
    10531123          // create the lins of not yet present
    10541124          BLS[0] = baseline->second;
     
    10801150          TrianglesOnBoundaryCount++;
    10811151        } else {
    1082           Log() << Verbose(1) << "I could not determine a winner for this baseline " << *(baseline->second) << "." << endl;
     1152          eLog() << Verbose(2) << "I could not determine a winner for this baseline " << *(baseline->second) << "." << endl;
    10831153        }
    10841154
    10851155        // 5d. If the set of lines is not yet empty, go to 5. and continue
    10861156      } else
    1087         Log() << Verbose(2) << "Baseline candidate " << *(baseline->second) << " has a triangle count of " << baseline->second->triangles.size() << "." << endl;
     1157        Log() << Verbose(0) << "Baseline candidate " << *(baseline->second) << " has a triangle count of " << baseline->second->triangles.size() << "." << endl;
    10881158  } while (flag);
    10891159
     
    11001170bool Tesselation::InsertStraddlingPoints(const PointCloud *cloud, const LinkedCell *LC)
    11011171{
     1172        Info FunctionInfo(__func__);
    11021173  Vector Intersection, Normal;
    11031174  TesselPoint *Walker = NULL;
     
    11061177  bool AddFlag = false;
    11071178  LinkedCell *BoundaryPoints = NULL;
    1108 
    1109   Log() << Verbose(1) << "Begin of InsertStraddlingPoints" << endl;
    11101179
    11111180  cloud->GoToFirst();
     
    11181187    }
    11191188    Walker = cloud->GetPoint();
    1120     Log() << Verbose(2) << "Current point is " << *Walker << "." << endl;
     1189    Log() << Verbose(0) << "Current point is " << *Walker << "." << endl;
    11211190    // get the next triangle
    11221191    triangles = FindClosestTrianglesToPoint(Walker->node, BoundaryPoints);
    11231192    BTS = triangles->front();
    11241193    if ((triangles == NULL) || (BTS->ContainsBoundaryPoint(Walker))) {
    1125       Log() << Verbose(2) << "No triangles found, probably a tesselation point itself." << endl;
     1194      Log() << Verbose(0) << "No triangles found, probably a tesselation point itself." << endl;
    11261195      cloud->GoToNext();
    11271196      continue;
    11281197    } else {
    11291198    }
    1130     Log() << Verbose(2) << "Closest triangle is " << *BTS << "." << endl;
     1199    Log() << Verbose(0) << "Closest triangle is " << *BTS << "." << endl;
    11311200    // get the intersection point
    11321201    if (BTS->GetIntersectionInsideTriangle(Center, Walker->node, &Intersection)) {
    1133       Log() << Verbose(2) << "We have an intersection at " << Intersection << "." << endl;
     1202      Log() << Verbose(0) << "We have an intersection at " << Intersection << "." << endl;
    11341203      // we have the intersection, check whether in- or outside of boundary
    11351204      if ((Center->DistanceSquared(Walker->node) - Center->DistanceSquared(&Intersection)) < -MYEPSILON) {
    11361205        // inside, next!
    1137         Log() << Verbose(2) << *Walker << " is inside wrt triangle " << *BTS << "." << endl;
     1206        Log() << Verbose(0) << *Walker << " is inside wrt triangle " << *BTS << "." << endl;
    11381207      } else {
    11391208        // outside!
    1140         Log() << Verbose(2) << *Walker << " is outside wrt triangle " << *BTS << "." << endl;
     1209        Log() << Verbose(0) << *Walker << " is outside wrt triangle " << *BTS << "." << endl;
    11411210        class BoundaryLineSet *OldLines[3], *NewLines[3];
    11421211        class BoundaryPointSet *OldPoints[3], *NewPoint;
     
    11481217        Normal.CopyVector(&BTS->NormalVector);
    11491218        // add Walker to boundary points
    1150         Log() << Verbose(2) << "Adding " << *Walker << " to BoundaryPoints." << endl;
     1219        Log() << Verbose(0) << "Adding " << *Walker << " to BoundaryPoints." << endl;
    11511220        AddFlag = true;
    11521221        if (AddBoundaryPoint(Walker,0))
     
    11551224          continue;
    11561225        // remove triangle
    1157         Log() << Verbose(2) << "Erasing triangle " << *BTS << "." << endl;
     1226        Log() << Verbose(0) << "Erasing triangle " << *BTS << "." << endl;
    11581227        TrianglesOnBoundary.erase(BTS->Nr);
    11591228        delete(BTS);
     
    11631232          BPS[1] = OldPoints[i];
    11641233          NewLines[i] = new class BoundaryLineSet(BPS, LinesOnBoundaryCount);
    1165           Log() << Verbose(3) << "Creating new line " << *NewLines[i] << "." << endl;
     1234          Log() << Verbose(1) << "Creating new line " << *NewLines[i] << "." << endl;
    11661235          LinesOnBoundary.insert(LinePair(LinesOnBoundaryCount, NewLines[i])); // no need for check for unique insertion as BPS[0] is definitely a new one
    11671236          LinesOnBoundaryCount++;
     
    11741243            if (NewLines[j]->IsConnectedTo(BLS[0])) {
    11751244              if (n>2) {
    1176                 Log() << Verbose(1) << "ERROR: " << BLS[0] << " connects to all of the new lines?!" << endl;
     1245                eLog() << Verbose(2) << BLS[0] << " connects to all of the new lines?!" << endl;
    11771246                return false;
    11781247              } else
     
    11851254          BTS->GetNormalVector(Normal);
    11861255          Normal.Scale(-1.);
    1187           Log() << Verbose(2) << "Created new triangle " << *BTS << "." << endl;
     1256          Log() << Verbose(0) << "Created new triangle " << *BTS << "." << endl;
    11881257          TrianglesOnBoundary.insert(TrianglePair(TrianglesOnBoundaryCount, BTS));
    11891258          TrianglesOnBoundaryCount++;
     
    11911260      }
    11921261    } else { // something is wrong with FindClosestTriangleToPoint!
    1193       Log() << Verbose(1) << "ERROR: The closest triangle did not produce an intersection!" << endl;
     1262      eLog() << Verbose(1) << "The closest triangle did not produce an intersection!" << endl;
    11941263      return false;
    11951264    }
     
    11991268  // exit
    12001269  delete(Center);
    1201   Log() << Verbose(1) << "End of InsertStraddlingPoints" << endl;
    12021270  return true;
    12031271};
     
    12101278bool Tesselation::AddBoundaryPoint(TesselPoint * Walker, const int n)
    12111279{
     1280        Info FunctionInfo(__func__);
    12121281  PointTestPair InsertUnique;
    12131282  BPS[n] = new class BoundaryPointSet(Walker);
     
    12311300void Tesselation::AddTesselationPoint(TesselPoint* Candidate, const int n)
    12321301{
     1302        Info FunctionInfo(__func__);
    12331303  PointTestPair InsertUnique;
    12341304  TPS[n] = new class BoundaryPointSet(Candidate);
     
    12381308  } else {
    12391309    delete TPS[n];
    1240     Log() << Verbose(4) << "Node " << *((InsertUnique.first)->second->node) << " is already present in PointsOnBoundary." << endl;
     1310    Log() << Verbose(0) << "Node " << *((InsertUnique.first)->second->node) << " is already present in PointsOnBoundary." << endl;
    12411311    TPS[n] = (InsertUnique.first)->second;
    12421312  }
    12431313}
    12441314;
     1315
     1316/** Sets point to a present Tesselation::PointsOnBoundary.
     1317 * Tesselation::TPS is set to the existing one or NULL if not found.
     1318 * @param Candidate point to set to
     1319 * @param n index for this point in Tesselation::TPS array
     1320 */
     1321void Tesselation::SetTesselationPoint(TesselPoint* Candidate, const int n) const
     1322{
     1323        Info FunctionInfo(__func__);
     1324  PointMap::const_iterator FindPoint = PointsOnBoundary.find(Candidate->nr);
     1325  if (FindPoint != PointsOnBoundary.end())
     1326    TPS[n] = FindPoint->second;
     1327  else
     1328    TPS[n] = NULL;
     1329};
    12451330
    12461331/** Function tries to add line from current Points in BPS to BoundaryLineSet.
     
    12581343    pair<LineMap::iterator,LineMap::iterator> FindPair;
    12591344    FindPair = a->lines.equal_range(b->node->nr);
    1260     Log() << Verbose(5) << "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "." << endl;
     1345    Log() << Verbose(1) << "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "." << endl;
    12611346
    12621347    for (FindLine = FindPair.first; FindLine != FindPair.second; FindLine++) {
     
    12641349      if (FindLine->second->triangles.size() < 2) {
    12651350        insertNewLine = false;
    1266         Log() << Verbose(4) << "Using existing line " << *FindLine->second << endl;
     1351        Log() << Verbose(0) << "Using existing line " << *FindLine->second << endl;
    12671352
    12681353        BPS[0] = FindLine->second->endpoints[0];
    12691354        BPS[1] = FindLine->second->endpoints[1];
    12701355        BLS[n] = FindLine->second;
     1356
     1357        // remove existing line from OpenLines
     1358        CandidateMap::iterator CandidateLine = OpenLines.find(BLS[n]);
     1359        delete(CandidateLine->second);
     1360        OpenLines.erase(CandidateLine);
    12711361
    12721362        break;
     
    12911381void Tesselation::AlwaysAddTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n)
    12921382{
    1293   Log() << Verbose(4) << "Adding line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl;
     1383        Info FunctionInfo(__func__);
     1384  Log() << Verbose(0) << "Adding open line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl;
    12941385  BPS[0] = a;
    12951386  BPS[1] = b;
     
    12991390  // increase counter
    13001391  LinesOnBoundaryCount++;
     1392  // also add to open lines
     1393  CandidateForTesselation *CFT = new CandidateForTesselation(BLS[n]);
     1394  OpenLines.insert(pair< BoundaryLineSet *, CandidateForTesselation *> (BLS[n], CFT));
    13011395};
    13021396
     
    13061400void Tesselation::AddTesselationTriangle()
    13071401{
     1402        Info FunctionInfo(__func__);
    13081403  Log() << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl;
    13091404
     
    13241419void Tesselation::AddTesselationTriangle(const int nr)
    13251420{
    1326   Log() << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl;
     1421        Info FunctionInfo(__func__);
     1422  Log() << Verbose(0) << "Adding triangle to global TrianglesOnBoundary map." << endl;
    13271423
    13281424  // add triangle to global map
     
    13421438void Tesselation::RemoveTesselationTriangle(class BoundaryTriangleSet *triangle)
    13431439{
     1440        Info FunctionInfo(__func__);
    13441441  if (triangle == NULL)
    13451442    return;
    13461443  for (int i = 0; i < 3; i++) {
    13471444    if (triangle->lines[i] != NULL) {
    1348       Log() << Verbose(5) << "Removing triangle Nr." << triangle->Nr << " in line " << *triangle->lines[i] << "." << endl;
     1445      Log() << Verbose(0) << "Removing triangle Nr." << triangle->Nr << " in line " << *triangle->lines[i] << "." << endl;
    13491446      triangle->lines[i]->triangles.erase(triangle->Nr);
    13501447      if (triangle->lines[i]->triangles.empty()) {
    1351           Log() << Verbose(5) << *triangle->lines[i] << " is no more attached to any triangle, erasing." << endl;
     1448          Log() << Verbose(0) << *triangle->lines[i] << " is no more attached to any triangle, erasing." << endl;
    13521449          RemoveTesselationLine(triangle->lines[i]);
    13531450      } else {
    1354         Log() << Verbose(5) << *triangle->lines[i] << " is still attached to another triangle: ";
     1451        Log() << Verbose(0) << *triangle->lines[i] << " is still attached to another triangle: ";
    13551452        for(TriangleMap::iterator TriangleRunner = triangle->lines[i]->triangles.begin(); TriangleRunner != triangle->lines[i]->triangles.end(); TriangleRunner++)
    13561453          Log() << Verbose(0) << "[" << (TriangleRunner->second)->Nr << "|" << *((TriangleRunner->second)->endpoints[0]) << ", " << *((TriangleRunner->second)->endpoints[1]) << ", " << *((TriangleRunner->second)->endpoints[2]) << "] \t";
    13571454        Log() << Verbose(0) << endl;
    13581455//        for (int j=0;j<2;j++) {
    1359 //          Log() << Verbose(5) << "Lines of endpoint " << *(triangle->lines[i]->endpoints[j]) << ": ";
     1456//          Log() << Verbose(0) << "Lines of endpoint " << *(triangle->lines[i]->endpoints[j]) << ": ";
    13601457//          for(LineMap::iterator LineRunner = triangle->lines[i]->endpoints[j]->lines.begin(); LineRunner != triangle->lines[i]->endpoints[j]->lines.end(); LineRunner++)
    13611458//            Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t";
     
    13651462      triangle->lines[i] = NULL;  // free'd or not: disconnect
    13661463    } else
    1367       eLog() << Verbose(0) << "ERROR: This line " << i << " has already been free'd." << endl;
     1464      eLog() << Verbose(1) << "This line " << i << " has already been free'd." << endl;
    13681465  }
    13691466
    13701467  if (TrianglesOnBoundary.erase(triangle->Nr))
    1371     Log() << Verbose(5) << "Removing triangle Nr. " << triangle->Nr << "." << endl;
     1468    Log() << Verbose(0) << "Removing triangle Nr. " << triangle->Nr << "." << endl;
    13721469  delete(triangle);
    13731470};
     
    13791476void Tesselation::RemoveTesselationLine(class BoundaryLineSet *line)
    13801477{
     1478        Info FunctionInfo(__func__);
    13811479  int Numbers[2];
    13821480
     
    13991497        for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++)
    14001498          if ((*Runner).second == line) {
    1401             Log() << Verbose(5) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;
     1499            Log() << Verbose(0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;
    14021500            line->endpoints[i]->lines.erase(Runner);
    14031501            break;
     
    14051503      } else { // there's just a single line left
    14061504        if (line->endpoints[i]->lines.erase(line->Nr))
    1407           Log() << Verbose(5) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;
     1505          Log() << Verbose(0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;
    14081506      }
    14091507      if (line->endpoints[i]->lines.empty()) {
    1410         Log() << Verbose(5) << *line->endpoints[i] << " has no more lines it's attached to, erasing." << endl;
     1508        Log() << Verbose(0) << *line->endpoints[i] << " has no more lines it's attached to, erasing." << endl;
    14111509        RemoveTesselationPoint(line->endpoints[i]);
    14121510      } else {
    1413         Log() << Verbose(5) << *line->endpoints[i] << " has still lines it's attached to: ";
     1511        Log() << Verbose(0) << *line->endpoints[i] << " has still lines it's attached to: ";
    14141512        for(LineMap::iterator LineRunner = line->endpoints[i]->lines.begin(); LineRunner != line->endpoints[i]->lines.end(); LineRunner++)
    14151513          Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t";
     
    14181516      line->endpoints[i] = NULL;  // free'd or not: disconnect
    14191517    } else
    1420       eLog() << Verbose(0) << "ERROR: Endpoint " << i << " has already been free'd." << endl;
     1518      eLog() << Verbose(1) << "Endpoint " << i << " has already been free'd." << endl;
    14211519  }
    14221520  if (!line->triangles.empty())
    1423     eLog() << Verbose(0) << "WARNING: Memory Leak! I " << *line << " am still connected to some triangles." << endl;
     1521    eLog() << Verbose(2) << "Memory Leak! I " << *line << " am still connected to some triangles." << endl;
    14241522
    14251523  if (LinesOnBoundary.erase(line->Nr))
    1426     Log() << Verbose(5) << "Removing line Nr. " << line->Nr << "." << endl;
     1524    Log() << Verbose(0) << "Removing line Nr. " << line->Nr << "." << endl;
    14271525  delete(line);
    14281526};
     
    14351533void Tesselation::RemoveTesselationPoint(class BoundaryPointSet *point)
    14361534{
     1535        Info FunctionInfo(__func__);
    14371536  if (point == NULL)
    14381537    return;
    14391538  if (PointsOnBoundary.erase(point->Nr))
    1440     Log() << Verbose(5) << "Removing point Nr. " << point->Nr << "." << endl;
     1539    Log() << Verbose(0) << "Removing point Nr. " << point->Nr << "." << endl;
    14411540  delete(point);
    14421541};
     
    14511550 *                 triangles exist which is the maximum for three points
    14521551 */
    1453 int Tesselation::CheckPresenceOfTriangle(TesselPoint *Candidates[3]) {
     1552int Tesselation::CheckPresenceOfTriangle(TesselPoint *Candidates[3]) const
     1553{
     1554        Info FunctionInfo(__func__);
    14541555  int adjacentTriangleCount = 0;
    14551556  class BoundaryPointSet *Points[3];
    14561557
    1457   Log() << Verbose(2) << "Begin of CheckPresenceOfTriangle" << endl;
    14581558  // builds a triangle point set (Points) of the end points
    14591559  for (int i = 0; i < 3; i++) {
    1460     PointMap::iterator FindPoint = PointsOnBoundary.find(Candidates[i]->nr);
     1560    PointMap::const_iterator FindPoint = PointsOnBoundary.find(Candidates[i]->nr);
    14611561    if (FindPoint != PointsOnBoundary.end()) {
    14621562      Points[i] = FindPoint->second;
     
    14711571      for (int j = i; j < 3; j++) {
    14721572        if (Points[j] != NULL) {
    1473           LineMap::iterator FindLine = Points[i]->lines.find(Points[j]->node->nr);
     1573          LineMap::const_iterator FindLine = Points[i]->lines.find(Points[j]->node->nr);
    14741574          for (; (FindLine != Points[i]->lines.end()) && (FindLine->first == Points[j]->node->nr); FindLine++) {
    14751575            TriangleMap *triangles = &FindLine->second->triangles;
    1476             Log() << Verbose(3) << "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "." << endl;
    1477             for (TriangleMap::iterator FindTriangle = triangles->begin(); FindTriangle != triangles->end(); FindTriangle++) {
     1576            Log() << Verbose(1) << "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "." << endl;
     1577            for (TriangleMap::const_iterator FindTriangle = triangles->begin(); FindTriangle != triangles->end(); FindTriangle++) {
    14781578              if (FindTriangle->second->IsPresentTupel(Points)) {
    14791579                adjacentTriangleCount++;
    14801580              }
    14811581            }
    1482             Log() << Verbose(3) << "end." << endl;
     1582            Log() << Verbose(1) << "end." << endl;
    14831583          }
    14841584          // Only one of the triangle lines must be considered for the triangle count.
    1485           //Log() << Verbose(2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;
     1585          //Log() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;
    14861586          //return adjacentTriangleCount;
    14871587        }
     
    14901590  }
    14911591
    1492   Log() << Verbose(2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;
    1493   Log() << Verbose(2) << "End of CheckPresenceOfTriangle" << endl;
     1592  Log() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;
    14941593  return adjacentTriangleCount;
    14951594};
     
    15051604class BoundaryTriangleSet * Tesselation::GetPresentTriangle(TesselPoint *Candidates[3])
    15061605{
     1606        Info FunctionInfo(__func__);
    15071607  class BoundaryTriangleSet *triangle = NULL;
    15081608  class BoundaryPointSet *Points[3];
     
    15341634          }
    15351635          // Only one of the triangle lines must be considered for the triangle count.
    1536           //Log() << Verbose(2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;
     1636          //Log() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;
    15371637          //return adjacentTriangleCount;
    15381638        }
     
    15551655void Tesselation::FindStartingTriangle(const double RADIUS, const LinkedCell *LC)
    15561656{
    1557   Log() << Verbose(1) << "Begin of FindStartingTriangle\n";
     1657        Info FunctionInfo(__func__);
    15581658  int i = 0;
    1559   TesselPoint* FirstPoint = NULL;
    1560   TesselPoint* SecondPoint = NULL;
    15611659  TesselPoint* MaxPoint[NDIM];
     1660  TesselPoint* Temporary;
    15621661  double maxCoordinate[NDIM];
     1662  BoundaryLineSet BaseLine;
    15631663  Vector Oben;
    15641664  Vector helper;
     
    15791679      for (LC->n[(i+2)%NDIM]=0;LC->n[(i+2)%NDIM]<LC->N[(i+2)%NDIM];LC->n[(i+2)%NDIM]++) {
    15801680        const LinkedNodes *List = LC->GetCurrentCell();
    1581         //Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;
     1681        //Log() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;
    15821682        if (List != NULL) {
    15831683          for (LinkedNodes::const_iterator Runner = List->begin();Runner != List->end();Runner++) {
    15841684            if ((*Runner)->node->x[i] > maxCoordinate[i]) {
    1585               Log() << Verbose(2) << "New maximal for axis " << i << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl;
     1685              Log() << Verbose(1) << "New maximal for axis " << i << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl;
    15861686              maxCoordinate[i] = (*Runner)->node->x[i];
    15871687              MaxPoint[i] = (*Runner);
     
    15891689          }
    15901690        } else {
    1591           eLog() << Verbose(0) << "ERROR: The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!" << endl;
     1691          eLog() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!" << endl;
    15921692        }
    15931693      }
    15941694  }
    15951695
    1596   Log() << Verbose(2) << "Found maximum coordinates: ";
     1696  Log() << Verbose(1) << "Found maximum coordinates: ";
    15971697  for (int i=0;i<NDIM;i++)
    15981698    Log() << Verbose(0) << i << ": " << *MaxPoint[i] << "\t";
     
    16001700
    16011701  BTS = NULL;
    1602   CandidateList *OptCandidates = new CandidateList();
    16031702  for (int k=0;k<NDIM;k++) {
    16041703    Oben.Zero();
    16051704    Oben.x[k] = 1.;
    1606     FirstPoint = MaxPoint[k];
    1607     Log() << Verbose(1) << "Coordinates of start node at " << *FirstPoint->node << "." << endl;
     1705    BaseLine.endpoints[0] = new BoundaryPointSet(MaxPoint[k]);
     1706    Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine.endpoints[0]->node << "." << endl;
    16081707
    16091708    double ShortestAngle;
    1610     TesselPoint* OptCandidate = NULL;
    16111709    ShortestAngle = 999999.; // This will contain the angle, which will be always positive (when looking for second point), when looking for third point this will be the quadrant.
    16121710
    1613     FindSecondPointForTesselation(FirstPoint, Oben, OptCandidate, &ShortestAngle, RADIUS, LC); // we give same point as next candidate as its bonds are looked into in find_second_...
    1614     SecondPoint = OptCandidate;
    1615     if (SecondPoint == NULL)  // have we found a second point?
     1711    FindSecondPointForTesselation(BaseLine.endpoints[0]->node, Oben, Temporary, &ShortestAngle, RADIUS, LC); // we give same point as next candidate as its bonds are looked into in find_second_...
     1712    if (Temporary == NULL)  // have we found a second point?
    16161713      continue;
    1617 
    1618     helper.CopyVector(FirstPoint->node);
    1619     helper.SubtractVector(SecondPoint->node);
     1714    BaseLine.endpoints[1] = new BoundaryPointSet(Temporary);
     1715
     1716    helper.CopyVector(BaseLine.endpoints[0]->node->node);
     1717    helper.SubtractVector(BaseLine.endpoints[1]->node->node);
    16201718    helper.Normalize();
    16211719    Oben.ProjectOntoPlane(&helper);
     
    16241722    ShortestAngle = 2.*M_PI; // This will indicate the quadrant.
    16251723
    1626     Chord.CopyVector(FirstPoint->node); // bring into calling function
    1627     Chord.SubtractVector(SecondPoint->node);
     1724    Chord.CopyVector(BaseLine.endpoints[0]->node->node); // bring into calling function
     1725    Chord.SubtractVector(BaseLine.endpoints[1]->node->node);
    16281726    double radius = Chord.ScalarProduct(&Chord);
    16291727    double CircleRadius = sqrt(RADIUS*RADIUS - radius/4.);
     
    16361734
    16371735    // adding point 1 and point 2 and add the line between them
    1638     Log() << Verbose(1) << "Coordinates of start node at " << *FirstPoint->node << "." << endl;
    1639     AddTesselationPoint(FirstPoint, 0);
    1640     Log() << Verbose(1) << "Found second point is at " << *SecondPoint->node << ".\n";
    1641     AddTesselationPoint(SecondPoint, 1);
    1642     AddTesselationLine(TPS[0], TPS[1], 0);
    1643 
    1644     //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << helper << ".\n";
    1645     FindThirdPointForTesselation(Oben, SearchDirection, helper, BLS[0], NULL, *&OptCandidates, &ShortestAngle, RADIUS, LC);
    1646     Log() << Verbose(1) << "List of third Points is ";
    1647     for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    1648         Log() << Verbose(0) << " " << *(*it)->point;
    1649     }
    1650     Log() << Verbose(0) << endl;
    1651 
    1652     for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    1653       // add third triangle point
    1654       AddTesselationPoint((*it)->point, 2);
    1655       // add the second and third line
    1656       AddTesselationLine(TPS[1], TPS[2], 1);
    1657       AddTesselationLine(TPS[0], TPS[2], 2);
    1658       // ... and triangles to the Maps of the Tesselation class
    1659       BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
    1660       AddTesselationTriangle();
    1661       // ... and calculate its normal vector (with correct orientation)
    1662       (*it)->OptCenter.Scale(-1.);
    1663       Log() << Verbose(2) << "Anti-Oben is currently " << (*it)->OptCenter << "." << endl;
    1664       BTS->GetNormalVector((*it)->OptCenter);  // vector to compare with should point inwards
    1665       Log() << Verbose(0) << "==> Found starting triangle consists of " << *FirstPoint << ", " << *SecondPoint << " and "
    1666       << *(*it)->point << " with normal vector " << BTS->NormalVector << ".\n";
    1667 
    1668       // if we do not reach the end with the next step of iteration, we need to setup a new first line
    1669       if (it != OptCandidates->end()--) {
    1670         FirstPoint = (*it)->BaseLine->endpoints[0]->node;
    1671         SecondPoint = (*it)->point;
    1672         // adding point 1 and point 2 and the line between them
    1673         AddTesselationPoint(FirstPoint, 0);
    1674         AddTesselationPoint(SecondPoint, 1);
    1675         AddTesselationLine(TPS[0], TPS[1], 0);
    1676       }
    1677       Log() << Verbose(2) << "Projection is " << BTS->NormalVector.ScalarProduct(&Oben) << "." << endl;
    1678     }
     1736    Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine.endpoints[0]->node << "." << endl;
     1737    Log() << Verbose(0) << "Found second point is at " << *BaseLine.endpoints[1]->node << ".\n";
     1738
     1739    //Log() << Verbose(1) << "INFO: OldSphereCenter is at " << helper << ".\n";
     1740    CandidateForTesselation OptCandidates(&BaseLine);
     1741    FindThirdPointForTesselation(Oben, SearchDirection, helper, OptCandidates, NULL, RADIUS, LC);
     1742    Log() << Verbose(0) << "List of third Points is:" << endl;
     1743    for (TesselPointList::iterator it = OptCandidates.pointlist.begin(); it != OptCandidates.pointlist.end(); it++) {
     1744        Log() << Verbose(0) << " " << *(*it) << endl;
     1745    }
     1746
     1747    BTS = NULL;
     1748    AddCandidateTriangle(OptCandidates);
     1749//    delete(BaseLine.endpoints[0]);
     1750//    delete(BaseLine.endpoints[1]);
     1751
    16791752    if (BTS != NULL) // we have created one starting triangle
    16801753      break;
    16811754    else {
    16821755      // remove all candidates from the list and then the list itself
    1683       class CandidateForTesselation *remover = NULL;
    1684       for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    1685         remover = *it;
    1686         delete(remover);
    1687       }
    1688       OptCandidates->clear();
    1689     }
    1690   }
    1691 
    1692   // remove all candidates from the list and then the list itself
    1693   class CandidateForTesselation *remover = NULL;
    1694   for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    1695     remover = *it;
    1696     delete(remover);
    1697   }
    1698   delete(OptCandidates);
    1699   Log() << Verbose(1) << "End of FindStartingTriangle\n";
    1700 };
    1701 
     1756      OptCandidates.pointlist.clear();
     1757    }
     1758  }
     1759};
     1760
     1761/** Checks for a given baseline and a third point candidate whether baselines of the found triangle don't have even better candidates.
     1762 * This is supposed to prevent early closing of the tesselation.
     1763 * \param CandidateLine CandidateForTesselation with baseline and shortestangle , i.e. not \a *OptCandidate
     1764 * \param *ThirdNode third point in triangle, not in BoundaryLineSet::endpoints
     1765 * \param RADIUS radius of sphere
     1766 * \param *LC LinkedCell structure
     1767 * \return true - there is a better candidate (smaller angle than \a ShortestAngle), false - no better TesselPoint candidate found
     1768 */
     1769//bool Tesselation::HasOtherBaselineBetterCandidate(CandidateForTesselation &CandidateLine, const TesselPoint * const ThirdNode, double RADIUS, const LinkedCell * const LC) const
     1770//{
     1771//      Info FunctionInfo(__func__);
     1772//  bool result = false;
     1773//  Vector CircleCenter;
     1774//  Vector CirclePlaneNormal;
     1775//  Vector OldSphereCenter;
     1776//  Vector SearchDirection;
     1777//  Vector helper;
     1778//  TesselPoint *OtherOptCandidate = NULL;
     1779//  double OtherShortestAngle = 2.*M_PI; // This will indicate the quadrant.
     1780//  double radius, CircleRadius;
     1781//  BoundaryLineSet *Line = NULL;
     1782//  BoundaryTriangleSet *T = NULL;
     1783//
     1784//  // check both other lines
     1785//  PointMap::const_iterator FindPoint = PointsOnBoundary.find(ThirdNode->nr);
     1786//  if (FindPoint != PointsOnBoundary.end()) {
     1787//    for (int i=0;i<2;i++) {
     1788//      LineMap::const_iterator FindLine = (FindPoint->second)->lines.find(BaseRay->endpoints[0]->node->nr);
     1789//      if (FindLine != (FindPoint->second)->lines.end()) {
     1790//        Line = FindLine->second;
     1791//        Log() << Verbose(0) << "Found line " << *Line << "." << endl;
     1792//        if (Line->triangles.size() == 1) {
     1793//          T = Line->triangles.begin()->second;
     1794//          // construct center of circle
     1795//          CircleCenter.CopyVector(Line->endpoints[0]->node->node);
     1796//          CircleCenter.AddVector(Line->endpoints[1]->node->node);
     1797//          CircleCenter.Scale(0.5);
     1798//
     1799//          // construct normal vector of circle
     1800//          CirclePlaneNormal.CopyVector(Line->endpoints[0]->node->node);
     1801//          CirclePlaneNormal.SubtractVector(Line->endpoints[1]->node->node);
     1802//
     1803//          // calculate squared radius of circle
     1804//          radius = CirclePlaneNormal.ScalarProduct(&CirclePlaneNormal);
     1805//          if (radius/4. < RADIUS*RADIUS) {
     1806//            CircleRadius = RADIUS*RADIUS - radius/4.;
     1807//            CirclePlaneNormal.Normalize();
     1808//            //Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
     1809//
     1810//            // construct old center
     1811//            GetCenterofCircumcircle(&OldSphereCenter, *T->endpoints[0]->node->node, *T->endpoints[1]->node->node, *T->endpoints[2]->node->node);
     1812//            helper.CopyVector(&T->NormalVector);  // normal vector ensures that this is correct center of the two possible ones
     1813//            radius = Line->endpoints[0]->node->node->DistanceSquared(&OldSphereCenter);
     1814//            helper.Scale(sqrt(RADIUS*RADIUS - radius));
     1815//            OldSphereCenter.AddVector(&helper);
     1816//            OldSphereCenter.SubtractVector(&CircleCenter);
     1817//            //Log() << Verbose(1) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;
     1818//
     1819//            // construct SearchDirection
     1820//            SearchDirection.MakeNormalVector(&T->NormalVector, &CirclePlaneNormal);
     1821//            helper.CopyVector(Line->endpoints[0]->node->node);
     1822//            helper.SubtractVector(ThirdNode->node);
     1823//            if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards!
     1824//              SearchDirection.Scale(-1.);
     1825//            SearchDirection.ProjectOntoPlane(&OldSphereCenter);
     1826//            SearchDirection.Normalize();
     1827//            Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
     1828//            if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {
     1829//              // rotated the wrong way!
     1830//              eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl;
     1831//            }
     1832//
     1833//            // add third point
     1834//            FindThirdPointForTesselation(T->NormalVector, SearchDirection, OldSphereCenter, OptCandidates, ThirdNode, RADIUS, LC);
     1835//            for (TesselPointList::iterator it = OptCandidates.pointlist.begin(); it != OptCandidates.pointlist.end(); ++it) {
     1836//              if (((*it) == BaseRay->endpoints[0]->node) || ((*it) == BaseRay->endpoints[1]->node)) // skip if it's the same triangle than suggested
     1837//                continue;
     1838//              Log() << Verbose(0) << " Third point candidate is " << (*it)
     1839//              << " with circumsphere's center at " << (*it)->OptCenter << "." << endl;
     1840//              Log() << Verbose(0) << " Baseline is " << *BaseRay << endl;
     1841//
     1842//              // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2)
     1843//              TesselPoint *PointCandidates[3];
     1844//              PointCandidates[0] = (*it);
     1845//              PointCandidates[1] = BaseRay->endpoints[0]->node;
     1846//              PointCandidates[2] = BaseRay->endpoints[1]->node;
     1847//              bool check=false;
     1848//              int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates);
     1849//              // If there is no triangle, add it regularly.
     1850//              if (existentTrianglesCount == 0) {
     1851//                SetTesselationPoint((*it), 0);
     1852//                SetTesselationPoint(BaseRay->endpoints[0]->node, 1);
     1853//                SetTesselationPoint(BaseRay->endpoints[1]->node, 2);
     1854//
     1855//                if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) {
     1856//                  OtherOptCandidate = (*it);
     1857//                  check = true;
     1858//                }
     1859//              } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time.
     1860//                SetTesselationPoint((*it), 0);
     1861//                SetTesselationPoint(BaseRay->endpoints[0]->node, 1);
     1862//                SetTesselationPoint(BaseRay->endpoints[1]->node, 2);
     1863//
     1864//                // We demand that at most one new degenerate line is created and that this line also already exists (which has to be the case due to existentTrianglesCount == 1)
     1865//                // i.e. at least one of the three lines must be present with TriangleCount <= 1
     1866//                if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS)) {
     1867//                  OtherOptCandidate = (*it);
     1868//                  check = true;
     1869//                }
     1870//              }
     1871//
     1872//              if (check) {
     1873//                if (ShortestAngle > OtherShortestAngle) {
     1874//                  Log() << Verbose(0) << "There is a better candidate than " << *ThirdNode << " with " << ShortestAngle << " from baseline " << *Line << ": " << *OtherOptCandidate << " with " << OtherShortestAngle << "." << endl;
     1875//                  result = true;
     1876//                  break;
     1877//                }
     1878//              }
     1879//            }
     1880//            delete(OptCandidates);
     1881//            if (result)
     1882//              break;
     1883//          } else {
     1884//            Log() << Verbose(0) << "Circumcircle for base line " << *Line << " and base triangle " << T << " is too big!" << endl;
     1885//          }
     1886//        } else {
     1887//          eLog() << Verbose(2) << "Baseline is connected to two triangles already?" << endl;
     1888//        }
     1889//      } else {
     1890//        Log() << Verbose(1) << "No present baseline between " << BaseRay->endpoints[0] << " and candidate " << *ThirdNode << "." << endl;
     1891//      }
     1892//    }
     1893//  } else {
     1894//    eLog() << Verbose(1) << "Could not find the TesselPoint " << *ThirdNode << "." << endl;
     1895//  }
     1896//
     1897//  return result;
     1898//};
    17021899
    17031900/** This function finds a triangle to a line, adjacent to an existing one.
    17041901 * @param out output stream for debugging
    1705  * @param Line current baseline to search from
     1902 * @param CandidateLine current cadndiate baseline to search from
    17061903 * @param T current triangle which \a Line is edge of
    17071904 * @param RADIUS radius of the rolling ball
     
    17091906 * @param *LC LinkedCell structure with neighbouring points
    17101907 */
    1711 bool Tesselation::FindNextSuitableTriangle(BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC)
    1712 {
    1713   Log() << Verbose(0) << "Begin of FindNextSuitableTriangle\n";
     1908bool Tesselation::FindNextSuitableTriangle(CandidateForTesselation &CandidateLine, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC)
     1909{
     1910        Info FunctionInfo(__func__);
    17141911  bool result = true;
    1715   CandidateList *OptCandidates = new CandidateList();
    17161912
    17171913  Vector CircleCenter;
     
    17221918  TesselPoint *ThirdNode = NULL;
    17231919  LineMap::iterator testline;
    1724   double ShortestAngle = 2.*M_PI; // This will indicate the quadrant.
    17251920  double radius, CircleRadius;
    17261921
    1727   Log() << Verbose(1) << "Current baseline is " << Line << " of triangle " << T << "." << endl;
     1922  Log() << Verbose(0) << "Current baseline is " << *CandidateLine.BaseLine << " of triangle " << T << "." << endl;
    17281923  for (int i=0;i<3;i++)
    1729     if ((T.endpoints[i]->node != Line.endpoints[0]->node) && (T.endpoints[i]->node != Line.endpoints[1]->node))
     1924    if ((T.endpoints[i]->node != CandidateLine.BaseLine->endpoints[0]->node) && (T.endpoints[i]->node != CandidateLine.BaseLine->endpoints[1]->node))
    17301925      ThirdNode = T.endpoints[i]->node;
    17311926
    17321927  // construct center of circle
    1733   CircleCenter.CopyVector(Line.endpoints[0]->node->node);
    1734   CircleCenter.AddVector(Line.endpoints[1]->node->node);
     1928  CircleCenter.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node);
     1929  CircleCenter.AddVector(CandidateLine.BaseLine->endpoints[1]->node->node);
    17351930  CircleCenter.Scale(0.5);
    17361931
    17371932  // construct normal vector of circle
    1738   CirclePlaneNormal.CopyVector(Line.endpoints[0]->node->node);
    1739   CirclePlaneNormal.SubtractVector(Line.endpoints[1]->node->node);
     1933  CirclePlaneNormal.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node);
     1934  CirclePlaneNormal.SubtractVector(CandidateLine.BaseLine->endpoints[1]->node->node);
    17401935
    17411936  // calculate squared radius of circle
     
    17441939    CircleRadius = RADIUS*RADIUS - radius/4.;
    17451940    CirclePlaneNormal.Normalize();
    1746     //Log() << Verbose(2) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
     1941    Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
    17471942
    17481943    // construct old center
    17491944    GetCenterofCircumcircle(&OldSphereCenter, *T.endpoints[0]->node->node, *T.endpoints[1]->node->node, *T.endpoints[2]->node->node);
    17501945    helper.CopyVector(&T.NormalVector);  // normal vector ensures that this is correct center of the two possible ones
    1751     radius = Line.endpoints[0]->node->node->DistanceSquared(&OldSphereCenter);
     1946    radius = CandidateLine.BaseLine->endpoints[0]->node->node->DistanceSquared(&OldSphereCenter);
    17521947    helper.Scale(sqrt(RADIUS*RADIUS - radius));
    17531948    OldSphereCenter.AddVector(&helper);
    17541949    OldSphereCenter.SubtractVector(&CircleCenter);
    1755     //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;
     1950    Log() << Verbose(1) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;
    17561951
    17571952    // construct SearchDirection
    17581953    SearchDirection.MakeNormalVector(&T.NormalVector, &CirclePlaneNormal);
    1759     helper.CopyVector(Line.endpoints[0]->node->node);
     1954    helper.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node);
    17601955    helper.SubtractVector(ThirdNode->node);
    17611956    if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards!
     
    17631958    SearchDirection.ProjectOntoPlane(&OldSphereCenter);
    17641959    SearchDirection.Normalize();
    1765     Log() << Verbose(2) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
     1960    Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
    17661961    if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {
    17671962      // rotated the wrong way!
    1768       eLog() << Verbose(0) << "ERROR: SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl;
     1963      eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl;
    17691964    }
    17701965
    17711966    // add third point
    1772     FindThirdPointForTesselation(T.NormalVector, SearchDirection, OldSphereCenter, &Line, ThirdNode, OptCandidates, &ShortestAngle, RADIUS, LC);
     1967    FindThirdPointForTesselation(T.NormalVector, SearchDirection, OldSphereCenter, CandidateLine, ThirdNode, RADIUS, LC);
    17731968
    17741969  } else {
    1775     Log() << Verbose(1) << "Circumcircle for base line " << Line << " and base triangle " << T << " is too big!" << endl;
    1776   }
    1777 
    1778   if (OptCandidates->begin() == OptCandidates->end()) {
    1779     eLog() << Verbose(0) << "WARNING: Could not find a suitable candidate." << endl;
     1970    Log() << Verbose(0) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and base triangle " << T << " is too big!" << endl;
     1971  }
     1972
     1973  if (CandidateLine.pointlist.empty()) {
     1974    eLog() << Verbose(2) << "Could not find a suitable candidate." << endl;
    17801975    return false;
    17811976  }
    1782   Log() << Verbose(1) << "Third Points are ";
    1783   for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    1784     Log() << Verbose(0) << " " << *(*it)->point;
    1785   }
    1786   Log() << Verbose(0) << endl;
    1787 
    1788   BoundaryLineSet *BaseRay = &Line;
    1789   for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    1790     Log() << Verbose(1) << " Third point candidate is " << *(*it)->point
    1791     << " with circumsphere's center at " << (*it)->OptCenter << "." << endl;
    1792     Log() << Verbose(1) << " Baseline is " << *BaseRay << endl;
    1793 
    1794     // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2)
    1795     TesselPoint *PointCandidates[3];
    1796     PointCandidates[0] = (*it)->point;
    1797     PointCandidates[1] = BaseRay->endpoints[0]->node;
    1798     PointCandidates[2] = BaseRay->endpoints[1]->node;
    1799     int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates);
    1800 
    1801     BTS = NULL;
    1802     // If there is no triangle, add it regularly.
    1803     if (existentTrianglesCount == 0) {
    1804       AddTesselationPoint((*it)->point, 0);
    1805       AddTesselationPoint(BaseRay->endpoints[0]->node, 1);
    1806       AddTesselationPoint(BaseRay->endpoints[1]->node, 2);
    1807 
    1808       if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) {
    1809         AddTesselationLine(TPS[0], TPS[1], 0);
    1810         AddTesselationLine(TPS[0], TPS[2], 1);
    1811         AddTesselationLine(TPS[1], TPS[2], 2);
    1812 
    1813         BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
    1814         AddTesselationTriangle();
    1815         (*it)->OptCenter.Scale(-1.);
    1816         BTS->GetNormalVector((*it)->OptCenter);
    1817         (*it)->OptCenter.Scale(-1.);
    1818 
    1819         Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector
    1820           << " for this triangle ... " << endl;
    1821       //Log() << Verbose(1) << "We have "<< TrianglesOnBoundaryCount << " for line " << *BaseRay << "." << endl;
    1822       } else {
    1823         Log() << Verbose(1) << "WARNING: This triangle consisting of ";
    1824         Log() << Verbose(0) << *(*it)->point << ", ";
    1825         Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and ";
    1826         Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " ";
    1827         Log() << Verbose(0) << "exists and is not added, as it does not seem helpful!" << endl;
    1828         result = false;
    1829       }
    1830     } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time.
    1831         AddTesselationPoint((*it)->point, 0);
    1832         AddTesselationPoint(BaseRay->endpoints[0]->node, 1);
    1833         AddTesselationPoint(BaseRay->endpoints[1]->node, 2);
    1834 
    1835         // We demand that at most one new degenerate line is created and that this line also already exists (which has to be the case due to existentTrianglesCount == 1)
    1836         // i.e. at least one of the three lines must be present with TriangleCount <= 1
    1837         if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS)) {
    1838           AddTesselationLine(TPS[0], TPS[1], 0);
    1839           AddTesselationLine(TPS[0], TPS[2], 1);
    1840           AddTesselationLine(TPS[1], TPS[2], 2);
    1841 
    1842           BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
    1843           AddTesselationTriangle();  // add to global map
    1844 
    1845           (*it)->OtherOptCenter.Scale(-1.);
    1846           BTS->GetNormalVector((*it)->OtherOptCenter);
    1847           (*it)->OtherOptCenter.Scale(-1.);
    1848 
    1849           Log() << Verbose(0) << "--> WARNING: Special new triangle with " << *BTS << " and normal vector " << BTS->NormalVector
    1850           << " for this triangle ... " << endl;
    1851           Log() << Verbose(1) << "We have "<< BaseRay->triangles.size() << " for line " << BaseRay << "." << endl;
    1852         } else {
    1853           Log() << Verbose(1) << "WARNING: This triangle consisting of ";
    1854           Log() << Verbose(0) << *(*it)->point << ", ";
    1855           Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and ";
    1856           Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " ";
    1857           Log() << Verbose(0) << "exists and is not added, as it does not seem helpful!" << endl;
    1858           result = false;
    1859         }
    1860     } else {
    1861       Log() << Verbose(1) << "This triangle consisting of ";
    1862       Log() << Verbose(0) << *(*it)->point << ", ";
    1863       Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and ";
    1864       Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " ";
    1865       Log() << Verbose(0) << "is invalid!" << endl;
    1866       result = false;
    1867     }
    1868 
    1869     // set baseline to new ray from ref point (here endpoints[0]->node) to current candidate (here (*it)->point))
    1870     BaseRay = BLS[0];
    1871     if ((BTS != NULL) && (BTS->NormalVector.NormSquared() < MYEPSILON)) {
    1872       Log() << Verbose(1) << "CRITICAL: Triangle " << *BTS << " has zero normal vector!" << endl;
    1873       exit(255);
    1874     }
    1875 
    1876   }
    1877 
    1878   // remove all candidates from the list and then the list itself
    1879   class CandidateForTesselation *remover = NULL;
    1880   for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    1881     remover = *it;
    1882     delete(remover);
    1883   }
    1884   delete(OptCandidates);
    1885   Log() << Verbose(0) << "End of FindNextSuitableTriangle\n";
     1977  Log() << Verbose(0) << "Third Points are: " << endl;
     1978  for (TesselPointList::iterator it = CandidateLine.pointlist.begin(); it != CandidateLine.pointlist.end(); ++it) {
     1979    Log() << Verbose(0) << " " << *(*it) << endl;
     1980  }
     1981
     1982  return true;
     1983
     1984//  BoundaryLineSet *BaseRay = CandidateLine.BaseLine;
     1985//  for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
     1986//    Log() << Verbose(0) << "Third point candidate is " << *(*it)->point
     1987//    << " with circumsphere's center at " << (*it)->OptCenter << "." << endl;
     1988//    Log() << Verbose(0) << "Baseline is " << *BaseRay << endl;
     1989//
     1990//    // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2)
     1991//    TesselPoint *PointCandidates[3];
     1992//    PointCandidates[0] = (*it)->point;
     1993//    PointCandidates[1] = BaseRay->endpoints[0]->node;
     1994//    PointCandidates[2] = BaseRay->endpoints[1]->node;
     1995//    int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates);
     1996//
     1997//    BTS = NULL;
     1998//    // check for present edges and whether we reach better candidates from them
     1999//    //if (HasOtherBaselineBetterCandidate(BaseRay, (*it)->point, ShortestAngle, RADIUS, LC) ) {
     2000//    if (0) {
     2001//      result = false;
     2002//      break;
     2003//    } else {
     2004//      // If there is no triangle, add it regularly.
     2005//      if (existentTrianglesCount == 0) {
     2006//        AddTesselationPoint((*it)->point, 0);
     2007//        AddTesselationPoint(BaseRay->endpoints[0]->node, 1);
     2008//        AddTesselationPoint(BaseRay->endpoints[1]->node, 2);
     2009//
     2010//        if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) {
     2011//          CandidateLine.point = (*it)->point;
     2012//          CandidateLine.OptCenter.CopyVector(&((*it)->OptCenter));
     2013//          CandidateLine.OtherOptCenter.CopyVector(&((*it)->OtherOptCenter));
     2014//          CandidateLine.ShortestAngle = ShortestAngle;
     2015//        } else {
     2016////          eLog() << Verbose(1) << "This triangle consisting of ";
     2017////          Log() << Verbose(0) << *(*it)->point << ", ";
     2018////          Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and ";
     2019////          Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " ";
     2020////          Log() << Verbose(0) << "exists and is not added, as it 0x80000000006fc150(does not seem helpful!" << endl;
     2021//          result = false;
     2022//        }
     2023//      } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time.
     2024//          AddTesselationPoint((*it)->point, 0);
     2025//          AddTesselationPoint(BaseRay->endpoints[0]->node, 1);
     2026//          AddTesselationPoint(BaseRay->endpoints[1]->node, 2);
     2027//
     2028//          // We demand that at most one new degenerate line is created and that this line also already exists (which has to be the case due to existentTrianglesCount == 1)
     2029//          // i.e. at least one of the three lines must be present with TriangleCount <= 1
     2030//          if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS) || CandidateLine.BaseLine->skipped) {
     2031//            CandidateLine.point = (*it)->point;
     2032//            CandidateLine.OptCenter.CopyVector(&(*it)->OptCenter);
     2033//            CandidateLine.OtherOptCenter.CopyVector(&(*it)->OtherOptCenter);
     2034//            CandidateLine.ShortestAngle = ShortestAngle+2.*M_PI;
     2035//
     2036//          } else {
     2037////            eLog() << Verbose(1) << "This triangle consisting of " << *(*it)->point << ", " << *BaseRay->endpoints[0]->node << " and " << *BaseRay->endpoints[1]->node << " " << "exists and is not added, as it does not seem helpful!" << endl;
     2038//            result = false;
     2039//          }
     2040//      } else {
     2041////        Log() << Verbose(1) << "This triangle consisting of ";
     2042////        Log() << Verbose(0) << *(*it)->point << ", ";
     2043////        Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and ";
     2044////        Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " ";
     2045////        Log() << Verbose(0) << "is invalid!" << endl;
     2046//        result = false;
     2047//      }
     2048//    }
     2049//
     2050//    // set baseline to new ray from ref point (here endpoints[0]->node) to current candidate (here (*it)->point))
     2051//    BaseRay = BLS[0];
     2052//    if ((BTS != NULL) && (BTS->NormalVector.NormSquared() < MYEPSILON)) {
     2053//      eLog() << Verbose(1) << "Triangle " << *BTS << " has zero normal vector!" << endl;
     2054//      exit(255);
     2055//    }
     2056//
     2057//  }
     2058//
     2059//  // remove all candidates from the list and then the list itself
     2060//  class CandidateForTesselation *remover = NULL;
     2061//  for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
     2062//    remover = *it;
     2063//    delete(remover);
     2064//  }
     2065//  delete(OptCandidates);
    18862066  return result;
     2067};
     2068
     2069/** Adds the present line and candidate point from \a &CandidateLine to the Tesselation.
     2070 * \param CandidateLine triangle to add
     2071 * \NOTE we need the copy operator here as the original CandidateForTesselation is removed in AddTesselationLine()
     2072 */
     2073void Tesselation::AddCandidateTriangle(CandidateForTesselation CandidateLine)
     2074{
     2075        Info FunctionInfo(__func__);
     2076  Vector Center;
     2077  TesselPoint * const TurningPoint = CandidateLine.BaseLine->endpoints[0]->node;
     2078
     2079  // fill the set of neighbours
     2080  Center.CopyVector(CandidateLine.BaseLine->endpoints[1]->node->node);
     2081  Center.SubtractVector(TurningPoint->node);
     2082  set<TesselPoint*> SetOfNeighbours;
     2083  SetOfNeighbours.insert(CandidateLine.BaseLine->endpoints[1]->node);
     2084  for (TesselPointList::iterator Runner = CandidateLine.pointlist.begin(); Runner != CandidateLine.pointlist.end(); Runner++)
     2085    SetOfNeighbours.insert(*Runner);
     2086  TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(&SetOfNeighbours, TurningPoint, &Center);
     2087
     2088  // go through all angle-sorted candidates (in degenerate n-nodes case we may have to add multiple triangles)
     2089  TesselPointList::iterator Runner = connectedClosestPoints->begin();
     2090  TesselPointList::iterator Sprinter = Runner;
     2091  Sprinter++;
     2092  while(Sprinter != connectedClosestPoints->end()) {
     2093    // add the points
     2094    AddTesselationPoint(TurningPoint, 0);
     2095    AddTesselationPoint((*Runner), 1);
     2096    AddTesselationPoint((*Sprinter), 2);
     2097
     2098    Center.CopyVector(&CandidateLine.OptCenter);
     2099    // add the lines
     2100    AddTesselationLine(TPS[0], TPS[1], 0);
     2101    AddTesselationLine(TPS[0], TPS[2], 1);
     2102    AddTesselationLine(TPS[1], TPS[2], 2);
     2103
     2104    // add the triangles
     2105    BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
     2106    AddTesselationTriangle();
     2107    Center.Scale(-1.);
     2108    BTS->GetNormalVector(Center);
     2109
     2110    Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector << "." << endl;
     2111    Runner = Sprinter;
     2112    Sprinter++;
     2113  }
    18872114};
    18882115
     
    18962123class BoundaryPointSet *Tesselation::IsConvexRectangle(class BoundaryLineSet *Base)
    18972124{
     2125        Info FunctionInfo(__func__);
    18982126  class BoundaryPointSet *Spot = NULL;
    18992127  class BoundaryLineSet *OtherBase;
     
    19072135  OtherBase = new class BoundaryLineSet(BPS,-1);
    19082136
    1909   Log() << Verbose(3) << "INFO: Current base line is " << *Base << "." << endl;
    1910   Log() << Verbose(3) << "INFO: Other base line is " << *OtherBase << "." << endl;
     2137  Log() << Verbose(1) << "INFO: Current base line is " << *Base << "." << endl;
     2138  Log() << Verbose(1) << "INFO: Other base line is " << *OtherBase << "." << endl;
    19112139
    19122140  // get the closest point on each line to the other line
     
    19282156  delete(ClosestPoint);
    19292157  if ((distance[0] * distance[1]) > 0)  { // have same sign?
    1930     Log() << Verbose(3) << "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1]  << ". " << *Base << "' rectangle is concave." << endl;
     2158    Log() << Verbose(1) << "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1]  << ". " << *Base << "' rectangle is concave." << endl;
    19312159    if (distance[0] < distance[1]) {
    19322160      Spot = Base->endpoints[0];
     
    19362164    return Spot;
    19372165  } else {  // different sign, i.e. we are in between
    1938     Log() << Verbose(3) << "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex." << endl;
     2166    Log() << Verbose(0) << "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex." << endl;
    19392167    return NULL;
    19402168  }
     
    19442172void Tesselation::PrintAllBoundaryPoints(ofstream *out) const
    19452173{
     2174        Info FunctionInfo(__func__);
    19462175  // print all lines
    1947   Log() << Verbose(1) << "Printing all boundary points for debugging:" << endl;
     2176  Log() << Verbose(0) << "Printing all boundary points for debugging:" << endl;
    19482177  for (PointMap::const_iterator PointRunner = PointsOnBoundary.begin();PointRunner != PointsOnBoundary.end(); PointRunner++)
    1949     Log() << Verbose(2) << *(PointRunner->second) << endl;
     2178    Log() << Verbose(0) << *(PointRunner->second) << endl;
    19502179};
    19512180
    19522181void Tesselation::PrintAllBoundaryLines(ofstream *out) const
    19532182{
     2183        Info FunctionInfo(__func__);
    19542184  // print all lines
    1955   Log() << Verbose(1) << "Printing all boundary lines for debugging:" << endl;
     2185  Log() << Verbose(0) << "Printing all boundary lines for debugging:" << endl;
    19562186  for (LineMap::const_iterator LineRunner = LinesOnBoundary.begin(); LineRunner != LinesOnBoundary.end(); LineRunner++)
    1957     Log() << Verbose(2) << *(LineRunner->second) << endl;
     2187    Log() << Verbose(0) << *(LineRunner->second) << endl;
    19582188};
    19592189
    19602190void Tesselation::PrintAllBoundaryTriangles(ofstream *out) const
    19612191{
     2192        Info FunctionInfo(__func__);
    19622193  // print all triangles
    1963   Log() << Verbose(1) << "Printing all boundary triangles for debugging:" << endl;
     2194  Log() << Verbose(0) << "Printing all boundary triangles for debugging:" << endl;
    19642195  for (TriangleMap::const_iterator TriangleRunner = TrianglesOnBoundary.begin(); TriangleRunner != TrianglesOnBoundary.end(); TriangleRunner++)
    1965     Log() << Verbose(2) << *(TriangleRunner->second) << endl;
     2196    Log() << Verbose(0) << *(TriangleRunner->second) << endl;
    19662197};
    19672198
     
    19732204double Tesselation::PickFarthestofTwoBaselines(class BoundaryLineSet *Base)
    19742205{
     2206        Info FunctionInfo(__func__);
    19752207  class BoundaryLineSet *OtherBase;
    19762208  Vector *ClosestPoint[2];
     
    19842216  OtherBase = new class BoundaryLineSet(BPS,-1);
    19852217
    1986   Log() << Verbose(3) << "INFO: Current base line is " << *Base << "." << endl;
    1987   Log() << Verbose(3) << "INFO: Other base line is " << *OtherBase << "." << endl;
     2218  Log() << Verbose(0) << "INFO: Current base line is " << *Base << "." << endl;
     2219  Log() << Verbose(0) << "INFO: Other base line is " << *OtherBase << "." << endl;
    19882220
    19892221  // get the closest point on each line to the other line
     
    20052237
    20062238  if (Distance.NormSquared() < MYEPSILON) { // check for intersection
    2007     Log() << Verbose(3) << "REJECT: Both lines have an intersection: Nothing to do." << endl;
     2239    Log() << Verbose(0) << "REJECT: Both lines have an intersection: Nothing to do." << endl;
    20082240    return false;
    20092241  } else { // check for sign against BaseLineNormal
     
    20112243    BaseLineNormal.Zero();
    20122244    if (Base->triangles.size() < 2) {
    2013       Log() << Verbose(2) << "ERROR: Less than two triangles are attached to this baseline!" << endl;
     2245      eLog() << Verbose(1) << "Less than two triangles are attached to this baseline!" << endl;
    20142246      return 0.;
    20152247    }
    20162248    for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) {
    2017       Log() << Verbose(4) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;
     2249      Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;
    20182250      BaseLineNormal.AddVector(&(runner->second->NormalVector));
    20192251    }
     
    20212253
    20222254    if (Distance.ScalarProduct(&BaseLineNormal) > MYEPSILON) { // Distance points outwards, hence OtherBase higher than Base -> flip
    2023       Log() << Verbose(2) << "ACCEPT: Other base line would be higher: Flipping baseline." << endl;
     2255      Log() << Verbose(0) << "ACCEPT: Other base line would be higher: Flipping baseline." << endl;
    20242256      // calculate volume summand as a general tetraeder
    20252257      return volume;
    20262258    } else {  // Base higher than OtherBase -> do nothing
    2027       Log() << Verbose(2) << "REJECT: Base line is higher: Nothing to do." << endl;
     2259      Log() << Verbose(0) << "REJECT: Base line is higher: Nothing to do." << endl;
    20282260      return 0.;
    20292261    }
     
    20402272class BoundaryLineSet * Tesselation::FlipBaseline(class BoundaryLineSet *Base)
    20412273{
     2274        Info FunctionInfo(__func__);
    20422275  class BoundaryLineSet *OldLines[4], *NewLine;
    20432276  class BoundaryPointSet *OldPoints[2];
     
    20462279  int i,m;
    20472280
    2048   Log() << Verbose(1) << "Begin of FlipBaseline" << endl;
    2049 
    20502281  // calculate NormalVector for later use
    20512282  BaseLineNormal.Zero();
    20522283  if (Base->triangles.size() < 2) {
    2053     Log() << Verbose(2) << "ERROR: Less than two triangles are attached to this baseline!" << endl;
     2284    eLog() << Verbose(1) << "Less than two triangles are attached to this baseline!" << endl;
    20542285    return NULL;
    20552286  }
    20562287  for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) {
    2057     Log() << Verbose(4) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;
     2288    Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;
    20582289    BaseLineNormal.AddVector(&(runner->second->NormalVector));
    20592290  }
     
    20682299  i=0;
    20692300  m=0;
    2070   Log() << Verbose(3) << "The four old lines are: ";
     2301  Log() << Verbose(0) << "The four old lines are: ";
    20712302  for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++)
    20722303    for (int j=0;j<3;j++) // all of their endpoints and baselines
     
    20762307      }
    20772308  Log() << Verbose(0) << endl;
    2078   Log() << Verbose(3) << "The two old points are: ";
     2309  Log() << Verbose(0) << "The two old points are: ";
    20792310  for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++)
    20802311    for (int j=0;j<3;j++) // all of their endpoints and baselines
     
    20872318  // check whether everything is in place to create new lines and triangles
    20882319  if (i<4) {
    2089     Log() << Verbose(1) << "ERROR: We have not gathered enough baselines!" << endl;
     2320    eLog() << Verbose(1) << "We have not gathered enough baselines!" << endl;
    20902321    return NULL;
    20912322  }
    20922323  for (int j=0;j<4;j++)
    20932324    if (OldLines[j] == NULL) {
    2094       Log() << Verbose(1) << "ERROR: We have not gathered enough baselines!" << endl;
     2325      eLog() << Verbose(1) << "We have not gathered enough baselines!" << endl;
    20952326      return NULL;
    20962327    }
    20972328  for (int j=0;j<2;j++)
    20982329    if (OldPoints[j] == NULL) {
    2099       Log() << Verbose(1) << "ERROR: We have not gathered enough endpoints!" << endl;
     2330      eLog() << Verbose(1) << "We have not gathered enough endpoints!" << endl;
    21002331      return NULL;
    21012332    }
    21022333
    21032334  // remove triangles and baseline removes itself
    2104   Log() << Verbose(3) << "INFO: Deleting baseline " << *Base << " from global list." << endl;
     2335  Log() << Verbose(0) << "INFO: Deleting baseline " << *Base << " from global list." << endl;
    21052336  OldBaseLineNr = Base->Nr;
    21062337  m=0;
    21072338  for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) {
    2108     Log() << Verbose(3) << "INFO: Deleting triangle " << *(runner->second) << "." << endl;
     2339    Log() << Verbose(0) << "INFO: Deleting triangle " << *(runner->second) << "." << endl;
    21092340    OldTriangleNrs[m++] = runner->second->Nr;
    21102341    RemoveTesselationTriangle(runner->second);
     
    21162347  NewLine = new class BoundaryLineSet(BPS, OldBaseLineNr);
    21172348  LinesOnBoundary.insert(LinePair(OldBaseLineNr, NewLine)); // no need for check for unique insertion as NewLine is definitely a new one
    2118   Log() << Verbose(3) << "INFO: Created new baseline " << *NewLine << "." << endl;
     2349  Log() << Verbose(0) << "INFO: Created new baseline " << *NewLine << "." << endl;
    21192350
    21202351  // construct new triangles with flipped baseline
     
    21312362    BTS->GetNormalVector(BaseLineNormal);
    21322363    AddTesselationTriangle(OldTriangleNrs[0]);
    2133     Log() << Verbose(3) << "INFO: Created new triangle " << *BTS << "." << endl;
     2364    Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl;
    21342365
    21352366    BLS[0] = (i==2 ? OldLines[3] : OldLines[2]);
     
    21392370    BTS->GetNormalVector(BaseLineNormal);
    21402371    AddTesselationTriangle(OldTriangleNrs[1]);
    2141     Log() << Verbose(3) << "INFO: Created new triangle " << *BTS << "." << endl;
     2372    Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl;
    21422373  } else {
    2143     Log() << Verbose(1) << "The four old lines do not connect, something's utterly wrong here!" << endl;
     2374    eLog() << Verbose(0) << "The four old lines do not connect, something's utterly wrong here!" << endl;
    21442375    return NULL;
    21452376  }
    21462377
    2147   Log() << Verbose(1) << "End of FlipBaseline" << endl;
    21482378  return NewLine;
    21492379};
     
    21602390void Tesselation::FindSecondPointForTesselation(TesselPoint* a, Vector Oben, TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell *LC)
    21612391{
    2162   Log() << Verbose(2) << "Begin of FindSecondPointForTesselation" << endl;
     2392        Info FunctionInfo(__func__);
    21632393  Vector AngleCheck;
    21642394  class TesselPoint* Candidate = NULL;
     
    21732403      N[i] = LC->n[i];
    21742404  } else {
    2175     eLog() << Verbose(0) << "ERROR: Point " << *a << " is not found in cell " << LC->index << "." << endl;
     2405    eLog() << Verbose(1) << "Point " << *a << " is not found in cell " << LC->index << "." << endl;
    21762406    return;
    21772407  }
    21782408  // then go through the current and all neighbouring cells and check the contained points for possible candidates
    2179   Log() << Verbose(3) << "LC Intervals from [";
    2180   for (int i=0;i<NDIM;i++) {
    2181   Log() << Verbose(0) << " " << N[i] << "<->" << LC->N[i];
    2182   }
    2183   Log() << Verbose(0) << "] :";
    21842409  for (int i=0;i<NDIM;i++) {
    21852410    Nlower[i] = ((N[i]-1) >= 0) ? N[i]-1 : 0;
    21862411    Nupper[i] = ((N[i]+1) < LC->N[i]) ? N[i]+1 : LC->N[i]-1;
    2187     Log() << Verbose(0) << " [" << Nlower[i] << "," << Nupper[i] << "] ";
    2188   }
    2189   Log() << Verbose(0) << endl;
    2190 
     2412  }
     2413  Log() << Verbose(0) << "LC Intervals from [" << N[0] << "<->" << LC->N[0] << ", " << N[1] << "<->" << LC->N[1] << ", " << N[2] << "<->" << LC->N[2] << "] :"
     2414    << " [" << Nlower[0] << "," << Nupper[0] << "], " << " [" << Nlower[1] << "," << Nupper[1] << "], " << " [" << Nlower[2] << "," << Nupper[2] << "], " << endl;
    21912415
    21922416  for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++)
     
    21942418      for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) {
    21952419        const LinkedNodes *List = LC->GetCurrentCell();
    2196         //Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;
     2420        //Log() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;
    21972421        if (List != NULL) {
    21982422          for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
     
    22252449                angle = AngleCheck.Angle(&Oben);
    22262450                if (angle < Storage[0]) {
    2227                   //Log() << Verbose(3) << "Old values of Storage: %lf %lf \n", Storage[0], Storage[1]);
    2228                   Log() << Verbose(3) << "Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << ".\n";
     2451                  //Log() << Verbose(1) << "Old values of Storage: %lf %lf \n", Storage[0], Storage[1]);
     2452                  Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << ".\n";
    22292453                  OptCandidate = Candidate;
    22302454                  Storage[0] = angle;
    2231                   //Log() << Verbose(3) << "Changing something in Storage: %lf %lf. \n", Storage[0], Storage[2]);
     2455                  //Log() << Verbose(1) << "Changing something in Storage: %lf %lf. \n", Storage[0], Storage[2]);
    22322456                } else {
    2233                   //Log() << Verbose(3) << "Current candidate is " << *Candidate << ": Looses with angle " << angle << " to a better candidate " << *OptCandidate << endl;
     2457                  //Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Looses with angle " << angle << " to a better candidate " << *OptCandidate << endl;
    22342458                }
    22352459              } else {
    2236                 //Log() << Verbose(3) << "Current candidate is " << *Candidate << ": Refused due to Radius " << norm << endl;
     2460                //Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Refused due to Radius " << norm << endl;
    22372461              }
    22382462            } else {
    2239               //Log() << Verbose(3) << "Current candidate is " << *Candidate << ": Candidate is equal to first endpoint." << *a << "." << endl;
     2463              //Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Candidate is equal to first endpoint." << *a << "." << endl;
    22402464            }
    22412465          }
    22422466        } else {
    2243           Log() << Verbose(3) << "Linked cell list is empty." << endl;
     2467          Log() << Verbose(0) << "Linked cell list is empty." << endl;
    22442468        }
    22452469      }
    2246   Log() << Verbose(2) << "End of FindSecondPointForTesselation" << endl;
    22472470};
    22482471
     
    22732496 * @param SearchDirection general direction where to search for the next point, relative to center of BaseLine
    22742497 * @param OldSphereCenter center of sphere for base triangle, relative to center of BaseLine, giving null angle for the parameter circle
    2275  * @param BaseLine BoundaryLineSet with the current base line
     2498 * @param CandidateLine CandidateForTesselation with the current base line and list of candidates and ShortestAngle
    22762499 * @param ThirdNode third point to avoid in search
    2277  * @param candidates list of equally good candidates to return
    2278  * @param ShortestAngle the current path length on this circle band for the current OptCandidate
    22792500 * @param RADIUS radius of sphere
    22802501 * @param *LC LinkedCell structure with neighbouring points
    22812502 */
    2282 void Tesselation::FindThirdPointForTesselation(Vector NormalVector, Vector SearchDirection, Vector OldSphereCenter, class BoundaryLineSet *BaseLine, class TesselPoint  *ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, const LinkedCell *LC)
    2283 {
     2503void Tesselation::FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, CandidateForTesselation &CandidateLine, const class TesselPoint  * const ThirdNode, const double RADIUS, const LinkedCell *LC) const
     2504{
     2505        Info FunctionInfo(__func__);
    22842506  Vector CircleCenter;  // center of the circle, i.e. of the band of sphere's centers
    22852507  Vector CirclePlaneNormal; // normal vector defining the plane this circle lives in
     
    22942516  int N[NDIM], Nlower[NDIM], Nupper[NDIM];
    22952517  TesselPoint *Candidate = NULL;
    2296   CandidateForTesselation *optCandidate = NULL;
    2297 
    2298   Log() << Verbose(1) << "Begin of FindThirdPointForTesselation" << endl;
    2299 
    2300   Log() << Verbose(2) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl;
     2518
     2519  Log() << Verbose(1) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl;
    23012520
    23022521  // construct center of circle
    2303   CircleCenter.CopyVector(BaseLine->endpoints[0]->node->node);
    2304   CircleCenter.AddVector(BaseLine->endpoints[1]->node->node);
     2522  CircleCenter.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node);
     2523  CircleCenter.AddVector(CandidateLine.BaseLine->endpoints[1]->node->node);
    23052524  CircleCenter.Scale(0.5);
    23062525
    23072526  // construct normal vector of circle
    2308   CirclePlaneNormal.CopyVector(BaseLine->endpoints[0]->node->node);
    2309   CirclePlaneNormal.SubtractVector(BaseLine->endpoints[1]->node->node);
     2527  CirclePlaneNormal.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node);
     2528  CirclePlaneNormal.SubtractVector(CandidateLine.BaseLine->endpoints[1]->node->node);
    23102529
    23112530  // calculate squared radius TesselPoint *ThirdNode,f circle
     
    23142533    CircleRadius = RADIUS*RADIUS - radius/4.;
    23152534    CirclePlaneNormal.Normalize();
    2316     //Log() << Verbose(2) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
     2535    //Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
    23172536
    23182537    // test whether old center is on the band's plane
    23192538    if (fabs(OldSphereCenter.ScalarProduct(&CirclePlaneNormal)) > HULLEPSILON) {
    2320       eLog() << Verbose(0) << "ERROR: Something's very wrong here: OldSphereCenter is not on the band's plane as desired by " << fabs(OldSphereCenter.ScalarProduct(&CirclePlaneNormal)) << "!" << endl;
     2539      eLog() << Verbose(1) << "Something's very wrong here: OldSphereCenter is not on the band's plane as desired by " << fabs(OldSphereCenter.ScalarProduct(&CirclePlaneNormal)) << "!" << endl;
    23212540      OldSphereCenter.ProjectOntoPlane(&CirclePlaneNormal);
    23222541    }
    23232542    radius = OldSphereCenter.ScalarProduct(&OldSphereCenter);
    23242543    if (fabs(radius - CircleRadius) < HULLEPSILON) {
    2325       //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;
     2544      //Log() << Verbose(1) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;
    23262545
    23272546      // check SearchDirection
    2328       //Log() << Verbose(2) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
     2547      //Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
    23292548      if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {  // rotated the wrong way!
    2330         eLog() << Verbose(0) << "ERROR: SearchDirection and RelativeOldSphereCenter are not orthogonal!" << endl;
     2549        eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are not orthogonal!" << endl;
    23312550      }
    23322551
     
    23352554        for(int i=0;i<NDIM;i++) // store indices of this cell
    23362555        N[i] = LC->n[i];
    2337         //Log() << Verbose(2) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
     2556        //Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
    23382557      } else {
    2339         eLog() << Verbose(0) << "ERROR: Vector " << CircleCenter << " is outside of LinkedCell's bounding box." << endl;
     2558        eLog() << Verbose(1) << "Vector " << CircleCenter << " is outside of LinkedCell's bounding box." << endl;
    23402559        return;
    23412560      }
    23422561      // then go through the current and all neighbouring cells and check the contained points for possible candidates
    2343       //Log() << Verbose(2) << "LC Intervals:";
     2562      //Log() << Verbose(1) << "LC Intervals:";
    23442563      for (int i=0;i<NDIM;i++) {
    23452564        Nlower[i] = ((N[i]-1) >= 0) ? N[i]-1 : 0;
     
    23522571          for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) {
    23532572            const LinkedNodes *List = LC->GetCurrentCell();
    2354             //Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;
     2573            //Log() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;
    23552574            if (List != NULL) {
    23562575              for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
     
    23582577
    23592578                // check for three unique points
    2360                 //Log() << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " at " << Candidate->node << "." << endl;
    2361                 if ((Candidate != BaseLine->endpoints[0]->node) && (Candidate != BaseLine->endpoints[1]->node) ){
     2579                Log() << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " at " << *(Candidate->node) << "." << endl;
     2580                if ((Candidate != CandidateLine.BaseLine->endpoints[0]->node) && (Candidate != CandidateLine.BaseLine->endpoints[1]->node) ){
    23622581
    23632582                  // construct both new centers
    2364                   GetCenterofCircumcircle(&NewSphereCenter, *BaseLine->endpoints[0]->node->node, *BaseLine->endpoints[1]->node->node, *Candidate->node);
     2583                  GetCenterofCircumcircle(&NewSphereCenter, *CandidateLine.BaseLine->endpoints[0]->node->node, *CandidateLine.BaseLine->endpoints[1]->node->node, *Candidate->node);
    23652584                  OtherNewSphereCenter.CopyVector(&NewSphereCenter);
    23662585
    2367                   if ((NewNormalVector.MakeNormalVector(BaseLine->endpoints[0]->node->node, BaseLine->endpoints[1]->node->node, Candidate->node))
     2586                  if ((NewNormalVector.MakeNormalVector(CandidateLine.BaseLine->endpoints[0]->node->node, CandidateLine.BaseLine->endpoints[1]->node->node, Candidate->node))
    23682587                  && (fabs(NewNormalVector.ScalarProduct(&NewNormalVector)) > HULLEPSILON)
    23692588                  ) {
    23702589                    helper.CopyVector(&NewNormalVector);
    2371                     //Log() << Verbose(2) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl;
    2372                     radius = BaseLine->endpoints[0]->node->node->DistanceSquared(&NewSphereCenter);
     2590                    Log() << Verbose(1) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl;
     2591                    radius = CandidateLine.BaseLine->endpoints[0]->node->node->DistanceSquared(&NewSphereCenter);
    23732592                    if (radius < RADIUS*RADIUS) {
    23742593                      helper.Scale(sqrt(RADIUS*RADIUS - radius));
    2375                       //Log() << Verbose(2) << "INFO: Distance of NewCircleCenter to NewSphereCenter is " << helper.Norm() << " with sphere radius " << RADIUS << "." << endl;
     2594                      Log() << Verbose(2) << "INFO: Distance of NewCircleCenter to NewSphereCenter is " << helper.Norm() << " with sphere radius " << RADIUS << "." << endl;
    23762595                      NewSphereCenter.AddVector(&helper);
    23772596                      NewSphereCenter.SubtractVector(&CircleCenter);
    2378                       //Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl;
     2597                      Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl;
    23792598
    23802599                      // OtherNewSphereCenter is created by the same vector just in the other direction
     
    23822601                      OtherNewSphereCenter.AddVector(&helper);
    23832602                      OtherNewSphereCenter.SubtractVector(&CircleCenter);
    2384                       //Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl;
     2603                      Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl;
    23852604
    23862605                      alpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, NewSphereCenter, OldSphereCenter, NormalVector, SearchDirection);
     
    23892608                      // if there is a better candidate, drop the current list and add the new candidate
    23902609                      // otherwise ignore the new candidate and keep the list
    2391                       if (*ShortestAngle > (alpha - HULLEPSILON)) {
    2392                         optCandidate = new CandidateForTesselation(Candidate, BaseLine, OptCandidateCenter, OtherOptCandidateCenter);
     2610                      if (CandidateLine.ShortestAngle > (alpha - HULLEPSILON)) {
    23932611                        if (fabs(alpha - Otheralpha) > MYEPSILON) {
    2394                           optCandidate->OptCenter.CopyVector(&NewSphereCenter);
    2395                           optCandidate->OtherOptCenter.CopyVector(&OtherNewSphereCenter);
     2612                          CandidateLine.OptCenter.CopyVector(&NewSphereCenter);
     2613                          CandidateLine.OtherOptCenter.CopyVector(&OtherNewSphereCenter);
    23962614                        } else {
    2397                           optCandidate->OptCenter.CopyVector(&OtherNewSphereCenter);
    2398                           optCandidate->OtherOptCenter.CopyVector(&NewSphereCenter);
     2615                          CandidateLine.OptCenter.CopyVector(&OtherNewSphereCenter);
     2616                          CandidateLine.OtherOptCenter.CopyVector(&NewSphereCenter);
    23992617                        }
    24002618                        // if there is an equal candidate, add it to the list without clearing the list
    2401                         if ((*ShortestAngle - HULLEPSILON) < alpha) {
    2402                           candidates->push_back(optCandidate);
    2403                           Log() << Verbose(2) << "ACCEPT: We have found an equally good candidate: " << *(optCandidate->point) << " with "
    2404                             << alpha << " and circumsphere's center at " << optCandidate->OptCenter << "." << endl;
     2619                        if ((CandidateLine.ShortestAngle - HULLEPSILON) < alpha) {
     2620                          CandidateLine.pointlist.push_back(Candidate);
     2621                          Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with "
     2622                            << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl;
    24052623                        } else {
    24062624                          // remove all candidates from the list and then the list itself
    2407                           class CandidateForTesselation *remover = NULL;
    2408                           for (CandidateList::iterator it = candidates->begin(); it != candidates->end(); ++it) {
    2409                             remover = *it;
    2410                             delete(remover);
    2411                           }
    2412                           candidates->clear();
    2413                           candidates->push_back(optCandidate);
    2414                           Log() << Verbose(2) << "ACCEPT: We have found a better candidate: " << *(optCandidate->point) << " with "
    2415                             << alpha << " and circumsphere's center at " << optCandidate->OptCenter << "." << endl;
     2625                          CandidateLine.pointlist.clear();
     2626                          CandidateLine.pointlist.push_back(Candidate);
     2627                          Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with "
     2628                            << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl;
    24162629                        }
    2417                         *ShortestAngle = alpha;
    2418                         //Log() << Verbose(2) << "INFO: There are " << candidates->size() << " candidates in the list now." << endl;
     2630                        CandidateLine.ShortestAngle = alpha;
     2631                        Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl;
    24192632                      } else {
    2420                         if ((optCandidate != NULL) && (optCandidate->point != NULL)) {
    2421                           //Log() << Verbose(2) << "REJECT: Old candidate " << *(optCandidate->point) << " with " << *ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl;
     2633                        if ((Candidate != NULL) && (CandidateLine.pointlist.begin() != CandidateLine.pointlist.end())) {
     2634                          Log() << Verbose(1) << "REJECT: Old candidate " << *(Candidate) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl;
    24222635                        } else {
    2423                           //Log() << Verbose(2) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl;
     2636                          Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl;
    24242637                        }
    24252638                      }
    24262639
    24272640                    } else {
    2428                       //Log() << Verbose(2) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl;
     2641                      Log() << Verbose(1) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl;
    24292642                    }
    24302643                  } else {
    2431                     //Log() << Verbose(2) << "REJECT: Three points from " << *BaseLine << " and Candidate " << *Candidate << " are linear-dependent." << endl;
     2644                    Log() << Verbose(1) << "REJECT: Three points from " << *CandidateLine.BaseLine << " and Candidate " << *Candidate << " are linear-dependent." << endl;
    24322645                  }
    24332646                } else {
    24342647                  if (ThirdNode != NULL) {
    2435                     //Log() << Verbose(2) << "REJECT: Base triangle " << *BaseLine << " and " << *ThirdNode << " contains Candidate " << *Candidate << "." << endl;
     2648                    Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " and " << *ThirdNode << " contains Candidate " << *Candidate << "." << endl;
    24362649                  } else {
    2437                     //Log() << Verbose(2) << "REJECT: Base triangle " << *BaseLine << " contains Candidate " << *Candidate << "." << endl;
     2650                    Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " contains Candidate " << *Candidate << "." << endl;
    24382651                  }
    24392652                }
     
    24422655          }
    24432656    } else {
    2444       eLog() << Verbose(2) << "ERROR: The projected center of the old sphere has radius " << radius << " instead of " << CircleRadius << "." << endl;
     2657      eLog() << Verbose(1) << "The projected center of the old sphere has radius " << radius << " instead of " << CircleRadius << "." << endl;
    24452658    }
    24462659  } else {
    24472660    if (ThirdNode != NULL)
    2448       Log() << Verbose(2) << "Circumcircle for base line " << *BaseLine << " and third node " << *ThirdNode << " is too big!" << endl;
     2661      Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and third node " << *ThirdNode << " is too big!" << endl;
    24492662    else
    2450       Log() << Verbose(2) << "Circumcircle for base line " << *BaseLine << " is too big!" << endl;
    2451   }
    2452 
    2453   //Log() << Verbose(2) << "INFO: Sorting candidate list ..." << endl;
    2454   if (candidates->size() > 1) {
    2455     candidates->unique();
    2456     candidates->sort(SortCandidates);
    2457   }
    2458 
    2459   Log() << Verbose(1) << "End of FindThirdPointForTesselation" << endl;
     2663      Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " is too big!" << endl;
     2664  }
     2665
     2666  Log() << Verbose(1) << "INFO: Sorting candidate list ..." << endl;
     2667  if (CandidateLine.pointlist.size() > 1) {
     2668    CandidateLine.pointlist.unique();
     2669    CandidateLine.pointlist.sort(); //SortCandidates);
     2670  }
    24602671};
    24612672
     
    24672678class BoundaryPointSet *Tesselation::GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const
    24682679{
     2680        Info FunctionInfo(__func__);
    24692681  const BoundaryLineSet * lines[2] = { line1, line2 };
    24702682  class BoundaryPointSet *node = NULL;
     
    24802692          { // if insertion fails, we have common endpoint
    24812693            node = OrderTest.first->second;
    2482             Log() << Verbose(5) << "Common endpoint of lines " << *line1
     2694            Log() << Verbose(1) << "Common endpoint of lines " << *line1
    24832695                << " and " << *line2 << " is: " << *node << "." << endl;
    24842696            j = 2;
     
    24972709list<BoundaryTriangleSet*> * Tesselation::FindClosestTrianglesToPoint(const Vector *x, const LinkedCell* LC) const
    24982710{
     2711        Info FunctionInfo(__func__);
    24992712  TesselPoint *trianglePoints[3];
    25002713  TesselPoint *SecondPoint = NULL;
     
    25022715
    25032716  if (LinesOnBoundary.empty()) {
    2504     Log() << Verbose(0) << "Error: There is no tesselation structure to compare the point with, please create one first.";
     2717    eLog() << Verbose(1) << "Error: There is no tesselation structure to compare the point with, please create one first.";
    25052718    return NULL;
    25062719  }
     
    25102723  // check whether closest point is "too close" :), then it's inside
    25112724  if (trianglePoints[0] == NULL) {
    2512     Log() << Verbose(2) << "Is the only point, no one else is closeby." << endl;
     2725    Log() << Verbose(0) << "Is the only point, no one else is closeby." << endl;
    25132726    return NULL;
    25142727  }
    25152728  if (trianglePoints[0]->node->DistanceSquared(x) < MYEPSILON) {
    2516     Log() << Verbose(3) << "Point is right on a tesselation point, no nearest triangle." << endl;
     2729    Log() << Verbose(1) << "Point is right on a tesselation point, no nearest triangle." << endl;
    25172730    PointMap::const_iterator PointRunner = PointsOnBoundary.find(trianglePoints[0]->nr);
    25182731    triangles = new list<BoundaryTriangleSet*>;
     
    25332746        triangles->unique();
    25342747      } else {
    2535         Log() << Verbose(1) << "ERROR: I cannot find a boundary point to the tessel point " << *trianglePoints[0] << "." << endl;
     2748        eLog() << Verbose(1) << "I cannot find a boundary point to the tessel point " << *trianglePoints[0] << "." << endl;
    25362749        return NULL;
    25372750      }
    25382751    }
    25392752  } else {
    2540     list<TesselPoint*> *connectedClosestPoints = GetCircleOfConnectedPoints(trianglePoints[0], x);
     2753    set<TesselPoint*> *connectedPoints = GetAllConnectedPoints(trianglePoints[0]);
     2754    TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(connectedPoints, trianglePoints[0], x);
     2755    delete(connectedPoints);
    25412756    if (connectedClosestPoints != NULL) {
    25422757      trianglePoints[1] = connectedClosestPoints->front();
     
    25442759      for (int i=0;i<3;i++) {
    25452760        if (trianglePoints[i] == NULL) {
    2546           Log() << Verbose(1) << "ERROR: IsInnerPoint encounters serious error, point " << i << " not found." << endl;
     2761          eLog() << Verbose(1) << "IsInnerPoint encounters serious error, point " << i << " not found." << endl;
    25472762        }
    2548         //Log() << Verbose(2) << "List of triangle points:" << endl;
    2549         //Log() << Verbose(3) << *trianglePoints[i] << endl;
     2763        //Log() << Verbose(1) << "List of triangle points:" << endl;
     2764        //Log() << Verbose(2) << *trianglePoints[i] << endl;
    25502765      }
    25512766
    25522767      triangles = FindTriangles(trianglePoints);
    2553       Log() << Verbose(2) << "List of possible triangles:" << endl;
     2768      Log() << Verbose(1) << "List of possible triangles:" << endl;
    25542769      for(list<BoundaryTriangleSet*>::iterator Runner = triangles->begin(); Runner != triangles->end(); Runner++)
    2555         Log() << Verbose(3) << **Runner << endl;
     2770        Log() << Verbose(2) << **Runner << endl;
    25562771
    25572772      delete(connectedClosestPoints);
    25582773    } else {
    25592774      triangles = NULL;
    2560       Log() << Verbose(1) << "There is no circle of connected points!" << endl;
     2775      eLog() << Verbose(2) << "There is no circle of connected points!" << endl;
    25612776    }
    25622777  }
    25632778 
    25642779  if ((triangles == NULL) || (triangles->empty())) {
    2565     Log() << Verbose(0) << "ERROR: There is no nearest triangle. Please check the tesselation structure.";
     2780    eLog() << Verbose(1) << "There is no nearest triangle. Please check the tesselation structure.";
    25662781    delete(triangles);
    25672782    return NULL;
     
    25782793class BoundaryTriangleSet * Tesselation::FindClosestTriangleToPoint(const Vector *x, const LinkedCell* LC) const
    25792794{
     2795        Info FunctionInfo(__func__);
    25802796  class BoundaryTriangleSet *result = NULL;
    25812797  list<BoundaryTriangleSet*> *triangles = FindClosestTrianglesToPoint(x, LC);
     
    25872803  if (triangles->size() == 1) { // there is no degenerate case
    25882804    result = triangles->front();
    2589     Log() << Verbose(2) << "Normal Vector of this triangle is " << result->NormalVector << "." << endl;
     2805    Log() << Verbose(1) << "Normal Vector of this triangle is " << result->NormalVector << "." << endl;
    25902806  } else {
    25912807    result = triangles->front();
    25922808    result->GetCenter(&Center);
    25932809    Center.SubtractVector(x);
    2594     Log() << Verbose(2) << "Normal Vector of this front side is " << result->NormalVector << "." << endl;
     2810    Log() << Verbose(1) << "Normal Vector of this front side is " << result->NormalVector << "." << endl;
    25952811    if (Center.ScalarProduct(&result->NormalVector) < 0) {
    25962812      result = triangles->back();
    2597       Log() << Verbose(2) << "Normal Vector of this back side is " << result->NormalVector << "." << endl;
     2813      Log() << Verbose(1) << "Normal Vector of this back side is " << result->NormalVector << "." << endl;
    25982814      if (Center.ScalarProduct(&result->NormalVector) < 0) {
    2599         Log() << Verbose(1) << "ERROR: Front and back side yield NormalVector in wrong direction!" << endl;
     2815        eLog() << Verbose(1) << "Front and back side yield NormalVector in wrong direction!" << endl;
    26002816      }
    26012817    }
     
    26142830bool Tesselation::IsInnerPoint(const Vector &Point, const LinkedCell* const LC) const
    26152831{
     2832        Info FunctionInfo(__func__);
    26162833  class BoundaryTriangleSet *result = FindClosestTriangleToPoint(&Point, LC);
    26172834  Vector Center;
     
    26232840
    26242841  result->GetCenter(&Center);
    2625   Log() << Verbose(3) << "INFO: Central point of the triangle is " << Center << "." << endl;
     2842  Log() << Verbose(2) << "INFO: Central point of the triangle is " << Center << "." << endl;
    26262843  Center.SubtractVector(&Point);
    2627   Log() << Verbose(3) << "INFO: Vector from center to point to test is " << Center << "." << endl;
     2844  Log() << Verbose(2) << "INFO: Vector from center to point to test is " << Center << "." << endl;
    26282845  if (Center.ScalarProduct(&result->NormalVector) > -MYEPSILON) {
    26292846    Log() << Verbose(1) << Point << " is an inner point." << endl;
     
    26442861bool Tesselation::IsInnerPoint(const TesselPoint * const Point, const LinkedCell* const LC) const
    26452862{
     2863        Info FunctionInfo(__func__);
    26462864  return IsInnerPoint(*(Point->node), LC);
    26472865}
     
    26552873set<TesselPoint*> * Tesselation::GetAllConnectedPoints(const TesselPoint* const Point) const
    26562874{
     2875        Info FunctionInfo(__func__);
    26572876  set<TesselPoint*> *connectedPoints = new set<TesselPoint*>;
    26582877  class BoundaryPointSet *ReferencePoint = NULL;
    26592878  TesselPoint* current;
    26602879  bool takePoint = false;
    2661 
    2662   Log() << Verbose(3) << "Begin of GetAllConnectedPoints" << endl;
    26632880
    26642881  // find the respective boundary point
     
    26672884    ReferencePoint = PointRunner->second;
    26682885  } else {
    2669     Log() << Verbose(2) << "GetAllConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl;
     2886    eLog() << Verbose(2) << "GetAllConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl;
    26702887    ReferencePoint = NULL;
    26712888  }
     
    26912908
    26922909   if (takePoint) {
    2693      Log() << Verbose(5) << "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted." << endl;
     2910     Log() << Verbose(1) << "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted." << endl;
    26942911     connectedPoints->insert(current);
    26952912   }
     
    26992916
    27002917  if (connectedPoints->size() == 0) { // if have not found any points
    2701     Log() << Verbose(1) << "ERROR: We have not found any connected points to " << *Point<< "." << endl;
     2918    eLog() << Verbose(1) << "We have not found any connected points to " << *Point<< "." << endl;
    27022919    return NULL;
    27032920  }
    27042921
    2705   Log() << Verbose(3) << "End of GetAllConnectedPoints" << endl;
    27062922  return connectedPoints;
    27072923};
     
    27152931 *
    27162932 * @param *out output stream for debugging
     2933 * @param *SetOfNeighbours all points for which the angle should be calculated
    27172934 * @param *Point of which get all connected points
    27182935 * @param *Reference Reference vector for zero angle or NULL for no preference
    27192936 * @return list of the all points linked to the provided one
    27202937 */
    2721 list<TesselPoint*> * Tesselation::GetCircleOfConnectedPoints(const TesselPoint* const Point, const Vector * const Reference) const
    2722 {
     2938list<TesselPoint*> * Tesselation::GetCircleOfSetOfPoints(set<TesselPoint*> *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference) const
     2939{
     2940        Info FunctionInfo(__func__);
    27232941  map<double, TesselPoint*> anglesOfPoints;
    2724   set<TesselPoint*> *connectedPoints = GetAllConnectedPoints(Point);
    27252942  list<TesselPoint*> *connectedCircle = new list<TesselPoint*>;
    27262943  Vector center;
     
    27302947  Vector helper;
    27312948
    2732   if (connectedPoints == NULL) {
    2733     Log() << Verbose(2) << "Could not find any connected points!" << endl;
     2949  if (SetOfNeighbours == NULL) {
     2950    eLog() << Verbose(2) << "Could not find any connected points!" << endl;
    27342951    delete(connectedCircle);
    27352952    return NULL;
    27362953  }
    2737   Log() << Verbose(2) << "Begin of GetCircleOfConnectedPoints" << endl;
    27382954
    27392955  // calculate central point
    2740   for (set<TesselPoint*>::const_iterator TesselRunner = connectedPoints->begin(); TesselRunner != connectedPoints->end(); TesselRunner++)
     2956  for (set<TesselPoint*>::const_iterator TesselRunner = SetOfNeighbours->begin(); TesselRunner != SetOfNeighbours->end(); TesselRunner++)
    27412957    center.AddVector((*TesselRunner)->node);
    27422958  //Log() << Verbose(0) << "Summed vectors " << center << "; number of points " << connectedPoints.size()
    27432959  //  << "; scale factor " << 1.0/connectedPoints.size();
    2744   center.Scale(1.0/connectedPoints->size());
    2745   Log() << Verbose(4) << "INFO: Calculated center of all circle points is " << center << "." << endl;
     2960  center.Scale(1.0/SetOfNeighbours->size());
     2961  Log() << Verbose(1) << "INFO: Calculated center of all circle points is " << center << "." << endl;
    27462962
    27472963  // projection plane of the circle is at the closes Point and normal is pointing away from center of all circle points
     
    27492965  PlaneNormal.SubtractVector(&center);
    27502966  PlaneNormal.Normalize();
    2751   Log() << Verbose(4) << "INFO: Calculated plane normal of circle is " << PlaneNormal << "." << endl;
     2967  Log() << Verbose(1) << "INFO: Calculated plane normal of circle is " << PlaneNormal << "." << endl;
    27522968
    27532969  // construct one orthogonal vector
     
    27582974  }
    27592975  if ((Reference == NULL) || (AngleZero.NormSquared() < MYEPSILON )) {
    2760     Log() << Verbose(4) << "Using alternatively " << *(*connectedPoints->begin())->node << " as angle 0 referencer." << endl;
    2761     AngleZero.CopyVector((*connectedPoints->begin())->node);
     2976    Log() << Verbose(1) << "Using alternatively " << *(*SetOfNeighbours->begin())->node << " as angle 0 referencer." << endl;
     2977    AngleZero.CopyVector((*SetOfNeighbours->begin())->node);
    27622978    AngleZero.SubtractVector(Point->node);
    27632979    AngleZero.ProjectOntoPlane(&PlaneNormal);
     
    27672983    }
    27682984  }
    2769   Log() << Verbose(4) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl;
     2985  Log() << Verbose(1) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl;
    27702986  if (AngleZero.NormSquared() > MYEPSILON)
    27712987    OrthogonalVector.MakeNormalVector(&PlaneNormal, &AngleZero);
    27722988  else
    27732989    OrthogonalVector.MakeNormalVector(&PlaneNormal);
    2774   Log() << Verbose(4) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl;
     2990  Log() << Verbose(1) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl;
    27752991
    27762992  // go through all connected points and calculate angle
    2777   for (set<TesselPoint*>::iterator listRunner = connectedPoints->begin(); listRunner != connectedPoints->end(); listRunner++) {
     2993  for (set<TesselPoint*>::iterator listRunner = SetOfNeighbours->begin(); listRunner != SetOfNeighbours->end(); listRunner++) {
    27782994    helper.CopyVector((*listRunner)->node);
    27792995    helper.SubtractVector(Point->node);
    27802996    helper.ProjectOntoPlane(&PlaneNormal);
    27812997    double angle = GetAngle(helper, AngleZero, OrthogonalVector);
    2782     Log() << Verbose(3) << "INFO: Calculated angle is " << angle << " for point " << **listRunner << "." << endl;
     2998    Log() << Verbose(0) << "INFO: Calculated angle is " << angle << " for point " << **listRunner << "." << endl;
    27832999    anglesOfPoints.insert(pair<double, TesselPoint*>(angle, (*listRunner)));
    27843000  }
     
    27873003    connectedCircle->push_back(AngleRunner->second);
    27883004  }
    2789 
    2790   delete(connectedPoints);
    2791 
    2792   Log() << Verbose(2) << "End of GetCircleOfConnectedPoints" << endl;
    27933005
    27943006  return connectedCircle;
     
    28033015list<list<TesselPoint*> *> * Tesselation::GetPathsOfConnectedPoints(const TesselPoint* const Point) const
    28043016{
     3017        Info FunctionInfo(__func__);
    28053018  map<double, TesselPoint*> anglesOfPoints;
    28063019  list<list<TesselPoint*> *> *ListOfPaths = new list<list<TesselPoint*> *>;
     
    28223035    ReferencePoint = PointRunner->second;
    28233036  } else {
    2824     Log() << Verbose(2) << "ERROR: GetPathOfConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl;
     3037    eLog() << Verbose(1) << "GetPathOfConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl;
    28253038    return NULL;
    28263039  }
     
    28393052      LineRunner = TouchedLine.find(runner->second);
    28403053      if (LineRunner == TouchedLine.end()) {
    2841         Log() << Verbose(2) << "ERROR: I could not find " << *runner->second << " in the touched list." << endl;
     3054        eLog() << Verbose(1) << "I could not find " << *runner->second << " in the touched list." << endl;
    28423055      } else if (!LineRunner->second) {
    28433056        LineRunner->second = true;
     
    28473060        StartLine = CurrentLine;
    28483061        CurrentPoint = CurrentLine->GetOtherEndpoint(ReferencePoint);
    2849         Log() << Verbose(3)<< "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "." << endl;
     3062        Log() << Verbose(1)<< "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "." << endl;
    28503063        do {
    28513064          // push current one
    2852           Log() << Verbose(3) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;
     3065          Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;
    28533066          connectedPath->push_back(CurrentPoint->node);
    28543067
    28553068          // find next triangle
    28563069          for (TriangleMap::iterator Runner = CurrentLine->triangles.begin(); Runner != CurrentLine->triangles.end(); Runner++) {
    2857             Log() << Verbose(3) << "INFO: Inspecting triangle " << *Runner->second << "." << endl;
     3070            Log() << Verbose(1) << "INFO: Inspecting triangle " << *Runner->second << "." << endl;
    28583071            if ((Runner->second != triangle)) { // look for first triangle not equal to old one
    28593072              triangle = Runner->second;
     
    28623075                if (!TriangleRunner->second) {
    28633076                  TriangleRunner->second = true;
    2864                   Log() << Verbose(3) << "INFO: Connecting triangle is " << *triangle << "." << endl;
     3077                  Log() << Verbose(1) << "INFO: Connecting triangle is " << *triangle << "." << endl;
    28653078                  break;
    28663079                } else {
    2867                   Log() << Verbose(3) << "INFO: Skipping " << *triangle << ", as we have already visited it." << endl;
     3080                  Log() << Verbose(1) << "INFO: Skipping " << *triangle << ", as we have already visited it." << endl;
    28683081                  triangle = NULL;
    28693082                }
    28703083              } else {
    2871                 Log() << Verbose(2) << "ERROR: I could not find " << *triangle << " in the touched list." << endl;
     3084                eLog() << Verbose(1) << "I could not find " << *triangle << " in the touched list." << endl;
    28723085                triangle = NULL;
    28733086              }
     
    28803093            if ((triangle->lines[i] != CurrentLine) && (triangle->lines[i]->ContainsBoundaryPoint(ReferencePoint))) { // not the current line and still containing Point
    28813094              CurrentLine = triangle->lines[i];
    2882               Log() << Verbose(3) << "INFO: Connecting line is " << *CurrentLine << "." << endl;
     3095              Log() << Verbose(1) << "INFO: Connecting line is " << *CurrentLine << "." << endl;
    28833096              break;
    28843097            }
     
    28863099          LineRunner = TouchedLine.find(CurrentLine);
    28873100          if (LineRunner == TouchedLine.end())
    2888             Log() << Verbose(2) << "ERROR: I could not find " << *CurrentLine << " in the touched list." << endl;
     3101            eLog() << Verbose(1) << "I could not find " << *CurrentLine << " in the touched list." << endl;
    28893102          else
    28903103            LineRunner->second = true;
     
    28943107        } while (CurrentLine != StartLine);
    28953108        // last point is missing, as it's on start line
    2896         Log() << Verbose(3) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;
     3109        Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;
    28973110        if (StartLine->GetOtherEndpoint(ReferencePoint)->node != connectedPath->back())
    28983111          connectedPath->push_back(StartLine->GetOtherEndpoint(ReferencePoint)->node);
     
    29003113        ListOfPaths->push_back(connectedPath);
    29013114      } else {
    2902         Log() << Verbose(3) << "INFO: Skipping " << *runner->second << ", as we have already visited it." << endl;
     3115        Log() << Verbose(1) << "INFO: Skipping " << *runner->second << ", as we have already visited it." << endl;
    29033116      }
    29043117    }
    29053118  } else {
    2906     Log() << Verbose(1) << "ERROR: There are no lines attached to " << *ReferencePoint << "." << endl;
     3119    eLog() << Verbose(1) << "There are no lines attached to " << *ReferencePoint << "." << endl;
    29073120  }
    29083121
     
    29183131list<list<TesselPoint*> *> * Tesselation::GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const
    29193132{
     3133        Info FunctionInfo(__func__);
    29203134  list<list<TesselPoint*> *> *ListofPaths = GetPathsOfConnectedPoints(Point);
    29213135  list<list<TesselPoint*> *> *ListofClosedPaths = new list<list<TesselPoint*> *>;
     
    29313145    connectedPath = *ListRunner;
    29323146
    2933     Log() << Verbose(2) << "INFO: Current path is " << connectedPath << "." << endl;
     3147    Log() << Verbose(1) << "INFO: Current path is " << connectedPath << "." << endl;
    29343148
    29353149    // go through list, look for reappearance of starting Point and count
     
    29413155      if ((*CircleRunner == *CircleStart) && (CircleRunner != CircleStart)) { // is not the very first point
    29423156        // we have a closed circle from Marker to new Marker
    2943         Log() << Verbose(3) << count+1 << ". closed path consists of: ";
     3157        Log() << Verbose(1) << count+1 << ". closed path consists of: ";
    29443158        newPath = new list<TesselPoint*>;
    29453159        list<TesselPoint*>::iterator CircleSprinter = Marker;
     
    29573171    }
    29583172  }
    2959   Log() << Verbose(3) << "INFO: " << count << " closed additional path(s) have been created." << endl;
     3173  Log() << Verbose(1) << "INFO: " << count << " closed additional path(s) have been created." << endl;
    29603174
    29613175  // delete list of paths
     
    29793193set<BoundaryTriangleSet*> *Tesselation::GetAllTriangles(const BoundaryPointSet * const Point) const
    29803194{
     3195        Info FunctionInfo(__func__);
    29813196  set<BoundaryTriangleSet*> *connectedTriangles = new set<BoundaryTriangleSet*>;
    29823197
    29833198  if (Point == NULL) {
    2984     Log() << Verbose(1) << "ERROR: Point given is NULL." << endl;
     3199    eLog() << Verbose(1) << "Point given is NULL." << endl;
    29853200  } else {
    29863201    // go through its lines and insert all triangles
     
    30143229
    30153230  if (point == NULL) {
    3016     Log() << Verbose(1) << "ERROR: Cannot remove the point " << point << ", it's NULL!" << endl;
     3231    eLog() << Verbose(1) << "Cannot remove the point " << point << ", it's NULL!" << endl;
    30173232    return 0.;
    30183233  } else
    3019     Log() << Verbose(2) << "Removing point " << *point << " from tesselated boundary ..." << endl;
     3234    Log() << Verbose(0) << "Removing point " << *point << " from tesselated boundary ..." << endl;
    30203235
    30213236  // copy old location for the volume
     
    30243239  // get list of connected points
    30253240  if (point->lines.empty()) {
    3026     Log() << Verbose(1) << "ERROR: Cannot remove the point " << *point << ", it's connected to no lines!" << endl;
     3241    eLog() << Verbose(1) << "Cannot remove the point " << *point << ", it's connected to no lines!" << endl;
    30273242    return 0.;
    30283243  }
     
    30473262  NormalVector.Zero();
    30483263  for (map<class BoundaryTriangleSet *, int>::iterator Runner = Candidates.begin(); Runner != Candidates.end(); Runner++) {
    3049     Log() << Verbose(3) << "INFO: Removing triangle " << *(Runner->first) << "." << endl;
     3264    Log() << Verbose(1) << "INFO: Removing triangle " << *(Runner->first) << "." << endl;
    30503265    NormalVector.SubtractVector(&Runner->first->NormalVector); // has to point inward
    30513266    RemoveTesselationTriangle(Runner->first);
     
    30773292        smallestangle = 0.;
    30783293        for (MiddleNode = connectedPath->begin(); MiddleNode != connectedPath->end(); MiddleNode++) {
    3079           Log() << Verbose(3) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;
     3294          Log() << Verbose(1) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;
    30803295          // construct vectors to next and previous neighbour
    30813296          StartNode = MiddleNode;
     
    31053320        MiddleNode = EndNode;
    31063321        if (MiddleNode == connectedPath->end()) {
    3107           Log() << Verbose(1) << "CRITICAL: Could not find a smallest angle!" << endl;
    3108           exit(255);
     3322          eLog() << Verbose(0) << "CRITICAL: Could not find a smallest angle!" << endl;
     3323          performCriticalExit();
    31093324        }
    31103325        StartNode = MiddleNode;
     
    31153330        if (EndNode == connectedPath->end())
    31163331          EndNode = connectedPath->begin();
    3117         Log() << Verbose(4) << "INFO: StartNode is " << **StartNode << "." << endl;
    3118         Log() << Verbose(4) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;
    3119         Log() << Verbose(4) << "INFO: EndNode is " << **EndNode << "." << endl;
    3120         Log() << Verbose(3) << "INFO: Attempting to create triangle " << (*StartNode)->Name << ", " << (*MiddleNode)->Name << " and " << (*EndNode)->Name << "." << endl;
     3332        Log() << Verbose(2) << "INFO: StartNode is " << **StartNode << "." << endl;
     3333        Log() << Verbose(2) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;
     3334        Log() << Verbose(2) << "INFO: EndNode is " << **EndNode << "." << endl;
     3335        Log() << Verbose(1) << "INFO: Attempting to create triangle " << (*StartNode)->Name << ", " << (*MiddleNode)->Name << " and " << (*EndNode)->Name << "." << endl;
    31213336        TriangleCandidates[0] = *StartNode;
    31223337        TriangleCandidates[1] = *MiddleNode;
     
    31243339        triangle = GetPresentTriangle(TriangleCandidates);
    31253340        if (triangle != NULL) {
    3126           Log() << Verbose(1) << "WARNING: New triangle already present, skipping!" << endl;
     3341          eLog() << Verbose(0) << "New triangle already present, skipping!" << endl;
    31273342          StartNode++;
    31283343          MiddleNode++;
     
    31363351          continue;
    31373352        }
    3138         Log() << Verbose(5) << "Adding new triangle points."<< endl;
     3353        Log() << Verbose(3) << "Adding new triangle points."<< endl;
    31393354        AddTesselationPoint(*StartNode, 0);
    31403355        AddTesselationPoint(*MiddleNode, 1);
    31413356        AddTesselationPoint(*EndNode, 2);
    3142         Log() << Verbose(5) << "Adding new triangle lines."<< endl;
     3357        Log() << Verbose(3) << "Adding new triangle lines."<< endl;
    31433358        AddTesselationLine(TPS[0], TPS[1], 0);
    31443359        AddTesselationLine(TPS[0], TPS[2], 1);
     
    31553370        // prepare nodes for next triangle
    31563371        StartNode = EndNode;
    3157         Log() << Verbose(4) << "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "." << endl;
     3372        Log() << Verbose(2) << "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "." << endl;
    31583373        connectedPath->remove(*MiddleNode); // remove the middle node (it is surrounded by triangles)
    31593374        if (connectedPath->size() == 2) { // we are done
     
    31623377          break;
    31633378        } else if (connectedPath->size() < 2) { // something's gone wrong!
    3164           Log() << Verbose(1) << "CRITICAL: There are only two endpoints left!" << endl;
    3165           exit(255);
     3379          eLog() << Verbose(0) << "CRITICAL: There are only two endpoints left!" << endl;
     3380          performCriticalExit();
    31663381        } else {
    31673382          MiddleNode = StartNode;
     
    31913406          if (maxgain != 0) {
    31923407            volume += maxgain;
    3193             Log() << Verbose(3) << "Flipping baseline with highest volume" << **Candidate << "." << endl;
     3408            Log() << Verbose(1) << "Flipping baseline with highest volume" << **Candidate << "." << endl;
    31943409            OtherBase = FlipBaseline(*Candidate);
    31953410            NewLines.erase(Candidate);
     
    32023417      delete(connectedPath);
    32033418    }
    3204     Log() << Verbose(1) << count << " triangles were created." << endl;
     3419    Log() << Verbose(0) << count << " triangles were created." << endl;
    32053420  } else {
    32063421    while (!ListOfClosedPaths->empty()) {
     
    32103425      delete(connectedPath);
    32113426    }
    3212     Log() << Verbose(1) << "No need to create any triangles." << endl;
     3427    Log() << Verbose(0) << "No need to create any triangles." << endl;
    32133428  }
    32143429  delete(ListOfClosedPaths);
    32153430
    3216   Log() << Verbose(1) << "Removed volume is " << volume << "." << endl;
     3431  Log() << Verbose(0) << "Removed volume is " << volume << "." << endl;
    32173432
    32183433  return volume;
     
    32313446list<BoundaryTriangleSet*> *Tesselation::FindTriangles(const TesselPoint* const Points[3]) const
    32323447{
     3448        Info FunctionInfo(__func__);
    32333449  list<BoundaryTriangleSet*> *result = new list<BoundaryTriangleSet*>;
    32343450  LineMap::const_iterator FindLine;
     
    32793495map<int, int> * Tesselation::FindAllDegeneratedLines()
    32803496{
     3497        Info FunctionInfo(__func__);
    32813498  map<int, class BoundaryLineSet *> AllLines;
    32823499  map<int, int> * DegeneratedLines = new map<int, int>;
     
    32843501  // sanity check
    32853502  if (LinesOnBoundary.empty()) {
    3286     Log() << Verbose(1) << "Warning: FindAllDegeneratedTriangles() was called without any tesselation structure.";
     3503    eLog() << Verbose(2) << "FindAllDegeneratedTriangles() was called without any tesselation structure.";
    32873504    return DegeneratedLines;
    32883505  }
     
    33003517  AllLines.clear();
    33013518
    3302   Log() << Verbose(1) << "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines." << endl;
     3519  Log() << Verbose(0) << "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines." << endl;
    33033520  map<int,int>::iterator it;
    33043521  for (it = DegeneratedLines->begin(); it != DegeneratedLines->end(); it++)
    3305       Log() << Verbose(2) << (*it).first << " => " << (*it).second << endl;
     3522      Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl;
    33063523
    33073524  return DegeneratedLines;
     
    33163533map<int, int> * Tesselation::FindAllDegeneratedTriangles()
    33173534{
     3535        Info FunctionInfo(__func__);
    33183536  map<int, int> * DegeneratedLines = FindAllDegeneratedLines();
    33193537  map<int, int> * DegeneratedTriangles = new map<int, int>;
     
    33433561  delete(DegeneratedLines);
    33443562
    3345   Log() << Verbose(1) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl;
     3563  Log() << Verbose(0) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl;
    33463564  map<int,int>::iterator it;
    33473565  for (it = DegeneratedTriangles->begin(); it != DegeneratedTriangles->end(); it++)
    3348       Log() << Verbose(2) << (*it).first << " => " << (*it).second << endl;
     3566      Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl;
    33493567
    33503568  return DegeneratedTriangles;
     
    33573575void Tesselation::RemoveDegeneratedTriangles()
    33583576{
     3577        Info FunctionInfo(__func__);
    33593578  map<int, int> * DegeneratedTriangles = FindAllDegeneratedTriangles();
    33603579  TriangleMap::iterator finder;
    33613580  BoundaryTriangleSet *triangle = NULL, *partnerTriangle = NULL;
    33623581  int count  = 0;
    3363 
    3364   Log() << Verbose(1) << "Begin of RemoveDegeneratedTriangles" << endl;
    33653582
    33663583  for (map<int, int>::iterator TriangleKeyRunner = DegeneratedTriangles->begin();
     
    34213638      // erase the pair
    34223639      count += (int) DegeneratedTriangles->erase(triangle->Nr);
    3423       Log() << Verbose(1) << "RemoveDegeneratedTriangles() removes triangle " << *triangle << "." << endl;
     3640      Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *triangle << "." << endl;
    34243641      RemoveTesselationTriangle(triangle);
    34253642      count += (int) DegeneratedTriangles->erase(partnerTriangle->Nr);
    3426       Log() << Verbose(1) << "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "." << endl;
     3643      Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "." << endl;
    34273644      RemoveTesselationTriangle(partnerTriangle);
    34283645    } else {
    3429       Log() << Verbose(1) << "RemoveDegeneratedTriangles() does not remove triangle " << *triangle
     3646      Log() << Verbose(0) << "RemoveDegeneratedTriangles() does not remove triangle " << *triangle
    34303647        << " and its partner " << *partnerTriangle << " because it is essential for at"
    34313648        << " least one of the endpoints to be kept in the tesselation structure." << endl;
     
    34333650  }
    34343651  delete(DegeneratedTriangles);
    3435 
    3436   Log() << Verbose(1) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl;
    3437   Log() << Verbose(1) << "End of RemoveDegeneratedTriangles" << endl;
     3652  if (count > 0)
     3653    LastTriangle = NULL;
     3654
     3655  Log() << Verbose(0) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl;
    34383656}
    34393657
     
    34483666void Tesselation::AddBoundaryPointByDegeneratedTriangle(class TesselPoint *point, LinkedCell *LC)
    34493667{
    3450   Log() << Verbose(2) << "Begin of AddBoundaryPointByDegeneratedTriangle" << endl;
    3451 
     3668        Info FunctionInfo(__func__);
    34523669  // find nearest boundary point
    34533670  class TesselPoint *BackupPoint = NULL;
     
    34623679    NearestBoundaryPoint = PointRunner->second;
    34633680  } else {
    3464     Log() << Verbose(1) << "ERROR: I cannot find the boundary point." << endl;
     3681    eLog() << Verbose(1) << "I cannot find the boundary point." << endl;
    34653682    return;
    34663683  }
    3467   Log() << Verbose(2) << "Nearest point on boundary is " << NearestPoint->Name << "." << endl;
     3684  Log() << Verbose(0) << "Nearest point on boundary is " << NearestPoint->Name << "." << endl;
    34683685
    34693686  // go through its lines and find the best one to split
     
    34983715
    34993716  // create new triangle to connect point (connects automatically with the missing spot of the chosen line)
    3500   Log() << Verbose(5) << "Adding new triangle points."<< endl;
     3717  Log() << Verbose(2) << "Adding new triangle points."<< endl;
    35013718  AddTesselationPoint((BestLine->endpoints[0]->node), 0);
    35023719  AddTesselationPoint((BestLine->endpoints[1]->node), 1);
    35033720  AddTesselationPoint(point, 2);
    3504   Log() << Verbose(5) << "Adding new triangle lines."<< endl;
     3721  Log() << Verbose(2) << "Adding new triangle lines."<< endl;
    35053722  AddTesselationLine(TPS[0], TPS[1], 0);
    35063723  AddTesselationLine(TPS[0], TPS[2], 1);
     
    35093726  BTS->GetNormalVector(TempTriangle->NormalVector);
    35103727  BTS->NormalVector.Scale(-1.);
    3511   Log() << Verbose(3) << "INFO: NormalVector of new triangle is " << BTS->NormalVector << "." << endl;
     3728  Log() << Verbose(1) << "INFO: NormalVector of new triangle is " << BTS->NormalVector << "." << endl;
    35123729  AddTesselationTriangle();
    35133730
    35143731  // create other side of this triangle and close both new sides of the first created triangle
    3515   Log() << Verbose(5) << "Adding new triangle points."<< endl;
     3732  Log() << Verbose(2) << "Adding new triangle points."<< endl;
    35163733  AddTesselationPoint((BestLine->endpoints[0]->node), 0);
    35173734  AddTesselationPoint((BestLine->endpoints[1]->node), 1);
    35183735  AddTesselationPoint(point, 2);
    3519   Log() << Verbose(5) << "Adding new triangle lines."<< endl;
     3736  Log() << Verbose(2) << "Adding new triangle lines."<< endl;
    35203737  AddTesselationLine(TPS[0], TPS[1], 0);
    35213738  AddTesselationLine(TPS[0], TPS[2], 1);
     
    35233740  BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
    35243741  BTS->GetNormalVector(TempTriangle->NormalVector);
    3525   Log() << Verbose(3) << "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "." << endl;
     3742  Log() << Verbose(1) << "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "." << endl;
    35263743  AddTesselationTriangle();
    35273744
     
    35303747    if ((BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[0])) && (BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[1]))) {
    35313748      if (BestLine == BTS->lines[i]){
    3532         Log() << Verbose(1) << "CRITICAL: BestLine is same as found line, something's wrong here!" << endl;
    3533         exit(255);
     3749        eLog() << Verbose(0) << "BestLine is same as found line, something's wrong here!" << endl;
     3750        performCriticalExit();
    35343751      }
    35353752      BTS->lines[i]->triangles.insert( pair<int, class BoundaryTriangleSet *> (TempTriangle->Nr, TempTriangle) );
     
    35383755    }
    35393756  }
    3540 
    3541   // exit
    3542   Log() << Verbose(2) << "End of AddBoundaryPointByDegeneratedTriangle" << endl;
    35433757};
    35443758
     
    35503764void Tesselation::Output(const char *filename, const PointCloud * const cloud)
    35513765{
     3766        Info FunctionInfo(__func__);
    35523767  ofstream *tempstream = NULL;
    35533768  string NameofTempFile;
     
    35623777      NameofTempFile.erase(npos, 1);
    35633778      NameofTempFile.append(TecplotSuffix);
    3564       Log() << Verbose(1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";
     3779      Log() << Verbose(0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";
    35653780      tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc);
    35663781      WriteTecplotFile(tempstream, this, cloud, TriangleFilesWritten);
     
    35763791      NameofTempFile.erase(npos, 1);
    35773792      NameofTempFile.append(Raster3DSuffix);
    3578       Log() << Verbose(1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";
     3793      Log() << Verbose(0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";
    35793794      tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc);
    35803795      WriteRaster3dFile(tempstream, this, cloud);
  • src/tesselation.hpp

    r3a0b38 r5ae39c  
    5353#define PointTestPair pair < PointMap::iterator, bool >
    5454#define CandidateList list <class CandidateForTesselation *>
     55#define CandidateMap map <class BoundaryLineSet *, class CandidateForTesselation *>
    5556
    5657#define LineMap multimap < int, class BoundaryLineSet * >
     
    6465#define DistanceMultiMap multimap <double, pair < PointMap::iterator, PointMap::iterator> >
    6566#define DistanceMultiMapPair pair <double, pair < PointMap::iterator, PointMap::iterator> >
     67
     68#define TesselPointList list <TesselPoint *>
    6669
    6770/********************************************** declarations *******************************/
     
    114117    TriangleMap triangles;
    115118    int Nr;
     119    bool skipped;
    116120};
    117121
     
    170174  virtual ~PointCloud();
    171175
     176  virtual const char * const GetName() const { return "unknown"; };
    172177  virtual Vector *GetCenter() const { return NULL; };
    173178  virtual TesselPoint *GetPoint() const { return NULL; };
     
    177182  virtual void GoToFirst() const {};
    178183  virtual void GoToLast() const {};
    179   virtual bool IsEmpty() const { return false; };
    180   virtual bool IsEnd() const { return false; };
     184  virtual bool IsEmpty() const { return true; };
     185  virtual bool IsEnd() const { return true; };
    181186};
    182187
     
    185190class CandidateForTesselation {
    186191  public :
     192  CandidateForTesselation(BoundaryLineSet* currentBaseLine);
    187193  CandidateForTesselation(TesselPoint* candidate, BoundaryLineSet* currentBaseLine, Vector OptCandidateCenter, Vector OtherOptCandidateCenter);
    188194  ~CandidateForTesselation();
    189195
    190   TesselPoint *point;
     196  TesselPointList pointlist;
    191197  BoundaryLineSet *BaseLine;
    192198  Vector OptCenter;
    193199  Vector OtherOptCenter;
    194 };
     200  double ShortestAngle;
     201  double OtherShortestAngle;
     202};
     203
     204ostream & operator <<(ostream &ost, const  CandidateForTesselation &a);
    195205
    196206// =========================================================== class TESSELATION ===========================================
     
    205215
    206216    void AddTesselationPoint(TesselPoint* Candidate, const int n);
     217    void SetTesselationPoint(TesselPoint* Candidate, const int n) const;
    207218    void AddTesselationLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
    208219    void AlwaysAddTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n);
    209220    void AddTesselationTriangle();
    210221    void AddTesselationTriangle(const int nr);
     222    void AddCandidateTriangle(CandidateForTesselation CandidateLine);
    211223    void RemoveTesselationTriangle(class BoundaryTriangleSet *triangle);
    212224    void RemoveTesselationLine(class BoundaryLineSet *line);
     
    217229    void FindStartingTriangle(const double RADIUS, const LinkedCell *LC);
    218230    void FindSecondPointForTesselation(class TesselPoint* a, Vector Oben, class TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell *LC);
    219     void FindThirdPointForTesselation(Vector NormalVector, Vector SearchDirection, Vector OldSphereCenter, class BoundaryLineSet *BaseLine, class TesselPoint *ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, const LinkedCell *LC);
    220     bool FindNextSuitableTriangle(BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC);
    221     int CheckPresenceOfTriangle(class TesselPoint *Candidates[3]);
     231    void FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, CandidateForTesselation &CandidateLine, const class TesselPoint  * const ThirdNode, const double RADIUS, const LinkedCell *LC) const;
     232    bool FindNextSuitableTriangle(CandidateForTesselation &CandidateLine, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC);
     233    int CheckPresenceOfTriangle(class TesselPoint *Candidates[3]) const;
    222234    class BoundaryTriangleSet * GetPresentTriangle(TesselPoint *Candidates[3]);
    223235
     
    239251    list<list<TesselPoint*> *> * GetPathsOfConnectedPoints(const TesselPoint* const Point) const;
    240252    list<list<TesselPoint*> *> * GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const;
    241     list<TesselPoint*> * GetCircleOfConnectedPoints(const TesselPoint* const Point, const Vector * const Reference = NULL) const;
     253    list<TesselPoint*> * GetCircleOfSetOfPoints(set<TesselPoint*> *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference = NULL) const;
    242254    class BoundaryPointSet *GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const;
    243255    list<BoundaryTriangleSet*> *FindTriangles(const TesselPoint* const Points[3]) const;
     
    258270    PointMap PointsOnBoundary;
    259271    LineMap LinesOnBoundary;
     272    CandidateMap OpenLines;
    260273    TriangleMap TrianglesOnBoundary;
    261274    int PointsOnBoundaryCount;
     
    281294
    282295  private:
    283     class BoundaryPointSet *TPS[3]; //this is a Storage for pointers to triangle points, this and BPS[2] needed due to AddLine restrictions
     296    mutable class BoundaryPointSet *TPS[3]; //this is a Storage for pointers to triangle points, this and BPS[2] needed due to AddLine restrictions
    284297
    285298    mutable PointMap::const_iterator InternalPointer;
     299
     300    //bool HasOtherBaselineBetterCandidate(const BoundaryLineSet * const BaseRay, const TesselPoint * const OptCandidate, double ShortestAngle, double RADIUS, const LinkedCell * const LC) const;
    286301};
    287302
  • src/tesselationhelpers.cpp

    r3a0b38 r5ae39c  
    88#include <fstream>
    99
     10#include "info.hpp"
    1011#include "linkedcell.hpp"
    1112#include "log.hpp"
     
    1516#include "verbose.hpp"
    1617
    17 double DetGet(gsl_matrix * const A, const int inPlace) {
     18double DetGet(gsl_matrix * const A, const int inPlace)
     19{
     20        Info FunctionInfo(__func__);
    1821  /*
    1922  inPlace = 1 => A is replaced with the LU decomposed copy.
     
    4548void GetSphere(Vector * const center, const Vector &a, const Vector &b, const Vector &c, const double RADIUS)
    4649{
     50        Info FunctionInfo(__func__);
    4751  gsl_matrix *A = gsl_matrix_calloc(3,3);
    4852  double m11, m12, m13, m14;
     
    7781
    7882  if (fabs(m11) < MYEPSILON)
    79     eLog() << Verbose(0) << "ERROR: three points are colinear." << endl;
     83    eLog() << Verbose(1) << "three points are colinear." << endl;
    8084
    8185  center->x[0] =  0.5 * m12/ m11;
     
    8488
    8589  if (fabs(a.Distance(center) - RADIUS) > MYEPSILON)
    86     eLog() << Verbose(0) << "ERROR: The given center is further way by " << fabs(a.Distance(center) - RADIUS) << " from a than RADIUS." << endl;
     90    eLog() << Verbose(1) << "The given center is further way by " << fabs(a.Distance(center) - RADIUS) << " from a than RADIUS." << endl;
    8791
    8892  gsl_matrix_free(A);
     
    111115    const double HalfplaneIndicator, const double AlternativeIndicator, const double alpha, const double beta, const double gamma, const double RADIUS, const double Umkreisradius)
    112116{
     117        Info FunctionInfo(__func__);
    113118  Vector TempNormal, helper;
    114119  double Restradius;
    115120  Vector OtherCenter;
    116   Log() << Verbose(3) << "Begin of GetCenterOfSphere.\n";
    117121  Center->Zero();
    118122  helper.CopyVector(&a);
     
    128132  Center->Scale(1./(sin(2.*alpha) + sin(2.*beta) + sin(2.*gamma)));
    129133  NewUmkreismittelpunkt->CopyVector(Center);
    130   Log() << Verbose(4) << "Center of new circumference is " << *NewUmkreismittelpunkt << ".\n";
     134  Log() << Verbose(1) << "Center of new circumference is " << *NewUmkreismittelpunkt << ".\n";
    131135  // Here we calculated center of circumscribing circle, using barycentric coordinates
    132   Log() << Verbose(4) << "Center of circumference is " << *Center << " in direction " << *Direction << ".\n";
     136  Log() << Verbose(1) << "Center of circumference is " << *Center << " in direction " << *Direction << ".\n";
    133137
    134138  TempNormal.CopyVector(&a);
     
    154158  TempNormal.Normalize();
    155159  Restradius = sqrt(RADIUS*RADIUS - Umkreisradius*Umkreisradius);
    156   Log() << Verbose(4) << "Height of center of circumference to center of sphere is " << Restradius << ".\n";
     160  Log() << Verbose(1) << "Height of center of circumference to center of sphere is " << Restradius << ".\n";
    157161  TempNormal.Scale(Restradius);
    158   Log() << Verbose(4) << "Shift vector to sphere of circumference is " << TempNormal << ".\n";
     162  Log() << Verbose(1) << "Shift vector to sphere of circumference is " << TempNormal << ".\n";
    159163
    160164  Center->AddVector(&TempNormal);
    161   Log() << Verbose(0) << "Center of sphere of circumference is " << *Center << ".\n";
     165  Log() << Verbose(1) << "Center of sphere of circumference is " << *Center << ".\n";
    162166  GetSphere(&OtherCenter, a, b, c, RADIUS);
    163   Log() << Verbose(0) << "OtherCenter of sphere of circumference is " << OtherCenter << ".\n";
    164   Log() << Verbose(3) << "End of GetCenterOfSphere.\n";
     167  Log() << Verbose(1) << "OtherCenter of sphere of circumference is " << OtherCenter << ".\n";
    165168};
    166169
     
    174177void GetCenterofCircumcircle(Vector * const Center, const Vector &a, const Vector &b, const Vector &c)
    175178{
     179        Info FunctionInfo(__func__);
    176180  Vector helper;
    177181  double alpha, beta, gamma;
     
    186190  beta = M_PI - SideC.Angle(&SideA);
    187191  gamma = M_PI - SideA.Angle(&SideB);
    188   //Log() << Verbose(3) << "INFO: alpha = " << alpha/M_PI*180. << ", beta = " << beta/M_PI*180. << ", gamma = " << gamma/M_PI*180. << "." << endl;
    189   if (fabs(M_PI - alpha - beta - gamma) > HULLEPSILON)
    190     eLog() << Verbose(0) << "GetCenterofCircumcircle: Sum of angles " << (alpha+beta+gamma)/M_PI*180. << " > 180 degrees by " << fabs(M_PI - alpha - beta - gamma)/M_PI*180. << "!" << endl;
     192  //Log() << Verbose(1) << "INFO: alpha = " << alpha/M_PI*180. << ", beta = " << beta/M_PI*180. << ", gamma = " << gamma/M_PI*180. << "." << endl;
     193  if (fabs(M_PI - alpha - beta - gamma) > HULLEPSILON) {
     194    eLog() << Verbose(1) << "GetCenterofCircumcircle: Sum of angles " << (alpha+beta+gamma)/M_PI*180. << " > 180 degrees by " << fabs(M_PI - alpha - beta - gamma)/M_PI*180. << "!" << endl;
     195  }
    191196
    192197  Center->Zero();
     
    218223double GetPathLengthonCircumCircle(const Vector &CircleCenter, const Vector &CirclePlaneNormal, const double CircleRadius, const Vector &NewSphereCenter, const Vector &OldSphereCenter, const Vector &NormalVector, const Vector &SearchDirection)
    219224{
     225        Info FunctionInfo(__func__);
    220226  Vector helper;
    221227  double radius, alpha;
     
    224230  // test whether new center is on the parameter circle's plane
    225231  if (fabs(helper.ScalarProduct(&CirclePlaneNormal)) > HULLEPSILON) {
    226     eLog() << Verbose(0) << "ERROR: Something's very wrong here: NewSphereCenter is not on the band's plane as desired by " <<fabs(helper.ScalarProduct(&CirclePlaneNormal))  << "!" << endl;
     232    eLog() << Verbose(1) << "Something's very wrong here: NewSphereCenter is not on the band's plane as desired by " <<fabs(helper.ScalarProduct(&CirclePlaneNormal))  << "!" << endl;
    227233    helper.ProjectOntoPlane(&CirclePlaneNormal);
    228234  }
     
    230236  // test whether the new center vector has length of CircleRadius
    231237  if (fabs(radius - CircleRadius) > HULLEPSILON)
    232     eLog() << Verbose(1) << "ERROR: The projected center of the new sphere has radius " << radius << " instead of " << CircleRadius << "." << endl;
     238    eLog() << Verbose(1) << "The projected center of the new sphere has radius " << radius << " instead of " << CircleRadius << "." << endl;
    233239  alpha = helper.Angle(&OldSphereCenter);
    234240  // make the angle unique by checking the halfplanes/search direction
    235241  if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)  // acos is not unique on [0, 2.*M_PI), hence extra check to decide between two half intervals
    236242    alpha = 2.*M_PI - alpha;
    237   //Log() << Verbose(2) << "INFO: RelativeNewSphereCenter is " << helper << ", RelativeOldSphereCenter is " << OldSphereCenter << " and resulting angle is " << alpha << "." << endl;
     243  //Log() << Verbose(1) << "INFO: RelativeNewSphereCenter is " << helper << ", RelativeOldSphereCenter is " << OldSphereCenter << " and resulting angle is " << alpha << "." << endl;
    238244  radius = helper.Distance(&OldSphereCenter);
    239245  helper.ProjectOntoPlane(&NormalVector);
    240246  // check whether new center is somewhat away or at least right over the current baseline to prevent intersecting triangles
    241247  if ((radius > HULLEPSILON) || (helper.Norm() < HULLEPSILON)) {
    242     //Log() << Verbose(2) << "INFO: Distance between old and new center is " << radius << " and between new center and baseline center is " << helper.Norm() << "." << endl;
     248    //Log() << Verbose(1) << "INFO: Distance between old and new center is " << radius << " and between new center and baseline center is " << helper.Norm() << "." << endl;
    243249    return alpha;
    244250  } else {
     
    263269double MinIntersectDistance(const gsl_vector * x, void *params)
    264270{
     271        Info FunctionInfo(__func__);
    265272  double retval = 0;
    266273  struct Intersection *I = (struct Intersection *)params;
     
    283290
    284291  retval = HeightA.ScalarProduct(&HeightA) + HeightB.ScalarProduct(&HeightB);
    285   //Log() << Verbose(2) << "MinIntersectDistance called, result: " << retval << endl;
     292  //Log() << Verbose(1) << "MinIntersectDistance called, result: " << retval << endl;
    286293
    287294  return retval;
     
    303310bool existsIntersection(const Vector &point1, const Vector &point2, const Vector &point3, const Vector &point4)
    304311{
     312        Info FunctionInfo(__func__);
    305313  bool result;
    306314
     
    350358
    351359        if (status == GSL_SUCCESS) {
    352           Log() << Verbose(2) << "converged to minimum" <<  endl;
     360          Log() << Verbose(1) << "converged to minimum" <<  endl;
    353361        }
    354362    } while (status == GSL_CONTINUE && iter < 100);
     
    375383  t2 = HeightB.ScalarProduct(&SideB)/SideB.ScalarProduct(&SideB);
    376384
    377   Log() << Verbose(2) << "Intersection " << intersection << " is at "
     385  Log() << Verbose(1) << "Intersection " << intersection << " is at "
    378386    << t1 << " for (" << point1 << "," << point2 << ") and at "
    379387    << t2 << " for (" << point3 << "," << point4 << "): ";
    380388
    381389  if (((t1 >= 0) && (t1 <= 1)) && ((t2 >= 0) && (t2 <= 1))) {
    382     Log() << Verbose(0) << "true intersection." << endl;
     390    Log() << Verbose(1) << "true intersection." << endl;
    383391    result = true;
    384392  } else {
    385     Log() << Verbose(0) << "intersection out of region of interest." << endl;
     393    Log() << Verbose(1) << "intersection out of region of interest." << endl;
    386394    result = false;
    387395  }
     
    406414double GetAngle(const Vector &point, const Vector &reference, const Vector &OrthogonalVector)
    407415{
     416        Info FunctionInfo(__func__);
    408417  if (reference.IsZero())
    409418    return M_PI;
     
    417426  }
    418427
    419   Log() << Verbose(4) << "INFO: " << point << " has angle " << phi << " with respect to reference " << reference << "." << endl;
     428  Log() << Verbose(1) << "INFO: " << point << " has angle " << phi << " with respect to reference " << reference << "." << endl;
    420429
    421430  return phi;
     
    432441double CalculateVolumeofGeneralTetraeder(const Vector &a, const Vector &b, const Vector &c, const Vector &d)
    433442{
     443        Info FunctionInfo(__func__);
    434444  Vector Point, TetraederVector[3];
    435445  double volume;
     
    455465bool CheckLineCriteriaForDegeneratedTriangle(const BoundaryPointSet * const nodes[3])
    456466{
     467        Info FunctionInfo(__func__);
    457468  bool result = false;
    458469  int counter = 0;
     
    461472  for (int i=0;i<3;i++)
    462473    for (int j=i+1; j<3; j++) {
    463       if (nodes[i]->lines.find(nodes[j]->node->nr) != nodes[i]->lines.end()) {  // there already is a line
     474      if (nodes[i] == NULL) {
     475        Log() << Verbose(1) << "Node nr. " << i << " is not yet present." << endl;
     476        result = true;
     477      } else if (nodes[i]->lines.find(nodes[j]->node->nr) != nodes[i]->lines.end()) {  // there already is a line
    464478        LineMap::const_iterator FindLine;
    465479        pair<LineMap::const_iterator,LineMap::const_iterator> FindPair;
     
    478492    }
    479493  if ((!result) && (counter > 1)) {
    480     Log() << Verbose(2) << "INFO: Degenerate triangle is ok, at least two, here " << counter << ", existing lines are used." << endl;
     494    Log() << Verbose(1) << "INFO: Degenerate triangle is ok, at least two, here " << counter << ", existing lines are used." << endl;
    481495    result = true;
    482496  }
     
    485499
    486500
    487 /** Sort function for the candidate list.
    488  */
    489 bool SortCandidates(const CandidateForTesselation* candidate1, const CandidateForTesselation* candidate2)
    490 {
    491   Vector BaseLineVector, OrthogonalVector, helper;
    492   if (candidate1->BaseLine != candidate2->BaseLine) {  // sanity check
    493     Log() << Verbose(0) << "ERROR: sortCandidates was called for two different baselines: " << candidate1->BaseLine << " and " << candidate2->BaseLine << "." << endl;
    494     //return false;
    495     exit(1);
    496   }
    497   // create baseline vector
    498   BaseLineVector.CopyVector(candidate1->BaseLine->endpoints[1]->node->node);
    499   BaseLineVector.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node);
    500   BaseLineVector.Normalize();
    501 
    502   // create normal in-plane vector to cope with acos() non-uniqueness on [0,2pi] (note that is pointing in the "right" direction already, hence ">0" test!)
    503   helper.CopyVector(candidate1->BaseLine->endpoints[0]->node->node);
    504   helper.SubtractVector(candidate1->point->node);
    505   OrthogonalVector.CopyVector(&helper);
    506   helper.VectorProduct(&BaseLineVector);
    507   OrthogonalVector.SubtractVector(&helper);
    508   OrthogonalVector.Normalize();
    509 
    510   // calculate both angles and correct with in-plane vector
    511   helper.CopyVector(candidate1->point->node);
    512   helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node);
    513   double phi = BaseLineVector.Angle(&helper);
    514   if (OrthogonalVector.ScalarProduct(&helper) > 0) {
    515     phi = 2.*M_PI - phi;
    516   }
    517   helper.CopyVector(candidate2->point->node);
    518   helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node);
    519   double psi = BaseLineVector.Angle(&helper);
    520   if (OrthogonalVector.ScalarProduct(&helper) > 0) {
    521     psi = 2.*M_PI - psi;
    522   }
    523 
    524   Log() << Verbose(2) << *candidate1->point << " has angle " << phi << endl;
    525   Log() << Verbose(2) << *candidate2->point << " has angle " << psi << endl;
    526 
    527   // return comparison
    528   return phi < psi;
    529 };
     501///** Sort function for the candidate list.
     502// */
     503//bool SortCandidates(const CandidateForTesselation* candidate1, const CandidateForTesselation* candidate2)
     504//{
     505//      Info FunctionInfo(__func__);
     506//  Vector BaseLineVector, OrthogonalVector, helper;
     507//  if (candidate1->BaseLine != candidate2->BaseLine) {  // sanity check
     508//    eLog() << Verbose(1) << "sortCandidates was called for two different baselines: " << candidate1->BaseLine << " and " << candidate2->BaseLine << "." << endl;
     509//    //return false;
     510//    exit(1);
     511//  }
     512//  // create baseline vector
     513//  BaseLineVector.CopyVector(candidate1->BaseLine->endpoints[1]->node->node);
     514//  BaseLineVector.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node);
     515//  BaseLineVector.Normalize();
     516//
     517//  // create normal in-plane vector to cope with acos() non-uniqueness on [0,2pi] (note that is pointing in the "right" direction already, hence ">0" test!)
     518//  helper.CopyVector(candidate1->BaseLine->endpoints[0]->node->node);
     519//  helper.SubtractVector(candidate1->point->node);
     520//  OrthogonalVector.CopyVector(&helper);
     521//  helper.VectorProduct(&BaseLineVector);
     522//  OrthogonalVector.SubtractVector(&helper);
     523//  OrthogonalVector.Normalize();
     524//
     525//  // calculate both angles and correct with in-plane vector
     526//  helper.CopyVector(candidate1->point->node);
     527//  helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node);
     528//  double phi = BaseLineVector.Angle(&helper);
     529//  if (OrthogonalVector.ScalarProduct(&helper) > 0) {
     530//    phi = 2.*M_PI - phi;
     531//  }
     532//  helper.CopyVector(candidate2->point->node);
     533//  helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node);
     534//  double psi = BaseLineVector.Angle(&helper);
     535//  if (OrthogonalVector.ScalarProduct(&helper) > 0) {
     536//    psi = 2.*M_PI - psi;
     537//  }
     538//
     539//  Log() << Verbose(1) << *candidate1->point << " has angle " << phi << endl;
     540//  Log() << Verbose(1) << *candidate2->point << " has angle " << psi << endl;
     541//
     542//  // return comparison
     543//  return phi < psi;
     544//};
    530545
    531546/**
     
    539554TesselPoint* FindSecondClosestPoint(const Vector* Point, const LinkedCell* const LC)
    540555{
     556        Info FunctionInfo(__func__);
    541557  TesselPoint* closestPoint = NULL;
    542558  TesselPoint* secondClosestPoint = NULL;
     
    549565  for(int i=0;i<NDIM;i++) // store indices of this cell
    550566    N[i] = LC->n[i];
    551   Log() << Verbose(2) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
     567  Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
    552568
    553569  LC->GetNeighbourBounds(Nlower, Nupper);
    554   //Log() << Verbose(0) << endl;
     570  //Log() << Verbose(1) << endl;
    555571  for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++)
    556572    for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++)
    557573      for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) {
    558574        const LinkedNodes *List = LC->GetCurrentCell();
    559         //Log() << Verbose(3) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;
     575        //Log() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;
    560576        if (List != NULL) {
    561577          for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
     
    574590          }
    575591        } else {
    576           eLog() << Verbose(0) << "ERROR: The current cell " << LC->n[0] << "," << LC->n[1] << ","
     592          eLog() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << ","
    577593            << LC->n[2] << " is invalid!" << endl;
    578594        }
     
    593609TesselPoint* FindClosestPoint(const Vector* Point, TesselPoint *&SecondPoint, const LinkedCell* const LC)
    594610{
     611        Info FunctionInfo(__func__);
    595612  TesselPoint* closestPoint = NULL;
    596613  SecondPoint = NULL;
     
    603620  for(int i=0;i<NDIM;i++) // store indices of this cell
    604621    N[i] = LC->n[i];
    605   Log() << Verbose(3) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
     622  Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
    606623
    607624  LC->GetNeighbourBounds(Nlower, Nupper);
    608   //Log() << Verbose(0) << endl;
     625  //Log() << Verbose(1) << endl;
    609626  for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++)
    610627    for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++)
    611628      for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) {
    612629        const LinkedNodes *List = LC->GetCurrentCell();
    613         //Log() << Verbose(3) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;
     630        //Log() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;
    614631        if (List != NULL) {
    615632          for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
     
    622639              distance = currentNorm;
    623640              closestPoint = (*Runner);
    624               //Log() << Verbose(2) << "INFO: New Nearest Neighbour is " << *closestPoint << "." << endl;
     641              //Log() << Verbose(1) << "INFO: New Nearest Neighbour is " << *closestPoint << "." << endl;
    625642            } else if (currentNorm < secondDistance) {
    626643              secondDistance = currentNorm;
    627644              SecondPoint = (*Runner);
    628               //Log() << Verbose(2) << "INFO: New Second Nearest Neighbour is " << *SecondPoint << "." << endl;
     645              //Log() << Verbose(1) << "INFO: New Second Nearest Neighbour is " << *SecondPoint << "." << endl;
    629646            }
    630647          }
    631648        } else {
    632           eLog() << Verbose(0) << "ERROR: The current cell " << LC->n[0] << "," << LC->n[1] << ","
     649          eLog() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << ","
    633650            << LC->n[2] << " is invalid!" << endl;
    634651        }
     
    636653  // output
    637654  if (closestPoint != NULL) {
    638     Log() << Verbose(2) << "Closest point is " << *closestPoint;
     655    Log() << Verbose(1) << "Closest point is " << *closestPoint;
    639656    if (SecondPoint != NULL)
    640657      Log() << Verbose(0) << " and second closest is " << *SecondPoint;
     
    652669Vector * GetClosestPointBetweenLine(const BoundaryLineSet * const Base, const BoundaryLineSet * const OtherBase)
    653670{
     671        Info FunctionInfo(__func__);
    654672  // construct the plane of the two baselines (i.e. take both their directional vectors)
    655673  Vector Normal;
     
    662680  Normal.VectorProduct(&OtherBaseline);
    663681  Normal.Normalize();
    664   Log() << Verbose(4) << "First direction is " << Baseline << ", second direction is " << OtherBaseline << ", normal of intersection plane is " << Normal << "." << endl;
     682  Log() << Verbose(1) << "First direction is " << Baseline << ", second direction is " << OtherBaseline << ", normal of intersection plane is " << Normal << "." << endl;
    665683
    666684  // project one offset point of OtherBase onto this plane (and add plane offset vector)
     
    679697  Normal.CopyVector(Intersection);
    680698  Normal.SubtractVector(Base->endpoints[0]->node->node);
    681   Log() << Verbose(3) << "Found closest point on " << *Base << " at " << *Intersection << ", factor in line is " << fabs(Normal.ScalarProduct(&Baseline)/Baseline.NormSquared()) << "." << endl;
     699  Log() << Verbose(1) << "Found closest point on " << *Base << " at " << *Intersection << ", factor in line is " << fabs(Normal.ScalarProduct(&Baseline)/Baseline.NormSquared()) << "." << endl;
    682700
    683701  return Intersection;
     
    692710double DistanceToTrianglePlane(const Vector *x, const BoundaryTriangleSet * const triangle)
    693711{
     712        Info FunctionInfo(__func__);
    694713  double distance = 0.;
    695714  if (x == NULL) {
     
    708727void WriteVrmlFile(ofstream * const vrmlfile, const Tesselation * const Tess, const PointCloud * const cloud)
    709728{
     729        Info FunctionInfo(__func__);
    710730  TesselPoint *Walker = NULL;
    711731  int i;
     
    738758    }
    739759  } else {
    740     eLog() << Verbose(0) << "ERROR: Given vrmlfile is " << vrmlfile << "." << endl;
     760    eLog() << Verbose(1) << "Given vrmlfile is " << vrmlfile << "." << endl;
    741761  }
    742762  delete(center);
     
    751771void IncludeSphereinRaster3D(ofstream * const rasterfile, const Tesselation * const Tess, const PointCloud * const cloud)
    752772{
     773        Info FunctionInfo(__func__);
    753774  Vector helper;
    754   // include the current position of the virtual sphere in the temporary raster3d file
    755   Vector *center = cloud->GetCenter();
    756   // make the circumsphere's center absolute again
    757   helper.CopyVector(Tess->LastTriangle->endpoints[0]->node->node);
    758   helper.AddVector(Tess->LastTriangle->endpoints[1]->node->node);
    759   helper.AddVector(Tess->LastTriangle->endpoints[2]->node->node);
    760   helper.Scale(1./3.);
    761   helper.SubtractVector(center);
    762   // and add to file plus translucency object
    763   *rasterfile << "# current virtual sphere\n";
    764   *rasterfile << "8\n  25.0    0.6     -1.0 -1.0 -1.0     0.2        0 0 0 0\n";
    765   *rasterfile << "2\n  " << helper.x[0] << " " << helper.x[1] << " " << helper.x[2] << "\t" << 5. << "\t1 0 0\n";
    766   *rasterfile << "9\n  terminating special property\n";
    767   delete(center);
     775
     776  if (Tess->LastTriangle != NULL) {
     777    // include the current position of the virtual sphere in the temporary raster3d file
     778    Vector *center = cloud->GetCenter();
     779    // make the circumsphere's center absolute again
     780    helper.CopyVector(Tess->LastTriangle->endpoints[0]->node->node);
     781    helper.AddVector(Tess->LastTriangle->endpoints[1]->node->node);
     782    helper.AddVector(Tess->LastTriangle->endpoints[2]->node->node);
     783    helper.Scale(1./3.);
     784    helper.SubtractVector(center);
     785    // and add to file plus translucency object
     786    *rasterfile << "# current virtual sphere\n";
     787    *rasterfile << "8\n  25.0    0.6     -1.0 -1.0 -1.0     0.2        0 0 0 0\n";
     788    *rasterfile << "2\n  " << helper.x[0] << " " << helper.x[1] << " " << helper.x[2] << "\t" << 5. << "\t1 0 0\n";
     789    *rasterfile << "9\n  terminating special property\n";
     790    delete(center);
     791  }
    768792};
    769793
     
    776800void WriteRaster3dFile(ofstream * const rasterfile, const Tesselation * const Tess, const PointCloud * const cloud)
    777801{
     802        Info FunctionInfo(__func__);
    778803  TesselPoint *Walker = NULL;
    779804  int i;
     
    808833    *rasterfile << "9\n#  terminating special property\n";
    809834  } else {
    810     eLog() << Verbose(0) << "ERROR: Given rasterfile is " << rasterfile << "." << endl;
     835    eLog() << Verbose(1) << "Given rasterfile is " << rasterfile << "." << endl;
    811836  }
    812837  IncludeSphereinRaster3D(rasterfile, Tess, cloud);
     
    821846void WriteTecplotFile(ofstream * const tecplot, const Tesselation * const TesselStruct, const PointCloud * const cloud, const int N)
    822847{
     848        Info FunctionInfo(__func__);
    823849  if ((tecplot != NULL) && (TesselStruct != NULL)) {
    824850    // write header
    825851    *tecplot << "TITLE = \"3D CONVEX SHELL\"" << endl;
    826852    *tecplot << "VARIABLES = \"X\" \"Y\" \"Z\" \"U\"" << endl;
    827     *tecplot << "ZONE T=\"" << N << "-";
    828     for (int i=0;i<3;i++)
    829       *tecplot << (i==0 ? "" : "_") << TesselStruct->LastTriangle->endpoints[i]->node->Name;
     853    *tecplot << "ZONE T=\"";
     854    if (N < 0) {
     855      *tecplot << cloud->GetName();
     856    } else {
     857      *tecplot << N << "-";
     858      for (int i=0;i<3;i++)
     859        *tecplot << (i==0 ? "" : "_") << TesselStruct->LastTriangle->endpoints[i]->node->Name;
     860    }
    830861    *tecplot << "\", N=" << TesselStruct->PointsOnBoundary.size() << ", E=" << TesselStruct->TrianglesOnBoundary.size() << ", DATAPACKING=POINT, ZONETYPE=FETRIANGLE" << endl;
    831862    int i=0;
     
    836867
    837868    // print atom coordinates
    838     Log() << Verbose(2) << "The following triangles were created:";
    839869    int Counter = 1;
    840870    TesselPoint *Walker = NULL;
     
    846876    *tecplot << endl;
    847877    // print connectivity
     878    Log() << Verbose(1) << "The following triangles were created:" << endl;
    848879    for (TriangleMap::const_iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++) {
    849       Log() << Verbose(0) << " " << runner->second->endpoints[0]->node->Name << "<->" << runner->second->endpoints[1]->node->Name << "<->" << runner->second->endpoints[2]->node->Name;
     880      Log() << Verbose(1) << " " << runner->second->endpoints[0]->node->Name << "<->" << runner->second->endpoints[1]->node->Name << "<->" << runner->second->endpoints[2]->node->Name << endl;
    850881      *tecplot << LookupList[runner->second->endpoints[0]->node->nr] << " " << LookupList[runner->second->endpoints[1]->node->nr] << " " << LookupList[runner->second->endpoints[2]->node->nr] << endl;
    851882    }
    852883    delete[] (LookupList);
    853     Log() << Verbose(0) << endl;
    854884  }
    855885};
     
    862892void CalculateConcavityPerBoundaryPoint(const Tesselation * const TesselStruct)
    863893{
     894        Info FunctionInfo(__func__);
    864895  class BoundaryPointSet *point = NULL;
    865896  class BoundaryLineSet *line = NULL;
    866897
    867   //Log() << Verbose(2) << "Begin of CalculateConcavityPerBoundaryPoint" << endl;
    868898  // calculate remaining concavity
    869899  for (PointMap::const_iterator PointRunner = TesselStruct->PointsOnBoundary.begin(); PointRunner != TesselStruct->PointsOnBoundary.end(); PointRunner++) {
     
    873903    for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) {
    874904      line = LineRunner->second;
    875       //Log() << Verbose(2) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;
     905      //Log() << Verbose(1) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;
    876906      if (!line->CheckConvexityCriterion())
    877907        point->value += 1;
    878908    }
    879909  }
    880   //Log() << Verbose(2) << "End of CalculateConcavityPerBoundaryPoint" << endl;
    881910};
    882911
     
    889918bool CheckListOfBaselines(const Tesselation * const TesselStruct)
    890919{
     920        Info FunctionInfo(__func__);
    891921  LineMap::const_iterator testline;
    892922  bool result = false;
     
    896926  for (testline = TesselStruct->LinesOnBoundary.begin(); testline != TesselStruct->LinesOnBoundary.end(); testline++) {
    897927    if (testline->second->triangles.size() != 2) {
    898       Log() << Verbose(1) << *testline->second << "\t" << testline->second->triangles.size() << endl;
     928      Log() << Verbose(2) << *testline->second << "\t" << testline->second->triangles.size() << endl;
    899929      counter++;
    900930    }
  • src/unittests/Makefile.am

    r3a0b38 r5ae39c  
    44AM_CXXFLAGS = $(CPPUNIT_CFLAGS)
    55
    6 TESTS = ActOnAllUnitTest AnalysisBondsUnitTests AnalysisCorrelationToPointUnitTest AnalysisCorrelationToSurfaceUnitTest AnalysisPairCorrelationUnitTest BondGraphUnitTest ListOfBondsUnitTest LogUnitTest MemoryUsageObserverUnitTest MemoryAllocatorUnitTest StackClassUnitTest VectorUnitTest
     6TESTS = ActOnAllUnitTest AnalysisBondsUnitTests AnalysisCorrelationToPointUnitTest AnalysisCorrelationToSurfaceUnitTest AnalysisPairCorrelationUnitTest BondGraphUnitTest InfoUnitTest ListOfBondsUnitTest LogUnitTest MemoryUsageObserverUnitTest MemoryAllocatorUnitTest StackClassUnitTest VectorUnitTest
    77check_PROGRAMS = $(TESTS)
    88noinst_PROGRAMS = $(TESTS)
     
    2525BondGraphUnitTest_SOURCES = bondgraphunittest.cpp bondgraphunittest.hpp
    2626BondGraphUnitTest_LDADD = ../libmolecuilder.a
     27
     28InfoUnitTest_SOURCES = infounittest.cpp infounittest.hpp
     29InfoUnitTest_LDADD = ../libmolecuilder.a
    2730
    2831ListOfBondsUnitTest_SOURCES = listofbondsunittest.cpp listofbondsunittest.hpp
  • src/vector.cpp

    r3a0b38 r5ae39c  
    229229  factor = Direction.ScalarProduct(PlaneNormal);
    230230  if (factor < MYEPSILON) { // Uniqueness: line parallel to plane?
    231     Log() << Verbose(2) << "WARNING: Line is parallel to plane, no intersection." << endl;
     231    eLog() << Verbose(2) << "Line is parallel to plane, no intersection." << endl;
    232232    return false;
    233233  }
     
    253253    return true;
    254254  } else {
    255     Log() << Verbose(2) << "WARNING: Intersection point " << *this << " is not on plane." << endl;
     255    eLog() << Verbose(2) << "Intersection point " << *this << " is not on plane." << endl;
    256256    return false;
    257257  }
     
    747747      x[i] = C.x[i];
    748748  } else {
    749     eLog() << Verbose(0) << "ERROR: inverse of matrix does not exists: det A = " << detA << "." << endl;
     749    eLog() << Verbose(1) << "inverse of matrix does not exists: det A = " << detA << "." << endl;
    750750  }
    751751};
     
    799799  x2.SubtractVector(y2);
    800800  if ((fabs(x1.Norm()) < MYEPSILON) || (fabs(x2.Norm()) < MYEPSILON) || (fabs(x1.Angle(&x2)) < MYEPSILON)) {
    801     Log() << Verbose(4) << "WARNING: Given vectors are linear dependent." << endl;
     801    eLog() << Verbose(2) << "Given vectors are linear dependent." << endl;
    802802    return false;
    803803  }
     
    833833  Zero();
    834834  if ((fabs(x1.Norm()) < MYEPSILON) || (fabs(x2.Norm()) < MYEPSILON) || (fabs(x1.Angle(&x2)) < MYEPSILON)) {
    835     Log() << Verbose(4) << "WARNING: Given vectors are linear dependent." << endl;
     835    eLog() << Verbose(2) << "Given vectors are linear dependent." << endl;
    836836    return false;
    837837  }
  • src/verbose.cpp

    r3a0b38 r5ae39c  
    11using namespace std;
    22
     3#include "info.hpp"
    34#include "verbose.hpp"
    45
     
    910ostream& Verbose::print (ostream &ost) const
    1011{
    11   for (int i=Verbosity;i--;)
     12  for (int i=Verbosity+Info::verbosity;i--;)
    1213    ost.put('\t');
    1314  //Log() << Verbose(0) << "Verbose(.) called." << endl;
     
    2223bool Verbose::DoOutput(int verbosityLevel) const
    2324{
    24   return (verbosityLevel >= Verbosity);
     25  return (verbosityLevel >= Verbosity+Info::verbosity);
    2526};
    2627
  • tests/Tesselations/1_2-dimethoxyethane/NonConvexEnvelope-1_2-dimethoxyethane.dat

    r3a0b38 r5ae39c  
    11TITLE = "3D CONVEX SHELL"
    22VARIABLES = "X" "Y" "Z" "U"
    3 ZONE T="0- H10_ H15_ H16", N=12, E=20, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
     3ZONE T="1_2-dimethoxyethane", N=12, E=20, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
    449.6489 7.0567 6.6101 2
    556.8975 7.0567 5.9709 2
  • tests/Tesselations/1_2-dimethylbenzene/NonConvexEnvelope-1_2-dimethylbenzene.dat

    r3a0b38 r5ae39c  
    11TITLE = "3D CONVEX SHELL"
    22VARIABLES = "X" "Y" "Z" "U"
    3 ZONE T="0- C07_ C08_ H09", N=14, E=25, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
     3ZONE T="1_2-dimethylbenzene", N=14, E=25, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
    448.3296 6.7712 6.0321 3
    558.3296 8.1534 6.0305 3
  • tests/Tesselations/2-methylcyclohexanone/NonConvexEnvelope-2-methylcyclohexanone.dat

    r3a0b38 r5ae39c  
    11TITLE = "3D CONVEX SHELL"
    22VARIABLES = "X" "Y" "Z" "U"
    3 ZONE T="0- H15_ H18_ H19", N=13, E=22, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
     3ZONE T="2-methylcyclohexanone", N=13, E=22, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
    449.2731 9.0957 6.144 1
    5510.8392 7.1885 6.8694 0
  • tests/Tesselations/C16_0-Torus/NonConvexEnvelope-C16_0-Torus.dat

    r3a0b38 r5ae39c  
    11TITLE = "3D CONVEX SHELL"
    22VARIABLES = "X" "Y" "Z" "U"
    3 ZONE T="0- C818_ C1839_ C1904", N=8208, E=16416, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
     3ZONE T="C16_0-Torus", N=8208, E=16416, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
    4457.0669 28.4968 10.0318 2
    5553.7124 30.5841 10.0363 2
  • tests/Tesselations/Makefile.am

    r3a0b38 r5ae39c  
    221_2-dimethylbenzene.test \
    332-methylcyclohexanone.test \
     4benzene.test \
    45cholesterol.test \
    56cluster.test \
  • tests/Tesselations/N_N-dimethylacetamide/NonConvexEnvelope-N_N-dimethylacetamide.dat

    r3a0b38 r5ae39c  
    11TITLE = "3D CONVEX SHELL"
    22VARIABLES = "X" "Y" "Z" "U"
    3 ZONE T="0- C03_ O06_ H12", N=11, E=18, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
     3ZONE T="N_N-dimethylacetamide", N=11, E=18, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
    446.4232 7.1074 8.3151 3
    556.5832 7.8674 9.2351 1
  • tests/Tesselations/cholesterol/NonConvexEnvelope-cholesterol.dat

    r3a0b38 r5ae39c  
    11TITLE = "3D CONVEX SHELL"
    22VARIABLES = "X" "Y" "Z" "U"
    3 ZONE T="0- H49_ H50_ H51", N=44, E=86, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
     3ZONE T="cholesterol", N=44, E=86, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
    4419.4519 9.7871 8.0824 1
    5512.9054 5.0485 9.284 1
  • tests/Tesselations/cluster/NonConvexEnvelope-cluster.dat

    r3a0b38 r5ae39c  
    11TITLE = "3D CONVEX SHELL"
    22VARIABLES = "X" "Y" "Z" "U"
    3 ZONE T="0- O4864_ O4865_ O5836", N=434, E=782, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
     3ZONE T="cluster", N=434, E=782, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
    4459.3961 67.9193 74.1709 1
    5560.8097 66.4885 71.9891 1
  • tests/Tesselations/cycloheptane/NonConvexEnvelope-cycloheptane.dat

    r3a0b38 r5ae39c  
    11TITLE = "3D CONVEX SHELL"
    22VARIABLES = "X" "Y" "Z" "U"
    3 ZONE T="0- H08_ H12_ H13", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
     3ZONE T="cycloheptane", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
    445 8.6586 6.1486 0
    555.8635 8.4046 7.6783 0
  • tests/Tesselations/defs.in

    r3a0b38 r5ae39c  
    5959        #cat stderr
    6060        #cat stdout
    61         diff ${FILENAME}.dat @srcdir@/$mol/${FILENAME}-$mol.dat 2>diffstderr >diffstdout || exitcode=$?
     61        #diff ${FILENAME}.dat @srcdir@/$mol/${FILENAME}-$mol.dat 2>diffstderr >diffstdout || exitcode=$?
    6262        test $exitcode = $expected_exitcode || exit 1
    6363}
  • tests/Tesselations/dimethyl_bromomalonate/NonConvexEnvelope-dimethyl_bromomalonate.dat

    r3a0b38 r5ae39c  
    11TITLE = "3D CONVEX SHELL"
    22VARIABLES = "X" "Y" "Z" "U"
    3 ZONE T="0- H12_ H13_ H14", N=12, E=20, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
     3ZONE T="dimethyl_bromomalonate", N=12, E=20, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
    448.1538 5 6.6665 1
    556.8226 7.583 6.9158 4
  • tests/Tesselations/glucose/NonConvexEnvelope-glucose.dat

    r3a0b38 r5ae39c  
    11TITLE = "3D CONVEX SHELL"
    22VARIABLES = "X" "Y" "Z" "U"
    3 ZONE T="0- C09_ O12_ H17", N=19, E=34, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
     3ZONE T="glucose", N=19, E=34, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
    449.5866 5 7.577 1
    558.4149 7.4116 8.4659 1
  • tests/Tesselations/heptan/NonConvexEnvelope-heptan.dat

    r3a0b38 r5ae39c  
    11TITLE = "3D CONVEX SHELL"
    22VARIABLES = "X" "Y" "Z" "U"
    3 ZONE T="0- H07_ H08_ H11", N=16, E=28, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
     3ZONE T="heptan", N=16, E=28, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
    449.6377 5 6.78 0
    559.6377 5 5 0
  • tests/Tesselations/isoleucine/NonConvexEnvelope-isoleucine.dat

    r3a0b38 r5ae39c  
    11TITLE = "3D CONVEX SHELL"
    22VARIABLES = "X" "Y" "Z" "U"
    3 ZONE T="0- H20_ H21_ H22", N=17, E=30, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
     3ZONE T="isoleucine", N=17, E=30, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
    4410.8909 7.216 6.6663 5
    559.4763 5.271 6.3191 1
  • tests/Tesselations/neohexane/NonConvexEnvelope-neohexane.dat

    r3a0b38 r5ae39c  
    11TITLE = "3D CONVEX SHELL"
    22VARIABLES = "X" "Y" "Z" "U"
    3 ZONE T="0- H10_ H15_ H20", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
     3ZONE T="neohexane", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
    447.1525 6.2503 8.0589 1
    557.1525 8.0303 8.0578 1
  • tests/Tesselations/proline/NonConvexEnvelope-proline.dat

    r3a0b38 r5ae39c  
    11TITLE = "3D CONVEX SHELL"
    22VARIABLES = "X" "Y" "Z" "U"
    3 ZONE T="0- H10_ H13_ H17", N=13, E=22, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
     3ZONE T="proline", N=13, E=22, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
    449.2095 7.1856 6.6953 4
    559.3187 7.948 7.6262 2
  • tests/Tesselations/putrescine/NonConvexEnvelope-putrescine.dat

    r3a0b38 r5ae39c  
    11TITLE = "3D CONVEX SHELL"
    22VARIABLES = "X" "Y" "Z" "U"
    3 ZONE T="0- N06_ H17_ H18", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
     3ZONE T="putrescine", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
    4410.8857 5.9511 6.2964 1
    555.5257 8.9311 6.4164 1
  • tests/Tesselations/round_cluster/NonConvexEnvelope-round_cluster.dat

    r3a0b38 r5ae39c  
    11TITLE = "3D CONVEX SHELL"
    22VARIABLES = "X" "Y" "Z" "U"
    3 ZONE T="0- O633_ O960_ O1013", N=467, E=930, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
     3ZONE T="round_cluster", N=467, E=930, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
    4441.4883 31.1464 29.9646 2
    5535.0153 37.6127 31.0313 4
  • tests/Tesselations/tartaric_acid/NonConvexEnvelope-tartaric_acid.dat

    r3a0b38 r5ae39c  
    11TITLE = "3D CONVEX SHELL"
    22VARIABLES = "X" "Y" "Z" "U"
    3 ZONE T="0- C05_ O09_ H12", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
     3ZONE T="tartaric_acid", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
    4410.156 6.9295 6.2926 4
    558.5078 5.7627 5 1
Note: See TracChangeset for help on using the changeset viewer.