Changes in src/boundary.cpp [b998c3:e359a8]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/boundary.cpp
rb998c3 re359a8 10 10 #include "element.hpp" 11 11 #include "helpers.hpp" 12 #include "info.hpp"13 12 #include "linkedcell.hpp" 14 13 #include "log.hpp" … … 34 33 double *GetDiametersOfCluster(const Boundaries *BoundaryPtr, const molecule *mol, Tesselation *&TesselStruct, const bool IsAngstroem) 35 34 { 36 Info FunctionInfo(__func__);37 35 // get points on boundary of NULL was given as parameter 38 36 bool BoundaryFreeFlag = false; … … 55 53 } else { 56 54 BoundaryPoints = BoundaryPtr; 57 Log() << Verbose( 0) << "Using given boundary points set." << endl;55 Log() << Verbose(1) << "Using given boundary points set." << endl; 58 56 } 59 57 // determine biggest "diameter" of cluster for each axis … … 69 67 //Log() << Verbose(1) << "Current component is " << component << ", Othercomponent is " << Othercomponent << "." << endl; 70 68 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; 72 70 // seek for the neighbours pair where the Othercomponent sign flips 73 71 Neighbour = runner; … … 84 82 DistanceVector.CopyVector(&runner->second.second->x); 85 83 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; 87 85 } while ((runner != Neighbour) && (fabs(OldComponent / fabs( 88 86 OldComponent) - DistanceVector.x[Othercomponent] / fabs( … … 93 91 OtherNeighbour = BoundaryPoints[axis].end(); 94 92 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; 96 94 // now we have found the pair: Neighbour and OtherNeighbour 97 95 OtherVector.CopyVector(&runner->second.second->x); 98 96 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; 101 99 // do linear interpolation between points (is exact) to extract exact intersection between Neighbour and OtherNeighbour 102 100 w1 = fabs(OtherVector.x[Othercomponent]); … … 105 103 * OtherVector.x[component]) / (w1 + w2)); 106 104 // 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; 108 106 GreatestDiameter[component] = (GreatestDiameter[component] 109 107 > tmp) ? GreatestDiameter[component] : tmp; 110 108 } //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; 112 110 } 113 111 } … … 137 135 Boundaries *GetBoundaryPoints(const molecule *mol, Tesselation *&TesselStruct) 138 136 { 139 Info FunctionInfo(__func__);140 137 atom *Walker = NULL; 141 138 PointMap PointsOnBoundary; … … 152 149 double angle = 0.; 153 150 151 Log() << Verbose(1) << "Finding all boundary points." << endl; 154 152 // 3a. Go through every axis 155 153 for (int axis = 0; axis < NDIM; axis++) { … … 178 176 angle = 0.; // otherwise it's a vector in Axis Direction and unimportant for boundary issues 179 177 180 //Log() << Verbose( 1) << "Checking sign in quadrant : " << ProjectedVector.Projection(&AngleReferenceNormalVector) << "." << endl;178 //Log() << Verbose(2) << "Checking sign in quadrant : " << ProjectedVector.Projection(&AngleReferenceNormalVector) << "." << endl; 181 179 if (ProjectedVector.ScalarProduct(&AngleReferenceNormalVector) > 0) { 182 180 angle = 2. * M_PI - angle; 183 181 } 184 Log() << Verbose( 1) << "Inserting " << *Walker << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl;182 Log() << Verbose(2) << "Inserting " << *Walker << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl; 185 183 BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, DistancePair (radius, Walker))); 186 184 if (!BoundaryTestPair.second) { // same point exists, check first r, then distance of original vectors to center of gravity … … 212 210 // printing all inserted for debugging 213 211 // { 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; 215 213 // int i=0; 216 214 // for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) { 217 215 // if (runner != BoundaryPoints[axis].begin()) 218 // Log() << Verbose( 0) << ", " << i << ": " << *runner->second.second;216 // Log() << Verbose(2) << ", " << i << ": " << *runner->second.second; 219 217 // else 220 // Log() << Verbose( 0) << i << ": " << *runner->second.second;218 // Log() << Verbose(2) << i << ": " << *runner->second.second; 221 219 // i++; 222 220 // } 223 // Log() << Verbose( 0) << endl;221 // Log() << Verbose(2) << endl; 224 222 // } 225 223 // 3c. throw out points whose distance is less than the mean of left and right neighbours … … 251 249 SideA.SubtractVector(MolCenter); 252 250 SideA.ProjectOntoPlane(&AxisVector); 253 // Log() << Verbose( 1) << "SideA: " << SideA << endl;251 // Log() << Verbose(0) << "SideA: " << SideA << endl; 254 252 255 253 SideB.CopyVector(&right->second.second->x); 256 254 SideB.SubtractVector(MolCenter); 257 255 SideB.ProjectOntoPlane(&AxisVector); 258 // Log() << Verbose( 1) << "SideB: " << SideB << endl;256 // Log() << Verbose(0) << "SideB: " << SideB << endl; 259 257 260 258 SideC.CopyVector(&left->second.second->x); 261 259 SideC.SubtractVector(&right->second.second->x); 262 260 SideC.ProjectOntoPlane(&AxisVector); 263 // Log() << Verbose( 1) << "SideC: " << SideC << endl;261 // Log() << Verbose(0) << "SideC: " << SideC << endl; 264 262 265 263 SideH.CopyVector(&runner->second.second->x); 266 264 SideH.SubtractVector(MolCenter); 267 265 SideH.ProjectOntoPlane(&AxisVector); 268 // Log() << Verbose( 1) << "SideH: " << SideH << endl;266 // Log() << Verbose(0) << "SideH: " << SideH << endl; 269 267 270 268 // calculate each length … … 279 277 const double delta = SideC.Angle(&SideH); 280 278 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; 282 280 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; 283 281 if ((fabs(h / fabs(h) - MinDistance / fabs(MinDistance)) < MYEPSILON) && ((h - MinDistance)) < -MYEPSILON) { … … 305 303 void FindConvexBorder(const molecule* mol, Tesselation *&TesselStruct, const LinkedCell *LCList, const char *filename) 306 304 { 307 Info FunctionInfo(__func__);308 305 bool BoundaryFreeFlag = false; 309 306 Boundaries *BoundaryPoints = NULL; 307 308 Log() << Verbose(1) << "Begin of FindConvexBorder" << endl; 310 309 311 310 if (TesselStruct != NULL) // free if allocated … … 318 317 BoundaryPoints = GetBoundaryPoints(mol, TesselStruct); 319 318 } else { 320 Log() << Verbose( 0) << "Using given boundary points set." << endl;319 Log() << Verbose(1) << "Using given boundary points set." << endl; 321 320 } 322 321 … … 324 323 for (int axis=0; axis < NDIM; axis++) 325 324 { 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; 327 326 int i=0; 328 327 for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) { 329 328 if (runner != BoundaryPoints[axis].begin()) 330 Log() << Verbose( 0) << ", " << i << ": " << *runner->second.second;329 Log() << Verbose(2) << ", " << i << ": " << *runner->second.second; 331 330 else 332 Log() << Verbose( 0) << i << ": " << *runner->second.second;331 Log() << Verbose(2) << i << ": " << *runner->second.second; 333 332 i++; 334 333 } 335 Log() << Verbose( 0) << endl;334 Log() << Verbose(2) << endl; 336 335 } 337 336 … … 342 341 eLog() << Verbose(2) << "Point " << *(runner->second.second) << " is already present!" << endl; 343 342 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; 345 344 // now we have the whole set of edge points in the BoundaryList 346 345 … … 348 347 // Log() << Verbose(1) << "Listing PointsOnBoundary:"; 349 348 // for(PointMap::iterator runner = PointsOnBoundary.begin(); runner != PointsOnBoundary.end(); runner++) { 350 // Log() << Verbose( 0) << " " << *runner->second;349 // Log() << Verbose(1) << " " << *runner->second; 351 350 // } 352 // Log() << Verbose( 0) << endl;351 // Log() << Verbose(1) << endl; 353 352 354 353 // 3a. guess starting triangle … … 360 359 // 3c. check whether all atoms lay inside the boundary, if not, add to boundary points, segment triangle into three with the new point 361 360 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; 365 364 366 365 // 4. Store triangles in tecplot file … … 412 411 // Log() << Verbose(1) << "Correction of concave tesselpoints failed!" << endl; 413 412 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; 415 414 416 415 // 4. Store triangles in tecplot file … … 438 437 if (BoundaryFreeFlag) 439 438 delete[] (BoundaryPoints); 439 440 Log() << Verbose(1) << "End of FindConvexBorder" << endl; 440 441 }; 441 442 … … 449 450 bool RemoveAllBoundaryPoints(class Tesselation *&TesselStruct, const molecule * const mol, const char * const filename) 450 451 { 451 Info FunctionInfo(__func__);452 452 int i=0; 453 453 char number[MAXSTRINGSIZE]; … … 460 460 PointMap::iterator PointRunner; 461 461 while (!TesselStruct->PointsOnBoundary.empty()) { 462 Log() << Verbose( 1) << "Remaining points are: ";462 Log() << Verbose(2) << "Remaining points are: "; 463 463 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; 466 466 467 467 PointRunner = TesselStruct->PointsOnBoundary.begin(); … … 503 503 double ConvexizeNonconvexEnvelope(class Tesselation *&TesselStruct, const molecule * const mol, const char * const filename) 504 504 { 505 Info FunctionInfo(__func__);506 505 double volume = 0; 507 506 class BoundaryPointSet *point = NULL; … … 517 516 int run = 0; 518 517 518 Log() << Verbose(0) << "Begin of ConvexizeNonconvexEnvelope" << endl; 519 519 520 // check whether there is something to work on 520 521 if (TesselStruct == NULL) { … … 538 539 for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) { 539 540 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; 541 542 if (!line->CheckConvexityCriterion()) { 542 543 // remove the point if needed … … 603 604 604 605 // 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; 606 608 return volume; 607 609 }; … … 617 619 double VolumeOfConvexEnvelope(class Tesselation *TesselStruct, class config *configuration) 618 620 { 619 Info FunctionInfo(__func__);620 621 bool IsAngstroem = configuration->GetIsAngstroem(); 621 622 double volume = 0.; … … 624 625 625 626 // 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; 626 630 for (TriangleMap::iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++) 627 631 { // go through every triangle, calculate volume of its pyramid with CoG as peak … … 638 642 const double h = x.Norm(); // distance of CoG to triangle 639 643 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 << " " 641 645 << (IsAngstroem ? "angstrom" : "atomiclength") << "^2, height is " 642 646 << h << " and the volume is " << PyramidVolume << " " … … 660 664 void StoreTrianglesinFile(const molecule * const mol, const Tesselation *&TesselStruct, const char *filename, const char *extraSuffix) 661 665 { 662 Info FunctionInfo(__func__);663 666 // 4. Store triangles in tecplot file 664 667 if (filename != NULL) { … … 668 671 OutputName.append(TecplotSuffix); 669 672 ofstream *tecplot = new ofstream(OutputName.c_str()); 670 WriteTecplotFile(tecplot, TesselStruct, mol, -1);673 WriteTecplotFile(tecplot, TesselStruct, mol, 0); 671 674 tecplot->close(); 672 675 delete(tecplot); … … 695 698 void PrepareClustersinWater(config *configuration, molecule *mol, double ClusterVolume, double celldensity) 696 699 { 697 Info FunctionInfo(__func__);698 700 bool IsAngstroem = true; 699 701 double *GreatestDiameter = NULL; … … 796 798 molecule * FillBoxWithMolecule(MoleculeListClass *List, molecule *filler, config &configuration, double distance[NDIM], double RandomAtomDisplacement, double RandomMolDisplacement, bool DoRandomRotation) 797 799 { 798 Info FunctionInfo(__func__);799 800 molecule *Filling = new molecule(filler->elemente); 800 801 Vector CurrentPosition; … … 813 814 double phi[NDIM]; 814 815 class Tesselation *TesselStruct[List->ListOfMolecules.size()]; 816 817 Log() << Verbose(0) << "Begin of FillBoxWithMolecule" << endl; 815 818 816 819 i=0; … … 874 877 for (int i=0;i<NDIM;i++) 875 878 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; 877 880 878 881 // go through all atoms … … 935 938 delete(TesselStruct[i]); 936 939 } 940 Log() << Verbose(0) << "End of FillBoxWithMolecule" << endl; 941 937 942 return Filling; 938 943 }; … … 946 951 * \param RADIUS radius of the virtual sphere 947 952 * \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 */ 954 void FindNonConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LCList, const double RADIUS, const char *filename = NULL) 951 955 { 952 Info FunctionInfo(__func__);953 956 bool freeLC = false; 954 bool status = false; 955 CandidateForTesselation *baseline; 957 LineMap::iterator baseline; 956 958 LineMap::iterator testline; 957 bool OneLoopWithoutSuccessFlag = true; // marks whether we went once through all baselines without finding any without two triangles959 bool OneLoopWithoutSuccessFlag = false; // marks whether we went once through all baselines without finding any without two triangles 958 960 bool TesselationFailFlag = false; 959 BoundaryTriangleSet *T = NULL; 960 961 962 Log() << Verbose(1) << "Entering search for non convex hull. " << endl; 961 963 if (TesselStruct == NULL) { 962 964 Log() << Verbose(1) << "Allocating Tesselation struct ..." << endl; … … 968 970 } 969 971 972 Log() << Verbose(0) << "Begin of FindNonConvexBorder\n"; 973 970 974 // initialise Linked Cell 971 975 if (LCList == NULL) { … … 978 982 979 983 // 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 } 992 1000 } 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; 1006 1005 } 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 1009 1016 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); 1026 1025 // mol->GoToFirst(); 1027 1026 // class TesselPoint *Runner = NULL; … … 1038 1037 // } 1039 1038 1040 //// Purges surplus triangles.1041 //TesselStruct->RemoveDegeneratedTriangles();1039 // Purges surplus triangles. 1040 TesselStruct->RemoveDegeneratedTriangles(); 1042 1041 1043 1042 // 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); 1054 1044 1055 1045 // write final envelope … … 1059 1049 if (freeLC) 1060 1050 delete(LCList); 1061 1062 return status; 1051 Log() << Verbose(0) << "End of FindNonConvexBorder\n"; 1063 1052 }; 1064 1053 … … 1072 1061 Vector* FindEmbeddingHole(MoleculeListClass *mols, molecule *srcmol) 1073 1062 { 1074 Info FunctionInfo(__func__);1075 1063 Vector *Center = new Vector; 1076 1064 Center->Zero();
Note:
See TracChangeset
for help on using the changeset viewer.