Ignore:
Timestamp:
Oct 27, 2009, 4:11:22 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
069034
Parents:
55a71b
Message:

Huge refactoring to make const what is const (ticket #38), continued.

  • too many changes because of too many cross-references to be able to list them up here.
  • NOTE that "make check" runs fine and did catch several error.
  • note that we had to use const_iterator several times when the map, ... was declared const.
  • at times we changed an allocated LinkedCell LCList(...) into

const LinkedCell *LCList;
LCList = new LinkedCell(...);

  • also mutable (see ticket #5) was used, e.g. for molecule::InternalPointer (PointCloud changes are allowed, because they are just accounting).

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/boundary.cpp

    r55a71b ra9b2a0a  
    2626 * \param *BoundaryPoints NDIM set of boundary points defining the convex envelope on each projected plane
    2727 * \param *mol molecule structure representing the cluster
     28 * \param *&TesselStruct Tesselation structure with triangles
    2829 * \param IsAngstroem whether we have angstroem or atomic units
    2930 * \return NDIM array of the diameters
    3031 */
    31 double *GetDiametersOfCluster(ofstream *out, Boundaries *BoundaryPtr, molecule *mol, bool IsAngstroem)
     32double *GetDiametersOfCluster(ofstream *out, const Boundaries *BoundaryPtr, const molecule *mol, Tesselation *&TesselStruct, const bool IsAngstroem)
    3233{
    3334  // get points on boundary of NULL was given as parameter
    3435  bool BoundaryFreeFlag = false;
    35   Boundaries *BoundaryPoints = BoundaryPtr;
    3636  double OldComponent = 0.;
    3737  double tmp = 0.;
     
    4242  int component = 0;
    4343  int Othercomponent = 0;
    44   Boundaries::iterator Neighbour;
    45   Boundaries::iterator OtherNeighbour;
     44  Boundaries::const_iterator Neighbour;
     45  Boundaries::const_iterator OtherNeighbour;
    4646  double *GreatestDiameter = new double[NDIM];
    4747
    48   if (BoundaryPoints == NULL) {
     48  const Boundaries *BoundaryPoints;
     49  if (BoundaryPtr == NULL) {
    4950    BoundaryFreeFlag = true;
    50     BoundaryPoints = GetBoundaryPoints(out, mol);
     51    BoundaryPoints = GetBoundaryPoints(out, mol, TesselStruct);
    5152  } else {
     53    BoundaryPoints = BoundaryPtr;
    5254    *out << Verbose(1) << "Using given boundary points set." << endl;
    5355  }
     
    6365          Othercomponent = (axis + 1 + ((j + 1) & 1)) % NDIM;
    6466          //*out << Verbose(1) << "Current component is " << component << ", Othercomponent is " << Othercomponent << "." << endl;
    65           for (Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner
    66               != BoundaryPoints[axis].end(); runner++)
    67             {
     67          for (Boundaries::const_iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) {
    6868              //*out << Verbose(2) << "Current runner is " << *(runner->second.second) << "." << endl;
    6969              // seek for the neighbours pair where the Othercomponent sign flips
     
    7474              DistanceVector.CopyVector(&runner->second.second->x);
    7575              DistanceVector.SubtractVector(&Neighbour->second.second->x);
    76               do
    77                 { // seek for neighbour pair where it flips
     76              do { // seek for neighbour pair where it flips
    7877                  OldComponent = DistanceVector.x[Othercomponent];
    7978                  Neighbour++;
     
    8382                  DistanceVector.SubtractVector(&Neighbour->second.second->x);
    8483                  //*out << Verbose(3) << "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "." << endl;
    85                 }
    86               while ((runner != Neighbour) && (fabs(OldComponent / fabs(
     84                } while ((runner != Neighbour) && (fabs(OldComponent / fabs(
    8785                  OldComponent) - DistanceVector.x[Othercomponent] / fabs(
    8886                  DistanceVector.x[Othercomponent])) < MYEPSILON)); // as long as sign does not flip
    89               if (runner != Neighbour)
    90                 {
     87              if (runner != Neighbour) {
    9188                  OtherNeighbour = Neighbour;
    9289                  if (OtherNeighbour == BoundaryPoints[axis].begin()) // make it wrap around
     
    133130 * \param *out output stream for debugging
    134131 * \param *mol molecule structure representing the cluster
    135  */
    136 Boundaries *GetBoundaryPoints(ofstream *out, molecule *mol)
     132 * \param *&TesselStruct pointer to Tesselation structure
     133 */
     134Boundaries *GetBoundaryPoints(ofstream *out, const molecule *mol, Tesselation *&TesselStruct)
    137135{
    138136  atom *Walker = NULL;
     
    148146  Vector ProjectedVector;
    149147  Boundaries *BoundaryPoints = new Boundaries[NDIM]; // first is alpha, second is (r, nr)
    150   double radius = 0.;
    151148  double angle = 0.;
    152149
     
    172169
    173170      // correct for negative side
    174       radius = ProjectedVector.NormSquared();
     171      const double radius = ProjectedVector.NormSquared();
    175172      if (fabs(radius) > MYEPSILON)
    176173        angle = ProjectedVector.Angle(&AngleReferenceVector);
     
    188185        *out << Verbose(2) << "Present vector: " << *BoundaryTestPair.first->second.second << endl;
    189186        *out << Verbose(2) << "New vector: " << *Walker << endl;
    190         double tmp = ProjectedVector.NormSquared();
    191         if ((tmp - BoundaryTestPair.first->second.first) > MYEPSILON) {
    192           BoundaryTestPair.first->second.first = tmp;
     187        const double ProjectedVectorNorm = ProjectedVector.NormSquared();
     188        if ((ProjectedVectorNorm - BoundaryTestPair.first->second.first) > MYEPSILON) {
     189          BoundaryTestPair.first->second.first = ProjectedVectorNorm;
    193190          BoundaryTestPair.first->second.second = Walker;
    194           *out << Verbose(2) << "Keeping new vector due to larger projected distance " << tmp << "." << endl;
    195         } else if (fabs(tmp - BoundaryTestPair.first->second.first) < MYEPSILON) {
     191          *out << Verbose(2) << "Keeping new vector due to larger projected distance " << ProjectedVectorNorm << "." << endl;
     192        } else if (fabs(ProjectedVectorNorm - BoundaryTestPair.first->second.first) < MYEPSILON) {
    196193          helper.CopyVector(&Walker->x);
    197194          helper.SubtractVector(MolCenter);
    198           tmp = helper.NormSquared();
     195          const double oldhelperNorm = helper.NormSquared();
    199196          helper.CopyVector(&BoundaryTestPair.first->second.second->x);
    200197          helper.SubtractVector(MolCenter);
    201           if (helper.NormSquared() < tmp) {
     198          if (helper.NormSquared() < oldhelperNorm) {
    202199            BoundaryTestPair.first->second.second = Walker;
    203200            *out << Verbose(2) << "Keeping new vector due to larger distance to molecule center " << helper.NormSquared() << "." << endl;
    204201          } else {
    205             *out << Verbose(2) << "Keeping present vector due to larger distance to molecule center " << tmp << "." << endl;
     202            *out << Verbose(2) << "Keeping present vector due to larger distance to molecule center " << oldhelperNorm << "." << endl;
    206203          }
    207204        } else {
    208           *out << Verbose(2) << "Keeping present vector due to larger projected distance " << tmp << "." << endl;
     205          *out << Verbose(2) << "Keeping present vector due to larger projected distance " << ProjectedVectorNorm << "." << endl;
    209206        }
    210207      }
     
    305302/** Tesselates the convex boundary by finding all boundary points.
    306303 * \param *out output stream for debugging
    307  * \param *mol molecule structure with Atom's and Bond's
     304 * \param *mol molecule structure with Atom's and Bond's.
    308305 * \param *TesselStruct Tesselation filled with points, lines and triangles on boundary on return
    309306 * \param *LCList atoms in LinkedCell list
     
    311308 * \return *TesselStruct is filled with convex boundary and tesselation is stored under \a *filename.
    312309 */
    313 void FindConvexBorder(ofstream *out, molecule* mol, class LinkedCell *LCList, const char *filename)
     310void FindConvexBorder(ofstream *out, const molecule* mol, Tesselation *&TesselStruct, const LinkedCell *LCList, const char *filename)
    314311{
    315312  bool BoundaryFreeFlag = false;
     
    318315  cout << Verbose(1) << "Begin of FindConvexBorder" << endl;
    319316
    320   if (mol->TesselStruct != NULL) // free if allocated
    321     delete(mol->TesselStruct);
    322   mol->TesselStruct = new class Tesselation;
     317  if (TesselStruct != NULL) // free if allocated
     318    delete(TesselStruct);
     319  TesselStruct = new class Tesselation;
    323320
    324321  // 1. Find all points on the boundary
    325322  if (BoundaryPoints == NULL) {
    326323      BoundaryFreeFlag = true;
    327       BoundaryPoints = GetBoundaryPoints(out, mol);
     324      BoundaryPoints = GetBoundaryPoints(out, mol, TesselStruct);
    328325  } else {
    329326      *out << Verbose(1) << "Using given boundary points set." << endl;
     
    348345  for (int axis = 0; axis < NDIM; axis++)
    349346    for (Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++)
    350         if (!mol->TesselStruct->AddBoundaryPoint(runner->second.second, 0))
     347        if (!TesselStruct->AddBoundaryPoint(runner->second.second, 0))
    351348          *out << Verbose(3) << "WARNING: Point " << *(runner->second.second) << " is already present!" << endl;
    352349
    353   *out << Verbose(2) << "I found " << mol->TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl;
     350  *out << Verbose(2) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl;
    354351  // now we have the whole set of edge points in the BoundaryList
    355352
     
    362359
    363360  // 3a. guess starting triangle
    364   mol->TesselStruct->GuessStartingTriangle(out);
     361  TesselStruct->GuessStartingTriangle(out);
    365362
    366363  // 3b. go through all lines, that are not yet part of two triangles (only of one so far)
    367   mol->TesselStruct->TesselateOnBoundary(out, mol);
     364  TesselStruct->TesselateOnBoundary(out, mol);
    368365
    369366  // 3c. check whether all atoms lay inside the boundary, if not, add to boundary points, segment triangle into three with the new point
    370   if (!mol->TesselStruct->InsertStraddlingPoints(out, mol, LCList))
     367  if (!TesselStruct->InsertStraddlingPoints(out, mol, LCList))
    371368    *out << Verbose(1) << "Insertion of straddling points failed!" << endl;
    372369
    373   *out << Verbose(2) << "I created " << mol->TesselStruct->TrianglesOnBoundary.size() << " intermediate triangles with " << mol->TesselStruct->LinesOnBoundary.size() << " lines and " << mol->TesselStruct->PointsOnBoundary.size() << " points." << endl;
     370  *out << Verbose(2) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " intermediate triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl;
    374371
    375372  // 4. Store triangles in tecplot file
     
    380377      OutputName.append(TecplotSuffix);
    381378      ofstream *tecplot = new ofstream(OutputName.c_str());
    382       WriteTecplotFile(out, tecplot, mol->TesselStruct, mol, 0);
     379      WriteTecplotFile(out, tecplot, TesselStruct, mol, 0);
    383380      tecplot->close();
    384381      delete(tecplot);
     
    389386      OutputName.append(Raster3DSuffix);
    390387      ofstream *rasterplot = new ofstream(OutputName.c_str());
    391       WriteRaster3dFile(out, rasterplot, mol->TesselStruct, mol);
     388      WriteRaster3dFile(out, rasterplot, TesselStruct, mol);
    392389      rasterplot->close();
    393390      delete(rasterplot);
     
    400397  do {
    401398    AllConvex = true;
    402     for (LineMap::iterator LineRunner = mol->TesselStruct->LinesOnBoundary.begin(); LineRunner != mol->TesselStruct->LinesOnBoundary.end(); LineRunner++) {
     399    for (LineMap::iterator LineRunner = TesselStruct->LinesOnBoundary.begin(); LineRunner != TesselStruct->LinesOnBoundary.end(); LineRunner++) {
    403400      line = LineRunner->second;
    404401      *out << Verbose(1) << "INFO: Current line is " << *line << "." << endl;
     
    407404
    408405        // flip the line
    409         if (mol->TesselStruct->PickFarthestofTwoBaselines(out, line) == 0.)
     406        if (TesselStruct->PickFarthestofTwoBaselines(out, line) == 0.)
    410407          *out << Verbose(1) << "ERROR: Correction of concave baselines failed!" << endl;
    411408        else {
    412           mol->TesselStruct->FlipBaseline(out, line);
     409          TesselStruct->FlipBaseline(out, line);
    413410          *out << Verbose(1) << "INFO: Correction of concave baselines worked." << endl;
    414411        }
     
    418415
    419416  // 3e. we need another correction here, for TesselPoints that are below the surface (i.e. have an odd number of concave triangles surrounding it)
    420 //  if (!mol->TesselStruct->CorrectConcaveTesselPoints(out))
     417//  if (!TesselStruct->CorrectConcaveTesselPoints(out))
    421418//    *out << Verbose(1) << "Correction of concave tesselpoints failed!" << endl;
    422419
    423   *out << Verbose(2) << "I created " << mol->TesselStruct->TrianglesOnBoundary.size() << " triangles with " << mol->TesselStruct->LinesOnBoundary.size() << " lines and " << mol->TesselStruct->PointsOnBoundary.size() << " points." << endl;
     420  *out << Verbose(2) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl;
    424421
    425422  // 4. Store triangles in tecplot file
     
    429426      OutputName.append(TecplotSuffix);
    430427      ofstream *tecplot = new ofstream(OutputName.c_str());
    431       WriteTecplotFile(out, tecplot, mol->TesselStruct, mol, 0);
     428      WriteTecplotFile(out, tecplot, TesselStruct, mol, 0);
    432429      tecplot->close();
    433430      delete(tecplot);
     
    437434      OutputName.append(Raster3DSuffix);
    438435      ofstream *rasterplot = new ofstream(OutputName.c_str());
    439       WriteRaster3dFile(out, rasterplot, mol->TesselStruct, mol);
     436      WriteRaster3dFile(out, rasterplot, TesselStruct, mol);
    440437      rasterplot->close();
    441438      delete(rasterplot);
     
    458455 * \return true - all removed, false - something went wrong
    459456 */
    460 bool RemoveAllBoundaryPoints(ofstream *out, class Tesselation *TesselStruct, molecule *mol, char *filename)
     457bool RemoveAllBoundaryPoints(ofstream *out, class Tesselation *&TesselStruct, const molecule * const mol, const char * const filename)
    461458{
    462459  int i=0;
     
    481478    // store envelope
    482479    sprintf(number, "-%04d", i++);
    483     StoreTrianglesinFile(out, mol, filename, number);
     480    StoreTrianglesinFile(out, mol, (const Tesselation *&)TesselStruct, filename, number);
    484481  }
    485482
     
    511508 * \return volume difference between the non- and the created convex envelope
    512509 */
    513 double ConvexizeNonconvexEnvelope(ofstream *out, class Tesselation *TesselStruct, molecule *mol, char *filename)
     510double ConvexizeNonconvexEnvelope(ofstream *out, class Tesselation *&TesselStruct, const molecule * const mol, const char * const filename)
    514511{
    515512  double volume = 0;
     
    539536    sprintf(dummy, "-first-%d", run);
    540537    //CalculateConcavityPerBoundaryPoint(out, TesselStruct);
    541     StoreTrianglesinFile(out, mol, filename, dummy);
     538    StoreTrianglesinFile(out, mol, (const Tesselation *&)TesselStruct, filename, dummy);
    542539
    543540    PointRunner = TesselStruct->PointsOnBoundary.begin();
     
    555552          volume += TesselStruct->RemovePointFromTesselatedSurface(out, point);
    556553          sprintf(dummy, "-first-%d", ++run);
    557           StoreTrianglesinFile(out, mol, filename, dummy);
     554          StoreTrianglesinFile(out, mol, (const Tesselation *&)TesselStruct, filename, dummy);
    558555          Concavity = true;
    559556          break;
     
    565562    sprintf(dummy, "-second-%d", run);
    566563    //CalculateConcavityPerBoundaryPoint(out, TesselStruct);
    567     StoreTrianglesinFile(out, mol, filename, dummy);
     564    StoreTrianglesinFile(out, mol, (const Tesselation *&)TesselStruct, filename, dummy);
    568565
    569566    // second step: PickFarthestofTwoBaselines
     
    579576        volume += tmp;
    580577        if (tmp != 0.) {
    581           mol->TesselStruct->FlipBaseline(out, line);
     578          TesselStruct->FlipBaseline(out, line);
    582579          Concavity = true;
    583580        }
     
    611608
    612609  CalculateConcavityPerBoundaryPoint(out, TesselStruct);
    613   StoreTrianglesinFile(out, mol, filename, "");
     610  StoreTrianglesinFile(out, mol, (const Tesselation *&)TesselStruct, filename, "");
    614611
    615612  // end
     
    668665 * \param *out output stream for debugging
    669666 * \param *mol molecule with atoms and bonds
     667 * \param *&TesselStruct Tesselation with boundary triangles
    670668 * \param *filename prefix of filename
    671669 * \param *extraSuffix intermediate suffix
    672670 */
    673 void StoreTrianglesinFile(ofstream *out, molecule *mol, const char *filename, const char *extraSuffix)
     671void StoreTrianglesinFile(ofstream *out, const molecule * const mol, const Tesselation *&TesselStruct, const char *filename, const char *extraSuffix)
    674672{
    675673  // 4. Store triangles in tecplot file
     
    680678      OutputName.append(TecplotSuffix);
    681679      ofstream *tecplot = new ofstream(OutputName.c_str());
    682       WriteTecplotFile(out, tecplot, mol->TesselStruct, mol, 0);
     680      WriteTecplotFile(out, tecplot, TesselStruct, mol, 0);
    683681      tecplot->close();
    684682      delete(tecplot);
     
    689687      OutputName.append(Raster3DSuffix);
    690688      ofstream *rasterplot = new ofstream(OutputName.c_str());
    691       WriteRaster3dFile(out, rasterplot, mol->TesselStruct, mol);
     689      WriteRaster3dFile(out, rasterplot, TesselStruct, mol);
    692690      rasterplot->close();
    693691      delete(rasterplot);
     
    701699 * \param *configuration needed for path to store convex envelope file
    702700 * \param *mol molecule structure representing the cluster
     701 * \param *&TesselStruct Tesselation structure with triangles on return
    703702 * \param ClusterVolume guesstimated cluster volume, if equal 0 we used VolumeOfConvexEnvelope() instead.
    704703 * \param celldensity desired average density in final cell
     
    722721
    723722  IsAngstroem = configuration->GetIsAngstroem();
    724   GreatestDiameter = GetDiametersOfCluster(out, BoundaryPoints, mol, IsAngstroem);
    725   BoundaryPoints = GetBoundaryPoints(out, mol);
     723  GreatestDiameter = GetDiametersOfCluster(out, BoundaryPoints, mol, TesselStruct, IsAngstroem);
     724  BoundaryPoints = GetBoundaryPoints(out, mol, TesselStruct);
    726725  LinkedCell LCList(mol, 10.);
    727   FindConvexBorder(out, mol, &LCList, NULL);
     726  FindConvexBorder(out, mol, TesselStruct, &LCList, NULL);
    728727
    729728  // some preparations beforehand
     
    821820  LinkedCell *LCList[List->ListOfMolecules.size()];
    822821  double phi[NDIM];
     822  class Tesselation *TesselStruct[List->ListOfMolecules.size()];
    823823
    824824  *out << Verbose(0) << "Begin of FillBoxWithMolecule" << endl;
     
    828828    *out << Verbose(1) << "Pre-creating linked cell lists for molecule " << *ListRunner << "." << endl;
    829829    LCList[i] = new LinkedCell((*ListRunner), 5.); // get linked cell list
    830     if ((*ListRunner)->TesselStruct == NULL) {
     830    if (TesselStruct[i] == NULL) {
    831831      *out << Verbose(1) << "Pre-creating tesselation for molecule " << *ListRunner << "." << endl;
    832       FindNonConvexBorder((ofstream *)&cout, (*ListRunner), LCList[i], 5., NULL);
     832      FindNonConvexBorder((ofstream *)&cout, (*ListRunner), TesselStruct[i], (const LinkedCell *&)LCList[i], 5., NULL);
    833833    }
    834834    i++;
     
    868868        for (MoleculeList::iterator ListRunner = List->ListOfMolecules.begin(); ListRunner != List->ListOfMolecules.end(); ListRunner++) {
    869869          // get linked cell list
    870           if ((*ListRunner)->TesselStruct == NULL) {
     870          if (TesselStruct[i] == NULL) {
    871871            *out << Verbose(1) << "ERROR: TesselStruct of " << (*ListRunner) << " is NULL. Didn't we pre-create it?" << endl;
    872872            FillIt = false;
    873           } else
    874             FillIt = FillIt && (!(*ListRunner)->TesselStruct->IsInnerPoint(out, CurrentPosition, LCList[i++]));
     873          } else {
     874            FillIt = FillIt && (!TesselStruct[i]->IsInnerPoint(out, CurrentPosition, LCList[i]));
     875            i++;
     876          }
    875877        }
    876878
     
    947949 * \param *out output stream for debugging
    948950 * \param *mol molecule structure with Atom's and Bond's
    949  * \param *Tess Tesselation filled with points, lines and triangles on boundary on return
    950  * \param *LCList atoms in LinkedCell list
     951 * \param *&TesselStruct Tesselation filled with points, lines and triangles on boundary on return
     952 * \param *&LCList atoms in LinkedCell list
    951953 * \param RADIUS radius of the virtual sphere
    952954 * \param *filename filename prefix for output of vertex data
    953955 */
    954 void FindNonConvexBorder(ofstream *out, molecule* mol, class LinkedCell *LCList, const double RADIUS, const char *filename = NULL)
     956void FindNonConvexBorder(ofstream *out, const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LCList, const double RADIUS, const char *filename = NULL)
    955957{
    956958  bool freeLC = false;
     
    961963
    962964  *out << Verbose(1) << "Entering search for non convex hull. " << endl;
    963   if (mol->TesselStruct == NULL) {
     965  if (TesselStruct == NULL) {
    964966    *out << Verbose(1) << "Allocating Tesselation struct ..." << endl;
    965     mol->TesselStruct = new Tesselation;
     967    TesselStruct= new Tesselation;
    966968  } else {
    967     delete(mol->TesselStruct);
     969    delete(TesselStruct);
    968970    *out << Verbose(1) << "Re-Allocating Tesselation struct ..." << endl;
    969     mol->TesselStruct = new Tesselation;
     971    TesselStruct = new Tesselation;
    970972  }
    971973
     
    979981
    980982  // 1. get starting triangle
    981   mol->TesselStruct->FindStartingTriangle(out, RADIUS, LCList);
     983  TesselStruct->FindStartingTriangle(out, RADIUS, LCList);
    982984
    983985  // 2. expand from there
    984   baseline = mol->TesselStruct->LinesOnBoundary.begin();
     986  baseline = TesselStruct->LinesOnBoundary.begin();
    985987  baseline++; // skip first line
    986   while ((baseline != mol->TesselStruct->LinesOnBoundary.end()) || (OneLoopWithoutSuccessFlag)) {
     988  while ((baseline != TesselStruct->LinesOnBoundary.end()) || (OneLoopWithoutSuccessFlag)) {
    987989    if (baseline->second->triangles.size() == 1) {
    988990      // 3. find next triangle
    989       TesselationFailFlag = mol->TesselStruct->FindNextSuitableTriangle(out, *(baseline->second), *(((baseline->second->triangles.begin()))->second), RADIUS, LCList); //the line is there, so there is a triangle, but only one.
     991      TesselationFailFlag = TesselStruct->FindNextSuitableTriangle(out, *(baseline->second), *(((baseline->second->triangles.begin()))->second), RADIUS, LCList); //the line is there, so there is a triangle, but only one.
    990992      OneLoopWithoutSuccessFlag = OneLoopWithoutSuccessFlag || TesselationFailFlag;
    991993      if (!TesselationFailFlag)
     
    994996      // write temporary envelope
    995997      if (filename != NULL) {
    996         if ((DoSingleStepOutput && ((mol->TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration
    997           mol->TesselStruct->Output(out, filename, mol);
     998        if ((DoSingleStepOutput && ((TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration
     999          TesselStruct->Output(out, filename, mol);
    9981000        }
    9991001      }
    1000       baseline = mol->TesselStruct->LinesOnBoundary.end();
     1002      baseline = TesselStruct->LinesOnBoundary.end();
    10011003      *out << Verbose(2) << "Baseline set to end." << endl;
    10021004    } else {
     
    10061008    }
    10071009
    1008     if ((baseline == mol->TesselStruct->LinesOnBoundary.end()) && (OneLoopWithoutSuccessFlag)) {
    1009       baseline = mol->TesselStruct->LinesOnBoundary.begin();   // restart if we reach end due to newly inserted lines
     1010    if ((baseline == TesselStruct->LinesOnBoundary.end()) && (OneLoopWithoutSuccessFlag)) {
     1011      baseline = TesselStruct->LinesOnBoundary.begin();   // restart if we reach end due to newly inserted lines
    10101012      OneLoopWithoutSuccessFlag = false;
    10111013    }
     
    10131015  }
    10141016  // check envelope for consistency
    1015   CheckListOfBaselines(out, mol->TesselStruct);
     1017  CheckListOfBaselines(out, TesselStruct);
    10161018
    10171019  // look whether all points are inside of the convex envelope, otherwise add them via degenerated triangles
    1018   //mol->TesselStruct->InsertStraddlingPoints(out, mol, LCList);
     1020  //->InsertStraddlingPoints(out, mol, LCList);
    10191021//  mol->GoToFirst();
    10201022//  class TesselPoint *Runner = NULL;
     
    10221024//    Runner = mol->GetPoint();
    10231025//    *out << Verbose(1) << "Checking on " << Runner->Name << " ... " << endl;
    1024 //    if (!mol->TesselStruct->IsInnerPoint(out, Runner, LCList)) {
     1026//    if (!->IsInnerPoint(out, Runner, LCList)) {
    10251027//      *out << Verbose(2) << Runner->Name << " is outside of envelope, adding via degenerated triangles." << endl;
    1026 //      mol->TesselStruct->AddBoundaryPointByDegeneratedTriangle(out, Runner, LCList);
     1028//      ->AddBoundaryPointByDegeneratedTriangle(out, Runner, LCList);
    10271029//    } else {
    10281030//      *out << Verbose(2) << Runner->Name << " is inside of or on envelope." << endl;
     
    10321034
    10331035  // Purges surplus triangles.
    1034   mol->TesselStruct->RemoveDegeneratedTriangles();
     1036  TesselStruct->RemoveDegeneratedTriangles();
    10351037
    10361038  // check envelope for consistency
    1037   CheckListOfBaselines(out, mol->TesselStruct);
     1039  CheckListOfBaselines(out, TesselStruct);
    10381040
    10391041  // write final envelope
    1040   CalculateConcavityPerBoundaryPoint(out, mol->TesselStruct);
    1041   StoreTrianglesinFile(out, mol, filename, "");
     1042  CalculateConcavityPerBoundaryPoint(out, TesselStruct);
     1043  StoreTrianglesinFile(out, mol, (const Tesselation *&)TesselStruct, filename, "");
    10421044
    10431045  if (freeLC)
Note: See TracChangeset for help on using the changeset viewer.