Changeset e138de for src/tesselation.cpp


Ignore:
Timestamp:
Nov 4, 2009, 7:56:04 PM (16 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:
1614174, e5ad5c
Parents:
7326b2
Message:

Huge change from ofstream * (const) out --> Log().

  • first shift was done via regular expressions
  • then via error messages from the code
  • note that class atom, class element and class molecule kept in parts their output stream, was they print to file.
  • make check runs fine
  • MISSING: Verbosity is not fixed for everything (i.e. if no endl; is present and next has Verbose(0) ...)

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tesselation.cpp

    r7326b2 re138de  
    1010#include "helpers.hpp"
    1111#include "linkedcell.hpp"
     12#include "log.hpp"
    1213#include "tesselation.hpp"
    1314#include "tesselationhelpers.hpp"
     
    4546BoundaryPointSet::~BoundaryPointSet()
    4647{
    47   //cout << Verbose(5) << "Erasing point nr. " << Nr << "." << endl;
     48  //Log() << Verbose(5) << "Erasing point nr. " << Nr << "." << endl;
    4849  if (!lines.empty())
    49     cerr << "WARNING: Memory Leak! I " << *this << " am still connected to some lines." << endl;
     50    eLog() << Verbose(0) << "WARNING: Memory Leak! I " << *this << " am still connected to some lines." << endl;
    5051  node = NULL;
    5152};
     
    5657void BoundaryPointSet::AddLine(class BoundaryLineSet *line)
    5758{
    58   cout << Verbose(6) << "Adding " << *this << " to line " << *line << "."
     59  Log() << Verbose(6) << "Adding " << *this << " to line " << *line << "."
    5960      << endl;
    6061  if (line->endpoints[0] == this)
     
    106107  Point[1]->AddLine(this); //
    107108  // clear triangles list
    108   cout << Verbose(5) << "New Line with endpoints " << *this << "." << endl;
     109  Log() << Verbose(5) << "New Line with endpoints " << *this << "." << endl;
    109110};
    110111
     
    133134        for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++)
    134135          if ((*Runner).second == this) {
    135             //cout << Verbose(5) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;
     136            //Log() << Verbose(5) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;
    136137            endpoints[i]->lines.erase(Runner);
    137138            break;
     
    139140      } else { // there's just a single line left
    140141        if (endpoints[i]->lines.erase(Nr)) {
    141           //cout << Verbose(5) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;
     142          //Log() << Verbose(5) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;
    142143        }
    143144      }
    144145      if (endpoints[i]->lines.empty()) {
    145         //cout << Verbose(5) << *endpoints[i] << " has no more lines it's attached to, erasing." << endl;
     146        //Log() << Verbose(5) << *endpoints[i] << " has no more lines it's attached to, erasing." << endl;
    146147        if (endpoints[i] != NULL) {
    147148          delete(endpoints[i]);
     
    152153  }
    153154  if (!triangles.empty())
    154     cerr << "WARNING: Memory Leak! I " << *this << " am still connected to some triangles." << endl;
     155    eLog() << Verbose(0) << "WARNING: Memory Leak! I " << *this << " am still connected to some triangles." << endl;
    155156};
    156157
     
    160161void BoundaryLineSet::AddTriangle(class BoundaryTriangleSet *triangle)
    161162{
    162   cout << Verbose(6) << "Add " << triangle->Nr << " to line " << *this << "." << endl;
     163  Log() << Verbose(6) << "Add " << triangle->Nr << " to line " << *this << "." << endl;
    163164  triangles.insert(TrianglePair(triangle->Nr, triangle));
    164165};
     
    182183 * \return true - triangles are convex, false - concave or less than two triangles connected
    183184 */
    184 bool BoundaryLineSet::CheckConvexityCriterion(ofstream *out)
     185bool BoundaryLineSet::CheckConvexityCriterion()
    185186{
    186187  Vector BaseLineCenter, BaseLineNormal, BaseLine, helper[2], NormalCheck;
    187188  // get the two triangles
    188189  if (triangles.size() != 2) {
    189     *out << Verbose(1) << "ERROR: Baseline " << *this << " is connected to less than two triangles, Tesselation incomplete!" << endl;
     190    Log() << Verbose(1) << "ERROR: Baseline " << *this << " is connected to less than two triangles, Tesselation incomplete!" << endl;
    190191    return true;
    191192  }
    192193  // check normal vectors
    193194  // have a normal vector on the base line pointing outwards
    194   //*out << Verbose(3) << "INFO: " << *this << " has vectors at " << *(endpoints[0]->node->node) << " and at " << *(endpoints[1]->node->node) << "." << endl;
     195  //Log() << Verbose(3) << "INFO: " << *this << " has vectors at " << *(endpoints[0]->node->node) << " and at " << *(endpoints[1]->node->node) << "." << endl;
    195196  BaseLineCenter.CopyVector(endpoints[0]->node->node);
    196197  BaseLineCenter.AddVector(endpoints[1]->node->node);
     
    198199  BaseLine.CopyVector(endpoints[0]->node->node);
    199200  BaseLine.SubtractVector(endpoints[1]->node->node);
    200   //*out << Verbose(3) << "INFO: Baseline is " << BaseLine << " and its center is at " << BaseLineCenter << "." << endl;
     201  //Log() << Verbose(3) << "INFO: Baseline is " << BaseLine << " and its center is at " << BaseLineCenter << "." << endl;
    201202
    202203  BaseLineNormal.Zero();
     
    206207  class BoundaryPointSet *node = NULL;
    207208  for(TriangleMap::iterator runner = triangles.begin(); runner != triangles.end(); runner++) {
    208     //*out << Verbose(3) << "INFO: NormalVector of " << *(runner->second) << " is " << runner->second->NormalVector << "." << endl;
     209    //Log() << Verbose(3) << "INFO: NormalVector of " << *(runner->second) << " is " << runner->second->NormalVector << "." << endl;
    209210    NormalCheck.AddVector(&runner->second->NormalVector);
    210211    NormalCheck.Scale(sign);
     
    213214      BaseLineNormal.CopyVector(&runner->second->NormalVector);   // yes, copy second on top of first
    214215    else {
    215       *out << Verbose(1) << "CRITICAL: Triangle " << *runner->second << " has zero normal vector!" << endl;
     216      Log() << Verbose(1) << "CRITICAL: Triangle " << *runner->second << " has zero normal vector!" << endl;
    216217      exit(255);
    217218    }
    218219    node = runner->second->GetThirdEndpoint(this);
    219220    if (node != NULL) {
    220       //*out << Verbose(3) << "INFO: Third node for triangle " << *(runner->second) << " is " << *node << " at " << *(node->node->node) << "." << endl;
     221      //Log() << Verbose(3) << "INFO: Third node for triangle " << *(runner->second) << " is " << *node << " at " << *(node->node->node) << "." << endl;
    221222      helper[i].CopyVector(node->node->node);
    222223      helper[i].SubtractVector(&BaseLineCenter);
    223224      helper[i].MakeNormalVector(&BaseLine);  // we want to compare the triangle's heights' angles!
    224       //*out << Verbose(4) << "INFO: Height vector with respect to baseline is " << helper[i] << "." << endl;
     225      //Log() << Verbose(4) << "INFO: Height vector with respect to baseline is " << helper[i] << "." << endl;
    225226      i++;
    226227    } else {
    227       //*out << Verbose(2) << "ERROR: I cannot find third node in triangle, something's wrong." << endl;
     228      //Log() << Verbose(2) << "ERROR: I cannot find third node in triangle, something's wrong." << endl;
    228229      return true;
    229230    }
    230231  }
    231   //*out << Verbose(3) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl;
     232  //Log() << Verbose(3) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl;
    232233  if (NormalCheck.NormSquared() < MYEPSILON) {
    233     *out << Verbose(3) << "ACCEPT: Normalvectors of both triangles are the same: convex." << endl;
     234    Log() << Verbose(3) << "ACCEPT: Normalvectors of both triangles are the same: convex." << endl;
    234235    return true;
    235236  }
     
    237238  double angle = GetAngle(helper[0], helper[1], BaseLineNormal);
    238239  if ((angle - M_PI) > -MYEPSILON) {
    239     *out << Verbose(3) << "ACCEPT: Angle is greater than pi: convex." << endl;
     240    Log() << Verbose(3) << "ACCEPT: Angle is greater than pi: convex." << endl;
    240241    return true;
    241242  } else {
    242     *out << Verbose(3) << "REJECT: Angle is less than pi: concave." << endl;
     243    Log() << Verbose(3) << "REJECT: Angle is less than pi: concave." << endl;
    243244    return false;
    244245  }
     
    304305  Nr = number;
    305306  // set lines
    306   cout << Verbose(5) << "New triangle " << Nr << ":" << endl;
     307  Log() << Verbose(5) << "New triangle " << Nr << ":" << endl;
    307308  for (int i = 0; i < 3; i++)
    308309    {
     
    322323  // set endpoints
    323324  int Counter = 0;
    324   cout << Verbose(6) << " with end points ";
     325  Log() << Verbose(6) << " with end points ";
    325326  for (map<int, class BoundaryPointSet *>::iterator runner = OrderMap.begin(); runner
    326327      != OrderMap.end(); runner++)
    327328    {
    328329      endpoints[Counter] = runner->second;
    329       cout << " " << *endpoints[Counter];
     330      Log() << Verbose(0) << " " << *endpoints[Counter];
    330331      Counter++;
    331332    }
    332333  if (Counter < 3)
    333334    {
    334       cerr << "ERROR! We have a triangle with only two distinct endpoints!"
     335      eLog() << Verbose(0) << "ERROR! We have a triangle with only two distinct endpoints!"
    335336          << endl;
    336337      //exit(1);
    337338    }
    338   cout << "." << endl;
     339  Log() << Verbose(0) << "." << endl;
    339340};
    340341
     
    348349    if (lines[i] != NULL) {
    349350      if (lines[i]->triangles.erase(Nr)) {
    350         //cout << Verbose(5) << "Triangle Nr." << Nr << " erased in line " << *lines[i] << "." << endl;
     351        //Log() << Verbose(5) << "Triangle Nr." << Nr << " erased in line " << *lines[i] << "." << endl;
    351352      }
    352353      if (lines[i]->triangles.empty()) {
    353           //cout << Verbose(5) << *lines[i] << " is no more attached to any triangle, erasing." << endl;
     354          //Log() << Verbose(5) << *lines[i] << " is no more attached to any triangle, erasing." << endl;
    354355          delete (lines[i]);
    355356          lines[i] = NULL;
     
    357358    }
    358359  }
    359   //cout << Verbose(5) << "Erasing triangle Nr." << Nr << " itself." << endl;
     360  //Log() << Verbose(5) << "Erasing triangle Nr." << Nr << " itself." << endl;
    360361};
    361362
     
    386387 * \return true - \a *Intersection contains intersection on plane defined by triangle, false - zero vector if outside of triangle.
    387388 */
    388 bool BoundaryTriangleSet::GetIntersectionInsideTriangle(ofstream *out, Vector *MolCenter, Vector *x, Vector *Intersection)
     389bool BoundaryTriangleSet::GetIntersectionInsideTriangle(Vector *MolCenter, Vector *x, Vector *Intersection)
    389390{
    390391  Vector CrossPoint;
    391392  Vector helper;
    392393
    393   if (!Intersection->GetIntersectionWithPlane(out, &NormalVector, endpoints[0]->node->node, MolCenter, x)) {
    394     *out << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl;
     394  if (!Intersection->GetIntersectionWithPlane(&NormalVector, endpoints[0]->node->node, MolCenter, x)) {
     395    Log() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl;
    395396    return false;
    396397  }
     
    399400  int i=0;
    400401  do {
    401     if (CrossPoint.GetIntersectionOfTwoLinesOnPlane(out, endpoints[i%3]->node->node, endpoints[(i+1)%3]->node->node, endpoints[(i+2)%3]->node->node, Intersection, &NormalVector)) {
     402    if (CrossPoint.GetIntersectionOfTwoLinesOnPlane(endpoints[i%3]->node->node, endpoints[(i+1)%3]->node->node, endpoints[(i+2)%3]->node->node, Intersection, &NormalVector)) {
    402403      helper.CopyVector(endpoints[(i+1)%3]->node->node);
    403404      helper.SubtractVector(endpoints[i%3]->node->node);
     
    408409  } while (CrossPoint.NormSquared() < MYEPSILON);
    409410  if (i==3) {
    410     *out << Verbose(1) << "ERROR: Could not find any cross points, something's utterly wrong here!" << endl;
     411    Log() << Verbose(1) << "ERROR: Could not find any cross points, something's utterly wrong here!" << endl;
    411412    exit(255);
    412413  }
     
    627628Tesselation::~Tesselation()
    628629{
    629   cout << Verbose(1) << "Free'ing TesselStruct ... " << endl;
     630  Log() << Verbose(1) << "Free'ing TesselStruct ... " << endl;
    630631  for (TriangleMap::iterator runner = TrianglesOnBoundary.begin(); runner != TrianglesOnBoundary.end(); runner++) {
    631632    if (runner->second != NULL) {
     
    633634      runner->second = NULL;
    634635    } else
    635       cerr << "ERROR: The triangle " << runner->first << " has already been free'd." << endl;
    636   }
    637   cout << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl;
     636      eLog() << Verbose(1) << "ERROR: The triangle " << runner->first << " has already been free'd." << endl;
     637  }
     638  Log() << Verbose(1) << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl;
    638639}
    639640;
     
    730731 */
    731732void
    732 Tesselation::GuessStartingTriangle(ofstream *out)
     733Tesselation::GuessStartingTriangle()
    733734{
    734735  // 4b. create a starting triangle
     
    762763    }
    763764  //    // listing distances
    764   //    *out << Verbose(1) << "Listing DistanceMMap:";
     765  //    Log() << Verbose(1) << "Listing DistanceMMap:";
    765766  //    for(DistanceMultiMap::iterator runner = DistanceMMap.begin(); runner != DistanceMMap.end(); runner++) {
    766   //      *out << " " << runner->first << "(" << *runner->second.first->second << ", " << *runner->second.second->second << ")";
     767  //      Log() << Verbose(0) << " " << runner->first << "(" << *runner->second.first->second << ", " << *runner->second.second->second << ")";
    767768  //    }
    768   //    *out << endl;
     769  //    Log() << Verbose(0) << endl;
    769770  // 4b2. pick three baselines forming a triangle
    770771  // 1. we take from the smallest sum of squared distance as the base line BC (with peak A) onward as the triangle candidate
     
    778779          baseline->second.first->second->node->node,
    779780          baseline->second.second->second->node->node);
    780       *out << Verbose(2) << "Plane vector of candidate triangle is ";
    781       PlaneVector.Output(out);
    782       *out << endl;
     781      Log() << Verbose(2) << "Plane vector of candidate triangle is ";
     782      PlaneVector.Output();
     783      Log() << Verbose(0) << endl;
    783784      // 4. loop over all points
    784785      double sign = 0.;
     
    796797          if (fabs(distance) < 1e-4) // we need to have a small epsilon around 0 which is still ok
    797798            continue;
    798           *out << Verbose(3) << "Projection of " << checker->second->node->Name
     799          Log() << Verbose(3) << "Projection of " << checker->second->node->Name
    799800              << " yields distance of " << distance << "." << endl;
    800801          tmp = distance / fabs(distance);
     
    803804            {
    804805              // 4c. If so, break 4. loop and continue with next candidate in 1. loop
    805               *out << Verbose(2) << "Current candidates: "
     806              Log() << Verbose(2) << "Current candidates: "
    806807                  << A->second->node->Name << ","
    807808                  << baseline->second.first->second->node->Name << ","
     
    813814          else
    814815            { // note the sign for later
    815               *out << Verbose(2) << "Current candidates: "
     816              Log() << Verbose(2) << "Current candidates: "
    816817                  << A->second->node->Name << ","
    817818                  << baseline->second.first->second->node->Name << ","
     
    850851      if (checker == PointsOnBoundary.end())
    851852        {
    852           *out << "Looks like we have a candidate!" << endl;
     853          Log() << Verbose(0) << "Looks like we have a candidate!" << endl;
    853854          break;
    854855        }
     
    876877        }
    877878
    878       *out << Verbose(1) << "Starting triangle is " << *BTS << "." << endl;
     879      Log() << Verbose(1) << "Starting triangle is " << *BTS << "." << endl;
    879880    }
    880881  else
    881882    {
    882       *out << Verbose(1) << "No starting triangle found." << endl;
     883      Log() << Verbose(1) << "No starting triangle found." << endl;
    883884      exit(255);
    884885    }
     
    899900 * \param *cloud cluster of points
    900901 */
    901 void Tesselation::TesselateOnBoundary(ofstream *out, const PointCloud * const cloud)
     902void Tesselation::TesselateOnBoundary(const PointCloud * const cloud)
    902903{
    903904  bool flag;
     
    908909  LineMap::iterator LineChecker[2];
    909910
    910   Center = cloud->GetCenter(out);
     911  Center = cloud->GetCenter();
    911912  // create a first tesselation with the given BoundaryPoints
    912913  do {
     
    919920        // get peak point with respect to this base line's only triangle
    920921        BTS = baseline->second->triangles.begin()->second; // there is only one triangle so far
    921         *out << Verbose(2) << "Current baseline is between " << *(baseline->second) << "." << endl;
     922        Log() << Verbose(2) << "Current baseline is between " << *(baseline->second) << "." << endl;
    922923        for (int i = 0; i < 3; i++)
    923924          if ((BTS->endpoints[i] != baseline->second->endpoints[0]) && (BTS->endpoints[i] != baseline->second->endpoints[1]))
    924925            peak = BTS->endpoints[i];
    925         *out << Verbose(3) << " and has peak " << *peak << "." << endl;
     926        Log() << Verbose(3) << " and has peak " << *peak << "." << endl;
    926927
    927928        // prepare some auxiliary vectors
     
    938939          CenterVector.AddVector(BTS->endpoints[i]->node->node);
    939940        CenterVector.Scale(1. / 3.);
    940         *out << Verbose(4) << "CenterVector of base triangle is " << CenterVector << endl;
     941        Log() << Verbose(4) << "CenterVector of base triangle is " << CenterVector << endl;
    941942
    942943        // normal vector of triangle
     
    945946        BTS->GetNormalVector(NormalVector);
    946947        NormalVector.CopyVector(&BTS->NormalVector);
    947         *out << Verbose(4) << "NormalVector of base triangle is " << NormalVector << endl;
     948        Log() << Verbose(4) << "NormalVector of base triangle is " << NormalVector << endl;
    948949
    949950        // vector in propagation direction (out of triangle)
     
    952953        TempVector.CopyVector(&CenterVector);
    953954        TempVector.SubtractVector(baseline->second->endpoints[0]->node->node); // TempVector is vector on triangle plane pointing from one baseline egde towards center!
    954         //*out << Verbose(2) << "Projection of propagation onto temp: " << PropagationVector.Projection(&TempVector) << "." << endl;
     955        //Log() << Verbose(2) << "Projection of propagation onto temp: " << PropagationVector.Projection(&TempVector) << "." << endl;
    955956        if (PropagationVector.ScalarProduct(&TempVector) > 0) // make sure normal propagation vector points outward from baseline
    956957          PropagationVector.Scale(-1.);
    957         *out << Verbose(4) << "PropagationVector of base triangle is " << PropagationVector << endl;
     958        Log() << Verbose(4) << "PropagationVector of base triangle is " << PropagationVector << endl;
    958959        winner = PointsOnBoundary.end();
    959960
     
    961962        for (PointMap::iterator target = PointsOnBoundary.begin(); target != PointsOnBoundary.end(); target++) {
    962963          if ((target->second != baseline->second->endpoints[0]) && (target->second != baseline->second->endpoints[1])) { // don't take the same endpoints
    963             *out << Verbose(3) << "Target point is " << *(target->second) << ":" << endl;
     964            Log() << Verbose(3) << "Target point is " << *(target->second) << ":" << endl;
    964965
    965966            // first check direction, so that triangles don't intersect
     
    968969            VirtualNormalVector.ProjectOntoPlane(&NormalVector);
    969970            TempAngle = VirtualNormalVector.Angle(&PropagationVector);
    970             *out << Verbose(4) << "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "." << endl;
     971            Log() << Verbose(4) << "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "." << endl;
    971972            if (TempAngle > (M_PI/2.)) { // no bends bigger than Pi/2 (90 degrees)
    972               *out << Verbose(4) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", bad direction!" << endl;
     973              Log() << Verbose(4) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", bad direction!" << endl;
    973974              continue;
    974975            } else
    975               *out << Verbose(4) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", good direction!" << endl;
     976              Log() << Verbose(4) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", good direction!" << endl;
    976977
    977978            // check first and second endpoint (if any connecting line goes to target has at least not more than 1 triangle)
     
    979980            LineChecker[1] = baseline->second->endpoints[1]->lines.find(target->first);
    980981            if (((LineChecker[0] != baseline->second->endpoints[0]->lines.end()) && (LineChecker[0]->second->triangles.size() == 2))) {
    981               *out << Verbose(4) << *(baseline->second->endpoints[0]) << " has line " << *(LineChecker[0]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[0]->second->triangles.size() << " triangles." << endl;
     982              Log() << Verbose(4) << *(baseline->second->endpoints[0]) << " has line " << *(LineChecker[0]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[0]->second->triangles.size() << " triangles." << endl;
    982983              continue;
    983984            }
    984985            if (((LineChecker[1] != baseline->second->endpoints[1]->lines.end()) && (LineChecker[1]->second->triangles.size() == 2))) {
    985               *out << Verbose(4) << *(baseline->second->endpoints[1]) << " has line " << *(LineChecker[1]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[1]->second->triangles.size() << " triangles." << endl;
     986              Log() << Verbose(4) << *(baseline->second->endpoints[1]) << " has line " << *(LineChecker[1]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[1]->second->triangles.size() << " triangles." << endl;
    986987              continue;
    987988            }
     
    989990            // check whether the envisaged triangle does not already exist (if both lines exist and have same endpoint)
    990991            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)))) {
    991               *out << Verbose(4) << "Current target is peak!" << endl;
     992              Log() << Verbose(4) << "Current target is peak!" << endl;
    992993              continue;
    993994            }
     
    10001001            helper.ProjectOntoPlane(&TempVector);
    10011002            if (fabs(helper.NormSquared()) < MYEPSILON) {
    1002               *out << Verbose(4) << "Chosen set of vectors is linear dependent." << endl;
     1003              Log() << Verbose(4) << "Chosen set of vectors is linear dependent." << endl;
    10031004              continue;
    10041005            }
     
    10171018            // calculate angle
    10181019            TempAngle = NormalVector.Angle(&VirtualNormalVector);
    1019             *out << Verbose(4) << "NormalVector is " << VirtualNormalVector << " and the angle is " << TempAngle << "." << endl;
     1020            Log() << Verbose(4) << "NormalVector is " << VirtualNormalVector << " and the angle is " << TempAngle << "." << endl;
    10201021            if ((SmallestAngle - TempAngle) > MYEPSILON) { // set to new possible winner
    10211022              SmallestAngle = TempAngle;
    10221023              winner = target;
    1023               *out << Verbose(4) << "New winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;
     1024              Log() << Verbose(4) << "New winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;
    10241025            } else if (fabs(SmallestAngle - TempAngle) < MYEPSILON) { // check the angle to propagation, both possible targets are in one plane! (their normals have same angle)
    10251026              // hence, check the angles to some normal direction from our base line but in this common plane of both targets...
     
    10391040                SmallestAngle = TempAngle;
    10401041                winner = target;
    1041                 *out << Verbose(4) << "New winner " << *winner->second->node << " due to smaller angle " << TempAngle << " to propagation direction." << endl;
     1042                Log() << Verbose(4) << "New winner " << *winner->second->node << " due to smaller angle " << TempAngle << " to propagation direction." << endl;
    10421043              } else
    1043                 *out << Verbose(4) << "Keeping old winner " << *winner->second->node << " due to smaller angle to propagation direction." << endl;
     1044                Log() << Verbose(4) << "Keeping old winner " << *winner->second->node << " due to smaller angle to propagation direction." << endl;
    10441045            } else
    1045               *out << Verbose(4) << "Keeping old winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;
     1046              Log() << Verbose(4) << "Keeping old winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;
    10461047          }
    10471048        } // end of loop over all boundary points
     
    10491050        // 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
    10501051        if (winner != PointsOnBoundary.end()) {
    1051           *out << Verbose(2) << "Winning target point is " << *(winner->second) << " with angle " << SmallestAngle << "." << endl;
     1052          Log() << Verbose(2) << "Winning target point is " << *(winner->second) << " with angle " << SmallestAngle << "." << endl;
    10521053          // create the lins of not yet present
    10531054          BLS[0] = baseline->second;
     
    10791080          TrianglesOnBoundaryCount++;
    10801081        } else {
    1081           *out << Verbose(1) << "I could not determine a winner for this baseline " << *(baseline->second) << "." << endl;
     1082          Log() << Verbose(1) << "I could not determine a winner for this baseline " << *(baseline->second) << "." << endl;
    10821083        }
    10831084
    10841085        // 5d. If the set of lines is not yet empty, go to 5. and continue
    10851086      } else
    1086         *out << Verbose(2) << "Baseline candidate " << *(baseline->second) << " has a triangle count of " << baseline->second->triangles.size() << "." << endl;
     1087        Log() << Verbose(2) << "Baseline candidate " << *(baseline->second) << " has a triangle count of " << baseline->second->triangles.size() << "." << endl;
    10871088  } while (flag);
    10881089
     
    10971098 * \return true - all straddling points insert, false - something went wrong
    10981099 */
    1099 bool Tesselation::InsertStraddlingPoints(ofstream *out, const PointCloud *cloud, const LinkedCell *LC)
     1100bool Tesselation::InsertStraddlingPoints(const PointCloud *cloud, const LinkedCell *LC)
    11001101{
    11011102  Vector Intersection, Normal;
    11021103  TesselPoint *Walker = NULL;
    1103   Vector *Center = cloud->GetCenter(out);
     1104  Vector *Center = cloud->GetCenter();
    11041105  list<BoundaryTriangleSet*> *triangles = NULL;
    11051106  bool AddFlag = false;
    11061107  LinkedCell *BoundaryPoints = NULL;
    11071108
    1108   *out << Verbose(1) << "Begin of InsertStraddlingPoints" << endl;
     1109  Log() << Verbose(1) << "Begin of InsertStraddlingPoints" << endl;
    11091110
    11101111  cloud->GoToFirst();
     
    11171118    }
    11181119    Walker = cloud->GetPoint();
    1119     *out << Verbose(2) << "Current point is " << *Walker << "." << endl;
     1120    Log() << Verbose(2) << "Current point is " << *Walker << "." << endl;
    11201121    // get the next triangle
    1121     triangles = FindClosestTrianglesToPoint(out, Walker->node, BoundaryPoints);
     1122    triangles = FindClosestTrianglesToPoint(Walker->node, BoundaryPoints);
    11221123    BTS = triangles->front();
    11231124    if ((triangles == NULL) || (BTS->ContainsBoundaryPoint(Walker))) {
    1124       *out << Verbose(2) << "No triangles found, probably a tesselation point itself." << endl;
     1125      Log() << Verbose(2) << "No triangles found, probably a tesselation point itself." << endl;
    11251126      cloud->GoToNext();
    11261127      continue;
    11271128    } else {
    11281129    }
    1129     *out << Verbose(2) << "Closest triangle is " << *BTS << "." << endl;
     1130    Log() << Verbose(2) << "Closest triangle is " << *BTS << "." << endl;
    11301131    // get the intersection point
    1131     if (BTS->GetIntersectionInsideTriangle(out, Center, Walker->node, &Intersection)) {
    1132       *out << Verbose(2) << "We have an intersection at " << Intersection << "." << endl;
     1132    if (BTS->GetIntersectionInsideTriangle(Center, Walker->node, &Intersection)) {
     1133      Log() << Verbose(2) << "We have an intersection at " << Intersection << "." << endl;
    11331134      // we have the intersection, check whether in- or outside of boundary
    11341135      if ((Center->DistanceSquared(Walker->node) - Center->DistanceSquared(&Intersection)) < -MYEPSILON) {
    11351136        // inside, next!
    1136         *out << Verbose(2) << *Walker << " is inside wrt triangle " << *BTS << "." << endl;
     1137        Log() << Verbose(2) << *Walker << " is inside wrt triangle " << *BTS << "." << endl;
    11371138      } else {
    11381139        // outside!
    1139         *out << Verbose(2) << *Walker << " is outside wrt triangle " << *BTS << "." << endl;
     1140        Log() << Verbose(2) << *Walker << " is outside wrt triangle " << *BTS << "." << endl;
    11401141        class BoundaryLineSet *OldLines[3], *NewLines[3];
    11411142        class BoundaryPointSet *OldPoints[3], *NewPoint;
     
    11471148        Normal.CopyVector(&BTS->NormalVector);
    11481149        // add Walker to boundary points
    1149         *out << Verbose(2) << "Adding " << *Walker << " to BoundaryPoints." << endl;
     1150        Log() << Verbose(2) << "Adding " << *Walker << " to BoundaryPoints." << endl;
    11501151        AddFlag = true;
    11511152        if (AddBoundaryPoint(Walker,0))
     
    11541155          continue;
    11551156        // remove triangle
    1156         *out << Verbose(2) << "Erasing triangle " << *BTS << "." << endl;
     1157        Log() << Verbose(2) << "Erasing triangle " << *BTS << "." << endl;
    11571158        TrianglesOnBoundary.erase(BTS->Nr);
    11581159        delete(BTS);
     
    11621163          BPS[1] = OldPoints[i];
    11631164          NewLines[i] = new class BoundaryLineSet(BPS, LinesOnBoundaryCount);
    1164           *out << Verbose(3) << "Creating new line " << *NewLines[i] << "." << endl;
     1165          Log() << Verbose(3) << "Creating new line " << *NewLines[i] << "." << endl;
    11651166          LinesOnBoundary.insert(LinePair(LinesOnBoundaryCount, NewLines[i])); // no need for check for unique insertion as BPS[0] is definitely a new one
    11661167          LinesOnBoundaryCount++;
     
    11731174            if (NewLines[j]->IsConnectedTo(BLS[0])) {
    11741175              if (n>2) {
    1175                 *out << Verbose(1) << "ERROR: " << BLS[0] << " connects to all of the new lines?!" << endl;
     1176                Log() << Verbose(1) << "ERROR: " << BLS[0] << " connects to all of the new lines?!" << endl;
    11761177                return false;
    11771178              } else
     
    11841185          BTS->GetNormalVector(Normal);
    11851186          Normal.Scale(-1.);
    1186           *out << Verbose(2) << "Created new triangle " << *BTS << "." << endl;
     1187          Log() << Verbose(2) << "Created new triangle " << *BTS << "." << endl;
    11871188          TrianglesOnBoundary.insert(TrianglePair(TrianglesOnBoundaryCount, BTS));
    11881189          TrianglesOnBoundaryCount++;
     
    11901191      }
    11911192    } else { // something is wrong with FindClosestTriangleToPoint!
    1192       *out << Verbose(1) << "ERROR: The closest triangle did not produce an intersection!" << endl;
     1193      Log() << Verbose(1) << "ERROR: The closest triangle did not produce an intersection!" << endl;
    11931194      return false;
    11941195    }
     
    11981199  // exit
    11991200  delete(Center);
    1200   *out << Verbose(1) << "End of InsertStraddlingPoints" << endl;
     1201  Log() << Verbose(1) << "End of InsertStraddlingPoints" << endl;
    12011202  return true;
    12021203};
     
    12371238  } else {
    12381239    delete TPS[n];
    1239     cout << Verbose(4) << "Node " << *((InsertUnique.first)->second->node) << " is already present in PointsOnBoundary." << endl;
     1240    Log() << Verbose(4) << "Node " << *((InsertUnique.first)->second->node) << " is already present in PointsOnBoundary." << endl;
    12401241    TPS[n] = (InsertUnique.first)->second;
    12411242  }
     
    12571258    pair<LineMap::iterator,LineMap::iterator> FindPair;
    12581259    FindPair = a->lines.equal_range(b->node->nr);
    1259     cout << Verbose(5) << "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "." << endl;
     1260    Log() << Verbose(5) << "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "." << endl;
    12601261
    12611262    for (FindLine = FindPair.first; FindLine != FindPair.second; FindLine++) {
     
    12631264      if (FindLine->second->triangles.size() < 2) {
    12641265        insertNewLine = false;
    1265         cout << Verbose(4) << "Using existing line " << *FindLine->second << endl;
     1266        Log() << Verbose(4) << "Using existing line " << *FindLine->second << endl;
    12661267
    12671268        BPS[0] = FindLine->second->endpoints[0];
     
    12901291void Tesselation::AlwaysAddTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n)
    12911292{
    1292   cout << Verbose(4) << "Adding line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl;
     1293  Log() << Verbose(4) << "Adding line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl;
    12931294  BPS[0] = a;
    12941295  BPS[1] = b;
     
    13051306void Tesselation::AddTesselationTriangle()
    13061307{
    1307   cout << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl;
     1308  Log() << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl;
    13081309
    13091310  // add triangle to global map
     
    13231324void Tesselation::AddTesselationTriangle(const int nr)
    13241325{
    1325   cout << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl;
     1326  Log() << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl;
    13261327
    13271328  // add triangle to global map
     
    13451346  for (int i = 0; i < 3; i++) {
    13461347    if (triangle->lines[i] != NULL) {
    1347       cout << Verbose(5) << "Removing triangle Nr." << triangle->Nr << " in line " << *triangle->lines[i] << "." << endl;
     1348      Log() << Verbose(5) << "Removing triangle Nr." << triangle->Nr << " in line " << *triangle->lines[i] << "." << endl;
    13481349      triangle->lines[i]->triangles.erase(triangle->Nr);
    13491350      if (triangle->lines[i]->triangles.empty()) {
    1350           cout << Verbose(5) << *triangle->lines[i] << " is no more attached to any triangle, erasing." << endl;
     1351          Log() << Verbose(5) << *triangle->lines[i] << " is no more attached to any triangle, erasing." << endl;
    13511352          RemoveTesselationLine(triangle->lines[i]);
    13521353      } else {
    1353         cout << Verbose(5) << *triangle->lines[i] << " is still attached to another triangle: ";
     1354        Log() << Verbose(5) << *triangle->lines[i] << " is still attached to another triangle: ";
    13541355        for(TriangleMap::iterator TriangleRunner = triangle->lines[i]->triangles.begin(); TriangleRunner != triangle->lines[i]->triangles.end(); TriangleRunner++)
    1355           cout << "[" << (TriangleRunner->second)->Nr << "|" << *((TriangleRunner->second)->endpoints[0]) << ", " << *((TriangleRunner->second)->endpoints[1]) << ", " << *((TriangleRunner->second)->endpoints[2]) << "] \t";
    1356         cout << endl;
     1356          Log() << Verbose(0) << "[" << (TriangleRunner->second)->Nr << "|" << *((TriangleRunner->second)->endpoints[0]) << ", " << *((TriangleRunner->second)->endpoints[1]) << ", " << *((TriangleRunner->second)->endpoints[2]) << "] \t";
     1357        Log() << Verbose(0) << endl;
    13571358//        for (int j=0;j<2;j++) {
    1358 //          cout << Verbose(5) << "Lines of endpoint " << *(triangle->lines[i]->endpoints[j]) << ": ";
     1359//          Log() << Verbose(5) << "Lines of endpoint " << *(triangle->lines[i]->endpoints[j]) << ": ";
    13591360//          for(LineMap::iterator LineRunner = triangle->lines[i]->endpoints[j]->lines.begin(); LineRunner != triangle->lines[i]->endpoints[j]->lines.end(); LineRunner++)
    1360 //            cout << "[" << *(LineRunner->second) << "] \t";
    1361 //          cout << endl;
     1361//            Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t";
     1362//          Log() << Verbose(0) << endl;
    13621363//        }
    13631364      }
    13641365      triangle->lines[i] = NULL;  // free'd or not: disconnect
    13651366    } else
    1366       cerr << "ERROR: This line " << i << " has already been free'd." << endl;
     1367      eLog() << Verbose(0) << "ERROR: This line " << i << " has already been free'd." << endl;
    13671368  }
    13681369
    13691370  if (TrianglesOnBoundary.erase(triangle->Nr))
    1370     cout << Verbose(5) << "Removing triangle Nr. " << triangle->Nr << "." << endl;
     1371    Log() << Verbose(5) << "Removing triangle Nr. " << triangle->Nr << "." << endl;
    13711372  delete(triangle);
    13721373};
     
    13981399        for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++)
    13991400          if ((*Runner).second == line) {
    1400             cout << Verbose(5) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;
     1401            Log() << Verbose(5) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;
    14011402            line->endpoints[i]->lines.erase(Runner);
    14021403            break;
     
    14041405      } else { // there's just a single line left
    14051406        if (line->endpoints[i]->lines.erase(line->Nr))
    1406           cout << Verbose(5) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;
     1407          Log() << Verbose(5) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;
    14071408      }
    14081409      if (line->endpoints[i]->lines.empty()) {
    1409         cout << Verbose(5) << *line->endpoints[i] << " has no more lines it's attached to, erasing." << endl;
     1410        Log() << Verbose(5) << *line->endpoints[i] << " has no more lines it's attached to, erasing." << endl;
    14101411        RemoveTesselationPoint(line->endpoints[i]);
    14111412      } else {
    1412         cout << Verbose(5) << *line->endpoints[i] << " has still lines it's attached to: ";
     1413        Log() << Verbose(5) << *line->endpoints[i] << " has still lines it's attached to: ";
    14131414        for(LineMap::iterator LineRunner = line->endpoints[i]->lines.begin(); LineRunner != line->endpoints[i]->lines.end(); LineRunner++)
    1414           cout << "[" << *(LineRunner->second) << "] \t";
    1415         cout << endl;
     1415          Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t";
     1416        Log() << Verbose(0) << endl;
    14161417      }
    14171418      line->endpoints[i] = NULL;  // free'd or not: disconnect
    14181419    } else
    1419       cerr << "ERROR: Endpoint " << i << " has already been free'd." << endl;
     1420      eLog() << Verbose(0) << "ERROR: Endpoint " << i << " has already been free'd." << endl;
    14201421  }
    14211422  if (!line->triangles.empty())
    1422     cerr << "WARNING: Memory Leak! I " << *line << " am still connected to some triangles." << endl;
     1423    eLog() << Verbose(0) << "WARNING: Memory Leak! I " << *line << " am still connected to some triangles." << endl;
    14231424
    14241425  if (LinesOnBoundary.erase(line->Nr))
    1425     cout << Verbose(5) << "Removing line Nr. " << line->Nr << "." << endl;
     1426    Log() << Verbose(5) << "Removing line Nr. " << line->Nr << "." << endl;
    14261427  delete(line);
    14271428};
     
    14371438    return;
    14381439  if (PointsOnBoundary.erase(point->Nr))
    1439     cout << Verbose(5) << "Removing point Nr. " << point->Nr << "." << endl;
     1440    Log() << Verbose(5) << "Removing point Nr. " << point->Nr << "." << endl;
    14401441  delete(point);
    14411442};
     
    14501451 *                 triangles exist which is the maximum for three points
    14511452 */
    1452 int Tesselation::CheckPresenceOfTriangle(ofstream *out, TesselPoint *Candidates[3]) {
     1453int Tesselation::CheckPresenceOfTriangle(TesselPoint *Candidates[3]) {
    14531454  int adjacentTriangleCount = 0;
    14541455  class BoundaryPointSet *Points[3];
    14551456
    1456   *out << Verbose(2) << "Begin of CheckPresenceOfTriangle" << endl;
     1457  Log() << Verbose(2) << "Begin of CheckPresenceOfTriangle" << endl;
    14571458  // builds a triangle point set (Points) of the end points
    14581459  for (int i = 0; i < 3; i++) {
     
    14731474          for (; (FindLine != Points[i]->lines.end()) && (FindLine->first == Points[j]->node->nr); FindLine++) {
    14741475            TriangleMap *triangles = &FindLine->second->triangles;
    1475             *out << Verbose(3) << "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "." << endl;
     1476            Log() << Verbose(3) << "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "." << endl;
    14761477            for (TriangleMap::iterator FindTriangle = triangles->begin(); FindTriangle != triangles->end(); FindTriangle++) {
    14771478              if (FindTriangle->second->IsPresentTupel(Points)) {
     
    14791480              }
    14801481            }
    1481             *out << Verbose(3) << "end." << endl;
     1482            Log() << Verbose(3) << "end." << endl;
    14821483          }
    14831484          // Only one of the triangle lines must be considered for the triangle count.
    1484           //*out << Verbose(2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;
     1485          //Log() << Verbose(2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;
    14851486          //return adjacentTriangleCount;
    14861487        }
     
    14891490  }
    14901491
    1491   *out << Verbose(2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;
    1492   *out << Verbose(2) << "End of CheckPresenceOfTriangle" << endl;
     1492  Log() << Verbose(2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;
     1493  Log() << Verbose(2) << "End of CheckPresenceOfTriangle" << endl;
    14931494  return adjacentTriangleCount;
    14941495};
     
    15021503 * \return NULL - none found or pointer to triangle
    15031504 */
    1504 class BoundaryTriangleSet * Tesselation::GetPresentTriangle(ofstream *out, TesselPoint *Candidates[3])
     1505class BoundaryTriangleSet * Tesselation::GetPresentTriangle(TesselPoint *Candidates[3])
    15051506{
    15061507  class BoundaryTriangleSet *triangle = NULL;
     
    15331534          }
    15341535          // Only one of the triangle lines must be considered for the triangle count.
    1535           //*out << Verbose(2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;
     1536          //Log() << Verbose(2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;
    15361537          //return adjacentTriangleCount;
    15371538        }
     
    15521553 * \param *LC LinkedCell structure with neighbouring TesselPoint's
    15531554 */
    1554 void Tesselation::FindStartingTriangle(ofstream *out, const double RADIUS, const LinkedCell *LC)
    1555 {
    1556   cout << Verbose(1) << "Begin of FindStartingTriangle\n";
     1555void Tesselation::FindStartingTriangle(const double RADIUS, const LinkedCell *LC)
     1556{
     1557  Log() << Verbose(1) << "Begin of FindStartingTriangle\n";
    15571558  int i = 0;
    15581559  TesselPoint* FirstPoint = NULL;
     
    15781579      for (LC->n[(i+2)%NDIM]=0;LC->n[(i+2)%NDIM]<LC->N[(i+2)%NDIM];LC->n[(i+2)%NDIM]++) {
    15791580        const LinkedNodes *List = LC->GetCurrentCell();
    1580         //cout << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;
     1581        //Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;
    15811582        if (List != NULL) {
    15821583          for (LinkedNodes::const_iterator Runner = List->begin();Runner != List->end();Runner++) {
    15831584            if ((*Runner)->node->x[i] > maxCoordinate[i]) {
    1584               cout << Verbose(2) << "New maximal for axis " << i << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl;
     1585              Log() << Verbose(2) << "New maximal for axis " << i << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl;
    15851586              maxCoordinate[i] = (*Runner)->node->x[i];
    15861587              MaxPoint[i] = (*Runner);
     
    15881589          }
    15891590        } else {
    1590           cerr << "ERROR: The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!" << endl;
     1591          eLog() << Verbose(0) << "ERROR: The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!" << endl;
    15911592        }
    15921593      }
    15931594  }
    15941595
    1595   cout << Verbose(2) << "Found maximum coordinates: ";
     1596  Log() << Verbose(2) << "Found maximum coordinates: ";
    15961597  for (int i=0;i<NDIM;i++)
    1597     cout << i << ": " << *MaxPoint[i] << "\t";
    1598   cout << endl;
     1598    Log() << Verbose(0) << i << ": " << *MaxPoint[i] << "\t";
     1599  Log() << Verbose(0) << endl;
    15991600
    16001601  BTS = NULL;
     
    16041605    Oben.x[k] = 1.;
    16051606    FirstPoint = MaxPoint[k];
    1606     cout << Verbose(1) << "Coordinates of start node at " << *FirstPoint->node << "." << endl;
     1607    Log() << Verbose(1) << "Coordinates of start node at " << *FirstPoint->node << "." << endl;
    16071608
    16081609    double ShortestAngle;
     
    16351636
    16361637    // adding point 1 and point 2 and add the line between them
    1637     cout << Verbose(1) << "Coordinates of start node at " << *FirstPoint->node << "." << endl;
     1638    Log() << Verbose(1) << "Coordinates of start node at " << *FirstPoint->node << "." << endl;
    16381639    AddTesselationPoint(FirstPoint, 0);
    1639     cout << Verbose(1) << "Found second point is at " << *SecondPoint->node << ".\n";
     1640    Log() << Verbose(1) << "Found second point is at " << *SecondPoint->node << ".\n";
    16401641    AddTesselationPoint(SecondPoint, 1);
    16411642    AddTesselationLine(TPS[0], TPS[1], 0);
    16421643
    1643     //cout << Verbose(2) << "INFO: OldSphereCenter is at " << helper << ".\n";
     1644    //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << helper << ".\n";
    16441645    FindThirdPointForTesselation(Oben, SearchDirection, helper, BLS[0], NULL, *&OptCandidates, &ShortestAngle, RADIUS, LC);
    1645     cout << Verbose(1) << "List of third Points is ";
     1646    Log() << Verbose(1) << "List of third Points is ";
    16461647    for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    1647         cout << " " << *(*it)->point;
    1648     }
    1649     cout << endl;
     1648        Log() << Verbose(0) << " " << *(*it)->point;
     1649    }
     1650    Log() << Verbose(0) << endl;
    16501651
    16511652    for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
     
    16601661      // ... and calculate its normal vector (with correct orientation)
    16611662      (*it)->OptCenter.Scale(-1.);
    1662       cout << Verbose(2) << "Anti-Oben is currently " << (*it)->OptCenter << "." << endl;
     1663      Log() << Verbose(2) << "Anti-Oben is currently " << (*it)->OptCenter << "." << endl;
    16631664      BTS->GetNormalVector((*it)->OptCenter);  // vector to compare with should point inwards
    1664       cout << Verbose(0) << "==> Found starting triangle consists of " << *FirstPoint << ", " << *SecondPoint << " and "
     1665      Log() << Verbose(0) << "==> Found starting triangle consists of " << *FirstPoint << ", " << *SecondPoint << " and "
    16651666      << *(*it)->point << " with normal vector " << BTS->NormalVector << ".\n";
    16661667
     
    16741675        AddTesselationLine(TPS[0], TPS[1], 0);
    16751676      }
    1676       cout << Verbose(2) << "Projection is " << BTS->NormalVector.ScalarProduct(&Oben) << "." << endl;
     1677      Log() << Verbose(2) << "Projection is " << BTS->NormalVector.ScalarProduct(&Oben) << "." << endl;
    16771678    }
    16781679    if (BTS != NULL) // we have created one starting triangle
     
    16961697  }
    16971698  delete(OptCandidates);
    1698   cout << Verbose(1) << "End of FindStartingTriangle\n";
     1699  Log() << Verbose(1) << "End of FindStartingTriangle\n";
    16991700};
    17001701
     
    17081709 * @param *LC LinkedCell structure with neighbouring points
    17091710 */
    1710 bool Tesselation::FindNextSuitableTriangle(ofstream *out, BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC)
    1711 {
    1712   cout << Verbose(0) << "Begin of FindNextSuitableTriangle\n";
     1711bool Tesselation::FindNextSuitableTriangle(BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC)
     1712{
     1713  Log() << Verbose(0) << "Begin of FindNextSuitableTriangle\n";
    17131714  bool result = true;
    17141715  CandidateList *OptCandidates = new CandidateList();
     
    17241725  double radius, CircleRadius;
    17251726
    1726   cout << Verbose(1) << "Current baseline is " << Line << " of triangle " << T << "." << endl;
     1727  Log() << Verbose(1) << "Current baseline is " << Line << " of triangle " << T << "." << endl;
    17271728  for (int i=0;i<3;i++)
    17281729    if ((T.endpoints[i]->node != Line.endpoints[0]->node) && (T.endpoints[i]->node != Line.endpoints[1]->node))
     
    17431744    CircleRadius = RADIUS*RADIUS - radius/4.;
    17441745    CirclePlaneNormal.Normalize();
    1745     //cout << Verbose(2) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
     1746    //Log() << Verbose(2) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
    17461747
    17471748    // construct old center
     
    17521753    OldSphereCenter.AddVector(&helper);
    17531754    OldSphereCenter.SubtractVector(&CircleCenter);
    1754     //cout << Verbose(2) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;
     1755    //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;
    17551756
    17561757    // construct SearchDirection
     
    17621763    SearchDirection.ProjectOntoPlane(&OldSphereCenter);
    17631764    SearchDirection.Normalize();
    1764     cout << Verbose(2) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
     1765    Log() << Verbose(2) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
    17651766    if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {
    17661767      // rotated the wrong way!
    1767       cerr << "ERROR: SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl;
     1768      eLog() << Verbose(0) << "ERROR: SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl;
    17681769    }
    17691770
     
    17721773
    17731774  } else {
    1774     cout << Verbose(1) << "Circumcircle for base line " << Line << " and base triangle " << T << " is too big!" << endl;
     1775    Log() << Verbose(1) << "Circumcircle for base line " << Line << " and base triangle " << T << " is too big!" << endl;
    17751776  }
    17761777
    17771778  if (OptCandidates->begin() == OptCandidates->end()) {
    1778     cerr << "WARNING: Could not find a suitable candidate." << endl;
     1779    eLog() << Verbose(0) << "WARNING: Could not find a suitable candidate." << endl;
    17791780    return false;
    17801781  }
    1781   cout << Verbose(1) << "Third Points are ";
     1782  Log() << Verbose(1) << "Third Points are ";
    17821783  for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    1783     cout << " " << *(*it)->point;
    1784   }
    1785   cout << endl;
     1784    Log() << Verbose(0) << " " << *(*it)->point;
     1785  }
     1786  Log() << Verbose(0) << endl;
    17861787
    17871788  BoundaryLineSet *BaseRay = &Line;
    17881789  for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    1789     cout << Verbose(1) << " Third point candidate is " << *(*it)->point
     1790    Log() << Verbose(1) << " Third point candidate is " << *(*it)->point
    17901791    << " with circumsphere's center at " << (*it)->OptCenter << "." << endl;
    1791     cout << Verbose(1) << " Baseline is " << *BaseRay << endl;
     1792    Log() << Verbose(1) << " Baseline is " << *BaseRay << endl;
    17921793
    17931794    // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2)
     
    17961797    PointCandidates[1] = BaseRay->endpoints[0]->node;
    17971798    PointCandidates[2] = BaseRay->endpoints[1]->node;
    1798     int existentTrianglesCount = CheckPresenceOfTriangle(out, PointCandidates);
     1799    int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates);
    17991800
    18001801    BTS = NULL;
     
    18161817        (*it)->OptCenter.Scale(-1.);
    18171818
    1818         cout << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector
     1819        Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector
    18191820          << " for this triangle ... " << endl;
    1820       //cout << Verbose(1) << "We have "<< TrianglesOnBoundaryCount << " for line " << *BaseRay << "." << endl;
     1821      //Log() << Verbose(1) << "We have "<< TrianglesOnBoundaryCount << " for line " << *BaseRay << "." << endl;
    18211822      } else {
    1822         cout << Verbose(1) << "WARNING: This triangle consisting of ";
    1823         cout << *(*it)->point << ", ";
    1824         cout << *BaseRay->endpoints[0]->node << " and ";
    1825         cout << *BaseRay->endpoints[1]->node << " ";
    1826         cout << "exists and is not added, as it does not seem helpful!" << endl;
     1823        Log() << Verbose(1) << "WARNING: This triangle consisting of ";
     1824        Log() << Verbose(0) << *(*it)->point << ", ";
     1825        Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and ";
     1826        Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " ";
     1827        Log() << Verbose(0) << "exists and is not added, as it does not seem helpful!" << endl;
    18271828        result = false;
    18281829      }
     
    18461847          (*it)->OtherOptCenter.Scale(-1.);
    18471848
    1848           cout << "--> WARNING: Special new triangle with " << *BTS << " and normal vector " << BTS->NormalVector
     1849          Log() << Verbose(0) << "--> WARNING: Special new triangle with " << *BTS << " and normal vector " << BTS->NormalVector
    18491850          << " for this triangle ... " << endl;
    1850           cout << Verbose(1) << "We have "<< BaseRay->triangles.size() << " for line " << BaseRay << "." << endl;
     1851          Log() << Verbose(1) << "We have "<< BaseRay->triangles.size() << " for line " << BaseRay << "." << endl;
    18511852        } else {
    1852           cout << Verbose(1) << "WARNING: This triangle consisting of ";
    1853           cout << *(*it)->point << ", ";
    1854           cout << *BaseRay->endpoints[0]->node << " and ";
    1855           cout << *BaseRay->endpoints[1]->node << " ";
    1856           cout << "exists and is not added, as it does not seem helpful!" << endl;
     1853          Log() << Verbose(1) << "WARNING: This triangle consisting of ";
     1854          Log() << Verbose(0) << *(*it)->point << ", ";
     1855          Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and ";
     1856          Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " ";
     1857          Log() << Verbose(0) << "exists and is not added, as it does not seem helpful!" << endl;
    18571858          result = false;
    18581859        }
    18591860    } else {
    1860       cout << Verbose(1) << "This triangle consisting of ";
    1861       cout << *(*it)->point << ", ";
    1862       cout << *BaseRay->endpoints[0]->node << " and ";
    1863       cout << *BaseRay->endpoints[1]->node << " ";
    1864       cout << "is invalid!" << endl;
     1861      Log() << Verbose(1) << "This triangle consisting of ";
     1862      Log() << Verbose(0) << *(*it)->point << ", ";
     1863      Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and ";
     1864      Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " ";
     1865      Log() << Verbose(0) << "is invalid!" << endl;
    18651866      result = false;
    18661867    }
     
    18691870    BaseRay = BLS[0];
    18701871    if ((BTS != NULL) && (BTS->NormalVector.NormSquared() < MYEPSILON)) {
    1871       *out << Verbose(1) << "CRITICAL: Triangle " << *BTS << " has zero normal vector!" << endl;
     1872      Log() << Verbose(1) << "CRITICAL: Triangle " << *BTS << " has zero normal vector!" << endl;
    18721873      exit(255);
    18731874    }
     
    18821883  }
    18831884  delete(OptCandidates);
    1884   cout << Verbose(0) << "End of FindNextSuitableTriangle\n";
     1885  Log() << Verbose(0) << "End of FindNextSuitableTriangle\n";
    18851886  return result;
    18861887};
     
    18931894 * \return NULL - convex, otherwise endpoint that makes it concave
    18941895 */
    1895 class BoundaryPointSet *Tesselation::IsConvexRectangle(ofstream *out, class BoundaryLineSet *Base)
     1896class BoundaryPointSet *Tesselation::IsConvexRectangle(class BoundaryLineSet *Base)
    18961897{
    18971898  class BoundaryPointSet *Spot = NULL;
     
    19061907  OtherBase = new class BoundaryLineSet(BPS,-1);
    19071908
    1908   *out << Verbose(3) << "INFO: Current base line is " << *Base << "." << endl;
    1909   *out << Verbose(3) << "INFO: Other base line is " << *OtherBase << "." << endl;
     1909  Log() << Verbose(3) << "INFO: Current base line is " << *Base << "." << endl;
     1910  Log() << Verbose(3) << "INFO: Other base line is " << *OtherBase << "." << endl;
    19101911
    19111912  // get the closest point on each line to the other line
    1912   ClosestPoint = GetClosestPointBetweenLine(out, Base, OtherBase);
     1913  ClosestPoint = GetClosestPointBetweenLine(Base, OtherBase);
    19131914
    19141915  // delete the temporary other base line
     
    19271928  delete(ClosestPoint);
    19281929  if ((distance[0] * distance[1]) > 0)  { // have same sign?
    1929     *out << Verbose(3) << "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1]  << ". " << *Base << "' rectangle is concave." << endl;
     1930    Log() << Verbose(3) << "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1]  << ". " << *Base << "' rectangle is concave." << endl;
    19301931    if (distance[0] < distance[1]) {
    19311932      Spot = Base->endpoints[0];
     
    19351936    return Spot;
    19361937  } else {  // different sign, i.e. we are in between
    1937     *out << Verbose(3) << "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex." << endl;
     1938    Log() << Verbose(3) << "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex." << endl;
    19381939    return NULL;
    19391940  }
     
    19441945{
    19451946  // print all lines
    1946   *out << Verbose(1) << "Printing all boundary points for debugging:" << endl;
     1947  Log() << Verbose(1) << "Printing all boundary points for debugging:" << endl;
    19471948  for (PointMap::const_iterator PointRunner = PointsOnBoundary.begin();PointRunner != PointsOnBoundary.end(); PointRunner++)
    1948     *out << Verbose(2) << *(PointRunner->second) << endl;
     1949    Log() << Verbose(2) << *(PointRunner->second) << endl;
    19491950};
    19501951
     
    19521953{
    19531954  // print all lines
    1954   *out << Verbose(1) << "Printing all boundary lines for debugging:" << endl;
     1955  Log() << Verbose(1) << "Printing all boundary lines for debugging:" << endl;
    19551956  for (LineMap::const_iterator LineRunner = LinesOnBoundary.begin(); LineRunner != LinesOnBoundary.end(); LineRunner++)
    1956     *out << Verbose(2) << *(LineRunner->second) << endl;
     1957    Log() << Verbose(2) << *(LineRunner->second) << endl;
    19571958};
    19581959
     
    19601961{
    19611962  // print all triangles
    1962   *out << Verbose(1) << "Printing all boundary triangles for debugging:" << endl;
     1963  Log() << Verbose(1) << "Printing all boundary triangles for debugging:" << endl;
    19631964  for (TriangleMap::const_iterator TriangleRunner = TrianglesOnBoundary.begin(); TriangleRunner != TrianglesOnBoundary.end(); TriangleRunner++)
    1964     *out << Verbose(2) << *(TriangleRunner->second) << endl;
     1965    Log() << Verbose(2) << *(TriangleRunner->second) << endl;
    19651966};
    19661967
     
    19701971 * \return volume change due to flipping (0 - then no flipped occured)
    19711972 */
    1972 double Tesselation::PickFarthestofTwoBaselines(ofstream *out, class BoundaryLineSet *Base)
     1973double Tesselation::PickFarthestofTwoBaselines(class BoundaryLineSet *Base)
    19731974{
    19741975  class BoundaryLineSet *OtherBase;
     
    19831984  OtherBase = new class BoundaryLineSet(BPS,-1);
    19841985
    1985   *out << Verbose(3) << "INFO: Current base line is " << *Base << "." << endl;
    1986   *out << Verbose(3) << "INFO: Other base line is " << *OtherBase << "." << endl;
     1986  Log() << Verbose(3) << "INFO: Current base line is " << *Base << "." << endl;
     1987  Log() << Verbose(3) << "INFO: Other base line is " << *OtherBase << "." << endl;
    19871988
    19881989  // get the closest point on each line to the other line
    1989   ClosestPoint[0] = GetClosestPointBetweenLine(out, Base, OtherBase);
    1990   ClosestPoint[1] = GetClosestPointBetweenLine(out, OtherBase, Base);
     1990  ClosestPoint[0] = GetClosestPointBetweenLine(Base, OtherBase);
     1991  ClosestPoint[1] = GetClosestPointBetweenLine(OtherBase, Base);
    19911992
    19921993  // get the distance vector from Base line to OtherBase line
     
    20042005
    20052006  if (Distance.NormSquared() < MYEPSILON) { // check for intersection
    2006     *out << Verbose(3) << "REJECT: Both lines have an intersection: Nothing to do." << endl;
     2007    Log() << Verbose(3) << "REJECT: Both lines have an intersection: Nothing to do." << endl;
    20072008    return false;
    20082009  } else { // check for sign against BaseLineNormal
     
    20102011    BaseLineNormal.Zero();
    20112012    if (Base->triangles.size() < 2) {
    2012       *out << Verbose(2) << "ERROR: Less than two triangles are attached to this baseline!" << endl;
     2013      Log() << Verbose(2) << "ERROR: Less than two triangles are attached to this baseline!" << endl;
    20132014      return 0.;
    20142015    }
    20152016    for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) {
    2016       *out << Verbose(4) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;
     2017      Log() << Verbose(4) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;
    20172018      BaseLineNormal.AddVector(&(runner->second->NormalVector));
    20182019    }
     
    20202021
    20212022    if (Distance.ScalarProduct(&BaseLineNormal) > MYEPSILON) { // Distance points outwards, hence OtherBase higher than Base -> flip
    2022       *out << Verbose(2) << "ACCEPT: Other base line would be higher: Flipping baseline." << endl;
     2023      Log() << Verbose(2) << "ACCEPT: Other base line would be higher: Flipping baseline." << endl;
    20232024      // calculate volume summand as a general tetraeder
    20242025      return volume;
    20252026    } else {  // Base higher than OtherBase -> do nothing
    2026       *out << Verbose(2) << "REJECT: Base line is higher: Nothing to do." << endl;
     2027      Log() << Verbose(2) << "REJECT: Base line is higher: Nothing to do." << endl;
    20272028      return 0.;
    20282029    }
     
    20372038 * \return pointer to allocated new baseline - flipping successful, NULL - something went awry
    20382039 */
    2039 class BoundaryLineSet * Tesselation::FlipBaseline(ofstream *out, class BoundaryLineSet *Base)
     2040class BoundaryLineSet * Tesselation::FlipBaseline(class BoundaryLineSet *Base)
    20402041{
    20412042  class BoundaryLineSet *OldLines[4], *NewLine;
     
    20452046  int i,m;
    20462047
    2047   *out << Verbose(1) << "Begin of FlipBaseline" << endl;
     2048  Log() << Verbose(1) << "Begin of FlipBaseline" << endl;
    20482049
    20492050  // calculate NormalVector for later use
    20502051  BaseLineNormal.Zero();
    20512052  if (Base->triangles.size() < 2) {
    2052     *out << Verbose(2) << "ERROR: Less than two triangles are attached to this baseline!" << endl;
     2053    Log() << Verbose(2) << "ERROR: Less than two triangles are attached to this baseline!" << endl;
    20532054    return NULL;
    20542055  }
    20552056  for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) {
    2056     *out << Verbose(4) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;
     2057    Log() << Verbose(4) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;
    20572058    BaseLineNormal.AddVector(&(runner->second->NormalVector));
    20582059  }
     
    20672068  i=0;
    20682069  m=0;
    2069   *out << Verbose(3) << "The four old lines are: ";
     2070  Log() << Verbose(3) << "The four old lines are: ";
    20702071  for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++)
    20712072    for (int j=0;j<3;j++) // all of their endpoints and baselines
    20722073      if (runner->second->lines[j] != Base) { // pick not the central baseline
    20732074        OldLines[i++] = runner->second->lines[j];
    2074         *out << *runner->second->lines[j] << "\t";
     2075        Log() << Verbose(0) << *runner->second->lines[j] << "\t";
    20752076      }
    2076   *out << endl;
    2077   *out << Verbose(3) << "The two old points are: ";
     2077  Log() << Verbose(0) << endl;
     2078  Log() << Verbose(3) << "The two old points are: ";
    20782079  for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++)
    20792080    for (int j=0;j<3;j++) // all of their endpoints and baselines
    20802081      if (!Base->ContainsBoundaryPoint(runner->second->endpoints[j])) { // and neither of its endpoints
    20812082        OldPoints[m++] = runner->second->endpoints[j];
    2082         *out << *runner->second->endpoints[j] << "\t";
     2083        Log() << Verbose(0) << *runner->second->endpoints[j] << "\t";
    20832084      }
    2084   *out << endl;
     2085  Log() << Verbose(0) << endl;
    20852086
    20862087  // check whether everything is in place to create new lines and triangles
    20872088  if (i<4) {
    2088     *out << Verbose(1) << "ERROR: We have not gathered enough baselines!" << endl;
     2089    Log() << Verbose(1) << "ERROR: We have not gathered enough baselines!" << endl;
    20892090    return NULL;
    20902091  }
    20912092  for (int j=0;j<4;j++)
    20922093    if (OldLines[j] == NULL) {
    2093       *out << Verbose(1) << "ERROR: We have not gathered enough baselines!" << endl;
     2094      Log() << Verbose(1) << "ERROR: We have not gathered enough baselines!" << endl;
    20942095      return NULL;
    20952096    }
    20962097  for (int j=0;j<2;j++)
    20972098    if (OldPoints[j] == NULL) {
    2098       *out << Verbose(1) << "ERROR: We have not gathered enough endpoints!" << endl;
     2099      Log() << Verbose(1) << "ERROR: We have not gathered enough endpoints!" << endl;
    20992100      return NULL;
    21002101    }
    21012102
    21022103  // remove triangles and baseline removes itself
    2103   *out << Verbose(3) << "INFO: Deleting baseline " << *Base << " from global list." << endl;
     2104  Log() << Verbose(3) << "INFO: Deleting baseline " << *Base << " from global list." << endl;
    21042105  OldBaseLineNr = Base->Nr;
    21052106  m=0;
    21062107  for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) {
    2107     *out << Verbose(3) << "INFO: Deleting triangle " << *(runner->second) << "." << endl;
     2108    Log() << Verbose(3) << "INFO: Deleting triangle " << *(runner->second) << "." << endl;
    21082109    OldTriangleNrs[m++] = runner->second->Nr;
    21092110    RemoveTesselationTriangle(runner->second);
     
    21152116  NewLine = new class BoundaryLineSet(BPS, OldBaseLineNr);
    21162117  LinesOnBoundary.insert(LinePair(OldBaseLineNr, NewLine)); // no need for check for unique insertion as NewLine is definitely a new one
    2117   *out << Verbose(3) << "INFO: Created new baseline " << *NewLine << "." << endl;
     2118  Log() << Verbose(3) << "INFO: Created new baseline " << *NewLine << "." << endl;
    21182119
    21192120  // construct new triangles with flipped baseline
     
    21302131    BTS->GetNormalVector(BaseLineNormal);
    21312132    AddTesselationTriangle(OldTriangleNrs[0]);
    2132     *out << Verbose(3) << "INFO: Created new triangle " << *BTS << "." << endl;
     2133    Log() << Verbose(3) << "INFO: Created new triangle " << *BTS << "." << endl;
    21332134
    21342135    BLS[0] = (i==2 ? OldLines[3] : OldLines[2]);
     
    21382139    BTS->GetNormalVector(BaseLineNormal);
    21392140    AddTesselationTriangle(OldTriangleNrs[1]);
    2140     *out << Verbose(3) << "INFO: Created new triangle " << *BTS << "." << endl;
     2141    Log() << Verbose(3) << "INFO: Created new triangle " << *BTS << "." << endl;
    21412142  } else {
    2142     *out << Verbose(1) << "The four old lines do not connect, something's utterly wrong here!" << endl;
     2143    Log() << Verbose(1) << "The four old lines do not connect, something's utterly wrong here!" << endl;
    21432144    return NULL;
    21442145  }
    21452146
    2146   *out << Verbose(1) << "End of FlipBaseline" << endl;
     2147  Log() << Verbose(1) << "End of FlipBaseline" << endl;
    21472148  return NewLine;
    21482149};
     
    21592160void Tesselation::FindSecondPointForTesselation(TesselPoint* a, Vector Oben, TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell *LC)
    21602161{
    2161   cout << Verbose(2) << "Begin of FindSecondPointForTesselation" << endl;
     2162  Log() << Verbose(2) << "Begin of FindSecondPointForTesselation" << endl;
    21622163  Vector AngleCheck;
    21632164  class TesselPoint* Candidate = NULL;
     
    21722173      N[i] = LC->n[i];
    21732174  } else {
    2174     cerr << "ERROR: Point " << *a << " is not found in cell " << LC->index << "." << endl;
     2175    eLog() << Verbose(0) << "ERROR: Point " << *a << " is not found in cell " << LC->index << "." << endl;
    21752176    return;
    21762177  }
    21772178  // then go through the current and all neighbouring cells and check the contained points for possible candidates
    2178   cout << Verbose(3) << "LC Intervals from [";
     2179  Log() << Verbose(3) << "LC Intervals from [";
    21792180  for (int i=0;i<NDIM;i++) {
    2180   cout << " " << N[i] << "<->" << LC->N[i];
    2181   }
    2182   cout << "] :";
     2181  Log() << Verbose(0) << " " << N[i] << "<->" << LC->N[i];
     2182  }
     2183  Log() << Verbose(0) << "] :";
    21832184  for (int i=0;i<NDIM;i++) {
    21842185    Nlower[i] = ((N[i]-1) >= 0) ? N[i]-1 : 0;
    21852186    Nupper[i] = ((N[i]+1) < LC->N[i]) ? N[i]+1 : LC->N[i]-1;
    2186     cout << " [" << Nlower[i] << "," << Nupper[i] << "] ";
    2187   }
    2188   cout << endl;
     2187    Log() << Verbose(0) << " [" << Nlower[i] << "," << Nupper[i] << "] ";
     2188  }
     2189  Log() << Verbose(0) << endl;
    21892190
    21902191
     
    21932194      for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) {
    21942195        const LinkedNodes *List = LC->GetCurrentCell();
    2195         //cout << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;
     2196        //Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;
    21962197        if (List != NULL) {
    21972198          for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
     
    22242225                angle = AngleCheck.Angle(&Oben);
    22252226                if (angle < Storage[0]) {
    2226                   //cout << Verbose(3) << "Old values of Storage: %lf %lf \n", Storage[0], Storage[1]);
    2227                   cout << Verbose(3) << "Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << ".\n";
     2227                  //Log() << Verbose(3) << "Old values of Storage: %lf %lf \n", Storage[0], Storage[1]);
     2228                  Log() << Verbose(3) << "Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << ".\n";
    22282229                  OptCandidate = Candidate;
    22292230                  Storage[0] = angle;
    2230                   //cout << Verbose(3) << "Changing something in Storage: %lf %lf. \n", Storage[0], Storage[2]);
     2231                  //Log() << Verbose(3) << "Changing something in Storage: %lf %lf. \n", Storage[0], Storage[2]);
    22312232                } else {
    2232                   //cout << Verbose(3) << "Current candidate is " << *Candidate << ": Looses with angle " << angle << " to a better candidate " << *OptCandidate << endl;
     2233                  //Log() << Verbose(3) << "Current candidate is " << *Candidate << ": Looses with angle " << angle << " to a better candidate " << *OptCandidate << endl;
    22332234                }
    22342235              } else {
    2235                 //cout << Verbose(3) << "Current candidate is " << *Candidate << ": Refused due to Radius " << norm << endl;
     2236                //Log() << Verbose(3) << "Current candidate is " << *Candidate << ": Refused due to Radius " << norm << endl;
    22362237              }
    22372238            } else {
    2238               //cout << Verbose(3) << "Current candidate is " << *Candidate << ": Candidate is equal to first endpoint." << *a << "." << endl;
     2239              //Log() << Verbose(3) << "Current candidate is " << *Candidate << ": Candidate is equal to first endpoint." << *a << "." << endl;
    22392240            }
    22402241          }
    22412242        } else {
    2242           cout << Verbose(3) << "Linked cell list is empty." << endl;
     2243          Log() << Verbose(3) << "Linked cell list is empty." << endl;
    22432244        }
    22442245      }
    2245   cout << Verbose(2) << "End of FindSecondPointForTesselation" << endl;
     2246  Log() << Verbose(2) << "End of FindSecondPointForTesselation" << endl;
    22462247};
    22472248
     
    22952296  CandidateForTesselation *optCandidate = NULL;
    22962297
    2297   cout << Verbose(1) << "Begin of FindThirdPointForTesselation" << endl;
    2298 
    2299   cout << Verbose(2) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl;
     2298  Log() << Verbose(1) << "Begin of FindThirdPointForTesselation" << endl;
     2299
     2300  Log() << Verbose(2) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl;
    23002301
    23012302  // construct center of circle
     
    23132314    CircleRadius = RADIUS*RADIUS - radius/4.;
    23142315    CirclePlaneNormal.Normalize();
    2315     //cout << Verbose(2) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
     2316    //Log() << Verbose(2) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
    23162317
    23172318    // test whether old center is on the band's plane
    23182319    if (fabs(OldSphereCenter.ScalarProduct(&CirclePlaneNormal)) > HULLEPSILON) {
    2319       cerr << "ERROR: Something's very wrong here: OldSphereCenter is not on the band's plane as desired by " << fabs(OldSphereCenter.ScalarProduct(&CirclePlaneNormal)) << "!" << endl;
     2320      eLog() << Verbose(0) << "ERROR: Something's very wrong here: OldSphereCenter is not on the band's plane as desired by " << fabs(OldSphereCenter.ScalarProduct(&CirclePlaneNormal)) << "!" << endl;
    23202321      OldSphereCenter.ProjectOntoPlane(&CirclePlaneNormal);
    23212322    }
    23222323    radius = OldSphereCenter.ScalarProduct(&OldSphereCenter);
    23232324    if (fabs(radius - CircleRadius) < HULLEPSILON) {
    2324       //cout << Verbose(2) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;
     2325      //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;
    23252326
    23262327      // check SearchDirection
    2327       //cout << Verbose(2) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
     2328      //Log() << Verbose(2) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
    23282329      if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {  // rotated the wrong way!
    2329         cerr << "ERROR: SearchDirection and RelativeOldSphereCenter are not orthogonal!" << endl;
     2330        eLog() << Verbose(0) << "ERROR: SearchDirection and RelativeOldSphereCenter are not orthogonal!" << endl;
    23302331      }
    23312332
     
    23342335        for(int i=0;i<NDIM;i++) // store indices of this cell
    23352336        N[i] = LC->n[i];
    2336         //cout << Verbose(2) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
     2337        //Log() << Verbose(2) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
    23372338      } else {
    2338         cerr << "ERROR: Vector " << CircleCenter << " is outside of LinkedCell's bounding box." << endl;
     2339        eLog() << Verbose(0) << "ERROR: Vector " << CircleCenter << " is outside of LinkedCell's bounding box." << endl;
    23392340        return;
    23402341      }
    23412342      // then go through the current and all neighbouring cells and check the contained points for possible candidates
    2342       //cout << Verbose(2) << "LC Intervals:";
     2343      //Log() << Verbose(2) << "LC Intervals:";
    23432344      for (int i=0;i<NDIM;i++) {
    23442345        Nlower[i] = ((N[i]-1) >= 0) ? N[i]-1 : 0;
    23452346        Nupper[i] = ((N[i]+1) < LC->N[i]) ? N[i]+1 : LC->N[i]-1;
    2346         //cout << " [" << Nlower[i] << "," << Nupper[i] << "] ";
     2347        //Log() << Verbose(0) << " [" << Nlower[i] << "," << Nupper[i] << "] ";
    23472348      }
    2348       //cout << endl;
     2349      //Log() << Verbose(0) << endl;
    23492350      for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++)
    23502351        for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++)
    23512352          for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) {
    23522353            const LinkedNodes *List = LC->GetCurrentCell();
    2353             //cout << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;
     2354            //Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;
    23542355            if (List != NULL) {
    23552356              for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
     
    23572358
    23582359                // check for three unique points
    2359                 //cout << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " at " << Candidate->node << "." << endl;
     2360                //Log() << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " at " << Candidate->node << "." << endl;
    23602361                if ((Candidate != BaseLine->endpoints[0]->node) && (Candidate != BaseLine->endpoints[1]->node) ){
    23612362
     
    23682369                  ) {
    23692370                    helper.CopyVector(&NewNormalVector);
    2370                     //cout << Verbose(2) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl;
     2371                    //Log() << Verbose(2) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl;
    23712372                    radius = BaseLine->endpoints[0]->node->node->DistanceSquared(&NewSphereCenter);
    23722373                    if (radius < RADIUS*RADIUS) {
    23732374                      helper.Scale(sqrt(RADIUS*RADIUS - radius));
    2374                       //cout << Verbose(2) << "INFO: Distance of NewCircleCenter to NewSphereCenter is " << helper.Norm() << " with sphere radius " << RADIUS << "." << endl;
     2375                      //Log() << Verbose(2) << "INFO: Distance of NewCircleCenter to NewSphereCenter is " << helper.Norm() << " with sphere radius " << RADIUS << "." << endl;
    23752376                      NewSphereCenter.AddVector(&helper);
    23762377                      NewSphereCenter.SubtractVector(&CircleCenter);
    2377                       //cout << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl;
     2378                      //Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl;
    23782379
    23792380                      // OtherNewSphereCenter is created by the same vector just in the other direction
     
    23812382                      OtherNewSphereCenter.AddVector(&helper);
    23822383                      OtherNewSphereCenter.SubtractVector(&CircleCenter);
    2383                       //cout << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl;
     2384                      //Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl;
    23842385
    23852386                      alpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, NewSphereCenter, OldSphereCenter, NormalVector, SearchDirection);
     
    24002401                        if ((*ShortestAngle - HULLEPSILON) < alpha) {
    24012402                          candidates->push_back(optCandidate);
    2402                           cout << Verbose(2) << "ACCEPT: We have found an equally good candidate: " << *(optCandidate->point) << " with "
     2403                          Log() << Verbose(2) << "ACCEPT: We have found an equally good candidate: " << *(optCandidate->point) << " with "
    24032404                            << alpha << " and circumsphere's center at " << optCandidate->OptCenter << "." << endl;
    24042405                        } else {
     
    24112412                          candidates->clear();
    24122413                          candidates->push_back(optCandidate);
    2413                           cout << Verbose(2) << "ACCEPT: We have found a better candidate: " << *(optCandidate->point) << " with "
     2414                          Log() << Verbose(2) << "ACCEPT: We have found a better candidate: " << *(optCandidate->point) << " with "
    24142415                            << alpha << " and circumsphere's center at " << optCandidate->OptCenter << "." << endl;
    24152416                        }
    24162417                        *ShortestAngle = alpha;
    2417                         //cout << Verbose(2) << "INFO: There are " << candidates->size() << " candidates in the list now." << endl;
     2418                        //Log() << Verbose(2) << "INFO: There are " << candidates->size() << " candidates in the list now." << endl;
    24182419                      } else {
    24192420                        if ((optCandidate != NULL) && (optCandidate->point != NULL)) {
    2420                           //cout << Verbose(2) << "REJECT: Old candidate " << *(optCandidate->point) << " with " << *ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl;
     2421                          //Log() << Verbose(2) << "REJECT: Old candidate " << *(optCandidate->point) << " with " << *ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl;
    24212422                        } else {
    2422                           //cout << Verbose(2) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl;
     2423                          //Log() << Verbose(2) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl;
    24232424                        }
    24242425                      }
    24252426
    24262427                    } else {
    2427                       //cout << Verbose(2) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl;
     2428                      //Log() << Verbose(2) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl;
    24282429                    }
    24292430                  } else {
    2430                     //cout << Verbose(2) << "REJECT: Three points from " << *BaseLine << " and Candidate " << *Candidate << " are linear-dependent." << endl;
     2431                    //Log() << Verbose(2) << "REJECT: Three points from " << *BaseLine << " and Candidate " << *Candidate << " are linear-dependent." << endl;
    24312432                  }
    24322433                } else {
    24332434                  if (ThirdNode != NULL) {
    2434                     //cout << Verbose(2) << "REJECT: Base triangle " << *BaseLine << " and " << *ThirdNode << " contains Candidate " << *Candidate << "." << endl;
     2435                    //Log() << Verbose(2) << "REJECT: Base triangle " << *BaseLine << " and " << *ThirdNode << " contains Candidate " << *Candidate << "." << endl;
    24352436                  } else {
    2436                     //cout << Verbose(2) << "REJECT: Base triangle " << *BaseLine << " contains Candidate " << *Candidate << "." << endl;
     2437                    //Log() << Verbose(2) << "REJECT: Base triangle " << *BaseLine << " contains Candidate " << *Candidate << "." << endl;
    24372438                  }
    24382439                }
     
    24412442          }
    24422443    } else {
    2443       cerr << Verbose(2) << "ERROR: The projected center of the old sphere has radius " << radius << " instead of " << CircleRadius << "." << endl;
     2444      eLog() << Verbose(2) << "ERROR: The projected center of the old sphere has radius " << radius << " instead of " << CircleRadius << "." << endl;
    24442445    }
    24452446  } else {
    24462447    if (ThirdNode != NULL)
    2447       cout << Verbose(2) << "Circumcircle for base line " << *BaseLine << " and third node " << *ThirdNode << " is too big!" << endl;
     2448      Log() << Verbose(2) << "Circumcircle for base line " << *BaseLine << " and third node " << *ThirdNode << " is too big!" << endl;
    24482449    else
    2449       cout << Verbose(2) << "Circumcircle for base line " << *BaseLine << " is too big!" << endl;
    2450   }
    2451 
    2452   //cout << Verbose(2) << "INFO: Sorting candidate list ..." << endl;
     2450      Log() << Verbose(2) << "Circumcircle for base line " << *BaseLine << " is too big!" << endl;
     2451  }
     2452
     2453  //Log() << Verbose(2) << "INFO: Sorting candidate list ..." << endl;
    24532454  if (candidates->size() > 1) {
    24542455    candidates->unique();
     
    24562457  }
    24572458
    2458   cout << Verbose(1) << "End of FindThirdPointForTesselation" << endl;
     2459  Log() << Verbose(1) << "End of FindThirdPointForTesselation" << endl;
    24592460};
    24602461
     
    24792480          { // if insertion fails, we have common endpoint
    24802481            node = OrderTest.first->second;
    2481             cout << Verbose(5) << "Common endpoint of lines " << *line1
     2482            Log() << Verbose(5) << "Common endpoint of lines " << *line1
    24822483                << " and " << *line2 << " is: " << *node << "." << endl;
    24832484            j = 2;
     
    24942495 * \return list of BoundaryTriangleSet of nearest triangles or NULL in degenerate case.
    24952496 */
    2496 list<BoundaryTriangleSet*> * Tesselation::FindClosestTrianglesToPoint(ofstream *out, const Vector *x, const LinkedCell* LC) const
     2497list<BoundaryTriangleSet*> * Tesselation::FindClosestTrianglesToPoint(const Vector *x, const LinkedCell* LC) const
    24972498{
    24982499  TesselPoint *trianglePoints[3];
     
    25012502
    25022503  if (LinesOnBoundary.empty()) {
    2503     *out << Verbose(0) << "Error: There is no tesselation structure to compare the point with, please create one first.";
     2504    Log() << Verbose(0) << "Error: There is no tesselation structure to compare the point with, please create one first.";
    25042505    return NULL;
    25052506  }
    2506   *out << Verbose(1) << "Finding closest Tesselpoint to " << *x << " ... " << endl;
     2507  Log() << Verbose(1) << "Finding closest Tesselpoint to " << *x << " ... " << endl;
    25072508  trianglePoints[0] = FindClosestPoint(x, SecondPoint, LC);
    25082509 
    25092510  // check whether closest point is "too close" :), then it's inside
    25102511  if (trianglePoints[0] == NULL) {
    2511     *out << Verbose(2) << "Is the only point, no one else is closeby." << endl;
     2512    Log() << Verbose(2) << "Is the only point, no one else is closeby." << endl;
    25122513    return NULL;
    25132514  }
    25142515  if (trianglePoints[0]->node->DistanceSquared(x) < MYEPSILON) {
    2515     *out << Verbose(3) << "Point is right on a tesselation point, no nearest triangle." << endl;
     2516    Log() << Verbose(3) << "Point is right on a tesselation point, no nearest triangle." << endl;
    25162517    PointMap::const_iterator PointRunner = PointsOnBoundary.find(trianglePoints[0]->nr);
    25172518    triangles = new list<BoundaryTriangleSet*>;
     
    25322533        triangles->unique();
    25332534      } else {
    2534         *out << Verbose(1) << "ERROR: I cannot find a boundary point to the tessel point " << *trianglePoints[0] << "." << endl;
     2535        Log() << Verbose(1) << "ERROR: I cannot find a boundary point to the tessel point " << *trianglePoints[0] << "." << endl;
    25352536        return NULL;
    25362537      }
    25372538    }
    25382539  } else {
    2539     list<TesselPoint*> *connectedClosestPoints = GetCircleOfConnectedPoints(out, trianglePoints[0], x);
     2540    list<TesselPoint*> *connectedClosestPoints = GetCircleOfConnectedPoints(trianglePoints[0], x);
    25402541    if (connectedClosestPoints != NULL) {
    25412542      trianglePoints[1] = connectedClosestPoints->front();
     
    25432544      for (int i=0;i<3;i++) {
    25442545        if (trianglePoints[i] == NULL) {
    2545           *out << Verbose(1) << "ERROR: IsInnerPoint encounters serious error, point " << i << " not found." << endl;
     2546          Log() << Verbose(1) << "ERROR: IsInnerPoint encounters serious error, point " << i << " not found." << endl;
    25462547        }
    2547         //*out << Verbose(2) << "List of triangle points:" << endl;
    2548         //*out << Verbose(3) << *trianglePoints[i] << endl;
     2548        //Log() << Verbose(2) << "List of triangle points:" << endl;
     2549        //Log() << Verbose(3) << *trianglePoints[i] << endl;
    25492550      }
    25502551
    25512552      triangles = FindTriangles(trianglePoints);
    2552       *out << Verbose(2) << "List of possible triangles:" << endl;
     2553      Log() << Verbose(2) << "List of possible triangles:" << endl;
    25532554      for(list<BoundaryTriangleSet*>::iterator Runner = triangles->begin(); Runner != triangles->end(); Runner++)
    2554         *out << Verbose(3) << **Runner << endl;
     2555        Log() << Verbose(3) << **Runner << endl;
    25552556
    25562557      delete(connectedClosestPoints);
    25572558    } else {
    25582559      triangles = NULL;
    2559       *out << Verbose(1) << "There is no circle of connected points!" << endl;
     2560      Log() << Verbose(1) << "There is no circle of connected points!" << endl;
    25602561    }
    25612562  }
    25622563 
    25632564  if ((triangles == NULL) || (triangles->empty())) {
    2564     *out << Verbose(0) << "ERROR: There is no nearest triangle. Please check the tesselation structure.";
     2565    Log() << Verbose(0) << "ERROR: There is no nearest triangle. Please check the tesselation structure.";
    25652566    delete(triangles);
    25662567    return NULL;
     
    25752576 * \return list of BoundaryTriangleSet of nearest triangles or NULL.
    25762577 */
    2577 class BoundaryTriangleSet * Tesselation::FindClosestTriangleToPoint(ofstream *out, const Vector *x, const LinkedCell* LC) const
     2578class BoundaryTriangleSet * Tesselation::FindClosestTriangleToPoint(const Vector *x, const LinkedCell* LC) const
    25782579{
    25792580  class BoundaryTriangleSet *result = NULL;
    2580   list<BoundaryTriangleSet*> *triangles = FindClosestTrianglesToPoint(out, x, LC);
     2581  list<BoundaryTriangleSet*> *triangles = FindClosestTrianglesToPoint(x, LC);
    25812582  Vector Center;
    25822583
     
    25862587  if (triangles->size() == 1) { // there is no degenerate case
    25872588    result = triangles->front();
    2588     *out << Verbose(2) << "Normal Vector of this triangle is " << result->NormalVector << "." << endl;
     2589    Log() << Verbose(2) << "Normal Vector of this triangle is " << result->NormalVector << "." << endl;
    25892590  } else {
    25902591    result = triangles->front();
    25912592    result->GetCenter(&Center);
    25922593    Center.SubtractVector(x);
    2593     *out << Verbose(2) << "Normal Vector of this front side is " << result->NormalVector << "." << endl;
     2594    Log() << Verbose(2) << "Normal Vector of this front side is " << result->NormalVector << "." << endl;
    25942595    if (Center.ScalarProduct(&result->NormalVector) < 0) {
    25952596      result = triangles->back();
    2596       *out << Verbose(2) << "Normal Vector of this back side is " << result->NormalVector << "." << endl;
     2597      Log() << Verbose(2) << "Normal Vector of this back side is " << result->NormalVector << "." << endl;
    25972598      if (Center.ScalarProduct(&result->NormalVector) < 0) {
    2598         *out << Verbose(1) << "ERROR: Front and back side yield NormalVector in wrong direction!" << endl;
     2599        Log() << Verbose(1) << "ERROR: Front and back side yield NormalVector in wrong direction!" << endl;
    25992600      }
    26002601    }
     
    26112612 * @return true if the point is inside the tesselation structure, false otherwise
    26122613 */
    2613 bool Tesselation::IsInnerPoint(ofstream *out, const Vector &Point, const LinkedCell* const LC) const
    2614 {
    2615   class BoundaryTriangleSet *result = FindClosestTriangleToPoint(out, &Point, LC);
     2614bool Tesselation::IsInnerPoint(const Vector &Point, const LinkedCell* const LC) const
     2615{
     2616  class BoundaryTriangleSet *result = FindClosestTriangleToPoint(&Point, LC);
    26162617  Vector Center;
    26172618
    26182619  if (result == NULL) {// is boundary point or only point in point cloud?
    2619     *out << Verbose(1) << Point << " is the only point in vicinity." << endl;
     2620    Log() << Verbose(1) << Point << " is the only point in vicinity." << endl;
    26202621    return false;
    26212622  }
    26222623
    26232624  result->GetCenter(&Center);
    2624   *out << Verbose(3) << "INFO: Central point of the triangle is " << Center << "." << endl;
     2625  Log() << Verbose(3) << "INFO: Central point of the triangle is " << Center << "." << endl;
    26252626  Center.SubtractVector(&Point);
    2626   *out << Verbose(3) << "INFO: Vector from center to point to test is " << Center << "." << endl;
     2627  Log() << Verbose(3) << "INFO: Vector from center to point to test is " << Center << "." << endl;
    26272628  if (Center.ScalarProduct(&result->NormalVector) > -MYEPSILON) {
    2628     *out << Verbose(1) << Point << " is an inner point." << endl;
     2629    Log() << Verbose(1) << Point << " is an inner point." << endl;
    26292630    return true;
    26302631  } else {
    2631     *out << Verbose(1) << Point << " is NOT an inner point." << endl;
     2632    Log() << Verbose(1) << Point << " is NOT an inner point." << endl;
    26322633    return false;
    26332634  }
     
    26412642 * @return true if the point is inside the tesselation structure, false otherwise
    26422643 */
    2643 bool Tesselation::IsInnerPoint(ofstream *out, const TesselPoint * const Point, const LinkedCell* const LC) const
    2644 {
    2645   return IsInnerPoint(out, *(Point->node), LC);
     2644bool Tesselation::IsInnerPoint(const TesselPoint * const Point, const LinkedCell* const LC) const
     2645{
     2646  return IsInnerPoint(*(Point->node), LC);
    26462647}
    26472648
     
    26522653 * @return set of the all points linked to the provided one
    26532654 */
    2654 set<TesselPoint*> * Tesselation::GetAllConnectedPoints(ofstream *out, const TesselPoint* const Point) const
     2655set<TesselPoint*> * Tesselation::GetAllConnectedPoints(const TesselPoint* const Point) const
    26552656{
    26562657  set<TesselPoint*> *connectedPoints = new set<TesselPoint*>;
     
    26592660  bool takePoint = false;
    26602661
    2661   *out << Verbose(3) << "Begin of GetAllConnectedPoints" << endl;
     2662  Log() << Verbose(3) << "Begin of GetAllConnectedPoints" << endl;
    26622663
    26632664  // find the respective boundary point
     
    26662667    ReferencePoint = PointRunner->second;
    26672668  } else {
    2668     *out << Verbose(2) << "GetAllConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl;
     2669    Log() << Verbose(2) << "GetAllConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl;
    26692670    ReferencePoint = NULL;
    26702671  }
     
    26902691
    26912692   if (takePoint) {
    2692      *out << Verbose(5) << "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted." << endl;
     2693     Log() << Verbose(5) << "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted." << endl;
    26932694     connectedPoints->insert(current);
    26942695   }
     
    26982699
    26992700  if (connectedPoints->size() == 0) { // if have not found any points
    2700     *out << Verbose(1) << "ERROR: We have not found any connected points to " << *Point<< "." << endl;
     2701    Log() << Verbose(1) << "ERROR: We have not found any connected points to " << *Point<< "." << endl;
    27012702    return NULL;
    27022703  }
    27032704
    2704   *out << Verbose(3) << "End of GetAllConnectedPoints" << endl;
     2705  Log() << Verbose(3) << "End of GetAllConnectedPoints" << endl;
    27052706  return connectedPoints;
    27062707};
     
    27182719 * @return list of the all points linked to the provided one
    27192720 */
    2720 list<TesselPoint*> * Tesselation::GetCircleOfConnectedPoints(ofstream *out, const TesselPoint* const Point, const Vector * const Reference) const
     2721list<TesselPoint*> * Tesselation::GetCircleOfConnectedPoints(const TesselPoint* const Point, const Vector * const Reference) const
    27212722{
    27222723  map<double, TesselPoint*> anglesOfPoints;
    2723   set<TesselPoint*> *connectedPoints = GetAllConnectedPoints(out, Point);
     2724  set<TesselPoint*> *connectedPoints = GetAllConnectedPoints(Point);
    27242725  list<TesselPoint*> *connectedCircle = new list<TesselPoint*>;
    27252726  Vector center;
     
    27302731
    27312732  if (connectedPoints == NULL) {
    2732     *out << Verbose(2) << "Could not find any connected points!" << endl;
     2733    Log() << Verbose(2) << "Could not find any connected points!" << endl;
    27332734    delete(connectedCircle);
    27342735    return NULL;
    27352736  }
    2736   *out << Verbose(2) << "Begin of GetCircleOfConnectedPoints" << endl;
     2737  Log() << Verbose(2) << "Begin of GetCircleOfConnectedPoints" << endl;
    27372738
    27382739  // calculate central point
    27392740  for (set<TesselPoint*>::const_iterator TesselRunner = connectedPoints->begin(); TesselRunner != connectedPoints->end(); TesselRunner++)
    27402741    center.AddVector((*TesselRunner)->node);
    2741   //*out << "Summed vectors " << center << "; number of points " << connectedPoints.size()
     2742  //Log() << Verbose(0) << "Summed vectors " << center << "; number of points " << connectedPoints.size()
    27422743  //  << "; scale factor " << 1.0/connectedPoints.size();
    27432744  center.Scale(1.0/connectedPoints->size());
    2744   *out << Verbose(4) << "INFO: Calculated center of all circle points is " << center << "." << endl;
     2745  Log() << Verbose(4) << "INFO: Calculated center of all circle points is " << center << "." << endl;
    27452746
    27462747  // projection plane of the circle is at the closes Point and normal is pointing away from center of all circle points
     
    27482749  PlaneNormal.SubtractVector(&center);
    27492750  PlaneNormal.Normalize();
    2750   *out << Verbose(4) << "INFO: Calculated plane normal of circle is " << PlaneNormal << "." << endl;
     2751  Log() << Verbose(4) << "INFO: Calculated plane normal of circle is " << PlaneNormal << "." << endl;
    27512752
    27522753  // construct one orthogonal vector
     
    27572758  }
    27582759  if ((Reference == NULL) || (AngleZero.NormSquared() < MYEPSILON )) {
    2759     *out << Verbose(4) << "Using alternatively " << *(*connectedPoints->begin())->node << " as angle 0 referencer." << endl;
     2760    Log() << Verbose(4) << "Using alternatively " << *(*connectedPoints->begin())->node << " as angle 0 referencer." << endl;
    27602761    AngleZero.CopyVector((*connectedPoints->begin())->node);
    27612762    AngleZero.SubtractVector(Point->node);
    27622763    AngleZero.ProjectOntoPlane(&PlaneNormal);
    27632764    if (AngleZero.NormSquared() < MYEPSILON) {
    2764       cerr << Verbose(0) << "CRITIAL: AngleZero is 0 even with alternative reference. The algorithm has to be changed here!" << endl;
     2765      eLog() << Verbose(0) << "CRITIAL: AngleZero is 0 even with alternative reference. The algorithm has to be changed here!" << endl;
    27652766      performCriticalExit();
    27662767    }
    27672768  }
    2768   *out << Verbose(4) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl;
     2769  Log() << Verbose(4) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl;
    27692770  if (AngleZero.NormSquared() > MYEPSILON)
    27702771    OrthogonalVector.MakeNormalVector(&PlaneNormal, &AngleZero);
    27712772  else
    27722773    OrthogonalVector.MakeNormalVector(&PlaneNormal);
    2773   *out << Verbose(4) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl;
     2774  Log() << Verbose(4) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl;
    27742775
    27752776  // go through all connected points and calculate angle
     
    27792780    helper.ProjectOntoPlane(&PlaneNormal);
    27802781    double angle = GetAngle(helper, AngleZero, OrthogonalVector);
    2781     *out << Verbose(3) << "INFO: Calculated angle is " << angle << " for point " << **listRunner << "." << endl;
     2782    Log() << Verbose(3) << "INFO: Calculated angle is " << angle << " for point " << **listRunner << "." << endl;
    27822783    anglesOfPoints.insert(pair<double, TesselPoint*>(angle, (*listRunner)));
    27832784  }
     
    27892790  delete(connectedPoints);
    27902791
    2791   *out << Verbose(2) << "End of GetCircleOfConnectedPoints" << endl;
     2792  Log() << Verbose(2) << "End of GetCircleOfConnectedPoints" << endl;
    27922793
    27932794  return connectedCircle;
     
    28002801 * @return list of the all points linked to the provided one
    28012802 */
    2802 list<list<TesselPoint*> *> * Tesselation::GetPathsOfConnectedPoints(ofstream *out, const TesselPoint* const Point) const
     2803list<list<TesselPoint*> *> * Tesselation::GetPathsOfConnectedPoints(const TesselPoint* const Point) const
    28032804{
    28042805  map<double, TesselPoint*> anglesOfPoints;
     
    28212822    ReferencePoint = PointRunner->second;
    28222823  } else {
    2823     *out << Verbose(2) << "ERROR: GetPathOfConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl;
     2824    Log() << Verbose(2) << "ERROR: GetPathOfConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl;
    28242825    return NULL;
    28252826  }
     
    28382839      LineRunner = TouchedLine.find(runner->second);
    28392840      if (LineRunner == TouchedLine.end()) {
    2840         *out << Verbose(2) << "ERROR: I could not find " << *runner->second << " in the touched list." << endl;
     2841        Log() << Verbose(2) << "ERROR: I could not find " << *runner->second << " in the touched list." << endl;
    28412842      } else if (!LineRunner->second) {
    28422843        LineRunner->second = true;
     
    28462847        StartLine = CurrentLine;
    28472848        CurrentPoint = CurrentLine->GetOtherEndpoint(ReferencePoint);
    2848         *out << Verbose(3)<< "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "." << endl;
     2849        Log() << Verbose(3)<< "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "." << endl;
    28492850        do {
    28502851          // push current one
    2851           *out << Verbose(3) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;
     2852          Log() << Verbose(3) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;
    28522853          connectedPath->push_back(CurrentPoint->node);
    28532854
    28542855          // find next triangle
    28552856          for (TriangleMap::iterator Runner = CurrentLine->triangles.begin(); Runner != CurrentLine->triangles.end(); Runner++) {
    2856             *out << Verbose(3) << "INFO: Inspecting triangle " << *Runner->second << "." << endl;
     2857            Log() << Verbose(3) << "INFO: Inspecting triangle " << *Runner->second << "." << endl;
    28572858            if ((Runner->second != triangle)) { // look for first triangle not equal to old one
    28582859              triangle = Runner->second;
     
    28612862                if (!TriangleRunner->second) {
    28622863                  TriangleRunner->second = true;
    2863                   *out << Verbose(3) << "INFO: Connecting triangle is " << *triangle << "." << endl;
     2864                  Log() << Verbose(3) << "INFO: Connecting triangle is " << *triangle << "." << endl;
    28642865                  break;
    28652866                } else {
    2866                   *out << Verbose(3) << "INFO: Skipping " << *triangle << ", as we have already visited it." << endl;
     2867                  Log() << Verbose(3) << "INFO: Skipping " << *triangle << ", as we have already visited it." << endl;
    28672868                  triangle = NULL;
    28682869                }
    28692870              } else {
    2870                 *out << Verbose(2) << "ERROR: I could not find " << *triangle << " in the touched list." << endl;
     2871                Log() << Verbose(2) << "ERROR: I could not find " << *triangle << " in the touched list." << endl;
    28712872                triangle = NULL;
    28722873              }
     
    28792880            if ((triangle->lines[i] != CurrentLine) && (triangle->lines[i]->ContainsBoundaryPoint(ReferencePoint))) { // not the current line and still containing Point
    28802881              CurrentLine = triangle->lines[i];
    2881               *out << Verbose(3) << "INFO: Connecting line is " << *CurrentLine << "." << endl;
     2882              Log() << Verbose(3) << "INFO: Connecting line is " << *CurrentLine << "." << endl;
    28822883              break;
    28832884            }
     
    28852886          LineRunner = TouchedLine.find(CurrentLine);
    28862887          if (LineRunner == TouchedLine.end())
    2887             *out << Verbose(2) << "ERROR: I could not find " << *CurrentLine << " in the touched list." << endl;
     2888            Log() << Verbose(2) << "ERROR: I could not find " << *CurrentLine << " in the touched list." << endl;
    28882889          else
    28892890            LineRunner->second = true;
     
    28932894        } while (CurrentLine != StartLine);
    28942895        // last point is missing, as it's on start line
    2895         *out << Verbose(3) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;
     2896        Log() << Verbose(3) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;
    28962897        if (StartLine->GetOtherEndpoint(ReferencePoint)->node != connectedPath->back())
    28972898          connectedPath->push_back(StartLine->GetOtherEndpoint(ReferencePoint)->node);
     
    28992900        ListOfPaths->push_back(connectedPath);
    29002901      } else {
    2901         *out << Verbose(3) << "INFO: Skipping " << *runner->second << ", as we have already visited it." << endl;
     2902        Log() << Verbose(3) << "INFO: Skipping " << *runner->second << ", as we have already visited it." << endl;
    29022903      }
    29032904    }
    29042905  } else {
    2905     *out << Verbose(1) << "ERROR: There are no lines attached to " << *ReferencePoint << "." << endl;
     2906    Log() << Verbose(1) << "ERROR: There are no lines attached to " << *ReferencePoint << "." << endl;
    29062907  }
    29072908
     
    29152916 * @return list of the closed paths
    29162917 */
    2917 list<list<TesselPoint*> *> * Tesselation::GetClosedPathsOfConnectedPoints(ofstream *out, const TesselPoint* const Point) const
    2918 {
    2919   list<list<TesselPoint*> *> *ListofPaths = GetPathsOfConnectedPoints(out, Point);
     2918list<list<TesselPoint*> *> * Tesselation::GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const
     2919{
     2920  list<list<TesselPoint*> *> *ListofPaths = GetPathsOfConnectedPoints(Point);
    29202921  list<list<TesselPoint*> *> *ListofClosedPaths = new list<list<TesselPoint*> *>;
    29212922  list<TesselPoint*> *connectedPath = NULL;
     
    29302931    connectedPath = *ListRunner;
    29312932
    2932     *out << Verbose(2) << "INFO: Current path is " << connectedPath << "." << endl;
     2933    Log() << Verbose(2) << "INFO: Current path is " << connectedPath << "." << endl;
    29332934
    29342935    // go through list, look for reappearance of starting Point and count
     
    29402941      if ((*CircleRunner == *CircleStart) && (CircleRunner != CircleStart)) { // is not the very first point
    29412942        // we have a closed circle from Marker to new Marker
    2942         *out << Verbose(3) << count+1 << ". closed path consists of: ";
     2943        Log() << Verbose(3) << count+1 << ". closed path consists of: ";
    29432944        newPath = new list<TesselPoint*>;
    29442945        list<TesselPoint*>::iterator CircleSprinter = Marker;
    29452946        for (; CircleSprinter != CircleRunner; CircleSprinter++) {
    29462947          newPath->push_back(*CircleSprinter);
    2947           *out << (**CircleSprinter) << " <-> ";
     2948          Log() << Verbose(0) << (**CircleSprinter) << " <-> ";
    29482949        }
    2949         *out << ".." << endl;
     2950        Log() << Verbose(0) << ".." << endl;
    29502951        count++;
    29512952        Marker = CircleRunner;
     
    29562957    }
    29572958  }
    2958   *out << Verbose(3) << "INFO: " << count << " closed additional path(s) have been created." << endl;
     2959  Log() << Verbose(3) << "INFO: " << count << " closed additional path(s) have been created." << endl;
    29592960
    29602961  // delete list of paths
     
    29762977 * \return pointer to allocated list of triangles
    29772978 */
    2978 set<BoundaryTriangleSet*> *Tesselation::GetAllTriangles(ofstream *out, const BoundaryPointSet * const Point) const
     2979set<BoundaryTriangleSet*> *Tesselation::GetAllTriangles(const BoundaryPointSet * const Point) const
    29792980{
    29802981  set<BoundaryTriangleSet*> *connectedTriangles = new set<BoundaryTriangleSet*>;
    29812982
    29822983  if (Point == NULL) {
    2983     *out << Verbose(1) << "ERROR: Point given is NULL." << endl;
     2984    Log() << Verbose(1) << "ERROR: Point given is NULL." << endl;
    29842985  } else {
    29852986    // go through its lines and insert all triangles
     
    30053006 * \return volume added to the volume inside the tesselated surface by the removal
    30063007 */
    3007 double Tesselation::RemovePointFromTesselatedSurface(ofstream *out, class BoundaryPointSet *point) {
     3008double Tesselation::RemovePointFromTesselatedSurface(class BoundaryPointSet *point) {
    30083009  class BoundaryLineSet *line = NULL;
    30093010  class BoundaryTriangleSet *triangle = NULL;
     
    30133014
    30143015  if (point == NULL) {
    3015     *out << Verbose(1) << "ERROR: Cannot remove the point " << point << ", it's NULL!" << endl;
     3016    Log() << Verbose(1) << "ERROR: Cannot remove the point " << point << ", it's NULL!" << endl;
    30163017    return 0.;
    30173018  } else
    3018     *out << Verbose(2) << "Removing point " << *point << " from tesselated boundary ..." << endl;
     3019    Log() << Verbose(2) << "Removing point " << *point << " from tesselated boundary ..." << endl;
    30193020
    30203021  // copy old location for the volume
     
    30233024  // get list of connected points
    30243025  if (point->lines.empty()) {
    3025     *out << Verbose(1) << "ERROR: Cannot remove the point " << *point << ", it's connected to no lines!" << endl;
     3026    Log() << Verbose(1) << "ERROR: Cannot remove the point " << *point << ", it's connected to no lines!" << endl;
    30263027    return 0.;
    30273028  }
    30283029
    3029   list<list<TesselPoint*> *> *ListOfClosedPaths = GetClosedPathsOfConnectedPoints(out, point->node);
     3030  list<list<TesselPoint*> *> *ListOfClosedPaths = GetClosedPathsOfConnectedPoints(point->node);
    30303031  list<TesselPoint*> *connectedPath = NULL;
    30313032
     
    30463047  NormalVector.Zero();
    30473048  for (map<class BoundaryTriangleSet *, int>::iterator Runner = Candidates.begin(); Runner != Candidates.end(); Runner++) {
    3048     *out << Verbose(3) << "INFO: Removing triangle " << *(Runner->first) << "." << endl;
     3049    Log() << Verbose(3) << "INFO: Removing triangle " << *(Runner->first) << "." << endl;
    30493050    NormalVector.SubtractVector(&Runner->first->NormalVector); // has to point inward
    30503051    RemoveTesselationTriangle(Runner->first);
    30513052    count++;
    30523053  }
    3053   *out << Verbose(1) << count << " triangles were removed." << endl;
     3054  Log() << Verbose(1) << count << " triangles were removed." << endl;
    30543055
    30553056  list<list<TesselPoint*> *>::iterator ListAdvance = ListOfClosedPaths->begin();
     
    30763077        smallestangle = 0.;
    30773078        for (MiddleNode = connectedPath->begin(); MiddleNode != connectedPath->end(); MiddleNode++) {
    3078           cout << Verbose(3) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;
     3079          Log() << Verbose(3) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;
    30793080          // construct vectors to next and previous neighbour
    30803081          StartNode = MiddleNode;
     
    30823083            StartNode = connectedPath->end();
    30833084          StartNode--;
    3084           //cout << Verbose(3) << "INFO: StartNode is " << **StartNode << "." << endl;
     3085          //Log() << Verbose(3) << "INFO: StartNode is " << **StartNode << "." << endl;
    30853086          Point.CopyVector((*StartNode)->node);
    30863087          Point.SubtractVector((*MiddleNode)->node);
     
    30893090          if (StartNode == connectedPath->end())
    30903091            StartNode = connectedPath->begin();
    3091           //cout << Verbose(3) << "INFO: EndNode is " << **StartNode << "." << endl;
     3092          //Log() << Verbose(3) << "INFO: EndNode is " << **StartNode << "." << endl;
    30923093          Reference.CopyVector((*StartNode)->node);
    30933094          Reference.SubtractVector((*MiddleNode)->node);
     
    31043105        MiddleNode = EndNode;
    31053106        if (MiddleNode == connectedPath->end()) {
    3106           cout << Verbose(1) << "CRITICAL: Could not find a smallest angle!" << endl;
     3107          Log() << Verbose(1) << "CRITICAL: Could not find a smallest angle!" << endl;
    31073108          exit(255);
    31083109        }
     
    31143115        if (EndNode == connectedPath->end())
    31153116          EndNode = connectedPath->begin();
    3116         cout << Verbose(4) << "INFO: StartNode is " << **StartNode << "." << endl;
    3117         cout << Verbose(4) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;
    3118         cout << Verbose(4) << "INFO: EndNode is " << **EndNode << "." << endl;
    3119         *out << Verbose(3) << "INFO: Attempting to create triangle " << (*StartNode)->Name << ", " << (*MiddleNode)->Name << " and " << (*EndNode)->Name << "." << endl;
     3117        Log() << Verbose(4) << "INFO: StartNode is " << **StartNode << "." << endl;
     3118        Log() << Verbose(4) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;
     3119        Log() << Verbose(4) << "INFO: EndNode is " << **EndNode << "." << endl;
     3120        Log() << Verbose(3) << "INFO: Attempting to create triangle " << (*StartNode)->Name << ", " << (*MiddleNode)->Name << " and " << (*EndNode)->Name << "." << endl;
    31203121        TriangleCandidates[0] = *StartNode;
    31213122        TriangleCandidates[1] = *MiddleNode;
    31223123        TriangleCandidates[2] = *EndNode;
    3123         triangle = GetPresentTriangle(out, TriangleCandidates);
     3124        triangle = GetPresentTriangle(TriangleCandidates);
    31243125        if (triangle != NULL) {
    3125           cout << Verbose(1) << "WARNING: New triangle already present, skipping!" << endl;
     3126          Log() << Verbose(1) << "WARNING: New triangle already present, skipping!" << endl;
    31263127          StartNode++;
    31273128          MiddleNode++;
     
    31353136          continue;
    31363137        }
    3137         *out << Verbose(5) << "Adding new triangle points."<< endl;
     3138        Log() << Verbose(5) << "Adding new triangle points."<< endl;
    31383139        AddTesselationPoint(*StartNode, 0);
    31393140        AddTesselationPoint(*MiddleNode, 1);
    31403141        AddTesselationPoint(*EndNode, 2);
    3141         *out << Verbose(5) << "Adding new triangle lines."<< endl;
     3142        Log() << Verbose(5) << "Adding new triangle lines."<< endl;
    31423143        AddTesselationLine(TPS[0], TPS[1], 0);
    31433144        AddTesselationLine(TPS[0], TPS[2], 1);
     
    31543155        // prepare nodes for next triangle
    31553156        StartNode = EndNode;
    3156         cout << Verbose(4) << "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "." << endl;
     3157        Log() << Verbose(4) << "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "." << endl;
    31573158        connectedPath->remove(*MiddleNode); // remove the middle node (it is surrounded by triangles)
    31583159        if (connectedPath->size() == 2) { // we are done
     
    31613162          break;
    31623163        } else if (connectedPath->size() < 2) { // something's gone wrong!
    3163           cout << Verbose(1) << "CRITICAL: There are only two endpoints left!" << endl;
     3164          Log() << Verbose(1) << "CRITICAL: There are only two endpoints left!" << endl;
    31643165          exit(255);
    31653166        } else {
     
    31823183          maxgain = 0;
    31833184          for(list<class BoundaryLineSet *>::iterator Runner = NewLines.begin(); Runner != NewLines.end(); Runner++) {
    3184             tmp = PickFarthestofTwoBaselines(out, *Runner);
     3185            tmp = PickFarthestofTwoBaselines(*Runner);
    31853186            if (maxgain < tmp) {
    31863187              maxgain = tmp;
     
    31903191          if (maxgain != 0) {
    31913192            volume += maxgain;
    3192             cout << Verbose(3) << "Flipping baseline with highest volume" << **Candidate << "." << endl;
    3193             OtherBase = FlipBaseline(out, *Candidate);
     3193            Log() << Verbose(3) << "Flipping baseline with highest volume" << **Candidate << "." << endl;
     3194            OtherBase = FlipBaseline(*Candidate);
    31943195            NewLines.erase(Candidate);
    31953196            NewLines.push_back(OtherBase);
     
    32013202      delete(connectedPath);
    32023203    }
    3203     *out << Verbose(1) << count << " triangles were created." << endl;
     3204    Log() << Verbose(1) << count << " triangles were created." << endl;
    32043205  } else {
    32053206    while (!ListOfClosedPaths->empty()) {
     
    32093210      delete(connectedPath);
    32103211    }
    3211     *out << Verbose(1) << "No need to create any triangles." << endl;
     3212    Log() << Verbose(1) << "No need to create any triangles." << endl;
    32123213  }
    32133214  delete(ListOfClosedPaths);
    32143215
    3215   *out << Verbose(1) << "Removed volume is " << volume << "." << endl;
     3216  Log() << Verbose(1) << "Removed volume is " << volume << "." << endl;
    32163217
    32173218  return volume;
     
    32833284  // sanity check
    32843285  if (LinesOnBoundary.empty()) {
    3285     cout << Verbose(1) << "Warning: FindAllDegeneratedTriangles() was called without any tesselation structure.";
     3286    Log() << Verbose(1) << "Warning: FindAllDegeneratedTriangles() was called without any tesselation structure.";
    32863287    return DegeneratedLines;
    32873288  }
     
    32993300  AllLines.clear();
    33003301
    3301   cout << Verbose(1) << "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines." << endl;
     3302  Log() << Verbose(1) << "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines." << endl;
    33023303  map<int,int>::iterator it;
    33033304  for (it = DegeneratedLines->begin(); it != DegeneratedLines->end(); it++)
    3304       cout << Verbose(2) << (*it).first << " => " << (*it).second << endl;
     3305      Log() << Verbose(2) << (*it).first << " => " << (*it).second << endl;
    33053306
    33063307  return DegeneratedLines;
     
    33423343  delete(DegeneratedLines);
    33433344
    3344   cout << Verbose(1) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl;
     3345  Log() << Verbose(1) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl;
    33453346  map<int,int>::iterator it;
    33463347  for (it = DegeneratedTriangles->begin(); it != DegeneratedTriangles->end(); it++)
    3347       cout << Verbose(2) << (*it).first << " => " << (*it).second << endl;
     3348      Log() << Verbose(2) << (*it).first << " => " << (*it).second << endl;
    33483349
    33493350  return DegeneratedTriangles;
     
    33613362  int count  = 0;
    33623363
    3363   cout << Verbose(1) << "Begin of RemoveDegeneratedTriangles" << endl;
     3364  Log() << Verbose(1) << "Begin of RemoveDegeneratedTriangles" << endl;
    33643365
    33653366  for (map<int, int>::iterator TriangleKeyRunner = DegeneratedTriangles->begin();
     
    34203421      // erase the pair
    34213422      count += (int) DegeneratedTriangles->erase(triangle->Nr);
    3422       cout << Verbose(1) << "RemoveDegeneratedTriangles() removes triangle " << *triangle << "." << endl;
     3423      Log() << Verbose(1) << "RemoveDegeneratedTriangles() removes triangle " << *triangle << "." << endl;
    34233424      RemoveTesselationTriangle(triangle);
    34243425      count += (int) DegeneratedTriangles->erase(partnerTriangle->Nr);
    3425       cout << Verbose(1) << "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "." << endl;
     3426      Log() << Verbose(1) << "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "." << endl;
    34263427      RemoveTesselationTriangle(partnerTriangle);
    34273428    } else {
    3428       cout << Verbose(1) << "RemoveDegeneratedTriangles() does not remove triangle " << *triangle
     3429      Log() << Verbose(1) << "RemoveDegeneratedTriangles() does not remove triangle " << *triangle
    34293430        << " and its partner " << *partnerTriangle << " because it is essential for at"
    34303431        << " least one of the endpoints to be kept in the tesselation structure." << endl;
     
    34333434  delete(DegeneratedTriangles);
    34343435
    3435   cout << Verbose(1) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl;
    3436   cout << Verbose(1) << "End of RemoveDegeneratedTriangles" << endl;
     3436  Log() << Verbose(1) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl;
     3437  Log() << Verbose(1) << "End of RemoveDegeneratedTriangles" << endl;
    34373438}
    34383439
     
    34453446 * \param *LC Linked Cell structure to find nearest point
    34463447 */
    3447 void Tesselation::AddBoundaryPointByDegeneratedTriangle(ofstream *out, class TesselPoint *point, LinkedCell *LC)
    3448 {
    3449   *out << Verbose(2) << "Begin of AddBoundaryPointByDegeneratedTriangle" << endl;
     3448void Tesselation::AddBoundaryPointByDegeneratedTriangle(class TesselPoint *point, LinkedCell *LC)
     3449{
     3450  Log() << Verbose(2) << "Begin of AddBoundaryPointByDegeneratedTriangle" << endl;
    34503451
    34513452  // find nearest boundary point
     
    34613462    NearestBoundaryPoint = PointRunner->second;
    34623463  } else {
    3463     *out << Verbose(1) << "ERROR: I cannot find the boundary point." << endl;
     3464    Log() << Verbose(1) << "ERROR: I cannot find the boundary point." << endl;
    34643465    return;
    34653466  }
    3466   *out << Verbose(2) << "Nearest point on boundary is " << NearestPoint->Name << "." << endl;
     3467  Log() << Verbose(2) << "Nearest point on boundary is " << NearestPoint->Name << "." << endl;
    34673468
    34683469  // go through its lines and find the best one to split
     
    34973498
    34983499  // create new triangle to connect point (connects automatically with the missing spot of the chosen line)
    3499   *out << Verbose(5) << "Adding new triangle points."<< endl;
     3500  Log() << Verbose(5) << "Adding new triangle points."<< endl;
    35003501  AddTesselationPoint((BestLine->endpoints[0]->node), 0);
    35013502  AddTesselationPoint((BestLine->endpoints[1]->node), 1);
    35023503  AddTesselationPoint(point, 2);
    3503   *out << Verbose(5) << "Adding new triangle lines."<< endl;
     3504  Log() << Verbose(5) << "Adding new triangle lines."<< endl;
    35043505  AddTesselationLine(TPS[0], TPS[1], 0);
    35053506  AddTesselationLine(TPS[0], TPS[2], 1);
     
    35083509  BTS->GetNormalVector(TempTriangle->NormalVector);
    35093510  BTS->NormalVector.Scale(-1.);
    3510   *out << Verbose(3) << "INFO: NormalVector of new triangle is " << BTS->NormalVector << "." << endl;
     3511  Log() << Verbose(3) << "INFO: NormalVector of new triangle is " << BTS->NormalVector << "." << endl;
    35113512  AddTesselationTriangle();
    35123513
    35133514  // create other side of this triangle and close both new sides of the first created triangle
    3514   *out << Verbose(5) << "Adding new triangle points."<< endl;
     3515  Log() << Verbose(5) << "Adding new triangle points."<< endl;
    35153516  AddTesselationPoint((BestLine->endpoints[0]->node), 0);
    35163517  AddTesselationPoint((BestLine->endpoints[1]->node), 1);
    35173518  AddTesselationPoint(point, 2);
    3518   *out << Verbose(5) << "Adding new triangle lines."<< endl;
     3519  Log() << Verbose(5) << "Adding new triangle lines."<< endl;
    35193520  AddTesselationLine(TPS[0], TPS[1], 0);
    35203521  AddTesselationLine(TPS[0], TPS[2], 1);
     
    35223523  BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
    35233524  BTS->GetNormalVector(TempTriangle->NormalVector);
    3524   *out << Verbose(3) << "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "." << endl;
     3525  Log() << Verbose(3) << "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "." << endl;
    35253526  AddTesselationTriangle();
    35263527
     
    35293530    if ((BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[0])) && (BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[1]))) {
    35303531      if (BestLine == BTS->lines[i]){
    3531         *out << Verbose(1) << "CRITICAL: BestLine is same as found line, something's wrong here!" << endl;
     3532        Log() << Verbose(1) << "CRITICAL: BestLine is same as found line, something's wrong here!" << endl;
    35323533        exit(255);
    35333534      }
     
    35393540
    35403541  // exit
    3541   *out << Verbose(2) << "End of AddBoundaryPointByDegeneratedTriangle" << endl;
     3542  Log() << Verbose(2) << "End of AddBoundaryPointByDegeneratedTriangle" << endl;
    35423543};
    35433544
     
    35473548 * \param *cloud PointCloud structure with all nodes
    35483549 */
    3549 void Tesselation::Output(ofstream *out, const char *filename, const PointCloud * const cloud)
     3550void Tesselation::Output(const char *filename, const PointCloud * const cloud)
    35503551{
    35513552  ofstream *tempstream = NULL;
     
    35613562      NameofTempFile.erase(npos, 1);
    35623563      NameofTempFile.append(TecplotSuffix);
    3563       *out << Verbose(1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";
     3564      Log() << Verbose(1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";
    35643565      tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc);
    3565       WriteTecplotFile(out, tempstream, this, cloud, TriangleFilesWritten);
     3566      WriteTecplotFile(tempstream, this, cloud, TriangleFilesWritten);
    35663567      tempstream->close();
    35673568      tempstream->flush();
     
    35753576      NameofTempFile.erase(npos, 1);
    35763577      NameofTempFile.append(Raster3DSuffix);
    3577       *out << Verbose(1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";
     3578      Log() << Verbose(1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";
    35783579      tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc);
    3579       WriteRaster3dFile(out, tempstream, this, cloud);
    3580       IncludeSphereinRaster3D(out, tempstream, this, cloud);
     3580      WriteRaster3dFile(tempstream, this, cloud);
     3581      IncludeSphereinRaster3D(tempstream, this, cloud);
    35813582      tempstream->close();
    35823583      tempstream->flush();
Note: See TracChangeset for help on using the changeset viewer.