Changeset f67b6e


Ignore:
Timestamp:
Nov 25, 2009, 3:29:18 PM (15 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
7273fc
Parents:
8725ed
Message:

Multi-Candidate-Add included and incorporated class Info into boundary.cpp, tesselation.cpp and tesselationhelpers.cpp

  • class Info incorporation:
    • (almost) all functions of boundary.cpp, tesselation.cpp and tesselationhelpers.cpp now begins with class Info FunctionName(func);
Location:
src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/boundary.cpp

    r8725ed rf67b6e  
    1010#include "element.hpp"
    1111#include "helpers.hpp"
     12#include "info.hpp"
    1213#include "linkedcell.hpp"
    1314#include "log.hpp"
     
    3334double *GetDiametersOfCluster(const Boundaries *BoundaryPtr, const molecule *mol, Tesselation *&TesselStruct, const bool IsAngstroem)
    3435{
     36        Info FunctionInfo(__func__);
    3537  // get points on boundary of NULL was given as parameter
    3638  bool BoundaryFreeFlag = false;
     
    5355  } else {
    5456    BoundaryPoints = BoundaryPtr;
    55     Log() << Verbose(1) << "Using given boundary points set." << endl;
     57    Log() << Verbose(0) << "Using given boundary points set." << endl;
    5658  }
    5759  // determine biggest "diameter" of cluster for each axis
     
    6769          //Log() << Verbose(1) << "Current component is " << component << ", Othercomponent is " << Othercomponent << "." << endl;
    6870          for (Boundaries::const_iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) {
    69               //Log() << Verbose(2) << "Current runner is " << *(runner->second.second) << "." << endl;
     71              //Log() << Verbose(1) << "Current runner is " << *(runner->second.second) << "." << endl;
    7072              // seek for the neighbours pair where the Othercomponent sign flips
    7173              Neighbour = runner;
     
    8284                  DistanceVector.CopyVector(&runner->second.second->x);
    8385                  DistanceVector.SubtractVector(&Neighbour->second.second->x);
    84                   //Log() << Verbose(3) << "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "." << endl;
     86                  //Log() << Verbose(2) << "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "." << endl;
    8587                } while ((runner != Neighbour) && (fabs(OldComponent / fabs(
    8688                  OldComponent) - DistanceVector.x[Othercomponent] / fabs(
     
    9193                    OtherNeighbour = BoundaryPoints[axis].end();
    9294                  OtherNeighbour--;
    93                   //Log() << Verbose(2) << "The pair, where the sign of OtherComponent flips, is: " << *(Neighbour->second.second) << " and " << *(OtherNeighbour->second.second) << "." << endl;
     95                  //Log() << Verbose(1) << "The pair, where the sign of OtherComponent flips, is: " << *(Neighbour->second.second) << " and " << *(OtherNeighbour->second.second) << "." << endl;
    9496                  // now we have found the pair: Neighbour and OtherNeighbour
    9597                  OtherVector.CopyVector(&runner->second.second->x);
    9698                  OtherVector.SubtractVector(&OtherNeighbour->second.second->x);
    97                   //Log() << Verbose(2) << "Distances to Neighbour and OtherNeighbour are " << DistanceVector.x[component] << " and " << OtherVector.x[component] << "." << endl;
    98                   //Log() << Verbose(2) << "OtherComponents to Neighbour and OtherNeighbour are " << DistanceVector.x[Othercomponent] << " and " << OtherVector.x[Othercomponent] << "." << endl;
     99                  //Log() << Verbose(1) << "Distances to Neighbour and OtherNeighbour are " << DistanceVector.x[component] << " and " << OtherVector.x[component] << "." << endl;
     100                  //Log() << Verbose(1) << "OtherComponents to Neighbour and OtherNeighbour are " << DistanceVector.x[Othercomponent] << " and " << OtherVector.x[Othercomponent] << "." << endl;
    99101                  // do linear interpolation between points (is exact) to extract exact intersection between Neighbour and OtherNeighbour
    100102                  w1 = fabs(OtherVector.x[Othercomponent]);
     
    103105                      * OtherVector.x[component]) / (w1 + w2));
    104106                  // mark if it has greater diameter
    105                   //Log() << Verbose(2) << "Comparing current greatest " << GreatestDiameter[component] << " to new " << tmp << "." << endl;
     107                  //Log() << Verbose(1) << "Comparing current greatest " << GreatestDiameter[component] << " to new " << tmp << "." << endl;
    106108                  GreatestDiameter[component] = (GreatestDiameter[component]
    107109                      > tmp) ? GreatestDiameter[component] : tmp;
    108110                } //else
    109               //Log() << Verbose(2) << "Saw no sign flip, probably top or bottom node." << endl;
     111              //Log() << Verbose(1) << "Saw no sign flip, probably top or bottom node." << endl;
    110112            }
    111113        }
     
    135137Boundaries *GetBoundaryPoints(const molecule *mol, Tesselation *&TesselStruct)
    136138{
     139        Info FunctionInfo(__func__);
    137140  atom *Walker = NULL;
    138141  PointMap PointsOnBoundary;
     
    149152  double angle = 0.;
    150153
    151   Log() << Verbose(1) << "Finding all boundary points." << endl;
    152154  // 3a. Go through every axis
    153155  for (int axis = 0; axis < NDIM; axis++) {
     
    176178        angle = 0.; // otherwise it's a vector in Axis Direction and unimportant for boundary issues
    177179
    178       //Log() << Verbose(2) << "Checking sign in quadrant : " << ProjectedVector.Projection(&AngleReferenceNormalVector) << "." << endl;
     180      //Log() << Verbose(1) << "Checking sign in quadrant : " << ProjectedVector.Projection(&AngleReferenceNormalVector) << "." << endl;
    179181      if (ProjectedVector.ScalarProduct(&AngleReferenceNormalVector) > 0) {
    180182        angle = 2. * M_PI - angle;
    181183      }
    182       Log() << Verbose(2) << "Inserting " << *Walker << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl;
     184      Log() << Verbose(1) << "Inserting " << *Walker << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl;
    183185      BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, DistancePair (radius, Walker)));
    184186      if (!BoundaryTestPair.second) { // same point exists, check first r, then distance of original vectors to center of gravity
     
    210212    // printing all inserted for debugging
    211213    //    {
    212     //      Log() << Verbose(2) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl;
     214    //      Log() << Verbose(1) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl;
    213215    //      int i=0;
    214216    //      for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) {
    215217    //        if (runner != BoundaryPoints[axis].begin())
    216     //          Log() << Verbose(2) << ", " << i << ": " << *runner->second.second;
     218    //          Log() << Verbose(0) << ", " << i << ": " << *runner->second.second;
    217219    //        else
    218     //          Log() << Verbose(2) << i << ": " << *runner->second.second;
     220    //          Log() << Verbose(0) << i << ": " << *runner->second.second;
    219221    //        i++;
    220222    //      }
    221     //      Log() << Verbose(2) << endl;
     223    //      Log() << Verbose(0) << endl;
    222224    //    }
    223225    // 3c. throw out points whose distance is less than the mean of left and right neighbours
     
    249251          SideA.SubtractVector(MolCenter);
    250252          SideA.ProjectOntoPlane(&AxisVector);
    251           //          Log() << Verbose(0) << "SideA: " << SideA << endl;
     253          //          Log() << Verbose(1) << "SideA: " << SideA << endl;
    252254
    253255          SideB.CopyVector(&right->second.second->x);
    254256          SideB.SubtractVector(MolCenter);
    255257          SideB.ProjectOntoPlane(&AxisVector);
    256           //          Log() << Verbose(0) << "SideB: " << SideB << endl;
     258          //          Log() << Verbose(1) << "SideB: " << SideB << endl;
    257259
    258260          SideC.CopyVector(&left->second.second->x);
    259261          SideC.SubtractVector(&right->second.second->x);
    260262          SideC.ProjectOntoPlane(&AxisVector);
    261           //          Log() << Verbose(0) << "SideC: " << SideC << endl;
     263          //          Log() << Verbose(1) << "SideC: " << SideC << endl;
    262264
    263265          SideH.CopyVector(&runner->second.second->x);
    264266          SideH.SubtractVector(MolCenter);
    265267          SideH.ProjectOntoPlane(&AxisVector);
    266           //          Log() << Verbose(0) << "SideH: " << SideH << endl;
     268          //          Log() << Verbose(1) << "SideH: " << SideH << endl;
    267269
    268270          // calculate each length
     
    277279          const double delta = SideC.Angle(&SideH);
    278280          const double MinDistance = a * sin(beta) / (sin(delta)) * (((alpha < M_PI / 2.) || (gamma < M_PI / 2.)) ? 1. : -1.);
    279           //Log() << Verbose(2) << " I calculated: a = " << a << ", h = " << h << ", beta(" << left->second.second->Name << "," << left->second.second->Name << "-" << right->second.second->Name << ") = " << beta << ", delta(" << left->second.second->Name << "," << runner->second.second->Name << ") = " << delta << ", Min = " << MinDistance << "." << endl;
     281          //Log() << Verbose(1) << " I calculated: a = " << a << ", h = " << h << ", beta(" << left->second.second->Name << "," << left->second.second->Name << "-" << right->second.second->Name << ") = " << beta << ", delta(" << left->second.second->Name << "," << runner->second.second->Name << ") = " << delta << ", Min = " << MinDistance << "." << endl;
    280282          Log() << Verbose(1) << "Checking CoG distance of runner " << *runner->second.second << " " << h << " against triangle's side length spanned by (" << *left->second.second << "," << *right->second.second << ") of " << MinDistance << "." << endl;
    281283          if ((fabs(h / fabs(h) - MinDistance / fabs(MinDistance)) < MYEPSILON) && ((h - MinDistance)) < -MYEPSILON) {
     
    303305void FindConvexBorder(const molecule* mol, Tesselation *&TesselStruct, const LinkedCell *LCList, const char *filename)
    304306{
     307        Info FunctionInfo(__func__);
    305308  bool BoundaryFreeFlag = false;
    306309  Boundaries *BoundaryPoints = NULL;
    307 
    308   Log() << Verbose(1) << "Begin of FindConvexBorder" << endl;
    309310
    310311  if (TesselStruct != NULL) // free if allocated
     
    317318      BoundaryPoints = GetBoundaryPoints(mol, TesselStruct);
    318319  } else {
    319       Log() << Verbose(1) << "Using given boundary points set." << endl;
     320      Log() << Verbose(0) << "Using given boundary points set." << endl;
    320321  }
    321322
     
    323324  for (int axis=0; axis < NDIM; axis++)
    324325    {
    325       Log() << Verbose(2) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl;
     326      Log() << Verbose(1) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl;
    326327      int i=0;
    327328      for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) {
    328329        if (runner != BoundaryPoints[axis].begin())
    329           Log() << Verbose(2) << ", " << i << ": " << *runner->second.second;
     330          Log() << Verbose(0) << ", " << i << ": " << *runner->second.second;
    330331        else
    331           Log() << Verbose(2) << i << ": " << *runner->second.second;
     332          Log() << Verbose(0) << i << ": " << *runner->second.second;
    332333        i++;
    333334      }
    334       Log() << Verbose(2) << endl;
     335      Log() << Verbose(0) << endl;
    335336    }
    336337
     
    341342          eLog() << Verbose(2) << "Point " << *(runner->second.second) << " is already present!" << endl;
    342343
    343   Log() << Verbose(2) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl;
     344  Log() << Verbose(0) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl;
    344345  // now we have the whole set of edge points in the BoundaryList
    345346
     
    347348  //  Log() << Verbose(1) << "Listing PointsOnBoundary:";
    348349  //  for(PointMap::iterator runner = PointsOnBoundary.begin(); runner != PointsOnBoundary.end(); runner++) {
    349   //    Log() << Verbose(1) << " " << *runner->second;
     350  //    Log() << Verbose(0) << " " << *runner->second;
    350351  //  }
    351   //  Log() << Verbose(1) << endl;
     352  //  Log() << Verbose(0) << endl;
    352353
    353354  // 3a. guess starting triangle
     
    359360  // 3c. check whether all atoms lay inside the boundary, if not, add to boundary points, segment triangle into three with the new point
    360361  if (!TesselStruct->InsertStraddlingPoints(mol, LCList))
    361     Log() << Verbose(1) << "Insertion of straddling points failed!" << endl;
    362 
    363   Log() << Verbose(2) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " intermediate triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl;
     362    eLog() << Verbose(1) << "Insertion of straddling points failed!" << endl;
     363
     364  Log() << Verbose(0) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " intermediate triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl;
    364365
    365366  // 4. Store triangles in tecplot file
     
    411412//    Log() << Verbose(1) << "Correction of concave tesselpoints failed!" << endl;
    412413
    413   Log() << Verbose(2) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl;
     414  Log() << Verbose(0) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl;
    414415
    415416  // 4. Store triangles in tecplot file
     
    437438  if (BoundaryFreeFlag)
    438439    delete[] (BoundaryPoints);
    439 
    440   Log() << Verbose(1) << "End of FindConvexBorder" << endl;
    441440};
    442441
     
    450449bool RemoveAllBoundaryPoints(class Tesselation *&TesselStruct, const molecule * const mol, const char * const filename)
    451450{
     451        Info FunctionInfo(__func__);
    452452  int i=0;
    453453  char number[MAXSTRINGSIZE];
     
    460460  PointMap::iterator PointRunner;
    461461  while (!TesselStruct->PointsOnBoundary.empty()) {
    462     Log() << Verbose(2) << "Remaining points are: ";
     462    Log() << Verbose(1) << "Remaining points are: ";
    463463    for (PointMap::iterator PointSprinter = TesselStruct->PointsOnBoundary.begin(); PointSprinter != TesselStruct->PointsOnBoundary.end(); PointSprinter++)
    464       Log() << Verbose(2) << *(PointSprinter->second) << "\t";
    465     Log() << Verbose(2) << endl;
     464      Log() << Verbose(0) << *(PointSprinter->second) << "\t";
     465    Log() << Verbose(0) << endl;
    466466
    467467    PointRunner = TesselStruct->PointsOnBoundary.begin();
     
    503503double ConvexizeNonconvexEnvelope(class Tesselation *&TesselStruct, const molecule * const mol, const char * const filename)
    504504{
     505        Info FunctionInfo(__func__);
    505506  double volume = 0;
    506507  class BoundaryPointSet *point = NULL;
     
    516517  int run = 0;
    517518
    518   Log() << Verbose(0) << "Begin of ConvexizeNonconvexEnvelope" << endl;
    519 
    520519  // check whether there is something to work on
    521520  if (TesselStruct == NULL) {
     
    539538      for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) {
    540539        line = LineRunner->second;
    541         Log() << Verbose(2) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;
     540        Log() << Verbose(1) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;
    542541        if (!line->CheckConvexityCriterion()) {
    543542          // remove the point if needed
     
    604603
    605604  // end
    606   Log() << Verbose(1) << "Volume is " << volume << "." << endl;
    607   Log() << Verbose(0) << "End of ConvexizeNonconvexEnvelope" << endl;
     605  Log() << Verbose(0) << "Volume is " << volume << "." << endl;
    608606  return volume;
    609607};
     
    619617double VolumeOfConvexEnvelope(class Tesselation *TesselStruct, class config *configuration)
    620618{
     619        Info FunctionInfo(__func__);
    621620  bool IsAngstroem = configuration->GetIsAngstroem();
    622621  double volume = 0.;
     
    625624
    626625  // 6a. Every triangle forms a pyramid with the center of gravity as its peak, sum up the volumes
    627   Log() << Verbose(1)
    628       << "Calculating the volume of the pyramids formed out of triangles and center of gravity."
    629       << endl;
    630626  for (TriangleMap::iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++)
    631627    { // go through every triangle, calculate volume of its pyramid with CoG as peak
     
    642638      const double h = x.Norm(); // distance of CoG to triangle
    643639      const double PyramidVolume = (1. / 3.) * G * h; // this formula holds for _all_ pyramids (independent of n-edge base or (not) centered peak)
    644       Log() << Verbose(2) << "Area of triangle is " << setprecision(10) << G << " "
     640      Log() << Verbose(1) << "Area of triangle is " << setprecision(10) << G << " "
    645641          << (IsAngstroem ? "angstrom" : "atomiclength") << "^2, height is "
    646642          << h << " and the volume is " << PyramidVolume << " "
     
    664660void StoreTrianglesinFile(const molecule * const mol, const Tesselation *&TesselStruct, const char *filename, const char *extraSuffix)
    665661{
     662        Info FunctionInfo(__func__);
    666663  // 4. Store triangles in tecplot file
    667664  if (filename != NULL) {
     
    698695void PrepareClustersinWater(config *configuration, molecule *mol, double ClusterVolume, double celldensity)
    699696{
     697        Info FunctionInfo(__func__);
    700698  bool IsAngstroem = true;
    701699  double *GreatestDiameter = NULL;
     
    798796molecule * FillBoxWithMolecule(MoleculeListClass *List, molecule *filler, config &configuration, double distance[NDIM], double RandomAtomDisplacement, double RandomMolDisplacement, bool DoRandomRotation)
    799797{
     798        Info FunctionInfo(__func__);
    800799  molecule *Filling = new molecule(filler->elemente);
    801800  Vector CurrentPosition;
     
    814813  double phi[NDIM];
    815814  class Tesselation *TesselStruct[List->ListOfMolecules.size()];
    816 
    817   Log() << Verbose(0) << "Begin of FillBoxWithMolecule" << endl;
    818815
    819816  i=0;
     
    877874          for (int i=0;i<NDIM;i++)
    878875            FillerTranslations.x[i] = RandomMolDisplacement*(rand()/(RAND_MAX/2.) - 1.);
    879           Log() << Verbose(3) << "INFO: Translating this filler by " << FillerTranslations << "." << endl;
     876          Log() << Verbose(2) << "INFO: Translating this filler by " << FillerTranslations << "." << endl;
    880877
    881878          // go through all atoms
     
    938935        delete(TesselStruct[i]);
    939936  }
    940   Log() << Verbose(0) << "End of FillBoxWithMolecule" << endl;
    941 
    942937  return Filling;
    943938};
     
    954949void FindNonConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LCList, const double RADIUS, const char *filename = NULL)
    955950{
     951        Info FunctionInfo(__func__);
    956952  bool freeLC = false;
    957953  CandidateForTesselation *baseline;
     
    959955  bool OneLoopWithoutSuccessFlag = true;  // marks whether we went once through all baselines without finding any without two triangles
    960956  bool TesselationFailFlag = false;
    961 
    962   Log() << Verbose(1) << "Entering search for non convex hull. " << endl;
     957  BoundaryTriangleSet *T = NULL;
     958
    963959  if (TesselStruct == NULL) {
    964960    Log() << Verbose(1) << "Allocating Tesselation struct ..." << endl;
     
    970966  }
    971967
    972   Log() << Verbose(0) << "Begin of FindNonConvexBorder\n";
    973 
    974968  // initialise Linked Cell
    975969  if (LCList == NULL) {
     
    984978  while ((!TesselStruct->OpenLines.empty()) && (OneLoopWithoutSuccessFlag)) {
    985979    // 2a. fill all new OpenLines
    986     Log() << Verbose(0) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for candidates:" << endl;
     980    Log() << Verbose(1) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for candidates:" << endl;
    987981    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++)
    988       Log() << Verbose(1) << *(Runner->second) << endl;
     982      Log() << Verbose(2) << *(Runner->second) << endl;
    989983
    990984    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) {
    991985      baseline = Runner->second;
    992       if (baseline->point == NULL) {
    993         Log() << Verbose(0) << "Finding best candidate for open line " << *baseline->BaseLine << endl;
    994         TesselationFailFlag = TesselStruct->FindNextSuitableTriangle(*baseline, *(((baseline->BaseLine->triangles.begin()))->second), RADIUS, LCList); //the line is there, so there is a triangle, but only one.
     986      if (baseline->pointlist.empty()) {
     987        T = (((baseline->BaseLine->triangles.begin()))->second);
     988        Log() << Verbose(1) << "Finding best candidate for open line " << *baseline->BaseLine << " of triangle " << *T << endl;
     989        TesselationFailFlag = TesselStruct->FindNextSuitableTriangle(*baseline, *T, RADIUS, LCList); //the line is there, so there is a triangle, but only one.
    995990      }
    996991    }
     
    998993    // 2b. search for smallest ShortestAngle among all candidates
    999994    double ShortestAngle = 4.*M_PI;
    1000     Log() << Verbose(0) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for the best candidates:" << endl;
     995    Log() << Verbose(1) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for the best candidates:" << endl;
    1001996    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++)
    1002       Log() << Verbose(1) << *(Runner->second) << endl;
     997      Log() << Verbose(2) << *(Runner->second) << endl;
    1003998
    1004999    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) {
     
    10061001        baseline = Runner->second;
    10071002        ShortestAngle = baseline->ShortestAngle;
    1008         //Log() << Verbose(0) << "New best candidate is " << *baseline->BaseLine << " with point " << *baseline->point << " and angle " << baseline->ShortestAngle << endl;
     1003        //Log() << Verbose(1) << "New best candidate is " << *baseline->BaseLine << " with point " << *baseline->point << " and angle " << baseline->ShortestAngle << endl;
    10091004      }
    10101005    }
    1011     if ((ShortestAngle == 4.*M_PI) || (baseline->point == NULL))
     1006    if ((ShortestAngle == 4.*M_PI) || (baseline->pointlist.empty()))
    10121007      OneLoopWithoutSuccessFlag = false;
    10131008    else {
     
    10411036//  }
    10421037
    1043   // Purges surplus triangles.
    1044   TesselStruct->RemoveDegeneratedTriangles();
    1045 
    1046   // check envelope for consistency
    1047   CheckListOfBaselines(TesselStruct);
     1038//  // Purges surplus triangles.
     1039//  TesselStruct->RemoveDegeneratedTriangles();
     1040//
     1041//  // check envelope for consistency
     1042//  CheckListOfBaselines(TesselStruct);
    10481043
    10491044  // write final envelope
     
    10531048  if (freeLC)
    10541049    delete(LCList);
    1055   Log() << Verbose(0) << "End of FindNonConvexBorder\n";
    10561050};
    10571051
     
    10651059Vector* FindEmbeddingHole(MoleculeListClass *mols, molecule *srcmol)
    10661060{
     1061        Info FunctionInfo(__func__);
    10671062  Vector *Center = new Vector;
    10681063  Center->Zero();
  • src/builder.cpp

    r8725ed rf67b6e  
    15771577                  molecules->ListOfMolecules.remove(mol);
    15781578                  molecules->DissectMoleculeIntoConnectedSubgraphs(mol,&configuration);
     1579                  delete(mol);
    15791580                  if (molecules->ListOfMolecules.size() != 0) {
    15801581                    for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     
    18071808                Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
    18081809                delete(LCList);
     1810                delete(T);
    18091811                argptr+=2;
    18101812              }
  • src/tesselation.cpp

    r8725ed rf67b6e  
    99
    1010#include "helpers.hpp"
     11#include "info.hpp"
    1112#include "linkedcell.hpp"
    1213#include "log.hpp"
     
    2728    Nr(-1)
    2829{
     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 at " << *(node->node) << 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())
    5056    eLog() << Verbose(2) << "Memory Leak! I " << *this << " am still connected to some lines." << endl;
     
    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)
     
    8895    Nr(-1)
    8996{
     97        Info FunctionInfo(__func__);
    9098  for (int i = 0; i < 2; i++)
    9199    endpoints[i] = NULL;
     
    99107BoundaryLineSet::BoundaryLineSet(class BoundaryPointSet *Point[2], const int number)
    100108{
     109        Info FunctionInfo(__func__);
    101110  // set number
    102111  Nr = number;
     
    109118  skipped = false;
    110119  // clear triangles list
    111   Log() << Verbose(5) << "New Line with endpoints " << *this << "." << endl;
     120  Log() << Verbose(0) << "New Line with endpoints " << *this << "." << endl;
    112121};
    113122
     
    118127BoundaryLineSet::~BoundaryLineSet()
    119128{
     129        Info FunctionInfo(__func__);
    120130  int Numbers[2];
    121131
     
    136146        for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++)
    137147          if ((*Runner).second == this) {
    138             //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;
    139149            endpoints[i]->lines.erase(Runner);
    140150            break;
     
    142152      } else { // there's just a single line left
    143153        if (endpoints[i]->lines.erase(Nr)) {
    144           //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;
    145155        }
    146156      }
    147157      if (endpoints[i]->lines.empty()) {
    148         //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;
    149159        if (endpoints[i] != NULL) {
    150160          delete(endpoints[i]);
     
    163173void BoundaryLineSet::AddTriangle(class BoundaryTriangleSet *triangle)
    164174{
    165   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;
    166177  triangles.insert(TrianglePair(triangle->Nr, triangle));
    167178};
     
    173184bool BoundaryLineSet::IsConnectedTo(class BoundaryLineSet *line)
    174185{
     186        Info FunctionInfo(__func__);
    175187  if ((endpoints[0] == line->endpoints[0]) || (endpoints[1] == line->endpoints[0]) || (endpoints[0] == line->endpoints[1]) || (endpoints[1] == line->endpoints[1]))
    176188    return true;
     
    187199bool BoundaryLineSet::CheckConvexityCriterion()
    188200{
     201        Info FunctionInfo(__func__);
    189202  Vector BaseLineCenter, BaseLineNormal, BaseLine, helper[2], NormalCheck;
    190203  // get the two triangles
    191204  if (triangles.size() != 2) {
    192     eLog() << Verbose(1) << "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;
    193206    return true;
    194207  }
    195208  // check normal vectors
    196209  // have a normal vector on the base line pointing outwards
    197   //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;
    198211  BaseLineCenter.CopyVector(endpoints[0]->node->node);
    199212  BaseLineCenter.AddVector(endpoints[1]->node->node);
     
    201214  BaseLine.CopyVector(endpoints[0]->node->node);
    202215  BaseLine.SubtractVector(endpoints[1]->node->node);
    203   //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;
    204217
    205218  BaseLineNormal.Zero();
     
    209222  class BoundaryPointSet *node = NULL;
    210223  for(TriangleMap::iterator runner = triangles.begin(); runner != triangles.end(); runner++) {
    211     //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;
    212225    NormalCheck.AddVector(&runner->second->NormalVector);
    213226    NormalCheck.Scale(sign);
     
    216229      BaseLineNormal.CopyVector(&runner->second->NormalVector);   // yes, copy second on top of first
    217230    else {
    218       Log() << Verbose(1) << "CRITICAL: Triangle " << *runner->second << " has zero normal vector!" << endl;
    219       exit(255);
     231      eLog() << Verbose(0) << "Triangle " << *runner->second << " has zero normal vector!" << endl;
    220232    }
    221233    node = runner->second->GetThirdEndpoint(this);
    222234    if (node != NULL) {
    223       //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;
    224236      helper[i].CopyVector(node->node->node);
    225237      helper[i].SubtractVector(&BaseLineCenter);
    226238      helper[i].MakeNormalVector(&BaseLine);  // we want to compare the triangle's heights' angles!
    227       //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;
    228240      i++;
    229241    } else {
    230       //eLog() << Verbose(1) << "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;
    231243      return true;
    232244    }
    233245  }
    234   //Log() << Verbose(3) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl;
     246  //Log() << Verbose(0) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl;
    235247  if (NormalCheck.NormSquared() < MYEPSILON) {
    236     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;
    237249    return true;
    238250  }
     
    240252  double angle = GetAngle(helper[0], helper[1], BaseLineNormal);
    241253  if ((angle - M_PI) > -MYEPSILON) {
    242     Log() << Verbose(3) << "ACCEPT: Angle is greater than pi: convex." << endl;
     254    Log() << Verbose(0) << "ACCEPT: Angle is greater than pi: convex." << endl;
    243255    return true;
    244256  } else {
    245     Log() << Verbose(3) << "REJECT: Angle is less than pi: concave." << endl;
     257    Log() << Verbose(0) << "REJECT: Angle is less than pi: concave." << endl;
    246258    return false;
    247259  }
     
    254266bool BoundaryLineSet::ContainsBoundaryPoint(class BoundaryPointSet *point)
    255267{
     268        Info FunctionInfo(__func__);
    256269  for(int i=0;i<2;i++)
    257270    if (point == endpoints[i])
     
    266279class BoundaryPointSet *BoundaryLineSet::GetOtherEndpoint(class BoundaryPointSet *point)
    267280{
     281        Info FunctionInfo(__func__);
    268282  if (endpoints[0] == point)
    269283    return endpoints[1];
     
    291305  Nr(-1)
    292306{
     307        Info FunctionInfo(__func__);
    293308  for (int i = 0; i < 3; i++)
    294309    {
     
    305320  Nr(number)
    306321{
     322        Info FunctionInfo(__func__);
    307323  // set number
    308324  // set lines
    309   Log() << Verbose(5) << "New triangle " << Nr << ":";
    310   for (int i = 0; i < 3; i++)
    311     {
    312       lines[i] = line[i];
    313       lines[i]->AddTriangle(this);
    314     }
     325  for (int i = 0; i < 3; i++) {
     326    lines[i] = line[i];
     327    lines[i]->AddTriangle(this);
     328  }
    315329  // get ascending order of endpoints
    316   map<int, class BoundaryPointSet *> OrderMap;
     330  PointMap OrderMap;
    317331  for (int i = 0; i < 3; i++)
    318332    // for all three lines
    319     for (int j = 0; j < 2; j++)
    320       { // for both endpoints
    321         OrderMap.insert(pair<int, class BoundaryPointSet *> (
    322             line[i]->endpoints[j]->Nr, line[i]->endpoints[j]));
    323         // and we don't care whether insertion fails
    324       }
     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    }
    325338  // set endpoints
    326339  int Counter = 0;
    327   Log() << Verbose(6) << " with end points ";
    328   for (map<int, class BoundaryPointSet *>::iterator runner = OrderMap.begin(); runner
    329       != OrderMap.end(); runner++)
    330     {
    331       endpoints[Counter] = runner->second;
    332       Log() << Verbose(0) << " " << *endpoints[Counter];
    333       Counter++;
    334     }
    335   if (Counter < 3)
    336     {
    337       eLog() << Verbose(0) << "ERROR! We have a triangle with only two distinct endpoints!" << endl;
    338       performCriticalExit();
    339     }
    340   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  }
    341350};
    342351
     
    347356BoundaryTriangleSet::~BoundaryTriangleSet()
    348357{
     358        Info FunctionInfo(__func__);
    349359  for (int i = 0; i < 3; i++) {
    350360    if (lines[i] != NULL) {
    351361      if (lines[i]->triangles.erase(Nr)) {
    352         //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;
    353363      }
    354364      if (lines[i]->triangles.empty()) {
    355           //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;
    356366          delete (lines[i]);
    357367          lines[i] = NULL;
     
    359369    }
    360370  }
    361   //Log() << Verbose(5) << "Erasing triangle Nr." << Nr << " itself." << endl;
     371  //Log() << Verbose(0) << "Erasing triangle Nr." << Nr << " itself." << endl;
    362372};
    363373
     
    368378void BoundaryTriangleSet::GetNormalVector(Vector &OtherVector)
    369379{
     380        Info FunctionInfo(__func__);
    370381  // get normal vector
    371382  NormalVector.MakeNormalVector(endpoints[0]->node->node, endpoints[1]->node->node, endpoints[2]->node->node);
     
    374385  if (NormalVector.ScalarProduct(&OtherVector) > 0.)
    375386    NormalVector.Scale(-1.);
     387  Log() << Verbose(1) << "Normal Vector is " << NormalVector << "." << endl;
    376388};
    377389
     
    390402bool BoundaryTriangleSet::GetIntersectionInsideTriangle(Vector *MolCenter, Vector *x, Vector *Intersection)
    391403{
     404        Info FunctionInfo(__func__);
    392405  Vector CrossPoint;
    393406  Vector helper;
    394407
    395408  if (!Intersection->GetIntersectionWithPlane(&NormalVector, endpoints[0]->node->node, MolCenter, x)) {
    396     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;
    397410    return false;
    398411  }
     
    410423  } while (CrossPoint.NormSquared() < MYEPSILON);
    411424  if (i==3) {
    412     eLog() << Verbose(1) << "Could not find any cross points, something's utterly wrong here!" << endl;
    413     exit(255);
     425    eLog() << Verbose(0) << "Could not find any cross points, something's utterly wrong here!" << endl;
    414426  }
    415427  CrossPoint.SubtractVector(endpoints[i%3]->node->node);  // cross point was returned as absolute vector
     
    430442bool BoundaryTriangleSet::ContainsBoundaryLine(class BoundaryLineSet *line)
    431443{
     444        Info FunctionInfo(__func__);
    432445  for(int i=0;i<3;i++)
    433446    if (line == lines[i])
     
    442455bool BoundaryTriangleSet::ContainsBoundaryPoint(class BoundaryPointSet *point)
    443456{
     457        Info FunctionInfo(__func__);
    444458  for(int i=0;i<3;i++)
    445459    if (point == endpoints[i])
     
    454468bool BoundaryTriangleSet::ContainsBoundaryPoint(class TesselPoint *point)
    455469{
     470        Info FunctionInfo(__func__);
    456471  for(int i=0;i<3;i++)
    457472    if (point == endpoints[i]->node)
     
    466481bool BoundaryTriangleSet::IsPresentTupel(class BoundaryPointSet *Points[3])
    467482{
     483        Info FunctionInfo(__func__);
    468484  return (((endpoints[0] == Points[0])
    469485            || (endpoints[0] == Points[1])
     
    487503bool BoundaryTriangleSet::IsPresentTupel(class BoundaryTriangleSet *T)
    488504{
     505        Info FunctionInfo(__func__);
    489506  return (((endpoints[0] == T->endpoints[0])
    490507            || (endpoints[0] == T->endpoints[1])
     
    508525class BoundaryPointSet *BoundaryTriangleSet::GetThirdEndpoint(class BoundaryLineSet *line)
    509526{
     527        Info FunctionInfo(__func__);
    510528  // sanity check
    511529  if (!ContainsBoundaryLine(line))
     
    524542void BoundaryTriangleSet::GetCenter(Vector *center)
    525543{
     544        Info FunctionInfo(__func__);
    526545  center->Zero();
    527546  for(int i=0;i<3;i++)
     
    536555ostream &operator <<(ostream &ost, const BoundaryTriangleSet &a)
    537556{
    538   ost << "[" << a.Nr << "|" << a.endpoints[0]->node->Name << " at " << *a.endpoints[0]->node->node << ","
    539       << 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 << "]";
    540560  return ost;
    541561};
     
    547567TesselPoint::TesselPoint()
    548568{
     569  Info FunctionInfo(__func__);
    549570  node = NULL;
    550571  nr = -1;
     
    556577TesselPoint::~TesselPoint()
    557578{
     579  Info FunctionInfo(__func__);
    558580};
    559581
     
    570592ostream & TesselPoint::operator << (ostream &ost)
    571593{
     594        Info FunctionInfo(__func__);
    572595  ost << "[" << (Name) << "|" << this << "]";
    573596  return ost;
     
    581604PointCloud::PointCloud()
    582605{
     606        Info FunctionInfo(__func__);
    583607};
    584608
     
    587611PointCloud::~PointCloud()
    588612{
     613        Info FunctionInfo(__func__);
    589614};
    590615
     
    594619 */
    595620CandidateForTesselation::CandidateForTesselation (BoundaryLineSet* line) :
    596   point(NULL),
    597621  BaseLine(line),
    598622  ShortestAngle(2.*M_PI),
    599623  OtherShortestAngle(2.*M_PI)
    600624{
     625        Info FunctionInfo(__func__);
    601626};
    602627
     
    605630 */
    606631CandidateForTesselation::CandidateForTesselation (TesselPoint *candidate, BoundaryLineSet* line, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) :
    607     point(candidate),
    608632    BaseLine(line),
    609633    ShortestAngle(2.*M_PI),
    610634    OtherShortestAngle(2.*M_PI)
    611635{
     636        Info FunctionInfo(__func__);
    612637  OptCenter.CopyVector(&OptCandidateCenter);
    613638  OtherOptCenter.CopyVector(&OtherOptCandidateCenter);
     
    617642 */
    618643CandidateForTesselation::~CandidateForTesselation() {
    619   point = NULL;
    620644  BaseLine = NULL;
    621645};
     
    628652{
    629653  ost << "[" << a.BaseLine->Nr << "|" << a.BaseLine->endpoints[0]->node->Name << "," << a.BaseLine->endpoints[1]->node->Name << "] with ";
    630   if (a.point == NULL)
     654  if (a.pointlist.empty())
    631655    ost << "no candidate.";
    632   else
    633     ost << "candidate " << *(a.point) << " at angle " << (a.ShortestAngle)<< ".";
     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  }
    634666
    635667  return ost;
     
    649681  InternalPointer(PointsOnBoundary.begin())
    650682{
     683        Info FunctionInfo(__func__);
    651684}
    652685;
     
    657690Tesselation::~Tesselation()
    658691{
    659   Log() << Verbose(1) << "Free'ing TesselStruct ... " << endl;
     692        Info FunctionInfo(__func__);
     693  Log() << Verbose(0) << "Free'ing TesselStruct ... " << endl;
    660694  for (TriangleMap::iterator runner = TrianglesOnBoundary.begin(); runner != TrianglesOnBoundary.end(); runner++) {
    661695    if (runner->second != NULL) {
     
    665699      eLog() << Verbose(1) << "The triangle " << runner->first << " has already been free'd." << endl;
    666700  }
    667   Log() << Verbose(1) << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl;
     701  Log() << Verbose(0) << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl;
    668702}
    669703;
     
    674708Vector * Tesselation::GetCenter(ofstream *out) const
    675709{
     710        Info FunctionInfo(__func__);
    676711  Vector *Center = new Vector(0.,0.,0.);
    677712  int num=0;
     
    689724TesselPoint * Tesselation::GetPoint() const
    690725{
     726        Info FunctionInfo(__func__);
    691727  return (InternalPointer->second->node);
    692728};
     
    697733TesselPoint * Tesselation::GetTerminalPoint() const
    698734{
     735        Info FunctionInfo(__func__);
    699736  PointMap::const_iterator Runner = PointsOnBoundary.end();
    700737  Runner--;
     
    707744void Tesselation::GoToNext() const
    708745{
     746        Info FunctionInfo(__func__);
    709747  if (InternalPointer != PointsOnBoundary.end())
    710748    InternalPointer++;
     
    716754void Tesselation::GoToPrevious() const
    717755{
     756        Info FunctionInfo(__func__);
    718757  if (InternalPointer != PointsOnBoundary.begin())
    719758    InternalPointer--;
     
    725764void Tesselation::GoToFirst() const
    726765{
     766        Info FunctionInfo(__func__);
    727767  InternalPointer = PointsOnBoundary.begin();
    728768};
     
    733773void Tesselation::GoToLast() const
    734774{
     775        Info FunctionInfo(__func__);
    735776  InternalPointer = PointsOnBoundary.end();
    736777  InternalPointer--;
     
    742783bool Tesselation::IsEmpty() const
    743784{
     785        Info FunctionInfo(__func__);
    744786  return (PointsOnBoundary.empty());
    745787};
     
    750792bool Tesselation::IsEnd() const
    751793{
     794        Info FunctionInfo(__func__);
    752795  return (InternalPointer == PointsOnBoundary.end());
    753796};
     
    762805Tesselation::GuessStartingTriangle()
    763806{
     807        Info FunctionInfo(__func__);
    764808  // 4b. create a starting triangle
    765809  // 4b1. create all distances
     
    808852          baseline->second.first->second->node->node,
    809853          baseline->second.second->second->node->node);
    810       Log() << Verbose(2) << "Plane vector of candidate triangle is ";
    811       PlaneVector.Output();
    812       Log() << Verbose(0) << endl;
     854      Log() << Verbose(2) << "Plane vector of candidate triangle is " << PlaneVector << endl;
    813855      // 4. loop over all points
    814856      double sign = 0.;
     
    826868          if (fabs(distance) < 1e-4) // we need to have a small epsilon around 0 which is still ok
    827869            continue;
    828           Log() << Verbose(3) << "Projection of " << checker->second->node->Name
    829               << " yields distance of " << distance << "." << endl;
     870          Log() << Verbose(2) << "Projection of " << checker->second->node->Name << " yields distance of " << distance << "." << endl;
    830871          tmp = distance / fabs(distance);
    831872          // 4b. Any have different sign to than before? (i.e. would lie outside convex hull with this starting triangle)
     
    880921      if (checker == PointsOnBoundary.end())
    881922        {
    882           Log() << Verbose(0) << "Looks like we have a candidate!" << endl;
     923          Log() << Verbose(2) << "Looks like we have a candidate!" << endl;
    883924          break;
    884925        }
     
    910951  else
    911952    {
    912       Log() << Verbose(1) << "No starting triangle found." << endl;
    913       exit(255);
     953      eLog() << Verbose(0) << "No starting triangle found." << endl;
    914954    }
    915955}
     
    931971void Tesselation::TesselateOnBoundary(const PointCloud * const cloud)
    932972{
     973        Info FunctionInfo(__func__);
    933974  bool flag;
    934975  PointMap::iterator winner;
     
    949990        // get peak point with respect to this base line's only triangle
    950991        BTS = baseline->second->triangles.begin()->second; // there is only one triangle so far
    951         Log() << Verbose(2) << "Current baseline is between " << *(baseline->second) << "." << endl;
     992        Log() << Verbose(0) << "Current baseline is between " << *(baseline->second) << "." << endl;
    952993        for (int i = 0; i < 3; i++)
    953994          if ((BTS->endpoints[i] != baseline->second->endpoints[0]) && (BTS->endpoints[i] != baseline->second->endpoints[1]))
    954995            peak = BTS->endpoints[i];
    955         Log() << Verbose(3) << " and has peak " << *peak << "." << endl;
     996        Log() << Verbose(1) << " and has peak " << *peak << "." << endl;
    956997
    957998        // prepare some auxiliary vectors
     
    9681009          CenterVector.AddVector(BTS->endpoints[i]->node->node);
    9691010        CenterVector.Scale(1. / 3.);
    970         Log() << Verbose(4) << "CenterVector of base triangle is " << CenterVector << endl;
     1011        Log() << Verbose(2) << "CenterVector of base triangle is " << CenterVector << endl;
    9711012
    9721013        // normal vector of triangle
     
    9751016        BTS->GetNormalVector(NormalVector);
    9761017        NormalVector.CopyVector(&BTS->NormalVector);
    977         Log() << Verbose(4) << "NormalVector of base triangle is " << NormalVector << endl;
     1018        Log() << Verbose(2) << "NormalVector of base triangle is " << NormalVector << endl;
    9781019
    9791020        // vector in propagation direction (out of triangle)
     
    9821023        TempVector.CopyVector(&CenterVector);
    9831024        TempVector.SubtractVector(baseline->second->endpoints[0]->node->node); // TempVector is vector on triangle plane pointing from one baseline egde towards center!
    984         //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;
    9851026        if (PropagationVector.ScalarProduct(&TempVector) > 0) // make sure normal propagation vector points outward from baseline
    9861027          PropagationVector.Scale(-1.);
    987         Log() << Verbose(4) << "PropagationVector of base triangle is " << PropagationVector << endl;
     1028        Log() << Verbose(2) << "PropagationVector of base triangle is " << PropagationVector << endl;
    9881029        winner = PointsOnBoundary.end();
    9891030
     
    9911032        for (PointMap::iterator target = PointsOnBoundary.begin(); target != PointsOnBoundary.end(); target++) {
    9921033          if ((target->second != baseline->second->endpoints[0]) && (target->second != baseline->second->endpoints[1])) { // don't take the same endpoints
    993             Log() << Verbose(3) << "Target point is " << *(target->second) << ":" << endl;
     1034            Log() << Verbose(1) << "Target point is " << *(target->second) << ":" << endl;
    9941035
    9951036            // first check direction, so that triangles don't intersect
     
    9981039            VirtualNormalVector.ProjectOntoPlane(&NormalVector);
    9991040            TempAngle = VirtualNormalVector.Angle(&PropagationVector);
    1000             Log() << Verbose(4) << "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "." << endl;
     1041            Log() << Verbose(2) << "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "." << endl;
    10011042            if (TempAngle > (M_PI/2.)) { // no bends bigger than Pi/2 (90 degrees)
    1002               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;
    10031044              continue;
    10041045            } else
    1005               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;
    10061047
    10071048            // check first and second endpoint (if any connecting line goes to target has at least not more than 1 triangle)
     
    10091050            LineChecker[1] = baseline->second->endpoints[1]->lines.find(target->first);
    10101051            if (((LineChecker[0] != baseline->second->endpoints[0]->lines.end()) && (LineChecker[0]->second->triangles.size() == 2))) {
    1011               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;
    10121053              continue;
    10131054            }
    10141055            if (((LineChecker[1] != baseline->second->endpoints[1]->lines.end()) && (LineChecker[1]->second->triangles.size() == 2))) {
    1015               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;
    10161057              continue;
    10171058            }
     
    10301071            helper.ProjectOntoPlane(&TempVector);
    10311072            if (fabs(helper.NormSquared()) < MYEPSILON) {
    1032               Log() << Verbose(4) << "Chosen set of vectors is linear dependent." << endl;
     1073              Log() << Verbose(2) << "Chosen set of vectors is linear dependent." << endl;
    10331074              continue;
    10341075            }
     
    10471088            // calculate angle
    10481089            TempAngle = NormalVector.Angle(&VirtualNormalVector);
    1049             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;
    10501091            if ((SmallestAngle - TempAngle) > MYEPSILON) { // set to new possible winner
    10511092              SmallestAngle = TempAngle;
    10521093              winner = target;
    1053               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;
    10541095            } else if (fabs(SmallestAngle - TempAngle) < MYEPSILON) { // check the angle to propagation, both possible targets are in one plane! (their normals have same angle)
    10551096              // hence, check the angles to some normal direction from our base line but in this common plane of both targets...
     
    10691110                SmallestAngle = TempAngle;
    10701111                winner = target;
    1071                 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;
    10721113              } else
    1073                 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;
    10741115            } else
    1075               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;
    10761117          }
    10771118        } // end of loop over all boundary points
     
    10791120        // 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
    10801121        if (winner != PointsOnBoundary.end()) {
    1081           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;
    10821123          // create the lins of not yet present
    10831124          BLS[0] = baseline->second;
     
    11091150          TrianglesOnBoundaryCount++;
    11101151        } else {
    1111           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;
    11121153        }
    11131154
    11141155        // 5d. If the set of lines is not yet empty, go to 5. and continue
    11151156      } else
    1116         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;
    11171158  } while (flag);
    11181159
     
    11291170bool Tesselation::InsertStraddlingPoints(const PointCloud *cloud, const LinkedCell *LC)
    11301171{
     1172        Info FunctionInfo(__func__);
    11311173  Vector Intersection, Normal;
    11321174  TesselPoint *Walker = NULL;
     
    11351177  bool AddFlag = false;
    11361178  LinkedCell *BoundaryPoints = NULL;
    1137 
    1138   Log() << Verbose(1) << "Begin of InsertStraddlingPoints" << endl;
    11391179
    11401180  cloud->GoToFirst();
     
    11471187    }
    11481188    Walker = cloud->GetPoint();
    1149     Log() << Verbose(2) << "Current point is " << *Walker << "." << endl;
     1189    Log() << Verbose(0) << "Current point is " << *Walker << "." << endl;
    11501190    // get the next triangle
    11511191    triangles = FindClosestTrianglesToPoint(Walker->node, BoundaryPoints);
    11521192    BTS = triangles->front();
    11531193    if ((triangles == NULL) || (BTS->ContainsBoundaryPoint(Walker))) {
    1154       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;
    11551195      cloud->GoToNext();
    11561196      continue;
    11571197    } else {
    11581198    }
    1159     Log() << Verbose(2) << "Closest triangle is " << *BTS << "." << endl;
     1199    Log() << Verbose(0) << "Closest triangle is " << *BTS << "." << endl;
    11601200    // get the intersection point
    11611201    if (BTS->GetIntersectionInsideTriangle(Center, Walker->node, &Intersection)) {
    1162       Log() << Verbose(2) << "We have an intersection at " << Intersection << "." << endl;
     1202      Log() << Verbose(0) << "We have an intersection at " << Intersection << "." << endl;
    11631203      // we have the intersection, check whether in- or outside of boundary
    11641204      if ((Center->DistanceSquared(Walker->node) - Center->DistanceSquared(&Intersection)) < -MYEPSILON) {
    11651205        // inside, next!
    1166         Log() << Verbose(2) << *Walker << " is inside wrt triangle " << *BTS << "." << endl;
     1206        Log() << Verbose(0) << *Walker << " is inside wrt triangle " << *BTS << "." << endl;
    11671207      } else {
    11681208        // outside!
    1169         Log() << Verbose(2) << *Walker << " is outside wrt triangle " << *BTS << "." << endl;
     1209        Log() << Verbose(0) << *Walker << " is outside wrt triangle " << *BTS << "." << endl;
    11701210        class BoundaryLineSet *OldLines[3], *NewLines[3];
    11711211        class BoundaryPointSet *OldPoints[3], *NewPoint;
     
    11771217        Normal.CopyVector(&BTS->NormalVector);
    11781218        // add Walker to boundary points
    1179         Log() << Verbose(2) << "Adding " << *Walker << " to BoundaryPoints." << endl;
     1219        Log() << Verbose(0) << "Adding " << *Walker << " to BoundaryPoints." << endl;
    11801220        AddFlag = true;
    11811221        if (AddBoundaryPoint(Walker,0))
     
    11841224          continue;
    11851225        // remove triangle
    1186         Log() << Verbose(2) << "Erasing triangle " << *BTS << "." << endl;
     1226        Log() << Verbose(0) << "Erasing triangle " << *BTS << "." << endl;
    11871227        TrianglesOnBoundary.erase(BTS->Nr);
    11881228        delete(BTS);
     
    11921232          BPS[1] = OldPoints[i];
    11931233          NewLines[i] = new class BoundaryLineSet(BPS, LinesOnBoundaryCount);
    1194           Log() << Verbose(3) << "Creating new line " << *NewLines[i] << "." << endl;
     1234          Log() << Verbose(1) << "Creating new line " << *NewLines[i] << "." << endl;
    11951235          LinesOnBoundary.insert(LinePair(LinesOnBoundaryCount, NewLines[i])); // no need for check for unique insertion as BPS[0] is definitely a new one
    11961236          LinesOnBoundaryCount++;
     
    12031243            if (NewLines[j]->IsConnectedTo(BLS[0])) {
    12041244              if (n>2) {
    1205                 Log() << Verbose(1) << BLS[0] << " connects to all of the new lines?!" << endl;
     1245                eLog() << Verbose(2) << BLS[0] << " connects to all of the new lines?!" << endl;
    12061246                return false;
    12071247              } else
     
    12141254          BTS->GetNormalVector(Normal);
    12151255          Normal.Scale(-1.);
    1216           Log() << Verbose(2) << "Created new triangle " << *BTS << "." << endl;
     1256          Log() << Verbose(0) << "Created new triangle " << *BTS << "." << endl;
    12171257          TrianglesOnBoundary.insert(TrianglePair(TrianglesOnBoundaryCount, BTS));
    12181258          TrianglesOnBoundaryCount++;
     
    12281268  // exit
    12291269  delete(Center);
    1230   Log() << Verbose(1) << "End of InsertStraddlingPoints" << endl;
    12311270  return true;
    12321271};
     
    12391278bool Tesselation::AddBoundaryPoint(TesselPoint * Walker, const int n)
    12401279{
     1280        Info FunctionInfo(__func__);
    12411281  PointTestPair InsertUnique;
    12421282  BPS[n] = new class BoundaryPointSet(Walker);
     
    12601300void Tesselation::AddTesselationPoint(TesselPoint* Candidate, const int n)
    12611301{
     1302        Info FunctionInfo(__func__);
    12621303  PointTestPair InsertUnique;
    12631304  TPS[n] = new class BoundaryPointSet(Candidate);
     
    12671308  } else {
    12681309    delete TPS[n];
    1269     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;
    12701311    TPS[n] = (InsertUnique.first)->second;
    12711312  }
     
    12801321void Tesselation::SetTesselationPoint(TesselPoint* Candidate, const int n) const
    12811322{
     1323        Info FunctionInfo(__func__);
    12821324  PointMap::const_iterator FindPoint = PointsOnBoundary.find(Candidate->nr);
    12831325  if (FindPoint != PointsOnBoundary.end())
     
    13011343    pair<LineMap::iterator,LineMap::iterator> FindPair;
    13021344    FindPair = a->lines.equal_range(b->node->nr);
    1303     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;
    13041346
    13051347    for (FindLine = FindPair.first; FindLine != FindPair.second; FindLine++) {
     
    13071349      if (FindLine->second->triangles.size() < 2) {
    13081350        insertNewLine = false;
    1309         Log() << Verbose(4) << "Using existing line " << *FindLine->second << endl;
     1351        Log() << Verbose(0) << "Using existing line " << *FindLine->second << endl;
    13101352
    13111353        BPS[0] = FindLine->second->endpoints[0];
     
    13391381void Tesselation::AlwaysAddTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n)
    13401382{
    1341   Log() << Verbose(4) << "Adding open 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;
    13421385  BPS[0] = a;
    13431386  BPS[1] = b;
     
    13571400void Tesselation::AddTesselationTriangle()
    13581401{
     1402        Info FunctionInfo(__func__);
    13591403  Log() << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl;
    13601404
     
    13751419void Tesselation::AddTesselationTriangle(const int nr)
    13761420{
    1377   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;
    13781423
    13791424  // add triangle to global map
     
    13931438void Tesselation::RemoveTesselationTriangle(class BoundaryTriangleSet *triangle)
    13941439{
     1440        Info FunctionInfo(__func__);
    13951441  if (triangle == NULL)
    13961442    return;
    13971443  for (int i = 0; i < 3; i++) {
    13981444    if (triangle->lines[i] != NULL) {
    1399       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;
    14001446      triangle->lines[i]->triangles.erase(triangle->Nr);
    14011447      if (triangle->lines[i]->triangles.empty()) {
    1402           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;
    14031449          RemoveTesselationLine(triangle->lines[i]);
    14041450      } else {
    1405         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: ";
    14061452        for(TriangleMap::iterator TriangleRunner = triangle->lines[i]->triangles.begin(); TriangleRunner != triangle->lines[i]->triangles.end(); TriangleRunner++)
    14071453          Log() << Verbose(0) << "[" << (TriangleRunner->second)->Nr << "|" << *((TriangleRunner->second)->endpoints[0]) << ", " << *((TriangleRunner->second)->endpoints[1]) << ", " << *((TriangleRunner->second)->endpoints[2]) << "] \t";
    14081454        Log() << Verbose(0) << endl;
    14091455//        for (int j=0;j<2;j++) {
    1410 //          Log() << Verbose(5) << "Lines of endpoint " << *(triangle->lines[i]->endpoints[j]) << ": ";
     1456//          Log() << Verbose(0) << "Lines of endpoint " << *(triangle->lines[i]->endpoints[j]) << ": ";
    14111457//          for(LineMap::iterator LineRunner = triangle->lines[i]->endpoints[j]->lines.begin(); LineRunner != triangle->lines[i]->endpoints[j]->lines.end(); LineRunner++)
    14121458//            Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t";
     
    14201466
    14211467  if (TrianglesOnBoundary.erase(triangle->Nr))
    1422     Log() << Verbose(5) << "Removing triangle Nr. " << triangle->Nr << "." << endl;
     1468    Log() << Verbose(0) << "Removing triangle Nr. " << triangle->Nr << "." << endl;
    14231469  delete(triangle);
    14241470};
     
    14301476void Tesselation::RemoveTesselationLine(class BoundaryLineSet *line)
    14311477{
     1478        Info FunctionInfo(__func__);
    14321479  int Numbers[2];
    14331480
     
    14501497        for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++)
    14511498          if ((*Runner).second == line) {
    1452             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;
    14531500            line->endpoints[i]->lines.erase(Runner);
    14541501            break;
     
    14561503      } else { // there's just a single line left
    14571504        if (line->endpoints[i]->lines.erase(line->Nr))
    1458           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;
    14591506      }
    14601507      if (line->endpoints[i]->lines.empty()) {
    1461         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;
    14621509        RemoveTesselationPoint(line->endpoints[i]);
    14631510      } else {
    1464         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: ";
    14651512        for(LineMap::iterator LineRunner = line->endpoints[i]->lines.begin(); LineRunner != line->endpoints[i]->lines.end(); LineRunner++)
    14661513          Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t";
     
    14751522
    14761523  if (LinesOnBoundary.erase(line->Nr))
    1477     Log() << Verbose(5) << "Removing line Nr. " << line->Nr << "." << endl;
     1524    Log() << Verbose(0) << "Removing line Nr. " << line->Nr << "." << endl;
    14781525  delete(line);
    14791526};
     
    14861533void Tesselation::RemoveTesselationPoint(class BoundaryPointSet *point)
    14871534{
     1535        Info FunctionInfo(__func__);
    14881536  if (point == NULL)
    14891537    return;
    14901538  if (PointsOnBoundary.erase(point->Nr))
    1491     Log() << Verbose(5) << "Removing point Nr. " << point->Nr << "." << endl;
     1539    Log() << Verbose(0) << "Removing point Nr. " << point->Nr << "." << endl;
    14921540  delete(point);
    14931541};
     
    15041552int Tesselation::CheckPresenceOfTriangle(TesselPoint *Candidates[3]) const
    15051553{
     1554        Info FunctionInfo(__func__);
    15061555  int adjacentTriangleCount = 0;
    15071556  class BoundaryPointSet *Points[3];
    15081557
    1509   Log() << Verbose(2) << "Begin of CheckPresenceOfTriangle" << endl;
    15101558  // builds a triangle point set (Points) of the end points
    15111559  for (int i = 0; i < 3; i++) {
     
    15261574          for (; (FindLine != Points[i]->lines.end()) && (FindLine->first == Points[j]->node->nr); FindLine++) {
    15271575            TriangleMap *triangles = &FindLine->second->triangles;
    1528             Log() << Verbose(3) << "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "." << endl;
     1576            Log() << Verbose(1) << "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "." << endl;
    15291577            for (TriangleMap::const_iterator FindTriangle = triangles->begin(); FindTriangle != triangles->end(); FindTriangle++) {
    15301578              if (FindTriangle->second->IsPresentTupel(Points)) {
     
    15321580              }
    15331581            }
    1534             Log() << Verbose(3) << "end." << endl;
     1582            Log() << Verbose(1) << "end." << endl;
    15351583          }
    15361584          // Only one of the triangle lines must be considered for the triangle count.
    1537           //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;
    15381586          //return adjacentTriangleCount;
    15391587        }
     
    15421590  }
    15431591
    1544   Log() << Verbose(2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;
    1545   Log() << Verbose(2) << "End of CheckPresenceOfTriangle" << endl;
     1592  Log() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;
    15461593  return adjacentTriangleCount;
    15471594};
     
    15571604class BoundaryTriangleSet * Tesselation::GetPresentTriangle(TesselPoint *Candidates[3])
    15581605{
     1606        Info FunctionInfo(__func__);
    15591607  class BoundaryTriangleSet *triangle = NULL;
    15601608  class BoundaryPointSet *Points[3];
     
    15861634          }
    15871635          // Only one of the triangle lines must be considered for the triangle count.
    1588           //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;
    15891637          //return adjacentTriangleCount;
    15901638        }
     
    16071655void Tesselation::FindStartingTriangle(const double RADIUS, const LinkedCell *LC)
    16081656{
    1609   Log() << Verbose(1) << "Begin of FindStartingTriangle\n";
     1657        Info FunctionInfo(__func__);
    16101658  int i = 0;
    16111659  TesselPoint* FirstPoint = NULL;
     
    16311679      for (LC->n[(i+2)%NDIM]=0;LC->n[(i+2)%NDIM]<LC->N[(i+2)%NDIM];LC->n[(i+2)%NDIM]++) {
    16321680        const LinkedNodes *List = LC->GetCurrentCell();
    1633         //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;
    16341682        if (List != NULL) {
    16351683          for (LinkedNodes::const_iterator Runner = List->begin();Runner != List->end();Runner++) {
    16361684            if ((*Runner)->node->x[i] > maxCoordinate[i]) {
    1637               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;
    16381686              maxCoordinate[i] = (*Runner)->node->x[i];
    16391687              MaxPoint[i] = (*Runner);
     
    16461694  }
    16471695
    1648   Log() << Verbose(2) << "Found maximum coordinates: ";
     1696  Log() << Verbose(1) << "Found maximum coordinates: ";
    16491697  for (int i=0;i<NDIM;i++)
    16501698    Log() << Verbose(0) << i << ": " << *MaxPoint[i] << "\t";
     
    16521700
    16531701  BTS = NULL;
    1654   CandidateList *OptCandidates = new CandidateList();
    16551702  for (int k=0;k<NDIM;k++) {
    16561703    Oben.Zero();
    16571704    Oben.x[k] = 1.;
    16581705    FirstPoint = MaxPoint[k];
    1659     Log() << Verbose(1) << "Coordinates of start node at " << *FirstPoint->node << "." << endl;
     1706    Log() << Verbose(0) << "Coordinates of start node at " << *FirstPoint->node << "." << endl;
    16601707
    16611708    double ShortestAngle;
     
    16881735
    16891736    // adding point 1 and point 2 and add the line between them
    1690     Log() << Verbose(1) << "Coordinates of start node at " << *FirstPoint->node << "." << endl;
     1737    Log() << Verbose(0) << "Coordinates of start node at " << *FirstPoint->node << "." << endl;
    16911738    AddTesselationPoint(FirstPoint, 0);
    1692     Log() << Verbose(1) << "Found second point is at " << *SecondPoint->node << ".\n";
     1739    Log() << Verbose(0) << "Found second point is at " << *SecondPoint->node << ".\n";
    16931740    AddTesselationPoint(SecondPoint, 1);
    16941741    AddTesselationLine(TPS[0], TPS[1], 0);
    16951742
    1696     //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << helper << ".\n";
    1697     FindThirdPointForTesselation(Oben, SearchDirection, helper, BLS[0], NULL, *&OptCandidates, &ShortestAngle, RADIUS, LC);
    1698     Log() << Verbose(1) << "List of third Points is ";
    1699     for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    1700         Log() << Verbose(0) << " " << *(*it)->point;
    1701     }
    1702     Log() << Verbose(0) << endl;
    1703 
    1704     for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
     1743    //Log() << Verbose(1) << "INFO: OldSphereCenter is at " << helper << ".\n";
     1744    CandidateForTesselation OptCandidates(BLS[0]);
     1745    FindThirdPointForTesselation(Oben, SearchDirection, helper, OptCandidates, NULL, RADIUS, LC);
     1746    Log() << Verbose(0) << "List of third Points is:" << endl;
     1747    for (TesselPointList::iterator it = OptCandidates.pointlist.begin(); it != OptCandidates.pointlist.end(); it++) {
     1748        Log() << Verbose(0) << " " << *(*it) << endl;
     1749    }
     1750
     1751    for (TesselPointList::iterator it = OptCandidates.pointlist.begin(); it != OptCandidates.pointlist.end(); it++) {
    17051752      // add third triangle point
    1706       AddTesselationPoint((*it)->point, 2);
     1753      AddTesselationPoint((*it), 2);
    17071754      // add the second and third line
    17081755      AddTesselationLine(TPS[1], TPS[2], 1);
     
    17121759      AddTesselationTriangle();
    17131760      // ... and calculate its normal vector (with correct orientation)
    1714       (*it)->OptCenter.Scale(-1.);
    1715       Log() << Verbose(2) << "Anti-Oben is currently " << (*it)->OptCenter << "." << endl;
    1716       BTS->GetNormalVector((*it)->OptCenter);  // vector to compare with should point inwards
     1761      OptCandidates.OptCenter.Scale(-1.);
     1762      Log() << Verbose(1) << "Anti-Oben is currently " << OptCandidates.OptCenter << "." << endl;
     1763      BTS->GetNormalVector(OptCandidates.OptCenter);  // vector to compare with should point inwards
     1764      OptCandidates.OptCenter.Scale(-1.);
    17171765      Log() << Verbose(0) << "==> Found starting triangle consists of " << *FirstPoint << ", " << *SecondPoint << " and "
    1718       << *(*it)->point << " with normal vector " << BTS->NormalVector << ".\n";
     1766      << (*it) << " with normal vector " << BTS->NormalVector << ".\n";
    17191767
    17201768//      // if we do not reach the end with the next step of iteration, we need to setup a new first line
     
    17271775//        AddTesselationLine(TPS[0], TPS[1], 0);
    17281776//      }
    1729       Log() << Verbose(2) << "Projection is " << BTS->NormalVector.ScalarProduct(&Oben) << "." << endl;
     1777      Log() << Verbose(1) << "Projection is " << BTS->NormalVector.ScalarProduct(&Oben) << "." << endl;
    17301778    }
    17311779    if (BTS != NULL) // we have created one starting triangle
     
    17331781    else {
    17341782      // remove all candidates from the list and then the list itself
    1735       class CandidateForTesselation *remover = NULL;
    1736       for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    1737         remover = *it;
    1738         delete(remover);
    1739       }
    1740       OptCandidates->clear();
    1741     }
    1742   }
    1743 
    1744   // remove all candidates from the list and then the list itself
    1745   class CandidateForTesselation *remover = NULL;
    1746   for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    1747     remover = *it;
    1748     delete(remover);
    1749   }
    1750   delete(OptCandidates);
    1751   Log() << Verbose(1) << "End of FindStartingTriangle\n";
     1783    }
     1784  }
    17521785};
    17531786
    17541787/** Checks for a given baseline and a third point candidate whether baselines of the found triangle don't have even better candidates.
    17551788 * This is supposed to prevent early closing of the tesselation.
    1756  * \param *BaseRay baseline, i.e. not \a *OptCandidate
     1789 * \param CandidateLine CandidateForTesselation with baseline and shortestangle , i.e. not \a *OptCandidate
    17571790 * \param *ThirdNode third point in triangle, not in BoundaryLineSet::endpoints
    1758  * \param ShortestAngle path length on this circle band for the current \a *ThirdNode
    17591791 * \param RADIUS radius of sphere
    17601792 * \param *LC LinkedCell structure
    17611793 * \return true - there is a better candidate (smaller angle than \a ShortestAngle), false - no better TesselPoint candidate found
    17621794 */
    1763 bool Tesselation::HasOtherBaselineBetterCandidate(const BoundaryLineSet * const BaseRay, const TesselPoint * const ThirdNode, double ShortestAngle, double RADIUS, const LinkedCell * const LC) const
    1764 {
    1765   bool result = false;
    1766   Vector CircleCenter;
    1767   Vector CirclePlaneNormal;
    1768   Vector OldSphereCenter;
    1769   Vector SearchDirection;
    1770   Vector helper;
    1771   TesselPoint *OtherOptCandidate = NULL;
    1772   double OtherShortestAngle = 2.*M_PI; // This will indicate the quadrant.
    1773   double radius, CircleRadius;
    1774   BoundaryLineSet *Line = NULL;
    1775   BoundaryTriangleSet *T = NULL;
    1776 
    1777   Log() << Verbose(1) << "Begin of HasOtherBaselineBetterCandidate" << endl;
    1778 
    1779   // check both other lines
    1780   PointMap::const_iterator FindPoint = PointsOnBoundary.find(ThirdNode->nr);
    1781   if (FindPoint != PointsOnBoundary.end()) {
    1782     for (int i=0;i<2;i++) {
    1783       LineMap::const_iterator FindLine = (FindPoint->second)->lines.find(BaseRay->endpoints[0]->node->nr);
    1784       if (FindLine != (FindPoint->second)->lines.end()) {
    1785         Line = FindLine->second;
    1786         Log() << Verbose(1) << "Found line " << *Line << "." << endl;
    1787         if (Line->triangles.size() == 1) {
    1788           T = Line->triangles.begin()->second;
    1789           // construct center of circle
    1790           CircleCenter.CopyVector(Line->endpoints[0]->node->node);
    1791           CircleCenter.AddVector(Line->endpoints[1]->node->node);
    1792           CircleCenter.Scale(0.5);
    1793 
    1794           // construct normal vector of circle
    1795           CirclePlaneNormal.CopyVector(Line->endpoints[0]->node->node);
    1796           CirclePlaneNormal.SubtractVector(Line->endpoints[1]->node->node);
    1797 
    1798           // calculate squared radius of circle
    1799           radius = CirclePlaneNormal.ScalarProduct(&CirclePlaneNormal);
    1800           if (radius/4. < RADIUS*RADIUS) {
    1801             CircleRadius = RADIUS*RADIUS - radius/4.;
    1802             CirclePlaneNormal.Normalize();
    1803             //Log() << Verbose(2) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
    1804 
    1805             // construct old center
    1806             GetCenterofCircumcircle(&OldSphereCenter, *T->endpoints[0]->node->node, *T->endpoints[1]->node->node, *T->endpoints[2]->node->node);
    1807             helper.CopyVector(&T->NormalVector);  // normal vector ensures that this is correct center of the two possible ones
    1808             radius = Line->endpoints[0]->node->node->DistanceSquared(&OldSphereCenter);
    1809             helper.Scale(sqrt(RADIUS*RADIUS - radius));
    1810             OldSphereCenter.AddVector(&helper);
    1811             OldSphereCenter.SubtractVector(&CircleCenter);
    1812             //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;
    1813 
    1814             // construct SearchDirection
    1815             SearchDirection.MakeNormalVector(&T->NormalVector, &CirclePlaneNormal);
    1816             helper.CopyVector(Line->endpoints[0]->node->node);
    1817             helper.SubtractVector(ThirdNode->node);
    1818             if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards!
    1819               SearchDirection.Scale(-1.);
    1820             SearchDirection.ProjectOntoPlane(&OldSphereCenter);
    1821             SearchDirection.Normalize();
    1822             Log() << Verbose(2) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
    1823             if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {
    1824               // rotated the wrong way!
    1825               eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl;
    1826             }
    1827 
    1828             // add third point
    1829             CandidateList *OptCandidates = new CandidateList();
    1830             FindThirdPointForTesselation(T->NormalVector, SearchDirection, OldSphereCenter, Line, ThirdNode, OptCandidates, &OtherShortestAngle, RADIUS, LC);
    1831             for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    1832               if (((*it)->point == BaseRay->endpoints[0]->node) || ((*it)->point == BaseRay->endpoints[1]->node)) // skip if it's the same triangle than suggested
    1833                 continue;
    1834               Log() << Verbose(1) << " Third point candidate is " << *(*it)->point
    1835               << " with circumsphere's center at " << (*it)->OptCenter << "." << endl;
    1836               Log() << Verbose(1) << " Baseline is " << *BaseRay << endl;
    1837 
    1838               // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2)
    1839               TesselPoint *PointCandidates[3];
    1840               PointCandidates[0] = (*it)->point;
    1841               PointCandidates[1] = BaseRay->endpoints[0]->node;
    1842               PointCandidates[2] = BaseRay->endpoints[1]->node;
    1843               bool check=false;
    1844               int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates);
    1845               // If there is no triangle, add it regularly.
    1846               if (existentTrianglesCount == 0) {
    1847                 SetTesselationPoint((*it)->point, 0);
    1848                 SetTesselationPoint(BaseRay->endpoints[0]->node, 1);
    1849                 SetTesselationPoint(BaseRay->endpoints[1]->node, 2);
    1850 
    1851                 if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) {
    1852                   OtherOptCandidate = (*it)->point;
    1853                   check = true;
    1854                 }
    1855               } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time.
    1856                 SetTesselationPoint((*it)->point, 0);
    1857                 SetTesselationPoint(BaseRay->endpoints[0]->node, 1);
    1858                 SetTesselationPoint(BaseRay->endpoints[1]->node, 2);
    1859 
    1860                 // 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)
    1861                 // i.e. at least one of the three lines must be present with TriangleCount <= 1
    1862                 if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS)) {
    1863                   OtherOptCandidate = (*it)->point;
    1864                   check = true;
    1865                 }
    1866               }
    1867 
    1868               if (check) {
    1869                 if (ShortestAngle > OtherShortestAngle) {
    1870                   Log() << Verbose(1) << "There is a better candidate than " << *ThirdNode << " with " << ShortestAngle << " from baseline " << *Line << ": " << *OtherOptCandidate << " with " << OtherShortestAngle << "." << endl;
    1871                   result = true;
    1872                   break;
    1873                 }
    1874               }
    1875             }
    1876             delete(OptCandidates);
    1877             if (result)
    1878               break;
    1879           } else {
    1880             Log() << Verbose(1) << "Circumcircle for base line " << *Line << " and base triangle " << T << " is too big!" << endl;
    1881           }
    1882         } else {
    1883           eLog() << Verbose(2) << "Baseline is connected to two triangles already?" << endl;
    1884         }
    1885       } else {
    1886         Log() << Verbose(2) << "No present baseline between " << BaseRay->endpoints[0] << " and candidate " << *ThirdNode << "." << endl;
    1887       }
    1888     }
    1889   } else {
    1890     eLog() << Verbose(1) << "Could not find the TesselPoint " << *ThirdNode << "." << endl;
    1891   }
    1892 
    1893   Log() << Verbose(1) << "End of HasOtherBaselineBetterCandidate" << endl;
    1894 
    1895   return result;
    1896 };
     1795//bool Tesselation::HasOtherBaselineBetterCandidate(CandidateForTesselation &CandidateLine, const TesselPoint * const ThirdNode, double RADIUS, const LinkedCell * const LC) const
     1796//{
     1797//      Info FunctionInfo(__func__);
     1798//  bool result = false;
     1799//  Vector CircleCenter;
     1800//  Vector CirclePlaneNormal;
     1801//  Vector OldSphereCenter;
     1802//  Vector SearchDirection;
     1803//  Vector helper;
     1804//  TesselPoint *OtherOptCandidate = NULL;
     1805//  double OtherShortestAngle = 2.*M_PI; // This will indicate the quadrant.
     1806//  double radius, CircleRadius;
     1807//  BoundaryLineSet *Line = NULL;
     1808//  BoundaryTriangleSet *T = NULL;
     1809//
     1810//  // check both other lines
     1811//  PointMap::const_iterator FindPoint = PointsOnBoundary.find(ThirdNode->nr);
     1812//  if (FindPoint != PointsOnBoundary.end()) {
     1813//    for (int i=0;i<2;i++) {
     1814//      LineMap::const_iterator FindLine = (FindPoint->second)->lines.find(BaseRay->endpoints[0]->node->nr);
     1815//      if (FindLine != (FindPoint->second)->lines.end()) {
     1816//        Line = FindLine->second;
     1817//        Log() << Verbose(0) << "Found line " << *Line << "." << endl;
     1818//        if (Line->triangles.size() == 1) {
     1819//          T = Line->triangles.begin()->second;
     1820//          // construct center of circle
     1821//          CircleCenter.CopyVector(Line->endpoints[0]->node->node);
     1822//          CircleCenter.AddVector(Line->endpoints[1]->node->node);
     1823//          CircleCenter.Scale(0.5);
     1824//
     1825//          // construct normal vector of circle
     1826//          CirclePlaneNormal.CopyVector(Line->endpoints[0]->node->node);
     1827//          CirclePlaneNormal.SubtractVector(Line->endpoints[1]->node->node);
     1828//
     1829//          // calculate squared radius of circle
     1830//          radius = CirclePlaneNormal.ScalarProduct(&CirclePlaneNormal);
     1831//          if (radius/4. < RADIUS*RADIUS) {
     1832//            CircleRadius = RADIUS*RADIUS - radius/4.;
     1833//            CirclePlaneNormal.Normalize();
     1834//            //Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
     1835//
     1836//            // construct old center
     1837//            GetCenterofCircumcircle(&OldSphereCenter, *T->endpoints[0]->node->node, *T->endpoints[1]->node->node, *T->endpoints[2]->node->node);
     1838//            helper.CopyVector(&T->NormalVector);  // normal vector ensures that this is correct center of the two possible ones
     1839//            radius = Line->endpoints[0]->node->node->DistanceSquared(&OldSphereCenter);
     1840//            helper.Scale(sqrt(RADIUS*RADIUS - radius));
     1841//            OldSphereCenter.AddVector(&helper);
     1842//            OldSphereCenter.SubtractVector(&CircleCenter);
     1843//            //Log() << Verbose(1) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;
     1844//
     1845//            // construct SearchDirection
     1846//            SearchDirection.MakeNormalVector(&T->NormalVector, &CirclePlaneNormal);
     1847//            helper.CopyVector(Line->endpoints[0]->node->node);
     1848//            helper.SubtractVector(ThirdNode->node);
     1849//            if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards!
     1850//              SearchDirection.Scale(-1.);
     1851//            SearchDirection.ProjectOntoPlane(&OldSphereCenter);
     1852//            SearchDirection.Normalize();
     1853//            Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
     1854//            if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {
     1855//              // rotated the wrong way!
     1856//              eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl;
     1857//            }
     1858//
     1859//            // add third point
     1860//            FindThirdPointForTesselation(T->NormalVector, SearchDirection, OldSphereCenter, OptCandidates, ThirdNode, RADIUS, LC);
     1861//            for (TesselPointList::iterator it = OptCandidates.pointlist.begin(); it != OptCandidates.pointlist.end(); ++it) {
     1862//              if (((*it) == BaseRay->endpoints[0]->node) || ((*it) == BaseRay->endpoints[1]->node)) // skip if it's the same triangle than suggested
     1863//                continue;
     1864//              Log() << Verbose(0) << " Third point candidate is " << (*it)
     1865//              << " with circumsphere's center at " << (*it)->OptCenter << "." << endl;
     1866//              Log() << Verbose(0) << " Baseline is " << *BaseRay << endl;
     1867//
     1868//              // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2)
     1869//              TesselPoint *PointCandidates[3];
     1870//              PointCandidates[0] = (*it);
     1871//              PointCandidates[1] = BaseRay->endpoints[0]->node;
     1872//              PointCandidates[2] = BaseRay->endpoints[1]->node;
     1873//              bool check=false;
     1874//              int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates);
     1875//              // If there is no triangle, add it regularly.
     1876//              if (existentTrianglesCount == 0) {
     1877//                SetTesselationPoint((*it), 0);
     1878//                SetTesselationPoint(BaseRay->endpoints[0]->node, 1);
     1879//                SetTesselationPoint(BaseRay->endpoints[1]->node, 2);
     1880//
     1881//                if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) {
     1882//                  OtherOptCandidate = (*it);
     1883//                  check = true;
     1884//                }
     1885//              } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time.
     1886//                SetTesselationPoint((*it), 0);
     1887//                SetTesselationPoint(BaseRay->endpoints[0]->node, 1);
     1888//                SetTesselationPoint(BaseRay->endpoints[1]->node, 2);
     1889//
     1890//                // 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)
     1891//                // i.e. at least one of the three lines must be present with TriangleCount <= 1
     1892//                if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS)) {
     1893//                  OtherOptCandidate = (*it);
     1894//                  check = true;
     1895//                }
     1896//              }
     1897//
     1898//              if (check) {
     1899//                if (ShortestAngle > OtherShortestAngle) {
     1900//                  Log() << Verbose(0) << "There is a better candidate than " << *ThirdNode << " with " << ShortestAngle << " from baseline " << *Line << ": " << *OtherOptCandidate << " with " << OtherShortestAngle << "." << endl;
     1901//                  result = true;
     1902//                  break;
     1903//                }
     1904//              }
     1905//            }
     1906//            delete(OptCandidates);
     1907//            if (result)
     1908//              break;
     1909//          } else {
     1910//            Log() << Verbose(0) << "Circumcircle for base line " << *Line << " and base triangle " << T << " is too big!" << endl;
     1911//          }
     1912//        } else {
     1913//          eLog() << Verbose(2) << "Baseline is connected to two triangles already?" << endl;
     1914//        }
     1915//      } else {
     1916//        Log() << Verbose(1) << "No present baseline between " << BaseRay->endpoints[0] << " and candidate " << *ThirdNode << "." << endl;
     1917//      }
     1918//    }
     1919//  } else {
     1920//    eLog() << Verbose(1) << "Could not find the TesselPoint " << *ThirdNode << "." << endl;
     1921//  }
     1922//
     1923//  return result;
     1924//};
    18971925
    18981926/** This function finds a triangle to a line, adjacent to an existing one.
     
    19061934bool Tesselation::FindNextSuitableTriangle(CandidateForTesselation &CandidateLine, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC)
    19071935{
    1908   Log() << Verbose(0) << "Begin of FindNextSuitableTriangle\n";
     1936        Info FunctionInfo(__func__);
    19091937  bool result = true;
    1910   CandidateList *OptCandidates = new CandidateList();
    19111938
    19121939  Vector CircleCenter;
     
    19171944  TesselPoint *ThirdNode = NULL;
    19181945  LineMap::iterator testline;
    1919   double ShortestAngle = 2.*M_PI; // This will indicate the quadrant.
    19201946  double radius, CircleRadius;
    19211947
    1922   Log() << Verbose(1) << "Current baseline is " << *CandidateLine.BaseLine << " of triangle " << T << "." << endl;
     1948  Log() << Verbose(0) << "Current baseline is " << *CandidateLine.BaseLine << " of triangle " << T << "." << endl;
    19231949  for (int i=0;i<3;i++)
    19241950    if ((T.endpoints[i]->node != CandidateLine.BaseLine->endpoints[0]->node) && (T.endpoints[i]->node != CandidateLine.BaseLine->endpoints[1]->node))
     
    19391965    CircleRadius = RADIUS*RADIUS - radius/4.;
    19401966    CirclePlaneNormal.Normalize();
    1941     //Log() << Verbose(2) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
     1967    Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
    19421968
    19431969    // construct old center
     
    19481974    OldSphereCenter.AddVector(&helper);
    19491975    OldSphereCenter.SubtractVector(&CircleCenter);
    1950     //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;
     1976    Log() << Verbose(1) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;
    19511977
    19521978    // construct SearchDirection
     
    19581984    SearchDirection.ProjectOntoPlane(&OldSphereCenter);
    19591985    SearchDirection.Normalize();
    1960     Log() << Verbose(2) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
     1986    Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
    19611987    if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {
    19621988      // rotated the wrong way!
     
    19651991
    19661992    // add third point
    1967     FindThirdPointForTesselation(T.NormalVector, SearchDirection, OldSphereCenter, CandidateLine.BaseLine, ThirdNode, OptCandidates, &ShortestAngle, RADIUS, LC);
     1993    FindThirdPointForTesselation(T.NormalVector, SearchDirection, OldSphereCenter, CandidateLine, ThirdNode, RADIUS, LC);
    19681994
    19691995  } else {
    1970     Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and base triangle " << T << " is too big!" << endl;
    1971   }
    1972 
    1973   if (OptCandidates->begin() == OptCandidates->end()) {
     1996    Log() << Verbose(0) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and base triangle " << T << " is too big!" << endl;
     1997  }
     1998
     1999  if (CandidateLine.pointlist.empty()) {
    19742000    eLog() << Verbose(2) << "Could not find a suitable candidate." << endl;
    19752001    return false;
    19762002  }
    1977   Log() << Verbose(1) << "Third Points are ";
    1978   for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    1979     Log() << Verbose(1) << " " << *(*it)->point << endl;
    1980   }
    1981 
    1982   BoundaryLineSet *BaseRay = CandidateLine.BaseLine;
    1983   for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    1984     Log() << Verbose(1) << " Third point candidate is " << *(*it)->point
    1985     << " with circumsphere's center at " << (*it)->OptCenter << "." << endl;
    1986     Log() << Verbose(1) << " Baseline is " << *BaseRay << endl;
    1987 
    1988     // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2)
    1989     TesselPoint *PointCandidates[3];
    1990     PointCandidates[0] = (*it)->point;
    1991     PointCandidates[1] = BaseRay->endpoints[0]->node;
    1992     PointCandidates[2] = BaseRay->endpoints[1]->node;
    1993     int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates);
    1994 
    1995     BTS = NULL;
    1996     // check for present edges and whether we reach better candidates from them
    1997     //if (HasOtherBaselineBetterCandidate(BaseRay, (*it)->point, ShortestAngle, RADIUS, LC) ) {
    1998     if (0) {
    1999       result = false;
    2000       break;
    2001     } else {
    2002       // If there is no triangle, add it regularly.
    2003       if (existentTrianglesCount == 0) {
    2004         AddTesselationPoint((*it)->point, 0);
    2005         AddTesselationPoint(BaseRay->endpoints[0]->node, 1);
    2006         AddTesselationPoint(BaseRay->endpoints[1]->node, 2);
    2007 
    2008         if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) {
    2009           CandidateLine.point = (*it)->point;
    2010           CandidateLine.OptCenter.CopyVector(&((*it)->OptCenter));
    2011           CandidateLine.OtherOptCenter.CopyVector(&((*it)->OtherOptCenter));
    2012           CandidateLine.ShortestAngle = ShortestAngle;
    2013         } else {
    2014 //          eLog() << Verbose(2) << "This triangle consisting of ";
    2015 //          Log() << Verbose(0) << *(*it)->point << ", ";
    2016 //          Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and ";
    2017 //          Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " ";
    2018 //          Log() << Verbose(0) << "exists and is not added, as it 0x80000000006fc150(does not seem helpful!" << endl;
    2019           result = false;
    2020         }
    2021       } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time.
    2022           AddTesselationPoint((*it)->point, 0);
    2023           AddTesselationPoint(BaseRay->endpoints[0]->node, 1);
    2024           AddTesselationPoint(BaseRay->endpoints[1]->node, 2);
    2025 
    2026           // 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)
    2027           // i.e. at least one of the three lines must be present with TriangleCount <= 1
    2028           if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS) || CandidateLine.BaseLine->skipped) {
    2029             CandidateLine.point = (*it)->point;
    2030             CandidateLine.OptCenter.CopyVector(&(*it)->OptCenter);
    2031             CandidateLine.OtherOptCenter.CopyVector(&(*it)->OtherOptCenter);
    2032             CandidateLine.ShortestAngle = ShortestAngle+2.*M_PI;
    2033 
    2034           } else {
    2035 //            eLog() << Verbose(2) << "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;
    2036             result = false;
    2037           }
    2038       } else {
    2039 //        Log() << Verbose(1) << "This triangle consisting of ";
    2040 //        Log() << Verbose(0) << *(*it)->point << ", ";
    2041 //        Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and ";
    2042 //        Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " ";
    2043 //        Log() << Verbose(0) << "is invalid!" << endl;
    2044         result = false;
    2045       }
    2046     }
    2047 
    2048     // set baseline to new ray from ref point (here endpoints[0]->node) to current candidate (here (*it)->point))
    2049     BaseRay = BLS[0];
    2050     if ((BTS != NULL) && (BTS->NormalVector.NormSquared() < MYEPSILON)) {
    2051       eLog() << Verbose(1) << "Triangle " << *BTS << " has zero normal vector!" << endl;
    2052       exit(255);
    2053     }
    2054 
    2055   }
    2056 
    2057   // remove all candidates from the list and then the list itself
    2058   class CandidateForTesselation *remover = NULL;
    2059   for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    2060     remover = *it;
    2061     delete(remover);
    2062   }
    2063   delete(OptCandidates);
    2064   Log() << Verbose(0) << "End of FindNextSuitableTriangle\n";
     2003  Log() << Verbose(0) << "Third Points are: " << endl;
     2004  for (TesselPointList::iterator it = CandidateLine.pointlist.begin(); it != CandidateLine.pointlist.end(); ++it) {
     2005    Log() << Verbose(0) << " " << *(*it) << endl;
     2006  }
     2007
     2008  return true;
     2009
     2010//  BoundaryLineSet *BaseRay = CandidateLine.BaseLine;
     2011//  for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
     2012//    Log() << Verbose(0) << "Third point candidate is " << *(*it)->point
     2013//    << " with circumsphere's center at " << (*it)->OptCenter << "." << endl;
     2014//    Log() << Verbose(0) << "Baseline is " << *BaseRay << endl;
     2015//
     2016//    // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2)
     2017//    TesselPoint *PointCandidates[3];
     2018//    PointCandidates[0] = (*it)->point;
     2019//    PointCandidates[1] = BaseRay->endpoints[0]->node;
     2020//    PointCandidates[2] = BaseRay->endpoints[1]->node;
     2021//    int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates);
     2022//
     2023//    BTS = NULL;
     2024//    // check for present edges and whether we reach better candidates from them
     2025//    //if (HasOtherBaselineBetterCandidate(BaseRay, (*it)->point, ShortestAngle, RADIUS, LC) ) {
     2026//    if (0) {
     2027//      result = false;
     2028//      break;
     2029//    } else {
     2030//      // If there is no triangle, add it regularly.
     2031//      if (existentTrianglesCount == 0) {
     2032//        AddTesselationPoint((*it)->point, 0);
     2033//        AddTesselationPoint(BaseRay->endpoints[0]->node, 1);
     2034//        AddTesselationPoint(BaseRay->endpoints[1]->node, 2);
     2035//
     2036//        if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) {
     2037//          CandidateLine.point = (*it)->point;
     2038//          CandidateLine.OptCenter.CopyVector(&((*it)->OptCenter));
     2039//          CandidateLine.OtherOptCenter.CopyVector(&((*it)->OtherOptCenter));
     2040//          CandidateLine.ShortestAngle = ShortestAngle;
     2041//        } else {
     2042////          eLog() << Verbose(1) << "This triangle consisting of ";
     2043////          Log() << Verbose(0) << *(*it)->point << ", ";
     2044////          Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and ";
     2045////          Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " ";
     2046////          Log() << Verbose(0) << "exists and is not added, as it 0x80000000006fc150(does not seem helpful!" << endl;
     2047//          result = false;
     2048//        }
     2049//      } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time.
     2050//          AddTesselationPoint((*it)->point, 0);
     2051//          AddTesselationPoint(BaseRay->endpoints[0]->node, 1);
     2052//          AddTesselationPoint(BaseRay->endpoints[1]->node, 2);
     2053//
     2054//          // 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)
     2055//          // i.e. at least one of the three lines must be present with TriangleCount <= 1
     2056//          if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS) || CandidateLine.BaseLine->skipped) {
     2057//            CandidateLine.point = (*it)->point;
     2058//            CandidateLine.OptCenter.CopyVector(&(*it)->OptCenter);
     2059//            CandidateLine.OtherOptCenter.CopyVector(&(*it)->OtherOptCenter);
     2060//            CandidateLine.ShortestAngle = ShortestAngle+2.*M_PI;
     2061//
     2062//          } else {
     2063////            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;
     2064//            result = false;
     2065//          }
     2066//      } else {
     2067////        Log() << Verbose(1) << "This triangle consisting of ";
     2068////        Log() << Verbose(0) << *(*it)->point << ", ";
     2069////        Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and ";
     2070////        Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " ";
     2071////        Log() << Verbose(0) << "is invalid!" << endl;
     2072//        result = false;
     2073//      }
     2074//    }
     2075//
     2076//    // set baseline to new ray from ref point (here endpoints[0]->node) to current candidate (here (*it)->point))
     2077//    BaseRay = BLS[0];
     2078//    if ((BTS != NULL) && (BTS->NormalVector.NormSquared() < MYEPSILON)) {
     2079//      eLog() << Verbose(1) << "Triangle " << *BTS << " has zero normal vector!" << endl;
     2080//      exit(255);
     2081//    }
     2082//
     2083//  }
     2084//
     2085//  // remove all candidates from the list and then the list itself
     2086//  class CandidateForTesselation *remover = NULL;
     2087//  for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
     2088//    remover = *it;
     2089//    delete(remover);
     2090//  }
     2091//  delete(OptCandidates);
    20652092  return result;
    20662093};
    20672094
    20682095/** Adds the present line and candidate point from \a &CandidateLine to the Tesselation.
    2069  * \param &CandidateLine triangle to add
    2070  */
    2071 void Tesselation::AddCandidateTriangle(CandidateForTesselation &CandidateLine)
    2072 {
     2096 * \param CandidateLine triangle to add
     2097 * \NOTE we need the copy operator here as the original CandidateForTesselation is removed in AddTesselationLine()
     2098 */
     2099void Tesselation::AddCandidateTriangle(CandidateForTesselation CandidateLine)
     2100{
     2101        Info FunctionInfo(__func__);
    20732102  Vector Center;
    2074   Log() << Verbose(2) << "BaseLine is :" << *(CandidateLine.BaseLine) << " with candidate " << *(CandidateLine.point) << "." << endl;
    2075   // add the points
    2076   AddTesselationPoint(CandidateLine.point, 0);
    2077   AddTesselationPoint(CandidateLine.BaseLine->endpoints[0]->node, 1);
    2078   AddTesselationPoint(CandidateLine.BaseLine->endpoints[1]->node, 2);
    2079 
    2080   Center.CopyVector(&CandidateLine.OptCenter);
    2081   // add the lines
    2082   AddTesselationLine(TPS[0], TPS[1], 0);
    2083   AddTesselationLine(TPS[0], TPS[2], 1);
    2084   AddTesselationLine(TPS[1], TPS[2], 2);
    2085 
    2086   // add the triangles
    2087   BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
    2088   AddTesselationTriangle();
    2089   Center.Scale(-1.);
    2090   BTS->GetNormalVector(Center);
    2091 
    2092   Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " for this triangle ... " << endl;
     2103  BoundaryLineSet *BaseLine = CandidateLine.BaseLine;
     2104
     2105  // go through all candidates (in degenerate n-nodes case we may have to add multiple triangles)
     2106  for (TesselPointList::iterator Runner = CandidateLine.pointlist.begin(); Runner != CandidateLine.pointlist.end(); Runner++) {
     2107    Log() << Verbose(2) << "BaseLine is :" << *(BaseLine) << " with current candidate " << *(*Runner) << "." << endl;
     2108    // add the points
     2109    AddTesselationPoint((*Runner), 0);
     2110    AddTesselationPoint(BaseLine->endpoints[0]->node, 1);
     2111    AddTesselationPoint(BaseLine->endpoints[1]->node, 2);
     2112
     2113    Center.CopyVector(&CandidateLine.OptCenter);
     2114    // add the lines
     2115    AddTesselationLine(TPS[0], TPS[1], 0);
     2116    AddTesselationLine(TPS[0], TPS[2], 1);
     2117    AddTesselationLine(TPS[1], TPS[2], 2);
     2118
     2119    // add the triangles
     2120    BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
     2121    AddTesselationTriangle();
     2122    Center.Scale(-1.);
     2123    BTS->GetNormalVector(Center);
     2124
     2125    Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector << "." << endl;
     2126    BaseLine = BLS[0];  // go to next baseline, in order to add in star formation from CandidateLine.BaseLine->endpoints[0]->node
     2127  }
    20932128};
    20942129
     
    21022137class BoundaryPointSet *Tesselation::IsConvexRectangle(class BoundaryLineSet *Base)
    21032138{
     2139        Info FunctionInfo(__func__);
    21042140  class BoundaryPointSet *Spot = NULL;
    21052141  class BoundaryLineSet *OtherBase;
     
    21132149  OtherBase = new class BoundaryLineSet(BPS,-1);
    21142150
    2115   Log() << Verbose(3) << "INFO: Current base line is " << *Base << "." << endl;
    2116   Log() << Verbose(3) << "INFO: Other base line is " << *OtherBase << "." << endl;
     2151  Log() << Verbose(1) << "INFO: Current base line is " << *Base << "." << endl;
     2152  Log() << Verbose(1) << "INFO: Other base line is " << *OtherBase << "." << endl;
    21172153
    21182154  // get the closest point on each line to the other line
     
    21342170  delete(ClosestPoint);
    21352171  if ((distance[0] * distance[1]) > 0)  { // have same sign?
    2136     Log() << Verbose(3) << "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1]  << ". " << *Base << "' rectangle is concave." << endl;
     2172    Log() << Verbose(1) << "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1]  << ". " << *Base << "' rectangle is concave." << endl;
    21372173    if (distance[0] < distance[1]) {
    21382174      Spot = Base->endpoints[0];
     
    21422178    return Spot;
    21432179  } else {  // different sign, i.e. we are in between
    2144     Log() << Verbose(3) << "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex." << endl;
     2180    Log() << Verbose(0) << "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex." << endl;
    21452181    return NULL;
    21462182  }
     
    21502186void Tesselation::PrintAllBoundaryPoints(ofstream *out) const
    21512187{
     2188        Info FunctionInfo(__func__);
    21522189  // print all lines
    2153   Log() << Verbose(1) << "Printing all boundary points for debugging:" << endl;
     2190  Log() << Verbose(0) << "Printing all boundary points for debugging:" << endl;
    21542191  for (PointMap::const_iterator PointRunner = PointsOnBoundary.begin();PointRunner != PointsOnBoundary.end(); PointRunner++)
    2155     Log() << Verbose(2) << *(PointRunner->second) << endl;
     2192    Log() << Verbose(0) << *(PointRunner->second) << endl;
    21562193};
    21572194
    21582195void Tesselation::PrintAllBoundaryLines(ofstream *out) const
    21592196{
     2197        Info FunctionInfo(__func__);
    21602198  // print all lines
    2161   Log() << Verbose(1) << "Printing all boundary lines for debugging:" << endl;
     2199  Log() << Verbose(0) << "Printing all boundary lines for debugging:" << endl;
    21622200  for (LineMap::const_iterator LineRunner = LinesOnBoundary.begin(); LineRunner != LinesOnBoundary.end(); LineRunner++)
    2163     Log() << Verbose(2) << *(LineRunner->second) << endl;
     2201    Log() << Verbose(0) << *(LineRunner->second) << endl;
    21642202};
    21652203
    21662204void Tesselation::PrintAllBoundaryTriangles(ofstream *out) const
    21672205{
     2206        Info FunctionInfo(__func__);
    21682207  // print all triangles
    2169   Log() << Verbose(1) << "Printing all boundary triangles for debugging:" << endl;
     2208  Log() << Verbose(0) << "Printing all boundary triangles for debugging:" << endl;
    21702209  for (TriangleMap::const_iterator TriangleRunner = TrianglesOnBoundary.begin(); TriangleRunner != TrianglesOnBoundary.end(); TriangleRunner++)
    2171     Log() << Verbose(2) << *(TriangleRunner->second) << endl;
     2210    Log() << Verbose(0) << *(TriangleRunner->second) << endl;
    21722211};
    21732212
     
    21792218double Tesselation::PickFarthestofTwoBaselines(class BoundaryLineSet *Base)
    21802219{
     2220        Info FunctionInfo(__func__);
    21812221  class BoundaryLineSet *OtherBase;
    21822222  Vector *ClosestPoint[2];
     
    21902230  OtherBase = new class BoundaryLineSet(BPS,-1);
    21912231
    2192   Log() << Verbose(3) << "INFO: Current base line is " << *Base << "." << endl;
    2193   Log() << Verbose(3) << "INFO: Other base line is " << *OtherBase << "." << endl;
     2232  Log() << Verbose(0) << "INFO: Current base line is " << *Base << "." << endl;
     2233  Log() << Verbose(0) << "INFO: Other base line is " << *OtherBase << "." << endl;
    21942234
    21952235  // get the closest point on each line to the other line
     
    22112251
    22122252  if (Distance.NormSquared() < MYEPSILON) { // check for intersection
    2213     Log() << Verbose(3) << "REJECT: Both lines have an intersection: Nothing to do." << endl;
     2253    Log() << Verbose(0) << "REJECT: Both lines have an intersection: Nothing to do." << endl;
    22142254    return false;
    22152255  } else { // check for sign against BaseLineNormal
     
    22212261    }
    22222262    for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) {
    2223       Log() << Verbose(4) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;
     2263      Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;
    22242264      BaseLineNormal.AddVector(&(runner->second->NormalVector));
    22252265    }
     
    22272267
    22282268    if (Distance.ScalarProduct(&BaseLineNormal) > MYEPSILON) { // Distance points outwards, hence OtherBase higher than Base -> flip
    2229       Log() << Verbose(2) << "ACCEPT: Other base line would be higher: Flipping baseline." << endl;
     2269      Log() << Verbose(0) << "ACCEPT: Other base line would be higher: Flipping baseline." << endl;
    22302270      // calculate volume summand as a general tetraeder
    22312271      return volume;
    22322272    } else {  // Base higher than OtherBase -> do nothing
    2233       Log() << Verbose(2) << "REJECT: Base line is higher: Nothing to do." << endl;
     2273      Log() << Verbose(0) << "REJECT: Base line is higher: Nothing to do." << endl;
    22342274      return 0.;
    22352275    }
     
    22462286class BoundaryLineSet * Tesselation::FlipBaseline(class BoundaryLineSet *Base)
    22472287{
     2288        Info FunctionInfo(__func__);
    22482289  class BoundaryLineSet *OldLines[4], *NewLine;
    22492290  class BoundaryPointSet *OldPoints[2];
     
    22522293  int i,m;
    22532294
    2254   Log() << Verbose(1) << "Begin of FlipBaseline" << endl;
    2255 
    22562295  // calculate NormalVector for later use
    22572296  BaseLineNormal.Zero();
     
    22612300  }
    22622301  for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) {
    2263     Log() << Verbose(4) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;
     2302    Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;
    22642303    BaseLineNormal.AddVector(&(runner->second->NormalVector));
    22652304  }
     
    22742313  i=0;
    22752314  m=0;
    2276   Log() << Verbose(3) << "The four old lines are: ";
     2315  Log() << Verbose(0) << "The four old lines are: ";
    22772316  for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++)
    22782317    for (int j=0;j<3;j++) // all of their endpoints and baselines
     
    22822321      }
    22832322  Log() << Verbose(0) << endl;
    2284   Log() << Verbose(3) << "The two old points are: ";
     2323  Log() << Verbose(0) << "The two old points are: ";
    22852324  for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++)
    22862325    for (int j=0;j<3;j++) // all of their endpoints and baselines
     
    23082347
    23092348  // remove triangles and baseline removes itself
    2310   Log() << Verbose(3) << "INFO: Deleting baseline " << *Base << " from global list." << endl;
     2349  Log() << Verbose(0) << "INFO: Deleting baseline " << *Base << " from global list." << endl;
    23112350  OldBaseLineNr = Base->Nr;
    23122351  m=0;
    23132352  for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) {
    2314     Log() << Verbose(3) << "INFO: Deleting triangle " << *(runner->second) << "." << endl;
     2353    Log() << Verbose(0) << "INFO: Deleting triangle " << *(runner->second) << "." << endl;
    23152354    OldTriangleNrs[m++] = runner->second->Nr;
    23162355    RemoveTesselationTriangle(runner->second);
     
    23222361  NewLine = new class BoundaryLineSet(BPS, OldBaseLineNr);
    23232362  LinesOnBoundary.insert(LinePair(OldBaseLineNr, NewLine)); // no need for check for unique insertion as NewLine is definitely a new one
    2324   Log() << Verbose(3) << "INFO: Created new baseline " << *NewLine << "." << endl;
     2363  Log() << Verbose(0) << "INFO: Created new baseline " << *NewLine << "." << endl;
    23252364
    23262365  // construct new triangles with flipped baseline
     
    23372376    BTS->GetNormalVector(BaseLineNormal);
    23382377    AddTesselationTriangle(OldTriangleNrs[0]);
    2339     Log() << Verbose(3) << "INFO: Created new triangle " << *BTS << "." << endl;
     2378    Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl;
    23402379
    23412380    BLS[0] = (i==2 ? OldLines[3] : OldLines[2]);
     
    23452384    BTS->GetNormalVector(BaseLineNormal);
    23462385    AddTesselationTriangle(OldTriangleNrs[1]);
    2347     Log() << Verbose(3) << "INFO: Created new triangle " << *BTS << "." << endl;
     2386    Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl;
    23482387  } else {
    2349     Log() << Verbose(1) << "The four old lines do not connect, something's utterly wrong here!" << endl;
     2388    eLog() << Verbose(0) << "The four old lines do not connect, something's utterly wrong here!" << endl;
    23502389    return NULL;
    23512390  }
    23522391
    2353   Log() << Verbose(1) << "End of FlipBaseline" << endl;
    23542392  return NewLine;
    23552393};
     
    23662404void Tesselation::FindSecondPointForTesselation(TesselPoint* a, Vector Oben, TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell *LC)
    23672405{
    2368   Log() << Verbose(2) << "Begin of FindSecondPointForTesselation" << endl;
     2406        Info FunctionInfo(__func__);
    23692407  Vector AngleCheck;
    23702408  class TesselPoint* Candidate = NULL;
     
    23872425    Nupper[i] = ((N[i]+1) < LC->N[i]) ? N[i]+1 : LC->N[i]-1;
    23882426  }
    2389   Log() << Verbose(3) << "LC Intervals from [" << N[0] << "<->" << LC->N[0] << ", " << N[1] << "<->" << LC->N[1] << ", " << N[2] << "<->" << LC->N[2] << "] :"
     2427  Log() << Verbose(0) << "LC Intervals from [" << N[0] << "<->" << LC->N[0] << ", " << N[1] << "<->" << LC->N[1] << ", " << N[2] << "<->" << LC->N[2] << "] :"
    23902428    << " [" << Nlower[0] << "," << Nupper[0] << "], " << " [" << Nlower[1] << "," << Nupper[1] << "], " << " [" << Nlower[2] << "," << Nupper[2] << "], " << endl;
    23912429
     
    23942432      for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) {
    23952433        const LinkedNodes *List = LC->GetCurrentCell();
    2396         //Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;
     2434        //Log() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;
    23972435        if (List != NULL) {
    23982436          for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
     
    24252463                angle = AngleCheck.Angle(&Oben);
    24262464                if (angle < Storage[0]) {
    2427                   //Log() << Verbose(3) << "Old values of Storage: %lf %lf \n", Storage[0], Storage[1]);
    2428                   Log() << Verbose(3) << "Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << ".\n";
     2465                  //Log() << Verbose(1) << "Old values of Storage: %lf %lf \n", Storage[0], Storage[1]);
     2466                  Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << ".\n";
    24292467                  OptCandidate = Candidate;
    24302468                  Storage[0] = angle;
    2431                   //Log() << Verbose(3) << "Changing something in Storage: %lf %lf. \n", Storage[0], Storage[2]);
     2469                  //Log() << Verbose(1) << "Changing something in Storage: %lf %lf. \n", Storage[0], Storage[2]);
    24322470                } else {
    2433                   //Log() << Verbose(3) << "Current candidate is " << *Candidate << ": Looses with angle " << angle << " to a better candidate " << *OptCandidate << endl;
     2471                  //Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Looses with angle " << angle << " to a better candidate " << *OptCandidate << endl;
    24342472                }
    24352473              } else {
    2436                 //Log() << Verbose(3) << "Current candidate is " << *Candidate << ": Refused due to Radius " << norm << endl;
     2474                //Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Refused due to Radius " << norm << endl;
    24372475              }
    24382476            } else {
    2439               //Log() << Verbose(3) << "Current candidate is " << *Candidate << ": Candidate is equal to first endpoint." << *a << "." << endl;
     2477              //Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Candidate is equal to first endpoint." << *a << "." << endl;
    24402478            }
    24412479          }
    24422480        } else {
    2443           Log() << Verbose(3) << "Linked cell list is empty." << endl;
     2481          Log() << Verbose(0) << "Linked cell list is empty." << endl;
    24442482        }
    24452483      }
    2446   Log() << Verbose(2) << "End of FindSecondPointForTesselation" << endl;
    24472484};
    24482485
     
    24732510 * @param SearchDirection general direction where to search for the next point, relative to center of BaseLine
    24742511 * @param OldSphereCenter center of sphere for base triangle, relative to center of BaseLine, giving null angle for the parameter circle
    2475  * @param BaseLine BoundaryLineSet with the current base line
     2512 * @param CandidateLine CandidateForTesselation with the current base line and list of candidates and ShortestAngle
    24762513 * @param ThirdNode third point to avoid in search
    2477  * @param candidates list of equally good candidates to return
    2478  * @param ShortestAngle the current path length on this circle band for the current OptCandidate
    24792514 * @param RADIUS radius of sphere
    24802515 * @param *LC LinkedCell structure with neighbouring points
    24812516 */
    2482 void Tesselation::FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, class BoundaryLineSet *BaseLine, const class TesselPoint  * const ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, const LinkedCell *LC) const
    2483 {
     2517void Tesselation::FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, CandidateForTesselation &CandidateLine, const class TesselPoint  * const ThirdNode, const double RADIUS, const LinkedCell *LC) const
     2518{
     2519        Info FunctionInfo(__func__);
    24842520  Vector CircleCenter;  // center of the circle, i.e. of the band of sphere's centers
    24852521  Vector CirclePlaneNormal; // normal vector defining the plane this circle lives in
     
    24942530  int N[NDIM], Nlower[NDIM], Nupper[NDIM];
    24952531  TesselPoint *Candidate = NULL;
    2496   CandidateForTesselation *optCandidate = NULL;
    2497 
    2498   Log() << Verbose(1) << "Begin of FindThirdPointForTesselation" << endl;
    2499 
    2500   Log() << Verbose(2) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl;
     2532
     2533  Log() << Verbose(1) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl;
    25012534
    25022535  // construct center of circle
    2503   CircleCenter.CopyVector(BaseLine->endpoints[0]->node->node);
    2504   CircleCenter.AddVector(BaseLine->endpoints[1]->node->node);
     2536  CircleCenter.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node);
     2537  CircleCenter.AddVector(CandidateLine.BaseLine->endpoints[1]->node->node);
    25052538  CircleCenter.Scale(0.5);
    25062539
    25072540  // construct normal vector of circle
    2508   CirclePlaneNormal.CopyVector(BaseLine->endpoints[0]->node->node);
    2509   CirclePlaneNormal.SubtractVector(BaseLine->endpoints[1]->node->node);
     2541  CirclePlaneNormal.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node);
     2542  CirclePlaneNormal.SubtractVector(CandidateLine.BaseLine->endpoints[1]->node->node);
    25102543
    25112544  // calculate squared radius TesselPoint *ThirdNode,f circle
     
    25142547    CircleRadius = RADIUS*RADIUS - radius/4.;
    25152548    CirclePlaneNormal.Normalize();
    2516     //Log() << Verbose(2) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
     2549    //Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
    25172550
    25182551    // test whether old center is on the band's plane
     
    25232556    radius = OldSphereCenter.ScalarProduct(&OldSphereCenter);
    25242557    if (fabs(radius - CircleRadius) < HULLEPSILON) {
    2525       //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;
     2558      //Log() << Verbose(1) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;
    25262559
    25272560      // check SearchDirection
    2528       //Log() << Verbose(2) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
     2561      //Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
    25292562      if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {  // rotated the wrong way!
    25302563        eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are not orthogonal!" << endl;
     
    25352568        for(int i=0;i<NDIM;i++) // store indices of this cell
    25362569        N[i] = LC->n[i];
    2537         //Log() << Verbose(2) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
     2570        //Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
    25382571      } else {
    25392572        eLog() << Verbose(1) << "Vector " << CircleCenter << " is outside of LinkedCell's bounding box." << endl;
     
    25412574      }
    25422575      // then go through the current and all neighbouring cells and check the contained points for possible candidates
    2543       //Log() << Verbose(2) << "LC Intervals:";
     2576      //Log() << Verbose(1) << "LC Intervals:";
    25442577      for (int i=0;i<NDIM;i++) {
    25452578        Nlower[i] = ((N[i]-1) >= 0) ? N[i]-1 : 0;
     
    25522585          for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) {
    25532586            const LinkedNodes *List = LC->GetCurrentCell();
    2554             //Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;
     2587            //Log() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;
    25552588            if (List != NULL) {
    25562589              for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
     
    25582591
    25592592                // check for three unique points
    2560                 //Log() << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " at " << Candidate->node << "." << endl;
    2561                 if ((Candidate != BaseLine->endpoints[0]->node) && (Candidate != BaseLine->endpoints[1]->node) ){
     2593                Log() << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " at " << *(Candidate->node) << "." << endl;
     2594                if ((Candidate != CandidateLine.BaseLine->endpoints[0]->node) && (Candidate != CandidateLine.BaseLine->endpoints[1]->node) ){
    25622595
    25632596                  // construct both new centers
    2564                   GetCenterofCircumcircle(&NewSphereCenter, *BaseLine->endpoints[0]->node->node, *BaseLine->endpoints[1]->node->node, *Candidate->node);
     2597                  GetCenterofCircumcircle(&NewSphereCenter, *CandidateLine.BaseLine->endpoints[0]->node->node, *CandidateLine.BaseLine->endpoints[1]->node->node, *Candidate->node);
    25652598                  OtherNewSphereCenter.CopyVector(&NewSphereCenter);
    25662599
    2567                   if ((NewNormalVector.MakeNormalVector(BaseLine->endpoints[0]->node->node, BaseLine->endpoints[1]->node->node, Candidate->node))
     2600                  if ((NewNormalVector.MakeNormalVector(CandidateLine.BaseLine->endpoints[0]->node->node, CandidateLine.BaseLine->endpoints[1]->node->node, Candidate->node))
    25682601                  && (fabs(NewNormalVector.ScalarProduct(&NewNormalVector)) > HULLEPSILON)
    25692602                  ) {
    25702603                    helper.CopyVector(&NewNormalVector);
    2571                     //Log() << Verbose(2) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl;
    2572                     radius = BaseLine->endpoints[0]->node->node->DistanceSquared(&NewSphereCenter);
     2604                    Log() << Verbose(1) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl;
     2605                    radius = CandidateLine.BaseLine->endpoints[0]->node->node->DistanceSquared(&NewSphereCenter);
    25732606                    if (radius < RADIUS*RADIUS) {
    25742607                      helper.Scale(sqrt(RADIUS*RADIUS - radius));
    2575                       //Log() << Verbose(2) << "INFO: Distance of NewCircleCenter to NewSphereCenter is " << helper.Norm() << " with sphere radius " << RADIUS << "." << endl;
     2608                      Log() << Verbose(2) << "INFO: Distance of NewCircleCenter to NewSphereCenter is " << helper.Norm() << " with sphere radius " << RADIUS << "." << endl;
    25762609                      NewSphereCenter.AddVector(&helper);
    25772610                      NewSphereCenter.SubtractVector(&CircleCenter);
    2578                       //Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl;
     2611                      Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl;
    25792612
    25802613                      // OtherNewSphereCenter is created by the same vector just in the other direction
     
    25822615                      OtherNewSphereCenter.AddVector(&helper);
    25832616                      OtherNewSphereCenter.SubtractVector(&CircleCenter);
    2584                       //Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl;
     2617                      Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl;
    25852618
    25862619                      alpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, NewSphereCenter, OldSphereCenter, NormalVector, SearchDirection);
     
    25892622                      // if there is a better candidate, drop the current list and add the new candidate
    25902623                      // otherwise ignore the new candidate and keep the list
    2591                       if (*ShortestAngle > (alpha - HULLEPSILON)) {
    2592                         optCandidate = new CandidateForTesselation(Candidate, BaseLine, OptCandidateCenter, OtherOptCandidateCenter);
     2624                      if (CandidateLine.ShortestAngle > (alpha - HULLEPSILON)) {
    25932625                        if (fabs(alpha - Otheralpha) > MYEPSILON) {
    2594                           optCandidate->OptCenter.CopyVector(&NewSphereCenter);
    2595                           optCandidate->OtherOptCenter.CopyVector(&OtherNewSphereCenter);
     2626                          CandidateLine.OptCenter.CopyVector(&NewSphereCenter);
     2627                          CandidateLine.OtherOptCenter.CopyVector(&OtherNewSphereCenter);
    25962628                        } else {
    2597                           optCandidate->OptCenter.CopyVector(&OtherNewSphereCenter);
    2598                           optCandidate->OtherOptCenter.CopyVector(&NewSphereCenter);
     2629                          CandidateLine.OptCenter.CopyVector(&OtherNewSphereCenter);
     2630                          CandidateLine.OtherOptCenter.CopyVector(&NewSphereCenter);
    25992631                        }
    26002632                        // if there is an equal candidate, add it to the list without clearing the list
    2601                         if ((*ShortestAngle - HULLEPSILON) < alpha) {
    2602                           candidates->push_back(optCandidate);
    2603                           Log() << Verbose(2) << "ACCEPT: We have found an equally good candidate: " << *(optCandidate->point) << " with "
    2604                             << alpha << " and circumsphere's center at " << optCandidate->OptCenter << "." << endl;
     2633                        if ((CandidateLine.ShortestAngle - HULLEPSILON) < alpha) {
     2634                          CandidateLine.pointlist.push_back(Candidate);
     2635                          Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with "
     2636                            << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl;
    26052637                        } else {
    26062638                          // remove all candidates from the list and then the list itself
    2607                           class CandidateForTesselation *remover = NULL;
    2608                           for (CandidateList::iterator it = candidates->begin(); it != candidates->end(); ++it) {
    2609                             remover = *it;
    2610                             delete(remover);
    2611                           }
    2612                           candidates->clear();
    2613                           candidates->push_back(optCandidate);
    2614                           Log() << Verbose(2) << "ACCEPT: We have found a better candidate: " << *(optCandidate->point) << " with "
    2615                             << alpha << " and circumsphere's center at " << optCandidate->OptCenter << "." << endl;
     2639                          CandidateLine.pointlist.clear();
     2640                          CandidateLine.pointlist.push_back(Candidate);
     2641                          Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with "
     2642                            << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl;
    26162643                        }
    2617                         *ShortestAngle = alpha;
    2618                         //Log() << Verbose(2) << "INFO: There are " << candidates->size() << " candidates in the list now." << endl;
     2644                        CandidateLine.ShortestAngle = alpha;
     2645                        Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl;
    26192646                      } else {
    2620                         if ((optCandidate != NULL) && (optCandidate->point != NULL)) {
    2621                           //Log() << Verbose(2) << "REJECT: Old candidate " << *(optCandidate->point) << " with " << *ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl;
     2647                        if ((Candidate != NULL) && (CandidateLine.pointlist.begin() != CandidateLine.pointlist.end())) {
     2648                          Log() << Verbose(1) << "REJECT: Old candidate " << *(Candidate) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl;
    26222649                        } else {
    2623                           //Log() << Verbose(2) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl;
     2650                          Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl;
    26242651                        }
    26252652                      }
    26262653
    26272654                    } else {
    2628                       //Log() << Verbose(2) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl;
     2655                      Log() << Verbose(1) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl;
    26292656                    }
    26302657                  } else {
    2631                     //Log() << Verbose(2) << "REJECT: Three points from " << *BaseLine << " and Candidate " << *Candidate << " are linear-dependent." << endl;
     2658                    Log() << Verbose(1) << "REJECT: Three points from " << *CandidateLine.BaseLine << " and Candidate " << *Candidate << " are linear-dependent." << endl;
    26322659                  }
    26332660                } else {
    26342661                  if (ThirdNode != NULL) {
    2635                     //Log() << Verbose(2) << "REJECT: Base triangle " << *BaseLine << " and " << *ThirdNode << " contains Candidate " << *Candidate << "." << endl;
     2662                    Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " and " << *ThirdNode << " contains Candidate " << *Candidate << "." << endl;
    26362663                  } else {
    2637                     //Log() << Verbose(2) << "REJECT: Base triangle " << *BaseLine << " contains Candidate " << *Candidate << "." << endl;
     2664                    Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " contains Candidate " << *Candidate << "." << endl;
    26382665                  }
    26392666                }
     
    26462673  } else {
    26472674    if (ThirdNode != NULL)
    2648       Log() << Verbose(2) << "Circumcircle for base line " << *BaseLine << " and third node " << *ThirdNode << " is too big!" << endl;
     2675      Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and third node " << *ThirdNode << " is too big!" << endl;
    26492676    else
    2650       Log() << Verbose(2) << "Circumcircle for base line " << *BaseLine << " is too big!" << endl;
    2651   }
    2652 
    2653   //Log() << Verbose(2) << "INFO: Sorting candidate list ..." << endl;
    2654   if (candidates->size() > 1) {
    2655     candidates->unique();
    2656     candidates->sort(SortCandidates);
    2657   }
    2658 
    2659   Log() << Verbose(1) << "End of FindThirdPointForTesselation" << endl;
     2677      Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " is too big!" << endl;
     2678  }
     2679
     2680  Log() << Verbose(1) << "INFO: Sorting candidate list ..." << endl;
     2681  if (CandidateLine.pointlist.size() > 1) {
     2682    CandidateLine.pointlist.unique();
     2683    CandidateLine.pointlist.sort(); //SortCandidates);
     2684  }
    26602685};
    26612686
     
    26672692class BoundaryPointSet *Tesselation::GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const
    26682693{
     2694        Info FunctionInfo(__func__);
    26692695  const BoundaryLineSet * lines[2] = { line1, line2 };
    26702696  class BoundaryPointSet *node = NULL;
     
    26802706          { // if insertion fails, we have common endpoint
    26812707            node = OrderTest.first->second;
    2682             Log() << Verbose(5) << "Common endpoint of lines " << *line1
     2708            Log() << Verbose(1) << "Common endpoint of lines " << *line1
    26832709                << " and " << *line2 << " is: " << *node << "." << endl;
    26842710            j = 2;
     
    26972723list<BoundaryTriangleSet*> * Tesselation::FindClosestTrianglesToPoint(const Vector *x, const LinkedCell* LC) const
    26982724{
     2725        Info FunctionInfo(__func__);
    26992726  TesselPoint *trianglePoints[3];
    27002727  TesselPoint *SecondPoint = NULL;
     
    27022729
    27032730  if (LinesOnBoundary.empty()) {
    2704     Log() << Verbose(0) << "Error: There is no tesselation structure to compare the point with, please create one first.";
     2731    eLog() << Verbose(1) << "Error: There is no tesselation structure to compare the point with, please create one first.";
    27052732    return NULL;
    27062733  }
     
    27102737  // check whether closest point is "too close" :), then it's inside
    27112738  if (trianglePoints[0] == NULL) {
    2712     Log() << Verbose(2) << "Is the only point, no one else is closeby." << endl;
     2739    Log() << Verbose(0) << "Is the only point, no one else is closeby." << endl;
    27132740    return NULL;
    27142741  }
    27152742  if (trianglePoints[0]->node->DistanceSquared(x) < MYEPSILON) {
    2716     Log() << Verbose(3) << "Point is right on a tesselation point, no nearest triangle." << endl;
     2743    Log() << Verbose(1) << "Point is right on a tesselation point, no nearest triangle." << endl;
    27172744    PointMap::const_iterator PointRunner = PointsOnBoundary.find(trianglePoints[0]->nr);
    27182745    triangles = new list<BoundaryTriangleSet*>;
     
    27462773          eLog() << Verbose(1) << "IsInnerPoint encounters serious error, point " << i << " not found." << endl;
    27472774        }
    2748         //Log() << Verbose(2) << "List of triangle points:" << endl;
    2749         //Log() << Verbose(3) << *trianglePoints[i] << endl;
     2775        //Log() << Verbose(1) << "List of triangle points:" << endl;
     2776        //Log() << Verbose(2) << *trianglePoints[i] << endl;
    27502777      }
    27512778
    27522779      triangles = FindTriangles(trianglePoints);
    2753       Log() << Verbose(2) << "List of possible triangles:" << endl;
     2780      Log() << Verbose(1) << "List of possible triangles:" << endl;
    27542781      for(list<BoundaryTriangleSet*>::iterator Runner = triangles->begin(); Runner != triangles->end(); Runner++)
    2755         Log() << Verbose(3) << **Runner << endl;
     2782        Log() << Verbose(2) << **Runner << endl;
    27562783
    27572784      delete(connectedClosestPoints);
    27582785    } else {
    27592786      triangles = NULL;
    2760       Log() << Verbose(1) << "There is no circle of connected points!" << endl;
     2787      eLog() << Verbose(2) << "There is no circle of connected points!" << endl;
    27612788    }
    27622789  }
     
    27782805class BoundaryTriangleSet * Tesselation::FindClosestTriangleToPoint(const Vector *x, const LinkedCell* LC) const
    27792806{
     2807        Info FunctionInfo(__func__);
    27802808  class BoundaryTriangleSet *result = NULL;
    27812809  list<BoundaryTriangleSet*> *triangles = FindClosestTrianglesToPoint(x, LC);
     
    27872815  if (triangles->size() == 1) { // there is no degenerate case
    27882816    result = triangles->front();
    2789     Log() << Verbose(2) << "Normal Vector of this triangle is " << result->NormalVector << "." << endl;
     2817    Log() << Verbose(1) << "Normal Vector of this triangle is " << result->NormalVector << "." << endl;
    27902818  } else {
    27912819    result = triangles->front();
    27922820    result->GetCenter(&Center);
    27932821    Center.SubtractVector(x);
    2794     Log() << Verbose(2) << "Normal Vector of this front side is " << result->NormalVector << "." << endl;
     2822    Log() << Verbose(1) << "Normal Vector of this front side is " << result->NormalVector << "." << endl;
    27952823    if (Center.ScalarProduct(&result->NormalVector) < 0) {
    27962824      result = triangles->back();
    2797       Log() << Verbose(2) << "Normal Vector of this back side is " << result->NormalVector << "." << endl;
     2825      Log() << Verbose(1) << "Normal Vector of this back side is " << result->NormalVector << "." << endl;
    27982826      if (Center.ScalarProduct(&result->NormalVector) < 0) {
    27992827        eLog() << Verbose(1) << "Front and back side yield NormalVector in wrong direction!" << endl;
     
    28142842bool Tesselation::IsInnerPoint(const Vector &Point, const LinkedCell* const LC) const
    28152843{
     2844        Info FunctionInfo(__func__);
    28162845  class BoundaryTriangleSet *result = FindClosestTriangleToPoint(&Point, LC);
    28172846  Vector Center;
     
    28232852
    28242853  result->GetCenter(&Center);
    2825   Log() << Verbose(3) << "INFO: Central point of the triangle is " << Center << "." << endl;
     2854  Log() << Verbose(2) << "INFO: Central point of the triangle is " << Center << "." << endl;
    28262855  Center.SubtractVector(&Point);
    2827   Log() << Verbose(3) << "INFO: Vector from center to point to test is " << Center << "." << endl;
     2856  Log() << Verbose(2) << "INFO: Vector from center to point to test is " << Center << "." << endl;
    28282857  if (Center.ScalarProduct(&result->NormalVector) > -MYEPSILON) {
    28292858    Log() << Verbose(1) << Point << " is an inner point." << endl;
     
    28442873bool Tesselation::IsInnerPoint(const TesselPoint * const Point, const LinkedCell* const LC) const
    28452874{
     2875        Info FunctionInfo(__func__);
    28462876  return IsInnerPoint(*(Point->node), LC);
    28472877}
     
    28552885set<TesselPoint*> * Tesselation::GetAllConnectedPoints(const TesselPoint* const Point) const
    28562886{
     2887        Info FunctionInfo(__func__);
    28572888  set<TesselPoint*> *connectedPoints = new set<TesselPoint*>;
    28582889  class BoundaryPointSet *ReferencePoint = NULL;
    28592890  TesselPoint* current;
    28602891  bool takePoint = false;
    2861 
    2862   Log() << Verbose(3) << "Begin of GetAllConnectedPoints" << endl;
    28632892
    28642893  // find the respective boundary point
     
    28672896    ReferencePoint = PointRunner->second;
    28682897  } else {
    2869     Log() << Verbose(2) << "GetAllConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl;
     2898    eLog() << Verbose(2) << "GetAllConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl;
    28702899    ReferencePoint = NULL;
    28712900  }
     
    28912920
    28922921   if (takePoint) {
    2893      Log() << Verbose(5) << "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted." << endl;
     2922     Log() << Verbose(1) << "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted." << endl;
    28942923     connectedPoints->insert(current);
    28952924   }
     
    29032932  }
    29042933
    2905   Log() << Verbose(3) << "End of GetAllConnectedPoints" << endl;
    29062934  return connectedPoints;
    29072935};
     
    29212949list<TesselPoint*> * Tesselation::GetCircleOfConnectedPoints(const TesselPoint* const Point, const Vector * const Reference) const
    29222950{
     2951        Info FunctionInfo(__func__);
    29232952  map<double, TesselPoint*> anglesOfPoints;
    29242953  set<TesselPoint*> *connectedPoints = GetAllConnectedPoints(Point);
     
    29312960
    29322961  if (connectedPoints == NULL) {
    2933     Log() << Verbose(2) << "Could not find any connected points!" << endl;
     2962    eLog() << Verbose(2) << "Could not find any connected points!" << endl;
    29342963    delete(connectedCircle);
    29352964    return NULL;
    29362965  }
    2937   Log() << Verbose(2) << "Begin of GetCircleOfConnectedPoints" << endl;
    29382966
    29392967  // calculate central point
     
    29432971  //  << "; scale factor " << 1.0/connectedPoints.size();
    29442972  center.Scale(1.0/connectedPoints->size());
    2945   Log() << Verbose(4) << "INFO: Calculated center of all circle points is " << center << "." << endl;
     2973  Log() << Verbose(1) << "INFO: Calculated center of all circle points is " << center << "." << endl;
    29462974
    29472975  // projection plane of the circle is at the closes Point and normal is pointing away from center of all circle points
     
    29492977  PlaneNormal.SubtractVector(&center);
    29502978  PlaneNormal.Normalize();
    2951   Log() << Verbose(4) << "INFO: Calculated plane normal of circle is " << PlaneNormal << "." << endl;
     2979  Log() << Verbose(1) << "INFO: Calculated plane normal of circle is " << PlaneNormal << "." << endl;
    29522980
    29532981  // construct one orthogonal vector
     
    29582986  }
    29592987  if ((Reference == NULL) || (AngleZero.NormSquared() < MYEPSILON )) {
    2960     Log() << Verbose(4) << "Using alternatively " << *(*connectedPoints->begin())->node << " as angle 0 referencer." << endl;
     2988    Log() << Verbose(1) << "Using alternatively " << *(*connectedPoints->begin())->node << " as angle 0 referencer." << endl;
    29612989    AngleZero.CopyVector((*connectedPoints->begin())->node);
    29622990    AngleZero.SubtractVector(Point->node);
     
    29672995    }
    29682996  }
    2969   Log() << Verbose(4) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl;
     2997  Log() << Verbose(1) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl;
    29702998  if (AngleZero.NormSquared() > MYEPSILON)
    29712999    OrthogonalVector.MakeNormalVector(&PlaneNormal, &AngleZero);
    29723000  else
    29733001    OrthogonalVector.MakeNormalVector(&PlaneNormal);
    2974   Log() << Verbose(4) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl;
     3002  Log() << Verbose(1) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl;
    29753003
    29763004  // go through all connected points and calculate angle
     
    29803008    helper.ProjectOntoPlane(&PlaneNormal);
    29813009    double angle = GetAngle(helper, AngleZero, OrthogonalVector);
    2982     Log() << Verbose(3) << "INFO: Calculated angle is " << angle << " for point " << **listRunner << "." << endl;
     3010    Log() << Verbose(0) << "INFO: Calculated angle is " << angle << " for point " << **listRunner << "." << endl;
    29833011    anglesOfPoints.insert(pair<double, TesselPoint*>(angle, (*listRunner)));
    29843012  }
     
    29893017
    29903018  delete(connectedPoints);
    2991 
    2992   Log() << Verbose(2) << "End of GetCircleOfConnectedPoints" << endl;
    29933019
    29943020  return connectedCircle;
     
    30033029list<list<TesselPoint*> *> * Tesselation::GetPathsOfConnectedPoints(const TesselPoint* const Point) const
    30043030{
     3031        Info FunctionInfo(__func__);
    30053032  map<double, TesselPoint*> anglesOfPoints;
    30063033  list<list<TesselPoint*> *> *ListOfPaths = new list<list<TesselPoint*> *>;
     
    30473074        StartLine = CurrentLine;
    30483075        CurrentPoint = CurrentLine->GetOtherEndpoint(ReferencePoint);
    3049         Log() << Verbose(3)<< "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "." << endl;
     3076        Log() << Verbose(1)<< "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "." << endl;
    30503077        do {
    30513078          // push current one
    3052           Log() << Verbose(3) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;
     3079          Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;
    30533080          connectedPath->push_back(CurrentPoint->node);
    30543081
    30553082          // find next triangle
    30563083          for (TriangleMap::iterator Runner = CurrentLine->triangles.begin(); Runner != CurrentLine->triangles.end(); Runner++) {
    3057             Log() << Verbose(3) << "INFO: Inspecting triangle " << *Runner->second << "." << endl;
     3084            Log() << Verbose(1) << "INFO: Inspecting triangle " << *Runner->second << "." << endl;
    30583085            if ((Runner->second != triangle)) { // look for first triangle not equal to old one
    30593086              triangle = Runner->second;
     
    30623089                if (!TriangleRunner->second) {
    30633090                  TriangleRunner->second = true;
    3064                   Log() << Verbose(3) << "INFO: Connecting triangle is " << *triangle << "." << endl;
     3091                  Log() << Verbose(1) << "INFO: Connecting triangle is " << *triangle << "." << endl;
    30653092                  break;
    30663093                } else {
    3067                   Log() << Verbose(3) << "INFO: Skipping " << *triangle << ", as we have already visited it." << endl;
     3094                  Log() << Verbose(1) << "INFO: Skipping " << *triangle << ", as we have already visited it." << endl;
    30683095                  triangle = NULL;
    30693096                }
     
    30803107            if ((triangle->lines[i] != CurrentLine) && (triangle->lines[i]->ContainsBoundaryPoint(ReferencePoint))) { // not the current line and still containing Point
    30813108              CurrentLine = triangle->lines[i];
    3082               Log() << Verbose(3) << "INFO: Connecting line is " << *CurrentLine << "." << endl;
     3109              Log() << Verbose(1) << "INFO: Connecting line is " << *CurrentLine << "." << endl;
    30833110              break;
    30843111            }
     
    30943121        } while (CurrentLine != StartLine);
    30953122        // last point is missing, as it's on start line
    3096         Log() << Verbose(3) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;
     3123        Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;
    30973124        if (StartLine->GetOtherEndpoint(ReferencePoint)->node != connectedPath->back())
    30983125          connectedPath->push_back(StartLine->GetOtherEndpoint(ReferencePoint)->node);
     
    31003127        ListOfPaths->push_back(connectedPath);
    31013128      } else {
    3102         Log() << Verbose(3) << "INFO: Skipping " << *runner->second << ", as we have already visited it." << endl;
     3129        Log() << Verbose(1) << "INFO: Skipping " << *runner->second << ", as we have already visited it." << endl;
    31033130      }
    31043131    }
     
    31183145list<list<TesselPoint*> *> * Tesselation::GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const
    31193146{
     3147        Info FunctionInfo(__func__);
    31203148  list<list<TesselPoint*> *> *ListofPaths = GetPathsOfConnectedPoints(Point);
    31213149  list<list<TesselPoint*> *> *ListofClosedPaths = new list<list<TesselPoint*> *>;
     
    31313159    connectedPath = *ListRunner;
    31323160
    3133     Log() << Verbose(2) << "INFO: Current path is " << connectedPath << "." << endl;
     3161    Log() << Verbose(1) << "INFO: Current path is " << connectedPath << "." << endl;
    31343162
    31353163    // go through list, look for reappearance of starting Point and count
     
    31413169      if ((*CircleRunner == *CircleStart) && (CircleRunner != CircleStart)) { // is not the very first point
    31423170        // we have a closed circle from Marker to new Marker
    3143         Log() << Verbose(3) << count+1 << ". closed path consists of: ";
     3171        Log() << Verbose(1) << count+1 << ". closed path consists of: ";
    31443172        newPath = new list<TesselPoint*>;
    31453173        list<TesselPoint*>::iterator CircleSprinter = Marker;
     
    31573185    }
    31583186  }
    3159   Log() << Verbose(3) << "INFO: " << count << " closed additional path(s) have been created." << endl;
     3187  Log() << Verbose(1) << "INFO: " << count << " closed additional path(s) have been created." << endl;
    31603188
    31613189  // delete list of paths
     
    31793207set<BoundaryTriangleSet*> *Tesselation::GetAllTriangles(const BoundaryPointSet * const Point) const
    31803208{
     3209        Info FunctionInfo(__func__);
    31813210  set<BoundaryTriangleSet*> *connectedTriangles = new set<BoundaryTriangleSet*>;
    31823211
     
    32173246    return 0.;
    32183247  } else
    3219     Log() << Verbose(2) << "Removing point " << *point << " from tesselated boundary ..." << endl;
     3248    Log() << Verbose(0) << "Removing point " << *point << " from tesselated boundary ..." << endl;
    32203249
    32213250  // copy old location for the volume
     
    32473276  NormalVector.Zero();
    32483277  for (map<class BoundaryTriangleSet *, int>::iterator Runner = Candidates.begin(); Runner != Candidates.end(); Runner++) {
    3249     Log() << Verbose(3) << "INFO: Removing triangle " << *(Runner->first) << "." << endl;
     3278    Log() << Verbose(1) << "INFO: Removing triangle " << *(Runner->first) << "." << endl;
    32503279    NormalVector.SubtractVector(&Runner->first->NormalVector); // has to point inward
    32513280    RemoveTesselationTriangle(Runner->first);
     
    32773306        smallestangle = 0.;
    32783307        for (MiddleNode = connectedPath->begin(); MiddleNode != connectedPath->end(); MiddleNode++) {
    3279           Log() << Verbose(3) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;
     3308          Log() << Verbose(1) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;
    32803309          // construct vectors to next and previous neighbour
    32813310          StartNode = MiddleNode;
     
    33053334        MiddleNode = EndNode;
    33063335        if (MiddleNode == connectedPath->end()) {
    3307           Log() << Verbose(1) << "CRITICAL: Could not find a smallest angle!" << endl;
    3308           exit(255);
     3336          eLog() << Verbose(0) << "CRITICAL: Could not find a smallest angle!" << endl;
     3337          performCriticalExit();
    33093338        }
    33103339        StartNode = MiddleNode;
     
    33153344        if (EndNode == connectedPath->end())
    33163345          EndNode = connectedPath->begin();
    3317         Log() << Verbose(4) << "INFO: StartNode is " << **StartNode << "." << endl;
    3318         Log() << Verbose(4) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;
    3319         Log() << Verbose(4) << "INFO: EndNode is " << **EndNode << "." << endl;
    3320         Log() << Verbose(3) << "INFO: Attempting to create triangle " << (*StartNode)->Name << ", " << (*MiddleNode)->Name << " and " << (*EndNode)->Name << "." << endl;
     3346        Log() << Verbose(2) << "INFO: StartNode is " << **StartNode << "." << endl;
     3347        Log() << Verbose(2) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;
     3348        Log() << Verbose(2) << "INFO: EndNode is " << **EndNode << "." << endl;
     3349        Log() << Verbose(1) << "INFO: Attempting to create triangle " << (*StartNode)->Name << ", " << (*MiddleNode)->Name << " and " << (*EndNode)->Name << "." << endl;
    33213350        TriangleCandidates[0] = *StartNode;
    33223351        TriangleCandidates[1] = *MiddleNode;
     
    33243353        triangle = GetPresentTriangle(TriangleCandidates);
    33253354        if (triangle != NULL) {
    3326           eLog() << Verbose(2) << "New triangle already present, skipping!" << endl;
     3355          eLog() << Verbose(0) << "New triangle already present, skipping!" << endl;
    33273356          StartNode++;
    33283357          MiddleNode++;
     
    33363365          continue;
    33373366        }
    3338         Log() << Verbose(5) << "Adding new triangle points."<< endl;
     3367        Log() << Verbose(3) << "Adding new triangle points."<< endl;
    33393368        AddTesselationPoint(*StartNode, 0);
    33403369        AddTesselationPoint(*MiddleNode, 1);
    33413370        AddTesselationPoint(*EndNode, 2);
    3342         Log() << Verbose(5) << "Adding new triangle lines."<< endl;
     3371        Log() << Verbose(3) << "Adding new triangle lines."<< endl;
    33433372        AddTesselationLine(TPS[0], TPS[1], 0);
    33443373        AddTesselationLine(TPS[0], TPS[2], 1);
     
    33553384        // prepare nodes for next triangle
    33563385        StartNode = EndNode;
    3357         Log() << Verbose(4) << "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "." << endl;
     3386        Log() << Verbose(2) << "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "." << endl;
    33583387        connectedPath->remove(*MiddleNode); // remove the middle node (it is surrounded by triangles)
    33593388        if (connectedPath->size() == 2) { // we are done
     
    33623391          break;
    33633392        } else if (connectedPath->size() < 2) { // something's gone wrong!
    3364           Log() << Verbose(1) << "CRITICAL: There are only two endpoints left!" << endl;
    3365           exit(255);
     3393          eLog() << Verbose(0) << "CRITICAL: There are only two endpoints left!" << endl;
     3394          performCriticalExit();
    33663395        } else {
    33673396          MiddleNode = StartNode;
     
    33913420          if (maxgain != 0) {
    33923421            volume += maxgain;
    3393             Log() << Verbose(3) << "Flipping baseline with highest volume" << **Candidate << "." << endl;
     3422            Log() << Verbose(1) << "Flipping baseline with highest volume" << **Candidate << "." << endl;
    33943423            OtherBase = FlipBaseline(*Candidate);
    33953424            NewLines.erase(Candidate);
     
    34023431      delete(connectedPath);
    34033432    }
    3404     Log() << Verbose(1) << count << " triangles were created." << endl;
     3433    Log() << Verbose(0) << count << " triangles were created." << endl;
    34053434  } else {
    34063435    while (!ListOfClosedPaths->empty()) {
     
    34103439      delete(connectedPath);
    34113440    }
    3412     Log() << Verbose(1) << "No need to create any triangles." << endl;
     3441    Log() << Verbose(0) << "No need to create any triangles." << endl;
    34133442  }
    34143443  delete(ListOfClosedPaths);
    34153444
    3416   Log() << Verbose(1) << "Removed volume is " << volume << "." << endl;
     3445  Log() << Verbose(0) << "Removed volume is " << volume << "." << endl;
    34173446
    34183447  return volume;
     
    34313460list<BoundaryTriangleSet*> *Tesselation::FindTriangles(const TesselPoint* const Points[3]) const
    34323461{
     3462        Info FunctionInfo(__func__);
    34333463  list<BoundaryTriangleSet*> *result = new list<BoundaryTriangleSet*>;
    34343464  LineMap::const_iterator FindLine;
     
    34793509map<int, int> * Tesselation::FindAllDegeneratedLines()
    34803510{
     3511        Info FunctionInfo(__func__);
    34813512  map<int, class BoundaryLineSet *> AllLines;
    34823513  map<int, int> * DegeneratedLines = new map<int, int>;
     
    34843515  // sanity check
    34853516  if (LinesOnBoundary.empty()) {
    3486     Log() << Verbose(1) << "Warning: FindAllDegeneratedTriangles() was called without any tesselation structure.";
     3517    eLog() << Verbose(2) << "FindAllDegeneratedTriangles() was called without any tesselation structure.";
    34873518    return DegeneratedLines;
    34883519  }
     
    35003531  AllLines.clear();
    35013532
    3502   Log() << Verbose(1) << "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines." << endl;
     3533  Log() << Verbose(0) << "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines." << endl;
    35033534  map<int,int>::iterator it;
    35043535  for (it = DegeneratedLines->begin(); it != DegeneratedLines->end(); it++)
    3505       Log() << Verbose(2) << (*it).first << " => " << (*it).second << endl;
     3536      Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl;
    35063537
    35073538  return DegeneratedLines;
     
    35163547map<int, int> * Tesselation::FindAllDegeneratedTriangles()
    35173548{
     3549        Info FunctionInfo(__func__);
    35183550  map<int, int> * DegeneratedLines = FindAllDegeneratedLines();
    35193551  map<int, int> * DegeneratedTriangles = new map<int, int>;
     
    35433575  delete(DegeneratedLines);
    35443576
    3545   Log() << Verbose(1) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl;
     3577  Log() << Verbose(0) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl;
    35463578  map<int,int>::iterator it;
    35473579  for (it = DegeneratedTriangles->begin(); it != DegeneratedTriangles->end(); it++)
    3548       Log() << Verbose(2) << (*it).first << " => " << (*it).second << endl;
     3580      Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl;
    35493581
    35503582  return DegeneratedTriangles;
     
    35573589void Tesselation::RemoveDegeneratedTriangles()
    35583590{
     3591        Info FunctionInfo(__func__);
    35593592  map<int, int> * DegeneratedTriangles = FindAllDegeneratedTriangles();
    35603593  TriangleMap::iterator finder;
    35613594  BoundaryTriangleSet *triangle = NULL, *partnerTriangle = NULL;
    35623595  int count  = 0;
    3563 
    3564   Log() << Verbose(1) << "Begin of RemoveDegeneratedTriangles" << endl;
    35653596
    35663597  for (map<int, int>::iterator TriangleKeyRunner = DegeneratedTriangles->begin();
     
    36213652      // erase the pair
    36223653      count += (int) DegeneratedTriangles->erase(triangle->Nr);
    3623       Log() << Verbose(1) << "RemoveDegeneratedTriangles() removes triangle " << *triangle << "." << endl;
     3654      Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *triangle << "." << endl;
    36243655      RemoveTesselationTriangle(triangle);
    36253656      count += (int) DegeneratedTriangles->erase(partnerTriangle->Nr);
    3626       Log() << Verbose(1) << "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "." << endl;
     3657      Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "." << endl;
    36273658      RemoveTesselationTriangle(partnerTriangle);
    36283659    } else {
    3629       Log() << Verbose(1) << "RemoveDegeneratedTriangles() does not remove triangle " << *triangle
     3660      Log() << Verbose(0) << "RemoveDegeneratedTriangles() does not remove triangle " << *triangle
    36303661        << " and its partner " << *partnerTriangle << " because it is essential for at"
    36313662        << " least one of the endpoints to be kept in the tesselation structure." << endl;
     
    36363667    LastTriangle = NULL;
    36373668
    3638   Log() << Verbose(1) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl;
    3639   Log() << Verbose(1) << "End of RemoveDegeneratedTriangles" << endl;
     3669  Log() << Verbose(0) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl;
    36403670}
    36413671
     
    36503680void Tesselation::AddBoundaryPointByDegeneratedTriangle(class TesselPoint *point, LinkedCell *LC)
    36513681{
    3652   Log() << Verbose(2) << "Begin of AddBoundaryPointByDegeneratedTriangle" << endl;
    3653 
     3682        Info FunctionInfo(__func__);
    36543683  // find nearest boundary point
    36553684  class TesselPoint *BackupPoint = NULL;
     
    36673696    return;
    36683697  }
    3669   Log() << Verbose(2) << "Nearest point on boundary is " << NearestPoint->Name << "." << endl;
     3698  Log() << Verbose(0) << "Nearest point on boundary is " << NearestPoint->Name << "." << endl;
    36703699
    36713700  // go through its lines and find the best one to split
     
    37003729
    37013730  // create new triangle to connect point (connects automatically with the missing spot of the chosen line)
    3702   Log() << Verbose(5) << "Adding new triangle points."<< endl;
     3731  Log() << Verbose(2) << "Adding new triangle points."<< endl;
    37033732  AddTesselationPoint((BestLine->endpoints[0]->node), 0);
    37043733  AddTesselationPoint((BestLine->endpoints[1]->node), 1);
    37053734  AddTesselationPoint(point, 2);
    3706   Log() << Verbose(5) << "Adding new triangle lines."<< endl;
     3735  Log() << Verbose(2) << "Adding new triangle lines."<< endl;
    37073736  AddTesselationLine(TPS[0], TPS[1], 0);
    37083737  AddTesselationLine(TPS[0], TPS[2], 1);
     
    37113740  BTS->GetNormalVector(TempTriangle->NormalVector);
    37123741  BTS->NormalVector.Scale(-1.);
    3713   Log() << Verbose(3) << "INFO: NormalVector of new triangle is " << BTS->NormalVector << "." << endl;
     3742  Log() << Verbose(1) << "INFO: NormalVector of new triangle is " << BTS->NormalVector << "." << endl;
    37143743  AddTesselationTriangle();
    37153744
    37163745  // create other side of this triangle and close both new sides of the first created triangle
    3717   Log() << Verbose(5) << "Adding new triangle points."<< endl;
     3746  Log() << Verbose(2) << "Adding new triangle points."<< endl;
    37183747  AddTesselationPoint((BestLine->endpoints[0]->node), 0);
    37193748  AddTesselationPoint((BestLine->endpoints[1]->node), 1);
    37203749  AddTesselationPoint(point, 2);
    3721   Log() << Verbose(5) << "Adding new triangle lines."<< endl;
     3750  Log() << Verbose(2) << "Adding new triangle lines."<< endl;
    37223751  AddTesselationLine(TPS[0], TPS[1], 0);
    37233752  AddTesselationLine(TPS[0], TPS[2], 1);
     
    37253754  BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
    37263755  BTS->GetNormalVector(TempTriangle->NormalVector);
    3727   Log() << Verbose(3) << "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "." << endl;
     3756  Log() << Verbose(1) << "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "." << endl;
    37283757  AddTesselationTriangle();
    37293758
     
    37323761    if ((BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[0])) && (BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[1]))) {
    37333762      if (BestLine == BTS->lines[i]){
    3734         Log() << Verbose(1) << "CRITICAL: BestLine is same as found line, something's wrong here!" << endl;
    3735         exit(255);
     3763        eLog() << Verbose(0) << "BestLine is same as found line, something's wrong here!" << endl;
     3764        performCriticalExit();
    37363765      }
    37373766      BTS->lines[i]->triangles.insert( pair<int, class BoundaryTriangleSet *> (TempTriangle->Nr, TempTriangle) );
     
    37403769    }
    37413770  }
    3742 
    3743   // exit
    3744   Log() << Verbose(2) << "End of AddBoundaryPointByDegeneratedTriangle" << endl;
    37453771};
    37463772
     
    37523778void Tesselation::Output(const char *filename, const PointCloud * const cloud)
    37533779{
     3780        Info FunctionInfo(__func__);
    37543781  ofstream *tempstream = NULL;
    37553782  string NameofTempFile;
     
    37643791      NameofTempFile.erase(npos, 1);
    37653792      NameofTempFile.append(TecplotSuffix);
    3766       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";
    37673794      tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc);
    37683795      WriteTecplotFile(tempstream, this, cloud, TriangleFilesWritten);
     
    37783805      NameofTempFile.erase(npos, 1);
    37793806      NameofTempFile.append(Raster3DSuffix);
    3780       Log() << Verbose(1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";
     3807      Log() << Verbose(0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";
    37813808      tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc);
    37823809      WriteRaster3dFile(tempstream, this, cloud);
  • src/tesselation.hpp

    r8725ed rf67b6e  
    6565#define DistanceMultiMap multimap <double, pair < PointMap::iterator, PointMap::iterator> >
    6666#define DistanceMultiMapPair pair <double, pair < PointMap::iterator, PointMap::iterator> >
     67
     68#define TesselPointList list <TesselPoint *>
    6769
    6870/********************************************** declarations *******************************/
     
    192194  ~CandidateForTesselation();
    193195
    194   TesselPoint *point;
     196  TesselPointList pointlist;
    195197  BoundaryLineSet *BaseLine;
    196198  Vector OptCenter;
     
    218220    void AddTesselationTriangle();
    219221    void AddTesselationTriangle(const int nr);
    220     void AddCandidateTriangle(CandidateForTesselation &CandidateLine);
     222    void AddCandidateTriangle(CandidateForTesselation CandidateLine);
    221223    void RemoveTesselationTriangle(class BoundaryTriangleSet *triangle);
    222224    void RemoveTesselationLine(class BoundaryLineSet *line);
     
    227229    void FindStartingTriangle(const double RADIUS, const LinkedCell *LC);
    228230    void FindSecondPointForTesselation(class TesselPoint* a, Vector Oben, class TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell *LC);
    229     void FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, class BoundaryLineSet *BaseLine, const class TesselPoint * const ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, const LinkedCell *LC) const;
     231    void FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, CandidateForTesselation &CandidateLine, const class TesselPoint  * const ThirdNode, const double RADIUS, const LinkedCell *LC) const;
    230232    bool FindNextSuitableTriangle(CandidateForTesselation &CandidateLine, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC);
    231233    int CheckPresenceOfTriangle(class TesselPoint *Candidates[3]) const;
     
    296298    mutable PointMap::const_iterator InternalPointer;
    297299
    298     bool HasOtherBaselineBetterCandidate(const BoundaryLineSet * const BaseRay, const TesselPoint * const OptCandidate, double ShortestAngle, double RADIUS, const LinkedCell * const LC) const;
     300    //bool HasOtherBaselineBetterCandidate(const BoundaryLineSet * const BaseRay, const TesselPoint * const OptCandidate, double ShortestAngle, double RADIUS, const LinkedCell * const LC) const;
    299301};
    300302
  • src/tesselationhelpers.cpp

    r8725ed rf67b6e  
    88#include <fstream>
    99
     10#include "info.hpp"
    1011#include "linkedcell.hpp"
    1112#include "log.hpp"
     
    1516#include "verbose.hpp"
    1617
    17 double DetGet(gsl_matrix * const A, const int inPlace) {
     18double DetGet(gsl_matrix * const A, const int inPlace)
     19{
     20        Info FunctionInfo(__func__);
    1821  /*
    1922  inPlace = 1 => A is replaced with the LU decomposed copy.
     
    4548void GetSphere(Vector * const center, const Vector &a, const Vector &b, const Vector &c, const double RADIUS)
    4649{
     50        Info FunctionInfo(__func__);
    4751  gsl_matrix *A = gsl_matrix_calloc(3,3);
    4852  double m11, m12, m13, m14;
     
    111115    const double HalfplaneIndicator, const double AlternativeIndicator, const double alpha, const double beta, const double gamma, const double RADIUS, const double Umkreisradius)
    112116{
     117        Info FunctionInfo(__func__);
    113118  Vector TempNormal, helper;
    114119  double Restradius;
    115120  Vector OtherCenter;
    116   Log() << Verbose(3) << "Begin of GetCenterOfSphere.\n";
    117121  Center->Zero();
    118122  helper.CopyVector(&a);
     
    128132  Center->Scale(1./(sin(2.*alpha) + sin(2.*beta) + sin(2.*gamma)));
    129133  NewUmkreismittelpunkt->CopyVector(Center);
    130   Log() << Verbose(4) << "Center of new circumference is " << *NewUmkreismittelpunkt << ".\n";
     134  Log() << Verbose(1) << "Center of new circumference is " << *NewUmkreismittelpunkt << ".\n";
    131135  // Here we calculated center of circumscribing circle, using barycentric coordinates
    132   Log() << Verbose(4) << "Center of circumference is " << *Center << " in direction " << *Direction << ".\n";
     136  Log() << Verbose(1) << "Center of circumference is " << *Center << " in direction " << *Direction << ".\n";
    133137
    134138  TempNormal.CopyVector(&a);
     
    154158  TempNormal.Normalize();
    155159  Restradius = sqrt(RADIUS*RADIUS - Umkreisradius*Umkreisradius);
    156   Log() << Verbose(4) << "Height of center of circumference to center of sphere is " << Restradius << ".\n";
     160  Log() << Verbose(1) << "Height of center of circumference to center of sphere is " << Restradius << ".\n";
    157161  TempNormal.Scale(Restradius);
    158   Log() << Verbose(4) << "Shift vector to sphere of circumference is " << TempNormal << ".\n";
     162  Log() << Verbose(1) << "Shift vector to sphere of circumference is " << TempNormal << ".\n";
    159163
    160164  Center->AddVector(&TempNormal);
    161   Log() << Verbose(0) << "Center of sphere of circumference is " << *Center << ".\n";
     165  Log() << Verbose(1) << "Center of sphere of circumference is " << *Center << ".\n";
    162166  GetSphere(&OtherCenter, a, b, c, RADIUS);
    163   Log() << Verbose(0) << "OtherCenter of sphere of circumference is " << OtherCenter << ".\n";
    164   Log() << Verbose(3) << "End of GetCenterOfSphere.\n";
     167  Log() << Verbose(1) << "OtherCenter of sphere of circumference is " << OtherCenter << ".\n";
    165168};
    166169
     
    174177void GetCenterofCircumcircle(Vector * const Center, const Vector &a, const Vector &b, const Vector &c)
    175178{
     179        Info FunctionInfo(__func__);
    176180  Vector helper;
    177181  double alpha, beta, gamma;
     
    186190  beta = M_PI - SideC.Angle(&SideA);
    187191  gamma = M_PI - SideA.Angle(&SideB);
    188   //Log() << Verbose(3) << "INFO: alpha = " << alpha/M_PI*180. << ", beta = " << beta/M_PI*180. << ", gamma = " << gamma/M_PI*180. << "." << endl;
     192  //Log() << Verbose(1) << "INFO: alpha = " << alpha/M_PI*180. << ", beta = " << beta/M_PI*180. << ", gamma = " << gamma/M_PI*180. << "." << endl;
    189193  if (fabs(M_PI - alpha - beta - gamma) > HULLEPSILON) {
    190194    eLog() << Verbose(1) << "GetCenterofCircumcircle: Sum of angles " << (alpha+beta+gamma)/M_PI*180. << " > 180 degrees by " << fabs(M_PI - alpha - beta - gamma)/M_PI*180. << "!" << endl;
     
    219223double GetPathLengthonCircumCircle(const Vector &CircleCenter, const Vector &CirclePlaneNormal, const double CircleRadius, const Vector &NewSphereCenter, const Vector &OldSphereCenter, const Vector &NormalVector, const Vector &SearchDirection)
    220224{
     225        Info FunctionInfo(__func__);
    221226  Vector helper;
    222227  double radius, alpha;
     
    236241  if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)  // acos is not unique on [0, 2.*M_PI), hence extra check to decide between two half intervals
    237242    alpha = 2.*M_PI - alpha;
    238   //Log() << Verbose(2) << "INFO: RelativeNewSphereCenter is " << helper << ", RelativeOldSphereCenter is " << OldSphereCenter << " and resulting angle is " << alpha << "." << endl;
     243  //Log() << Verbose(1) << "INFO: RelativeNewSphereCenter is " << helper << ", RelativeOldSphereCenter is " << OldSphereCenter << " and resulting angle is " << alpha << "." << endl;
    239244  radius = helper.Distance(&OldSphereCenter);
    240245  helper.ProjectOntoPlane(&NormalVector);
    241246  // check whether new center is somewhat away or at least right over the current baseline to prevent intersecting triangles
    242247  if ((radius > HULLEPSILON) || (helper.Norm() < HULLEPSILON)) {
    243     //Log() << Verbose(2) << "INFO: Distance between old and new center is " << radius << " and between new center and baseline center is " << helper.Norm() << "." << endl;
     248    //Log() << Verbose(1) << "INFO: Distance between old and new center is " << radius << " and between new center and baseline center is " << helper.Norm() << "." << endl;
    244249    return alpha;
    245250  } else {
     
    264269double MinIntersectDistance(const gsl_vector * x, void *params)
    265270{
     271        Info FunctionInfo(__func__);
    266272  double retval = 0;
    267273  struct Intersection *I = (struct Intersection *)params;
     
    284290
    285291  retval = HeightA.ScalarProduct(&HeightA) + HeightB.ScalarProduct(&HeightB);
    286   //Log() << Verbose(2) << "MinIntersectDistance called, result: " << retval << endl;
     292  //Log() << Verbose(1) << "MinIntersectDistance called, result: " << retval << endl;
    287293
    288294  return retval;
     
    304310bool existsIntersection(const Vector &point1, const Vector &point2, const Vector &point3, const Vector &point4)
    305311{
     312        Info FunctionInfo(__func__);
    306313  bool result;
    307314
     
    351358
    352359        if (status == GSL_SUCCESS) {
    353           Log() << Verbose(2) << "converged to minimum" <<  endl;
     360          Log() << Verbose(1) << "converged to minimum" <<  endl;
    354361        }
    355362    } while (status == GSL_CONTINUE && iter < 100);
     
    376383  t2 = HeightB.ScalarProduct(&SideB)/SideB.ScalarProduct(&SideB);
    377384
    378   Log() << Verbose(2) << "Intersection " << intersection << " is at "
     385  Log() << Verbose(1) << "Intersection " << intersection << " is at "
    379386    << t1 << " for (" << point1 << "," << point2 << ") and at "
    380387    << t2 << " for (" << point3 << "," << point4 << "): ";
    381388
    382389  if (((t1 >= 0) && (t1 <= 1)) && ((t2 >= 0) && (t2 <= 1))) {
    383     Log() << Verbose(0) << "true intersection." << endl;
     390    Log() << Verbose(1) << "true intersection." << endl;
    384391    result = true;
    385392  } else {
    386     Log() << Verbose(0) << "intersection out of region of interest." << endl;
     393    Log() << Verbose(1) << "intersection out of region of interest." << endl;
    387394    result = false;
    388395  }
     
    407414double GetAngle(const Vector &point, const Vector &reference, const Vector &OrthogonalVector)
    408415{
     416        Info FunctionInfo(__func__);
    409417  if (reference.IsZero())
    410418    return M_PI;
     
    418426  }
    419427
    420   Log() << Verbose(4) << "INFO: " << point << " has angle " << phi << " with respect to reference " << reference << "." << endl;
     428  Log() << Verbose(1) << "INFO: " << point << " has angle " << phi << " with respect to reference " << reference << "." << endl;
    421429
    422430  return phi;
     
    433441double CalculateVolumeofGeneralTetraeder(const Vector &a, const Vector &b, const Vector &c, const Vector &d)
    434442{
     443        Info FunctionInfo(__func__);
    435444  Vector Point, TetraederVector[3];
    436445  double volume;
     
    456465bool CheckLineCriteriaForDegeneratedTriangle(const BoundaryPointSet * const nodes[3])
    457466{
     467        Info FunctionInfo(__func__);
    458468  bool result = false;
    459469  int counter = 0;
     
    482492    }
    483493  if ((!result) && (counter > 1)) {
    484     Log() << Verbose(2) << "INFO: Degenerate triangle is ok, at least two, here " << counter << ", existing lines are used." << endl;
     494    Log() << Verbose(1) << "INFO: Degenerate triangle is ok, at least two, here " << counter << ", existing lines are used." << endl;
    485495    result = true;
    486496  }
     
    489499
    490500
    491 /** Sort function for the candidate list.
    492  */
    493 bool SortCandidates(const CandidateForTesselation* candidate1, const CandidateForTesselation* candidate2)
    494 {
    495   Vector BaseLineVector, OrthogonalVector, helper;
    496   if (candidate1->BaseLine != candidate2->BaseLine) {  // sanity check
    497     eLog() << Verbose(1) << "sortCandidates was called for two different baselines: " << candidate1->BaseLine << " and " << candidate2->BaseLine << "." << endl;
    498     //return false;
    499     exit(1);
    500   }
    501   // create baseline vector
    502   BaseLineVector.CopyVector(candidate1->BaseLine->endpoints[1]->node->node);
    503   BaseLineVector.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node);
    504   BaseLineVector.Normalize();
    505 
    506   // create normal in-plane vector to cope with acos() non-uniqueness on [0,2pi] (note that is pointing in the "right" direction already, hence ">0" test!)
    507   helper.CopyVector(candidate1->BaseLine->endpoints[0]->node->node);
    508   helper.SubtractVector(candidate1->point->node);
    509   OrthogonalVector.CopyVector(&helper);
    510   helper.VectorProduct(&BaseLineVector);
    511   OrthogonalVector.SubtractVector(&helper);
    512   OrthogonalVector.Normalize();
    513 
    514   // calculate both angles and correct with in-plane vector
    515   helper.CopyVector(candidate1->point->node);
    516   helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node);
    517   double phi = BaseLineVector.Angle(&helper);
    518   if (OrthogonalVector.ScalarProduct(&helper) > 0) {
    519     phi = 2.*M_PI - phi;
    520   }
    521   helper.CopyVector(candidate2->point->node);
    522   helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node);
    523   double psi = BaseLineVector.Angle(&helper);
    524   if (OrthogonalVector.ScalarProduct(&helper) > 0) {
    525     psi = 2.*M_PI - psi;
    526   }
    527 
    528   Log() << Verbose(2) << *candidate1->point << " has angle " << phi << endl;
    529   Log() << Verbose(2) << *candidate2->point << " has angle " << psi << endl;
    530 
    531   // return comparison
    532   return phi < psi;
    533 };
     501///** Sort function for the candidate list.
     502// */
     503//bool SortCandidates(const CandidateForTesselation* candidate1, const CandidateForTesselation* candidate2)
     504//{
     505//      Info FunctionInfo(__func__);
     506//  Vector BaseLineVector, OrthogonalVector, helper;
     507//  if (candidate1->BaseLine != candidate2->BaseLine) {  // sanity check
     508//    eLog() << Verbose(1) << "sortCandidates was called for two different baselines: " << candidate1->BaseLine << " and " << candidate2->BaseLine << "." << endl;
     509//    //return false;
     510//    exit(1);
     511//  }
     512//  // create baseline vector
     513//  BaseLineVector.CopyVector(candidate1->BaseLine->endpoints[1]->node->node);
     514//  BaseLineVector.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node);
     515//  BaseLineVector.Normalize();
     516//
     517//  // create normal in-plane vector to cope with acos() non-uniqueness on [0,2pi] (note that is pointing in the "right" direction already, hence ">0" test!)
     518//  helper.CopyVector(candidate1->BaseLine->endpoints[0]->node->node);
     519//  helper.SubtractVector(candidate1->point->node);
     520//  OrthogonalVector.CopyVector(&helper);
     521//  helper.VectorProduct(&BaseLineVector);
     522//  OrthogonalVector.SubtractVector(&helper);
     523//  OrthogonalVector.Normalize();
     524//
     525//  // calculate both angles and correct with in-plane vector
     526//  helper.CopyVector(candidate1->point->node);
     527//  helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node);
     528//  double phi = BaseLineVector.Angle(&helper);
     529//  if (OrthogonalVector.ScalarProduct(&helper) > 0) {
     530//    phi = 2.*M_PI - phi;
     531//  }
     532//  helper.CopyVector(candidate2->point->node);
     533//  helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node);
     534//  double psi = BaseLineVector.Angle(&helper);
     535//  if (OrthogonalVector.ScalarProduct(&helper) > 0) {
     536//    psi = 2.*M_PI - psi;
     537//  }
     538//
     539//  Log() << Verbose(1) << *candidate1->point << " has angle " << phi << endl;
     540//  Log() << Verbose(1) << *candidate2->point << " has angle " << psi << endl;
     541//
     542//  // return comparison
     543//  return phi < psi;
     544//};
    534545
    535546/**
     
    543554TesselPoint* FindSecondClosestPoint(const Vector* Point, const LinkedCell* const LC)
    544555{
     556        Info FunctionInfo(__func__);
    545557  TesselPoint* closestPoint = NULL;
    546558  TesselPoint* secondClosestPoint = NULL;
     
    553565  for(int i=0;i<NDIM;i++) // store indices of this cell
    554566    N[i] = LC->n[i];
    555   Log() << Verbose(2) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
     567  Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
    556568
    557569  LC->GetNeighbourBounds(Nlower, Nupper);
    558   //Log() << Verbose(0) << endl;
     570  //Log() << Verbose(1) << endl;
    559571  for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++)
    560572    for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++)
    561573      for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) {
    562574        const LinkedNodes *List = LC->GetCurrentCell();
    563         //Log() << Verbose(3) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;
     575        //Log() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;
    564576        if (List != NULL) {
    565577          for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
     
    597609TesselPoint* FindClosestPoint(const Vector* Point, TesselPoint *&SecondPoint, const LinkedCell* const LC)
    598610{
     611        Info FunctionInfo(__func__);
    599612  TesselPoint* closestPoint = NULL;
    600613  SecondPoint = NULL;
     
    607620  for(int i=0;i<NDIM;i++) // store indices of this cell
    608621    N[i] = LC->n[i];
    609   Log() << Verbose(3) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
     622  Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
    610623
    611624  LC->GetNeighbourBounds(Nlower, Nupper);
    612   //Log() << Verbose(0) << endl;
     625  //Log() << Verbose(1) << endl;
    613626  for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++)
    614627    for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++)
    615628      for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) {
    616629        const LinkedNodes *List = LC->GetCurrentCell();
    617         //Log() << Verbose(3) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;
     630        //Log() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;
    618631        if (List != NULL) {
    619632          for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
     
    626639              distance = currentNorm;
    627640              closestPoint = (*Runner);
    628               //Log() << Verbose(2) << "INFO: New Nearest Neighbour is " << *closestPoint << "." << endl;
     641              //Log() << Verbose(1) << "INFO: New Nearest Neighbour is " << *closestPoint << "." << endl;
    629642            } else if (currentNorm < secondDistance) {
    630643              secondDistance = currentNorm;
    631644              SecondPoint = (*Runner);
    632               //Log() << Verbose(2) << "INFO: New Second Nearest Neighbour is " << *SecondPoint << "." << endl;
     645              //Log() << Verbose(1) << "INFO: New Second Nearest Neighbour is " << *SecondPoint << "." << endl;
    633646            }
    634647          }
     
    640653  // output
    641654  if (closestPoint != NULL) {
    642     Log() << Verbose(2) << "Closest point is " << *closestPoint;
     655    Log() << Verbose(1) << "Closest point is " << *closestPoint;
    643656    if (SecondPoint != NULL)
    644657      Log() << Verbose(0) << " and second closest is " << *SecondPoint;
     
    656669Vector * GetClosestPointBetweenLine(const BoundaryLineSet * const Base, const BoundaryLineSet * const OtherBase)
    657670{
     671        Info FunctionInfo(__func__);
    658672  // construct the plane of the two baselines (i.e. take both their directional vectors)
    659673  Vector Normal;
     
    666680  Normal.VectorProduct(&OtherBaseline);
    667681  Normal.Normalize();
    668   Log() << Verbose(4) << "First direction is " << Baseline << ", second direction is " << OtherBaseline << ", normal of intersection plane is " << Normal << "." << endl;
     682  Log() << Verbose(1) << "First direction is " << Baseline << ", second direction is " << OtherBaseline << ", normal of intersection plane is " << Normal << "." << endl;
    669683
    670684  // project one offset point of OtherBase onto this plane (and add plane offset vector)
     
    683697  Normal.CopyVector(Intersection);
    684698  Normal.SubtractVector(Base->endpoints[0]->node->node);
    685   Log() << Verbose(3) << "Found closest point on " << *Base << " at " << *Intersection << ", factor in line is " << fabs(Normal.ScalarProduct(&Baseline)/Baseline.NormSquared()) << "." << endl;
     699  Log() << Verbose(1) << "Found closest point on " << *Base << " at " << *Intersection << ", factor in line is " << fabs(Normal.ScalarProduct(&Baseline)/Baseline.NormSquared()) << "." << endl;
    686700
    687701  return Intersection;
     
    696710double DistanceToTrianglePlane(const Vector *x, const BoundaryTriangleSet * const triangle)
    697711{
     712        Info FunctionInfo(__func__);
    698713  double distance = 0.;
    699714  if (x == NULL) {
     
    712727void WriteVrmlFile(ofstream * const vrmlfile, const Tesselation * const Tess, const PointCloud * const cloud)
    713728{
     729        Info FunctionInfo(__func__);
    714730  TesselPoint *Walker = NULL;
    715731  int i;
     
    755771void IncludeSphereinRaster3D(ofstream * const rasterfile, const Tesselation * const Tess, const PointCloud * const cloud)
    756772{
     773        Info FunctionInfo(__func__);
    757774  Vector helper;
    758775
     
    783800void WriteRaster3dFile(ofstream * const rasterfile, const Tesselation * const Tess, const PointCloud * const cloud)
    784801{
     802        Info FunctionInfo(__func__);
    785803  TesselPoint *Walker = NULL;
    786804  int i;
     
    828846void WriteTecplotFile(ofstream * const tecplot, const Tesselation * const TesselStruct, const PointCloud * const cloud, const int N)
    829847{
     848        Info FunctionInfo(__func__);
    830849  if ((tecplot != NULL) && (TesselStruct != NULL)) {
    831850    // write header
     
    848867
    849868    // print atom coordinates
    850     Log() << Verbose(2) << "The following triangles were created:";
    851869    int Counter = 1;
    852870    TesselPoint *Walker = NULL;
     
    858876    *tecplot << endl;
    859877    // print connectivity
     878    Log() << Verbose(1) << "The following triangles were created:" << endl;
    860879    for (TriangleMap::const_iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++) {
    861       Log() << Verbose(0) << " " << runner->second->endpoints[0]->node->Name << "<->" << runner->second->endpoints[1]->node->Name << "<->" << runner->second->endpoints[2]->node->Name;
     880      Log() << Verbose(1) << " " << runner->second->endpoints[0]->node->Name << "<->" << runner->second->endpoints[1]->node->Name << "<->" << runner->second->endpoints[2]->node->Name << endl;
    862881      *tecplot << LookupList[runner->second->endpoints[0]->node->nr] << " " << LookupList[runner->second->endpoints[1]->node->nr] << " " << LookupList[runner->second->endpoints[2]->node->nr] << endl;
    863882    }
    864883    delete[] (LookupList);
    865     Log() << Verbose(0) << endl;
    866884  }
    867885};
     
    874892void CalculateConcavityPerBoundaryPoint(const Tesselation * const TesselStruct)
    875893{
     894        Info FunctionInfo(__func__);
    876895  class BoundaryPointSet *point = NULL;
    877896  class BoundaryLineSet *line = NULL;
    878897
    879   //Log() << Verbose(2) << "Begin of CalculateConcavityPerBoundaryPoint" << endl;
    880898  // calculate remaining concavity
    881899  for (PointMap::const_iterator PointRunner = TesselStruct->PointsOnBoundary.begin(); PointRunner != TesselStruct->PointsOnBoundary.end(); PointRunner++) {
     
    885903    for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) {
    886904      line = LineRunner->second;
    887       //Log() << Verbose(2) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;
     905      //Log() << Verbose(1) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;
    888906      if (!line->CheckConvexityCriterion())
    889907        point->value += 1;
    890908    }
    891909  }
    892   //Log() << Verbose(2) << "End of CalculateConcavityPerBoundaryPoint" << endl;
    893910};
    894911
     
    901918bool CheckListOfBaselines(const Tesselation * const TesselStruct)
    902919{
     920        Info FunctionInfo(__func__);
    903921  LineMap::const_iterator testline;
    904922  bool result = false;
     
    908926  for (testline = TesselStruct->LinesOnBoundary.begin(); testline != TesselStruct->LinesOnBoundary.end(); testline++) {
    909927    if (testline->second->triangles.size() != 2) {
    910       Log() << Verbose(1) << *testline->second << "\t" << testline->second->triangles.size() << endl;
     928      Log() << Verbose(2) << *testline->second << "\t" << testline->second->triangles.size() << endl;
    911929      counter++;
    912930    }
Note: See TracChangeset for help on using the changeset viewer.