Changes in src/boundary.cpp [7f4bee:4fc93f]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/boundary.cpp
r7f4bee r4fc93f 10 10 #include "element.hpp" 11 11 #include "helpers.hpp" 12 #include "info.hpp" 12 13 #include "linkedcell.hpp" 13 14 #include "log.hpp" … … 33 34 double *GetDiametersOfCluster(const Boundaries *BoundaryPtr, const molecule *mol, Tesselation *&TesselStruct, const bool IsAngstroem) 34 35 { 36 Info FunctionInfo(__func__); 35 37 // get points on boundary of NULL was given as parameter 36 38 bool BoundaryFreeFlag = false; … … 53 55 } else { 54 56 BoundaryPoints = BoundaryPtr; 55 Log() << Verbose( 1) << "Using given boundary points set." << endl;57 Log() << Verbose(0) << "Using given boundary points set." << endl; 56 58 } 57 59 // determine biggest "diameter" of cluster for each axis … … 67 69 //Log() << Verbose(1) << "Current component is " << component << ", Othercomponent is " << Othercomponent << "." << endl; 68 70 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; 70 72 // seek for the neighbours pair where the Othercomponent sign flips 71 73 Neighbour = runner; … … 82 84 DistanceVector.CopyVector(&runner->second.second->x); 83 85 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; 85 87 } while ((runner != Neighbour) && (fabs(OldComponent / fabs( 86 88 OldComponent) - DistanceVector.x[Othercomponent] / fabs( … … 91 93 OtherNeighbour = BoundaryPoints[axis].end(); 92 94 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; 94 96 // now we have found the pair: Neighbour and OtherNeighbour 95 97 OtherVector.CopyVector(&runner->second.second->x); 96 98 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; 99 101 // do linear interpolation between points (is exact) to extract exact intersection between Neighbour and OtherNeighbour 100 102 w1 = fabs(OtherVector.x[Othercomponent]); … … 103 105 * OtherVector.x[component]) / (w1 + w2)); 104 106 // 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; 106 108 GreatestDiameter[component] = (GreatestDiameter[component] 107 109 > tmp) ? GreatestDiameter[component] : tmp; 108 110 } //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; 110 112 } 111 113 } … … 135 137 Boundaries *GetBoundaryPoints(const molecule *mol, Tesselation *&TesselStruct) 136 138 { 139 Info FunctionInfo(__func__); 137 140 atom *Walker = NULL; 138 141 PointMap PointsOnBoundary; … … 149 152 double angle = 0.; 150 153 151 Log() << Verbose(1) << "Finding all boundary points." << endl;152 154 // 3a. Go through every axis 153 155 for (int axis = 0; axis < NDIM; axis++) { … … 176 178 angle = 0.; // otherwise it's a vector in Axis Direction and unimportant for boundary issues 177 179 178 //Log() << Verbose( 0) << "Checking sign in quadrant : " << ProjectedVector.Projection(&AngleReferenceNormalVector) << "." << endl;180 //Log() << Verbose(1) << "Checking sign in quadrant : " << ProjectedVector.Projection(&AngleReferenceNormalVector) << "." << endl; 179 181 if (ProjectedVector.ScalarProduct(&AngleReferenceNormalVector) > 0) { 180 182 angle = 2. * M_PI - angle; 181 183 } 182 Log() << Verbose( 2) << "Inserting " << *Walker << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl;184 Log() << Verbose(1) << "Inserting " << *Walker << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl; 183 185 BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, DistancePair (radius, Walker))); 184 186 if (!BoundaryTestPair.second) { // same point exists, check first r, then distance of original vectors to center of gravity … … 210 212 // printing all inserted for debugging 211 213 // { 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; 213 215 // int i=0; 214 216 // for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) { … … 249 251 SideA.SubtractVector(MolCenter); 250 252 SideA.ProjectOntoPlane(&AxisVector); 251 // Log() << Verbose(0) << "SideA: "; 252 // SideA.Output(out); 253 // Log() << Verbose(0) << endl; 253 // Log() << Verbose(1) << "SideA: " << SideA << endl; 254 254 255 255 SideB.CopyVector(&right->second.second->x); 256 256 SideB.SubtractVector(MolCenter); 257 257 SideB.ProjectOntoPlane(&AxisVector); 258 // Log() << Verbose(0) << "SideB: "; 259 // SideB.Output(out); 260 // Log() << Verbose(0) << endl; 258 // Log() << Verbose(1) << "SideB: " << SideB << endl; 261 259 262 260 SideC.CopyVector(&left->second.second->x); 263 261 SideC.SubtractVector(&right->second.second->x); 264 262 SideC.ProjectOntoPlane(&AxisVector); 265 // Log() << Verbose(0) << "SideC: "; 266 // SideC.Output(out); 267 // Log() << Verbose(0) << endl; 263 // Log() << Verbose(1) << "SideC: " << SideC << endl; 268 264 269 265 SideH.CopyVector(&runner->second.second->x); 270 266 SideH.SubtractVector(MolCenter); 271 267 SideH.ProjectOntoPlane(&AxisVector); 272 // Log() << Verbose(0) << "SideH: "; 273 // SideH.Output(out); 274 // Log() << Verbose(0) << endl; 268 // Log() << Verbose(1) << "SideH: " << SideH << endl; 275 269 276 270 // calculate each length … … 285 279 const double delta = SideC.Angle(&SideH); 286 280 const double MinDistance = a * sin(beta) / (sin(delta)) * (((alpha < M_PI / 2.) || (gamma < M_PI / 2.)) ? 1. : -1.); 287 //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; 288 282 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; 289 283 if ((fabs(h / fabs(h) - MinDistance / fabs(MinDistance)) < MYEPSILON) && ((h - MinDistance)) < -MYEPSILON) { … … 311 305 void FindConvexBorder(const molecule* mol, Tesselation *&TesselStruct, const LinkedCell *LCList, const char *filename) 312 306 { 307 Info FunctionInfo(__func__); 313 308 bool BoundaryFreeFlag = false; 314 309 Boundaries *BoundaryPoints = NULL; 315 316 Log() << Verbose(1) << "Begin of FindConvexBorder" << endl;317 310 318 311 if (TesselStruct != NULL) // free if allocated … … 325 318 BoundaryPoints = GetBoundaryPoints(mol, TesselStruct); 326 319 } else { 327 Log() << Verbose( 1) << "Using given boundary points set." << endl;320 Log() << Verbose(0) << "Using given boundary points set." << endl; 328 321 } 329 322 … … 331 324 for (int axis=0; axis < NDIM; axis++) 332 325 { 333 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; 334 327 int i=0; 335 328 for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) { … … 347 340 for (Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) 348 341 if (!TesselStruct->AddBoundaryPoint(runner->second.second, 0)) 349 Log() << Verbose(3) << "WARNING:Point " << *(runner->second.second) << " is already present!" << endl;350 351 Log() << Verbose( 2) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl;342 eLog() << Verbose(2) << "Point " << *(runner->second.second) << " is already present!" << endl; 343 344 Log() << Verbose(0) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl; 352 345 // now we have the whole set of edge points in the BoundaryList 353 346 … … 367 360 // 3c. check whether all atoms lay inside the boundary, if not, add to boundary points, segment triangle into three with the new point 368 361 if (!TesselStruct->InsertStraddlingPoints(mol, LCList)) 369 Log() << Verbose(1) << "Insertion of straddling points failed!" << endl;370 371 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; 372 365 373 366 // 4. Store triangles in tecplot file … … 406 399 // flip the line 407 400 if (TesselStruct->PickFarthestofTwoBaselines(line) == 0.) 408 Log() << Verbose(1) << "ERROR:Correction of concave baselines failed!" << endl;401 eLog() << Verbose(1) << "Correction of concave baselines failed!" << endl; 409 402 else { 410 403 TesselStruct->FlipBaseline(line); … … 419 412 // Log() << Verbose(1) << "Correction of concave tesselpoints failed!" << endl; 420 413 421 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; 422 415 423 416 // 4. Store triangles in tecplot file … … 445 438 if (BoundaryFreeFlag) 446 439 delete[] (BoundaryPoints); 447 448 Log() << Verbose(1) << "End of FindConvexBorder" << endl;449 440 }; 450 441 … … 458 449 bool RemoveAllBoundaryPoints(class Tesselation *&TesselStruct, const molecule * const mol, const char * const filename) 459 450 { 451 Info FunctionInfo(__func__); 460 452 int i=0; 461 453 char number[MAXSTRINGSIZE]; 462 454 463 455 if ((TesselStruct == NULL) || (TesselStruct->PointsOnBoundary.empty())) { 464 Log() << Verbose(2) << "ERROR:TesselStruct is empty." << endl;456 eLog() << Verbose(1) << "TesselStruct is empty." << endl; 465 457 return false; 466 458 } … … 468 460 PointMap::iterator PointRunner; 469 461 while (!TesselStruct->PointsOnBoundary.empty()) { 470 Log() << Verbose( 2) << "Remaining points are: ";462 Log() << Verbose(1) << "Remaining points are: "; 471 463 for (PointMap::iterator PointSprinter = TesselStruct->PointsOnBoundary.begin(); PointSprinter != TesselStruct->PointsOnBoundary.end(); PointSprinter++) 472 464 Log() << Verbose(0) << *(PointSprinter->second) << "\t"; … … 511 503 double ConvexizeNonconvexEnvelope(class Tesselation *&TesselStruct, const molecule * const mol, const char * const filename) 512 504 { 505 Info FunctionInfo(__func__); 513 506 double volume = 0; 514 507 class BoundaryPointSet *point = NULL; … … 524 517 int run = 0; 525 518 526 Log() << Verbose(0) << "Begin of ConvexizeNonconvexEnvelope" << endl;527 528 519 // check whether there is something to work on 529 520 if (TesselStruct == NULL) { 530 Log() << Verbose(1) << "ERROR:TesselStruct is empty!" << endl;521 eLog() << Verbose(1) << "TesselStruct is empty!" << endl; 531 522 return volume; 532 523 } … … 547 538 for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) { 548 539 line = LineRunner->second; 549 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; 550 541 if (!line->CheckConvexityCriterion()) { 551 542 // remove the point if needed … … 612 603 613 604 // end 614 Log() << Verbose(1) << "Volume is " << volume << "." << endl; 615 Log() << Verbose(0) << "End of ConvexizeNonconvexEnvelope" << endl; 605 Log() << Verbose(0) << "Volume is " << volume << "." << endl; 616 606 return volume; 617 607 }; … … 627 617 double VolumeOfConvexEnvelope(class Tesselation *TesselStruct, class config *configuration) 628 618 { 619 Info FunctionInfo(__func__); 629 620 bool IsAngstroem = configuration->GetIsAngstroem(); 630 621 double volume = 0.; … … 633 624 634 625 // 6a. Every triangle forms a pyramid with the center of gravity as its peak, sum up the volumes 635 Log() << Verbose(1)636 << "Calculating the volume of the pyramids formed out of triangles and center of gravity."637 << endl;638 626 for (TriangleMap::iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++) 639 627 { // go through every triangle, calculate volume of its pyramid with CoG as peak … … 650 638 const double h = x.Norm(); // distance of CoG to triangle 651 639 const double PyramidVolume = (1. / 3.) * G * h; // this formula holds for _all_ pyramids (independent of n-edge base or (not) centered peak) 652 Log() << Verbose( 2) << "Area of triangle is " << setprecision(10) << G << " "640 Log() << Verbose(1) << "Area of triangle is " << setprecision(10) << G << " " 653 641 << (IsAngstroem ? "angstrom" : "atomiclength") << "^2, height is " 654 642 << h << " and the volume is " << PyramidVolume << " " … … 672 660 void StoreTrianglesinFile(const molecule * const mol, const Tesselation *&TesselStruct, const char *filename, const char *extraSuffix) 673 661 { 662 Info FunctionInfo(__func__); 674 663 // 4. Store triangles in tecplot file 675 664 if (filename != NULL) { … … 679 668 OutputName.append(TecplotSuffix); 680 669 ofstream *tecplot = new ofstream(OutputName.c_str()); 681 WriteTecplotFile(tecplot, TesselStruct, mol, 0);670 WriteTecplotFile(tecplot, TesselStruct, mol, -1); 682 671 tecplot->close(); 683 672 delete(tecplot); … … 706 695 void PrepareClustersinWater(config *configuration, molecule *mol, double ClusterVolume, double celldensity) 707 696 { 697 Info FunctionInfo(__func__); 708 698 bool IsAngstroem = true; 709 699 double *GreatestDiameter = NULL; … … 756 746 Log() << Verbose(1) << "Minimum volume of the convex envelope contained in a rectangular box is " << minimumvolume << " atomicmassunit/" << (IsAngstroem ? "angstrom" : "atomiclength") << "^3." << endl; 757 747 if (minimumvolume > cellvolume) { 758 eLog() << Verbose( 0) << "ERROR:the containing box already has a greater volume than the envisaged cell volume!" << endl;748 eLog() << Verbose(1) << "the containing box already has a greater volume than the envisaged cell volume!" << endl; 759 749 Log() << Verbose(0) << "Setting Box dimensions to minimum possible, the greatest diameters." << endl; 760 750 for (int i = 0; i < NDIM; i++) … … 806 796 molecule * FillBoxWithMolecule(MoleculeListClass *List, molecule *filler, config &configuration, double distance[NDIM], double RandomAtomDisplacement, double RandomMolDisplacement, bool DoRandomRotation) 807 797 { 798 Info FunctionInfo(__func__); 808 799 molecule *Filling = new molecule(filler->elemente); 809 800 Vector CurrentPosition; … … 823 814 class Tesselation *TesselStruct[List->ListOfMolecules.size()]; 824 815 825 Log() << Verbose(0) << "Begin of FillBoxWithMolecule" << endl;826 827 816 i=0; 828 817 for (MoleculeList::iterator ListRunner = List->ListOfMolecules.begin(); ListRunner != List->ListOfMolecules.end(); ListRunner++) { … … 849 838 for(int i=0;i<NDIM;i++) { 850 839 N[i] = (int) ceil(1./FillerDistance.x[i]); 851 Log() << Verbose( 0) << N[i];840 Log() << Verbose(1) << N[i]; 852 841 if (i != NDIM-1) 853 Log() << Verbose( 0)<< ", ";842 Log() << Verbose(1)<< ", "; 854 843 else 855 Log() << Verbose( 0) << "." << endl;844 Log() << Verbose(1) << "." << endl; 856 845 } 857 846 … … 870 859 // get linked cell list 871 860 if (TesselStruct[i] == NULL) { 872 Log() << Verbose(1) << "ERROR:TesselStruct of " << (*ListRunner) << " is NULL. Didn't we pre-create it?" << endl;861 eLog() << Verbose(1) << "TesselStruct of " << (*ListRunner) << " is NULL. Didn't we pre-create it?" << endl; 873 862 FillIt = false; 874 863 } else { … … 885 874 for (int i=0;i<NDIM;i++) 886 875 FillerTranslations.x[i] = RandomMolDisplacement*(rand()/(RAND_MAX/2.) - 1.); 887 Log() << Verbose( 3) << "INFO: Translating this filler by " << FillerTranslations << "." << endl;876 Log() << Verbose(2) << "INFO: Translating this filler by " << FillerTranslations << "." << endl; 888 877 889 878 // go through all atoms … … 946 935 delete(TesselStruct[i]); 947 936 } 948 Log() << Verbose(0) << "End of FillBoxWithMolecule" << endl;949 950 937 return Filling; 951 938 }; … … 959 946 * \param RADIUS radius of the virtual sphere 960 947 * \param *filename filename prefix for output of vertex data 961 */ 962 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 */ 950 bool FindNonConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LCList, const double RADIUS, const char *filename = NULL) 963 951 { 952 Info FunctionInfo(__func__); 964 953 bool freeLC = false; 965 LineMap::iterator baseline; 954 bool status = false; 955 CandidateForTesselation *baseline; 966 956 LineMap::iterator testline; 967 bool OneLoopWithoutSuccessFlag = false; // marks whether we went once through all baselines without finding any without two triangles957 bool OneLoopWithoutSuccessFlag = true; // marks whether we went once through all baselines without finding any without two triangles 968 958 bool TesselationFailFlag = false; 969 970 Log() << Verbose(1) << "Entering search for non convex hull. " << endl; 959 BoundaryTriangleSet *T = NULL; 960 971 961 if (TesselStruct == NULL) { 972 962 Log() << Verbose(1) << "Allocating Tesselation struct ..." << endl; … … 978 968 } 979 969 980 Log() << Verbose(0) << "Begin of FindNonConvexBorder\n";981 982 970 // initialise Linked Cell 983 971 if (LCList == NULL) { … … 990 978 991 979 // 2. expand from there 992 baseline = TesselStruct->LinesOnBoundary.begin(); 993 baseline++; // skip first line 994 while ((baseline != TesselStruct->LinesOnBoundary.end()) || (OneLoopWithoutSuccessFlag)) { 995 if (baseline->second->triangles.size() == 1) { 996 // 3. find next triangle 997 TesselationFailFlag = TesselStruct->FindNextSuitableTriangle(*(baseline->second), *(((baseline->second->triangles.begin()))->second), RADIUS, LCList); //the line is there, so there is a triangle, but only one. 998 OneLoopWithoutSuccessFlag = OneLoopWithoutSuccessFlag || TesselationFailFlag; 999 if (!TesselationFailFlag) 1000 eLog() << Verbose(0) << "WARNING: FindNextSuitableTriangle failed." << endl; 1001 1002 // write temporary envelope 1003 if (filename != NULL) { 1004 if ((DoSingleStepOutput && ((TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration 1005 TesselStruct->Output(filename, mol); 1006 } 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. 1007 992 } 1008 baseline = TesselStruct->LinesOnBoundary.end(); 1009 Log() << Verbose(2) << "Baseline set to end." << endl; 1010 } else { 1011 //Log() << Verbose(1) << "Line " << *baseline->second << " has " << baseline->second->triangles.size() << " triangles adjacent" << endl; 1012 if (baseline->second->triangles.size() != 2) 1013 Log() << Verbose(1) << "ERROR: TESSELATION FINISHED WITH INVALID TRIANGLE COUNT!" << endl; 1014 } 1015 1016 if ((baseline == TesselStruct->LinesOnBoundary.end()) && (OneLoopWithoutSuccessFlag)) { 1017 baseline = TesselStruct->LinesOnBoundary.begin(); // restart if we reach end due to newly inserted lines 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; 1006 } 1007 } 1008 if ((ShortestAngle == 4.*M_PI) || (baseline->pointlist.empty())) 1018 1009 OneLoopWithoutSuccessFlag = false; 1019 } 1020 baseline++; 1021 } 1022 // check envelope for consistency 1023 CheckListOfBaselines(TesselStruct); 1024 1025 // look whether all points are inside of the convex envelope, otherwise add them via degenerated triangles 1026 //->InsertStraddlingPoints(mol, LCList); 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); 1027 1026 // mol->GoToFirst(); 1028 1027 // class TesselPoint *Runner = NULL; … … 1039 1038 // } 1040 1039 1041 // Purges surplus triangles.1042 TesselStruct->RemoveDegeneratedTriangles();1040 // // Purges surplus triangles. 1041 // TesselStruct->RemoveDegeneratedTriangles(); 1043 1042 1044 1043 // check envelope for consistency 1045 CheckListOfBaselines(TesselStruct);1044 status = CheckListOfBaselines(TesselStruct); 1046 1045 1047 1046 // write final envelope … … 1051 1050 if (freeLC) 1052 1051 delete(LCList); 1053 Log() << Verbose(0) << "End of FindNonConvexBorder\n"; 1052 1053 return status; 1054 1054 }; 1055 1055 … … 1063 1063 Vector* FindEmbeddingHole(MoleculeListClass *mols, molecule *srcmol) 1064 1064 { 1065 Info FunctionInfo(__func__); 1065 1066 Vector *Center = new Vector; 1066 1067 Center->Zero();
Note:
See TracChangeset
for help on using the changeset viewer.