Changeset 1cf5df
- Timestamp:
- Dec 17, 2009, 5:52:45 PM (15 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 1ca488, 3930eb
- Parents:
- ebbd3d (diff), 73b510 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 4 added
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Makefile.am
rebbd3d r1cf5df 5 5 ANALYSISHEADER = analysis_bonds.hpp analysis_correlation.hpp 6 6 7 SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp leastsquaremin.cpp linkedcell.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp8 HEADER = ${ANALYSISHEADER} ${ATOMHEADER} bond.hpp bondgraph.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp errorlogger.hpp graph.hpp helpers.hpp leastsquaremin.hpp linkedcell.hpp lists.hpp log.hpp logger.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp7 SOURCE = ${ANALYSISSOURCE} ${ATOMSOURCE} bond.cpp bondgraph.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp errorlogger.cpp graph.cpp helpers.cpp info.cpp leastsquaremin.cpp linkedcell.cpp log.cpp logger.cpp memoryusageobserver.cpp moleculelist.cpp molecule.cpp molecule_dynamics.cpp molecule_fragmentation.cpp molecule_geometry.cpp molecule_graph.cpp molecule_pointcloud.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp 8 HEADER = ${ANALYSISHEADER} ${ATOMHEADER} bond.hpp bondgraph.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp errorlogger.hpp graph.hpp helpers.hpp info.hpp leastsquaremin.hpp linkedcell.hpp lists.hpp log.hpp logger.hpp memoryallocator.hpp memoryusageobserver.hpp molecule.hpp molecule_template.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp 9 9 10 10 BOOST_LIB = $(BOOST_LDFLAGS) $(BOOST_MPL_LIB) … … 25 25 26 26 #EXTRA_DIST = ${molecuilder_DATA} 27 28 FORCE: 29 $(srcdir)/.git-version: FORCE 30 @if (test -d $(top_srcdir)/../.git && cd $(srcdir) && git describe HEAD) > .git-version-t 2>/dev/null \ 31 && ! diff .git-version-t $(srcdir)/.git-version >/dev/null 2>&1; then \ 32 mv -f .git-version-t $(srcdir)/.git-version; \ 33 else \ 34 rm -f .git-version-t; \ 35 fi 36 37 EXTRA_DIST = $(srcdir)/.git-version 38 39 $(srcdir)/version.c: $(srcdir)/.git-version 40 echo "const char *ESPACKVersion = \"$(PACKAGE_NAME) -- git version: "`cat $(srcdir)/.git-version`"\";" > $@ 41 42 molecuilder_SOURCES += $(srcdir)/version.c -
src/bondgraph.cpp
rebbd3d r1cf5df 35 35 /** Parses the bond lengths in a given file and puts them int a matrix form. 36 36 * Allocates \a MatrixContainer for BondGraph::BondLengthMatrix, using MatrixContainer::ParseMatrix(), 37 * but only if parsing is successful l. Otherwise variable is left as NULL.37 * but only if parsing is successful. Otherwise variable is left as NULL. 38 38 * \param *out output stream for debugging 39 39 * \param filename file with bond lengths to parse -
src/boundary.cpp
rebbd3d r1cf5df 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( 2) << "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++) { 215 217 // if (runner != BoundaryPoints[axis].begin()) 216 // Log() << Verbose( 2) << ", " << i << ": " << *runner->second.second;218 // Log() << Verbose(0) << ", " << i << ": " << *runner->second.second; 217 219 // else 218 // Log() << Verbose( 2) << i << ": " << *runner->second.second;220 // Log() << Verbose(0) << i << ": " << *runner->second.second; 219 221 // i++; 220 222 // } 221 // Log() << Verbose( 2) << endl;223 // Log() << Verbose(0) << endl; 222 224 // } 223 225 // 3c. throw out points whose distance is less than the mean of left and right neighbours … … 249 251 SideA.SubtractVector(MolCenter); 250 252 SideA.ProjectOntoPlane(&AxisVector); 251 // Log() << Verbose( 0) << "SideA: " << SideA << endl;253 // Log() << Verbose(1) << "SideA: " << SideA << endl; 252 254 253 255 SideB.CopyVector(&right->second.second->x); 254 256 SideB.SubtractVector(MolCenter); 255 257 SideB.ProjectOntoPlane(&AxisVector); 256 // Log() << Verbose( 0) << "SideB: " << SideB << endl;258 // Log() << Verbose(1) << "SideB: " << SideB << endl; 257 259 258 260 SideC.CopyVector(&left->second.second->x); 259 261 SideC.SubtractVector(&right->second.second->x); 260 262 SideC.ProjectOntoPlane(&AxisVector); 261 // Log() << Verbose( 0) << "SideC: " << SideC << endl;263 // Log() << Verbose(1) << "SideC: " << SideC << endl; 262 264 263 265 SideH.CopyVector(&runner->second.second->x); 264 266 SideH.SubtractVector(MolCenter); 265 267 SideH.ProjectOntoPlane(&AxisVector); 266 // Log() << Verbose( 0) << "SideH: " << SideH << endl;268 // Log() << Verbose(1) << "SideH: " << SideH << endl; 267 269 268 270 // calculate each length … … 277 279 const double delta = SideC.Angle(&SideH); 278 280 const double MinDistance = a * sin(beta) / (sin(delta)) * (((alpha < M_PI / 2.) || (gamma < M_PI / 2.)) ? 1. : -1.); 279 //Log() << Verbose( 2) << " I calculated: a = " << a << ", h = " << h << ", beta(" << left->second.second->Name << "," << left->second.second->Name << "-" << right->second.second->Name << ") = " << beta << ", delta(" << left->second.second->Name << "," << runner->second.second->Name << ") = " << delta << ", Min = " << MinDistance << "." << endl;281 //Log() << Verbose(1) << " I calculated: a = " << a << ", h = " << h << ", beta(" << left->second.second->Name << "," << left->second.second->Name << "-" << right->second.second->Name << ") = " << beta << ", delta(" << left->second.second->Name << "," << runner->second.second->Name << ") = " << delta << ", Min = " << MinDistance << "." << endl; 280 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; 281 283 if ((fabs(h / fabs(h) - MinDistance / fabs(MinDistance)) < MYEPSILON) && ((h - MinDistance)) < -MYEPSILON) { … … 303 305 void FindConvexBorder(const molecule* mol, Tesselation *&TesselStruct, const LinkedCell *LCList, const char *filename) 304 306 { 307 Info FunctionInfo(__func__); 305 308 bool BoundaryFreeFlag = false; 306 309 Boundaries *BoundaryPoints = NULL; 307 308 Log() << Verbose(1) << "Begin of FindConvexBorder" << endl;309 310 310 311 if (TesselStruct != NULL) // free if allocated … … 317 318 BoundaryPoints = GetBoundaryPoints(mol, TesselStruct); 318 319 } else { 319 Log() << Verbose( 1) << "Using given boundary points set." << endl;320 Log() << Verbose(0) << "Using given boundary points set." << endl; 320 321 } 321 322 … … 323 324 for (int axis=0; axis < NDIM; axis++) 324 325 { 325 Log() << Verbose( 2) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl;326 Log() << Verbose(1) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl; 326 327 int i=0; 327 328 for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) { 328 329 if (runner != BoundaryPoints[axis].begin()) 329 Log() << Verbose( 2) << ", " << i << ": " << *runner->second.second;330 Log() << Verbose(0) << ", " << i << ": " << *runner->second.second; 330 331 else 331 Log() << Verbose( 2) << i << ": " << *runner->second.second;332 Log() << Verbose(0) << i << ": " << *runner->second.second; 332 333 i++; 333 334 } 334 Log() << Verbose( 2) << endl;335 Log() << Verbose(0) << endl; 335 336 } 336 337 … … 341 342 eLog() << Verbose(2) << "Point " << *(runner->second.second) << " is already present!" << endl; 342 343 343 Log() << Verbose( 2) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl;344 Log() << Verbose(0) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl; 344 345 // now we have the whole set of edge points in the BoundaryList 345 346 … … 347 348 // Log() << Verbose(1) << "Listing PointsOnBoundary:"; 348 349 // for(PointMap::iterator runner = PointsOnBoundary.begin(); runner != PointsOnBoundary.end(); runner++) { 349 // Log() << Verbose( 1) << " " << *runner->second;350 // Log() << Verbose(0) << " " << *runner->second; 350 351 // } 351 // Log() << Verbose( 1) << endl;352 // Log() << Verbose(0) << endl; 352 353 353 354 // 3a. guess starting triangle … … 359 360 // 3c. check whether all atoms lay inside the boundary, if not, add to boundary points, segment triangle into three with the new point 360 361 if (!TesselStruct->InsertStraddlingPoints(mol, LCList)) 361 Log() << Verbose(1) << "Insertion of straddling points failed!" << endl;362 363 Log() << Verbose( 2) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " intermediate triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl;362 eLog() << Verbose(1) << "Insertion of straddling points failed!" << endl; 363 364 Log() << Verbose(0) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " intermediate triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl; 364 365 365 366 // 4. Store triangles in tecplot file … … 411 412 // Log() << Verbose(1) << "Correction of concave tesselpoints failed!" << endl; 412 413 413 Log() << Verbose( 2) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl;414 Log() << Verbose(0) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl; 414 415 415 416 // 4. Store triangles in tecplot file … … 437 438 if (BoundaryFreeFlag) 438 439 delete[] (BoundaryPoints); 439 440 Log() << Verbose(1) << "End of FindConvexBorder" << endl;441 440 }; 442 441 … … 450 449 bool RemoveAllBoundaryPoints(class Tesselation *&TesselStruct, const molecule * const mol, const char * const filename) 451 450 { 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( 2) << "Remaining points are: ";462 Log() << Verbose(1) << "Remaining points are: "; 463 463 for (PointMap::iterator PointSprinter = TesselStruct->PointsOnBoundary.begin(); PointSprinter != TesselStruct->PointsOnBoundary.end(); PointSprinter++) 464 Log() << Verbose( 2) << *(PointSprinter->second) << "\t";465 Log() << Verbose( 2) << endl;464 Log() << Verbose(0) << *(PointSprinter->second) << "\t"; 465 Log() << Verbose(0) << endl; 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__); 505 506 double volume = 0; 506 507 class BoundaryPointSet *point = NULL; … … 516 517 int run = 0; 517 518 518 Log() << Verbose(0) << "Begin of ConvexizeNonconvexEnvelope" << endl;519 520 519 // check whether there is something to work on 521 520 if (TesselStruct == NULL) { … … 539 538 for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) { 540 539 line = LineRunner->second; 541 Log() << Verbose( 2) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;540 Log() << Verbose(1) << "INFO: Current line of point " << *point << " is " << *line << "." << endl; 542 541 if (!line->CheckConvexityCriterion()) { 543 542 // remove the point if needed … … 604 603 605 604 // end 606 Log() << Verbose(1) << "Volume is " << volume << "." << endl; 607 Log() << Verbose(0) << "End of ConvexizeNonconvexEnvelope" << endl; 605 Log() << Verbose(0) << "Volume is " << volume << "." << endl; 608 606 return volume; 609 607 }; … … 619 617 double VolumeOfConvexEnvelope(class Tesselation *TesselStruct, class config *configuration) 620 618 { 619 Info FunctionInfo(__func__); 621 620 bool IsAngstroem = configuration->GetIsAngstroem(); 622 621 double volume = 0.; … … 625 624 626 625 // 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;630 626 for (TriangleMap::iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++) 631 627 { // go through every triangle, calculate volume of its pyramid with CoG as peak … … 642 638 const double h = x.Norm(); // distance of CoG to triangle 643 639 const double PyramidVolume = (1. / 3.) * G * h; // this formula holds for _all_ pyramids (independent of n-edge base or (not) centered peak) 644 Log() << Verbose( 2) << "Area of triangle is " << setprecision(10) << G << " "640 Log() << Verbose(1) << "Area of triangle is " << setprecision(10) << G << " " 645 641 << (IsAngstroem ? "angstrom" : "atomiclength") << "^2, height is " 646 642 << h << " and the volume is " << PyramidVolume << " " … … 664 660 void StoreTrianglesinFile(const molecule * const mol, const Tesselation *&TesselStruct, const char *filename, const char *extraSuffix) 665 661 { 662 Info FunctionInfo(__func__); 666 663 // 4. Store triangles in tecplot file 667 664 if (filename != NULL) { … … 698 695 void PrepareClustersinWater(config *configuration, molecule *mol, double ClusterVolume, double celldensity) 699 696 { 697 Info FunctionInfo(__func__); 700 698 bool IsAngstroem = true; 701 699 double *GreatestDiameter = NULL; … … 798 796 molecule * FillBoxWithMolecule(MoleculeListClass *List, molecule *filler, config &configuration, double distance[NDIM], double RandomAtomDisplacement, double RandomMolDisplacement, bool DoRandomRotation) 799 797 { 798 Info FunctionInfo(__func__); 800 799 molecule *Filling = new molecule(filler->elemente); 801 800 Vector CurrentPosition; … … 814 813 double phi[NDIM]; 815 814 class Tesselation *TesselStruct[List->ListOfMolecules.size()]; 816 817 Log() << Verbose(0) << "Begin of FillBoxWithMolecule" << endl;818 815 819 816 i=0; … … 877 874 for (int i=0;i<NDIM;i++) 878 875 FillerTranslations.x[i] = RandomMolDisplacement*(rand()/(RAND_MAX/2.) - 1.); 879 Log() << Verbose( 3) << "INFO: Translating this filler by " << FillerTranslations << "." << endl;876 Log() << Verbose(2) << "INFO: Translating this filler by " << FillerTranslations << "." << endl; 880 877 881 878 // go through all atoms … … 938 935 delete(TesselStruct[i]); 939 936 } 940 Log() << Verbose(0) << "End of FillBoxWithMolecule" << endl;941 942 937 return Filling; 943 938 }; … … 951 946 * \param RADIUS radius of the virtual sphere 952 947 * \param *filename filename prefix for output of vertex data 953 */ 954 void FindNonConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LCList, const double RADIUS, const char *filename = NULL) 948 * \return true - tesselation successful, false - tesselation failed 949 */ 950 bool FindNonConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LCList, const double RADIUS, const char *filename = NULL) 955 951 { 952 Info FunctionInfo(__func__); 956 953 bool freeLC = false; 957 LineMap::iterator baseline; 954 bool status = false; 955 CandidateForTesselation *baseline; 958 956 LineMap::iterator testline; 959 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 960 958 bool TesselationFailFlag = false; 961 962 Log() << Verbose(1) << "Entering search for non convex hull. " << endl; 959 BoundaryTriangleSet *T = NULL; 960 963 961 if (TesselStruct == NULL) { 964 962 Log() << Verbose(1) << "Allocating Tesselation struct ..." << endl; … … 970 968 } 971 969 972 Log() << Verbose(0) << "Begin of FindNonConvexBorder\n";973 974 970 // initialise Linked Cell 975 971 if (LCList == NULL) { … … 982 978 983 979 // 2. expand from there 984 baseline = TesselStruct->LinesOnBoundary.begin(); 985 baseline++; // skip first line 986 while ((baseline != TesselStruct->LinesOnBoundary.end()) || (OneLoopWithoutSuccessFlag)) { 987 if (baseline->second->triangles.size() == 1) { 988 CheckListOfBaselines(TesselStruct); 989 // 3. find next triangle 990 TesselationFailFlag = TesselStruct->FindNextSuitableTriangle(*(baseline->second), *(((baseline->second->triangles.begin()))->second), RADIUS, LCList); //the line is there, so there is a triangle, but only one. 991 OneLoopWithoutSuccessFlag = OneLoopWithoutSuccessFlag || TesselationFailFlag; 992 if (!TesselationFailFlag) 993 eLog() << Verbose(2) << "FindNextSuitableTriangle failed." << endl; 994 995 // write temporary envelope 996 if (filename != NULL) { 997 if ((DoSingleStepOutput && ((TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration 998 TesselStruct->Output(filename, mol); 999 } 980 while ((!TesselStruct->OpenLines.empty()) && (OneLoopWithoutSuccessFlag)) { 981 // 2a. fill all new OpenLines 982 Log() << Verbose(1) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for candidates:" << endl; 983 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) 984 Log() << Verbose(2) << *(Runner->second) << endl; 985 986 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) { 987 baseline = Runner->second; 988 if (baseline->pointlist.empty()) { 989 T = (((baseline->BaseLine->triangles.begin()))->second); 990 Log() << Verbose(1) << "Finding best candidate for open line " << *baseline->BaseLine << " of triangle " << *T << endl; 991 TesselationFailFlag = TesselStruct->FindNextSuitableTriangle(*baseline, *T, RADIUS, LCList); //the line is there, so there is a triangle, but only one. 1000 992 } 1001 if (TesselationFailFlag) { 1002 baseline = TesselStruct->LinesOnBoundary.begin(); 1003 OneLoopWithoutSuccessFlag = false; 1004 Log() << Verbose(2) << "Baseline set to begin." << endl; 993 } 994 995 // 2b. search for smallest ShortestAngle among all candidates 996 double ShortestAngle = 4.*M_PI; 997 Log() << Verbose(1) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for the best candidates:" << endl; 998 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) 999 Log() << Verbose(2) << *(Runner->second) << endl; 1000 1001 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) { 1002 if (Runner->second->ShortestAngle < ShortestAngle) { 1003 baseline = Runner->second; 1004 ShortestAngle = baseline->ShortestAngle; 1005 //Log() << Verbose(1) << "New best candidate is " << *baseline->BaseLine << " with point " << *baseline->point << " and angle " << baseline->ShortestAngle << endl; 1005 1006 } 1006 } else { 1007 //Log() << Verbose(1) << "Line " << *baseline->second << " has " << baseline->second->triangles.size() << " triangles adjacent" << endl; 1008 if (baseline->second->triangles.size() != 2) { 1009 eLog() << Verbose(0) << "TESSELATION FINISHED WITH INVALID TRIANGLE COUNT!" << endl; 1010 performCriticalExit(); 1007 } 1008 if ((ShortestAngle == 4.*M_PI) || (baseline->pointlist.empty())) 1009 OneLoopWithoutSuccessFlag = false; 1010 else { 1011 TesselStruct->AddCandidateTriangle(*baseline); 1012 } 1013 1014 // write temporary envelope 1015 if (filename != NULL) { 1016 if ((DoSingleStepOutput && ((TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration 1017 TesselStruct->Output(filename, mol); 1011 1018 } 1012 1019 } 1013 1014 if ((baseline == TesselStruct->LinesOnBoundary.end()) && (OneLoopWithoutSuccessFlag)) { 1015 baseline = TesselStruct->LinesOnBoundary.begin(); // restart if we reach end due to newly inserted lines 1016 OneLoopWithoutSuccessFlag = false; 1017 } 1018 baseline++; 1019 } 1020 // check envelope for consistency 1021 CheckListOfBaselines(TesselStruct); 1022 1023 // look whether all points are inside of the convex envelope, otherwise add them via degenerated triangles 1024 //->InsertStraddlingPoints(mol, LCList); 1020 } 1021 // // check envelope for consistency 1022 // status = CheckListOfBaselines(TesselStruct); 1023 // 1024 // // look whether all points are inside of the convex envelope, otherwise add them via degenerated triangles 1025 // //->InsertStraddlingPoints(mol, LCList); 1025 1026 // mol->GoToFirst(); 1026 1027 // class TesselPoint *Runner = NULL; … … 1037 1038 // } 1038 1039 1039 // Purges surplus triangles.1040 TesselStruct->RemoveDegeneratedTriangles();1040 // // Purges surplus triangles. 1041 // TesselStruct->RemoveDegeneratedTriangles(); 1041 1042 1042 1043 // check envelope for consistency 1043 CheckListOfBaselines(TesselStruct); 1044 status = CheckListOfBaselines(TesselStruct); 1045 1046 // store before correction 1047 StoreTrianglesinFile(mol, (const Tesselation *&)TesselStruct, filename, ""); 1048 1049 // correct degenerated polygons 1050 TesselStruct->CorrectAllDegeneratedPolygons(); 1051 1052 // check envelope for consistency 1053 status = CheckListOfBaselines(TesselStruct); 1044 1054 1045 1055 // write final envelope … … 1049 1059 if (freeLC) 1050 1060 delete(LCList); 1051 Log() << Verbose(0) << "End of FindNonConvexBorder\n"; 1061 1062 return status; 1052 1063 }; 1053 1064 … … 1061 1072 Vector* FindEmbeddingHole(MoleculeListClass *mols, molecule *srcmol) 1062 1073 { 1074 Info FunctionInfo(__func__); 1063 1075 Vector *Center = new Vector; 1064 1076 Center->Zero(); -
src/boundary.hpp
rebbd3d r1cf5df 35 35 36 36 #define DEBUG 1 37 #define DoSingleStepOutput 138 #define SingleStepWidth 1 37 #define DoSingleStepOutput 0 38 #define SingleStepWidth 10 39 39 40 40 #define DistancePair pair < double, atom* > … … 53 53 Vector* FindEmbeddingHole(MoleculeListClass *mols, molecule *srcmol); 54 54 void FindNextSuitablePoint(class BoundaryTriangleSet *BaseTriangle, class BoundaryLineSet *BaseLine, atom*& OptCandidate, Vector *OptCandidateCenter, double *ShortestAngle, const double RADIUS, LinkedCell *LC); 55 voidFindNonConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LC, const double RADIUS, const char *tempbasename);55 bool FindNonConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LC, const double RADIUS, const char *tempbasename); 56 56 Boundaries *GetBoundaryPoints(const molecule *mol, Tesselation *&TesselStruct); 57 57 double * GetDiametersOfCluster(const Boundaries *BoundaryPtr, const molecule *mol, Tesselation *&TesselStruct, const bool IsAngstroem); -
src/builder.cpp
rebbd3d r1cf5df 65 65 #include "molecule.hpp" 66 66 #include "periodentafel.hpp" 67 #include "version.h" 67 68 68 69 /********************************************* Subsubmenu routine ************************************/ … … 1574 1575 else { 1575 1576 Log() << Verbose(2) << "File found and parsed." << endl; 1576 mol->SetNameFromFilename(argv[argptr]); 1577 molecules->ListOfMolecules.remove(mol); 1578 molecules->DissectMoleculeIntoConnectedSubgraphs(mol,&configuration); 1579 if (molecules->ListOfMolecules.size() != 0) { 1580 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) 1581 if ((*ListRunner)->ActiveFlag) { 1582 mol = *ListRunner; 1583 break; 1584 } 1585 } 1577 // @TODO rather do the dissection afterwards 1578 // mol->SetNameFromFilename(argv[argptr]); 1579 // molecules->ListOfMolecules.remove(mol); 1580 // molecules->DissectMoleculeIntoConnectedSubgraphs(mol,&configuration); 1581 // delete(mol); 1582 // if (molecules->ListOfMolecules.size() != 0) { 1583 // for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) 1584 // if ((*ListRunner)->ActiveFlag) { 1585 // mol = *ListRunner; 1586 // break; 1587 // } 1588 // } 1586 1589 configPresent = present; 1587 1590 } … … 1802 1805 start = clock(); 1803 1806 LCList = new LinkedCell(Boundary, atof(argv[argptr])*2.); 1804 FindNonConvexBorder(Boundary, T, LCList, atof(argv[argptr]), argv[argptr+1]); 1807 if (!FindNonConvexBorder(Boundary, T, LCList, atof(argv[argptr]), argv[argptr+1])) 1808 ExitFlag = 255; 1805 1809 //FindDistributionOfEllipsoids(T, &LCList, N, number, filename.c_str()); 1806 1810 end = clock(); 1807 1811 Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl; 1808 1812 delete(LCList); 1813 delete(T); 1809 1814 argptr+=2; 1810 1815 } … … 2102 2107 if (volume != -1) 2103 2108 ExitFlag = 255; 2104 eLog() << Verbose(0) << "Not enough arguments given for suspension: -u <density>" << endl;2109 eLog() << Verbose(0) << "Not enough or invalid arguments given for suspension: -u <density>" << endl; 2105 2110 performCriticalExit(); 2106 2111 } else { … … 2218 2223 int j; 2219 2224 2225 cout << ESPACKVersion << endl; 2226 2220 2227 setVerbosity(0); 2221 2228 -
src/config.cpp
rebbd3d r1cf5df 140 140 void ConfigFileBuffer::MapIonTypesInBuffer(const int NoAtoms) 141 141 { 142 map<const char *, int, IonTypeCompare> LineList;142 map<const char *, int, IonTypeCompare> IonTypeLineMap; 143 143 if (LineMapping == NULL) { 144 144 eLog() << Verbose(0) << "map pointer is NULL: " << LineMapping << endl; … … 149 149 // put all into hashed map 150 150 for (int i=0; i<NoAtoms; ++i) { 151 LineList.insert(pair<const char *, int> (buffer[CurrentLine+i], CurrentLine+i));151 IonTypeLineMap.insert(pair<const char *, int> (buffer[CurrentLine+i], CurrentLine+i)); 152 152 } 153 153 154 154 // fill map 155 155 int nr=0; 156 for (map<const char *, int, IonTypeCompare>::iterator runner = LineList.begin(); runner != LineList.end(); ++runner) {156 for (map<const char *, int, IonTypeCompare>::iterator runner = IonTypeLineMap.begin(); runner != IonTypeLineMap.end(); ++runner) { 157 157 if (CurrentLine+nr < NoLines) 158 158 LineMapping[CurrentLine+(nr++)] = runner->second; … … 1069 1069 mol->SetNameFromFilename(filename); 1070 1070 mol->ActiveFlag = true; 1071 MolList->insert(mol); 1071 1072 1072 1073 // 4. dissect the molecule into connected subgraphs 1073 MolList->DissectMoleculeIntoConnectedSubgraphs(mol,this); 1074 1075 delete(mol); 1074 // don't do this here ... 1075 //MolList->DissectMoleculeIntoConnectedSubgraphs(mol,this); 1076 //delete(mol); 1077 1076 1078 delete(FileBuffer); 1077 1079 }; -
src/molecule_graph.cpp
rebbd3d r1cf5df 1117 1117 bool status = true; 1118 1118 if (ReferenceStack->IsEmpty()) { 1119 eLog() << Verbose(0) << "ReferenceStack is empty!" << endl; 1120 performCriticalExit(); 1119 Log() << Verbose(1) << "ReferenceStack is empty!" << endl; 1121 1120 return false; 1122 1121 } -
src/moleculelist.cpp
rebbd3d r1cf5df 402 402 input.open(line.c_str()); 403 403 if (input == NULL) { 404 eLog() << Verbose(0) << endl << "Unable to open " << line << ", is the directory correct?" << endl; 405 performCriticalExit(); 404 Log() << Verbose(1) << endl << "Unable to open " << line << ", is the directory correct?" << endl; 406 405 return false; 407 406 } -
src/parser.cpp
rebbd3d r1cf5df 158 158 //Log() << Verbose(0) << "Opening " << name << " ... " << input << endl; 159 159 if (input == NULL) { 160 eLog() << Verbose( 0) << endl << "Unable to open " << name << ", is the directory correct?" << endl;161 performCriticalExit();160 eLog() << Verbose(1) << endl << "Unable to open " << name << ", is the directory correct?" << endl; 161 //performCriticalExit(); 162 162 return false; 163 163 } -
src/tesselation.cpp
rebbd3d r1cf5df 9 9 10 10 #include "helpers.hpp" 11 #include "info.hpp" 11 12 #include "linkedcell.hpp" 12 13 #include "log.hpp" … … 22 23 /** Constructor of BoundaryPointSet. 23 24 */ 24 BoundaryPointSet::BoundaryPointSet() 25 { 26 LinesCount = 0; 27 Nr = -1; 28 value = 0.; 25 BoundaryPointSet::BoundaryPointSet() : 26 LinesCount(0), 27 value(0.), 28 Nr(-1) 29 { 30 Info FunctionInfo(__func__); 31 Log() << Verbose(1) << "Adding noname." << endl; 29 32 }; 30 33 … … 32 35 * \param *Walker TesselPoint this boundary point represents 33 36 */ 34 BoundaryPointSet::BoundaryPointSet(TesselPoint * Walker) 35 { 36 node = Walker; 37 LinesCount = 0; 38 Nr = Walker->nr; 39 value = 0.; 37 BoundaryPointSet::BoundaryPointSet(TesselPoint * Walker) : 38 LinesCount(0), 39 node(Walker), 40 value(0.), 41 Nr(Walker->nr) 42 { 43 Info FunctionInfo(__func__); 44 Log() << Verbose(1) << "Adding Node " << *Walker << endl; 40 45 }; 41 46 … … 46 51 BoundaryPointSet::~BoundaryPointSet() 47 52 { 48 //Log() << Verbose(5) << "Erasing point nr. " << Nr << "." << endl; 53 Info FunctionInfo(__func__); 54 //Log() << Verbose(0) << "Erasing point nr. " << Nr << "." << endl; 49 55 if (!lines.empty()) 50 56 eLog() << Verbose(2) << "Memory Leak! I " << *this << " am still connected to some lines." << endl; … … 57 63 void BoundaryPointSet::AddLine(class BoundaryLineSet *line) 58 64 { 59 Log() << Verbose(6) << "Adding " << *this << " to line " << *line << "." 65 Info FunctionInfo(__func__); 66 Log() << Verbose(1) << "Adding " << *this << " to line " << *line << "." 60 67 << endl; 61 68 if (line->endpoints[0] == this) … … 85 92 /** Constructor of BoundaryLineSet. 86 93 */ 87 BoundaryLineSet::BoundaryLineSet() 88 { 94 BoundaryLineSet::BoundaryLineSet() : 95 Nr(-1) 96 { 97 Info FunctionInfo(__func__); 89 98 for (int i = 0; i < 2; i++) 90 99 endpoints[i] = NULL; 91 Nr = -1;92 100 }; 93 101 … … 99 107 BoundaryLineSet::BoundaryLineSet(class BoundaryPointSet *Point[2], const int number) 100 108 { 109 Info FunctionInfo(__func__); 101 110 // set number 102 111 Nr = number; … … 106 115 Point[0]->AddLine(this); //Taken out, to check whether we can avoid unwanted double adding. 107 116 Point[1]->AddLine(this); // 117 // set skipped to false 118 skipped = false; 108 119 // clear triangles list 109 Log() << Verbose( 5) << "New Line with endpoints " << *this << "." << endl;120 Log() << Verbose(0) << "New Line with endpoints " << *this << "." << endl; 110 121 }; 111 122 … … 116 127 BoundaryLineSet::~BoundaryLineSet() 117 128 { 129 Info FunctionInfo(__func__); 118 130 int Numbers[2]; 119 131 … … 134 146 for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++) 135 147 if ((*Runner).second == this) { 136 //Log() << Verbose( 5) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;148 //Log() << Verbose(0) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl; 137 149 endpoints[i]->lines.erase(Runner); 138 150 break; … … 140 152 } else { // there's just a single line left 141 153 if (endpoints[i]->lines.erase(Nr)) { 142 //Log() << Verbose( 5) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl;154 //Log() << Verbose(0) << "Removing Line Nr. " << Nr << " in boundary point " << *endpoints[i] << "." << endl; 143 155 } 144 156 } 145 157 if (endpoints[i]->lines.empty()) { 146 //Log() << Verbose( 5) << *endpoints[i] << " has no more lines it's attached to, erasing." << endl;158 //Log() << Verbose(0) << *endpoints[i] << " has no more lines it's attached to, erasing." << endl; 147 159 if (endpoints[i] != NULL) { 148 160 delete(endpoints[i]); … … 161 173 void BoundaryLineSet::AddTriangle(class BoundaryTriangleSet *triangle) 162 174 { 163 Log() << Verbose(6) << "Add " << triangle->Nr << " to line " << *this << "." << endl; 175 Info FunctionInfo(__func__); 176 Log() << Verbose(0) << "Add " << triangle->Nr << " to line " << *this << "." << endl; 164 177 triangles.insert(TrianglePair(triangle->Nr, triangle)); 165 178 }; … … 171 184 bool BoundaryLineSet::IsConnectedTo(class BoundaryLineSet *line) 172 185 { 186 Info FunctionInfo(__func__); 173 187 if ((endpoints[0] == line->endpoints[0]) || (endpoints[1] == line->endpoints[0]) || (endpoints[0] == line->endpoints[1]) || (endpoints[1] == line->endpoints[1])) 174 188 return true; … … 185 199 bool BoundaryLineSet::CheckConvexityCriterion() 186 200 { 201 Info FunctionInfo(__func__); 187 202 Vector BaseLineCenter, BaseLineNormal, BaseLine, helper[2], NormalCheck; 188 203 // get the two triangles 189 204 if (triangles.size() != 2) { 190 eLog() << Verbose( 1) << "Baseline " << *this << " is connected to less than two triangles, Tesselation incomplete!" << endl;205 eLog() << Verbose(0) << "Baseline " << *this << " is connected to less than two triangles, Tesselation incomplete!" << endl; 191 206 return true; 192 207 } 193 208 // check normal vectors 194 209 // have a normal vector on the base line pointing outwards 195 //Log() << Verbose( 3) << "INFO: " << *this << " has vectors at " << *(endpoints[0]->node->node) << " and at " << *(endpoints[1]->node->node) << "." << endl;210 //Log() << Verbose(0) << "INFO: " << *this << " has vectors at " << *(endpoints[0]->node->node) << " and at " << *(endpoints[1]->node->node) << "." << endl; 196 211 BaseLineCenter.CopyVector(endpoints[0]->node->node); 197 212 BaseLineCenter.AddVector(endpoints[1]->node->node); … … 199 214 BaseLine.CopyVector(endpoints[0]->node->node); 200 215 BaseLine.SubtractVector(endpoints[1]->node->node); 201 //Log() << Verbose( 3) << "INFO: Baseline is " << BaseLine << " and its center is at " << BaseLineCenter << "." << endl;216 //Log() << Verbose(0) << "INFO: Baseline is " << BaseLine << " and its center is at " << BaseLineCenter << "." << endl; 202 217 203 218 BaseLineNormal.Zero(); … … 207 222 class BoundaryPointSet *node = NULL; 208 223 for(TriangleMap::iterator runner = triangles.begin(); runner != triangles.end(); runner++) { 209 //Log() << Verbose( 3) << "INFO: NormalVector of " << *(runner->second) << " is " << runner->second->NormalVector << "." << endl;224 //Log() << Verbose(0) << "INFO: NormalVector of " << *(runner->second) << " is " << runner->second->NormalVector << "." << endl; 210 225 NormalCheck.AddVector(&runner->second->NormalVector); 211 226 NormalCheck.Scale(sign); … … 214 229 BaseLineNormal.CopyVector(&runner->second->NormalVector); // yes, copy second on top of first 215 230 else { 216 Log() << Verbose(1) << "CRITICAL: Triangle " << *runner->second << " has zero normal vector!" << endl; 217 exit(255); 231 eLog() << Verbose(0) << "Triangle " << *runner->second << " has zero normal vector!" << endl; 218 232 } 219 233 node = runner->second->GetThirdEndpoint(this); 220 234 if (node != NULL) { 221 //Log() << Verbose( 3) << "INFO: Third node for triangle " << *(runner->second) << " is " << *node << " at " << *(node->node->node) << "." << endl;235 //Log() << Verbose(0) << "INFO: Third node for triangle " << *(runner->second) << " is " << *node << " at " << *(node->node->node) << "." << endl; 222 236 helper[i].CopyVector(node->node->node); 223 237 helper[i].SubtractVector(&BaseLineCenter); 224 238 helper[i].MakeNormalVector(&BaseLine); // we want to compare the triangle's heights' angles! 225 //Log() << Verbose( 4) << "INFO: Height vector with respect to baseline is " << helper[i] << "." << endl;239 //Log() << Verbose(0) << "INFO: Height vector with respect to baseline is " << helper[i] << "." << endl; 226 240 i++; 227 241 } else { 228 //eLog() << Verbose(1) << "I cannot find third node in triangle, something's wrong." << endl;242 eLog() << Verbose(1) << "I cannot find third node in triangle, something's wrong." << endl; 229 243 return true; 230 244 } 231 245 } 232 //Log() << Verbose( 3) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl;246 //Log() << Verbose(0) << "INFO: BaselineNormal is " << BaseLineNormal << "." << endl; 233 247 if (NormalCheck.NormSquared() < MYEPSILON) { 234 Log() << Verbose( 3) << "ACCEPT: Normalvectors of both triangles are the same: convex." << endl;248 Log() << Verbose(0) << "ACCEPT: Normalvectors of both triangles are the same: convex." << endl; 235 249 return true; 236 250 } … … 238 252 double angle = GetAngle(helper[0], helper[1], BaseLineNormal); 239 253 if ((angle - M_PI) > -MYEPSILON) { 240 Log() << Verbose( 3) << "ACCEPT: Angle is greater than pi: convex." << endl;254 Log() << Verbose(0) << "ACCEPT: Angle is greater than pi: convex." << endl; 241 255 return true; 242 256 } else { 243 Log() << Verbose( 3) << "REJECT: Angle is less than pi: concave." << endl;257 Log() << Verbose(0) << "REJECT: Angle is less than pi: concave." << endl; 244 258 return false; 245 259 } … … 252 266 bool BoundaryLineSet::ContainsBoundaryPoint(class BoundaryPointSet *point) 253 267 { 268 Info FunctionInfo(__func__); 254 269 for(int i=0;i<2;i++) 255 270 if (point == endpoints[i]) … … 264 279 class BoundaryPointSet *BoundaryLineSet::GetOtherEndpoint(class BoundaryPointSet *point) 265 280 { 281 Info FunctionInfo(__func__); 266 282 if (endpoints[0] == point) 267 283 return endpoints[1]; … … 286 302 /** Constructor for BoundaryTriangleSet. 287 303 */ 288 BoundaryTriangleSet::BoundaryTriangleSet() 289 { 304 BoundaryTriangleSet::BoundaryTriangleSet() : 305 Nr(-1) 306 { 307 Info FunctionInfo(__func__); 290 308 for (int i = 0; i < 3; i++) 291 309 { … … 293 311 lines[i] = NULL; 294 312 } 295 Nr = -1;296 313 }; 297 314 … … 300 317 * \param number number of triangle 301 318 */ 302 BoundaryTriangleSet::BoundaryTriangleSet(class BoundaryLineSet *line[3], int number) 303 { 319 BoundaryTriangleSet::BoundaryTriangleSet(class BoundaryLineSet *line[3], int number) : 320 Nr(number) 321 { 322 Info FunctionInfo(__func__); 304 323 // set number 305 Nr = number;306 324 // set lines 307 Log() << Verbose(5) << "New triangle " << Nr << ":" << endl; 308 for (int i = 0; i < 3; i++) 309 { 310 lines[i] = line[i]; 311 lines[i]->AddTriangle(this); 312 } 325 for (int i = 0; i < 3; i++) { 326 lines[i] = line[i]; 327 lines[i]->AddTriangle(this); 328 } 313 329 // get ascending order of endpoints 314 map<int, class BoundaryPointSet *>OrderMap;330 PointMap OrderMap; 315 331 for (int i = 0; i < 3; i++) 316 332 // for all three lines 317 for (int j = 0; j < 2; j++) 318 { // for both endpoints 319 OrderMap.insert(pair<int, class BoundaryPointSet *> ( 320 line[i]->endpoints[j]->Nr, line[i]->endpoints[j])); 321 // and we don't care whether insertion fails 322 } 333 for (int j = 0; j < 2; j++) { // for both endpoints 334 OrderMap.insert(pair<int, class BoundaryPointSet *> ( 335 line[i]->endpoints[j]->Nr, line[i]->endpoints[j])); 336 // and we don't care whether insertion fails 337 } 323 338 // set endpoints 324 339 int Counter = 0; 325 Log() << Verbose(6) << " with end points "; 326 for (map<int, class BoundaryPointSet *>::iterator runner = OrderMap.begin(); runner 327 != OrderMap.end(); runner++) 328 { 329 endpoints[Counter] = runner->second; 330 Log() << Verbose(0) << " " << *endpoints[Counter]; 331 Counter++; 332 } 333 if (Counter < 3) 334 { 335 eLog() << Verbose(0) << "ERROR! We have a triangle with only two distinct endpoints!" << endl; 336 performCriticalExit(); 337 } 338 Log() << Verbose(0) << "." << endl; 340 Log() << Verbose(0) << "New triangle " << Nr << " with end points: " << endl; 341 for (PointMap::iterator runner = OrderMap.begin(); runner != OrderMap.end(); runner++) { 342 endpoints[Counter] = runner->second; 343 Log() << Verbose(0) << " " << *endpoints[Counter] << endl; 344 Counter++; 345 } 346 if (Counter < 3) { 347 eLog() << Verbose(0) << "We have a triangle with only two distinct endpoints!" << endl; 348 performCriticalExit(); 349 } 339 350 }; 340 351 … … 345 356 BoundaryTriangleSet::~BoundaryTriangleSet() 346 357 { 358 Info FunctionInfo(__func__); 347 359 for (int i = 0; i < 3; i++) { 348 360 if (lines[i] != NULL) { 349 361 if (lines[i]->triangles.erase(Nr)) { 350 //Log() << Verbose( 5) << "Triangle Nr." << Nr << " erased in line " << *lines[i] << "." << endl;362 //Log() << Verbose(0) << "Triangle Nr." << Nr << " erased in line " << *lines[i] << "." << endl; 351 363 } 352 364 if (lines[i]->triangles.empty()) { 353 //Log() << Verbose( 5) << *lines[i] << " is no more attached to any triangle, erasing." << endl;365 //Log() << Verbose(0) << *lines[i] << " is no more attached to any triangle, erasing." << endl; 354 366 delete (lines[i]); 355 367 lines[i] = NULL; … … 357 369 } 358 370 } 359 //Log() << Verbose( 5) << "Erasing triangle Nr." << Nr << " itself." << endl;371 //Log() << Verbose(0) << "Erasing triangle Nr." << Nr << " itself." << endl; 360 372 }; 361 373 … … 366 378 void BoundaryTriangleSet::GetNormalVector(Vector &OtherVector) 367 379 { 380 Info FunctionInfo(__func__); 368 381 // get normal vector 369 382 NormalVector.MakeNormalVector(endpoints[0]->node->node, endpoints[1]->node->node, endpoints[2]->node->node); … … 372 385 if (NormalVector.ScalarProduct(&OtherVector) > 0.) 373 386 NormalVector.Scale(-1.); 387 Log() << Verbose(1) << "Normal Vector is " << NormalVector << "." << endl; 374 388 }; 375 389 … … 388 402 bool BoundaryTriangleSet::GetIntersectionInsideTriangle(Vector *MolCenter, Vector *x, Vector *Intersection) 389 403 { 404 Info FunctionInfo(__func__); 390 405 Vector CrossPoint; 391 406 Vector helper; 392 407 393 408 if (!Intersection->GetIntersectionWithPlane(&NormalVector, endpoints[0]->node->node, MolCenter, x)) { 394 Log() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl;409 eLog() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl; 395 410 return false; 396 411 } … … 408 423 } while (CrossPoint.NormSquared() < MYEPSILON); 409 424 if (i==3) { 410 eLog() << Verbose(1) << "Could not find any cross points, something's utterly wrong here!" << endl; 411 exit(255); 425 eLog() << Verbose(0) << "Could not find any cross points, something's utterly wrong here!" << endl; 412 426 } 413 427 CrossPoint.SubtractVector(endpoints[i%3]->node->node); // cross point was returned as absolute vector … … 428 442 bool BoundaryTriangleSet::ContainsBoundaryLine(class BoundaryLineSet *line) 429 443 { 444 Info FunctionInfo(__func__); 430 445 for(int i=0;i<3;i++) 431 446 if (line == lines[i]) … … 440 455 bool BoundaryTriangleSet::ContainsBoundaryPoint(class BoundaryPointSet *point) 441 456 { 457 Info FunctionInfo(__func__); 442 458 for(int i=0;i<3;i++) 443 459 if (point == endpoints[i]) … … 452 468 bool BoundaryTriangleSet::ContainsBoundaryPoint(class TesselPoint *point) 453 469 { 470 Info FunctionInfo(__func__); 454 471 for(int i=0;i<3;i++) 455 472 if (point == endpoints[i]->node) … … 464 481 bool BoundaryTriangleSet::IsPresentTupel(class BoundaryPointSet *Points[3]) 465 482 { 483 Info FunctionInfo(__func__); 466 484 return (((endpoints[0] == Points[0]) 467 485 || (endpoints[0] == Points[1]) … … 485 503 bool BoundaryTriangleSet::IsPresentTupel(class BoundaryTriangleSet *T) 486 504 { 505 Info FunctionInfo(__func__); 487 506 return (((endpoints[0] == T->endpoints[0]) 488 507 || (endpoints[0] == T->endpoints[1]) … … 506 525 class BoundaryPointSet *BoundaryTriangleSet::GetThirdEndpoint(class BoundaryLineSet *line) 507 526 { 527 Info FunctionInfo(__func__); 508 528 // sanity check 509 529 if (!ContainsBoundaryLine(line)) … … 522 542 void BoundaryTriangleSet::GetCenter(Vector *center) 523 543 { 544 Info FunctionInfo(__func__); 524 545 center->Zero(); 525 546 for(int i=0;i<3;i++) … … 534 555 ostream &operator <<(ostream &ost, const BoundaryTriangleSet &a) 535 556 { 536 ost << "[" << a.Nr << "|" << a.endpoints[0]->node->Name << " at " << *a.endpoints[0]->node->node << "," 537 << a.endpoints[1]->node->Name << " at " << *a.endpoints[1]->node->node << "," << a.endpoints[2]->node->Name << " at " << *a.endpoints[2]->node->node << "]"; 557 ost << "[" << a.Nr << "|" << a.endpoints[0]->node->Name << "," << a.endpoints[1]->node->Name << "," << a.endpoints[2]->node->Name << "]"; 558 // ost << "[" << a.Nr << "|" << a.endpoints[0]->node->Name << " at " << *a.endpoints[0]->node->node << "," 559 // << a.endpoints[1]->node->Name << " at " << *a.endpoints[1]->node->node << "," << a.endpoints[2]->node->Name << " at " << *a.endpoints[2]->node->node << "]"; 538 560 return ost; 539 561 }; 540 562 563 // ======================================== Polygons on Boundary ================================= 564 565 /** Constructor for BoundaryPolygonSet. 566 */ 567 BoundaryPolygonSet::BoundaryPolygonSet() : 568 Nr(-1) 569 { 570 Info FunctionInfo(__func__); 571 }; 572 573 /** Destructor of BoundaryPolygonSet. 574 * Just clears endpoints. 575 * \note When removing triangles from a class Tesselation, use RemoveTesselationTriangle() 576 */ 577 BoundaryPolygonSet::~BoundaryPolygonSet() 578 { 579 Info FunctionInfo(__func__); 580 endpoints.clear(); 581 Log() << Verbose(1) << "Erasing polygon Nr." << Nr << " itself." << endl; 582 }; 583 584 /** Calculates the normal vector for this triangle. 585 * Is made unique by comparison with \a OtherVector to point in the other direction. 586 * \param &OtherVector direction vector to make normal vector unique. 587 * \return allocated vector in normal direction 588 */ 589 Vector * BoundaryPolygonSet::GetNormalVector(const Vector &OtherVector) const 590 { 591 Info FunctionInfo(__func__); 592 // get normal vector 593 Vector TemporaryNormal; 594 Vector *TotalNormal = new Vector; 595 PointSet::const_iterator Runner[3]; 596 for (int i=0;i<3; i++) { 597 Runner[i] = endpoints.begin(); 598 for (int j = 0; j<i; j++) { // go as much further 599 Runner[i]++; 600 if (Runner[i] == endpoints.end()) { 601 eLog() << Verbose(0) << "There are less than three endpoints in the polygon!" << endl; 602 performCriticalExit(); 603 } 604 } 605 } 606 TotalNormal->Zero(); 607 int counter=0; 608 for (; Runner[2] != endpoints.end(); ) { 609 TemporaryNormal.MakeNormalVector((*Runner[0])->node->node, (*Runner[1])->node->node, (*Runner[2])->node->node); 610 for (int i=0;i<3;i++) // increase each of them 611 Runner[i]++; 612 TotalNormal->AddVector(&TemporaryNormal); 613 } 614 TotalNormal->Scale(1./(double)counter); 615 616 // make it always point inward (any offset vector onto plane projected onto normal vector suffices) 617 if (TotalNormal->ScalarProduct(&OtherVector) > 0.) 618 TotalNormal->Scale(-1.); 619 Log() << Verbose(1) << "Normal Vector is " << *TotalNormal << "." << endl; 620 621 return TotalNormal; 622 }; 623 624 /** Calculates the center point of the triangle. 625 * Is third of the sum of all endpoints. 626 * \param *center central point on return. 627 */ 628 void BoundaryPolygonSet::GetCenter(Vector * const center) const 629 { 630 Info FunctionInfo(__func__); 631 center->Zero(); 632 int counter = 0; 633 for(PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) { 634 center->AddVector((*Runner)->node->node); 635 counter++; 636 } 637 center->Scale(1./(double)counter); 638 Log() << Verbose(1) << "Center is at " << *center << "." << endl; 639 } 640 641 /** Checks whether the polygons contains all three endpoints of the triangle. 642 * \param *triangle triangle to test 643 * \return true - triangle is contained polygon, false - is not 644 */ 645 bool BoundaryPolygonSet::ContainsBoundaryTriangle(const BoundaryTriangleSet * const triangle) const 646 { 647 Info FunctionInfo(__func__); 648 return ContainsPresentTupel(triangle->endpoints, 3); 649 }; 650 651 /** Checks whether the polygons contains both endpoints of the line. 652 * \param *line line to test 653 * \return true - line is of the triangle, false - is not 654 */ 655 bool BoundaryPolygonSet::ContainsBoundaryLine(const BoundaryLineSet * const line) const 656 { 657 Info FunctionInfo(__func__); 658 return ContainsPresentTupel(line->endpoints, 2); 659 }; 660 661 /** Checks whether point is any of the three endpoints this triangle contains. 662 * \param *point point to test 663 * \return true - point is of the triangle, false - is not 664 */ 665 bool BoundaryPolygonSet::ContainsBoundaryPoint(const BoundaryPointSet * const point) const 666 { 667 Info FunctionInfo(__func__); 668 for(PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) { 669 Log() << Verbose(0) << "Checking against " << **Runner << endl; 670 if (point == (*Runner)) { 671 Log() << Verbose(0) << " Contained." << endl; 672 return true; 673 } 674 } 675 Log() << Verbose(0) << " Not contained." << endl; 676 return false; 677 }; 678 679 /** Checks whether point is any of the three endpoints this triangle contains. 680 * \param *point TesselPoint to test 681 * \return true - point is of the triangle, false - is not 682 */ 683 bool BoundaryPolygonSet::ContainsBoundaryPoint(const TesselPoint * const point) const 684 { 685 Info FunctionInfo(__func__); 686 for(PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) 687 if (point == (*Runner)->node) { 688 Log() << Verbose(0) << " Contained." << endl; 689 return true; 690 } 691 Log() << Verbose(0) << " Not contained." << endl; 692 return false; 693 }; 694 695 /** Checks whether given array of \a *Points coincide with polygons's endpoints. 696 * \param **Points pointer to an array of BoundaryPointSet 697 * \param dim dimension of array 698 * \return true - set of points is contained in polygon, false - is not 699 */ 700 bool BoundaryPolygonSet::ContainsPresentTupel(const BoundaryPointSet * const * Points, const int dim) const 701 { 702 Info FunctionInfo(__func__); 703 int counter = 0; 704 Log() << Verbose(1) << "Polygon is " << *this << endl; 705 for(int i=0;i<dim;i++) { 706 Log() << Verbose(1) << " Testing endpoint " << *Points[i] << endl; 707 if (ContainsBoundaryPoint(Points[i])) { 708 counter++; 709 } 710 } 711 712 if (counter == dim) 713 return true; 714 else 715 return false; 716 }; 717 718 /** Checks whether given PointList coincide with polygons's endpoints. 719 * \param &endpoints PointList 720 * \return true - set of points is contained in polygon, false - is not 721 */ 722 bool BoundaryPolygonSet::ContainsPresentTupel(const PointSet &endpoints) const 723 { 724 Info FunctionInfo(__func__); 725 size_t counter = 0; 726 Log() << Verbose(1) << "Polygon is " << *this << endl; 727 for(PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) { 728 Log() << Verbose(1) << " Testing endpoint " << **Runner << endl; 729 if (ContainsBoundaryPoint(*Runner)) 730 counter++; 731 } 732 733 if (counter == endpoints.size()) 734 return true; 735 else 736 return false; 737 }; 738 739 /** Checks whether given set of \a *Points coincide with polygons's endpoints. 740 * \param *P pointer to BoundaryPolygonSet 741 * \return true - is the very triangle, false - is not 742 */ 743 bool BoundaryPolygonSet::ContainsPresentTupel(const BoundaryPolygonSet * const P) const 744 { 745 return ContainsPresentTupel((const PointSet)P->endpoints); 746 }; 747 748 /** Gathers all the endpoints' triangles in a unique set. 749 * \return set of all triangles 750 */ 751 TriangleSet * BoundaryPolygonSet::GetAllContainedTrianglesFromEndpoints() const 752 { 753 Info FunctionInfo(__func__); 754 pair <TriangleSet::iterator, bool> Tester; 755 TriangleSet *triangles = new TriangleSet; 756 757 for(PointSet::const_iterator Runner = endpoints.begin(); Runner != endpoints.end(); Runner++) 758 for(LineMap::const_iterator Walker = (*Runner)->lines.begin(); Walker != (*Runner)->lines.end(); Walker++) 759 for(TriangleMap::const_iterator Sprinter = (Walker->second)->triangles.begin(); Sprinter != (Walker->second)->triangles.end(); Sprinter++) { 760 //Log() << Verbose(0) << " Testing triangle " << *(Sprinter->second) << endl; 761 if (ContainsBoundaryTriangle(Sprinter->second)) { 762 Tester = triangles->insert(Sprinter->second); 763 if (Tester.second) 764 Log() << Verbose(0) << "Adding triangle " << *(Sprinter->second) << endl; 765 } 766 } 767 768 Log() << Verbose(1) << "The Polygon of " << endpoints.size() << " endpoints has " << triangles->size() << " unique triangles in total." << endl; 769 return triangles; 770 }; 771 772 /** Fills the endpoints of this polygon from the triangles attached to \a *line. 773 * \param *line lines with triangles attached 774 * \return true - polygon contains endpoints, false - line was NULL 775 */ 776 bool BoundaryPolygonSet::FillPolygonFromTrianglesOfLine(const BoundaryLineSet * const line) 777 { 778 Info FunctionInfo(__func__); 779 pair <PointSet::iterator, bool> Tester; 780 if (line == NULL) 781 return false; 782 Log() << Verbose(1) << "Filling polygon from line " << *line << endl; 783 for(TriangleMap::const_iterator Runner = line->triangles.begin(); Runner != line->triangles.end(); Runner++) { 784 for (int i=0;i<3;i++) { 785 Tester = endpoints.insert((Runner->second)->endpoints[i]); 786 if (Tester.second) 787 Log() << Verbose(1) << " Inserting endpoint " << *((Runner->second)->endpoints[i]) << endl; 788 } 789 } 790 791 return true; 792 }; 793 794 /** output operator for BoundaryPolygonSet. 795 * \param &ost output stream 796 * \param &a boundary polygon 797 */ 798 ostream &operator <<(ostream &ost, const BoundaryPolygonSet &a) 799 { 800 ost << "[" << a.Nr << "|"; 801 for(PointSet::const_iterator Runner = a.endpoints.begin(); Runner != a.endpoints.end();) { 802 ost << (*Runner)->node->Name; 803 Runner++; 804 if (Runner != a.endpoints.end()) 805 ost << ","; 806 } 807 ost<< "]"; 808 return ost; 809 }; 810 541 811 // =========================================================== class TESSELPOINT =========================================== 542 812 … … 545 815 TesselPoint::TesselPoint() 546 816 { 817 Info FunctionInfo(__func__); 547 818 node = NULL; 548 819 nr = -1; … … 554 825 TesselPoint::~TesselPoint() 555 826 { 827 Info FunctionInfo(__func__); 556 828 }; 557 829 … … 568 840 ostream & TesselPoint::operator << (ostream &ost) 569 841 { 570 ost << "[" << (Name) << "|" << this << "]"; 842 Info FunctionInfo(__func__); 843 ost << "[" << (nr) << "|" << this << "]"; 571 844 return ost; 572 845 }; … … 579 852 PointCloud::PointCloud() 580 853 { 581 854 Info FunctionInfo(__func__); 582 855 }; 583 856 … … 586 859 PointCloud::~PointCloud() 587 860 { 588 861 Info FunctionInfo(__func__); 589 862 }; 590 863 … … 593 866 /** Constructor of class CandidateForTesselation. 594 867 */ 595 CandidateForTesselation::CandidateForTesselation(TesselPoint *candidate, BoundaryLineSet* line, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) { 596 point = candidate; 597 BaseLine = line; 868 CandidateForTesselation::CandidateForTesselation (BoundaryLineSet* line) : 869 BaseLine(line), 870 ShortestAngle(2.*M_PI), 871 OtherShortestAngle(2.*M_PI) 872 { 873 Info FunctionInfo(__func__); 874 }; 875 876 877 /** Constructor of class CandidateForTesselation. 878 */ 879 CandidateForTesselation::CandidateForTesselation (TesselPoint *candidate, BoundaryLineSet* line, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) : 880 BaseLine(line), 881 ShortestAngle(2.*M_PI), 882 OtherShortestAngle(2.*M_PI) 883 { 884 Info FunctionInfo(__func__); 598 885 OptCenter.CopyVector(&OptCandidateCenter); 599 886 OtherOptCenter.CopyVector(&OtherOptCandidateCenter); … … 603 890 */ 604 891 CandidateForTesselation::~CandidateForTesselation() { 605 point = NULL;606 892 BaseLine = NULL; 607 893 }; 608 894 895 /** output operator for CandidateForTesselation. 896 * \param &ost output stream 897 * \param &a boundary line 898 */ 899 ostream & operator <<(ostream &ost, const CandidateForTesselation &a) 900 { 901 ost << "[" << a.BaseLine->Nr << "|" << a.BaseLine->endpoints[0]->node->Name << "," << a.BaseLine->endpoints[1]->node->Name << "] with "; 902 if (a.pointlist.empty()) 903 ost << "no candidate."; 904 else { 905 ost << "candidate"; 906 if (a.pointlist.size() != 1) 907 ost << "s "; 908 else 909 ost << " "; 910 for (TesselPointList::const_iterator Runner = a.pointlist.begin(); Runner != a.pointlist.end(); Runner++) 911 ost << *(*Runner) << " "; 912 ost << " at angle " << (a.ShortestAngle)<< "."; 913 } 914 915 return ost; 916 }; 917 918 609 919 // =========================================================== class TESSELATION =========================================== 610 920 611 921 /** Constructor of class Tesselation. 612 922 */ 613 Tesselation::Tesselation() 614 { 615 PointsOnBoundaryCount = 0; 616 LinesOnBoundaryCount = 0; 617 TrianglesOnBoundaryCount = 0; 618 InternalPointer = PointsOnBoundary.begin(); 619 LastTriangle = NULL; 620 TriangleFilesWritten = 0; 923 Tesselation::Tesselation() : 924 PointsOnBoundaryCount(0), 925 LinesOnBoundaryCount(0), 926 TrianglesOnBoundaryCount(0), 927 LastTriangle(NULL), 928 TriangleFilesWritten(0), 929 InternalPointer(PointsOnBoundary.begin()) 930 { 931 Info FunctionInfo(__func__); 621 932 } 622 933 ; … … 627 938 Tesselation::~Tesselation() 628 939 { 629 Log() << Verbose(1) << "Free'ing TesselStruct ... " << endl; 940 Info FunctionInfo(__func__); 941 Log() << Verbose(0) << "Free'ing TesselStruct ... " << endl; 630 942 for (TriangleMap::iterator runner = TrianglesOnBoundary.begin(); runner != TrianglesOnBoundary.end(); runner++) { 631 943 if (runner->second != NULL) { … … 635 947 eLog() << Verbose(1) << "The triangle " << runner->first << " has already been free'd." << endl; 636 948 } 637 Log() << Verbose( 1) << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl;949 Log() << Verbose(0) << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl; 638 950 } 639 951 ; … … 644 956 Vector * Tesselation::GetCenter(ofstream *out) const 645 957 { 958 Info FunctionInfo(__func__); 646 959 Vector *Center = new Vector(0.,0.,0.); 647 960 int num=0; … … 659 972 TesselPoint * Tesselation::GetPoint() const 660 973 { 974 Info FunctionInfo(__func__); 661 975 return (InternalPointer->second->node); 662 976 }; … … 667 981 TesselPoint * Tesselation::GetTerminalPoint() const 668 982 { 983 Info FunctionInfo(__func__); 669 984 PointMap::const_iterator Runner = PointsOnBoundary.end(); 670 985 Runner--; … … 677 992 void Tesselation::GoToNext() const 678 993 { 994 Info FunctionInfo(__func__); 679 995 if (InternalPointer != PointsOnBoundary.end()) 680 996 InternalPointer++; … … 686 1002 void Tesselation::GoToPrevious() const 687 1003 { 1004 Info FunctionInfo(__func__); 688 1005 if (InternalPointer != PointsOnBoundary.begin()) 689 1006 InternalPointer--; … … 695 1012 void Tesselation::GoToFirst() const 696 1013 { 1014 Info FunctionInfo(__func__); 697 1015 InternalPointer = PointsOnBoundary.begin(); 698 1016 }; … … 703 1021 void Tesselation::GoToLast() const 704 1022 { 1023 Info FunctionInfo(__func__); 705 1024 InternalPointer = PointsOnBoundary.end(); 706 1025 InternalPointer--; … … 712 1031 bool Tesselation::IsEmpty() const 713 1032 { 1033 Info FunctionInfo(__func__); 714 1034 return (PointsOnBoundary.empty()); 715 1035 }; … … 720 1040 bool Tesselation::IsEnd() const 721 1041 { 1042 Info FunctionInfo(__func__); 722 1043 return (InternalPointer == PointsOnBoundary.end()); 723 1044 }; … … 732 1053 Tesselation::GuessStartingTriangle() 733 1054 { 1055 Info FunctionInfo(__func__); 734 1056 // 4b. create a starting triangle 735 1057 // 4b1. create all distances … … 778 1100 baseline->second.first->second->node->node, 779 1101 baseline->second.second->second->node->node); 780 Log() << Verbose(2) << "Plane vector of candidate triangle is "; 781 PlaneVector.Output(); 782 Log() << Verbose(0) << endl; 1102 Log() << Verbose(2) << "Plane vector of candidate triangle is " << PlaneVector << endl; 783 1103 // 4. loop over all points 784 1104 double sign = 0.; … … 796 1116 if (fabs(distance) < 1e-4) // we need to have a small epsilon around 0 which is still ok 797 1117 continue; 798 Log() << Verbose(3) << "Projection of " << checker->second->node->Name 799 << " yields distance of " << distance << "." << endl; 1118 Log() << Verbose(2) << "Projection of " << checker->second->node->Name << " yields distance of " << distance << "." << endl; 800 1119 tmp = distance / fabs(distance); 801 1120 // 4b. Any have different sign to than before? (i.e. would lie outside convex hull with this starting triangle) … … 850 1169 if (checker == PointsOnBoundary.end()) 851 1170 { 852 Log() << Verbose( 0) << "Looks like we have a candidate!" << endl;1171 Log() << Verbose(2) << "Looks like we have a candidate!" << endl; 853 1172 break; 854 1173 } … … 880 1199 else 881 1200 { 882 Log() << Verbose(1) << "No starting triangle found." << endl; 883 exit(255); 1201 eLog() << Verbose(0) << "No starting triangle found." << endl; 884 1202 } 885 1203 } … … 901 1219 void Tesselation::TesselateOnBoundary(const PointCloud * const cloud) 902 1220 { 1221 Info FunctionInfo(__func__); 903 1222 bool flag; 904 1223 PointMap::iterator winner; … … 919 1238 // get peak point with respect to this base line's only triangle 920 1239 BTS = baseline->second->triangles.begin()->second; // there is only one triangle so far 921 Log() << Verbose( 2) << "Current baseline is between " << *(baseline->second) << "." << endl;1240 Log() << Verbose(0) << "Current baseline is between " << *(baseline->second) << "." << endl; 922 1241 for (int i = 0; i < 3; i++) 923 1242 if ((BTS->endpoints[i] != baseline->second->endpoints[0]) && (BTS->endpoints[i] != baseline->second->endpoints[1])) 924 1243 peak = BTS->endpoints[i]; 925 Log() << Verbose( 3) << " and has peak " << *peak << "." << endl;1244 Log() << Verbose(1) << " and has peak " << *peak << "." << endl; 926 1245 927 1246 // prepare some auxiliary vectors … … 938 1257 CenterVector.AddVector(BTS->endpoints[i]->node->node); 939 1258 CenterVector.Scale(1. / 3.); 940 Log() << Verbose( 4) << "CenterVector of base triangle is " << CenterVector << endl;1259 Log() << Verbose(2) << "CenterVector of base triangle is " << CenterVector << endl; 941 1260 942 1261 // normal vector of triangle … … 945 1264 BTS->GetNormalVector(NormalVector); 946 1265 NormalVector.CopyVector(&BTS->NormalVector); 947 Log() << Verbose( 4) << "NormalVector of base triangle is " << NormalVector << endl;1266 Log() << Verbose(2) << "NormalVector of base triangle is " << NormalVector << endl; 948 1267 949 1268 // vector in propagation direction (out of triangle) … … 952 1271 TempVector.CopyVector(&CenterVector); 953 1272 TempVector.SubtractVector(baseline->second->endpoints[0]->node->node); // TempVector is vector on triangle plane pointing from one baseline egde towards center! 954 //Log() << Verbose( 2) << "Projection of propagation onto temp: " << PropagationVector.Projection(&TempVector) << "." << endl;1273 //Log() << Verbose(0) << "Projection of propagation onto temp: " << PropagationVector.Projection(&TempVector) << "." << endl; 955 1274 if (PropagationVector.ScalarProduct(&TempVector) > 0) // make sure normal propagation vector points outward from baseline 956 1275 PropagationVector.Scale(-1.); 957 Log() << Verbose( 4) << "PropagationVector of base triangle is " << PropagationVector << endl;1276 Log() << Verbose(2) << "PropagationVector of base triangle is " << PropagationVector << endl; 958 1277 winner = PointsOnBoundary.end(); 959 1278 … … 961 1280 for (PointMap::iterator target = PointsOnBoundary.begin(); target != PointsOnBoundary.end(); target++) { 962 1281 if ((target->second != baseline->second->endpoints[0]) && (target->second != baseline->second->endpoints[1])) { // don't take the same endpoints 963 Log() << Verbose( 3) << "Target point is " << *(target->second) << ":" << endl;1282 Log() << Verbose(1) << "Target point is " << *(target->second) << ":" << endl; 964 1283 965 1284 // first check direction, so that triangles don't intersect … … 968 1287 VirtualNormalVector.ProjectOntoPlane(&NormalVector); 969 1288 TempAngle = VirtualNormalVector.Angle(&PropagationVector); 970 Log() << Verbose( 4) << "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "." << endl;1289 Log() << Verbose(2) << "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "." << endl; 971 1290 if (TempAngle > (M_PI/2.)) { // no bends bigger than Pi/2 (90 degrees) 972 Log() << Verbose( 4) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", bad direction!" << endl;1291 Log() << Verbose(2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", bad direction!" << endl; 973 1292 continue; 974 1293 } else 975 Log() << Verbose( 4) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", good direction!" << endl;1294 Log() << Verbose(2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", good direction!" << endl; 976 1295 977 1296 // check first and second endpoint (if any connecting line goes to target has at least not more than 1 triangle) … … 979 1298 LineChecker[1] = baseline->second->endpoints[1]->lines.find(target->first); 980 1299 if (((LineChecker[0] != baseline->second->endpoints[0]->lines.end()) && (LineChecker[0]->second->triangles.size() == 2))) { 981 Log() << Verbose( 4) << *(baseline->second->endpoints[0]) << " has line " << *(LineChecker[0]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[0]->second->triangles.size() << " triangles." << endl;1300 Log() << Verbose(2) << *(baseline->second->endpoints[0]) << " has line " << *(LineChecker[0]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[0]->second->triangles.size() << " triangles." << endl; 982 1301 continue; 983 1302 } 984 1303 if (((LineChecker[1] != baseline->second->endpoints[1]->lines.end()) && (LineChecker[1]->second->triangles.size() == 2))) { 985 Log() << Verbose( 4) << *(baseline->second->endpoints[1]) << " has line " << *(LineChecker[1]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[1]->second->triangles.size() << " triangles." << endl;1304 Log() << Verbose(2) << *(baseline->second->endpoints[1]) << " has line " << *(LineChecker[1]->second) << " to " << *(target->second) << " as endpoint with " << LineChecker[1]->second->triangles.size() << " triangles." << endl; 986 1305 continue; 987 1306 } … … 1000 1319 helper.ProjectOntoPlane(&TempVector); 1001 1320 if (fabs(helper.NormSquared()) < MYEPSILON) { 1002 Log() << Verbose( 4) << "Chosen set of vectors is linear dependent." << endl;1321 Log() << Verbose(2) << "Chosen set of vectors is linear dependent." << endl; 1003 1322 continue; 1004 1323 } … … 1017 1336 // calculate angle 1018 1337 TempAngle = NormalVector.Angle(&VirtualNormalVector); 1019 Log() << Verbose( 4) << "NormalVector is " << VirtualNormalVector << " and the angle is " << TempAngle << "." << endl;1338 Log() << Verbose(2) << "NormalVector is " << VirtualNormalVector << " and the angle is " << TempAngle << "." << endl; 1020 1339 if ((SmallestAngle - TempAngle) > MYEPSILON) { // set to new possible winner 1021 1340 SmallestAngle = TempAngle; 1022 1341 winner = target; 1023 Log() << Verbose( 4) << "New winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;1342 Log() << Verbose(2) << "New winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl; 1024 1343 } else if (fabs(SmallestAngle - TempAngle) < MYEPSILON) { // check the angle to propagation, both possible targets are in one plane! (their normals have same angle) 1025 1344 // hence, check the angles to some normal direction from our base line but in this common plane of both targets... … … 1039 1358 SmallestAngle = TempAngle; 1040 1359 winner = target; 1041 Log() << Verbose( 4) << "New winner " << *winner->second->node << " due to smaller angle " << TempAngle << " to propagation direction." << endl;1360 Log() << Verbose(2) << "New winner " << *winner->second->node << " due to smaller angle " << TempAngle << " to propagation direction." << endl; 1042 1361 } else 1043 Log() << Verbose( 4) << "Keeping old winner " << *winner->second->node << " due to smaller angle to propagation direction." << endl;1362 Log() << Verbose(2) << "Keeping old winner " << *winner->second->node << " due to smaller angle to propagation direction." << endl; 1044 1363 } else 1045 Log() << Verbose( 4) << "Keeping old winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;1364 Log() << Verbose(2) << "Keeping old winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl; 1046 1365 } 1047 1366 } // end of loop over all boundary points … … 1049 1368 // 5b. The point of the above whose triangle has the greatest angle with the triangle the current line belongs to (it only belongs to one, remember!): New triangle 1050 1369 if (winner != PointsOnBoundary.end()) { 1051 Log() << Verbose( 2) << "Winning target point is " << *(winner->second) << " with angle " << SmallestAngle << "." << endl;1370 Log() << Verbose(0) << "Winning target point is " << *(winner->second) << " with angle " << SmallestAngle << "." << endl; 1052 1371 // create the lins of not yet present 1053 1372 BLS[0] = baseline->second; … … 1079 1398 TrianglesOnBoundaryCount++; 1080 1399 } else { 1081 Log() << Verbose(1) << "I could not determine a winner for this baseline " << *(baseline->second) << "." << endl;1400 eLog() << Verbose(2) << "I could not determine a winner for this baseline " << *(baseline->second) << "." << endl; 1082 1401 } 1083 1402 1084 1403 // 5d. If the set of lines is not yet empty, go to 5. and continue 1085 1404 } else 1086 Log() << Verbose( 2) << "Baseline candidate " << *(baseline->second) << " has a triangle count of " << baseline->second->triangles.size() << "." << endl;1405 Log() << Verbose(0) << "Baseline candidate " << *(baseline->second) << " has a triangle count of " << baseline->second->triangles.size() << "." << endl; 1087 1406 } while (flag); 1088 1407 … … 1099 1418 bool Tesselation::InsertStraddlingPoints(const PointCloud *cloud, const LinkedCell *LC) 1100 1419 { 1420 Info FunctionInfo(__func__); 1101 1421 Vector Intersection, Normal; 1102 1422 TesselPoint *Walker = NULL; … … 1105 1425 bool AddFlag = false; 1106 1426 LinkedCell *BoundaryPoints = NULL; 1107 1108 Log() << Verbose(1) << "Begin of InsertStraddlingPoints" << endl;1109 1427 1110 1428 cloud->GoToFirst(); … … 1117 1435 } 1118 1436 Walker = cloud->GetPoint(); 1119 Log() << Verbose( 2) << "Current point is " << *Walker << "." << endl;1437 Log() << Verbose(0) << "Current point is " << *Walker << "." << endl; 1120 1438 // get the next triangle 1121 1439 triangles = FindClosestTrianglesToPoint(Walker->node, BoundaryPoints); 1122 1440 BTS = triangles->front(); 1123 1441 if ((triangles == NULL) || (BTS->ContainsBoundaryPoint(Walker))) { 1124 Log() << Verbose( 2) << "No triangles found, probably a tesselation point itself." << endl;1442 Log() << Verbose(0) << "No triangles found, probably a tesselation point itself." << endl; 1125 1443 cloud->GoToNext(); 1126 1444 continue; 1127 1445 } else { 1128 1446 } 1129 Log() << Verbose( 2) << "Closest triangle is " << *BTS << "." << endl;1447 Log() << Verbose(0) << "Closest triangle is " << *BTS << "." << endl; 1130 1448 // get the intersection point 1131 1449 if (BTS->GetIntersectionInsideTriangle(Center, Walker->node, &Intersection)) { 1132 Log() << Verbose( 2) << "We have an intersection at " << Intersection << "." << endl;1450 Log() << Verbose(0) << "We have an intersection at " << Intersection << "." << endl; 1133 1451 // we have the intersection, check whether in- or outside of boundary 1134 1452 if ((Center->DistanceSquared(Walker->node) - Center->DistanceSquared(&Intersection)) < -MYEPSILON) { 1135 1453 // inside, next! 1136 Log() << Verbose( 2) << *Walker << " is inside wrt triangle " << *BTS << "." << endl;1454 Log() << Verbose(0) << *Walker << " is inside wrt triangle " << *BTS << "." << endl; 1137 1455 } else { 1138 1456 // outside! 1139 Log() << Verbose( 2) << *Walker << " is outside wrt triangle " << *BTS << "." << endl;1457 Log() << Verbose(0) << *Walker << " is outside wrt triangle " << *BTS << "." << endl; 1140 1458 class BoundaryLineSet *OldLines[3], *NewLines[3]; 1141 1459 class BoundaryPointSet *OldPoints[3], *NewPoint; … … 1147 1465 Normal.CopyVector(&BTS->NormalVector); 1148 1466 // add Walker to boundary points 1149 Log() << Verbose( 2) << "Adding " << *Walker << " to BoundaryPoints." << endl;1467 Log() << Verbose(0) << "Adding " << *Walker << " to BoundaryPoints." << endl; 1150 1468 AddFlag = true; 1151 1469 if (AddBoundaryPoint(Walker,0)) … … 1154 1472 continue; 1155 1473 // remove triangle 1156 Log() << Verbose( 2) << "Erasing triangle " << *BTS << "." << endl;1474 Log() << Verbose(0) << "Erasing triangle " << *BTS << "." << endl; 1157 1475 TrianglesOnBoundary.erase(BTS->Nr); 1158 1476 delete(BTS); … … 1162 1480 BPS[1] = OldPoints[i]; 1163 1481 NewLines[i] = new class BoundaryLineSet(BPS, LinesOnBoundaryCount); 1164 Log() << Verbose( 3) << "Creating new line " << *NewLines[i] << "." << endl;1482 Log() << Verbose(1) << "Creating new line " << *NewLines[i] << "." << endl; 1165 1483 LinesOnBoundary.insert(LinePair(LinesOnBoundaryCount, NewLines[i])); // no need for check for unique insertion as BPS[0] is definitely a new one 1166 1484 LinesOnBoundaryCount++; … … 1173 1491 if (NewLines[j]->IsConnectedTo(BLS[0])) { 1174 1492 if (n>2) { 1175 Log() << Verbose(1) << BLS[0] << " connects to all of the new lines?!" << endl;1493 eLog() << Verbose(2) << BLS[0] << " connects to all of the new lines?!" << endl; 1176 1494 return false; 1177 1495 } else … … 1184 1502 BTS->GetNormalVector(Normal); 1185 1503 Normal.Scale(-1.); 1186 Log() << Verbose( 2) << "Created new triangle " << *BTS << "." << endl;1504 Log() << Verbose(0) << "Created new triangle " << *BTS << "." << endl; 1187 1505 TrianglesOnBoundary.insert(TrianglePair(TrianglesOnBoundaryCount, BTS)); 1188 1506 TrianglesOnBoundaryCount++; … … 1198 1516 // exit 1199 1517 delete(Center); 1200 Log() << Verbose(1) << "End of InsertStraddlingPoints" << endl;1201 1518 return true; 1202 1519 }; … … 1209 1526 bool Tesselation::AddBoundaryPoint(TesselPoint * Walker, const int n) 1210 1527 { 1528 Info FunctionInfo(__func__); 1211 1529 PointTestPair InsertUnique; 1212 1530 BPS[n] = new class BoundaryPointSet(Walker); … … 1230 1548 void Tesselation::AddTesselationPoint(TesselPoint* Candidate, const int n) 1231 1549 { 1550 Info FunctionInfo(__func__); 1232 1551 PointTestPair InsertUnique; 1233 1552 TPS[n] = new class BoundaryPointSet(Candidate); … … 1237 1556 } else { 1238 1557 delete TPS[n]; 1239 Log() << Verbose( 4) << "Node " << *((InsertUnique.first)->second->node) << " is already present in PointsOnBoundary." << endl;1558 Log() << Verbose(0) << "Node " << *((InsertUnique.first)->second->node) << " is already present in PointsOnBoundary." << endl; 1240 1559 TPS[n] = (InsertUnique.first)->second; 1241 1560 } … … 1250 1569 void Tesselation::SetTesselationPoint(TesselPoint* Candidate, const int n) const 1251 1570 { 1571 Info FunctionInfo(__func__); 1252 1572 PointMap::const_iterator FindPoint = PointsOnBoundary.find(Candidate->nr); 1253 1573 if (FindPoint != PointsOnBoundary.end()) … … 1267 1587 bool insertNewLine = true; 1268 1588 1269 if (a->lines.find(b->node->nr) != a->lines.end()) { 1270 LineMap::iterator FindLine = a->lines.find(b->node->nr); 1589 LineMap::iterator FindLine = a->lines.find(b->node->nr); 1590 if (FindLine != a->lines.end()) { 1591 Log() << Verbose(1) << "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "." << endl; 1592 1271 1593 pair<LineMap::iterator,LineMap::iterator> FindPair; 1272 1594 FindPair = a->lines.equal_range(b->node->nr); 1273 Log() << Verbose(5) << "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "." << endl;1274 1595 1275 1596 for (FindLine = FindPair.first; FindLine != FindPair.second; FindLine++) { … … 1277 1598 if (FindLine->second->triangles.size() < 2) { 1278 1599 insertNewLine = false; 1279 Log() << Verbose( 4) << "Using existing line " << *FindLine->second << endl;1600 Log() << Verbose(0) << "Using existing line " << *FindLine->second << endl; 1280 1601 1281 1602 BPS[0] = FindLine->second->endpoints[0]; 1282 1603 BPS[1] = FindLine->second->endpoints[1]; 1283 1604 BLS[n] = FindLine->second; 1605 1606 // remove existing line from OpenLines 1607 CandidateMap::iterator CandidateLine = OpenLines.find(BLS[n]); 1608 if (CandidateLine != OpenLines.end()) { 1609 Log() << Verbose(1) << " Removing line from OpenLines." << endl; 1610 delete(CandidateLine->second); 1611 OpenLines.erase(CandidateLine); 1612 } else { 1613 eLog() << Verbose(1) << "Line exists and is attached to less than two triangles, but not in OpenLines!" << endl; 1614 } 1284 1615 1285 1616 break; … … 1304 1635 void Tesselation::AlwaysAddTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n) 1305 1636 { 1306 Log() << Verbose(4) << "Adding line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl; 1637 Info FunctionInfo(__func__); 1638 Log() << Verbose(0) << "Adding open line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl; 1307 1639 BPS[0] = a; 1308 1640 BPS[1] = b; … … 1312 1644 // increase counter 1313 1645 LinesOnBoundaryCount++; 1646 // also add to open lines 1647 CandidateForTesselation *CFT = new CandidateForTesselation(BLS[n]); 1648 OpenLines.insert(pair< BoundaryLineSet *, CandidateForTesselation *> (BLS[n], CFT)); 1314 1649 }; 1315 1650 … … 1319 1654 void Tesselation::AddTesselationTriangle() 1320 1655 { 1656 Info FunctionInfo(__func__); 1321 1657 Log() << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl; 1322 1658 … … 1337 1673 void Tesselation::AddTesselationTriangle(const int nr) 1338 1674 { 1339 Log() << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl; 1675 Info FunctionInfo(__func__); 1676 Log() << Verbose(0) << "Adding triangle to global TrianglesOnBoundary map." << endl; 1340 1677 1341 1678 // add triangle to global map … … 1355 1692 void Tesselation::RemoveTesselationTriangle(class BoundaryTriangleSet *triangle) 1356 1693 { 1694 Info FunctionInfo(__func__); 1357 1695 if (triangle == NULL) 1358 1696 return; 1359 1697 for (int i = 0; i < 3; i++) { 1360 1698 if (triangle->lines[i] != NULL) { 1361 Log() << Verbose( 5) << "Removing triangle Nr." << triangle->Nr << " in line " << *triangle->lines[i] << "." << endl;1699 Log() << Verbose(0) << "Removing triangle Nr." << triangle->Nr << " in line " << *triangle->lines[i] << "." << endl; 1362 1700 triangle->lines[i]->triangles.erase(triangle->Nr); 1363 1701 if (triangle->lines[i]->triangles.empty()) { 1364 Log() << Verbose( 5) << *triangle->lines[i] << " is no more attached to any triangle, erasing." << endl;1702 Log() << Verbose(0) << *triangle->lines[i] << " is no more attached to any triangle, erasing." << endl; 1365 1703 RemoveTesselationLine(triangle->lines[i]); 1366 1704 } else { 1367 Log() << Verbose(5) << *triangle->lines[i] << " is still attached to another triangle: "; 1705 Log() << Verbose(0) << *triangle->lines[i] << " is still attached to another triangle: "; 1706 OpenLines.insert(pair< BoundaryLineSet *, CandidateForTesselation *> (triangle->lines[i], NULL)); 1368 1707 for(TriangleMap::iterator TriangleRunner = triangle->lines[i]->triangles.begin(); TriangleRunner != triangle->lines[i]->triangles.end(); TriangleRunner++) 1369 1708 Log() << Verbose(0) << "[" << (TriangleRunner->second)->Nr << "|" << *((TriangleRunner->second)->endpoints[0]) << ", " << *((TriangleRunner->second)->endpoints[1]) << ", " << *((TriangleRunner->second)->endpoints[2]) << "] \t"; 1370 1709 Log() << Verbose(0) << endl; 1371 1710 // for (int j=0;j<2;j++) { 1372 // Log() << Verbose( 5) << "Lines of endpoint " << *(triangle->lines[i]->endpoints[j]) << ": ";1711 // Log() << Verbose(0) << "Lines of endpoint " << *(triangle->lines[i]->endpoints[j]) << ": "; 1373 1712 // for(LineMap::iterator LineRunner = triangle->lines[i]->endpoints[j]->lines.begin(); LineRunner != triangle->lines[i]->endpoints[j]->lines.end(); LineRunner++) 1374 1713 // Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t"; … … 1382 1721 1383 1722 if (TrianglesOnBoundary.erase(triangle->Nr)) 1384 Log() << Verbose( 5) << "Removing triangle Nr. " << triangle->Nr << "." << endl;1723 Log() << Verbose(0) << "Removing triangle Nr. " << triangle->Nr << "." << endl; 1385 1724 delete(triangle); 1386 1725 }; … … 1392 1731 void Tesselation::RemoveTesselationLine(class BoundaryLineSet *line) 1393 1732 { 1733 Info FunctionInfo(__func__); 1394 1734 int Numbers[2]; 1395 1735 … … 1412 1752 for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++) 1413 1753 if ((*Runner).second == line) { 1414 Log() << Verbose( 5) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;1754 Log() << Verbose(0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl; 1415 1755 line->endpoints[i]->lines.erase(Runner); 1416 1756 break; … … 1418 1758 } else { // there's just a single line left 1419 1759 if (line->endpoints[i]->lines.erase(line->Nr)) 1420 Log() << Verbose( 5) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;1760 Log() << Verbose(0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl; 1421 1761 } 1422 1762 if (line->endpoints[i]->lines.empty()) { 1423 Log() << Verbose( 5) << *line->endpoints[i] << " has no more lines it's attached to, erasing." << endl;1763 Log() << Verbose(0) << *line->endpoints[i] << " has no more lines it's attached to, erasing." << endl; 1424 1764 RemoveTesselationPoint(line->endpoints[i]); 1425 1765 } else { 1426 Log() << Verbose( 5) << *line->endpoints[i] << " has still lines it's attached to: ";1766 Log() << Verbose(0) << *line->endpoints[i] << " has still lines it's attached to: "; 1427 1767 for(LineMap::iterator LineRunner = line->endpoints[i]->lines.begin(); LineRunner != line->endpoints[i]->lines.end(); LineRunner++) 1428 1768 Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t"; … … 1437 1777 1438 1778 if (LinesOnBoundary.erase(line->Nr)) 1439 Log() << Verbose( 5) << "Removing line Nr. " << line->Nr << "." << endl;1779 Log() << Verbose(0) << "Removing line Nr. " << line->Nr << "." << endl; 1440 1780 delete(line); 1441 1781 }; … … 1448 1788 void Tesselation::RemoveTesselationPoint(class BoundaryPointSet *point) 1449 1789 { 1790 Info FunctionInfo(__func__); 1450 1791 if (point == NULL) 1451 1792 return; 1452 1793 if (PointsOnBoundary.erase(point->Nr)) 1453 Log() << Verbose( 5) << "Removing point Nr. " << point->Nr << "." << endl;1794 Log() << Verbose(0) << "Removing point Nr. " << point->Nr << "." << endl; 1454 1795 delete(point); 1455 1796 }; … … 1466 1807 int Tesselation::CheckPresenceOfTriangle(TesselPoint *Candidates[3]) const 1467 1808 { 1809 Info FunctionInfo(__func__); 1468 1810 int adjacentTriangleCount = 0; 1469 1811 class BoundaryPointSet *Points[3]; 1470 1812 1471 Log() << Verbose(2) << "Begin of CheckPresenceOfTriangle" << endl;1472 1813 // builds a triangle point set (Points) of the end points 1473 1814 for (int i = 0; i < 3; i++) { … … 1488 1829 for (; (FindLine != Points[i]->lines.end()) && (FindLine->first == Points[j]->node->nr); FindLine++) { 1489 1830 TriangleMap *triangles = &FindLine->second->triangles; 1490 Log() << Verbose( 3) << "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "." << endl;1831 Log() << Verbose(1) << "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "." << endl; 1491 1832 for (TriangleMap::const_iterator FindTriangle = triangles->begin(); FindTriangle != triangles->end(); FindTriangle++) { 1492 1833 if (FindTriangle->second->IsPresentTupel(Points)) { … … 1494 1835 } 1495 1836 } 1496 Log() << Verbose( 3) << "end." << endl;1837 Log() << Verbose(1) << "end." << endl; 1497 1838 } 1498 1839 // Only one of the triangle lines must be considered for the triangle count. 1499 //Log() << Verbose( 2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;1840 //Log() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl; 1500 1841 //return adjacentTriangleCount; 1501 1842 } … … 1504 1845 } 1505 1846 1506 Log() << Verbose(2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl; 1507 Log() << Verbose(2) << "End of CheckPresenceOfTriangle" << endl; 1847 Log() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl; 1508 1848 return adjacentTriangleCount; 1509 1849 }; … … 1519 1859 class BoundaryTriangleSet * Tesselation::GetPresentTriangle(TesselPoint *Candidates[3]) 1520 1860 { 1861 Info FunctionInfo(__func__); 1521 1862 class BoundaryTriangleSet *triangle = NULL; 1522 1863 class BoundaryPointSet *Points[3]; … … 1548 1889 } 1549 1890 // Only one of the triangle lines must be considered for the triangle count. 1550 //Log() << Verbose( 2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;1891 //Log() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl; 1551 1892 //return adjacentTriangleCount; 1552 1893 } … … 1569 1910 void Tesselation::FindStartingTriangle(const double RADIUS, const LinkedCell *LC) 1570 1911 { 1571 Log() << Verbose(1) << "Begin of FindStartingTriangle\n";1912 Info FunctionInfo(__func__); 1572 1913 int i = 0; 1573 TesselPoint* FirstPoint = NULL;1574 TesselPoint* SecondPoint = NULL;1575 1914 TesselPoint* MaxPoint[NDIM]; 1915 TesselPoint* Temporary; 1576 1916 double maxCoordinate[NDIM]; 1577 Vector Oben;1917 BoundaryLineSet BaseLine; 1578 1918 Vector helper; 1579 1919 Vector Chord; 1580 1920 Vector SearchDirection; 1581 1582 Oben.Zero(); 1921 Vector CircleCenter; // center of the circle, i.e. of the band of sphere's centers 1922 Vector CirclePlaneNormal; // normal vector defining the plane this circle lives in 1923 Vector SphereCenter; 1924 Vector NormalVector; 1925 1926 NormalVector.Zero(); 1583 1927 1584 1928 for (i = 0; i < 3; i++) { … … 1593 1937 for (LC->n[(i+2)%NDIM]=0;LC->n[(i+2)%NDIM]<LC->N[(i+2)%NDIM];LC->n[(i+2)%NDIM]++) { 1594 1938 const LinkedNodes *List = LC->GetCurrentCell(); 1595 //Log() << Verbose( 2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;1939 //Log() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl; 1596 1940 if (List != NULL) { 1597 1941 for (LinkedNodes::const_iterator Runner = List->begin();Runner != List->end();Runner++) { 1598 1942 if ((*Runner)->node->x[i] > maxCoordinate[i]) { 1599 Log() << Verbose( 2) << "New maximal for axis " << i << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl;1943 Log() << Verbose(1) << "New maximal for axis " << i << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl; 1600 1944 maxCoordinate[i] = (*Runner)->node->x[i]; 1601 1945 MaxPoint[i] = (*Runner); … … 1608 1952 } 1609 1953 1610 Log() << Verbose( 2) << "Found maximum coordinates: ";1954 Log() << Verbose(1) << "Found maximum coordinates: "; 1611 1955 for (int i=0;i<NDIM;i++) 1612 1956 Log() << Verbose(0) << i << ": " << *MaxPoint[i] << "\t"; … … 1614 1958 1615 1959 BTS = NULL; 1616 CandidateList *OptCandidates = new CandidateList();1617 1960 for (int k=0;k<NDIM;k++) { 1618 Oben.Zero();1619 Oben.x[k] = 1.;1620 FirstPoint = MaxPoint[k];1621 Log() << Verbose( 1) << "Coordinates of start node at " << *FirstPoint->node << "." << endl;1961 NormalVector.Zero(); 1962 NormalVector.x[k] = 1.; 1963 BaseLine.endpoints[0] = new BoundaryPointSet(MaxPoint[k]); 1964 Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine.endpoints[0]->node << "." << endl; 1622 1965 1623 1966 double ShortestAngle; 1624 TesselPoint* OptCandidate = NULL;1625 1967 ShortestAngle = 999999.; // This will contain the angle, which will be always positive (when looking for second point), when looking for third point this will be the quadrant. 1626 1968 1627 FindSecondPointForTesselation(FirstPoint, Oben, OptCandidate, &ShortestAngle, RADIUS, LC); // we give same point as next candidate as its bonds are looked into in find_second_... 1628 SecondPoint = OptCandidate; 1629 if (SecondPoint == NULL) // have we found a second point? 1969 FindSecondPointForTesselation(BaseLine.endpoints[0]->node, NormalVector, Temporary, &ShortestAngle, RADIUS, LC); // we give same point as next candidate as its bonds are looked into in find_second_... 1970 if (Temporary == NULL) // have we found a second point? 1630 1971 continue; 1631 1632 helper.CopyVector(FirstPoint->node); 1633 helper.SubtractVector(SecondPoint->node); 1634 helper.Normalize(); 1635 Oben.ProjectOntoPlane(&helper); 1636 Oben.Normalize(); 1637 helper.VectorProduct(&Oben); 1972 BaseLine.endpoints[1] = new BoundaryPointSet(Temporary); 1973 1974 // construct center of circle 1975 CircleCenter.CopyVector(BaseLine.endpoints[0]->node->node); 1976 CircleCenter.AddVector(BaseLine.endpoints[1]->node->node); 1977 CircleCenter.Scale(0.5); 1978 1979 // construct normal vector of circle 1980 CirclePlaneNormal.CopyVector(BaseLine.endpoints[0]->node->node); 1981 CirclePlaneNormal.SubtractVector(BaseLine.endpoints[1]->node->node); 1982 1983 double radius = CirclePlaneNormal.NormSquared(); 1984 double CircleRadius = sqrt(RADIUS*RADIUS - radius/4.); 1985 1986 NormalVector.ProjectOntoPlane(&CirclePlaneNormal); 1987 NormalVector.Normalize(); 1638 1988 ShortestAngle = 2.*M_PI; // This will indicate the quadrant. 1639 1989 1640 Chord.CopyVector(FirstPoint->node); // bring into calling function 1641 Chord.SubtractVector(SecondPoint->node); 1642 double radius = Chord.ScalarProduct(&Chord); 1643 double CircleRadius = sqrt(RADIUS*RADIUS - radius/4.); 1644 helper.CopyVector(&Oben); 1645 helper.Scale(CircleRadius); 1646 // Now, oben and helper are two orthonormalized vectors in the plane defined by Chord (not normalized) 1990 SphereCenter.CopyVector(&NormalVector); 1991 SphereCenter.Scale(CircleRadius); 1992 SphereCenter.AddVector(&CircleCenter); 1993 // Now, NormalVector and SphereCenter are two orthonormalized vectors in the plane defined by CirclePlaneNormal (not normalized) 1647 1994 1648 1995 // look in one direction of baseline for initial candidate 1649 SearchDirection.MakeNormalVector(&C hord, &Oben); // whether we look "left" first or "right" first is not important ...1996 SearchDirection.MakeNormalVector(&CirclePlaneNormal, &NormalVector); // whether we look "left" first or "right" first is not important ... 1650 1997 1651 1998 // adding point 1 and point 2 and add the line between them 1652 Log() << Verbose(1) << "Coordinates of start node at " << *FirstPoint->node << "." << endl; 1653 AddTesselationPoint(FirstPoint, 0); 1654 Log() << Verbose(1) << "Found second point is at " << *SecondPoint->node << ".\n"; 1655 AddTesselationPoint(SecondPoint, 1); 1656 AddTesselationLine(TPS[0], TPS[1], 0); 1657 1658 //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << helper << ".\n"; 1659 FindThirdPointForTesselation(Oben, SearchDirection, helper, BLS[0], NULL, *&OptCandidates, &ShortestAngle, RADIUS, LC); 1660 Log() << Verbose(1) << "List of third Points is "; 1661 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1662 Log() << Verbose(0) << " " << *(*it)->point; 1663 } 1664 Log() << Verbose(0) << endl; 1665 1666 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1667 // add third triangle point 1668 AddTesselationPoint((*it)->point, 2); 1669 // add the second and third line 1670 AddTesselationLine(TPS[1], TPS[2], 1); 1671 AddTesselationLine(TPS[0], TPS[2], 2); 1672 // ... and triangles to the Maps of the Tesselation class 1673 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 1674 AddTesselationTriangle(); 1675 // ... and calculate its normal vector (with correct orientation) 1676 (*it)->OptCenter.Scale(-1.); 1677 Log() << Verbose(2) << "Anti-Oben is currently " << (*it)->OptCenter << "." << endl; 1678 BTS->GetNormalVector((*it)->OptCenter); // vector to compare with should point inwards 1679 Log() << Verbose(0) << "==> Found starting triangle consists of " << *FirstPoint << ", " << *SecondPoint << " and " 1680 << *(*it)->point << " with normal vector " << BTS->NormalVector << ".\n"; 1681 1682 // if we do not reach the end with the next step of iteration, we need to setup a new first line 1683 if (it != OptCandidates->end()--) { 1684 FirstPoint = (*it)->BaseLine->endpoints[0]->node; 1685 SecondPoint = (*it)->point; 1686 // adding point 1 and point 2 and the line between them 1687 AddTesselationPoint(FirstPoint, 0); 1688 AddTesselationPoint(SecondPoint, 1); 1689 AddTesselationLine(TPS[0], TPS[1], 0); 1690 } 1691 Log() << Verbose(2) << "Projection is " << BTS->NormalVector.ScalarProduct(&Oben) << "." << endl; 1692 } 1999 Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine.endpoints[0]->node << "." << endl; 2000 Log() << Verbose(0) << "Found second point is at " << *BaseLine.endpoints[1]->node << ".\n"; 2001 2002 //Log() << Verbose(1) << "INFO: OldSphereCenter is at " << helper << ".\n"; 2003 CandidateForTesselation OptCandidates(&BaseLine); 2004 FindThirdPointForTesselation(NormalVector, SearchDirection, SphereCenter, OptCandidates, NULL, RADIUS, LC); 2005 Log() << Verbose(0) << "List of third Points is:" << endl; 2006 for (TesselPointList::iterator it = OptCandidates.pointlist.begin(); it != OptCandidates.pointlist.end(); it++) { 2007 Log() << Verbose(0) << " " << *(*it) << endl; 2008 } 2009 2010 BTS = NULL; 2011 AddCandidateTriangle(OptCandidates); 2012 // delete(BaseLine.endpoints[0]); 2013 // delete(BaseLine.endpoints[1]); 2014 1693 2015 if (BTS != NULL) // we have created one starting triangle 1694 2016 break; 1695 2017 else { 1696 2018 // remove all candidates from the list and then the list itself 1697 class CandidateForTesselation *remover = NULL; 1698 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1699 remover = *it; 1700 delete(remover); 1701 } 1702 OptCandidates->clear(); 1703 } 1704 } 1705 1706 // remove all candidates from the list and then the list itself 1707 class CandidateForTesselation *remover = NULL; 1708 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1709 remover = *it; 1710 delete(remover); 1711 } 1712 delete(OptCandidates); 1713 Log() << Verbose(1) << "End of FindStartingTriangle\n"; 2019 OptCandidates.pointlist.clear(); 2020 } 2021 } 1714 2022 }; 1715 2023 1716 2024 /** Checks for a given baseline and a third point candidate whether baselines of the found triangle don't have even better candidates. 1717 2025 * This is supposed to prevent early closing of the tesselation. 1718 * \param *BaseRay baseline, i.e. not \a *OptCandidate2026 * \param CandidateLine CandidateForTesselation with baseline and shortestangle , i.e. not \a *OptCandidate 1719 2027 * \param *ThirdNode third point in triangle, not in BoundaryLineSet::endpoints 1720 * \param ShortestAngle path length on this circle band for the current \a *ThirdNode1721 2028 * \param RADIUS radius of sphere 1722 2029 * \param *LC LinkedCell structure 1723 2030 * \return true - there is a better candidate (smaller angle than \a ShortestAngle), false - no better TesselPoint candidate found 1724 2031 */ 1725 bool Tesselation::HasOtherBaselineBetterCandidate(const BoundaryLineSet * const BaseRay, const TesselPoint * const ThirdNode, double ShortestAngle, double RADIUS, const LinkedCell * const LC) const 1726 { 1727 bool result = false; 1728 Vector CircleCenter; 1729 Vector CirclePlaneNormal; 1730 Vector OldSphereCenter; 1731 Vector SearchDirection; 1732 Vector helper; 1733 TesselPoint *OtherOptCandidate = NULL; 1734 double OtherShortestAngle = 2.*M_PI; // This will indicate the quadrant. 1735 double radius, CircleRadius; 1736 BoundaryLineSet *Line = NULL; 1737 BoundaryTriangleSet *T = NULL; 1738 1739 Log() << Verbose(1) << "Begin of HasOtherBaselineBetterCandidate" << endl; 1740 1741 // check both other lines 1742 PointMap::const_iterator FindPoint = PointsOnBoundary.find(ThirdNode->nr); 1743 if (FindPoint != PointsOnBoundary.end()) { 1744 for (int i=0;i<2;i++) { 1745 LineMap::const_iterator FindLine = (FindPoint->second)->lines.find(BaseRay->endpoints[0]->node->nr); 1746 if (FindLine != (FindPoint->second)->lines.end()) { 1747 Line = FindLine->second; 1748 Log() << Verbose(1) << "Found line " << *Line << "." << endl; 1749 if (Line->triangles.size() == 1) { 1750 T = Line->triangles.begin()->second; 1751 // construct center of circle 1752 CircleCenter.CopyVector(Line->endpoints[0]->node->node); 1753 CircleCenter.AddVector(Line->endpoints[1]->node->node); 1754 CircleCenter.Scale(0.5); 1755 1756 // construct normal vector of circle 1757 CirclePlaneNormal.CopyVector(Line->endpoints[0]->node->node); 1758 CirclePlaneNormal.SubtractVector(Line->endpoints[1]->node->node); 1759 1760 // calculate squared radius of circle 1761 radius = CirclePlaneNormal.ScalarProduct(&CirclePlaneNormal); 1762 if (radius/4. < RADIUS*RADIUS) { 1763 CircleRadius = RADIUS*RADIUS - radius/4.; 1764 CirclePlaneNormal.Normalize(); 1765 //Log() << Verbose(2) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl; 1766 1767 // construct old center 1768 GetCenterofCircumcircle(&OldSphereCenter, *T->endpoints[0]->node->node, *T->endpoints[1]->node->node, *T->endpoints[2]->node->node); 1769 helper.CopyVector(&T->NormalVector); // normal vector ensures that this is correct center of the two possible ones 1770 radius = Line->endpoints[0]->node->node->DistanceSquared(&OldSphereCenter); 1771 helper.Scale(sqrt(RADIUS*RADIUS - radius)); 1772 OldSphereCenter.AddVector(&helper); 1773 OldSphereCenter.SubtractVector(&CircleCenter); 1774 //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl; 1775 1776 // construct SearchDirection 1777 SearchDirection.MakeNormalVector(&T->NormalVector, &CirclePlaneNormal); 1778 helper.CopyVector(Line->endpoints[0]->node->node); 1779 helper.SubtractVector(ThirdNode->node); 1780 if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards! 1781 SearchDirection.Scale(-1.); 1782 SearchDirection.ProjectOntoPlane(&OldSphereCenter); 1783 SearchDirection.Normalize(); 1784 Log() << Verbose(2) << "INFO: SearchDirection is " << SearchDirection << "." << endl; 1785 if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) { 1786 // rotated the wrong way! 1787 eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl; 1788 } 1789 1790 // add third point 1791 CandidateList *OptCandidates = new CandidateList(); 1792 FindThirdPointForTesselation(T->NormalVector, SearchDirection, OldSphereCenter, Line, ThirdNode, OptCandidates, &OtherShortestAngle, RADIUS, LC); 1793 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1794 if (((*it)->point == BaseRay->endpoints[0]->node) || ((*it)->point == BaseRay->endpoints[1]->node)) // skip if it's the same triangle than suggested 1795 continue; 1796 Log() << Verbose(1) << " Third point candidate is " << *(*it)->point 1797 << " with circumsphere's center at " << (*it)->OptCenter << "." << endl; 1798 Log() << Verbose(1) << " Baseline is " << *BaseRay << endl; 1799 1800 // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2) 1801 TesselPoint *PointCandidates[3]; 1802 PointCandidates[0] = (*it)->point; 1803 PointCandidates[1] = BaseRay->endpoints[0]->node; 1804 PointCandidates[2] = BaseRay->endpoints[1]->node; 1805 bool check=false; 1806 int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates); 1807 // If there is no triangle, add it regularly. 1808 if (existentTrianglesCount == 0) { 1809 SetTesselationPoint((*it)->point, 0); 1810 SetTesselationPoint(BaseRay->endpoints[0]->node, 1); 1811 SetTesselationPoint(BaseRay->endpoints[1]->node, 2); 1812 1813 if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) { 1814 OtherOptCandidate = (*it)->point; 1815 check = true; 1816 } 1817 } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time. 1818 SetTesselationPoint((*it)->point, 0); 1819 SetTesselationPoint(BaseRay->endpoints[0]->node, 1); 1820 SetTesselationPoint(BaseRay->endpoints[1]->node, 2); 1821 1822 // We demand that at most one new degenerate line is created and that this line also already exists (which has to be the case due to existentTrianglesCount == 1) 1823 // i.e. at least one of the three lines must be present with TriangleCount <= 1 1824 if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS)) { 1825 OtherOptCandidate = (*it)->point; 1826 check = true; 1827 } 1828 } 1829 1830 if (check) { 1831 if (ShortestAngle > OtherShortestAngle) { 1832 Log() << Verbose(1) << "There is a better candidate than " << *ThirdNode << " with " << ShortestAngle << " from baseline " << *Line << ": " << *OtherOptCandidate << " with " << OtherShortestAngle << "." << endl; 1833 result = true; 1834 break; 1835 } 1836 } 1837 } 1838 delete(OptCandidates); 1839 if (result) 1840 break; 1841 } else { 1842 Log() << Verbose(1) << "Circumcircle for base line " << *Line << " and base triangle " << T << " is too big!" << endl; 1843 } 1844 } else { 1845 eLog() << Verbose(2) << "Baseline is connected to two triangles already?" << endl; 1846 } 1847 } else { 1848 Log() << Verbose(2) << "No present baseline between " << BaseRay->endpoints[0] << " and candidate " << *ThirdNode << "." << endl; 1849 } 1850 } 1851 } else { 1852 eLog() << Verbose(1) << "Could not find the TesselPoint " << *ThirdNode << "." << endl; 1853 } 1854 1855 Log() << Verbose(1) << "End of HasOtherBaselineBetterCandidate" << endl; 1856 1857 return result; 1858 }; 2032 //bool Tesselation::HasOtherBaselineBetterCandidate(CandidateForTesselation &CandidateLine, const TesselPoint * const ThirdNode, double RADIUS, const LinkedCell * const LC) const 2033 //{ 2034 // Info FunctionInfo(__func__); 2035 // bool result = false; 2036 // Vector CircleCenter; 2037 // Vector CirclePlaneNormal; 2038 // Vector OldSphereCenter; 2039 // Vector SearchDirection; 2040 // Vector helper; 2041 // TesselPoint *OtherOptCandidate = NULL; 2042 // double OtherShortestAngle = 2.*M_PI; // This will indicate the quadrant. 2043 // double radius, CircleRadius; 2044 // BoundaryLineSet *Line = NULL; 2045 // BoundaryTriangleSet *T = NULL; 2046 // 2047 // // check both other lines 2048 // PointMap::const_iterator FindPoint = PointsOnBoundary.find(ThirdNode->nr); 2049 // if (FindPoint != PointsOnBoundary.end()) { 2050 // for (int i=0;i<2;i++) { 2051 // LineMap::const_iterator FindLine = (FindPoint->second)->lines.find(BaseRay->endpoints[0]->node->nr); 2052 // if (FindLine != (FindPoint->second)->lines.end()) { 2053 // Line = FindLine->second; 2054 // Log() << Verbose(0) << "Found line " << *Line << "." << endl; 2055 // if (Line->triangles.size() == 1) { 2056 // T = Line->triangles.begin()->second; 2057 // // construct center of circle 2058 // CircleCenter.CopyVector(Line->endpoints[0]->node->node); 2059 // CircleCenter.AddVector(Line->endpoints[1]->node->node); 2060 // CircleCenter.Scale(0.5); 2061 // 2062 // // construct normal vector of circle 2063 // CirclePlaneNormal.CopyVector(Line->endpoints[0]->node->node); 2064 // CirclePlaneNormal.SubtractVector(Line->endpoints[1]->node->node); 2065 // 2066 // // calculate squared radius of circle 2067 // radius = CirclePlaneNormal.ScalarProduct(&CirclePlaneNormal); 2068 // if (radius/4. < RADIUS*RADIUS) { 2069 // CircleRadius = RADIUS*RADIUS - radius/4.; 2070 // CirclePlaneNormal.Normalize(); 2071 // //Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl; 2072 // 2073 // // construct old center 2074 // GetCenterofCircumcircle(&OldSphereCenter, *T->endpoints[0]->node->node, *T->endpoints[1]->node->node, *T->endpoints[2]->node->node); 2075 // helper.CopyVector(&T->NormalVector); // normal vector ensures that this is correct center of the two possible ones 2076 // radius = Line->endpoints[0]->node->node->DistanceSquared(&OldSphereCenter); 2077 // helper.Scale(sqrt(RADIUS*RADIUS - radius)); 2078 // OldSphereCenter.AddVector(&helper); 2079 // OldSphereCenter.SubtractVector(&CircleCenter); 2080 // //Log() << Verbose(1) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl; 2081 // 2082 // // construct SearchDirection 2083 // SearchDirection.MakeNormalVector(&T->NormalVector, &CirclePlaneNormal); 2084 // helper.CopyVector(Line->endpoints[0]->node->node); 2085 // helper.SubtractVector(ThirdNode->node); 2086 // if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards! 2087 // SearchDirection.Scale(-1.); 2088 // SearchDirection.ProjectOntoPlane(&OldSphereCenter); 2089 // SearchDirection.Normalize(); 2090 // Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl; 2091 // if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) { 2092 // // rotated the wrong way! 2093 // eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl; 2094 // } 2095 // 2096 // // add third point 2097 // FindThirdPointForTesselation(T->NormalVector, SearchDirection, OldSphereCenter, OptCandidates, ThirdNode, RADIUS, LC); 2098 // for (TesselPointList::iterator it = OptCandidates.pointlist.begin(); it != OptCandidates.pointlist.end(); ++it) { 2099 // if (((*it) == BaseRay->endpoints[0]->node) || ((*it) == BaseRay->endpoints[1]->node)) // skip if it's the same triangle than suggested 2100 // continue; 2101 // Log() << Verbose(0) << " Third point candidate is " << (*it) 2102 // << " with circumsphere's center at " << (*it)->OptCenter << "." << endl; 2103 // Log() << Verbose(0) << " Baseline is " << *BaseRay << endl; 2104 // 2105 // // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2) 2106 // TesselPoint *PointCandidates[3]; 2107 // PointCandidates[0] = (*it); 2108 // PointCandidates[1] = BaseRay->endpoints[0]->node; 2109 // PointCandidates[2] = BaseRay->endpoints[1]->node; 2110 // bool check=false; 2111 // int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates); 2112 // // If there is no triangle, add it regularly. 2113 // if (existentTrianglesCount == 0) { 2114 // SetTesselationPoint((*it), 0); 2115 // SetTesselationPoint(BaseRay->endpoints[0]->node, 1); 2116 // SetTesselationPoint(BaseRay->endpoints[1]->node, 2); 2117 // 2118 // if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) { 2119 // OtherOptCandidate = (*it); 2120 // check = true; 2121 // } 2122 // } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time. 2123 // SetTesselationPoint((*it), 0); 2124 // SetTesselationPoint(BaseRay->endpoints[0]->node, 1); 2125 // SetTesselationPoint(BaseRay->endpoints[1]->node, 2); 2126 // 2127 // // We demand that at most one new degenerate line is created and that this line also already exists (which has to be the case due to existentTrianglesCount == 1) 2128 // // i.e. at least one of the three lines must be present with TriangleCount <= 1 2129 // if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS)) { 2130 // OtherOptCandidate = (*it); 2131 // check = true; 2132 // } 2133 // } 2134 // 2135 // if (check) { 2136 // if (ShortestAngle > OtherShortestAngle) { 2137 // Log() << Verbose(0) << "There is a better candidate than " << *ThirdNode << " with " << ShortestAngle << " from baseline " << *Line << ": " << *OtherOptCandidate << " with " << OtherShortestAngle << "." << endl; 2138 // result = true; 2139 // break; 2140 // } 2141 // } 2142 // } 2143 // delete(OptCandidates); 2144 // if (result) 2145 // break; 2146 // } else { 2147 // Log() << Verbose(0) << "Circumcircle for base line " << *Line << " and base triangle " << T << " is too big!" << endl; 2148 // } 2149 // } else { 2150 // eLog() << Verbose(2) << "Baseline is connected to two triangles already?" << endl; 2151 // } 2152 // } else { 2153 // Log() << Verbose(1) << "No present baseline between " << BaseRay->endpoints[0] << " and candidate " << *ThirdNode << "." << endl; 2154 // } 2155 // } 2156 // } else { 2157 // eLog() << Verbose(1) << "Could not find the TesselPoint " << *ThirdNode << "." << endl; 2158 // } 2159 // 2160 // return result; 2161 //}; 1859 2162 1860 2163 /** This function finds a triangle to a line, adjacent to an existing one. 1861 2164 * @param out output stream for debugging 1862 * @param Line currentbaseline to search from2165 * @param CandidateLine current cadndiate baseline to search from 1863 2166 * @param T current triangle which \a Line is edge of 1864 2167 * @param RADIUS radius of the rolling ball … … 1866 2169 * @param *LC LinkedCell structure with neighbouring points 1867 2170 */ 1868 bool Tesselation::FindNextSuitableTriangle( BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC)1869 { 1870 Log() << Verbose(0) << "Begin of FindNextSuitableTriangle\n";2171 bool Tesselation::FindNextSuitableTriangle(CandidateForTesselation &CandidateLine, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC) 2172 { 2173 Info FunctionInfo(__func__); 1871 2174 bool result = true; 1872 CandidateList *OptCandidates = new CandidateList();1873 2175 1874 2176 Vector CircleCenter; 1875 2177 Vector CirclePlaneNormal; 1876 Vector OldSphereCenter;2178 Vector RelativeSphereCenter; 1877 2179 Vector SearchDirection; 1878 2180 Vector helper; 1879 2181 TesselPoint *ThirdNode = NULL; 1880 2182 LineMap::iterator testline; 1881 double ShortestAngle = 2.*M_PI; // This will indicate the quadrant.1882 2183 double radius, CircleRadius; 1883 2184 1884 Log() << Verbose(1) << "Current baseline is " << Line << " of triangle " << T << "." << endl;1885 2185 for (int i=0;i<3;i++) 1886 if ((T.endpoints[i]->node != Line.endpoints[0]->node) && (T.endpoints[i]->node != Line.endpoints[1]->node))2186 if ((T.endpoints[i]->node != CandidateLine.BaseLine->endpoints[0]->node) && (T.endpoints[i]->node != CandidateLine.BaseLine->endpoints[1]->node)) { 1887 2187 ThirdNode = T.endpoints[i]->node; 2188 break; 2189 } 2190 Log() << Verbose(0) << "Current baseline is " << *CandidateLine.BaseLine << " with ThirdNode " << *ThirdNode << " of triangle " << T << "." << endl; 1888 2191 1889 2192 // construct center of circle 1890 CircleCenter.CopyVector( Line.endpoints[0]->node->node);1891 CircleCenter.AddVector( Line.endpoints[1]->node->node);2193 CircleCenter.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node); 2194 CircleCenter.AddVector(CandidateLine.BaseLine->endpoints[1]->node->node); 1892 2195 CircleCenter.Scale(0.5); 1893 2196 1894 2197 // construct normal vector of circle 1895 CirclePlaneNormal.CopyVector( Line.endpoints[0]->node->node);1896 CirclePlaneNormal.SubtractVector( Line.endpoints[1]->node->node);2198 CirclePlaneNormal.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node); 2199 CirclePlaneNormal.SubtractVector(CandidateLine.BaseLine->endpoints[1]->node->node); 1897 2200 1898 2201 // calculate squared radius of circle 1899 2202 radius = CirclePlaneNormal.ScalarProduct(&CirclePlaneNormal); 1900 2203 if (radius/4. < RADIUS*RADIUS) { 2204 // construct relative sphere center with now known CircleCenter 2205 RelativeSphereCenter.CopyVector(&T.SphereCenter); 2206 RelativeSphereCenter.SubtractVector(&CircleCenter); 2207 1901 2208 CircleRadius = RADIUS*RADIUS - radius/4.; 1902 2209 CirclePlaneNormal.Normalize(); 1903 //Log() << Verbose(2) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl; 1904 1905 // construct old center 1906 GetCenterofCircumcircle(&OldSphereCenter, *T.endpoints[0]->node->node, *T.endpoints[1]->node->node, *T.endpoints[2]->node->node); 1907 helper.CopyVector(&T.NormalVector); // normal vector ensures that this is correct center of the two possible ones 1908 radius = Line.endpoints[0]->node->node->DistanceSquared(&OldSphereCenter); 1909 helper.Scale(sqrt(RADIUS*RADIUS - radius)); 1910 OldSphereCenter.AddVector(&helper); 1911 OldSphereCenter.SubtractVector(&CircleCenter); 1912 //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl; 1913 1914 // construct SearchDirection 1915 SearchDirection.MakeNormalVector(&T.NormalVector, &CirclePlaneNormal); 1916 helper.CopyVector(Line.endpoints[0]->node->node); 2210 Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl; 2211 2212 Log() << Verbose(1) << "INFO: OldSphereCenter is at " << T.SphereCenter << "." << endl; 2213 2214 // construct SearchDirection and an "outward pointer" 2215 SearchDirection.MakeNormalVector(&RelativeSphereCenter, &CirclePlaneNormal); 2216 helper.CopyVector(&CircleCenter); 1917 2217 helper.SubtractVector(ThirdNode->node); 1918 2218 if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards! 1919 2219 SearchDirection.Scale(-1.); 1920 SearchDirection.ProjectOntoPlane(&OldSphereCenter); 1921 SearchDirection.Normalize(); 1922 Log() << Verbose(2) << "INFO: SearchDirection is " << SearchDirection << "." << endl; 1923 if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) { 2220 Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl; 2221 if (fabs(RelativeSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) { 1924 2222 // rotated the wrong way! 1925 2223 eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl; … … 1927 2225 1928 2226 // add third point 1929 FindThirdPointForTesselation(T.NormalVector, SearchDirection, OldSphereCenter, &Line, ThirdNode, OptCandidates, &ShortestAngle, RADIUS, LC);2227 FindThirdPointForTesselation(T.NormalVector, SearchDirection, T.SphereCenter, CandidateLine, ThirdNode, RADIUS, LC); 1930 2228 1931 2229 } else { 1932 Log() << Verbose( 1) << "Circumcircle for base line " <<Line << " and base triangle " << T << " is too big!" << endl;1933 } 1934 1935 if ( OptCandidates->begin() == OptCandidates->end()) {2230 Log() << Verbose(0) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and base triangle " << T << " is too big!" << endl; 2231 } 2232 2233 if (CandidateLine.pointlist.empty()) { 1936 2234 eLog() << Verbose(2) << "Could not find a suitable candidate." << endl; 1937 2235 return false; 1938 2236 } 1939 Log() << Verbose(1) << "Third Points are "; 1940 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1941 Log() << Verbose(1) << " " << *(*it)->point << endl; 1942 } 1943 1944 BoundaryLineSet *BaseRay = &Line; 1945 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1946 Log() << Verbose(1) << " Third point candidate is " << *(*it)->point 1947 << " with circumsphere's center at " << (*it)->OptCenter << "." << endl; 1948 Log() << Verbose(1) << " Baseline is " << *BaseRay << endl; 1949 1950 // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2) 1951 TesselPoint *PointCandidates[3]; 1952 PointCandidates[0] = (*it)->point; 1953 PointCandidates[1] = BaseRay->endpoints[0]->node; 1954 PointCandidates[2] = BaseRay->endpoints[1]->node; 1955 int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates); 1956 1957 BTS = NULL; 1958 // check for present edges and whether we reach better candidates from them 1959 //if (HasOtherBaselineBetterCandidate(BaseRay, (*it)->point, ShortestAngle, RADIUS, LC) ) { 1960 if (0) { 1961 result = false; 1962 break; 1963 } else { 1964 // If there is no triangle, add it regularly. 1965 if (existentTrianglesCount == 0) { 1966 AddTesselationPoint((*it)->point, 0); 1967 AddTesselationPoint(BaseRay->endpoints[0]->node, 1); 1968 AddTesselationPoint(BaseRay->endpoints[1]->node, 2); 1969 1970 if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) { 1971 AddTesselationLine(TPS[0], TPS[1], 0); 1972 AddTesselationLine(TPS[0], TPS[2], 1); 1973 AddTesselationLine(TPS[1], TPS[2], 2); 1974 1975 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 1976 AddTesselationTriangle(); 1977 (*it)->OptCenter.Scale(-1.); 1978 BTS->GetNormalVector((*it)->OptCenter); 1979 (*it)->OptCenter.Scale(-1.); 1980 1981 Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector 1982 << " for this triangle ... " << endl; 1983 //Log() << Verbose(1) << "We have "<< TrianglesOnBoundaryCount << " for line " << *BaseRay << "." << endl; 1984 } else { 1985 eLog() << Verbose(2) << "This triangle consisting of "; 1986 Log() << Verbose(0) << *(*it)->point << ", "; 1987 Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and "; 1988 Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " "; 1989 Log() << Verbose(0) << "exists and is not added, as it does not seem helpful!" << endl; 1990 result = false; 1991 } 1992 } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time. 1993 AddTesselationPoint((*it)->point, 0); 1994 AddTesselationPoint(BaseRay->endpoints[0]->node, 1); 1995 AddTesselationPoint(BaseRay->endpoints[1]->node, 2); 1996 1997 // We demand that at most one new degenerate line is created and that this line also already exists (which has to be the case due to existentTrianglesCount == 1) 1998 // i.e. at least one of the three lines must be present with TriangleCount <= 1 1999 if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS)) { 2000 AddTesselationLine(TPS[0], TPS[1], 0); 2001 AddTesselationLine(TPS[0], TPS[2], 1); 2002 AddTesselationLine(TPS[1], TPS[2], 2); 2003 2004 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 2005 AddTesselationTriangle(); // add to global map 2006 2007 (*it)->OtherOptCenter.Scale(-1.); 2008 BTS->GetNormalVector((*it)->OtherOptCenter); 2009 (*it)->OtherOptCenter.Scale(-1.); 2010 2011 eLog() << Verbose(2) << "--> WARNING: Special new triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " for this triangle ... " << endl; 2012 Log() << Verbose(1) << "We have "<< BaseRay->triangles.size() << " for line " << BaseRay << "." << endl; 2013 } else { 2014 eLog() << Verbose(2) << "This triangle consisting of " << *(*it)->point << ", " << *BaseRay->endpoints[0]->node << " and " << *BaseRay->endpoints[1]->node << " " << "exists and is not added, as it does not seem helpful!" << endl; 2015 result = false; 2016 } 2017 } else { 2018 Log() << Verbose(1) << "This triangle consisting of "; 2019 Log() << Verbose(0) << *(*it)->point << ", "; 2020 Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and "; 2021 Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " "; 2022 Log() << Verbose(0) << "is invalid!" << endl; 2023 result = false; 2024 } 2025 } 2026 2027 // set baseline to new ray from ref point (here endpoints[0]->node) to current candidate (here (*it)->point)) 2028 BaseRay = BLS[0]; 2029 if ((BTS != NULL) && (BTS->NormalVector.NormSquared() < MYEPSILON)) { 2030 eLog() << Verbose(1) << "Triangle " << *BTS << " has zero normal vector!" << endl; 2031 exit(255); 2032 } 2033 2034 } 2035 2036 // remove all candidates from the list and then the list itself 2037 class CandidateForTesselation *remover = NULL; 2038 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 2039 remover = *it; 2040 delete(remover); 2041 } 2042 delete(OptCandidates); 2043 Log() << Verbose(0) << "End of FindNextSuitableTriangle\n"; 2237 Log() << Verbose(0) << "Third Points are: " << endl; 2238 for (TesselPointList::iterator it = CandidateLine.pointlist.begin(); it != CandidateLine.pointlist.end(); ++it) { 2239 Log() << Verbose(0) << " " << *(*it) << endl; 2240 } 2241 2242 return true; 2243 2244 // BoundaryLineSet *BaseRay = CandidateLine.BaseLine; 2245 // for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 2246 // Log() << Verbose(0) << "Third point candidate is " << *(*it)->point 2247 // << " with circumsphere's center at " << (*it)->OptCenter << "." << endl; 2248 // Log() << Verbose(0) << "Baseline is " << *BaseRay << endl; 2249 // 2250 // // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2) 2251 // TesselPoint *PointCandidates[3]; 2252 // PointCandidates[0] = (*it)->point; 2253 // PointCandidates[1] = BaseRay->endpoints[0]->node; 2254 // PointCandidates[2] = BaseRay->endpoints[1]->node; 2255 // int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates); 2256 // 2257 // BTS = NULL; 2258 // // check for present edges and whether we reach better candidates from them 2259 // //if (HasOtherBaselineBetterCandidate(BaseRay, (*it)->point, ShortestAngle, RADIUS, LC) ) { 2260 // if (0) { 2261 // result = false; 2262 // break; 2263 // } else { 2264 // // If there is no triangle, add it regularly. 2265 // if (existentTrianglesCount == 0) { 2266 // AddTesselationPoint((*it)->point, 0); 2267 // AddTesselationPoint(BaseRay->endpoints[0]->node, 1); 2268 // AddTesselationPoint(BaseRay->endpoints[1]->node, 2); 2269 // 2270 // if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) { 2271 // CandidateLine.point = (*it)->point; 2272 // CandidateLine.OptCenter.CopyVector(&((*it)->OptCenter)); 2273 // CandidateLine.OtherOptCenter.CopyVector(&((*it)->OtherOptCenter)); 2274 // CandidateLine.ShortestAngle = ShortestAngle; 2275 // } else { 2276 //// eLog() << Verbose(1) << "This triangle consisting of "; 2277 //// Log() << Verbose(0) << *(*it)->point << ", "; 2278 //// Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and "; 2279 //// Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " "; 2280 //// Log() << Verbose(0) << "exists and is not added, as it 0x80000000006fc150(does not seem helpful!" << endl; 2281 // result = false; 2282 // } 2283 // } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time. 2284 // AddTesselationPoint((*it)->point, 0); 2285 // AddTesselationPoint(BaseRay->endpoints[0]->node, 1); 2286 // AddTesselationPoint(BaseRay->endpoints[1]->node, 2); 2287 // 2288 // // We demand that at most one new degenerate line is created and that this line also already exists (which has to be the case due to existentTrianglesCount == 1) 2289 // // i.e. at least one of the three lines must be present with TriangleCount <= 1 2290 // if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS) || CandidateLine.BaseLine->skipped) { 2291 // CandidateLine.point = (*it)->point; 2292 // CandidateLine.OptCenter.CopyVector(&(*it)->OptCenter); 2293 // CandidateLine.OtherOptCenter.CopyVector(&(*it)->OtherOptCenter); 2294 // CandidateLine.ShortestAngle = ShortestAngle+2.*M_PI; 2295 // 2296 // } else { 2297 //// eLog() << Verbose(1) << "This triangle consisting of " << *(*it)->point << ", " << *BaseRay->endpoints[0]->node << " and " << *BaseRay->endpoints[1]->node << " " << "exists and is not added, as it does not seem helpful!" << endl; 2298 // result = false; 2299 // } 2300 // } else { 2301 //// Log() << Verbose(1) << "This triangle consisting of "; 2302 //// Log() << Verbose(0) << *(*it)->point << ", "; 2303 //// Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and "; 2304 //// Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " "; 2305 //// Log() << Verbose(0) << "is invalid!" << endl; 2306 // result = false; 2307 // } 2308 // } 2309 // 2310 // // set baseline to new ray from ref point (here endpoints[0]->node) to current candidate (here (*it)->point)) 2311 // BaseRay = BLS[0]; 2312 // if ((BTS != NULL) && (BTS->NormalVector.NormSquared() < MYEPSILON)) { 2313 // eLog() << Verbose(1) << "Triangle " << *BTS << " has zero normal vector!" << endl; 2314 // exit(255); 2315 // } 2316 // 2317 // } 2318 // 2319 // // remove all candidates from the list and then the list itself 2320 // class CandidateForTesselation *remover = NULL; 2321 // for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 2322 // remover = *it; 2323 // delete(remover); 2324 // } 2325 // delete(OptCandidates); 2044 2326 return result; 2327 }; 2328 2329 /** Adds the present line and candidate point from \a &CandidateLine to the Tesselation. 2330 * \param CandidateLine triangle to add 2331 * \NOTE we need the copy operator here as the original CandidateForTesselation is removed in AddTesselationLine() 2332 */ 2333 void Tesselation::AddCandidateTriangle(CandidateForTesselation CandidateLine) 2334 { 2335 Info FunctionInfo(__func__); 2336 Vector Center; 2337 TesselPoint * const TurningPoint = CandidateLine.BaseLine->endpoints[0]->node; 2338 2339 // fill the set of neighbours 2340 Center.CopyVector(CandidateLine.BaseLine->endpoints[1]->node->node); 2341 Center.SubtractVector(TurningPoint->node); 2342 set<TesselPoint*> SetOfNeighbours; 2343 SetOfNeighbours.insert(CandidateLine.BaseLine->endpoints[1]->node); 2344 for (TesselPointList::iterator Runner = CandidateLine.pointlist.begin(); Runner != CandidateLine.pointlist.end(); Runner++) 2345 SetOfNeighbours.insert(*Runner); 2346 TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(&SetOfNeighbours, TurningPoint, &Center); 2347 2348 // go through all angle-sorted candidates (in degenerate n-nodes case we may have to add multiple triangles) 2349 TesselPointList::iterator Runner = connectedClosestPoints->begin(); 2350 TesselPointList::iterator Sprinter = Runner; 2351 Sprinter++; 2352 while(Sprinter != connectedClosestPoints->end()) { 2353 // add the points 2354 AddTesselationPoint(TurningPoint, 0); 2355 AddTesselationPoint((*Runner), 1); 2356 AddTesselationPoint((*Sprinter), 2); 2357 2358 2359 // add the lines 2360 AddTesselationLine(TPS[0], TPS[1], 0); 2361 AddTesselationLine(TPS[0], TPS[2], 1); 2362 AddTesselationLine(TPS[1], TPS[2], 2); 2363 2364 // add the triangles 2365 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 2366 AddTesselationTriangle(); 2367 BTS->GetCenter(&Center); 2368 Center.SubtractVector(&CandidateLine.OptCenter); 2369 BTS->SphereCenter.CopyVector(&CandidateLine.OptCenter); 2370 BTS->GetNormalVector(Center); 2371 2372 Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector << "." << endl; 2373 Runner = Sprinter; 2374 Sprinter++; 2375 } 2376 delete(connectedClosestPoints); 2045 2377 }; 2046 2378 … … 2054 2386 class BoundaryPointSet *Tesselation::IsConvexRectangle(class BoundaryLineSet *Base) 2055 2387 { 2388 Info FunctionInfo(__func__); 2056 2389 class BoundaryPointSet *Spot = NULL; 2057 2390 class BoundaryLineSet *OtherBase; … … 2065 2398 OtherBase = new class BoundaryLineSet(BPS,-1); 2066 2399 2067 Log() << Verbose( 3) << "INFO: Current base line is " << *Base << "." << endl;2068 Log() << Verbose( 3) << "INFO: Other base line is " << *OtherBase << "." << endl;2400 Log() << Verbose(1) << "INFO: Current base line is " << *Base << "." << endl; 2401 Log() << Verbose(1) << "INFO: Other base line is " << *OtherBase << "." << endl; 2069 2402 2070 2403 // get the closest point on each line to the other line … … 2086 2419 delete(ClosestPoint); 2087 2420 if ((distance[0] * distance[1]) > 0) { // have same sign? 2088 Log() << Verbose( 3) << "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1] << ". " << *Base << "' rectangle is concave." << endl;2421 Log() << Verbose(1) << "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1] << ". " << *Base << "' rectangle is concave." << endl; 2089 2422 if (distance[0] < distance[1]) { 2090 2423 Spot = Base->endpoints[0]; … … 2094 2427 return Spot; 2095 2428 } else { // different sign, i.e. we are in between 2096 Log() << Verbose( 3) << "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex." << endl;2429 Log() << Verbose(0) << "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex." << endl; 2097 2430 return NULL; 2098 2431 } … … 2102 2435 void Tesselation::PrintAllBoundaryPoints(ofstream *out) const 2103 2436 { 2437 Info FunctionInfo(__func__); 2104 2438 // print all lines 2105 Log() << Verbose( 1) << "Printing all boundary points for debugging:" << endl;2439 Log() << Verbose(0) << "Printing all boundary points for debugging:" << endl; 2106 2440 for (PointMap::const_iterator PointRunner = PointsOnBoundary.begin();PointRunner != PointsOnBoundary.end(); PointRunner++) 2107 Log() << Verbose( 2) << *(PointRunner->second) << endl;2441 Log() << Verbose(0) << *(PointRunner->second) << endl; 2108 2442 }; 2109 2443 2110 2444 void Tesselation::PrintAllBoundaryLines(ofstream *out) const 2111 2445 { 2446 Info FunctionInfo(__func__); 2112 2447 // print all lines 2113 Log() << Verbose( 1) << "Printing all boundary lines for debugging:" << endl;2448 Log() << Verbose(0) << "Printing all boundary lines for debugging:" << endl; 2114 2449 for (LineMap::const_iterator LineRunner = LinesOnBoundary.begin(); LineRunner != LinesOnBoundary.end(); LineRunner++) 2115 Log() << Verbose( 2) << *(LineRunner->second) << endl;2450 Log() << Verbose(0) << *(LineRunner->second) << endl; 2116 2451 }; 2117 2452 2118 2453 void Tesselation::PrintAllBoundaryTriangles(ofstream *out) const 2119 2454 { 2455 Info FunctionInfo(__func__); 2120 2456 // print all triangles 2121 Log() << Verbose( 1) << "Printing all boundary triangles for debugging:" << endl;2457 Log() << Verbose(0) << "Printing all boundary triangles for debugging:" << endl; 2122 2458 for (TriangleMap::const_iterator TriangleRunner = TrianglesOnBoundary.begin(); TriangleRunner != TrianglesOnBoundary.end(); TriangleRunner++) 2123 Log() << Verbose( 2) << *(TriangleRunner->second) << endl;2459 Log() << Verbose(0) << *(TriangleRunner->second) << endl; 2124 2460 }; 2125 2461 … … 2131 2467 double Tesselation::PickFarthestofTwoBaselines(class BoundaryLineSet *Base) 2132 2468 { 2469 Info FunctionInfo(__func__); 2133 2470 class BoundaryLineSet *OtherBase; 2134 2471 Vector *ClosestPoint[2]; … … 2142 2479 OtherBase = new class BoundaryLineSet(BPS,-1); 2143 2480 2144 Log() << Verbose( 3) << "INFO: Current base line is " << *Base << "." << endl;2145 Log() << Verbose( 3) << "INFO: Other base line is " << *OtherBase << "." << endl;2481 Log() << Verbose(0) << "INFO: Current base line is " << *Base << "." << endl; 2482 Log() << Verbose(0) << "INFO: Other base line is " << *OtherBase << "." << endl; 2146 2483 2147 2484 // get the closest point on each line to the other line … … 2163 2500 2164 2501 if (Distance.NormSquared() < MYEPSILON) { // check for intersection 2165 Log() << Verbose( 3) << "REJECT: Both lines have an intersection: Nothing to do." << endl;2502 Log() << Verbose(0) << "REJECT: Both lines have an intersection: Nothing to do." << endl; 2166 2503 return false; 2167 2504 } else { // check for sign against BaseLineNormal … … 2173 2510 } 2174 2511 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) { 2175 Log() << Verbose( 4) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;2512 Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl; 2176 2513 BaseLineNormal.AddVector(&(runner->second->NormalVector)); 2177 2514 } … … 2179 2516 2180 2517 if (Distance.ScalarProduct(&BaseLineNormal) > MYEPSILON) { // Distance points outwards, hence OtherBase higher than Base -> flip 2181 Log() << Verbose( 2) << "ACCEPT: Other base line would be higher: Flipping baseline." << endl;2518 Log() << Verbose(0) << "ACCEPT: Other base line would be higher: Flipping baseline." << endl; 2182 2519 // calculate volume summand as a general tetraeder 2183 2520 return volume; 2184 2521 } else { // Base higher than OtherBase -> do nothing 2185 Log() << Verbose( 2) << "REJECT: Base line is higher: Nothing to do." << endl;2522 Log() << Verbose(0) << "REJECT: Base line is higher: Nothing to do." << endl; 2186 2523 return 0.; 2187 2524 } … … 2198 2535 class BoundaryLineSet * Tesselation::FlipBaseline(class BoundaryLineSet *Base) 2199 2536 { 2537 Info FunctionInfo(__func__); 2200 2538 class BoundaryLineSet *OldLines[4], *NewLine; 2201 2539 class BoundaryPointSet *OldPoints[2]; … … 2204 2542 int i,m; 2205 2543 2206 Log() << Verbose(1) << "Begin of FlipBaseline" << endl;2207 2208 2544 // calculate NormalVector for later use 2209 2545 BaseLineNormal.Zero(); … … 2213 2549 } 2214 2550 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) { 2215 Log() << Verbose( 4) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;2551 Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl; 2216 2552 BaseLineNormal.AddVector(&(runner->second->NormalVector)); 2217 2553 } … … 2226 2562 i=0; 2227 2563 m=0; 2228 Log() << Verbose( 3) << "The four old lines are: ";2564 Log() << Verbose(0) << "The four old lines are: "; 2229 2565 for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) 2230 2566 for (int j=0;j<3;j++) // all of their endpoints and baselines … … 2234 2570 } 2235 2571 Log() << Verbose(0) << endl; 2236 Log() << Verbose( 3) << "The two old points are: ";2572 Log() << Verbose(0) << "The two old points are: "; 2237 2573 for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) 2238 2574 for (int j=0;j<3;j++) // all of their endpoints and baselines … … 2260 2596 2261 2597 // remove triangles and baseline removes itself 2262 Log() << Verbose( 3) << "INFO: Deleting baseline " << *Base << " from global list." << endl;2598 Log() << Verbose(0) << "INFO: Deleting baseline " << *Base << " from global list." << endl; 2263 2599 OldBaseLineNr = Base->Nr; 2264 2600 m=0; 2265 2601 for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) { 2266 Log() << Verbose( 3) << "INFO: Deleting triangle " << *(runner->second) << "." << endl;2602 Log() << Verbose(0) << "INFO: Deleting triangle " << *(runner->second) << "." << endl; 2267 2603 OldTriangleNrs[m++] = runner->second->Nr; 2268 2604 RemoveTesselationTriangle(runner->second); … … 2274 2610 NewLine = new class BoundaryLineSet(BPS, OldBaseLineNr); 2275 2611 LinesOnBoundary.insert(LinePair(OldBaseLineNr, NewLine)); // no need for check for unique insertion as NewLine is definitely a new one 2276 Log() << Verbose( 3) << "INFO: Created new baseline " << *NewLine << "." << endl;2612 Log() << Verbose(0) << "INFO: Created new baseline " << *NewLine << "." << endl; 2277 2613 2278 2614 // construct new triangles with flipped baseline … … 2289 2625 BTS->GetNormalVector(BaseLineNormal); 2290 2626 AddTesselationTriangle(OldTriangleNrs[0]); 2291 Log() << Verbose( 3) << "INFO: Created new triangle " << *BTS << "." << endl;2627 Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl; 2292 2628 2293 2629 BLS[0] = (i==2 ? OldLines[3] : OldLines[2]); … … 2297 2633 BTS->GetNormalVector(BaseLineNormal); 2298 2634 AddTesselationTriangle(OldTriangleNrs[1]); 2299 Log() << Verbose( 3) << "INFO: Created new triangle " << *BTS << "." << endl;2635 Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl; 2300 2636 } else { 2301 Log() << Verbose(1) << "The four old lines do not connect, something's utterly wrong here!" << endl;2637 eLog() << Verbose(0) << "The four old lines do not connect, something's utterly wrong here!" << endl; 2302 2638 return NULL; 2303 2639 } 2304 2640 2305 Log() << Verbose(1) << "End of FlipBaseline" << endl;2306 2641 return NewLine; 2307 2642 }; … … 2318 2653 void Tesselation::FindSecondPointForTesselation(TesselPoint* a, Vector Oben, TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell *LC) 2319 2654 { 2320 Log() << Verbose(2) << "Begin of FindSecondPointForTesselation" << endl;2655 Info FunctionInfo(__func__); 2321 2656 Vector AngleCheck; 2322 2657 class TesselPoint* Candidate = NULL; … … 2339 2674 Nupper[i] = ((N[i]+1) < LC->N[i]) ? N[i]+1 : LC->N[i]-1; 2340 2675 } 2341 Log() << Verbose( 3) << "LC Intervals from [" << N[0] << "<->" << LC->N[0] << ", " << N[1] << "<->" << LC->N[1] << ", " << N[2] << "<->" << LC->N[2] << "] :"2676 Log() << Verbose(0) << "LC Intervals from [" << N[0] << "<->" << LC->N[0] << ", " << N[1] << "<->" << LC->N[1] << ", " << N[2] << "<->" << LC->N[2] << "] :" 2342 2677 << " [" << Nlower[0] << "," << Nupper[0] << "], " << " [" << Nlower[1] << "," << Nupper[1] << "], " << " [" << Nlower[2] << "," << Nupper[2] << "], " << endl; 2343 2678 … … 2346 2681 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 2347 2682 const LinkedNodes *List = LC->GetCurrentCell(); 2348 //Log() << Verbose( 2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;2683 //Log() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl; 2349 2684 if (List != NULL) { 2350 2685 for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { … … 2377 2712 angle = AngleCheck.Angle(&Oben); 2378 2713 if (angle < Storage[0]) { 2379 //Log() << Verbose( 3) << "Old values of Storage: %lf %lf \n", Storage[0], Storage[1]);2380 Log() << Verbose( 3) << "Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << ".\n";2714 //Log() << Verbose(1) << "Old values of Storage: %lf %lf \n", Storage[0], Storage[1]); 2715 Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << ".\n"; 2381 2716 OptCandidate = Candidate; 2382 2717 Storage[0] = angle; 2383 //Log() << Verbose( 3) << "Changing something in Storage: %lf %lf. \n", Storage[0], Storage[2]);2718 //Log() << Verbose(1) << "Changing something in Storage: %lf %lf. \n", Storage[0], Storage[2]); 2384 2719 } else { 2385 //Log() << Verbose( 3) << "Current candidate is " << *Candidate << ": Looses with angle " << angle << " to a better candidate " << *OptCandidate << endl;2720 //Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Looses with angle " << angle << " to a better candidate " << *OptCandidate << endl; 2386 2721 } 2387 2722 } else { 2388 //Log() << Verbose( 3) << "Current candidate is " << *Candidate << ": Refused due to Radius " << norm << endl;2723 //Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Refused due to Radius " << norm << endl; 2389 2724 } 2390 2725 } else { 2391 //Log() << Verbose( 3) << "Current candidate is " << *Candidate << ": Candidate is equal to first endpoint." << *a << "." << endl;2726 //Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Candidate is equal to first endpoint." << *a << "." << endl; 2392 2727 } 2393 2728 } 2394 2729 } else { 2395 Log() << Verbose( 3) << "Linked cell list is empty." << endl;2730 Log() << Verbose(0) << "Linked cell list is empty." << endl; 2396 2731 } 2397 2732 } 2398 Log() << Verbose(2) << "End of FindSecondPointForTesselation" << endl;2399 2733 }; 2400 2734 … … 2425 2759 * @param SearchDirection general direction where to search for the next point, relative to center of BaseLine 2426 2760 * @param OldSphereCenter center of sphere for base triangle, relative to center of BaseLine, giving null angle for the parameter circle 2427 * @param BaseLine BoundaryLineSet with the current base line2761 * @param CandidateLine CandidateForTesselation with the current base line and list of candidates and ShortestAngle 2428 2762 * @param ThirdNode third point to avoid in search 2429 * @param candidates list of equally good candidates to return2430 * @param ShortestAngle the current path length on this circle band for the current OptCandidate2431 2763 * @param RADIUS radius of sphere 2432 2764 * @param *LC LinkedCell structure with neighbouring points 2433 2765 */ 2434 void Tesselation::FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, class BoundaryLineSet *BaseLine, const class TesselPoint * const ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, const LinkedCell *LC) const 2435 { 2766 void Tesselation::FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, CandidateForTesselation &CandidateLine, const class TesselPoint * const ThirdNode, const double RADIUS, const LinkedCell *LC) const 2767 { 2768 Info FunctionInfo(__func__); 2436 2769 Vector CircleCenter; // center of the circle, i.e. of the band of sphere's centers 2437 2770 Vector CirclePlaneNormal; // normal vector defining the plane this circle lives in … … 2441 2774 Vector NewNormalVector; // normal vector of the Candidate's triangle 2442 2775 Vector helper, OptCandidateCenter, OtherOptCandidateCenter; 2776 Vector RelativeOldSphereCenter; 2777 Vector NewPlaneCenter; 2443 2778 double CircleRadius; // radius of this circle 2444 2779 double radius; 2780 double otherradius; 2445 2781 double alpha, Otheralpha; // angles (i.e. parameter for the circle). 2446 2782 int N[NDIM], Nlower[NDIM], Nupper[NDIM]; 2447 2783 TesselPoint *Candidate = NULL; 2448 CandidateForTesselation *optCandidate = NULL; 2449 2450 Log() << Verbose(1) << "Begin of FindThirdPointForTesselation" << endl; 2451 2452 Log() << Verbose(2) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl; 2784 2785 Log() << Verbose(1) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl; 2453 2786 2454 2787 // construct center of circle 2455 CircleCenter.CopyVector( BaseLine->endpoints[0]->node->node);2456 CircleCenter.AddVector( BaseLine->endpoints[1]->node->node);2788 CircleCenter.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node); 2789 CircleCenter.AddVector(CandidateLine.BaseLine->endpoints[1]->node->node); 2457 2790 CircleCenter.Scale(0.5); 2458 2791 2459 2792 // construct normal vector of circle 2460 CirclePlaneNormal.CopyVector(BaseLine->endpoints[0]->node->node); 2461 CirclePlaneNormal.SubtractVector(BaseLine->endpoints[1]->node->node); 2793 CirclePlaneNormal.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node); 2794 CirclePlaneNormal.SubtractVector(CandidateLine.BaseLine->endpoints[1]->node->node); 2795 2796 RelativeOldSphereCenter.CopyVector(&OldSphereCenter); 2797 RelativeOldSphereCenter.SubtractVector(&CircleCenter); 2462 2798 2463 2799 // calculate squared radius TesselPoint *ThirdNode,f circle 2464 radius = CirclePlaneNormal. ScalarProduct(&CirclePlaneNormal);2465 if (radius /4.< RADIUS*RADIUS) {2466 CircleRadius = RADIUS*RADIUS - radius /4.;2800 radius = CirclePlaneNormal.NormSquared()/4.; 2801 if (radius < RADIUS*RADIUS) { 2802 CircleRadius = RADIUS*RADIUS - radius; 2467 2803 CirclePlaneNormal.Normalize(); 2468 //Log() << Verbose(2) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;2804 Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl; 2469 2805 2470 2806 // test whether old center is on the band's plane 2471 if (fabs( OldSphereCenter.ScalarProduct(&CirclePlaneNormal)) > HULLEPSILON) {2472 eLog() << Verbose(1) << "Something's very wrong here: OldSphereCenter is not on the band's plane as desired by " << fabs(OldSphereCenter.ScalarProduct(&CirclePlaneNormal)) << "!" << endl;2473 OldSphereCenter.ProjectOntoPlane(&CirclePlaneNormal);2474 } 2475 radius = OldSphereCenter.ScalarProduct(&OldSphereCenter);2807 if (fabs(RelativeOldSphereCenter.ScalarProduct(&CirclePlaneNormal)) > HULLEPSILON) { 2808 eLog() << Verbose(1) << "Something's very wrong here: RelativeOldSphereCenter is not on the band's plane as desired by " << fabs(RelativeOldSphereCenter.ScalarProduct(&CirclePlaneNormal)) << "!" << endl; 2809 RelativeOldSphereCenter.ProjectOntoPlane(&CirclePlaneNormal); 2810 } 2811 radius = RelativeOldSphereCenter.NormSquared(); 2476 2812 if (fabs(radius - CircleRadius) < HULLEPSILON) { 2477 //Log() << Verbose(2) << "INFO: OldSphereCenter is at " <<OldSphereCenter << "." << endl;2813 Log() << Verbose(1) << "INFO: RelativeOldSphereCenter is at " << RelativeOldSphereCenter << "." << endl; 2478 2814 2479 2815 // check SearchDirection 2480 //Log() << Verbose(2) << "INFO: SearchDirection is " << SearchDirection << "." << endl;2481 if (fabs( OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) { // rotated the wrong way!2816 Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl; 2817 if (fabs(RelativeOldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) { // rotated the wrong way! 2482 2818 eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are not orthogonal!" << endl; 2483 2819 } … … 2487 2823 for(int i=0;i<NDIM;i++) // store indices of this cell 2488 2824 N[i] = LC->n[i]; 2489 //Log() << Verbose( 2) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;2825 //Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl; 2490 2826 } else { 2491 2827 eLog() << Verbose(1) << "Vector " << CircleCenter << " is outside of LinkedCell's bounding box." << endl; … … 2493 2829 } 2494 2830 // then go through the current and all neighbouring cells and check the contained points for possible candidates 2495 //Log() << Verbose( 2) << "LC Intervals:";2831 //Log() << Verbose(1) << "LC Intervals:"; 2496 2832 for (int i=0;i<NDIM;i++) { 2497 2833 Nlower[i] = ((N[i]-1) >= 0) ? N[i]-1 : 0; … … 2504 2840 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 2505 2841 const LinkedNodes *List = LC->GetCurrentCell(); 2506 //Log() << Verbose( 2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;2842 //Log() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl; 2507 2843 if (List != NULL) { 2508 2844 for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { … … 2510 2846 2511 2847 // check for three unique points 2512 //Log() << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " at " << Candidate->node<< "." << endl;2513 if ((Candidate != BaseLine->endpoints[0]->node) && (Candidate !=BaseLine->endpoints[1]->node) ){2514 2515 // construct both new centers2516 GetCenterofCircumcircle(&New SphereCenter, *BaseLine->endpoints[0]->node->node, *BaseLine->endpoints[1]->node->node, *Candidate->node);2517 OtherNewSphereCenter.CopyVector(&NewSphereCenter);2518 2519 if ( (NewNormalVector.MakeNormalVector(BaseLine->endpoints[0]->node->node, BaseLine->endpoints[1]->node->node, Candidate->node))2520 && (fabs(NewNormalVector. ScalarProduct(&NewNormalVector)) > HULLEPSILON)2848 Log() << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " for BaseLine " << *CandidateLine.BaseLine << " with OldSphereCenter " << OldSphereCenter << "." << endl; 2849 if ((Candidate != CandidateLine.BaseLine->endpoints[0]->node) && (Candidate != CandidateLine.BaseLine->endpoints[1]->node) ){ 2850 2851 // find center on the plane 2852 GetCenterofCircumcircle(&NewPlaneCenter, *CandidateLine.BaseLine->endpoints[0]->node->node, *CandidateLine.BaseLine->endpoints[1]->node->node, *Candidate->node); 2853 Log() << Verbose(1) << "INFO: NewPlaneCenter is " << NewPlaneCenter << "." << endl; 2854 2855 if (NewNormalVector.MakeNormalVector(CandidateLine.BaseLine->endpoints[0]->node->node, CandidateLine.BaseLine->endpoints[1]->node->node, Candidate->node) 2856 && (fabs(NewNormalVector.NormSquared()) > HULLEPSILON) 2521 2857 ) { 2522 helper.CopyVector(&NewNormalVector); 2523 //Log() << Verbose(2) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl; 2524 radius = BaseLine->endpoints[0]->node->node->DistanceSquared(&NewSphereCenter); 2858 Log() << Verbose(1) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl; 2859 radius = CandidateLine.BaseLine->endpoints[0]->node->node->DistanceSquared(&NewPlaneCenter); 2860 Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl; 2861 Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl; 2862 Log() << Verbose(1) << "INFO: Radius of CircumCenterCircle is " << radius << "." << endl; 2525 2863 if (radius < RADIUS*RADIUS) { 2864 otherradius = CandidateLine.BaseLine->endpoints[1]->node->node->DistanceSquared(&NewPlaneCenter); 2865 if (fabs(radius - otherradius) > HULLEPSILON) { 2866 eLog() << Verbose(1) << "Distance to center of circumcircle is not the same from each corner of the triangle: " << fabs(radius-otherradius) << endl; 2867 } 2868 // construct both new centers 2869 NewSphereCenter.CopyVector(&NewPlaneCenter); 2870 OtherNewSphereCenter.CopyVector(&NewPlaneCenter); 2871 helper.CopyVector(&NewNormalVector); 2526 2872 helper.Scale(sqrt(RADIUS*RADIUS - radius)); 2527 //Log() << Verbose(2) << "INFO: Distance of NewCircleCenter to NewSphereCenter is " << helper.Norm()<< " with sphere radius " << RADIUS << "." << endl;2873 Log() << Verbose(2) << "INFO: Distance of NewPlaneCenter " << NewPlaneCenter << " to either NewSphereCenter is " << helper.Norm() << " of vector " << helper << " with sphere radius " << RADIUS << "." << endl; 2528 2874 NewSphereCenter.AddVector(&helper); 2529 NewSphereCenter.SubtractVector(&CircleCenter); 2530 //Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl; 2531 2875 Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl; 2532 2876 // OtherNewSphereCenter is created by the same vector just in the other direction 2533 2877 helper.Scale(-1.); 2534 2878 OtherNewSphereCenter.AddVector(&helper); 2535 OtherNewSphereCenter.SubtractVector(&CircleCenter); 2536 //Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl; 2879 Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl; 2537 2880 2538 2881 alpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, NewSphereCenter, OldSphereCenter, NormalVector, SearchDirection); 2539 2882 Otheralpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, OtherNewSphereCenter, OldSphereCenter, NormalVector, SearchDirection); 2540 2883 alpha = min(alpha, Otheralpha); 2884 2541 2885 // if there is a better candidate, drop the current list and add the new candidate 2542 2886 // otherwise ignore the new candidate and keep the list 2543 if (*ShortestAngle > (alpha - HULLEPSILON)) { 2544 optCandidate = new CandidateForTesselation(Candidate, BaseLine, OptCandidateCenter, OtherOptCandidateCenter); 2887 if (CandidateLine.ShortestAngle > (alpha - HULLEPSILON)) { 2545 2888 if (fabs(alpha - Otheralpha) > MYEPSILON) { 2546 optCandidate->OptCenter.CopyVector(&NewSphereCenter);2547 optCandidate->OtherOptCenter.CopyVector(&OtherNewSphereCenter);2889 CandidateLine.OptCenter.CopyVector(&NewSphereCenter); 2890 CandidateLine.OtherOptCenter.CopyVector(&OtherNewSphereCenter); 2548 2891 } else { 2549 optCandidate->OptCenter.CopyVector(&OtherNewSphereCenter);2550 optCandidate->OtherOptCenter.CopyVector(&NewSphereCenter);2892 CandidateLine.OptCenter.CopyVector(&OtherNewSphereCenter); 2893 CandidateLine.OtherOptCenter.CopyVector(&NewSphereCenter); 2551 2894 } 2552 2895 // if there is an equal candidate, add it to the list without clearing the list 2553 if (( *ShortestAngle - HULLEPSILON) < alpha) {2554 candidates->push_back(optCandidate);2555 Log() << Verbose( 2) << "ACCEPT: We have found an equally good candidate: " << *(optCandidate->point) << " with "2556 << alpha << " and circumsphere's center at " << optCandidate->OptCenter << "." << endl;2896 if ((CandidateLine.ShortestAngle - HULLEPSILON) < alpha) { 2897 CandidateLine.pointlist.push_back(Candidate); 2898 Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with " 2899 << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl; 2557 2900 } else { 2558 2901 // remove all candidates from the list and then the list itself 2559 class CandidateForTesselation *remover = NULL; 2560 for (CandidateList::iterator it = candidates->begin(); it != candidates->end(); ++it) { 2561 remover = *it; 2562 delete(remover); 2563 } 2564 candidates->clear(); 2565 candidates->push_back(optCandidate); 2566 Log() << Verbose(2) << "ACCEPT: We have found a better candidate: " << *(optCandidate->point) << " with " 2567 << alpha << " and circumsphere's center at " << optCandidate->OptCenter << "." << endl; 2902 CandidateLine.pointlist.clear(); 2903 CandidateLine.pointlist.push_back(Candidate); 2904 Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with " 2905 << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl; 2568 2906 } 2569 *ShortestAngle = alpha;2570 //Log() << Verbose(2) << "INFO: There are " << candidates->size() << " candidates in the list now." << endl;2907 CandidateLine.ShortestAngle = alpha; 2908 Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl; 2571 2909 } else { 2572 if (( optCandidate != NULL) && (optCandidate->point != NULL)) {2573 //Log() << Verbose(2) << "REJECT: Old candidate " << *(optCandidate->point) << " with " << *ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl;2910 if ((Candidate != NULL) && (CandidateLine.pointlist.begin() != CandidateLine.pointlist.end())) { 2911 Log() << Verbose(1) << "REJECT: Old candidate " << *(Candidate) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl; 2574 2912 } else { 2575 //Log() << Verbose(2) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl;2913 Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl; 2576 2914 } 2577 2915 } 2578 2579 2916 } else { 2580 //Log() << Verbose(2) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl;2917 Log() << Verbose(1) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl; 2581 2918 } 2582 2919 } else { 2583 //Log() << Verbose(2) << "REJECT: Three points from " << *BaseLine << " and Candidate " << *Candidate << " are linear-dependent." << endl;2920 Log() << Verbose(1) << "REJECT: Three points from " << *CandidateLine.BaseLine << " and Candidate " << *Candidate << " are linear-dependent." << endl; 2584 2921 } 2585 2922 } else { 2586 2923 if (ThirdNode != NULL) { 2587 //Log() << Verbose(2) << "REJECT: Base triangle " << *BaseLine << " and " << *ThirdNode << " contains Candidate " << *Candidate << "." << endl;2924 Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " and " << *ThirdNode << " contains Candidate " << *Candidate << "." << endl; 2588 2925 } else { 2589 //Log() << Verbose(2) << "REJECT: Base triangle " << *BaseLine << " contains Candidate " << *Candidate << "." << endl;2926 Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " contains Candidate " << *Candidate << "." << endl; 2590 2927 } 2591 2928 } … … 2598 2935 } else { 2599 2936 if (ThirdNode != NULL) 2600 Log() << Verbose( 2) << "Circumcircle for base line " << *BaseLine << " and third node " << *ThirdNode << " is too big!" << endl;2937 Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and third node " << *ThirdNode << " is too big!" << endl; 2601 2938 else 2602 Log() << Verbose(2) << "Circumcircle for base line " << *BaseLine << " is too big!" << endl; 2603 } 2604 2605 //Log() << Verbose(2) << "INFO: Sorting candidate list ..." << endl; 2606 if (candidates->size() > 1) { 2607 candidates->unique(); 2608 candidates->sort(SortCandidates); 2609 } 2610 2611 Log() << Verbose(1) << "End of FindThirdPointForTesselation" << endl; 2939 Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " is too big!" << endl; 2940 } 2941 2942 Log() << Verbose(1) << "INFO: Sorting candidate list ..." << endl; 2943 if (CandidateLine.pointlist.size() > 1) { 2944 CandidateLine.pointlist.unique(); 2945 CandidateLine.pointlist.sort(); //SortCandidates); 2946 } 2612 2947 }; 2613 2948 … … 2619 2954 class BoundaryPointSet *Tesselation::GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const 2620 2955 { 2956 Info FunctionInfo(__func__); 2621 2957 const BoundaryLineSet * lines[2] = { line1, line2 }; 2622 2958 class BoundaryPointSet *node = NULL; … … 2632 2968 { // if insertion fails, we have common endpoint 2633 2969 node = OrderTest.first->second; 2634 Log() << Verbose( 5) << "Common endpoint of lines " << *line12970 Log() << Verbose(1) << "Common endpoint of lines " << *line1 2635 2971 << " and " << *line2 << " is: " << *node << "." << endl; 2636 2972 j = 2; … … 2649 2985 list<BoundaryTriangleSet*> * Tesselation::FindClosestTrianglesToPoint(const Vector *x, const LinkedCell* LC) const 2650 2986 { 2987 Info FunctionInfo(__func__); 2651 2988 TesselPoint *trianglePoints[3]; 2652 2989 TesselPoint *SecondPoint = NULL; … … 2654 2991 2655 2992 if (LinesOnBoundary.empty()) { 2656 Log() << Verbose(0) << "Error: There is no tesselation structure to compare the point with, please create one first.";2993 eLog() << Verbose(1) << "Error: There is no tesselation structure to compare the point with, please create one first."; 2657 2994 return NULL; 2658 2995 } … … 2662 2999 // check whether closest point is "too close" :), then it's inside 2663 3000 if (trianglePoints[0] == NULL) { 2664 Log() << Verbose( 2) << "Is the only point, no one else is closeby." << endl;3001 Log() << Verbose(0) << "Is the only point, no one else is closeby." << endl; 2665 3002 return NULL; 2666 3003 } 2667 3004 if (trianglePoints[0]->node->DistanceSquared(x) < MYEPSILON) { 2668 Log() << Verbose( 3) << "Point is right on a tesselation point, no nearest triangle." << endl;3005 Log() << Verbose(1) << "Point is right on a tesselation point, no nearest triangle." << endl; 2669 3006 PointMap::const_iterator PointRunner = PointsOnBoundary.find(trianglePoints[0]->nr); 2670 3007 triangles = new list<BoundaryTriangleSet*>; … … 2690 3027 } 2691 3028 } else { 2692 list<TesselPoint*> *connectedClosestPoints = GetCircleOfConnectedPoints(trianglePoints[0], x); 3029 set<TesselPoint*> *connectedPoints = GetAllConnectedPoints(trianglePoints[0]); 3030 TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(connectedPoints, trianglePoints[0], x); 3031 delete(connectedPoints); 2693 3032 if (connectedClosestPoints != NULL) { 2694 3033 trianglePoints[1] = connectedClosestPoints->front(); … … 2698 3037 eLog() << Verbose(1) << "IsInnerPoint encounters serious error, point " << i << " not found." << endl; 2699 3038 } 2700 //Log() << Verbose( 2) << "List of triangle points:" << endl;2701 //Log() << Verbose( 3) << *trianglePoints[i] << endl;3039 //Log() << Verbose(1) << "List of triangle points:" << endl; 3040 //Log() << Verbose(2) << *trianglePoints[i] << endl; 2702 3041 } 2703 3042 2704 3043 triangles = FindTriangles(trianglePoints); 2705 Log() << Verbose( 2) << "List of possible triangles:" << endl;3044 Log() << Verbose(1) << "List of possible triangles:" << endl; 2706 3045 for(list<BoundaryTriangleSet*>::iterator Runner = triangles->begin(); Runner != triangles->end(); Runner++) 2707 Log() << Verbose( 3) << **Runner << endl;3046 Log() << Verbose(2) << **Runner << endl; 2708 3047 2709 3048 delete(connectedClosestPoints); 2710 3049 } else { 2711 3050 triangles = NULL; 2712 Log() << Verbose(1) << "There is no circle of connected points!" << endl;3051 eLog() << Verbose(2) << "There is no circle of connected points!" << endl; 2713 3052 } 2714 3053 } … … 2730 3069 class BoundaryTriangleSet * Tesselation::FindClosestTriangleToPoint(const Vector *x, const LinkedCell* LC) const 2731 3070 { 3071 Info FunctionInfo(__func__); 2732 3072 class BoundaryTriangleSet *result = NULL; 2733 3073 list<BoundaryTriangleSet*> *triangles = FindClosestTrianglesToPoint(x, LC); … … 2739 3079 if (triangles->size() == 1) { // there is no degenerate case 2740 3080 result = triangles->front(); 2741 Log() << Verbose( 2) << "Normal Vector of this triangle is " << result->NormalVector << "." << endl;3081 Log() << Verbose(1) << "Normal Vector of this triangle is " << result->NormalVector << "." << endl; 2742 3082 } else { 2743 3083 result = triangles->front(); 2744 3084 result->GetCenter(&Center); 2745 3085 Center.SubtractVector(x); 2746 Log() << Verbose( 2) << "Normal Vector of this front side is " << result->NormalVector << "." << endl;3086 Log() << Verbose(1) << "Normal Vector of this front side is " << result->NormalVector << "." << endl; 2747 3087 if (Center.ScalarProduct(&result->NormalVector) < 0) { 2748 3088 result = triangles->back(); 2749 Log() << Verbose( 2) << "Normal Vector of this back side is " << result->NormalVector << "." << endl;3089 Log() << Verbose(1) << "Normal Vector of this back side is " << result->NormalVector << "." << endl; 2750 3090 if (Center.ScalarProduct(&result->NormalVector) < 0) { 2751 3091 eLog() << Verbose(1) << "Front and back side yield NormalVector in wrong direction!" << endl; … … 2766 3106 bool Tesselation::IsInnerPoint(const Vector &Point, const LinkedCell* const LC) const 2767 3107 { 3108 Info FunctionInfo(__func__); 2768 3109 class BoundaryTriangleSet *result = FindClosestTriangleToPoint(&Point, LC); 2769 3110 Vector Center; … … 2775 3116 2776 3117 result->GetCenter(&Center); 2777 Log() << Verbose( 3) << "INFO: Central point of the triangle is " << Center << "." << endl;3118 Log() << Verbose(2) << "INFO: Central point of the triangle is " << Center << "." << endl; 2778 3119 Center.SubtractVector(&Point); 2779 Log() << Verbose( 3) << "INFO: Vector from center to point to test is " << Center << "." << endl;3120 Log() << Verbose(2) << "INFO: Vector from center to point to test is " << Center << "." << endl; 2780 3121 if (Center.ScalarProduct(&result->NormalVector) > -MYEPSILON) { 2781 3122 Log() << Verbose(1) << Point << " is an inner point." << endl; … … 2796 3137 bool Tesselation::IsInnerPoint(const TesselPoint * const Point, const LinkedCell* const LC) const 2797 3138 { 3139 Info FunctionInfo(__func__); 2798 3140 return IsInnerPoint(*(Point->node), LC); 2799 3141 } … … 2807 3149 set<TesselPoint*> * Tesselation::GetAllConnectedPoints(const TesselPoint* const Point) const 2808 3150 { 3151 Info FunctionInfo(__func__); 2809 3152 set<TesselPoint*> *connectedPoints = new set<TesselPoint*>; 2810 3153 class BoundaryPointSet *ReferencePoint = NULL; 2811 3154 TesselPoint* current; 2812 3155 bool takePoint = false; 2813 2814 Log() << Verbose(3) << "Begin of GetAllConnectedPoints" << endl;2815 3156 2816 3157 // find the respective boundary point … … 2819 3160 ReferencePoint = PointRunner->second; 2820 3161 } else { 2821 Log() << Verbose(2) << "GetAllConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl;3162 eLog() << Verbose(2) << "GetAllConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl; 2822 3163 ReferencePoint = NULL; 2823 3164 } … … 2843 3184 2844 3185 if (takePoint) { 2845 Log() << Verbose( 5) << "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted." << endl;3186 Log() << Verbose(1) << "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted." << endl; 2846 3187 connectedPoints->insert(current); 2847 3188 } … … 2855 3196 } 2856 3197 2857 Log() << Verbose(3) << "End of GetAllConnectedPoints" << endl;2858 3198 return connectedPoints; 2859 3199 }; … … 2867 3207 * 2868 3208 * @param *out output stream for debugging 3209 * @param *SetOfNeighbours all points for which the angle should be calculated 2869 3210 * @param *Point of which get all connected points 2870 3211 * @param *Reference Reference vector for zero angle or NULL for no preference 2871 3212 * @return list of the all points linked to the provided one 2872 3213 */ 2873 list<TesselPoint*> * Tesselation::GetCircleOfConnectedPoints(const TesselPoint* const Point, const Vector * const Reference) const 2874 { 3214 list<TesselPoint*> * Tesselation::GetCircleOfSetOfPoints(set<TesselPoint*> *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference) const 3215 { 3216 Info FunctionInfo(__func__); 2875 3217 map<double, TesselPoint*> anglesOfPoints; 2876 set<TesselPoint*> *connectedPoints = GetAllConnectedPoints(Point);2877 3218 list<TesselPoint*> *connectedCircle = new list<TesselPoint*>; 2878 3219 Vector center; … … 2882 3223 Vector helper; 2883 3224 2884 if ( connectedPoints == NULL) {2885 Log() << Verbose(2) << "Could not find any connected points!" << endl;3225 if (SetOfNeighbours == NULL) { 3226 eLog() << Verbose(2) << "Could not find any connected points!" << endl; 2886 3227 delete(connectedCircle); 2887 3228 return NULL; 2888 3229 } 2889 Log() << Verbose(2) << "Begin of GetCircleOfConnectedPoints" << endl;2890 3230 2891 3231 // calculate central point 2892 for (set<TesselPoint*>::const_iterator TesselRunner = connectedPoints->begin(); TesselRunner != connectedPoints->end(); TesselRunner++)3232 for (set<TesselPoint*>::const_iterator TesselRunner = SetOfNeighbours->begin(); TesselRunner != SetOfNeighbours->end(); TesselRunner++) 2893 3233 center.AddVector((*TesselRunner)->node); 2894 3234 //Log() << Verbose(0) << "Summed vectors " << center << "; number of points " << connectedPoints.size() 2895 3235 // << "; scale factor " << 1.0/connectedPoints.size(); 2896 center.Scale(1.0/ connectedPoints->size());2897 Log() << Verbose( 4) << "INFO: Calculated center of all circle points is " << center << "." << endl;3236 center.Scale(1.0/SetOfNeighbours->size()); 3237 Log() << Verbose(1) << "INFO: Calculated center of all circle points is " << center << "." << endl; 2898 3238 2899 3239 // projection plane of the circle is at the closes Point and normal is pointing away from center of all circle points … … 2901 3241 PlaneNormal.SubtractVector(¢er); 2902 3242 PlaneNormal.Normalize(); 2903 Log() << Verbose( 4) << "INFO: Calculated plane normal of circle is " << PlaneNormal << "." << endl;3243 Log() << Verbose(1) << "INFO: Calculated plane normal of circle is " << PlaneNormal << "." << endl; 2904 3244 2905 3245 // construct one orthogonal vector … … 2910 3250 } 2911 3251 if ((Reference == NULL) || (AngleZero.NormSquared() < MYEPSILON )) { 2912 Log() << Verbose( 4) << "Using alternatively " << *(*connectedPoints->begin())->node << " as angle 0 referencer." << endl;2913 AngleZero.CopyVector((* connectedPoints->begin())->node);3252 Log() << Verbose(1) << "Using alternatively " << *(*SetOfNeighbours->begin())->node << " as angle 0 referencer." << endl; 3253 AngleZero.CopyVector((*SetOfNeighbours->begin())->node); 2914 3254 AngleZero.SubtractVector(Point->node); 2915 3255 AngleZero.ProjectOntoPlane(&PlaneNormal); … … 2919 3259 } 2920 3260 } 2921 Log() << Verbose( 4) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl;3261 Log() << Verbose(1) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl; 2922 3262 if (AngleZero.NormSquared() > MYEPSILON) 2923 3263 OrthogonalVector.MakeNormalVector(&PlaneNormal, &AngleZero); 2924 3264 else 2925 3265 OrthogonalVector.MakeNormalVector(&PlaneNormal); 2926 Log() << Verbose( 4) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl;3266 Log() << Verbose(1) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl; 2927 3267 2928 3268 // go through all connected points and calculate angle 2929 for (set<TesselPoint*>::iterator listRunner = connectedPoints->begin(); listRunner != connectedPoints->end(); listRunner++) {3269 for (set<TesselPoint*>::iterator listRunner = SetOfNeighbours->begin(); listRunner != SetOfNeighbours->end(); listRunner++) { 2930 3270 helper.CopyVector((*listRunner)->node); 2931 3271 helper.SubtractVector(Point->node); 2932 3272 helper.ProjectOntoPlane(&PlaneNormal); 2933 3273 double angle = GetAngle(helper, AngleZero, OrthogonalVector); 2934 Log() << Verbose( 3) << "INFO: Calculated angle is " << angle << " for point " << **listRunner << "." << endl;3274 Log() << Verbose(0) << "INFO: Calculated angle is " << angle << " for point " << **listRunner << "." << endl; 2935 3275 anglesOfPoints.insert(pair<double, TesselPoint*>(angle, (*listRunner))); 2936 3276 } … … 2939 3279 connectedCircle->push_back(AngleRunner->second); 2940 3280 } 2941 2942 delete(connectedPoints);2943 2944 Log() << Verbose(2) << "End of GetCircleOfConnectedPoints" << endl;2945 3281 2946 3282 return connectedCircle; … … 2955 3291 list<list<TesselPoint*> *> * Tesselation::GetPathsOfConnectedPoints(const TesselPoint* const Point) const 2956 3292 { 3293 Info FunctionInfo(__func__); 2957 3294 map<double, TesselPoint*> anglesOfPoints; 2958 3295 list<list<TesselPoint*> *> *ListOfPaths = new list<list<TesselPoint*> *>; … … 2999 3336 StartLine = CurrentLine; 3000 3337 CurrentPoint = CurrentLine->GetOtherEndpoint(ReferencePoint); 3001 Log() << Verbose( 3)<< "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "." << endl;3338 Log() << Verbose(1)<< "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "." << endl; 3002 3339 do { 3003 3340 // push current one 3004 Log() << Verbose( 3) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;3341 Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl; 3005 3342 connectedPath->push_back(CurrentPoint->node); 3006 3343 3007 3344 // find next triangle 3008 3345 for (TriangleMap::iterator Runner = CurrentLine->triangles.begin(); Runner != CurrentLine->triangles.end(); Runner++) { 3009 Log() << Verbose( 3) << "INFO: Inspecting triangle " << *Runner->second << "." << endl;3346 Log() << Verbose(1) << "INFO: Inspecting triangle " << *Runner->second << "." << endl; 3010 3347 if ((Runner->second != triangle)) { // look for first triangle not equal to old one 3011 3348 triangle = Runner->second; … … 3014 3351 if (!TriangleRunner->second) { 3015 3352 TriangleRunner->second = true; 3016 Log() << Verbose( 3) << "INFO: Connecting triangle is " << *triangle << "." << endl;3353 Log() << Verbose(1) << "INFO: Connecting triangle is " << *triangle << "." << endl; 3017 3354 break; 3018 3355 } else { 3019 Log() << Verbose( 3) << "INFO: Skipping " << *triangle << ", as we have already visited it." << endl;3356 Log() << Verbose(1) << "INFO: Skipping " << *triangle << ", as we have already visited it." << endl; 3020 3357 triangle = NULL; 3021 3358 } … … 3032 3369 if ((triangle->lines[i] != CurrentLine) && (triangle->lines[i]->ContainsBoundaryPoint(ReferencePoint))) { // not the current line and still containing Point 3033 3370 CurrentLine = triangle->lines[i]; 3034 Log() << Verbose( 3) << "INFO: Connecting line is " << *CurrentLine << "." << endl;3371 Log() << Verbose(1) << "INFO: Connecting line is " << *CurrentLine << "." << endl; 3035 3372 break; 3036 3373 } … … 3046 3383 } while (CurrentLine != StartLine); 3047 3384 // last point is missing, as it's on start line 3048 Log() << Verbose( 3) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;3385 Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl; 3049 3386 if (StartLine->GetOtherEndpoint(ReferencePoint)->node != connectedPath->back()) 3050 3387 connectedPath->push_back(StartLine->GetOtherEndpoint(ReferencePoint)->node); … … 3052 3389 ListOfPaths->push_back(connectedPath); 3053 3390 } else { 3054 Log() << Verbose( 3) << "INFO: Skipping " << *runner->second << ", as we have already visited it." << endl;3391 Log() << Verbose(1) << "INFO: Skipping " << *runner->second << ", as we have already visited it." << endl; 3055 3392 } 3056 3393 } … … 3070 3407 list<list<TesselPoint*> *> * Tesselation::GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const 3071 3408 { 3409 Info FunctionInfo(__func__); 3072 3410 list<list<TesselPoint*> *> *ListofPaths = GetPathsOfConnectedPoints(Point); 3073 3411 list<list<TesselPoint*> *> *ListofClosedPaths = new list<list<TesselPoint*> *>; … … 3083 3421 connectedPath = *ListRunner; 3084 3422 3085 Log() << Verbose( 2) << "INFO: Current path is " << connectedPath << "." << endl;3423 Log() << Verbose(1) << "INFO: Current path is " << connectedPath << "." << endl; 3086 3424 3087 3425 // go through list, look for reappearance of starting Point and count … … 3093 3431 if ((*CircleRunner == *CircleStart) && (CircleRunner != CircleStart)) { // is not the very first point 3094 3432 // we have a closed circle from Marker to new Marker 3095 Log() << Verbose( 3) << count+1 << ". closed path consists of: ";3433 Log() << Verbose(1) << count+1 << ". closed path consists of: "; 3096 3434 newPath = new list<TesselPoint*>; 3097 3435 list<TesselPoint*>::iterator CircleSprinter = Marker; … … 3109 3447 } 3110 3448 } 3111 Log() << Verbose( 3) << "INFO: " << count << " closed additional path(s) have been created." << endl;3449 Log() << Verbose(1) << "INFO: " << count << " closed additional path(s) have been created." << endl; 3112 3450 3113 3451 // delete list of paths … … 3131 3469 set<BoundaryTriangleSet*> *Tesselation::GetAllTriangles(const BoundaryPointSet * const Point) const 3132 3470 { 3471 Info FunctionInfo(__func__); 3133 3472 set<BoundaryTriangleSet*> *connectedTriangles = new set<BoundaryTriangleSet*>; 3134 3473 … … 3169 3508 return 0.; 3170 3509 } else 3171 Log() << Verbose( 2) << "Removing point " << *point << " from tesselated boundary ..." << endl;3510 Log() << Verbose(0) << "Removing point " << *point << " from tesselated boundary ..." << endl; 3172 3511 3173 3512 // copy old location for the volume … … 3199 3538 NormalVector.Zero(); 3200 3539 for (map<class BoundaryTriangleSet *, int>::iterator Runner = Candidates.begin(); Runner != Candidates.end(); Runner++) { 3201 Log() << Verbose( 3) << "INFO: Removing triangle " << *(Runner->first) << "." << endl;3540 Log() << Verbose(1) << "INFO: Removing triangle " << *(Runner->first) << "." << endl; 3202 3541 NormalVector.SubtractVector(&Runner->first->NormalVector); // has to point inward 3203 3542 RemoveTesselationTriangle(Runner->first); … … 3229 3568 smallestangle = 0.; 3230 3569 for (MiddleNode = connectedPath->begin(); MiddleNode != connectedPath->end(); MiddleNode++) { 3231 Log() << Verbose( 3) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;3570 Log() << Verbose(1) << "INFO: MiddleNode is " << **MiddleNode << "." << endl; 3232 3571 // construct vectors to next and previous neighbour 3233 3572 StartNode = MiddleNode; … … 3257 3596 MiddleNode = EndNode; 3258 3597 if (MiddleNode == connectedPath->end()) { 3259 Log() << Verbose(1) << "CRITICAL: Could not find a smallest angle!" << endl;3260 exit(255);3598 eLog() << Verbose(0) << "CRITICAL: Could not find a smallest angle!" << endl; 3599 performCriticalExit(); 3261 3600 } 3262 3601 StartNode = MiddleNode; … … 3267 3606 if (EndNode == connectedPath->end()) 3268 3607 EndNode = connectedPath->begin(); 3269 Log() << Verbose( 4) << "INFO: StartNode is " << **StartNode << "." << endl;3270 Log() << Verbose( 4) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;3271 Log() << Verbose( 4) << "INFO: EndNode is " << **EndNode << "." << endl;3272 Log() << Verbose( 3) << "INFO: Attempting to create triangle " << (*StartNode)->Name << ", " << (*MiddleNode)->Name << " and " << (*EndNode)->Name << "." << endl;3608 Log() << Verbose(2) << "INFO: StartNode is " << **StartNode << "." << endl; 3609 Log() << Verbose(2) << "INFO: MiddleNode is " << **MiddleNode << "." << endl; 3610 Log() << Verbose(2) << "INFO: EndNode is " << **EndNode << "." << endl; 3611 Log() << Verbose(1) << "INFO: Attempting to create triangle " << (*StartNode)->Name << ", " << (*MiddleNode)->Name << " and " << (*EndNode)->Name << "." << endl; 3273 3612 TriangleCandidates[0] = *StartNode; 3274 3613 TriangleCandidates[1] = *MiddleNode; … … 3276 3615 triangle = GetPresentTriangle(TriangleCandidates); 3277 3616 if (triangle != NULL) { 3278 eLog() << Verbose( 2) << "New triangle already present, skipping!" << endl;3617 eLog() << Verbose(0) << "New triangle already present, skipping!" << endl; 3279 3618 StartNode++; 3280 3619 MiddleNode++; … … 3288 3627 continue; 3289 3628 } 3290 Log() << Verbose( 5) << "Adding new triangle points."<< endl;3629 Log() << Verbose(3) << "Adding new triangle points."<< endl; 3291 3630 AddTesselationPoint(*StartNode, 0); 3292 3631 AddTesselationPoint(*MiddleNode, 1); 3293 3632 AddTesselationPoint(*EndNode, 2); 3294 Log() << Verbose( 5) << "Adding new triangle lines."<< endl;3633 Log() << Verbose(3) << "Adding new triangle lines."<< endl; 3295 3634 AddTesselationLine(TPS[0], TPS[1], 0); 3296 3635 AddTesselationLine(TPS[0], TPS[2], 1); … … 3307 3646 // prepare nodes for next triangle 3308 3647 StartNode = EndNode; 3309 Log() << Verbose( 4) << "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "." << endl;3648 Log() << Verbose(2) << "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "." << endl; 3310 3649 connectedPath->remove(*MiddleNode); // remove the middle node (it is surrounded by triangles) 3311 3650 if (connectedPath->size() == 2) { // we are done … … 3314 3653 break; 3315 3654 } else if (connectedPath->size() < 2) { // something's gone wrong! 3316 Log() << Verbose(1) << "CRITICAL: There are only two endpoints left!" << endl;3317 exit(255);3655 eLog() << Verbose(0) << "CRITICAL: There are only two endpoints left!" << endl; 3656 performCriticalExit(); 3318 3657 } else { 3319 3658 MiddleNode = StartNode; … … 3343 3682 if (maxgain != 0) { 3344 3683 volume += maxgain; 3345 Log() << Verbose( 3) << "Flipping baseline with highest volume" << **Candidate << "." << endl;3684 Log() << Verbose(1) << "Flipping baseline with highest volume" << **Candidate << "." << endl; 3346 3685 OtherBase = FlipBaseline(*Candidate); 3347 3686 NewLines.erase(Candidate); … … 3354 3693 delete(connectedPath); 3355 3694 } 3356 Log() << Verbose( 1) << count << " triangles were created." << endl;3695 Log() << Verbose(0) << count << " triangles were created." << endl; 3357 3696 } else { 3358 3697 while (!ListOfClosedPaths->empty()) { … … 3362 3701 delete(connectedPath); 3363 3702 } 3364 Log() << Verbose( 1) << "No need to create any triangles." << endl;3703 Log() << Verbose(0) << "No need to create any triangles." << endl; 3365 3704 } 3366 3705 delete(ListOfClosedPaths); 3367 3706 3368 Log() << Verbose( 1) << "Removed volume is " << volume << "." << endl;3707 Log() << Verbose(0) << "Removed volume is " << volume << "." << endl; 3369 3708 3370 3709 return volume; … … 3383 3722 list<BoundaryTriangleSet*> *Tesselation::FindTriangles(const TesselPoint* const Points[3]) const 3384 3723 { 3724 Info FunctionInfo(__func__); 3385 3725 list<BoundaryTriangleSet*> *result = new list<BoundaryTriangleSet*>; 3386 3726 LineMap::const_iterator FindLine; … … 3423 3763 } 3424 3764 3765 struct BoundaryLineSetCompare { 3766 bool operator() (const BoundaryLineSet * const a, const BoundaryLineSet * const b) { 3767 int lowerNra = -1; 3768 int lowerNrb = -1; 3769 3770 if (a->endpoints[0] < a->endpoints[1]) 3771 lowerNra = 0; 3772 else 3773 lowerNra = 1; 3774 3775 if (b->endpoints[0] < b->endpoints[1]) 3776 lowerNrb = 0; 3777 else 3778 lowerNrb = 1; 3779 3780 if (a->endpoints[lowerNra] < b->endpoints[lowerNrb]) 3781 return true; 3782 else if (a->endpoints[lowerNra] > b->endpoints[lowerNrb]) 3783 return false; 3784 else { // both lower-numbered endpoints are the same ... 3785 if (a->endpoints[(lowerNra+1)%2] < b->endpoints[(lowerNrb+1)%2]) 3786 return true; 3787 else if (a->endpoints[(lowerNra+1)%2] > b->endpoints[(lowerNrb+1)%2]) 3788 return false; 3789 } 3790 return false; 3791 }; 3792 }; 3793 3794 #define UniqueLines set < class BoundaryLineSet *, BoundaryLineSetCompare> 3795 3425 3796 /** 3426 3797 * Finds all degenerated lines within the tesselation structure. … … 3431 3802 map<int, int> * Tesselation::FindAllDegeneratedLines() 3432 3803 { 3433 map<int, class BoundaryLineSet *> AllLines; 3804 Info FunctionInfo(__func__); 3805 UniqueLines AllLines; 3434 3806 map<int, int> * DegeneratedLines = new map<int, int>; 3435 3807 3436 3808 // sanity check 3437 3809 if (LinesOnBoundary.empty()) { 3438 Log() << Verbose(1) << "Warning:FindAllDegeneratedTriangles() was called without any tesselation structure.";3810 eLog() << Verbose(2) << "FindAllDegeneratedTriangles() was called without any tesselation structure."; 3439 3811 return DegeneratedLines; 3440 3812 } 3441 3813 3442 3814 LineMap::iterator LineRunner1; 3443 pair< LineMap::iterator, bool> tester;3815 pair< UniqueLines::iterator, bool> tester; 3444 3816 for (LineRunner1 = LinesOnBoundary.begin(); LineRunner1 != LinesOnBoundary.end(); ++LineRunner1) { 3445 tester = AllLines.insert( pair<int,BoundaryLineSet *> (LineRunner1->second->endpoints[0]->Nr, LineRunner1->second));3446 if ( (!tester.second) && (tester.first->second->endpoints[1]->Nr == LineRunner1->second->endpoints[1]->Nr)) { // found degenerated line3447 DegeneratedLines->insert ( pair<int, int> (LineRunner1->second->Nr, tester.first->second->Nr) );3448 DegeneratedLines->insert ( pair<int, int> ( tester.first->second->Nr, LineRunner1->second->Nr) );3817 tester = AllLines.insert( LineRunner1->second ); 3818 if (!tester.second) { // found degenerated line 3819 DegeneratedLines->insert ( pair<int, int> (LineRunner1->second->Nr, (*tester.first)->Nr) ); 3820 DegeneratedLines->insert ( pair<int, int> ((*tester.first)->Nr, LineRunner1->second->Nr) ); 3449 3821 } 3450 3822 } … … 3452 3824 AllLines.clear(); 3453 3825 3454 Log() << Verbose( 1) << "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines." << endl;3826 Log() << Verbose(0) << "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines." << endl; 3455 3827 map<int,int>::iterator it; 3456 for (it = DegeneratedLines->begin(); it != DegeneratedLines->end(); it++) 3457 Log() << Verbose(2) << (*it).first << " => " << (*it).second << endl; 3828 for (it = DegeneratedLines->begin(); it != DegeneratedLines->end(); it++) { 3829 const LineMap::const_iterator Line1 = LinesOnBoundary.find((*it).first); 3830 const LineMap::const_iterator Line2 = LinesOnBoundary.find((*it).second); 3831 if (Line1 != LinesOnBoundary.end() && Line2 != LinesOnBoundary.end()) 3832 Log() << Verbose(0) << *Line1->second << " => " << *Line2->second << endl; 3833 else 3834 eLog() << Verbose(1) << "Either " << (*it).first << " or " << (*it).second << " are not in LinesOnBoundary!" << endl; 3835 } 3458 3836 3459 3837 return DegeneratedLines; … … 3468 3846 map<int, int> * Tesselation::FindAllDegeneratedTriangles() 3469 3847 { 3848 Info FunctionInfo(__func__); 3470 3849 map<int, int> * DegeneratedLines = FindAllDegeneratedLines(); 3471 3850 map<int, int> * DegeneratedTriangles = new map<int, int>; … … 3495 3874 delete(DegeneratedLines); 3496 3875 3497 Log() << Verbose( 1) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl;3876 Log() << Verbose(0) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl; 3498 3877 map<int,int>::iterator it; 3499 3878 for (it = DegeneratedTriangles->begin(); it != DegeneratedTriangles->end(); it++) 3500 Log() << Verbose( 2) << (*it).first << " => " << (*it).second << endl;3879 Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl; 3501 3880 3502 3881 return DegeneratedTriangles; … … 3509 3888 void Tesselation::RemoveDegeneratedTriangles() 3510 3889 { 3890 Info FunctionInfo(__func__); 3511 3891 map<int, int> * DegeneratedTriangles = FindAllDegeneratedTriangles(); 3512 3892 TriangleMap::iterator finder; 3513 3893 BoundaryTriangleSet *triangle = NULL, *partnerTriangle = NULL; 3514 3894 int count = 0; 3515 3516 Log() << Verbose(1) << "Begin of RemoveDegeneratedTriangles" << endl;3517 3895 3518 3896 for (map<int, int>::iterator TriangleKeyRunner = DegeneratedTriangles->begin(); … … 3573 3951 // erase the pair 3574 3952 count += (int) DegeneratedTriangles->erase(triangle->Nr); 3575 Log() << Verbose( 1) << "RemoveDegeneratedTriangles() removes triangle " << *triangle << "." << endl;3953 Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *triangle << "." << endl; 3576 3954 RemoveTesselationTriangle(triangle); 3577 3955 count += (int) DegeneratedTriangles->erase(partnerTriangle->Nr); 3578 Log() << Verbose( 1) << "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "." << endl;3956 Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "." << endl; 3579 3957 RemoveTesselationTriangle(partnerTriangle); 3580 3958 } else { 3581 Log() << Verbose( 1) << "RemoveDegeneratedTriangles() does not remove triangle " << *triangle3959 Log() << Verbose(0) << "RemoveDegeneratedTriangles() does not remove triangle " << *triangle 3582 3960 << " and its partner " << *partnerTriangle << " because it is essential for at" 3583 3961 << " least one of the endpoints to be kept in the tesselation structure." << endl; … … 3588 3966 LastTriangle = NULL; 3589 3967 3590 Log() << Verbose(1) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl; 3591 Log() << Verbose(1) << "End of RemoveDegeneratedTriangles" << endl; 3968 Log() << Verbose(0) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl; 3592 3969 } 3593 3970 … … 3602 3979 void Tesselation::AddBoundaryPointByDegeneratedTriangle(class TesselPoint *point, LinkedCell *LC) 3603 3980 { 3604 Log() << Verbose(2) << "Begin of AddBoundaryPointByDegeneratedTriangle" << endl; 3605 3981 Info FunctionInfo(__func__); 3606 3982 // find nearest boundary point 3607 3983 class TesselPoint *BackupPoint = NULL; … … 3619 3995 return; 3620 3996 } 3621 Log() << Verbose( 2) << "Nearest point on boundary is " << NearestPoint->Name << "." << endl;3997 Log() << Verbose(0) << "Nearest point on boundary is " << NearestPoint->Name << "." << endl; 3622 3998 3623 3999 // go through its lines and find the best one to split … … 3652 4028 3653 4029 // create new triangle to connect point (connects automatically with the missing spot of the chosen line) 3654 Log() << Verbose( 5) << "Adding new triangle points."<< endl;4030 Log() << Verbose(2) << "Adding new triangle points."<< endl; 3655 4031 AddTesselationPoint((BestLine->endpoints[0]->node), 0); 3656 4032 AddTesselationPoint((BestLine->endpoints[1]->node), 1); 3657 4033 AddTesselationPoint(point, 2); 3658 Log() << Verbose( 5) << "Adding new triangle lines."<< endl;4034 Log() << Verbose(2) << "Adding new triangle lines."<< endl; 3659 4035 AddTesselationLine(TPS[0], TPS[1], 0); 3660 4036 AddTesselationLine(TPS[0], TPS[2], 1); … … 3663 4039 BTS->GetNormalVector(TempTriangle->NormalVector); 3664 4040 BTS->NormalVector.Scale(-1.); 3665 Log() << Verbose( 3) << "INFO: NormalVector of new triangle is " << BTS->NormalVector << "." << endl;4041 Log() << Verbose(1) << "INFO: NormalVector of new triangle is " << BTS->NormalVector << "." << endl; 3666 4042 AddTesselationTriangle(); 3667 4043 3668 4044 // create other side of this triangle and close both new sides of the first created triangle 3669 Log() << Verbose( 5) << "Adding new triangle points."<< endl;4045 Log() << Verbose(2) << "Adding new triangle points."<< endl; 3670 4046 AddTesselationPoint((BestLine->endpoints[0]->node), 0); 3671 4047 AddTesselationPoint((BestLine->endpoints[1]->node), 1); 3672 4048 AddTesselationPoint(point, 2); 3673 Log() << Verbose( 5) << "Adding new triangle lines."<< endl;4049 Log() << Verbose(2) << "Adding new triangle lines."<< endl; 3674 4050 AddTesselationLine(TPS[0], TPS[1], 0); 3675 4051 AddTesselationLine(TPS[0], TPS[2], 1); … … 3677 4053 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 3678 4054 BTS->GetNormalVector(TempTriangle->NormalVector); 3679 Log() << Verbose( 3) << "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "." << endl;4055 Log() << Verbose(1) << "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "." << endl; 3680 4056 AddTesselationTriangle(); 3681 4057 … … 3684 4060 if ((BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[0])) && (BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[1]))) { 3685 4061 if (BestLine == BTS->lines[i]){ 3686 Log() << Verbose(1) << "CRITICAL:BestLine is same as found line, something's wrong here!" << endl;3687 exit(255);4062 eLog() << Verbose(0) << "BestLine is same as found line, something's wrong here!" << endl; 4063 performCriticalExit(); 3688 4064 } 3689 4065 BTS->lines[i]->triangles.insert( pair<int, class BoundaryTriangleSet *> (TempTriangle->Nr, TempTriangle) ); … … 3692 4068 } 3693 4069 } 3694 3695 // exit3696 Log() << Verbose(2) << "End of AddBoundaryPointByDegeneratedTriangle" << endl;3697 4070 }; 3698 4071 … … 3704 4077 void Tesselation::Output(const char *filename, const PointCloud * const cloud) 3705 4078 { 4079 Info FunctionInfo(__func__); 3706 4080 ofstream *tempstream = NULL; 3707 4081 string NameofTempFile; … … 3716 4090 NameofTempFile.erase(npos, 1); 3717 4091 NameofTempFile.append(TecplotSuffix); 3718 Log() << Verbose( 1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";4092 Log() << Verbose(0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n"; 3719 4093 tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc); 3720 4094 WriteTecplotFile(tempstream, this, cloud, TriangleFilesWritten); … … 3730 4104 NameofTempFile.erase(npos, 1); 3731 4105 NameofTempFile.append(Raster3DSuffix); 3732 Log() << Verbose( 1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";4106 Log() << Verbose(0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n"; 3733 4107 tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc); 3734 4108 WriteRaster3dFile(tempstream, this, cloud); … … 3742 4116 TriangleFilesWritten++; 3743 4117 }; 4118 4119 struct BoundaryPolygonSetCompare { 4120 bool operator()(const BoundaryPolygonSet * s1, const BoundaryPolygonSet * s2) const { 4121 if (s1->endpoints.size() < s2->endpoints.size()) 4122 return true; 4123 else if (s1->endpoints.size() > s2->endpoints.size()) 4124 return false; 4125 else { // equality of number of endpoints 4126 PointSet::const_iterator Walker1 = s1->endpoints.begin(); 4127 PointSet::const_iterator Walker2 = s2->endpoints.begin(); 4128 while ((Walker1 != s1->endpoints.end()) || (Walker2 != s2->endpoints.end())) { 4129 if ((*Walker1)->Nr < (*Walker2)->Nr) 4130 return true; 4131 else if ((*Walker1)->Nr > (*Walker2)->Nr) 4132 return false; 4133 Walker1++; 4134 Walker2++; 4135 } 4136 return false; 4137 } 4138 } 4139 }; 4140 4141 #define UniquePolygonSet set < BoundaryPolygonSet *, BoundaryPolygonSetCompare> 4142 4143 /** Finds all degenerated polygons and calls ReTesselateDegeneratedPolygon()/ 4144 * \return number of polygons found 4145 */ 4146 int Tesselation::CorrectAllDegeneratedPolygons() 4147 { 4148 Info FunctionInfo(__func__); 4149 4150 /// 2. Go through all BoundaryPointSet's, check their triangles' NormalVector 4151 map <int, int> *DegeneratedTriangles = FindAllDegeneratedTriangles(); 4152 set < BoundaryPointSet *> EndpointCandidateList; 4153 pair < set < BoundaryPointSet *>::iterator, bool > InsertionTester; 4154 pair < map < int, Vector *>::iterator, bool > TriangleInsertionTester; 4155 for (PointMap::const_iterator Runner = PointsOnBoundary.begin(); Runner != PointsOnBoundary.end(); Runner++) { 4156 Log() << Verbose(0) << "Current point is " << *Runner->second << "." << endl; 4157 map < int, Vector *> TriangleVectors; 4158 // gather all NormalVectors 4159 Log() << Verbose(1) << "Gathering triangles ..." << endl; 4160 for (LineMap::const_iterator LineRunner = (Runner->second)->lines.begin(); LineRunner != (Runner->second)->lines.end(); LineRunner++) 4161 for (TriangleMap::const_iterator TriangleRunner = (LineRunner->second)->triangles.begin(); TriangleRunner != (LineRunner->second)->triangles.end(); TriangleRunner++) { 4162 if (DegeneratedTriangles->find(TriangleRunner->second->Nr) == DegeneratedTriangles->end()) { 4163 TriangleInsertionTester = TriangleVectors.insert( pair< int, Vector *> ((TriangleRunner->second)->Nr, &((TriangleRunner->second)->NormalVector)) ); 4164 if (TriangleInsertionTester.second) 4165 Log() << Verbose(1) << " Adding triangle " << *(TriangleRunner->second) << " to triangles to check-list." << endl; 4166 } else { 4167 Log() << Verbose(1) << " NOT adding triangle " << *(TriangleRunner->second) << " as it's a simply degenerated one." << endl; 4168 } 4169 } 4170 // check whether there are two that are parallel 4171 Log() << Verbose(1) << "Finding two parallel triangles ..." << endl; 4172 for (map < int, Vector *>::iterator VectorWalker = TriangleVectors.begin(); VectorWalker != TriangleVectors.end(); VectorWalker++) 4173 for (map < int, Vector *>::iterator VectorRunner = VectorWalker; VectorRunner != TriangleVectors.end(); VectorRunner++) 4174 if (VectorWalker != VectorRunner) { // skip equals 4175 const double SCP = VectorWalker->second->ScalarProduct(VectorRunner->second); // ScalarProduct should result in -1. for degenerated triangles 4176 Log() << Verbose(1) << "Checking " << *VectorWalker->second<< " against " << *VectorRunner->second << ": " << SCP << endl; 4177 if (fabs(SCP + 1.) < ParallelEpsilon) { 4178 InsertionTester = EndpointCandidateList.insert((Runner->second)); 4179 if (InsertionTester.second) 4180 Log() << Verbose(0) << " Adding " << *Runner->second << " to endpoint candidate list." << endl; 4181 // and break out of both loops 4182 VectorWalker = TriangleVectors.end(); 4183 VectorRunner = TriangleVectors.end(); 4184 break; 4185 } 4186 } 4187 } 4188 4189 /// 3. Find connected endpoint candidates and put them into a polygon 4190 UniquePolygonSet ListofDegeneratedPolygons; 4191 BoundaryPointSet *Walker = NULL; 4192 BoundaryPointSet *OtherWalker = NULL; 4193 BoundaryPolygonSet *Current = NULL; 4194 stack <BoundaryPointSet*> ToCheckConnecteds; 4195 while (!EndpointCandidateList.empty()) { 4196 Walker = *(EndpointCandidateList.begin()); 4197 if (Current == NULL) { // create a new polygon with current candidate 4198 Log() << Verbose(0) << "Starting new polygon set at point " << *Walker << endl; 4199 Current = new BoundaryPolygonSet; 4200 Current->endpoints.insert(Walker); 4201 EndpointCandidateList.erase(Walker); 4202 ToCheckConnecteds.push(Walker); 4203 } 4204 4205 // go through to-check stack 4206 while (!ToCheckConnecteds.empty()) { 4207 Walker = ToCheckConnecteds.top(); // fetch ... 4208 ToCheckConnecteds.pop(); // ... and remove 4209 for (LineMap::const_iterator LineWalker = Walker->lines.begin(); LineWalker != Walker->lines.end(); LineWalker++) { 4210 OtherWalker = (LineWalker->second)->GetOtherEndpoint(Walker); 4211 Log() << Verbose(1) << "Checking " << *OtherWalker << endl; 4212 set < BoundaryPointSet *>::iterator Finder = EndpointCandidateList.find(OtherWalker); 4213 if (Finder != EndpointCandidateList.end()) { // found a connected partner 4214 Log() << Verbose(1) << " Adding to polygon." << endl; 4215 Current->endpoints.insert(OtherWalker); 4216 EndpointCandidateList.erase(Finder); // remove from candidates 4217 ToCheckConnecteds.push(OtherWalker); // but check its partners too 4218 } else { 4219 Log() << Verbose(1) << " is not connected to " << *Walker << endl; 4220 } 4221 } 4222 } 4223 4224 Log() << Verbose(0) << "Final polygon is " << *Current << endl; 4225 ListofDegeneratedPolygons.insert(Current); 4226 Current = NULL; 4227 } 4228 4229 const int counter = ListofDegeneratedPolygons.size(); 4230 4231 Log() << Verbose(0) << "The following " << counter << " degenerated polygons have been found: " << endl; 4232 for (UniquePolygonSet::iterator PolygonRunner = ListofDegeneratedPolygons.begin(); PolygonRunner != ListofDegeneratedPolygons.end(); PolygonRunner++) 4233 Log() << Verbose(0) << " " << **PolygonRunner << endl; 4234 4235 /// 4. Go through all these degenerated polygons 4236 for (UniquePolygonSet::iterator PolygonRunner = ListofDegeneratedPolygons.begin(); PolygonRunner != ListofDegeneratedPolygons.end(); PolygonRunner++) { 4237 stack <int> TriangleNrs; 4238 Vector NormalVector; 4239 /// 4a. Gather all triangles of this polygon 4240 TriangleSet *T = (*PolygonRunner)->GetAllContainedTrianglesFromEndpoints(); 4241 4242 // check whether number is bigger than 2, otherwise it's just a simply degenerated one and nothing to do. 4243 if (T->size() == 2) { 4244 Log() << Verbose(1) << " Skipping degenerated polygon, is just a (already simply degenerated) triangle." << endl; 4245 delete(T); 4246 continue; 4247 } 4248 4249 // check whether number is even 4250 // If this case occurs, we have to think about it! 4251 // The Problem is probably due to two degenerated polygons being connected by a bridging, non-degenerated polygon, as somehow one node has 4252 // connections to either polygon ... 4253 if (T->size() % 2 != 0) { 4254 eLog() << Verbose(0) << " degenerated polygon contains an odd number of triangles, probably contains bridging non-degenerated ones, too!" << endl; 4255 performCriticalExit(); 4256 } 4257 4258 TriangleSet::iterator TriangleWalker = T->begin(); // is the inner iterator 4259 /// 4a. Get NormalVector for one side (this is "front") 4260 NormalVector.CopyVector(&(*TriangleWalker)->NormalVector); 4261 Log() << Verbose(1) << "\"front\" defining triangle is " << **TriangleWalker << " and Normal vector of \"front\" side is " << NormalVector << endl; 4262 TriangleWalker++; 4263 TriangleSet::iterator TriangleSprinter = TriangleWalker; // is the inner advanced iterator 4264 /// 4b. Remove all triangles whose NormalVector is in opposite direction (i.e. "back") 4265 BoundaryTriangleSet *triangle = NULL; 4266 while (TriangleSprinter != T->end()) { 4267 TriangleWalker = TriangleSprinter; 4268 triangle = *TriangleWalker; 4269 TriangleSprinter++; 4270 Log() << Verbose(1) << "Current triangle to test for removal: " << *triangle << endl; 4271 if (triangle->NormalVector.ScalarProduct(&NormalVector) < 0) { // if from other side, then delete and remove from list 4272 Log() << Verbose(1) << " Removing ... " << endl; 4273 TriangleNrs.push(triangle->Nr); 4274 T->erase(TriangleWalker); 4275 RemoveTesselationTriangle(triangle); 4276 } else 4277 Log() << Verbose(1) << " Keeping ... " << endl; 4278 } 4279 /// 4c. Copy all "front" triangles but with inverse NormalVector 4280 TriangleWalker = T->begin(); 4281 while (TriangleWalker != T->end()) { // go through all front triangles 4282 Log() << Verbose(1) << " Re-creating triangle " << **TriangleWalker << " with NormalVector " << (*TriangleWalker)->NormalVector << endl; 4283 for (int i = 0; i < 3; i++) 4284 AddTesselationPoint((*TriangleWalker)->endpoints[i]->node, i); 4285 AddTesselationLine(TPS[0], TPS[1], 0); 4286 AddTesselationLine(TPS[0], TPS[2], 1); 4287 AddTesselationLine(TPS[1], TPS[2], 2); 4288 if (TriangleNrs.empty()) 4289 eLog() << Verbose(0) << "No more free triangle numbers!" << endl; 4290 BTS = new BoundaryTriangleSet(BLS, TriangleNrs.top()); // copy triangle ... 4291 AddTesselationTriangle(); // ... and add 4292 TriangleNrs.pop(); 4293 BTS->NormalVector.CopyVector(&(*TriangleWalker)->NormalVector); 4294 BTS->NormalVector.Scale(-1.); 4295 TriangleWalker++; 4296 } 4297 if (!TriangleNrs.empty()) { 4298 eLog() << Verbose(0) << "There have been less triangles created than removed!" << endl; 4299 } 4300 delete(T); // remove the triangleset 4301 } 4302 4303 map<int, int> * SimplyDegeneratedTriangles = FindAllDegeneratedTriangles(); 4304 Log() << Verbose(0) << "Final list of simply degenerated triangles found, containing " << SimplyDegeneratedTriangles->size() << " triangles:" << endl; 4305 map<int,int>::iterator it; 4306 for (it = SimplyDegeneratedTriangles->begin(); it != SimplyDegeneratedTriangles->end(); it++) 4307 Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl; 4308 delete(SimplyDegeneratedTriangles); 4309 4310 /// 5. exit 4311 UniquePolygonSet::iterator PolygonRunner; 4312 while (!ListofDegeneratedPolygons.empty()) { 4313 PolygonRunner = ListofDegeneratedPolygons.begin(); 4314 delete(*PolygonRunner); 4315 ListofDegeneratedPolygons.erase(PolygonRunner); 4316 } 4317 4318 return counter; 4319 }; -
src/tesselation.hpp
rebbd3d r1cf5df 23 23 #include <list> 24 24 #include <set> 25 #include <stack> 25 26 26 27 #include "atom_particleinfo.hpp" … … 47 48 #define VRMLSUffix ".wrl" 48 49 50 #define ParallelEpsilon 1e-3 51 49 52 // ======================================================= some template functions ========================================= 50 53 51 54 #define PointMap map < int, class BoundaryPointSet * > 55 #define PointSet set < class BoundaryPointSet * > 56 #define PointList list < class BoundaryPointSet * > 52 57 #define PointPair pair < int, class BoundaryPointSet * > 53 58 #define PointTestPair pair < PointMap::iterator, bool > 59 54 60 #define CandidateList list <class CandidateForTesselation *> 61 #define CandidateMap map <class BoundaryLineSet *, class CandidateForTesselation *> 55 62 56 63 #define LineMap multimap < int, class BoundaryLineSet * > 64 #define LineSet set < class BoundaryLineSet * > 65 #define LineList list < class BoundaryLineSet * > 57 66 #define LinePair pair < int, class BoundaryLineSet * > 58 67 #define LineTestPair pair < LineMap::iterator, bool > 59 68 60 69 #define TriangleMap map < int, class BoundaryTriangleSet * > 70 #define TriangleSet set < class BoundaryTriangleSet * > 71 #define TriangleList list < class BoundaryTriangleSet * > 61 72 #define TrianglePair pair < int, class BoundaryTriangleSet * > 62 73 #define TriangleTestPair pair < TrianglePair::iterator, bool > 63 74 75 #define PolygonMap map < int, class BoundaryPolygonSet * > 76 #define PolygonSet set < class BoundaryPolygonSet * > 77 #define PolygonList list < class BoundaryPolygonSet * > 78 64 79 #define DistanceMultiMap multimap <double, pair < PointMap::iterator, PointMap::iterator> > 65 80 #define DistanceMultiMapPair pair <double, pair < PointMap::iterator, PointMap::iterator> > 81 82 #define TesselPointList list <TesselPoint *> 83 #define TesselPointSet set <TesselPoint *> 66 84 67 85 /********************************************** declarations *******************************/ … … 114 132 TriangleMap triangles; 115 133 int Nr; 134 bool skipped; 116 135 }; 117 136 … … 139 158 class BoundaryLineSet *lines[3]; 140 159 Vector NormalVector; 160 Vector SphereCenter; 141 161 int Nr; 142 162 }; 143 163 144 164 ostream & operator << (ostream &ost, const BoundaryTriangleSet &a); 165 166 167 // ======================================================== class BoundaryTriangleSet ======================================= 168 169 /** Set of BoundaryPointSet. 170 * This is just meant as a container for a group of endpoints, extending the node, line, triangle concept. However, this has 171 * only marginally something to do with the tesselation. Hence, there is no incorporation into the bookkeeping of the Tesselation 172 * class (i.e. no allocation, no deletion). 173 * \note we assume that the set of endpoints reside (more or less) on a plane. 174 */ 175 class BoundaryPolygonSet { 176 public: 177 BoundaryPolygonSet(); 178 ~BoundaryPolygonSet(); 179 180 Vector * GetNormalVector(const Vector &NormalVector) const; 181 void GetCenter(Vector *center) const; 182 bool ContainsBoundaryLine(const BoundaryLineSet * const line) const; 183 bool ContainsBoundaryPoint(const BoundaryPointSet * const point) const; 184 bool ContainsBoundaryPoint(const TesselPoint * const point) const; 185 bool ContainsBoundaryTriangle(const BoundaryTriangleSet * const point) const; 186 bool ContainsPresentTupel(const BoundaryPointSet * const * Points, const int dim) const; 187 bool ContainsPresentTupel(const BoundaryPolygonSet * const P) const; 188 bool ContainsPresentTupel(const PointSet &endpoints) const; 189 TriangleSet * GetAllContainedTrianglesFromEndpoints() const; 190 bool FillPolygonFromTrianglesOfLine(const BoundaryLineSet * const line); 191 192 PointSet endpoints; 193 int Nr; 194 }; 195 196 ostream & operator << (ostream &ost, const BoundaryPolygonSet &a); 145 197 146 198 // =========================================================== class TESSELPOINT =========================================== … … 186 238 class CandidateForTesselation { 187 239 public : 240 CandidateForTesselation(BoundaryLineSet* currentBaseLine); 188 241 CandidateForTesselation(TesselPoint* candidate, BoundaryLineSet* currentBaseLine, Vector OptCandidateCenter, Vector OtherOptCandidateCenter); 189 242 ~CandidateForTesselation(); 190 243 191 TesselPoint *point;244 TesselPointList pointlist; 192 245 BoundaryLineSet *BaseLine; 193 246 Vector OptCenter; 194 247 Vector OtherOptCenter; 195 }; 248 double ShortestAngle; 249 double OtherShortestAngle; 250 }; 251 252 ostream & operator <<(ostream &ost, const CandidateForTesselation &a); 196 253 197 254 // =========================================================== class TESSELATION =========================================== … … 211 268 void AddTesselationTriangle(); 212 269 void AddTesselationTriangle(const int nr); 270 void AddCandidateTriangle(CandidateForTesselation CandidateLine); 213 271 void RemoveTesselationTriangle(class BoundaryTriangleSet *triangle); 214 272 void RemoveTesselationLine(class BoundaryLineSet *line); … … 219 277 void FindStartingTriangle(const double RADIUS, const LinkedCell *LC); 220 278 void FindSecondPointForTesselation(class TesselPoint* a, Vector Oben, class TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell *LC); 221 void FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, class BoundaryLineSet *BaseLine, const class TesselPoint * const ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, const LinkedCell *LC) const;222 bool FindNextSuitableTriangle( BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC);279 void FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, CandidateForTesselation &CandidateLine, const class TesselPoint * const ThirdNode, const double RADIUS, const LinkedCell *LC) const; 280 bool FindNextSuitableTriangle(CandidateForTesselation &CandidateLine, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC); 223 281 int CheckPresenceOfTriangle(class TesselPoint *Candidates[3]) const; 224 282 class BoundaryTriangleSet * GetPresentTriangle(TesselPoint *Candidates[3]); … … 236 294 void RemoveDegeneratedTriangles(); 237 295 void AddBoundaryPointByDegeneratedTriangle(class TesselPoint *point, LinkedCell *LC); 296 int CorrectAllDegeneratedPolygons(); 238 297 239 298 set<TesselPoint*> * GetAllConnectedPoints(const TesselPoint* const Point) const; … … 241 300 list<list<TesselPoint*> *> * GetPathsOfConnectedPoints(const TesselPoint* const Point) const; 242 301 list<list<TesselPoint*> *> * GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const; 243 list<TesselPoint*> * GetCircleOf ConnectedPoints(const TesselPoint* const Point, const Vector * const Reference = NULL) const;302 list<TesselPoint*> * GetCircleOfSetOfPoints(set<TesselPoint*> *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference = NULL) const; 244 303 class BoundaryPointSet *GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const; 245 304 list<BoundaryTriangleSet*> *FindTriangles(const TesselPoint* const Points[3]) const; … … 260 319 PointMap PointsOnBoundary; 261 320 LineMap LinesOnBoundary; 321 CandidateMap OpenLines; 262 322 TriangleMap TrianglesOnBoundary; 263 323 int PointsOnBoundaryCount; … … 287 347 mutable PointMap::const_iterator InternalPointer; 288 348 289 bool HasOtherBaselineBetterCandidate(const BoundaryLineSet * const BaseRay, const TesselPoint * const OptCandidate, double ShortestAngle, double RADIUS, const LinkedCell * const LC) const;349 //bool HasOtherBaselineBetterCandidate(const BoundaryLineSet * const BaseRay, const TesselPoint * const OptCandidate, double ShortestAngle, double RADIUS, const LinkedCell * const LC) const; 290 350 }; 291 351 -
src/tesselationhelpers.cpp
rebbd3d r1cf5df 8 8 #include <fstream> 9 9 10 #include "info.hpp" 10 11 #include "linkedcell.hpp" 11 12 #include "log.hpp" … … 15 16 #include "verbose.hpp" 16 17 17 double DetGet(gsl_matrix * const A, const int inPlace) { 18 double DetGet(gsl_matrix * const A, const int inPlace) 19 { 20 Info FunctionInfo(__func__); 18 21 /* 19 22 inPlace = 1 => A is replaced with the LU decomposed copy. … … 45 48 void GetSphere(Vector * const center, const Vector &a, const Vector &b, const Vector &c, const double RADIUS) 46 49 { 50 Info FunctionInfo(__func__); 47 51 gsl_matrix *A = gsl_matrix_calloc(3,3); 48 52 double m11, m12, m13, m14; … … 111 115 const double HalfplaneIndicator, const double AlternativeIndicator, const double alpha, const double beta, const double gamma, const double RADIUS, const double Umkreisradius) 112 116 { 117 Info FunctionInfo(__func__); 113 118 Vector TempNormal, helper; 114 119 double Restradius; 115 120 Vector OtherCenter; 116 Log() << Verbose(3) << "Begin of GetCenterOfSphere.\n";117 121 Center->Zero(); 118 122 helper.CopyVector(&a); … … 128 132 Center->Scale(1./(sin(2.*alpha) + sin(2.*beta) + sin(2.*gamma))); 129 133 NewUmkreismittelpunkt->CopyVector(Center); 130 Log() << Verbose( 4) << "Center of new circumference is " << *NewUmkreismittelpunkt << ".\n";134 Log() << Verbose(1) << "Center of new circumference is " << *NewUmkreismittelpunkt << ".\n"; 131 135 // Here we calculated center of circumscribing circle, using barycentric coordinates 132 Log() << Verbose( 4) << "Center of circumference is " << *Center << " in direction " << *Direction << ".\n";136 Log() << Verbose(1) << "Center of circumference is " << *Center << " in direction " << *Direction << ".\n"; 133 137 134 138 TempNormal.CopyVector(&a); … … 154 158 TempNormal.Normalize(); 155 159 Restradius = sqrt(RADIUS*RADIUS - Umkreisradius*Umkreisradius); 156 Log() << Verbose( 4) << "Height of center of circumference to center of sphere is " << Restradius << ".\n";160 Log() << Verbose(1) << "Height of center of circumference to center of sphere is " << Restradius << ".\n"; 157 161 TempNormal.Scale(Restradius); 158 Log() << Verbose( 4) << "Shift vector to sphere of circumference is " << TempNormal << ".\n";162 Log() << Verbose(1) << "Shift vector to sphere of circumference is " << TempNormal << ".\n"; 159 163 160 164 Center->AddVector(&TempNormal); 161 Log() << Verbose( 0) << "Center of sphere of circumference is " << *Center << ".\n";165 Log() << Verbose(1) << "Center of sphere of circumference is " << *Center << ".\n"; 162 166 GetSphere(&OtherCenter, a, b, c, RADIUS); 163 Log() << Verbose(0) << "OtherCenter of sphere of circumference is " << OtherCenter << ".\n"; 164 Log() << Verbose(3) << "End of GetCenterOfSphere.\n"; 167 Log() << Verbose(1) << "OtherCenter of sphere of circumference is " << OtherCenter << ".\n"; 165 168 }; 166 169 … … 174 177 void GetCenterofCircumcircle(Vector * const Center, const Vector &a, const Vector &b, const Vector &c) 175 178 { 179 Info FunctionInfo(__func__); 176 180 Vector helper; 177 181 double alpha, beta, gamma; … … 186 190 beta = M_PI - SideC.Angle(&SideA); 187 191 gamma = M_PI - SideA.Angle(&SideB); 188 //Log() << Verbose( 3) << "INFO: alpha = " << alpha/M_PI*180. << ", beta = " << beta/M_PI*180. << ", gamma = " << gamma/M_PI*180. << "." << endl;192 //Log() << Verbose(1) << "INFO: alpha = " << alpha/M_PI*180. << ", beta = " << beta/M_PI*180. << ", gamma = " << gamma/M_PI*180. << "." << endl; 189 193 if (fabs(M_PI - alpha - beta - gamma) > HULLEPSILON) { 190 194 eLog() << Verbose(1) << "GetCenterofCircumcircle: Sum of angles " << (alpha+beta+gamma)/M_PI*180. << " > 180 degrees by " << fabs(M_PI - alpha - beta - gamma)/M_PI*180. << "!" << endl; … … 219 223 double GetPathLengthonCircumCircle(const Vector &CircleCenter, const Vector &CirclePlaneNormal, const double CircleRadius, const Vector &NewSphereCenter, const Vector &OldSphereCenter, const Vector &NormalVector, const Vector &SearchDirection) 220 224 { 225 Info FunctionInfo(__func__); 221 226 Vector helper; 222 227 double radius, alpha; 223 224 helper.CopyVector(&NewSphereCenter); 228 Vector RelativeOldSphereCenter; 229 Vector RelativeNewSphereCenter; 230 231 RelativeOldSphereCenter.CopyVector(&OldSphereCenter); 232 RelativeOldSphereCenter.SubtractVector(&CircleCenter); 233 RelativeNewSphereCenter.CopyVector(&NewSphereCenter); 234 RelativeNewSphereCenter.SubtractVector(&CircleCenter); 235 helper.CopyVector(&RelativeNewSphereCenter); 225 236 // test whether new center is on the parameter circle's plane 226 237 if (fabs(helper.ScalarProduct(&CirclePlaneNormal)) > HULLEPSILON) { … … 228 239 helper.ProjectOntoPlane(&CirclePlaneNormal); 229 240 } 230 radius = helper. ScalarProduct(&helper);241 radius = helper.NormSquared(); 231 242 // test whether the new center vector has length of CircleRadius 232 243 if (fabs(radius - CircleRadius) > HULLEPSILON) 233 244 eLog() << Verbose(1) << "The projected center of the new sphere has radius " << radius << " instead of " << CircleRadius << "." << endl; 234 alpha = helper.Angle(& OldSphereCenter);245 alpha = helper.Angle(&RelativeOldSphereCenter); 235 246 // make the angle unique by checking the halfplanes/search direction 236 247 if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON) // acos is not unique on [0, 2.*M_PI), hence extra check to decide between two half intervals 237 248 alpha = 2.*M_PI - alpha; 238 //Log() << Verbose(2) << "INFO: RelativeNewSphereCenter is " << helper << ", RelativeOldSphereCenter is " <<OldSphereCenter << " and resulting angle is " << alpha << "." << endl;239 radius = helper.Distance(& OldSphereCenter);249 Log() << Verbose(1) << "INFO: RelativeNewSphereCenter is " << helper << ", RelativeOldSphereCenter is " << RelativeOldSphereCenter << " and resulting angle is " << alpha << "." << endl; 250 radius = helper.Distance(&RelativeOldSphereCenter); 240 251 helper.ProjectOntoPlane(&NormalVector); 241 252 // check whether new center is somewhat away or at least right over the current baseline to prevent intersecting triangles 242 253 if ((radius > HULLEPSILON) || (helper.Norm() < HULLEPSILON)) { 243 //Log() << Verbose(2) << "INFO: Distance between old and new center is " << radius << " and between new center and baseline center is " << helper.Norm() << "." << endl;254 Log() << Verbose(1) << "INFO: Distance between old and new center is " << radius << " and between new center and baseline center is " << helper.Norm() << "." << endl; 244 255 return alpha; 245 256 } else { 246 //Log() << Verbose(1) << "INFO: NewSphereCenter " << helper << " is too close to OldSphereCenter" <<OldSphereCenter << "." << endl;257 Log() << Verbose(1) << "INFO: NewSphereCenter " << RelativeNewSphereCenter << " is too close to RelativeOldSphereCenter" << RelativeOldSphereCenter << "." << endl; 247 258 return 2.*M_PI; 248 259 } … … 264 275 double MinIntersectDistance(const gsl_vector * x, void *params) 265 276 { 277 Info FunctionInfo(__func__); 266 278 double retval = 0; 267 279 struct Intersection *I = (struct Intersection *)params; … … 284 296 285 297 retval = HeightA.ScalarProduct(&HeightA) + HeightB.ScalarProduct(&HeightB); 286 //Log() << Verbose( 2) << "MinIntersectDistance called, result: " << retval << endl;298 //Log() << Verbose(1) << "MinIntersectDistance called, result: " << retval << endl; 287 299 288 300 return retval; … … 304 316 bool existsIntersection(const Vector &point1, const Vector &point2, const Vector &point3, const Vector &point4) 305 317 { 318 Info FunctionInfo(__func__); 306 319 bool result; 307 320 … … 351 364 352 365 if (status == GSL_SUCCESS) { 353 Log() << Verbose( 2) << "converged to minimum" << endl;366 Log() << Verbose(1) << "converged to minimum" << endl; 354 367 } 355 368 } while (status == GSL_CONTINUE && iter < 100); … … 376 389 t2 = HeightB.ScalarProduct(&SideB)/SideB.ScalarProduct(&SideB); 377 390 378 Log() << Verbose( 2) << "Intersection " << intersection << " is at "391 Log() << Verbose(1) << "Intersection " << intersection << " is at " 379 392 << t1 << " for (" << point1 << "," << point2 << ") and at " 380 393 << t2 << " for (" << point3 << "," << point4 << "): "; 381 394 382 395 if (((t1 >= 0) && (t1 <= 1)) && ((t2 >= 0) && (t2 <= 1))) { 383 Log() << Verbose( 0) << "true intersection." << endl;396 Log() << Verbose(1) << "true intersection." << endl; 384 397 result = true; 385 398 } else { 386 Log() << Verbose( 0) << "intersection out of region of interest." << endl;399 Log() << Verbose(1) << "intersection out of region of interest." << endl; 387 400 result = false; 388 401 } … … 407 420 double GetAngle(const Vector &point, const Vector &reference, const Vector &OrthogonalVector) 408 421 { 422 Info FunctionInfo(__func__); 409 423 if (reference.IsZero()) 410 424 return M_PI; … … 418 432 } 419 433 420 Log() << Verbose( 4) << "INFO: " << point << " has angle " << phi << " with respect to reference " << reference << "." << endl;434 Log() << Verbose(1) << "INFO: " << point << " has angle " << phi << " with respect to reference " << reference << "." << endl; 421 435 422 436 return phi; … … 433 447 double CalculateVolumeofGeneralTetraeder(const Vector &a, const Vector &b, const Vector &c, const Vector &d) 434 448 { 449 Info FunctionInfo(__func__); 435 450 Vector Point, TetraederVector[3]; 436 451 double volume; … … 456 471 bool CheckLineCriteriaForDegeneratedTriangle(const BoundaryPointSet * const nodes[3]) 457 472 { 473 Info FunctionInfo(__func__); 458 474 bool result = false; 459 475 int counter = 0; … … 482 498 } 483 499 if ((!result) && (counter > 1)) { 484 Log() << Verbose( 2) << "INFO: Degenerate triangle is ok, at least two, here " << counter << ", existing lines are used." << endl;500 Log() << Verbose(1) << "INFO: Degenerate triangle is ok, at least two, here " << counter << ", existing lines are used." << endl; 485 501 result = true; 486 502 } … … 489 505 490 506 491 /** Sort function for the candidate list. 492 */ 493 bool SortCandidates(const CandidateForTesselation* candidate1, const CandidateForTesselation* candidate2) 494 { 495 Vector BaseLineVector, OrthogonalVector, helper; 496 if (candidate1->BaseLine != candidate2->BaseLine) { // sanity check 497 eLog() << Verbose(1) << "sortCandidates was called for two different baselines: " << candidate1->BaseLine << " and " << candidate2->BaseLine << "." << endl; 498 //return false; 499 exit(1); 500 } 501 // create baseline vector 502 BaseLineVector.CopyVector(candidate1->BaseLine->endpoints[1]->node->node); 503 BaseLineVector.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node); 504 BaseLineVector.Normalize(); 505 506 // create normal in-plane vector to cope with acos() non-uniqueness on [0,2pi] (note that is pointing in the "right" direction already, hence ">0" test!) 507 helper.CopyVector(candidate1->BaseLine->endpoints[0]->node->node); 508 helper.SubtractVector(candidate1->point->node); 509 OrthogonalVector.CopyVector(&helper); 510 helper.VectorProduct(&BaseLineVector); 511 OrthogonalVector.SubtractVector(&helper); 512 OrthogonalVector.Normalize(); 513 514 // calculate both angles and correct with in-plane vector 515 helper.CopyVector(candidate1->point->node); 516 helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node); 517 double phi = BaseLineVector.Angle(&helper); 518 if (OrthogonalVector.ScalarProduct(&helper) > 0) { 519 phi = 2.*M_PI - phi; 520 } 521 helper.CopyVector(candidate2->point->node); 522 helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node); 523 double psi = BaseLineVector.Angle(&helper); 524 if (OrthogonalVector.ScalarProduct(&helper) > 0) { 525 psi = 2.*M_PI - psi; 526 } 527 528 Log() << Verbose(2) << *candidate1->point << " has angle " << phi << endl; 529 Log() << Verbose(2) << *candidate2->point << " has angle " << psi << endl; 530 531 // return comparison 532 return phi < psi; 533 }; 507 ///** Sort function for the candidate list. 508 // */ 509 //bool SortCandidates(const CandidateForTesselation* candidate1, const CandidateForTesselation* candidate2) 510 //{ 511 // Info FunctionInfo(__func__); 512 // Vector BaseLineVector, OrthogonalVector, helper; 513 // if (candidate1->BaseLine != candidate2->BaseLine) { // sanity check 514 // eLog() << Verbose(1) << "sortCandidates was called for two different baselines: " << candidate1->BaseLine << " and " << candidate2->BaseLine << "." << endl; 515 // //return false; 516 // exit(1); 517 // } 518 // // create baseline vector 519 // BaseLineVector.CopyVector(candidate1->BaseLine->endpoints[1]->node->node); 520 // BaseLineVector.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node); 521 // BaseLineVector.Normalize(); 522 // 523 // // create normal in-plane vector to cope with acos() non-uniqueness on [0,2pi] (note that is pointing in the "right" direction already, hence ">0" test!) 524 // helper.CopyVector(candidate1->BaseLine->endpoints[0]->node->node); 525 // helper.SubtractVector(candidate1->point->node); 526 // OrthogonalVector.CopyVector(&helper); 527 // helper.VectorProduct(&BaseLineVector); 528 // OrthogonalVector.SubtractVector(&helper); 529 // OrthogonalVector.Normalize(); 530 // 531 // // calculate both angles and correct with in-plane vector 532 // helper.CopyVector(candidate1->point->node); 533 // helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node); 534 // double phi = BaseLineVector.Angle(&helper); 535 // if (OrthogonalVector.ScalarProduct(&helper) > 0) { 536 // phi = 2.*M_PI - phi; 537 // } 538 // helper.CopyVector(candidate2->point->node); 539 // helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node); 540 // double psi = BaseLineVector.Angle(&helper); 541 // if (OrthogonalVector.ScalarProduct(&helper) > 0) { 542 // psi = 2.*M_PI - psi; 543 // } 544 // 545 // Log() << Verbose(1) << *candidate1->point << " has angle " << phi << endl; 546 // Log() << Verbose(1) << *candidate2->point << " has angle " << psi << endl; 547 // 548 // // return comparison 549 // return phi < psi; 550 //}; 534 551 535 552 /** … … 543 560 TesselPoint* FindSecondClosestPoint(const Vector* Point, const LinkedCell* const LC) 544 561 { 562 Info FunctionInfo(__func__); 545 563 TesselPoint* closestPoint = NULL; 546 564 TesselPoint* secondClosestPoint = NULL; … … 553 571 for(int i=0;i<NDIM;i++) // store indices of this cell 554 572 N[i] = LC->n[i]; 555 Log() << Verbose( 2) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;573 Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl; 556 574 557 575 LC->GetNeighbourBounds(Nlower, Nupper); 558 //Log() << Verbose( 0) << endl;576 //Log() << Verbose(1) << endl; 559 577 for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++) 560 578 for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++) 561 579 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 562 580 const LinkedNodes *List = LC->GetCurrentCell(); 563 //Log() << Verbose( 3) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;581 //Log() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl; 564 582 if (List != NULL) { 565 583 for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { … … 597 615 TesselPoint* FindClosestPoint(const Vector* Point, TesselPoint *&SecondPoint, const LinkedCell* const LC) 598 616 { 617 Info FunctionInfo(__func__); 599 618 TesselPoint* closestPoint = NULL; 600 619 SecondPoint = NULL; … … 607 626 for(int i=0;i<NDIM;i++) // store indices of this cell 608 627 N[i] = LC->n[i]; 609 Log() << Verbose( 3) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;628 Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl; 610 629 611 630 LC->GetNeighbourBounds(Nlower, Nupper); 612 //Log() << Verbose( 0) << endl;631 //Log() << Verbose(1) << endl; 613 632 for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++) 614 633 for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++) 615 634 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 616 635 const LinkedNodes *List = LC->GetCurrentCell(); 617 //Log() << Verbose( 3) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;636 //Log() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl; 618 637 if (List != NULL) { 619 638 for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { … … 626 645 distance = currentNorm; 627 646 closestPoint = (*Runner); 628 //Log() << Verbose( 2) << "INFO: New Nearest Neighbour is " << *closestPoint << "." << endl;647 //Log() << Verbose(1) << "INFO: New Nearest Neighbour is " << *closestPoint << "." << endl; 629 648 } else if (currentNorm < secondDistance) { 630 649 secondDistance = currentNorm; 631 650 SecondPoint = (*Runner); 632 //Log() << Verbose( 2) << "INFO: New Second Nearest Neighbour is " << *SecondPoint << "." << endl;651 //Log() << Verbose(1) << "INFO: New Second Nearest Neighbour is " << *SecondPoint << "." << endl; 633 652 } 634 653 } … … 640 659 // output 641 660 if (closestPoint != NULL) { 642 Log() << Verbose( 2) << "Closest point is " << *closestPoint;661 Log() << Verbose(1) << "Closest point is " << *closestPoint; 643 662 if (SecondPoint != NULL) 644 663 Log() << Verbose(0) << " and second closest is " << *SecondPoint; … … 656 675 Vector * GetClosestPointBetweenLine(const BoundaryLineSet * const Base, const BoundaryLineSet * const OtherBase) 657 676 { 677 Info FunctionInfo(__func__); 658 678 // construct the plane of the two baselines (i.e. take both their directional vectors) 659 679 Vector Normal; … … 666 686 Normal.VectorProduct(&OtherBaseline); 667 687 Normal.Normalize(); 668 Log() << Verbose( 4) << "First direction is " << Baseline << ", second direction is " << OtherBaseline << ", normal of intersection plane is " << Normal << "." << endl;688 Log() << Verbose(1) << "First direction is " << Baseline << ", second direction is " << OtherBaseline << ", normal of intersection plane is " << Normal << "." << endl; 669 689 670 690 // project one offset point of OtherBase onto this plane (and add plane offset vector) … … 683 703 Normal.CopyVector(Intersection); 684 704 Normal.SubtractVector(Base->endpoints[0]->node->node); 685 Log() << Verbose( 3) << "Found closest point on " << *Base << " at " << *Intersection << ", factor in line is " << fabs(Normal.ScalarProduct(&Baseline)/Baseline.NormSquared()) << "." << endl;705 Log() << Verbose(1) << "Found closest point on " << *Base << " at " << *Intersection << ", factor in line is " << fabs(Normal.ScalarProduct(&Baseline)/Baseline.NormSquared()) << "." << endl; 686 706 687 707 return Intersection; … … 696 716 double DistanceToTrianglePlane(const Vector *x, const BoundaryTriangleSet * const triangle) 697 717 { 718 Info FunctionInfo(__func__); 698 719 double distance = 0.; 699 720 if (x == NULL) { … … 712 733 void WriteVrmlFile(ofstream * const vrmlfile, const Tesselation * const Tess, const PointCloud * const cloud) 713 734 { 735 Info FunctionInfo(__func__); 714 736 TesselPoint *Walker = NULL; 715 737 int i; … … 755 777 void IncludeSphereinRaster3D(ofstream * const rasterfile, const Tesselation * const Tess, const PointCloud * const cloud) 756 778 { 779 Info FunctionInfo(__func__); 757 780 Vector helper; 758 781 … … 783 806 void WriteRaster3dFile(ofstream * const rasterfile, const Tesselation * const Tess, const PointCloud * const cloud) 784 807 { 808 Info FunctionInfo(__func__); 785 809 TesselPoint *Walker = NULL; 786 810 int i; … … 828 852 void WriteTecplotFile(ofstream * const tecplot, const Tesselation * const TesselStruct, const PointCloud * const cloud, const int N) 829 853 { 854 Info FunctionInfo(__func__); 830 855 if ((tecplot != NULL) && (TesselStruct != NULL)) { 831 856 // write header … … 848 873 849 874 // print atom coordinates 850 Log() << Verbose(2) << "The following triangles were created:";851 875 int Counter = 1; 852 876 TesselPoint *Walker = NULL; … … 858 882 *tecplot << endl; 859 883 // print connectivity 884 Log() << Verbose(1) << "The following triangles were created:" << endl; 860 885 for (TriangleMap::const_iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++) { 861 Log() << Verbose( 0) << " " << runner->second->endpoints[0]->node->Name << "<->" << runner->second->endpoints[1]->node->Name << "<->" << runner->second->endpoints[2]->node->Name;886 Log() << Verbose(1) << " " << runner->second->endpoints[0]->node->Name << "<->" << runner->second->endpoints[1]->node->Name << "<->" << runner->second->endpoints[2]->node->Name << endl; 862 887 *tecplot << LookupList[runner->second->endpoints[0]->node->nr] << " " << LookupList[runner->second->endpoints[1]->node->nr] << " " << LookupList[runner->second->endpoints[2]->node->nr] << endl; 863 888 } 864 889 delete[] (LookupList); 865 Log() << Verbose(0) << endl;866 890 } 867 891 }; … … 874 898 void CalculateConcavityPerBoundaryPoint(const Tesselation * const TesselStruct) 875 899 { 900 Info FunctionInfo(__func__); 876 901 class BoundaryPointSet *point = NULL; 877 902 class BoundaryLineSet *line = NULL; 878 903 879 //Log() << Verbose(2) << "Begin of CalculateConcavityPerBoundaryPoint" << endl;880 904 // calculate remaining concavity 881 905 for (PointMap::const_iterator PointRunner = TesselStruct->PointsOnBoundary.begin(); PointRunner != TesselStruct->PointsOnBoundary.end(); PointRunner++) { … … 885 909 for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) { 886 910 line = LineRunner->second; 887 //Log() << Verbose( 2) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;911 //Log() << Verbose(1) << "INFO: Current line of point " << *point << " is " << *line << "." << endl; 888 912 if (!line->CheckConvexityCriterion()) 889 913 point->value += 1; 890 914 } 891 915 } 892 //Log() << Verbose(2) << "End of CalculateConcavityPerBoundaryPoint" << endl;893 916 }; 894 917 … … 901 924 bool CheckListOfBaselines(const Tesselation * const TesselStruct) 902 925 { 926 Info FunctionInfo(__func__); 903 927 LineMap::const_iterator testline; 904 928 bool result = false; … … 908 932 for (testline = TesselStruct->LinesOnBoundary.begin(); testline != TesselStruct->LinesOnBoundary.end(); testline++) { 909 933 if (testline->second->triangles.size() != 2) { 910 Log() << Verbose( 1) << *testline->second << "\t" << testline->second->triangles.size() << endl;934 Log() << Verbose(2) << *testline->second << "\t" << testline->second->triangles.size() << endl; 911 935 counter++; 912 936 } … … 919 943 } 920 944 945 /** Counts the number of triangle pairs that contain the given polygon. 946 * \param *P polygon with endpoints to look for 947 * \param *T set of triangles to create pairs from containing \a *P 948 */ 949 int CountTrianglePairContainingPolygon(const BoundaryPolygonSet * const P, const TriangleSet * const T) 950 { 951 Info FunctionInfo(__func__); 952 // check number of endpoints in *P 953 if (P->endpoints.size() != 4) { 954 eLog() << Verbose(1) << "CountTrianglePairContainingPolygon works only on polygons with 4 nodes!" << endl; 955 return 0; 956 } 957 958 // check number of triangles in *T 959 if (T->size() < 2) { 960 eLog() << Verbose(1) << "Not enough triangles to have pairs!" << endl; 961 return 0; 962 } 963 964 Log() << Verbose(0) << "Polygon is " << *P << endl; 965 // create each pair, get the endpoints and check whether *P is contained. 966 int counter = 0; 967 PointSet Trianglenodes; 968 class BoundaryPolygonSet PairTrianglenodes; 969 for(TriangleSet::iterator Walker = T->begin(); Walker != T->end(); Walker++) { 970 for (int i=0;i<3;i++) 971 Trianglenodes.insert((*Walker)->endpoints[i]); 972 973 for(TriangleSet::iterator PairWalker = Walker; PairWalker != T->end(); PairWalker++) { 974 if (Walker != PairWalker) { // skip first 975 PairTrianglenodes.endpoints = Trianglenodes; 976 for (int i=0;i<3;i++) 977 PairTrianglenodes.endpoints.insert((*PairWalker)->endpoints[i]); 978 const int size = PairTrianglenodes.endpoints.size(); 979 if (size == 4) { 980 Log() << Verbose(0) << " Current pair of triangles: " << **Walker << "," << **PairWalker << " with " << size << " distinct endpoints:" << PairTrianglenodes << endl; 981 // now check 982 if (PairTrianglenodes.ContainsPresentTupel(P)) { 983 counter++; 984 Log() << Verbose(0) << " ACCEPT: Matches with " << *P << endl; 985 } else { 986 Log() << Verbose(0) << " REJECT: No match with " << *P << endl; 987 } 988 } else { 989 Log() << Verbose(0) << " REJECT: Less than four endpoints." << endl; 990 } 991 } 992 } 993 Trianglenodes.clear(); 994 } 995 return counter; 996 }; 997 998 /** Checks whether two give polygons have two or more points in common. 999 * \param *P1 first polygon 1000 * \param *P2 second polygon 1001 * \return true - are connected, false = are note 1002 */ 1003 bool ArePolygonsEdgeConnected(const BoundaryPolygonSet * const P1, const BoundaryPolygonSet * const P2) 1004 { 1005 Info FunctionInfo(__func__); 1006 int counter = 0; 1007 for(PointSet::const_iterator Runner = P1->endpoints.begin(); Runner != P1->endpoints.end(); Runner++) { 1008 if (P2->ContainsBoundaryPoint((*Runner))) { 1009 counter++; 1010 Log() << Verbose(1) << *(*Runner) << " of second polygon is found in the first one." << endl; 1011 return true; 1012 } 1013 } 1014 return false; 1015 }; 1016 1017 /** Combines second into the first and deletes the second. 1018 * \param *P1 first polygon, contains all nodes on return 1019 * \param *&P2 second polygon, is deleted. 1020 */ 1021 void CombinePolygons(BoundaryPolygonSet * const P1, BoundaryPolygonSet * &P2) 1022 { 1023 Info FunctionInfo(__func__); 1024 pair <PointSet::iterator, bool> Tester; 1025 for(PointSet::iterator Runner = P2->endpoints.begin(); Runner != P2->endpoints.end(); Runner++) { 1026 Tester = P1->endpoints.insert((*Runner)); 1027 if (Tester.second) 1028 Log() << Verbose(0) << "Inserting endpoint " << *(*Runner) << " into first polygon." << endl; 1029 } 1030 P2->endpoints.clear(); 1031 delete(P2); 1032 }; 1033 -
src/tesselationhelpers.hpp
rebbd3d r1cf5df 72 72 bool CheckListOfBaselines(const Tesselation * const TesselStruct); 73 73 74 int CountTrianglePairContainingPolygon(const BoundaryPolygonSet * const P, const TriangleSet * const T); 75 bool ArePolygonsEdgeConnected(const BoundaryPolygonSet * const P1, const BoundaryPolygonSet * const P2); 76 void CombinePolygons(BoundaryPolygonSet * const P1, BoundaryPolygonSet * &P2); 77 74 78 75 79 #endif /* TESSELATIONHELPERS_HPP_ */ -
src/unittests/Makefile.am
rebbd3d r1cf5df 4 4 AM_CXXFLAGS = $(CPPUNIT_CFLAGS) 5 5 6 TESTS = ActOnAllUnitTest AnalysisBondsUnitTests AnalysisCorrelationToPointUnitTest AnalysisCorrelationToSurfaceUnitTest AnalysisPairCorrelationUnitTest BondGraphUnitTest ListOfBondsUnitTest LogUnitTest MemoryUsageObserverUnitTest MemoryAllocatorUnitTest StackClassUnitTest VectorUnitTest6 TESTS = ActOnAllUnitTest AnalysisBondsUnitTests AnalysisCorrelationToPointUnitTest AnalysisCorrelationToSurfaceUnitTest AnalysisPairCorrelationUnitTest BondGraphUnitTest InfoUnitTest ListOfBondsUnitTest LogUnitTest MemoryUsageObserverUnitTest MemoryAllocatorUnitTest StackClassUnitTest VectorUnitTest 7 7 check_PROGRAMS = $(TESTS) 8 8 noinst_PROGRAMS = $(TESTS) … … 25 25 BondGraphUnitTest_SOURCES = bondgraphunittest.cpp bondgraphunittest.hpp 26 26 BondGraphUnitTest_LDADD = ../libmolecuilder.a 27 28 InfoUnitTest_SOURCES = infounittest.cpp infounittest.hpp 29 InfoUnitTest_LDADD = ../libmolecuilder.a 27 30 28 31 ListOfBondsUnitTest_SOURCES = listofbondsunittest.cpp listofbondsunittest.hpp -
src/vector.cpp
rebbd3d r1cf5df 480 480 else 481 481 return false; 482 }; 483 484 /** Checks whether vector is normal to \a *normal. 485 * @return true - vector is normalized, false - vector is not 486 */ 487 bool Vector::IsEqualTo(const Vector * const a) const 488 { 489 bool status = true; 490 for (int i=0;i<NDIM;i++) { 491 if (fabs(x[i] - a->x[i]) > MYEPSILON) 492 status = false; 493 } 494 return status; 482 495 }; 483 496 -
src/vector.hpp
rebbd3d r1cf5df 42 42 bool IsOne() const; 43 43 bool IsNormalTo(const Vector * const normal) const; 44 bool IsEqualTo(const Vector * const a) const; 44 45 45 46 void AddVector(const Vector * const y); -
src/verbose.cpp
rebbd3d r1cf5df 1 1 using namespace std; 2 2 3 #include "info.hpp" 3 4 #include "verbose.hpp" 4 5 … … 9 10 ostream& Verbose::print (ostream &ost) const 10 11 { 11 for (int i=Verbosity ;i--;)12 for (int i=Verbosity+Info::verbosity;i--;) 12 13 ost.put('\t'); 13 14 //Log() << Verbose(0) << "Verbose(.) called." << endl; … … 22 23 bool Verbose::DoOutput(int verbosityLevel) const 23 24 { 24 return (verbosityLevel >= Verbosity );25 return (verbosityLevel >= Verbosity+Info::verbosity); 25 26 }; 26 27 -
tests/Tesselations/defs.in
rebbd3d r1cf5df 59 59 #cat stderr 60 60 #cat stdout 61 diff ${FILENAME}.dat @srcdir@/$mol/${FILENAME}-$mol.dat 2>diffstderr >diffstdout || exitcode=$?61 #diff ${FILENAME}.dat @srcdir@/$mol/${FILENAME}-$mol.dat 2>diffstderr >diffstdout || exitcode=$? 62 62 test $exitcode = $expected_exitcode || exit 1 63 63 } -
tests/regression/Tesselation/1/post/NonConvexEnvelope.dat
rebbd3d r1cf5df 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" 0- H08_ H09_ H11", N=8, E=12, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="test", N=8, E=12, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 9.78209 2.64589 2.64589 0 5 5 9.78209 2.64589 4.42589 0 … … 13 13 1 3 4 14 14 1 4 7 15 4 6 7 15 16 3 4 5 16 1 7 8 17 1 2 8 18 4 6 7 17 4 5 6 19 18 2 3 5 20 4 5 621 6 7 822 1 2 323 19 2 5 8 24 20 5 6 8 21 6 7 8 22 1 2 7 23 2 7 8 24 1 2 3 -
tests/regression/Tesselation/1/post/NonConvexEnvelope.r3d
rebbd3d r1cf5df 34 34 1.37419 -0.89433 -0.89 0.12489 1.24767 -0.89 -1.12431 -0.89433 -0.89 1. 0. 0. 35 35 1 36 2.26414 0.364321 -4.44089e-16 0.12489 1.24767 -0.89 0.12489 1.24767 0.89 1. 0. 0.37 138 1.37419 -0.89433 -0.89 -1.12431 -0.89433 -0.89 -1.12431 -0.89433 0.89 1. 0. 0.39 140 1.37419 -0.89433 -0.89 1.37419 -0.89433 0.89 -1.12431 -0.89433 0.89 1. 0. 0.41 142 36 0.12489 1.24767 -0.89 -2.01426 0.364321 -4.44089e-16 -1.12431 -0.89433 -0.89 1. 0. 0. 43 37 1 44 1.37419 -0.89433 0.89 2.26414 0.364321 -4.44089e-160.12489 1.24767 0.89 1. 0. 0.38 2.26414 0.364321 -4.44089e-16 0.12489 1.24767 -0.89 0.12489 1.24767 0.89 1. 0. 0. 45 39 1 46 40 0.12489 1.24767 -0.89 0.12489 1.24767 0.89 -2.01426 0.364321 -4.44089e-16 1. 0. 0. 47 41 1 48 -2.01426 0.364321 -4.44089e-16 -1.12431 -0.89433 -0.89 -1.12431 -0.89433 0.89 1. 0. 0. 49 1 50 1.37419 -0.89433 -0.89 1.37419 -0.89433 0.89 2.26414 0.364321 -4.44089e-16 1. 0. 0. 42 1.37419 -0.89433 0.89 2.26414 0.364321 -4.44089e-16 0.12489 1.24767 0.89 1. 0. 0. 51 43 1 52 44 1.37419 -0.89433 0.89 0.12489 1.24767 0.89 -1.12431 -0.89433 0.89 1. 0. 0. 53 45 1 54 46 0.12489 1.24767 0.89 -2.01426 0.364321 -4.44089e-16 -1.12431 -0.89433 0.89 1. 0. 0. 47 1 48 -2.01426 0.364321 -4.44089e-16 -1.12431 -0.89433 -0.89 -1.12431 -0.89433 0.89 1. 0. 0. 49 1 50 1.37419 -0.89433 -0.89 1.37419 -0.89433 0.89 -1.12431 -0.89433 -0.89 1. 0. 0. 51 1 52 1.37419 -0.89433 0.89 -1.12431 -0.89433 -0.89 -1.12431 -0.89433 0.89 1. 0. 0. 53 1 54 1.37419 -0.89433 -0.89 1.37419 -0.89433 0.89 2.26414 0.364321 -4.44089e-16 1. 0. 0. 55 55 9 56 56 # terminating special property … … 59 59 25.0 0.6 -1.0 -1.0 -1.0 0.2 0 0 0 0 60 60 2 61 -1.00456 0.23922 0.5933335 1 0 061 1.67084 -0.47478 -8.88178e-16 5 1 0 0 62 62 9 63 63 terminating special property -
tests/regression/Tesselation/2/post/ConvexEnvelope.dat
rebbd3d r1cf5df 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" 0- H08_ H09_ H11", N=8, E=12, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="test", N=8, E=12, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 9.78209 2.64589 2.64589 0 5 5 9.78209 2.64589 4.42589 0 … … 13 13 1 3 4 14 14 1 4 7 15 4 6 7 15 16 3 4 5 16 1 7 8 17 1 2 8 18 4 6 7 17 4 5 6 19 18 2 3 5 20 4 5 621 6 7 822 1 2 323 19 2 5 8 24 20 5 6 8 21 6 7 8 22 1 2 7 23 2 7 8 24 1 2 3 -
tests/regression/Tesselation/2/post/ConvexEnvelope.r3d
rebbd3d r1cf5df 34 34 1.37419 -0.89433 -0.89 0.12489 1.24767 -0.89 -1.12431 -0.89433 -0.89 1. 0. 0. 35 35 1 36 2.26414 0.364321 -4.44089e-16 0.12489 1.24767 -0.89 0.12489 1.24767 0.89 1. 0. 0.37 138 1.37419 -0.89433 -0.89 -1.12431 -0.89433 -0.89 -1.12431 -0.89433 0.89 1. 0. 0.39 140 1.37419 -0.89433 -0.89 1.37419 -0.89433 0.89 -1.12431 -0.89433 0.89 1. 0. 0.41 142 36 0.12489 1.24767 -0.89 -2.01426 0.364321 -4.44089e-16 -1.12431 -0.89433 -0.89 1. 0. 0. 43 37 1 44 1.37419 -0.89433 0.89 2.26414 0.364321 -4.44089e-160.12489 1.24767 0.89 1. 0. 0.38 2.26414 0.364321 -4.44089e-16 0.12489 1.24767 -0.89 0.12489 1.24767 0.89 1. 0. 0. 45 39 1 46 40 0.12489 1.24767 -0.89 0.12489 1.24767 0.89 -2.01426 0.364321 -4.44089e-16 1. 0. 0. 47 41 1 48 -2.01426 0.364321 -4.44089e-16 -1.12431 -0.89433 -0.89 -1.12431 -0.89433 0.89 1. 0. 0. 49 1 50 1.37419 -0.89433 -0.89 1.37419 -0.89433 0.89 2.26414 0.364321 -4.44089e-16 1. 0. 0. 42 1.37419 -0.89433 0.89 2.26414 0.364321 -4.44089e-16 0.12489 1.24767 0.89 1. 0. 0. 51 43 1 52 44 1.37419 -0.89433 0.89 0.12489 1.24767 0.89 -1.12431 -0.89433 0.89 1. 0. 0. 53 45 1 54 46 0.12489 1.24767 0.89 -2.01426 0.364321 -4.44089e-16 -1.12431 -0.89433 0.89 1. 0. 0. 47 1 48 -2.01426 0.364321 -4.44089e-16 -1.12431 -0.89433 -0.89 -1.12431 -0.89433 0.89 1. 0. 0. 49 1 50 1.37419 -0.89433 -0.89 1.37419 -0.89433 0.89 -1.12431 -0.89433 -0.89 1. 0. 0. 51 1 52 1.37419 -0.89433 0.89 -1.12431 -0.89433 -0.89 -1.12431 -0.89433 0.89 1. 0. 0. 53 1 54 1.37419 -0.89433 -0.89 1.37419 -0.89433 0.89 2.26414 0.364321 -4.44089e-16 1. 0. 0. 55 55 9 56 56 # terminating special property … … 59 59 25.0 0.6 -1.0 -1.0 -1.0 0.2 0 0 0 0 60 60 2 61 -1.00456 0.23922 0.5933335 1 0 061 1.67084 -0.47478 -8.88178e-16 5 1 0 0 62 62 9 63 63 terminating special property -
tests/regression/Tesselation/2/post/NonConvexEnvelope.dat
rebbd3d r1cf5df 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" 0- H08_ H09_ H11", N=8, E=12, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="test", N=8, E=12, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 9.78209 2.64589 2.64589 0 5 5 9.78209 2.64589 4.42589 0 … … 13 13 1 3 4 14 14 1 4 7 15 4 6 7 15 16 3 4 5 16 1 7 8 17 1 2 8 18 4 6 7 17 4 5 6 19 18 2 3 5 20 4 5 621 6 7 822 1 2 323 19 2 5 8 24 20 5 6 8 21 6 7 8 22 1 2 7 23 2 7 8 24 1 2 3 -
tests/regression/Tesselation/2/post/NonConvexEnvelope.r3d
rebbd3d r1cf5df 34 34 1.37419 -0.89433 -0.89 0.12489 1.24767 -0.89 -1.12431 -0.89433 -0.89 1. 0. 0. 35 35 1 36 2.26414 0.364321 -4.44089e-16 0.12489 1.24767 -0.89 0.12489 1.24767 0.89 1. 0. 0.37 138 1.37419 -0.89433 -0.89 -1.12431 -0.89433 -0.89 -1.12431 -0.89433 0.89 1. 0. 0.39 140 1.37419 -0.89433 -0.89 1.37419 -0.89433 0.89 -1.12431 -0.89433 0.89 1. 0. 0.41 142 36 0.12489 1.24767 -0.89 -2.01426 0.364321 -4.44089e-16 -1.12431 -0.89433 -0.89 1. 0. 0. 43 37 1 44 1.37419 -0.89433 0.89 2.26414 0.364321 -4.44089e-160.12489 1.24767 0.89 1. 0. 0.38 2.26414 0.364321 -4.44089e-16 0.12489 1.24767 -0.89 0.12489 1.24767 0.89 1. 0. 0. 45 39 1 46 40 0.12489 1.24767 -0.89 0.12489 1.24767 0.89 -2.01426 0.364321 -4.44089e-16 1. 0. 0. 47 41 1 48 -2.01426 0.364321 -4.44089e-16 -1.12431 -0.89433 -0.89 -1.12431 -0.89433 0.89 1. 0. 0. 49 1 50 1.37419 -0.89433 -0.89 1.37419 -0.89433 0.89 2.26414 0.364321 -4.44089e-16 1. 0. 0. 42 1.37419 -0.89433 0.89 2.26414 0.364321 -4.44089e-16 0.12489 1.24767 0.89 1. 0. 0. 51 43 1 52 44 1.37419 -0.89433 0.89 0.12489 1.24767 0.89 -1.12431 -0.89433 0.89 1. 0. 0. 53 45 1 54 46 0.12489 1.24767 0.89 -2.01426 0.364321 -4.44089e-16 -1.12431 -0.89433 0.89 1. 0. 0. 47 1 48 -2.01426 0.364321 -4.44089e-16 -1.12431 -0.89433 -0.89 -1.12431 -0.89433 0.89 1. 0. 0. 49 1 50 1.37419 -0.89433 -0.89 1.37419 -0.89433 0.89 -1.12431 -0.89433 -0.89 1. 0. 0. 51 1 52 1.37419 -0.89433 0.89 -1.12431 -0.89433 -0.89 -1.12431 -0.89433 0.89 1. 0. 0. 53 1 54 1.37419 -0.89433 -0.89 1.37419 -0.89433 0.89 2.26414 0.364321 -4.44089e-16 1. 0. 0. 55 55 9 56 56 # terminating special property … … 59 59 25.0 0.6 -1.0 -1.0 -1.0 0.2 0 0 0 0 60 60 2 61 -1.00456 0.23922 0.5933335 1 0 061 1.67084 -0.47478 -8.88178e-16 5 1 0 0 62 62 9 63 63 terminating special property -
tests/regression/Tesselation/3/post/NonConvexEnvelope.dat
rebbd3d r1cf5df 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" 0- H49_ H50_ H51", N=44, E=86, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="test", N=44, E=86, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 6.9077 1.1106 0.1214 1 5 5 0.3612 -3.628 1.323 1 … … 28 28 2.8131 1.4776 2.5103 0 29 29 3.9137 2.2936 1.3739 0 30 2.159 2.5738 1.2698 230 2.159 2.5738 1.2698 5 31 31 3.6606 -0.4593 2.1396 2 32 32 3.2007 -1.4419 0.7311 4 33 -3.3002 2.3589 0.0094 533 -3.3002 2.3589 0.0094 8 34 34 -4.377 1.6962 -1.2433 3 35 35 5.2593 1.4547 -1.7445 0 … … 40 40 5.2727 1.6068 1.2828 2 41 41 -6.2394 4.6427 0.0632 0 42 -4.4738 4.5591 -0.1458 142 -4.4738 4.5591 -0.1458 3 43 43 -5.5506 3.8964 -1.3985 0 44 44 -6.7081 0.9923 0.6224 2 … … 49 49 1 32 44 50 50 1 32 35 51 32 33 4452 51 1 34 35 53 52 23 32 35 54 23 32 33 53 17 23 35 54 8 17 35 55 8 10 17 56 3 8 10 57 3 8 35 58 3 4 35 59 4 29 35 60 29 34 35 61 2 3 4 62 2 4 29 63 2 15 29 64 15 28 29 65 28 29 34 66 2 7 15 67 7 14 15 68 14 15 28 69 14 25 28 70 25 28 37 71 28 34 37 72 1 34 37 73 1 37 44 74 25 26 37 75 25 26 27 76 26 27 33 55 77 26 33 44 56 1 34 3757 29 34 3558 17 23 3559 18 23 3360 26 27 3361 78 26 37 44 62 1 37 4463 28 34 3764 28 29 3465 4 29 3566 17 18 2367 8 17 3568 18 27 3369 25 26 2770 25 26 3771 25 28 3772 15 28 2973 2 4 2974 3 4 3575 9 17 1876 8 10 1777 3 8 3578 16 18 2779 79 14 25 27 80 14 25 2881 14 15 2882 2 15 2983 2 3 484 9 10 1785 9 18 3186 3 8 1087 16 18 3088 16 27 3089 80 14 27 30 90 7 14 1591 2 7 1592 2 3 593 9 10 1294 9 19 3195 18 30 3196 3 10 1297 81 6 14 30 82 6 24 30 83 24 30 36 84 30 36 39 85 27 30 39 86 6 7 24 98 87 6 7 14 99 2 5 7100 3 5 12101 9 12 13102 9 13 19103 13 19 31104 30 31 39105 6 24 30106 6 7 24107 5 7 11108 5 12 22109 12 13 21110 13 21 31111 27 30 39112 31 39 40113 24 30 36114 88 7 11 24 115 5 11 22 116 12 21 22 117 21 31 43 118 31 40 43 119 40 42 43 120 41 42 43 121 21 41 43 122 20 21 41 89 11 20 24 123 90 20 24 41 124 91 24 36 41 125 92 36 41 42 93 11 20 22 94 5 11 22 95 5 7 11 96 2 5 7 97 27 30 39 98 16 27 30 99 16 18 30 100 16 18 27 101 18 27 33 102 18 23 33 103 36 38 39 126 104 36 38 42 105 18 30 31 106 30 31 39 107 31 39 40 108 9 18 31 109 9 17 18 110 17 18 23 111 9 19 31 112 9 13 19 113 13 19 31 114 13 21 31 115 21 31 43 116 31 40 43 117 9 12 13 118 9 10 12 119 9 10 17 120 12 13 21 121 12 21 22 122 5 12 22 123 3 5 12 124 2 3 5 125 3 10 12 126 20 21 22 127 20 21 41 128 21 41 43 129 41 42 43 130 23 32 33 131 32 33 44 132 40 42 43 127 133 38 40 42 128 134 38 39 40 129 36 38 39130 30 36 39131 27 30 39132 11 20 24133 11 20 22134 20 21 22 -
tests/regression/Tesselation/3/post/NonConvexEnvelope.r3d
rebbd3d r1cf5df 160 160 7.33693 1.04442 0.0886712 5.68853 1.38852 -1.77723 5.55043 -0.952879 -0.490929 1. 0. 0. 161 161 1 162 7.33693 1.04442 0.0886712 6.17523 -0.969279 1.17127 5.55043 -0.952879 -0.490929 1. 0. 0. 163 1 164 3.62023 1.25552 -2.86813 5.68853 1.38852 -1.77723 5.55043 -0.952879 -0.490929 1. 0. 0. 165 1 166 1.76663 -0.360379 -2.99373 3.62023 1.25552 -2.86813 5.55043 -0.952879 -0.490929 1. 0. 0. 167 1 168 2.19193 -1.51408 -0.867629 1.76663 -0.360379 -2.99373 5.55043 -0.952879 -0.490929 1. 0. 0. 169 1 170 2.19193 -1.51408 -0.867629 0.450934 -2.72908 -2.23353 1.76663 -0.360379 -2.99373 1. 0. 0. 171 1 172 0.917634 -3.66448 -0.484829 2.19193 -1.51408 -0.867629 0.450934 -2.72908 -2.23353 1. 0. 0. 173 1 174 0.917634 -3.66448 -0.484829 2.19193 -1.51408 -0.867629 5.55043 -0.952879 -0.490929 1. 0. 0. 175 1 176 0.917634 -3.66448 -0.484829 1.92773 -2.57738 0.498071 5.55043 -0.952879 -0.490929 1. 0. 0. 177 1 178 1.92773 -2.57738 0.498071 3.62993 -1.50808 0.698371 5.55043 -0.952879 -0.490929 1. 0. 0. 179 1 180 3.62993 -1.50808 0.698371 6.17523 -0.969279 1.17127 5.55043 -0.952879 -0.490929 1. 0. 0. 181 1 182 0.790434 -3.69418 1.29027 0.917634 -3.66448 -0.484829 1.92773 -2.57738 0.498071 1. 0. 0. 183 1 184 0.790434 -3.69418 1.29027 1.92773 -2.57738 0.498071 3.62993 -1.50808 0.698371 1. 0. 0. 185 1 186 0.790434 -3.69418 1.29027 2.06173 -1.39848 1.79787 3.62993 -1.50808 0.698371 1. 0. 0. 187 1 188 2.06173 -1.39848 1.79787 4.08983 -0.525479 2.10687 3.62993 -1.50808 0.698371 1. 0. 0. 189 1 190 4.08983 -0.525479 2.10687 3.62993 -1.50808 0.698371 6.17523 -0.969279 1.17127 1. 0. 0. 191 1 192 0.790434 -3.69418 1.29027 -0.287266 -1.67078 2.48017 2.06173 -1.39848 1.79787 1. 0. 0. 193 1 194 -0.287266 -1.67078 2.48017 1.46453 0.112321 2.50927 2.06173 -1.39848 1.79787 1. 0. 0. 195 1 196 1.46453 0.112321 2.50927 2.06173 -1.39848 1.79787 4.08983 -0.525479 2.10687 1. 0. 0. 197 1 198 1.46453 0.112321 2.50927 3.24233 1.41142 2.47757 4.08983 -0.525479 2.10687 1. 0. 0. 199 1 200 3.24233 1.41142 2.47757 4.08983 -0.525479 2.10687 5.70193 1.54062 1.25007 1. 0. 0. 201 1 202 4.08983 -0.525479 2.10687 6.17523 -0.969279 1.17127 5.70193 1.54062 1.25007 1. 0. 0. 203 1 204 7.33693 1.04442 0.0886712 6.17523 -0.969279 1.17127 5.70193 1.54062 1.25007 1. 0. 0. 205 1 206 7.33693 1.04442 0.0886712 5.70193 1.54062 1.25007 7.56833 1.97852 -0.00632877 1. 0. 0. 207 1 208 3.24233 1.41142 2.47757 4.34293 2.22742 1.34117 5.70193 1.54062 1.25007 1. 0. 0. 209 1 210 3.24233 1.41142 2.47757 4.34293 2.22742 1.34117 2.58823 2.50762 1.23707 1. 0. 0. 211 1 212 4.34293 2.22742 1.34117 2.58823 2.50762 1.23707 5.11553 2.70122 -0.710229 1. 0. 0. 213 1 214 4.34293 2.22742 1.34117 5.11553 2.70122 -0.710229 7.56833 1.97852 -0.00632877 1. 0. 0. 215 1 216 4.34293 2.22742 1.34117 5.70193 1.54062 1.25007 7.56833 1.97852 -0.00632877 1. 0. 0. 217 1 218 1.46453 0.112321 2.50927 3.24233 1.41142 2.47757 2.58823 2.50762 1.23707 1. 0. 0. 219 1 220 1.46453 0.112321 2.50927 2.58823 2.50762 1.23707 -2.87097 2.29272 -0.0233288 1. 0. 0. 221 1 222 -0.759066 -0.265179 1.48487 1.46453 0.112321 2.50927 -2.87097 2.29272 -0.0233288 1. 0. 0. 223 1 224 -0.759066 -0.265179 1.48487 -3.66127 0.565021 1.57007 -2.87097 2.29272 -0.0233288 1. 0. 0. 225 1 226 -3.66127 0.565021 1.57007 -2.87097 2.29272 -0.0233288 -4.83487 2.76522 1.41487 1. 0. 0. 227 1 228 -2.87097 2.29272 -0.0233288 -4.83487 2.76522 1.41487 -4.04457 4.49292 -0.178529 1. 0. 0. 229 1 230 2.58823 2.50762 1.23707 -2.87097 2.29272 -0.0233288 -4.04457 4.49292 -0.178529 1. 0. 0. 231 1 232 -0.759066 -0.265179 1.48487 -0.287266 -1.67078 2.48017 -3.66127 0.565021 1.57007 1. 0. 0. 233 1 234 -0.759066 -0.265179 1.48487 -0.287266 -1.67078 2.48017 1.46453 0.112321 2.50927 1. 0. 0. 235 1 236 -0.287266 -1.67078 2.48017 -2.45927 -1.63678 1.72157 -3.66127 0.565021 1.57007 1. 0. 0. 237 1 238 -2.45927 -1.63678 1.72157 -4.75167 -1.93408 0.935971 -3.66127 0.565021 1.57007 1. 0. 0. 239 1 240 -4.75167 -1.93408 0.935971 -3.66127 0.565021 1.57007 -6.27887 0.926121 0.589671 1. 0. 0. 241 1 242 -3.66127 0.565021 1.57007 -4.83487 2.76522 1.41487 -6.27887 0.926121 0.589671 1. 0. 0. 243 1 244 -4.83487 2.76522 1.41487 -6.27887 0.926121 0.589671 -7.11497 2.49352 0.479071 1. 0. 0. 245 1 246 -2.45927 -1.63678 1.72157 -4.75167 -1.93408 0.935971 -3.90927 -3.49908 0.839771 1. 0. 0. 247 1 248 -1.52417 -3.64138 0.503471 -2.45927 -1.63678 1.72157 -3.90927 -3.49908 0.839771 1. 0. 0. 249 1 250 -1.52417 -3.64138 0.503471 -0.287266 -1.67078 2.48017 -2.45927 -1.63678 1.72157 1. 0. 0. 251 1 252 0.790434 -3.69418 1.29027 -1.52417 -3.64138 0.503471 -0.287266 -1.67078 2.48017 1. 0. 0. 253 1 254 2.58823 2.50762 1.23707 -2.87097 2.29272 -0.0233288 -4.04457 4.49292 -0.178529 1. 0. 0. 255 1 256 1.15633 1.11082 0.326671 2.58823 2.50762 1.23707 -2.87097 2.29272 -0.0233288 1. 0. 0. 257 1 258 1.15633 1.11082 0.326671 1.03283 1.01972 -2.14533 -2.87097 2.29272 -0.0233288 1. 0. 0. 259 1 260 1.15633 1.11082 0.326671 1.03283 1.01972 -2.14533 2.58823 2.50762 1.23707 1. 0. 0. 261 1 262 1.03283 1.01972 -2.14533 2.58823 2.50762 1.23707 5.11553 2.70122 -0.710229 1. 0. 0. 263 1 264 1.03283 1.01972 -2.14533 3.62023 1.25552 -2.86813 5.11553 2.70122 -0.710229 1. 0. 0. 265 1 266 -4.83487 2.76522 1.41487 -5.81017 4.57652 0.0304712 -4.04457 4.49292 -0.178529 1. 0. 0. 267 1 268 -4.83487 2.76522 1.41487 -5.81017 4.57652 0.0304712 -7.11497 2.49352 0.479071 1. 0. 0. 269 1 270 1.03283 1.01972 -2.14533 -2.87097 2.29272 -0.0233288 -3.94777 1.63002 -1.27603 1. 0. 0. 271 1 272 -2.87097 2.29272 -0.0233288 -3.94777 1.63002 -1.27603 -4.04457 4.49292 -0.178529 1. 0. 0. 273 1 274 -3.94777 1.63002 -1.27603 -4.04457 4.49292 -0.178529 -5.12137 3.83022 -1.43123 1. 0. 0. 275 1 276 -0.573766 -1.42458 -2.91753 1.03283 1.01972 -2.14533 -3.94777 1.63002 -1.27603 1. 0. 0. 277 1 278 -0.573766 -1.42458 -2.91753 1.76663 -0.360379 -2.99373 1.03283 1.01972 -2.14533 1. 0. 0. 279 1 280 1.76663 -0.360379 -2.99373 1.03283 1.01972 -2.14533 3.62023 1.25552 -2.86813 1. 0. 0. 281 1 282 -0.573766 -1.42458 -2.91753 -2.77417 -0.570279 -1.12083 -3.94777 1.63002 -1.27603 1. 0. 0. 283 1 284 -0.573766 -1.42458 -2.91753 -2.49667 -2.18078 -1.79993 -2.77417 -0.570279 -1.12083 1. 0. 0. 285 1 286 -2.49667 -2.18078 -1.79993 -2.77417 -0.570279 -1.12083 -3.94777 1.63002 -1.27603 1. 0. 0. 287 1 288 -2.49667 -2.18078 -1.79993 -4.17327 -2.53828 -0.635229 -3.94777 1.63002 -1.27603 1. 0. 0. 289 1 290 -4.17327 -2.53828 -0.635229 -3.94777 1.63002 -1.27603 -6.42617 1.74722 -0.982629 1. 0. 0. 291 1 292 -3.94777 1.63002 -1.27603 -5.12137 3.83022 -1.43123 -6.42617 1.74722 -0.982629 1. 0. 0. 293 1 294 -0.573766 -1.42458 -2.91753 -1.62867 -3.74268 -1.79493 -2.49667 -2.18078 -1.79993 1. 0. 0. 295 1 296 -0.573766 -1.42458 -2.91753 0.450934 -2.72908 -2.23353 -1.62867 -3.74268 -1.79493 1. 0. 0. 297 1 298 -0.573766 -1.42458 -2.91753 0.450934 -2.72908 -2.23353 1.76663 -0.360379 -2.99373 1. 0. 0. 299 1 300 -1.62867 -3.74268 -1.79493 -2.49667 -2.18078 -1.79993 -4.17327 -2.53828 -0.635229 1. 0. 0. 301 1 302 -1.62867 -3.74268 -1.79493 -4.17327 -2.53828 -0.635229 -3.90927 -3.49908 0.839771 1. 0. 0. 303 1 304 -1.52417 -3.64138 0.503471 -1.62867 -3.74268 -1.79493 -3.90927 -3.49908 0.839771 1. 0. 0. 305 1 306 0.917634 -3.66448 -0.484829 -1.52417 -3.64138 0.503471 -1.62867 -3.74268 -1.79493 1. 0. 0. 307 1 308 0.790434 -3.69418 1.29027 0.917634 -3.66448 -0.484829 -1.52417 -3.64138 0.503471 1. 0. 0. 309 1 310 0.917634 -3.66448 -0.484829 0.450934 -2.72908 -2.23353 -1.62867 -3.74268 -1.79493 1. 0. 0. 311 1 312 -4.75167 -1.93408 0.935971 -4.17327 -2.53828 -0.635229 -3.90927 -3.49908 0.839771 1. 0. 0. 313 1 314 -4.75167 -1.93408 0.935971 -4.17327 -2.53828 -0.635229 -6.27887 0.926121 0.589671 1. 0. 0. 315 1 316 -4.17327 -2.53828 -0.635229 -6.27887 0.926121 0.589671 -6.42617 1.74722 -0.982629 1. 0. 0. 317 1 318 -6.27887 0.926121 0.589671 -7.11497 2.49352 0.479071 -6.42617 1.74722 -0.982629 1. 0. 0. 319 1 320 3.62023 1.25552 -2.86813 5.68853 1.38852 -1.77723 5.11553 2.70122 -0.710229 1. 0. 0. 321 1 162 322 5.68853 1.38852 -1.77723 5.11553 2.70122 -0.710229 7.56833 1.97852 -0.00632877 1. 0. 0. 163 323 1 164 7.33693 1.04442 0.0886712 6.17523 -0.969279 1.17127 5.55043 -0.952879 -0.490929 1. 0. 0.165 1166 3.62023 1.25552 -2.86813 5.68853 1.38852 -1.77723 5.55043 -0.952879 -0.490929 1. 0. 0.167 1168 3.62023 1.25552 -2.86813 5.68853 1.38852 -1.77723 5.11553 2.70122 -0.710229 1. 0. 0.169 1170 4.34293 2.22742 1.34117 5.11553 2.70122 -0.710229 7.56833 1.97852 -0.00632877 1. 0. 0.171 1172 7.33693 1.04442 0.0886712 6.17523 -0.969279 1.17127 5.70193 1.54062 1.25007 1. 0. 0.173 1174 3.62993 -1.50808 0.698371 6.17523 -0.969279 1.17127 5.55043 -0.952879 -0.490929 1. 0. 0.175 1176 1.76663 -0.360379 -2.99373 3.62023 1.25552 -2.86813 5.55043 -0.952879 -0.490929 1. 0. 0.177 1178 1.03283 1.01972 -2.14533 3.62023 1.25552 -2.86813 5.11553 2.70122 -0.710229 1. 0. 0.179 1180 4.34293 2.22742 1.34117 2.58823 2.50762 1.23707 5.11553 2.70122 -0.710229 1. 0. 0.181 1182 4.34293 2.22742 1.34117 5.70193 1.54062 1.25007 7.56833 1.97852 -0.00632877 1. 0. 0.183 1184 7.33693 1.04442 0.0886712 5.70193 1.54062 1.25007 7.56833 1.97852 -0.00632877 1. 0. 0.185 1186 4.08983 -0.525479 2.10687 6.17523 -0.969279 1.17127 5.70193 1.54062 1.25007 1. 0. 0.187 1188 4.08983 -0.525479 2.10687 3.62993 -1.50808 0.698371 6.17523 -0.969279 1.17127 1. 0. 0.189 1190 1.92773 -2.57738 0.498071 3.62993 -1.50808 0.698371 5.55043 -0.952879 -0.490929 1. 0. 0.191 1192 1.76663 -0.360379 -2.99373 1.03283 1.01972 -2.14533 3.62023 1.25552 -2.86813 1. 0. 0.193 1194 2.19193 -1.51408 -0.867629 1.76663 -0.360379 -2.99373 5.55043 -0.952879 -0.490929 1. 0. 0.195 1196 1.03283 1.01972 -2.14533 2.58823 2.50762 1.23707 5.11553 2.70122 -0.710229 1. 0. 0.197 1198 3.24233 1.41142 2.47757 4.34293 2.22742 1.34117 2.58823 2.50762 1.23707 1. 0. 0.199 1200 3.24233 1.41142 2.47757 4.34293 2.22742 1.34117 5.70193 1.54062 1.25007 1. 0. 0.201 1202 3.24233 1.41142 2.47757 4.08983 -0.525479 2.10687 5.70193 1.54062 1.25007 1. 0. 0.203 1204 2.06173 -1.39848 1.79787 4.08983 -0.525479 2.10687 3.62993 -1.50808 0.698371 1. 0. 0.205 1206 0.790434 -3.69418 1.29027 1.92773 -2.57738 0.498071 3.62993 -1.50808 0.698371 1. 0. 0.207 1208 0.917634 -3.66448 -0.484829 1.92773 -2.57738 0.498071 5.55043 -0.952879 -0.490929 1. 0. 0.209 1210 -0.573766 -1.42458 -2.91753 1.76663 -0.360379 -2.99373 1.03283 1.01972 -2.14533 1. 0. 0.211 1212 2.19193 -1.51408 -0.867629 0.450934 -2.72908 -2.23353 1.76663 -0.360379 -2.99373 1. 0. 0.213 1214 0.917634 -3.66448 -0.484829 2.19193 -1.51408 -0.867629 5.55043 -0.952879 -0.490929 1. 0. 0.215 1216 1.15633 1.11082 0.326671 1.03283 1.01972 -2.14533 2.58823 2.50762 1.23707 1. 0. 0.217 1218 1.46453 0.112321 2.50927 3.24233 1.41142 2.47757 2.58823 2.50762 1.23707 1. 0. 0.219 1220 1.46453 0.112321 2.50927 3.24233 1.41142 2.47757 4.08983 -0.525479 2.10687 1. 0. 0.221 1222 1.46453 0.112321 2.50927 2.06173 -1.39848 1.79787 4.08983 -0.525479 2.10687 1. 0. 0.223 1224 0.790434 -3.69418 1.29027 2.06173 -1.39848 1.79787 3.62993 -1.50808 0.698371 1. 0. 0.225 1226 0.790434 -3.69418 1.29027 0.917634 -3.66448 -0.484829 1.92773 -2.57738 0.498071 1. 0. 0.227 1228 -0.573766 -1.42458 -2.91753 0.450934 -2.72908 -2.23353 1.76663 -0.360379 -2.99373 1. 0. 0.229 1230 -0.573766 -1.42458 -2.91753 1.03283 1.01972 -2.14533 -3.94777 1.63002 -1.27603 1. 0. 0.231 1232 0.917634 -3.66448 -0.484829 2.19193 -1.51408 -0.867629 0.450934 -2.72908 -2.23353 1. 0. 0.233 1234 1.15633 1.11082 0.326671 1.03283 1.01972 -2.14533 -2.87097 2.29272 -0.0233288 1. 0. 0.235 1236 1.15633 1.11082 0.326671 2.58823 2.50762 1.23707 -2.87097 2.29272 -0.0233288 1. 0. 0.237 1238 1.46453 0.112321 2.50927 2.58823 2.50762 1.23707 -2.87097 2.29272 -0.0233288 1. 0. 0.239 1240 -0.287266 -1.67078 2.48017 1.46453 0.112321 2.50927 2.06173 -1.39848 1.79787 1. 0. 0.241 1242 0.790434 -3.69418 1.29027 -0.287266 -1.67078 2.48017 2.06173 -1.39848 1.79787 1. 0. 0.243 1244 0.790434 -3.69418 1.29027 0.917634 -3.66448 -0.484829 -1.52417 -3.64138 0.503471 1. 0. 0.245 1246 -0.573766 -1.42458 -2.91753 0.450934 -2.72908 -2.23353 -1.62867 -3.74268 -1.79493 1. 0. 0.247 1248 -0.573766 -1.42458 -2.91753 -2.77417 -0.570279 -1.12083 -3.94777 1.63002 -1.27603 1. 0. 0.249 1250 1.03283 1.01972 -2.14533 -2.87097 2.29272 -0.0233288 -3.94777 1.63002 -1.27603 1. 0. 0.251 1252 0.917634 -3.66448 -0.484829 0.450934 -2.72908 -2.23353 -1.62867 -3.74268 -1.79493 1. 0. 0.253 1254 -0.759066 -0.265179 1.48487 1.46453 0.112321 2.50927 -2.87097 2.29272 -0.0233288 1. 0. 0.255 1256 -0.759066 -0.265179 1.48487 -0.287266 -1.67078 2.48017 1.46453 0.112321 2.50927 1. 0. 0.257 1258 0.790434 -3.69418 1.29027 -1.52417 -3.64138 0.503471 -0.287266 -1.67078 2.48017 1. 0. 0.259 1260 0.917634 -3.66448 -0.484829 -1.52417 -3.64138 0.503471 -1.62867 -3.74268 -1.79493 1. 0. 0.261 1262 -0.573766 -1.42458 -2.91753 -1.62867 -3.74268 -1.79493 -2.49667 -2.18078 -1.79993 1. 0. 0.263 1264 -0.573766 -1.42458 -2.91753 -2.49667 -2.18078 -1.79993 -2.77417 -0.570279 -1.12083 1. 0. 0.265 1266 -2.49667 -2.18078 -1.79993 -2.77417 -0.570279 -1.12083 -3.94777 1.63002 -1.27603 1. 0. 0.267 1268 -2.87097 2.29272 -0.0233288 -3.94777 1.63002 -1.27603 -4.04457 4.49292 -0.178529 1. 0. 0.269 1270 -0.759066 -0.265179 1.48487 -3.66127 0.565021 1.57007 -2.87097 2.29272 -0.0233288 1. 0. 0.271 1272 -0.759066 -0.265179 1.48487 -0.287266 -1.67078 2.48017 -3.66127 0.565021 1.57007 1. 0. 0.273 1274 -1.52417 -3.64138 0.503471 -0.287266 -1.67078 2.48017 -2.45927 -1.63678 1.72157 1. 0. 0.275 1276 -1.52417 -3.64138 0.503471 -1.62867 -3.74268 -1.79493 -3.90927 -3.49908 0.839771 1. 0. 0.277 1278 -1.62867 -3.74268 -1.79493 -2.49667 -2.18078 -1.79993 -4.17327 -2.53828 -0.635229 1. 0. 0.279 1280 -2.49667 -2.18078 -1.79993 -4.17327 -2.53828 -0.635229 -3.94777 1.63002 -1.27603 1. 0. 0.281 1282 2.58823 2.50762 1.23707 -2.87097 2.29272 -0.0233288 -4.04457 4.49292 -0.178529 1. 0. 0.283 1284 -3.94777 1.63002 -1.27603 -4.04457 4.49292 -0.178529 -5.12137 3.83022 -1.43123 1. 0. 0.285 1286 -3.66127 0.565021 1.57007 -2.87097 2.29272 -0.0233288 -4.83487 2.76522 1.41487 1. 0. 0.287 1288 -0.287266 -1.67078 2.48017 -2.45927 -1.63678 1.72157 -3.66127 0.565021 1.57007 1. 0. 0.289 1290 -1.52417 -3.64138 0.503471 -2.45927 -1.63678 1.72157 -3.90927 -3.49908 0.839771 1. 0. 0.291 1292 -1.62867 -3.74268 -1.79493 -4.17327 -2.53828 -0.635229 -3.90927 -3.49908 0.839771 1. 0. 0.293 1294 -4.17327 -2.53828 -0.635229 -3.94777 1.63002 -1.27603 -6.42617 1.74722 -0.982629 1. 0. 0.295 1296 -3.94777 1.63002 -1.27603 -5.12137 3.83022 -1.43123 -6.42617 1.74722 -0.982629 1. 0. 0.297 1298 324 -5.12137 3.83022 -1.43123 -7.11497 2.49352 0.479071 -6.42617 1.74722 -0.982629 1. 0. 0. 299 325 1 300 -6.27887 0.926121 0.589671 -7.11497 2.49352 0.479071 -6.42617 1.74722 -0.982629 1. 0. 0.301 1302 -4.17327 -2.53828 -0.635229 -6.27887 0.926121 0.589671 -6.42617 1.74722 -0.982629 1. 0. 0.303 1304 -4.75167 -1.93408 0.935971 -4.17327 -2.53828 -0.635229 -6.27887 0.926121 0.589671 1. 0. 0.305 1306 -4.75167 -1.93408 0.935971 -3.66127 0.565021 1.57007 -6.27887 0.926121 0.589671 1. 0. 0.307 1308 -3.66127 0.565021 1.57007 -4.83487 2.76522 1.41487 -6.27887 0.926121 0.589671 1. 0. 0.309 1310 -4.83487 2.76522 1.41487 -6.27887 0.926121 0.589671 -7.11497 2.49352 0.479071 1. 0. 0.311 1312 -4.83487 2.76522 1.41487 -5.81017 4.57652 0.0304712 -7.11497 2.49352 0.479071 1. 0. 0.313 1314 326 -5.81017 4.57652 0.0304712 -5.12137 3.83022 -1.43123 -7.11497 2.49352 0.479071 1. 0. 0. 315 327 1 316 328 -5.81017 4.57652 0.0304712 -4.04457 4.49292 -0.178529 -5.12137 3.83022 -1.43123 1. 0. 0. 317 1318 -4.83487 2.76522 1.41487 -5.81017 4.57652 0.0304712 -4.04457 4.49292 -0.178529 1. 0. 0.319 1320 -2.87097 2.29272 -0.0233288 -4.83487 2.76522 1.41487 -4.04457 4.49292 -0.178529 1. 0. 0.321 1322 2.58823 2.50762 1.23707 -2.87097 2.29272 -0.0233288 -4.04457 4.49292 -0.178529 1. 0. 0.323 1324 -2.45927 -1.63678 1.72157 -4.75167 -1.93408 0.935971 -3.66127 0.565021 1.57007 1. 0. 0.325 1326 -2.45927 -1.63678 1.72157 -4.75167 -1.93408 0.935971 -3.90927 -3.49908 0.839771 1. 0. 0.327 1328 -4.75167 -1.93408 0.935971 -4.17327 -2.53828 -0.635229 -3.90927 -3.49908 0.839771 1. 0. 0.329 329 9 330 330 # terminating special property … … 333 333 25.0 0.6 -1.0 -1.0 -1.0 0.2 0 0 0 0 334 334 2 335 -4. 27807 -2.65715 0.3801715 1 0 0335 -4.99203 4.29989 -0.526429 5 1 0 0 336 336 9 337 337 terminating special property -
tests/testsuite.at
rebbd3d r1cf5df 12 12 AT_CHECK([pwd],[ignore],[ignore]) 13 13 AT_CHECK([../../molecuilder -v], 0, [stdout], [ignore]) 14 AT_CHECK([fgrep molecuilder stdout], 0, [ignore], [ignore])14 AT_CHECK([fgrep olecuilder stdout], 0, [ignore], [ignore]) 15 15 AT_CHECK([../../molecuilder -h], 0, [stdout], [ignore]) 16 16 AT_CHECK([fgrep "Give this help screen" stdout], 0, [ignore], [ignore]) 17 AT_CHECK([../../molecuilder -e], 0, [ignore], [stderr])17 AT_CHECK([../../molecuilder -e], 255, [ignore], [stderr]) 18 18 AT_CHECK([fgrep "Not enough or invalid arguments" stderr], 0, [ignore], [ignore]) 19 19 AT_CHECK([../../molecuilder test.conf], 0, [stdout], [stderr]) … … 78 78 AT_SETUP([Simple configuration - invalid commands on present configs]) 79 79 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/regression/Simple_configuration/7/pre/test.conf .], 0) 80 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -t -s -b -E -c -b -a -U -T -u], 255, [ignore], [stderr]) 81 AT_CHECK([fgrep -c "Not enough or invalid" stderr], 0, [9 82 ], [ignore]) 80 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -t], 255, [ignore], [stderr]) 81 AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore]) 82 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -s -b -E -c -b -a -U -T -u], 255, [ignore], [stderr]) 83 AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore]) 84 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -b -E -c -b -a -U -T -u], 255, [ignore], [stderr]) 85 AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore]) 86 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -E -c -b -a -U -T -u], 255, [ignore], [stderr]) 87 AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore]) 88 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -c -b -a -U -T -u], 255, [ignore], [stderr]) 89 AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore]) 90 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -b -a -U -T -u], 255, [ignore], [stderr]) 91 AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore]) 92 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -a -U -T -u], 255, [ignore], [stderr]) 93 AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore]) 94 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -U -T -u], 255, [ignore], [stderr]) 95 AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore]) 96 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -T -u], 255, [ignore], [stderr]) 97 AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore]) 98 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -u], 255, [ignore], [stderr]) 99 AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore]) 83 100 AT_CLEANUP 84 101 … … 88 105 AT_SETUP([Graph - DFS analysis]) 89 106 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/regression/Graph/1/pre/test.conf .], 0) 90 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ - D 2.], 0, [stdout], [stderr])107 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -vvv -D 2.], 0, [stdout], [stderr]) 91 108 AT_CHECK([fgrep -c "No rings were detected in the molecular structure." stdout], 0, [1 92 109 ], [ignore]) … … 134 151 AT_CHECK([file=ConvexEnvelope.dat; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/regression/Tesselation/2/post/$file], 0, [ignore], [ignore]) 135 152 AT_CHECK([file=ConvexEnvelope.r3d; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/regression/Tesselation/2/post/$file], 0, [ignore], [ignore]) 136 AT_CHECK([fgrep " RESULT: The summed volume is 16.401577angstrom^3" stdout], 0, [ignore], [ignore])153 AT_CHECK([fgrep "tesselated volume area is 16.4016 angstrom^3" stdout], 0, [ignore], [ignore]) 137 154 AT_CHECK([diff ConvexEnvelope.dat NonConvexEnvelope.dat], 0, [ignore], [ignore]) 138 155 AT_CLEANUP … … 152 169 #AT_CHECK([file=ConvexEnvelope.dat; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/regression/Tesselation/4/post/$file], 0, [ignore], [ignore]) 153 170 #AT_CHECK([file=ConvexEnvelope.r3d; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/regression/Tesselation/4/post/$file], 0, [ignore], [ignore]) 154 #AT_CHECK([fgrep " RESULT: The summed volume is 16.401577angstrom^3" stdout], 0, [ignore], [ignore])171 #AT_CHECK([fgrep "tesselated volume area is 16.4016 angstrom^3" stdout], 0, [ignore], [ignore]) 155 172 #AT_CLEANUP 156 173
Note:
See TracChangeset
for help on using the changeset viewer.