Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tesselation.cpp

    re138de r27bd2f  
    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);
Note: See TracChangeset for help on using the changeset viewer.