Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/boundary.cpp

    rb998c3 re359a8  
    1010#include "element.hpp"
    1111#include "helpers.hpp"
    12 #include "info.hpp"
    1312#include "linkedcell.hpp"
    1413#include "log.hpp"
     
    3433double *GetDiametersOfCluster(const Boundaries *BoundaryPtr, const molecule *mol, Tesselation *&TesselStruct, const bool IsAngstroem)
    3534{
    36         Info FunctionInfo(__func__);
    3735  // get points on boundary of NULL was given as parameter
    3836  bool BoundaryFreeFlag = false;
     
    5553  } else {
    5654    BoundaryPoints = BoundaryPtr;
    57     Log() << Verbose(0) << "Using given boundary points set." << endl;
     55    Log() << Verbose(1) << "Using given boundary points set." << endl;
    5856  }
    5957  // determine biggest "diameter" of cluster for each axis
     
    6967          //Log() << Verbose(1) << "Current component is " << component << ", Othercomponent is " << Othercomponent << "." << endl;
    7068          for (Boundaries::const_iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) {
    71               //Log() << Verbose(1) << "Current runner is " << *(runner->second.second) << "." << endl;
     69              //Log() << Verbose(2) << "Current runner is " << *(runner->second.second) << "." << endl;
    7270              // seek for the neighbours pair where the Othercomponent sign flips
    7371              Neighbour = runner;
     
    8482                  DistanceVector.CopyVector(&runner->second.second->x);
    8583                  DistanceVector.SubtractVector(&Neighbour->second.second->x);
    86                   //Log() << Verbose(2) << "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "." << endl;
     84                  //Log() << Verbose(3) << "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "." << endl;
    8785                } while ((runner != Neighbour) && (fabs(OldComponent / fabs(
    8886                  OldComponent) - DistanceVector.x[Othercomponent] / fabs(
     
    9391                    OtherNeighbour = BoundaryPoints[axis].end();
    9492                  OtherNeighbour--;
    95                   //Log() << Verbose(1) << "The pair, where the sign of OtherComponent flips, is: " << *(Neighbour->second.second) << " and " << *(OtherNeighbour->second.second) << "." << endl;
     93                  //Log() << Verbose(2) << "The pair, where the sign of OtherComponent flips, is: " << *(Neighbour->second.second) << " and " << *(OtherNeighbour->second.second) << "." << endl;
    9694                  // now we have found the pair: Neighbour and OtherNeighbour
    9795                  OtherVector.CopyVector(&runner->second.second->x);
    9896                  OtherVector.SubtractVector(&OtherNeighbour->second.second->x);
    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;
     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;
    10199                  // do linear interpolation between points (is exact) to extract exact intersection between Neighbour and OtherNeighbour
    102100                  w1 = fabs(OtherVector.x[Othercomponent]);
     
    105103                      * OtherVector.x[component]) / (w1 + w2));
    106104                  // mark if it has greater diameter
    107                   //Log() << Verbose(1) << "Comparing current greatest " << GreatestDiameter[component] << " to new " << tmp << "." << endl;
     105                  //Log() << Verbose(2) << "Comparing current greatest " << GreatestDiameter[component] << " to new " << tmp << "." << endl;
    108106                  GreatestDiameter[component] = (GreatestDiameter[component]
    109107                      > tmp) ? GreatestDiameter[component] : tmp;
    110108                } //else
    111               //Log() << Verbose(1) << "Saw no sign flip, probably top or bottom node." << endl;
     109              //Log() << Verbose(2) << "Saw no sign flip, probably top or bottom node." << endl;
    112110            }
    113111        }
     
    137135Boundaries *GetBoundaryPoints(const molecule *mol, Tesselation *&TesselStruct)
    138136{
    139         Info FunctionInfo(__func__);
    140137  atom *Walker = NULL;
    141138  PointMap PointsOnBoundary;
     
    152149  double angle = 0.;
    153150
     151  Log() << Verbose(1) << "Finding all boundary points." << endl;
    154152  // 3a. Go through every axis
    155153  for (int axis = 0; axis < NDIM; axis++) {
     
    178176        angle = 0.; // otherwise it's a vector in Axis Direction and unimportant for boundary issues
    179177
    180       //Log() << Verbose(1) << "Checking sign in quadrant : " << ProjectedVector.Projection(&AngleReferenceNormalVector) << "." << endl;
     178      //Log() << Verbose(2) << "Checking sign in quadrant : " << ProjectedVector.Projection(&AngleReferenceNormalVector) << "." << endl;
    181179      if (ProjectedVector.ScalarProduct(&AngleReferenceNormalVector) > 0) {
    182180        angle = 2. * M_PI - angle;
    183181      }
    184       Log() << Verbose(1) << "Inserting " << *Walker << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl;
     182      Log() << Verbose(2) << "Inserting " << *Walker << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl;
    185183      BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, DistancePair (radius, Walker)));
    186184      if (!BoundaryTestPair.second) { // same point exists, check first r, then distance of original vectors to center of gravity
     
    212210    // printing all inserted for debugging
    213211    //    {
    214     //      Log() << Verbose(1) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl;
     212    //      Log() << Verbose(2) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl;
    215213    //      int i=0;
    216214    //      for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) {
    217215    //        if (runner != BoundaryPoints[axis].begin())
    218     //          Log() << Verbose(0) << ", " << i << ": " << *runner->second.second;
     216    //          Log() << Verbose(2) << ", " << i << ": " << *runner->second.second;
    219217    //        else
    220     //          Log() << Verbose(0) << i << ": " << *runner->second.second;
     218    //          Log() << Verbose(2) << i << ": " << *runner->second.second;
    221219    //        i++;
    222220    //      }
    223     //      Log() << Verbose(0) << endl;
     221    //      Log() << Verbose(2) << endl;
    224222    //    }
    225223    // 3c. throw out points whose distance is less than the mean of left and right neighbours
     
    251249          SideA.SubtractVector(MolCenter);
    252250          SideA.ProjectOntoPlane(&AxisVector);
    253           //          Log() << Verbose(1) << "SideA: " << SideA << endl;
     251          //          Log() << Verbose(0) << "SideA: " << SideA << endl;
    254252
    255253          SideB.CopyVector(&right->second.second->x);
    256254          SideB.SubtractVector(MolCenter);
    257255          SideB.ProjectOntoPlane(&AxisVector);
    258           //          Log() << Verbose(1) << "SideB: " << SideB << endl;
     256          //          Log() << Verbose(0) << "SideB: " << SideB << endl;
    259257
    260258          SideC.CopyVector(&left->second.second->x);
    261259          SideC.SubtractVector(&right->second.second->x);
    262260          SideC.ProjectOntoPlane(&AxisVector);
    263           //          Log() << Verbose(1) << "SideC: " << SideC << endl;
     261          //          Log() << Verbose(0) << "SideC: " << SideC << endl;
    264262
    265263          SideH.CopyVector(&runner->second.second->x);
    266264          SideH.SubtractVector(MolCenter);
    267265          SideH.ProjectOntoPlane(&AxisVector);
    268           //          Log() << Verbose(1) << "SideH: " << SideH << endl;
     266          //          Log() << Verbose(0) << "SideH: " << SideH << endl;
    269267
    270268          // calculate each length
     
    279277          const double delta = SideC.Angle(&SideH);
    280278          const double MinDistance = a * sin(beta) / (sin(delta)) * (((alpha < M_PI / 2.) || (gamma < M_PI / 2.)) ? 1. : -1.);
    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;
     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;
    282280          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;
    283281          if ((fabs(h / fabs(h) - MinDistance / fabs(MinDistance)) < MYEPSILON) && ((h - MinDistance)) < -MYEPSILON) {
     
    305303void FindConvexBorder(const molecule* mol, Tesselation *&TesselStruct, const LinkedCell *LCList, const char *filename)
    306304{
    307         Info FunctionInfo(__func__);
    308305  bool BoundaryFreeFlag = false;
    309306  Boundaries *BoundaryPoints = NULL;
     307
     308  Log() << Verbose(1) << "Begin of FindConvexBorder" << endl;
    310309
    311310  if (TesselStruct != NULL) // free if allocated
     
    318317      BoundaryPoints = GetBoundaryPoints(mol, TesselStruct);
    319318  } else {
    320       Log() << Verbose(0) << "Using given boundary points set." << endl;
     319      Log() << Verbose(1) << "Using given boundary points set." << endl;
    321320  }
    322321
     
    324323  for (int axis=0; axis < NDIM; axis++)
    325324    {
    326       Log() << Verbose(1) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl;
     325      Log() << Verbose(2) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl;
    327326      int i=0;
    328327      for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) {
    329328        if (runner != BoundaryPoints[axis].begin())
    330           Log() << Verbose(0) << ", " << i << ": " << *runner->second.second;
     329          Log() << Verbose(2) << ", " << i << ": " << *runner->second.second;
    331330        else
    332           Log() << Verbose(0) << i << ": " << *runner->second.second;
     331          Log() << Verbose(2) << i << ": " << *runner->second.second;
    333332        i++;
    334333      }
    335       Log() << Verbose(0) << endl;
     334      Log() << Verbose(2) << endl;
    336335    }
    337336
     
    342341          eLog() << Verbose(2) << "Point " << *(runner->second.second) << " is already present!" << endl;
    343342
    344   Log() << Verbose(0) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl;
     343  Log() << Verbose(2) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl;
    345344  // now we have the whole set of edge points in the BoundaryList
    346345
     
    348347  //  Log() << Verbose(1) << "Listing PointsOnBoundary:";
    349348  //  for(PointMap::iterator runner = PointsOnBoundary.begin(); runner != PointsOnBoundary.end(); runner++) {
    350   //    Log() << Verbose(0) << " " << *runner->second;
     349  //    Log() << Verbose(1) << " " << *runner->second;
    351350  //  }
    352   //  Log() << Verbose(0) << endl;
     351  //  Log() << Verbose(1) << endl;
    353352
    354353  // 3a. guess starting triangle
     
    360359  // 3c. check whether all atoms lay inside the boundary, if not, add to boundary points, segment triangle into three with the new point
    361360  if (!TesselStruct->InsertStraddlingPoints(mol, LCList))
    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;
     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;
    365364
    366365  // 4. Store triangles in tecplot file
     
    412411//    Log() << Verbose(1) << "Correction of concave tesselpoints failed!" << endl;
    413412
    414   Log() << Verbose(0) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl;
     413  Log() << Verbose(2) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl;
    415414
    416415  // 4. Store triangles in tecplot file
     
    438437  if (BoundaryFreeFlag)
    439438    delete[] (BoundaryPoints);
     439
     440  Log() << Verbose(1) << "End of FindConvexBorder" << endl;
    440441};
    441442
     
    449450bool RemoveAllBoundaryPoints(class Tesselation *&TesselStruct, const molecule * const mol, const char * const filename)
    450451{
    451         Info FunctionInfo(__func__);
    452452  int i=0;
    453453  char number[MAXSTRINGSIZE];
     
    460460  PointMap::iterator PointRunner;
    461461  while (!TesselStruct->PointsOnBoundary.empty()) {
    462     Log() << Verbose(1) << "Remaining points are: ";
     462    Log() << Verbose(2) << "Remaining points are: ";
    463463    for (PointMap::iterator PointSprinter = TesselStruct->PointsOnBoundary.begin(); PointSprinter != TesselStruct->PointsOnBoundary.end(); PointSprinter++)
    464       Log() << Verbose(0) << *(PointSprinter->second) << "\t";
    465     Log() << Verbose(0) << endl;
     464      Log() << Verbose(2) << *(PointSprinter->second) << "\t";
     465    Log() << Verbose(2) << 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__);
    506505  double volume = 0;
    507506  class BoundaryPointSet *point = NULL;
     
    517516  int run = 0;
    518517
     518  Log() << Verbose(0) << "Begin of ConvexizeNonconvexEnvelope" << endl;
     519
    519520  // check whether there is something to work on
    520521  if (TesselStruct == NULL) {
     
    538539      for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) {
    539540        line = LineRunner->second;
    540         Log() << Verbose(1) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;
     541        Log() << Verbose(2) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;
    541542        if (!line->CheckConvexityCriterion()) {
    542543          // remove the point if needed
     
    603604
    604605  // end
    605   Log() << Verbose(0) << "Volume is " << volume << "." << endl;
     606  Log() << Verbose(1) << "Volume is " << volume << "." << endl;
     607  Log() << Verbose(0) << "End of ConvexizeNonconvexEnvelope" << endl;
    606608  return volume;
    607609};
     
    617619double VolumeOfConvexEnvelope(class Tesselation *TesselStruct, class config *configuration)
    618620{
    619         Info FunctionInfo(__func__);
    620621  bool IsAngstroem = configuration->GetIsAngstroem();
    621622  double volume = 0.;
     
    624625
    625626  // 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;
    626630  for (TriangleMap::iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++)
    627631    { // go through every triangle, calculate volume of its pyramid with CoG as peak
     
    638642      const double h = x.Norm(); // distance of CoG to triangle
    639643      const double PyramidVolume = (1. / 3.) * G * h; // this formula holds for _all_ pyramids (independent of n-edge base or (not) centered peak)
    640       Log() << Verbose(1) << "Area of triangle is " << setprecision(10) << G << " "
     644      Log() << Verbose(2) << "Area of triangle is " << setprecision(10) << G << " "
    641645          << (IsAngstroem ? "angstrom" : "atomiclength") << "^2, height is "
    642646          << h << " and the volume is " << PyramidVolume << " "
     
    660664void StoreTrianglesinFile(const molecule * const mol, const Tesselation *&TesselStruct, const char *filename, const char *extraSuffix)
    661665{
    662         Info FunctionInfo(__func__);
    663666  // 4. Store triangles in tecplot file
    664667  if (filename != NULL) {
     
    668671      OutputName.append(TecplotSuffix);
    669672      ofstream *tecplot = new ofstream(OutputName.c_str());
    670       WriteTecplotFile(tecplot, TesselStruct, mol, -1);
     673      WriteTecplotFile(tecplot, TesselStruct, mol, 0);
    671674      tecplot->close();
    672675      delete(tecplot);
     
    695698void PrepareClustersinWater(config *configuration, molecule *mol, double ClusterVolume, double celldensity)
    696699{
    697         Info FunctionInfo(__func__);
    698700  bool IsAngstroem = true;
    699701  double *GreatestDiameter = NULL;
     
    796798molecule * FillBoxWithMolecule(MoleculeListClass *List, molecule *filler, config &configuration, double distance[NDIM], double RandomAtomDisplacement, double RandomMolDisplacement, bool DoRandomRotation)
    797799{
    798         Info FunctionInfo(__func__);
    799800  molecule *Filling = new molecule(filler->elemente);
    800801  Vector CurrentPosition;
     
    813814  double phi[NDIM];
    814815  class Tesselation *TesselStruct[List->ListOfMolecules.size()];
     816
     817  Log() << Verbose(0) << "Begin of FillBoxWithMolecule" << endl;
    815818
    816819  i=0;
     
    874877          for (int i=0;i<NDIM;i++)
    875878            FillerTranslations.x[i] = RandomMolDisplacement*(rand()/(RAND_MAX/2.) - 1.);
    876           Log() << Verbose(2) << "INFO: Translating this filler by " << FillerTranslations << "." << endl;
     879          Log() << Verbose(3) << "INFO: Translating this filler by " << FillerTranslations << "." << endl;
    877880
    878881          // go through all atoms
     
    935938        delete(TesselStruct[i]);
    936939  }
     940  Log() << Verbose(0) << "End of FillBoxWithMolecule" << endl;
     941
    937942  return Filling;
    938943};
     
    946951 * \param RADIUS radius of the virtual sphere
    947952 * \param *filename filename prefix for output of vertex data
    948  * \return true - tesselation successful, false - tesselation failed
    949  */
    950 bool FindNonConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LCList, const double RADIUS, const char *filename = NULL)
     953 */
     954void FindNonConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LCList, const double RADIUS, const char *filename = NULL)
    951955{
    952         Info FunctionInfo(__func__);
    953956  bool freeLC = false;
    954   bool status = false;
    955   CandidateForTesselation *baseline;
     957  LineMap::iterator baseline;
    956958  LineMap::iterator testline;
    957   bool OneLoopWithoutSuccessFlag = true;  // marks whether we went once through all baselines without finding any without two triangles
     959  bool OneLoopWithoutSuccessFlag = false;  // marks whether we went once through all baselines without finding any without two triangles
    958960  bool TesselationFailFlag = false;
    959   BoundaryTriangleSet *T = NULL;
    960 
     961
     962  Log() << Verbose(1) << "Entering search for non convex hull. " << endl;
    961963  if (TesselStruct == NULL) {
    962964    Log() << Verbose(1) << "Allocating Tesselation struct ..." << endl;
     
    968970  }
    969971
     972  Log() << Verbose(0) << "Begin of FindNonConvexBorder\n";
     973
    970974  // initialise Linked Cell
    971975  if (LCList == NULL) {
     
    978982
    979983  // 2. expand from there
    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.
     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        }
    9921000      }
    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;
     1001      if (TesselationFailFlag) {
     1002        baseline = TesselStruct->LinesOnBoundary.begin();
     1003        OneLoopWithoutSuccessFlag = false;
     1004        Log() << Verbose(2) << "Baseline set to begin." << endl;
    10061005      }
    1007     }
    1008     if ((ShortestAngle == 4.*M_PI) || (baseline->pointlist.empty()))
     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();
     1011      }
     1012    }
     1013
     1014    if ((baseline == TesselStruct->LinesOnBoundary.end()) && (OneLoopWithoutSuccessFlag)) {
     1015      baseline = TesselStruct->LinesOnBoundary.begin();   // restart if we reach end due to newly inserted lines
    10091016      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);
    1018       }
    1019     }
    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);
     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);
    10261025//  mol->GoToFirst();
    10271026//  class TesselPoint *Runner = NULL;
     
    10381037//  }
    10391038
    1040 //  // Purges surplus triangles.
    1041 //  TesselStruct->RemoveDegeneratedTriangles();
     1039  // Purges surplus triangles.
     1040  TesselStruct->RemoveDegeneratedTriangles();
    10421041
    10431042  // check envelope for consistency
    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);
     1043  CheckListOfBaselines(TesselStruct);
    10541044
    10551045  // write final envelope
     
    10591049  if (freeLC)
    10601050    delete(LCList);
    1061 
    1062   return status;
     1051  Log() << Verbose(0) << "End of FindNonConvexBorder\n";
    10631052};
    10641053
     
    10721061Vector* FindEmbeddingHole(MoleculeListClass *mols, molecule *srcmol)
    10731062{
    1074         Info FunctionInfo(__func__);
    10751063  Vector *Center = new Vector;
    10761064  Center->Zero();
Note: See TracChangeset for help on using the changeset viewer.