Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/boundary.cpp

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