Changeset a67d19 for src/tesselation.cpp


Ignore:
Timestamp:
Apr 22, 2010, 2:00:03 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:
299554
Parents:
6613ec
Message:

Huge change: Log() << Verbose(.) --> DoLog(.) && (Log() << Verbose(.) << ...);

Most of the files are affected, but this is necessary as if DoLog() says verbosity is not enough, all the stream operators won"t get executed which saves substantial amount of computation time.

Signed-off-by: Frederik Heber <heber@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tesselation.cpp

    r6613ec ra67d19  
    2828{
    2929  Info FunctionInfo(__func__);
    30   Log() << Verbose(1) << "Adding noname." << endl;
     30  DoLog(1) && (Log() << Verbose(1) << "Adding noname." << endl);
    3131}
    3232;
     
    3939{
    4040  Info FunctionInfo(__func__);
    41   Log() << Verbose(1) << "Adding Node " << *Walker << endl;
     41  DoLog(1) && (Log() << Verbose(1) << "Adding Node " << *Walker << endl);
    4242}
    4343;
     
    6363{
    6464  Info FunctionInfo(__func__);
    65   Log() << Verbose(1) << "Adding " << *this << " to line " << *line << "." << endl;
     65  DoLog(1) && (Log() << Verbose(1) << "Adding " << *this << " to line " << *line << "." << endl);
    6666  if (line->endpoints[0] == this) {
    6767    lines.insert(LinePair(line->endpoints[1]->Nr, line));
     
    115115  skipped = false;
    116116  // clear triangles list
    117   Log() << Verbose(0) << "New Line with endpoints " << *this << "." << endl;
     117  DoLog(0) && (Log() << Verbose(0) << "New Line with endpoints " << *this << "." << endl);
    118118}
    119119;
     
    138138  skipped = false;
    139139  // clear triangles list
    140   Log() << Verbose(0) << "New Line with endpoints " << *this << "." << endl;
     140  DoLog(0) && (Log() << Verbose(0) << "New Line with endpoints " << *this << "." << endl);
    141141}
    142142;
     
    196196{
    197197  Info FunctionInfo(__func__);
    198   Log() << Verbose(0) << "Add " << triangle->Nr << " to line " << *this << "." << endl;
     198  DoLog(0) && (Log() << Verbose(0) << "Add " << triangle->Nr << " to line " << *this << "." << endl);
    199199  triangles.insert(TrianglePair(triangle->Nr, triangle));
    200200}
     
    270270  //Log() << Verbose(0) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl;
    271271  if (NormalCheck.NormSquared() < MYEPSILON) {
    272     Log() << Verbose(0) << "ACCEPT: Normalvectors of both triangles are the same: convex." << endl;
     272    DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Normalvectors of both triangles are the same: convex." << endl);
    273273    return true;
    274274  }
     
    276276  double angle = GetAngle(helper[0], helper[1], BaseLineNormal);
    277277  if ((angle - M_PI) > -MYEPSILON) {
    278     Log() << Verbose(0) << "ACCEPT: Angle is greater than pi: convex." << endl;
     278    DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Angle is greater than pi: convex." << endl);
    279279    return true;
    280280  } else {
    281     Log() << Verbose(0) << "REJECT: Angle is less than pi: concave." << endl;
     281    DoLog(0) && (Log() << Verbose(0) << "REJECT: Angle is less than pi: concave." << endl);
    282282    return false;
    283283  }
     
    364364  // set endpoints
    365365  int Counter = 0;
    366   Log() << Verbose(0) << "New triangle " << Nr << " with end points: " << endl;
     366  DoLog(0) && (Log() << Verbose(0) << "New triangle " << Nr << " with end points: " << endl);
    367367  for (PointMap::iterator runner = OrderMap.begin(); runner != OrderMap.end(); runner++) {
    368368    endpoints[Counter] = runner->second;
    369     Log() << Verbose(0) << " " << *endpoints[Counter] << endl;
     369    DoLog(0) && (Log() << Verbose(0) << " " << *endpoints[Counter] << endl);
    370370    Counter++;
    371371  }
     
    413413  if (NormalVector.ScalarProduct(&OtherVector) > 0.)
    414414    NormalVector.Scale(-1.);
    415   Log() << Verbose(1) << "Normal Vector is " << NormalVector << "." << endl;
     415  DoLog(1) && (Log() << Verbose(1) << "Normal Vector is " << NormalVector << "." << endl);
    416416}
    417417;
     
    440440  }
    441441
    442   Log() << Verbose(1) << "INFO: Triangle is " << *this << "." << endl;
    443   Log() << Verbose(1) << "INFO: Line is from " << *MolCenter << " to " << *x << "." << endl;
    444   Log() << Verbose(1) << "INFO: Intersection is " << *Intersection << "." << endl;
     442  DoLog(1) && (Log() << Verbose(1) << "INFO: Triangle is " << *this << "." << endl);
     443  DoLog(1) && (Log() << Verbose(1) << "INFO: Line is from " << *MolCenter << " to " << *x << "." << endl);
     444  DoLog(1) && (Log() << Verbose(1) << "INFO: Intersection is " << *Intersection << "." << endl);
    445445
    446446  if (Intersection->DistanceSquared(endpoints[0]->node->node) < MYEPSILON) {
    447     Log() << Verbose(1) << "Intersection coindices with first endpoint." << endl;
     447    DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with first endpoint." << endl);
    448448    return true;
    449449  } else if (Intersection->DistanceSquared(endpoints[1]->node->node) < MYEPSILON) {
    450     Log() << Verbose(1) << "Intersection coindices with second endpoint." << endl;
     450    DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with second endpoint." << endl);
    451451    return true;
    452452  } else if (Intersection->DistanceSquared(endpoints[2]->node->node) < MYEPSILON) {
    453     Log() << Verbose(1) << "Intersection coindices with third endpoint." << endl;
     453    DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with third endpoint." << endl);
    454454    return true;
    455455  }
     
    462462      CrossPoint.SubtractVector(endpoints[i % 3]->node->node); // cross point was returned as absolute vector
    463463      const double s = CrossPoint.ScalarProduct(&helper) / helper.NormSquared();
    464       Log() << Verbose(1) << "INFO: Factor s is " << s << "." << endl;
     464      DoLog(1) && (Log() << Verbose(1) << "INFO: Factor s is " << s << "." << endl);
    465465      if ((s < -MYEPSILON) || ((s - 1.) > MYEPSILON)) {
    466         Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << "outside of triangle." << endl;
     466        DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << "outside of triangle." << endl);
    467467        i = 4;
    468468        break;
     
    473473  } while (i < 3);
    474474  if (i == 3) {
    475     Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " inside of triangle." << endl;
     475    DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " inside of triangle." << endl);
    476476    return true;
    477477  } else {
    478     Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " outside of triangle." << endl;
     478    DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " outside of triangle." << endl);
    479479    return false;
    480480  }
     
    500500
    501501  // 1. get intersection with plane
    502   Log() << Verbose(1) << "INFO: Looking for closest point of triangle " << *this << " to " << *x << "." << endl;
     502  DoLog(1) && (Log() << Verbose(1) << "INFO: Looking for closest point of triangle " << *this << " to " << *x << "." << endl);
    503503  GetCenter(&Direction);
    504504  if (!ClosestPoint->GetIntersectionWithPlane(&NormalVector, endpoints[0]->node->node, x, &Direction)) {
     
    513513  InPlane.AddVector(ClosestPoint);
    514514
    515   Log() << Verbose(2) << "INFO: Triangle is " << *this << "." << endl;
    516   Log() << Verbose(2) << "INFO: Line is from " << Direction << " to " << *x << "." << endl;
    517   Log() << Verbose(2) << "INFO: In-plane part is " << InPlane << "." << endl;
     515  DoLog(2) && (Log() << Verbose(2) << "INFO: Triangle is " << *this << "." << endl);
     516  DoLog(2) && (Log() << Verbose(2) << "INFO: Line is from " << Direction << " to " << *x << "." << endl);
     517  DoLog(2) && (Log() << Verbose(2) << "INFO: In-plane part is " << InPlane << "." << endl);
    518518
    519519  // Calculate cross point between one baseline and the desired point such that distance is shortest
     
    533533    CrossPoint[i].SubtractVector(endpoints[i % 3]->node->node); // cross point was returned as absolute vector
    534534    const double s = CrossPoint[i].ScalarProduct(&Direction) / Direction.NormSquared();
    535     Log() << Verbose(2) << "INFO: Factor s is " << s << "." << endl;
     535    DoLog(2) && (Log() << Verbose(2) << "INFO: Factor s is " << s << "." << endl);
    536536    if ((s >= -MYEPSILON) && ((s - 1.) <= MYEPSILON)) {
    537537      CrossPoint[i].AddVector(endpoints[i % 3]->node->node); // make cross point absolute again
    538       Log() << Verbose(2) << "INFO: Crosspoint is " << CrossPoint[i] << ", intersecting BoundaryLine between " << *endpoints[i % 3]->node->node << " and " << *endpoints[(i + 1) % 3]->node->node << "." << endl;
     538      DoLog(2) && (Log() << Verbose(2) << "INFO: Crosspoint is " << CrossPoint[i] << ", intersecting BoundaryLine between " << *endpoints[i % 3]->node->node << " and " << *endpoints[(i + 1) % 3]->node->node << "." << endl);
    539539      const double distance = CrossPoint[i].DistanceSquared(x);
    540540      if ((ShortestDistance < 0.) || (ShortestDistance > distance)) {
     
    565565    }
    566566  }
    567   Log() << Verbose(1) << "INFO: Closest Point is " << *ClosestPoint << " with shortest squared distance is " << ShortestDistance << "." << endl;
     567  DoLog(1) && (Log() << Verbose(1) << "INFO: Closest Point is " << *ClosestPoint << " with shortest squared distance is " << ShortestDistance << "." << endl);
    568568  return ShortestDistance;
    569569}
     
    619619{
    620620  Info FunctionInfo(__func__);
    621   Log() << Verbose(1) << "INFO: Checking " << Points[0] << "," << Points[1] << "," << Points[2] << " against " << endpoints[0] << "," << endpoints[1] << "," << endpoints[2] << "." << endl;
     621  DoLog(1) && (Log() << Verbose(1) << "INFO: Checking " << Points[0] << "," << Points[1] << "," << Points[2] << " against " << endpoints[0] << "," << endpoints[1] << "," << endpoints[2] << "." << endl);
    622622  return (((endpoints[0] == Points[0]) || (endpoints[0] == Points[1]) || (endpoints[0] == Points[2])) && ((endpoints[1] == Points[0]) || (endpoints[1] == Points[1]) || (endpoints[1] == Points[2])) && ((endpoints[2] == Points[0]) || (endpoints[2] == Points[1]) || (endpoints[2] == Points[2])
    623623
     
    668668    center->AddVector(endpoints[i]->node->node);
    669669  center->Scale(1. / 3.);
    670   Log() << Verbose(1) << "INFO: Center is at " << *center << "." << endl;
     670  DoLog(1) && (Log() << Verbose(1) << "INFO: Center is at " << *center << "." << endl);
    671671}
    672672
     
    703703  Info FunctionInfo(__func__);
    704704  endpoints.clear();
    705   Log() << Verbose(1) << "Erasing polygon Nr." << Nr << " itself." << endl;
     705  DoLog(1) && (Log() << Verbose(1) << "Erasing polygon Nr." << Nr << " itself." << endl);
    706706}
    707707;
     
    742742  if (TotalNormal->ScalarProduct(&OtherVector) > 0.)
    743743    TotalNormal->Scale(-1.);
    744   Log() << Verbose(1) << "Normal Vector is " << *TotalNormal << "." << endl;
     744  DoLog(1) && (Log() << Verbose(1) << "Normal Vector is " << *TotalNormal << "." << endl);
    745745
    746746  return TotalNormal;
     
    762762  }
    763763  center->Scale(1. / (double) counter);
    764   Log() << Verbose(1) << "Center is at " << *center << "." << endl;
     764  DoLog(1) && (Log() << Verbose(1) << "Center is at " << *center << "." << endl);
    765765}
    766766
     
    795795  Info FunctionInfo(__func__);
    796796  for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) {
    797     Log() << Verbose(0) << "Checking against " << **Runner << endl;
     797    DoLog(0) && (Log() << Verbose(0) << "Checking against " << **Runner << endl);
    798798    if (point == (*Runner)) {
    799       Log() << Verbose(0) << " Contained." << endl;
     799      DoLog(0) && (Log() << Verbose(0) << " Contained." << endl);
    800800      return true;
    801801    }
    802802  }
    803   Log() << Verbose(0) << " Not contained." << endl;
     803  DoLog(0) && (Log() << Verbose(0) << " Not contained." << endl);
    804804  return false;
    805805}
     
    815815  for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++)
    816816    if (point == (*Runner)->node) {
    817       Log() << Verbose(0) << " Contained." << endl;
     817      DoLog(0) && (Log() << Verbose(0) << " Contained." << endl);
    818818      return true;
    819819    }
    820   Log() << Verbose(0) << " Not contained." << endl;
     820  DoLog(0) && (Log() << Verbose(0) << " Not contained." << endl);
    821821  return false;
    822822}
     
    832832  Info FunctionInfo(__func__);
    833833  int counter = 0;
    834   Log() << Verbose(1) << "Polygon is " << *this << endl;
     834  DoLog(1) && (Log() << Verbose(1) << "Polygon is " << *this << endl);
    835835  for (int i = 0; i < dim; i++) {
    836     Log() << Verbose(1) << " Testing endpoint " << *Points[i] << endl;
     836    DoLog(1) && (Log() << Verbose(1) << " Testing endpoint " << *Points[i] << endl);
    837837    if (ContainsBoundaryPoint(Points[i])) {
    838838      counter++;
     
    855855  Info FunctionInfo(__func__);
    856856  size_t counter = 0;
    857   Log() << Verbose(1) << "Polygon is " << *this << endl;
     857  DoLog(1) && (Log() << Verbose(1) << "Polygon is " << *this << endl);
    858858  for (PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) {
    859     Log() << Verbose(1) << " Testing endpoint " << **Runner << endl;
     859    DoLog(1) && (Log() << Verbose(1) << " Testing endpoint " << **Runner << endl);
    860860    if (ContainsBoundaryPoint(*Runner))
    861861      counter++;
     
    895895          Tester = triangles->insert(Sprinter->second);
    896896          if (Tester.second)
    897             Log() << Verbose(0) << "Adding triangle " << *(Sprinter->second) << endl;
     897            DoLog(0) && (Log() << Verbose(0) << "Adding triangle " << *(Sprinter->second) << endl);
    898898        }
    899899      }
    900900
    901   Log() << Verbose(1) << "The Polygon of " << endpoints.size() << " endpoints has " << triangles->size() << " unique triangles in total." << endl;
     901  DoLog(1) && (Log() << Verbose(1) << "The Polygon of " << endpoints.size() << " endpoints has " << triangles->size() << " unique triangles in total." << endl);
    902902  return triangles;
    903903}
     
    914914  if (line == NULL)
    915915    return false;
    916   Log() << Verbose(1) << "Filling polygon from line " << *line << endl;
     916  DoLog(1) && (Log() << Verbose(1) << "Filling polygon from line " << *line << endl);
    917917  for (TriangleMap::const_iterator Runner = line->triangles.begin(); Runner != line->triangles.end(); Runner++) {
    918918    for (int i = 0; i < 3; i++) {
    919919      Tester = endpoints.insert((Runner->second)->endpoints[i]);
    920920      if (Tester.second)
    921         Log() << Verbose(1) << "  Inserting endpoint " << *((Runner->second)->endpoints[i]) << endl;
     921        DoLog(1) && (Log() << Verbose(1) << "  Inserting endpoint " << *((Runner->second)->endpoints[i]) << endl);
    922922    }
    923923  }
     
    10711071        return false;
    10721072      } else {
    1073         Log() << Verbose(1) << "Candidate " << *Walker << " is inside by " << distance << "." << endl;
     1073        DoLog(1) && (Log() << Verbose(1) << "Candidate " << *Walker << " is inside by " << distance << "." << endl);
    10741074      }
    10751075    }
     
    10821082    TesselPointList *ListofPoints = LC->GetPointsInsideSphere(RADIUS, (*VRunner));
    10831083
    1084     Log() << Verbose(1) << "The following atoms are inside sphere at " << OtherOptCenter << ":" << endl;
     1084    DoLog(1) && (Log() << Verbose(1) << "The following atoms are inside sphere at " << OtherOptCenter << ":" << endl);
    10851085    for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner)
    1086       Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->Distance(&OtherOptCenter) << "." << endl;
     1086      DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->Distance(&OtherOptCenter) << "." << endl);
    10871087
    10881088    // remove baseline's endpoints and candidates
    10891089    for (int i = 0; i < 2; i++) {
    1090       Log() << Verbose(1) << "INFO: removing baseline tesselpoint " << *BaseLine->endpoints[i]->node << "." << endl;
     1090      DoLog(1) && (Log() << Verbose(1) << "INFO: removing baseline tesselpoint " << *BaseLine->endpoints[i]->node << "." << endl);
    10911091      ListofPoints->remove(BaseLine->endpoints[i]->node);
    10921092    }
    10931093    for (TesselPointList::const_iterator Runner = pointlist.begin(); Runner != pointlist.end(); ++Runner) {
    1094       Log() << Verbose(1) << "INFO: removing candidate tesselpoint " << *(*Runner) << "." << endl;
     1094      DoLog(1) && (Log() << Verbose(1) << "INFO: removing candidate tesselpoint " << *(*Runner) << "." << endl);
    10951095      ListofPoints->remove(*Runner);
    10961096    }
     
    11061106    // check with animate_sphere.tcl VMD script
    11071107    if (ThirdPoint != NULL) {
    1108       Log() << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " " << ThirdPoint->Nr + 1 << " " << RADIUS << " " << OldCenter.x[0] << " " << OldCenter.x[1] << " " << OldCenter.x[2] << " " << (*VRunner)->x[0] << " " << (*VRunner)->x[1] << " " << (*VRunner)->x[2] << endl;
     1108      DoLog(1) && (Log() << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " " << ThirdPoint->Nr + 1 << " " << RADIUS << " " << OldCenter.x[0] << " " << OldCenter.x[1] << " " << OldCenter.x[2] << " " << (*VRunner)->x[0] << " " << (*VRunner)->x[1] << " " << (*VRunner)->x[2] << endl);
    11091109    } else {
    1110       Log() << Verbose(1) << "Check by: ... missing third point ..." << endl;
    1111       Log() << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " ??? " << RADIUS << " " << OldCenter.x[0] << " " << OldCenter.x[1] << " " << OldCenter.x[2] << " " << (*VRunner)->x[0] << " " << (*VRunner)->x[1] << " " << (*VRunner)->x[2] << endl;
     1110      DoLog(1) && (Log() << Verbose(1) << "Check by: ... missing third point ..." << endl);
     1111      DoLog(1) && (Log() << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr + 1 << " " << BaseLine->endpoints[1]->Nr + 1 << " ??? " << RADIUS << " " << OldCenter.x[0] << " " << OldCenter.x[1] << " " << OldCenter.x[2] << " " << (*VRunner)->x[0] << " " << (*VRunner)->x[1] << " " << (*VRunner)->x[2] << endl);
    11121112    }
    11131113  }
     
    11571157{
    11581158  Info FunctionInfo(__func__);
    1159   Log() << Verbose(0) << "Free'ing TesselStruct ... " << endl;
     1159  DoLog(0) && (Log() << Verbose(0) << "Free'ing TesselStruct ... " << endl);
    11601160  for (TriangleMap::iterator runner = TrianglesOnBoundary.begin(); runner != TrianglesOnBoundary.end(); runner++) {
    11611161    if (runner->second != NULL) {
     
    11651165      DoeLog(1) && (eLog() << Verbose(1) << "The triangle " << runner->first << " has already been free'd." << endl);
    11661166  }
    1167   Log() << Verbose(0) << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl;
     1167  DoLog(0) && (Log() << Verbose(0) << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl);
    11681168}
    11691169;
     
    13191319    // 3. construct plane vector
    13201320    PlaneVector.MakeNormalVector(A->second->node->node, baseline->second.first->second->node->node, baseline->second.second->second->node->node);
    1321     Log() << Verbose(2) << "Plane vector of candidate triangle is " << PlaneVector << endl;
     1321    DoLog(2) && (Log() << Verbose(2) << "Plane vector of candidate triangle is " << PlaneVector << endl);
    13221322    // 4. loop over all points
    13231323    double sign = 0.;
     
    13331333      if (fabs(distance) < 1e-4) // we need to have a small epsilon around 0 which is still ok
    13341334        continue;
    1335       Log() << Verbose(2) << "Projection of " << checker->second->node->Name << " yields distance of " << distance << "." << endl;
     1335      DoLog(2) && (Log() << Verbose(2) << "Projection of " << checker->second->node->Name << " yields distance of " << distance << "." << endl);
    13361336      tmp = distance / fabs(distance);
    13371337      // 4b. Any have different sign to than before? (i.e. would lie outside convex hull with this starting triangle)
    13381338      if ((sign != 0) && (tmp != sign)) {
    13391339        // 4c. If so, break 4. loop and continue with next candidate in 1. loop
    1340         Log() << Verbose(2) << "Current candidates: " << A->second->node->Name << "," << baseline->second.first->second->node->Name << "," << baseline->second.second->second->node->Name << " leaves " << checker->second->node->Name << " outside the convex hull." << endl;
     1340        DoLog(2) && (Log() << Verbose(2) << "Current candidates: " << A->second->node->Name << "," << baseline->second.first->second->node->Name << "," << baseline->second.second->second->node->Name << " leaves " << checker->second->node->Name << " outside the convex hull." << endl);
    13411341        break;
    13421342      } else { // note the sign for later
    1343         Log() << Verbose(2) << "Current candidates: " << A->second->node->Name << "," << baseline->second.first->second->node->Name << "," << baseline->second.second->second->node->Name << " leave " << checker->second->node->Name << " inside the convex hull." << endl;
     1343        DoLog(2) && (Log() << Verbose(2) << "Current candidates: " << A->second->node->Name << "," << baseline->second.first->second->node->Name << "," << baseline->second.second->second->node->Name << " leave " << checker->second->node->Name << " inside the convex hull." << endl);
    13441344        sign = tmp;
    13451345      }
     
    13611361    // 5. come this far, all on same side? Then break 1. loop and construct triangle
    13621362    if (checker == PointsOnBoundary.end()) {
    1363       Log() << Verbose(2) << "Looks like we have a candidate!" << endl;
     1363      DoLog(2) && (Log() << Verbose(2) << "Looks like we have a candidate!" << endl);
    13641364      break;
    13651365    }
     
    13851385    }
    13861386
    1387     Log() << Verbose(1) << "Starting triangle is " << *BTS << "." << endl;
     1387    DoLog(1) && (Log() << Verbose(1) << "Starting triangle is " << *BTS << "." << endl);
    13881388  } else {
    13891389    DoeLog(0) && (eLog() << Verbose(0) << "No starting triangle found." << endl);
     
    14261426        // get peak point with respect to this base line's only triangle
    14271427        BTS = baseline->second->triangles.begin()->second; // there is only one triangle so far
    1428         Log() << Verbose(0) << "Current baseline is between " << *(baseline->second) << "." << endl;
     1428        DoLog(0) && (Log() << Verbose(0) << "Current baseline is between " << *(baseline->second) << "." << endl);
    14291429        for (int i = 0; i < 3; i++)
    14301430          if ((BTS->endpoints[i] != baseline->second->endpoints[0]) && (BTS->endpoints[i] != baseline->second->endpoints[1]))
    14311431            peak = BTS->endpoints[i];
    1432         Log() << Verbose(1) << " and has peak " << *peak << "." << endl;
     1432        DoLog(1) && (Log() << Verbose(1) << " and has peak " << *peak << "." << endl);
    14331433
    14341434        // prepare some auxiliary vectors
     
    14451445          CenterVector.AddVector(BTS->endpoints[i]->node->node);
    14461446        CenterVector.Scale(1. / 3.);
    1447         Log() << Verbose(2) << "CenterVector of base triangle is " << CenterVector << endl;
     1447        DoLog(2) && (Log() << Verbose(2) << "CenterVector of base triangle is " << CenterVector << endl);
    14481448
    14491449        // normal vector of triangle
     
    14521452        BTS->GetNormalVector(NormalVector);
    14531453        NormalVector.CopyVector(&BTS->NormalVector);
    1454         Log() << Verbose(2) << "NormalVector of base triangle is " << NormalVector << endl;
     1454        DoLog(2) && (Log() << Verbose(2) << "NormalVector of base triangle is " << NormalVector << endl);
    14551455
    14561456        // vector in propagation direction (out of triangle)
     
    14621462        if (PropagationVector.ScalarProduct(&TempVector) > 0) // make sure normal propagation vector points outward from baseline
    14631463          PropagationVector.Scale(-1.);
    1464         Log() << Verbose(2) << "PropagationVector of base triangle is " << PropagationVector << endl;
     1464        DoLog(2) && (Log() << Verbose(2) << "PropagationVector of base triangle is " << PropagationVector << endl);
    14651465        winner = PointsOnBoundary.end();
    14661466
     
    14681468        for (PointMap::iterator target = PointsOnBoundary.begin(); target != PointsOnBoundary.end(); target++) {
    14691469          if ((target->second != baseline->second->endpoints[0]) && (target->second != baseline->second->endpoints[1])) { // don't take the same endpoints
    1470             Log() << Verbose(1) << "Target point is " << *(target->second) << ":" << endl;
     1470            DoLog(1) && (Log() << Verbose(1) << "Target point is " << *(target->second) << ":" << endl);
    14711471
    14721472            // first check direction, so that triangles don't intersect
     
    14751475            VirtualNormalVector.ProjectOntoPlane(&NormalVector);
    14761476            TempAngle = VirtualNormalVector.Angle(&PropagationVector);
    1477             Log() << Verbose(2) << "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "." << endl;
     1477            DoLog(2) && (Log() << Verbose(2) << "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "." << endl);
    14781478            if (TempAngle > (M_PI / 2.)) { // no bends bigger than Pi/2 (90 degrees)
    1479               Log() << Verbose(2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", bad direction!" << endl;
     1479              DoLog(2) && (Log() << Verbose(2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", bad direction!" << endl);
    14801480              continue;
    14811481            } else
    1482               Log() << Verbose(2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", good direction!" << endl;
     1482              DoLog(2) && (Log() << Verbose(2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", good direction!" << endl);
    14831483
    14841484            // check first and second endpoint (if any connecting line goes to target has at least not more than 1 triangle)
     
    14861486            LineChecker[1] = baseline->second->endpoints[1]->lines.find(target->first);
    14871487            if (((LineChecker[0] != baseline->second->endpoints[0]->lines.end()) && (LineChecker[0]->second->triangles.size() == 2))) {
    1488               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;
     1488              DoLog(2) && (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);
    14891489              continue;
    14901490            }
    14911491            if (((LineChecker[1] != baseline->second->endpoints[1]->lines.end()) && (LineChecker[1]->second->triangles.size() == 2))) {
    1492               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;
     1492              DoLog(2) && (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);
    14931493              continue;
    14941494            }
     
    14961496            // check whether the envisaged triangle does not already exist (if both lines exist and have same endpoint)
    14971497            if ((((LineChecker[0] != baseline->second->endpoints[0]->lines.end()) && (LineChecker[1] != baseline->second->endpoints[1]->lines.end()) && (GetCommonEndpoint(LineChecker[0]->second, LineChecker[1]->second) == peak)))) {
    1498               Log() << Verbose(4) << "Current target is peak!" << endl;
     1498              DoLog(4) && (Log() << Verbose(4) << "Current target is peak!" << endl);
    14991499              continue;
    15001500            }
     
    15071507            helper.ProjectOntoPlane(&TempVector);
    15081508            if (fabs(helper.NormSquared()) < MYEPSILON) {
    1509               Log() << Verbose(2) << "Chosen set of vectors is linear dependent." << endl;
     1509              DoLog(2) && (Log() << Verbose(2) << "Chosen set of vectors is linear dependent." << endl);
    15101510              continue;
    15111511            }
     
    15241524            // calculate angle
    15251525            TempAngle = NormalVector.Angle(&VirtualNormalVector);
    1526             Log() << Verbose(2) << "NormalVector is " << VirtualNormalVector << " and the angle is " << TempAngle << "." << endl;
     1526            DoLog(2) && (Log() << Verbose(2) << "NormalVector is " << VirtualNormalVector << " and the angle is " << TempAngle << "." << endl);
    15271527            if ((SmallestAngle - TempAngle) > MYEPSILON) { // set to new possible winner
    15281528              SmallestAngle = TempAngle;
    15291529              winner = target;
    1530               Log() << Verbose(2) << "New winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;
     1530              DoLog(2) && (Log() << Verbose(2) << "New winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl);
    15311531            } else if (fabs(SmallestAngle - TempAngle) < MYEPSILON) { // check the angle to propagation, both possible targets are in one plane! (their normals have same angle)
    15321532              // hence, check the angles to some normal direction from our base line but in this common plane of both targets...
     
    15461546                SmallestAngle = TempAngle;
    15471547                winner = target;
    1548                 Log() << Verbose(2) << "New winner " << *winner->second->node << " due to smaller angle " << TempAngle << " to propagation direction." << endl;
     1548                DoLog(2) && (Log() << Verbose(2) << "New winner " << *winner->second->node << " due to smaller angle " << TempAngle << " to propagation direction." << endl);
    15491549              } else
    1550                 Log() << Verbose(2) << "Keeping old winner " << *winner->second->node << " due to smaller angle to propagation direction." << endl;
     1550                DoLog(2) && (Log() << Verbose(2) << "Keeping old winner " << *winner->second->node << " due to smaller angle to propagation direction." << endl);
    15511551            } else
    1552               Log() << Verbose(2) << "Keeping old winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;
     1552              DoLog(2) && (Log() << Verbose(2) << "Keeping old winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl);
    15531553          }
    15541554        } // end of loop over all boundary points
     
    15561556        // 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
    15571557        if (winner != PointsOnBoundary.end()) {
    1558           Log() << Verbose(0) << "Winning target point is " << *(winner->second) << " with angle " << SmallestAngle << "." << endl;
     1558          DoLog(0) && (Log() << Verbose(0) << "Winning target point is " << *(winner->second) << " with angle " << SmallestAngle << "." << endl);
    15591559          // create the lins of not yet present
    15601560          BLS[0] = baseline->second;
     
    15911591        // 5d. If the set of lines is not yet empty, go to 5. and continue
    15921592      } else
    1593         Log() << Verbose(0) << "Baseline candidate " << *(baseline->second) << " has a triangle count of " << baseline->second->triangles.size() << "." << endl;
     1593        DoLog(0) && (Log() << Verbose(0) << "Baseline candidate " << *(baseline->second) << " has a triangle count of " << baseline->second->triangles.size() << "." << endl);
    15941594  } while (flag);
    15951595
     
    16241624    }
    16251625    Walker = cloud->GetPoint();
    1626     Log() << Verbose(0) << "Current point is " << *Walker << "." << endl;
     1626    DoLog(0) && (Log() << Verbose(0) << "Current point is " << *Walker << "." << endl);
    16271627    // get the next triangle
    16281628    triangles = FindClosestTrianglesToVector(Walker->node, BoundaryPoints);
    16291629    BTS = triangles->front();
    16301630    if ((triangles == NULL) || (BTS->ContainsBoundaryPoint(Walker))) {
    1631       Log() << Verbose(0) << "No triangles found, probably a tesselation point itself." << endl;
     1631      DoLog(0) && (Log() << Verbose(0) << "No triangles found, probably a tesselation point itself." << endl);
    16321632      cloud->GoToNext();
    16331633      continue;
    16341634    } else {
    16351635    }
    1636     Log() << Verbose(0) << "Closest triangle is " << *BTS << "." << endl;
     1636    DoLog(0) && (Log() << Verbose(0) << "Closest triangle is " << *BTS << "." << endl);
    16371637    // get the intersection point
    16381638    if (BTS->GetIntersectionInsideTriangle(Center, Walker->node, &Intersection)) {
    1639       Log() << Verbose(0) << "We have an intersection at " << Intersection << "." << endl;
     1639      DoLog(0) && (Log() << Verbose(0) << "We have an intersection at " << Intersection << "." << endl);
    16401640      // we have the intersection, check whether in- or outside of boundary
    16411641      if ((Center->DistanceSquared(Walker->node) - Center->DistanceSquared(&Intersection)) < -MYEPSILON) {
    16421642        // inside, next!
    1643         Log() << Verbose(0) << *Walker << " is inside wrt triangle " << *BTS << "." << endl;
     1643        DoLog(0) && (Log() << Verbose(0) << *Walker << " is inside wrt triangle " << *BTS << "." << endl);
    16441644      } else {
    16451645        // outside!
    1646         Log() << Verbose(0) << *Walker << " is outside wrt triangle " << *BTS << "." << endl;
     1646        DoLog(0) && (Log() << Verbose(0) << *Walker << " is outside wrt triangle " << *BTS << "." << endl);
    16471647        class BoundaryLineSet *OldLines[3], *NewLines[3];
    16481648        class BoundaryPointSet *OldPoints[3], *NewPoint;
     
    16541654        Normal.CopyVector(&BTS->NormalVector);
    16551655        // add Walker to boundary points
    1656         Log() << Verbose(0) << "Adding " << *Walker << " to BoundaryPoints." << endl;
     1656        DoLog(0) && (Log() << Verbose(0) << "Adding " << *Walker << " to BoundaryPoints." << endl);
    16571657        AddFlag = true;
    16581658        if (AddBoundaryPoint(Walker, 0))
     
    16611661          continue;
    16621662        // remove triangle
    1663         Log() << Verbose(0) << "Erasing triangle " << *BTS << "." << endl;
     1663        DoLog(0) && (Log() << Verbose(0) << "Erasing triangle " << *BTS << "." << endl);
    16641664        TrianglesOnBoundary.erase(BTS->Nr);
    16651665        delete (BTS);
     
    16691669          BPS[1] = OldPoints[i];
    16701670          NewLines[i] = new class BoundaryLineSet(BPS, LinesOnBoundaryCount);
    1671           Log() << Verbose(1) << "Creating new line " << *NewLines[i] << "." << endl;
     1671          DoLog(1) && (Log() << Verbose(1) << "Creating new line " << *NewLines[i] << "." << endl);
    16721672          LinesOnBoundary.insert(LinePair(LinesOnBoundaryCount, NewLines[i])); // no need for check for unique insertion as BPS[0] is definitely a new one
    16731673          LinesOnBoundaryCount++;
     
    16911691          BTS->GetNormalVector(Normal);
    16921692          Normal.Scale(-1.);
    1693           Log() << Verbose(0) << "Created new triangle " << *BTS << "." << endl;
     1693          DoLog(0) && (Log() << Verbose(0) << "Created new triangle " << *BTS << "." << endl);
    16941694          TrianglesOnBoundary.insert(TrianglePair(TrianglesOnBoundaryCount, BTS));
    16951695          TrianglesOnBoundaryCount++;
     
    17461746  } else {
    17471747    delete TPS[n];
    1748     Log() << Verbose(0) << "Node " << *((InsertUnique.first)->second->node) << " is already present in PointsOnBoundary." << endl;
     1748    DoLog(0) && (Log() << Verbose(0) << "Node " << *((InsertUnique.first)->second->node) << " is already present in PointsOnBoundary." << endl);
    17491749    TPS[n] = (InsertUnique.first)->second;
    17501750  }
     
    17831783  BoundaryLineSet *WinningLine = NULL;
    17841784  if (FindLine != a->lines.end()) {
    1785     Log() << Verbose(1) << "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "." << endl;
     1785    DoLog(1) && (Log() << Verbose(1) << "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "." << endl);
    17861786
    17871787    pair<LineMap::iterator, LineMap::iterator> FindPair;
     
    17891789
    17901790    for (FindLine = FindPair.first; (FindLine != FindPair.second) && (insertNewLine); FindLine++) {
    1791       Log() << Verbose(1) << "INFO: Checking line " << *(FindLine->second) << " ..." << endl;
     1791      DoLog(1) && (Log() << Verbose(1) << "INFO: Checking line " << *(FindLine->second) << " ..." << endl);
    17921792      // If there is a line with less than two attached triangles, we don't need a new line.
    17931793      if (FindLine->second->triangles.size() == 1) {
    17941794        CandidateMap::iterator Finder = OpenLines.find(FindLine->second);
    17951795        if (!Finder->second->pointlist.empty())
    1796           Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with candidate " << **(Finder->second->pointlist.begin()) << "." << endl;
     1796          DoLog(1) && (Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with candidate " << **(Finder->second->pointlist.begin()) << "." << endl);
    17971797        else
    1798           Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with no candidate." << endl;
     1798          DoLog(1) && (Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with no candidate." << endl);
    17991799        // get open line
    18001800        for (TesselPointList::const_iterator CandidateChecker = Finder->second->pointlist.begin(); CandidateChecker != Finder->second->pointlist.end(); ++CandidateChecker) {
     
    18281828{
    18291829  Info FunctionInfo(__func__);
    1830   Log() << Verbose(0) << "Adding open line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl;
     1830  DoLog(0) && (Log() << Verbose(0) << "Adding open line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl);
    18311831  BPS[0] = a;
    18321832  BPS[1] = b;
     
    18501850{
    18511851  Info FunctionInfo(__func__);
    1852   Log() << Verbose(0) << "Using existing line " << *Line << endl;
     1852  DoLog(0) && (Log() << Verbose(0) << "Using existing line " << *Line << endl);
    18531853
    18541854  // set endpoints and line
     
    18591859  CandidateMap::iterator CandidateLine = OpenLines.find(BLS[n]);
    18601860  if (CandidateLine != OpenLines.end()) {
    1861     Log() << Verbose(1) << " Removing line from OpenLines." << endl;
     1861    DoLog(1) && (Log() << Verbose(1) << " Removing line from OpenLines." << endl);
    18621862    delete (CandidateLine->second);
    18631863    OpenLines.erase(CandidateLine);
     
    18741874{
    18751875  Info FunctionInfo(__func__);
    1876   Log() << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl;
     1876  DoLog(1) && (Log() << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl);
    18771877
    18781878  // add triangle to global map
     
    18941894{
    18951895  Info FunctionInfo(__func__);
    1896   Log() << Verbose(0) << "Adding triangle to global TrianglesOnBoundary map." << endl;
     1896  DoLog(0) && (Log() << Verbose(0) << "Adding triangle to global TrianglesOnBoundary map." << endl);
    18971897
    18981898  // add triangle to global map
     
    19181918  for (int i = 0; i < 3; i++) {
    19191919    if (triangle->lines[i] != NULL) {
    1920       Log() << Verbose(0) << "Removing triangle Nr." << triangle->Nr << " in line " << *triangle->lines[i] << "." << endl;
     1920      DoLog(0) && (Log() << Verbose(0) << "Removing triangle Nr." << triangle->Nr << " in line " << *triangle->lines[i] << "." << endl);
    19211921      triangle->lines[i]->triangles.erase(triangle->Nr);
    19221922      if (triangle->lines[i]->triangles.empty()) {
    1923         Log() << Verbose(0) << *triangle->lines[i] << " is no more attached to any triangle, erasing." << endl;
     1923        DoLog(0) && (Log() << Verbose(0) << *triangle->lines[i] << " is no more attached to any triangle, erasing." << endl);
    19241924        RemoveTesselationLine(triangle->lines[i]);
    19251925      } else {
    1926         Log() << Verbose(0) << *triangle->lines[i] << " is still attached to another triangle: ";
     1926        DoLog(0) && (Log() << Verbose(0) << *triangle->lines[i] << " is still attached to another triangle: ");
    19271927        OpenLines.insert(pair<BoundaryLineSet *, CandidateForTesselation *> (triangle->lines[i], NULL));
    19281928        for (TriangleMap::iterator TriangleRunner = triangle->lines[i]->triangles.begin(); TriangleRunner != triangle->lines[i]->triangles.end(); TriangleRunner++)
    1929           Log() << Verbose(0) << "[" << (TriangleRunner->second)->Nr << "|" << *((TriangleRunner->second)->endpoints[0]) << ", " << *((TriangleRunner->second)->endpoints[1]) << ", " << *((TriangleRunner->second)->endpoints[2]) << "] \t";
    1930         Log() << Verbose(0) << endl;
     1929          DoLog(0) && (Log() << Verbose(0) << "[" << (TriangleRunner->second)->Nr << "|" << *((TriangleRunner->second)->endpoints[0]) << ", " << *((TriangleRunner->second)->endpoints[1]) << ", " << *((TriangleRunner->second)->endpoints[2]) << "] \t");
     1930        DoLog(0) && (Log() << Verbose(0) << endl);
    19311931        //        for (int j=0;j<2;j++) {
    19321932        //          Log() << Verbose(0) << "Lines of endpoint " << *(triangle->lines[i]->endpoints[j]) << ": ";
     
    19421942
    19431943  if (TrianglesOnBoundary.erase(triangle->Nr))
    1944     Log() << Verbose(0) << "Removing triangle Nr. " << triangle->Nr << "." << endl;
     1944    DoLog(0) && (Log() << Verbose(0) << "Removing triangle Nr. " << triangle->Nr << "." << endl);
    19451945  delete (triangle);
    19461946}
     
    19741974        for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++)
    19751975          if ((*Runner).second == line) {
    1976             Log() << Verbose(0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;
     1976            DoLog(0) && (Log() << Verbose(0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl);
    19771977            line->endpoints[i]->lines.erase(Runner);
    19781978            break;
     
    19801980      } else { // there's just a single line left
    19811981        if (line->endpoints[i]->lines.erase(line->Nr))
    1982           Log() << Verbose(0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;
     1982          DoLog(0) && (Log() << Verbose(0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl);
    19831983      }
    19841984      if (line->endpoints[i]->lines.empty()) {
    1985         Log() << Verbose(0) << *line->endpoints[i] << " has no more lines it's attached to, erasing." << endl;
     1985        DoLog(0) && (Log() << Verbose(0) << *line->endpoints[i] << " has no more lines it's attached to, erasing." << endl);
    19861986        RemoveTesselationPoint(line->endpoints[i]);
    19871987      } else {
    1988         Log() << Verbose(0) << *line->endpoints[i] << " has still lines it's attached to: ";
     1988        DoLog(0) && (Log() << Verbose(0) << *line->endpoints[i] << " has still lines it's attached to: ");
    19891989        for (LineMap::iterator LineRunner = line->endpoints[i]->lines.begin(); LineRunner != line->endpoints[i]->lines.end(); LineRunner++)
    1990           Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t";
    1991         Log() << Verbose(0) << endl;
     1990          DoLog(0) && (Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t");
     1991        DoLog(0) && (Log() << Verbose(0) << endl);
    19921992      }
    19931993      line->endpoints[i] = NULL; // free'd or not: disconnect
     
    19991999
    20002000  if (LinesOnBoundary.erase(line->Nr))
    2001     Log() << Verbose(0) << "Removing line Nr. " << line->Nr << "." << endl;
     2001    DoLog(0) && (Log() << Verbose(0) << "Removing line Nr. " << line->Nr << "." << endl);
    20022002  delete (line);
    20032003}
     
    20152015    return;
    20162016  if (PointsOnBoundary.erase(point->Nr))
    2017     Log() << Verbose(0) << "Removing point Nr. " << point->Nr << "." << endl;
     2017    DoLog(0) && (Log() << Verbose(0) << "Removing point Nr. " << point->Nr << "." << endl);
    20182018  delete (point);
    20192019}
     
    20352035  bool flag = true;
    20362036
    2037   Log() << Verbose(1) << "Check by: draw sphere {" << CandidateLine.OtherOptCenter.x[0] << " " << CandidateLine.OtherOptCenter.x[1] << " " << CandidateLine.OtherOptCenter.x[2] << "} radius " << RADIUS << " resolution 30" << endl;
     2037  DoLog(1) && (Log() << Verbose(1) << "Check by: draw sphere {" << CandidateLine.OtherOptCenter.x[0] << " " << CandidateLine.OtherOptCenter.x[1] << " " << CandidateLine.OtherOptCenter.x[2] << "} radius " << RADIUS << " resolution 30" << endl);
    20382038  // get all points inside the sphere
    20392039  TesselPointList *ListofPoints = LC->GetPointsInsideSphere(RADIUS, &CandidateLine.OtherOptCenter);
    20402040
    2041   Log() << Verbose(1) << "The following atoms are inside sphere at " << CandidateLine.OtherOptCenter << ":" << endl;
     2041  DoLog(1) && (Log() << Verbose(1) << "The following atoms are inside sphere at " << CandidateLine.OtherOptCenter << ":" << endl);
    20422042  for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner)
    2043     Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->Distance(&CandidateLine.OtherOptCenter) << "." << endl;
     2043    DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->Distance(&CandidateLine.OtherOptCenter) << "." << endl);
    20442044
    20452045  // remove triangles's endpoints
     
    20532053  // check for other points
    20542054  if (!ListofPoints->empty()) {
    2055     Log() << Verbose(1) << "CheckDegeneracy: There are still " << ListofPoints->size() << " points inside the sphere." << endl;
     2055    DoLog(1) && (Log() << Verbose(1) << "CheckDegeneracy: There are still " << ListofPoints->size() << " points inside the sphere." << endl);
    20562056    flag = false;
    2057     Log() << Verbose(1) << "External atoms inside of sphere at " << CandidateLine.OtherOptCenter << ":" << endl;
     2057    DoLog(1) && (Log() << Verbose(1) << "External atoms inside of sphere at " << CandidateLine.OtherOptCenter << ":" << endl);
    20582058    for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner)
    2059       Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->Distance(&CandidateLine.OtherOptCenter) << "." << endl;
     2059      DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->Distance(&CandidateLine.OtherOptCenter) << "." << endl);
    20602060  }
    20612061  delete (ListofPoints);
     
    20982098          for (; (FindLine != Points[i]->lines.end()) && (FindLine->first == Points[j]->node->nr); FindLine++) {
    20992099            TriangleMap *triangles = &FindLine->second->triangles;
    2100             Log() << Verbose(1) << "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "." << endl;
     2100            DoLog(1) && (Log() << Verbose(1) << "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "." << endl);
    21012101            for (TriangleMap::const_iterator FindTriangle = triangles->begin(); FindTriangle != triangles->end(); FindTriangle++) {
    21022102              if (FindTriangle->second->IsPresentTupel(Points)) {
     
    21042104              }
    21052105            }
    2106             Log() << Verbose(1) << "end." << endl;
     2106            DoLog(1) && (Log() << Verbose(1) << "end." << endl);
    21072107          }
    21082108          // Only one of the triangle lines must be considered for the triangle count.
     
    21142114  }
    21152115
    2116   Log() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;
     2116  DoLog(0) && (Log() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl);
    21172117  return adjacentTriangleCount;
    21182118}
     
    22112211          for (LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
    22122212            if ((*Runner)->node->x[i] > maxCoordinate[i]) {
    2213               Log() << Verbose(1) << "New maximal for axis " << i << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl;
     2213              DoLog(1) && (Log() << Verbose(1) << "New maximal for axis " << i << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl);
    22142214              maxCoordinate[i] = (*Runner)->node->x[i];
    22152215              MaxPoint[i] = (*Runner);
     
    22222222  }
    22232223
    2224   Log() << Verbose(1) << "Found maximum coordinates: ";
     2224  DoLog(1) && (Log() << Verbose(1) << "Found maximum coordinates: ");
    22252225  for (int i = 0; i < NDIM; i++)
    2226     Log() << Verbose(0) << i << ": " << *MaxPoint[i] << "\t";
    2227   Log() << Verbose(0) << endl;
     2226    DoLog(0) && (Log() << Verbose(0) << i << ": " << *MaxPoint[i] << "\t");
     2227  DoLog(0) && (Log() << Verbose(0) << endl);
    22282228
    22292229  BTS = NULL;
     
    22332233    BaseLine = new BoundaryLineSet();
    22342234    BaseLine->endpoints[0] = new BoundaryPointSet(MaxPoint[k]);
    2235     Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine->endpoints[0]->node << "." << endl;
     2235    DoLog(0) && (Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine->endpoints[0]->node << "." << endl);
    22362236
    22372237    double ShortestAngle;
     
    22712271
    22722272    // adding point 1 and point 2 and add the line between them
    2273     Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine->endpoints[0]->node << "." << endl;
    2274     Log() << Verbose(0) << "Found second point is at " << *BaseLine->endpoints[1]->node << ".\n";
     2273    DoLog(0) && (Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine->endpoints[0]->node << "." << endl);
     2274    DoLog(0) && (Log() << Verbose(0) << "Found second point is at " << *BaseLine->endpoints[1]->node << ".\n");
    22752275
    22762276    //Log() << Verbose(1) << "INFO: OldSphereCenter is at " << helper << ".\n";
    22772277    CandidateForTesselation OptCandidates(BaseLine);
    22782278    FindThirdPointForTesselation(NormalVector, SearchDirection, SphereCenter, OptCandidates, NULL, RADIUS, LC);
    2279     Log() << Verbose(0) << "List of third Points is:" << endl;
     2279    DoLog(0) && (Log() << Verbose(0) << "List of third Points is:" << endl);
    22802280    for (TesselPointList::iterator it = OptCandidates.pointlist.begin(); it != OptCandidates.pointlist.end(); it++) {
    2281       Log() << Verbose(0) << " " << *(*it) << endl;
     2281      DoLog(0) && (Log() << Verbose(0) << " " << *(*it) << endl);
    22822282    }
    22832283    if (!OptCandidates.pointlist.empty()) {
     
    24652465      break;
    24662466    }
    2467   Log() << Verbose(0) << "Current baseline is " << *CandidateLine.BaseLine << " with ThirdPoint " << *ThirdPoint << " of triangle " << T << "." << endl;
     2467  DoLog(0) && (Log() << Verbose(0) << "Current baseline is " << *CandidateLine.BaseLine << " with ThirdPoint " << *ThirdPoint << " of triangle " << T << "." << endl);
    24682468
    24692469  CandidateLine.T = &T;
     
    24872487    CircleRadius = RADIUS * RADIUS - radius / 4.;
    24882488    CirclePlaneNormal.Normalize();
    2489     Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
    2490 
    2491     Log() << Verbose(1) << "INFO: OldSphereCenter is at " << T.SphereCenter << "." << endl;
     2489    DoLog(1) && (Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl);
     2490
     2491    DoLog(1) && (Log() << Verbose(1) << "INFO: OldSphereCenter is at " << T.SphereCenter << "." << endl);
    24922492
    24932493    // construct SearchDirection and an "outward pointer"
     
    24972497    if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards!
    24982498      SearchDirection.Scale(-1.);
    2499     Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
     2499    DoLog(1) && (Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl);
    25002500    if (fabs(RelativeSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {
    25012501      // rotated the wrong way!
     
    25072507
    25082508  } else {
    2509     Log() << Verbose(0) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and base triangle " << T << " is too big!" << endl;
     2509    DoLog(0) && (Log() << Verbose(0) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and base triangle " << T << " is too big!" << endl);
    25102510  }
    25112511
     
    25142514    return false;
    25152515  }
    2516   Log() << Verbose(0) << "Third Points are: " << endl;
     2516  DoLog(0) && (Log() << Verbose(0) << "Third Points are: " << endl);
    25172517  for (TesselPointList::iterator it = CandidateLine.pointlist.begin(); it != CandidateLine.pointlist.end(); ++it) {
    2518     Log() << Verbose(0) << " " << *(*it) << endl;
     2518    DoLog(0) && (Log() << Verbose(0) << " " << *(*it) << endl);
    25192519  }
    25202520
     
    25392539    if (baseline->pointlist.empty()) {
    25402540      T = (((baseline->BaseLine->triangles.begin()))->second);
    2541       Log() << Verbose(1) << "Finding best candidate for open line " << *baseline->BaseLine << " of triangle " << *T << endl;
     2541      DoLog(1) && (Log() << Verbose(1) << "Finding best candidate for open line " << *baseline->BaseLine << " of triangle " << *T << endl);
    25422542      TesselationFailFlag = TesselationFailFlag && FindNextSuitableTriangle(*baseline, *T, RADIUS, LCList); //the line is there, so there is a triangle, but only one.
    25432543    }
     
    25692569  TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(&SetOfNeighbours, TurningPoint, CandidateLine.BaseLine->endpoints[1]->node->node);
    25702570
    2571   Log() << Verbose(0) << "List of Candidates for Turning Point " << *TurningPoint << ":" << endl;
     2571  DoLog(0) && (Log() << Verbose(0) << "List of Candidates for Turning Point " << *TurningPoint << ":" << endl);
    25722572  for (TesselPointList::iterator TesselRunner = connectedClosestPoints->begin(); TesselRunner != connectedClosestPoints->end(); ++TesselRunner)
    2573     Log() << Verbose(0) << " " << **TesselRunner << endl;
     2573    DoLog(0) && (Log() << Verbose(0) << " " << **TesselRunner << endl);
    25742574
    25752575  // go through all angle-sorted candidates (in degenerate n-nodes case we may have to add multiple triangles)
     
    25782578  Sprinter++;
    25792579  while (Sprinter != connectedClosestPoints->end()) {
    2580     Log() << Verbose(0) << "Current Runner is " << *(*Runner) << " and sprinter is " << *(*Sprinter) << "." << endl;
     2580    DoLog(0) && (Log() << Verbose(0) << "Current Runner is " << *(*Runner) << " and sprinter is " << *(*Sprinter) << "." << endl);
    25812581
    25822582    AddTesselationPoint(TurningPoint, 0);
     
    25912591      // fill the internal open lines with its respective candidate (otherwise lines in degenerate case are not picked)
    25922592      FindDegeneratedCandidatesforOpenLines(*Sprinter, &CandidateLine.OptCenter);
    2593       Log() << Verbose(0) << " There are still more triangles to add." << endl;
     2593      DoLog(0) && (Log() << Verbose(0) << " There are still more triangles to add." << endl);
    25942594    }
    25952595    // pick candidates for other open lines as well
     
    25992599    if (CheckDegeneracy(CandidateLine, RADIUS, LC)) {
    26002600      // add normal and degenerate triangles
    2601       Log() << Verbose(1) << "Triangle of endpoints " << *TPS[0] << "," << *TPS[1] << " and " << *TPS[2] << " is degenerated, adding both sides." << endl;
     2601      DoLog(1) && (Log() << Verbose(1) << "Triangle of endpoints " << *TPS[0] << "," << *TPS[1] << " and " << *TPS[2] << " is degenerated, adding both sides." << endl);
    26022602      AddCandidateTriangle(CandidateLine, OtherOpt);
    26032603
     
    26232623  pair<LineMap::iterator, LineMap::iterator> FindPair = TPS[0]->lines.equal_range(TPS[2]->node->nr);
    26242624  for (LineMap::const_iterator FindLine = FindPair.first; FindLine != FindPair.second; FindLine++) {
    2625     Log() << Verbose(1) << "INFO: Checking line " << *(FindLine->second) << " ..." << endl;
     2625    DoLog(1) && (Log() << Verbose(1) << "INFO: Checking line " << *(FindLine->second) << " ..." << endl);
    26262626    // If there is a line with less than two attached triangles, we don't need a new line.
    26272627    if (FindLine->second->triangles.size() == 1) {
    26282628      CandidateMap::iterator Finder = OpenLines.find(FindLine->second);
    26292629      if (!Finder->second->pointlist.empty())
    2630         Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with candidate " << **(Finder->second->pointlist.begin()) << "." << endl;
     2630        DoLog(1) && (Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with candidate " << **(Finder->second->pointlist.begin()) << "." << endl);
    26312631      else {
    2632         Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with no candidate, setting to next Sprinter" << (*Sprinter) << endl;
     2632        DoLog(1) && (Log() << Verbose(1) << "INFO: line " << *(FindLine->second) << " is open with no candidate, setting to next Sprinter" << (*Sprinter) << endl);
    26332633        Finder->second->pointlist.push_back(Sprinter);
    26342634        Finder->second->ShortestAngle = 0.;
     
    26542654
    26552655  /// 1. Create or pick the lines for the first triangle
    2656   Log() << Verbose(0) << "INFO: Creating/Picking lines for first triangle ..." << endl;
     2656  DoLog(0) && (Log() << Verbose(0) << "INFO: Creating/Picking lines for first triangle ..." << endl);
    26572657  for (int i = 0; i < 3; i++) {
    26582658    BLS[i] = NULL;
    2659     Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl;
     2659    DoLog(0) && (Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl);
    26602660    AddTesselationLine(&CandidateLine.OptCenter, TPS[(i + 2) % 3], TPS[(i + 0) % 3], TPS[(i + 1) % 3], i);
    26612661  }
    26622662
    26632663  /// 2. create the first triangle and NormalVector and so on
    2664   Log() << Verbose(0) << "INFO: Adding first triangle with center at " << CandidateLine.OptCenter << " ..." << endl;
     2664  DoLog(0) && (Log() << Verbose(0) << "INFO: Adding first triangle with center at " << CandidateLine.OptCenter << " ..." << endl);
    26652665  BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
    26662666  AddTesselationTriangle();
     
    26732673  // give some verbose output about the whole procedure
    26742674  if (CandidateLine.T != NULL)
    2675     Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "." << endl;
     2675    DoLog(0) && (Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "." << endl);
    26762676  else
    2677     Log() << Verbose(0) << "--> New starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle." << endl;
     2677    DoLog(0) && (Log() << Verbose(0) << "--> New starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle." << endl);
    26782678  triangle = BTS;
    26792679
    26802680  /// 3. Gather candidates for each new line
    2681   Log() << Verbose(0) << "INFO: Adding candidates to new lines ..." << endl;
     2681  DoLog(0) && (Log() << Verbose(0) << "INFO: Adding candidates to new lines ..." << endl);
    26822682  for (int i = 0; i < 3; i++) {
    2683     Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl;
     2683    DoLog(0) && (Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl);
    26842684    CandidateCheck = OpenLines.find(BLS[i]);
    26852685    if ((CandidateCheck != OpenLines.end()) && (CandidateCheck->second->pointlist.empty())) {
     
    26912691
    26922692  /// 4. Create or pick the lines for the second triangle
    2693   Log() << Verbose(0) << "INFO: Creating/Picking lines for second triangle ..." << endl;
     2693  DoLog(0) && (Log() << Verbose(0) << "INFO: Creating/Picking lines for second triangle ..." << endl);
    26942694  for (int i = 0; i < 3; i++) {
    2695     Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl;
     2695    DoLog(0) && (Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl);
    26962696    AddTesselationLine(&CandidateLine.OtherOptCenter, TPS[(i + 2) % 3], TPS[(i + 0) % 3], TPS[(i + 1) % 3], i);
    26972697  }
    26982698
    26992699  /// 5. create the second triangle and NormalVector and so on
    2700   Log() << Verbose(0) << "INFO: Adding second triangle with center at " << CandidateLine.OtherOptCenter << " ..." << endl;
     2700  DoLog(0) && (Log() << Verbose(0) << "INFO: Adding second triangle with center at " << CandidateLine.OtherOptCenter << " ..." << endl);
    27012701  BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
    27022702  AddTesselationTriangle();
     
    27082708  // give some verbose output about the whole procedure
    27092709  if (CandidateLine.T != NULL)
    2710     Log() << Verbose(0) << "--> New degenerate triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "." << endl;
     2710    DoLog(0) && (Log() << Verbose(0) << "--> New degenerate triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "." << endl);
    27112711  else
    2712     Log() << Verbose(0) << "--> New degenerate starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle." << endl;
     2712    DoLog(0) && (Log() << Verbose(0) << "--> New degenerate starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle." << endl);
    27132713
    27142714  /// 6. Adding triangle to new lines
    2715   Log() << Verbose(0) << "INFO: Adding second triangles to new lines ..." << endl;
     2715  DoLog(0) && (Log() << Verbose(0) << "INFO: Adding second triangles to new lines ..." << endl);
    27162716  for (int i = 0; i < 3; i++) {
    2717     Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl;
     2717    DoLog(0) && (Log() << Verbose(0) << "Current line is between " << *TPS[(i + 0) % 3] << " and " << *TPS[(i + 1) % 3] << ":" << endl);
    27182718    CandidateCheck = OpenLines.find(BLS[i]);
    27192719    if ((CandidateCheck != OpenLines.end()) && (CandidateCheck->second->pointlist.empty())) {
     
    27532753  // give some verbose output about the whole procedure
    27542754  if (CandidateLine.T != NULL)
    2755     Log() << Verbose(0) << "--> New" << ((type == OtherOpt) ? " degenerate " : " ") << "triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "." << endl;
     2755    DoLog(0) && (Log() << Verbose(0) << "--> New" << ((type == OtherOpt) ? " degenerate " : " ") << "triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "." << endl);
    27562756  else
    2757     Log() << Verbose(0) << "--> New" << ((type == OtherOpt) ? " degenerate " : " ") << "starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle." << endl;
     2757    DoLog(0) && (Log() << Verbose(0) << "--> New" << ((type == OtherOpt) ? " degenerate " : " ") << "starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle." << endl);
    27582758}
    27592759;
     
    27802780  OtherBase = new class BoundaryLineSet(BPS, -1);
    27812781
    2782   Log() << Verbose(1) << "INFO: Current base line is " << *Base << "." << endl;
    2783   Log() << Verbose(1) << "INFO: Other base line is " << *OtherBase << "." << endl;
     2782  DoLog(1) && (Log() << Verbose(1) << "INFO: Current base line is " << *Base << "." << endl);
     2783  DoLog(1) && (Log() << Verbose(1) << "INFO: Other base line is " << *OtherBase << "." << endl);
    27842784
    27852785  // get the closest point on each line to the other line
     
    28012801  delete (ClosestPoint);
    28022802  if ((distance[0] * distance[1]) > 0) { // have same sign?
    2803     Log() << Verbose(1) << "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1] << ". " << *Base << "' rectangle is concave." << endl;
     2803    DoLog(1) && (Log() << Verbose(1) << "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1] << ". " << *Base << "' rectangle is concave." << endl);
    28042804    if (distance[0] < distance[1]) {
    28052805      Spot = Base->endpoints[0];
     
    28092809    return Spot;
    28102810  } else { // different sign, i.e. we are in between
    2811     Log() << Verbose(0) << "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex." << endl;
     2811    DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex." << endl);
    28122812    return NULL;
    28132813  }
     
    28202820  Info FunctionInfo(__func__);
    28212821  // print all lines
    2822   Log() << Verbose(0) << "Printing all boundary points for debugging:" << endl;
     2822  DoLog(0) && (Log() << Verbose(0) << "Printing all boundary points for debugging:" << endl);
    28232823  for (PointMap::const_iterator PointRunner = PointsOnBoundary.begin(); PointRunner != PointsOnBoundary.end(); PointRunner++)
    2824     Log() << Verbose(0) << *(PointRunner->second) << endl;
     2824    DoLog(0) && (Log() << Verbose(0) << *(PointRunner->second) << endl);
    28252825}
    28262826;
     
    28302830  Info FunctionInfo(__func__);
    28312831  // print all lines
    2832   Log() << Verbose(0) << "Printing all boundary lines for debugging:" << endl;
     2832  DoLog(0) && (Log() << Verbose(0) << "Printing all boundary lines for debugging:" << endl);
    28332833  for (LineMap::const_iterator LineRunner = LinesOnBoundary.begin(); LineRunner != LinesOnBoundary.end(); LineRunner++)
    2834     Log() << Verbose(0) << *(LineRunner->second) << endl;
     2834    DoLog(0) && (Log() << Verbose(0) << *(LineRunner->second) << endl);
    28352835}
    28362836;
     
    28402840  Info FunctionInfo(__func__);
    28412841  // print all triangles
    2842   Log() << Verbose(0) << "Printing all boundary triangles for debugging:" << endl;
     2842  DoLog(0) && (Log() << Verbose(0) << "Printing all boundary triangles for debugging:" << endl);
    28432843  for (TriangleMap::const_iterator TriangleRunner = TrianglesOnBoundary.begin(); TriangleRunner != TrianglesOnBoundary.end(); TriangleRunner++)
    2844     Log() << Verbose(0) << *(TriangleRunner->second) << endl;
     2844    DoLog(0) && (Log() << Verbose(0) << *(TriangleRunner->second) << endl);
    28452845}
    28462846;
     
    28652865  OtherBase = new class BoundaryLineSet(BPS, -1);
    28662866
    2867   Log() << Verbose(0) << "INFO: Current base line is " << *Base << "." << endl;
    2868   Log() << Verbose(0) << "INFO: Other base line is " << *OtherBase << "." << endl;
     2867  DoLog(0) && (Log() << Verbose(0) << "INFO: Current base line is " << *Base << "." << endl);
     2868  DoLog(0) && (Log() << Verbose(0) << "INFO: Other base line is " << *OtherBase << "." << endl);
    28692869
    28702870  // get the closest point on each line to the other line
     
    28862886
    28872887  if (Distance.NormSquared() < MYEPSILON) { // check for intersection
    2888     Log() << Verbose(0) << "REJECT: Both lines have an intersection: Nothing to do." << endl;
     2888    DoLog(0) && (Log() << Verbose(0) << "REJECT: Both lines have an intersection: Nothing to do." << endl);
    28892889    return false;
    28902890  } else { // check for sign against BaseLineNormal
     
    28962896    }
    28972897    for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) {
    2898       Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;
     2898      DoLog(1) && (Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl);
    28992899      BaseLineNormal.AddVector(&(runner->second->NormalVector));
    29002900    }
     
    29022902
    29032903    if (Distance.ScalarProduct(&BaseLineNormal) > MYEPSILON) { // Distance points outwards, hence OtherBase higher than Base -> flip
    2904       Log() << Verbose(0) << "ACCEPT: Other base line would be higher: Flipping baseline." << endl;
     2904      DoLog(0) && (Log() << Verbose(0) << "ACCEPT: Other base line would be higher: Flipping baseline." << endl);
    29052905      // calculate volume summand as a general tetraeder
    29062906      return volume;
    29072907    } else { // Base higher than OtherBase -> do nothing
    2908       Log() << Verbose(0) << "REJECT: Base line is higher: Nothing to do." << endl;
     2908      DoLog(0) && (Log() << Verbose(0) << "REJECT: Base line is higher: Nothing to do." << endl);
    29092909      return 0.;
    29102910    }
     
    29362936  }
    29372937  for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) {
    2938     Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;
     2938    DoLog(1) && (Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl);
    29392939    BaseLineNormal.AddVector(&(runner->second->NormalVector));
    29402940  }
     
    29492949  i = 0;
    29502950  m = 0;
    2951   Log() << Verbose(0) << "The four old lines are: ";
     2951  DoLog(0) && (Log() << Verbose(0) << "The four old lines are: ");
    29522952  for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++)
    29532953    for (int j = 0; j < 3; j++) // all of their endpoints and baselines
    29542954      if (runner->second->lines[j] != Base) { // pick not the central baseline
    29552955        OldLines[i++] = runner->second->lines[j];
    2956         Log() << Verbose(0) << *runner->second->lines[j] << "\t";
     2956        DoLog(0) && (Log() << Verbose(0) << *runner->second->lines[j] << "\t");
    29572957      }
    2958   Log() << Verbose(0) << endl;
    2959   Log() << Verbose(0) << "The two old points are: ";
     2958  DoLog(0) && (Log() << Verbose(0) << endl);
     2959  DoLog(0) && (Log() << Verbose(0) << "The two old points are: ");
    29602960  for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++)
    29612961    for (int j = 0; j < 3; j++) // all of their endpoints and baselines
    29622962      if (!Base->ContainsBoundaryPoint(runner->second->endpoints[j])) { // and neither of its endpoints
    29632963        OldPoints[m++] = runner->second->endpoints[j];
    2964         Log() << Verbose(0) << *runner->second->endpoints[j] << "\t";
     2964        DoLog(0) && (Log() << Verbose(0) << *runner->second->endpoints[j] << "\t");
    29652965      }
    2966   Log() << Verbose(0) << endl;
     2966  DoLog(0) && (Log() << Verbose(0) << endl);
    29672967
    29682968  // check whether everything is in place to create new lines and triangles
     
    29832983
    29842984  // remove triangles and baseline removes itself
    2985   Log() << Verbose(0) << "INFO: Deleting baseline " << *Base << " from global list." << endl;
     2985  DoLog(0) && (Log() << Verbose(0) << "INFO: Deleting baseline " << *Base << " from global list." << endl);
    29862986  OldBaseLineNr = Base->Nr;
    29872987  m = 0;
    29882988  for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) {
    2989     Log() << Verbose(0) << "INFO: Deleting triangle " << *(runner->second) << "." << endl;
     2989    DoLog(0) && (Log() << Verbose(0) << "INFO: Deleting triangle " << *(runner->second) << "." << endl);
    29902990    OldTriangleNrs[m++] = runner->second->Nr;
    29912991    RemoveTesselationTriangle(runner->second);
     
    29972997  NewLine = new class BoundaryLineSet(BPS, OldBaseLineNr);
    29982998  LinesOnBoundary.insert(LinePair(OldBaseLineNr, NewLine)); // no need for check for unique insertion as NewLine is definitely a new one
    2999   Log() << Verbose(0) << "INFO: Created new baseline " << *NewLine << "." << endl;
     2999  DoLog(0) && (Log() << Verbose(0) << "INFO: Created new baseline " << *NewLine << "." << endl);
    30003000
    30013001  // construct new triangles with flipped baseline
     
    30123012    BTS->GetNormalVector(BaseLineNormal);
    30133013    AddTesselationTriangle(OldTriangleNrs[0]);
    3014     Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl;
     3014    DoLog(0) && (Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl);
    30153015
    30163016    BLS[0] = (i == 2 ? OldLines[3] : OldLines[2]);
     
    30203020    BTS->GetNormalVector(BaseLineNormal);
    30213021    AddTesselationTriangle(OldTriangleNrs[1]);
    3022     Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl;
     3022    DoLog(0) && (Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl);
    30233023  } else {
    30243024    DoeLog(0) && (eLog() << Verbose(0) << "The four old lines do not connect, something's utterly wrong here!" << endl);
     
    30613061    Nupper[i] = ((N[i] + 1) < LC->N[i]) ? N[i] + 1 : LC->N[i] - 1;
    30623062  }
    3063   Log() << Verbose(0) << "LC Intervals from [" << N[0] << "<->" << LC->N[0] << ", " << N[1] << "<->" << LC->N[1] << ", " << N[2] << "<->" << LC->N[2] << "] :" << " [" << Nlower[0] << "," << Nupper[0] << "], " << " [" << Nlower[1] << "," << Nupper[1] << "], " << " [" << Nlower[2] << "," << Nupper[2] << "], " << endl;
     3063  DoLog(0) && (Log() << Verbose(0) << "LC Intervals from [" << N[0] << "<->" << LC->N[0] << ", " << N[1] << "<->" << LC->N[1] << ", " << N[2] << "<->" << LC->N[2] << "] :" << " [" << Nlower[0] << "," << Nupper[0] << "], " << " [" << Nlower[1] << "," << Nupper[1] << "], " << " [" << Nlower[2] << "," << Nupper[2] << "], " << endl);
    30643064
    30653065  for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++)
     
    30993099                if (angle < Storage[0]) {
    31003100                  //Log() << Verbose(1) << "Old values of Storage: %lf %lf \n", Storage[0], Storage[1]);
    3101                   Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << ".\n";
     3101                  DoLog(1) && (Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << ".\n");
    31023102                  OptCandidate = Candidate;
    31033103                  Storage[0] = angle;
     
    31143114          }
    31153115        } else {
    3116           Log() << Verbose(0) << "Linked cell list is empty." << endl;
     3116          DoLog(0) && (Log() << Verbose(0) << "Linked cell list is empty." << endl);
    31173117        }
    31183118      }
     
    31693169  TesselPoint *Candidate = NULL;
    31703170
    3171   Log() << Verbose(1) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl;
     3171  DoLog(1) && (Log() << Verbose(1) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl);
    31723172
    31733173  // copy old center
     
    31933193    CircleRadius = RADIUS * RADIUS - radius;
    31943194    CirclePlaneNormal.Normalize();
    3195     Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
     3195    DoLog(1) && (Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl);
    31963196
    31973197    // test whether old center is on the band's plane
     
    32023202    radius = RelativeOldSphereCenter.NormSquared();
    32033203    if (fabs(radius - CircleRadius) < HULLEPSILON) {
    3204       Log() << Verbose(1) << "INFO: RelativeOldSphereCenter is at " << RelativeOldSphereCenter << "." << endl;
     3204      DoLog(1) && (Log() << Verbose(1) << "INFO: RelativeOldSphereCenter is at " << RelativeOldSphereCenter << "." << endl);
    32053205
    32063206      // check SearchDirection
    3207       Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
     3207      DoLog(1) && (Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl);
    32083208      if (fabs(RelativeOldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) { // rotated the wrong way!
    32093209        DoeLog(1) && (eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are not orthogonal!" << endl);
     
    32373237
    32383238                // check for three unique points
    3239                 Log() << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " for BaseLine " << *CandidateLine.BaseLine << " with OldSphereCenter " << OldSphereCenter << "." << endl;
     3239                DoLog(2) && (Log() << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " for BaseLine " << *CandidateLine.BaseLine << " with OldSphereCenter " << OldSphereCenter << "." << endl);
    32403240                if ((Candidate != CandidateLine.BaseLine->endpoints[0]->node) && (Candidate != CandidateLine.BaseLine->endpoints[1]->node)) {
    32413241
    32423242                  // find center on the plane
    32433243                  GetCenterofCircumcircle(&NewPlaneCenter, *CandidateLine.BaseLine->endpoints[0]->node->node, *CandidateLine.BaseLine->endpoints[1]->node->node, *Candidate->node);
    3244                   Log() << Verbose(1) << "INFO: NewPlaneCenter is " << NewPlaneCenter << "." << endl;
     3244                  DoLog(1) && (Log() << Verbose(1) << "INFO: NewPlaneCenter is " << NewPlaneCenter << "." << endl);
    32453245
    32463246                  if (NewNormalVector.MakeNormalVector(CandidateLine.BaseLine->endpoints[0]->node->node, CandidateLine.BaseLine->endpoints[1]->node->node, Candidate->node) && (fabs(NewNormalVector.NormSquared()) > HULLEPSILON)) {
    3247                     Log() << Verbose(1) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl;
     3247                    DoLog(1) && (Log() << Verbose(1) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl);
    32483248                    radius = CandidateLine.BaseLine->endpoints[0]->node->node->DistanceSquared(&NewPlaneCenter);
    3249                     Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
    3250                     Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
    3251                     Log() << Verbose(1) << "INFO: Radius of CircumCenterCircle is " << radius << "." << endl;
     3249                    DoLog(1) && (Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl);
     3250                    DoLog(1) && (Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl);
     3251                    DoLog(1) && (Log() << Verbose(1) << "INFO: Radius of CircumCenterCircle is " << radius << "." << endl);
    32523252                    if (radius < RADIUS * RADIUS) {
    32533253                      otherradius = CandidateLine.BaseLine->endpoints[1]->node->node->DistanceSquared(&NewPlaneCenter);
     
    32603260                      helper.CopyVector(&NewNormalVector);
    32613261                      helper.Scale(sqrt(RADIUS * RADIUS - radius));
    3262                       Log() << Verbose(2) << "INFO: Distance of NewPlaneCenter " << NewPlaneCenter << " to either NewSphereCenter is " << helper.Norm() << " of vector " << helper << " with sphere radius " << RADIUS << "." << endl;
     3262                      DoLog(2) && (Log() << Verbose(2) << "INFO: Distance of NewPlaneCenter " << NewPlaneCenter << " to either NewSphereCenter is " << helper.Norm() << " of vector " << helper << " with sphere radius " << RADIUS << "." << endl);
    32633263                      NewSphereCenter.AddVector(&helper);
    3264                       Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl;
     3264                      DoLog(2) && (Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl);
    32653265                      // OtherNewSphereCenter is created by the same vector just in the other direction
    32663266                      helper.Scale(-1.);
    32673267                      OtherNewSphereCenter.AddVector(&helper);
    3268                       Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl;
     3268                      DoLog(2) && (Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl);
    32693269
    32703270                      alpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, NewSphereCenter, OldSphereCenter, NormalVector, SearchDirection);
     
    32853285                        if ((CandidateLine.ShortestAngle - HULLEPSILON) < alpha) {
    32863286                          CandidateLine.pointlist.push_back(Candidate);
    3287                           Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl;
     3287                          DoLog(0) && (Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl);
    32883288                        } else {
    32893289                          // remove all candidates from the list and then the list itself
    32903290                          CandidateLine.pointlist.clear();
    32913291                          CandidateLine.pointlist.push_back(Candidate);
    3292                           Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl;
     3292                          DoLog(0) && (Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with " << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl);
    32933293                        }
    32943294                        CandidateLine.ShortestAngle = alpha;
    3295                         Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl;
     3295                        DoLog(0) && (Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl);
    32963296                      } else {
    32973297                        if ((Candidate != NULL) && (CandidateLine.pointlist.begin() != CandidateLine.pointlist.end())) {
    3298                           Log() << Verbose(1) << "REJECT: Old candidate " << *(*CandidateLine.pointlist.begin()) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl;
     3298                          DoLog(1) && (Log() << Verbose(1) << "REJECT: Old candidate " << *(*CandidateLine.pointlist.begin()) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl);
    32993299                        } else {
    3300                           Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl;
     3300                          DoLog(1) && (Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl);
    33013301                        }
    33023302                      }
    33033303                    } else {
    3304                       Log() << Verbose(1) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl;
     3304                      DoLog(1) && (Log() << Verbose(1) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl);
    33053305                    }
    33063306                  } else {
    3307                     Log() << Verbose(1) << "REJECT: Three points from " << *CandidateLine.BaseLine << " and Candidate " << *Candidate << " are linear-dependent." << endl;
     3307                    DoLog(1) && (Log() << Verbose(1) << "REJECT: Three points from " << *CandidateLine.BaseLine << " and Candidate " << *Candidate << " are linear-dependent." << endl);
    33083308                  }
    33093309                } else {
    33103310                  if (ThirdPoint != NULL) {
    3311                     Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " and " << *ThirdPoint << " contains Candidate " << *Candidate << "." << endl;
     3311                    DoLog(1) && (Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " and " << *ThirdPoint << " contains Candidate " << *Candidate << "." << endl);
    33123312                  } else {
    3313                     Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " contains Candidate " << *Candidate << "." << endl;
     3313                    DoLog(1) && (Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " contains Candidate " << *Candidate << "." << endl);
    33143314                  }
    33153315                }
     
    33223322  } else {
    33233323    if (ThirdPoint != NULL)
    3324       Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and third node " << *ThirdPoint << " is too big!" << endl;
     3324      DoLog(1) && (Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and third node " << *ThirdPoint << " is too big!" << endl);
    33253325    else
    3326       Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " is too big!" << endl;
     3326      DoLog(1) && (Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " is too big!" << endl);
    33273327  }
    33283328
     
    33583358      if (!OrderTest.second) { // if insertion fails, we have common endpoint
    33593359        node = OrderTest.first->second;
    3360         Log() << Verbose(1) << "Common endpoint of lines " << *line1 << " and " << *line2 << " is: " << *node << "." << endl;
     3360        DoLog(1) && (Log() << Verbose(1) << "Common endpoint of lines " << *line1 << " and " << *line2 << " is: " << *node << "." << endl);
    33613361        j = 2;
    33623362        i = 2;
     
    33883388  for (int i = 0; i < NDIM; i++) // store indices of this cell
    33893389    N[i] = LC->n[i];
    3390   Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
     3390  DoLog(1) && (Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl);
    33913391  DistanceToPointMap * points = new DistanceToPointMap;
    33923392  LC->GetNeighbourBounds(Nlower, Nupper);
     
    34023402            if (FindPoint != PointsOnBoundary.end()) {
    34033403              points->insert(DistanceToPointPair(FindPoint->second->node->node->DistanceSquared(x), FindPoint->second));
    3404               Log() << Verbose(1) << "INFO: Putting " << *FindPoint->second << " into the list." << endl;
     3404              DoLog(1) && (Log() << Verbose(1) << "INFO: Putting " << *FindPoint->second << " into the list." << endl);
    34053405            }
    34063406          }
     
    34363436
    34373437  // for each point, check its lines, remember closest
    3438   Log() << Verbose(1) << "Finding closest BoundaryLine to " << *x << " ... " << endl;
     3438  DoLog(1) && (Log() << Verbose(1) << "Finding closest BoundaryLine to " << *x << " ... " << endl);
    34393439  BoundaryLineSet *ClosestLine = NULL;
    34403440  double MinDistance = -1.;
     
    34673467          ClosestLine = LineRunner->second;
    34683468          MinDistance = distance;
    3469           Log() << Verbose(1) << "ACCEPT: New closest line is " << *ClosestLine << " with projected distance " << MinDistance << "." << endl;
     3469          DoLog(1) && (Log() << Verbose(1) << "ACCEPT: New closest line is " << *ClosestLine << " with projected distance " << MinDistance << "." << endl);
    34703470        } else {
    3471           Log() << Verbose(1) << "REJECT: Intersection is outside of the line section: " << lengthA << " and " << lengthB << "." << endl;
     3471          DoLog(1) && (Log() << Verbose(1) << "REJECT: Intersection is outside of the line section: " << lengthA << " and " << lengthB << "." << endl);
    34723472        }
    34733473      } else {
    3474         Log() << Verbose(1) << "REJECT: Point is too further away than present line: " << distance << " >> " << MinDistance << "." << endl;
     3474        DoLog(1) && (Log() << Verbose(1) << "REJECT: Point is too further away than present line: " << distance << " >> " << MinDistance << "." << endl);
    34753475      }
    34763476    }
     
    34793479  // check whether closest line is "too close" :), then it's inside
    34803480  if (ClosestLine == NULL) {
    3481     Log() << Verbose(0) << "Is the only point, no one else is closeby." << endl;
     3481    DoLog(0) && (Log() << Verbose(0) << "Is the only point, no one else is closeby." << endl);
    34823482    return NULL;
    34833483  }
     
    35023502
    35033503  // for each point, check its lines, remember closest
    3504   Log() << Verbose(1) << "Finding closest BoundaryTriangle to " << *x << " ... " << endl;
     3504  DoLog(1) && (Log() << Verbose(1) << "Finding closest BoundaryTriangle to " << *x << " ... " << endl);
    35053505  LineSet ClosestLines;
    35063506  double MinDistance = 1e+16;
     
    35303530          ClosestLines.insert(LineRunner->second);
    35313531          MinDistance = lengthEnd;
    3532           Log() << Verbose(1) << "ACCEPT: Line " << *LineRunner->second << " to endpoint " << *LineRunner->second->endpoints[0]->node << " is closer with " << lengthEnd << "." << endl;
     3532          DoLog(1) && (Log() << Verbose(1) << "ACCEPT: Line " << *LineRunner->second << " to endpoint " << *LineRunner->second->endpoints[0]->node << " is closer with " << lengthEnd << "." << endl);
    35333533        } else if (fabs(lengthEnd - MinDistance) < MYEPSILON) { // additional best candidate
    35343534          ClosestLines.insert(LineRunner->second);
    3535           Log() << Verbose(1) << "ACCEPT: Line " << *LineRunner->second << " to endpoint " << *LineRunner->second->endpoints[1]->node << " is equally good with " << lengthEnd << "." << endl;
     3535          DoLog(1) && (Log() << Verbose(1) << "ACCEPT: Line " << *LineRunner->second << " to endpoint " << *LineRunner->second->endpoints[1]->node << " is equally good with " << lengthEnd << "." << endl);
    35363536        } else { // line is worse
    3537           Log() << Verbose(1) << "REJECT: Line " << *LineRunner->second << " to either endpoints is further away than present closest line candidate: " << lengthEndA << ", " << lengthEndB << ", and distance is longer than baseline:" << lengthBase << "." << endl;
     3537          DoLog(1) && (Log() << Verbose(1) << "REJECT: Line " << *LineRunner->second << " to either endpoints is further away than present closest line candidate: " << lengthEndA << ", " << lengthEndB << ", and distance is longer than baseline:" << lengthBase << "." << endl);
    35383538        }
    35393539      } else { // intersection is closer, calculate
     
    35513551          ClosestLines.insert(LineRunner->second);
    35523552          MinDistance = distance;
    3553           Log() << Verbose(1) << "ACCEPT: Intersection in between endpoints, new closest line " << *LineRunner->second << " is " << *ClosestLines.begin() << " with projected distance " << MinDistance << "." << endl;
     3553          DoLog(1) && (Log() << Verbose(1) << "ACCEPT: Intersection in between endpoints, new closest line " << *LineRunner->second << " is " << *ClosestLines.begin() << " with projected distance " << MinDistance << "." << endl);
    35543554        } else {
    3555           Log() << Verbose(2) << "REJECT: Point is further away from line " << *LineRunner->second << " than present closest line: " << distance << " >> " << MinDistance << "." << endl;
     3555          DoLog(2) && (Log() << Verbose(2) << "REJECT: Point is further away from line " << *LineRunner->second << " than present closest line: " << distance << " >> " << MinDistance << "." << endl);
    35563556        }
    35573557      }
     
    35623562  // check whether closest line is "too close" :), then it's inside
    35633563  if (ClosestLines.empty()) {
    3564     Log() << Verbose(0) << "Is the only point, no one else is closeby." << endl;
     3564    DoLog(0) && (Log() << Verbose(0) << "Is the only point, no one else is closeby." << endl);
    35653565    return NULL;
    35663566  }
     
    36033603      result = *Runner;
    36043604      MinAlignment = Alignment;
    3605       Log() << Verbose(1) << "ACCEPT: Triangle " << *result << " is better aligned with " << MinAlignment << "." << endl;
     3605      DoLog(1) && (Log() << Verbose(1) << "ACCEPT: Triangle " << *result << " is better aligned with " << MinAlignment << "." << endl);
    36063606    } else {
    3607       Log() << Verbose(1) << "REJECT: Triangle " << *result << " is worse aligned with " << MinAlignment << "." << endl;
     3607      DoLog(1) && (Log() << Verbose(1) << "REJECT: Triangle " << *result << " is worse aligned with " << MinAlignment << "." << endl);
    36083608    }
    36093609  }
     
    36583658
    36593659  if (triangle == NULL) {// is boundary point or only point in point cloud?
    3660     Log() << Verbose(1) << "No triangle given!" << endl;
     3660    DoLog(1) && (Log() << Verbose(1) << "No triangle given!" << endl);
    36613661    return -1.;
    36623662  } else {
    3663     Log() << Verbose(1) << "INFO: Closest triangle found is " << *triangle << " with normal vector " << triangle->NormalVector << "." << endl;
     3663    DoLog(1) && (Log() << Verbose(1) << "INFO: Closest triangle found is " << *triangle << " with normal vector " << triangle->NormalVector << "." << endl);
    36643664  }
    36653665
    36663666  triangle->GetCenter(&Center);
    3667   Log() << Verbose(2) << "INFO: Central point of the triangle is " << Center << "." << endl;
     3667  DoLog(2) && (Log() << Verbose(2) << "INFO: Central point of the triangle is " << Center << "." << endl);
    36683668  DistanceToCenter.CopyVector(&Center);
    36693669  DistanceToCenter.SubtractVector(&Point);
    3670   Log() << Verbose(2) << "INFO: Vector from point to test to center is " << DistanceToCenter << "." << endl;
     3670  DoLog(2) && (Log() << Verbose(2) << "INFO: Vector from point to test to center is " << DistanceToCenter << "." << endl);
    36713671
    36723672  // check whether we are on boundary
     
    36773677    Center.SubtractVector(&triangle->NormalVector); // points towards MolCenter
    36783678    DistanceToCenter.AddVector(&triangle->NormalVector); // points outside
    3679     Log() << Verbose(1) << "INFO: Calling Intersection with " << Center << " and " << DistanceToCenter << "." << endl;
     3679    DoLog(1) && (Log() << Verbose(1) << "INFO: Calling Intersection with " << Center << " and " << DistanceToCenter << "." << endl);
    36803680    if (triangle->GetIntersectionInsideTriangle(&Center, &DistanceToCenter, &Intersection)) {
    3681       Log() << Verbose(1) << Point << " is inner point: sufficiently close to boundary, " << Intersection << "." << endl;
     3681      DoLog(1) && (Log() << Verbose(1) << Point << " is inner point: sufficiently close to boundary, " << Intersection << "." << endl);
    36823682      return 0.;
    36833683    } else {
    3684       Log() << Verbose(1) << Point << " is NOT an inner point: on triangle plane but outside of triangle bounds." << endl;
     3684      DoLog(1) && (Log() << Verbose(1) << Point << " is NOT an inner point: on triangle plane but outside of triangle bounds." << endl);
    36853685      return false;
    36863686    }
     
    36883688    // calculate smallest distance
    36893689    distance = triangle->GetClosestPointInsideTriangle(&Point, &Intersection);
    3690     Log() << Verbose(1) << "Closest point on triangle is " << Intersection << "." << endl;
     3690    DoLog(1) && (Log() << Verbose(1) << "Closest point on triangle is " << Intersection << "." << endl);
    36913691
    36923692    // then check direction to boundary
    36933693    if (DistanceToCenter.ScalarProduct(&triangle->NormalVector) > MYEPSILON) {
    3694       Log() << Verbose(1) << Point << " is an inner point, " << distance << " below surface." << endl;
     3694      DoLog(1) && (Log() << Verbose(1) << Point << " is an inner point, " << distance << " below surface." << endl);
    36953695      return -distance;
    36963696    } else {
    3697       Log() << Verbose(1) << Point << " is NOT an inner point, " << distance << " above surface." << endl;
     3697      DoLog(1) && (Log() << Verbose(1) << Point << " is NOT an inner point, " << distance << " above surface." << endl);
    36983698      return +distance;
    36993699    }
     
    37753775
    37763776    if (takePoint) {
    3777       Log() << Verbose(1) << "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted." << endl;
     3777      DoLog(1) && (Log() << Verbose(1) << "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted." << endl);
    37783778      connectedPoints->insert(current);
    37793779    }
     
    38313831  }
    38323832  PlaneNormal.Scale(1.0 / triangles->size());
    3833   Log() << Verbose(1) << "INFO: Calculated PlaneNormal of all circle points is " << PlaneNormal << "." << endl;
     3833  DoLog(1) && (Log() << Verbose(1) << "INFO: Calculated PlaneNormal of all circle points is " << PlaneNormal << "." << endl);
    38343834  PlaneNormal.Normalize();
    38353835
     
    38413841  }
    38423842  if ((Reference == NULL) || (AngleZero.NormSquared() < MYEPSILON)) {
    3843     Log() << Verbose(1) << "Using alternatively " << *(*SetOfNeighbours->begin())->node << " as angle 0 referencer." << endl;
     3843    DoLog(1) && (Log() << Verbose(1) << "Using alternatively " << *(*SetOfNeighbours->begin())->node << " as angle 0 referencer." << endl);
    38443844    AngleZero.CopyVector((*SetOfNeighbours->begin())->node);
    38453845    AngleZero.SubtractVector(Point->node);
     
    38503850    }
    38513851  }
    3852   Log() << Verbose(1) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl;
     3852  DoLog(1) && (Log() << Verbose(1) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl);
    38533853  if (AngleZero.NormSquared() > MYEPSILON)
    38543854    OrthogonalVector.MakeNormalVector(&PlaneNormal, &AngleZero);
    38553855  else
    38563856    OrthogonalVector.MakeNormalVector(&PlaneNormal);
    3857   Log() << Verbose(1) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl;
     3857  DoLog(1) && (Log() << Verbose(1) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl);
    38583858
    38593859  // go through all connected points and calculate angle
     
    38633863    helper.ProjectOntoPlane(&PlaneNormal);
    38643864    double angle = GetAngle(helper, AngleZero, OrthogonalVector);
    3865     Log() << Verbose(0) << "INFO: Calculated angle is " << angle << " for point " << **listRunner << "." << endl;
     3865    DoLog(0) && (Log() << Verbose(0) << "INFO: Calculated angle is " << angle << " for point " << **listRunner << "." << endl);
    38663866    anglesOfPoints.insert(pair<double, TesselPoint*> (angle, (*listRunner)));
    38673867  }
     
    39093909  }
    39103910
    3911   Log() << Verbose(1) << "INFO: Point is " << *Point << " and Reference is " << *Reference << "." << endl;
     3911  DoLog(1) && (Log() << Verbose(1) << "INFO: Point is " << *Point << " and Reference is " << *Reference << "." << endl);
    39123912  // calculate central point
    39133913  TesselPointSet::const_iterator TesselA = SetOfNeighbours->begin();
     
    39203920  while (TesselC != SetOfNeighbours->end()) {
    39213921    helper.MakeNormalVector((*TesselA)->node, (*TesselB)->node, (*TesselC)->node);
    3922     Log() << Verbose(0) << "Making normal vector out of " << *(*TesselA) << ", " << *(*TesselB) << " and " << *(*TesselC) << ":" << helper << endl;
     3922    DoLog(0) && (Log() << Verbose(0) << "Making normal vector out of " << *(*TesselA) << ", " << *(*TesselB) << " and " << *(*TesselC) << ":" << helper << endl);
    39233923    counter++;
    39243924    TesselA++;
     
    39363936  //  PlaneNormal.SubtractVector(&center);
    39373937  //  PlaneNormal.Normalize();
    3938   Log() << Verbose(1) << "INFO: Calculated plane normal of circle is " << PlaneNormal << "." << endl;
     3938  DoLog(1) && (Log() << Verbose(1) << "INFO: Calculated plane normal of circle is " << PlaneNormal << "." << endl);
    39393939
    39403940  // construct one orthogonal vector
     
    39453945  }
    39463946  if ((Reference == NULL) || (AngleZero.NormSquared() < MYEPSILON)) {
    3947     Log() << Verbose(1) << "Using alternatively " << *(*SetOfNeighbours->begin())->node << " as angle 0 referencer." << endl;
     3947    DoLog(1) && (Log() << Verbose(1) << "Using alternatively " << *(*SetOfNeighbours->begin())->node << " as angle 0 referencer." << endl);
    39483948    AngleZero.CopyVector((*SetOfNeighbours->begin())->node);
    39493949    AngleZero.SubtractVector(Point->node);
     
    39543954    }
    39553955  }
    3956   Log() << Verbose(1) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl;
     3956  DoLog(1) && (Log() << Verbose(1) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl);
    39573957  if (AngleZero.NormSquared() > MYEPSILON)
    39583958    OrthogonalVector.MakeNormalVector(&PlaneNormal, &AngleZero);
    39593959  else
    39603960    OrthogonalVector.MakeNormalVector(&PlaneNormal);
    3961   Log() << Verbose(1) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl;
     3961  DoLog(1) && (Log() << Verbose(1) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl);
    39623962
    39633963  // go through all connected points and calculate angle
     
    39703970    if (angle > M_PI) // the correction is of no use here (and not desired)
    39713971      angle = 2. * M_PI - angle;
    3972     Log() << Verbose(0) << "INFO: Calculated angle between " << helper << " and " << AngleZero << " is " << angle << " for point " << **listRunner << "." << endl;
     3972    DoLog(0) && (Log() << Verbose(0) << "INFO: Calculated angle between " << helper << " and " << AngleZero << " is " << angle << " for point " << **listRunner << "." << endl);
    39733973    InserterTest = anglesOfPoints.insert(pair<double, TesselPoint*> (angle, (*listRunner)));
    39743974    if (!InserterTest.second) {
     
    40374037        StartLine = CurrentLine;
    40384038        CurrentPoint = CurrentLine->GetOtherEndpoint(ReferencePoint);
    4039         Log() << Verbose(1) << "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "." << endl;
     4039        DoLog(1) && (Log() << Verbose(1) << "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "." << endl);
    40404040        do {
    40414041          // push current one
    4042           Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;
     4042          DoLog(1) && (Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl);
    40434043          connectedPath->push_back(CurrentPoint->node);
    40444044
    40454045          // find next triangle
    40464046          for (TriangleMap::iterator Runner = CurrentLine->triangles.begin(); Runner != CurrentLine->triangles.end(); Runner++) {
    4047             Log() << Verbose(1) << "INFO: Inspecting triangle " << *Runner->second << "." << endl;
     4047            DoLog(1) && (Log() << Verbose(1) << "INFO: Inspecting triangle " << *Runner->second << "." << endl);
    40484048            if ((Runner->second != triangle)) { // look for first triangle not equal to old one
    40494049              triangle = Runner->second;
     
    40524052                if (!TriangleRunner->second) {
    40534053                  TriangleRunner->second = true;
    4054                   Log() << Verbose(1) << "INFO: Connecting triangle is " << *triangle << "." << endl;
     4054                  DoLog(1) && (Log() << Verbose(1) << "INFO: Connecting triangle is " << *triangle << "." << endl);
    40554055                  break;
    40564056                } else {
    4057                   Log() << Verbose(1) << "INFO: Skipping " << *triangle << ", as we have already visited it." << endl;
     4057                  DoLog(1) && (Log() << Verbose(1) << "INFO: Skipping " << *triangle << ", as we have already visited it." << endl);
    40584058                  triangle = NULL;
    40594059                }
     
    40704070            if ((triangle->lines[i] != CurrentLine) && (triangle->lines[i]->ContainsBoundaryPoint(ReferencePoint))) { // not the current line and still containing Point
    40714071              CurrentLine = triangle->lines[i];
    4072               Log() << Verbose(1) << "INFO: Connecting line is " << *CurrentLine << "." << endl;
     4072              DoLog(1) && (Log() << Verbose(1) << "INFO: Connecting line is " << *CurrentLine << "." << endl);
    40734073              break;
    40744074            }
     
    40844084        } while (CurrentLine != StartLine);
    40854085        // last point is missing, as it's on start line
    4086         Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;
     4086        DoLog(1) && (Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl);
    40874087        if (StartLine->GetOtherEndpoint(ReferencePoint)->node != connectedPath->back())
    40884088          connectedPath->push_back(StartLine->GetOtherEndpoint(ReferencePoint)->node);
     
    40904090        ListOfPaths->push_back(connectedPath);
    40914091      } else {
    4092         Log() << Verbose(1) << "INFO: Skipping " << *runner->second << ", as we have already visited it." << endl;
     4092        DoLog(1) && (Log() << Verbose(1) << "INFO: Skipping " << *runner->second << ", as we have already visited it." << endl);
    40934093      }
    40944094    }
     
    41204120    connectedPath = *ListRunner;
    41214121
    4122     Log() << Verbose(1) << "INFO: Current path is " << connectedPath << "." << endl;
     4122    DoLog(1) && (Log() << Verbose(1) << "INFO: Current path is " << connectedPath << "." << endl);
    41234123
    41244124    // go through list, look for reappearance of starting Point and count
     
    41294129      if ((*CircleRunner == *CircleStart) && (CircleRunner != CircleStart)) { // is not the very first point
    41304130        // we have a closed circle from Marker to new Marker
    4131         Log() << Verbose(1) << count + 1 << ". closed path consists of: ";
     4131        DoLog(1) && (Log() << Verbose(1) << count + 1 << ". closed path consists of: ");
    41324132        newPath = new TesselPointList;
    41334133        TesselPointList::iterator CircleSprinter = Marker;
    41344134        for (; CircleSprinter != CircleRunner; CircleSprinter++) {
    41354135          newPath->push_back(*CircleSprinter);
    4136           Log() << Verbose(0) << (**CircleSprinter) << " <-> ";
     4136          DoLog(0) && (Log() << Verbose(0) << (**CircleSprinter) << " <-> ");
    41374137        }
    4138         Log() << Verbose(0) << ".." << endl;
     4138        DoLog(0) && (Log() << Verbose(0) << ".." << endl);
    41394139        count++;
    41404140        Marker = CircleRunner;
     
    41454145    }
    41464146  }
    4147   Log() << Verbose(1) << "INFO: " << count << " closed additional path(s) have been created." << endl;
     4147  DoLog(1) && (Log() << Verbose(1) << "INFO: " << count << " closed additional path(s) have been created." << endl);
    41484148
    41494149  // delete list of paths
     
    42074207    return 0.;
    42084208  } else
    4209     Log() << Verbose(0) << "Removing point " << *point << " from tesselated boundary ..." << endl;
     4209    DoLog(0) && (Log() << Verbose(0) << "Removing point " << *point << " from tesselated boundary ..." << endl);
    42104210
    42114211  // copy old location for the volume
     
    42374237  NormalVector.Zero();
    42384238  for (TriangleMap::iterator Runner = Candidates.begin(); Runner != Candidates.end(); Runner++) {
    4239     Log() << Verbose(1) << "INFO: Removing triangle " << *(Runner->second) << "." << endl;
     4239    DoLog(1) && (Log() << Verbose(1) << "INFO: Removing triangle " << *(Runner->second) << "." << endl);
    42404240    NormalVector.SubtractVector(&Runner->second->NormalVector); // has to point inward
    42414241    RemoveTesselationTriangle(Runner->second);
    42424242    count++;
    42434243  }
    4244   Log() << Verbose(1) << count << " triangles were removed." << endl;
     4244  DoLog(1) && (Log() << Verbose(1) << count << " triangles were removed." << endl);
    42454245
    42464246  list<TesselPointList *>::iterator ListAdvance = ListOfClosedPaths->begin();
     
    42664266        smallestangle = 0.;
    42674267        for (MiddleNode = connectedPath->begin(); MiddleNode != connectedPath->end(); MiddleNode++) {
    4268           Log() << Verbose(1) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;
     4268          DoLog(1) && (Log() << Verbose(1) << "INFO: MiddleNode is " << **MiddleNode << "." << endl);
    42694269          // construct vectors to next and previous neighbour
    42704270          StartNode = MiddleNode;
     
    43044304        if (EndNode == connectedPath->end())
    43054305          EndNode = connectedPath->begin();
    4306         Log() << Verbose(2) << "INFO: StartNode is " << **StartNode << "." << endl;
    4307         Log() << Verbose(2) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;
    4308         Log() << Verbose(2) << "INFO: EndNode is " << **EndNode << "." << endl;
    4309         Log() << Verbose(1) << "INFO: Attempting to create triangle " << (*StartNode)->Name << ", " << (*MiddleNode)->Name << " and " << (*EndNode)->Name << "." << endl;
     4306        DoLog(2) && (Log() << Verbose(2) << "INFO: StartNode is " << **StartNode << "." << endl);
     4307        DoLog(2) && (Log() << Verbose(2) << "INFO: MiddleNode is " << **MiddleNode << "." << endl);
     4308        DoLog(2) && (Log() << Verbose(2) << "INFO: EndNode is " << **EndNode << "." << endl);
     4309        DoLog(1) && (Log() << Verbose(1) << "INFO: Attempting to create triangle " << (*StartNode)->Name << ", " << (*MiddleNode)->Name << " and " << (*EndNode)->Name << "." << endl);
    43104310        TriangleCandidates[0] = *StartNode;
    43114311        TriangleCandidates[1] = *MiddleNode;
     
    43254325          continue;
    43264326        }
    4327         Log() << Verbose(3) << "Adding new triangle points." << endl;
     4327        DoLog(3) && (Log() << Verbose(3) << "Adding new triangle points." << endl);
    43284328        AddTesselationPoint(*StartNode, 0);
    43294329        AddTesselationPoint(*MiddleNode, 1);
    43304330        AddTesselationPoint(*EndNode, 2);
    4331         Log() << Verbose(3) << "Adding new triangle lines." << endl;
     4331        DoLog(3) && (Log() << Verbose(3) << "Adding new triangle lines." << endl);
    43324332        AddTesselationLine(NULL, NULL, TPS[0], TPS[1], 0);
    43334333        AddTesselationLine(NULL, NULL, TPS[0], TPS[2], 1);
     
    43444344        // prepare nodes for next triangle
    43454345        StartNode = EndNode;
    4346         Log() << Verbose(2) << "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "." << endl;
     4346        DoLog(2) && (Log() << Verbose(2) << "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "." << endl);
    43474347        connectedPath->remove(*MiddleNode); // remove the middle node (it is surrounded by triangles)
    43484348        if (connectedPath->size() == 2) { // we are done
     
    43804380          if (maxgain != 0) {
    43814381            volume += maxgain;
    4382             Log() << Verbose(1) << "Flipping baseline with highest volume" << **Candidate << "." << endl;
     4382            DoLog(1) && (Log() << Verbose(1) << "Flipping baseline with highest volume" << **Candidate << "." << endl);
    43834383            OtherBase = FlipBaseline(*Candidate);
    43844384            NewLines.erase(Candidate);
     
    43914391      delete (connectedPath);
    43924392    }
    4393     Log() << Verbose(0) << count << " triangles were created." << endl;
     4393    DoLog(0) && (Log() << Verbose(0) << count << " triangles were created." << endl);
    43944394  } else {
    43954395    while (!ListOfClosedPaths->empty()) {
     
    43994399      delete (connectedPath);
    44004400    }
    4401     Log() << Verbose(0) << "No need to create any triangles." << endl;
     4401    DoLog(0) && (Log() << Verbose(0) << "No need to create any triangles." << endl);
    44024402  }
    44034403  delete (ListOfClosedPaths);
    44044404
    4405   Log() << Verbose(0) << "Removed volume is " << volume << "." << endl;
     4405  DoLog(0) && (Log() << Verbose(0) << "Removed volume is " << volume << "." << endl);
    44064406
    44074407  return volume;
     
    45684568  AllLines.clear();
    45694569
    4570   Log() << Verbose(0) << "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines." << endl;
     4570  DoLog(0) && (Log() << Verbose(0) << "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines." << endl);
    45714571  IndexToIndex::iterator it;
    45724572  for (it = DegeneratedLines->begin(); it != DegeneratedLines->end(); it++) {
     
    45744574    const LineMap::const_iterator Line2 = LinesOnBoundary.find((*it).second);
    45754575    if (Line1 != LinesOnBoundary.end() && Line2 != LinesOnBoundary.end())
    4576       Log() << Verbose(0) << *Line1->second << " => " << *Line2->second << endl;
     4576      DoLog(0) && (Log() << Verbose(0) << *Line1->second << " => " << *Line2->second << endl);
    45774577    else
    45784578      DoeLog(1) && (eLog() << Verbose(1) << "Either " << (*it).first << " or " << (*it).second << " are not in LinesOnBoundary!" << endl);
     
    46164616  delete (DegeneratedLines);
    46174617
    4618   Log() << Verbose(0) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl;
     4618  DoLog(0) && (Log() << Verbose(0) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl);
    46194619  IndexToIndex::iterator it;
    46204620  for (it = DegeneratedTriangles->begin(); it != DegeneratedTriangles->end(); it++)
    4621     Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl;
     4621    DoLog(0) && (Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl);
    46224622
    46234623  return DegeneratedTriangles;
     
    46874687      // erase the pair
    46884688      count += (int) DegeneratedTriangles->erase(triangle->Nr);
    4689       Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *triangle << "." << endl;
     4689      DoLog(0) && (Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *triangle << "." << endl);
    46904690      RemoveTesselationTriangle(triangle);
    46914691      count += (int) DegeneratedTriangles->erase(partnerTriangle->Nr);
    4692       Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "." << endl;
     4692      DoLog(0) && (Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "." << endl);
    46934693      RemoveTesselationTriangle(partnerTriangle);
    46944694    } else {
    4695       Log() << Verbose(0) << "RemoveDegeneratedTriangles() does not remove triangle " << *triangle << " and its partner " << *partnerTriangle << " because it is essential for at" << " least one of the endpoints to be kept in the tesselation structure." << endl;
     4695      DoLog(0) && (Log() << Verbose(0) << "RemoveDegeneratedTriangles() does not remove triangle " << *triangle << " and its partner " << *partnerTriangle << " because it is essential for at" << " least one of the endpoints to be kept in the tesselation structure." << endl);
    46964696    }
    46974697  }
     
    47004700    LastTriangle = NULL;
    47014701
    4702   Log() << Verbose(0) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl;
     4702  DoLog(0) && (Log() << Verbose(0) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl);
    47034703}
    47044704
     
    47294729    return;
    47304730  }
    4731   Log() << Verbose(0) << "Nearest point on boundary is " << NearestPoint->Name << "." << endl;
     4731  DoLog(0) && (Log() << Verbose(0) << "Nearest point on boundary is " << NearestPoint->Name << "." << endl);
    47324732
    47334733  // go through its lines and find the best one to split
     
    47624762
    47634763  // create new triangle to connect point (connects automatically with the missing spot of the chosen line)
    4764   Log() << Verbose(2) << "Adding new triangle points." << endl;
     4764  DoLog(2) && (Log() << Verbose(2) << "Adding new triangle points." << endl);
    47654765  AddTesselationPoint((BestLine->endpoints[0]->node), 0);
    47664766  AddTesselationPoint((BestLine->endpoints[1]->node), 1);
    47674767  AddTesselationPoint(point, 2);
    4768   Log() << Verbose(2) << "Adding new triangle lines." << endl;
     4768  DoLog(2) && (Log() << Verbose(2) << "Adding new triangle lines." << endl);
    47694769  AddTesselationLine(NULL, NULL, TPS[0], TPS[1], 0);
    47704770  AddTesselationLine(NULL, NULL, TPS[0], TPS[2], 1);
     
    47734773  BTS->GetNormalVector(TempTriangle->NormalVector);
    47744774  BTS->NormalVector.Scale(-1.);
    4775   Log() << Verbose(1) << "INFO: NormalVector of new triangle is " << BTS->NormalVector << "." << endl;
     4775  DoLog(1) && (Log() << Verbose(1) << "INFO: NormalVector of new triangle is " << BTS->NormalVector << "." << endl);
    47764776  AddTesselationTriangle();
    47774777
    47784778  // create other side of this triangle and close both new sides of the first created triangle
    4779   Log() << Verbose(2) << "Adding new triangle points." << endl;
     4779  DoLog(2) && (Log() << Verbose(2) << "Adding new triangle points." << endl);
    47804780  AddTesselationPoint((BestLine->endpoints[0]->node), 0);
    47814781  AddTesselationPoint((BestLine->endpoints[1]->node), 1);
    47824782  AddTesselationPoint(point, 2);
    4783   Log() << Verbose(2) << "Adding new triangle lines." << endl;
     4783  DoLog(2) && (Log() << Verbose(2) << "Adding new triangle lines." << endl);
    47844784  AddTesselationLine(NULL, NULL, TPS[0], TPS[1], 0);
    47854785  AddTesselationLine(NULL, NULL, TPS[0], TPS[2], 1);
     
    47874787  BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
    47884788  BTS->GetNormalVector(TempTriangle->NormalVector);
    4789   Log() << Verbose(1) << "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "." << endl;
     4789  DoLog(1) && (Log() << Verbose(1) << "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "." << endl);
    47904790  AddTesselationTriangle();
    47914791
     
    48254825        NameofTempFile.erase(npos, 1);
    48264826      NameofTempFile.append(TecplotSuffix);
    4827       Log() << Verbose(0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";
     4827      DoLog(0) && (Log() << Verbose(0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n");
    48284828      tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc);
    48294829      WriteTecplotFile(tempstream, this, cloud, TriangleFilesWritten);
     
    48394839        NameofTempFile.erase(npos, 1);
    48404840      NameofTempFile.append(Raster3DSuffix);
    4841       Log() << Verbose(0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";
     4841      DoLog(0) && (Log() << Verbose(0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n");
    48424842      tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc);
    48434843      WriteRaster3dFile(tempstream, this, cloud);
     
    48914891  pair<map<int, Vector *>::iterator, bool> TriangleInsertionTester;
    48924892  for (PointMap::const_iterator Runner = PointsOnBoundary.begin(); Runner != PointsOnBoundary.end(); Runner++) {
    4893     Log() << Verbose(0) << "Current point is " << *Runner->second << "." << endl;
     4893    DoLog(0) && (Log() << Verbose(0) << "Current point is " << *Runner->second << "." << endl);
    48944894    map<int, Vector *> TriangleVectors;
    48954895    // gather all NormalVectors
    4896     Log() << Verbose(1) << "Gathering triangles ..." << endl;
     4896    DoLog(1) && (Log() << Verbose(1) << "Gathering triangles ..." << endl);
    48974897    for (LineMap::const_iterator LineRunner = (Runner->second)->lines.begin(); LineRunner != (Runner->second)->lines.end(); LineRunner++)
    48984898      for (TriangleMap::const_iterator TriangleRunner = (LineRunner->second)->triangles.begin(); TriangleRunner != (LineRunner->second)->triangles.end(); TriangleRunner++) {
     
    49004900          TriangleInsertionTester = TriangleVectors.insert(pair<int, Vector *> ((TriangleRunner->second)->Nr, &((TriangleRunner->second)->NormalVector)));
    49014901          if (TriangleInsertionTester.second)
    4902             Log() << Verbose(1) << " Adding triangle " << *(TriangleRunner->second) << " to triangles to check-list." << endl;
     4902            DoLog(1) && (Log() << Verbose(1) << " Adding triangle " << *(TriangleRunner->second) << " to triangles to check-list." << endl);
    49034903        } else {
    4904           Log() << Verbose(1) << " NOT adding triangle " << *(TriangleRunner->second) << " as it's a simply degenerated one." << endl;
     4904          DoLog(1) && (Log() << Verbose(1) << " NOT adding triangle " << *(TriangleRunner->second) << " as it's a simply degenerated one." << endl);
    49054905        }
    49064906      }
    49074907    // check whether there are two that are parallel
    4908     Log() << Verbose(1) << "Finding two parallel triangles ..." << endl;
     4908    DoLog(1) && (Log() << Verbose(1) << "Finding two parallel triangles ..." << endl);
    49094909    for (map<int, Vector *>::iterator VectorWalker = TriangleVectors.begin(); VectorWalker != TriangleVectors.end(); VectorWalker++)
    49104910      for (map<int, Vector *>::iterator VectorRunner = VectorWalker; VectorRunner != TriangleVectors.end(); VectorRunner++)
    49114911        if (VectorWalker != VectorRunner) { // skip equals
    49124912          const double SCP = VectorWalker->second->ScalarProduct(VectorRunner->second); // ScalarProduct should result in -1. for degenerated triangles
    4913           Log() << Verbose(1) << "Checking " << *VectorWalker->second << " against " << *VectorRunner->second << ": " << SCP << endl;
     4913          DoLog(1) && (Log() << Verbose(1) << "Checking " << *VectorWalker->second << " against " << *VectorRunner->second << ": " << SCP << endl);
    49144914          if (fabs(SCP + 1.) < ParallelEpsilon) {
    49154915            InsertionTester = EndpointCandidateList.insert((Runner->second));
    49164916            if (InsertionTester.second)
    4917               Log() << Verbose(0) << " Adding " << *Runner->second << " to endpoint candidate list." << endl;
     4917              DoLog(0) && (Log() << Verbose(0) << " Adding " << *Runner->second << " to endpoint candidate list." << endl);
    49184918            // and break out of both loops
    49194919            VectorWalker = TriangleVectors.end();
     
    49334933    Walker = *(EndpointCandidateList.begin());
    49344934    if (Current == NULL) { // create a new polygon with current candidate
    4935       Log() << Verbose(0) << "Starting new polygon set at point " << *Walker << endl;
     4935      DoLog(0) && (Log() << Verbose(0) << "Starting new polygon set at point " << *Walker << endl);
    49364936      Current = new BoundaryPolygonSet;
    49374937      Current->endpoints.insert(Walker);
     
    49464946      for (LineMap::const_iterator LineWalker = Walker->lines.begin(); LineWalker != Walker->lines.end(); LineWalker++) {
    49474947        OtherWalker = (LineWalker->second)->GetOtherEndpoint(Walker);
    4948         Log() << Verbose(1) << "Checking " << *OtherWalker << endl;
     4948        DoLog(1) && (Log() << Verbose(1) << "Checking " << *OtherWalker << endl);
    49494949        set<BoundaryPointSet *>::iterator Finder = EndpointCandidateList.find(OtherWalker);
    49504950        if (Finder != EndpointCandidateList.end()) { // found a connected partner
    4951           Log() << Verbose(1) << " Adding to polygon." << endl;
     4951          DoLog(1) && (Log() << Verbose(1) << " Adding to polygon." << endl);
    49524952          Current->endpoints.insert(OtherWalker);
    49534953          EndpointCandidateList.erase(Finder); // remove from candidates
    49544954          ToCheckConnecteds.push(OtherWalker); // but check its partners too
    49554955        } else {
    4956           Log() << Verbose(1) << " is not connected to " << *Walker << endl;
     4956          DoLog(1) && (Log() << Verbose(1) << " is not connected to " << *Walker << endl);
    49574957        }
    49584958      }
    49594959    }
    49604960
    4961     Log() << Verbose(0) << "Final polygon is " << *Current << endl;
     4961    DoLog(0) && (Log() << Verbose(0) << "Final polygon is " << *Current << endl);
    49624962    ListofDegeneratedPolygons.insert(Current);
    49634963    Current = NULL;
     
    49664966  const int counter = ListofDegeneratedPolygons.size();
    49674967
    4968   Log() << Verbose(0) << "The following " << counter << " degenerated polygons have been found: " << endl;
     4968  DoLog(0) && (Log() << Verbose(0) << "The following " << counter << " degenerated polygons have been found: " << endl);
    49694969  for (UniquePolygonSet::iterator PolygonRunner = ListofDegeneratedPolygons.begin(); PolygonRunner != ListofDegeneratedPolygons.end(); PolygonRunner++)
    4970     Log() << Verbose(0) << " " << **PolygonRunner << endl;
     4970    DoLog(0) && (Log() << Verbose(0) << " " << **PolygonRunner << endl);
    49714971
    49724972  /// 4. Go through all these degenerated polygons
     
    49794979    // check whether number is bigger than 2, otherwise it's just a simply degenerated one and nothing to do.
    49804980    if (T->size() == 2) {
    4981       Log() << Verbose(1) << " Skipping degenerated polygon, is just a (already simply degenerated) triangle." << endl;
     4981      DoLog(1) && (Log() << Verbose(1) << " Skipping degenerated polygon, is just a (already simply degenerated) triangle." << endl);
    49824982      delete (T);
    49834983      continue;
     
    49954995    /// 4a. Get NormalVector for one side (this is "front")
    49964996    NormalVector.CopyVector(&(*TriangleWalker)->NormalVector);
    4997     Log() << Verbose(1) << "\"front\" defining triangle is " << **TriangleWalker << " and Normal vector of \"front\" side is " << NormalVector << endl;
     4997    DoLog(1) && (Log() << Verbose(1) << "\"front\" defining triangle is " << **TriangleWalker << " and Normal vector of \"front\" side is " << NormalVector << endl);
    49984998    TriangleWalker++;
    49994999    TriangleSet::iterator TriangleSprinter = TriangleWalker; // is the inner advanced iterator
     
    50045004      triangle = *TriangleWalker;
    50055005      TriangleSprinter++;
    5006       Log() << Verbose(1) << "Current triangle to test for removal: " << *triangle << endl;
     5006      DoLog(1) && (Log() << Verbose(1) << "Current triangle to test for removal: " << *triangle << endl);
    50075007      if (triangle->NormalVector.ScalarProduct(&NormalVector) < 0) { // if from other side, then delete and remove from list
    5008         Log() << Verbose(1) << " Removing ... " << endl;
     5008        DoLog(1) && (Log() << Verbose(1) << " Removing ... " << endl);
    50095009        TriangleNrs.push(triangle->Nr);
    50105010        T->erase(TriangleWalker);
    50115011        RemoveTesselationTriangle(triangle);
    50125012      } else
    5013         Log() << Verbose(1) << " Keeping ... " << endl;
     5013        DoLog(1) && (Log() << Verbose(1) << " Keeping ... " << endl);
    50145014    }
    50155015    /// 4c. Copy all "front" triangles but with inverse NormalVector
    50165016    TriangleWalker = T->begin();
    50175017    while (TriangleWalker != T->end()) { // go through all front triangles
    5018       Log() << Verbose(1) << " Re-creating triangle " << **TriangleWalker << " with NormalVector " << (*TriangleWalker)->NormalVector << endl;
     5018      DoLog(1) && (Log() << Verbose(1) << " Re-creating triangle " << **TriangleWalker << " with NormalVector " << (*TriangleWalker)->NormalVector << endl);
    50195019      for (int i = 0; i < 3; i++)
    50205020        AddTesselationPoint((*TriangleWalker)->endpoints[i]->node, i);
     
    50375037  }
    50385038  IndexToIndex * SimplyDegeneratedTriangles = FindAllDegeneratedTriangles();
    5039   Log() << Verbose(0) << "Final list of simply degenerated triangles found, containing " << SimplyDegeneratedTriangles->size() << " triangles:" << endl;
     5039  DoLog(0) && (Log() << Verbose(0) << "Final list of simply degenerated triangles found, containing " << SimplyDegeneratedTriangles->size() << " triangles:" << endl);
    50405040  IndexToIndex::iterator it;
    50415041  for (it = SimplyDegeneratedTriangles->begin(); it != SimplyDegeneratedTriangles->end(); it++)
    5042     Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl;
     5042    DoLog(0) && (Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl);
    50435043  delete (SimplyDegeneratedTriangles);
    50445044  /// 5. exit
Note: See TracChangeset for help on using the changeset viewer.