Changes in / [8927ae:1ca488]


Ignore:
Files:
7 added
48 edited

Legend:

Unmodified
Added
Removed
  • src/Makefile.am

    r8927ae r1ca488  
    1717UIHEADER = ${ACTIONSHEADER} ${VIEWHEADER} ${MENUHEADER} UIElements/UIFactory.hpp UIElements/TextUIFactory.hpp UIElements/MainWindow.hpp UIElements/TextWindow.hpp UIElements/Dialog.hpp UIElements/TextDialog.hpp
    1818
    19 SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} ${UISOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp leastsquaremin.cpp linkedcell.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp menu.cpp
    20 HEADER = ${ANALYSISHEADER} ${ATOMHEADER} ${UIHEADER} bond.hpp bondgraph.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp errorlogger.hpp graph.hpp helpers.hpp leastsquaremin.hpp linkedcell.hpp lists.hpp log.hpp logger.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp menu.hpp
     19SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} ${UISOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp info.cpp leastsquaremin.cpp linkedcell.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp menu.cpp
     20HEADER = ${ANALYSISHEADER} ${ATOMHEADER} ${UIHEADER} bond.hpp bondgraph.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp errorlogger.hpp graph.hpp helpers.hpp info.hpp leastsquaremin.hpp linkedcell.hpp lists.hpp log.hpp logger.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp menu.hpp
    2121
    2222BOOST_LIB = $(BOOST_LDFLAGS) $(BOOST_MPL_LIB)
     
    3838#EXTRA_DIST = ${molecuilder_DATA}
    3939
     40FORCE:
     41$(srcdir)/.git-version: FORCE
     42        @if (test -d $(top_srcdir)/../.git && cd $(srcdir) && git describe HEAD) > .git-version-t 2>/dev/null \
     43          && ! diff .git-version-t $(srcdir)/.git-version >/dev/null 2>&1; then \
     44          mv -f .git-version-t $(srcdir)/.git-version; \
     45        else \
     46          rm -f .git-version-t; \
     47        fi
     48
     49EXTRA_DIST = $(srcdir)/.git-version
     50
     51$(srcdir)/version.c: $(srcdir)/.git-version
     52        echo "const char *ESPACKVersion = \"$(PACKAGE_NAME) -- git version: "`cat $(srcdir)/.git-version`"\";" > $@
     53
     54molecuilder_SOURCES += $(srcdir)/version.c
  • src/atom_bondedparticle.cpp

    r8927ae r1ca488  
    121121  bond *CandidateBond = NULL;
    122122
     123  NoBonds = CountBonds();
    123124  //Log() << Verbose(3) << "Walker " << *this << ": " << (int)this->type->NoValenceOrbitals << " > " << NoBonds << "?" << endl;
    124   NoBonds = CountBonds();
    125125  if ((int)(type->NoValenceOrbitals) > NoBonds) { // we have a mismatch, check all bonding partners for mismatch
    126126    for (BondList::const_iterator Runner = ListOfBonds.begin(); Runner != ListOfBonds.end(); (++Runner)) {
    127127      OtherWalker = (*Runner)->GetOtherAtom(this);
    128128      OtherNoBonds = OtherWalker->CountBonds();
    129       //Log() << Verbose(3) << "OtherWalker " << *OtherWalker << ": " << (int)OtherWalker->type->NoValenceOrbitals << " > " << NoBonds << "?" << endl;
    130       if ((int)(OtherWalker->type->NoValenceOrbitals) > NoBonds) { // check if possible candidate
     129      //Log() << Verbose(3) << "OtherWalker " << *OtherWalker << ": " << (int)OtherWalker->type->NoValenceOrbitals << " > " << OtherNoBonds << "?" << endl;
     130      if ((int)(OtherWalker->type->NoValenceOrbitals) > OtherNoBonds) { // check if possible candidate
    131131        if ((CandidateBond == NULL) || (ListOfBonds.size() > OtherWalker->ListOfBonds.size())) { // pick the one with fewer number of bonds first
    132132          CandidateBond = (*Runner);
     
    137137    if ((CandidateBond != NULL)) {
    138138      CandidateBond->BondDegree++;
    139       Log() << Verbose(2) << "Increased bond degree for bond " << *CandidateBond << "." << endl;
     139      //Log() << Verbose(2) << "Increased bond degree for bond " << *CandidateBond << "." << endl;
    140140    } else {
    141       //Log() << Verbose(2) << "Could not find correct degree for atom " << *this << "." << endl;
     141      eLog() << Verbose(2) << "Could not find correct degree for atom " << *this << "." << endl;
    142142      FalseBondDegree++;
    143143    }
  • src/bondgraph.cpp

    r8927ae r1ca488  
    3535/** Parses the bond lengths in a given file and puts them int a matrix form.
    3636 * Allocates \a MatrixContainer for BondGraph::BondLengthMatrix, using MatrixContainer::ParseMatrix(),
    37  * but only if parsing is successfull. Otherwise variable is left as NULL.
     37 * but only if parsing is successful. Otherwise variable is left as NULL.
    3838 * \param *out output stream for debugging
    3939 * \param filename file with bond lengths to parse
  • src/boundary.cpp

    r8927ae r1ca488  
    1010#include "element.hpp"
    1111#include "helpers.hpp"
     12#include "info.hpp"
    1213#include "linkedcell.hpp"
    1314#include "log.hpp"
     
    3334double *GetDiametersOfCluster(const Boundaries *BoundaryPtr, const molecule *mol, Tesselation *&TesselStruct, const bool IsAngstroem)
    3435{
     36        Info FunctionInfo(__func__);
    3537  // get points on boundary of NULL was given as parameter
    3638  bool BoundaryFreeFlag = false;
     
    5355  } else {
    5456    BoundaryPoints = BoundaryPtr;
    55     Log() << Verbose(1) << "Using given boundary points set." << endl;
     57    Log() << Verbose(0) << "Using given boundary points set." << endl;
    5658  }
    5759  // determine biggest "diameter" of cluster for each axis
     
    6769          //Log() << Verbose(1) << "Current component is " << component << ", Othercomponent is " << Othercomponent << "." << endl;
    6870          for (Boundaries::const_iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) {
    69               //Log() << Verbose(2) << "Current runner is " << *(runner->second.second) << "." << endl;
     71              //Log() << Verbose(1) << "Current runner is " << *(runner->second.second) << "." << endl;
    7072              // seek for the neighbours pair where the Othercomponent sign flips
    7173              Neighbour = runner;
     
    8284                  DistanceVector.CopyVector(&runner->second.second->x);
    8385                  DistanceVector.SubtractVector(&Neighbour->second.second->x);
    84                   //Log() << Verbose(3) << "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "." << endl;
     86                  //Log() << Verbose(2) << "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "." << endl;
    8587                } while ((runner != Neighbour) && (fabs(OldComponent / fabs(
    8688                  OldComponent) - DistanceVector.x[Othercomponent] / fabs(
     
    9193                    OtherNeighbour = BoundaryPoints[axis].end();
    9294                  OtherNeighbour--;
    93                   //Log() << Verbose(2) << "The pair, where the sign of OtherComponent flips, is: " << *(Neighbour->second.second) << " and " << *(OtherNeighbour->second.second) << "." << endl;
     95                  //Log() << Verbose(1) << "The pair, where the sign of OtherComponent flips, is: " << *(Neighbour->second.second) << " and " << *(OtherNeighbour->second.second) << "." << endl;
    9496                  // now we have found the pair: Neighbour and OtherNeighbour
    9597                  OtherVector.CopyVector(&runner->second.second->x);
    9698                  OtherVector.SubtractVector(&OtherNeighbour->second.second->x);
    97                   //Log() << Verbose(2) << "Distances to Neighbour and OtherNeighbour are " << DistanceVector.x[component] << " and " << OtherVector.x[component] << "." << endl;
    98                   //Log() << Verbose(2) << "OtherComponents to Neighbour and OtherNeighbour are " << DistanceVector.x[Othercomponent] << " and " << OtherVector.x[Othercomponent] << "." << endl;
     99                  //Log() << Verbose(1) << "Distances to Neighbour and OtherNeighbour are " << DistanceVector.x[component] << " and " << OtherVector.x[component] << "." << endl;
     100                  //Log() << Verbose(1) << "OtherComponents to Neighbour and OtherNeighbour are " << DistanceVector.x[Othercomponent] << " and " << OtherVector.x[Othercomponent] << "." << endl;
    99101                  // do linear interpolation between points (is exact) to extract exact intersection between Neighbour and OtherNeighbour
    100102                  w1 = fabs(OtherVector.x[Othercomponent]);
     
    103105                      * OtherVector.x[component]) / (w1 + w2));
    104106                  // mark if it has greater diameter
    105                   //Log() << Verbose(2) << "Comparing current greatest " << GreatestDiameter[component] << " to new " << tmp << "." << endl;
     107                  //Log() << Verbose(1) << "Comparing current greatest " << GreatestDiameter[component] << " to new " << tmp << "." << endl;
    106108                  GreatestDiameter[component] = (GreatestDiameter[component]
    107109                      > tmp) ? GreatestDiameter[component] : tmp;
    108110                } //else
    109               //Log() << Verbose(2) << "Saw no sign flip, probably top or bottom node." << endl;
     111              //Log() << Verbose(1) << "Saw no sign flip, probably top or bottom node." << endl;
    110112            }
    111113        }
     
    135137Boundaries *GetBoundaryPoints(const molecule *mol, Tesselation *&TesselStruct)
    136138{
     139        Info FunctionInfo(__func__);
    137140  atom *Walker = NULL;
    138141  PointMap PointsOnBoundary;
     
    149152  double angle = 0.;
    150153
    151   Log() << Verbose(1) << "Finding all boundary points." << endl;
    152154  // 3a. Go through every axis
    153155  for (int axis = 0; axis < NDIM; axis++) {
     
    176178        angle = 0.; // otherwise it's a vector in Axis Direction and unimportant for boundary issues
    177179
    178       //Log() << Verbose(2) << "Checking sign in quadrant : " << ProjectedVector.Projection(&AngleReferenceNormalVector) << "." << endl;
     180      //Log() << Verbose(1) << "Checking sign in quadrant : " << ProjectedVector.Projection(&AngleReferenceNormalVector) << "." << endl;
    179181      if (ProjectedVector.ScalarProduct(&AngleReferenceNormalVector) > 0) {
    180182        angle = 2. * M_PI - angle;
    181183      }
    182       Log() << Verbose(2) << "Inserting " << *Walker << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl;
     184      Log() << Verbose(1) << "Inserting " << *Walker << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl;
    183185      BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, DistancePair (radius, Walker)));
    184186      if (!BoundaryTestPair.second) { // same point exists, check first r, then distance of original vectors to center of gravity
     
    210212    // printing all inserted for debugging
    211213    //    {
    212     //      Log() << Verbose(2) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl;
     214    //      Log() << Verbose(1) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl;
    213215    //      int i=0;
    214216    //      for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) {
    215217    //        if (runner != BoundaryPoints[axis].begin())
    216     //          Log() << Verbose(2) << ", " << i << ": " << *runner->second.second;
     218    //          Log() << Verbose(0) << ", " << i << ": " << *runner->second.second;
    217219    //        else
    218     //          Log() << Verbose(2) << i << ": " << *runner->second.second;
     220    //          Log() << Verbose(0) << i << ": " << *runner->second.second;
    219221    //        i++;
    220222    //      }
    221     //      Log() << Verbose(2) << endl;
     223    //      Log() << Verbose(0) << endl;
    222224    //    }
    223225    // 3c. throw out points whose distance is less than the mean of left and right neighbours
     
    249251          SideA.SubtractVector(MolCenter);
    250252          SideA.ProjectOntoPlane(&AxisVector);
    251           //          Log() << Verbose(0) << "SideA: " << SideA << endl;
     253          //          Log() << Verbose(1) << "SideA: " << SideA << endl;
    252254
    253255          SideB.CopyVector(&right->second.second->x);
    254256          SideB.SubtractVector(MolCenter);
    255257          SideB.ProjectOntoPlane(&AxisVector);
    256           //          Log() << Verbose(0) << "SideB: " << SideB << endl;
     258          //          Log() << Verbose(1) << "SideB: " << SideB << endl;
    257259
    258260          SideC.CopyVector(&left->second.second->x);
    259261          SideC.SubtractVector(&right->second.second->x);
    260262          SideC.ProjectOntoPlane(&AxisVector);
    261           //          Log() << Verbose(0) << "SideC: " << SideC << endl;
     263          //          Log() << Verbose(1) << "SideC: " << SideC << endl;
    262264
    263265          SideH.CopyVector(&runner->second.second->x);
    264266          SideH.SubtractVector(MolCenter);
    265267          SideH.ProjectOntoPlane(&AxisVector);
    266           //          Log() << Verbose(0) << "SideH: " << SideH << endl;
     268          //          Log() << Verbose(1) << "SideH: " << SideH << endl;
    267269
    268270          // calculate each length
     
    277279          const double delta = SideC.Angle(&SideH);
    278280          const double MinDistance = a * sin(beta) / (sin(delta)) * (((alpha < M_PI / 2.) || (gamma < M_PI / 2.)) ? 1. : -1.);
    279           //Log() << Verbose(2) << " I calculated: a = " << a << ", h = " << h << ", beta(" << left->second.second->Name << "," << left->second.second->Name << "-" << right->second.second->Name << ") = " << beta << ", delta(" << left->second.second->Name << "," << runner->second.second->Name << ") = " << delta << ", Min = " << MinDistance << "." << endl;
     281          //Log() << Verbose(1) << " I calculated: a = " << a << ", h = " << h << ", beta(" << left->second.second->Name << "," << left->second.second->Name << "-" << right->second.second->Name << ") = " << beta << ", delta(" << left->second.second->Name << "," << runner->second.second->Name << ") = " << delta << ", Min = " << MinDistance << "." << endl;
    280282          Log() << Verbose(1) << "Checking CoG distance of runner " << *runner->second.second << " " << h << " against triangle's side length spanned by (" << *left->second.second << "," << *right->second.second << ") of " << MinDistance << "." << endl;
    281283          if ((fabs(h / fabs(h) - MinDistance / fabs(MinDistance)) < MYEPSILON) && ((h - MinDistance)) < -MYEPSILON) {
     
    303305void FindConvexBorder(const molecule* mol, Tesselation *&TesselStruct, const LinkedCell *LCList, const char *filename)
    304306{
     307        Info FunctionInfo(__func__);
    305308  bool BoundaryFreeFlag = false;
    306309  Boundaries *BoundaryPoints = NULL;
    307 
    308   Log() << Verbose(1) << "Begin of FindConvexBorder" << endl;
    309310
    310311  if (TesselStruct != NULL) // free if allocated
     
    317318      BoundaryPoints = GetBoundaryPoints(mol, TesselStruct);
    318319  } else {
    319       Log() << Verbose(1) << "Using given boundary points set." << endl;
     320      Log() << Verbose(0) << "Using given boundary points set." << endl;
    320321  }
    321322
     
    323324  for (int axis=0; axis < NDIM; axis++)
    324325    {
    325       Log() << Verbose(2) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl;
     326      Log() << Verbose(1) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl;
    326327      int i=0;
    327328      for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) {
    328329        if (runner != BoundaryPoints[axis].begin())
    329           Log() << Verbose(2) << ", " << i << ": " << *runner->second.second;
     330          Log() << Verbose(0) << ", " << i << ": " << *runner->second.second;
    330331        else
    331           Log() << Verbose(2) << i << ": " << *runner->second.second;
     332          Log() << Verbose(0) << i << ": " << *runner->second.second;
    332333        i++;
    333334      }
    334       Log() << Verbose(2) << endl;
     335      Log() << Verbose(0) << endl;
    335336    }
    336337
     
    341342          eLog() << Verbose(2) << "Point " << *(runner->second.second) << " is already present!" << endl;
    342343
    343   Log() << Verbose(2) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl;
     344  Log() << Verbose(0) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl;
    344345  // now we have the whole set of edge points in the BoundaryList
    345346
     
    347348  //  Log() << Verbose(1) << "Listing PointsOnBoundary:";
    348349  //  for(PointMap::iterator runner = PointsOnBoundary.begin(); runner != PointsOnBoundary.end(); runner++) {
    349   //    Log() << Verbose(1) << " " << *runner->second;
     350  //    Log() << Verbose(0) << " " << *runner->second;
    350351  //  }
    351   //  Log() << Verbose(1) << endl;
     352  //  Log() << Verbose(0) << endl;
    352353
    353354  // 3a. guess starting triangle
     
    359360  // 3c. check whether all atoms lay inside the boundary, if not, add to boundary points, segment triangle into three with the new point
    360361  if (!TesselStruct->InsertStraddlingPoints(mol, LCList))
    361     Log() << Verbose(1) << "Insertion of straddling points failed!" << endl;
    362 
    363   Log() << Verbose(2) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " intermediate triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl;
     362    eLog() << Verbose(1) << "Insertion of straddling points failed!" << endl;
     363
     364  Log() << Verbose(0) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " intermediate triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl;
    364365
    365366  // 4. Store triangles in tecplot file
     
    411412//    Log() << Verbose(1) << "Correction of concave tesselpoints failed!" << endl;
    412413
    413   Log() << Verbose(2) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl;
     414  Log() << Verbose(0) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl;
    414415
    415416  // 4. Store triangles in tecplot file
     
    437438  if (BoundaryFreeFlag)
    438439    delete[] (BoundaryPoints);
    439 
    440   Log() << Verbose(1) << "End of FindConvexBorder" << endl;
    441440};
    442441
     
    450449bool RemoveAllBoundaryPoints(class Tesselation *&TesselStruct, const molecule * const mol, const char * const filename)
    451450{
     451        Info FunctionInfo(__func__);
    452452  int i=0;
    453453  char number[MAXSTRINGSIZE];
     
    460460  PointMap::iterator PointRunner;
    461461  while (!TesselStruct->PointsOnBoundary.empty()) {
    462     Log() << Verbose(2) << "Remaining points are: ";
     462    Log() << Verbose(1) << "Remaining points are: ";
    463463    for (PointMap::iterator PointSprinter = TesselStruct->PointsOnBoundary.begin(); PointSprinter != TesselStruct->PointsOnBoundary.end(); PointSprinter++)
    464       Log() << Verbose(2) << *(PointSprinter->second) << "\t";
    465     Log() << Verbose(2) << endl;
     464      Log() << Verbose(0) << *(PointSprinter->second) << "\t";
     465    Log() << Verbose(0) << endl;
    466466
    467467    PointRunner = TesselStruct->PointsOnBoundary.begin();
     
    503503double ConvexizeNonconvexEnvelope(class Tesselation *&TesselStruct, const molecule * const mol, const char * const filename)
    504504{
     505        Info FunctionInfo(__func__);
    505506  double volume = 0;
    506507  class BoundaryPointSet *point = NULL;
     
    516517  int run = 0;
    517518
    518   Log() << Verbose(0) << "Begin of ConvexizeNonconvexEnvelope" << endl;
    519 
    520519  // check whether there is something to work on
    521520  if (TesselStruct == NULL) {
     
    539538      for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) {
    540539        line = LineRunner->second;
    541         Log() << Verbose(2) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;
     540        Log() << Verbose(1) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;
    542541        if (!line->CheckConvexityCriterion()) {
    543542          // remove the point if needed
     
    604603
    605604  // end
    606   Log() << Verbose(1) << "Volume is " << volume << "." << endl;
    607   Log() << Verbose(0) << "End of ConvexizeNonconvexEnvelope" << endl;
     605  Log() << Verbose(0) << "Volume is " << volume << "." << endl;
    608606  return volume;
    609607};
     
    619617double VolumeOfConvexEnvelope(class Tesselation *TesselStruct, class config *configuration)
    620618{
     619        Info FunctionInfo(__func__);
    621620  bool IsAngstroem = configuration->GetIsAngstroem();
    622621  double volume = 0.;
     
    625624
    626625  // 6a. Every triangle forms a pyramid with the center of gravity as its peak, sum up the volumes
    627   Log() << Verbose(1)
    628       << "Calculating the volume of the pyramids formed out of triangles and center of gravity."
    629       << endl;
    630626  for (TriangleMap::iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++)
    631627    { // go through every triangle, calculate volume of its pyramid with CoG as peak
     
    642638      const double h = x.Norm(); // distance of CoG to triangle
    643639      const double PyramidVolume = (1. / 3.) * G * h; // this formula holds for _all_ pyramids (independent of n-edge base or (not) centered peak)
    644       Log() << Verbose(2) << "Area of triangle is " << setprecision(10) << G << " "
     640      Log() << Verbose(1) << "Area of triangle is " << setprecision(10) << G << " "
    645641          << (IsAngstroem ? "angstrom" : "atomiclength") << "^2, height is "
    646642          << h << " and the volume is " << PyramidVolume << " "
     
    664660void StoreTrianglesinFile(const molecule * const mol, const Tesselation *&TesselStruct, const char *filename, const char *extraSuffix)
    665661{
     662        Info FunctionInfo(__func__);
    666663  // 4. Store triangles in tecplot file
    667664  if (filename != NULL) {
     
    671668      OutputName.append(TecplotSuffix);
    672669      ofstream *tecplot = new ofstream(OutputName.c_str());
    673       WriteTecplotFile(tecplot, TesselStruct, mol, 0);
     670      WriteTecplotFile(tecplot, TesselStruct, mol, -1);
    674671      tecplot->close();
    675672      delete(tecplot);
     
    698695void PrepareClustersinWater(config *configuration, molecule *mol, double ClusterVolume, double celldensity)
    699696{
     697        Info FunctionInfo(__func__);
    700698  bool IsAngstroem = true;
    701699  double *GreatestDiameter = NULL;
     
    798796molecule * FillBoxWithMolecule(MoleculeListClass *List, molecule *filler, config &configuration, double distance[NDIM], double RandomAtomDisplacement, double RandomMolDisplacement, bool DoRandomRotation)
    799797{
     798        Info FunctionInfo(__func__);
    800799  molecule *Filling = new molecule(filler->elemente);
    801800  Vector CurrentPosition;
     
    814813  double phi[NDIM];
    815814  class Tesselation *TesselStruct[List->ListOfMolecules.size()];
    816 
    817   Log() << Verbose(0) << "Begin of FillBoxWithMolecule" << endl;
    818815
    819816  i=0;
     
    877874          for (int i=0;i<NDIM;i++)
    878875            FillerTranslations.x[i] = RandomMolDisplacement*(rand()/(RAND_MAX/2.) - 1.);
    879           Log() << Verbose(3) << "INFO: Translating this filler by " << FillerTranslations << "." << endl;
     876          Log() << Verbose(2) << "INFO: Translating this filler by " << FillerTranslations << "." << endl;
    880877
    881878          // go through all atoms
     
    938935        delete(TesselStruct[i]);
    939936  }
    940   Log() << Verbose(0) << "End of FillBoxWithMolecule" << endl;
    941 
    942937  return Filling;
    943938};
     
    951946 * \param RADIUS radius of the virtual sphere
    952947 * \param *filename filename prefix for output of vertex data
    953  */
    954 void FindNonConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LCList, const double RADIUS, const char *filename = NULL)
     948 * \return true - tesselation successful, false - tesselation failed
     949 */
     950bool FindNonConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LCList, const double RADIUS, const char *filename = NULL)
    955951{
     952        Info FunctionInfo(__func__);
    956953  bool freeLC = false;
    957   LineMap::iterator baseline;
     954  bool status = false;
     955  CandidateForTesselation *baseline;
    958956  LineMap::iterator testline;
    959   bool OneLoopWithoutSuccessFlag = false;  // marks whether we went once through all baselines without finding any without two triangles
     957  bool OneLoopWithoutSuccessFlag = true;  // marks whether we went once through all baselines without finding any without two triangles
    960958  bool TesselationFailFlag = false;
    961 
    962   Log() << Verbose(1) << "Entering search for non convex hull. " << endl;
     959  BoundaryTriangleSet *T = NULL;
     960
    963961  if (TesselStruct == NULL) {
    964962    Log() << Verbose(1) << "Allocating Tesselation struct ..." << endl;
     
    970968  }
    971969
    972   Log() << Verbose(0) << "Begin of FindNonConvexBorder\n";
    973 
    974970  // initialise Linked Cell
    975971  if (LCList == NULL) {
     
    982978
    983979  // 2. expand from there
    984   baseline = TesselStruct->LinesOnBoundary.begin();
    985   baseline++; // skip first line
    986   while ((baseline != TesselStruct->LinesOnBoundary.end()) || (OneLoopWithoutSuccessFlag)) {
    987     if (baseline->second->triangles.size() == 1) {
    988       CheckListOfBaselines(TesselStruct);
    989       // 3. find next triangle
    990       TesselationFailFlag = TesselStruct->FindNextSuitableTriangle(*(baseline->second), *(((baseline->second->triangles.begin()))->second), RADIUS, LCList); //the line is there, so there is a triangle, but only one.
    991       OneLoopWithoutSuccessFlag = OneLoopWithoutSuccessFlag || TesselationFailFlag;
    992       if (!TesselationFailFlag)
    993         eLog() << Verbose(2) << "FindNextSuitableTriangle failed." << endl;
    994 
    995       // write temporary envelope
    996       if (filename != NULL) {
    997         if ((DoSingleStepOutput && ((TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration
    998           TesselStruct->Output(filename, mol);
    999         }
     980  while ((!TesselStruct->OpenLines.empty()) && (OneLoopWithoutSuccessFlag)) {
     981    // 2a. fill all new OpenLines
     982    Log() << Verbose(1) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for candidates:" << endl;
     983    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++)
     984      Log() << Verbose(2) << *(Runner->second) << endl;
     985
     986    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) {
     987      baseline = Runner->second;
     988      if (baseline->pointlist.empty()) {
     989        T = (((baseline->BaseLine->triangles.begin()))->second);
     990        Log() << Verbose(1) << "Finding best candidate for open line " << *baseline->BaseLine << " of triangle " << *T << endl;
     991        TesselationFailFlag = TesselStruct->FindNextSuitableTriangle(*baseline, *T, RADIUS, LCList); //the line is there, so there is a triangle, but only one.
    1000992      }
    1001       if (TesselationFailFlag) {
    1002         baseline = TesselStruct->LinesOnBoundary.begin();
    1003         OneLoopWithoutSuccessFlag = false;
    1004         Log() << Verbose(2) << "Baseline set to begin." << endl;
     993    }
     994
     995    // 2b. search for smallest ShortestAngle among all candidates
     996    double ShortestAngle = 4.*M_PI;
     997    Log() << Verbose(1) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for the best candidates:" << endl;
     998    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++)
     999      Log() << Verbose(2) << *(Runner->second) << endl;
     1000
     1001    for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) {
     1002      if (Runner->second->ShortestAngle < ShortestAngle) {
     1003        baseline = Runner->second;
     1004        ShortestAngle = baseline->ShortestAngle;
     1005        //Log() << Verbose(1) << "New best candidate is " << *baseline->BaseLine << " with point " << *baseline->point << " and angle " << baseline->ShortestAngle << endl;
    10051006      }
    1006     } else {
    1007       //Log() << Verbose(1) << "Line " << *baseline->second << " has " << baseline->second->triangles.size() << " triangles adjacent" << endl;
    1008       if (baseline->second->triangles.size() != 2) {
    1009         eLog() << Verbose(0) << "TESSELATION FINISHED WITH INVALID TRIANGLE COUNT!" << endl;
    1010         performCriticalExit();
     1007    }
     1008    if ((ShortestAngle == 4.*M_PI) || (baseline->pointlist.empty()))
     1009      OneLoopWithoutSuccessFlag = false;
     1010    else {
     1011      TesselStruct->AddCandidateTriangle(*baseline);
     1012    }
     1013
     1014    // write temporary envelope
     1015    if (filename != NULL) {
     1016      if ((DoSingleStepOutput && ((TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration
     1017        TesselStruct->Output(filename, mol);
    10111018      }
    10121019    }
    1013 
    1014     if ((baseline == TesselStruct->LinesOnBoundary.end()) && (OneLoopWithoutSuccessFlag)) {
    1015       baseline = TesselStruct->LinesOnBoundary.begin();   // restart if we reach end due to newly inserted lines
    1016       OneLoopWithoutSuccessFlag = false;
    1017     }
    1018     baseline++;
    1019   }
    1020   // check envelope for consistency
    1021   CheckListOfBaselines(TesselStruct);
    1022 
    1023   // look whether all points are inside of the convex envelope, otherwise add them via degenerated triangles
    1024   //->InsertStraddlingPoints(mol, LCList);
     1020  }
     1021//  // check envelope for consistency
     1022//  status = CheckListOfBaselines(TesselStruct);
     1023//
     1024//  // look whether all points are inside of the convex envelope, otherwise add them via degenerated triangles
     1025//  //->InsertStraddlingPoints(mol, LCList);
    10251026//  mol->GoToFirst();
    10261027//  class TesselPoint *Runner = NULL;
     
    10371038//  }
    10381039
    1039   // Purges surplus triangles.
    1040   TesselStruct->RemoveDegeneratedTriangles();
     1040//  // Purges surplus triangles.
     1041//  TesselStruct->RemoveDegeneratedTriangles();
    10411042
    10421043  // check envelope for consistency
    1043   CheckListOfBaselines(TesselStruct);
     1044  status = CheckListOfBaselines(TesselStruct);
     1045
     1046  // store before correction
     1047  StoreTrianglesinFile(mol, (const Tesselation *&)TesselStruct, filename, "");
     1048
     1049  // correct degenerated polygons
     1050  TesselStruct->CorrectAllDegeneratedPolygons();
     1051
     1052  // check envelope for consistency
     1053  status = CheckListOfBaselines(TesselStruct);
    10441054
    10451055  // write final envelope
     
    10491059  if (freeLC)
    10501060    delete(LCList);
    1051   Log() << Verbose(0) << "End of FindNonConvexBorder\n";
     1061
     1062  return status;
    10521063};
    10531064
     
    10611072Vector* FindEmbeddingHole(MoleculeListClass *mols, molecule *srcmol)
    10621073{
     1074        Info FunctionInfo(__func__);
    10631075  Vector *Center = new Vector;
    10641076  Center->Zero();
  • src/boundary.hpp

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

    r8927ae r1ca488  
    7373#include "Actions/ActionRegistry.hpp"
    7474#include "Actions/MethodAction.hpp"
    75 
     75#include "version.h"
     76
     77/********************************************* Subsubmenu routine ************************************/
     78#if 0
     79/** Submenu for adding atoms to the molecule.
     80 * \param *periode periodentafel
     81 * \param *molecule molecules with atoms
     82 */
     83static void AddAtoms(periodentafel *periode, molecule *mol)
     84{
     85  atom *first, *second, *third, *fourth;
     86  Vector **atoms;
     87  Vector x,y,z,n;  // coordinates for absolute point in cell volume
     88  double a,b,c;
     89  char choice;  // menu choice char
     90  bool valid;
     91
     92  Log() << Verbose(0) << "===========ADD ATOM============================" << endl;
     93  Log() << Verbose(0) << " a - state absolute coordinates of atom" << endl;
     94  Log() << Verbose(0) << " b - state relative coordinates of atom wrt to reference point" << endl;
     95  Log() << Verbose(0) << " c - state relative coordinates of atom wrt to already placed atom" << endl;
     96  Log() << Verbose(0) << " d - state two atoms, two angles and a distance" << endl;
     97  Log() << Verbose(0) << " e - least square distance position to a set of atoms" << endl;
     98  Log() << Verbose(0) << "all else - go back" << endl;
     99  Log() << Verbose(0) << "===============================================" << endl;
     100  Log() << Verbose(0) << "Note: Specifiy angles in degrees not multiples of Pi!" << endl;
     101  Log() << Verbose(0) << "INPUT: ";
     102  cin >> choice;
     103
     104  switch (choice) {
     105    default:
     106      eLog() << Verbose(2) << "Not a valid choice." << endl;
     107      break;
     108      case 'a': // absolute coordinates of atom
     109        Log() << Verbose(0) << "Enter absolute coordinates." << endl;
     110        first = new atom;
     111        first->x.AskPosition(mol->cell_size, false);
     112        first->type = periode->AskElement();  // give type
     113        mol->AddAtom(first);  // add to molecule
     114        break;
     115
     116      case 'b': // relative coordinates of atom wrt to reference point
     117        first = new atom;
     118        valid = true;
     119        do {
     120          if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl;
     121          Log() << Verbose(0) << "Enter reference coordinates." << endl;
     122          x.AskPosition(mol->cell_size, true);
     123          Log() << Verbose(0) << "Enter relative coordinates." << endl;
     124          first->x.AskPosition(mol->cell_size, false);
     125          first->x.AddVector((const Vector *)&x);
     126          Log() << Verbose(0) << "\n";
     127        } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
     128        first->type = periode->AskElement();  // give type
     129        mol->AddAtom(first);  // add to molecule
     130        break;
     131
     132      case 'c': // relative coordinates of atom wrt to already placed atom
     133        first = new atom;
     134        valid = true;
     135        do {
     136          if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl;
     137          second = mol->AskAtom("Enter atom number: ");
     138          Log() << Verbose(0) << "Enter relative coordinates." << endl;
     139          first->x.AskPosition(mol->cell_size, false);
     140          for (int i=NDIM;i--;) {
     141            first->x.x[i] += second->x.x[i];
     142          }
     143        } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
     144        first->type = periode->AskElement();  // give type
     145        mol->AddAtom(first);  // add to molecule
     146        break;
     147
     148    case 'd': // two atoms, two angles and a distance
     149        first = new atom;
     150        valid = true;
     151        do {
     152          if (!valid) {
     153            eLog() << Verbose(2) << "Resulting coordinates out of cell - " << first->x << endl;
     154          }
     155          Log() << Verbose(0) << "First, we need two atoms, the first atom is the central, while the second is the outer one." << endl;
     156          second = mol->AskAtom("Enter central atom: ");
     157          third = mol->AskAtom("Enter second atom (specifying the axis for first angle): ");
     158          fourth = mol->AskAtom("Enter third atom (specifying a plane for second angle): ");
     159          a = ask_value("Enter distance between central (first) and new atom: ");
     160          b = ask_value("Enter angle between new, first and second atom (degrees): ");
     161          b *= M_PI/180.;
     162          bound(&b, 0., 2.*M_PI);
     163          c = ask_value("Enter second angle between new and normal vector of plane defined by first, second and third atom (degrees): ");
     164          c *= M_PI/180.;
     165          bound(&c, -M_PI, M_PI);
     166          Log() << Verbose(0) << "radius: " << a << "\t phi: " << b*180./M_PI << "\t theta: " << c*180./M_PI << endl;
     167/*
     168          second->Output(1,1,(ofstream *)&cout);
     169          third->Output(1,2,(ofstream *)&cout);
     170          fourth->Output(1,3,(ofstream *)&cout);
     171          n.MakeNormalvector((const vector *)&second->x, (const vector *)&third->x, (const vector *)&fourth->x);
     172          x.Copyvector(&second->x);
     173          x.SubtractVector(&third->x);
     174          x.Copyvector(&fourth->x);
     175          x.SubtractVector(&third->x);
     176
     177          if (!z.SolveSystem(&x,&y,&n, b, c, a)) {
     178            Log() << Verbose(0) << "Failure solving self-dependent linear system!" << endl;
     179            continue;
     180          }
     181          Log() << Verbose(0) << "resulting relative coordinates: ";
     182          z.Output();
     183          Log() << Verbose(0) << endl;
     184          */
     185          // calc axis vector
     186          x.CopyVector(&second->x);
     187          x.SubtractVector(&third->x);
     188          x.Normalize();
     189          Log() << Verbose(0) << "x: ",
     190          x.Output();
     191          Log() << Verbose(0) << endl;
     192          z.MakeNormalVector(&second->x,&third->x,&fourth->x);
     193          Log() << Verbose(0) << "z: ",
     194          z.Output();
     195          Log() << Verbose(0) << endl;
     196          y.MakeNormalVector(&x,&z);
     197          Log() << Verbose(0) << "y: ",
     198          y.Output();
     199          Log() << Verbose(0) << endl;
     200
     201          // rotate vector around first angle
     202          first->x.CopyVector(&x);
     203          first->x.RotateVector(&z,b - M_PI);
     204          Log() << Verbose(0) << "Rotated vector: ",
     205          first->x.Output();
     206          Log() << Verbose(0) << endl;
     207          // remove the projection onto the rotation plane of the second angle
     208          n.CopyVector(&y);
     209          n.Scale(first->x.ScalarProduct(&y));
     210          Log() << Verbose(0) << "N1: ",
     211          n.Output();
     212          Log() << Verbose(0) << endl;
     213          first->x.SubtractVector(&n);
     214          Log() << Verbose(0) << "Subtracted vector: ",
     215          first->x.Output();
     216          Log() << Verbose(0) << endl;
     217          n.CopyVector(&z);
     218          n.Scale(first->x.ScalarProduct(&z));
     219          Log() << Verbose(0) << "N2: ",
     220          n.Output();
     221          Log() << Verbose(0) << endl;
     222          first->x.SubtractVector(&n);
     223          Log() << Verbose(0) << "2nd subtracted vector: ",
     224          first->x.Output();
     225          Log() << Verbose(0) << endl;
     226
     227          // rotate another vector around second angle
     228          n.CopyVector(&y);
     229          n.RotateVector(&x,c - M_PI);
     230          Log() << Verbose(0) << "2nd Rotated vector: ",
     231          n.Output();
     232          Log() << Verbose(0) << endl;
     233
     234          // add the two linear independent vectors
     235          first->x.AddVector(&n);
     236          first->x.Normalize();
     237          first->x.Scale(a);
     238          first->x.AddVector(&second->x);
     239
     240          Log() << Verbose(0) << "resulting coordinates: ";
     241          first->x.Output();
     242          Log() << Verbose(0) << endl;
     243        } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
     244        first->type = periode->AskElement();  // give type
     245        mol->AddAtom(first);  // add to molecule
     246        break;
     247
     248      case 'e': // least square distance position to a set of atoms
     249        first = new atom;
     250        atoms = new (Vector*[128]);
     251        valid = true;
     252        for(int i=128;i--;)
     253          atoms[i] = NULL;
     254        int i=0, j=0;
     255        Log() << Verbose(0) << "Now we need at least three molecules.\n";
     256        do {
     257          Log() << Verbose(0) << "Enter " << i+1 << "th atom: ";
     258          cin >> j;
     259          if (j != -1) {
     260            second = mol->FindAtom(j);
     261            atoms[i++] = &(second->x);
     262          }
     263        } while ((j != -1) && (i<128));
     264        if (i >= 2) {
     265          first->x.LSQdistance((const Vector **)atoms, i);
     266
     267          first->x.Output();
     268          first->type = periode->AskElement();  // give type
     269          mol->AddAtom(first);  // add to molecule
     270        } else {
     271          delete first;
     272          Log() << Verbose(0) << "Please enter at least two vectors!\n";
     273        }
     274        break;
     275  };
     276};
     277
     278/** Submenu for centering the atoms in the molecule.
     279 * \param *mol molecule with all the atoms
     280 */
     281static void CenterAtoms(molecule *mol)
     282{
     283  Vector x, y, helper;
     284  char choice;  // menu choice char
     285
     286  Log() << Verbose(0) << "===========CENTER ATOMS=========================" << endl;
     287  Log() << Verbose(0) << " a - on origin" << endl;
     288  Log() << Verbose(0) << " b - on center of gravity" << endl;
     289  Log() << Verbose(0) << " c - within box with additional boundary" << endl;
     290  Log() << Verbose(0) << " d - within given simulation box" << endl;
     291  Log() << Verbose(0) << "all else - go back" << endl;
     292  Log() << Verbose(0) << "===============================================" << endl;
     293  Log() << Verbose(0) << "INPUT: ";
     294  cin >> choice;
     295
     296  switch (choice) {
     297    default:
     298      Log() << Verbose(0) << "Not a valid choice." << endl;
     299      break;
     300    case 'a':
     301      Log() << Verbose(0) << "Centering atoms in config file on origin." << endl;
     302      mol->CenterOrigin();
     303      break;
     304    case 'b':
     305      Log() << Verbose(0) << "Centering atoms in config file on center of gravity." << endl;
     306      mol->CenterPeriodic();
     307      break;
     308    case 'c':
     309      Log() << Verbose(0) << "Centering atoms in config file within given additional boundary." << endl;
     310      for (int i=0;i<NDIM;i++) {
     311        Log() << Verbose(0) << "Enter axis " << i << " boundary: ";
     312        cin >> y.x[i];
     313      }
     314      mol->CenterEdge(&x);  // make every coordinate positive
     315      mol->Center.AddVector(&y); // translate by boundary
     316      helper.CopyVector(&y);
     317      helper.Scale(2.);
     318      helper.AddVector(&x);
     319      mol->SetBoxDimension(&helper);  // update Box of atoms by boundary
     320      break;
     321    case 'd':
     322      Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl;
     323      for (int i=0;i<NDIM;i++) {
     324        Log() << Verbose(0) << "Enter axis " << i << " boundary: ";
     325        cin >> x.x[i];
     326      }
     327      // update Box of atoms by boundary
     328      mol->SetBoxDimension(&x);
     329      // center
     330      mol->CenterInBox();
     331      break;
     332  }
     333};
     334
     335/** Submenu for aligning the atoms in the molecule.
     336 * \param *periode periodentafel
     337 * \param *mol molecule with all the atoms
     338 */
     339static void AlignAtoms(periodentafel *periode, molecule *mol)
     340{
     341  atom *first, *second, *third;
     342  Vector x,n;
     343  char choice;  // menu choice char
     344
     345  Log() << Verbose(0) << "===========ALIGN ATOMS=========================" << endl;
     346  Log() << Verbose(0) << " a - state three atoms defining align plane" << endl;
     347  Log() << Verbose(0) << " b - state alignment vector" << endl;
     348  Log() << Verbose(0) << " c - state two atoms in alignment direction" << endl;
     349  Log() << Verbose(0) << " d - align automatically by least square fit" << endl;
     350  Log() << Verbose(0) << "all else - go back" << endl;
     351  Log() << Verbose(0) << "===============================================" << endl;
     352  Log() << Verbose(0) << "INPUT: ";
     353  cin >> choice;
     354
     355  switch (choice) {
     356    default:
     357    case 'a': // three atoms defining mirror plane
     358      first = mol->AskAtom("Enter first atom: ");
     359      second = mol->AskAtom("Enter second atom: ");
     360      third = mol->AskAtom("Enter third atom: ");
     361
     362      n.MakeNormalVector((const Vector *)&first->x,(const Vector *)&second->x,(const Vector *)&third->x);
     363      break;
     364    case 'b': // normal vector of mirror plane
     365      Log() << Verbose(0) << "Enter normal vector of mirror plane." << endl;
     366      n.AskPosition(mol->cell_size,0);
     367      n.Normalize();
     368      break;
     369    case 'c': // three atoms defining mirror plane
     370      first = mol->AskAtom("Enter first atom: ");
     371      second = mol->AskAtom("Enter second atom: ");
     372
     373      n.CopyVector((const Vector *)&first->x);
     374      n.SubtractVector((const Vector *)&second->x);
     375      n.Normalize();
     376      break;
     377    case 'd':
     378      char shorthand[4];
     379      Vector a;
     380      struct lsq_params param;
     381      do {
     382        fprintf(stdout, "Enter the element of atoms to be chosen: ");
     383        fscanf(stdin, "%3s", shorthand);
     384      } while ((param.type = periode->FindElement(shorthand)) == NULL);
     385      Log() << Verbose(0) << "Element is " << param.type->name << endl;
     386      mol->GetAlignvector(&param);
     387      for (int i=NDIM;i--;) {
     388        x.x[i] = gsl_vector_get(param.x,i);
     389        n.x[i] = gsl_vector_get(param.x,i+NDIM);
     390      }
     391      gsl_vector_free(param.x);
     392      Log() << Verbose(0) << "Offset vector: ";
     393      x.Output();
     394      Log() << Verbose(0) << endl;
     395      n.Normalize();
     396      break;
     397  };
     398  Log() << Verbose(0) << "Alignment vector: ";
     399  n.Output();
     400  Log() << Verbose(0) << endl;
     401  mol->Align(&n);
     402};
     403
     404/** Submenu for mirroring the atoms in the molecule.
     405 * \param *mol molecule with all the atoms
     406 */
     407static void MirrorAtoms(molecule *mol)
     408{
     409  atom *first, *second, *third;
     410  Vector n;
     411  char choice;  // menu choice char
     412
     413  Log() << Verbose(0) << "===========MIRROR ATOMS=========================" << endl;
     414  Log() << Verbose(0) << " a - state three atoms defining mirror plane" << endl;
     415  Log() << Verbose(0) << " b - state normal vector of mirror plane" << endl;
     416  Log() << Verbose(0) << " c - state two atoms in normal direction" << endl;
     417  Log() << Verbose(0) << "all else - go back" << endl;
     418  Log() << Verbose(0) << "===============================================" << endl;
     419  Log() << Verbose(0) << "INPUT: ";
     420  cin >> choice;
     421
     422  switch (choice) {
     423    default:
     424    case 'a': // three atoms defining mirror plane
     425      first = mol->AskAtom("Enter first atom: ");
     426      second = mol->AskAtom("Enter second atom: ");
     427      third = mol->AskAtom("Enter third atom: ");
     428
     429      n.MakeNormalVector((const Vector *)&first->x,(const Vector *)&second->x,(const Vector *)&third->x);
     430      break;
     431    case 'b': // normal vector of mirror plane
     432      Log() << Verbose(0) << "Enter normal vector of mirror plane." << endl;
     433      n.AskPosition(mol->cell_size,0);
     434      n.Normalize();
     435      break;
     436    case 'c': // three atoms defining mirror plane
     437      first = mol->AskAtom("Enter first atom: ");
     438      second = mol->AskAtom("Enter second atom: ");
     439
     440      n.CopyVector((const Vector *)&first->x);
     441      n.SubtractVector((const Vector *)&second->x);
     442      n.Normalize();
     443      break;
     444  };
     445  Log() << Verbose(0) << "Normal vector: ";
     446  n.Output();
     447  Log() << Verbose(0) << endl;
     448  mol->Mirror((const Vector *)&n);
     449};
     450
     451/** Submenu for removing the atoms from the molecule.
     452 * \param *mol molecule with all the atoms
     453 */
     454static void RemoveAtoms(molecule *mol)
     455{
     456  atom *first, *second;
     457  int axis;
     458  double tmp1, tmp2;
     459  char choice;  // menu choice char
     460
     461  Log() << Verbose(0) << "===========REMOVE ATOMS=========================" << endl;
     462  Log() << Verbose(0) << " a - state atom for removal by number" << endl;
     463  Log() << Verbose(0) << " b - keep only in radius around atom" << endl;
     464  Log() << Verbose(0) << " c - remove this with one axis greater value" << endl;
     465  Log() << Verbose(0) << "all else - go back" << endl;
     466  Log() << Verbose(0) << "===============================================" << endl;
     467  Log() << Verbose(0) << "INPUT: ";
     468  cin >> choice;
     469
     470  switch (choice) {
     471    default:
     472    case 'a':
     473      if (mol->RemoveAtom(mol->AskAtom("Enter number of atom within molecule: ")))
     474        Log() << Verbose(1) << "Atom removed." << endl;
     475      else
     476        Log() << Verbose(1) << "Atom not found." << endl;
     477      break;
     478    case 'b':
     479      second = mol->AskAtom("Enter number of atom as reference point: ");
     480      Log() << Verbose(0) << "Enter radius: ";
     481      cin >> tmp1;
     482      first = mol->start;
     483      second = first->next;
     484      while(second != mol->end) {
     485        first = second;
     486        second = first->next;
     487        if (first->x.DistanceSquared((const Vector *)&second->x) > tmp1*tmp1) // distance to first above radius ...
     488          mol->RemoveAtom(first);
     489      }
     490      break;
     491    case 'c':
     492      Log() << Verbose(0) << "Which axis is it: ";
     493      cin >> axis;
     494      Log() << Verbose(0) << "Lower boundary: ";
     495      cin >> tmp1;
     496      Log() << Verbose(0) << "Upper boundary: ";
     497      cin >> tmp2;
     498      first = mol->start;
     499      second = first->next;
     500      while(second != mol->end) {
     501        first = second;
     502        second = first->next;
     503        if ((first->x.x[axis] < tmp1) || (first->x.x[axis] > tmp2)) {// out of boundary ...
     504          //Log() << Verbose(0) << "Atom " << *first << " with " << first->x.x[axis] << " on axis " << axis << " is out of bounds [" << tmp1 << "," << tmp2 << "]." << endl;
     505          mol->RemoveAtom(first);
     506        }
     507      }
     508      break;
     509  };
     510  //mol->Output();
     511  choice = 'r';
     512};
     513
     514/** Submenu for measuring out the atoms in the molecule.
     515 * \param *periode periodentafel
     516 * \param *mol molecule with all the atoms
     517 */
     518static void MeasureAtoms(periodentafel *periode, molecule *mol, config *configuration)
     519{
     520  atom *first, *second, *third;
     521  Vector x,y;
     522  double min[256], tmp1, tmp2, tmp3;
     523  int Z;
     524  char choice;  // menu choice char
     525
     526  Log() << Verbose(0) << "===========MEASURE ATOMS=========================" << endl;
     527  Log() << Verbose(0) << " a - calculate bond length between one atom and all others" << endl;
     528  Log() << Verbose(0) << " b - calculate bond length between two atoms" << endl;
     529  Log() << Verbose(0) << " c - calculate bond angle" << endl;
     530  Log() << Verbose(0) << " d - calculate principal axis of the system" << endl;
     531  Log() << Verbose(0) << " e - calculate volume of the convex envelope" << endl;
     532  Log() << Verbose(0) << " f - calculate temperature from current velocity" << endl;
     533  Log() << Verbose(0) << " g - output all temperatures per step from velocities" << endl;
     534  Log() << Verbose(0) << "all else - go back" << endl;
     535  Log() << Verbose(0) << "===============================================" << endl;
     536  Log() << Verbose(0) << "INPUT: ";
     537  cin >> choice;
     538
     539  switch(choice) {
     540    default:
     541      Log() << Verbose(1) << "Not a valid choice." << endl;
     542      break;
     543    case 'a':
     544      first = mol->AskAtom("Enter first atom: ");
     545      for (int i=MAX_ELEMENTS;i--;)
     546        min[i] = 0.;
     547
     548      second = mol->start;
     549      while ((second->next != mol->end)) {
     550        second = second->next; // advance
     551        Z = second->type->Z;
     552        tmp1 = 0.;
     553        if (first != second) {
     554          x.CopyVector((const Vector *)&first->x);
     555          x.SubtractVector((const Vector *)&second->x);
     556          tmp1 = x.Norm();
     557        }
     558        if ((tmp1 != 0.) && ((min[Z] == 0.) || (tmp1 < min[Z]))) min[Z] = tmp1;
     559        //Log() << Verbose(0) << "Bond length between Atom " << first->nr << " and " << second->nr << ": " << tmp1 << " a.u." << endl;
     560      }
     561      for (int i=MAX_ELEMENTS;i--;)
     562        if (min[i] != 0.) Log() << Verbose(0) << "Minimum Bond length between " << first->type->name << " Atom " << first->nr << " and next Ion of type " << (periode->FindElement(i))->name << ": " << min[i] << " a.u." << endl;
     563      break;
     564
     565    case 'b':
     566      first = mol->AskAtom("Enter first atom: ");
     567      second = mol->AskAtom("Enter second atom: ");
     568      for (int i=NDIM;i--;)
     569        min[i] = 0.;
     570      x.CopyVector((const Vector *)&first->x);
     571      x.SubtractVector((const Vector *)&second->x);
     572      tmp1 = x.Norm();
     573      Log() << Verbose(1) << "Distance vector is ";
     574      x.Output();
     575      Log() << Verbose(0) << "." << endl << "Norm of distance is " << tmp1 << "." << endl;
     576      break;
     577
     578    case 'c':
     579      Log() << Verbose(0) << "Evaluating bond angle between three - first, central, last - atoms." << endl;
     580      first = mol->AskAtom("Enter first atom: ");
     581      second = mol->AskAtom("Enter central atom: ");
     582      third  = mol->AskAtom("Enter last atom: ");
     583      tmp1 = tmp2 = tmp3 = 0.;
     584      x.CopyVector((const Vector *)&first->x);
     585      x.SubtractVector((const Vector *)&second->x);
     586      y.CopyVector((const Vector *)&third->x);
     587      y.SubtractVector((const Vector *)&second->x);
     588      Log() << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": ";
     589      Log() << Verbose(0) << (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl;
     590      break;
     591    case 'd':
     592      Log() << Verbose(0) << "Evaluating prinicipal axis." << endl;
     593      Log() << Verbose(0) << "Shall we rotate? [0/1]: ";
     594      cin >> Z;
     595      if ((Z >=0) && (Z <=1))
     596        mol->PrincipalAxisSystem((bool)Z);
     597      else
     598        mol->PrincipalAxisSystem(false);
     599      break;
     600    case 'e':
     601      {
     602        Log() << Verbose(0) << "Evaluating volume of the convex envelope.";
     603        class Tesselation *TesselStruct = NULL;
     604        const LinkedCell *LCList = NULL;
     605        LCList = new LinkedCell(mol, 10.);
     606        FindConvexBorder(mol, TesselStruct, LCList, NULL);
     607        double clustervolume = VolumeOfConvexEnvelope(TesselStruct, configuration);
     608        Log() << Verbose(0) << "The tesselated surface area is " << clustervolume << "." << endl;\
     609        delete(LCList);
     610        delete(TesselStruct);
     611      }
     612      break;
     613    case 'f':
     614      mol->OutputTemperatureFromTrajectories((ofstream *)&cout, mol->MDSteps-1, mol->MDSteps);
     615      break;
     616    case 'g':
     617      {
     618        char filename[255];
     619        Log() << Verbose(0) << "Please enter filename: " << endl;
     620        cin >> filename;
     621        Log() << Verbose(1) << "Storing temperatures in " << filename << "." << endl;
     622        ofstream *output = new ofstream(filename, ios::trunc);
     623        if (!mol->OutputTemperatureFromTrajectories(output, 0, mol->MDSteps))
     624          Log() << Verbose(2) << "File could not be written." << endl;
     625        else
     626          Log() << Verbose(2) << "File stored." << endl;
     627        output->close();
     628        delete(output);
     629      }
     630      break;
     631  }
     632};
     633
     634/** Submenu for measuring out the atoms in the molecule.
     635 * \param *mol molecule with all the atoms
     636 * \param *configuration configuration structure for the to be written config files of all fragments
     637 */
     638static void FragmentAtoms(molecule *mol, config *configuration)
     639{
     640  int Order1;
     641  clock_t start, end;
     642
     643  Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl;
     644  Log() << Verbose(0) << "What's the desired bond order: ";
     645  cin >> Order1;
     646  if (mol->first->next != mol->last) {  // there are bonds
     647    start = clock();
     648    mol->FragmentMolecule(Order1, configuration);
     649    end = clock();
     650    Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
     651  } else
     652    Log() << Verbose(0) << "Connection matrix has not yet been generated!" << endl;
     653};
     654
     655/********************************************** Submenu routine **************************************/
     656
     657/** Submenu for manipulating atoms.
     658 * \param *periode periodentafel
     659 * \param *molecules list of molecules whose atoms are to be manipulated
     660 */
     661static void ManipulateAtoms(periodentafel *periode, MoleculeListClass *molecules, config *configuration)
     662{
     663  atom *first, *second;
     664  molecule *mol = NULL;
     665  Vector x,y,z,n; // coordinates for absolute point in cell volume
     666  double *factor; // unit factor if desired
     667  double bond, minBond;
     668  char choice;  // menu choice char
     669  bool valid;
     670
     671  Log() << Verbose(0) << "=========MANIPULATE ATOMS======================" << endl;
     672  Log() << Verbose(0) << "a - add an atom" << endl;
     673  Log() << Verbose(0) << "r - remove an atom" << endl;
     674  Log() << Verbose(0) << "b - scale a bond between atoms" << endl;
     675  Log() << Verbose(0) << "u - change an atoms element" << endl;
     676  Log() << Verbose(0) << "l - measure lengths, angles, ... for an atom" << endl;
     677  Log() << Verbose(0) << "all else - go back" << endl;
     678  Log() << Verbose(0) << "===============================================" << endl;
     679  if (molecules->NumberOfActiveMolecules() > 1)
     680    eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl;
     681  Log() << Verbose(0) << "INPUT: ";
     682  cin >> choice;
     683
     684  switch (choice) {
     685    default:
     686      Log() << Verbose(0) << "Not a valid choice." << endl;
     687      break;
     688
     689    case 'a': // add atom
     690      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     691        if ((*ListRunner)->ActiveFlag) {
     692        mol = *ListRunner;
     693        Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     694        AddAtoms(periode, mol);
     695      }
     696      break;
     697
     698    case 'b': // scale a bond
     699      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     700        if ((*ListRunner)->ActiveFlag) {
     701        mol = *ListRunner;
     702        Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     703        Log() << Verbose(0) << "Scaling bond length between two atoms." << endl;
     704        first = mol->AskAtom("Enter first (fixed) atom: ");
     705        second = mol->AskAtom("Enter second (shifting) atom: ");
     706        minBond = 0.;
     707        for (int i=NDIM;i--;)
     708          minBond += (first->x.x[i]-second->x.x[i])*(first->x.x[i] - second->x.x[i]);
     709        minBond = sqrt(minBond);
     710        Log() << Verbose(0) << "Current Bond length between " << first->type->name << " Atom " << first->nr << " and " << second->type->name << " Atom " << second->nr << ": " << minBond << " a.u." << endl;
     711        Log() << Verbose(0) << "Enter new bond length [a.u.]: ";
     712        cin >> bond;
     713        for (int i=NDIM;i--;) {
     714          second->x.x[i] -= (second->x.x[i]-first->x.x[i])/minBond*(minBond-bond);
     715        }
     716        //Log() << Verbose(0) << "New coordinates of Atom " << second->nr << " are: ";
     717        //second->Output(second->type->No, 1);
     718      }
     719      break;
     720
     721    case 'c': // unit scaling of the metric
     722      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     723        if ((*ListRunner)->ActiveFlag) {
     724        mol = *ListRunner;
     725        Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     726       Log() << Verbose(0) << "Angstroem -> Bohrradius: 1.8897261\t\tBohrradius -> Angstroem: 0.52917721" << endl;
     727       Log() << Verbose(0) << "Enter three factors: ";
     728       factor = new double[NDIM];
     729       cin >> factor[0];
     730       cin >> factor[1];
     731       cin >> factor[2];
     732       valid = true;
     733       mol->Scale((const double ** const)&factor);
     734       delete[](factor);
     735      }
     736     break;
     737
     738    case 'l': // measure distances or angles
     739      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     740        if ((*ListRunner)->ActiveFlag) {
     741        mol = *ListRunner;
     742        Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     743        MeasureAtoms(periode, mol, configuration);
     744      }
     745      break;
     746
     747    case 'r': // remove atom
     748      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     749        if ((*ListRunner)->ActiveFlag) {
     750        mol = *ListRunner;
     751        Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     752        RemoveAtoms(mol);
     753      }
     754      break;
     755
     756    case 'u': // change an atom's element
     757      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     758        if ((*ListRunner)->ActiveFlag) {
     759        int Z;
     760        mol = *ListRunner;
     761        Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     762        first = NULL;
     763        do {
     764          Log() << Verbose(0) << "Change the element of which atom: ";
     765          cin >> Z;
     766        } while ((first = mol->FindAtom(Z)) == NULL);
     767        Log() << Verbose(0) << "New element by atomic number Z: ";
     768        cin >> Z;
     769        first->type = periode->FindElement(Z);
     770        Log() << Verbose(0) << "Atom " << first->nr << "'s element is " << first->type->name << "." << endl;
     771      }
     772      break;
     773  }
     774};
     775
     776/** Submenu for manipulating molecules.
     777 * \param *periode periodentafel
     778 * \param *molecules list of molecule to manipulate
     779 */
     780static void ManipulateMolecules(periodentafel *periode, MoleculeListClass *molecules, config *configuration)
     781{
     782  atom *first = NULL;
     783  Vector x,y,z,n; // coordinates for absolute point in cell volume
     784  int j, axis, count, faktor;
     785  char choice;  // menu choice char
     786  molecule *mol = NULL;
     787  element **Elements;
     788  Vector **vectors;
     789  MoleculeLeafClass *Subgraphs = NULL;
     790
     791  Log() << Verbose(0) << "=========MANIPULATE GLOBALLY===================" << endl;
     792  Log() << Verbose(0) << "c - scale by unit transformation" << endl;
     793  Log() << Verbose(0) << "d - duplicate molecule/periodic cell" << endl;
     794  Log() << Verbose(0) << "f - fragment molecule many-body bond order style" << endl;
     795  Log() << Verbose(0) << "g - center atoms in box" << endl;
     796  Log() << Verbose(0) << "i - realign molecule" << endl;
     797  Log() << Verbose(0) << "m - mirror all molecules" << endl;
     798  Log() << Verbose(0) << "o - create connection matrix" << endl;
     799  Log() << Verbose(0) << "t - translate molecule by vector" << endl;
     800  Log() << Verbose(0) << "all else - go back" << endl;
     801  Log() << Verbose(0) << "===============================================" << endl;
     802  if (molecules->NumberOfActiveMolecules() > 1)
     803    eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl;
     804  Log() << Verbose(0) << "INPUT: ";
     805  cin >> choice;
     806
     807  switch (choice) {
     808    default:
     809      Log() << Verbose(0) << "Not a valid choice." << endl;
     810      break;
     811
     812    case 'd': // duplicate the periodic cell along a given axis, given times
     813      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     814        if ((*ListRunner)->ActiveFlag) {
     815        mol = *ListRunner;
     816        Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     817        Log() << Verbose(0) << "State the axis [(+-)123]: ";
     818        cin >> axis;
     819        Log() << Verbose(0) << "State the factor: ";
     820        cin >> faktor;
     821
     822        mol->CountAtoms(); // recount atoms
     823        if (mol->AtomCount != 0) {  // if there is more than none
     824          count = mol->AtomCount;  // is changed becausing of adding, thus has to be stored away beforehand
     825          Elements = new element *[count];
     826          vectors = new Vector *[count];
     827          j = 0;
     828          first = mol->start;
     829          while (first->next != mol->end) { // make a list of all atoms with coordinates and element
     830            first = first->next;
     831            Elements[j] = first->type;
     832            vectors[j] = &first->x;
     833            j++;
     834          }
     835          if (count != j)
     836            eLog() << Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl;
     837          x.Zero();
     838          y.Zero();
     839          y.x[abs(axis)-1] = mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude
     840          for (int i=1;i<faktor;i++) {  // then add this list with respective translation factor times
     841            x.AddVector(&y); // per factor one cell width further
     842            for (int k=count;k--;) { // go through every atom of the original cell
     843              first = new atom(); // create a new body
     844              first->x.CopyVector(vectors[k]);  // use coordinate of original atom
     845              first->x.AddVector(&x);     // translate the coordinates
     846              first->type = Elements[k];  // insert original element
     847              mol->AddAtom(first);        // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...)
     848            }
     849          }
     850          if (mol->first->next != mol->last) // if connect matrix is present already, redo it
     851            mol->CreateAdjacencyList(mol->BondDistance, configuration->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
     852          // free memory
     853          delete[](Elements);
     854          delete[](vectors);
     855          // correct cell size
     856          if (axis < 0) { // if sign was negative, we have to translate everything
     857            x.Zero();
     858            x.AddVector(&y);
     859            x.Scale(-(faktor-1));
     860            mol->Translate(&x);
     861          }
     862          mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;
     863        }
     864      }
     865      break;
     866
     867    case 'f':
     868      FragmentAtoms(mol, configuration);
     869      break;
     870
     871    case 'g': // center the atoms
     872      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     873        if ((*ListRunner)->ActiveFlag) {
     874        mol = *ListRunner;
     875        Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     876        CenterAtoms(mol);
     877      }
     878      break;
     879
     880    case 'i': // align all atoms
     881      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     882        if ((*ListRunner)->ActiveFlag) {
     883        mol = *ListRunner;
     884        Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     885        AlignAtoms(periode, mol);
     886      }
     887      break;
     888
     889    case 'm': // mirror atoms along a given axis
     890      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     891        if ((*ListRunner)->ActiveFlag) {
     892        mol = *ListRunner;
     893        Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     894        MirrorAtoms(mol);
     895      }
     896      break;
     897
     898    case 'o': // create the connection matrix
     899      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     900        if ((*ListRunner)->ActiveFlag) {
     901          mol = *ListRunner;
     902          double bonddistance;
     903          clock_t start,end;
     904          Log() << Verbose(0) << "What's the maximum bond distance: ";
     905          cin >> bonddistance;
     906          start = clock();
     907          mol->CreateAdjacencyList(bonddistance, configuration->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
     908          end = clock();
     909          Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
     910        }
     911      break;
     912
     913    case 't': // translate all atoms
     914      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     915        if ((*ListRunner)->ActiveFlag) {
     916        mol = *ListRunner;
     917        Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     918        Log() << Verbose(0) << "Enter translation vector." << endl;
     919        x.AskPosition(mol->cell_size,0);
     920        mol->Center.AddVector((const Vector *)&x);
     921     }
     922     break;
     923  }
     924  // Free all
     925  if (Subgraphs != NULL) {  // free disconnected subgraph list of DFS analysis was performed
     926    while (Subgraphs->next != NULL) {
     927      Subgraphs = Subgraphs->next;
     928      delete(Subgraphs->previous);
     929    }
     930    delete(Subgraphs);
     931  }
     932};
     933
     934
     935/** Submenu for creating new molecules.
     936 * \param *periode periodentafel
     937 * \param *molecules list of molecules to add to
     938 */
     939static void EditMolecules(periodentafel *periode, MoleculeListClass *molecules)
     940{
     941  char choice;  // menu choice char
     942  Vector center;
     943  int nr, count;
     944  molecule *mol = NULL;
     945
     946  Log() << Verbose(0) << "==========EDIT MOLECULES=====================" << endl;
     947  Log() << Verbose(0) << "c - create new molecule" << endl;
     948  Log() << Verbose(0) << "l - load molecule from xyz file" << endl;
     949  Log() << Verbose(0) << "n - change molecule's name" << endl;
     950  Log() << Verbose(0) << "N - give molecules filename" << endl;
     951  Log() << Verbose(0) << "p - parse atoms in xyz file into molecule" << endl;
     952  Log() << Verbose(0) << "r - remove a molecule" << endl;
     953  Log() << Verbose(0) << "all else - go back" << endl;
     954  Log() << Verbose(0) << "===============================================" << endl;
     955  Log() << Verbose(0) << "INPUT: ";
     956  cin >> choice;
     957
     958  switch (choice) {
     959    default:
     960      Log() << Verbose(0) << "Not a valid choice." << endl;
     961      break;
     962    case 'c':
     963      mol = new molecule(periode);
     964      molecules->insert(mol);
     965      break;
     966
     967    case 'l': // load from XYZ file
     968      {
     969        char filename[MAXSTRINGSIZE];
     970        Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;
     971        mol = new molecule(periode);
     972        do {
     973          Log() << Verbose(0) << "Enter file name: ";
     974          cin >> filename;
     975        } while (!mol->AddXYZFile(filename));
     976        mol->SetNameFromFilename(filename);
     977        // center at set box dimensions
     978        mol->CenterEdge(&center);
     979        mol->cell_size[0] = center.x[0];
     980        mol->cell_size[1] = 0;
     981        mol->cell_size[2] = center.x[1];
     982        mol->cell_size[3] = 0;
     983        mol->cell_size[4] = 0;
     984        mol->cell_size[5] = center.x[2];
     985        molecules->insert(mol);
     986      }
     987      break;
     988
     989    case 'n':
     990      {
     991        char filename[MAXSTRINGSIZE];
     992        do {
     993          Log() << Verbose(0) << "Enter index of molecule: ";
     994          cin >> nr;
     995          mol = molecules->ReturnIndex(nr);
     996        } while (mol == NULL);
     997        Log() << Verbose(0) << "Enter name: ";
     998        cin >> filename;
     999        strcpy(mol->name, filename);
     1000      }
     1001      break;
     1002
     1003    case 'N':
     1004      {
     1005        char filename[MAXSTRINGSIZE];
     1006        do {
     1007          Log() << Verbose(0) << "Enter index of molecule: ";
     1008          cin >> nr;
     1009          mol = molecules->ReturnIndex(nr);
     1010        } while (mol == NULL);
     1011        Log() << Verbose(0) << "Enter name: ";
     1012        cin >> filename;
     1013        mol->SetNameFromFilename(filename);
     1014      }
     1015      break;
     1016
     1017    case 'p': // parse XYZ file
     1018      {
     1019        char filename[MAXSTRINGSIZE];
     1020        mol = NULL;
     1021        do {
     1022          Log() << Verbose(0) << "Enter index of molecule: ";
     1023          cin >> nr;
     1024          mol = molecules->ReturnIndex(nr);
     1025        } while (mol == NULL);
     1026        Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;
     1027        do {
     1028          Log() << Verbose(0) << "Enter file name: ";
     1029          cin >> filename;
     1030        } while (!mol->AddXYZFile(filename));
     1031        mol->SetNameFromFilename(filename);
     1032      }
     1033      break;
     1034
     1035    case 'r':
     1036      Log() << Verbose(0) << "Enter index of molecule: ";
     1037      cin >> nr;
     1038      count = 1;
     1039      for(MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     1040        if (nr == (*ListRunner)->IndexNr) {
     1041          mol = *ListRunner;
     1042          molecules->ListOfMolecules.erase(ListRunner);
     1043          delete(mol);
     1044          break;
     1045        }
     1046      break;
     1047  }
     1048};
     1049
     1050
     1051/** Submenu for merging molecules.
     1052 * \param *periode periodentafel
     1053 * \param *molecules list of molecules to add to
     1054 */
     1055static void MergeMolecules(periodentafel *periode, MoleculeListClass *molecules)
     1056{
     1057  char choice;  // menu choice char
     1058
     1059  Log() << Verbose(0) << "===========MERGE MOLECULES=====================" << endl;
     1060  Log() << Verbose(0) << "a - simple add of one molecule to another" << endl;
     1061  Log() << Verbose(0) << "e - embedding merge of two molecules" << endl;
     1062  Log() << Verbose(0) << "m - multi-merge of all molecules" << endl;
     1063  Log() << Verbose(0) << "s - scatter merge of two molecules" << endl;
     1064  Log() << Verbose(0) << "t - simple merge of two molecules" << endl;
     1065  Log() << Verbose(0) << "all else - go back" << endl;
     1066  Log() << Verbose(0) << "===============================================" << endl;
     1067  Log() << Verbose(0) << "INPUT: ";
     1068  cin >> choice;
     1069
     1070  switch (choice) {
     1071    default:
     1072      Log() << Verbose(0) << "Not a valid choice." << endl;
     1073      break;
     1074
     1075    case 'a':
     1076      {
     1077        int src, dest;
     1078        molecule *srcmol = NULL, *destmol = NULL;
     1079        {
     1080          do {
     1081            Log() << Verbose(0) << "Enter index of destination molecule: ";
     1082            cin >> dest;
     1083            destmol = molecules->ReturnIndex(dest);
     1084          } while ((destmol == NULL) && (dest != -1));
     1085          do {
     1086            Log() << Verbose(0) << "Enter index of source molecule to add from: ";
     1087            cin >> src;
     1088            srcmol = molecules->ReturnIndex(src);
     1089          } while ((srcmol == NULL) && (src != -1));
     1090          if ((src != -1) && (dest != -1))
     1091            molecules->SimpleAdd(srcmol, destmol);
     1092        }
     1093      }
     1094      break;
     1095
     1096    case 'e':
     1097      {
     1098        int src, dest;
     1099        molecule *srcmol = NULL, *destmol = NULL;
     1100        do {
     1101          Log() << Verbose(0) << "Enter index of matrix molecule (the variable one): ";
     1102          cin >> src;
     1103          srcmol = molecules->ReturnIndex(src);
     1104        } while ((srcmol == NULL) && (src != -1));
     1105        do {
     1106          Log() << Verbose(0) << "Enter index of molecule to merge into (the fixed one): ";
     1107          cin >> dest;
     1108          destmol = molecules->ReturnIndex(dest);
     1109        } while ((destmol == NULL) && (dest != -1));
     1110        if ((src != -1) && (dest != -1))
     1111          molecules->EmbedMerge(destmol, srcmol);
     1112      }
     1113      break;
     1114
     1115    case 'm':
     1116      {
     1117        int nr;
     1118        molecule *mol = NULL;
     1119        do {
     1120          Log() << Verbose(0) << "Enter index of molecule to merge into: ";
     1121          cin >> nr;
     1122          mol = molecules->ReturnIndex(nr);
     1123        } while ((mol == NULL) && (nr != -1));
     1124        if (nr != -1) {
     1125          int N = molecules->ListOfMolecules.size()-1;
     1126          int *src = new int(N);
     1127          for(MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     1128            if ((*ListRunner)->IndexNr != nr)
     1129              src[N++] = (*ListRunner)->IndexNr;       
     1130          molecules->SimpleMultiMerge(mol, src, N);
     1131          delete[](src);
     1132        }
     1133      }
     1134      break;
     1135
     1136    case 's':
     1137      Log() << Verbose(0) << "Not implemented yet." << endl;
     1138      break;
     1139
     1140    case 't':
     1141      {
     1142        int src, dest;
     1143        molecule *srcmol = NULL, *destmol = NULL;
     1144        {
     1145          do {
     1146            Log() << Verbose(0) << "Enter index of destination molecule: ";
     1147            cin >> dest;
     1148            destmol = molecules->ReturnIndex(dest);
     1149          } while ((destmol == NULL) && (dest != -1));
     1150          do {
     1151            Log() << Verbose(0) << "Enter index of source molecule to merge into: ";
     1152            cin >> src;
     1153            srcmol = molecules->ReturnIndex(src);
     1154          } while ((srcmol == NULL) && (src != -1));
     1155          if ((src != -1) && (dest != -1))
     1156            molecules->SimpleMerge(srcmol, destmol);
     1157        }
     1158      }
     1159      break;
     1160  }
     1161};
     1162
     1163/********************************************** Test routine **************************************/
     1164
     1165/** Is called always as option 'T' in the menu.
     1166 * \param *molecules list of molecules
     1167 */
     1168static void testroutine(MoleculeListClass *molecules)
     1169{
     1170  // the current test routine checks the functionality of the KeySet&Graph concept:
     1171  // We want to have a multiindex (the KeySet) describing a unique subgraph
     1172  int i, comp, counter=0;
     1173
     1174  // create a clone
     1175  molecule *mol = NULL;
     1176  if (molecules->ListOfMolecules.size() != 0) // clone
     1177    mol = (molecules->ListOfMolecules.front())->CopyMolecule();
     1178  else {
     1179    eLog() << Verbose(0) << "I don't have anything to test on ... ";
     1180    performCriticalExit();
     1181    return;
     1182  }
     1183  atom *Walker = mol->start;
     1184
     1185  // generate some KeySets
     1186  Log() << Verbose(0) << "Generating KeySets." << endl;
     1187  KeySet TestSets[mol->AtomCount+1];
     1188  i=1;
     1189  while (Walker->next != mol->end) {
     1190    Walker = Walker->next;
     1191    for (int j=0;j<i;j++) {
     1192      TestSets[j].insert(Walker->nr);
     1193    }
     1194    i++;
     1195  }
     1196  Log() << Verbose(0) << "Testing insertion of already present item in KeySets." << endl;
     1197  KeySetTestPair test;
     1198  test = TestSets[mol->AtomCount-1].insert(Walker->nr);
     1199  if (test.second) {
     1200    Log() << Verbose(1) << "Insertion worked?!" << endl;
     1201  } else {
     1202    Log() << Verbose(1) << "Insertion rejected: Present object is " << (*test.first) << "." << endl;
     1203  }
     1204  TestSets[mol->AtomCount].insert(mol->end->previous->nr);
     1205  TestSets[mol->AtomCount].insert(mol->end->previous->previous->previous->nr);
     1206
     1207  // constructing Graph structure
     1208  Log() << Verbose(0) << "Generating Subgraph class." << endl;
     1209  Graph Subgraphs;
     1210
     1211  // insert KeySets into Subgraphs
     1212  Log() << Verbose(0) << "Inserting KeySets into Subgraph class." << endl;
     1213  for (int j=0;j<mol->AtomCount;j++) {
     1214    Subgraphs.insert(GraphPair (TestSets[j],pair<int, double>(counter++, 1.)));
     1215  }
     1216  Log() << Verbose(0) << "Testing insertion of already present item in Subgraph." << endl;
     1217  GraphTestPair test2;
     1218  test2 = Subgraphs.insert(GraphPair (TestSets[mol->AtomCount],pair<int, double>(counter++, 1.)));
     1219  if (test2.second) {
     1220    Log() << Verbose(1) << "Insertion worked?!" << endl;
     1221  } else {
     1222    Log() << Verbose(1) << "Insertion rejected: Present object is " << (*(test2.first)).second.first << "." << endl;
     1223  }
     1224
     1225  // show graphs
     1226  Log() << Verbose(0) << "Showing Subgraph's contents, checking that it's sorted." << endl;
     1227  Graph::iterator A = Subgraphs.begin();
     1228  while (A !=  Subgraphs.end()) {
     1229    Log() << Verbose(0) << (*A).second.first << ": ";
     1230    KeySet::iterator key = (*A).first.begin();
     1231    comp = -1;
     1232    while (key != (*A).first.end()) {
     1233      if ((*key) > comp)
     1234        Log() << Verbose(0) << (*key) << " ";
     1235      else
     1236        Log() << Verbose(0) << (*key) << "! ";
     1237      comp = (*key);
     1238      key++;
     1239    }
     1240    Log() << Verbose(0) << endl;
     1241    A++;
     1242  }
     1243  delete(mol);
     1244};
     1245
     1246#endif
    761247
    771248/** Parses the command line options.
     
    1021273  int argptr;
    1031274  molecule *mol = NULL;
    104   string BondGraphFileName("");
     1275  string BondGraphFileName("\n");
    1051276  int verbosity = 0;
    1061277  strncpy(configuration.databasepath, LocalPath, MAXSTRINGSIZE-1);
     
    2561427       mol = new molecule(periode);
    2571428       mol->ActiveFlag = true;
     1429       if (ConfigFileName != NULL)
     1430         mol->SetNameFromFilename(ConfigFileName);
    2581431       molecules->insert(mol);
     1432     }
     1433     if (configuration.BG == NULL) {
     1434       configuration.BG = new BondGraph(configuration.GetIsAngstroem());
     1435       if ((BondGraphFileName.empty()) && (configuration.BG->LoadBondLengthTable(BondGraphFileName))) {
     1436         Log() << Verbose(0) << "Bond length table loaded successfully." << endl;
     1437       } else {
     1438         eLog() << Verbose(1) << "Bond length table loading failed." << endl;
     1439       }
    2591440     }
    2601441
     
    2801461                else {
    2811462                  Log() << Verbose(2) << "File found and parsed." << endl;
     1463                  // @TODO rather do the dissection afterwards
     1464//                  mol->SetNameFromFilename(argv[argptr]);
     1465//                  molecules->ListOfMolecules.remove(mol);
     1466//                  molecules->DissectMoleculeIntoConnectedSubgraphs(mol,&configuration);
     1467//                  delete(mol);
     1468//                  if (molecules->ListOfMolecules.size() != 0) {
     1469//                    for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     1470//                      if ((*ListRunner)->ActiveFlag) {
     1471//                        mol = *ListRunner;
     1472//                        break;
     1473//                      }
     1474//                  }
    2821475                  configPresent = present;
    2831476                }
     
    4981691                start = clock();
    4991692                LCList = new LinkedCell(Boundary, atof(argv[argptr])*2.);
    500                 FindNonConvexBorder(Boundary, T, LCList, atof(argv[argptr]), argv[argptr+1]);
     1693                if (!FindNonConvexBorder(Boundary, T, LCList, atof(argv[argptr]), argv[argptr+1]))
     1694                  ExitFlag = 255;
    5011695                //FindDistributionOfEllipsoids(T, &LCList, N, number, filename.c_str());
    5021696                end = clock();
    5031697                Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
    5041698                delete(LCList);
     1699                delete(T);
    5051700                argptr+=2;
    5061701              }
     
    7981993                if (volume != -1)
    7991994                  ExitFlag = 255;
    800                   eLog() << Verbose(0) << "Not enough arguments given for suspension: -u <density>" << endl;
     1995                  eLog() << Verbose(0) << "Not enough or invalid arguments given for suspension: -u <density>" << endl;
    8011996                  performCriticalExit();
    8021997              } else {
     
    9702165
    9712166    {
     2167      cout << ESPACKVersion << endl;
     2168
     2169      setVerbosity(0);
     2170
    9722171      menuPopulaters populaters;
    9732172      populaters.MakeEditMoleculesMenu = populateEditMoleculesMenu;
  • src/config.cpp

    r8927ae r1ca488  
    140140void ConfigFileBuffer::MapIonTypesInBuffer(const int NoAtoms)
    141141{
    142   map<const char *, int, IonTypeCompare> LineList;
     142  map<const char *, int, IonTypeCompare> IonTypeLineMap;
    143143  if (LineMapping == NULL) {
    144144    eLog() << Verbose(0) << "map pointer is NULL: " << LineMapping << endl;
     
    149149  // put all into hashed map
    150150  for (int i=0; i<NoAtoms; ++i) {
    151     LineList.insert(pair<const char *, int> (buffer[CurrentLine+i], CurrentLine+i));
     151    IonTypeLineMap.insert(pair<const char *, int> (buffer[CurrentLine+i], CurrentLine+i));
    152152  }
    153153
    154154  // fill map
    155155  int nr=0;
    156   for (map<const char *, int, IonTypeCompare>::iterator runner = LineList.begin(); runner != LineList.end(); ++runner) {
     156  for (map<const char *, int, IonTypeCompare>::iterator runner = IonTypeLineMap.begin(); runner != IonTypeLineMap.end(); ++runner) {
    157157    if (CurrentLine+nr < NoLines)
    158158      LineMapping[CurrentLine+(nr++)] = runner->second;
     
    10561056
    10571057  // 2. parse the bond graph file if given
    1058   BG = new BondGraph(IsAngstroem);
    1059   if (BG->LoadBondLengthTable(BondGraphFileName)) {
    1060     Log() << Verbose(0) << "Bond length table loaded successfully." << endl;
    1061   } else {
    1062     eLog() << Verbose(1) << "Bond length table loading failed." << endl;
     1058  if (BG == NULL) {
     1059    BG = new BondGraph(IsAngstroem);
     1060    if (BG->LoadBondLengthTable(BondGraphFileName)) {
     1061      Log() << Verbose(0) << "Bond length table loaded successfully." << endl;
     1062    } else {
     1063      eLog() << Verbose(1) << "Bond length table loading failed." << endl;
     1064    }
    10631065  }
    10641066
    10651067  // 3. parse the molecule in
    10661068  LoadMolecule(mol, FileBuffer, periode, FastParsing);
     1069  mol->SetNameFromFilename(filename);
    10671070  mol->ActiveFlag = true;
     1071  MolList->insert(mol);
    10681072
    10691073  // 4. dissect the molecule into connected subgraphs
    1070   MolList->DissectMoleculeIntoConnectedSubgraphs(mol,this);
    1071 
    1072   delete(mol);
     1074  // don't do this here ...
     1075  //MolList->DissectMoleculeIntoConnectedSubgraphs(mol,this);
     1076  //delete(mol);
     1077
    10731078  delete(FileBuffer);
    10741079};
     
    17821787  ofstream output;
    17831788  molecule *mol = new molecule(periode);
    1784 
    1785   if (!strcmp(configpath, GetDefaultPath())) {
     1789  mol->SetNameFromFilename(ConfigFileName);
     1790
     1791  if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) {
    17861792    eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl;
    17871793  }
     
    17911797  if (ConfigFileName != NULL)
    17921798    strcpy(filename, ConfigFileName);
    1793   else
     1799  if (output == NULL)
    17941800    strcpy(filename,"main_pcp_linux");
    17951801  Log() << Verbose(0) << "Saving as pdb input ";
    1796   if (SavePDB(filename, molecules))
     1802  if (configuration->SavePDB(filename, molecules))
    17971803    Log() << Verbose(0) << "done." << endl;
    17981804  else
     
    18021808  if (ConfigFileName != NULL)
    18031809    strcpy(filename, ConfigFileName);
    1804   else
     1810  if (output == NULL)
    18051811    strcpy(filename,"main_pcp_linux");
    18061812  Log() << Verbose(0) << "Saving as tremolo data input ";
    1807   if (SaveTREMOLO(filename, molecules))
     1813  if (configuration->SaveTREMOLO(filename, molecules))
    18081814    Log() << Verbose(0) << "done." << endl;
    18091815  else
     
    18301836  Log() << Verbose(0) << "Storing configuration ... " << endl;
    18311837  // get correct valence orbitals
    1832   mol->CalculateOrbitals(*this);
    1833   InitMaxMinStopStep = MaxMinStopStep = MaxPsiDouble;
     1838  mol->CalculateOrbitals(*configuration);
     1839  configuration->InitMaxMinStopStep = configuration->MaxMinStopStep = configuration->MaxPsiDouble;
    18341840  if (ConfigFileName != NULL) { // test the file name
    18351841    strcpy(filename, ConfigFileName);
    18361842    output.open(filename, ios::trunc);
    1837   } else if (strlen(configname) != 0) {
    1838     strcpy(filename, configname);
    1839     output.open(configname, ios::trunc);
     1843  } else if (strlen(configuration->configname) != 0) {
     1844    strcpy(filename, configuration->configname);
     1845    output.open(configuration->configname, ios::trunc);
    18401846    } else {
    18411847      strcpy(filename, DEFAULTCONFIG);
     
    18451851  output.clear();
    18461852  Log() << Verbose(0) << "Saving of config file ";
    1847   if (Save(filename, periode, mol))
     1853  if (configuration->Save(filename, periode, mol))
    18481854    Log() << Verbose(0) << "successful." << endl;
    18491855  else
     
    18561862    output.open(filename, ios::trunc);
    18571863  }
    1858   else {
     1864  if (output == NULL) {
    18591865    strcpy(filename,"main_pcp_linux");
    18601866    strcat(filename, ".xyz");
     
    18791885  if (ConfigFileName != NULL)
    18801886    strcpy(filename, ConfigFileName);
    1881   else
     1887  if (output == NULL)
    18821888    strcpy(filename,"main_pcp_linux");
    18831889  Log() << Verbose(0) << "Saving as mpqc input ";
    1884   if (SaveMPQC(filename, mol))
     1890  if (configuration->SaveMPQC(filename, mol))
    18851891    Log() << Verbose(0) << "done." << endl;
    18861892  else
    18871893    Log() << Verbose(0) << "failed." << endl;
    18881894
    1889   if (!strcmp(configpath, GetDefaultPath())) {
     1895  if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) {
    18901896    eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl;
    18911897  }
  • src/molecule.hpp

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

    r8927ae r1ca488  
    11171117  bool status = true;
    11181118  if (ReferenceStack->IsEmpty()) {
    1119     eLog() << Verbose(0) << "ReferenceStack is empty!" << endl;
    1120     performCriticalExit();
     1119    Log() << Verbose(1) << "ReferenceStack is empty!" << endl;
    11211120    return false;
    11221121  }
  • src/molecule_pointcloud.cpp

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

    r8927ae r1ca488  
    402402  input.open(line.c_str());
    403403  if (input == NULL) {
    404     eLog() << Verbose(0) << endl << "Unable to open " << line << ", is the directory correct?" << endl;
    405     performCriticalExit();
     404    Log() << Verbose(1) << endl << "Unable to open " << line << ", is the directory correct?" << endl;
    406405    return false;
    407406  }
     
    760759  // 4a. create array of molecules to fill
    761760  const int MolCount = Subgraphs->next->Count();
     761  char number[MAXSTRINGSIZE];
    762762  molecule **molecules = Malloc<molecule *>(MolCount, "config::Load() - **molecules");
    763763  for (int i=0;i<MolCount;i++) {
    764764    molecules[i] = (molecule*) new molecule(mol->elemente);
    765765    molecules[i]->ActiveFlag = true;
     766    strncpy(molecules[i]->name, mol->name, MAXSTRINGSIZE);
     767    if (MolCount > 1) {
     768      sprintf(number, "-%d", i+1);
     769      strncat(molecules[i]->name, number, MAXSTRINGSIZE - strlen(mol->name) - 1);
     770    }
     771    cout << "MolName is " << molecules[i]->name << endl;
    766772    insert(molecules[i]);
    767773  }
     
    800806    }
    801807  }
    802   // 4d. we don't need to redo bonds, as they are connected subgraphs and still maintained their ListOfBonds, but we have to remove them from first..last list
     808  // 4d. we don't need to redo bonds, as they are connected subgraphs and still maintain their ListOfBonds, but we have to remove them from first..last list
    803809  bond *Binder = mol->first;
    804810  while (mol->first->next != mol->last) {
  • src/parser.cpp

    r8927ae r1ca488  
    158158  //Log() << Verbose(0) << "Opening " << name << " ... "  << input << endl;
    159159  if (input == NULL) {
    160     eLog() << Verbose(0) << endl << "Unable to open " << name << ", is the directory correct?" << endl;
    161     performCriticalExit();
     160    eLog() << Verbose(1) << endl << "Unable to open " << name << ", is the directory correct?" << endl;
     161    //performCriticalExit();
    162162    return false;
    163163  }
  • src/tesselation.cpp

    r8927ae r1ca488  
    99
    1010#include "helpers.hpp"
     11#include "info.hpp"
    1112#include "linkedcell.hpp"
    1213#include "log.hpp"
     
    2223/** Constructor of BoundaryPointSet.
    2324 */
    24 BoundaryPointSet::BoundaryPointSet()
    25 {
    26   LinesCount = 0;
    27   Nr = -1;
    28   value = 0.;
     25BoundaryPointSet::BoundaryPointSet() :
     26    LinesCount(0),
     27    value(0.),
     28    Nr(-1)
     29{
     30        Info FunctionInfo(__func__);
     31        Log() << Verbose(1) << "Adding noname." << endl;
    2932};
    3033
     
    3235 * \param *Walker TesselPoint this boundary point represents
    3336 */
    34 BoundaryPointSet::BoundaryPointSet(TesselPoint * Walker)
    35 {
    36   node = Walker;
    37   LinesCount = 0;
    38   Nr = Walker->nr;
    39   value = 0.;
     37BoundaryPointSet::BoundaryPointSet(TesselPoint * Walker) :
     38  LinesCount(0),
     39  node(Walker),
     40  value(0.),
     41  Nr(Walker->nr)
     42{
     43        Info FunctionInfo(__func__);
     44  Log() << Verbose(1) << "Adding Node " << *Walker << endl;
    4045};
    4146
     
    4651BoundaryPointSet::~BoundaryPointSet()
    4752{
    48   //Log() << Verbose(5) << "Erasing point nr. " << Nr << "." << endl;
     53        Info FunctionInfo(__func__);
     54  //Log() << Verbose(0) << "Erasing point nr. " << Nr << "." << endl;
    4955  if (!lines.empty())
    5056    eLog() << Verbose(2) << "Memory Leak! I " << *this << " am still connected to some lines." << endl;
     
    5763void BoundaryPointSet::AddLine(class BoundaryLineSet *line)
    5864{
    59   Log() << Verbose(6) << "Adding " << *this << " to line " << *line << "."
     65        Info FunctionInfo(__func__);
     66  Log() << Verbose(1) << "Adding " << *this << " to line " << *line << "."
    6067      << endl;
    6168  if (line->endpoints[0] == this)
     
    8592/** Constructor of BoundaryLineSet.
    8693 */
    87 BoundaryLineSet::BoundaryLineSet()
    88 {
     94BoundaryLineSet::BoundaryLineSet() :
     95    Nr(-1)
     96{
     97        Info FunctionInfo(__func__);
    8998  for (int i = 0; i < 2; i++)
    9099    endpoints[i] = NULL;
    91   Nr = -1;
    92100};
    93101
     
    99107BoundaryLineSet::BoundaryLineSet(class BoundaryPointSet *Point[2], const int number)
    100108{
     109        Info FunctionInfo(__func__);
    101110  // set number
    102111  Nr = number;
     
    106115  Point[0]->AddLine(this); //Taken out, to check whether we can avoid unwanted double adding.
    107116  Point[1]->AddLine(this); //
     117  // set skipped to false
     118  skipped = false;
    108119  // clear triangles list
    109   Log() << Verbose(5) << "New Line with endpoints " << *this << "." << endl;
     120  Log() << Verbose(0) << "New Line with endpoints " << *this << "." << endl;
    110121};
    111122
     
    116127BoundaryLineSet::~BoundaryLineSet()
    117128{
     129        Info FunctionInfo(__func__);
    118130  int Numbers[2];
    119131
     
    134146        for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++)
    135147          if ((*Runner).second == this) {
    136             //Log() << Verbose(5) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;
     148            //Log() << Verbose(0) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;
    137149            endpoints[i]->lines.erase(Runner);
    138150            break;
     
    140152      } else { // there's just a single line left
    141153        if (endpoints[i]->lines.erase(Nr)) {
    142           //Log() << Verbose(5) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;
     154          //Log() << Verbose(0) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;
    143155        }
    144156      }
    145157      if (endpoints[i]->lines.empty()) {
    146         //Log() << Verbose(5) << *endpoints[i] << " has no more lines it's attached to, erasing." << endl;
     158        //Log() << Verbose(0) << *endpoints[i] << " has no more lines it's attached to, erasing." << endl;
    147159        if (endpoints[i] != NULL) {
    148160          delete(endpoints[i]);
     
    161173void BoundaryLineSet::AddTriangle(class BoundaryTriangleSet *triangle)
    162174{
    163   Log() << Verbose(6) << "Add " << triangle->Nr << " to line " << *this << "." << endl;
     175        Info FunctionInfo(__func__);
     176  Log() << Verbose(0) << "Add " << triangle->Nr << " to line " << *this << "." << endl;
    164177  triangles.insert(TrianglePair(triangle->Nr, triangle));
    165178};
     
    171184bool BoundaryLineSet::IsConnectedTo(class BoundaryLineSet *line)
    172185{
     186        Info FunctionInfo(__func__);
    173187  if ((endpoints[0] == line->endpoints[0]) || (endpoints[1] == line->endpoints[0]) || (endpoints[0] == line->endpoints[1]) || (endpoints[1] == line->endpoints[1]))
    174188    return true;
     
    185199bool BoundaryLineSet::CheckConvexityCriterion()
    186200{
     201        Info FunctionInfo(__func__);
    187202  Vector BaseLineCenter, BaseLineNormal, BaseLine, helper[2], NormalCheck;
    188203  // get the two triangles
    189204  if (triangles.size() != 2) {
    190     eLog() << Verbose(1) << "Baseline " << *this << " is connected to less than two triangles, Tesselation incomplete!" << endl;
     205    eLog() << Verbose(0) << "Baseline " << *this << " is connected to less than two triangles, Tesselation incomplete!" << endl;
    191206    return true;
    192207  }
    193208  // check normal vectors
    194209  // have a normal vector on the base line pointing outwards
    195   //Log() << Verbose(3) << "INFO: " << *this << " has vectors at " << *(endpoints[0]->node->node) << " and at " << *(endpoints[1]->node->node) << "." << endl;
     210  //Log() << Verbose(0) << "INFO: " << *this << " has vectors at " << *(endpoints[0]->node->node) << " and at " << *(endpoints[1]->node->node) << "." << endl;
    196211  BaseLineCenter.CopyVector(endpoints[0]->node->node);
    197212  BaseLineCenter.AddVector(endpoints[1]->node->node);
     
    199214  BaseLine.CopyVector(endpoints[0]->node->node);
    200215  BaseLine.SubtractVector(endpoints[1]->node->node);
    201   //Log() << Verbose(3) << "INFO: Baseline is " << BaseLine << " and its center is at " << BaseLineCenter << "." << endl;
     216  //Log() << Verbose(0) << "INFO: Baseline is " << BaseLine << " and its center is at " << BaseLineCenter << "." << endl;
    202217
    203218  BaseLineNormal.Zero();
     
    207222  class BoundaryPointSet *node = NULL;
    208223  for(TriangleMap::iterator runner = triangles.begin(); runner != triangles.end(); runner++) {
    209     //Log() << Verbose(3) << "INFO: NormalVector of " << *(runner->second) << " is " << runner->second->NormalVector << "." << endl;
     224    //Log() << Verbose(0) << "INFO: NormalVector of " << *(runner->second) << " is " << runner->second->NormalVector << "." << endl;
    210225    NormalCheck.AddVector(&runner->second->NormalVector);
    211226    NormalCheck.Scale(sign);
     
    214229      BaseLineNormal.CopyVector(&runner->second->NormalVector);   // yes, copy second on top of first
    215230    else {
    216       Log() << Verbose(1) << "CRITICAL: Triangle " << *runner->second << " has zero normal vector!" << endl;
    217       exit(255);
     231      eLog() << Verbose(0) << "Triangle " << *runner->second << " has zero normal vector!" << endl;
    218232    }
    219233    node = runner->second->GetThirdEndpoint(this);
    220234    if (node != NULL) {
    221       //Log() << Verbose(3) << "INFO: Third node for triangle " << *(runner->second) << " is " << *node << " at " << *(node->node->node) << "." << endl;
     235      //Log() << Verbose(0) << "INFO: Third node for triangle " << *(runner->second) << " is " << *node << " at " << *(node->node->node) << "." << endl;
    222236      helper[i].CopyVector(node->node->node);
    223237      helper[i].SubtractVector(&BaseLineCenter);
    224238      helper[i].MakeNormalVector(&BaseLine);  // we want to compare the triangle's heights' angles!
    225       //Log() << Verbose(4) << "INFO: Height vector with respect to baseline is " << helper[i] << "." << endl;
     239      //Log() << Verbose(0) << "INFO: Height vector with respect to baseline is " << helper[i] << "." << endl;
    226240      i++;
    227241    } else {
    228       //eLog() << Verbose(1) << "I cannot find third node in triangle, something's wrong." << endl;
     242      eLog() << Verbose(1) << "I cannot find third node in triangle, something's wrong." << endl;
    229243      return true;
    230244    }
    231245  }
    232   //Log() << Verbose(3) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl;
     246  //Log() << Verbose(0) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl;
    233247  if (NormalCheck.NormSquared() < MYEPSILON) {
    234     Log() << Verbose(3) << "ACCEPT: Normalvectors of both triangles are the same: convex." << endl;
     248    Log() << Verbose(0) << "ACCEPT: Normalvectors of both triangles are the same: convex." << endl;
    235249    return true;
    236250  }
     
    238252  double angle = GetAngle(helper[0], helper[1], BaseLineNormal);
    239253  if ((angle - M_PI) > -MYEPSILON) {
    240     Log() << Verbose(3) << "ACCEPT: Angle is greater than pi: convex." << endl;
     254    Log() << Verbose(0) << "ACCEPT: Angle is greater than pi: convex." << endl;
    241255    return true;
    242256  } else {
    243     Log() << Verbose(3) << "REJECT: Angle is less than pi: concave." << endl;
     257    Log() << Verbose(0) << "REJECT: Angle is less than pi: concave." << endl;
    244258    return false;
    245259  }
     
    252266bool BoundaryLineSet::ContainsBoundaryPoint(class BoundaryPointSet *point)
    253267{
     268        Info FunctionInfo(__func__);
    254269  for(int i=0;i<2;i++)
    255270    if (point == endpoints[i])
     
    264279class BoundaryPointSet *BoundaryLineSet::GetOtherEndpoint(class BoundaryPointSet *point)
    265280{
     281        Info FunctionInfo(__func__);
    266282  if (endpoints[0] == point)
    267283    return endpoints[1];
     
    286302/** Constructor for BoundaryTriangleSet.
    287303 */
    288 BoundaryTriangleSet::BoundaryTriangleSet()
    289 {
     304BoundaryTriangleSet::BoundaryTriangleSet() :
     305  Nr(-1)
     306{
     307        Info FunctionInfo(__func__);
    290308  for (int i = 0; i < 3; i++)
    291309    {
     
    293311      lines[i] = NULL;
    294312    }
    295   Nr = -1;
    296313};
    297314
     
    300317 * \param number number of triangle
    301318 */
    302 BoundaryTriangleSet::BoundaryTriangleSet(class BoundaryLineSet *line[3], int number)
    303 {
     319BoundaryTriangleSet::BoundaryTriangleSet(class BoundaryLineSet *line[3], int number) :
     320  Nr(number)
     321{
     322        Info FunctionInfo(__func__);
    304323  // set number
    305   Nr = number;
    306324  // set lines
    307   Log() << Verbose(5) << "New triangle " << Nr << ":" << endl;
    308   for (int i = 0; i < 3; i++)
    309     {
    310       lines[i] = line[i];
    311       lines[i]->AddTriangle(this);
    312     }
     325  for (int i = 0; i < 3; i++) {
     326    lines[i] = line[i];
     327    lines[i]->AddTriangle(this);
     328  }
    313329  // get ascending order of endpoints
    314   map<int, class BoundaryPointSet *> OrderMap;
     330  PointMap OrderMap;
    315331  for (int i = 0; i < 3; i++)
    316332    // for all three lines
    317     for (int j = 0; j < 2; j++)
    318       { // for both endpoints
    319         OrderMap.insert(pair<int, class BoundaryPointSet *> (
    320             line[i]->endpoints[j]->Nr, line[i]->endpoints[j]));
    321         // and we don't care whether insertion fails
    322       }
     333    for (int j = 0; j < 2; j++) { // for both endpoints
     334      OrderMap.insert(pair<int, class BoundaryPointSet *> (
     335          line[i]->endpoints[j]->Nr, line[i]->endpoints[j]));
     336      // and we don't care whether insertion fails
     337    }
    323338  // set endpoints
    324339  int Counter = 0;
    325   Log() << Verbose(6) << " with end points ";
    326   for (map<int, class BoundaryPointSet *>::iterator runner = OrderMap.begin(); runner
    327       != OrderMap.end(); runner++)
    328     {
    329       endpoints[Counter] = runner->second;
    330       Log() << Verbose(0) << " " << *endpoints[Counter];
    331       Counter++;
    332     }
    333   if (Counter < 3)
    334     {
    335       eLog() << Verbose(0) << "ERROR! We have a triangle with only two distinct endpoints!" << endl;
    336       performCriticalExit();
    337     }
    338   Log() << Verbose(0) << "." << endl;
     340  Log() << Verbose(0) << "New triangle " << Nr << " with end points: " << endl;
     341  for (PointMap::iterator runner = OrderMap.begin(); runner != OrderMap.end(); runner++) {
     342    endpoints[Counter] = runner->second;
     343    Log() << Verbose(0) << " " << *endpoints[Counter] << endl;
     344    Counter++;
     345  }
     346  if (Counter < 3) {
     347    eLog() << Verbose(0) << "We have a triangle with only two distinct endpoints!" << endl;
     348    performCriticalExit();
     349  }
    339350};
    340351
     
    345356BoundaryTriangleSet::~BoundaryTriangleSet()
    346357{
     358        Info FunctionInfo(__func__);
    347359  for (int i = 0; i < 3; i++) {
    348360    if (lines[i] != NULL) {
    349361      if (lines[i]->triangles.erase(Nr)) {
    350         //Log() << Verbose(5) << "Triangle Nr." << Nr << " erased in line " << *lines[i] << "." << endl;
     362        //Log() << Verbose(0) << "Triangle Nr." << Nr << " erased in line " << *lines[i] << "." << endl;
    351363      }
    352364      if (lines[i]->triangles.empty()) {
    353           //Log() << Verbose(5) << *lines[i] << " is no more attached to any triangle, erasing." << endl;
     365          //Log() << Verbose(0) << *lines[i] << " is no more attached to any triangle, erasing." << endl;
    354366          delete (lines[i]);
    355367          lines[i] = NULL;
     
    357369    }
    358370  }
    359   //Log() << Verbose(5) << "Erasing triangle Nr." << Nr << " itself." << endl;
     371  //Log() << Verbose(0) << "Erasing triangle Nr." << Nr << " itself." << endl;
    360372};
    361373
     
    366378void BoundaryTriangleSet::GetNormalVector(Vector &OtherVector)
    367379{
     380        Info FunctionInfo(__func__);
    368381  // get normal vector
    369382  NormalVector.MakeNormalVector(endpoints[0]->node->node, endpoints[1]->node->node, endpoints[2]->node->node);
     
    372385  if (NormalVector.ScalarProduct(&OtherVector) > 0.)
    373386    NormalVector.Scale(-1.);
     387  Log() << Verbose(1) << "Normal Vector is " << NormalVector << "." << endl;
    374388};
    375389
     
    388402bool BoundaryTriangleSet::GetIntersectionInsideTriangle(Vector *MolCenter, Vector *x, Vector *Intersection)
    389403{
     404        Info FunctionInfo(__func__);
    390405  Vector CrossPoint;
    391406  Vector helper;
    392407
    393408  if (!Intersection->GetIntersectionWithPlane(&NormalVector, endpoints[0]->node->node, MolCenter, x)) {
    394     Log() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl;
     409    eLog() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl;
    395410    return false;
    396411  }
     
    408423  } while (CrossPoint.NormSquared() < MYEPSILON);
    409424  if (i==3) {
    410     eLog() << Verbose(1) << "Could not find any cross points, something's utterly wrong here!" << endl;
    411     exit(255);
     425    eLog() << Verbose(0) << "Could not find any cross points, something's utterly wrong here!" << endl;
    412426  }
    413427  CrossPoint.SubtractVector(endpoints[i%3]->node->node);  // cross point was returned as absolute vector
     
    428442bool BoundaryTriangleSet::ContainsBoundaryLine(class BoundaryLineSet *line)
    429443{
     444        Info FunctionInfo(__func__);
    430445  for(int i=0;i<3;i++)
    431446    if (line == lines[i])
     
    440455bool BoundaryTriangleSet::ContainsBoundaryPoint(class BoundaryPointSet *point)
    441456{
     457        Info FunctionInfo(__func__);
    442458  for(int i=0;i<3;i++)
    443459    if (point == endpoints[i])
     
    452468bool BoundaryTriangleSet::ContainsBoundaryPoint(class TesselPoint *point)
    453469{
     470        Info FunctionInfo(__func__);
    454471  for(int i=0;i<3;i++)
    455472    if (point == endpoints[i]->node)
     
    464481bool BoundaryTriangleSet::IsPresentTupel(class BoundaryPointSet *Points[3])
    465482{
     483        Info FunctionInfo(__func__);
    466484  return (((endpoints[0] == Points[0])
    467485            || (endpoints[0] == Points[1])
     
    485503bool BoundaryTriangleSet::IsPresentTupel(class BoundaryTriangleSet *T)
    486504{
     505        Info FunctionInfo(__func__);
    487506  return (((endpoints[0] == T->endpoints[0])
    488507            || (endpoints[0] == T->endpoints[1])
     
    506525class BoundaryPointSet *BoundaryTriangleSet::GetThirdEndpoint(class BoundaryLineSet *line)
    507526{
     527        Info FunctionInfo(__func__);
    508528  // sanity check
    509529  if (!ContainsBoundaryLine(line))
     
    522542void BoundaryTriangleSet::GetCenter(Vector *center)
    523543{
     544        Info FunctionInfo(__func__);
    524545  center->Zero();
    525546  for(int i=0;i<3;i++)
     
    534555ostream &operator <<(ostream &ost, const BoundaryTriangleSet &a)
    535556{
    536   ost << "[" << a.Nr << "|" << a.endpoints[0]->node->Name << " at " << *a.endpoints[0]->node->node << ","
    537       << a.endpoints[1]->node->Name << " at " << *a.endpoints[1]->node->node << "," << a.endpoints[2]->node->Name << " at " << *a.endpoints[2]->node->node << "]";
     557  ost << "[" << a.Nr << "|" << a.endpoints[0]->node->Name << "," << a.endpoints[1]->node->Name << "," << a.endpoints[2]->node->Name << "]";
     558//  ost << "[" << a.Nr << "|" << a.endpoints[0]->node->Name << " at " << *a.endpoints[0]->node->node << ","
     559//      << a.endpoints[1]->node->Name << " at " << *a.endpoints[1]->node->node << "," << a.endpoints[2]->node->Name << " at " << *a.endpoints[2]->node->node << "]";
    538560  return ost;
    539561};
    540562
     563// ======================================== Polygons on Boundary =================================
     564
     565/** Constructor for BoundaryPolygonSet.
     566 */
     567BoundaryPolygonSet::BoundaryPolygonSet() :
     568  Nr(-1)
     569{
     570  Info FunctionInfo(__func__);
     571};
     572
     573/** Destructor of BoundaryPolygonSet.
     574 * Just clears endpoints.
     575 * \note When removing triangles from a class Tesselation, use RemoveTesselationTriangle()
     576 */
     577BoundaryPolygonSet::~BoundaryPolygonSet()
     578{
     579  Info FunctionInfo(__func__);
     580  endpoints.clear();
     581  Log() << Verbose(1) << "Erasing polygon Nr." << Nr << " itself." << endl;
     582};
     583
     584/** Calculates the normal vector for this triangle.
     585 * Is made unique by comparison with \a OtherVector to point in the other direction.
     586 * \param &OtherVector direction vector to make normal vector unique.
     587 * \return allocated vector in normal direction
     588 */
     589Vector * BoundaryPolygonSet::GetNormalVector(const Vector &OtherVector) const
     590{
     591  Info FunctionInfo(__func__);
     592  // get normal vector
     593  Vector TemporaryNormal;
     594  Vector *TotalNormal = new Vector;
     595  PointSet::const_iterator Runner[3];
     596  for (int i=0;i<3; i++) {
     597    Runner[i] = endpoints.begin();
     598    for (int j = 0; j<i; j++) { // go as much further
     599      Runner[i]++;
     600      if (Runner[i] == endpoints.end()) {
     601        eLog() << Verbose(0) << "There are less than three endpoints in the polygon!" << endl;
     602        performCriticalExit();
     603      }
     604    }
     605  }
     606  TotalNormal->Zero();
     607  int counter=0;
     608  for (; Runner[2] != endpoints.end(); ) {
     609    TemporaryNormal.MakeNormalVector((*Runner[0])->node->node, (*Runner[1])->node->node, (*Runner[2])->node->node);
     610    for (int i=0;i<3;i++) // increase each of them
     611      Runner[i]++;
     612    TotalNormal->AddVector(&TemporaryNormal);
     613  }
     614  TotalNormal->Scale(1./(double)counter);
     615
     616  // make it always point inward (any offset vector onto plane projected onto normal vector suffices)
     617  if (TotalNormal->ScalarProduct(&OtherVector) > 0.)
     618    TotalNormal->Scale(-1.);
     619  Log() << Verbose(1) << "Normal Vector is " << *TotalNormal << "." << endl;
     620
     621  return TotalNormal;
     622};
     623
     624/** Calculates the center point of the triangle.
     625 * Is third of the sum of all endpoints.
     626 * \param *center central point on return.
     627 */
     628void BoundaryPolygonSet::GetCenter(Vector * const center) const
     629{
     630  Info FunctionInfo(__func__);
     631  center->Zero();
     632  int counter = 0;
     633  for(PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) {
     634    center->AddVector((*Runner)->node->node);
     635    counter++;
     636  }
     637  center->Scale(1./(double)counter);
     638  Log() << Verbose(1) << "Center is at " << *center << "." << endl;
     639}
     640
     641/** Checks whether the polygons contains all three endpoints of the triangle.
     642 * \param *triangle triangle to test
     643 * \return true - triangle is contained polygon, false - is not
     644 */
     645bool BoundaryPolygonSet::ContainsBoundaryTriangle(const BoundaryTriangleSet * const triangle) const
     646{
     647  Info FunctionInfo(__func__);
     648  return ContainsPresentTupel(triangle->endpoints, 3);
     649};
     650
     651/** Checks whether the polygons contains both endpoints of the line.
     652 * \param *line line to test
     653 * \return true - line is of the triangle, false - is not
     654 */
     655bool BoundaryPolygonSet::ContainsBoundaryLine(const BoundaryLineSet * const line) const
     656{
     657  Info FunctionInfo(__func__);
     658  return ContainsPresentTupel(line->endpoints, 2);
     659};
     660
     661/** Checks whether point is any of the three endpoints this triangle contains.
     662 * \param *point point to test
     663 * \return true - point is of the triangle, false - is not
     664 */
     665bool BoundaryPolygonSet::ContainsBoundaryPoint(const BoundaryPointSet * const point) const
     666{
     667  Info FunctionInfo(__func__);
     668  for(PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) {
     669    Log() << Verbose(0) << "Checking against " << **Runner << endl;
     670    if (point == (*Runner)) {
     671      Log() << Verbose(0) << " Contained." << endl;
     672      return true;
     673    }
     674  }
     675  Log() << Verbose(0) << " Not contained." << endl;
     676  return false;
     677};
     678
     679/** Checks whether point is any of the three endpoints this triangle contains.
     680 * \param *point TesselPoint to test
     681 * \return true - point is of the triangle, false - is not
     682 */
     683bool BoundaryPolygonSet::ContainsBoundaryPoint(const TesselPoint * const point) const
     684{
     685  Info FunctionInfo(__func__);
     686  for(PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++)
     687    if (point == (*Runner)->node) {
     688      Log() << Verbose(0) << " Contained." << endl;
     689      return true;
     690    }
     691  Log() << Verbose(0) << " Not contained." << endl;
     692  return false;
     693};
     694
     695/** Checks whether given array of \a *Points coincide with polygons's endpoints.
     696 * \param **Points pointer to an array of BoundaryPointSet
     697 * \param dim dimension of array
     698 * \return true - set of points is contained in polygon, false - is not
     699 */
     700bool BoundaryPolygonSet::ContainsPresentTupel(const BoundaryPointSet * const * Points, const int dim) const
     701{
     702  Info FunctionInfo(__func__);
     703  int counter = 0;
     704  Log() << Verbose(1) << "Polygon is " << *this << endl;
     705  for(int i=0;i<dim;i++) {
     706    Log() << Verbose(1) << " Testing endpoint " << *Points[i] << endl;
     707    if (ContainsBoundaryPoint(Points[i])) {
     708      counter++;
     709    }
     710  }
     711
     712  if (counter == dim)
     713    return true;
     714  else
     715    return false;
     716};
     717
     718/** Checks whether given PointList coincide with polygons's endpoints.
     719 * \param &endpoints PointList
     720 * \return true - set of points is contained in polygon, false - is not
     721 */
     722bool BoundaryPolygonSet::ContainsPresentTupel(const PointSet &endpoints) const
     723{
     724  Info FunctionInfo(__func__);
     725  size_t counter = 0;
     726  Log() << Verbose(1) << "Polygon is " << *this << endl;
     727  for(PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) {
     728    Log() << Verbose(1) << " Testing endpoint " << **Runner << endl;
     729    if (ContainsBoundaryPoint(*Runner))
     730      counter++;
     731  }
     732
     733  if (counter == endpoints.size())
     734    return true;
     735  else
     736    return false;
     737};
     738
     739/** Checks whether given set of \a *Points coincide with polygons's endpoints.
     740 * \param *P pointer to BoundaryPolygonSet
     741 * \return true - is the very triangle, false - is not
     742 */
     743bool BoundaryPolygonSet::ContainsPresentTupel(const BoundaryPolygonSet * const P) const
     744{
     745  return ContainsPresentTupel((const PointSet)P->endpoints);
     746};
     747
     748/** Gathers all the endpoints' triangles in a unique set.
     749 * \return set of all triangles
     750 */
     751TriangleSet * BoundaryPolygonSet::GetAllContainedTrianglesFromEndpoints() const
     752{
     753  Info FunctionInfo(__func__);
     754  pair <TriangleSet::iterator, bool> Tester;
     755  TriangleSet *triangles = new TriangleSet;
     756
     757  for(PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++)
     758    for(LineMap::const_iterator Walker = (*Runner)->lines.begin(); Walker != (*Runner)->lines.end(); Walker++)
     759      for(TriangleMap::const_iterator Sprinter = (Walker->second)->triangles.begin(); Sprinter != (Walker->second)->triangles.end(); Sprinter++) {
     760        //Log() << Verbose(0) << " Testing triangle " << *(Sprinter->second) << endl;
     761        if (ContainsBoundaryTriangle(Sprinter->second)) {
     762          Tester = triangles->insert(Sprinter->second);
     763          if (Tester.second)
     764            Log() << Verbose(0) << "Adding triangle " << *(Sprinter->second) << endl;
     765        }
     766      }
     767
     768  Log() << Verbose(1) << "The Polygon of " << endpoints.size() << " endpoints has " << triangles->size() << " unique triangles in total." << endl;
     769  return triangles;
     770};
     771
     772/** Fills the endpoints of this polygon from the triangles attached to \a *line.
     773 * \param *line lines with triangles attached
     774 * \return true - polygon contains endpoints, false - line was NULL
     775 */
     776bool BoundaryPolygonSet::FillPolygonFromTrianglesOfLine(const BoundaryLineSet * const line)
     777{
     778  Info FunctionInfo(__func__);
     779  pair <PointSet::iterator, bool> Tester;
     780  if (line == NULL)
     781    return false;
     782  Log() << Verbose(1) << "Filling polygon from line " << *line << endl;
     783  for(TriangleMap::const_iterator Runner = line->triangles.begin(); Runner != line->triangles.end(); Runner++) {
     784    for (int i=0;i<3;i++) {
     785      Tester = endpoints.insert((Runner->second)->endpoints[i]);
     786      if (Tester.second)
     787        Log() << Verbose(1) << "  Inserting endpoint " << *((Runner->second)->endpoints[i]) << endl;
     788    }
     789  }
     790
     791  return true;
     792};
     793
     794/** output operator for BoundaryPolygonSet.
     795 * \param &ost output stream
     796 * \param &a boundary polygon
     797 */
     798ostream &operator <<(ostream &ost, const BoundaryPolygonSet &a)
     799{
     800  ost << "[" << a.Nr << "|";
     801  for(PointSet::const_iterator Runner = a.endpoints.begin(); Runner != a.endpoints.end();) {
     802   ost << (*Runner)->node->Name;
     803   Runner++;
     804   if (Runner != a.endpoints.end())
     805     ost << ",";
     806  }
     807  ost<< "]";
     808  return ost;
     809};
     810
    541811// =========================================================== class TESSELPOINT ===========================================
    542812
     
    545815TesselPoint::TesselPoint()
    546816{
     817  Info FunctionInfo(__func__);
    547818  node = NULL;
    548819  nr = -1;
     
    554825TesselPoint::~TesselPoint()
    555826{
     827  Info FunctionInfo(__func__);
    556828};
    557829
     
    568840ostream & TesselPoint::operator << (ostream &ost)
    569841{
    570   ost << "[" << (Name) << "|" << this << "]";
     842        Info FunctionInfo(__func__);
     843  ost << "[" << (nr) << "|" << this << "]";
    571844  return ost;
    572845};
     
    579852PointCloud::PointCloud()
    580853{
    581 
     854        Info FunctionInfo(__func__);
    582855};
    583856
     
    586859PointCloud::~PointCloud()
    587860{
    588 
     861        Info FunctionInfo(__func__);
    589862};
    590863
     
    593866/** Constructor of class CandidateForTesselation.
    594867 */
    595 CandidateForTesselation::CandidateForTesselation(TesselPoint *candidate, BoundaryLineSet* line, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) {
    596   point = candidate;
    597   BaseLine = line;
     868CandidateForTesselation::CandidateForTesselation (BoundaryLineSet* line) :
     869  BaseLine(line),
     870  ShortestAngle(2.*M_PI),
     871  OtherShortestAngle(2.*M_PI)
     872{
     873        Info FunctionInfo(__func__);
     874};
     875
     876
     877/** Constructor of class CandidateForTesselation.
     878 */
     879CandidateForTesselation::CandidateForTesselation (TesselPoint *candidate, BoundaryLineSet* line, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) :
     880    BaseLine(line),
     881    ShortestAngle(2.*M_PI),
     882    OtherShortestAngle(2.*M_PI)
     883{
     884        Info FunctionInfo(__func__);
    598885  OptCenter.CopyVector(&OptCandidateCenter);
    599886  OtherOptCenter.CopyVector(&OtherOptCandidateCenter);
     
    603890 */
    604891CandidateForTesselation::~CandidateForTesselation() {
    605   point = NULL;
    606892  BaseLine = NULL;
    607893};
    608894
     895/** output operator for CandidateForTesselation.
     896 * \param &ost output stream
     897 * \param &a boundary line
     898 */
     899ostream & operator <<(ostream &ost, const  CandidateForTesselation &a)
     900{
     901  ost << "[" << a.BaseLine->Nr << "|" << a.BaseLine->endpoints[0]->node->Name << "," << a.BaseLine->endpoints[1]->node->Name << "] with ";
     902  if (a.pointlist.empty())
     903    ost << "no candidate.";
     904  else {
     905    ost << "candidate";
     906    if (a.pointlist.size() != 1)
     907      ost << "s ";
     908    else
     909      ost << " ";
     910    for (TesselPointList::const_iterator Runner = a.pointlist.begin(); Runner != a.pointlist.end(); Runner++)
     911      ost << *(*Runner) << " ";
     912    ost << " at angle " << (a.ShortestAngle)<< ".";
     913  }
     914
     915  return ost;
     916};
     917
     918
    609919// =========================================================== class TESSELATION ===========================================
    610920
    611921/** Constructor of class Tesselation.
    612922 */
    613 Tesselation::Tesselation()
    614 {
    615   PointsOnBoundaryCount = 0;
    616   LinesOnBoundaryCount = 0;
    617   TrianglesOnBoundaryCount = 0;
    618   InternalPointer = PointsOnBoundary.begin();
    619   LastTriangle = NULL;
    620   TriangleFilesWritten = 0;
     923Tesselation::Tesselation() :
     924  PointsOnBoundaryCount(0),
     925  LinesOnBoundaryCount(0),
     926  TrianglesOnBoundaryCount(0),
     927  LastTriangle(NULL),
     928  TriangleFilesWritten(0),
     929  InternalPointer(PointsOnBoundary.begin())
     930{
     931        Info FunctionInfo(__func__);
    621932}
    622933;
     
    627938Tesselation::~Tesselation()
    628939{
    629   Log() << Verbose(1) << "Free'ing TesselStruct ... " << endl;
     940        Info FunctionInfo(__func__);
     941  Log() << Verbose(0) << "Free'ing TesselStruct ... " << endl;
    630942  for (TriangleMap::iterator runner = TrianglesOnBoundary.begin(); runner != TrianglesOnBoundary.end(); runner++) {
    631943    if (runner->second != NULL) {
     
    635947      eLog() << Verbose(1) << "The triangle " << runner->first << " has already been free'd." << endl;
    636948  }
    637   Log() << Verbose(1) << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl;
     949  Log() << Verbose(0) << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl;
    638950}
    639951;
     
    644956Vector * Tesselation::GetCenter(ofstream *out) const
    645957{
     958        Info FunctionInfo(__func__);
    646959  Vector *Center = new Vector(0.,0.,0.);
    647960  int num=0;
     
    659972TesselPoint * Tesselation::GetPoint() const
    660973{
     974        Info FunctionInfo(__func__);
    661975  return (InternalPointer->second->node);
    662976};
     
    667981TesselPoint * Tesselation::GetTerminalPoint() const
    668982{
     983        Info FunctionInfo(__func__);
    669984  PointMap::const_iterator Runner = PointsOnBoundary.end();
    670985  Runner--;
     
    677992void Tesselation::GoToNext() const
    678993{
     994        Info FunctionInfo(__func__);
    679995  if (InternalPointer != PointsOnBoundary.end())
    680996    InternalPointer++;
     
    6861002void Tesselation::GoToPrevious() const
    6871003{
     1004        Info FunctionInfo(__func__);
    6881005  if (InternalPointer != PointsOnBoundary.begin())
    6891006    InternalPointer--;
     
    6951012void Tesselation::GoToFirst() const
    6961013{
     1014        Info FunctionInfo(__func__);
    6971015  InternalPointer = PointsOnBoundary.begin();
    6981016};
     
    7031021void Tesselation::GoToLast() const
    7041022{
     1023        Info FunctionInfo(__func__);
    7051024  InternalPointer = PointsOnBoundary.end();
    7061025  InternalPointer--;
     
    7121031bool Tesselation::IsEmpty() const
    7131032{
     1033        Info FunctionInfo(__func__);
    7141034  return (PointsOnBoundary.empty());
    7151035};
     
    7201040bool Tesselation::IsEnd() const
    7211041{
     1042        Info FunctionInfo(__func__);
    7221043  return (InternalPointer == PointsOnBoundary.end());
    7231044};
     
    7321053Tesselation::GuessStartingTriangle()
    7331054{
     1055        Info FunctionInfo(__func__);
    7341056  // 4b. create a starting triangle
    7351057  // 4b1. create all distances
     
    7781100          baseline->second.first->second->node->node,
    7791101          baseline->second.second->second->node->node);
    780       Log() << Verbose(2) << "Plane vector of candidate triangle is ";
    781       PlaneVector.Output();
    782       Log() << Verbose(0) << endl;
     1102      Log() << Verbose(2) << "Plane vector of candidate triangle is " << PlaneVector << endl;
    7831103      // 4. loop over all points
    7841104      double sign = 0.;
     
    7961116          if (fabs(distance) < 1e-4) // we need to have a small epsilon around 0 which is still ok
    7971117            continue;
    798           Log() << Verbose(3) << "Projection of " << checker->second->node->Name
    799               << " yields distance of " << distance << "." << endl;
     1118          Log() << Verbose(2) << "Projection of " << checker->second->node->Name << " yields distance of " << distance << "." << endl;
    8001119          tmp = distance / fabs(distance);
    8011120          // 4b. Any have different sign to than before? (i.e. would lie outside convex hull with this starting triangle)
     
    8501169      if (checker == PointsOnBoundary.end())
    8511170        {
    852           Log() << Verbose(0) << "Looks like we have a candidate!" << endl;
     1171          Log() << Verbose(2) << "Looks like we have a candidate!" << endl;
    8531172          break;
    8541173        }
     
    8801199  else
    8811200    {
    882       Log() << Verbose(1) << "No starting triangle found." << endl;
    883       exit(255);
     1201      eLog() << Verbose(0) << "No starting triangle found." << endl;
    8841202    }
    8851203}
     
    9011219void Tesselation::TesselateOnBoundary(const PointCloud * const cloud)
    9021220{
     1221        Info FunctionInfo(__func__);
    9031222  bool flag;
    9041223  PointMap::iterator winner;
     
    9191238        // get peak point with respect to this base line's only triangle
    9201239        BTS = baseline->second->triangles.begin()->second; // there is only one triangle so far
    921         Log() << Verbose(2) << "Current baseline is between " << *(baseline->second) << "." << endl;
     1240        Log() << Verbose(0) << "Current baseline is between " << *(baseline->second) << "." << endl;
    9221241        for (int i = 0; i < 3; i++)
    9231242          if ((BTS->endpoints[i] != baseline->second->endpoints[0]) && (BTS->endpoints[i] != baseline->second->endpoints[1]))
    9241243            peak = BTS->endpoints[i];
    925         Log() << Verbose(3) << " and has peak " << *peak << "." << endl;
     1244        Log() << Verbose(1) << " and has peak " << *peak << "." << endl;
    9261245
    9271246        // prepare some auxiliary vectors
     
    9381257          CenterVector.AddVector(BTS->endpoints[i]->node->node);
    9391258        CenterVector.Scale(1. / 3.);
    940         Log() << Verbose(4) << "CenterVector of base triangle is " << CenterVector << endl;
     1259        Log() << Verbose(2) << "CenterVector of base triangle is " << CenterVector << endl;
    9411260
    9421261        // normal vector of triangle
     
    9451264        BTS->GetNormalVector(NormalVector);
    9461265        NormalVector.CopyVector(&BTS->NormalVector);
    947         Log() << Verbose(4) << "NormalVector of base triangle is " << NormalVector << endl;
     1266        Log() << Verbose(2) << "NormalVector of base triangle is " << NormalVector << endl;
    9481267
    9491268        // vector in propagation direction (out of triangle)
     
    9521271        TempVector.CopyVector(&CenterVector);
    9531272        TempVector.SubtractVector(baseline->second->endpoints[0]->node->node); // TempVector is vector on triangle plane pointing from one baseline egde towards center!
    954         //Log() << Verbose(2) << "Projection of propagation onto temp: " << PropagationVector.Projection(&TempVector) << "." << endl;
     1273        //Log() << Verbose(0) << "Projection of propagation onto temp: " << PropagationVector.Projection(&TempVector) << "." << endl;
    9551274        if (PropagationVector.ScalarProduct(&TempVector) > 0) // make sure normal propagation vector points outward from baseline
    9561275          PropagationVector.Scale(-1.);
    957         Log() << Verbose(4) << "PropagationVector of base triangle is " << PropagationVector << endl;
     1276        Log() << Verbose(2) << "PropagationVector of base triangle is " << PropagationVector << endl;
    9581277        winner = PointsOnBoundary.end();
    9591278
     
    9611280        for (PointMap::iterator target = PointsOnBoundary.begin(); target != PointsOnBoundary.end(); target++) {
    9621281          if ((target->second != baseline->second->endpoints[0]) && (target->second != baseline->second->endpoints[1])) { // don't take the same endpoints
    963             Log() << Verbose(3) << "Target point is " << *(target->second) << ":" << endl;
     1282            Log() << Verbose(1) << "Target point is " << *(target->second) << ":" << endl;
    9641283
    9651284            // first check direction, so that triangles don't intersect
     
    9681287            VirtualNormalVector.ProjectOntoPlane(&NormalVector);
    9691288            TempAngle = VirtualNormalVector.Angle(&PropagationVector);
    970             Log() << Verbose(4) << "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "." << endl;
     1289            Log() << Verbose(2) << "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "." << endl;
    9711290            if (TempAngle > (M_PI/2.)) { // no bends bigger than Pi/2 (90 degrees)
    972               Log() << Verbose(4) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", bad direction!" << endl;
     1291              Log() << Verbose(2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", bad direction!" << endl;
    9731292              continue;
    9741293            } else
    975               Log() << Verbose(4) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", good direction!" << endl;
     1294              Log() << Verbose(2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", good direction!" << endl;
    9761295
    9771296            // check first and second endpoint (if any connecting line goes to target has at least not more than 1 triangle)
     
    9791298            LineChecker[1] = baseline->second->endpoints[1]->lines.find(target->first);
    9801299            if (((LineChecker[0] != baseline->second->endpoints[0]->lines.end()) && (LineChecker[0]->second->triangles.size() == 2))) {
    981               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;
     1300              Log() << Verbose(2) << *(baseline->second->endpoints[0]) << " has line " << *(LineChecker[0]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[0]->second->triangles.size() << " triangles." << endl;
    9821301              continue;
    9831302            }
    9841303            if (((LineChecker[1] != baseline->second->endpoints[1]->lines.end()) && (LineChecker[1]->second->triangles.size() == 2))) {
    985               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;
     1304              Log() << Verbose(2) << *(baseline->second->endpoints[1]) << " has line " << *(LineChecker[1]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[1]->second->triangles.size() << " triangles." << endl;
    9861305              continue;
    9871306            }
     
    10001319            helper.ProjectOntoPlane(&TempVector);
    10011320            if (fabs(helper.NormSquared()) < MYEPSILON) {
    1002               Log() << Verbose(4) << "Chosen set of vectors is linear dependent." << endl;
     1321              Log() << Verbose(2) << "Chosen set of vectors is linear dependent." << endl;
    10031322              continue;
    10041323            }
     
    10171336            // calculate angle
    10181337            TempAngle = NormalVector.Angle(&VirtualNormalVector);
    1019             Log() << Verbose(4) << "NormalVector is " << VirtualNormalVector << " and the angle is " << TempAngle << "." << endl;
     1338            Log() << Verbose(2) << "NormalVector is " << VirtualNormalVector << " and the angle is " << TempAngle << "." << endl;
    10201339            if ((SmallestAngle - TempAngle) > MYEPSILON) { // set to new possible winner
    10211340              SmallestAngle = TempAngle;
    10221341              winner = target;
    1023               Log() << Verbose(4) << "New winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;
     1342              Log() << Verbose(2) << "New winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;
    10241343            } else if (fabs(SmallestAngle - TempAngle) < MYEPSILON) { // check the angle to propagation, both possible targets are in one plane! (their normals have same angle)
    10251344              // hence, check the angles to some normal direction from our base line but in this common plane of both targets...
     
    10391358                SmallestAngle = TempAngle;
    10401359                winner = target;
    1041                 Log() << Verbose(4) << "New winner " << *winner->second->node << " due to smaller angle " << TempAngle << " to propagation direction." << endl;
     1360                Log() << Verbose(2) << "New winner " << *winner->second->node << " due to smaller angle " << TempAngle << " to propagation direction." << endl;
    10421361              } else
    1043                 Log() << Verbose(4) << "Keeping old winner " << *winner->second->node << " due to smaller angle to propagation direction." << endl;
     1362                Log() << Verbose(2) << "Keeping old winner " << *winner->second->node << " due to smaller angle to propagation direction." << endl;
    10441363            } else
    1045               Log() << Verbose(4) << "Keeping old winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;
     1364              Log() << Verbose(2) << "Keeping old winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;
    10461365          }
    10471366        } // end of loop over all boundary points
     
    10491368        // 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
    10501369        if (winner != PointsOnBoundary.end()) {
    1051           Log() << Verbose(2) << "Winning target point is " << *(winner->second) << " with angle " << SmallestAngle << "." << endl;
     1370          Log() << Verbose(0) << "Winning target point is " << *(winner->second) << " with angle " << SmallestAngle << "." << endl;
    10521371          // create the lins of not yet present
    10531372          BLS[0] = baseline->second;
     
    10791398          TrianglesOnBoundaryCount++;
    10801399        } else {
    1081           Log() << Verbose(1) << "I could not determine a winner for this baseline " << *(baseline->second) << "." << endl;
     1400          eLog() << Verbose(2) << "I could not determine a winner for this baseline " << *(baseline->second) << "." << endl;
    10821401        }
    10831402
    10841403        // 5d. If the set of lines is not yet empty, go to 5. and continue
    10851404      } else
    1086         Log() << Verbose(2) << "Baseline candidate " << *(baseline->second) << " has a triangle count of " << baseline->second->triangles.size() << "." << endl;
     1405        Log() << Verbose(0) << "Baseline candidate " << *(baseline->second) << " has a triangle count of " << baseline->second->triangles.size() << "." << endl;
    10871406  } while (flag);
    10881407
     
    10991418bool Tesselation::InsertStraddlingPoints(const PointCloud *cloud, const LinkedCell *LC)
    11001419{
     1420        Info FunctionInfo(__func__);
    11011421  Vector Intersection, Normal;
    11021422  TesselPoint *Walker = NULL;
     
    11051425  bool AddFlag = false;
    11061426  LinkedCell *BoundaryPoints = NULL;
    1107 
    1108   Log() << Verbose(1) << "Begin of InsertStraddlingPoints" << endl;
    11091427
    11101428  cloud->GoToFirst();
     
    11171435    }
    11181436    Walker = cloud->GetPoint();
    1119     Log() << Verbose(2) << "Current point is " << *Walker << "." << endl;
     1437    Log() << Verbose(0) << "Current point is " << *Walker << "." << endl;
    11201438    // get the next triangle
    11211439    triangles = FindClosestTrianglesToPoint(Walker->node, BoundaryPoints);
    11221440    BTS = triangles->front();
    11231441    if ((triangles == NULL) || (BTS->ContainsBoundaryPoint(Walker))) {
    1124       Log() << Verbose(2) << "No triangles found, probably a tesselation point itself." << endl;
     1442      Log() << Verbose(0) << "No triangles found, probably a tesselation point itself." << endl;
    11251443      cloud->GoToNext();
    11261444      continue;
    11271445    } else {
    11281446    }
    1129     Log() << Verbose(2) << "Closest triangle is " << *BTS << "." << endl;
     1447    Log() << Verbose(0) << "Closest triangle is " << *BTS << "." << endl;
    11301448    // get the intersection point
    11311449    if (BTS->GetIntersectionInsideTriangle(Center, Walker->node, &Intersection)) {
    1132       Log() << Verbose(2) << "We have an intersection at " << Intersection << "." << endl;
     1450      Log() << Verbose(0) << "We have an intersection at " << Intersection << "." << endl;
    11331451      // we have the intersection, check whether in- or outside of boundary
    11341452      if ((Center->DistanceSquared(Walker->node) - Center->DistanceSquared(&Intersection)) < -MYEPSILON) {
    11351453        // inside, next!
    1136         Log() << Verbose(2) << *Walker << " is inside wrt triangle " << *BTS << "." << endl;
     1454        Log() << Verbose(0) << *Walker << " is inside wrt triangle " << *BTS << "." << endl;
    11371455      } else {
    11381456        // outside!
    1139         Log() << Verbose(2) << *Walker << " is outside wrt triangle " << *BTS << "." << endl;
     1457        Log() << Verbose(0) << *Walker << " is outside wrt triangle " << *BTS << "." << endl;
    11401458        class BoundaryLineSet *OldLines[3], *NewLines[3];
    11411459        class BoundaryPointSet *OldPoints[3], *NewPoint;
     
    11471465        Normal.CopyVector(&BTS->NormalVector);
    11481466        // add Walker to boundary points
    1149         Log() << Verbose(2) << "Adding " << *Walker << " to BoundaryPoints." << endl;
     1467        Log() << Verbose(0) << "Adding " << *Walker << " to BoundaryPoints." << endl;
    11501468        AddFlag = true;
    11511469        if (AddBoundaryPoint(Walker,0))
     
    11541472          continue;
    11551473        // remove triangle
    1156         Log() << Verbose(2) << "Erasing triangle " << *BTS << "." << endl;
     1474        Log() << Verbose(0) << "Erasing triangle " << *BTS << "." << endl;
    11571475        TrianglesOnBoundary.erase(BTS->Nr);
    11581476        delete(BTS);
     
    11621480          BPS[1] = OldPoints[i];
    11631481          NewLines[i] = new class BoundaryLineSet(BPS, LinesOnBoundaryCount);
    1164           Log() << Verbose(3) << "Creating new line " << *NewLines[i] << "." << endl;
     1482          Log() << Verbose(1) << "Creating new line " << *NewLines[i] << "." << endl;
    11651483          LinesOnBoundary.insert(LinePair(LinesOnBoundaryCount, NewLines[i])); // no need for check for unique insertion as BPS[0] is definitely a new one
    11661484          LinesOnBoundaryCount++;
     
    11731491            if (NewLines[j]->IsConnectedTo(BLS[0])) {
    11741492              if (n>2) {
    1175                 Log() << Verbose(1) << BLS[0] << " connects to all of the new lines?!" << endl;
     1493                eLog() << Verbose(2) << BLS[0] << " connects to all of the new lines?!" << endl;
    11761494                return false;
    11771495              } else
     
    11841502          BTS->GetNormalVector(Normal);
    11851503          Normal.Scale(-1.);
    1186           Log() << Verbose(2) << "Created new triangle " << *BTS << "." << endl;
     1504          Log() << Verbose(0) << "Created new triangle " << *BTS << "." << endl;
    11871505          TrianglesOnBoundary.insert(TrianglePair(TrianglesOnBoundaryCount, BTS));
    11881506          TrianglesOnBoundaryCount++;
     
    11981516  // exit
    11991517  delete(Center);
    1200   Log() << Verbose(1) << "End of InsertStraddlingPoints" << endl;
    12011518  return true;
    12021519};
     
    12091526bool Tesselation::AddBoundaryPoint(TesselPoint * Walker, const int n)
    12101527{
     1528        Info FunctionInfo(__func__);
    12111529  PointTestPair InsertUnique;
    12121530  BPS[n] = new class BoundaryPointSet(Walker);
     
    12301548void Tesselation::AddTesselationPoint(TesselPoint* Candidate, const int n)
    12311549{
     1550        Info FunctionInfo(__func__);
    12321551  PointTestPair InsertUnique;
    12331552  TPS[n] = new class BoundaryPointSet(Candidate);
     
    12371556  } else {
    12381557    delete TPS[n];
    1239     Log() << Verbose(4) << "Node " << *((InsertUnique.first)->second->node) << " is already present in PointsOnBoundary." << endl;
     1558    Log() << Verbose(0) << "Node " << *((InsertUnique.first)->second->node) << " is already present in PointsOnBoundary." << endl;
    12401559    TPS[n] = (InsertUnique.first)->second;
    12411560  }
     
    12501569void Tesselation::SetTesselationPoint(TesselPoint* Candidate, const int n) const
    12511570{
     1571        Info FunctionInfo(__func__);
    12521572  PointMap::const_iterator FindPoint = PointsOnBoundary.find(Candidate->nr);
    12531573  if (FindPoint != PointsOnBoundary.end())
     
    12671587  bool insertNewLine = true;
    12681588
    1269   if (a->lines.find(b->node->nr) != a->lines.end()) {
    1270     LineMap::iterator FindLine = a->lines.find(b->node->nr);
     1589  LineMap::iterator FindLine = a->lines.find(b->node->nr);
     1590  if (FindLine != a->lines.end()) {
     1591    Log() << Verbose(1) << "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "." << endl;
     1592
    12711593    pair<LineMap::iterator,LineMap::iterator> FindPair;
    12721594    FindPair = a->lines.equal_range(b->node->nr);
    1273     Log() << Verbose(5) << "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "." << endl;
    12741595
    12751596    for (FindLine = FindPair.first; FindLine != FindPair.second; FindLine++) {
     
    12771598      if (FindLine->second->triangles.size() < 2) {
    12781599        insertNewLine = false;
    1279         Log() << Verbose(4) << "Using existing line " << *FindLine->second << endl;
     1600        Log() << Verbose(0) << "Using existing line " << *FindLine->second << endl;
    12801601
    12811602        BPS[0] = FindLine->second->endpoints[0];
    12821603        BPS[1] = FindLine->second->endpoints[1];
    12831604        BLS[n] = FindLine->second;
     1605
     1606        // remove existing line from OpenLines
     1607        CandidateMap::iterator CandidateLine = OpenLines.find(BLS[n]);
     1608        if (CandidateLine != OpenLines.end()) {
     1609          Log() << Verbose(1) << " Removing line from OpenLines." << endl;
     1610          delete(CandidateLine->second);
     1611          OpenLines.erase(CandidateLine);
     1612        } else {
     1613          eLog() << Verbose(1) << "Line exists and is attached to less than two triangles, but not in OpenLines!" << endl;
     1614        }
    12841615
    12851616        break;
     
    13041635void Tesselation::AlwaysAddTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n)
    13051636{
    1306   Log() << Verbose(4) << "Adding line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl;
     1637        Info FunctionInfo(__func__);
     1638  Log() << Verbose(0) << "Adding open line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl;
    13071639  BPS[0] = a;
    13081640  BPS[1] = b;
     
    13121644  // increase counter
    13131645  LinesOnBoundaryCount++;
     1646  // also add to open lines
     1647  CandidateForTesselation *CFT = new CandidateForTesselation(BLS[n]);
     1648  OpenLines.insert(pair< BoundaryLineSet *, CandidateForTesselation *> (BLS[n], CFT));
    13141649};
    13151650
     
    13191654void Tesselation::AddTesselationTriangle()
    13201655{
     1656        Info FunctionInfo(__func__);
    13211657  Log() << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl;
    13221658
     
    13371673void Tesselation::AddTesselationTriangle(const int nr)
    13381674{
    1339   Log() << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl;
     1675        Info FunctionInfo(__func__);
     1676  Log() << Verbose(0) << "Adding triangle to global TrianglesOnBoundary map." << endl;
    13401677
    13411678  // add triangle to global map
     
    13551692void Tesselation::RemoveTesselationTriangle(class BoundaryTriangleSet *triangle)
    13561693{
     1694        Info FunctionInfo(__func__);
    13571695  if (triangle == NULL)
    13581696    return;
    13591697  for (int i = 0; i < 3; i++) {
    13601698    if (triangle->lines[i] != NULL) {
    1361       Log() << Verbose(5) << "Removing triangle Nr." << triangle->Nr << " in line " << *triangle->lines[i] << "." << endl;
     1699      Log() << Verbose(0) << "Removing triangle Nr." << triangle->Nr << " in line " << *triangle->lines[i] << "." << endl;
    13621700      triangle->lines[i]->triangles.erase(triangle->Nr);
    13631701      if (triangle->lines[i]->triangles.empty()) {
    1364           Log() << Verbose(5) << *triangle->lines[i] << " is no more attached to any triangle, erasing." << endl;
     1702          Log() << Verbose(0) << *triangle->lines[i] << " is no more attached to any triangle, erasing." << endl;
    13651703          RemoveTesselationLine(triangle->lines[i]);
    13661704      } else {
    1367         Log() << Verbose(5) << *triangle->lines[i] << " is still attached to another triangle: ";
     1705        Log() << Verbose(0) << *triangle->lines[i] << " is still attached to another triangle: ";
     1706        OpenLines.insert(pair< BoundaryLineSet *, CandidateForTesselation *> (triangle->lines[i], NULL));
    13681707        for(TriangleMap::iterator TriangleRunner = triangle->lines[i]->triangles.begin(); TriangleRunner != triangle->lines[i]->triangles.end(); TriangleRunner++)
    13691708          Log() << Verbose(0) << "[" << (TriangleRunner->second)->Nr << "|" << *((TriangleRunner->second)->endpoints[0]) << ", " << *((TriangleRunner->second)->endpoints[1]) << ", " << *((TriangleRunner->second)->endpoints[2]) << "] \t";
    13701709        Log() << Verbose(0) << endl;
    13711710//        for (int j=0;j<2;j++) {
    1372 //          Log() << Verbose(5) << "Lines of endpoint " << *(triangle->lines[i]->endpoints[j]) << ": ";
     1711//          Log() << Verbose(0) << "Lines of endpoint " << *(triangle->lines[i]->endpoints[j]) << ": ";
    13731712//          for(LineMap::iterator LineRunner = triangle->lines[i]->endpoints[j]->lines.begin(); LineRunner != triangle->lines[i]->endpoints[j]->lines.end(); LineRunner++)
    13741713//            Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t";
     
    13821721
    13831722  if (TrianglesOnBoundary.erase(triangle->Nr))
    1384     Log() << Verbose(5) << "Removing triangle Nr. " << triangle->Nr << "." << endl;
     1723    Log() << Verbose(0) << "Removing triangle Nr. " << triangle->Nr << "." << endl;
    13851724  delete(triangle);
    13861725};
     
    13921731void Tesselation::RemoveTesselationLine(class BoundaryLineSet *line)
    13931732{
     1733        Info FunctionInfo(__func__);
    13941734  int Numbers[2];
    13951735
     
    14121752        for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++)
    14131753          if ((*Runner).second == line) {
    1414             Log() << Verbose(5) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;
     1754            Log() << Verbose(0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;
    14151755            line->endpoints[i]->lines.erase(Runner);
    14161756            break;
     
    14181758      } else { // there's just a single line left
    14191759        if (line->endpoints[i]->lines.erase(line->Nr))
    1420           Log() << Verbose(5) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;
     1760          Log() << Verbose(0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;
    14211761      }
    14221762      if (line->endpoints[i]->lines.empty()) {
    1423         Log() << Verbose(5) << *line->endpoints[i] << " has no more lines it's attached to, erasing." << endl;
     1763        Log() << Verbose(0) << *line->endpoints[i] << " has no more lines it's attached to, erasing." << endl;
    14241764        RemoveTesselationPoint(line->endpoints[i]);
    14251765      } else {
    1426         Log() << Verbose(5) << *line->endpoints[i] << " has still lines it's attached to: ";
     1766        Log() << Verbose(0) << *line->endpoints[i] << " has still lines it's attached to: ";
    14271767        for(LineMap::iterator LineRunner = line->endpoints[i]->lines.begin(); LineRunner != line->endpoints[i]->lines.end(); LineRunner++)
    14281768          Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t";
     
    14371777
    14381778  if (LinesOnBoundary.erase(line->Nr))
    1439     Log() << Verbose(5) << "Removing line Nr. " << line->Nr << "." << endl;
     1779    Log() << Verbose(0) << "Removing line Nr. " << line->Nr << "." << endl;
    14401780  delete(line);
    14411781};
     
    14481788void Tesselation::RemoveTesselationPoint(class BoundaryPointSet *point)
    14491789{
     1790        Info FunctionInfo(__func__);
    14501791  if (point == NULL)
    14511792    return;
    14521793  if (PointsOnBoundary.erase(point->Nr))
    1453     Log() << Verbose(5) << "Removing point Nr. " << point->Nr << "." << endl;
     1794    Log() << Verbose(0) << "Removing point Nr. " << point->Nr << "." << endl;
    14541795  delete(point);
    14551796};
     
    14661807int Tesselation::CheckPresenceOfTriangle(TesselPoint *Candidates[3]) const
    14671808{
     1809        Info FunctionInfo(__func__);
    14681810  int adjacentTriangleCount = 0;
    14691811  class BoundaryPointSet *Points[3];
    14701812
    1471   Log() << Verbose(2) << "Begin of CheckPresenceOfTriangle" << endl;
    14721813  // builds a triangle point set (Points) of the end points
    14731814  for (int i = 0; i < 3; i++) {
     
    14881829          for (; (FindLine != Points[i]->lines.end()) && (FindLine->first == Points[j]->node->nr); FindLine++) {
    14891830            TriangleMap *triangles = &FindLine->second->triangles;
    1490             Log() << Verbose(3) << "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "." << endl;
     1831            Log() << Verbose(1) << "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "." << endl;
    14911832            for (TriangleMap::const_iterator FindTriangle = triangles->begin(); FindTriangle != triangles->end(); FindTriangle++) {
    14921833              if (FindTriangle->second->IsPresentTupel(Points)) {
     
    14941835              }
    14951836            }
    1496             Log() << Verbose(3) << "end." << endl;
     1837            Log() << Verbose(1) << "end." << endl;
    14971838          }
    14981839          // Only one of the triangle lines must be considered for the triangle count.
    1499           //Log() << Verbose(2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;
     1840          //Log() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;
    15001841          //return adjacentTriangleCount;
    15011842        }
     
    15041845  }
    15051846
    1506   Log() << Verbose(2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;
    1507   Log() << Verbose(2) << "End of CheckPresenceOfTriangle" << endl;
     1847  Log() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;
    15081848  return adjacentTriangleCount;
    15091849};
     
    15191859class BoundaryTriangleSet * Tesselation::GetPresentTriangle(TesselPoint *Candidates[3])
    15201860{
     1861        Info FunctionInfo(__func__);
    15211862  class BoundaryTriangleSet *triangle = NULL;
    15221863  class BoundaryPointSet *Points[3];
     
    15481889          }
    15491890          // Only one of the triangle lines must be considered for the triangle count.
    1550           //Log() << Verbose(2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;
     1891          //Log() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;
    15511892          //return adjacentTriangleCount;
    15521893        }
     
    15691910void Tesselation::FindStartingTriangle(const double RADIUS, const LinkedCell *LC)
    15701911{
    1571   Log() << Verbose(1) << "Begin of FindStartingTriangle\n";
     1912        Info FunctionInfo(__func__);
    15721913  int i = 0;
    1573   TesselPoint* FirstPoint = NULL;
    1574   TesselPoint* SecondPoint = NULL;
    15751914  TesselPoint* MaxPoint[NDIM];
     1915  TesselPoint* Temporary;
    15761916  double maxCoordinate[NDIM];
    1577   Vector Oben;
     1917  BoundaryLineSet BaseLine;
    15781918  Vector helper;
    15791919  Vector Chord;
    15801920  Vector SearchDirection;
    1581 
    1582   Oben.Zero();
     1921  Vector CircleCenter;  // center of the circle, i.e. of the band of sphere's centers
     1922  Vector CirclePlaneNormal; // normal vector defining the plane this circle lives in
     1923  Vector SphereCenter;
     1924  Vector NormalVector;
     1925
     1926  NormalVector.Zero();
    15831927
    15841928  for (i = 0; i < 3; i++) {
     
    15931937      for (LC->n[(i+2)%NDIM]=0;LC->n[(i+2)%NDIM]<LC->N[(i+2)%NDIM];LC->n[(i+2)%NDIM]++) {
    15941938        const LinkedNodes *List = LC->GetCurrentCell();
    1595         //Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;
     1939        //Log() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;
    15961940        if (List != NULL) {
    15971941          for (LinkedNodes::const_iterator Runner = List->begin();Runner != List->end();Runner++) {
    15981942            if ((*Runner)->node->x[i] > maxCoordinate[i]) {
    1599               Log() << Verbose(2) << "New maximal for axis " << i << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl;
     1943              Log() << Verbose(1) << "New maximal for axis " << i << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl;
    16001944              maxCoordinate[i] = (*Runner)->node->x[i];
    16011945              MaxPoint[i] = (*Runner);
     
    16081952  }
    16091953
    1610   Log() << Verbose(2) << "Found maximum coordinates: ";
     1954  Log() << Verbose(1) << "Found maximum coordinates: ";
    16111955  for (int i=0;i<NDIM;i++)
    16121956    Log() << Verbose(0) << i << ": " << *MaxPoint[i] << "\t";
     
    16141958
    16151959  BTS = NULL;
    1616   CandidateList *OptCandidates = new CandidateList();
    16171960  for (int k=0;k<NDIM;k++) {
    1618     Oben.Zero();
    1619     Oben.x[k] = 1.;
    1620     FirstPoint = MaxPoint[k];
    1621     Log() << Verbose(1) << "Coordinates of start node at " << *FirstPoint->node << "." << endl;
     1961    NormalVector.Zero();
     1962    NormalVector.x[k] = 1.;
     1963    BaseLine.endpoints[0] = new BoundaryPointSet(MaxPoint[k]);
     1964    Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine.endpoints[0]->node << "." << endl;
    16221965
    16231966    double ShortestAngle;
    1624     TesselPoint* OptCandidate = NULL;
    16251967    ShortestAngle = 999999.; // This will contain the angle, which will be always positive (when looking for second point), when looking for third point this will be the quadrant.
    16261968
    1627     FindSecondPointForTesselation(FirstPoint, Oben, OptCandidate, &ShortestAngle, RADIUS, LC); // we give same point as next candidate as its bonds are looked into in find_second_...
    1628     SecondPoint = OptCandidate;
    1629     if (SecondPoint == NULL)  // have we found a second point?
     1969    FindSecondPointForTesselation(BaseLine.endpoints[0]->node, NormalVector, Temporary, &ShortestAngle, RADIUS, LC); // we give same point as next candidate as its bonds are looked into in find_second_...
     1970    if (Temporary == NULL)  // have we found a second point?
    16301971      continue;
    1631 
    1632     helper.CopyVector(FirstPoint->node);
    1633     helper.SubtractVector(SecondPoint->node);
    1634     helper.Normalize();
    1635     Oben.ProjectOntoPlane(&helper);
    1636     Oben.Normalize();
    1637     helper.VectorProduct(&Oben);
     1972    BaseLine.endpoints[1] = new BoundaryPointSet(Temporary);
     1973
     1974    // construct center of circle
     1975    CircleCenter.CopyVector(BaseLine.endpoints[0]->node->node);
     1976    CircleCenter.AddVector(BaseLine.endpoints[1]->node->node);
     1977    CircleCenter.Scale(0.5);
     1978
     1979    // construct normal vector of circle
     1980    CirclePlaneNormal.CopyVector(BaseLine.endpoints[0]->node->node);
     1981    CirclePlaneNormal.SubtractVector(BaseLine.endpoints[1]->node->node);
     1982
     1983    double radius = CirclePlaneNormal.NormSquared();
     1984    double CircleRadius = sqrt(RADIUS*RADIUS - radius/4.);
     1985
     1986    NormalVector.ProjectOntoPlane(&CirclePlaneNormal);
     1987    NormalVector.Normalize();
    16381988    ShortestAngle = 2.*M_PI; // This will indicate the quadrant.
    16391989
    1640     Chord.CopyVector(FirstPoint->node); // bring into calling function
    1641     Chord.SubtractVector(SecondPoint->node);
    1642     double radius = Chord.ScalarProduct(&Chord);
    1643     double CircleRadius = sqrt(RADIUS*RADIUS - radius/4.);
    1644     helper.CopyVector(&Oben);
    1645     helper.Scale(CircleRadius);
    1646     // Now, oben and helper are two orthonormalized vectors in the plane defined by Chord (not normalized)
     1990    SphereCenter.CopyVector(&NormalVector);
     1991    SphereCenter.Scale(CircleRadius);
     1992    SphereCenter.AddVector(&CircleCenter);
     1993    // Now, NormalVector and SphereCenter are two orthonormalized vectors in the plane defined by CirclePlaneNormal (not normalized)
    16471994
    16481995    // look in one direction of baseline for initial candidate
    1649     SearchDirection.MakeNormalVector(&Chord, &Oben);  // whether we look "left" first or "right" first is not important ...
     1996    SearchDirection.MakeNormalVector(&CirclePlaneNormal, &NormalVector);  // whether we look "left" first or "right" first is not important ...
    16501997
    16511998    // adding point 1 and point 2 and add the line between them
    1652     Log() << Verbose(1) << "Coordinates of start node at " << *FirstPoint->node << "." << endl;
    1653     AddTesselationPoint(FirstPoint, 0);
    1654     Log() << Verbose(1) << "Found second point is at " << *SecondPoint->node << ".\n";
    1655     AddTesselationPoint(SecondPoint, 1);
    1656     AddTesselationLine(TPS[0], TPS[1], 0);
    1657 
    1658     //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << helper << ".\n";
    1659     FindThirdPointForTesselation(Oben, SearchDirection, helper, BLS[0], NULL, *&OptCandidates, &ShortestAngle, RADIUS, LC);
    1660     Log() << Verbose(1) << "List of third Points is ";
    1661     for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    1662         Log() << Verbose(0) << " " << *(*it)->point;
    1663     }
    1664     Log() << Verbose(0) << endl;
    1665 
    1666     for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    1667       // add third triangle point
    1668       AddTesselationPoint((*it)->point, 2);
    1669       // add the second and third line
    1670       AddTesselationLine(TPS[1], TPS[2], 1);
    1671       AddTesselationLine(TPS[0], TPS[2], 2);
    1672       // ... and triangles to the Maps of the Tesselation class
    1673       BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
    1674       AddTesselationTriangle();
    1675       // ... and calculate its normal vector (with correct orientation)
    1676       (*it)->OptCenter.Scale(-1.);
    1677       Log() << Verbose(2) << "Anti-Oben is currently " << (*it)->OptCenter << "." << endl;
    1678       BTS->GetNormalVector((*it)->OptCenter);  // vector to compare with should point inwards
    1679       Log() << Verbose(0) << "==> Found starting triangle consists of " << *FirstPoint << ", " << *SecondPoint << " and "
    1680       << *(*it)->point << " with normal vector " << BTS->NormalVector << ".\n";
    1681 
    1682       // if we do not reach the end with the next step of iteration, we need to setup a new first line
    1683       if (it != OptCandidates->end()--) {
    1684         FirstPoint = (*it)->BaseLine->endpoints[0]->node;
    1685         SecondPoint = (*it)->point;
    1686         // adding point 1 and point 2 and the line between them
    1687         AddTesselationPoint(FirstPoint, 0);
    1688         AddTesselationPoint(SecondPoint, 1);
    1689         AddTesselationLine(TPS[0], TPS[1], 0);
    1690       }
    1691       Log() << Verbose(2) << "Projection is " << BTS->NormalVector.ScalarProduct(&Oben) << "." << endl;
    1692     }
     1999    Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine.endpoints[0]->node << "." << endl;
     2000    Log() << Verbose(0) << "Found second point is at " << *BaseLine.endpoints[1]->node << ".\n";
     2001
     2002    //Log() << Verbose(1) << "INFO: OldSphereCenter is at " << helper << ".\n";
     2003    CandidateForTesselation OptCandidates(&BaseLine);
     2004    FindThirdPointForTesselation(NormalVector, SearchDirection, SphereCenter, OptCandidates, NULL, RADIUS, LC);
     2005    Log() << Verbose(0) << "List of third Points is:" << endl;
     2006    for (TesselPointList::iterator it = OptCandidates.pointlist.begin(); it != OptCandidates.pointlist.end(); it++) {
     2007        Log() << Verbose(0) << " " << *(*it) << endl;
     2008    }
     2009
     2010    BTS = NULL;
     2011    AddCandidateTriangle(OptCandidates);
     2012//    delete(BaseLine.endpoints[0]);
     2013//    delete(BaseLine.endpoints[1]);
     2014
    16932015    if (BTS != NULL) // we have created one starting triangle
    16942016      break;
    16952017    else {
    16962018      // remove all candidates from the list and then the list itself
    1697       class CandidateForTesselation *remover = NULL;
    1698       for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    1699         remover = *it;
    1700         delete(remover);
    1701       }
    1702       OptCandidates->clear();
    1703     }
    1704   }
    1705 
    1706   // remove all candidates from the list and then the list itself
    1707   class CandidateForTesselation *remover = NULL;
    1708   for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    1709     remover = *it;
    1710     delete(remover);
    1711   }
    1712   delete(OptCandidates);
    1713   Log() << Verbose(1) << "End of FindStartingTriangle\n";
     2019      OptCandidates.pointlist.clear();
     2020    }
     2021  }
    17142022};
    17152023
    17162024/** Checks for a given baseline and a third point candidate whether baselines of the found triangle don't have even better candidates.
    17172025 * This is supposed to prevent early closing of the tesselation.
    1718  * \param *BaseRay baseline, i.e. not \a *OptCandidate
     2026 * \param CandidateLine CandidateForTesselation with baseline and shortestangle , i.e. not \a *OptCandidate
    17192027 * \param *ThirdNode third point in triangle, not in BoundaryLineSet::endpoints
    1720  * \param ShortestAngle path length on this circle band for the current \a *ThirdNode
    17212028 * \param RADIUS radius of sphere
    17222029 * \param *LC LinkedCell structure
    17232030 * \return true - there is a better candidate (smaller angle than \a ShortestAngle), false - no better TesselPoint candidate found
    17242031 */
    1725 bool Tesselation::HasOtherBaselineBetterCandidate(const BoundaryLineSet * const BaseRay, const TesselPoint * const ThirdNode, double ShortestAngle, double RADIUS, const LinkedCell * const LC) const
    1726 {
    1727   bool result = false;
    1728   Vector CircleCenter;
    1729   Vector CirclePlaneNormal;
    1730   Vector OldSphereCenter;
    1731   Vector SearchDirection;
    1732   Vector helper;
    1733   TesselPoint *OtherOptCandidate = NULL;
    1734   double OtherShortestAngle = 2.*M_PI; // This will indicate the quadrant.
    1735   double radius, CircleRadius;
    1736   BoundaryLineSet *Line = NULL;
    1737   BoundaryTriangleSet *T = NULL;
    1738 
    1739   Log() << Verbose(1) << "Begin of HasOtherBaselineBetterCandidate" << endl;
    1740 
    1741   // check both other lines
    1742   PointMap::const_iterator FindPoint = PointsOnBoundary.find(ThirdNode->nr);
    1743   if (FindPoint != PointsOnBoundary.end()) {
    1744     for (int i=0;i<2;i++) {
    1745       LineMap::const_iterator FindLine = (FindPoint->second)->lines.find(BaseRay->endpoints[0]->node->nr);
    1746       if (FindLine != (FindPoint->second)->lines.end()) {
    1747         Line = FindLine->second;
    1748         Log() << Verbose(1) << "Found line " << *Line << "." << endl;
    1749         if (Line->triangles.size() == 1) {
    1750           T = Line->triangles.begin()->second;
    1751           // construct center of circle
    1752           CircleCenter.CopyVector(Line->endpoints[0]->node->node);
    1753           CircleCenter.AddVector(Line->endpoints[1]->node->node);
    1754           CircleCenter.Scale(0.5);
    1755 
    1756           // construct normal vector of circle
    1757           CirclePlaneNormal.CopyVector(Line->endpoints[0]->node->node);
    1758           CirclePlaneNormal.SubtractVector(Line->endpoints[1]->node->node);
    1759 
    1760           // calculate squared radius of circle
    1761           radius = CirclePlaneNormal.ScalarProduct(&CirclePlaneNormal);
    1762           if (radius/4. < RADIUS*RADIUS) {
    1763             CircleRadius = RADIUS*RADIUS - radius/4.;
    1764             CirclePlaneNormal.Normalize();
    1765             //Log() << Verbose(2) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
    1766 
    1767             // construct old center
    1768             GetCenterofCircumcircle(&OldSphereCenter, *T->endpoints[0]->node->node, *T->endpoints[1]->node->node, *T->endpoints[2]->node->node);
    1769             helper.CopyVector(&T->NormalVector);  // normal vector ensures that this is correct center of the two possible ones
    1770             radius = Line->endpoints[0]->node->node->DistanceSquared(&OldSphereCenter);
    1771             helper.Scale(sqrt(RADIUS*RADIUS - radius));
    1772             OldSphereCenter.AddVector(&helper);
    1773             OldSphereCenter.SubtractVector(&CircleCenter);
    1774             //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;
    1775 
    1776             // construct SearchDirection
    1777             SearchDirection.MakeNormalVector(&T->NormalVector, &CirclePlaneNormal);
    1778             helper.CopyVector(Line->endpoints[0]->node->node);
    1779             helper.SubtractVector(ThirdNode->node);
    1780             if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards!
    1781               SearchDirection.Scale(-1.);
    1782             SearchDirection.ProjectOntoPlane(&OldSphereCenter);
    1783             SearchDirection.Normalize();
    1784             Log() << Verbose(2) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
    1785             if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {
    1786               // rotated the wrong way!
    1787               eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl;
    1788             }
    1789 
    1790             // add third point
    1791             CandidateList *OptCandidates = new CandidateList();
    1792             FindThirdPointForTesselation(T->NormalVector, SearchDirection, OldSphereCenter, Line, ThirdNode, OptCandidates, &OtherShortestAngle, RADIUS, LC);
    1793             for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    1794               if (((*it)->point == BaseRay->endpoints[0]->node) || ((*it)->point == BaseRay->endpoints[1]->node)) // skip if it's the same triangle than suggested
    1795                 continue;
    1796               Log() << Verbose(1) << " Third point candidate is " << *(*it)->point
    1797               << " with circumsphere's center at " << (*it)->OptCenter << "." << endl;
    1798               Log() << Verbose(1) << " Baseline is " << *BaseRay << endl;
    1799 
    1800               // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2)
    1801               TesselPoint *PointCandidates[3];
    1802               PointCandidates[0] = (*it)->point;
    1803               PointCandidates[1] = BaseRay->endpoints[0]->node;
    1804               PointCandidates[2] = BaseRay->endpoints[1]->node;
    1805               bool check=false;
    1806               int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates);
    1807               // If there is no triangle, add it regularly.
    1808               if (existentTrianglesCount == 0) {
    1809                 SetTesselationPoint((*it)->point, 0);
    1810                 SetTesselationPoint(BaseRay->endpoints[0]->node, 1);
    1811                 SetTesselationPoint(BaseRay->endpoints[1]->node, 2);
    1812 
    1813                 if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) {
    1814                   OtherOptCandidate = (*it)->point;
    1815                   check = true;
    1816                 }
    1817               } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time.
    1818                 SetTesselationPoint((*it)->point, 0);
    1819                 SetTesselationPoint(BaseRay->endpoints[0]->node, 1);
    1820                 SetTesselationPoint(BaseRay->endpoints[1]->node, 2);
    1821 
    1822                 // We demand that at most one new degenerate line is created and that this line also already exists (which has to be the case due to existentTrianglesCount == 1)
    1823                 // i.e. at least one of the three lines must be present with TriangleCount <= 1
    1824                 if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS)) {
    1825                   OtherOptCandidate = (*it)->point;
    1826                   check = true;
    1827                 }
    1828               }
    1829 
    1830               if (check) {
    1831                 if (ShortestAngle > OtherShortestAngle) {
    1832                   Log() << Verbose(1) << "There is a better candidate than " << *ThirdNode << " with " << ShortestAngle << " from baseline " << *Line << ": " << *OtherOptCandidate << " with " << OtherShortestAngle << "." << endl;
    1833                   result = true;
    1834                   break;
    1835                 }
    1836               }
    1837             }
    1838             delete(OptCandidates);
    1839             if (result)
    1840               break;
    1841           } else {
    1842             Log() << Verbose(1) << "Circumcircle for base line " << *Line << " and base triangle " << T << " is too big!" << endl;
    1843           }
    1844         } else {
    1845           eLog() << Verbose(2) << "Baseline is connected to two triangles already?" << endl;
    1846         }
    1847       } else {
    1848         Log() << Verbose(2) << "No present baseline between " << BaseRay->endpoints[0] << " and candidate " << *ThirdNode << "." << endl;
    1849       }
    1850     }
    1851   } else {
    1852     eLog() << Verbose(1) << "Could not find the TesselPoint " << *ThirdNode << "." << endl;
    1853   }
    1854 
    1855   Log() << Verbose(1) << "End of HasOtherBaselineBetterCandidate" << endl;
    1856 
    1857   return result;
    1858 };
     2032//bool Tesselation::HasOtherBaselineBetterCandidate(CandidateForTesselation &CandidateLine, const TesselPoint * const ThirdNode, double RADIUS, const LinkedCell * const LC) const
     2033//{
     2034//      Info FunctionInfo(__func__);
     2035//  bool result = false;
     2036//  Vector CircleCenter;
     2037//  Vector CirclePlaneNormal;
     2038//  Vector OldSphereCenter;
     2039//  Vector SearchDirection;
     2040//  Vector helper;
     2041//  TesselPoint *OtherOptCandidate = NULL;
     2042//  double OtherShortestAngle = 2.*M_PI; // This will indicate the quadrant.
     2043//  double radius, CircleRadius;
     2044//  BoundaryLineSet *Line = NULL;
     2045//  BoundaryTriangleSet *T = NULL;
     2046//
     2047//  // check both other lines
     2048//  PointMap::const_iterator FindPoint = PointsOnBoundary.find(ThirdNode->nr);
     2049//  if (FindPoint != PointsOnBoundary.end()) {
     2050//    for (int i=0;i<2;i++) {
     2051//      LineMap::const_iterator FindLine = (FindPoint->second)->lines.find(BaseRay->endpoints[0]->node->nr);
     2052//      if (FindLine != (FindPoint->second)->lines.end()) {
     2053//        Line = FindLine->second;
     2054//        Log() << Verbose(0) << "Found line " << *Line << "." << endl;
     2055//        if (Line->triangles.size() == 1) {
     2056//          T = Line->triangles.begin()->second;
     2057//          // construct center of circle
     2058//          CircleCenter.CopyVector(Line->endpoints[0]->node->node);
     2059//          CircleCenter.AddVector(Line->endpoints[1]->node->node);
     2060//          CircleCenter.Scale(0.5);
     2061//
     2062//          // construct normal vector of circle
     2063//          CirclePlaneNormal.CopyVector(Line->endpoints[0]->node->node);
     2064//          CirclePlaneNormal.SubtractVector(Line->endpoints[1]->node->node);
     2065//
     2066//          // calculate squared radius of circle
     2067//          radius = CirclePlaneNormal.ScalarProduct(&CirclePlaneNormal);
     2068//          if (radius/4. < RADIUS*RADIUS) {
     2069//            CircleRadius = RADIUS*RADIUS - radius/4.;
     2070//            CirclePlaneNormal.Normalize();
     2071//            //Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
     2072//
     2073//            // construct old center
     2074//            GetCenterofCircumcircle(&OldSphereCenter, *T->endpoints[0]->node->node, *T->endpoints[1]->node->node, *T->endpoints[2]->node->node);
     2075//            helper.CopyVector(&T->NormalVector);  // normal vector ensures that this is correct center of the two possible ones
     2076//            radius = Line->endpoints[0]->node->node->DistanceSquared(&OldSphereCenter);
     2077//            helper.Scale(sqrt(RADIUS*RADIUS - radius));
     2078//            OldSphereCenter.AddVector(&helper);
     2079//            OldSphereCenter.SubtractVector(&CircleCenter);
     2080//            //Log() << Verbose(1) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;
     2081//
     2082//            // construct SearchDirection
     2083//            SearchDirection.MakeNormalVector(&T->NormalVector, &CirclePlaneNormal);
     2084//            helper.CopyVector(Line->endpoints[0]->node->node);
     2085//            helper.SubtractVector(ThirdNode->node);
     2086//            if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards!
     2087//              SearchDirection.Scale(-1.);
     2088//            SearchDirection.ProjectOntoPlane(&OldSphereCenter);
     2089//            SearchDirection.Normalize();
     2090//            Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
     2091//            if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {
     2092//              // rotated the wrong way!
     2093//              eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl;
     2094//            }
     2095//
     2096//            // add third point
     2097//            FindThirdPointForTesselation(T->NormalVector, SearchDirection, OldSphereCenter, OptCandidates, ThirdNode, RADIUS, LC);
     2098//            for (TesselPointList::iterator it = OptCandidates.pointlist.begin(); it != OptCandidates.pointlist.end(); ++it) {
     2099//              if (((*it) == BaseRay->endpoints[0]->node) || ((*it) == BaseRay->endpoints[1]->node)) // skip if it's the same triangle than suggested
     2100//                continue;
     2101//              Log() << Verbose(0) << " Third point candidate is " << (*it)
     2102//              << " with circumsphere's center at " << (*it)->OptCenter << "." << endl;
     2103//              Log() << Verbose(0) << " Baseline is " << *BaseRay << endl;
     2104//
     2105//              // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2)
     2106//              TesselPoint *PointCandidates[3];
     2107//              PointCandidates[0] = (*it);
     2108//              PointCandidates[1] = BaseRay->endpoints[0]->node;
     2109//              PointCandidates[2] = BaseRay->endpoints[1]->node;
     2110//              bool check=false;
     2111//              int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates);
     2112//              // If there is no triangle, add it regularly.
     2113//              if (existentTrianglesCount == 0) {
     2114//                SetTesselationPoint((*it), 0);
     2115//                SetTesselationPoint(BaseRay->endpoints[0]->node, 1);
     2116//                SetTesselationPoint(BaseRay->endpoints[1]->node, 2);
     2117//
     2118//                if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) {
     2119//                  OtherOptCandidate = (*it);
     2120//                  check = true;
     2121//                }
     2122//              } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time.
     2123//                SetTesselationPoint((*it), 0);
     2124//                SetTesselationPoint(BaseRay->endpoints[0]->node, 1);
     2125//                SetTesselationPoint(BaseRay->endpoints[1]->node, 2);
     2126//
     2127//                // We demand that at most one new degenerate line is created and that this line also already exists (which has to be the case due to existentTrianglesCount == 1)
     2128//                // i.e. at least one of the three lines must be present with TriangleCount <= 1
     2129//                if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS)) {
     2130//                  OtherOptCandidate = (*it);
     2131//                  check = true;
     2132//                }
     2133//              }
     2134//
     2135//              if (check) {
     2136//                if (ShortestAngle > OtherShortestAngle) {
     2137//                  Log() << Verbose(0) << "There is a better candidate than " << *ThirdNode << " with " << ShortestAngle << " from baseline " << *Line << ": " << *OtherOptCandidate << " with " << OtherShortestAngle << "." << endl;
     2138//                  result = true;
     2139//                  break;
     2140//                }
     2141//              }
     2142//            }
     2143//            delete(OptCandidates);
     2144//            if (result)
     2145//              break;
     2146//          } else {
     2147//            Log() << Verbose(0) << "Circumcircle for base line " << *Line << " and base triangle " << T << " is too big!" << endl;
     2148//          }
     2149//        } else {
     2150//          eLog() << Verbose(2) << "Baseline is connected to two triangles already?" << endl;
     2151//        }
     2152//      } else {
     2153//        Log() << Verbose(1) << "No present baseline between " << BaseRay->endpoints[0] << " and candidate " << *ThirdNode << "." << endl;
     2154//      }
     2155//    }
     2156//  } else {
     2157//    eLog() << Verbose(1) << "Could not find the TesselPoint " << *ThirdNode << "." << endl;
     2158//  }
     2159//
     2160//  return result;
     2161//};
    18592162
    18602163/** This function finds a triangle to a line, adjacent to an existing one.
    18612164 * @param out output stream for debugging
    1862  * @param Line current baseline to search from
     2165 * @param CandidateLine current cadndiate baseline to search from
    18632166 * @param T current triangle which \a Line is edge of
    18642167 * @param RADIUS radius of the rolling ball
     
    18662169 * @param *LC LinkedCell structure with neighbouring points
    18672170 */
    1868 bool Tesselation::FindNextSuitableTriangle(BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC)
    1869 {
    1870   Log() << Verbose(0) << "Begin of FindNextSuitableTriangle\n";
     2171bool Tesselation::FindNextSuitableTriangle(CandidateForTesselation &CandidateLine, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC)
     2172{
     2173        Info FunctionInfo(__func__);
    18712174  bool result = true;
    1872   CandidateList *OptCandidates = new CandidateList();
    18732175
    18742176  Vector CircleCenter;
    18752177  Vector CirclePlaneNormal;
    1876   Vector OldSphereCenter;
     2178  Vector RelativeSphereCenter;
    18772179  Vector SearchDirection;
    18782180  Vector helper;
    18792181  TesselPoint *ThirdNode = NULL;
    18802182  LineMap::iterator testline;
    1881   double ShortestAngle = 2.*M_PI; // This will indicate the quadrant.
    18822183  double radius, CircleRadius;
    18832184
    1884   Log() << Verbose(1) << "Current baseline is " << Line << " of triangle " << T << "." << endl;
    18852185  for (int i=0;i<3;i++)
    1886     if ((T.endpoints[i]->node != Line.endpoints[0]->node) && (T.endpoints[i]->node != Line.endpoints[1]->node))
     2186    if ((T.endpoints[i]->node != CandidateLine.BaseLine->endpoints[0]->node) && (T.endpoints[i]->node != CandidateLine.BaseLine->endpoints[1]->node)) {
    18872187      ThirdNode = T.endpoints[i]->node;
     2188      break;
     2189    }
     2190  Log() << Verbose(0) << "Current baseline is " << *CandidateLine.BaseLine << " with ThirdNode " << *ThirdNode << " of triangle " << T << "." << endl;
    18882191
    18892192  // construct center of circle
    1890   CircleCenter.CopyVector(Line.endpoints[0]->node->node);
    1891   CircleCenter.AddVector(Line.endpoints[1]->node->node);
     2193  CircleCenter.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node);
     2194  CircleCenter.AddVector(CandidateLine.BaseLine->endpoints[1]->node->node);
    18922195  CircleCenter.Scale(0.5);
    18932196
    18942197  // construct normal vector of circle
    1895   CirclePlaneNormal.CopyVector(Line.endpoints[0]->node->node);
    1896   CirclePlaneNormal.SubtractVector(Line.endpoints[1]->node->node);
     2198  CirclePlaneNormal.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node);
     2199  CirclePlaneNormal.SubtractVector(CandidateLine.BaseLine->endpoints[1]->node->node);
    18972200
    18982201  // calculate squared radius of circle
    18992202  radius = CirclePlaneNormal.ScalarProduct(&CirclePlaneNormal);
    19002203  if (radius/4. < RADIUS*RADIUS) {
     2204    // construct relative sphere center with now known CircleCenter
     2205    RelativeSphereCenter.CopyVector(&T.SphereCenter);
     2206    RelativeSphereCenter.SubtractVector(&CircleCenter);
     2207
    19012208    CircleRadius = RADIUS*RADIUS - radius/4.;
    19022209    CirclePlaneNormal.Normalize();
    1903     //Log() << Verbose(2) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
    1904 
    1905     // construct old center
    1906     GetCenterofCircumcircle(&OldSphereCenter, *T.endpoints[0]->node->node, *T.endpoints[1]->node->node, *T.endpoints[2]->node->node);
    1907     helper.CopyVector(&T.NormalVector);  // normal vector ensures that this is correct center of the two possible ones
    1908     radius = Line.endpoints[0]->node->node->DistanceSquared(&OldSphereCenter);
    1909     helper.Scale(sqrt(RADIUS*RADIUS - radius));
    1910     OldSphereCenter.AddVector(&helper);
    1911     OldSphereCenter.SubtractVector(&CircleCenter);
    1912     //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;
    1913 
    1914     // construct SearchDirection
    1915     SearchDirection.MakeNormalVector(&T.NormalVector, &CirclePlaneNormal);
    1916     helper.CopyVector(Line.endpoints[0]->node->node);
     2210    Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
     2211
     2212    Log() << Verbose(1) << "INFO: OldSphereCenter is at " << T.SphereCenter << "." << endl;
     2213
     2214    // construct SearchDirection and an "outward pointer"
     2215    SearchDirection.MakeNormalVector(&RelativeSphereCenter, &CirclePlaneNormal);
     2216    helper.CopyVector(&CircleCenter);
    19172217    helper.SubtractVector(ThirdNode->node);
    19182218    if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards!
    19192219      SearchDirection.Scale(-1.);
    1920     SearchDirection.ProjectOntoPlane(&OldSphereCenter);
    1921     SearchDirection.Normalize();
    1922     Log() << Verbose(2) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
    1923     if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {
     2220    Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
     2221    if (fabs(RelativeSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {
    19242222      // rotated the wrong way!
    19252223      eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl;
     
    19272225
    19282226    // add third point
    1929     FindThirdPointForTesselation(T.NormalVector, SearchDirection, OldSphereCenter, &Line, ThirdNode, OptCandidates, &ShortestAngle, RADIUS, LC);
     2227    FindThirdPointForTesselation(T.NormalVector, SearchDirection, T.SphereCenter, CandidateLine, ThirdNode, RADIUS, LC);
    19302228
    19312229  } else {
    1932     Log() << Verbose(1) << "Circumcircle for base line " << Line << " and base triangle " << T << " is too big!" << endl;
    1933   }
    1934 
    1935   if (OptCandidates->begin() == OptCandidates->end()) {
     2230    Log() << Verbose(0) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and base triangle " << T << " is too big!" << endl;
     2231  }
     2232
     2233  if (CandidateLine.pointlist.empty()) {
    19362234    eLog() << Verbose(2) << "Could not find a suitable candidate." << endl;
    19372235    return false;
    19382236  }
    1939   Log() << Verbose(1) << "Third Points are ";
    1940   for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    1941     Log() << Verbose(1) << " " << *(*it)->point << endl;
    1942   }
    1943 
    1944   BoundaryLineSet *BaseRay = &Line;
    1945   for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    1946     Log() << Verbose(1) << " Third point candidate is " << *(*it)->point
    1947     << " with circumsphere's center at " << (*it)->OptCenter << "." << endl;
    1948     Log() << Verbose(1) << " Baseline is " << *BaseRay << endl;
    1949 
    1950     // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2)
    1951     TesselPoint *PointCandidates[3];
    1952     PointCandidates[0] = (*it)->point;
    1953     PointCandidates[1] = BaseRay->endpoints[0]->node;
    1954     PointCandidates[2] = BaseRay->endpoints[1]->node;
    1955     int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates);
    1956 
    1957     BTS = NULL;
    1958     // check for present edges and whether we reach better candidates from them
    1959     if (HasOtherBaselineBetterCandidate(BaseRay, (*it)->point, ShortestAngle, RADIUS, LC) ) {
    1960       result = false;
    1961       break;
    1962     } else {
    1963       // If there is no triangle, add it regularly.
    1964       if (existentTrianglesCount == 0) {
    1965         AddTesselationPoint((*it)->point, 0);
    1966         AddTesselationPoint(BaseRay->endpoints[0]->node, 1);
    1967         AddTesselationPoint(BaseRay->endpoints[1]->node, 2);
    1968 
    1969         if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) {
    1970           AddTesselationLine(TPS[0], TPS[1], 0);
    1971           AddTesselationLine(TPS[0], TPS[2], 1);
    1972           AddTesselationLine(TPS[1], TPS[2], 2);
    1973 
    1974           BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
    1975           AddTesselationTriangle();
    1976           (*it)->OptCenter.Scale(-1.);
    1977           BTS->GetNormalVector((*it)->OptCenter);
    1978           (*it)->OptCenter.Scale(-1.);
    1979 
    1980           Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector
    1981             << " for this triangle ... " << endl;
    1982         //Log() << Verbose(1) << "We have "<< TrianglesOnBoundaryCount << " for line " << *BaseRay << "." << endl;
    1983         } else {
    1984           eLog() << Verbose(2) << "This triangle consisting of ";
    1985           Log() << Verbose(0) << *(*it)->point << ", ";
    1986           Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and ";
    1987           Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " ";
    1988           Log() << Verbose(0) << "exists and is not added, as it does not seem helpful!" << endl;
    1989           result = false;
    1990         }
    1991       } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time.
    1992           AddTesselationPoint((*it)->point, 0);
    1993           AddTesselationPoint(BaseRay->endpoints[0]->node, 1);
    1994           AddTesselationPoint(BaseRay->endpoints[1]->node, 2);
    1995 
    1996           // We demand that at most one new degenerate line is created and that this line also already exists (which has to be the case due to existentTrianglesCount == 1)
    1997           // i.e. at least one of the three lines must be present with TriangleCount <= 1
    1998           if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS)) {
    1999             AddTesselationLine(TPS[0], TPS[1], 0);
    2000             AddTesselationLine(TPS[0], TPS[2], 1);
    2001             AddTesselationLine(TPS[1], TPS[2], 2);
    2002 
    2003             BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
    2004             AddTesselationTriangle();  // add to global map
    2005 
    2006             (*it)->OtherOptCenter.Scale(-1.);
    2007             BTS->GetNormalVector((*it)->OtherOptCenter);
    2008             (*it)->OtherOptCenter.Scale(-1.);
    2009 
    2010             eLog() << Verbose(2) << "--> WARNING: Special new triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " for this triangle ... " << endl;
    2011             Log() << Verbose(1) << "We have "<< BaseRay->triangles.size() << " for line " << BaseRay << "." << endl;
    2012           } else {
    2013             eLog() << Verbose(2) << "This triangle consisting of " << *(*it)->point << ", " << *BaseRay->endpoints[0]->node << " and " << *BaseRay->endpoints[1]->node << " " << "exists and is not added, as it does not seem helpful!" << endl;
    2014             result = false;
    2015           }
    2016       } else {
    2017         Log() << Verbose(1) << "This triangle consisting of ";
    2018         Log() << Verbose(0) << *(*it)->point << ", ";
    2019         Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and ";
    2020         Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " ";
    2021         Log() << Verbose(0) << "is invalid!" << endl;
    2022         result = false;
    2023       }
    2024     }
    2025 
    2026     // set baseline to new ray from ref point (here endpoints[0]->node) to current candidate (here (*it)->point))
    2027     BaseRay = BLS[0];
    2028     if ((BTS != NULL) && (BTS->NormalVector.NormSquared() < MYEPSILON)) {
    2029       eLog() << Verbose(1) << "Triangle " << *BTS << " has zero normal vector!" << endl;
    2030       exit(255);
    2031     }
    2032 
    2033   }
    2034 
    2035   // remove all candidates from the list and then the list itself
    2036   class CandidateForTesselation *remover = NULL;
    2037   for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
    2038     remover = *it;
    2039     delete(remover);
    2040   }
    2041   delete(OptCandidates);
    2042   Log() << Verbose(0) << "End of FindNextSuitableTriangle\n";
     2237  Log() << Verbose(0) << "Third Points are: " << endl;
     2238  for (TesselPointList::iterator it = CandidateLine.pointlist.begin(); it != CandidateLine.pointlist.end(); ++it) {
     2239    Log() << Verbose(0) << " " << *(*it) << endl;
     2240  }
     2241
     2242  return true;
     2243
     2244//  BoundaryLineSet *BaseRay = CandidateLine.BaseLine;
     2245//  for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
     2246//    Log() << Verbose(0) << "Third point candidate is " << *(*it)->point
     2247//    << " with circumsphere's center at " << (*it)->OptCenter << "." << endl;
     2248//    Log() << Verbose(0) << "Baseline is " << *BaseRay << endl;
     2249//
     2250//    // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2)
     2251//    TesselPoint *PointCandidates[3];
     2252//    PointCandidates[0] = (*it)->point;
     2253//    PointCandidates[1] = BaseRay->endpoints[0]->node;
     2254//    PointCandidates[2] = BaseRay->endpoints[1]->node;
     2255//    int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates);
     2256//
     2257//    BTS = NULL;
     2258//    // check for present edges and whether we reach better candidates from them
     2259//    //if (HasOtherBaselineBetterCandidate(BaseRay, (*it)->point, ShortestAngle, RADIUS, LC) ) {
     2260//    if (0) {
     2261//      result = false;
     2262//      break;
     2263//    } else {
     2264//      // If there is no triangle, add it regularly.
     2265//      if (existentTrianglesCount == 0) {
     2266//        AddTesselationPoint((*it)->point, 0);
     2267//        AddTesselationPoint(BaseRay->endpoints[0]->node, 1);
     2268//        AddTesselationPoint(BaseRay->endpoints[1]->node, 2);
     2269//
     2270//        if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) {
     2271//          CandidateLine.point = (*it)->point;
     2272//          CandidateLine.OptCenter.CopyVector(&((*it)->OptCenter));
     2273//          CandidateLine.OtherOptCenter.CopyVector(&((*it)->OtherOptCenter));
     2274//          CandidateLine.ShortestAngle = ShortestAngle;
     2275//        } else {
     2276////          eLog() << Verbose(1) << "This triangle consisting of ";
     2277////          Log() << Verbose(0) << *(*it)->point << ", ";
     2278////          Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and ";
     2279////          Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " ";
     2280////          Log() << Verbose(0) << "exists and is not added, as it 0x80000000006fc150(does not seem helpful!" << endl;
     2281//          result = false;
     2282//        }
     2283//      } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time.
     2284//          AddTesselationPoint((*it)->point, 0);
     2285//          AddTesselationPoint(BaseRay->endpoints[0]->node, 1);
     2286//          AddTesselationPoint(BaseRay->endpoints[1]->node, 2);
     2287//
     2288//          // We demand that at most one new degenerate line is created and that this line also already exists (which has to be the case due to existentTrianglesCount == 1)
     2289//          // i.e. at least one of the three lines must be present with TriangleCount <= 1
     2290//          if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS) || CandidateLine.BaseLine->skipped) {
     2291//            CandidateLine.point = (*it)->point;
     2292//            CandidateLine.OptCenter.CopyVector(&(*it)->OptCenter);
     2293//            CandidateLine.OtherOptCenter.CopyVector(&(*it)->OtherOptCenter);
     2294//            CandidateLine.ShortestAngle = ShortestAngle+2.*M_PI;
     2295//
     2296//          } else {
     2297////            eLog() << Verbose(1) << "This triangle consisting of " << *(*it)->point << ", " << *BaseRay->endpoints[0]->node << " and " << *BaseRay->endpoints[1]->node << " " << "exists and is not added, as it does not seem helpful!" << endl;
     2298//            result = false;
     2299//          }
     2300//      } else {
     2301////        Log() << Verbose(1) << "This triangle consisting of ";
     2302////        Log() << Verbose(0) << *(*it)->point << ", ";
     2303////        Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and ";
     2304////        Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " ";
     2305////        Log() << Verbose(0) << "is invalid!" << endl;
     2306//        result = false;
     2307//      }
     2308//    }
     2309//
     2310//    // set baseline to new ray from ref point (here endpoints[0]->node) to current candidate (here (*it)->point))
     2311//    BaseRay = BLS[0];
     2312//    if ((BTS != NULL) && (BTS->NormalVector.NormSquared() < MYEPSILON)) {
     2313//      eLog() << Verbose(1) << "Triangle " << *BTS << " has zero normal vector!" << endl;
     2314//      exit(255);
     2315//    }
     2316//
     2317//  }
     2318//
     2319//  // remove all candidates from the list and then the list itself
     2320//  class CandidateForTesselation *remover = NULL;
     2321//  for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) {
     2322//    remover = *it;
     2323//    delete(remover);
     2324//  }
     2325//  delete(OptCandidates);
    20432326  return result;
     2327};
     2328
     2329/** Adds the present line and candidate point from \a &CandidateLine to the Tesselation.
     2330 * \param CandidateLine triangle to add
     2331 * \NOTE we need the copy operator here as the original CandidateForTesselation is removed in AddTesselationLine()
     2332 */
     2333void Tesselation::AddCandidateTriangle(CandidateForTesselation CandidateLine)
     2334{
     2335        Info FunctionInfo(__func__);
     2336  Vector Center;
     2337  TesselPoint * const TurningPoint = CandidateLine.BaseLine->endpoints[0]->node;
     2338
     2339  // fill the set of neighbours
     2340  Center.CopyVector(CandidateLine.BaseLine->endpoints[1]->node->node);
     2341  Center.SubtractVector(TurningPoint->node);
     2342  set<TesselPoint*> SetOfNeighbours;
     2343  SetOfNeighbours.insert(CandidateLine.BaseLine->endpoints[1]->node);
     2344  for (TesselPointList::iterator Runner = CandidateLine.pointlist.begin(); Runner != CandidateLine.pointlist.end(); Runner++)
     2345    SetOfNeighbours.insert(*Runner);
     2346  TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(&SetOfNeighbours, TurningPoint, &Center);
     2347
     2348  // go through all angle-sorted candidates (in degenerate n-nodes case we may have to add multiple triangles)
     2349  TesselPointList::iterator Runner = connectedClosestPoints->begin();
     2350  TesselPointList::iterator Sprinter = Runner;
     2351  Sprinter++;
     2352  while(Sprinter != connectedClosestPoints->end()) {
     2353    // add the points
     2354    AddTesselationPoint(TurningPoint, 0);
     2355    AddTesselationPoint((*Runner), 1);
     2356    AddTesselationPoint((*Sprinter), 2);
     2357
     2358
     2359    // add the lines
     2360    AddTesselationLine(TPS[0], TPS[1], 0);
     2361    AddTesselationLine(TPS[0], TPS[2], 1);
     2362    AddTesselationLine(TPS[1], TPS[2], 2);
     2363
     2364    // add the triangles
     2365    BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
     2366    AddTesselationTriangle();
     2367    BTS->GetCenter(&Center);
     2368    Center.SubtractVector(&CandidateLine.OptCenter);
     2369    BTS->SphereCenter.CopyVector(&CandidateLine.OptCenter);
     2370    BTS->GetNormalVector(Center);
     2371
     2372    Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector << "." << endl;
     2373    Runner = Sprinter;
     2374    Sprinter++;
     2375  }
     2376  delete(connectedClosestPoints);
    20442377};
    20452378
     
    20532386class BoundaryPointSet *Tesselation::IsConvexRectangle(class BoundaryLineSet *Base)
    20542387{
     2388        Info FunctionInfo(__func__);
    20552389  class BoundaryPointSet *Spot = NULL;
    20562390  class BoundaryLineSet *OtherBase;
     
    20642398  OtherBase = new class BoundaryLineSet(BPS,-1);
    20652399
    2066   Log() << Verbose(3) << "INFO: Current base line is " << *Base << "." << endl;
    2067   Log() << Verbose(3) << "INFO: Other base line is " << *OtherBase << "." << endl;
     2400  Log() << Verbose(1) << "INFO: Current base line is " << *Base << "." << endl;
     2401  Log() << Verbose(1) << "INFO: Other base line is " << *OtherBase << "." << endl;
    20682402
    20692403  // get the closest point on each line to the other line
     
    20852419  delete(ClosestPoint);
    20862420  if ((distance[0] * distance[1]) > 0)  { // have same sign?
    2087     Log() << Verbose(3) << "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1]  << ". " << *Base << "' rectangle is concave." << endl;
     2421    Log() << Verbose(1) << "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1]  << ". " << *Base << "' rectangle is concave." << endl;
    20882422    if (distance[0] < distance[1]) {
    20892423      Spot = Base->endpoints[0];
     
    20932427    return Spot;
    20942428  } else {  // different sign, i.e. we are in between
    2095     Log() << Verbose(3) << "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex." << endl;
     2429    Log() << Verbose(0) << "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex." << endl;
    20962430    return NULL;
    20972431  }
     
    21012435void Tesselation::PrintAllBoundaryPoints(ofstream *out) const
    21022436{
     2437        Info FunctionInfo(__func__);
    21032438  // print all lines
    2104   Log() << Verbose(1) << "Printing all boundary points for debugging:" << endl;
     2439  Log() << Verbose(0) << "Printing all boundary points for debugging:" << endl;
    21052440  for (PointMap::const_iterator PointRunner = PointsOnBoundary.begin();PointRunner != PointsOnBoundary.end(); PointRunner++)
    2106     Log() << Verbose(2) << *(PointRunner->second) << endl;
     2441    Log() << Verbose(0) << *(PointRunner->second) << endl;
    21072442};
    21082443
    21092444void Tesselation::PrintAllBoundaryLines(ofstream *out) const
    21102445{
     2446        Info FunctionInfo(__func__);
    21112447  // print all lines
    2112   Log() << Verbose(1) << "Printing all boundary lines for debugging:" << endl;
     2448  Log() << Verbose(0) << "Printing all boundary lines for debugging:" << endl;
    21132449  for (LineMap::const_iterator LineRunner = LinesOnBoundary.begin(); LineRunner != LinesOnBoundary.end(); LineRunner++)
    2114     Log() << Verbose(2) << *(LineRunner->second) << endl;
     2450    Log() << Verbose(0) << *(LineRunner->second) << endl;
    21152451};
    21162452
    21172453void Tesselation::PrintAllBoundaryTriangles(ofstream *out) const
    21182454{
     2455        Info FunctionInfo(__func__);
    21192456  // print all triangles
    2120   Log() << Verbose(1) << "Printing all boundary triangles for debugging:" << endl;
     2457  Log() << Verbose(0) << "Printing all boundary triangles for debugging:" << endl;
    21212458  for (TriangleMap::const_iterator TriangleRunner = TrianglesOnBoundary.begin(); TriangleRunner != TrianglesOnBoundary.end(); TriangleRunner++)
    2122     Log() << Verbose(2) << *(TriangleRunner->second) << endl;
     2459    Log() << Verbose(0) << *(TriangleRunner->second) << endl;
    21232460};
    21242461
     
    21302467double Tesselation::PickFarthestofTwoBaselines(class BoundaryLineSet *Base)
    21312468{
     2469        Info FunctionInfo(__func__);
    21322470  class BoundaryLineSet *OtherBase;
    21332471  Vector *ClosestPoint[2];
     
    21412479  OtherBase = new class BoundaryLineSet(BPS,-1);
    21422480
    2143   Log() << Verbose(3) << "INFO: Current base line is " << *Base << "." << endl;
    2144   Log() << Verbose(3) << "INFO: Other base line is " << *OtherBase << "." << endl;
     2481  Log() << Verbose(0) << "INFO: Current base line is " << *Base << "." << endl;
     2482  Log() << Verbose(0) << "INFO: Other base line is " << *OtherBase << "." << endl;
    21452483
    21462484  // get the closest point on each line to the other line
     
    21622500
    21632501  if (Distance.NormSquared() < MYEPSILON) { // check for intersection
    2164     Log() << Verbose(3) << "REJECT: Both lines have an intersection: Nothing to do." << endl;
     2502    Log() << Verbose(0) << "REJECT: Both lines have an intersection: Nothing to do." << endl;
    21652503    return false;
    21662504  } else { // check for sign against BaseLineNormal
     
    21722510    }
    21732511    for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) {
    2174       Log() << Verbose(4) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;
     2512      Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;
    21752513      BaseLineNormal.AddVector(&(runner->second->NormalVector));
    21762514    }
     
    21782516
    21792517    if (Distance.ScalarProduct(&BaseLineNormal) > MYEPSILON) { // Distance points outwards, hence OtherBase higher than Base -> flip
    2180       Log() << Verbose(2) << "ACCEPT: Other base line would be higher: Flipping baseline." << endl;
     2518      Log() << Verbose(0) << "ACCEPT: Other base line would be higher: Flipping baseline." << endl;
    21812519      // calculate volume summand as a general tetraeder
    21822520      return volume;
    21832521    } else {  // Base higher than OtherBase -> do nothing
    2184       Log() << Verbose(2) << "REJECT: Base line is higher: Nothing to do." << endl;
     2522      Log() << Verbose(0) << "REJECT: Base line is higher: Nothing to do." << endl;
    21852523      return 0.;
    21862524    }
     
    21972535class BoundaryLineSet * Tesselation::FlipBaseline(class BoundaryLineSet *Base)
    21982536{
     2537        Info FunctionInfo(__func__);
    21992538  class BoundaryLineSet *OldLines[4], *NewLine;
    22002539  class BoundaryPointSet *OldPoints[2];
     
    22032542  int i,m;
    22042543
    2205   Log() << Verbose(1) << "Begin of FlipBaseline" << endl;
    2206 
    22072544  // calculate NormalVector for later use
    22082545  BaseLineNormal.Zero();
     
    22122549  }
    22132550  for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) {
    2214     Log() << Verbose(4) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;
     2551    Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;
    22152552    BaseLineNormal.AddVector(&(runner->second->NormalVector));
    22162553  }
     
    22252562  i=0;
    22262563  m=0;
    2227   Log() << Verbose(3) << "The four old lines are: ";
     2564  Log() << Verbose(0) << "The four old lines are: ";
    22282565  for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++)
    22292566    for (int j=0;j<3;j++) // all of their endpoints and baselines
     
    22332570      }
    22342571  Log() << Verbose(0) << endl;
    2235   Log() << Verbose(3) << "The two old points are: ";
     2572  Log() << Verbose(0) << "The two old points are: ";
    22362573  for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++)
    22372574    for (int j=0;j<3;j++) // all of their endpoints and baselines
     
    22592596
    22602597  // remove triangles and baseline removes itself
    2261   Log() << Verbose(3) << "INFO: Deleting baseline " << *Base << " from global list." << endl;
     2598  Log() << Verbose(0) << "INFO: Deleting baseline " << *Base << " from global list." << endl;
    22622599  OldBaseLineNr = Base->Nr;
    22632600  m=0;
    22642601  for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) {
    2265     Log() << Verbose(3) << "INFO: Deleting triangle " << *(runner->second) << "." << endl;
     2602    Log() << Verbose(0) << "INFO: Deleting triangle " << *(runner->second) << "." << endl;
    22662603    OldTriangleNrs[m++] = runner->second->Nr;
    22672604    RemoveTesselationTriangle(runner->second);
     
    22732610  NewLine = new class BoundaryLineSet(BPS, OldBaseLineNr);
    22742611  LinesOnBoundary.insert(LinePair(OldBaseLineNr, NewLine)); // no need for check for unique insertion as NewLine is definitely a new one
    2275   Log() << Verbose(3) << "INFO: Created new baseline " << *NewLine << "." << endl;
     2612  Log() << Verbose(0) << "INFO: Created new baseline " << *NewLine << "." << endl;
    22762613
    22772614  // construct new triangles with flipped baseline
     
    22882625    BTS->GetNormalVector(BaseLineNormal);
    22892626    AddTesselationTriangle(OldTriangleNrs[0]);
    2290     Log() << Verbose(3) << "INFO: Created new triangle " << *BTS << "." << endl;
     2627    Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl;
    22912628
    22922629    BLS[0] = (i==2 ? OldLines[3] : OldLines[2]);
     
    22962633    BTS->GetNormalVector(BaseLineNormal);
    22972634    AddTesselationTriangle(OldTriangleNrs[1]);
    2298     Log() << Verbose(3) << "INFO: Created new triangle " << *BTS << "." << endl;
     2635    Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl;
    22992636  } else {
    2300     Log() << Verbose(1) << "The four old lines do not connect, something's utterly wrong here!" << endl;
     2637    eLog() << Verbose(0) << "The four old lines do not connect, something's utterly wrong here!" << endl;
    23012638    return NULL;
    23022639  }
    23032640
    2304   Log() << Verbose(1) << "End of FlipBaseline" << endl;
    23052641  return NewLine;
    23062642};
     
    23172653void Tesselation::FindSecondPointForTesselation(TesselPoint* a, Vector Oben, TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell *LC)
    23182654{
    2319   Log() << Verbose(2) << "Begin of FindSecondPointForTesselation" << endl;
     2655        Info FunctionInfo(__func__);
    23202656  Vector AngleCheck;
    23212657  class TesselPoint* Candidate = NULL;
     
    23382674    Nupper[i] = ((N[i]+1) < LC->N[i]) ? N[i]+1 : LC->N[i]-1;
    23392675  }
    2340   Log() << Verbose(3) << "LC Intervals from [" << N[0] << "<->" << LC->N[0] << ", " << N[1] << "<->" << LC->N[1] << ", " << N[2] << "<->" << LC->N[2] << "] :"
     2676  Log() << Verbose(0) << "LC Intervals from [" << N[0] << "<->" << LC->N[0] << ", " << N[1] << "<->" << LC->N[1] << ", " << N[2] << "<->" << LC->N[2] << "] :"
    23412677    << " [" << Nlower[0] << "," << Nupper[0] << "], " << " [" << Nlower[1] << "," << Nupper[1] << "], " << " [" << Nlower[2] << "," << Nupper[2] << "], " << endl;
    23422678
     
    23452681      for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) {
    23462682        const LinkedNodes *List = LC->GetCurrentCell();
    2347         //Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;
     2683        //Log() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;
    23482684        if (List != NULL) {
    23492685          for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
     
    23762712                angle = AngleCheck.Angle(&Oben);
    23772713                if (angle < Storage[0]) {
    2378                   //Log() << Verbose(3) << "Old values of Storage: %lf %lf \n", Storage[0], Storage[1]);
    2379                   Log() << Verbose(3) << "Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << ".\n";
     2714                  //Log() << Verbose(1) << "Old values of Storage: %lf %lf \n", Storage[0], Storage[1]);
     2715                  Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << ".\n";
    23802716                  OptCandidate = Candidate;
    23812717                  Storage[0] = angle;
    2382                   //Log() << Verbose(3) << "Changing something in Storage: %lf %lf. \n", Storage[0], Storage[2]);
     2718                  //Log() << Verbose(1) << "Changing something in Storage: %lf %lf. \n", Storage[0], Storage[2]);
    23832719                } else {
    2384                   //Log() << Verbose(3) << "Current candidate is " << *Candidate << ": Looses with angle " << angle << " to a better candidate " << *OptCandidate << endl;
     2720                  //Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Looses with angle " << angle << " to a better candidate " << *OptCandidate << endl;
    23852721                }
    23862722              } else {
    2387                 //Log() << Verbose(3) << "Current candidate is " << *Candidate << ": Refused due to Radius " << norm << endl;
     2723                //Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Refused due to Radius " << norm << endl;
    23882724              }
    23892725            } else {
    2390               //Log() << Verbose(3) << "Current candidate is " << *Candidate << ": Candidate is equal to first endpoint." << *a << "." << endl;
     2726              //Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Candidate is equal to first endpoint." << *a << "." << endl;
    23912727            }
    23922728          }
    23932729        } else {
    2394           Log() << Verbose(3) << "Linked cell list is empty." << endl;
     2730          Log() << Verbose(0) << "Linked cell list is empty." << endl;
    23952731        }
    23962732      }
    2397   Log() << Verbose(2) << "End of FindSecondPointForTesselation" << endl;
    23982733};
    23992734
     
    24242759 * @param SearchDirection general direction where to search for the next point, relative to center of BaseLine
    24252760 * @param OldSphereCenter center of sphere for base triangle, relative to center of BaseLine, giving null angle for the parameter circle
    2426  * @param BaseLine BoundaryLineSet with the current base line
     2761 * @param CandidateLine CandidateForTesselation with the current base line and list of candidates and ShortestAngle
    24272762 * @param ThirdNode third point to avoid in search
    2428  * @param candidates list of equally good candidates to return
    2429  * @param ShortestAngle the current path length on this circle band for the current OptCandidate
    24302763 * @param RADIUS radius of sphere
    24312764 * @param *LC LinkedCell structure with neighbouring points
    24322765 */
    2433 void Tesselation::FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, class BoundaryLineSet *BaseLine, const class TesselPoint  * const ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, const LinkedCell *LC) const
    2434 {
     2766void Tesselation::FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, CandidateForTesselation &CandidateLine, const class TesselPoint  * const ThirdNode, const double RADIUS, const LinkedCell *LC) const
     2767{
     2768        Info FunctionInfo(__func__);
    24352769  Vector CircleCenter;  // center of the circle, i.e. of the band of sphere's centers
    24362770  Vector CirclePlaneNormal; // normal vector defining the plane this circle lives in
     
    24402774  Vector NewNormalVector;   // normal vector of the Candidate's triangle
    24412775  Vector helper, OptCandidateCenter, OtherOptCandidateCenter;
     2776  Vector RelativeOldSphereCenter;
     2777  Vector NewPlaneCenter;
    24422778  double CircleRadius; // radius of this circle
    24432779  double radius;
     2780  double otherradius;
    24442781  double alpha, Otheralpha; // angles (i.e. parameter for the circle).
    24452782  int N[NDIM], Nlower[NDIM], Nupper[NDIM];
    24462783  TesselPoint *Candidate = NULL;
    2447   CandidateForTesselation *optCandidate = NULL;
    2448 
    2449   Log() << Verbose(1) << "Begin of FindThirdPointForTesselation" << endl;
    2450 
    2451   Log() << Verbose(2) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl;
     2784
     2785  Log() << Verbose(1) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl;
    24522786
    24532787  // construct center of circle
    2454   CircleCenter.CopyVector(BaseLine->endpoints[0]->node->node);
    2455   CircleCenter.AddVector(BaseLine->endpoints[1]->node->node);
     2788  CircleCenter.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node);
     2789  CircleCenter.AddVector(CandidateLine.BaseLine->endpoints[1]->node->node);
    24562790  CircleCenter.Scale(0.5);
    24572791
    24582792  // construct normal vector of circle
    2459   CirclePlaneNormal.CopyVector(BaseLine->endpoints[0]->node->node);
    2460   CirclePlaneNormal.SubtractVector(BaseLine->endpoints[1]->node->node);
     2793  CirclePlaneNormal.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node);
     2794  CirclePlaneNormal.SubtractVector(CandidateLine.BaseLine->endpoints[1]->node->node);
     2795
     2796  RelativeOldSphereCenter.CopyVector(&OldSphereCenter);
     2797  RelativeOldSphereCenter.SubtractVector(&CircleCenter);
    24612798
    24622799  // calculate squared radius TesselPoint *ThirdNode,f circle
    2463   radius = CirclePlaneNormal.ScalarProduct(&CirclePlaneNormal);
    2464   if (radius/4. < RADIUS*RADIUS) {
    2465     CircleRadius = RADIUS*RADIUS - radius/4.;
     2800  radius = CirclePlaneNormal.NormSquared()/4.;
     2801  if (radius < RADIUS*RADIUS) {
     2802    CircleRadius = RADIUS*RADIUS - radius;
    24662803    CirclePlaneNormal.Normalize();
    2467     //Log() << Verbose(2) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
     2804    Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
    24682805
    24692806    // test whether old center is on the band's plane
    2470     if (fabs(OldSphereCenter.ScalarProduct(&CirclePlaneNormal)) > HULLEPSILON) {
    2471       eLog() << Verbose(1) << "Something's very wrong here: OldSphereCenter is not on the band's plane as desired by " << fabs(OldSphereCenter.ScalarProduct(&CirclePlaneNormal)) << "!" << endl;
    2472       OldSphereCenter.ProjectOntoPlane(&CirclePlaneNormal);
    2473     }
    2474     radius = OldSphereCenter.ScalarProduct(&OldSphereCenter);
     2807    if (fabs(RelativeOldSphereCenter.ScalarProduct(&CirclePlaneNormal)) > HULLEPSILON) {
     2808      eLog() << Verbose(1) << "Something's very wrong here: RelativeOldSphereCenter is not on the band's plane as desired by " << fabs(RelativeOldSphereCenter.ScalarProduct(&CirclePlaneNormal)) << "!" << endl;
     2809      RelativeOldSphereCenter.ProjectOntoPlane(&CirclePlaneNormal);
     2810    }
     2811    radius = RelativeOldSphereCenter.NormSquared();
    24752812    if (fabs(radius - CircleRadius) < HULLEPSILON) {
    2476       //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;
     2813      Log() << Verbose(1) << "INFO: RelativeOldSphereCenter is at " << RelativeOldSphereCenter << "." << endl;
    24772814
    24782815      // check SearchDirection
    2479       //Log() << Verbose(2) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
    2480       if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {  // rotated the wrong way!
     2816      Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
     2817      if (fabs(RelativeOldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) {  // rotated the wrong way!
    24812818        eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are not orthogonal!" << endl;
    24822819      }
     
    24862823        for(int i=0;i<NDIM;i++) // store indices of this cell
    24872824        N[i] = LC->n[i];
    2488         //Log() << Verbose(2) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
     2825        //Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
    24892826      } else {
    24902827        eLog() << Verbose(1) << "Vector " << CircleCenter << " is outside of LinkedCell's bounding box." << endl;
     
    24922829      }
    24932830      // then go through the current and all neighbouring cells and check the contained points for possible candidates
    2494       //Log() << Verbose(2) << "LC Intervals:";
     2831      //Log() << Verbose(1) << "LC Intervals:";
    24952832      for (int i=0;i<NDIM;i++) {
    24962833        Nlower[i] = ((N[i]-1) >= 0) ? N[i]-1 : 0;
     
    25032840          for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) {
    25042841            const LinkedNodes *List = LC->GetCurrentCell();
    2505             //Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;
     2842            //Log() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;
    25062843            if (List != NULL) {
    25072844              for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
     
    25092846
    25102847                // check for three unique points
    2511                 //Log() << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " at " << Candidate->node << "." << endl;
    2512                 if ((Candidate != BaseLine->endpoints[0]->node) && (Candidate != BaseLine->endpoints[1]->node) ){
    2513 
    2514                   // construct both new centers
    2515                   GetCenterofCircumcircle(&NewSphereCenter, *BaseLine->endpoints[0]->node->node, *BaseLine->endpoints[1]->node->node, *Candidate->node);
    2516                   OtherNewSphereCenter.CopyVector(&NewSphereCenter);
    2517 
    2518                   if ((NewNormalVector.MakeNormalVector(BaseLine->endpoints[0]->node->node, BaseLine->endpoints[1]->node->node, Candidate->node))
    2519                   && (fabs(NewNormalVector.ScalarProduct(&NewNormalVector)) > HULLEPSILON)
     2848                Log() << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " for BaseLine " << *CandidateLine.BaseLine << " with OldSphereCenter " << OldSphereCenter << "." << endl;
     2849                if ((Candidate != CandidateLine.BaseLine->endpoints[0]->node) && (Candidate != CandidateLine.BaseLine->endpoints[1]->node) ){
     2850
     2851                  // find center on the plane
     2852                  GetCenterofCircumcircle(&NewPlaneCenter, *CandidateLine.BaseLine->endpoints[0]->node->node, *CandidateLine.BaseLine->endpoints[1]->node->node, *Candidate->node);
     2853                  Log() << Verbose(1) << "INFO: NewPlaneCenter is " << NewPlaneCenter << "." << endl;
     2854
     2855                  if (NewNormalVector.MakeNormalVector(CandidateLine.BaseLine->endpoints[0]->node->node, CandidateLine.BaseLine->endpoints[1]->node->node, Candidate->node)
     2856                  && (fabs(NewNormalVector.NormSquared()) > HULLEPSILON)
    25202857                  ) {
    2521                     helper.CopyVector(&NewNormalVector);
    2522                     //Log() << Verbose(2) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl;
    2523                     radius = BaseLine->endpoints[0]->node->node->DistanceSquared(&NewSphereCenter);
     2858                    Log() << Verbose(1) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl;
     2859                    radius = CandidateLine.BaseLine->endpoints[0]->node->node->DistanceSquared(&NewPlaneCenter);
     2860                    Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;
     2861                    Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl;
     2862                    Log() << Verbose(1) << "INFO: Radius of CircumCenterCircle is " << radius << "." << endl;
    25242863                    if (radius < RADIUS*RADIUS) {
     2864                      otherradius = CandidateLine.BaseLine->endpoints[1]->node->node->DistanceSquared(&NewPlaneCenter);
     2865                      if (fabs(radius - otherradius) > HULLEPSILON) {
     2866                        eLog() << Verbose(1) << "Distance to center of circumcircle is not the same from each corner of the triangle: " << fabs(radius-otherradius) << endl;
     2867                      }
     2868                      // construct both new centers
     2869                      NewSphereCenter.CopyVector(&NewPlaneCenter);
     2870                      OtherNewSphereCenter.CopyVector(&NewPlaneCenter);
     2871                      helper.CopyVector(&NewNormalVector);
    25252872                      helper.Scale(sqrt(RADIUS*RADIUS - radius));
    2526                       //Log() << Verbose(2) << "INFO: Distance of NewCircleCenter to NewSphereCenter is " << helper.Norm() << " with sphere radius " << RADIUS << "." << endl;
     2873                      Log() << Verbose(2) << "INFO: Distance of NewPlaneCenter " << NewPlaneCenter << " to either NewSphereCenter is " << helper.Norm() << " of vector " << helper << " with sphere radius " << RADIUS << "." << endl;
    25272874                      NewSphereCenter.AddVector(&helper);
    2528                       NewSphereCenter.SubtractVector(&CircleCenter);
    2529                       //Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl;
    2530 
     2875                      Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl;
    25312876                      // OtherNewSphereCenter is created by the same vector just in the other direction
    25322877                      helper.Scale(-1.);
    25332878                      OtherNewSphereCenter.AddVector(&helper);
    2534                       OtherNewSphereCenter.SubtractVector(&CircleCenter);
    2535                       //Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl;
     2879                      Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl;
    25362880
    25372881                      alpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, NewSphereCenter, OldSphereCenter, NormalVector, SearchDirection);
    25382882                      Otheralpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, OtherNewSphereCenter, OldSphereCenter, NormalVector, SearchDirection);
    25392883                      alpha = min(alpha, Otheralpha);
     2884
    25402885                      // if there is a better candidate, drop the current list and add the new candidate
    25412886                      // otherwise ignore the new candidate and keep the list
    2542                       if (*ShortestAngle > (alpha - HULLEPSILON)) {
    2543                         optCandidate = new CandidateForTesselation(Candidate, BaseLine, OptCandidateCenter, OtherOptCandidateCenter);
     2887                      if (CandidateLine.ShortestAngle > (alpha - HULLEPSILON)) {
    25442888                        if (fabs(alpha - Otheralpha) > MYEPSILON) {
    2545                           optCandidate->OptCenter.CopyVector(&NewSphereCenter);
    2546                           optCandidate->OtherOptCenter.CopyVector(&OtherNewSphereCenter);
     2889                          CandidateLine.OptCenter.CopyVector(&NewSphereCenter);
     2890                          CandidateLine.OtherOptCenter.CopyVector(&OtherNewSphereCenter);
    25472891                        } else {
    2548                           optCandidate->OptCenter.CopyVector(&OtherNewSphereCenter);
    2549                           optCandidate->OtherOptCenter.CopyVector(&NewSphereCenter);
     2892                          CandidateLine.OptCenter.CopyVector(&OtherNewSphereCenter);
     2893                          CandidateLine.OtherOptCenter.CopyVector(&NewSphereCenter);
    25502894                        }
    25512895                        // if there is an equal candidate, add it to the list without clearing the list
    2552                         if ((*ShortestAngle - HULLEPSILON) < alpha) {
    2553                           candidates->push_back(optCandidate);
    2554                           Log() << Verbose(2) << "ACCEPT: We have found an equally good candidate: " << *(optCandidate->point) << " with "
    2555                             << alpha << " and circumsphere's center at " << optCandidate->OptCenter << "." << endl;
     2896                        if ((CandidateLine.ShortestAngle - HULLEPSILON) < alpha) {
     2897                          CandidateLine.pointlist.push_back(Candidate);
     2898                          Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with "
     2899                            << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl;
    25562900                        } else {
    25572901                          // remove all candidates from the list and then the list itself
    2558                           class CandidateForTesselation *remover = NULL;
    2559                           for (CandidateList::iterator it = candidates->begin(); it != candidates->end(); ++it) {
    2560                             remover = *it;
    2561                             delete(remover);
    2562                           }
    2563                           candidates->clear();
    2564                           candidates->push_back(optCandidate);
    2565                           Log() << Verbose(2) << "ACCEPT: We have found a better candidate: " << *(optCandidate->point) << " with "
    2566                             << alpha << " and circumsphere's center at " << optCandidate->OptCenter << "." << endl;
     2902                          CandidateLine.pointlist.clear();
     2903                          CandidateLine.pointlist.push_back(Candidate);
     2904                          Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with "
     2905                            << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl;
    25672906                        }
    2568                         *ShortestAngle = alpha;
    2569                         //Log() << Verbose(2) << "INFO: There are " << candidates->size() << " candidates in the list now." << endl;
     2907                        CandidateLine.ShortestAngle = alpha;
     2908                        Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl;
    25702909                      } else {
    2571                         if ((optCandidate != NULL) && (optCandidate->point != NULL)) {
    2572                           //Log() << Verbose(2) << "REJECT: Old candidate " << *(optCandidate->point) << " with " << *ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl;
     2910                        if ((Candidate != NULL) && (CandidateLine.pointlist.begin() != CandidateLine.pointlist.end())) {
     2911                          Log() << Verbose(1) << "REJECT: Old candidate " << *(Candidate) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl;
    25732912                        } else {
    2574                           //Log() << Verbose(2) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl;
     2913                          Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl;
    25752914                        }
    25762915                      }
    2577 
    25782916                    } else {
    2579                       //Log() << Verbose(2) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl;
     2917                      Log() << Verbose(1) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl;
    25802918                    }
    25812919                  } else {
    2582                     //Log() << Verbose(2) << "REJECT: Three points from " << *BaseLine << " and Candidate " << *Candidate << " are linear-dependent." << endl;
     2920                    Log() << Verbose(1) << "REJECT: Three points from " << *CandidateLine.BaseLine << " and Candidate " << *Candidate << " are linear-dependent." << endl;
    25832921                  }
    25842922                } else {
    25852923                  if (ThirdNode != NULL) {
    2586                     //Log() << Verbose(2) << "REJECT: Base triangle " << *BaseLine << " and " << *ThirdNode << " contains Candidate " << *Candidate << "." << endl;
     2924                    Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " and " << *ThirdNode << " contains Candidate " << *Candidate << "." << endl;
    25872925                  } else {
    2588                     //Log() << Verbose(2) << "REJECT: Base triangle " << *BaseLine << " contains Candidate " << *Candidate << "." << endl;
     2926                    Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " contains Candidate " << *Candidate << "." << endl;
    25892927                  }
    25902928                }
     
    25972935  } else {
    25982936    if (ThirdNode != NULL)
    2599       Log() << Verbose(2) << "Circumcircle for base line " << *BaseLine << " and third node " << *ThirdNode << " is too big!" << endl;
     2937      Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and third node " << *ThirdNode << " is too big!" << endl;
    26002938    else
    2601       Log() << Verbose(2) << "Circumcircle for base line " << *BaseLine << " is too big!" << endl;
    2602   }
    2603 
    2604   //Log() << Verbose(2) << "INFO: Sorting candidate list ..." << endl;
    2605   if (candidates->size() > 1) {
    2606     candidates->unique();
    2607     candidates->sort(SortCandidates);
    2608   }
    2609 
    2610   Log() << Verbose(1) << "End of FindThirdPointForTesselation" << endl;
     2939      Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " is too big!" << endl;
     2940  }
     2941
     2942  Log() << Verbose(1) << "INFO: Sorting candidate list ..." << endl;
     2943  if (CandidateLine.pointlist.size() > 1) {
     2944    CandidateLine.pointlist.unique();
     2945    CandidateLine.pointlist.sort(); //SortCandidates);
     2946  }
    26112947};
    26122948
     
    26182954class BoundaryPointSet *Tesselation::GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const
    26192955{
     2956        Info FunctionInfo(__func__);
    26202957  const BoundaryLineSet * lines[2] = { line1, line2 };
    26212958  class BoundaryPointSet *node = NULL;
     
    26312968          { // if insertion fails, we have common endpoint
    26322969            node = OrderTest.first->second;
    2633             Log() << Verbose(5) << "Common endpoint of lines " << *line1
     2970            Log() << Verbose(1) << "Common endpoint of lines " << *line1
    26342971                << " and " << *line2 << " is: " << *node << "." << endl;
    26352972            j = 2;
     
    26482985list<BoundaryTriangleSet*> * Tesselation::FindClosestTrianglesToPoint(const Vector *x, const LinkedCell* LC) const
    26492986{
     2987        Info FunctionInfo(__func__);
    26502988  TesselPoint *trianglePoints[3];
    26512989  TesselPoint *SecondPoint = NULL;
     
    26532991
    26542992  if (LinesOnBoundary.empty()) {
    2655     Log() << Verbose(0) << "Error: There is no tesselation structure to compare the point with, please create one first.";
     2993    eLog() << Verbose(1) << "Error: There is no tesselation structure to compare the point with, please create one first.";
    26562994    return NULL;
    26572995  }
     
    26612999  // check whether closest point is "too close" :), then it's inside
    26623000  if (trianglePoints[0] == NULL) {
    2663     Log() << Verbose(2) << "Is the only point, no one else is closeby." << endl;
     3001    Log() << Verbose(0) << "Is the only point, no one else is closeby." << endl;
    26643002    return NULL;
    26653003  }
    26663004  if (trianglePoints[0]->node->DistanceSquared(x) < MYEPSILON) {
    2667     Log() << Verbose(3) << "Point is right on a tesselation point, no nearest triangle." << endl;
     3005    Log() << Verbose(1) << "Point is right on a tesselation point, no nearest triangle." << endl;
    26683006    PointMap::const_iterator PointRunner = PointsOnBoundary.find(trianglePoints[0]->nr);
    26693007    triangles = new list<BoundaryTriangleSet*>;
     
    26893027    }
    26903028  } else {
    2691     list<TesselPoint*> *connectedClosestPoints = GetCircleOfConnectedPoints(trianglePoints[0], x);
     3029    set<TesselPoint*> *connectedPoints = GetAllConnectedPoints(trianglePoints[0]);
     3030    TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(connectedPoints, trianglePoints[0], x);
     3031    delete(connectedPoints);
    26923032    if (connectedClosestPoints != NULL) {
    26933033      trianglePoints[1] = connectedClosestPoints->front();
     
    26973037          eLog() << Verbose(1) << "IsInnerPoint encounters serious error, point " << i << " not found." << endl;
    26983038        }
    2699         //Log() << Verbose(2) << "List of triangle points:" << endl;
    2700         //Log() << Verbose(3) << *trianglePoints[i] << endl;
     3039        //Log() << Verbose(1) << "List of triangle points:" << endl;
     3040        //Log() << Verbose(2) << *trianglePoints[i] << endl;
    27013041      }
    27023042
    27033043      triangles = FindTriangles(trianglePoints);
    2704       Log() << Verbose(2) << "List of possible triangles:" << endl;
     3044      Log() << Verbose(1) << "List of possible triangles:" << endl;
    27053045      for(list<BoundaryTriangleSet*>::iterator Runner = triangles->begin(); Runner != triangles->end(); Runner++)
    2706         Log() << Verbose(3) << **Runner << endl;
     3046        Log() << Verbose(2) << **Runner << endl;
    27073047
    27083048      delete(connectedClosestPoints);
    27093049    } else {
    27103050      triangles = NULL;
    2711       Log() << Verbose(1) << "There is no circle of connected points!" << endl;
     3051      eLog() << Verbose(2) << "There is no circle of connected points!" << endl;
    27123052    }
    27133053  }
     
    27293069class BoundaryTriangleSet * Tesselation::FindClosestTriangleToPoint(const Vector *x, const LinkedCell* LC) const
    27303070{
     3071        Info FunctionInfo(__func__);
    27313072  class BoundaryTriangleSet *result = NULL;
    27323073  list<BoundaryTriangleSet*> *triangles = FindClosestTrianglesToPoint(x, LC);
     
    27383079  if (triangles->size() == 1) { // there is no degenerate case
    27393080    result = triangles->front();
    2740     Log() << Verbose(2) << "Normal Vector of this triangle is " << result->NormalVector << "." << endl;
     3081    Log() << Verbose(1) << "Normal Vector of this triangle is " << result->NormalVector << "." << endl;
    27413082  } else {
    27423083    result = triangles->front();
    27433084    result->GetCenter(&Center);
    27443085    Center.SubtractVector(x);
    2745     Log() << Verbose(2) << "Normal Vector of this front side is " << result->NormalVector << "." << endl;
     3086    Log() << Verbose(1) << "Normal Vector of this front side is " << result->NormalVector << "." << endl;
    27463087    if (Center.ScalarProduct(&result->NormalVector) < 0) {
    27473088      result = triangles->back();
    2748       Log() << Verbose(2) << "Normal Vector of this back side is " << result->NormalVector << "." << endl;
     3089      Log() << Verbose(1) << "Normal Vector of this back side is " << result->NormalVector << "." << endl;
    27493090      if (Center.ScalarProduct(&result->NormalVector) < 0) {
    27503091        eLog() << Verbose(1) << "Front and back side yield NormalVector in wrong direction!" << endl;
     
    27653106bool Tesselation::IsInnerPoint(const Vector &Point, const LinkedCell* const LC) const
    27663107{
     3108        Info FunctionInfo(__func__);
    27673109  class BoundaryTriangleSet *result = FindClosestTriangleToPoint(&Point, LC);
    27683110  Vector Center;
     
    27743116
    27753117  result->GetCenter(&Center);
    2776   Log() << Verbose(3) << "INFO: Central point of the triangle is " << Center << "." << endl;
     3118  Log() << Verbose(2) << "INFO: Central point of the triangle is " << Center << "." << endl;
    27773119  Center.SubtractVector(&Point);
    2778   Log() << Verbose(3) << "INFO: Vector from center to point to test is " << Center << "." << endl;
     3120  Log() << Verbose(2) << "INFO: Vector from center to point to test is " << Center << "." << endl;
    27793121  if (Center.ScalarProduct(&result->NormalVector) > -MYEPSILON) {
    27803122    Log() << Verbose(1) << Point << " is an inner point." << endl;
     
    27953137bool Tesselation::IsInnerPoint(const TesselPoint * const Point, const LinkedCell* const LC) const
    27963138{
     3139        Info FunctionInfo(__func__);
    27973140  return IsInnerPoint(*(Point->node), LC);
    27983141}
     
    28063149set<TesselPoint*> * Tesselation::GetAllConnectedPoints(const TesselPoint* const Point) const
    28073150{
     3151        Info FunctionInfo(__func__);
    28083152  set<TesselPoint*> *connectedPoints = new set<TesselPoint*>;
    28093153  class BoundaryPointSet *ReferencePoint = NULL;
    28103154  TesselPoint* current;
    28113155  bool takePoint = false;
    2812 
    2813   Log() << Verbose(3) << "Begin of GetAllConnectedPoints" << endl;
    28143156
    28153157  // find the respective boundary point
     
    28183160    ReferencePoint = PointRunner->second;
    28193161  } else {
    2820     Log() << Verbose(2) << "GetAllConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl;
     3162    eLog() << Verbose(2) << "GetAllConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl;
    28213163    ReferencePoint = NULL;
    28223164  }
     
    28423184
    28433185   if (takePoint) {
    2844      Log() << Verbose(5) << "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted." << endl;
     3186     Log() << Verbose(1) << "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted." << endl;
    28453187     connectedPoints->insert(current);
    28463188   }
     
    28543196  }
    28553197
    2856   Log() << Verbose(3) << "End of GetAllConnectedPoints" << endl;
    28573198  return connectedPoints;
    28583199};
     
    28663207 *
    28673208 * @param *out output stream for debugging
     3209 * @param *SetOfNeighbours all points for which the angle should be calculated
    28683210 * @param *Point of which get all connected points
    28693211 * @param *Reference Reference vector for zero angle or NULL for no preference
    28703212 * @return list of the all points linked to the provided one
    28713213 */
    2872 list<TesselPoint*> * Tesselation::GetCircleOfConnectedPoints(const TesselPoint* const Point, const Vector * const Reference) const
    2873 {
     3214list<TesselPoint*> * Tesselation::GetCircleOfSetOfPoints(set<TesselPoint*> *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference) const
     3215{
     3216        Info FunctionInfo(__func__);
    28743217  map<double, TesselPoint*> anglesOfPoints;
    2875   set<TesselPoint*> *connectedPoints = GetAllConnectedPoints(Point);
    28763218  list<TesselPoint*> *connectedCircle = new list<TesselPoint*>;
    28773219  Vector center;
     
    28813223  Vector helper;
    28823224
    2883   if (connectedPoints == NULL) {
    2884     Log() << Verbose(2) << "Could not find any connected points!" << endl;
     3225  if (SetOfNeighbours == NULL) {
     3226    eLog() << Verbose(2) << "Could not find any connected points!" << endl;
    28853227    delete(connectedCircle);
    28863228    return NULL;
    28873229  }
    2888   Log() << Verbose(2) << "Begin of GetCircleOfConnectedPoints" << endl;
    28893230
    28903231  // calculate central point
    2891   for (set<TesselPoint*>::const_iterator TesselRunner = connectedPoints->begin(); TesselRunner != connectedPoints->end(); TesselRunner++)
     3232  for (set<TesselPoint*>::const_iterator TesselRunner = SetOfNeighbours->begin(); TesselRunner != SetOfNeighbours->end(); TesselRunner++)
    28923233    center.AddVector((*TesselRunner)->node);
    28933234  //Log() << Verbose(0) << "Summed vectors " << center << "; number of points " << connectedPoints.size()
    28943235  //  << "; scale factor " << 1.0/connectedPoints.size();
    2895   center.Scale(1.0/connectedPoints->size());
    2896   Log() << Verbose(4) << "INFO: Calculated center of all circle points is " << center << "." << endl;
     3236  center.Scale(1.0/SetOfNeighbours->size());
     3237  Log() << Verbose(1) << "INFO: Calculated center of all circle points is " << center << "." << endl;
    28973238
    28983239  // projection plane of the circle is at the closes Point and normal is pointing away from center of all circle points
     
    29003241  PlaneNormal.SubtractVector(&center);
    29013242  PlaneNormal.Normalize();
    2902   Log() << Verbose(4) << "INFO: Calculated plane normal of circle is " << PlaneNormal << "." << endl;
     3243  Log() << Verbose(1) << "INFO: Calculated plane normal of circle is " << PlaneNormal << "." << endl;
    29033244
    29043245  // construct one orthogonal vector
     
    29093250  }
    29103251  if ((Reference == NULL) || (AngleZero.NormSquared() < MYEPSILON )) {
    2911     Log() << Verbose(4) << "Using alternatively " << *(*connectedPoints->begin())->node << " as angle 0 referencer." << endl;
    2912     AngleZero.CopyVector((*connectedPoints->begin())->node);
     3252    Log() << Verbose(1) << "Using alternatively " << *(*SetOfNeighbours->begin())->node << " as angle 0 referencer." << endl;
     3253    AngleZero.CopyVector((*SetOfNeighbours->begin())->node);
    29133254    AngleZero.SubtractVector(Point->node);
    29143255    AngleZero.ProjectOntoPlane(&PlaneNormal);
     
    29183259    }
    29193260  }
    2920   Log() << Verbose(4) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl;
     3261  Log() << Verbose(1) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl;
    29213262  if (AngleZero.NormSquared() > MYEPSILON)
    29223263    OrthogonalVector.MakeNormalVector(&PlaneNormal, &AngleZero);
    29233264  else
    29243265    OrthogonalVector.MakeNormalVector(&PlaneNormal);
    2925   Log() << Verbose(4) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl;
     3266  Log() << Verbose(1) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl;
    29263267
    29273268  // go through all connected points and calculate angle
    2928   for (set<TesselPoint*>::iterator listRunner = connectedPoints->begin(); listRunner != connectedPoints->end(); listRunner++) {
     3269  for (set<TesselPoint*>::iterator listRunner = SetOfNeighbours->begin(); listRunner != SetOfNeighbours->end(); listRunner++) {
    29293270    helper.CopyVector((*listRunner)->node);
    29303271    helper.SubtractVector(Point->node);
    29313272    helper.ProjectOntoPlane(&PlaneNormal);
    29323273    double angle = GetAngle(helper, AngleZero, OrthogonalVector);
    2933     Log() << Verbose(3) << "INFO: Calculated angle is " << angle << " for point " << **listRunner << "." << endl;
     3274    Log() << Verbose(0) << "INFO: Calculated angle is " << angle << " for point " << **listRunner << "." << endl;
    29343275    anglesOfPoints.insert(pair<double, TesselPoint*>(angle, (*listRunner)));
    29353276  }
     
    29383279    connectedCircle->push_back(AngleRunner->second);
    29393280  }
    2940 
    2941   delete(connectedPoints);
    2942 
    2943   Log() << Verbose(2) << "End of GetCircleOfConnectedPoints" << endl;
    29443281
    29453282  return connectedCircle;
     
    29543291list<list<TesselPoint*> *> * Tesselation::GetPathsOfConnectedPoints(const TesselPoint* const Point) const
    29553292{
     3293        Info FunctionInfo(__func__);
    29563294  map<double, TesselPoint*> anglesOfPoints;
    29573295  list<list<TesselPoint*> *> *ListOfPaths = new list<list<TesselPoint*> *>;
     
    29983336        StartLine = CurrentLine;
    29993337        CurrentPoint = CurrentLine->GetOtherEndpoint(ReferencePoint);
    3000         Log() << Verbose(3)<< "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "." << endl;
     3338        Log() << Verbose(1)<< "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "." << endl;
    30013339        do {
    30023340          // push current one
    3003           Log() << Verbose(3) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;
     3341          Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;
    30043342          connectedPath->push_back(CurrentPoint->node);
    30053343
    30063344          // find next triangle
    30073345          for (TriangleMap::iterator Runner = CurrentLine->triangles.begin(); Runner != CurrentLine->triangles.end(); Runner++) {
    3008             Log() << Verbose(3) << "INFO: Inspecting triangle " << *Runner->second << "." << endl;
     3346            Log() << Verbose(1) << "INFO: Inspecting triangle " << *Runner->second << "." << endl;
    30093347            if ((Runner->second != triangle)) { // look for first triangle not equal to old one
    30103348              triangle = Runner->second;
     
    30133351                if (!TriangleRunner->second) {
    30143352                  TriangleRunner->second = true;
    3015                   Log() << Verbose(3) << "INFO: Connecting triangle is " << *triangle << "." << endl;
     3353                  Log() << Verbose(1) << "INFO: Connecting triangle is " << *triangle << "." << endl;
    30163354                  break;
    30173355                } else {
    3018                   Log() << Verbose(3) << "INFO: Skipping " << *triangle << ", as we have already visited it." << endl;
     3356                  Log() << Verbose(1) << "INFO: Skipping " << *triangle << ", as we have already visited it." << endl;
    30193357                  triangle = NULL;
    30203358                }
     
    30313369            if ((triangle->lines[i] != CurrentLine) && (triangle->lines[i]->ContainsBoundaryPoint(ReferencePoint))) { // not the current line and still containing Point
    30323370              CurrentLine = triangle->lines[i];
    3033               Log() << Verbose(3) << "INFO: Connecting line is " << *CurrentLine << "." << endl;
     3371              Log() << Verbose(1) << "INFO: Connecting line is " << *CurrentLine << "." << endl;
    30343372              break;
    30353373            }
     
    30453383        } while (CurrentLine != StartLine);
    30463384        // last point is missing, as it's on start line
    3047         Log() << Verbose(3) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;
     3385        Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;
    30483386        if (StartLine->GetOtherEndpoint(ReferencePoint)->node != connectedPath->back())
    30493387          connectedPath->push_back(StartLine->GetOtherEndpoint(ReferencePoint)->node);
     
    30513389        ListOfPaths->push_back(connectedPath);
    30523390      } else {
    3053         Log() << Verbose(3) << "INFO: Skipping " << *runner->second << ", as we have already visited it." << endl;
     3391        Log() << Verbose(1) << "INFO: Skipping " << *runner->second << ", as we have already visited it." << endl;
    30543392      }
    30553393    }
     
    30693407list<list<TesselPoint*> *> * Tesselation::GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const
    30703408{
     3409        Info FunctionInfo(__func__);
    30713410  list<list<TesselPoint*> *> *ListofPaths = GetPathsOfConnectedPoints(Point);
    30723411  list<list<TesselPoint*> *> *ListofClosedPaths = new list<list<TesselPoint*> *>;
     
    30823421    connectedPath = *ListRunner;
    30833422
    3084     Log() << Verbose(2) << "INFO: Current path is " << connectedPath << "." << endl;
     3423    Log() << Verbose(1) << "INFO: Current path is " << connectedPath << "." << endl;
    30853424
    30863425    // go through list, look for reappearance of starting Point and count
     
    30923431      if ((*CircleRunner == *CircleStart) && (CircleRunner != CircleStart)) { // is not the very first point
    30933432        // we have a closed circle from Marker to new Marker
    3094         Log() << Verbose(3) << count+1 << ". closed path consists of: ";
     3433        Log() << Verbose(1) << count+1 << ". closed path consists of: ";
    30953434        newPath = new list<TesselPoint*>;
    30963435        list<TesselPoint*>::iterator CircleSprinter = Marker;
     
    31083447    }
    31093448  }
    3110   Log() << Verbose(3) << "INFO: " << count << " closed additional path(s) have been created." << endl;
     3449  Log() << Verbose(1) << "INFO: " << count << " closed additional path(s) have been created." << endl;
    31113450
    31123451  // delete list of paths
     
    31303469set<BoundaryTriangleSet*> *Tesselation::GetAllTriangles(const BoundaryPointSet * const Point) const
    31313470{
     3471        Info FunctionInfo(__func__);
    31323472  set<BoundaryTriangleSet*> *connectedTriangles = new set<BoundaryTriangleSet*>;
    31333473
     
    31683508    return 0.;
    31693509  } else
    3170     Log() << Verbose(2) << "Removing point " << *point << " from tesselated boundary ..." << endl;
     3510    Log() << Verbose(0) << "Removing point " << *point << " from tesselated boundary ..." << endl;
    31713511
    31723512  // copy old location for the volume
     
    31983538  NormalVector.Zero();
    31993539  for (map<class BoundaryTriangleSet *, int>::iterator Runner = Candidates.begin(); Runner != Candidates.end(); Runner++) {
    3200     Log() << Verbose(3) << "INFO: Removing triangle " << *(Runner->first) << "." << endl;
     3540    Log() << Verbose(1) << "INFO: Removing triangle " << *(Runner->first) << "." << endl;
    32013541    NormalVector.SubtractVector(&Runner->first->NormalVector); // has to point inward
    32023542    RemoveTesselationTriangle(Runner->first);
     
    32283568        smallestangle = 0.;
    32293569        for (MiddleNode = connectedPath->begin(); MiddleNode != connectedPath->end(); MiddleNode++) {
    3230           Log() << Verbose(3) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;
     3570          Log() << Verbose(1) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;
    32313571          // construct vectors to next and previous neighbour
    32323572          StartNode = MiddleNode;
     
    32563596        MiddleNode = EndNode;
    32573597        if (MiddleNode == connectedPath->end()) {
    3258           Log() << Verbose(1) << "CRITICAL: Could not find a smallest angle!" << endl;
    3259           exit(255);
     3598          eLog() << Verbose(0) << "CRITICAL: Could not find a smallest angle!" << endl;
     3599          performCriticalExit();
    32603600        }
    32613601        StartNode = MiddleNode;
     
    32663606        if (EndNode == connectedPath->end())
    32673607          EndNode = connectedPath->begin();
    3268         Log() << Verbose(4) << "INFO: StartNode is " << **StartNode << "." << endl;
    3269         Log() << Verbose(4) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;
    3270         Log() << Verbose(4) << "INFO: EndNode is " << **EndNode << "." << endl;
    3271         Log() << Verbose(3) << "INFO: Attempting to create triangle " << (*StartNode)->Name << ", " << (*MiddleNode)->Name << " and " << (*EndNode)->Name << "." << endl;
     3608        Log() << Verbose(2) << "INFO: StartNode is " << **StartNode << "." << endl;
     3609        Log() << Verbose(2) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;
     3610        Log() << Verbose(2) << "INFO: EndNode is " << **EndNode << "." << endl;
     3611        Log() << Verbose(1) << "INFO: Attempting to create triangle " << (*StartNode)->Name << ", " << (*MiddleNode)->Name << " and " << (*EndNode)->Name << "." << endl;
    32723612        TriangleCandidates[0] = *StartNode;
    32733613        TriangleCandidates[1] = *MiddleNode;
     
    32753615        triangle = GetPresentTriangle(TriangleCandidates);
    32763616        if (triangle != NULL) {
    3277           eLog() << Verbose(2) << "New triangle already present, skipping!" << endl;
     3617          eLog() << Verbose(0) << "New triangle already present, skipping!" << endl;
    32783618          StartNode++;
    32793619          MiddleNode++;
     
    32873627          continue;
    32883628        }
    3289         Log() << Verbose(5) << "Adding new triangle points."<< endl;
     3629        Log() << Verbose(3) << "Adding new triangle points."<< endl;
    32903630        AddTesselationPoint(*StartNode, 0);
    32913631        AddTesselationPoint(*MiddleNode, 1);
    32923632        AddTesselationPoint(*EndNode, 2);
    3293         Log() << Verbose(5) << "Adding new triangle lines."<< endl;
     3633        Log() << Verbose(3) << "Adding new triangle lines."<< endl;
    32943634        AddTesselationLine(TPS[0], TPS[1], 0);
    32953635        AddTesselationLine(TPS[0], TPS[2], 1);
     
    33063646        // prepare nodes for next triangle
    33073647        StartNode = EndNode;
    3308         Log() << Verbose(4) << "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "." << endl;
     3648        Log() << Verbose(2) << "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "." << endl;
    33093649        connectedPath->remove(*MiddleNode); // remove the middle node (it is surrounded by triangles)
    33103650        if (connectedPath->size() == 2) { // we are done
     
    33133653          break;
    33143654        } else if (connectedPath->size() < 2) { // something's gone wrong!
    3315           Log() << Verbose(1) << "CRITICAL: There are only two endpoints left!" << endl;
    3316           exit(255);
     3655          eLog() << Verbose(0) << "CRITICAL: There are only two endpoints left!" << endl;
     3656          performCriticalExit();
    33173657        } else {
    33183658          MiddleNode = StartNode;
     
    33423682          if (maxgain != 0) {
    33433683            volume += maxgain;
    3344             Log() << Verbose(3) << "Flipping baseline with highest volume" << **Candidate << "." << endl;
     3684            Log() << Verbose(1) << "Flipping baseline with highest volume" << **Candidate << "." << endl;
    33453685            OtherBase = FlipBaseline(*Candidate);
    33463686            NewLines.erase(Candidate);
     
    33533693      delete(connectedPath);
    33543694    }
    3355     Log() << Verbose(1) << count << " triangles were created." << endl;
     3695    Log() << Verbose(0) << count << " triangles were created." << endl;
    33563696  } else {
    33573697    while (!ListOfClosedPaths->empty()) {
     
    33613701      delete(connectedPath);
    33623702    }
    3363     Log() << Verbose(1) << "No need to create any triangles." << endl;
     3703    Log() << Verbose(0) << "No need to create any triangles." << endl;
    33643704  }
    33653705  delete(ListOfClosedPaths);
    33663706
    3367   Log() << Verbose(1) << "Removed volume is " << volume << "." << endl;
     3707  Log() << Verbose(0) << "Removed volume is " << volume << "." << endl;
    33683708
    33693709  return volume;
     
    33823722list<BoundaryTriangleSet*> *Tesselation::FindTriangles(const TesselPoint* const Points[3]) const
    33833723{
     3724        Info FunctionInfo(__func__);
    33843725  list<BoundaryTriangleSet*> *result = new list<BoundaryTriangleSet*>;
    33853726  LineMap::const_iterator FindLine;
     
    34223763}
    34233764
     3765struct BoundaryLineSetCompare {
     3766  bool operator() (const BoundaryLineSet * const a, const BoundaryLineSet * const b) {
     3767    int lowerNra = -1;
     3768    int lowerNrb = -1;
     3769
     3770    if (a->endpoints[0] < a->endpoints[1])
     3771      lowerNra = 0;
     3772    else
     3773      lowerNra = 1;
     3774
     3775    if (b->endpoints[0] < b->endpoints[1])
     3776      lowerNrb = 0;
     3777    else
     3778      lowerNrb = 1;
     3779
     3780    if (a->endpoints[lowerNra] < b->endpoints[lowerNrb])
     3781      return true;
     3782    else if (a->endpoints[lowerNra] > b->endpoints[lowerNrb])
     3783      return false;
     3784    else {  // both lower-numbered endpoints are the same ...
     3785     if (a->endpoints[(lowerNra+1)%2] < b->endpoints[(lowerNrb+1)%2])
     3786       return true;
     3787     else if (a->endpoints[(lowerNra+1)%2] > b->endpoints[(lowerNrb+1)%2])
     3788       return false;
     3789    }
     3790    return false;
     3791  };
     3792};
     3793
     3794#define UniqueLines set < class BoundaryLineSet *, BoundaryLineSetCompare>
     3795
    34243796/**
    34253797 * Finds all degenerated lines within the tesselation structure.
     
    34303802map<int, int> * Tesselation::FindAllDegeneratedLines()
    34313803{
    3432   map<int, class BoundaryLineSet *> AllLines;
     3804        Info FunctionInfo(__func__);
     3805        UniqueLines AllLines;
    34333806  map<int, int> * DegeneratedLines = new map<int, int>;
    34343807
    34353808  // sanity check
    34363809  if (LinesOnBoundary.empty()) {
    3437     Log() << Verbose(1) << "Warning: FindAllDegeneratedTriangles() was called without any tesselation structure.";
     3810    eLog() << Verbose(2) << "FindAllDegeneratedTriangles() was called without any tesselation structure.";
    34383811    return DegeneratedLines;
    34393812  }
    34403813
    34413814  LineMap::iterator LineRunner1;
    3442   pair<LineMap::iterator, bool> tester;
     3815  pair< UniqueLines::iterator, bool> tester;
    34433816  for (LineRunner1 = LinesOnBoundary.begin(); LineRunner1 != LinesOnBoundary.end(); ++LineRunner1) {
    3444     tester = AllLines.insert( pair<int,BoundaryLineSet *> (LineRunner1->second->endpoints[0]->Nr, LineRunner1->second) );
    3445     if ((!tester.second) && (tester.first->second->endpoints[1]->Nr == LineRunner1->second->endpoints[1]->Nr)) { // found degenerated line
    3446       DegeneratedLines->insert ( pair<int, int> (LineRunner1->second->Nr, tester.first->second->Nr) );
    3447       DegeneratedLines->insert ( pair<int, int> (tester.first->second->Nr, LineRunner1->second->Nr) );
     3817    tester = AllLines.insert( LineRunner1->second );
     3818    if (!tester.second) { // found degenerated line
     3819      DegeneratedLines->insert ( pair<int, int> (LineRunner1->second->Nr, (*tester.first)->Nr) );
     3820      DegeneratedLines->insert ( pair<int, int> ((*tester.first)->Nr, LineRunner1->second->Nr) );
    34483821    }
    34493822  }
     
    34513824  AllLines.clear();
    34523825
    3453   Log() << Verbose(1) << "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines." << endl;
     3826  Log() << Verbose(0) << "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines." << endl;
    34543827  map<int,int>::iterator it;
    3455   for (it = DegeneratedLines->begin(); it != DegeneratedLines->end(); it++)
    3456       Log() << Verbose(2) << (*it).first << " => " << (*it).second << endl;
     3828  for (it = DegeneratedLines->begin(); it != DegeneratedLines->end(); it++) {
     3829    const LineMap::const_iterator Line1 = LinesOnBoundary.find((*it).first);
     3830    const LineMap::const_iterator Line2 = LinesOnBoundary.find((*it).second);
     3831    if (Line1 != LinesOnBoundary.end() && Line2 != LinesOnBoundary.end())
     3832      Log() << Verbose(0) << *Line1->second << " => " << *Line2->second << endl;
     3833    else
     3834      eLog() << Verbose(1) << "Either " << (*it).first << " or " << (*it).second << " are not in LinesOnBoundary!" << endl;
     3835  }
    34573836
    34583837  return DegeneratedLines;
     
    34673846map<int, int> * Tesselation::FindAllDegeneratedTriangles()
    34683847{
     3848        Info FunctionInfo(__func__);
    34693849  map<int, int> * DegeneratedLines = FindAllDegeneratedLines();
    34703850  map<int, int> * DegeneratedTriangles = new map<int, int>;
     
    34943874  delete(DegeneratedLines);
    34953875
    3496   Log() << Verbose(1) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl;
     3876  Log() << Verbose(0) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl;
    34973877  map<int,int>::iterator it;
    34983878  for (it = DegeneratedTriangles->begin(); it != DegeneratedTriangles->end(); it++)
    3499       Log() << Verbose(2) << (*it).first << " => " << (*it).second << endl;
     3879      Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl;
    35003880
    35013881  return DegeneratedTriangles;
     
    35083888void Tesselation::RemoveDegeneratedTriangles()
    35093889{
     3890        Info FunctionInfo(__func__);
    35103891  map<int, int> * DegeneratedTriangles = FindAllDegeneratedTriangles();
    35113892  TriangleMap::iterator finder;
    35123893  BoundaryTriangleSet *triangle = NULL, *partnerTriangle = NULL;
    35133894  int count  = 0;
    3514 
    3515   Log() << Verbose(1) << "Begin of RemoveDegeneratedTriangles" << endl;
    35163895
    35173896  for (map<int, int>::iterator TriangleKeyRunner = DegeneratedTriangles->begin();
     
    35723951      // erase the pair
    35733952      count += (int) DegeneratedTriangles->erase(triangle->Nr);
    3574       Log() << Verbose(1) << "RemoveDegeneratedTriangles() removes triangle " << *triangle << "." << endl;
     3953      Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *triangle << "." << endl;
    35753954      RemoveTesselationTriangle(triangle);
    35763955      count += (int) DegeneratedTriangles->erase(partnerTriangle->Nr);
    3577       Log() << Verbose(1) << "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "." << endl;
     3956      Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "." << endl;
    35783957      RemoveTesselationTriangle(partnerTriangle);
    35793958    } else {
    3580       Log() << Verbose(1) << "RemoveDegeneratedTriangles() does not remove triangle " << *triangle
     3959      Log() << Verbose(0) << "RemoveDegeneratedTriangles() does not remove triangle " << *triangle
    35813960        << " and its partner " << *partnerTriangle << " because it is essential for at"
    35823961        << " least one of the endpoints to be kept in the tesselation structure." << endl;
     
    35843963  }
    35853964  delete(DegeneratedTriangles);
    3586 
    3587   Log() << Verbose(1) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl;
    3588   Log() << Verbose(1) << "End of RemoveDegeneratedTriangles" << endl;
     3965  if (count > 0)
     3966    LastTriangle = NULL;
     3967
     3968  Log() << Verbose(0) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl;
    35893969}
    35903970
     
    35993979void Tesselation::AddBoundaryPointByDegeneratedTriangle(class TesselPoint *point, LinkedCell *LC)
    36003980{
    3601   Log() << Verbose(2) << "Begin of AddBoundaryPointByDegeneratedTriangle" << endl;
    3602 
     3981        Info FunctionInfo(__func__);
    36033982  // find nearest boundary point
    36043983  class TesselPoint *BackupPoint = NULL;
     
    36163995    return;
    36173996  }
    3618   Log() << Verbose(2) << "Nearest point on boundary is " << NearestPoint->Name << "." << endl;
     3997  Log() << Verbose(0) << "Nearest point on boundary is " << NearestPoint->Name << "." << endl;
    36193998
    36203999  // go through its lines and find the best one to split
     
    36494028
    36504029  // create new triangle to connect point (connects automatically with the missing spot of the chosen line)
    3651   Log() << Verbose(5) << "Adding new triangle points."<< endl;
     4030  Log() << Verbose(2) << "Adding new triangle points."<< endl;
    36524031  AddTesselationPoint((BestLine->endpoints[0]->node), 0);
    36534032  AddTesselationPoint((BestLine->endpoints[1]->node), 1);
    36544033  AddTesselationPoint(point, 2);
    3655   Log() << Verbose(5) << "Adding new triangle lines."<< endl;
     4034  Log() << Verbose(2) << "Adding new triangle lines."<< endl;
    36564035  AddTesselationLine(TPS[0], TPS[1], 0);
    36574036  AddTesselationLine(TPS[0], TPS[2], 1);
     
    36604039  BTS->GetNormalVector(TempTriangle->NormalVector);
    36614040  BTS->NormalVector.Scale(-1.);
    3662   Log() << Verbose(3) << "INFO: NormalVector of new triangle is " << BTS->NormalVector << "." << endl;
     4041  Log() << Verbose(1) << "INFO: NormalVector of new triangle is " << BTS->NormalVector << "." << endl;
    36634042  AddTesselationTriangle();
    36644043
    36654044  // create other side of this triangle and close both new sides of the first created triangle
    3666   Log() << Verbose(5) << "Adding new triangle points."<< endl;
     4045  Log() << Verbose(2) << "Adding new triangle points."<< endl;
    36674046  AddTesselationPoint((BestLine->endpoints[0]->node), 0);
    36684047  AddTesselationPoint((BestLine->endpoints[1]->node), 1);
    36694048  AddTesselationPoint(point, 2);
    3670   Log() << Verbose(5) << "Adding new triangle lines."<< endl;
     4049  Log() << Verbose(2) << "Adding new triangle lines."<< endl;
    36714050  AddTesselationLine(TPS[0], TPS[1], 0);
    36724051  AddTesselationLine(TPS[0], TPS[2], 1);
     
    36744053  BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
    36754054  BTS->GetNormalVector(TempTriangle->NormalVector);
    3676   Log() << Verbose(3) << "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "." << endl;
     4055  Log() << Verbose(1) << "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "." << endl;
    36774056  AddTesselationTriangle();
    36784057
     
    36814060    if ((BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[0])) && (BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[1]))) {
    36824061      if (BestLine == BTS->lines[i]){
    3683         Log() << Verbose(1) << "CRITICAL: BestLine is same as found line, something's wrong here!" << endl;
    3684         exit(255);
     4062        eLog() << Verbose(0) << "BestLine is same as found line, something's wrong here!" << endl;
     4063        performCriticalExit();
    36854064      }
    36864065      BTS->lines[i]->triangles.insert( pair<int, class BoundaryTriangleSet *> (TempTriangle->Nr, TempTriangle) );
     
    36894068    }
    36904069  }
    3691 
    3692   // exit
    3693   Log() << Verbose(2) << "End of AddBoundaryPointByDegeneratedTriangle" << endl;
    36944070};
    36954071
     
    37014077void Tesselation::Output(const char *filename, const PointCloud * const cloud)
    37024078{
     4079        Info FunctionInfo(__func__);
    37034080  ofstream *tempstream = NULL;
    37044081  string NameofTempFile;
     
    37134090      NameofTempFile.erase(npos, 1);
    37144091      NameofTempFile.append(TecplotSuffix);
    3715       Log() << Verbose(1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";
     4092      Log() << Verbose(0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";
    37164093      tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc);
    37174094      WriteTecplotFile(tempstream, this, cloud, TriangleFilesWritten);
     
    37274104      NameofTempFile.erase(npos, 1);
    37284105      NameofTempFile.append(Raster3DSuffix);
    3729       Log() << Verbose(1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";
     4106      Log() << Verbose(0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";
    37304107      tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc);
    37314108      WriteRaster3dFile(tempstream, this, cloud);
     
    37394116    TriangleFilesWritten++;
    37404117};
     4118
     4119struct BoundaryPolygonSetCompare {
     4120  bool operator()(const BoundaryPolygonSet * s1, const BoundaryPolygonSet * s2) const {
     4121    if (s1->endpoints.size() < s2->endpoints.size())
     4122      return true;
     4123    else if (s1->endpoints.size() > s2->endpoints.size())
     4124      return false;
     4125    else { // equality of number of endpoints
     4126      PointSet::const_iterator Walker1 = s1->endpoints.begin();
     4127      PointSet::const_iterator Walker2 = s2->endpoints.begin();
     4128      while ((Walker1 != s1->endpoints.end()) || (Walker2 != s2->endpoints.end())) {
     4129        if ((*Walker1)->Nr < (*Walker2)->Nr)
     4130          return true;
     4131        else if ((*Walker1)->Nr > (*Walker2)->Nr)
     4132          return false;
     4133        Walker1++;
     4134        Walker2++;
     4135      }
     4136      return false;
     4137    }
     4138  }
     4139};
     4140
     4141#define UniquePolygonSet set < BoundaryPolygonSet *, BoundaryPolygonSetCompare>
     4142
     4143/** Finds all degenerated polygons and calls ReTesselateDegeneratedPolygon()/
     4144 * \return number of polygons found
     4145 */
     4146int Tesselation::CorrectAllDegeneratedPolygons()
     4147{
     4148  Info FunctionInfo(__func__);
     4149
     4150  /// 2. Go through all BoundaryPointSet's, check their triangles' NormalVector
     4151  map <int, int> *DegeneratedTriangles = FindAllDegeneratedTriangles();
     4152  set < BoundaryPointSet *> EndpointCandidateList;
     4153  pair < set < BoundaryPointSet *>::iterator, bool > InsertionTester;
     4154  pair < map < int, Vector *>::iterator, bool > TriangleInsertionTester;
     4155  for (PointMap::const_iterator Runner = PointsOnBoundary.begin(); Runner != PointsOnBoundary.end(); Runner++) {
     4156    Log() << Verbose(0) << "Current point is " << *Runner->second << "." << endl;
     4157    map < int, Vector *> TriangleVectors;
     4158    // gather all NormalVectors
     4159    Log() << Verbose(1) << "Gathering triangles ..." << endl;
     4160    for (LineMap::const_iterator LineRunner = (Runner->second)->lines.begin(); LineRunner != (Runner->second)->lines.end(); LineRunner++)
     4161      for (TriangleMap::const_iterator TriangleRunner = (LineRunner->second)->triangles.begin(); TriangleRunner != (LineRunner->second)->triangles.end(); TriangleRunner++) {
     4162        if (DegeneratedTriangles->find(TriangleRunner->second->Nr) == DegeneratedTriangles->end()) {
     4163          TriangleInsertionTester = TriangleVectors.insert( pair< int, Vector *> ((TriangleRunner->second)->Nr, &((TriangleRunner->second)->NormalVector)) );
     4164          if (TriangleInsertionTester.second)
     4165            Log() << Verbose(1) << " Adding triangle " << *(TriangleRunner->second) << " to triangles to check-list." << endl;
     4166        } else {
     4167          Log() << Verbose(1) << " NOT adding triangle " << *(TriangleRunner->second) << " as it's a simply degenerated one." << endl;
     4168        }
     4169      }
     4170    // check whether there are two that are parallel
     4171    Log() << Verbose(1) << "Finding two parallel triangles ..." << endl;
     4172    for (map < int, Vector *>::iterator VectorWalker = TriangleVectors.begin(); VectorWalker != TriangleVectors.end(); VectorWalker++)
     4173      for (map < int, Vector *>::iterator VectorRunner = VectorWalker; VectorRunner != TriangleVectors.end(); VectorRunner++)
     4174        if (VectorWalker != VectorRunner) { // skip equals
     4175          const double SCP = VectorWalker->second->ScalarProduct(VectorRunner->second);  // ScalarProduct should result in -1. for degenerated triangles
     4176          Log() << Verbose(1) << "Checking " << *VectorWalker->second<< " against " << *VectorRunner->second << ": " << SCP << endl;
     4177          if (fabs(SCP + 1.) < ParallelEpsilon) {
     4178            InsertionTester = EndpointCandidateList.insert((Runner->second));
     4179            if (InsertionTester.second)
     4180              Log() << Verbose(0) << " Adding " << *Runner->second << " to endpoint candidate list." << endl;
     4181            // and break out of both loops
     4182            VectorWalker = TriangleVectors.end();
     4183            VectorRunner = TriangleVectors.end();
     4184            break;
     4185          }
     4186        }
     4187  }
     4188
     4189  /// 3. Find connected endpoint candidates and put them into a polygon
     4190  UniquePolygonSet ListofDegeneratedPolygons;
     4191  BoundaryPointSet *Walker = NULL;
     4192  BoundaryPointSet *OtherWalker = NULL;
     4193  BoundaryPolygonSet *Current = NULL;
     4194  stack <BoundaryPointSet*> ToCheckConnecteds;
     4195  while (!EndpointCandidateList.empty()) {
     4196    Walker = *(EndpointCandidateList.begin());
     4197    if (Current == NULL) {  // create a new polygon with current candidate
     4198      Log() << Verbose(0) << "Starting new polygon set at point " << *Walker << endl;
     4199      Current = new BoundaryPolygonSet;
     4200      Current->endpoints.insert(Walker);
     4201      EndpointCandidateList.erase(Walker);
     4202      ToCheckConnecteds.push(Walker);
     4203    }
     4204
     4205    // go through to-check stack
     4206    while (!ToCheckConnecteds.empty()) {
     4207      Walker = ToCheckConnecteds.top(); // fetch ...
     4208      ToCheckConnecteds.pop(); // ... and remove
     4209      for (LineMap::const_iterator LineWalker = Walker->lines.begin(); LineWalker != Walker->lines.end(); LineWalker++) {
     4210        OtherWalker = (LineWalker->second)->GetOtherEndpoint(Walker);
     4211        Log() << Verbose(1) << "Checking " << *OtherWalker << endl;
     4212        set < BoundaryPointSet *>::iterator Finder = EndpointCandidateList.find(OtherWalker);
     4213        if (Finder != EndpointCandidateList.end()) {  // found a connected partner
     4214          Log() << Verbose(1) << " Adding to polygon." << endl;
     4215          Current->endpoints.insert(OtherWalker);
     4216          EndpointCandidateList.erase(Finder);  // remove from candidates
     4217          ToCheckConnecteds.push(OtherWalker);  // but check its partners too
     4218        } else {
     4219          Log() << Verbose(1) << " is not connected to " << *Walker << endl;
     4220        }
     4221      }
     4222    }
     4223
     4224    Log() << Verbose(0) << "Final polygon is " << *Current << endl;
     4225    ListofDegeneratedPolygons.insert(Current);
     4226    Current = NULL;
     4227  }
     4228
     4229  const int counter = ListofDegeneratedPolygons.size();
     4230
     4231  Log() << Verbose(0) << "The following " << counter << " degenerated polygons have been found: " << endl;
     4232  for (UniquePolygonSet::iterator PolygonRunner = ListofDegeneratedPolygons.begin(); PolygonRunner != ListofDegeneratedPolygons.end(); PolygonRunner++)
     4233    Log() << Verbose(0) << " " << **PolygonRunner << endl;
     4234
     4235  /// 4. Go through all these degenerated polygons
     4236  for (UniquePolygonSet::iterator PolygonRunner = ListofDegeneratedPolygons.begin(); PolygonRunner != ListofDegeneratedPolygons.end(); PolygonRunner++) {
     4237    stack <int> TriangleNrs;
     4238    Vector NormalVector;
     4239    /// 4a. Gather all triangles of this polygon
     4240    TriangleSet *T = (*PolygonRunner)->GetAllContainedTrianglesFromEndpoints();
     4241
     4242    // check whether number is bigger than 2, otherwise it's just a simply degenerated one and nothing to do.
     4243    if (T->size() == 2) {
     4244      Log() << Verbose(1) << " Skipping degenerated polygon, is just a (already simply degenerated) triangle." << endl;
     4245      delete(T);
     4246      continue;
     4247    }
     4248
     4249    // check whether number is even
     4250    // If this case occurs, we have to think about it!
     4251    // The Problem is probably due to two degenerated polygons being connected by a bridging, non-degenerated polygon, as somehow one node has
     4252    // connections to either polygon ...
     4253    if (T->size() % 2 != 0) {
     4254      eLog() << Verbose(0) << " degenerated polygon contains an odd number of triangles, probably contains bridging non-degenerated ones, too!" << endl;
     4255      performCriticalExit();
     4256    }
     4257
     4258    TriangleSet::iterator TriangleWalker = T->begin();  // is the inner iterator
     4259    /// 4a. Get NormalVector for one side (this is "front")
     4260    NormalVector.CopyVector(&(*TriangleWalker)->NormalVector);
     4261    Log() << Verbose(1) << "\"front\" defining triangle is " << **TriangleWalker << " and Normal vector of \"front\" side is " << NormalVector << endl;
     4262    TriangleWalker++;
     4263    TriangleSet::iterator TriangleSprinter = TriangleWalker; // is the inner advanced iterator
     4264    /// 4b. Remove all triangles whose NormalVector is in opposite direction (i.e. "back")
     4265    BoundaryTriangleSet *triangle = NULL;
     4266    while (TriangleSprinter != T->end()) {
     4267      TriangleWalker = TriangleSprinter;
     4268      triangle = *TriangleWalker;
     4269      TriangleSprinter++;
     4270      Log() << Verbose(1) << "Current triangle to test for removal: " << *triangle << endl;
     4271      if (triangle->NormalVector.ScalarProduct(&NormalVector) < 0) { // if from other side, then delete and remove from list
     4272        Log() << Verbose(1) << " Removing ... " << endl;
     4273        TriangleNrs.push(triangle->Nr);
     4274        T->erase(TriangleWalker);
     4275        RemoveTesselationTriangle(triangle);
     4276      } else
     4277        Log() << Verbose(1) << " Keeping ... " << endl;
     4278    }
     4279    /// 4c. Copy all "front" triangles but with inverse NormalVector
     4280    TriangleWalker = T->begin();
     4281    while (TriangleWalker != T->end()) {  // go through all front triangles
     4282      Log() << Verbose(1) << " Re-creating triangle " << **TriangleWalker << " with NormalVector " << (*TriangleWalker)->NormalVector << endl;
     4283      for (int i = 0; i < 3; i++)
     4284        AddTesselationPoint((*TriangleWalker)->endpoints[i]->node, i);
     4285      AddTesselationLine(TPS[0], TPS[1], 0);
     4286      AddTesselationLine(TPS[0], TPS[2], 1);
     4287      AddTesselationLine(TPS[1], TPS[2], 2);
     4288      if (TriangleNrs.empty())
     4289        eLog() << Verbose(0) << "No more free triangle numbers!" << endl;
     4290      BTS = new BoundaryTriangleSet(BLS, TriangleNrs.top()); // copy triangle ...
     4291      AddTesselationTriangle(); // ... and add
     4292      TriangleNrs.pop();
     4293      BTS->NormalVector.CopyVector(&(*TriangleWalker)->NormalVector);
     4294      BTS->NormalVector.Scale(-1.);
     4295      TriangleWalker++;
     4296    }
     4297    if (!TriangleNrs.empty()) {
     4298      eLog() << Verbose(0) << "There have been less triangles created than removed!" << endl;
     4299    }
     4300    delete(T);  // remove the triangleset
     4301  }
     4302
     4303  map<int, int> * SimplyDegeneratedTriangles = FindAllDegeneratedTriangles();
     4304  Log() << Verbose(0) << "Final list of simply degenerated triangles found, containing " << SimplyDegeneratedTriangles->size() << " triangles:" << endl;
     4305  map<int,int>::iterator it;
     4306  for (it = SimplyDegeneratedTriangles->begin(); it != SimplyDegeneratedTriangles->end(); it++)
     4307      Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl;
     4308  delete(SimplyDegeneratedTriangles);
     4309
     4310  /// 5. exit
     4311  UniquePolygonSet::iterator PolygonRunner;
     4312  while (!ListofDegeneratedPolygons.empty()) {
     4313    PolygonRunner = ListofDegeneratedPolygons.begin();
     4314    delete(*PolygonRunner);
     4315    ListofDegeneratedPolygons.erase(PolygonRunner);
     4316  }
     4317
     4318  return counter;
     4319};
  • src/tesselation.hpp

    r8927ae r1ca488  
    2323#include <list>
    2424#include <set>
     25#include <stack>
    2526
    2627#include "atom_particleinfo.hpp"
     
    4748#define VRMLSUffix ".wrl"
    4849
     50#define ParallelEpsilon 1e-3
     51
    4952// ======================================================= some template functions =========================================
    5053
    5154#define PointMap map < int, class BoundaryPointSet * >
     55#define PointSet set < class BoundaryPointSet * >
     56#define PointList list < class BoundaryPointSet * >
    5257#define PointPair pair < int, class BoundaryPointSet * >
    5358#define PointTestPair pair < PointMap::iterator, bool >
     59
    5460#define CandidateList list <class CandidateForTesselation *>
     61#define CandidateMap map <class BoundaryLineSet *, class CandidateForTesselation *>
    5562
    5663#define LineMap multimap < int, class BoundaryLineSet * >
     64#define LineSet set < class BoundaryLineSet * >
     65#define LineList list < class BoundaryLineSet * >
    5766#define LinePair pair < int, class BoundaryLineSet * >
    5867#define LineTestPair pair < LineMap::iterator, bool >
    5968
    6069#define TriangleMap map < int, class BoundaryTriangleSet * >
     70#define TriangleSet set < class BoundaryTriangleSet * >
     71#define TriangleList list < class BoundaryTriangleSet * >
    6172#define TrianglePair pair < int, class BoundaryTriangleSet * >
    6273#define TriangleTestPair pair < TrianglePair::iterator, bool >
    6374
     75#define PolygonMap map < int, class BoundaryPolygonSet * >
     76#define PolygonSet set < class BoundaryPolygonSet * >
     77#define PolygonList list < class BoundaryPolygonSet * >
     78
    6479#define DistanceMultiMap multimap <double, pair < PointMap::iterator, PointMap::iterator> >
    6580#define DistanceMultiMapPair pair <double, pair < PointMap::iterator, PointMap::iterator> >
     81
     82#define TesselPointList list <TesselPoint *>
     83#define TesselPointSet set <TesselPoint *>
    6684
    6785/********************************************** declarations *******************************/
     
    114132    TriangleMap triangles;
    115133    int Nr;
     134    bool skipped;
    116135};
    117136
     
    139158    class BoundaryLineSet *lines[3];
    140159    Vector NormalVector;
     160    Vector SphereCenter;
    141161    int Nr;
    142162};
    143163
    144164ostream & operator << (ostream &ost, const BoundaryTriangleSet &a);
     165
     166
     167// ======================================================== class BoundaryTriangleSet =======================================
     168
     169/** Set of BoundaryPointSet.
     170 * This is just meant as a container for a group of endpoints, extending the node, line, triangle concept. However, this has
     171 * only marginally something to do with the tesselation. Hence, there is no incorporation into the bookkeeping of the Tesselation
     172 * class (i.e. no allocation, no deletion).
     173 * \note we assume that the set of endpoints reside (more or less) on a plane.
     174 */
     175class BoundaryPolygonSet {
     176  public:
     177    BoundaryPolygonSet();
     178    ~BoundaryPolygonSet();
     179
     180    Vector * GetNormalVector(const Vector &NormalVector) const;
     181    void GetCenter(Vector *center) const;
     182    bool ContainsBoundaryLine(const BoundaryLineSet * const line) const;
     183    bool ContainsBoundaryPoint(const BoundaryPointSet * const point) const;
     184    bool ContainsBoundaryPoint(const TesselPoint * const point) const;
     185    bool ContainsBoundaryTriangle(const BoundaryTriangleSet * const point) const;
     186    bool ContainsPresentTupel(const BoundaryPointSet * const * Points, const int dim) const;
     187    bool ContainsPresentTupel(const BoundaryPolygonSet * const P) const;
     188    bool ContainsPresentTupel(const PointSet &endpoints) const;
     189    TriangleSet * GetAllContainedTrianglesFromEndpoints() const;
     190    bool FillPolygonFromTrianglesOfLine(const BoundaryLineSet * const line);
     191
     192    PointSet endpoints;
     193    int Nr;
     194};
     195
     196ostream & operator << (ostream &ost, const BoundaryPolygonSet &a);
    145197
    146198// =========================================================== class TESSELPOINT ===========================================
     
    170222  virtual ~PointCloud();
    171223
     224  virtual const char * const GetName() const { return "unknown"; };
    172225  virtual Vector *GetCenter() const { return NULL; };
    173226  virtual TesselPoint *GetPoint() const { return NULL; };
     
    177230  virtual void GoToFirst() const {};
    178231  virtual void GoToLast() const {};
    179   virtual bool IsEmpty() const { return false; };
    180   virtual bool IsEnd() const { return false; };
     232  virtual bool IsEmpty() const { return true; };
     233  virtual bool IsEnd() const { return true; };
    181234};
    182235
     
    185238class CandidateForTesselation {
    186239  public :
     240  CandidateForTesselation(BoundaryLineSet* currentBaseLine);
    187241  CandidateForTesselation(TesselPoint* candidate, BoundaryLineSet* currentBaseLine, Vector OptCandidateCenter, Vector OtherOptCandidateCenter);
    188242  ~CandidateForTesselation();
    189243
    190   TesselPoint *point;
     244  TesselPointList pointlist;
    191245  BoundaryLineSet *BaseLine;
    192246  Vector OptCenter;
    193247  Vector OtherOptCenter;
    194 };
     248  double ShortestAngle;
     249  double OtherShortestAngle;
     250};
     251
     252ostream & operator <<(ostream &ost, const  CandidateForTesselation &a);
    195253
    196254// =========================================================== class TESSELATION ===========================================
     
    210268    void AddTesselationTriangle();
    211269    void AddTesselationTriangle(const int nr);
     270    void AddCandidateTriangle(CandidateForTesselation CandidateLine);
    212271    void RemoveTesselationTriangle(class BoundaryTriangleSet *triangle);
    213272    void RemoveTesselationLine(class BoundaryLineSet *line);
     
    218277    void FindStartingTriangle(const double RADIUS, const LinkedCell *LC);
    219278    void FindSecondPointForTesselation(class TesselPoint* a, Vector Oben, class TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell *LC);
    220     void FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, class BoundaryLineSet *BaseLine, const class TesselPoint * const ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, const LinkedCell *LC) const;
    221     bool FindNextSuitableTriangle(BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC);
     279    void FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, CandidateForTesselation &CandidateLine, const class TesselPoint  * const ThirdNode, const double RADIUS, const LinkedCell *LC) const;
     280    bool FindNextSuitableTriangle(CandidateForTesselation &CandidateLine, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC);
    222281    int CheckPresenceOfTriangle(class TesselPoint *Candidates[3]) const;
    223282    class BoundaryTriangleSet * GetPresentTriangle(TesselPoint *Candidates[3]);
     
    235294    void RemoveDegeneratedTriangles();
    236295    void AddBoundaryPointByDegeneratedTriangle(class TesselPoint *point, LinkedCell *LC);
     296    int CorrectAllDegeneratedPolygons();
    237297
    238298    set<TesselPoint*> * GetAllConnectedPoints(const TesselPoint* const Point) const;
     
    240300    list<list<TesselPoint*> *> * GetPathsOfConnectedPoints(const TesselPoint* const Point) const;
    241301    list<list<TesselPoint*> *> * GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const;
    242     list<TesselPoint*> * GetCircleOfConnectedPoints(const TesselPoint* const Point, const Vector * const Reference = NULL) const;
     302    list<TesselPoint*> * GetCircleOfSetOfPoints(set<TesselPoint*> *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference = NULL) const;
    243303    class BoundaryPointSet *GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const;
    244304    list<BoundaryTriangleSet*> *FindTriangles(const TesselPoint* const Points[3]) const;
     
    259319    PointMap PointsOnBoundary;
    260320    LineMap LinesOnBoundary;
     321    CandidateMap OpenLines;
    261322    TriangleMap TrianglesOnBoundary;
    262323    int PointsOnBoundaryCount;
     
    286347    mutable PointMap::const_iterator InternalPointer;
    287348
    288     bool HasOtherBaselineBetterCandidate(const BoundaryLineSet * const BaseRay, const TesselPoint * const OptCandidate, double ShortestAngle, double RADIUS, const LinkedCell * const LC) const;
     349    //bool HasOtherBaselineBetterCandidate(const BoundaryLineSet * const BaseRay, const TesselPoint * const OptCandidate, double ShortestAngle, double RADIUS, const LinkedCell * const LC) const;
    289350};
    290351
  • src/tesselationhelpers.cpp

    r8927ae r1ca488  
    88#include <fstream>
    99
     10#include "info.hpp"
    1011#include "linkedcell.hpp"
    1112#include "log.hpp"
     
    1516#include "verbose.hpp"
    1617
    17 double DetGet(gsl_matrix * const A, const int inPlace) {
     18double DetGet(gsl_matrix * const A, const int inPlace)
     19{
     20        Info FunctionInfo(__func__);
    1821  /*
    1922  inPlace = 1 => A is replaced with the LU decomposed copy.
     
    4548void GetSphere(Vector * const center, const Vector &a, const Vector &b, const Vector &c, const double RADIUS)
    4649{
     50        Info FunctionInfo(__func__);
    4751  gsl_matrix *A = gsl_matrix_calloc(3,3);
    4852  double m11, m12, m13, m14;
     
    111115    const double HalfplaneIndicator, const double AlternativeIndicator, const double alpha, const double beta, const double gamma, const double RADIUS, const double Umkreisradius)
    112116{
     117        Info FunctionInfo(__func__);
    113118  Vector TempNormal, helper;
    114119  double Restradius;
    115120  Vector OtherCenter;
    116   Log() << Verbose(3) << "Begin of GetCenterOfSphere.\n";
    117121  Center->Zero();
    118122  helper.CopyVector(&a);
     
    128132  Center->Scale(1./(sin(2.*alpha) + sin(2.*beta) + sin(2.*gamma)));
    129133  NewUmkreismittelpunkt->CopyVector(Center);
    130   Log() << Verbose(4) << "Center of new circumference is " << *NewUmkreismittelpunkt << ".\n";
     134  Log() << Verbose(1) << "Center of new circumference is " << *NewUmkreismittelpunkt << ".\n";
    131135  // Here we calculated center of circumscribing circle, using barycentric coordinates
    132   Log() << Verbose(4) << "Center of circumference is " << *Center << " in direction " << *Direction << ".\n";
     136  Log() << Verbose(1) << "Center of circumference is " << *Center << " in direction " << *Direction << ".\n";
    133137
    134138  TempNormal.CopyVector(&a);
     
    154158  TempNormal.Normalize();
    155159  Restradius = sqrt(RADIUS*RADIUS - Umkreisradius*Umkreisradius);
    156   Log() << Verbose(4) << "Height of center of circumference to center of sphere is " << Restradius << ".\n";
     160  Log() << Verbose(1) << "Height of center of circumference to center of sphere is " << Restradius << ".\n";
    157161  TempNormal.Scale(Restradius);
    158   Log() << Verbose(4) << "Shift vector to sphere of circumference is " << TempNormal << ".\n";
     162  Log() << Verbose(1) << "Shift vector to sphere of circumference is " << TempNormal << ".\n";
    159163
    160164  Center->AddVector(&TempNormal);
    161   Log() << Verbose(0) << "Center of sphere of circumference is " << *Center << ".\n";
     165  Log() << Verbose(1) << "Center of sphere of circumference is " << *Center << ".\n";
    162166  GetSphere(&OtherCenter, a, b, c, RADIUS);
    163   Log() << Verbose(0) << "OtherCenter of sphere of circumference is " << OtherCenter << ".\n";
    164   Log() << Verbose(3) << "End of GetCenterOfSphere.\n";
     167  Log() << Verbose(1) << "OtherCenter of sphere of circumference is " << OtherCenter << ".\n";
    165168};
    166169
     
    174177void GetCenterofCircumcircle(Vector * const Center, const Vector &a, const Vector &b, const Vector &c)
    175178{
     179        Info FunctionInfo(__func__);
    176180  Vector helper;
    177181  double alpha, beta, gamma;
     
    186190  beta = M_PI - SideC.Angle(&SideA);
    187191  gamma = M_PI - SideA.Angle(&SideB);
    188   //Log() << Verbose(3) << "INFO: alpha = " << alpha/M_PI*180. << ", beta = " << beta/M_PI*180. << ", gamma = " << gamma/M_PI*180. << "." << endl;
     192  //Log() << Verbose(1) << "INFO: alpha = " << alpha/M_PI*180. << ", beta = " << beta/M_PI*180. << ", gamma = " << gamma/M_PI*180. << "." << endl;
    189193  if (fabs(M_PI - alpha - beta - gamma) > HULLEPSILON) {
    190194    eLog() << Verbose(1) << "GetCenterofCircumcircle: Sum of angles " << (alpha+beta+gamma)/M_PI*180. << " > 180 degrees by " << fabs(M_PI - alpha - beta - gamma)/M_PI*180. << "!" << endl;
     
    219223double GetPathLengthonCircumCircle(const Vector &CircleCenter, const Vector &CirclePlaneNormal, const double CircleRadius, const Vector &NewSphereCenter, const Vector &OldSphereCenter, const Vector &NormalVector, const Vector &SearchDirection)
    220224{
     225        Info FunctionInfo(__func__);
    221226  Vector helper;
    222227  double radius, alpha;
    223 
    224   helper.CopyVector(&NewSphereCenter);
     228  Vector RelativeOldSphereCenter;
     229  Vector RelativeNewSphereCenter;
     230
     231  RelativeOldSphereCenter.CopyVector(&OldSphereCenter);
     232  RelativeOldSphereCenter.SubtractVector(&CircleCenter);
     233  RelativeNewSphereCenter.CopyVector(&NewSphereCenter);
     234  RelativeNewSphereCenter.SubtractVector(&CircleCenter);
     235  helper.CopyVector(&RelativeNewSphereCenter);
    225236  // test whether new center is on the parameter circle's plane
    226237  if (fabs(helper.ScalarProduct(&CirclePlaneNormal)) > HULLEPSILON) {
     
    228239    helper.ProjectOntoPlane(&CirclePlaneNormal);
    229240  }
    230   radius = helper.ScalarProduct(&helper);
     241  radius = helper.NormSquared();
    231242  // test whether the new center vector has length of CircleRadius
    232243  if (fabs(radius - CircleRadius) > HULLEPSILON)
    233244    eLog() << Verbose(1) << "The projected center of the new sphere has radius " << radius << " instead of " << CircleRadius << "." << endl;
    234   alpha = helper.Angle(&OldSphereCenter);
     245  alpha = helper.Angle(&RelativeOldSphereCenter);
    235246  // make the angle unique by checking the halfplanes/search direction
    236247  if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)  // acos is not unique on [0, 2.*M_PI), hence extra check to decide between two half intervals
    237248    alpha = 2.*M_PI - alpha;
    238   //Log() << Verbose(2) << "INFO: RelativeNewSphereCenter is " << helper << ", RelativeOldSphereCenter is " << OldSphereCenter << " and resulting angle is " << alpha << "." << endl;
    239   radius = helper.Distance(&OldSphereCenter);
     249  Log() << Verbose(1) << "INFO: RelativeNewSphereCenter is " << helper << ", RelativeOldSphereCenter is " << RelativeOldSphereCenter << " and resulting angle is " << alpha << "." << endl;
     250  radius = helper.Distance(&RelativeOldSphereCenter);
    240251  helper.ProjectOntoPlane(&NormalVector);
    241252  // check whether new center is somewhat away or at least right over the current baseline to prevent intersecting triangles
    242253  if ((radius > HULLEPSILON) || (helper.Norm() < HULLEPSILON)) {
    243     //Log() << Verbose(2) << "INFO: Distance between old and new center is " << radius << " and between new center and baseline center is " << helper.Norm() << "." << endl;
     254    Log() << Verbose(1) << "INFO: Distance between old and new center is " << radius << " and between new center and baseline center is " << helper.Norm() << "." << endl;
    244255    return alpha;
    245256  } else {
    246     //Log() << Verbose(1) << "INFO: NewSphereCenter " << helper << " is too close to OldSphereCenter" << OldSphereCenter << "." << endl;
     257    Log() << Verbose(1) << "INFO: NewSphereCenter " << RelativeNewSphereCenter << " is too close to RelativeOldSphereCenter" << RelativeOldSphereCenter << "." << endl;
    247258    return 2.*M_PI;
    248259  }
     
    264275double MinIntersectDistance(const gsl_vector * x, void *params)
    265276{
     277        Info FunctionInfo(__func__);
    266278  double retval = 0;
    267279  struct Intersection *I = (struct Intersection *)params;
     
    284296
    285297  retval = HeightA.ScalarProduct(&HeightA) + HeightB.ScalarProduct(&HeightB);
    286   //Log() << Verbose(2) << "MinIntersectDistance called, result: " << retval << endl;
     298  //Log() << Verbose(1) << "MinIntersectDistance called, result: " << retval << endl;
    287299
    288300  return retval;
     
    304316bool existsIntersection(const Vector &point1, const Vector &point2, const Vector &point3, const Vector &point4)
    305317{
     318        Info FunctionInfo(__func__);
    306319  bool result;
    307320
     
    351364
    352365        if (status == GSL_SUCCESS) {
    353           Log() << Verbose(2) << "converged to minimum" <<  endl;
     366          Log() << Verbose(1) << "converged to minimum" <<  endl;
    354367        }
    355368    } while (status == GSL_CONTINUE && iter < 100);
     
    376389  t2 = HeightB.ScalarProduct(&SideB)/SideB.ScalarProduct(&SideB);
    377390
    378   Log() << Verbose(2) << "Intersection " << intersection << " is at "
     391  Log() << Verbose(1) << "Intersection " << intersection << " is at "
    379392    << t1 << " for (" << point1 << "," << point2 << ") and at "
    380393    << t2 << " for (" << point3 << "," << point4 << "): ";
    381394
    382395  if (((t1 >= 0) && (t1 <= 1)) && ((t2 >= 0) && (t2 <= 1))) {
    383     Log() << Verbose(0) << "true intersection." << endl;
     396    Log() << Verbose(1) << "true intersection." << endl;
    384397    result = true;
    385398  } else {
    386     Log() << Verbose(0) << "intersection out of region of interest." << endl;
     399    Log() << Verbose(1) << "intersection out of region of interest." << endl;
    387400    result = false;
    388401  }
     
    407420double GetAngle(const Vector &point, const Vector &reference, const Vector &OrthogonalVector)
    408421{
     422        Info FunctionInfo(__func__);
    409423  if (reference.IsZero())
    410424    return M_PI;
     
    418432  }
    419433
    420   Log() << Verbose(4) << "INFO: " << point << " has angle " << phi << " with respect to reference " << reference << "." << endl;
     434  Log() << Verbose(1) << "INFO: " << point << " has angle " << phi << " with respect to reference " << reference << "." << endl;
    421435
    422436  return phi;
     
    433447double CalculateVolumeofGeneralTetraeder(const Vector &a, const Vector &b, const Vector &c, const Vector &d)
    434448{
     449        Info FunctionInfo(__func__);
    435450  Vector Point, TetraederVector[3];
    436451  double volume;
     
    456471bool CheckLineCriteriaForDegeneratedTriangle(const BoundaryPointSet * const nodes[3])
    457472{
     473        Info FunctionInfo(__func__);
    458474  bool result = false;
    459475  int counter = 0;
     
    482498    }
    483499  if ((!result) && (counter > 1)) {
    484     Log() << Verbose(2) << "INFO: Degenerate triangle is ok, at least two, here " << counter << ", existing lines are used." << endl;
     500    Log() << Verbose(1) << "INFO: Degenerate triangle is ok, at least two, here " << counter << ", existing lines are used." << endl;
    485501    result = true;
    486502  }
     
    489505
    490506
    491 /** Sort function for the candidate list.
    492  */
    493 bool SortCandidates(const CandidateForTesselation* candidate1, const CandidateForTesselation* candidate2)
    494 {
    495   Vector BaseLineVector, OrthogonalVector, helper;
    496   if (candidate1->BaseLine != candidate2->BaseLine) {  // sanity check
    497     eLog() << Verbose(1) << "sortCandidates was called for two different baselines: " << candidate1->BaseLine << " and " << candidate2->BaseLine << "." << endl;
    498     //return false;
    499     exit(1);
    500   }
    501   // create baseline vector
    502   BaseLineVector.CopyVector(candidate1->BaseLine->endpoints[1]->node->node);
    503   BaseLineVector.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node);
    504   BaseLineVector.Normalize();
    505 
    506   // create normal in-plane vector to cope with acos() non-uniqueness on [0,2pi] (note that is pointing in the "right" direction already, hence ">0" test!)
    507   helper.CopyVector(candidate1->BaseLine->endpoints[0]->node->node);
    508   helper.SubtractVector(candidate1->point->node);
    509   OrthogonalVector.CopyVector(&helper);
    510   helper.VectorProduct(&BaseLineVector);
    511   OrthogonalVector.SubtractVector(&helper);
    512   OrthogonalVector.Normalize();
    513 
    514   // calculate both angles and correct with in-plane vector
    515   helper.CopyVector(candidate1->point->node);
    516   helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node);
    517   double phi = BaseLineVector.Angle(&helper);
    518   if (OrthogonalVector.ScalarProduct(&helper) > 0) {
    519     phi = 2.*M_PI - phi;
    520   }
    521   helper.CopyVector(candidate2->point->node);
    522   helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node);
    523   double psi = BaseLineVector.Angle(&helper);
    524   if (OrthogonalVector.ScalarProduct(&helper) > 0) {
    525     psi = 2.*M_PI - psi;
    526   }
    527 
    528   Log() << Verbose(2) << *candidate1->point << " has angle " << phi << endl;
    529   Log() << Verbose(2) << *candidate2->point << " has angle " << psi << endl;
    530 
    531   // return comparison
    532   return phi < psi;
    533 };
     507///** Sort function for the candidate list.
     508// */
     509//bool SortCandidates(const CandidateForTesselation* candidate1, const CandidateForTesselation* candidate2)
     510//{
     511//      Info FunctionInfo(__func__);
     512//  Vector BaseLineVector, OrthogonalVector, helper;
     513//  if (candidate1->BaseLine != candidate2->BaseLine) {  // sanity check
     514//    eLog() << Verbose(1) << "sortCandidates was called for two different baselines: " << candidate1->BaseLine << " and " << candidate2->BaseLine << "." << endl;
     515//    //return false;
     516//    exit(1);
     517//  }
     518//  // create baseline vector
     519//  BaseLineVector.CopyVector(candidate1->BaseLine->endpoints[1]->node->node);
     520//  BaseLineVector.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node);
     521//  BaseLineVector.Normalize();
     522//
     523//  // create normal in-plane vector to cope with acos() non-uniqueness on [0,2pi] (note that is pointing in the "right" direction already, hence ">0" test!)
     524//  helper.CopyVector(candidate1->BaseLine->endpoints[0]->node->node);
     525//  helper.SubtractVector(candidate1->point->node);
     526//  OrthogonalVector.CopyVector(&helper);
     527//  helper.VectorProduct(&BaseLineVector);
     528//  OrthogonalVector.SubtractVector(&helper);
     529//  OrthogonalVector.Normalize();
     530//
     531//  // calculate both angles and correct with in-plane vector
     532//  helper.CopyVector(candidate1->point->node);
     533//  helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node);
     534//  double phi = BaseLineVector.Angle(&helper);
     535//  if (OrthogonalVector.ScalarProduct(&helper) > 0) {
     536//    phi = 2.*M_PI - phi;
     537//  }
     538//  helper.CopyVector(candidate2->point->node);
     539//  helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node);
     540//  double psi = BaseLineVector.Angle(&helper);
     541//  if (OrthogonalVector.ScalarProduct(&helper) > 0) {
     542//    psi = 2.*M_PI - psi;
     543//  }
     544//
     545//  Log() << Verbose(1) << *candidate1->point << " has angle " << phi << endl;
     546//  Log() << Verbose(1) << *candidate2->point << " has angle " << psi << endl;
     547//
     548//  // return comparison
     549//  return phi < psi;
     550//};
    534551
    535552/**
     
    543560TesselPoint* FindSecondClosestPoint(const Vector* Point, const LinkedCell* const LC)
    544561{
     562        Info FunctionInfo(__func__);
    545563  TesselPoint* closestPoint = NULL;
    546564  TesselPoint* secondClosestPoint = NULL;
     
    553571  for(int i=0;i<NDIM;i++) // store indices of this cell
    554572    N[i] = LC->n[i];
    555   Log() << Verbose(2) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
     573  Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
    556574
    557575  LC->GetNeighbourBounds(Nlower, Nupper);
    558   //Log() << Verbose(0) << endl;
     576  //Log() << Verbose(1) << endl;
    559577  for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++)
    560578    for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++)
    561579      for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) {
    562580        const LinkedNodes *List = LC->GetCurrentCell();
    563         //Log() << Verbose(3) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;
     581        //Log() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;
    564582        if (List != NULL) {
    565583          for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
     
    597615TesselPoint* FindClosestPoint(const Vector* Point, TesselPoint *&SecondPoint, const LinkedCell* const LC)
    598616{
     617        Info FunctionInfo(__func__);
    599618  TesselPoint* closestPoint = NULL;
    600619  SecondPoint = NULL;
     
    607626  for(int i=0;i<NDIM;i++) // store indices of this cell
    608627    N[i] = LC->n[i];
    609   Log() << Verbose(3) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
     628  Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;
    610629
    611630  LC->GetNeighbourBounds(Nlower, Nupper);
    612   //Log() << Verbose(0) << endl;
     631  //Log() << Verbose(1) << endl;
    613632  for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++)
    614633    for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++)
    615634      for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) {
    616635        const LinkedNodes *List = LC->GetCurrentCell();
    617         //Log() << Verbose(3) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;
     636        //Log() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;
    618637        if (List != NULL) {
    619638          for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
     
    626645              distance = currentNorm;
    627646              closestPoint = (*Runner);
    628               //Log() << Verbose(2) << "INFO: New Nearest Neighbour is " << *closestPoint << "." << endl;
     647              //Log() << Verbose(1) << "INFO: New Nearest Neighbour is " << *closestPoint << "." << endl;
    629648            } else if (currentNorm < secondDistance) {
    630649              secondDistance = currentNorm;
    631650              SecondPoint = (*Runner);
    632               //Log() << Verbose(2) << "INFO: New Second Nearest Neighbour is " << *SecondPoint << "." << endl;
     651              //Log() << Verbose(1) << "INFO: New Second Nearest Neighbour is " << *SecondPoint << "." << endl;
    633652            }
    634653          }
     
    640659  // output
    641660  if (closestPoint != NULL) {
    642     Log() << Verbose(2) << "Closest point is " << *closestPoint;
     661    Log() << Verbose(1) << "Closest point is " << *closestPoint;
    643662    if (SecondPoint != NULL)
    644663      Log() << Verbose(0) << " and second closest is " << *SecondPoint;
     
    656675Vector * GetClosestPointBetweenLine(const BoundaryLineSet * const Base, const BoundaryLineSet * const OtherBase)
    657676{
     677        Info FunctionInfo(__func__);
    658678  // construct the plane of the two baselines (i.e. take both their directional vectors)
    659679  Vector Normal;
     
    666686  Normal.VectorProduct(&OtherBaseline);
    667687  Normal.Normalize();
    668   Log() << Verbose(4) << "First direction is " << Baseline << ", second direction is " << OtherBaseline << ", normal of intersection plane is " << Normal << "." << endl;
     688  Log() << Verbose(1) << "First direction is " << Baseline << ", second direction is " << OtherBaseline << ", normal of intersection plane is " << Normal << "." << endl;
    669689
    670690  // project one offset point of OtherBase onto this plane (and add plane offset vector)
     
    683703  Normal.CopyVector(Intersection);
    684704  Normal.SubtractVector(Base->endpoints[0]->node->node);
    685   Log() << Verbose(3) << "Found closest point on " << *Base << " at " << *Intersection << ", factor in line is " << fabs(Normal.ScalarProduct(&Baseline)/Baseline.NormSquared()) << "." << endl;
     705  Log() << Verbose(1) << "Found closest point on " << *Base << " at " << *Intersection << ", factor in line is " << fabs(Normal.ScalarProduct(&Baseline)/Baseline.NormSquared()) << "." << endl;
    686706
    687707  return Intersection;
     
    696716double DistanceToTrianglePlane(const Vector *x, const BoundaryTriangleSet * const triangle)
    697717{
     718        Info FunctionInfo(__func__);
    698719  double distance = 0.;
    699720  if (x == NULL) {
     
    712733void WriteVrmlFile(ofstream * const vrmlfile, const Tesselation * const Tess, const PointCloud * const cloud)
    713734{
     735        Info FunctionInfo(__func__);
    714736  TesselPoint *Walker = NULL;
    715737  int i;
     
    755777void IncludeSphereinRaster3D(ofstream * const rasterfile, const Tesselation * const Tess, const PointCloud * const cloud)
    756778{
     779        Info FunctionInfo(__func__);
    757780  Vector helper;
    758   // include the current position of the virtual sphere in the temporary raster3d file
    759   Vector *center = cloud->GetCenter();
    760   // make the circumsphere's center absolute again
    761   helper.CopyVector(Tess->LastTriangle->endpoints[0]->node->node);
    762   helper.AddVector(Tess->LastTriangle->endpoints[1]->node->node);
    763   helper.AddVector(Tess->LastTriangle->endpoints[2]->node->node);
    764   helper.Scale(1./3.);
    765   helper.SubtractVector(center);
    766   // and add to file plus translucency object
    767   *rasterfile << "# current virtual sphere\n";
    768   *rasterfile << "8\n  25.0    0.6     -1.0 -1.0 -1.0     0.2        0 0 0 0\n";
    769   *rasterfile << "2\n  " << helper.x[0] << " " << helper.x[1] << " " << helper.x[2] << "\t" << 5. << "\t1 0 0\n";
    770   *rasterfile << "9\n  terminating special property\n";
    771   delete(center);
     781
     782  if (Tess->LastTriangle != NULL) {
     783    // include the current position of the virtual sphere in the temporary raster3d file
     784    Vector *center = cloud->GetCenter();
     785    // make the circumsphere's center absolute again
     786    helper.CopyVector(Tess->LastTriangle->endpoints[0]->node->node);
     787    helper.AddVector(Tess->LastTriangle->endpoints[1]->node->node);
     788    helper.AddVector(Tess->LastTriangle->endpoints[2]->node->node);
     789    helper.Scale(1./3.);
     790    helper.SubtractVector(center);
     791    // and add to file plus translucency object
     792    *rasterfile << "# current virtual sphere\n";
     793    *rasterfile << "8\n  25.0    0.6     -1.0 -1.0 -1.0     0.2        0 0 0 0\n";
     794    *rasterfile << "2\n  " << helper.x[0] << " " << helper.x[1] << " " << helper.x[2] << "\t" << 5. << "\t1 0 0\n";
     795    *rasterfile << "9\n  terminating special property\n";
     796    delete(center);
     797  }
    772798};
    773799
     
    780806void WriteRaster3dFile(ofstream * const rasterfile, const Tesselation * const Tess, const PointCloud * const cloud)
    781807{
     808        Info FunctionInfo(__func__);
    782809  TesselPoint *Walker = NULL;
    783810  int i;
     
    825852void WriteTecplotFile(ofstream * const tecplot, const Tesselation * const TesselStruct, const PointCloud * const cloud, const int N)
    826853{
     854        Info FunctionInfo(__func__);
    827855  if ((tecplot != NULL) && (TesselStruct != NULL)) {
    828856    // write header
    829857    *tecplot << "TITLE = \"3D CONVEX SHELL\"" << endl;
    830858    *tecplot << "VARIABLES = \"X\" \"Y\" \"Z\" \"U\"" << endl;
    831     *tecplot << "ZONE T=\"" << N << "-";
    832     for (int i=0;i<3;i++)
    833       *tecplot << (i==0 ? "" : "_") << TesselStruct->LastTriangle->endpoints[i]->node->Name;
     859    *tecplot << "ZONE T=\"";
     860    if (N < 0) {
     861      *tecplot << cloud->GetName();
     862    } else {
     863      *tecplot << N << "-";
     864      for (int i=0;i<3;i++)
     865        *tecplot << (i==0 ? "" : "_") << TesselStruct->LastTriangle->endpoints[i]->node->Name;
     866    }
    834867    *tecplot << "\", N=" << TesselStruct->PointsOnBoundary.size() << ", E=" << TesselStruct->TrianglesOnBoundary.size() << ", DATAPACKING=POINT, ZONETYPE=FETRIANGLE" << endl;
    835868    int i=0;
     
    840873
    841874    // print atom coordinates
    842     Log() << Verbose(2) << "The following triangles were created:";
    843875    int Counter = 1;
    844876    TesselPoint *Walker = NULL;
     
    850882    *tecplot << endl;
    851883    // print connectivity
     884    Log() << Verbose(1) << "The following triangles were created:" << endl;
    852885    for (TriangleMap::const_iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++) {
    853       Log() << Verbose(0) << " " << runner->second->endpoints[0]->node->Name << "<->" << runner->second->endpoints[1]->node->Name << "<->" << runner->second->endpoints[2]->node->Name;
     886      Log() << Verbose(1) << " " << runner->second->endpoints[0]->node->Name << "<->" << runner->second->endpoints[1]->node->Name << "<->" << runner->second->endpoints[2]->node->Name << endl;
    854887      *tecplot << LookupList[runner->second->endpoints[0]->node->nr] << " " << LookupList[runner->second->endpoints[1]->node->nr] << " " << LookupList[runner->second->endpoints[2]->node->nr] << endl;
    855888    }
    856889    delete[] (LookupList);
    857     Log() << Verbose(0) << endl;
    858890  }
    859891};
     
    866898void CalculateConcavityPerBoundaryPoint(const Tesselation * const TesselStruct)
    867899{
     900        Info FunctionInfo(__func__);
    868901  class BoundaryPointSet *point = NULL;
    869902  class BoundaryLineSet *line = NULL;
    870903
    871   //Log() << Verbose(2) << "Begin of CalculateConcavityPerBoundaryPoint" << endl;
    872904  // calculate remaining concavity
    873905  for (PointMap::const_iterator PointRunner = TesselStruct->PointsOnBoundary.begin(); PointRunner != TesselStruct->PointsOnBoundary.end(); PointRunner++) {
     
    877909    for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) {
    878910      line = LineRunner->second;
    879       //Log() << Verbose(2) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;
     911      //Log() << Verbose(1) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;
    880912      if (!line->CheckConvexityCriterion())
    881913        point->value += 1;
    882914    }
    883915  }
    884   //Log() << Verbose(2) << "End of CalculateConcavityPerBoundaryPoint" << endl;
    885916};
    886917
     
    893924bool CheckListOfBaselines(const Tesselation * const TesselStruct)
    894925{
     926        Info FunctionInfo(__func__);
    895927  LineMap::const_iterator testline;
    896928  bool result = false;
     
    900932  for (testline = TesselStruct->LinesOnBoundary.begin(); testline != TesselStruct->LinesOnBoundary.end(); testline++) {
    901933    if (testline->second->triangles.size() != 2) {
    902       Log() << Verbose(1) << *testline->second << "\t" << testline->second->triangles.size() << endl;
     934      Log() << Verbose(2) << *testline->second << "\t" << testline->second->triangles.size() << endl;
    903935      counter++;
    904936    }
     
    911943}
    912944
     945/** Counts the number of triangle pairs that contain the given polygon.
     946 * \param *P polygon with endpoints to look for
     947 * \param *T set of triangles to create pairs from containing \a *P
     948 */
     949int CountTrianglePairContainingPolygon(const BoundaryPolygonSet * const P, const TriangleSet * const T)
     950{
     951  Info FunctionInfo(__func__);
     952  // check number of endpoints in *P
     953  if (P->endpoints.size() != 4) {
     954    eLog() << Verbose(1) << "CountTrianglePairContainingPolygon works only on polygons with 4 nodes!" << endl;
     955    return 0;
     956  }
     957
     958  // check number of triangles in *T
     959  if (T->size() < 2) {
     960    eLog() << Verbose(1) << "Not enough triangles to have pairs!" << endl;
     961    return 0;
     962  }
     963
     964  Log() << Verbose(0) << "Polygon is " << *P << endl;
     965  // create each pair, get the endpoints and check whether *P is contained.
     966  int counter = 0;
     967  PointSet Trianglenodes;
     968  class BoundaryPolygonSet PairTrianglenodes;
     969  for(TriangleSet::iterator Walker = T->begin(); Walker != T->end(); Walker++) {
     970    for (int i=0;i<3;i++)
     971      Trianglenodes.insert((*Walker)->endpoints[i]);
     972
     973    for(TriangleSet::iterator PairWalker = Walker; PairWalker != T->end(); PairWalker++) {
     974      if (Walker != PairWalker) { // skip first
     975        PairTrianglenodes.endpoints = Trianglenodes;
     976        for (int i=0;i<3;i++)
     977          PairTrianglenodes.endpoints.insert((*PairWalker)->endpoints[i]);
     978        const int size = PairTrianglenodes.endpoints.size();
     979        if (size == 4) {
     980          Log() << Verbose(0) << " Current pair of triangles: " << **Walker << "," << **PairWalker << " with " << size << " distinct endpoints:" << PairTrianglenodes << endl;
     981          // now check
     982          if (PairTrianglenodes.ContainsPresentTupel(P)) {
     983            counter++;
     984            Log() << Verbose(0) << "  ACCEPT: Matches with " << *P << endl;
     985          } else {
     986            Log() << Verbose(0) << "  REJECT: No match with " << *P << endl;
     987          }
     988        } else {
     989          Log() << Verbose(0) << "  REJECT: Less than four endpoints." << endl;
     990        }
     991      }
     992    }
     993    Trianglenodes.clear();
     994  }
     995  return counter;
     996};
     997
     998/** Checks whether two give polygons have two or more points in common.
     999 * \param *P1 first polygon
     1000 * \param *P2 second polygon
     1001 * \return true - are connected, false = are note
     1002 */
     1003bool ArePolygonsEdgeConnected(const BoundaryPolygonSet * const P1, const BoundaryPolygonSet * const P2)
     1004{
     1005  Info FunctionInfo(__func__);
     1006  int counter = 0;
     1007  for(PointSet::const_iterator Runner = P1->endpoints.begin(); Runner != P1->endpoints.end(); Runner++) {
     1008    if (P2->ContainsBoundaryPoint((*Runner))) {
     1009      counter++;
     1010      Log() << Verbose(1) << *(*Runner) << " of second polygon is found in the first one." << endl;
     1011      return true;
     1012    }
     1013  }
     1014  return false;
     1015};
     1016
     1017/** Combines second into the first and deletes the second.
     1018 * \param *P1 first polygon, contains all nodes on return
     1019 * \param *&P2 second polygon, is deleted.
     1020 */
     1021void CombinePolygons(BoundaryPolygonSet * const P1, BoundaryPolygonSet * &P2)
     1022{
     1023  Info FunctionInfo(__func__);
     1024  pair <PointSet::iterator, bool> Tester;
     1025  for(PointSet::iterator Runner = P2->endpoints.begin(); Runner != P2->endpoints.end(); Runner++) {
     1026    Tester = P1->endpoints.insert((*Runner));
     1027    if (Tester.second)
     1028      Log() << Verbose(0) << "Inserting endpoint " << *(*Runner) << " into first polygon." << endl;
     1029  }
     1030  P2->endpoints.clear();
     1031  delete(P2);
     1032};
     1033
  • src/tesselationhelpers.hpp

    r8927ae r1ca488  
    7272bool CheckListOfBaselines(const Tesselation * const TesselStruct);
    7373
     74int CountTrianglePairContainingPolygon(const BoundaryPolygonSet * const P, const TriangleSet * const T);
     75bool ArePolygonsEdgeConnected(const BoundaryPolygonSet * const P1, const BoundaryPolygonSet * const P2);
     76void CombinePolygons(BoundaryPolygonSet * const P1, BoundaryPolygonSet * &P2);
     77
    7478
    7579#endif /* TESSELATIONHELPERS_HPP_ */
  • src/unittests/Makefile.am

    r8927ae r1ca488  
    66MENUTESTS = ActionSequenceTest
    77
    8 TESTS = ActOnAllUnitTest AnalysisBondsUnitTests AnalysisCorrelationToPointUnitTest AnalysisCorrelationToSurfaceUnitTest AnalysisPairCorrelationUnitTest BondGraphUnitTest ListOfBondsUnitTest LogUnitTest MemoryUsageObserverUnitTest MemoryAllocatorUnitTest StackClassUnitTest VectorUnitTest ${MENUTESTS}
     8TESTS = ActOnAllUnitTest AnalysisBondsUnitTests AnalysisCorrelationToPointUnitTest AnalysisCorrelationToSurfaceUnitTest AnalysisPairCorrelationUnitTest BondGraphUnitTest InfoUnitTest ListOfBondsUnitTest LogUnitTest MemoryUsageObserverUnitTest MemoryAllocatorUnitTest StackClassUnitTest VectorUnitTest ${MENUTESTS}
     9
    910check_PROGRAMS = $(TESTS)
    1011noinst_PROGRAMS = $(TESTS)
     
    2728BondGraphUnitTest_SOURCES = bondgraphunittest.cpp bondgraphunittest.hpp
    2829BondGraphUnitTest_LDADD = ../libmolecuilder.a
     30
     31InfoUnitTest_SOURCES = infounittest.cpp infounittest.hpp
     32InfoUnitTest_LDADD = ../libmolecuilder.a
    2933
    3034ListOfBondsUnitTest_SOURCES = listofbondsunittest.cpp listofbondsunittest.hpp
  • src/vector.cpp

    r8927ae r1ca488  
    480480  else
    481481    return false;
     482};
     483
     484/** Checks whether vector is normal to \a *normal.
     485 * @return true - vector is normalized, false - vector is not
     486 */
     487bool Vector::IsEqualTo(const Vector * const a) const
     488{
     489  bool status = true;
     490  for (int i=0;i<NDIM;i++) {
     491    if (fabs(x[i] - a->x[i]) > MYEPSILON)
     492      status = false;
     493  }
     494  return status;
    482495};
    483496
  • src/vector.hpp

    r8927ae r1ca488  
    4242  bool IsOne() const;
    4343  bool IsNormalTo(const Vector * const normal) const;
     44  bool IsEqualTo(const Vector * const a) const;
    4445
    4546  void AddVector(const Vector * const y);
  • src/verbose.cpp

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    r8927ae r1ca488  
    11TITLE = "3D CONVEX SHELL"
    22VARIABLES = "X" "Y" "Z" "U"
    3 ZONE T="0- C05_ O09_ H12", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
     3ZONE T="tartaric_acid", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
    4410.156 6.9295 6.2926 4
    558.5078 5.7627 5 1
  • tests/regression/Tesselation/1/post/NonConvexEnvelope.dat

    r8927ae r1ca488  
    11TITLE = "3D CONVEX SHELL"
    22VARIABLES = "X" "Y" "Z" "U"
    3 ZONE T="0- H08_ H09_ H11", N=8, E=12, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
     3ZONE T="test", N=8, E=12, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
    449.78209 2.64589 2.64589 0
    559.78209 2.64589 4.42589 0
     
    13131 3 4
    14141 4 7
     154 6 7
    15163 4 5
    16 1 7 8
    17 1 2 8
    18 4 6 7
     174 5 6
    19182 3 5
    20 4 5 6
    21 6 7 8
    22 1 2 3
    23192 5 8
    24205 6 8
     216 7 8
     221 2 7
     232 7 8
     241 2 3
  • tests/regression/Tesselation/1/post/NonConvexEnvelope.r3d

    r8927ae r1ca488  
    3434  1.37419 -0.89433 -0.89        0.12489 1.24767 -0.89   -1.12431 -0.89433 -0.89         1. 0. 0.
    35351
    36   2.26414 0.364321 -4.44089e-16         0.12489 1.24767 -0.89   0.12489 1.24767 0.89    1. 0. 0.
    37 1
    38   1.37419 -0.89433 -0.89        -1.12431 -0.89433 -0.89         -1.12431 -0.89433 0.89  1. 0. 0.
    39 1
    40   1.37419 -0.89433 -0.89        1.37419 -0.89433 0.89   -1.12431 -0.89433 0.89  1. 0. 0.
    41 1
    4236  0.12489 1.24767 -0.89         -2.01426 0.364321 -4.44089e-16  -1.12431 -0.89433 -0.89         1. 0. 0.
    43371
    44   1.37419 -0.89433 0.89         2.26414 0.364321 -4.44089e-16   0.12489 1.24767 0.89    1. 0. 0.
     38  2.26414 0.364321 -4.44089e-16         0.12489 1.24767 -0.89   0.12489 1.24767 0.89    1. 0. 0.
    45391
    4640  0.12489 1.24767 -0.89         0.12489 1.24767 0.89    -2.01426 0.364321 -4.44089e-16  1. 0. 0.
    47411
    48   -2.01426 0.364321 -4.44089e-16        -1.12431 -0.89433 -0.89         -1.12431 -0.89433 0.89  1. 0. 0.
    49 1
    50   1.37419 -0.89433 -0.89        1.37419 -0.89433 0.89   2.26414 0.364321 -4.44089e-16   1. 0. 0.
     42  1.37419 -0.89433 0.89         2.26414 0.364321 -4.44089e-16   0.12489 1.24767 0.89    1. 0. 0.
    51431
    5244  1.37419 -0.89433 0.89         0.12489 1.24767 0.89    -1.12431 -0.89433 0.89  1. 0. 0.
    53451
    5446  0.12489 1.24767 0.89  -2.01426 0.364321 -4.44089e-16  -1.12431 -0.89433 0.89  1. 0. 0.
     471
     48  -2.01426 0.364321 -4.44089e-16        -1.12431 -0.89433 -0.89         -1.12431 -0.89433 0.89  1. 0. 0.
     491
     50  1.37419 -0.89433 -0.89        1.37419 -0.89433 0.89   -1.12431 -0.89433 -0.89         1. 0. 0.
     511
     52  1.37419 -0.89433 0.89         -1.12431 -0.89433 -0.89         -1.12431 -0.89433 0.89  1. 0. 0.
     531
     54  1.37419 -0.89433 -0.89        1.37419 -0.89433 0.89   2.26414 0.364321 -4.44089e-16   1. 0. 0.
    55559
    5656#  terminating special property
     
    5959  25.0    0.6     -1.0 -1.0 -1.0     0.2        0 0 0 0
    60602
    61   -1.00456 0.23922 0.593333     5       1 0 0
     61  1.67084 -0.47478 -8.88178e-16 5       1 0 0
    62629
    6363  terminating special property
  • tests/regression/Tesselation/2/post/ConvexEnvelope.dat

    r8927ae r1ca488  
    11TITLE = "3D CONVEX SHELL"
    22VARIABLES = "X" "Y" "Z" "U"
    3 ZONE T="0- H08_ H09_ H11", N=8, E=12, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
     3ZONE T="test", N=8, E=12, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
    449.78209 2.64589 2.64589 0
    559.78209 2.64589 4.42589 0
     
    13131 3 4
    14141 4 7
     154 6 7
    15163 4 5
    16 1 7 8
    17 1 2 8
    18 4 6 7
     174 5 6
    19182 3 5
    20 4 5 6
    21 6 7 8
    22 1 2 3
    23192 5 8
    24205 6 8
     216 7 8
     221 2 7
     232 7 8
     241 2 3
  • tests/regression/Tesselation/2/post/ConvexEnvelope.r3d

    r8927ae r1ca488  
    3434  1.37419 -0.89433 -0.89        0.12489 1.24767 -0.89   -1.12431 -0.89433 -0.89         1. 0. 0.
    35351
    36   2.26414 0.364321 -4.44089e-16         0.12489 1.24767 -0.89   0.12489 1.24767 0.89    1. 0. 0.
    37 1
    38   1.37419 -0.89433 -0.89        -1.12431 -0.89433 -0.89         -1.12431 -0.89433 0.89  1. 0. 0.
    39 1
    40   1.37419 -0.89433 -0.89        1.37419 -0.89433 0.89   -1.12431 -0.89433 0.89  1. 0. 0.
    41 1
    4236  0.12489 1.24767 -0.89         -2.01426 0.364321 -4.44089e-16  -1.12431 -0.89433 -0.89         1. 0. 0.
    43371
    44   1.37419 -0.89433 0.89         2.26414 0.364321 -4.44089e-16   0.12489 1.24767 0.89    1. 0. 0.
     38  2.26414 0.364321 -4.44089e-16         0.12489 1.24767 -0.89   0.12489 1.24767 0.89    1. 0. 0.
    45391
    4640  0.12489 1.24767 -0.89         0.12489 1.24767 0.89    -2.01426 0.364321 -4.44089e-16  1. 0. 0.
    47411
    48   -2.01426 0.364321 -4.44089e-16        -1.12431 -0.89433 -0.89         -1.12431 -0.89433 0.89  1. 0. 0.
    49 1
    50   1.37419 -0.89433 -0.89        1.37419 -0.89433 0.89   2.26414 0.364321 -4.44089e-16   1. 0. 0.
     42  1.37419 -0.89433 0.89         2.26414 0.364321 -4.44089e-16   0.12489 1.24767 0.89    1. 0. 0.
    51431
    5244  1.37419 -0.89433 0.89         0.12489 1.24767 0.89    -1.12431 -0.89433 0.89  1. 0. 0.
    53451
    5446  0.12489 1.24767 0.89  -2.01426 0.364321 -4.44089e-16  -1.12431 -0.89433 0.89  1. 0. 0.
     471
     48  -2.01426 0.364321 -4.44089e-16        -1.12431 -0.89433 -0.89         -1.12431 -0.89433 0.89  1. 0. 0.
     491
     50  1.37419 -0.89433 -0.89        1.37419 -0.89433 0.89   -1.12431 -0.89433 -0.89         1. 0. 0.
     511
     52  1.37419 -0.89433 0.89         -1.12431 -0.89433 -0.89         -1.12431 -0.89433 0.89  1. 0. 0.
     531
     54  1.37419 -0.89433 -0.89        1.37419 -0.89433 0.89   2.26414 0.364321 -4.44089e-16   1. 0. 0.
    55559
    5656#  terminating special property
     
    5959  25.0    0.6     -1.0 -1.0 -1.0     0.2        0 0 0 0
    60602
    61   -1.00456 0.23922 0.593333     5       1 0 0
     61  1.67084 -0.47478 -8.88178e-16 5       1 0 0
    62629
    6363  terminating special property
  • tests/regression/Tesselation/2/post/NonConvexEnvelope.dat

    r8927ae r1ca488  
    11TITLE = "3D CONVEX SHELL"
    22VARIABLES = "X" "Y" "Z" "U"
    3 ZONE T="0- H08_ H09_ H11", N=8, E=12, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
     3ZONE T="test", N=8, E=12, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
    449.78209 2.64589 2.64589 0
    559.78209 2.64589 4.42589 0
     
    13131 3 4
    14141 4 7
     154 6 7
    15163 4 5
    16 1 7 8
    17 1 2 8
    18 4 6 7
     174 5 6
    19182 3 5
    20 4 5 6
    21 6 7 8
    22 1 2 3
    23192 5 8
    24205 6 8
     216 7 8
     221 2 7
     232 7 8
     241 2 3
  • tests/regression/Tesselation/2/post/NonConvexEnvelope.r3d

    r8927ae r1ca488  
    3434  1.37419 -0.89433 -0.89        0.12489 1.24767 -0.89   -1.12431 -0.89433 -0.89         1. 0. 0.
    35351
    36   2.26414 0.364321 -4.44089e-16         0.12489 1.24767 -0.89   0.12489 1.24767 0.89    1. 0. 0.
    37 1
    38   1.37419 -0.89433 -0.89        -1.12431 -0.89433 -0.89         -1.12431 -0.89433 0.89  1. 0. 0.
    39 1
    40   1.37419 -0.89433 -0.89        1.37419 -0.89433 0.89   -1.12431 -0.89433 0.89  1. 0. 0.
    41 1
    4236  0.12489 1.24767 -0.89         -2.01426 0.364321 -4.44089e-16  -1.12431 -0.89433 -0.89         1. 0. 0.
    43371
    44   1.37419 -0.89433 0.89         2.26414 0.364321 -4.44089e-16   0.12489 1.24767 0.89    1. 0. 0.
     38  2.26414 0.364321 -4.44089e-16         0.12489 1.24767 -0.89   0.12489 1.24767 0.89    1. 0. 0.
    45391
    4640  0.12489 1.24767 -0.89         0.12489 1.24767 0.89    -2.01426 0.364321 -4.44089e-16  1. 0. 0.
    47411
    48   -2.01426 0.364321 -4.44089e-16        -1.12431 -0.89433 -0.89         -1.12431 -0.89433 0.89  1. 0. 0.
    49 1
    50   1.37419 -0.89433 -0.89        1.37419 -0.89433 0.89   2.26414 0.364321 -4.44089e-16   1. 0. 0.
     42  1.37419 -0.89433 0.89         2.26414 0.364321 -4.44089e-16   0.12489 1.24767 0.89    1. 0. 0.
    51431
    5244  1.37419 -0.89433 0.89         0.12489 1.24767 0.89    -1.12431 -0.89433 0.89  1. 0. 0.
    53451
    5446  0.12489 1.24767 0.89  -2.01426 0.364321 -4.44089e-16  -1.12431 -0.89433 0.89  1. 0. 0.
     471
     48  -2.01426 0.364321 -4.44089e-16        -1.12431 -0.89433 -0.89         -1.12431 -0.89433 0.89  1. 0. 0.
     491
     50  1.37419 -0.89433 -0.89        1.37419 -0.89433 0.89   -1.12431 -0.89433 -0.89         1. 0. 0.
     511
     52  1.37419 -0.89433 0.89         -1.12431 -0.89433 -0.89         -1.12431 -0.89433 0.89  1. 0. 0.
     531
     54  1.37419 -0.89433 -0.89        1.37419 -0.89433 0.89   2.26414 0.364321 -4.44089e-16   1. 0. 0.
    55559
    5656#  terminating special property
     
    5959  25.0    0.6     -1.0 -1.0 -1.0     0.2        0 0 0 0
    60602
    61   -1.00456 0.23922 0.593333     5       1 0 0
     61  1.67084 -0.47478 -8.88178e-16 5       1 0 0
    62629
    6363  terminating special property
  • tests/regression/Tesselation/3/post/NonConvexEnvelope.dat

    r8927ae r1ca488  
    11TITLE = "3D CONVEX SHELL"
    22VARIABLES = "X" "Y" "Z" "U"
    3 ZONE T="0- H49_ H50_ H51", N=44, E=86, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
     3ZONE T="test", N=44, E=86, DATAPACKING=POINT, ZONETYPE=FETRIANGLE
    446.9077 1.1106 0.1214 1
    550.3612 -3.628 1.323 1
     
    28282.8131 1.4776 2.5103 0
    29293.9137 2.2936 1.3739 0
    30 2.159 2.5738 1.2698 2
     302.159 2.5738 1.2698 5
    31313.6606 -0.4593 2.1396 2
    32323.2007 -1.4419 0.7311 4
    33 -3.3002 2.3589 0.0094 5
     33-3.3002 2.3589 0.0094 8
    3434-4.377 1.6962 -1.2433 3
    35355.2593 1.4547 -1.7445 0
     
    40405.2727 1.6068 1.2828 2
    4141-6.2394 4.6427 0.0632 0
    42 -4.4738 4.5591 -0.1458 1
     42-4.4738 4.5591 -0.1458 3
    4343-5.5506 3.8964 -1.3985 0
    4444-6.7081 0.9923 0.6224 2
     
    49491 32 44
    50501 32 35
    51 32 33 44
    52511 34 35
    535223 32 35
    54 23 32 33
     5317 23 35
     548 17 35
     558 10 17
     563 8 10
     573 8 35
     583 4 35
     594 29 35
     6029 34 35
     612 3 4
     622 4 29
     632 15 29
     6415 28 29
     6528 29 34
     662 7 15
     677 14 15
     6814 15 28
     6914 25 28
     7025 28 37
     7128 34 37
     721 34 37
     731 37 44
     7425 26 37
     7525 26 27
     7626 27 33
    557726 33 44
    56 1 34 37
    57 29 34 35
    58 17 23 35
    59 18 23 33
    60 26 27 33
    617826 37 44
    62 1 37 44
    63 28 34 37
    64 28 29 34
    65 4 29 35
    66 17 18 23
    67 8 17 35
    68 18 27 33
    69 25 26 27
    70 25 26 37
    71 25 28 37
    72 15 28 29
    73 2 4 29
    74 3 4 35
    75 9 17 18
    76 8 10 17
    77 3 8 35
    78 16 18 27
    797914 25 27
    80 14 25 28
    81 14 15 28
    82 2 15 29
    83 2 3 4
    84 9 10 17
    85 9 18 31
    86 3 8 10
    87 16 18 30
    88 16 27 30
    898014 27 30
    90 7 14 15
    91 2 7 15
    92 2 3 5
    93 9 10 12
    94 9 19 31
    95 18 30 31
    96 3 10 12
    97816 14 30
     826 24 30
     8324 30 36
     8430 36 39
     8527 30 39
     866 7 24
    98876 7 14
    99 2 5 7
    100 3 5 12
    101 9 12 13
    102 9 13 19
    103 13 19 31
    104 30 31 39
    105 6 24 30
    106 6 7 24
    107 5 7 11
    108 5 12 22
    109 12 13 21
    110 13 21 31
    111 27 30 39
    112 31 39 40
    113 24 30 36
    114887 11 24
    115 5 11 22
    116 12 21 22
    117 21 31 43
    118 31 40 43
    119 40 42 43
    120 41 42 43
    121 21 41 43
    122 20 21 41
     8911 20 24
    1239020 24 41
    1249124 36 41
    1259236 41 42
     9311 20 22
     945 11 22
     955 7 11
     962 5 7
     9727 30 39
     9816 27 30
     9916 18 30
     10016 18 27
     10118 27 33
     10218 23 33
     10336 38 39
    12610436 38 42
     10518 30 31
     10630 31 39
     10731 39 40
     1089 18 31
     1099 17 18
     11017 18 23
     1119 19 31
     1129 13 19
     11313 19 31
     11413 21 31
     11521 31 43
     11631 40 43
     1179 12 13
     1189 10 12
     1199 10 17
     12012 13 21
     12112 21 22
     1225 12 22
     1233 5 12
     1242 3 5
     1253 10 12
     12620 21 22
     12720 21 41
     12821 41 43
     12941 42 43
     13023 32 33
     13132 33 44
     13240 42 43
    12713338 40 42
    12813438 39 40
    129 36 38 39
    130 30 36 39
    131 27 30 39
    132 11 20 24
    133 11 20 22
    134 20 21 22
  • tests/regression/Tesselation/3/post/NonConvexEnvelope.r3d

    r8927ae r1ca488  
    160160  7.33693 1.04442 0.0886712     5.68853 1.38852 -1.77723        5.55043 -0.952879 -0.490929     1. 0. 0.
    1611611
     162  7.33693 1.04442 0.0886712     6.17523 -0.969279 1.17127       5.55043 -0.952879 -0.490929     1. 0. 0.
     1631
     164  3.62023 1.25552 -2.86813      5.68853 1.38852 -1.77723        5.55043 -0.952879 -0.490929     1. 0. 0.
     1651
     166  1.76663 -0.360379 -2.99373    3.62023 1.25552 -2.86813        5.55043 -0.952879 -0.490929     1. 0. 0.
     1671
     168  2.19193 -1.51408 -0.867629    1.76663 -0.360379 -2.99373      5.55043 -0.952879 -0.490929     1. 0. 0.
     1691
     170  2.19193 -1.51408 -0.867629    0.450934 -2.72908 -2.23353      1.76663 -0.360379 -2.99373      1. 0. 0.
     1711
     172  0.917634 -3.66448 -0.484829   2.19193 -1.51408 -0.867629      0.450934 -2.72908 -2.23353      1. 0. 0.
     1731
     174  0.917634 -3.66448 -0.484829   2.19193 -1.51408 -0.867629      5.55043 -0.952879 -0.490929     1. 0. 0.
     1751
     176  0.917634 -3.66448 -0.484829   1.92773 -2.57738 0.498071       5.55043 -0.952879 -0.490929     1. 0. 0.
     1771
     178  1.92773 -2.57738 0.498071     3.62993 -1.50808 0.698371       5.55043 -0.952879 -0.490929     1. 0. 0.
     1791
     180  3.62993 -1.50808 0.698371     6.17523 -0.969279 1.17127       5.55043 -0.952879 -0.490929     1. 0. 0.
     1811
     182  0.790434 -3.69418 1.29027     0.917634 -3.66448 -0.484829     1.92773 -2.57738 0.498071       1. 0. 0.
     1831
     184  0.790434 -3.69418 1.29027     1.92773 -2.57738 0.498071       3.62993 -1.50808 0.698371       1. 0. 0.
     1851
     186  0.790434 -3.69418 1.29027     2.06173 -1.39848 1.79787        3.62993 -1.50808 0.698371       1. 0. 0.
     1871
     188  2.06173 -1.39848 1.79787      4.08983 -0.525479 2.10687       3.62993 -1.50808 0.698371       1. 0. 0.
     1891
     190  4.08983 -0.525479 2.10687     3.62993 -1.50808 0.698371       6.17523 -0.969279 1.17127       1. 0. 0.
     1911
     192  0.790434 -3.69418 1.29027     -0.287266 -1.67078 2.48017      2.06173 -1.39848 1.79787        1. 0. 0.
     1931
     194  -0.287266 -1.67078 2.48017    1.46453 0.112321 2.50927        2.06173 -1.39848 1.79787        1. 0. 0.
     1951
     196  1.46453 0.112321 2.50927      2.06173 -1.39848 1.79787        4.08983 -0.525479 2.10687       1. 0. 0.
     1971
     198  1.46453 0.112321 2.50927      3.24233 1.41142 2.47757         4.08983 -0.525479 2.10687       1. 0. 0.
     1991
     200  3.24233 1.41142 2.47757       4.08983 -0.525479 2.10687       5.70193 1.54062 1.25007         1. 0. 0.
     2011
     202  4.08983 -0.525479 2.10687     6.17523 -0.969279 1.17127       5.70193 1.54062 1.25007         1. 0. 0.
     2031
     204  7.33693 1.04442 0.0886712     6.17523 -0.969279 1.17127       5.70193 1.54062 1.25007         1. 0. 0.
     2051
     206  7.33693 1.04442 0.0886712     5.70193 1.54062 1.25007         7.56833 1.97852 -0.00632877     1. 0. 0.
     2071
     208  3.24233 1.41142 2.47757       4.34293 2.22742 1.34117         5.70193 1.54062 1.25007         1. 0. 0.
     2091
     210  3.24233 1.41142 2.47757       4.34293 2.22742 1.34117         2.58823 2.50762 1.23707         1. 0. 0.
     2111
     212  4.34293 2.22742 1.34117       2.58823 2.50762 1.23707         5.11553 2.70122 -0.710229       1. 0. 0.
     2131
     214  4.34293 2.22742 1.34117       5.11553 2.70122 -0.710229       7.56833 1.97852 -0.00632877     1. 0. 0.
     2151
     216  4.34293 2.22742 1.34117       5.70193 1.54062 1.25007         7.56833 1.97852 -0.00632877     1. 0. 0.
     2171
     218  1.46453 0.112321 2.50927      3.24233 1.41142 2.47757         2.58823 2.50762 1.23707         1. 0. 0.
     2191
     220  1.46453 0.112321 2.50927      2.58823 2.50762 1.23707         -2.87097 2.29272 -0.0233288     1. 0. 0.
     2211
     222  -0.759066 -0.265179 1.48487   1.46453 0.112321 2.50927        -2.87097 2.29272 -0.0233288     1. 0. 0.
     2231
     224  -0.759066 -0.265179 1.48487   -3.66127 0.565021 1.57007       -2.87097 2.29272 -0.0233288     1. 0. 0.
     2251
     226  -3.66127 0.565021 1.57007     -2.87097 2.29272 -0.0233288     -4.83487 2.76522 1.41487        1. 0. 0.
     2271
     228  -2.87097 2.29272 -0.0233288   -4.83487 2.76522 1.41487        -4.04457 4.49292 -0.178529      1. 0. 0.
     2291
     230  2.58823 2.50762 1.23707       -2.87097 2.29272 -0.0233288     -4.04457 4.49292 -0.178529      1. 0. 0.
     2311
     232  -0.759066 -0.265179 1.48487   -0.287266 -1.67078 2.48017      -3.66127 0.565021 1.57007       1. 0. 0.
     2331
     234  -0.759066 -0.265179 1.48487   -0.287266 -1.67078 2.48017      1.46453 0.112321 2.50927        1. 0. 0.
     2351
     236  -0.287266 -1.67078 2.48017    -2.45927 -1.63678 1.72157       -3.66127 0.565021 1.57007       1. 0. 0.
     2371
     238  -2.45927 -1.63678 1.72157     -4.75167 -1.93408 0.935971      -3.66127 0.565021 1.57007       1. 0. 0.
     2391
     240  -4.75167 -1.93408 0.935971    -3.66127 0.565021 1.57007       -6.27887 0.926121 0.589671      1. 0. 0.
     2411
     242  -3.66127 0.565021 1.57007     -4.83487 2.76522 1.41487        -6.27887 0.926121 0.589671      1. 0. 0.
     2431
     244  -4.83487 2.76522 1.41487      -6.27887 0.926121 0.589671      -7.11497 2.49352 0.479071       1. 0. 0.
     2451
     246  -2.45927 -1.63678 1.72157     -4.75167 -1.93408 0.935971      -3.90927 -3.49908 0.839771      1. 0. 0.
     2471
     248  -1.52417 -3.64138 0.503471    -2.45927 -1.63678 1.72157       -3.90927 -3.49908 0.839771      1. 0. 0.
     2491
     250  -1.52417 -3.64138 0.503471    -0.287266 -1.67078 2.48017      -2.45927 -1.63678 1.72157       1. 0. 0.
     2511
     252  0.790434 -3.69418 1.29027     -1.52417 -3.64138 0.503471      -0.287266 -1.67078 2.48017      1. 0. 0.
     2531
     254  2.58823 2.50762 1.23707       -2.87097 2.29272 -0.0233288     -4.04457 4.49292 -0.178529      1. 0. 0.
     2551
     256  1.15633 1.11082 0.326671      2.58823 2.50762 1.23707         -2.87097 2.29272 -0.0233288     1. 0. 0.
     2571
     258  1.15633 1.11082 0.326671      1.03283 1.01972 -2.14533        -2.87097 2.29272 -0.0233288     1. 0. 0.
     2591
     260  1.15633 1.11082 0.326671      1.03283 1.01972 -2.14533        2.58823 2.50762 1.23707         1. 0. 0.
     2611
     262  1.03283 1.01972 -2.14533      2.58823 2.50762 1.23707         5.11553 2.70122 -0.710229       1. 0. 0.
     2631
     264  1.03283 1.01972 -2.14533      3.62023 1.25552 -2.86813        5.11553 2.70122 -0.710229       1. 0. 0.
     2651
     266  -4.83487 2.76522 1.41487      -5.81017 4.57652 0.0304712      -4.04457 4.49292 -0.178529      1. 0. 0.
     2671
     268  -4.83487 2.76522 1.41487      -5.81017 4.57652 0.0304712      -7.11497 2.49352 0.479071       1. 0. 0.
     2691
     270  1.03283 1.01972 -2.14533      -2.87097 2.29272 -0.0233288     -3.94777 1.63002 -1.27603       1. 0. 0.
     2711
     272  -2.87097 2.29272 -0.0233288   -3.94777 1.63002 -1.27603       -4.04457 4.49292 -0.178529      1. 0. 0.
     2731
     274  -3.94777 1.63002 -1.27603     -4.04457 4.49292 -0.178529      -5.12137 3.83022 -1.43123       1. 0. 0.
     2751
     276  -0.573766 -1.42458 -2.91753   1.03283 1.01972 -2.14533        -3.94777 1.63002 -1.27603       1. 0. 0.
     2771
     278  -0.573766 -1.42458 -2.91753   1.76663 -0.360379 -2.99373      1.03283 1.01972 -2.14533        1. 0. 0.
     2791
     280  1.76663 -0.360379 -2.99373    1.03283 1.01972 -2.14533        3.62023 1.25552 -2.86813        1. 0. 0.
     2811
     282  -0.573766 -1.42458 -2.91753   -2.77417 -0.570279 -1.12083     -3.94777 1.63002 -1.27603       1. 0. 0.
     2831
     284  -0.573766 -1.42458 -2.91753   -2.49667 -2.18078 -1.79993      -2.77417 -0.570279 -1.12083     1. 0. 0.
     2851
     286  -2.49667 -2.18078 -1.79993    -2.77417 -0.570279 -1.12083     -3.94777 1.63002 -1.27603       1. 0. 0.
     2871
     288  -2.49667 -2.18078 -1.79993    -4.17327 -2.53828 -0.635229     -3.94777 1.63002 -1.27603       1. 0. 0.
     2891
     290  -4.17327 -2.53828 -0.635229   -3.94777 1.63002 -1.27603       -6.42617 1.74722 -0.982629      1. 0. 0.
     2911
     292  -3.94777 1.63002 -1.27603     -5.12137 3.83022 -1.43123       -6.42617 1.74722 -0.982629      1. 0. 0.
     2931
     294  -0.573766 -1.42458 -2.91753   -1.62867 -3.74268 -1.79493      -2.49667 -2.18078 -1.79993      1. 0. 0.
     2951
     296  -0.573766 -1.42458 -2.91753   0.450934 -2.72908 -2.23353      -1.62867 -3.74268 -1.79493      1. 0. 0.
     2971
     298  -0.573766 -1.42458 -2.91753   0.450934 -2.72908 -2.23353      1.76663 -0.360379 -2.99373      1. 0. 0.
     2991
     300  -1.62867 -3.74268 -1.79493    -2.49667 -2.18078 -1.79993      -4.17327 -2.53828 -0.635229     1. 0. 0.
     3011
     302  -1.62867 -3.74268 -1.79493    -4.17327 -2.53828 -0.635229     -3.90927 -3.49908 0.839771      1. 0. 0.
     3031
     304  -1.52417 -3.64138 0.503471    -1.62867 -3.74268 -1.79493      -3.90927 -3.49908 0.839771      1. 0. 0.
     3051
     306  0.917634 -3.66448 -0.484829   -1.52417 -3.64138 0.503471      -1.62867 -3.74268 -1.79493      1. 0. 0.
     3071
     308  0.790434 -3.69418 1.29027     0.917634 -3.66448 -0.484829     -1.52417 -3.64138 0.503471      1. 0. 0.
     3091
     310  0.917634 -3.66448 -0.484829   0.450934 -2.72908 -2.23353      -1.62867 -3.74268 -1.79493      1. 0. 0.
     3111
     312  -4.75167 -1.93408 0.935971    -4.17327 -2.53828 -0.635229     -3.90927 -3.49908 0.839771      1. 0. 0.
     3131
     314  -4.75167 -1.93408 0.935971    -4.17327 -2.53828 -0.635229     -6.27887 0.926121 0.589671      1. 0. 0.
     3151
     316  -4.17327 -2.53828 -0.635229   -6.27887 0.926121 0.589671      -6.42617 1.74722 -0.982629      1. 0. 0.
     3171
     318  -6.27887 0.926121 0.589671    -7.11497 2.49352 0.479071       -6.42617 1.74722 -0.982629      1. 0. 0.
     3191
     320  3.62023 1.25552 -2.86813      5.68853 1.38852 -1.77723        5.11553 2.70122 -0.710229       1. 0. 0.
     3211
    162322  5.68853 1.38852 -1.77723      5.11553 2.70122 -0.710229       7.56833 1.97852 -0.00632877     1. 0. 0.
    1633231
    164   7.33693 1.04442 0.0886712     6.17523 -0.969279 1.17127       5.55043 -0.952879 -0.490929     1. 0. 0.
    165 1
    166   3.62023 1.25552 -2.86813      5.68853 1.38852 -1.77723        5.55043 -0.952879 -0.490929     1. 0. 0.
    167 1
    168   3.62023 1.25552 -2.86813      5.68853 1.38852 -1.77723        5.11553 2.70122 -0.710229       1. 0. 0.
    169 1
    170   4.34293 2.22742 1.34117       5.11553 2.70122 -0.710229       7.56833 1.97852 -0.00632877     1. 0. 0.
    171 1
    172   7.33693 1.04442 0.0886712     6.17523 -0.969279 1.17127       5.70193 1.54062 1.25007         1. 0. 0.
    173 1
    174   3.62993 -1.50808 0.698371     6.17523 -0.969279 1.17127       5.55043 -0.952879 -0.490929     1. 0. 0.
    175 1
    176   1.76663 -0.360379 -2.99373    3.62023 1.25552 -2.86813        5.55043 -0.952879 -0.490929     1. 0. 0.
    177 1
    178   1.03283 1.01972 -2.14533      3.62023 1.25552 -2.86813        5.11553 2.70122 -0.710229       1. 0. 0.
    179 1
    180   4.34293 2.22742 1.34117       2.58823 2.50762 1.23707         5.11553 2.70122 -0.710229       1. 0. 0.
    181 1
    182   4.34293 2.22742 1.34117       5.70193 1.54062 1.25007         7.56833 1.97852 -0.00632877     1. 0. 0.
    183 1
    184   7.33693 1.04442 0.0886712     5.70193 1.54062 1.25007         7.56833 1.97852 -0.00632877     1. 0. 0.
    185 1
    186   4.08983 -0.525479 2.10687     6.17523 -0.969279 1.17127       5.70193 1.54062 1.25007         1. 0. 0.
    187 1
    188   4.08983 -0.525479 2.10687     3.62993 -1.50808 0.698371       6.17523 -0.969279 1.17127       1. 0. 0.
    189 1
    190   1.92773 -2.57738 0.498071     3.62993 -1.50808 0.698371       5.55043 -0.952879 -0.490929     1. 0. 0.
    191 1
    192   1.76663 -0.360379 -2.99373    1.03283 1.01972 -2.14533        3.62023 1.25552 -2.86813        1. 0. 0.
    193 1
    194   2.19193 -1.51408 -0.867629    1.76663 -0.360379 -2.99373      5.55043 -0.952879 -0.490929     1. 0. 0.
    195 1
    196   1.03283 1.01972 -2.14533      2.58823 2.50762 1.23707         5.11553 2.70122 -0.710229       1. 0. 0.
    197 1
    198   3.24233 1.41142 2.47757       4.34293 2.22742 1.34117         2.58823 2.50762 1.23707         1. 0. 0.
    199 1
    200   3.24233 1.41142 2.47757       4.34293 2.22742 1.34117         5.70193 1.54062 1.25007         1. 0. 0.
    201 1
    202   3.24233 1.41142 2.47757       4.08983 -0.525479 2.10687       5.70193 1.54062 1.25007         1. 0. 0.
    203 1
    204   2.06173 -1.39848 1.79787      4.08983 -0.525479 2.10687       3.62993 -1.50808 0.698371       1. 0. 0.
    205 1
    206   0.790434 -3.69418 1.29027     1.92773 -2.57738 0.498071       3.62993 -1.50808 0.698371       1. 0. 0.
    207 1
    208   0.917634 -3.66448 -0.484829   1.92773 -2.57738 0.498071       5.55043 -0.952879 -0.490929     1. 0. 0.
    209 1
    210   -0.573766 -1.42458 -2.91753   1.76663 -0.360379 -2.99373      1.03283 1.01972 -2.14533        1. 0. 0.
    211 1
    212   2.19193 -1.51408 -0.867629    0.450934 -2.72908 -2.23353      1.76663 -0.360379 -2.99373      1. 0. 0.
    213 1
    214   0.917634 -3.66448 -0.484829   2.19193 -1.51408 -0.867629      5.55043 -0.952879 -0.490929     1. 0. 0.
    215 1
    216   1.15633 1.11082 0.326671      1.03283 1.01972 -2.14533        2.58823 2.50762 1.23707         1. 0. 0.
    217 1
    218   1.46453 0.112321 2.50927      3.24233 1.41142 2.47757         2.58823 2.50762 1.23707         1. 0. 0.
    219 1
    220   1.46453 0.112321 2.50927      3.24233 1.41142 2.47757         4.08983 -0.525479 2.10687       1. 0. 0.
    221 1
    222   1.46453 0.112321 2.50927      2.06173 -1.39848 1.79787        4.08983 -0.525479 2.10687       1. 0. 0.
    223 1
    224   0.790434 -3.69418 1.29027     2.06173 -1.39848 1.79787        3.62993 -1.50808 0.698371       1. 0. 0.
    225 1
    226   0.790434 -3.69418 1.29027     0.917634 -3.66448 -0.484829     1.92773 -2.57738 0.498071       1. 0. 0.
    227 1
    228   -0.573766 -1.42458 -2.91753   0.450934 -2.72908 -2.23353      1.76663 -0.360379 -2.99373      1. 0. 0.
    229 1
    230   -0.573766 -1.42458 -2.91753   1.03283 1.01972 -2.14533        -3.94777 1.63002 -1.27603       1. 0. 0.
    231 1
    232   0.917634 -3.66448 -0.484829   2.19193 -1.51408 -0.867629      0.450934 -2.72908 -2.23353      1. 0. 0.
    233 1
    234   1.15633 1.11082 0.326671      1.03283 1.01972 -2.14533        -2.87097 2.29272 -0.0233288     1. 0. 0.
    235 1
    236   1.15633 1.11082 0.326671      2.58823 2.50762 1.23707         -2.87097 2.29272 -0.0233288     1. 0. 0.
    237 1
    238   1.46453 0.112321 2.50927      2.58823 2.50762 1.23707         -2.87097 2.29272 -0.0233288     1. 0. 0.
    239 1
    240   -0.287266 -1.67078 2.48017    1.46453 0.112321 2.50927        2.06173 -1.39848 1.79787        1. 0. 0.
    241 1
    242   0.790434 -3.69418 1.29027     -0.287266 -1.67078 2.48017      2.06173 -1.39848 1.79787        1. 0. 0.
    243 1
    244   0.790434 -3.69418 1.29027     0.917634 -3.66448 -0.484829     -1.52417 -3.64138 0.503471      1. 0. 0.
    245 1
    246   -0.573766 -1.42458 -2.91753   0.450934 -2.72908 -2.23353      -1.62867 -3.74268 -1.79493      1. 0. 0.
    247 1
    248   -0.573766 -1.42458 -2.91753   -2.77417 -0.570279 -1.12083     -3.94777 1.63002 -1.27603       1. 0. 0.
    249 1
    250   1.03283 1.01972 -2.14533      -2.87097 2.29272 -0.0233288     -3.94777 1.63002 -1.27603       1. 0. 0.
    251 1
    252   0.917634 -3.66448 -0.484829   0.450934 -2.72908 -2.23353      -1.62867 -3.74268 -1.79493      1. 0. 0.
    253 1
    254   -0.759066 -0.265179 1.48487   1.46453 0.112321 2.50927        -2.87097 2.29272 -0.0233288     1. 0. 0.
    255 1
    256   -0.759066 -0.265179 1.48487   -0.287266 -1.67078 2.48017      1.46453 0.112321 2.50927        1. 0. 0.
    257 1
    258   0.790434 -3.69418 1.29027     -1.52417 -3.64138 0.503471      -0.287266 -1.67078 2.48017      1. 0. 0.
    259 1
    260   0.917634 -3.66448 -0.484829   -1.52417 -3.64138 0.503471      -1.62867 -3.74268 -1.79493      1. 0. 0.
    261 1
    262   -0.573766 -1.42458 -2.91753   -1.62867 -3.74268 -1.79493      -2.49667 -2.18078 -1.79993      1. 0. 0.
    263 1
    264   -0.573766 -1.42458 -2.91753   -2.49667 -2.18078 -1.79993      -2.77417 -0.570279 -1.12083     1. 0. 0.
    265 1
    266   -2.49667 -2.18078 -1.79993    -2.77417 -0.570279 -1.12083     -3.94777 1.63002 -1.27603       1. 0. 0.
    267 1
    268   -2.87097 2.29272 -0.0233288   -3.94777 1.63002 -1.27603       -4.04457 4.49292 -0.178529      1. 0. 0.
    269 1
    270   -0.759066 -0.265179 1.48487   -3.66127 0.565021 1.57007       -2.87097 2.29272 -0.0233288     1. 0. 0.
    271 1
    272   -0.759066 -0.265179 1.48487   -0.287266 -1.67078 2.48017      -3.66127 0.565021 1.57007       1. 0. 0.
    273 1
    274   -1.52417 -3.64138 0.503471    -0.287266 -1.67078 2.48017      -2.45927 -1.63678 1.72157       1. 0. 0.
    275 1
    276   -1.52417 -3.64138 0.503471    -1.62867 -3.74268 -1.79493      -3.90927 -3.49908 0.839771      1. 0. 0.
    277 1
    278   -1.62867 -3.74268 -1.79493    -2.49667 -2.18078 -1.79993      -4.17327 -2.53828 -0.635229     1. 0. 0.
    279 1
    280   -2.49667 -2.18078 -1.79993    -4.17327 -2.53828 -0.635229     -3.94777 1.63002 -1.27603       1. 0. 0.
    281 1
    282   2.58823 2.50762 1.23707       -2.87097 2.29272 -0.0233288     -4.04457 4.49292 -0.178529      1. 0. 0.
    283 1
    284   -3.94777 1.63002 -1.27603     -4.04457 4.49292 -0.178529      -5.12137 3.83022 -1.43123       1. 0. 0.
    285 1
    286   -3.66127 0.565021 1.57007     -2.87097 2.29272 -0.0233288     -4.83487 2.76522 1.41487        1. 0. 0.
    287 1
    288   -0.287266 -1.67078 2.48017    -2.45927 -1.63678 1.72157       -3.66127 0.565021 1.57007       1. 0. 0.
    289 1
    290   -1.52417 -3.64138 0.503471    -2.45927 -1.63678 1.72157       -3.90927 -3.49908 0.839771      1. 0. 0.
    291 1
    292   -1.62867 -3.74268 -1.79493    -4.17327 -2.53828 -0.635229     -3.90927 -3.49908 0.839771      1. 0. 0.
    293 1
    294   -4.17327 -2.53828 -0.635229   -3.94777 1.63002 -1.27603       -6.42617 1.74722 -0.982629      1. 0. 0.
    295 1
    296   -3.94777 1.63002 -1.27603     -5.12137 3.83022 -1.43123       -6.42617 1.74722 -0.982629      1. 0. 0.
    297 1
    298324  -5.12137 3.83022 -1.43123     -7.11497 2.49352 0.479071       -6.42617 1.74722 -0.982629      1. 0. 0.
    2993251
    300   -6.27887 0.926121 0.589671    -7.11497 2.49352 0.479071       -6.42617 1.74722 -0.982629      1. 0. 0.
    301 1
    302   -4.17327 -2.53828 -0.635229   -6.27887 0.926121 0.589671      -6.42617 1.74722 -0.982629      1. 0. 0.
    303 1
    304   -4.75167 -1.93408 0.935971    -4.17327 -2.53828 -0.635229     -6.27887 0.926121 0.589671      1. 0. 0.
    305 1
    306   -4.75167 -1.93408 0.935971    -3.66127 0.565021 1.57007       -6.27887 0.926121 0.589671      1. 0. 0.
    307 1
    308   -3.66127 0.565021 1.57007     -4.83487 2.76522 1.41487        -6.27887 0.926121 0.589671      1. 0. 0.
    309 1
    310   -4.83487 2.76522 1.41487      -6.27887 0.926121 0.589671      -7.11497 2.49352 0.479071       1. 0. 0.
    311 1
    312   -4.83487 2.76522 1.41487      -5.81017 4.57652 0.0304712      -7.11497 2.49352 0.479071       1. 0. 0.
    313 1
    314326  -5.81017 4.57652 0.0304712    -5.12137 3.83022 -1.43123       -7.11497 2.49352 0.479071       1. 0. 0.
    3153271
    316328  -5.81017 4.57652 0.0304712    -4.04457 4.49292 -0.178529      -5.12137 3.83022 -1.43123       1. 0. 0.
    317 1
    318   -4.83487 2.76522 1.41487      -5.81017 4.57652 0.0304712      -4.04457 4.49292 -0.178529      1. 0. 0.
    319 1
    320   -2.87097 2.29272 -0.0233288   -4.83487 2.76522 1.41487        -4.04457 4.49292 -0.178529      1. 0. 0.
    321 1
    322   2.58823 2.50762 1.23707       -2.87097 2.29272 -0.0233288     -4.04457 4.49292 -0.178529      1. 0. 0.
    323 1
    324   -2.45927 -1.63678 1.72157     -4.75167 -1.93408 0.935971      -3.66127 0.565021 1.57007       1. 0. 0.
    325 1
    326   -2.45927 -1.63678 1.72157     -4.75167 -1.93408 0.935971      -3.90927 -3.49908 0.839771      1. 0. 0.
    327 1
    328   -4.75167 -1.93408 0.935971    -4.17327 -2.53828 -0.635229     -3.90927 -3.49908 0.839771      1. 0. 0.
    3293299
    330330#  terminating special property
     
    333333  25.0    0.6     -1.0 -1.0 -1.0     0.2        0 0 0 0
    3343342
    335   -4.27807 -2.65715 0.380171    5       1 0 0
     335  -4.99203 4.29989 -0.526429    5       1 0 0
    3363369
    337337  terminating special property
  • tests/testsuite.at

    r8927ae r1ca488  
    1212AT_CHECK([pwd],[ignore],[ignore])
    1313AT_CHECK([../../molecuilder -v], 0, [stdout], [ignore])
    14 AT_CHECK([fgrep molecuilder stdout], 0, [ignore], [ignore])
     14AT_CHECK([fgrep olecuilder stdout], 0, [ignore], [ignore])
    1515AT_CHECK([../../molecuilder -h], 0, [stdout], [ignore])
    1616AT_CHECK([fgrep "Give this help screen" stdout], 0, [ignore], [ignore])
    17 AT_CHECK([../../molecuilder -e], 0, [ignore], [stderr])
     17AT_CHECK([../../molecuilder -e], 255, [ignore], [stderr])
    1818AT_CHECK([fgrep "Not enough or invalid arguments" stderr], 0, [ignore], [ignore])
    1919AT_CHECK([../../molecuilder test.conf], 0, [stdout], [stderr])
     
    7878AT_SETUP([Simple configuration - invalid commands on present configs])
    7979AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/regression/Simple_configuration/7/pre/test.conf .], 0)
    80 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -t -s -b -E -c -b -a -U -T -u], 255, [ignore], [stderr])
    81 AT_CHECK([fgrep -c "Not enough or invalid" stderr], 0, [9
    82 ], [ignore])
     80AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -t], 255, [ignore], [stderr])
     81AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore])
     82AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -s -b -E -c -b -a -U -T -u], 255, [ignore], [stderr])
     83AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore])
     84AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -b -E -c -b -a -U -T -u], 255, [ignore], [stderr])
     85AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore])
     86AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -E -c -b -a -U -T -u], 255, [ignore], [stderr])
     87AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore])
     88AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -c -b -a -U -T -u], 255, [ignore], [stderr])
     89AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore])
     90AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -b -a -U -T -u], 255, [ignore], [stderr])
     91AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore])
     92AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -a -U -T -u], 255, [ignore], [stderr])
     93AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore])
     94AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -U -T -u], 255, [ignore], [stderr])
     95AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore])
     96AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -T -u], 255, [ignore], [stderr])
     97AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore])
     98AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -u], 255, [ignore], [stderr])
     99AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore])
    83100AT_CLEANUP
    84101
     
    88105AT_SETUP([Graph - DFS analysis])
    89106AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/regression/Graph/1/pre/test.conf .], 0)
    90 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -D 2.], 0, [stdout], [stderr])
     107AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -vvv -D 2.], 0, [stdout], [stderr])
    91108AT_CHECK([fgrep -c "No rings were detected in the molecular structure." stdout], 0, [1
    92109], [ignore])
     
    134151AT_CHECK([file=ConvexEnvelope.dat; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/regression/Tesselation/2/post/$file], 0, [ignore], [ignore])
    135152AT_CHECK([file=ConvexEnvelope.r3d; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/regression/Tesselation/2/post/$file], 0, [ignore], [ignore])
    136 AT_CHECK([fgrep "RESULT: The summed volume is 16.401577 angstrom^3" stdout], 0, [ignore], [ignore])
     153AT_CHECK([fgrep "tesselated volume area is 16.4016 angstrom^3" stdout], 0, [ignore], [ignore])
    137154AT_CHECK([diff ConvexEnvelope.dat NonConvexEnvelope.dat], 0, [ignore], [ignore])
    138155AT_CLEANUP
     
    152169#AT_CHECK([file=ConvexEnvelope.dat; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/regression/Tesselation/4/post/$file], 0, [ignore], [ignore])
    153170#AT_CHECK([file=ConvexEnvelope.r3d; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/regression/Tesselation/4/post/$file], 0, [ignore], [ignore])
    154 #AT_CHECK([fgrep "RESULT: The summed volume is 16.401577 angstrom^3" stdout], 0, [ignore], [ignore])
     171#AT_CHECK([fgrep "tesselated volume area is 16.4016 angstrom^3" stdout], 0, [ignore], [ignore])
    155172#AT_CLEANUP
    156173
Note: See TracChangeset for help on using the changeset viewer.