Changes in / [3a0b38:5ae39c]
- Files:
-
- 7 added
- 52 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Makefile.am
r3a0b38 r5ae39c 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) -
src/analysis_correlation.hpp
r3a0b38 r5ae39c 72 72 if (map == NULL) { 73 73 eLog() << Verbose(0) << "Nothing to min/max, map is NULL!" << endl; 74 performCriticalExit(); 74 75 return; 75 76 } … … 107 108 if (map == NULL) { 108 109 eLog() << Verbose(0) << "Nothing to bin, is NULL!" << endl; 110 performCriticalExit(); 109 111 return outmap; 110 112 } -
src/analyzer.cpp
r3a0b38 r5ae39c 94 94 if (!Hcorrection.ParseFragmentMatrix(argv[1], "", HCORRECTIONSUFFIX,0,0)) { 95 95 NoHCorrection = true; 96 Log() << Verbose(0) << "No HCorrection file found, skipping these." << endl;96 eLog() << Verbose(2) << "No HCorrection file found, skipping these." << endl; 97 97 } 98 98 … … 100 100 if (!Hessian.ParseFragmentMatrix(argv[1], dir, HessianSuffix,0,0)) { 101 101 NoHessian = true; 102 Log() << Verbose(0) << "No Hessian file found, skipping these." << endl;102 eLog() << Verbose(2) << "No Hessian file found, skipping these." << endl; 103 103 } 104 104 if (!Time.ParseFragmentMatrix(argv[1], dir, TimeSuffix, 10,1)) { 105 105 NoTime = true; 106 Log() << Verbose(0) << "No speed file found, skipping these." << endl;106 eLog() << Verbose(2) << "No speed file found, skipping these." << endl; 107 107 } 108 108 if (periode != NULL) { // also look for PAS values -
src/atom_bondedparticle.cpp
r3a0b38 r5ae39c 44 44 void BondedParticle::OutputBondOfAtom() const 45 45 { 46 Log() << Verbose(4) << "Atom " << Name << "/" << nr << " with " << ListOfBonds.size() << " bonds: " ;46 Log() << Verbose(4) << "Atom " << Name << "/" << nr << " with " << ListOfBonds.size() << " bonds: " << endl; 47 47 int TotalDegree = 0; 48 48 for (BondList::const_iterator Runner = ListOfBonds.begin(); Runner != ListOfBonds.end(); ++Runner) { 49 Log() << Verbose( 0) << **Runner << "\t";49 Log() << Verbose(4) << **Runner << endl; 50 50 TotalDegree += (*Runner)->BondDegree; 51 51 } 52 Log() << Verbose( 0) << " -- TotalDegree: " << TotalDegree << endl;52 Log() << Verbose(4) << " -- TotalDegree: " << TotalDegree << endl; 53 53 }; 54 54 … … 75 75 status = true; 76 76 } else { 77 Log() << Verbose(1) << "ERROR: "<< *Binder << " does not contain " << *this << "." << endl;77 eLog() << Verbose(1) << *Binder << " does not contain " << *this << "." << endl; 78 78 } 79 79 } else { 80 Log() << Verbose(1) << "ERROR:Binder is " << Binder << "." << endl;80 eLog() << Verbose(1) << "Binder is " << Binder << "." << endl; 81 81 } 82 82 return status; … … 94 94 status = true; 95 95 } else { 96 Log() << Verbose(1) << "ERROR: "<< *Binder << " does not contain " << *this << "." << endl;96 eLog() << Verbose(1) << *Binder << " does not contain " << *this << "." << endl; 97 97 } 98 98 } else { 99 Log() << Verbose(1) << "ERROR:Binder is " << Binder << "." << endl;99 eLog() << Verbose(1) << "Binder is " << Binder << "." << endl; 100 100 } 101 101 return status; … … 121 121 bond *CandidateBond = NULL; 122 122 123 NoBonds = CountBonds(); 123 124 //Log() << Verbose(3) << "Walker " << *this << ": " << (int)this->type->NoValenceOrbitals << " > " << NoBonds << "?" << endl; 124 NoBonds = CountBonds();125 125 if ((int)(type->NoValenceOrbitals) > NoBonds) { // we have a mismatch, check all bonding partners for mismatch 126 126 for (BondList::const_iterator Runner = ListOfBonds.begin(); Runner != ListOfBonds.end(); (++Runner)) { 127 127 OtherWalker = (*Runner)->GetOtherAtom(this); 128 128 OtherNoBonds = OtherWalker->CountBonds(); 129 //Log() << Verbose(3) << "OtherWalker " << *OtherWalker << ": " << (int)OtherWalker->type->NoValenceOrbitals << " > " << NoBonds << "?" << endl;130 if ((int)(OtherWalker->type->NoValenceOrbitals) > NoBonds) { // check if possible candidate129 //Log() << Verbose(3) << "OtherWalker " << *OtherWalker << ": " << (int)OtherWalker->type->NoValenceOrbitals << " > " << OtherNoBonds << "?" << endl; 130 if ((int)(OtherWalker->type->NoValenceOrbitals) > OtherNoBonds) { // check if possible candidate 131 131 if ((CandidateBond == NULL) || (ListOfBonds.size() > OtherWalker->ListOfBonds.size())) { // pick the one with fewer number of bonds first 132 132 CandidateBond = (*Runner); … … 137 137 if ((CandidateBond != NULL)) { 138 138 CandidateBond->BondDegree++; 139 Log() << Verbose(2) << "Increased bond degree for bond " << *CandidateBond << "." << endl;139 //Log() << Verbose(2) << "Increased bond degree for bond " << *CandidateBond << "." << endl; 140 140 } else { 141 //Log() << Verbose(2) << "Could not find correct degree for atom " << *this << "." << endl;141 eLog() << Verbose(2) << "Could not find correct degree for atom " << *this << "." << endl; 142 142 FalseBondDegree++; 143 143 } -
src/atom_graphnode.cpp
r3a0b38 r5ae39c 29 29 Log() << Verbose(2) << "Atom " << Name << " is " << ((SeparationVertex) ? "a" : "not a") << " separation vertex, components are "; 30 30 OutputComponentNumber(); 31 Log() << Verbose( 0) << " with Lowpoint " << LowpointNr << " and Graph Nr. " << GraphNr << "." << endl;31 Log() << Verbose(3) << " with Lowpoint " << LowpointNr << " and Graph Nr. " << GraphNr << "." << endl; 32 32 }; 33 33 … … 40 40 if (ComponentNr != NULL) { 41 41 for (int i=0; ComponentNr[i] != -1; i++) 42 Log() << Verbose( 0) << ComponentNr[i] << " ";42 Log() << Verbose(2) << ComponentNr[i] << " "; 43 43 } 44 44 }; -
src/atom_trajectoryparticle.cpp
r3a0b38 r5ae39c 203 203 U[d] = gsl_ran_gaussian (r, sigma); 204 204 } 205 Log() << Verbose( 0) << sqrt(U[0]*U[0]+U[1]*U[1]+U[2]*U[2]) << endl;205 Log() << Verbose(2) << sqrt(U[0]*U[0]+U[1]*U[1]+U[2]*U[2]) << endl; 206 206 } 207 207 for (int d=0; d<NDIM; d++) -
src/bond.cpp
r3a0b38 r5ae39c 63 63 if(rightatom == Atom) 64 64 return leftatom; 65 eLog() << Verbose( 0) << "Bond " << *this << " does not contain atom " << *Atom << "!" << endl;65 eLog() << Verbose(1) << "Bond " << *this << " does not contain atom " << *Atom << "!" << endl; 66 66 return NULL; 67 67 }; … … 99 99 bool bond::MarkUsed(const enum Shading color) { 100 100 if (Used == black) { 101 eLog() << Verbose( 0) << "ERROR:Bond " << this << " was already marked black!." << endl;101 eLog() << Verbose(1) << "Bond " << this << " was already marked black!." << endl; 102 102 return false; 103 103 } else { -
src/bondgraph.cpp
r3a0b38 r5ae39c 153 153 { 154 154 if (BondLengthMatrix == NULL) {// safety measure if no matrix has been parsed yet 155 eLog() << Verbose( 1) << "WARNING:BondLengthMatrixMinMaxDistance() called without having parsed the bond length matrix yet!" << endl;155 eLog() << Verbose(2) << "BondLengthMatrixMinMaxDistance() called without having parsed the bond length matrix yet!" << endl; 156 156 CovalentMinMaxDistance(Walker, OtherWalker, MinDistance, MaxDistance, IsAngstroem); 157 157 } else { -
src/boundary.cpp
r3a0b38 r5ae39c 10 10 #include "element.hpp" 11 11 #include "helpers.hpp" 12 #include "info.hpp" 12 13 #include "linkedcell.hpp" 13 14 #include "log.hpp" … … 33 34 double *GetDiametersOfCluster(const Boundaries *BoundaryPtr, const molecule *mol, Tesselation *&TesselStruct, const bool IsAngstroem) 34 35 { 36 Info FunctionInfo(__func__); 35 37 // get points on boundary of NULL was given as parameter 36 38 bool BoundaryFreeFlag = false; … … 53 55 } else { 54 56 BoundaryPoints = BoundaryPtr; 55 Log() << Verbose( 1) << "Using given boundary points set." << endl;57 Log() << Verbose(0) << "Using given boundary points set." << endl; 56 58 } 57 59 // determine biggest "diameter" of cluster for each axis … … 67 69 //Log() << Verbose(1) << "Current component is " << component << ", Othercomponent is " << Othercomponent << "." << endl; 68 70 for (Boundaries::const_iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) { 69 //Log() << Verbose( 2) << "Current runner is " << *(runner->second.second) << "." << endl;71 //Log() << Verbose(1) << "Current runner is " << *(runner->second.second) << "." << endl; 70 72 // seek for the neighbours pair where the Othercomponent sign flips 71 73 Neighbour = runner; … … 82 84 DistanceVector.CopyVector(&runner->second.second->x); 83 85 DistanceVector.SubtractVector(&Neighbour->second.second->x); 84 //Log() << Verbose( 3) << "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "." << endl;86 //Log() << Verbose(2) << "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "." << endl; 85 87 } while ((runner != Neighbour) && (fabs(OldComponent / fabs( 86 88 OldComponent) - DistanceVector.x[Othercomponent] / fabs( … … 91 93 OtherNeighbour = BoundaryPoints[axis].end(); 92 94 OtherNeighbour--; 93 //Log() << Verbose( 2) << "The pair, where the sign of OtherComponent flips, is: " << *(Neighbour->second.second) << " and " << *(OtherNeighbour->second.second) << "." << endl;95 //Log() << Verbose(1) << "The pair, where the sign of OtherComponent flips, is: " << *(Neighbour->second.second) << " and " << *(OtherNeighbour->second.second) << "." << endl; 94 96 // now we have found the pair: Neighbour and OtherNeighbour 95 97 OtherVector.CopyVector(&runner->second.second->x); 96 98 OtherVector.SubtractVector(&OtherNeighbour->second.second->x); 97 //Log() << Verbose( 2) << "Distances to Neighbour and OtherNeighbour are " << DistanceVector.x[component] << " and " << OtherVector.x[component] << "." << endl;98 //Log() << Verbose( 2) << "OtherComponents to Neighbour and OtherNeighbour are " << DistanceVector.x[Othercomponent] << " and " << OtherVector.x[Othercomponent] << "." << endl;99 //Log() << Verbose(1) << "Distances to Neighbour and OtherNeighbour are " << DistanceVector.x[component] << " and " << OtherVector.x[component] << "." << endl; 100 //Log() << Verbose(1) << "OtherComponents to Neighbour and OtherNeighbour are " << DistanceVector.x[Othercomponent] << " and " << OtherVector.x[Othercomponent] << "." << endl; 99 101 // do linear interpolation between points (is exact) to extract exact intersection between Neighbour and OtherNeighbour 100 102 w1 = fabs(OtherVector.x[Othercomponent]); … … 103 105 * OtherVector.x[component]) / (w1 + w2)); 104 106 // mark if it has greater diameter 105 //Log() << Verbose( 2) << "Comparing current greatest " << GreatestDiameter[component] << " to new " << tmp << "." << endl;107 //Log() << Verbose(1) << "Comparing current greatest " << GreatestDiameter[component] << " to new " << tmp << "." << endl; 106 108 GreatestDiameter[component] = (GreatestDiameter[component] 107 109 > tmp) ? GreatestDiameter[component] : tmp; 108 110 } //else 109 //Log() << Verbose( 2) << "Saw no sign flip, probably top or bottom node." << endl;111 //Log() << Verbose(1) << "Saw no sign flip, probably top or bottom node." << endl; 110 112 } 111 113 } … … 135 137 Boundaries *GetBoundaryPoints(const molecule *mol, Tesselation *&TesselStruct) 136 138 { 139 Info FunctionInfo(__func__); 137 140 atom *Walker = NULL; 138 141 PointMap PointsOnBoundary; … … 149 152 double angle = 0.; 150 153 151 Log() << Verbose(1) << "Finding all boundary points." << endl;152 154 // 3a. Go through every axis 153 155 for (int axis = 0; axis < NDIM; axis++) { … … 176 178 angle = 0.; // otherwise it's a vector in Axis Direction and unimportant for boundary issues 177 179 178 //Log() << Verbose( 0) << "Checking sign in quadrant : " << ProjectedVector.Projection(&AngleReferenceNormalVector) << "." << endl;180 //Log() << Verbose(1) << "Checking sign in quadrant : " << ProjectedVector.Projection(&AngleReferenceNormalVector) << "." << endl; 179 181 if (ProjectedVector.ScalarProduct(&AngleReferenceNormalVector) > 0) { 180 182 angle = 2. * M_PI - angle; 181 183 } 182 Log() << Verbose( 2) << "Inserting " << *Walker << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl;184 Log() << Verbose(1) << "Inserting " << *Walker << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl; 183 185 BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, DistancePair (radius, Walker))); 184 186 if (!BoundaryTestPair.second) { // same point exists, check first r, then distance of original vectors to center of gravity … … 210 212 // printing all inserted for debugging 211 213 // { 212 // Log() << Verbose( 2) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl;214 // Log() << Verbose(1) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl; 213 215 // int i=0; 214 216 // for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) { … … 249 251 SideA.SubtractVector(MolCenter); 250 252 SideA.ProjectOntoPlane(&AxisVector); 251 // Log() << Verbose(0) << "SideA: "; 252 // SideA.Output(out); 253 // Log() << Verbose(0) << endl; 253 // Log() << Verbose(1) << "SideA: " << SideA << endl; 254 254 255 255 SideB.CopyVector(&right->second.second->x); 256 256 SideB.SubtractVector(MolCenter); 257 257 SideB.ProjectOntoPlane(&AxisVector); 258 // Log() << Verbose(0) << "SideB: "; 259 // SideB.Output(out); 260 // Log() << Verbose(0) << endl; 258 // Log() << Verbose(1) << "SideB: " << SideB << endl; 261 259 262 260 SideC.CopyVector(&left->second.second->x); 263 261 SideC.SubtractVector(&right->second.second->x); 264 262 SideC.ProjectOntoPlane(&AxisVector); 265 // Log() << Verbose(0) << "SideC: "; 266 // SideC.Output(out); 267 // Log() << Verbose(0) << endl; 263 // Log() << Verbose(1) << "SideC: " << SideC << endl; 268 264 269 265 SideH.CopyVector(&runner->second.second->x); 270 266 SideH.SubtractVector(MolCenter); 271 267 SideH.ProjectOntoPlane(&AxisVector); 272 // Log() << Verbose(0) << "SideH: "; 273 // SideH.Output(out); 274 // Log() << Verbose(0) << endl; 268 // Log() << Verbose(1) << "SideH: " << SideH << endl; 275 269 276 270 // calculate each length … … 285 279 const double delta = SideC.Angle(&SideH); 286 280 const double MinDistance = a * sin(beta) / (sin(delta)) * (((alpha < M_PI / 2.) || (gamma < M_PI / 2.)) ? 1. : -1.); 287 //Log() << Verbose( 2) << " I calculated: a = " << a << ", h = " << h << ", beta(" << left->second.second->Name << "," << left->second.second->Name << "-" << right->second.second->Name << ") = " << beta << ", delta(" << left->second.second->Name << "," << runner->second.second->Name << ") = " << delta << ", Min = " << MinDistance << "." << endl;281 //Log() << Verbose(1) << " I calculated: a = " << a << ", h = " << h << ", beta(" << left->second.second->Name << "," << left->second.second->Name << "-" << right->second.second->Name << ") = " << beta << ", delta(" << left->second.second->Name << "," << runner->second.second->Name << ") = " << delta << ", Min = " << MinDistance << "." << endl; 288 282 Log() << Verbose(1) << "Checking CoG distance of runner " << *runner->second.second << " " << h << " against triangle's side length spanned by (" << *left->second.second << "," << *right->second.second << ") of " << MinDistance << "." << endl; 289 283 if ((fabs(h / fabs(h) - MinDistance / fabs(MinDistance)) < MYEPSILON) && ((h - MinDistance)) < -MYEPSILON) { … … 311 305 void FindConvexBorder(const molecule* mol, Tesselation *&TesselStruct, const LinkedCell *LCList, const char *filename) 312 306 { 307 Info FunctionInfo(__func__); 313 308 bool BoundaryFreeFlag = false; 314 309 Boundaries *BoundaryPoints = NULL; 315 316 Log() << Verbose(1) << "Begin of FindConvexBorder" << endl;317 310 318 311 if (TesselStruct != NULL) // free if allocated … … 325 318 BoundaryPoints = GetBoundaryPoints(mol, TesselStruct); 326 319 } else { 327 Log() << Verbose( 1) << "Using given boundary points set." << endl;320 Log() << Verbose(0) << "Using given boundary points set." << endl; 328 321 } 329 322 … … 331 324 for (int axis=0; axis < NDIM; axis++) 332 325 { 333 Log() << Verbose( 2) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl;326 Log() << Verbose(1) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl; 334 327 int i=0; 335 328 for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) { … … 347 340 for (Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) 348 341 if (!TesselStruct->AddBoundaryPoint(runner->second.second, 0)) 349 Log() << Verbose(3) << "WARNING:Point " << *(runner->second.second) << " is already present!" << endl;350 351 Log() << Verbose( 2) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl;342 eLog() << Verbose(2) << "Point " << *(runner->second.second) << " is already present!" << endl; 343 344 Log() << Verbose(0) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl; 352 345 // now we have the whole set of edge points in the BoundaryList 353 346 … … 367 360 // 3c. check whether all atoms lay inside the boundary, if not, add to boundary points, segment triangle into three with the new point 368 361 if (!TesselStruct->InsertStraddlingPoints(mol, LCList)) 369 Log() << Verbose(1) << "Insertion of straddling points failed!" << endl;370 371 Log() << Verbose( 2) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " intermediate triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl;362 eLog() << Verbose(1) << "Insertion of straddling points failed!" << endl; 363 364 Log() << Verbose(0) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " intermediate triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl; 372 365 373 366 // 4. Store triangles in tecplot file … … 406 399 // flip the line 407 400 if (TesselStruct->PickFarthestofTwoBaselines(line) == 0.) 408 Log() << Verbose(1) << "ERROR:Correction of concave baselines failed!" << endl;401 eLog() << Verbose(1) << "Correction of concave baselines failed!" << endl; 409 402 else { 410 403 TesselStruct->FlipBaseline(line); … … 419 412 // Log() << Verbose(1) << "Correction of concave tesselpoints failed!" << endl; 420 413 421 Log() << Verbose( 2) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl;414 Log() << Verbose(0) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl; 422 415 423 416 // 4. Store triangles in tecplot file … … 445 438 if (BoundaryFreeFlag) 446 439 delete[] (BoundaryPoints); 447 448 Log() << Verbose(1) << "End of FindConvexBorder" << endl;449 440 }; 450 441 … … 458 449 bool RemoveAllBoundaryPoints(class Tesselation *&TesselStruct, const molecule * const mol, const char * const filename) 459 450 { 451 Info FunctionInfo(__func__); 460 452 int i=0; 461 453 char number[MAXSTRINGSIZE]; 462 454 463 455 if ((TesselStruct == NULL) || (TesselStruct->PointsOnBoundary.empty())) { 464 Log() << Verbose(2) << "ERROR:TesselStruct is empty." << endl;456 eLog() << Verbose(1) << "TesselStruct is empty." << endl; 465 457 return false; 466 458 } … … 468 460 PointMap::iterator PointRunner; 469 461 while (!TesselStruct->PointsOnBoundary.empty()) { 470 Log() << Verbose( 2) << "Remaining points are: ";462 Log() << Verbose(1) << "Remaining points are: "; 471 463 for (PointMap::iterator PointSprinter = TesselStruct->PointsOnBoundary.begin(); PointSprinter != TesselStruct->PointsOnBoundary.end(); PointSprinter++) 472 464 Log() << Verbose(0) << *(PointSprinter->second) << "\t"; … … 511 503 double ConvexizeNonconvexEnvelope(class Tesselation *&TesselStruct, const molecule * const mol, const char * const filename) 512 504 { 505 Info FunctionInfo(__func__); 513 506 double volume = 0; 514 507 class BoundaryPointSet *point = NULL; … … 524 517 int run = 0; 525 518 526 Log() << Verbose(0) << "Begin of ConvexizeNonconvexEnvelope" << endl;527 528 519 // check whether there is something to work on 529 520 if (TesselStruct == NULL) { 530 Log() << Verbose(1) << "ERROR:TesselStruct is empty!" << endl;521 eLog() << Verbose(1) << "TesselStruct is empty!" << endl; 531 522 return volume; 532 523 } … … 547 538 for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) { 548 539 line = LineRunner->second; 549 Log() << Verbose( 2) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;540 Log() << Verbose(1) << "INFO: Current line of point " << *point << " is " << *line << "." << endl; 550 541 if (!line->CheckConvexityCriterion()) { 551 542 // remove the point if needed … … 612 603 613 604 // end 614 Log() << Verbose(1) << "Volume is " << volume << "." << endl; 615 Log() << Verbose(0) << "End of ConvexizeNonconvexEnvelope" << endl; 605 Log() << Verbose(0) << "Volume is " << volume << "." << endl; 616 606 return volume; 617 607 }; … … 627 617 double VolumeOfConvexEnvelope(class Tesselation *TesselStruct, class config *configuration) 628 618 { 619 Info FunctionInfo(__func__); 629 620 bool IsAngstroem = configuration->GetIsAngstroem(); 630 621 double volume = 0.; … … 633 624 634 625 // 6a. Every triangle forms a pyramid with the center of gravity as its peak, sum up the volumes 635 Log() << Verbose(1)636 << "Calculating the volume of the pyramids formed out of triangles and center of gravity."637 << endl;638 626 for (TriangleMap::iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++) 639 627 { // go through every triangle, calculate volume of its pyramid with CoG as peak … … 650 638 const double h = x.Norm(); // distance of CoG to triangle 651 639 const double PyramidVolume = (1. / 3.) * G * h; // this formula holds for _all_ pyramids (independent of n-edge base or (not) centered peak) 652 Log() << Verbose( 2) << "Area of triangle is " << setprecision(10) << G << " "640 Log() << Verbose(1) << "Area of triangle is " << setprecision(10) << G << " " 653 641 << (IsAngstroem ? "angstrom" : "atomiclength") << "^2, height is " 654 642 << h << " and the volume is " << PyramidVolume << " " … … 672 660 void StoreTrianglesinFile(const molecule * const mol, const Tesselation *&TesselStruct, const char *filename, const char *extraSuffix) 673 661 { 662 Info FunctionInfo(__func__); 674 663 // 4. Store triangles in tecplot file 675 664 if (filename != NULL) { … … 679 668 OutputName.append(TecplotSuffix); 680 669 ofstream *tecplot = new ofstream(OutputName.c_str()); 681 WriteTecplotFile(tecplot, TesselStruct, mol, 0);670 WriteTecplotFile(tecplot, TesselStruct, mol, -1); 682 671 tecplot->close(); 683 672 delete(tecplot); … … 706 695 void PrepareClustersinWater(config *configuration, molecule *mol, double ClusterVolume, double celldensity) 707 696 { 697 Info FunctionInfo(__func__); 708 698 bool IsAngstroem = true; 709 699 double *GreatestDiameter = NULL; … … 756 746 Log() << Verbose(1) << "Minimum volume of the convex envelope contained in a rectangular box is " << minimumvolume << " atomicmassunit/" << (IsAngstroem ? "angstrom" : "atomiclength") << "^3." << endl; 757 747 if (minimumvolume > cellvolume) { 758 eLog() << Verbose( 0) << "ERROR:the containing box already has a greater volume than the envisaged cell volume!" << endl;748 eLog() << Verbose(1) << "the containing box already has a greater volume than the envisaged cell volume!" << endl; 759 749 Log() << Verbose(0) << "Setting Box dimensions to minimum possible, the greatest diameters." << endl; 760 750 for (int i = 0; i < NDIM; i++) … … 806 796 molecule * FillBoxWithMolecule(MoleculeListClass *List, molecule *filler, config &configuration, double distance[NDIM], double RandomAtomDisplacement, double RandomMolDisplacement, bool DoRandomRotation) 807 797 { 798 Info FunctionInfo(__func__); 808 799 molecule *Filling = new molecule(filler->elemente); 809 800 Vector CurrentPosition; … … 823 814 class Tesselation *TesselStruct[List->ListOfMolecules.size()]; 824 815 825 Log() << Verbose(0) << "Begin of FillBoxWithMolecule" << endl;826 827 816 i=0; 828 817 for (MoleculeList::iterator ListRunner = List->ListOfMolecules.begin(); ListRunner != List->ListOfMolecules.end(); ListRunner++) { … … 849 838 for(int i=0;i<NDIM;i++) { 850 839 N[i] = (int) ceil(1./FillerDistance.x[i]); 851 Log() << Verbose( 0) << N[i];840 Log() << Verbose(1) << N[i]; 852 841 if (i != NDIM-1) 853 Log() << Verbose( 0)<< ", ";842 Log() << Verbose(1)<< ", "; 854 843 else 855 Log() << Verbose( 0) << "." << endl;844 Log() << Verbose(1) << "." << endl; 856 845 } 857 846 … … 870 859 // get linked cell list 871 860 if (TesselStruct[i] == NULL) { 872 Log() << Verbose(1) << "ERROR:TesselStruct of " << (*ListRunner) << " is NULL. Didn't we pre-create it?" << endl;861 eLog() << Verbose(1) << "TesselStruct of " << (*ListRunner) << " is NULL. Didn't we pre-create it?" << endl; 873 862 FillIt = false; 874 863 } else { … … 885 874 for (int i=0;i<NDIM;i++) 886 875 FillerTranslations.x[i] = RandomMolDisplacement*(rand()/(RAND_MAX/2.) - 1.); 887 Log() << Verbose( 3) << "INFO: Translating this filler by " << FillerTranslations << "." << endl;876 Log() << Verbose(2) << "INFO: Translating this filler by " << FillerTranslations << "." << endl; 888 877 889 878 // go through all atoms … … 946 935 delete(TesselStruct[i]); 947 936 } 948 Log() << Verbose(0) << "End of FillBoxWithMolecule" << endl;949 950 937 return Filling; 951 938 }; … … 959 946 * \param RADIUS radius of the virtual sphere 960 947 * \param *filename filename prefix for output of vertex data 961 */ 962 void FindNonConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LCList, const double RADIUS, const char *filename = NULL) 948 * \return true - tesselation successful, false - tesselation failed 949 */ 950 bool FindNonConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LCList, const double RADIUS, const char *filename = NULL) 963 951 { 952 Info FunctionInfo(__func__); 964 953 bool freeLC = false; 965 LineMap::iterator baseline; 954 bool status = false; 955 CandidateForTesselation *baseline; 966 956 LineMap::iterator testline; 967 bool OneLoopWithoutSuccessFlag = false; // marks whether we went once through all baselines without finding any without two triangles957 bool OneLoopWithoutSuccessFlag = true; // marks whether we went once through all baselines without finding any without two triangles 968 958 bool TesselationFailFlag = false; 969 970 Log() << Verbose(1) << "Entering search for non convex hull. " << endl; 959 BoundaryTriangleSet *T = NULL; 960 971 961 if (TesselStruct == NULL) { 972 962 Log() << Verbose(1) << "Allocating Tesselation struct ..." << endl; … … 978 968 } 979 969 980 Log() << Verbose(0) << "Begin of FindNonConvexBorder\n";981 982 970 // initialise Linked Cell 983 971 if (LCList == NULL) { … … 990 978 991 979 // 2. expand from there 992 baseline = TesselStruct->LinesOnBoundary.begin(); 993 baseline++; // skip first line 994 while ((baseline != TesselStruct->LinesOnBoundary.end()) || (OneLoopWithoutSuccessFlag)) { 995 if (baseline->second->triangles.size() == 1) { 996 // 3. find next triangle 997 TesselationFailFlag = TesselStruct->FindNextSuitableTriangle(*(baseline->second), *(((baseline->second->triangles.begin()))->second), RADIUS, LCList); //the line is there, so there is a triangle, but only one. 998 OneLoopWithoutSuccessFlag = OneLoopWithoutSuccessFlag || TesselationFailFlag; 999 if (!TesselationFailFlag) 1000 eLog() << Verbose(0) << "WARNING: FindNextSuitableTriangle failed." << endl; 1001 1002 // write temporary envelope 1003 if (filename != NULL) { 1004 if ((DoSingleStepOutput && ((TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration 1005 TesselStruct->Output(filename, mol); 1006 } 980 while ((!TesselStruct->OpenLines.empty()) && (OneLoopWithoutSuccessFlag)) { 981 // 2a. fill all new OpenLines 982 Log() << Verbose(1) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for candidates:" << endl; 983 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) 984 Log() << Verbose(2) << *(Runner->second) << endl; 985 986 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) { 987 baseline = Runner->second; 988 if (baseline->pointlist.empty()) { 989 T = (((baseline->BaseLine->triangles.begin()))->second); 990 Log() << Verbose(1) << "Finding best candidate for open line " << *baseline->BaseLine << " of triangle " << *T << endl; 991 TesselationFailFlag = TesselStruct->FindNextSuitableTriangle(*baseline, *T, RADIUS, LCList); //the line is there, so there is a triangle, but only one. 1007 992 } 1008 baseline = TesselStruct->LinesOnBoundary.end(); 1009 Log() << Verbose(2) << "Baseline set to end." << endl; 1010 } else { 1011 //Log() << Verbose(1) << "Line " << *baseline->second << " has " << baseline->second->triangles.size() << " triangles adjacent" << endl; 1012 if (baseline->second->triangles.size() != 2) 1013 Log() << Verbose(1) << "ERROR: TESSELATION FINISHED WITH INVALID TRIANGLE COUNT!" << endl; 1014 } 1015 1016 if ((baseline == TesselStruct->LinesOnBoundary.end()) && (OneLoopWithoutSuccessFlag)) { 1017 baseline = TesselStruct->LinesOnBoundary.begin(); // restart if we reach end due to newly inserted lines 993 } 994 995 // 2b. search for smallest ShortestAngle among all candidates 996 double ShortestAngle = 4.*M_PI; 997 Log() << Verbose(1) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for the best candidates:" << endl; 998 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) 999 Log() << Verbose(2) << *(Runner->second) << endl; 1000 1001 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) { 1002 if (Runner->second->ShortestAngle < ShortestAngle) { 1003 baseline = Runner->second; 1004 ShortestAngle = baseline->ShortestAngle; 1005 //Log() << Verbose(1) << "New best candidate is " << *baseline->BaseLine << " with point " << *baseline->point << " and angle " << baseline->ShortestAngle << endl; 1006 } 1007 } 1008 if ((ShortestAngle == 4.*M_PI) || (baseline->pointlist.empty())) 1018 1009 OneLoopWithoutSuccessFlag = false; 1019 } 1020 baseline++; 1021 } 1022 // check envelope for consistency 1023 CheckListOfBaselines(TesselStruct); 1024 1025 // look whether all points are inside of the convex envelope, otherwise add them via degenerated triangles 1026 //->InsertStraddlingPoints(mol, LCList); 1010 else { 1011 TesselStruct->AddCandidateTriangle(*baseline); 1012 } 1013 1014 // write temporary envelope 1015 if (filename != NULL) { 1016 if ((DoSingleStepOutput && ((TesselStruct->TrianglesOnBoundary.size() % SingleStepWidth == 0)))) { // if we have a new triangle and want to output each new triangle configuration 1017 TesselStruct->Output(filename, mol); 1018 } 1019 } 1020 } 1021 // // check envelope for consistency 1022 // status = CheckListOfBaselines(TesselStruct); 1023 // 1024 // // look whether all points are inside of the convex envelope, otherwise add them via degenerated triangles 1025 // //->InsertStraddlingPoints(mol, LCList); 1027 1026 // mol->GoToFirst(); 1028 1027 // class TesselPoint *Runner = NULL; … … 1039 1038 // } 1040 1039 1041 // Purges surplus triangles.1042 TesselStruct->RemoveDegeneratedTriangles();1040 // // Purges surplus triangles. 1041 // TesselStruct->RemoveDegeneratedTriangles(); 1043 1042 1044 1043 // check envelope for consistency 1045 CheckListOfBaselines(TesselStruct);1044 status = CheckListOfBaselines(TesselStruct); 1046 1045 1047 1046 // write final envelope … … 1051 1050 if (freeLC) 1052 1051 delete(LCList); 1053 Log() << Verbose(0) << "End of FindNonConvexBorder\n"; 1052 1053 return status; 1054 1054 }; 1055 1055 … … 1063 1063 Vector* FindEmbeddingHole(MoleculeListClass *mols, molecule *srcmol) 1064 1064 { 1065 Info FunctionInfo(__func__); 1065 1066 Vector *Center = new Vector; 1066 1067 Center->Zero(); -
src/boundary.hpp
r3a0b38 r5ae39c 35 35 36 36 #define DEBUG 1 37 #define DoSingleStepOutput 037 #define DoSingleStepOutput 1 38 38 #define SingleStepWidth 1 39 39 … … 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
r3a0b38 r5ae39c 95 95 switch (choice) { 96 96 default: 97 Log() << Verbose(0) << "Not a valid choice." << endl;97 eLog() << Verbose(2) << "Not a valid choice." << endl; 98 98 break; 99 99 case 'a': // absolute coordinates of atom … … 109 109 valid = true; 110 110 do { 111 if (!valid) Log() << Verbose(0) << "Resulting position out of cell." << endl;111 if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl; 112 112 Log() << Verbose(0) << "Enter reference coordinates." << endl; 113 113 x.AskPosition(mol->cell_size, true); … … 125 125 valid = true; 126 126 do { 127 if (!valid) Log() << Verbose(0) << "Resulting position out of cell." << endl;127 if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl; 128 128 second = mol->AskAtom("Enter atom number: "); 129 129 Log() << Verbose(0) << "Enter relative coordinates." << endl; … … 142 142 do { 143 143 if (!valid) { 144 Log() << Verbose(0) << "Resulting coordinates out of cell - "; 145 first->x.Output(); 146 Log() << Verbose(0) << endl; 144 eLog() << Verbose(2) << "Resulting coordinates out of cell - " << first->x << endl; 147 145 } 148 146 Log() << Verbose(0) << "First, we need two atoms, the first atom is the central, while the second is the outer one." << endl; … … 671 669 Log() << Verbose(0) << "===============================================" << endl; 672 670 if (molecules->NumberOfActiveMolecules() > 1) 673 Log() << Verbose(0) << "WARNING:There is more than one molecule active! Atoms will be added to each." << endl;671 eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl; 674 672 Log() << Verbose(0) << "INPUT: "; 675 673 cin >> choice; … … 794 792 Log() << Verbose(0) << "===============================================" << endl; 795 793 if (molecules->NumberOfActiveMolecules() > 1) 796 Log() << Verbose(0) << "WARNING:There is more than one molecule active! Atoms will be added to each." << endl;794 eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl; 797 795 Log() << Verbose(0) << "INPUT: "; 798 796 cin >> choice; … … 827 825 } 828 826 if (count != j) 829 Log() << Verbose(0) << "ERROR:AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl;827 eLog() << Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl; 830 828 x.Zero(); 831 829 y.Zero(); … … 1172 1170 else { 1173 1171 eLog() << Verbose(0) << "I don't have anything to test on ... "; 1172 performCriticalExit(); 1174 1173 return; 1175 1174 } … … 1248 1247 ofstream output; 1249 1248 molecule *mol = new molecule(periode); 1249 mol->SetNameFromFilename(ConfigFileName); 1250 1250 1251 1251 if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) { 1252 eLog() << Verbose( 0) << "WARNING:config is found under different path then stated in config file::defaultpath!" << endl;1252 eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl; 1253 1253 } 1254 1254 … … 1354 1354 1355 1355 if (!strcmp(configuration->configpath, configuration->GetDefaultPath())) { 1356 eLog() << Verbose( 0) << "WARNING:config is found under different path then stated in config file::defaultpath!" << endl;1356 eLog() << Verbose(2) << "config is found under different path then stated in config file::defaultpath!" << endl; 1357 1357 } 1358 1358 … … 1386 1386 int argptr; 1387 1387 molecule *mol = NULL; 1388 string BondGraphFileName(""); 1388 string BondGraphFileName("\n"); 1389 int verbosity = 0; 1389 1390 strncpy(configuration.databasepath, LocalPath, MAXSTRINGSIZE-1); 1390 1391 … … 1432 1433 Log() << Verbose(0) << "\t-T x1 x2 x3\tTranslate periodically all atoms by this vector (x1,x2,x3)." << endl; 1433 1434 Log() << Verbose(0) << "\t-u rho\tsuspend in water solution and output necessary cell lengths, average density rho and repetition." << endl; 1434 Log() << Verbose(0) << "\t-v/-V\t\tGives version information." << endl; 1435 Log() << Verbose(0) << "\t-v\t\tsets verbosity (more is more)." << endl; 1436 Log() << Verbose(0) << "\t-V\t\tGives version information." << endl; 1435 1437 Log() << Verbose(0) << "Note: config files must not begin with '-' !" << endl; 1436 1438 return (1); 1437 1439 break; 1438 1440 case 'v': 1441 while (argv[argptr-1][verbosity+1] == 'v') { 1442 verbosity++; 1443 } 1444 setVerbosity(verbosity); 1445 Log() << Verbose(0) << "Setting verbosity to " << verbosity << "." << endl; 1446 break; 1439 1447 case 'V': 1440 1448 Log() << Verbose(0) << argv[0] << " " << VERSIONSTRING << endl; … … 1445 1453 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1446 1454 eLog() << Verbose(0) << "Not enough or invalid arguments for specifying element db: -e <db file>" << endl; 1455 performCriticalExit(); 1447 1456 } else { 1448 1457 Log() << Verbose(0) << "Using " << argv[argptr] << " as elements database." << endl; … … 1454 1463 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1455 1464 eLog() << Verbose(0) << "Not enough or invalid arguments for specifying bond length table: -g <table file>" << endl; 1465 performCriticalExit(); 1456 1466 } else { 1457 1467 BondGraphFileName = argv[argptr]; … … 1530 1540 mol = new molecule(periode); 1531 1541 mol->ActiveFlag = true; 1542 if (ConfigFileName != NULL) 1543 mol->SetNameFromFilename(ConfigFileName); 1532 1544 molecules->insert(mol); 1545 } 1546 if (configuration.BG == NULL) { 1547 configuration.BG = new BondGraph(configuration.GetIsAngstroem()); 1548 if ((BondGraphFileName.empty()) && (configuration.BG->LoadBondLengthTable(BondGraphFileName))) { 1549 Log() << Verbose(0) << "Bond length table loaded successfully." << endl; 1550 } else { 1551 eLog() << Verbose(1) << "Bond length table loading failed." << endl; 1552 } 1533 1553 } 1534 1554 … … 1546 1566 ExitFlag = 255; 1547 1567 eLog() << Verbose(0) << "Not enough arguments for parsing: -p <xyz file>" << endl; 1568 performCriticalExit(); 1548 1569 } else { 1549 1570 SaveFlag = true; … … 1553 1574 else { 1554 1575 Log() << Verbose(2) << "File found and parsed." << endl; 1576 // @TODO rather do the dissection afterwards 1577 // mol->SetNameFromFilename(argv[argptr]); 1578 // molecules->ListOfMolecules.remove(mol); 1579 // molecules->DissectMoleculeIntoConnectedSubgraphs(mol,&configuration); 1580 // delete(mol); 1581 // if (molecules->ListOfMolecules.size() != 0) { 1582 // for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) 1583 // if ((*ListRunner)->ActiveFlag) { 1584 // mol = *ListRunner; 1585 // break; 1586 // } 1587 // } 1555 1588 configPresent = present; 1556 1589 } … … 1562 1595 ExitFlag = 255; 1563 1596 eLog() << Verbose(0) << "Not enough or invalid arguments for adding atom: -a <element> <x> <y> <z>" << endl; 1597 performCriticalExit(); 1564 1598 } else { 1565 1599 SaveFlag = true; … … 1590 1624 ExitFlag = 255; 1591 1625 eLog() << Verbose(0) << "Not enough or invalid arguments given for setting MPQC basis: -B <basis name>" << endl; 1626 performCriticalExit(); 1592 1627 } else { 1593 1628 configuration.basis = argv[argptr]; … … 1634 1669 ExitFlag = 255; 1635 1670 eLog() << Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C <Z> <output> <bin output>" << endl; 1671 performCriticalExit(); 1636 1672 } else { 1637 1673 SaveFlag = false; … … 1680 1716 ExitFlag = 255; 1681 1717 eLog() << Verbose(0) << "Not enough or invalid arguments given for changing element: -E <atom nr.> <element>" << endl; 1718 performCriticalExit(); 1682 1719 } else { 1683 1720 SaveFlag = true; … … 1693 1730 ExitFlag = 255; 1694 1731 eLog() << Verbose(0) << "Not enough or invalid arguments given for filling box with water: -F <dist_x> <dist_y> <dist_z> <randatom> <randmol> <DoRotate>" << endl; 1732 performCriticalExit(); 1695 1733 } else { 1696 1734 SaveFlag = true; … … 1731 1769 ExitFlag =255; 1732 1770 eLog() << Verbose(0) << "Missing source file for bonds in molecule: -A <bond sourcefile>" << endl; 1771 performCriticalExit(); 1733 1772 } else { 1734 1773 Log() << Verbose(0) << "Parsing bonds from " << argv[argptr] << "." << endl; … … 1744 1783 ExitFlag = 255; 1745 1784 eLog() << Verbose(0) << "Not enough or invalid arguments given for non-convex envelope: -o <radius> <tecplot output file>" << endl; 1785 performCriticalExit(); 1746 1786 } else { 1747 1787 class Tesselation *T = NULL; 1748 1788 const LinkedCell *LCList = NULL; 1749 string filename(argv[argptr+1]); 1750 filename.append(".csv"); 1751 Log() << Verbose(0) << "Evaluating non-convex envelope."; 1789 molecule * Boundary = NULL; 1790 //string filename(argv[argptr+1]); 1791 //filename.append(".csv"); 1792 Log() << Verbose(0) << "Evaluating non-convex envelope of biggest molecule."; 1752 1793 Log() << Verbose(1) << "Using rolling ball of radius " << atof(argv[argptr]) << " and storing tecplot data in " << argv[argptr+1] << "." << endl; 1794 // find biggest molecule 1795 int counter = 0; 1796 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) { 1797 (*BigFinder)->CountAtoms(); 1798 if ((Boundary == NULL) || (Boundary->AtomCount < (*BigFinder)->AtomCount)) { 1799 Boundary = *BigFinder; 1800 } 1801 counter++; 1802 } 1803 Log() << Verbose(1) << "Biggest molecule has " << Boundary->AtomCount << " atoms." << endl; 1753 1804 start = clock(); 1754 LCList = new LinkedCell(mol, atof(argv[argptr])*2.); 1755 FindNonConvexBorder(mol, T, LCList, atof(argv[argptr]), argv[argptr+1]); 1805 LCList = new LinkedCell(Boundary, atof(argv[argptr])*2.); 1806 if (!FindNonConvexBorder(Boundary, T, LCList, atof(argv[argptr]), argv[argptr+1])) 1807 ExitFlag = 255; 1756 1808 //FindDistributionOfEllipsoids(T, &LCList, N, number, filename.c_str()); 1757 1809 end = clock(); 1758 1810 Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl; 1759 1811 delete(LCList); 1812 delete(T); 1760 1813 argptr+=2; 1761 1814 } … … 1766 1819 ExitFlag = 255; 1767 1820 eLog() << Verbose(0) << "Not enough or invalid arguments given for storing tempature: -S <temperature file>" << endl; 1821 performCriticalExit(); 1768 1822 } else { 1769 1823 Log() << Verbose(1) << "Storing temperatures in " << argv[argptr] << "." << endl; … … 1783 1837 ExitFlag = 255; 1784 1838 eLog() << Verbose(0) << "Not enough or invalid arguments given for storing tempature: -L <step0> <step1> <prefix> <identity mapping?>" << endl; 1839 performCriticalExit(); 1785 1840 } else { 1786 1841 SaveFlag = true; … … 1800 1855 ExitFlag = 255; 1801 1856 eLog() << Verbose(0) << "Not enough or invalid arguments given for parsing and integrating forces: -P <forces file>" << endl; 1857 performCriticalExit(); 1802 1858 } else { 1803 1859 SaveFlag = true; … … 1815 1871 ExitFlag = 255; 1816 1872 eLog() << Verbose(0) << "Not enough or invalid arguments given for removing atoms: -R <id> <distance>" << endl; 1873 performCriticalExit(); 1817 1874 } else { 1818 1875 SaveFlag = true; … … 1830 1887 } 1831 1888 } else { 1832 eLog() << Verbose( 0) << "Removal failed due to missing atoms on molecule or wrong id." << endl;1889 eLog() << Verbose(1) << "Removal failed due to missing atoms on molecule or wrong id." << endl; 1833 1890 } 1834 1891 argptr+=2; … … 1840 1897 ExitFlag = 255; 1841 1898 eLog() << Verbose(0) << "Not enough or invalid arguments given for translation: -t <x> <y> <z>" << endl; 1899 performCriticalExit(); 1842 1900 } else { 1843 1901 if (ExitFlag == 0) ExitFlag = 1; … … 1855 1913 ExitFlag = 255; 1856 1914 eLog() << Verbose(0) << "Not enough or invalid arguments given for periodic translation: -T <x> <y> <z>" << endl; 1915 performCriticalExit(); 1857 1916 } else { 1858 1917 if (ExitFlag == 0) ExitFlag = 1; … … 1870 1929 ExitFlag = 255; 1871 1930 eLog() << Verbose(0) << "Not enough or invalid arguments given for scaling: -s <factor_x> [factor_y] [factor_z]" << endl; 1931 performCriticalExit(); 1872 1932 } else { 1873 1933 SaveFlag = true; … … 1893 1953 ExitFlag = 255; 1894 1954 eLog() << Verbose(0) << "Not enough or invalid arguments given for centering in box: -b <xx> <xy> <xz> <yy> <yz> <zz>" << endl; 1955 performCriticalExit(); 1895 1956 } else { 1896 1957 SaveFlag = true; … … 1910 1971 ExitFlag = 255; 1911 1972 eLog() << Verbose(0) << "Not enough or invalid arguments given for bounding in box: -B <xx> <xy> <xz> <yy> <yz> <zz>" << endl; 1973 performCriticalExit(); 1912 1974 } else { 1913 1975 SaveFlag = true; … … 1927 1989 ExitFlag = 255; 1928 1990 eLog() << Verbose(0) << "Not enough or invalid arguments given for centering with boundary: -c <boundary_x> <boundary_y> <boundary_z>" << endl; 1991 performCriticalExit(); 1929 1992 } else { 1930 1993 SaveFlag = true; … … 1960 2023 ExitFlag = 255; 1961 2024 eLog() << Verbose(0) << "Not enough or invalid arguments given for removing atoms: -r <id>" << endl; 2025 performCriticalExit(); 1962 2026 } else { 1963 2027 SaveFlag = true; … … 1973 2037 ExitFlag = 255; 1974 2038 eLog() << Verbose(0) << "Not enough or invalid arguments for fragmentation: -f <max. bond distance> <bond order>" << endl; 2039 performCriticalExit(); 1975 2040 } else { 1976 2041 Log() << Verbose(0) << "Fragmenting molecule with bond distance " << argv[argptr] << " angstroem, order of " << argv[argptr+1] << "." << endl; … … 1991 2056 j = atoi(argv[argptr++]); 1992 2057 if ((j<0) || (j>1)) { 1993 eLog() << Verbose(1) << " ERROR:Argument of '-m' should be either 0 for no-rotate or 1 for rotate." << endl;2058 eLog() << Verbose(1) << "Argument of '-m' should be either 0 for no-rotate or 1 for rotate." << endl; 1994 2059 j = 0; 1995 2060 } … … 2006 2071 ExitFlag = 255; 2007 2072 eLog() << Verbose(0) << "Not enough or invalid arguments given for convex envelope: -o <convex output file> <non-convex output file>" << endl; 2073 performCriticalExit(); 2008 2074 } else { 2009 2075 class Tesselation *TesselStruct = NULL; … … 2030 2096 ExitFlag = 255; 2031 2097 eLog() << Verbose(0) << "Not enough or invalid arguments given for suspension with specified volume: -U <volume> <density>" << endl; 2032 volume = -1; // for case 'u': don't print error again2098 performCriticalExit(); 2033 2099 } else { 2034 2100 volume = atof(argv[argptr++]); … … 2041 2107 ExitFlag = 255; 2042 2108 eLog() << Verbose(0) << "Not enough arguments given for suspension: -u <density>" << endl; 2109 performCriticalExit(); 2043 2110 } else { 2044 2111 double density; … … 2047 2114 density = atof(argv[argptr++]); 2048 2115 if (density < 1.0) { 2049 eLog() << Verbose( 0) << "Density must be greater than 1.0g/cm^3 !" << endl;2116 eLog() << Verbose(1) << "Density must be greater than 1.0g/cm^3 !" << endl; 2050 2117 density = 1.3; 2051 2118 } … … 2053 2120 // repetition[i] = atoi(argv[argptr++]); 2054 2121 // if (repetition[i] < 1) 2055 // eLog() << Verbose( 0) << "ERROR:repetition value must be greater 1!" << endl;2122 // eLog() << Verbose(1) << "repetition value must be greater 1!" << endl; 2056 2123 // repetition[i] = 1; 2057 2124 // } … … 2064 2131 ExitFlag = 255; 2065 2132 eLog() << Verbose(0) << "Not enough or invalid arguments given for repeating cells: -d <repeat_x> <repeat_y> <repeat_z>" << endl; 2133 performCriticalExit(); 2066 2134 } else { 2067 2135 SaveFlag = true; … … 2072 2140 Vector ** vectors; 2073 2141 if (faktor < 1) { 2074 eLog() << Verbose( 0) << "ERROR: Repetition faktor mus be greater than 1!" << endl;2142 eLog() << Verbose(1) << "Repetition factor mus be greater than 1!" << endl; 2075 2143 faktor = 1; 2076 2144 } … … 2089 2157 } 2090 2158 if (count != j) 2091 Log() << Verbose(0) << "ERROR:AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl;2159 eLog() << Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl; 2092 2160 x.Zero(); 2093 2161 y.Zero(); … … 2154 2222 int j; 2155 2223 2156 setVerbosity( 2);2224 setVerbosity(0); 2157 2225 2158 2226 // =========================== PARSE COMMAND LINE OPTIONS ==================================== -
src/config.cpp
r3a0b38 r5ae39c 72 72 file= new ifstream(filename); 73 73 if (file == NULL) { 74 eLog() << Verbose( 0) << "ERROR:config file " << filename << " missing!" << endl;74 eLog() << Verbose(1) << "config file " << filename << " missing!" << endl; 75 75 return; 76 76 } … … 87 87 // allocate buffer's 1st dimension 88 88 if (buffer != NULL) { 89 eLog() << Verbose( 0) << "ERROR:FileBuffer->buffer is not NULL!" << endl;89 eLog() << Verbose(1) << "FileBuffer->buffer is not NULL!" << endl; 90 90 return; 91 91 } else … … 143 143 if (LineMapping == NULL) { 144 144 eLog() << Verbose(0) << "map pointer is NULL: " << LineMapping << endl; 145 performCriticalExit(); 145 146 return; 146 147 } … … 156 157 if (CurrentLine+nr < NoLines) 157 158 LineMapping[CurrentLine+(nr++)] = runner->second; 158 else 159 else { 159 160 eLog() << Verbose(0) << "config::MapIonTypesInBuffer - NoAtoms is wrong: We are past the end of the file!" << endl; 161 performCriticalExit(); 162 } 160 163 } 161 164 } … … 653 656 { 654 657 if (FileBuffer != NULL) { 655 eLog() << Verbose( 1) << "WARNING:deleting present FileBuffer in PrepareFileBuffer()." << endl;658 eLog() << Verbose(2) << "deleting present FileBuffer in PrepareFileBuffer()." << endl; 656 659 delete(FileBuffer); 657 660 } … … 686 689 if (MaxTypes == 0) { 687 690 eLog() << Verbose(0) << "There are no atoms according to MaxTypes in this config file." << endl; 691 performCriticalExit(); 688 692 } else { 689 693 // prescan number of ions per type … … 704 708 if (!ParseForParameter(verbose,FileBuffer, (const char*)name, 1, 1, 1, int_type, &value[0], 1, critical)) { 705 709 eLog() << Verbose(0) << "There are no atoms in the config file!" << endl; 710 performCriticalExit(); 706 711 return; 707 712 } … … 847 852 ifstream *file = new ifstream(filename); 848 853 if (file == NULL) { 849 eLog() << Verbose( 0) << "ERROR:config file " << filename << " missing!" << endl;854 eLog() << Verbose(1) << "config file " << filename << " missing!" << endl; 850 855 return; 851 856 } … … 1051 1056 1052 1057 // 2. parse the bond graph file if given 1053 BG = new BondGraph(IsAngstroem); 1054 if (BG->LoadBondLengthTable(BondGraphFileName)) { 1055 Log() << Verbose(0) << "Bond length table loaded successfully." << endl; 1056 } else { 1057 Log() << Verbose(0) << "Bond length table loading failed." << endl; 1058 if (BG == NULL) { 1059 BG = new BondGraph(IsAngstroem); 1060 if (BG->LoadBondLengthTable(BondGraphFileName)) { 1061 Log() << Verbose(0) << "Bond length table loaded successfully." << endl; 1062 } else { 1063 eLog() << Verbose(1) << "Bond length table loading failed." << endl; 1064 } 1058 1065 } 1059 1066 1060 1067 // 3. parse the molecule in 1061 1068 LoadMolecule(mol, FileBuffer, periode, FastParsing); 1069 mol->SetNameFromFilename(filename); 1062 1070 mol->ActiveFlag = true; 1071 MolList->insert(mol); 1063 1072 1064 1073 // 4. dissect the molecule into connected subgraphs 1065 MolList->DissectMoleculeIntoConnectedSubgraphs(mol,this); 1074 // don't do this here ... 1075 //MolList->DissectMoleculeIntoConnectedSubgraphs(mol,this); 1066 1076 1067 1077 delete(mol); … … 1080 1090 ifstream *file = new ifstream(filename); 1081 1091 if (file == NULL) { 1082 eLog() << Verbose( 0) << "ERROR:config file " << filename << " missing!" << endl;1092 eLog() << Verbose(1) << "config file " << filename << " missing!" << endl; 1083 1093 return; 1084 1094 } -
src/ellipsoid.cpp
r3a0b38 r5ae39c 241 241 x = new Vector[PointsToPick]; 242 242 } else { 243 eLog() << Verbose(2) << " WARNING:Given pointer to vector array seems already allocated." << endl;243 eLog() << Verbose(2) << "Given pointer to vector array seems already allocated." << endl; 244 244 } 245 245 … … 341 341 x = new Vector[PointsToPick]; 342 342 } else { 343 eLog() << Verbose(2) << " WARNING:Given pointer to vector array seems already allocated." << endl;343 eLog() << Verbose(2) << "Given pointer to vector array seems already allocated." << endl; 344 344 } 345 345 -
src/errorlogger.cpp
r3a0b38 r5ae39c 82 82 l.nix->clear(); 83 83 if (v.DoOutput(verbosityLevel)) { 84 v.print(cout);85 84 switch(v.Verbosity) { 86 85 case 0: 87 c out<< "CRITICAL: ";86 cerr << "CRITICAL: "; 88 87 break; 89 88 case 1: 90 c out<< "ERROR: ";89 cerr << "ERROR: "; 91 90 break; 92 91 case 2: 93 c out<< "WARNING: ";92 cerr << "WARNING: "; 94 93 break; 95 94 default: 96 95 break; 97 96 } 97 v.print(cerr); 98 98 return cerr; 99 99 } else … … 105 105 l->nix->clear(); 106 106 if (v.DoOutput(verbosityLevel)) { 107 v.print(cout);108 107 switch(v.Verbosity) { 109 108 case 0: 110 c out<< "CRITICAL: ";109 cerr << "CRITICAL: "; 111 110 break; 112 111 case 1: 113 c out<< "ERROR: ";112 cerr << "ERROR: "; 114 113 break; 115 114 case 2: 116 c out<< "WARNING: ";115 cerr << "WARNING: "; 117 116 break; 118 117 default: 119 118 break; 120 119 } 120 v.print(cerr); 121 121 return cerr; 122 122 } else -
src/helpers.hpp
r3a0b38 r5ae39c 111 111 if (LookupTable == NULL) { 112 112 eLog() << Verbose(0) << "LookupTable memory allocation failed!" << endl; 113 performCriticalExit(); 113 114 status = false; 114 115 } else { -
src/linkedcell.cpp
r3a0b38 r5ae39c 47 47 Log() << Verbose(1) << "Begin of LinkedCell" << endl; 48 48 if (set->IsEmpty()) { 49 eLog() << Verbose( 0) << "ERROR:set contains no linked cell nodes!" << endl;49 eLog() << Verbose(1) << "set contains no linked cell nodes!" << endl; 50 50 return; 51 51 } … … 79 79 Log() << Verbose(2) << "Allocating cells ... "; 80 80 if (LC != NULL) { 81 Log() << Verbose(1) << "ERROR:Linked Cell list is already allocated, I do nothing." << endl;81 eLog() << Verbose(1) << "Linked Cell list is already allocated, I do nothing." << endl; 82 82 return; 83 83 } … … 122 122 Log() << Verbose(1) << "Begin of LinkedCell" << endl; 123 123 if (set->empty()) { 124 eLog() << Verbose( 0) << "ERROR:set contains no linked cell nodes!" << endl;124 eLog() << Verbose(1) << "set contains no linked cell nodes!" << endl; 125 125 return; 126 126 } … … 151 151 Log() << Verbose(2) << "Allocating cells ... "; 152 152 if (LC != NULL) { 153 Log() << Verbose(1) << "ERROR:Linked Cell list is already allocated, I do nothing." << endl;153 eLog() << Verbose(1) << "Linked Cell list is already allocated, I do nothing." << endl; 154 154 return; 155 155 } … … 199 199 status = status && ((n[i] >=0) && (n[i] < N[i])); 200 200 if (!status) 201 eLog() << Verbose( 0) << "ERROR:indices are out of bounds!" << endl;201 eLog() << Verbose(1) << "indices are out of bounds!" << endl; 202 202 return status; 203 203 }; … … 260 260 return status; 261 261 } else { 262 eLog() << Verbose(1) << " ERROR:Node at " << *Walker << " is out of bounds." << endl;262 eLog() << Verbose(1) << "Node at " << *Walker << " is out of bounds." << endl; 263 263 return false; 264 264 } -
src/memoryusageobserver.cpp
r3a0b38 r5ae39c 88 88 89 89 if (current == memoryUsers.end()) { 90 Log() << Verbose(0) << "WARNING:There is non-tracked memory to be freed. Pointer "90 eLog() << Verbose(2) << "There is non-tracked memory to be freed. Pointer " 91 91 << pointer << " is not registered by MemoryUsageObserver: "; 92 92 if (msg != NULL) -
src/molecule.cpp
r3a0b38 r5ae39c 192 192 BondRescale = TopOrigin->type->HBondDistance[TopBond->BondDegree-1]; 193 193 if (BondRescale == -1) { 194 eLog() << Verbose( 3) << "ERROR:There is no typical hydrogen bond distance in replacing bond (" << TopOrigin->Name << "<->" << TopReplacement->Name << ") of degree " << TopBond->BondDegree << "!" << endl;194 eLog() << Verbose(1) << "There is no typical hydrogen bond distance in replacing bond (" << TopOrigin->Name << "<->" << TopReplacement->Name << ") of degree " << TopBond->BondDegree << "!" << endl; 195 195 return false; 196 196 BondRescale = bondlength; … … 235 235 SecondOtherAtom = (*Runner)->GetOtherAtom(TopOrigin); 236 236 } else { 237 Log() << Verbose(3) << "WARNING:Detected more than four bonds for atom " << TopOrigin->Name;237 eLog() << Verbose(2) << "Detected more than four bonds for atom " << TopOrigin->Name; 238 238 } 239 239 } … … 272 272 bondangle = TopOrigin->type->HBondAngle[1]; 273 273 if (bondangle == -1) { 274 Log() << Verbose(3) << "ERROR:There is no typical hydrogen bond angle in replacing bond (" << TopOrigin->Name << "<->" << TopReplacement->Name << ") of degree " << TopBond->BondDegree << "!" << endl;274 eLog() << Verbose(1) << "There is no typical hydrogen bond angle in replacing bond (" << TopOrigin->Name << "<->" << TopReplacement->Name << ") of degree " << TopBond->BondDegree << "!" << endl; 275 275 return false; 276 276 bondangle = 0; … … 394 394 break; 395 395 default: 396 eLog() << Verbose( 0) << "ERROR:BondDegree does not state single, double or triple bond!" << endl;396 eLog() << Verbose(1) << "BondDegree does not state single, double or triple bond!" << endl; 397 397 AllWentWell = false; 398 398 break; … … 445 445 Walker->type = elemente->FindElement(shorthand); 446 446 if (Walker->type == NULL) { 447 eLog() << Verbose( 0) << "Could not parse the element at line: '" << line << "', setting to H.";447 eLog() << Verbose(1) << "Could not parse the element at line: '" << line << "', setting to H."; 448 448 Walker->type = elemente->FindElement(1); 449 449 } … … 541 541 add(Binder, last); 542 542 } else { 543 eLog() << Verbose(1) << " ERROR:Could not add bond between " << atom1->Name << " and " << atom2->Name << " as one or both are not present in the molecule." << endl;543 eLog() << Verbose(1) << "Could not add bond between " << atom1->Name << " and " << atom2->Name << " as one or both are not present in the molecule." << endl; 544 544 } 545 545 return Binder; … … 619 619 AtomCount--; 620 620 } else 621 eLog() << Verbose( 0) << "ERROR:Atom " << pointer->Name << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl;621 eLog() << Verbose(1) << "Atom " << pointer->Name << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl; 622 622 if (ElementsInMolecule[pointer->type->Z] == 0) // was last atom of this element? 623 623 ElementCount--; … … 637 637 ElementsInMolecule[pointer->type->Z]--; // decrease number of atom of this element 638 638 else 639 eLog() << Verbose( 0) << "ERROR:Atom " << pointer->Name << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl;639 eLog() << Verbose(1) << "Atom " << pointer->Name << " is of element " << pointer->type->Z << " but the entry in the table of the molecule is 0!" << endl; 640 640 if (ElementsInMolecule[pointer->type->Z] == 0) // was last atom of this element? 641 641 ElementCount--; -
src/molecule.hpp
r3a0b38 r5ae39c 106 106 107 107 // re-definition of virtual functions from PointCloud 108 const char * const GetName() const; 108 109 Vector *GetCenter() const ; 109 110 TesselPoint *GetPoint() const ; -
src/molecule_dynamics.cpp
r3a0b38 r5ae39c 307 307 if (Params.DoubleList[i] > 1) { 308 308 eLog() << Verbose(0) << "Failed to create an injective PermutationMap!" << endl; 309 exit(1);309 performCriticalExit(); 310 310 } 311 311 Log() << Verbose(1) << "done." << endl; … … 428 428 } 429 429 if (Potential > Params.PenaltyConstants[2]) { 430 eLog() << Verbose( 0) << "ERROR:The two-step permutation procedure did not maintain injectivity!" << endl;430 eLog() << Verbose(1) << "The two-step permutation procedure did not maintain injectivity!" << endl; 431 431 exit(255); 432 432 } 433 433 //Log() << Verbose(0) << endl; 434 434 } else { 435 eLog() << Verbose( 0) << "ERROR: "<< *Runner << " was not the owner of " << *Sprinter << "!" << endl;435 eLog() << Verbose(1) << *Runner << " was not the owner of " << *Sprinter << "!" << endl; 436 436 exit(255); 437 437 } … … 569 569 if (!Force.ParseMatrix(file, 0,0,0)) { 570 570 eLog() << Verbose(0) << "Could not parse Force Matrix file " << file << "." << endl; 571 performCriticalExit(); 571 572 return false; 572 573 } 573 574 if (Force.RowCounter[0] != AtomCount) { 574 575 eLog() << Verbose(0) << "Mismatch between number of atoms in file " << Force.RowCounter[0] << " and in molecule " << AtomCount << "." << endl; 576 performCriticalExit(); 575 577 return false; 576 578 } -
src/molecule_fragmentation.cpp
r3a0b38 r5ae39c 111 111 if (!testGraphInsert.second) { 112 112 eLog() << Verbose(0) << "KeySet file must be corrupt as there are two equal key sets therein!" << endl; 113 performCriticalExit(); 113 114 } 114 115 } … … 211 212 } else { 212 213 eLog() << Verbose(0) << "Unable to open " << line << " for writing keysets!" << endl; 214 performCriticalExit(); 213 215 status = false; 214 216 } … … 368 370 } else { 369 371 eLog() << Verbose(0) << "Atom No. " << (*runner).second.first << " was not found in this molecule." << endl; 372 performCriticalExit(); 370 373 } 371 374 } … … 441 444 // transmorph graph keyset list into indexed KeySetList 442 445 if (GlobalKeySetList == NULL) { 443 Log() << Verbose(1) << "ERROR:Given global key set list (graph) is NULL!" << endl;446 eLog() << Verbose(1) << "Given global key set list (graph) is NULL!" << endl; 444 447 return false; 445 448 } … … 449 452 map<int, pair<double,int> > *AdaptiveCriteriaList = ScanAdaptiveFileIntoMap(path, *IndexKeySetList); // (Root No., (Value, Order)) ! 450 453 if (AdaptiveCriteriaList->empty()) { 451 eLog() << Verbose( 0) << "Unable to parse file, incrementing all." << endl;454 eLog() << Verbose(2) << "Unable to parse file, incrementing all." << endl; 452 455 while (Walker->next != end) { 453 456 Walker = Walker->next; … … 638 641 MolecularWalker->Leaf->FragmentBOSSANOVA(FragmentList[FragmentCounter], RootStack[FragmentCounter], MinimumRingSize); 639 642 } else { 640 eLog() << Verbose( 0) << "Subgraph " << MolecularWalker << " has no atoms!" << endl;643 eLog() << Verbose(1) << "Subgraph " << MolecularWalker << " has no atoms!" << endl; 641 644 } 642 645 FragmentCounter++; // next fragment list … … 898 901 } 899 902 } else { 900 Log() << Verbose(0) << "ERROR:Son " << Runner->Name << " has father " << FatherOfRunner->Name << " but its entry in SonList is " << SonList[FatherOfRunner->nr] << "!" << endl;903 eLog() << Verbose(1) << "Son " << Runner->Name << " has father " << FatherOfRunner->Name << " but its entry in SonList is " << SonList[FatherOfRunner->nr] << "!" << endl; 901 904 } 902 905 if ((LonelyFlag) && (Leaf->AtomCount > 1)) { … … 1133 1136 Log() << Verbose(0) << endl; 1134 1137 //if (!CheckForConnectedSubgraph(FragmentSearch->FragmentSet)) 1135 // Log() << Verbose(0) << "ERROR:The found fragment is not a connected subgraph!" << endl;1138 //eLog() << Verbose(1) << "The found fragment is not a connected subgraph!" << endl; 1136 1139 InsertFragmentIntoGraph(FragmentSearch); 1137 1140 } -
src/molecule_graph.cpp
r3a0b38 r5ae39c 926 926 break; // breaking here will not cause error! 927 927 } 928 if (i == vertex->ListOfBonds.size()) 928 if (i == vertex->ListOfBonds.size()) { 929 929 eLog() << Verbose(0) << "Error: All Component entries are already occupied!" << endl; 930 } else 930 performCriticalExit(); 931 } 932 } else { 931 933 eLog() << Verbose(0) << "Error: Given vertex is NULL!" << endl; 934 performCriticalExit(); 935 } 932 936 } 933 937 ; … … 1114 1118 if (ReferenceStack->IsEmpty()) { 1115 1119 eLog() << Verbose(0) << "ReferenceStack is empty!" << endl; 1120 performCriticalExit(); 1116 1121 return false; 1117 1122 } -
src/molecule_pointcloud.cpp
r3a0b38 r5ae39c 13 13 /************************************* Functions for class molecule *********************************/ 14 14 15 /** Returns a name for this point cloud, here the molecule's name. 16 * \return name of point cloud 17 */ 18 const char * const molecule::GetName() const 19 { 20 return name; 21 }; 15 22 16 23 /** Determine center of all atoms. -
src/moleculelist.cpp
r3a0b38 r5ae39c 311 311 Tesselation *TesselStruct = NULL; 312 312 if ((srcmol == NULL) || (mol == NULL)) { 313 Log() << Verbose(1) << "ERROR:Either fixed or variable molecule is given as NULL." << endl;313 eLog() << Verbose(1) << "Either fixed or variable molecule is given as NULL." << endl; 314 314 return false; 315 315 } … … 319 319 FindNonConvexBorder(mol, TesselStruct, (const LinkedCell *&)LCList, 4., NULL); 320 320 if (TesselStruct == NULL) { 321 Log() << Verbose(1) << "ERROR:Could not tesselate the fixed molecule." << endl;321 eLog() << Verbose(1) << "Could not tesselate the fixed molecule." << endl; 322 322 return false; 323 323 } … … 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?" 405 << endl;404 eLog() << Verbose(0) << endl << "Unable to open " << line << ", is the directory correct?" << endl; 405 performCriticalExit(); 406 406 return false; 407 407 } … … 442 442 if (input == NULL) { 443 443 eLog() << Verbose(0) << endl << "Unable to open " << line << ", is the directory correct?" << endl; 444 performCriticalExit(); 444 445 return false; 445 446 } … … 643 644 if (path != NULL) 644 645 strcpy(PathBackup, path); 645 else 646 else { 646 647 eLog() << Verbose(0) << "OutputConfigForListOfFragments: NULL default path obtained from config!" << endl; 648 performCriticalExit(); 649 } 647 650 648 651 // correct periodic … … 757 760 // 4a. create array of molecules to fill 758 761 const int MolCount = Subgraphs->next->Count(); 762 char number[MAXSTRINGSIZE]; 759 763 molecule **molecules = Malloc<molecule *>(MolCount, "config::Load() - **molecules"); 760 764 for (int i=0;i<MolCount;i++) { 761 765 molecules[i] = (molecule*) new molecule(mol->elemente); 762 766 molecules[i]->ActiveFlag = true; 767 strncpy(molecules[i]->name, mol->name, MAXSTRINGSIZE); 768 if (MolCount > 1) { 769 sprintf(number, "-%d", i+1); 770 strncat(molecules[i]->name, number, MAXSTRINGSIZE - strlen(mol->name) - 1); 771 } 772 cout << "MolName is " << molecules[i]->name << endl; 763 773 insert(molecules[i]); 764 774 } … … 797 807 } 798 808 } 799 // 4d. we don't need to redo bonds, as they are connected subgraphs and still maintain edtheir ListOfBonds, but we have to remove them from first..last list809 // 4d. we don't need to redo bonds, as they are connected subgraphs and still maintain their ListOfBonds, but we have to remove them from first..last list 800 810 bond *Binder = mol->first; 801 811 while (mol->first->next != mol->last) { -
src/parser.cpp
r3a0b38 r5ae39c 159 159 if (input == NULL) { 160 160 eLog() << Verbose(0) << endl << "Unable to open " << name << ", is the directory correct?" << endl; 161 performCriticalExit(); 161 162 return false; 162 163 } … … 179 180 //Log() << Verbose(0) << line.str() << endl; 180 181 //Log() << Verbose(0) << "ColumnCounter[" << MatrixNr << "]: " << ColumnCounter[MatrixNr] << "." << endl; 181 if (ColumnCounter[MatrixNr] == 0) 182 if (ColumnCounter[MatrixNr] == 0) { 182 183 eLog() << Verbose(0) << "ColumnCounter[" << MatrixNr << "]: " << ColumnCounter[MatrixNr] << " from file " << name << ", this is probably an error!" << endl; 184 performCriticalExit(); 185 } 183 186 184 187 // scan rest for number of rows/lines … … 193 196 } 194 197 //Log() << Verbose(0) << "RowCounter[" << MatrixNr << "]: " << RowCounter[MatrixNr] << " from file " << name << "." << endl; 195 if (RowCounter[MatrixNr] == 0) 198 if (RowCounter[MatrixNr] == 0) { 196 199 eLog() << Verbose(0) << "RowCounter[" << MatrixNr << "]: " << RowCounter[MatrixNr] << " from file " << name << ", this is probably an error!" << endl; 200 performCriticalExit(); 201 } 197 202 198 203 // allocate matrix if it's not zero dimension in one direction … … 226 231 } 227 232 } else { 228 eLog() << Verbose( 0) << "ERROR:Matrix nr. " << MatrixNr << " has column and row count of (" << ColumnCounter[MatrixNr] << "," << RowCounter[MatrixNr] << "), could not allocate nor parse!" << endl;233 eLog() << Verbose(1) << "Matrix nr. " << MatrixNr << " has column and row count of (" << ColumnCounter[MatrixNr] << "," << RowCounter[MatrixNr] << "), could not allocate nor parse!" << endl; 229 234 } 230 235 input.close(); … … 428 433 if (m > RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ]) { 429 434 eLog() << Verbose(0) << "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment] << " current force index " << m << " is greater than " << RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl; 435 performCriticalExit(); 430 436 return false; 431 437 } … … 471 477 if (output == NULL) { 472 478 eLog() << Verbose(0) << "Unable to open output energy file " << line.str() << "!" << endl; 479 performCriticalExit(); 473 480 return false; 474 481 } … … 500 507 if (output == NULL) { 501 508 eLog() << Verbose(0) << "Unable to open output matrix file " << line.str() << "!" << endl; 509 performCriticalExit(); 502 510 return false; 503 511 } … … 656 664 if (j > RowCounter[MatrixCounter]) { 657 665 eLog() << Verbose(0) << "Current force index " << j << " is greater than " << RowCounter[MatrixCounter] << "!" << endl; 666 performCriticalExit(); 658 667 return false; 659 668 } … … 793 802 if (j > RowCounter[MatrixCounter]) { 794 803 eLog() << Verbose(0) << "Current hessian index " << j << " is greater than " << RowCounter[MatrixCounter] << ", where i=" << i << ", Order=" << Order << ", l=" << l << " and FragmentNr=" << FragmentNr << "!" << endl; 804 performCriticalExit(); 795 805 return false; 796 806 } … … 800 810 if (k > ColumnCounter[MatrixCounter]) { 801 811 eLog() << Verbose(0) << "Current hessian index " << k << " is greater than " << ColumnCounter[MatrixCounter] << ", where m=" << m << ", j=" << j << ", i=" << i << ", Order=" << Order << ", l=" << l << " and FragmentNr=" << FragmentNr << "!" << endl; 812 performCriticalExit(); 802 813 return false; 803 814 } … … 852 863 if (m > RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ]) { 853 864 eLog() << Verbose(0) << "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment] << " current row index " << m << " is greater than " << RowCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl; 865 performCriticalExit(); 854 866 return false; 855 867 } … … 869 881 if (n > ColumnCounter[ KeySets.OrderSet[Order][CurrentFragment] ]) { 870 882 eLog() << Verbose(0) << "In fragment No. " << KeySets.OrderSet[Order][CurrentFragment] << " current column index " << n << " is greater than " << ColumnCounter[ KeySets.OrderSet[Order][CurrentFragment] ] << "!" << endl; 883 performCriticalExit(); 871 884 return false; 872 885 } -
src/periodentafel.cpp
r3a0b38 r5ae39c 313 313 314 314 if (!otherstatus) 315 eLog() << Verbose( 0) << "WARNING:Something went wrong while parsing the other databases!" << endl;315 eLog() << Verbose(2) << "Something went wrong while parsing the other databases!" << endl; 316 316 317 317 return status; -
src/stackclass.hpp
r3a0b38 r5ae39c 72 72 return true; 73 73 } else { 74 eLog() << Verbose( 0) << "ERROR:Stack is full, " << "Stack: CurrentLastEntry " << CurrentLastEntry<< "\tCurrentFirstEntry " << CurrentFirstEntry << "\tNextFreeField " << NextFreeField << "\tEntryCount " << EntryCount << "!" << endl;74 eLog() << Verbose(1) << "Stack is full, " << "Stack: CurrentLastEntry " << CurrentLastEntry<< "\tCurrentFirstEntry " << CurrentFirstEntry << "\tNextFreeField " << NextFreeField << "\tEntryCount " << EntryCount << "!" << endl; 75 75 return false; 76 76 } … … 87 87 Walker = StackList[CurrentFirstEntry]; 88 88 if (Walker == NULL) 89 eLog() << Verbose( 0) << "ERROR:Stack's field is empty!" << endl;89 eLog() << Verbose(1) << "Stack's field is empty!" << endl; 90 90 StackList[CurrentFirstEntry] = NULL; 91 91 if (CurrentFirstEntry != CurrentLastEntry) { // hasn't last item been popped as well? … … 96 96 } 97 97 } else 98 eLog() << Verbose( 0) << "ERROR:Stack is empty!" << endl;98 eLog() << Verbose(1) << "Stack is empty!" << endl; 99 99 return Walker; 100 100 }; … … 111 111 StackList[CurrentLastEntry] = NULL; 112 112 if (Walker == NULL) 113 eLog() << Verbose( 0) << "ERROR:Stack's field is empty!" << endl;113 eLog() << Verbose(1) << "Stack's field is empty!" << endl; 114 114 NextFreeField = CurrentLastEntry; 115 115 if (CurrentLastEntry != CurrentFirstEntry) // has there been more than one item on stack 116 116 CurrentLastEntry = (CurrentLastEntry + (EntryCount-1)) % EntryCount; // step back from current free field to last (modulo does not work in -1, thus go EntryCount-1 instead) 117 117 } else { 118 eLog() << Verbose( 0) << "ERROR:Stack is empty!" << endl;118 eLog() << Verbose(1) << "Stack is empty!" << endl; 119 119 } 120 120 return Walker; … … 151 151 } while (i!=NextFreeField); 152 152 else 153 eLog() << Verbose( 0) << "ERROR:Stack is already empty!" << endl;153 eLog() << Verbose(1) << "Stack is already empty!" << endl; 154 154 if (found) { 155 155 NextFreeField = CurrentLastEntry; -
src/tesselation.cpp
r3a0b38 r5ae39c 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 eLog() << Verbose( 0) << "WARNING:Memory Leak! I " << *this << " am still connected to some lines." << endl;56 eLog() << Verbose(2) << "Memory Leak! I " << *this << " am still connected to some lines." << endl; 51 57 node = NULL; 52 58 }; … … 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]); … … 153 165 } 154 166 if (!triangles.empty()) 155 eLog() << Verbose( 0) << "WARNING:Memory Leak! I " << *this << " am still connected to some triangles." << endl;167 eLog() << Verbose(2) << "Memory Leak! I " << *this << " am still connected to some triangles." << endl; 156 168 }; 157 169 … … 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 Log() << Verbose(1) << "ERROR: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 //Log() << Verbose(2) << "ERROR: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!" 336 << endl; 337 //exit(1); 338 } 339 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 } 340 350 }; 341 351 … … 346 356 BoundaryTriangleSet::~BoundaryTriangleSet() 347 357 { 358 Info FunctionInfo(__func__); 348 359 for (int i = 0; i < 3; i++) { 349 360 if (lines[i] != NULL) { 350 361 if (lines[i]->triangles.erase(Nr)) { 351 //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; 352 363 } 353 364 if (lines[i]->triangles.empty()) { 354 //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; 355 366 delete (lines[i]); 356 367 lines[i] = NULL; … … 358 369 } 359 370 } 360 //Log() << Verbose( 5) << "Erasing triangle Nr." << Nr << " itself." << endl;371 //Log() << Verbose(0) << "Erasing triangle Nr." << Nr << " itself." << endl; 361 372 }; 362 373 … … 367 378 void BoundaryTriangleSet::GetNormalVector(Vector &OtherVector) 368 379 { 380 Info FunctionInfo(__func__); 369 381 // get normal vector 370 382 NormalVector.MakeNormalVector(endpoints[0]->node->node, endpoints[1]->node->node, endpoints[2]->node->node); … … 373 385 if (NormalVector.ScalarProduct(&OtherVector) > 0.) 374 386 NormalVector.Scale(-1.); 387 Log() << Verbose(1) << "Normal Vector is " << NormalVector << "." << endl; 375 388 }; 376 389 … … 389 402 bool BoundaryTriangleSet::GetIntersectionInsideTriangle(Vector *MolCenter, Vector *x, Vector *Intersection) 390 403 { 404 Info FunctionInfo(__func__); 391 405 Vector CrossPoint; 392 406 Vector helper; 393 407 394 408 if (!Intersection->GetIntersectionWithPlane(&NormalVector, endpoints[0]->node->node, MolCenter, x)) { 395 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; 396 410 return false; 397 411 } … … 409 423 } while (CrossPoint.NormSquared() < MYEPSILON); 410 424 if (i==3) { 411 Log() << Verbose(1) << "ERROR: Could not find any cross points, something's utterly wrong here!" << endl; 412 exit(255); 425 eLog() << Verbose(0) << "Could not find any cross points, something's utterly wrong here!" << endl; 413 426 } 414 427 CrossPoint.SubtractVector(endpoints[i%3]->node->node); // cross point was returned as absolute vector … … 429 442 bool BoundaryTriangleSet::ContainsBoundaryLine(class BoundaryLineSet *line) 430 443 { 444 Info FunctionInfo(__func__); 431 445 for(int i=0;i<3;i++) 432 446 if (line == lines[i]) … … 441 455 bool BoundaryTriangleSet::ContainsBoundaryPoint(class BoundaryPointSet *point) 442 456 { 457 Info FunctionInfo(__func__); 443 458 for(int i=0;i<3;i++) 444 459 if (point == endpoints[i]) … … 453 468 bool BoundaryTriangleSet::ContainsBoundaryPoint(class TesselPoint *point) 454 469 { 470 Info FunctionInfo(__func__); 455 471 for(int i=0;i<3;i++) 456 472 if (point == endpoints[i]->node) … … 465 481 bool BoundaryTriangleSet::IsPresentTupel(class BoundaryPointSet *Points[3]) 466 482 { 483 Info FunctionInfo(__func__); 467 484 return (((endpoints[0] == Points[0]) 468 485 || (endpoints[0] == Points[1]) … … 486 503 bool BoundaryTriangleSet::IsPresentTupel(class BoundaryTriangleSet *T) 487 504 { 505 Info FunctionInfo(__func__); 488 506 return (((endpoints[0] == T->endpoints[0]) 489 507 || (endpoints[0] == T->endpoints[1]) … … 507 525 class BoundaryPointSet *BoundaryTriangleSet::GetThirdEndpoint(class BoundaryLineSet *line) 508 526 { 527 Info FunctionInfo(__func__); 509 528 // sanity check 510 529 if (!ContainsBoundaryLine(line)) … … 523 542 void BoundaryTriangleSet::GetCenter(Vector *center) 524 543 { 544 Info FunctionInfo(__func__); 525 545 center->Zero(); 526 546 for(int i=0;i<3;i++) … … 535 555 ostream &operator <<(ostream &ost, const BoundaryTriangleSet &a) 536 556 { 537 ost << "[" << a.Nr << "|" << a.endpoints[0]->node->Name << " at " << *a.endpoints[0]->node->node << "," 538 << 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 << "]"; 539 560 return ost; 540 561 }; … … 546 567 TesselPoint::TesselPoint() 547 568 { 569 Info FunctionInfo(__func__); 548 570 node = NULL; 549 571 nr = -1; … … 555 577 TesselPoint::~TesselPoint() 556 578 { 579 Info FunctionInfo(__func__); 557 580 }; 558 581 … … 569 592 ostream & TesselPoint::operator << (ostream &ost) 570 593 { 571 ost << "[" << (Name) << "|" << this << "]"; 594 Info FunctionInfo(__func__); 595 ost << "[" << (nr) << "|" << this << "]"; 572 596 return ost; 573 597 }; … … 580 604 PointCloud::PointCloud() 581 605 { 582 606 Info FunctionInfo(__func__); 583 607 }; 584 608 … … 587 611 PointCloud::~PointCloud() 588 612 { 589 613 Info FunctionInfo(__func__); 590 614 }; 591 615 … … 594 618 /** Constructor of class CandidateForTesselation. 595 619 */ 596 CandidateForTesselation::CandidateForTesselation(TesselPoint *candidate, BoundaryLineSet* line, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) { 597 point = candidate; 598 BaseLine = line; 620 CandidateForTesselation::CandidateForTesselation (BoundaryLineSet* line) : 621 BaseLine(line), 622 ShortestAngle(2.*M_PI), 623 OtherShortestAngle(2.*M_PI) 624 { 625 Info FunctionInfo(__func__); 626 }; 627 628 629 /** Constructor of class CandidateForTesselation. 630 */ 631 CandidateForTesselation::CandidateForTesselation (TesselPoint *candidate, BoundaryLineSet* line, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) : 632 BaseLine(line), 633 ShortestAngle(2.*M_PI), 634 OtherShortestAngle(2.*M_PI) 635 { 636 Info FunctionInfo(__func__); 599 637 OptCenter.CopyVector(&OptCandidateCenter); 600 638 OtherOptCenter.CopyVector(&OtherOptCandidateCenter); … … 604 642 */ 605 643 CandidateForTesselation::~CandidateForTesselation() { 606 point = NULL;607 644 BaseLine = NULL; 608 645 }; 609 646 647 /** output operator for CandidateForTesselation. 648 * \param &ost output stream 649 * \param &a boundary line 650 */ 651 ostream & operator <<(ostream &ost, const CandidateForTesselation &a) 652 { 653 ost << "[" << a.BaseLine->Nr << "|" << a.BaseLine->endpoints[0]->node->Name << "," << a.BaseLine->endpoints[1]->node->Name << "] with "; 654 if (a.pointlist.empty()) 655 ost << "no candidate."; 656 else { 657 ost << "candidate"; 658 if (a.pointlist.size() != 1) 659 ost << "s "; 660 else 661 ost << " "; 662 for (TesselPointList::const_iterator Runner = a.pointlist.begin(); Runner != a.pointlist.end(); Runner++) 663 ost << *(*Runner) << " "; 664 ost << " at angle " << (a.ShortestAngle)<< "."; 665 } 666 667 return ost; 668 }; 669 670 610 671 // =========================================================== class TESSELATION =========================================== 611 672 612 673 /** Constructor of class Tesselation. 613 674 */ 614 Tesselation::Tesselation() 615 { 616 PointsOnBoundaryCount = 0; 617 LinesOnBoundaryCount = 0; 618 TrianglesOnBoundaryCount = 0; 619 InternalPointer = PointsOnBoundary.begin(); 620 LastTriangle = NULL; 621 TriangleFilesWritten = 0; 675 Tesselation::Tesselation() : 676 PointsOnBoundaryCount(0), 677 LinesOnBoundaryCount(0), 678 TrianglesOnBoundaryCount(0), 679 LastTriangle(NULL), 680 TriangleFilesWritten(0), 681 InternalPointer(PointsOnBoundary.begin()) 682 { 683 Info FunctionInfo(__func__); 622 684 } 623 685 ; … … 628 690 Tesselation::~Tesselation() 629 691 { 630 Log() << Verbose(1) << "Free'ing TesselStruct ... " << endl; 692 Info FunctionInfo(__func__); 693 Log() << Verbose(0) << "Free'ing TesselStruct ... " << endl; 631 694 for (TriangleMap::iterator runner = TrianglesOnBoundary.begin(); runner != TrianglesOnBoundary.end(); runner++) { 632 695 if (runner->second != NULL) { … … 634 697 runner->second = NULL; 635 698 } else 636 eLog() << Verbose(1) << " ERROR:The triangle " << runner->first << " has already been free'd." << endl;637 } 638 Log() << Verbose( 1) << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl;699 eLog() << Verbose(1) << "The triangle " << runner->first << " has already been free'd." << endl; 700 } 701 Log() << Verbose(0) << "This envelope was written to file " << TriangleFilesWritten << " times(s)." << endl; 639 702 } 640 703 ; … … 645 708 Vector * Tesselation::GetCenter(ofstream *out) const 646 709 { 710 Info FunctionInfo(__func__); 647 711 Vector *Center = new Vector(0.,0.,0.); 648 712 int num=0; … … 660 724 TesselPoint * Tesselation::GetPoint() const 661 725 { 726 Info FunctionInfo(__func__); 662 727 return (InternalPointer->second->node); 663 728 }; … … 668 733 TesselPoint * Tesselation::GetTerminalPoint() const 669 734 { 735 Info FunctionInfo(__func__); 670 736 PointMap::const_iterator Runner = PointsOnBoundary.end(); 671 737 Runner--; … … 678 744 void Tesselation::GoToNext() const 679 745 { 746 Info FunctionInfo(__func__); 680 747 if (InternalPointer != PointsOnBoundary.end()) 681 748 InternalPointer++; … … 687 754 void Tesselation::GoToPrevious() const 688 755 { 756 Info FunctionInfo(__func__); 689 757 if (InternalPointer != PointsOnBoundary.begin()) 690 758 InternalPointer--; … … 696 764 void Tesselation::GoToFirst() const 697 765 { 766 Info FunctionInfo(__func__); 698 767 InternalPointer = PointsOnBoundary.begin(); 699 768 }; … … 704 773 void Tesselation::GoToLast() const 705 774 { 775 Info FunctionInfo(__func__); 706 776 InternalPointer = PointsOnBoundary.end(); 707 777 InternalPointer--; … … 713 783 bool Tesselation::IsEmpty() const 714 784 { 785 Info FunctionInfo(__func__); 715 786 return (PointsOnBoundary.empty()); 716 787 }; … … 721 792 bool Tesselation::IsEnd() const 722 793 { 794 Info FunctionInfo(__func__); 723 795 return (InternalPointer == PointsOnBoundary.end()); 724 796 }; … … 733 805 Tesselation::GuessStartingTriangle() 734 806 { 807 Info FunctionInfo(__func__); 735 808 // 4b. create a starting triangle 736 809 // 4b1. create all distances … … 779 852 baseline->second.first->second->node->node, 780 853 baseline->second.second->second->node->node); 781 Log() << Verbose(2) << "Plane vector of candidate triangle is "; 782 PlaneVector.Output(); 783 Log() << Verbose(0) << endl; 854 Log() << Verbose(2) << "Plane vector of candidate triangle is " << PlaneVector << endl; 784 855 // 4. loop over all points 785 856 double sign = 0.; … … 797 868 if (fabs(distance) < 1e-4) // we need to have a small epsilon around 0 which is still ok 798 869 continue; 799 Log() << Verbose(3) << "Projection of " << checker->second->node->Name 800 << " yields distance of " << distance << "." << endl; 870 Log() << Verbose(2) << "Projection of " << checker->second->node->Name << " yields distance of " << distance << "." << endl; 801 871 tmp = distance / fabs(distance); 802 872 // 4b. Any have different sign to than before? (i.e. would lie outside convex hull with this starting triangle) … … 851 921 if (checker == PointsOnBoundary.end()) 852 922 { 853 Log() << Verbose( 0) << "Looks like we have a candidate!" << endl;923 Log() << Verbose(2) << "Looks like we have a candidate!" << endl; 854 924 break; 855 925 } … … 881 951 else 882 952 { 883 Log() << Verbose(1) << "No starting triangle found." << endl; 884 exit(255); 953 eLog() << Verbose(0) << "No starting triangle found." << endl; 885 954 } 886 955 } … … 902 971 void Tesselation::TesselateOnBoundary(const PointCloud * const cloud) 903 972 { 973 Info FunctionInfo(__func__); 904 974 bool flag; 905 975 PointMap::iterator winner; … … 920 990 // get peak point with respect to this base line's only triangle 921 991 BTS = baseline->second->triangles.begin()->second; // there is only one triangle so far 922 Log() << Verbose( 2) << "Current baseline is between " << *(baseline->second) << "." << endl;992 Log() << Verbose(0) << "Current baseline is between " << *(baseline->second) << "." << endl; 923 993 for (int i = 0; i < 3; i++) 924 994 if ((BTS->endpoints[i] != baseline->second->endpoints[0]) && (BTS->endpoints[i] != baseline->second->endpoints[1])) 925 995 peak = BTS->endpoints[i]; 926 Log() << Verbose( 3) << " and has peak " << *peak << "." << endl;996 Log() << Verbose(1) << " and has peak " << *peak << "." << endl; 927 997 928 998 // prepare some auxiliary vectors … … 939 1009 CenterVector.AddVector(BTS->endpoints[i]->node->node); 940 1010 CenterVector.Scale(1. / 3.); 941 Log() << Verbose( 4) << "CenterVector of base triangle is " << CenterVector << endl;1011 Log() << Verbose(2) << "CenterVector of base triangle is " << CenterVector << endl; 942 1012 943 1013 // normal vector of triangle … … 946 1016 BTS->GetNormalVector(NormalVector); 947 1017 NormalVector.CopyVector(&BTS->NormalVector); 948 Log() << Verbose( 4) << "NormalVector of base triangle is " << NormalVector << endl;1018 Log() << Verbose(2) << "NormalVector of base triangle is " << NormalVector << endl; 949 1019 950 1020 // vector in propagation direction (out of triangle) … … 953 1023 TempVector.CopyVector(&CenterVector); 954 1024 TempVector.SubtractVector(baseline->second->endpoints[0]->node->node); // TempVector is vector on triangle plane pointing from one baseline egde towards center! 955 //Log() << Verbose( 2) << "Projection of propagation onto temp: " << PropagationVector.Projection(&TempVector) << "." << endl;1025 //Log() << Verbose(0) << "Projection of propagation onto temp: " << PropagationVector.Projection(&TempVector) << "." << endl; 956 1026 if (PropagationVector.ScalarProduct(&TempVector) > 0) // make sure normal propagation vector points outward from baseline 957 1027 PropagationVector.Scale(-1.); 958 Log() << Verbose( 4) << "PropagationVector of base triangle is " << PropagationVector << endl;1028 Log() << Verbose(2) << "PropagationVector of base triangle is " << PropagationVector << endl; 959 1029 winner = PointsOnBoundary.end(); 960 1030 … … 962 1032 for (PointMap::iterator target = PointsOnBoundary.begin(); target != PointsOnBoundary.end(); target++) { 963 1033 if ((target->second != baseline->second->endpoints[0]) && (target->second != baseline->second->endpoints[1])) { // don't take the same endpoints 964 Log() << Verbose( 3) << "Target point is " << *(target->second) << ":" << endl;1034 Log() << Verbose(1) << "Target point is " << *(target->second) << ":" << endl; 965 1035 966 1036 // first check direction, so that triangles don't intersect … … 969 1039 VirtualNormalVector.ProjectOntoPlane(&NormalVector); 970 1040 TempAngle = VirtualNormalVector.Angle(&PropagationVector); 971 Log() << Verbose( 4) << "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "." << endl;1041 Log() << Verbose(2) << "VirtualNormalVector is " << VirtualNormalVector << " and PropagationVector is " << PropagationVector << "." << endl; 972 1042 if (TempAngle > (M_PI/2.)) { // no bends bigger than Pi/2 (90 degrees) 973 Log() << Verbose( 4) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", bad direction!" << endl;1043 Log() << Verbose(2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", bad direction!" << endl; 974 1044 continue; 975 1045 } else 976 Log() << Verbose( 4) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", good direction!" << endl;1046 Log() << Verbose(2) << "Angle on triangle plane between propagation direction and base line to " << *(target->second) << " is " << TempAngle << ", good direction!" << endl; 977 1047 978 1048 // check first and second endpoint (if any connecting line goes to target has at least not more than 1 triangle) … … 980 1050 LineChecker[1] = baseline->second->endpoints[1]->lines.find(target->first); 981 1051 if (((LineChecker[0] != baseline->second->endpoints[0]->lines.end()) && (LineChecker[0]->second->triangles.size() == 2))) { 982 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;1052 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; 983 1053 continue; 984 1054 } 985 1055 if (((LineChecker[1] != baseline->second->endpoints[1]->lines.end()) && (LineChecker[1]->second->triangles.size() == 2))) { 986 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;1056 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; 987 1057 continue; 988 1058 } … … 1001 1071 helper.ProjectOntoPlane(&TempVector); 1002 1072 if (fabs(helper.NormSquared()) < MYEPSILON) { 1003 Log() << Verbose( 4) << "Chosen set of vectors is linear dependent." << endl;1073 Log() << Verbose(2) << "Chosen set of vectors is linear dependent." << endl; 1004 1074 continue; 1005 1075 } … … 1018 1088 // calculate angle 1019 1089 TempAngle = NormalVector.Angle(&VirtualNormalVector); 1020 Log() << Verbose( 4) << "NormalVector is " << VirtualNormalVector << " and the angle is " << TempAngle << "." << endl;1090 Log() << Verbose(2) << "NormalVector is " << VirtualNormalVector << " and the angle is " << TempAngle << "." << endl; 1021 1091 if ((SmallestAngle - TempAngle) > MYEPSILON) { // set to new possible winner 1022 1092 SmallestAngle = TempAngle; 1023 1093 winner = target; 1024 Log() << Verbose( 4) << "New winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;1094 Log() << Verbose(2) << "New winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl; 1025 1095 } else if (fabs(SmallestAngle - TempAngle) < MYEPSILON) { // check the angle to propagation, both possible targets are in one plane! (their normals have same angle) 1026 1096 // hence, check the angles to some normal direction from our base line but in this common plane of both targets... … … 1040 1110 SmallestAngle = TempAngle; 1041 1111 winner = target; 1042 Log() << Verbose( 4) << "New winner " << *winner->second->node << " due to smaller angle " << TempAngle << " to propagation direction." << endl;1112 Log() << Verbose(2) << "New winner " << *winner->second->node << " due to smaller angle " << TempAngle << " to propagation direction." << endl; 1043 1113 } else 1044 Log() << Verbose( 4) << "Keeping old winner " << *winner->second->node << " due to smaller angle to propagation direction." << endl;1114 Log() << Verbose(2) << "Keeping old winner " << *winner->second->node << " due to smaller angle to propagation direction." << endl; 1045 1115 } else 1046 Log() << Verbose( 4) << "Keeping old winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl;1116 Log() << Verbose(2) << "Keeping old winner " << *winner->second->node << " due to smaller angle between normal vectors." << endl; 1047 1117 } 1048 1118 } // end of loop over all boundary points … … 1050 1120 // 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 1051 1121 if (winner != PointsOnBoundary.end()) { 1052 Log() << Verbose( 2) << "Winning target point is " << *(winner->second) << " with angle " << SmallestAngle << "." << endl;1122 Log() << Verbose(0) << "Winning target point is " << *(winner->second) << " with angle " << SmallestAngle << "." << endl; 1053 1123 // create the lins of not yet present 1054 1124 BLS[0] = baseline->second; … … 1080 1150 TrianglesOnBoundaryCount++; 1081 1151 } else { 1082 Log() << Verbose(1) << "I could not determine a winner for this baseline " << *(baseline->second) << "." << endl;1152 eLog() << Verbose(2) << "I could not determine a winner for this baseline " << *(baseline->second) << "." << endl; 1083 1153 } 1084 1154 1085 1155 // 5d. If the set of lines is not yet empty, go to 5. and continue 1086 1156 } else 1087 Log() << Verbose( 2) << "Baseline candidate " << *(baseline->second) << " has a triangle count of " << baseline->second->triangles.size() << "." << endl;1157 Log() << Verbose(0) << "Baseline candidate " << *(baseline->second) << " has a triangle count of " << baseline->second->triangles.size() << "." << endl; 1088 1158 } while (flag); 1089 1159 … … 1100 1170 bool Tesselation::InsertStraddlingPoints(const PointCloud *cloud, const LinkedCell *LC) 1101 1171 { 1172 Info FunctionInfo(__func__); 1102 1173 Vector Intersection, Normal; 1103 1174 TesselPoint *Walker = NULL; … … 1106 1177 bool AddFlag = false; 1107 1178 LinkedCell *BoundaryPoints = NULL; 1108 1109 Log() << Verbose(1) << "Begin of InsertStraddlingPoints" << endl;1110 1179 1111 1180 cloud->GoToFirst(); … … 1118 1187 } 1119 1188 Walker = cloud->GetPoint(); 1120 Log() << Verbose( 2) << "Current point is " << *Walker << "." << endl;1189 Log() << Verbose(0) << "Current point is " << *Walker << "." << endl; 1121 1190 // get the next triangle 1122 1191 triangles = FindClosestTrianglesToPoint(Walker->node, BoundaryPoints); 1123 1192 BTS = triangles->front(); 1124 1193 if ((triangles == NULL) || (BTS->ContainsBoundaryPoint(Walker))) { 1125 Log() << Verbose( 2) << "No triangles found, probably a tesselation point itself." << endl;1194 Log() << Verbose(0) << "No triangles found, probably a tesselation point itself." << endl; 1126 1195 cloud->GoToNext(); 1127 1196 continue; 1128 1197 } else { 1129 1198 } 1130 Log() << Verbose( 2) << "Closest triangle is " << *BTS << "." << endl;1199 Log() << Verbose(0) << "Closest triangle is " << *BTS << "." << endl; 1131 1200 // get the intersection point 1132 1201 if (BTS->GetIntersectionInsideTriangle(Center, Walker->node, &Intersection)) { 1133 Log() << Verbose( 2) << "We have an intersection at " << Intersection << "." << endl;1202 Log() << Verbose(0) << "We have an intersection at " << Intersection << "." << endl; 1134 1203 // we have the intersection, check whether in- or outside of boundary 1135 1204 if ((Center->DistanceSquared(Walker->node) - Center->DistanceSquared(&Intersection)) < -MYEPSILON) { 1136 1205 // inside, next! 1137 Log() << Verbose( 2) << *Walker << " is inside wrt triangle " << *BTS << "." << endl;1206 Log() << Verbose(0) << *Walker << " is inside wrt triangle " << *BTS << "." << endl; 1138 1207 } else { 1139 1208 // outside! 1140 Log() << Verbose( 2) << *Walker << " is outside wrt triangle " << *BTS << "." << endl;1209 Log() << Verbose(0) << *Walker << " is outside wrt triangle " << *BTS << "." << endl; 1141 1210 class BoundaryLineSet *OldLines[3], *NewLines[3]; 1142 1211 class BoundaryPointSet *OldPoints[3], *NewPoint; … … 1148 1217 Normal.CopyVector(&BTS->NormalVector); 1149 1218 // add Walker to boundary points 1150 Log() << Verbose( 2) << "Adding " << *Walker << " to BoundaryPoints." << endl;1219 Log() << Verbose(0) << "Adding " << *Walker << " to BoundaryPoints." << endl; 1151 1220 AddFlag = true; 1152 1221 if (AddBoundaryPoint(Walker,0)) … … 1155 1224 continue; 1156 1225 // remove triangle 1157 Log() << Verbose( 2) << "Erasing triangle " << *BTS << "." << endl;1226 Log() << Verbose(0) << "Erasing triangle " << *BTS << "." << endl; 1158 1227 TrianglesOnBoundary.erase(BTS->Nr); 1159 1228 delete(BTS); … … 1163 1232 BPS[1] = OldPoints[i]; 1164 1233 NewLines[i] = new class BoundaryLineSet(BPS, LinesOnBoundaryCount); 1165 Log() << Verbose( 3) << "Creating new line " << *NewLines[i] << "." << endl;1234 Log() << Verbose(1) << "Creating new line " << *NewLines[i] << "." << endl; 1166 1235 LinesOnBoundary.insert(LinePair(LinesOnBoundaryCount, NewLines[i])); // no need for check for unique insertion as BPS[0] is definitely a new one 1167 1236 LinesOnBoundaryCount++; … … 1174 1243 if (NewLines[j]->IsConnectedTo(BLS[0])) { 1175 1244 if (n>2) { 1176 Log() << Verbose(1) << "ERROR: "<< BLS[0] << " connects to all of the new lines?!" << endl;1245 eLog() << Verbose(2) << BLS[0] << " connects to all of the new lines?!" << endl; 1177 1246 return false; 1178 1247 } else … … 1185 1254 BTS->GetNormalVector(Normal); 1186 1255 Normal.Scale(-1.); 1187 Log() << Verbose( 2) << "Created new triangle " << *BTS << "." << endl;1256 Log() << Verbose(0) << "Created new triangle " << *BTS << "." << endl; 1188 1257 TrianglesOnBoundary.insert(TrianglePair(TrianglesOnBoundaryCount, BTS)); 1189 1258 TrianglesOnBoundaryCount++; … … 1191 1260 } 1192 1261 } else { // something is wrong with FindClosestTriangleToPoint! 1193 Log() << Verbose(1) << "ERROR:The closest triangle did not produce an intersection!" << endl;1262 eLog() << Verbose(1) << "The closest triangle did not produce an intersection!" << endl; 1194 1263 return false; 1195 1264 } … … 1199 1268 // exit 1200 1269 delete(Center); 1201 Log() << Verbose(1) << "End of InsertStraddlingPoints" << endl;1202 1270 return true; 1203 1271 }; … … 1210 1278 bool Tesselation::AddBoundaryPoint(TesselPoint * Walker, const int n) 1211 1279 { 1280 Info FunctionInfo(__func__); 1212 1281 PointTestPair InsertUnique; 1213 1282 BPS[n] = new class BoundaryPointSet(Walker); … … 1231 1300 void Tesselation::AddTesselationPoint(TesselPoint* Candidate, const int n) 1232 1301 { 1302 Info FunctionInfo(__func__); 1233 1303 PointTestPair InsertUnique; 1234 1304 TPS[n] = new class BoundaryPointSet(Candidate); … … 1238 1308 } else { 1239 1309 delete TPS[n]; 1240 Log() << Verbose( 4) << "Node " << *((InsertUnique.first)->second->node) << " is already present in PointsOnBoundary." << endl;1310 Log() << Verbose(0) << "Node " << *((InsertUnique.first)->second->node) << " is already present in PointsOnBoundary." << endl; 1241 1311 TPS[n] = (InsertUnique.first)->second; 1242 1312 } 1243 1313 } 1244 1314 ; 1315 1316 /** Sets point to a present Tesselation::PointsOnBoundary. 1317 * Tesselation::TPS is set to the existing one or NULL if not found. 1318 * @param Candidate point to set to 1319 * @param n index for this point in Tesselation::TPS array 1320 */ 1321 void Tesselation::SetTesselationPoint(TesselPoint* Candidate, const int n) const 1322 { 1323 Info FunctionInfo(__func__); 1324 PointMap::const_iterator FindPoint = PointsOnBoundary.find(Candidate->nr); 1325 if (FindPoint != PointsOnBoundary.end()) 1326 TPS[n] = FindPoint->second; 1327 else 1328 TPS[n] = NULL; 1329 }; 1245 1330 1246 1331 /** Function tries to add line from current Points in BPS to BoundaryLineSet. … … 1258 1343 pair<LineMap::iterator,LineMap::iterator> FindPair; 1259 1344 FindPair = a->lines.equal_range(b->node->nr); 1260 Log() << Verbose( 5) << "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "." << endl;1345 Log() << Verbose(1) << "INFO: There is at least one line between " << *a << " and " << *b << ": " << *(FindLine->second) << "." << endl; 1261 1346 1262 1347 for (FindLine = FindPair.first; FindLine != FindPair.second; FindLine++) { … … 1264 1349 if (FindLine->second->triangles.size() < 2) { 1265 1350 insertNewLine = false; 1266 Log() << Verbose( 4) << "Using existing line " << *FindLine->second << endl;1351 Log() << Verbose(0) << "Using existing line " << *FindLine->second << endl; 1267 1352 1268 1353 BPS[0] = FindLine->second->endpoints[0]; 1269 1354 BPS[1] = FindLine->second->endpoints[1]; 1270 1355 BLS[n] = FindLine->second; 1356 1357 // remove existing line from OpenLines 1358 CandidateMap::iterator CandidateLine = OpenLines.find(BLS[n]); 1359 delete(CandidateLine->second); 1360 OpenLines.erase(CandidateLine); 1271 1361 1272 1362 break; … … 1291 1381 void Tesselation::AlwaysAddTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n) 1292 1382 { 1293 Log() << Verbose(4) << "Adding line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl; 1383 Info FunctionInfo(__func__); 1384 Log() << Verbose(0) << "Adding open line [" << LinesOnBoundaryCount << "|" << *(a->node) << " and " << *(b->node) << "." << endl; 1294 1385 BPS[0] = a; 1295 1386 BPS[1] = b; … … 1299 1390 // increase counter 1300 1391 LinesOnBoundaryCount++; 1392 // also add to open lines 1393 CandidateForTesselation *CFT = new CandidateForTesselation(BLS[n]); 1394 OpenLines.insert(pair< BoundaryLineSet *, CandidateForTesselation *> (BLS[n], CFT)); 1301 1395 }; 1302 1396 … … 1306 1400 void Tesselation::AddTesselationTriangle() 1307 1401 { 1402 Info FunctionInfo(__func__); 1308 1403 Log() << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl; 1309 1404 … … 1324 1419 void Tesselation::AddTesselationTriangle(const int nr) 1325 1420 { 1326 Log() << Verbose(1) << "Adding triangle to global TrianglesOnBoundary map." << endl; 1421 Info FunctionInfo(__func__); 1422 Log() << Verbose(0) << "Adding triangle to global TrianglesOnBoundary map." << endl; 1327 1423 1328 1424 // add triangle to global map … … 1342 1438 void Tesselation::RemoveTesselationTriangle(class BoundaryTriangleSet *triangle) 1343 1439 { 1440 Info FunctionInfo(__func__); 1344 1441 if (triangle == NULL) 1345 1442 return; 1346 1443 for (int i = 0; i < 3; i++) { 1347 1444 if (triangle->lines[i] != NULL) { 1348 Log() << Verbose( 5) << "Removing triangle Nr." << triangle->Nr << " in line " << *triangle->lines[i] << "." << endl;1445 Log() << Verbose(0) << "Removing triangle Nr." << triangle->Nr << " in line " << *triangle->lines[i] << "." << endl; 1349 1446 triangle->lines[i]->triangles.erase(triangle->Nr); 1350 1447 if (triangle->lines[i]->triangles.empty()) { 1351 Log() << Verbose( 5) << *triangle->lines[i] << " is no more attached to any triangle, erasing." << endl;1448 Log() << Verbose(0) << *triangle->lines[i] << " is no more attached to any triangle, erasing." << endl; 1352 1449 RemoveTesselationLine(triangle->lines[i]); 1353 1450 } else { 1354 Log() << Verbose( 5) << *triangle->lines[i] << " is still attached to another triangle: ";1451 Log() << Verbose(0) << *triangle->lines[i] << " is still attached to another triangle: "; 1355 1452 for(TriangleMap::iterator TriangleRunner = triangle->lines[i]->triangles.begin(); TriangleRunner != triangle->lines[i]->triangles.end(); TriangleRunner++) 1356 1453 Log() << Verbose(0) << "[" << (TriangleRunner->second)->Nr << "|" << *((TriangleRunner->second)->endpoints[0]) << ", " << *((TriangleRunner->second)->endpoints[1]) << ", " << *((TriangleRunner->second)->endpoints[2]) << "] \t"; 1357 1454 Log() << Verbose(0) << endl; 1358 1455 // for (int j=0;j<2;j++) { 1359 // Log() << Verbose( 5) << "Lines of endpoint " << *(triangle->lines[i]->endpoints[j]) << ": ";1456 // Log() << Verbose(0) << "Lines of endpoint " << *(triangle->lines[i]->endpoints[j]) << ": "; 1360 1457 // for(LineMap::iterator LineRunner = triangle->lines[i]->endpoints[j]->lines.begin(); LineRunner != triangle->lines[i]->endpoints[j]->lines.end(); LineRunner++) 1361 1458 // Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t"; … … 1365 1462 triangle->lines[i] = NULL; // free'd or not: disconnect 1366 1463 } else 1367 eLog() << Verbose( 0) << "ERROR:This line " << i << " has already been free'd." << endl;1464 eLog() << Verbose(1) << "This line " << i << " has already been free'd." << endl; 1368 1465 } 1369 1466 1370 1467 if (TrianglesOnBoundary.erase(triangle->Nr)) 1371 Log() << Verbose( 5) << "Removing triangle Nr. " << triangle->Nr << "." << endl;1468 Log() << Verbose(0) << "Removing triangle Nr. " << triangle->Nr << "." << endl; 1372 1469 delete(triangle); 1373 1470 }; … … 1379 1476 void Tesselation::RemoveTesselationLine(class BoundaryLineSet *line) 1380 1477 { 1478 Info FunctionInfo(__func__); 1381 1479 int Numbers[2]; 1382 1480 … … 1399 1497 for (LineMap::iterator Runner = erasor.first; Runner != erasor.second; Runner++) 1400 1498 if ((*Runner).second == line) { 1401 Log() << Verbose( 5) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;1499 Log() << Verbose(0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl; 1402 1500 line->endpoints[i]->lines.erase(Runner); 1403 1501 break; … … 1405 1503 } else { // there's just a single line left 1406 1504 if (line->endpoints[i]->lines.erase(line->Nr)) 1407 Log() << Verbose( 5) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl;1505 Log() << Verbose(0) << "Removing Line Nr. " << line->Nr << " in boundary point " << *line->endpoints[i] << "." << endl; 1408 1506 } 1409 1507 if (line->endpoints[i]->lines.empty()) { 1410 Log() << Verbose( 5) << *line->endpoints[i] << " has no more lines it's attached to, erasing." << endl;1508 Log() << Verbose(0) << *line->endpoints[i] << " has no more lines it's attached to, erasing." << endl; 1411 1509 RemoveTesselationPoint(line->endpoints[i]); 1412 1510 } else { 1413 Log() << Verbose( 5) << *line->endpoints[i] << " has still lines it's attached to: ";1511 Log() << Verbose(0) << *line->endpoints[i] << " has still lines it's attached to: "; 1414 1512 for(LineMap::iterator LineRunner = line->endpoints[i]->lines.begin(); LineRunner != line->endpoints[i]->lines.end(); LineRunner++) 1415 1513 Log() << Verbose(0) << "[" << *(LineRunner->second) << "] \t"; … … 1418 1516 line->endpoints[i] = NULL; // free'd or not: disconnect 1419 1517 } else 1420 eLog() << Verbose( 0) << "ERROR:Endpoint " << i << " has already been free'd." << endl;1518 eLog() << Verbose(1) << "Endpoint " << i << " has already been free'd." << endl; 1421 1519 } 1422 1520 if (!line->triangles.empty()) 1423 eLog() << Verbose( 0) << "WARNING:Memory Leak! I " << *line << " am still connected to some triangles." << endl;1521 eLog() << Verbose(2) << "Memory Leak! I " << *line << " am still connected to some triangles." << endl; 1424 1522 1425 1523 if (LinesOnBoundary.erase(line->Nr)) 1426 Log() << Verbose( 5) << "Removing line Nr. " << line->Nr << "." << endl;1524 Log() << Verbose(0) << "Removing line Nr. " << line->Nr << "." << endl; 1427 1525 delete(line); 1428 1526 }; … … 1435 1533 void Tesselation::RemoveTesselationPoint(class BoundaryPointSet *point) 1436 1534 { 1535 Info FunctionInfo(__func__); 1437 1536 if (point == NULL) 1438 1537 return; 1439 1538 if (PointsOnBoundary.erase(point->Nr)) 1440 Log() << Verbose( 5) << "Removing point Nr. " << point->Nr << "." << endl;1539 Log() << Verbose(0) << "Removing point Nr. " << point->Nr << "." << endl; 1441 1540 delete(point); 1442 1541 }; … … 1451 1550 * triangles exist which is the maximum for three points 1452 1551 */ 1453 int Tesselation::CheckPresenceOfTriangle(TesselPoint *Candidates[3]) { 1552 int Tesselation::CheckPresenceOfTriangle(TesselPoint *Candidates[3]) const 1553 { 1554 Info FunctionInfo(__func__); 1454 1555 int adjacentTriangleCount = 0; 1455 1556 class BoundaryPointSet *Points[3]; 1456 1557 1457 Log() << Verbose(2) << "Begin of CheckPresenceOfTriangle" << endl;1458 1558 // builds a triangle point set (Points) of the end points 1459 1559 for (int i = 0; i < 3; i++) { 1460 PointMap:: iterator FindPoint = PointsOnBoundary.find(Candidates[i]->nr);1560 PointMap::const_iterator FindPoint = PointsOnBoundary.find(Candidates[i]->nr); 1461 1561 if (FindPoint != PointsOnBoundary.end()) { 1462 1562 Points[i] = FindPoint->second; … … 1471 1571 for (int j = i; j < 3; j++) { 1472 1572 if (Points[j] != NULL) { 1473 LineMap:: iterator FindLine = Points[i]->lines.find(Points[j]->node->nr);1573 LineMap::const_iterator FindLine = Points[i]->lines.find(Points[j]->node->nr); 1474 1574 for (; (FindLine != Points[i]->lines.end()) && (FindLine->first == Points[j]->node->nr); FindLine++) { 1475 1575 TriangleMap *triangles = &FindLine->second->triangles; 1476 Log() << Verbose( 3) << "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "." << endl;1477 for (TriangleMap:: iterator FindTriangle = triangles->begin(); FindTriangle != triangles->end(); FindTriangle++) {1576 Log() << Verbose(1) << "Current line is " << FindLine->first << ": " << *(FindLine->second) << " with triangles " << triangles << "." << endl; 1577 for (TriangleMap::const_iterator FindTriangle = triangles->begin(); FindTriangle != triangles->end(); FindTriangle++) { 1478 1578 if (FindTriangle->second->IsPresentTupel(Points)) { 1479 1579 adjacentTriangleCount++; 1480 1580 } 1481 1581 } 1482 Log() << Verbose( 3) << "end." << endl;1582 Log() << Verbose(1) << "end." << endl; 1483 1583 } 1484 1584 // Only one of the triangle lines must be considered for the triangle count. 1485 //Log() << Verbose( 2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;1585 //Log() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl; 1486 1586 //return adjacentTriangleCount; 1487 1587 } … … 1490 1590 } 1491 1591 1492 Log() << Verbose(2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl; 1493 Log() << Verbose(2) << "End of CheckPresenceOfTriangle" << endl; 1592 Log() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl; 1494 1593 return adjacentTriangleCount; 1495 1594 }; … … 1505 1604 class BoundaryTriangleSet * Tesselation::GetPresentTriangle(TesselPoint *Candidates[3]) 1506 1605 { 1606 Info FunctionInfo(__func__); 1507 1607 class BoundaryTriangleSet *triangle = NULL; 1508 1608 class BoundaryPointSet *Points[3]; … … 1534 1634 } 1535 1635 // Only one of the triangle lines must be considered for the triangle count. 1536 //Log() << Verbose( 2) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl;1636 //Log() << Verbose(0) << "Found " << adjacentTriangleCount << " adjacent triangles for the point set." << endl; 1537 1637 //return adjacentTriangleCount; 1538 1638 } … … 1555 1655 void Tesselation::FindStartingTriangle(const double RADIUS, const LinkedCell *LC) 1556 1656 { 1557 Log() << Verbose(1) << "Begin of FindStartingTriangle\n";1657 Info FunctionInfo(__func__); 1558 1658 int i = 0; 1559 TesselPoint* FirstPoint = NULL;1560 TesselPoint* SecondPoint = NULL;1561 1659 TesselPoint* MaxPoint[NDIM]; 1660 TesselPoint* Temporary; 1562 1661 double maxCoordinate[NDIM]; 1662 BoundaryLineSet BaseLine; 1563 1663 Vector Oben; 1564 1664 Vector helper; … … 1579 1679 for (LC->n[(i+2)%NDIM]=0;LC->n[(i+2)%NDIM]<LC->N[(i+2)%NDIM];LC->n[(i+2)%NDIM]++) { 1580 1680 const LinkedNodes *List = LC->GetCurrentCell(); 1581 //Log() << Verbose( 2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;1681 //Log() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl; 1582 1682 if (List != NULL) { 1583 1683 for (LinkedNodes::const_iterator Runner = List->begin();Runner != List->end();Runner++) { 1584 1684 if ((*Runner)->node->x[i] > maxCoordinate[i]) { 1585 Log() << Verbose( 2) << "New maximal for axis " << i << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl;1685 Log() << Verbose(1) << "New maximal for axis " << i << " node is " << *(*Runner) << " at " << *(*Runner)->node << "." << endl; 1586 1686 maxCoordinate[i] = (*Runner)->node->x[i]; 1587 1687 MaxPoint[i] = (*Runner); … … 1589 1689 } 1590 1690 } else { 1591 eLog() << Verbose( 0) << "ERROR:The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!" << endl;1691 eLog() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << " is invalid!" << endl; 1592 1692 } 1593 1693 } 1594 1694 } 1595 1695 1596 Log() << Verbose( 2) << "Found maximum coordinates: ";1696 Log() << Verbose(1) << "Found maximum coordinates: "; 1597 1697 for (int i=0;i<NDIM;i++) 1598 1698 Log() << Verbose(0) << i << ": " << *MaxPoint[i] << "\t"; … … 1600 1700 1601 1701 BTS = NULL; 1602 CandidateList *OptCandidates = new CandidateList();1603 1702 for (int k=0;k<NDIM;k++) { 1604 1703 Oben.Zero(); 1605 1704 Oben.x[k] = 1.; 1606 FirstPoint = MaxPoint[k];1607 Log() << Verbose( 1) << "Coordinates of start node at " << *FirstPoint->node << "." << endl;1705 BaseLine.endpoints[0] = new BoundaryPointSet(MaxPoint[k]); 1706 Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine.endpoints[0]->node << "." << endl; 1608 1707 1609 1708 double ShortestAngle; 1610 TesselPoint* OptCandidate = NULL;1611 1709 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. 1612 1710 1613 FindSecondPointForTesselation(FirstPoint, Oben, OptCandidate, &ShortestAngle, RADIUS, LC); // we give same point as next candidate as its bonds are looked into in find_second_... 1614 SecondPoint = OptCandidate; 1615 if (SecondPoint == NULL) // have we found a second point? 1711 FindSecondPointForTesselation(BaseLine.endpoints[0]->node, Oben, Temporary, &ShortestAngle, RADIUS, LC); // we give same point as next candidate as its bonds are looked into in find_second_... 1712 if (Temporary == NULL) // have we found a second point? 1616 1713 continue; 1617 1618 helper.CopyVector(FirstPoint->node); 1619 helper.SubtractVector(SecondPoint->node); 1714 BaseLine.endpoints[1] = new BoundaryPointSet(Temporary); 1715 1716 helper.CopyVector(BaseLine.endpoints[0]->node->node); 1717 helper.SubtractVector(BaseLine.endpoints[1]->node->node); 1620 1718 helper.Normalize(); 1621 1719 Oben.ProjectOntoPlane(&helper); … … 1624 1722 ShortestAngle = 2.*M_PI; // This will indicate the quadrant. 1625 1723 1626 Chord.CopyVector( FirstPoint->node); // bring into calling function1627 Chord.SubtractVector( SecondPoint->node);1724 Chord.CopyVector(BaseLine.endpoints[0]->node->node); // bring into calling function 1725 Chord.SubtractVector(BaseLine.endpoints[1]->node->node); 1628 1726 double radius = Chord.ScalarProduct(&Chord); 1629 1727 double CircleRadius = sqrt(RADIUS*RADIUS - radius/4.); … … 1636 1734 1637 1735 // adding point 1 and point 2 and add the line between them 1638 Log() << Verbose(1) << "Coordinates of start node at " << *FirstPoint->node << "." << endl; 1639 AddTesselationPoint(FirstPoint, 0); 1640 Log() << Verbose(1) << "Found second point is at " << *SecondPoint->node << ".\n"; 1641 AddTesselationPoint(SecondPoint, 1); 1642 AddTesselationLine(TPS[0], TPS[1], 0); 1643 1644 //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << helper << ".\n"; 1645 FindThirdPointForTesselation(Oben, SearchDirection, helper, BLS[0], NULL, *&OptCandidates, &ShortestAngle, RADIUS, LC); 1646 Log() << Verbose(1) << "List of third Points is "; 1647 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1648 Log() << Verbose(0) << " " << *(*it)->point; 1649 } 1650 Log() << Verbose(0) << endl; 1651 1652 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1653 // add third triangle point 1654 AddTesselationPoint((*it)->point, 2); 1655 // add the second and third line 1656 AddTesselationLine(TPS[1], TPS[2], 1); 1657 AddTesselationLine(TPS[0], TPS[2], 2); 1658 // ... and triangles to the Maps of the Tesselation class 1659 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 1660 AddTesselationTriangle(); 1661 // ... and calculate its normal vector (with correct orientation) 1662 (*it)->OptCenter.Scale(-1.); 1663 Log() << Verbose(2) << "Anti-Oben is currently " << (*it)->OptCenter << "." << endl; 1664 BTS->GetNormalVector((*it)->OptCenter); // vector to compare with should point inwards 1665 Log() << Verbose(0) << "==> Found starting triangle consists of " << *FirstPoint << ", " << *SecondPoint << " and " 1666 << *(*it)->point << " with normal vector " << BTS->NormalVector << ".\n"; 1667 1668 // if we do not reach the end with the next step of iteration, we need to setup a new first line 1669 if (it != OptCandidates->end()--) { 1670 FirstPoint = (*it)->BaseLine->endpoints[0]->node; 1671 SecondPoint = (*it)->point; 1672 // adding point 1 and point 2 and the line between them 1673 AddTesselationPoint(FirstPoint, 0); 1674 AddTesselationPoint(SecondPoint, 1); 1675 AddTesselationLine(TPS[0], TPS[1], 0); 1676 } 1677 Log() << Verbose(2) << "Projection is " << BTS->NormalVector.ScalarProduct(&Oben) << "." << endl; 1678 } 1736 Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine.endpoints[0]->node << "." << endl; 1737 Log() << Verbose(0) << "Found second point is at " << *BaseLine.endpoints[1]->node << ".\n"; 1738 1739 //Log() << Verbose(1) << "INFO: OldSphereCenter is at " << helper << ".\n"; 1740 CandidateForTesselation OptCandidates(&BaseLine); 1741 FindThirdPointForTesselation(Oben, SearchDirection, helper, OptCandidates, NULL, RADIUS, LC); 1742 Log() << Verbose(0) << "List of third Points is:" << endl; 1743 for (TesselPointList::iterator it = OptCandidates.pointlist.begin(); it != OptCandidates.pointlist.end(); it++) { 1744 Log() << Verbose(0) << " " << *(*it) << endl; 1745 } 1746 1747 BTS = NULL; 1748 AddCandidateTriangle(OptCandidates); 1749 // delete(BaseLine.endpoints[0]); 1750 // delete(BaseLine.endpoints[1]); 1751 1679 1752 if (BTS != NULL) // we have created one starting triangle 1680 1753 break; 1681 1754 else { 1682 1755 // remove all candidates from the list and then the list itself 1683 class CandidateForTesselation *remover = NULL; 1684 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1685 remover = *it; 1686 delete(remover); 1687 } 1688 OptCandidates->clear(); 1689 } 1690 } 1691 1692 // remove all candidates from the list and then the list itself 1693 class CandidateForTesselation *remover = NULL; 1694 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1695 remover = *it; 1696 delete(remover); 1697 } 1698 delete(OptCandidates); 1699 Log() << Verbose(1) << "End of FindStartingTriangle\n"; 1700 }; 1701 1756 OptCandidates.pointlist.clear(); 1757 } 1758 } 1759 }; 1760 1761 /** Checks for a given baseline and a third point candidate whether baselines of the found triangle don't have even better candidates. 1762 * This is supposed to prevent early closing of the tesselation. 1763 * \param CandidateLine CandidateForTesselation with baseline and shortestangle , i.e. not \a *OptCandidate 1764 * \param *ThirdNode third point in triangle, not in BoundaryLineSet::endpoints 1765 * \param RADIUS radius of sphere 1766 * \param *LC LinkedCell structure 1767 * \return true - there is a better candidate (smaller angle than \a ShortestAngle), false - no better TesselPoint candidate found 1768 */ 1769 //bool Tesselation::HasOtherBaselineBetterCandidate(CandidateForTesselation &CandidateLine, const TesselPoint * const ThirdNode, double RADIUS, const LinkedCell * const LC) const 1770 //{ 1771 // Info FunctionInfo(__func__); 1772 // bool result = false; 1773 // Vector CircleCenter; 1774 // Vector CirclePlaneNormal; 1775 // Vector OldSphereCenter; 1776 // Vector SearchDirection; 1777 // Vector helper; 1778 // TesselPoint *OtherOptCandidate = NULL; 1779 // double OtherShortestAngle = 2.*M_PI; // This will indicate the quadrant. 1780 // double radius, CircleRadius; 1781 // BoundaryLineSet *Line = NULL; 1782 // BoundaryTriangleSet *T = NULL; 1783 // 1784 // // check both other lines 1785 // PointMap::const_iterator FindPoint = PointsOnBoundary.find(ThirdNode->nr); 1786 // if (FindPoint != PointsOnBoundary.end()) { 1787 // for (int i=0;i<2;i++) { 1788 // LineMap::const_iterator FindLine = (FindPoint->second)->lines.find(BaseRay->endpoints[0]->node->nr); 1789 // if (FindLine != (FindPoint->second)->lines.end()) { 1790 // Line = FindLine->second; 1791 // Log() << Verbose(0) << "Found line " << *Line << "." << endl; 1792 // if (Line->triangles.size() == 1) { 1793 // T = Line->triangles.begin()->second; 1794 // // construct center of circle 1795 // CircleCenter.CopyVector(Line->endpoints[0]->node->node); 1796 // CircleCenter.AddVector(Line->endpoints[1]->node->node); 1797 // CircleCenter.Scale(0.5); 1798 // 1799 // // construct normal vector of circle 1800 // CirclePlaneNormal.CopyVector(Line->endpoints[0]->node->node); 1801 // CirclePlaneNormal.SubtractVector(Line->endpoints[1]->node->node); 1802 // 1803 // // calculate squared radius of circle 1804 // radius = CirclePlaneNormal.ScalarProduct(&CirclePlaneNormal); 1805 // if (radius/4. < RADIUS*RADIUS) { 1806 // CircleRadius = RADIUS*RADIUS - radius/4.; 1807 // CirclePlaneNormal.Normalize(); 1808 // //Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl; 1809 // 1810 // // construct old center 1811 // GetCenterofCircumcircle(&OldSphereCenter, *T->endpoints[0]->node->node, *T->endpoints[1]->node->node, *T->endpoints[2]->node->node); 1812 // helper.CopyVector(&T->NormalVector); // normal vector ensures that this is correct center of the two possible ones 1813 // radius = Line->endpoints[0]->node->node->DistanceSquared(&OldSphereCenter); 1814 // helper.Scale(sqrt(RADIUS*RADIUS - radius)); 1815 // OldSphereCenter.AddVector(&helper); 1816 // OldSphereCenter.SubtractVector(&CircleCenter); 1817 // //Log() << Verbose(1) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl; 1818 // 1819 // // construct SearchDirection 1820 // SearchDirection.MakeNormalVector(&T->NormalVector, &CirclePlaneNormal); 1821 // helper.CopyVector(Line->endpoints[0]->node->node); 1822 // helper.SubtractVector(ThirdNode->node); 1823 // if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards! 1824 // SearchDirection.Scale(-1.); 1825 // SearchDirection.ProjectOntoPlane(&OldSphereCenter); 1826 // SearchDirection.Normalize(); 1827 // Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl; 1828 // if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) { 1829 // // rotated the wrong way! 1830 // eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl; 1831 // } 1832 // 1833 // // add third point 1834 // FindThirdPointForTesselation(T->NormalVector, SearchDirection, OldSphereCenter, OptCandidates, ThirdNode, RADIUS, LC); 1835 // for (TesselPointList::iterator it = OptCandidates.pointlist.begin(); it != OptCandidates.pointlist.end(); ++it) { 1836 // if (((*it) == BaseRay->endpoints[0]->node) || ((*it) == BaseRay->endpoints[1]->node)) // skip if it's the same triangle than suggested 1837 // continue; 1838 // Log() << Verbose(0) << " Third point candidate is " << (*it) 1839 // << " with circumsphere's center at " << (*it)->OptCenter << "." << endl; 1840 // Log() << Verbose(0) << " Baseline is " << *BaseRay << endl; 1841 // 1842 // // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2) 1843 // TesselPoint *PointCandidates[3]; 1844 // PointCandidates[0] = (*it); 1845 // PointCandidates[1] = BaseRay->endpoints[0]->node; 1846 // PointCandidates[2] = BaseRay->endpoints[1]->node; 1847 // bool check=false; 1848 // int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates); 1849 // // If there is no triangle, add it regularly. 1850 // if (existentTrianglesCount == 0) { 1851 // SetTesselationPoint((*it), 0); 1852 // SetTesselationPoint(BaseRay->endpoints[0]->node, 1); 1853 // SetTesselationPoint(BaseRay->endpoints[1]->node, 2); 1854 // 1855 // if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) { 1856 // OtherOptCandidate = (*it); 1857 // check = true; 1858 // } 1859 // } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time. 1860 // SetTesselationPoint((*it), 0); 1861 // SetTesselationPoint(BaseRay->endpoints[0]->node, 1); 1862 // SetTesselationPoint(BaseRay->endpoints[1]->node, 2); 1863 // 1864 // // 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) 1865 // // i.e. at least one of the three lines must be present with TriangleCount <= 1 1866 // if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS)) { 1867 // OtherOptCandidate = (*it); 1868 // check = true; 1869 // } 1870 // } 1871 // 1872 // if (check) { 1873 // if (ShortestAngle > OtherShortestAngle) { 1874 // Log() << Verbose(0) << "There is a better candidate than " << *ThirdNode << " with " << ShortestAngle << " from baseline " << *Line << ": " << *OtherOptCandidate << " with " << OtherShortestAngle << "." << endl; 1875 // result = true; 1876 // break; 1877 // } 1878 // } 1879 // } 1880 // delete(OptCandidates); 1881 // if (result) 1882 // break; 1883 // } else { 1884 // Log() << Verbose(0) << "Circumcircle for base line " << *Line << " and base triangle " << T << " is too big!" << endl; 1885 // } 1886 // } else { 1887 // eLog() << Verbose(2) << "Baseline is connected to two triangles already?" << endl; 1888 // } 1889 // } else { 1890 // Log() << Verbose(1) << "No present baseline between " << BaseRay->endpoints[0] << " and candidate " << *ThirdNode << "." << endl; 1891 // } 1892 // } 1893 // } else { 1894 // eLog() << Verbose(1) << "Could not find the TesselPoint " << *ThirdNode << "." << endl; 1895 // } 1896 // 1897 // return result; 1898 //}; 1702 1899 1703 1900 /** This function finds a triangle to a line, adjacent to an existing one. 1704 1901 * @param out output stream for debugging 1705 * @param Line currentbaseline to search from1902 * @param CandidateLine current cadndiate baseline to search from 1706 1903 * @param T current triangle which \a Line is edge of 1707 1904 * @param RADIUS radius of the rolling ball … … 1709 1906 * @param *LC LinkedCell structure with neighbouring points 1710 1907 */ 1711 bool Tesselation::FindNextSuitableTriangle( BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC)1712 { 1713 Log() << Verbose(0) << "Begin of FindNextSuitableTriangle\n";1908 bool Tesselation::FindNextSuitableTriangle(CandidateForTesselation &CandidateLine, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC) 1909 { 1910 Info FunctionInfo(__func__); 1714 1911 bool result = true; 1715 CandidateList *OptCandidates = new CandidateList();1716 1912 1717 1913 Vector CircleCenter; … … 1722 1918 TesselPoint *ThirdNode = NULL; 1723 1919 LineMap::iterator testline; 1724 double ShortestAngle = 2.*M_PI; // This will indicate the quadrant.1725 1920 double radius, CircleRadius; 1726 1921 1727 Log() << Verbose( 1) << "Current baseline is " <<Line << " of triangle " << T << "." << endl;1922 Log() << Verbose(0) << "Current baseline is " << *CandidateLine.BaseLine << " of triangle " << T << "." << endl; 1728 1923 for (int i=0;i<3;i++) 1729 if ((T.endpoints[i]->node != Line.endpoints[0]->node) && (T.endpoints[i]->node != Line.endpoints[1]->node))1924 if ((T.endpoints[i]->node != CandidateLine.BaseLine->endpoints[0]->node) && (T.endpoints[i]->node != CandidateLine.BaseLine->endpoints[1]->node)) 1730 1925 ThirdNode = T.endpoints[i]->node; 1731 1926 1732 1927 // construct center of circle 1733 CircleCenter.CopyVector( Line.endpoints[0]->node->node);1734 CircleCenter.AddVector( Line.endpoints[1]->node->node);1928 CircleCenter.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node); 1929 CircleCenter.AddVector(CandidateLine.BaseLine->endpoints[1]->node->node); 1735 1930 CircleCenter.Scale(0.5); 1736 1931 1737 1932 // construct normal vector of circle 1738 CirclePlaneNormal.CopyVector( Line.endpoints[0]->node->node);1739 CirclePlaneNormal.SubtractVector( Line.endpoints[1]->node->node);1933 CirclePlaneNormal.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node); 1934 CirclePlaneNormal.SubtractVector(CandidateLine.BaseLine->endpoints[1]->node->node); 1740 1935 1741 1936 // calculate squared radius of circle … … 1744 1939 CircleRadius = RADIUS*RADIUS - radius/4.; 1745 1940 CirclePlaneNormal.Normalize(); 1746 //Log() << Verbose(2) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;1941 Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl; 1747 1942 1748 1943 // construct old center 1749 1944 GetCenterofCircumcircle(&OldSphereCenter, *T.endpoints[0]->node->node, *T.endpoints[1]->node->node, *T.endpoints[2]->node->node); 1750 1945 helper.CopyVector(&T.NormalVector); // normal vector ensures that this is correct center of the two possible ones 1751 radius = Line.endpoints[0]->node->node->DistanceSquared(&OldSphereCenter);1946 radius = CandidateLine.BaseLine->endpoints[0]->node->node->DistanceSquared(&OldSphereCenter); 1752 1947 helper.Scale(sqrt(RADIUS*RADIUS - radius)); 1753 1948 OldSphereCenter.AddVector(&helper); 1754 1949 OldSphereCenter.SubtractVector(&CircleCenter); 1755 //Log() << Verbose(2) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;1950 Log() << Verbose(1) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl; 1756 1951 1757 1952 // construct SearchDirection 1758 1953 SearchDirection.MakeNormalVector(&T.NormalVector, &CirclePlaneNormal); 1759 helper.CopyVector( Line.endpoints[0]->node->node);1954 helper.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node); 1760 1955 helper.SubtractVector(ThirdNode->node); 1761 1956 if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards! … … 1763 1958 SearchDirection.ProjectOntoPlane(&OldSphereCenter); 1764 1959 SearchDirection.Normalize(); 1765 Log() << Verbose( 2) << "INFO: SearchDirection is " << SearchDirection << "." << endl;1960 Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl; 1766 1961 if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) { 1767 1962 // rotated the wrong way! 1768 eLog() << Verbose( 0) << "ERROR:SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl;1963 eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are still not orthogonal!" << endl; 1769 1964 } 1770 1965 1771 1966 // add third point 1772 FindThirdPointForTesselation(T.NormalVector, SearchDirection, OldSphereCenter, &Line, ThirdNode, OptCandidates, &ShortestAngle, RADIUS, LC);1967 FindThirdPointForTesselation(T.NormalVector, SearchDirection, OldSphereCenter, CandidateLine, ThirdNode, RADIUS, LC); 1773 1968 1774 1969 } else { 1775 Log() << Verbose( 1) << "Circumcircle for base line " <<Line << " and base triangle " << T << " is too big!" << endl;1776 } 1777 1778 if ( OptCandidates->begin() == OptCandidates->end()) {1779 eLog() << Verbose( 0) << "WARNING:Could not find a suitable candidate." << endl;1970 Log() << Verbose(0) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and base triangle " << T << " is too big!" << endl; 1971 } 1972 1973 if (CandidateLine.pointlist.empty()) { 1974 eLog() << Verbose(2) << "Could not find a suitable candidate." << endl; 1780 1975 return false; 1781 1976 } 1782 Log() << Verbose(1) << "Third Points are "; 1783 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1784 Log() << Verbose(0) << " " << *(*it)->point; 1785 } 1786 Log() << Verbose(0) << endl; 1787 1788 BoundaryLineSet *BaseRay = &Line; 1789 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1790 Log() << Verbose(1) << " Third point candidate is " << *(*it)->point 1791 << " with circumsphere's center at " << (*it)->OptCenter << "." << endl; 1792 Log() << Verbose(1) << " Baseline is " << *BaseRay << endl; 1793 1794 // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2) 1795 TesselPoint *PointCandidates[3]; 1796 PointCandidates[0] = (*it)->point; 1797 PointCandidates[1] = BaseRay->endpoints[0]->node; 1798 PointCandidates[2] = BaseRay->endpoints[1]->node; 1799 int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates); 1800 1801 BTS = NULL; 1802 // If there is no triangle, add it regularly. 1803 if (existentTrianglesCount == 0) { 1804 AddTesselationPoint((*it)->point, 0); 1805 AddTesselationPoint(BaseRay->endpoints[0]->node, 1); 1806 AddTesselationPoint(BaseRay->endpoints[1]->node, 2); 1807 1808 if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) { 1809 AddTesselationLine(TPS[0], TPS[1], 0); 1810 AddTesselationLine(TPS[0], TPS[2], 1); 1811 AddTesselationLine(TPS[1], TPS[2], 2); 1812 1813 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 1814 AddTesselationTriangle(); 1815 (*it)->OptCenter.Scale(-1.); 1816 BTS->GetNormalVector((*it)->OptCenter); 1817 (*it)->OptCenter.Scale(-1.); 1818 1819 Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector 1820 << " for this triangle ... " << endl; 1821 //Log() << Verbose(1) << "We have "<< TrianglesOnBoundaryCount << " for line " << *BaseRay << "." << endl; 1822 } else { 1823 Log() << Verbose(1) << "WARNING: This triangle consisting of "; 1824 Log() << Verbose(0) << *(*it)->point << ", "; 1825 Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and "; 1826 Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " "; 1827 Log() << Verbose(0) << "exists and is not added, as it does not seem helpful!" << endl; 1828 result = false; 1829 } 1830 } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time. 1831 AddTesselationPoint((*it)->point, 0); 1832 AddTesselationPoint(BaseRay->endpoints[0]->node, 1); 1833 AddTesselationPoint(BaseRay->endpoints[1]->node, 2); 1834 1835 // 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) 1836 // i.e. at least one of the three lines must be present with TriangleCount <= 1 1837 if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS)) { 1838 AddTesselationLine(TPS[0], TPS[1], 0); 1839 AddTesselationLine(TPS[0], TPS[2], 1); 1840 AddTesselationLine(TPS[1], TPS[2], 2); 1841 1842 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 1843 AddTesselationTriangle(); // add to global map 1844 1845 (*it)->OtherOptCenter.Scale(-1.); 1846 BTS->GetNormalVector((*it)->OtherOptCenter); 1847 (*it)->OtherOptCenter.Scale(-1.); 1848 1849 Log() << Verbose(0) << "--> WARNING: Special new triangle with " << *BTS << " and normal vector " << BTS->NormalVector 1850 << " for this triangle ... " << endl; 1851 Log() << Verbose(1) << "We have "<< BaseRay->triangles.size() << " for line " << BaseRay << "." << endl; 1852 } else { 1853 Log() << Verbose(1) << "WARNING: This triangle consisting of "; 1854 Log() << Verbose(0) << *(*it)->point << ", "; 1855 Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and "; 1856 Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " "; 1857 Log() << Verbose(0) << "exists and is not added, as it does not seem helpful!" << endl; 1858 result = false; 1859 } 1860 } else { 1861 Log() << Verbose(1) << "This triangle consisting of "; 1862 Log() << Verbose(0) << *(*it)->point << ", "; 1863 Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and "; 1864 Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " "; 1865 Log() << Verbose(0) << "is invalid!" << endl; 1866 result = false; 1867 } 1868 1869 // set baseline to new ray from ref point (here endpoints[0]->node) to current candidate (here (*it)->point)) 1870 BaseRay = BLS[0]; 1871 if ((BTS != NULL) && (BTS->NormalVector.NormSquared() < MYEPSILON)) { 1872 Log() << Verbose(1) << "CRITICAL: Triangle " << *BTS << " has zero normal vector!" << endl; 1873 exit(255); 1874 } 1875 1876 } 1877 1878 // remove all candidates from the list and then the list itself 1879 class CandidateForTesselation *remover = NULL; 1880 for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1881 remover = *it; 1882 delete(remover); 1883 } 1884 delete(OptCandidates); 1885 Log() << Verbose(0) << "End of FindNextSuitableTriangle\n"; 1977 Log() << Verbose(0) << "Third Points are: " << endl; 1978 for (TesselPointList::iterator it = CandidateLine.pointlist.begin(); it != CandidateLine.pointlist.end(); ++it) { 1979 Log() << Verbose(0) << " " << *(*it) << endl; 1980 } 1981 1982 return true; 1983 1984 // BoundaryLineSet *BaseRay = CandidateLine.BaseLine; 1985 // for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 1986 // Log() << Verbose(0) << "Third point candidate is " << *(*it)->point 1987 // << " with circumsphere's center at " << (*it)->OptCenter << "." << endl; 1988 // Log() << Verbose(0) << "Baseline is " << *BaseRay << endl; 1989 // 1990 // // check whether all edges of the new triangle still have space for one more triangle (i.e. TriangleCount <2) 1991 // TesselPoint *PointCandidates[3]; 1992 // PointCandidates[0] = (*it)->point; 1993 // PointCandidates[1] = BaseRay->endpoints[0]->node; 1994 // PointCandidates[2] = BaseRay->endpoints[1]->node; 1995 // int existentTrianglesCount = CheckPresenceOfTriangle(PointCandidates); 1996 // 1997 // BTS = NULL; 1998 // // check for present edges and whether we reach better candidates from them 1999 // //if (HasOtherBaselineBetterCandidate(BaseRay, (*it)->point, ShortestAngle, RADIUS, LC) ) { 2000 // if (0) { 2001 // result = false; 2002 // break; 2003 // } else { 2004 // // If there is no triangle, add it regularly. 2005 // if (existentTrianglesCount == 0) { 2006 // AddTesselationPoint((*it)->point, 0); 2007 // AddTesselationPoint(BaseRay->endpoints[0]->node, 1); 2008 // AddTesselationPoint(BaseRay->endpoints[1]->node, 2); 2009 // 2010 // if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const )TPS)) { 2011 // CandidateLine.point = (*it)->point; 2012 // CandidateLine.OptCenter.CopyVector(&((*it)->OptCenter)); 2013 // CandidateLine.OtherOptCenter.CopyVector(&((*it)->OtherOptCenter)); 2014 // CandidateLine.ShortestAngle = ShortestAngle; 2015 // } else { 2016 //// eLog() << Verbose(1) << "This triangle consisting of "; 2017 //// Log() << Verbose(0) << *(*it)->point << ", "; 2018 //// Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and "; 2019 //// Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " "; 2020 //// Log() << Verbose(0) << "exists and is not added, as it 0x80000000006fc150(does not seem helpful!" << endl; 2021 // result = false; 2022 // } 2023 // } else if ((existentTrianglesCount >= 1) && (existentTrianglesCount <= 3)) { // If there is a planar region within the structure, we need this triangle a second time. 2024 // AddTesselationPoint((*it)->point, 0); 2025 // AddTesselationPoint(BaseRay->endpoints[0]->node, 1); 2026 // AddTesselationPoint(BaseRay->endpoints[1]->node, 2); 2027 // 2028 // // 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) 2029 // // i.e. at least one of the three lines must be present with TriangleCount <= 1 2030 // if (CheckLineCriteriaForDegeneratedTriangle((const BoundaryPointSet ** const)TPS) || CandidateLine.BaseLine->skipped) { 2031 // CandidateLine.point = (*it)->point; 2032 // CandidateLine.OptCenter.CopyVector(&(*it)->OptCenter); 2033 // CandidateLine.OtherOptCenter.CopyVector(&(*it)->OtherOptCenter); 2034 // CandidateLine.ShortestAngle = ShortestAngle+2.*M_PI; 2035 // 2036 // } else { 2037 //// 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; 2038 // result = false; 2039 // } 2040 // } else { 2041 //// Log() << Verbose(1) << "This triangle consisting of "; 2042 //// Log() << Verbose(0) << *(*it)->point << ", "; 2043 //// Log() << Verbose(0) << *BaseRay->endpoints[0]->node << " and "; 2044 //// Log() << Verbose(0) << *BaseRay->endpoints[1]->node << " "; 2045 //// Log() << Verbose(0) << "is invalid!" << endl; 2046 // result = false; 2047 // } 2048 // } 2049 // 2050 // // set baseline to new ray from ref point (here endpoints[0]->node) to current candidate (here (*it)->point)) 2051 // BaseRay = BLS[0]; 2052 // if ((BTS != NULL) && (BTS->NormalVector.NormSquared() < MYEPSILON)) { 2053 // eLog() << Verbose(1) << "Triangle " << *BTS << " has zero normal vector!" << endl; 2054 // exit(255); 2055 // } 2056 // 2057 // } 2058 // 2059 // // remove all candidates from the list and then the list itself 2060 // class CandidateForTesselation *remover = NULL; 2061 // for (CandidateList::iterator it = OptCandidates->begin(); it != OptCandidates->end(); ++it) { 2062 // remover = *it; 2063 // delete(remover); 2064 // } 2065 // delete(OptCandidates); 1886 2066 return result; 2067 }; 2068 2069 /** Adds the present line and candidate point from \a &CandidateLine to the Tesselation. 2070 * \param CandidateLine triangle to add 2071 * \NOTE we need the copy operator here as the original CandidateForTesselation is removed in AddTesselationLine() 2072 */ 2073 void Tesselation::AddCandidateTriangle(CandidateForTesselation CandidateLine) 2074 { 2075 Info FunctionInfo(__func__); 2076 Vector Center; 2077 TesselPoint * const TurningPoint = CandidateLine.BaseLine->endpoints[0]->node; 2078 2079 // fill the set of neighbours 2080 Center.CopyVector(CandidateLine.BaseLine->endpoints[1]->node->node); 2081 Center.SubtractVector(TurningPoint->node); 2082 set<TesselPoint*> SetOfNeighbours; 2083 SetOfNeighbours.insert(CandidateLine.BaseLine->endpoints[1]->node); 2084 for (TesselPointList::iterator Runner = CandidateLine.pointlist.begin(); Runner != CandidateLine.pointlist.end(); Runner++) 2085 SetOfNeighbours.insert(*Runner); 2086 TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(&SetOfNeighbours, TurningPoint, &Center); 2087 2088 // go through all angle-sorted candidates (in degenerate n-nodes case we may have to add multiple triangles) 2089 TesselPointList::iterator Runner = connectedClosestPoints->begin(); 2090 TesselPointList::iterator Sprinter = Runner; 2091 Sprinter++; 2092 while(Sprinter != connectedClosestPoints->end()) { 2093 // add the points 2094 AddTesselationPoint(TurningPoint, 0); 2095 AddTesselationPoint((*Runner), 1); 2096 AddTesselationPoint((*Sprinter), 2); 2097 2098 Center.CopyVector(&CandidateLine.OptCenter); 2099 // add the lines 2100 AddTesselationLine(TPS[0], TPS[1], 0); 2101 AddTesselationLine(TPS[0], TPS[2], 1); 2102 AddTesselationLine(TPS[1], TPS[2], 2); 2103 2104 // add the triangles 2105 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 2106 AddTesselationTriangle(); 2107 Center.Scale(-1.); 2108 BTS->GetNormalVector(Center); 2109 2110 Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector << "." << endl; 2111 Runner = Sprinter; 2112 Sprinter++; 2113 } 1887 2114 }; 1888 2115 … … 1896 2123 class BoundaryPointSet *Tesselation::IsConvexRectangle(class BoundaryLineSet *Base) 1897 2124 { 2125 Info FunctionInfo(__func__); 1898 2126 class BoundaryPointSet *Spot = NULL; 1899 2127 class BoundaryLineSet *OtherBase; … … 1907 2135 OtherBase = new class BoundaryLineSet(BPS,-1); 1908 2136 1909 Log() << Verbose( 3) << "INFO: Current base line is " << *Base << "." << endl;1910 Log() << Verbose( 3) << "INFO: Other base line is " << *OtherBase << "." << endl;2137 Log() << Verbose(1) << "INFO: Current base line is " << *Base << "." << endl; 2138 Log() << Verbose(1) << "INFO: Other base line is " << *OtherBase << "." << endl; 1911 2139 1912 2140 // get the closest point on each line to the other line … … 1928 2156 delete(ClosestPoint); 1929 2157 if ((distance[0] * distance[1]) > 0) { // have same sign? 1930 Log() << Verbose( 3) << "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1] << ". " << *Base << "' rectangle is concave." << endl;2158 Log() << Verbose(1) << "REJECT: Both SKPs have same sign: " << distance[0] << " and " << distance[1] << ". " << *Base << "' rectangle is concave." << endl; 1931 2159 if (distance[0] < distance[1]) { 1932 2160 Spot = Base->endpoints[0]; … … 1936 2164 return Spot; 1937 2165 } else { // different sign, i.e. we are in between 1938 Log() << Verbose( 3) << "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex." << endl;2166 Log() << Verbose(0) << "ACCEPT: Rectangle of triangles of base line " << *Base << " is convex." << endl; 1939 2167 return NULL; 1940 2168 } … … 1944 2172 void Tesselation::PrintAllBoundaryPoints(ofstream *out) const 1945 2173 { 2174 Info FunctionInfo(__func__); 1946 2175 // print all lines 1947 Log() << Verbose( 1) << "Printing all boundary points for debugging:" << endl;2176 Log() << Verbose(0) << "Printing all boundary points for debugging:" << endl; 1948 2177 for (PointMap::const_iterator PointRunner = PointsOnBoundary.begin();PointRunner != PointsOnBoundary.end(); PointRunner++) 1949 Log() << Verbose( 2) << *(PointRunner->second) << endl;2178 Log() << Verbose(0) << *(PointRunner->second) << endl; 1950 2179 }; 1951 2180 1952 2181 void Tesselation::PrintAllBoundaryLines(ofstream *out) const 1953 2182 { 2183 Info FunctionInfo(__func__); 1954 2184 // print all lines 1955 Log() << Verbose( 1) << "Printing all boundary lines for debugging:" << endl;2185 Log() << Verbose(0) << "Printing all boundary lines for debugging:" << endl; 1956 2186 for (LineMap::const_iterator LineRunner = LinesOnBoundary.begin(); LineRunner != LinesOnBoundary.end(); LineRunner++) 1957 Log() << Verbose( 2) << *(LineRunner->second) << endl;2187 Log() << Verbose(0) << *(LineRunner->second) << endl; 1958 2188 }; 1959 2189 1960 2190 void Tesselation::PrintAllBoundaryTriangles(ofstream *out) const 1961 2191 { 2192 Info FunctionInfo(__func__); 1962 2193 // print all triangles 1963 Log() << Verbose( 1) << "Printing all boundary triangles for debugging:" << endl;2194 Log() << Verbose(0) << "Printing all boundary triangles for debugging:" << endl; 1964 2195 for (TriangleMap::const_iterator TriangleRunner = TrianglesOnBoundary.begin(); TriangleRunner != TrianglesOnBoundary.end(); TriangleRunner++) 1965 Log() << Verbose( 2) << *(TriangleRunner->second) << endl;2196 Log() << Verbose(0) << *(TriangleRunner->second) << endl; 1966 2197 }; 1967 2198 … … 1973 2204 double Tesselation::PickFarthestofTwoBaselines(class BoundaryLineSet *Base) 1974 2205 { 2206 Info FunctionInfo(__func__); 1975 2207 class BoundaryLineSet *OtherBase; 1976 2208 Vector *ClosestPoint[2]; … … 1984 2216 OtherBase = new class BoundaryLineSet(BPS,-1); 1985 2217 1986 Log() << Verbose( 3) << "INFO: Current base line is " << *Base << "." << endl;1987 Log() << Verbose( 3) << "INFO: Other base line is " << *OtherBase << "." << endl;2218 Log() << Verbose(0) << "INFO: Current base line is " << *Base << "." << endl; 2219 Log() << Verbose(0) << "INFO: Other base line is " << *OtherBase << "." << endl; 1988 2220 1989 2221 // get the closest point on each line to the other line … … 2005 2237 2006 2238 if (Distance.NormSquared() < MYEPSILON) { // check for intersection 2007 Log() << Verbose( 3) << "REJECT: Both lines have an intersection: Nothing to do." << endl;2239 Log() << Verbose(0) << "REJECT: Both lines have an intersection: Nothing to do." << endl; 2008 2240 return false; 2009 2241 } else { // check for sign against BaseLineNormal … … 2011 2243 BaseLineNormal.Zero(); 2012 2244 if (Base->triangles.size() < 2) { 2013 Log() << Verbose(2) << "ERROR:Less than two triangles are attached to this baseline!" << endl;2245 eLog() << Verbose(1) << "Less than two triangles are attached to this baseline!" << endl; 2014 2246 return 0.; 2015 2247 } 2016 2248 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) { 2017 Log() << Verbose( 4) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;2249 Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl; 2018 2250 BaseLineNormal.AddVector(&(runner->second->NormalVector)); 2019 2251 } … … 2021 2253 2022 2254 if (Distance.ScalarProduct(&BaseLineNormal) > MYEPSILON) { // Distance points outwards, hence OtherBase higher than Base -> flip 2023 Log() << Verbose( 2) << "ACCEPT: Other base line would be higher: Flipping baseline." << endl;2255 Log() << Verbose(0) << "ACCEPT: Other base line would be higher: Flipping baseline." << endl; 2024 2256 // calculate volume summand as a general tetraeder 2025 2257 return volume; 2026 2258 } else { // Base higher than OtherBase -> do nothing 2027 Log() << Verbose( 2) << "REJECT: Base line is higher: Nothing to do." << endl;2259 Log() << Verbose(0) << "REJECT: Base line is higher: Nothing to do." << endl; 2028 2260 return 0.; 2029 2261 } … … 2040 2272 class BoundaryLineSet * Tesselation::FlipBaseline(class BoundaryLineSet *Base) 2041 2273 { 2274 Info FunctionInfo(__func__); 2042 2275 class BoundaryLineSet *OldLines[4], *NewLine; 2043 2276 class BoundaryPointSet *OldPoints[2]; … … 2046 2279 int i,m; 2047 2280 2048 Log() << Verbose(1) << "Begin of FlipBaseline" << endl;2049 2050 2281 // calculate NormalVector for later use 2051 2282 BaseLineNormal.Zero(); 2052 2283 if (Base->triangles.size() < 2) { 2053 Log() << Verbose(2) << "ERROR:Less than two triangles are attached to this baseline!" << endl;2284 eLog() << Verbose(1) << "Less than two triangles are attached to this baseline!" << endl; 2054 2285 return NULL; 2055 2286 } 2056 2287 for (TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) { 2057 Log() << Verbose( 4) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl;2288 Log() << Verbose(1) << "INFO: Adding NormalVector " << runner->second->NormalVector << " of triangle " << *(runner->second) << "." << endl; 2058 2289 BaseLineNormal.AddVector(&(runner->second->NormalVector)); 2059 2290 } … … 2068 2299 i=0; 2069 2300 m=0; 2070 Log() << Verbose( 3) << "The four old lines are: ";2301 Log() << Verbose(0) << "The four old lines are: "; 2071 2302 for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) 2072 2303 for (int j=0;j<3;j++) // all of their endpoints and baselines … … 2076 2307 } 2077 2308 Log() << Verbose(0) << endl; 2078 Log() << Verbose( 3) << "The two old points are: ";2309 Log() << Verbose(0) << "The two old points are: "; 2079 2310 for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) 2080 2311 for (int j=0;j<3;j++) // all of their endpoints and baselines … … 2087 2318 // check whether everything is in place to create new lines and triangles 2088 2319 if (i<4) { 2089 Log() << Verbose(1) << "ERROR:We have not gathered enough baselines!" << endl;2320 eLog() << Verbose(1) << "We have not gathered enough baselines!" << endl; 2090 2321 return NULL; 2091 2322 } 2092 2323 for (int j=0;j<4;j++) 2093 2324 if (OldLines[j] == NULL) { 2094 Log() << Verbose(1) << "ERROR:We have not gathered enough baselines!" << endl;2325 eLog() << Verbose(1) << "We have not gathered enough baselines!" << endl; 2095 2326 return NULL; 2096 2327 } 2097 2328 for (int j=0;j<2;j++) 2098 2329 if (OldPoints[j] == NULL) { 2099 Log() << Verbose(1) << "ERROR:We have not gathered enough endpoints!" << endl;2330 eLog() << Verbose(1) << "We have not gathered enough endpoints!" << endl; 2100 2331 return NULL; 2101 2332 } 2102 2333 2103 2334 // remove triangles and baseline removes itself 2104 Log() << Verbose( 3) << "INFO: Deleting baseline " << *Base << " from global list." << endl;2335 Log() << Verbose(0) << "INFO: Deleting baseline " << *Base << " from global list." << endl; 2105 2336 OldBaseLineNr = Base->Nr; 2106 2337 m=0; 2107 2338 for(TriangleMap::iterator runner = Base->triangles.begin(); runner != Base->triangles.end(); runner++) { 2108 Log() << Verbose( 3) << "INFO: Deleting triangle " << *(runner->second) << "." << endl;2339 Log() << Verbose(0) << "INFO: Deleting triangle " << *(runner->second) << "." << endl; 2109 2340 OldTriangleNrs[m++] = runner->second->Nr; 2110 2341 RemoveTesselationTriangle(runner->second); … … 2116 2347 NewLine = new class BoundaryLineSet(BPS, OldBaseLineNr); 2117 2348 LinesOnBoundary.insert(LinePair(OldBaseLineNr, NewLine)); // no need for check for unique insertion as NewLine is definitely a new one 2118 Log() << Verbose( 3) << "INFO: Created new baseline " << *NewLine << "." << endl;2349 Log() << Verbose(0) << "INFO: Created new baseline " << *NewLine << "." << endl; 2119 2350 2120 2351 // construct new triangles with flipped baseline … … 2131 2362 BTS->GetNormalVector(BaseLineNormal); 2132 2363 AddTesselationTriangle(OldTriangleNrs[0]); 2133 Log() << Verbose( 3) << "INFO: Created new triangle " << *BTS << "." << endl;2364 Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl; 2134 2365 2135 2366 BLS[0] = (i==2 ? OldLines[3] : OldLines[2]); … … 2139 2370 BTS->GetNormalVector(BaseLineNormal); 2140 2371 AddTesselationTriangle(OldTriangleNrs[1]); 2141 Log() << Verbose( 3) << "INFO: Created new triangle " << *BTS << "." << endl;2372 Log() << Verbose(0) << "INFO: Created new triangle " << *BTS << "." << endl; 2142 2373 } else { 2143 Log() << Verbose(1) << "The four old lines do not connect, something's utterly wrong here!" << endl;2374 eLog() << Verbose(0) << "The four old lines do not connect, something's utterly wrong here!" << endl; 2144 2375 return NULL; 2145 2376 } 2146 2377 2147 Log() << Verbose(1) << "End of FlipBaseline" << endl;2148 2378 return NewLine; 2149 2379 }; … … 2160 2390 void Tesselation::FindSecondPointForTesselation(TesselPoint* a, Vector Oben, TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell *LC) 2161 2391 { 2162 Log() << Verbose(2) << "Begin of FindSecondPointForTesselation" << endl;2392 Info FunctionInfo(__func__); 2163 2393 Vector AngleCheck; 2164 2394 class TesselPoint* Candidate = NULL; … … 2173 2403 N[i] = LC->n[i]; 2174 2404 } else { 2175 eLog() << Verbose( 0) << "ERROR:Point " << *a << " is not found in cell " << LC->index << "." << endl;2405 eLog() << Verbose(1) << "Point " << *a << " is not found in cell " << LC->index << "." << endl; 2176 2406 return; 2177 2407 } 2178 2408 // then go through the current and all neighbouring cells and check the contained points for possible candidates 2179 Log() << Verbose(3) << "LC Intervals from [";2180 for (int i=0;i<NDIM;i++) {2181 Log() << Verbose(0) << " " << N[i] << "<->" << LC->N[i];2182 }2183 Log() << Verbose(0) << "] :";2184 2409 for (int i=0;i<NDIM;i++) { 2185 2410 Nlower[i] = ((N[i]-1) >= 0) ? N[i]-1 : 0; 2186 2411 Nupper[i] = ((N[i]+1) < LC->N[i]) ? N[i]+1 : LC->N[i]-1; 2187 Log() << Verbose(0) << " [" << Nlower[i] << "," << Nupper[i] << "] "; 2188 } 2189 Log() << Verbose(0) << endl; 2190 2412 } 2413 Log() << Verbose(0) << "LC Intervals from [" << N[0] << "<->" << LC->N[0] << ", " << N[1] << "<->" << LC->N[1] << ", " << N[2] << "<->" << LC->N[2] << "] :" 2414 << " [" << Nlower[0] << "," << Nupper[0] << "], " << " [" << Nlower[1] << "," << Nupper[1] << "], " << " [" << Nlower[2] << "," << Nupper[2] << "], " << endl; 2191 2415 2192 2416 for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++) … … 2194 2418 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 2195 2419 const LinkedNodes *List = LC->GetCurrentCell(); 2196 //Log() << Verbose( 2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;2420 //Log() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl; 2197 2421 if (List != NULL) { 2198 2422 for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { … … 2225 2449 angle = AngleCheck.Angle(&Oben); 2226 2450 if (angle < Storage[0]) { 2227 //Log() << Verbose( 3) << "Old values of Storage: %lf %lf \n", Storage[0], Storage[1]);2228 Log() << Verbose( 3) << "Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << ".\n";2451 //Log() << Verbose(1) << "Old values of Storage: %lf %lf \n", Storage[0], Storage[1]); 2452 Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Is a better candidate with distance " << norm << " and angle " << angle << " to oben " << Oben << ".\n"; 2229 2453 OptCandidate = Candidate; 2230 2454 Storage[0] = angle; 2231 //Log() << Verbose( 3) << "Changing something in Storage: %lf %lf. \n", Storage[0], Storage[2]);2455 //Log() << Verbose(1) << "Changing something in Storage: %lf %lf. \n", Storage[0], Storage[2]); 2232 2456 } else { 2233 //Log() << Verbose( 3) << "Current candidate is " << *Candidate << ": Looses with angle " << angle << " to a better candidate " << *OptCandidate << endl;2457 //Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Looses with angle " << angle << " to a better candidate " << *OptCandidate << endl; 2234 2458 } 2235 2459 } else { 2236 //Log() << Verbose( 3) << "Current candidate is " << *Candidate << ": Refused due to Radius " << norm << endl;2460 //Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Refused due to Radius " << norm << endl; 2237 2461 } 2238 2462 } else { 2239 //Log() << Verbose( 3) << "Current candidate is " << *Candidate << ": Candidate is equal to first endpoint." << *a << "." << endl;2463 //Log() << Verbose(1) << "Current candidate is " << *Candidate << ": Candidate is equal to first endpoint." << *a << "." << endl; 2240 2464 } 2241 2465 } 2242 2466 } else { 2243 Log() << Verbose( 3) << "Linked cell list is empty." << endl;2467 Log() << Verbose(0) << "Linked cell list is empty." << endl; 2244 2468 } 2245 2469 } 2246 Log() << Verbose(2) << "End of FindSecondPointForTesselation" << endl;2247 2470 }; 2248 2471 … … 2273 2496 * @param SearchDirection general direction where to search for the next point, relative to center of BaseLine 2274 2497 * @param OldSphereCenter center of sphere for base triangle, relative to center of BaseLine, giving null angle for the parameter circle 2275 * @param BaseLine BoundaryLineSet with the current base line2498 * @param CandidateLine CandidateForTesselation with the current base line and list of candidates and ShortestAngle 2276 2499 * @param ThirdNode third point to avoid in search 2277 * @param candidates list of equally good candidates to return2278 * @param ShortestAngle the current path length on this circle band for the current OptCandidate2279 2500 * @param RADIUS radius of sphere 2280 2501 * @param *LC LinkedCell structure with neighbouring points 2281 2502 */ 2282 void Tesselation::FindThirdPointForTesselation(Vector NormalVector, Vector SearchDirection, Vector OldSphereCenter, class BoundaryLineSet *BaseLine, class TesselPoint *ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, const LinkedCell *LC) 2283 { 2503 void Tesselation::FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, CandidateForTesselation &CandidateLine, const class TesselPoint * const ThirdNode, const double RADIUS, const LinkedCell *LC) const 2504 { 2505 Info FunctionInfo(__func__); 2284 2506 Vector CircleCenter; // center of the circle, i.e. of the band of sphere's centers 2285 2507 Vector CirclePlaneNormal; // normal vector defining the plane this circle lives in … … 2294 2516 int N[NDIM], Nlower[NDIM], Nupper[NDIM]; 2295 2517 TesselPoint *Candidate = NULL; 2296 CandidateForTesselation *optCandidate = NULL; 2297 2298 Log() << Verbose(1) << "Begin of FindThirdPointForTesselation" << endl; 2299 2300 Log() << Verbose(2) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl; 2518 2519 Log() << Verbose(1) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl; 2301 2520 2302 2521 // construct center of circle 2303 CircleCenter.CopyVector( BaseLine->endpoints[0]->node->node);2304 CircleCenter.AddVector( BaseLine->endpoints[1]->node->node);2522 CircleCenter.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node); 2523 CircleCenter.AddVector(CandidateLine.BaseLine->endpoints[1]->node->node); 2305 2524 CircleCenter.Scale(0.5); 2306 2525 2307 2526 // construct normal vector of circle 2308 CirclePlaneNormal.CopyVector( BaseLine->endpoints[0]->node->node);2309 CirclePlaneNormal.SubtractVector( BaseLine->endpoints[1]->node->node);2527 CirclePlaneNormal.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node); 2528 CirclePlaneNormal.SubtractVector(CandidateLine.BaseLine->endpoints[1]->node->node); 2310 2529 2311 2530 // calculate squared radius TesselPoint *ThirdNode,f circle … … 2314 2533 CircleRadius = RADIUS*RADIUS - radius/4.; 2315 2534 CirclePlaneNormal.Normalize(); 2316 //Log() << Verbose( 2) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl;2535 //Log() << Verbose(1) << "INFO: CircleCenter is at " << CircleCenter << ", CirclePlaneNormal is " << CirclePlaneNormal << " with circle radius " << sqrt(CircleRadius) << "." << endl; 2317 2536 2318 2537 // test whether old center is on the band's plane 2319 2538 if (fabs(OldSphereCenter.ScalarProduct(&CirclePlaneNormal)) > HULLEPSILON) { 2320 eLog() << Verbose( 0) << "ERROR:Something's very wrong here: OldSphereCenter is not on the band's plane as desired by " << fabs(OldSphereCenter.ScalarProduct(&CirclePlaneNormal)) << "!" << endl;2539 eLog() << Verbose(1) << "Something's very wrong here: OldSphereCenter is not on the band's plane as desired by " << fabs(OldSphereCenter.ScalarProduct(&CirclePlaneNormal)) << "!" << endl; 2321 2540 OldSphereCenter.ProjectOntoPlane(&CirclePlaneNormal); 2322 2541 } 2323 2542 radius = OldSphereCenter.ScalarProduct(&OldSphereCenter); 2324 2543 if (fabs(radius - CircleRadius) < HULLEPSILON) { 2325 //Log() << Verbose( 2) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl;2544 //Log() << Verbose(1) << "INFO: OldSphereCenter is at " << OldSphereCenter << "." << endl; 2326 2545 2327 2546 // check SearchDirection 2328 //Log() << Verbose( 2) << "INFO: SearchDirection is " << SearchDirection << "." << endl;2547 //Log() << Verbose(1) << "INFO: SearchDirection is " << SearchDirection << "." << endl; 2329 2548 if (fabs(OldSphereCenter.ScalarProduct(&SearchDirection)) > HULLEPSILON) { // rotated the wrong way! 2330 eLog() << Verbose( 0) << "ERROR:SearchDirection and RelativeOldSphereCenter are not orthogonal!" << endl;2549 eLog() << Verbose(1) << "SearchDirection and RelativeOldSphereCenter are not orthogonal!" << endl; 2331 2550 } 2332 2551 … … 2335 2554 for(int i=0;i<NDIM;i++) // store indices of this cell 2336 2555 N[i] = LC->n[i]; 2337 //Log() << Verbose( 2) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;2556 //Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl; 2338 2557 } else { 2339 eLog() << Verbose( 0) << "ERROR:Vector " << CircleCenter << " is outside of LinkedCell's bounding box." << endl;2558 eLog() << Verbose(1) << "Vector " << CircleCenter << " is outside of LinkedCell's bounding box." << endl; 2340 2559 return; 2341 2560 } 2342 2561 // then go through the current and all neighbouring cells and check the contained points for possible candidates 2343 //Log() << Verbose( 2) << "LC Intervals:";2562 //Log() << Verbose(1) << "LC Intervals:"; 2344 2563 for (int i=0;i<NDIM;i++) { 2345 2564 Nlower[i] = ((N[i]-1) >= 0) ? N[i]-1 : 0; … … 2352 2571 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 2353 2572 const LinkedNodes *List = LC->GetCurrentCell(); 2354 //Log() << Verbose( 2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl;2573 //Log() << Verbose(1) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl; 2355 2574 if (List != NULL) { 2356 2575 for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { … … 2358 2577 2359 2578 // check for three unique points 2360 //Log() << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " at " << Candidate->node<< "." << endl;2361 if ((Candidate != BaseLine->endpoints[0]->node) && (Candidate !=BaseLine->endpoints[1]->node) ){2579 Log() << Verbose(2) << "INFO: Current Candidate is " << *Candidate << " at " << *(Candidate->node) << "." << endl; 2580 if ((Candidate != CandidateLine.BaseLine->endpoints[0]->node) && (Candidate != CandidateLine.BaseLine->endpoints[1]->node) ){ 2362 2581 2363 2582 // construct both new centers 2364 GetCenterofCircumcircle(&NewSphereCenter, * BaseLine->endpoints[0]->node->node, *BaseLine->endpoints[1]->node->node, *Candidate->node);2583 GetCenterofCircumcircle(&NewSphereCenter, *CandidateLine.BaseLine->endpoints[0]->node->node, *CandidateLine.BaseLine->endpoints[1]->node->node, *Candidate->node); 2365 2584 OtherNewSphereCenter.CopyVector(&NewSphereCenter); 2366 2585 2367 if ((NewNormalVector.MakeNormalVector( BaseLine->endpoints[0]->node->node,BaseLine->endpoints[1]->node->node, Candidate->node))2586 if ((NewNormalVector.MakeNormalVector(CandidateLine.BaseLine->endpoints[0]->node->node, CandidateLine.BaseLine->endpoints[1]->node->node, Candidate->node)) 2368 2587 && (fabs(NewNormalVector.ScalarProduct(&NewNormalVector)) > HULLEPSILON) 2369 2588 ) { 2370 2589 helper.CopyVector(&NewNormalVector); 2371 //Log() << Verbose(2) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl;2372 radius = BaseLine->endpoints[0]->node->node->DistanceSquared(&NewSphereCenter);2590 Log() << Verbose(1) << "INFO: NewNormalVector is " << NewNormalVector << "." << endl; 2591 radius = CandidateLine.BaseLine->endpoints[0]->node->node->DistanceSquared(&NewSphereCenter); 2373 2592 if (radius < RADIUS*RADIUS) { 2374 2593 helper.Scale(sqrt(RADIUS*RADIUS - radius)); 2375 //Log() << Verbose(2) << "INFO: Distance of NewCircleCenter to NewSphereCenter is " << helper.Norm() << " with sphere radius " << RADIUS << "." << endl;2594 Log() << Verbose(2) << "INFO: Distance of NewCircleCenter to NewSphereCenter is " << helper.Norm() << " with sphere radius " << RADIUS << "." << endl; 2376 2595 NewSphereCenter.AddVector(&helper); 2377 2596 NewSphereCenter.SubtractVector(&CircleCenter); 2378 //Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl;2597 Log() << Verbose(2) << "INFO: NewSphereCenter is at " << NewSphereCenter << "." << endl; 2379 2598 2380 2599 // OtherNewSphereCenter is created by the same vector just in the other direction … … 2382 2601 OtherNewSphereCenter.AddVector(&helper); 2383 2602 OtherNewSphereCenter.SubtractVector(&CircleCenter); 2384 //Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl;2603 Log() << Verbose(2) << "INFO: OtherNewSphereCenter is at " << OtherNewSphereCenter << "." << endl; 2385 2604 2386 2605 alpha = GetPathLengthonCircumCircle(CircleCenter, CirclePlaneNormal, CircleRadius, NewSphereCenter, OldSphereCenter, NormalVector, SearchDirection); … … 2389 2608 // if there is a better candidate, drop the current list and add the new candidate 2390 2609 // otherwise ignore the new candidate and keep the list 2391 if (*ShortestAngle > (alpha - HULLEPSILON)) { 2392 optCandidate = new CandidateForTesselation(Candidate, BaseLine, OptCandidateCenter, OtherOptCandidateCenter); 2610 if (CandidateLine.ShortestAngle > (alpha - HULLEPSILON)) { 2393 2611 if (fabs(alpha - Otheralpha) > MYEPSILON) { 2394 optCandidate->OptCenter.CopyVector(&NewSphereCenter);2395 optCandidate->OtherOptCenter.CopyVector(&OtherNewSphereCenter);2612 CandidateLine.OptCenter.CopyVector(&NewSphereCenter); 2613 CandidateLine.OtherOptCenter.CopyVector(&OtherNewSphereCenter); 2396 2614 } else { 2397 optCandidate->OptCenter.CopyVector(&OtherNewSphereCenter);2398 optCandidate->OtherOptCenter.CopyVector(&NewSphereCenter);2615 CandidateLine.OptCenter.CopyVector(&OtherNewSphereCenter); 2616 CandidateLine.OtherOptCenter.CopyVector(&NewSphereCenter); 2399 2617 } 2400 2618 // if there is an equal candidate, add it to the list without clearing the list 2401 if (( *ShortestAngle - HULLEPSILON) < alpha) {2402 candidates->push_back(optCandidate);2403 Log() << Verbose( 2) << "ACCEPT: We have found an equally good candidate: " << *(optCandidate->point) << " with "2404 << alpha << " and circumsphere's center at " << optCandidate->OptCenter << "." << endl;2619 if ((CandidateLine.ShortestAngle - HULLEPSILON) < alpha) { 2620 CandidateLine.pointlist.push_back(Candidate); 2621 Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with " 2622 << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl; 2405 2623 } else { 2406 2624 // remove all candidates from the list and then the list itself 2407 class CandidateForTesselation *remover = NULL; 2408 for (CandidateList::iterator it = candidates->begin(); it != candidates->end(); ++it) { 2409 remover = *it; 2410 delete(remover); 2411 } 2412 candidates->clear(); 2413 candidates->push_back(optCandidate); 2414 Log() << Verbose(2) << "ACCEPT: We have found a better candidate: " << *(optCandidate->point) << " with " 2415 << alpha << " and circumsphere's center at " << optCandidate->OptCenter << "." << endl; 2625 CandidateLine.pointlist.clear(); 2626 CandidateLine.pointlist.push_back(Candidate); 2627 Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with " 2628 << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl; 2416 2629 } 2417 *ShortestAngle = alpha;2418 //Log() << Verbose(2) << "INFO: There are " << candidates->size() << " candidates in the list now." << endl;2630 CandidateLine.ShortestAngle = alpha; 2631 Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl; 2419 2632 } else { 2420 if (( optCandidate != NULL) && (optCandidate->point != NULL)) {2421 //Log() << Verbose(2) << "REJECT: Old candidate " << *(optCandidate->point) << " with " << *ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl;2633 if ((Candidate != NULL) && (CandidateLine.pointlist.begin() != CandidateLine.pointlist.end())) { 2634 Log() << Verbose(1) << "REJECT: Old candidate " << *(Candidate) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl; 2422 2635 } else { 2423 //Log() << Verbose(2) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl;2636 Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl; 2424 2637 } 2425 2638 } 2426 2639 2427 2640 } else { 2428 //Log() << Verbose(2) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl;2641 Log() << Verbose(1) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl; 2429 2642 } 2430 2643 } else { 2431 //Log() << Verbose(2) << "REJECT: Three points from " << *BaseLine << " and Candidate " << *Candidate << " are linear-dependent." << endl;2644 Log() << Verbose(1) << "REJECT: Three points from " << *CandidateLine.BaseLine << " and Candidate " << *Candidate << " are linear-dependent." << endl; 2432 2645 } 2433 2646 } else { 2434 2647 if (ThirdNode != NULL) { 2435 //Log() << Verbose(2) << "REJECT: Base triangle " << *BaseLine << " and " << *ThirdNode << " contains Candidate " << *Candidate << "." << endl;2648 Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " and " << *ThirdNode << " contains Candidate " << *Candidate << "." << endl; 2436 2649 } else { 2437 //Log() << Verbose(2) << "REJECT: Base triangle " << *BaseLine << " contains Candidate " << *Candidate << "." << endl;2650 Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " contains Candidate " << *Candidate << "." << endl; 2438 2651 } 2439 2652 } … … 2442 2655 } 2443 2656 } else { 2444 eLog() << Verbose( 2) << "ERROR:The projected center of the old sphere has radius " << radius << " instead of " << CircleRadius << "." << endl;2657 eLog() << Verbose(1) << "The projected center of the old sphere has radius " << radius << " instead of " << CircleRadius << "." << endl; 2445 2658 } 2446 2659 } else { 2447 2660 if (ThirdNode != NULL) 2448 Log() << Verbose( 2) << "Circumcircle for base line " << *BaseLine << " and third node " << *ThirdNode << " is too big!" << endl;2661 Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and third node " << *ThirdNode << " is too big!" << endl; 2449 2662 else 2450 Log() << Verbose(2) << "Circumcircle for base line " << *BaseLine << " is too big!" << endl; 2451 } 2452 2453 //Log() << Verbose(2) << "INFO: Sorting candidate list ..." << endl; 2454 if (candidates->size() > 1) { 2455 candidates->unique(); 2456 candidates->sort(SortCandidates); 2457 } 2458 2459 Log() << Verbose(1) << "End of FindThirdPointForTesselation" << endl; 2663 Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " is too big!" << endl; 2664 } 2665 2666 Log() << Verbose(1) << "INFO: Sorting candidate list ..." << endl; 2667 if (CandidateLine.pointlist.size() > 1) { 2668 CandidateLine.pointlist.unique(); 2669 CandidateLine.pointlist.sort(); //SortCandidates); 2670 } 2460 2671 }; 2461 2672 … … 2467 2678 class BoundaryPointSet *Tesselation::GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const 2468 2679 { 2680 Info FunctionInfo(__func__); 2469 2681 const BoundaryLineSet * lines[2] = { line1, line2 }; 2470 2682 class BoundaryPointSet *node = NULL; … … 2480 2692 { // if insertion fails, we have common endpoint 2481 2693 node = OrderTest.first->second; 2482 Log() << Verbose( 5) << "Common endpoint of lines " << *line12694 Log() << Verbose(1) << "Common endpoint of lines " << *line1 2483 2695 << " and " << *line2 << " is: " << *node << "." << endl; 2484 2696 j = 2; … … 2497 2709 list<BoundaryTriangleSet*> * Tesselation::FindClosestTrianglesToPoint(const Vector *x, const LinkedCell* LC) const 2498 2710 { 2711 Info FunctionInfo(__func__); 2499 2712 TesselPoint *trianglePoints[3]; 2500 2713 TesselPoint *SecondPoint = NULL; … … 2502 2715 2503 2716 if (LinesOnBoundary.empty()) { 2504 Log() << Verbose(0) << "Error: There is no tesselation structure to compare the point with, please create one first.";2717 eLog() << Verbose(1) << "Error: There is no tesselation structure to compare the point with, please create one first."; 2505 2718 return NULL; 2506 2719 } … … 2510 2723 // check whether closest point is "too close" :), then it's inside 2511 2724 if (trianglePoints[0] == NULL) { 2512 Log() << Verbose( 2) << "Is the only point, no one else is closeby." << endl;2725 Log() << Verbose(0) << "Is the only point, no one else is closeby." << endl; 2513 2726 return NULL; 2514 2727 } 2515 2728 if (trianglePoints[0]->node->DistanceSquared(x) < MYEPSILON) { 2516 Log() << Verbose( 3) << "Point is right on a tesselation point, no nearest triangle." << endl;2729 Log() << Verbose(1) << "Point is right on a tesselation point, no nearest triangle." << endl; 2517 2730 PointMap::const_iterator PointRunner = PointsOnBoundary.find(trianglePoints[0]->nr); 2518 2731 triangles = new list<BoundaryTriangleSet*>; … … 2533 2746 triangles->unique(); 2534 2747 } else { 2535 Log() << Verbose(1) << "ERROR:I cannot find a boundary point to the tessel point " << *trianglePoints[0] << "." << endl;2748 eLog() << Verbose(1) << "I cannot find a boundary point to the tessel point " << *trianglePoints[0] << "." << endl; 2536 2749 return NULL; 2537 2750 } 2538 2751 } 2539 2752 } else { 2540 list<TesselPoint*> *connectedClosestPoints = GetCircleOfConnectedPoints(trianglePoints[0], x); 2753 set<TesselPoint*> *connectedPoints = GetAllConnectedPoints(trianglePoints[0]); 2754 TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(connectedPoints, trianglePoints[0], x); 2755 delete(connectedPoints); 2541 2756 if (connectedClosestPoints != NULL) { 2542 2757 trianglePoints[1] = connectedClosestPoints->front(); … … 2544 2759 for (int i=0;i<3;i++) { 2545 2760 if (trianglePoints[i] == NULL) { 2546 Log() << Verbose(1) << "ERROR:IsInnerPoint encounters serious error, point " << i << " not found." << endl;2761 eLog() << Verbose(1) << "IsInnerPoint encounters serious error, point " << i << " not found." << endl; 2547 2762 } 2548 //Log() << Verbose( 2) << "List of triangle points:" << endl;2549 //Log() << Verbose( 3) << *trianglePoints[i] << endl;2763 //Log() << Verbose(1) << "List of triangle points:" << endl; 2764 //Log() << Verbose(2) << *trianglePoints[i] << endl; 2550 2765 } 2551 2766 2552 2767 triangles = FindTriangles(trianglePoints); 2553 Log() << Verbose( 2) << "List of possible triangles:" << endl;2768 Log() << Verbose(1) << "List of possible triangles:" << endl; 2554 2769 for(list<BoundaryTriangleSet*>::iterator Runner = triangles->begin(); Runner != triangles->end(); Runner++) 2555 Log() << Verbose( 3) << **Runner << endl;2770 Log() << Verbose(2) << **Runner << endl; 2556 2771 2557 2772 delete(connectedClosestPoints); 2558 2773 } else { 2559 2774 triangles = NULL; 2560 Log() << Verbose(1) << "There is no circle of connected points!" << endl;2775 eLog() << Verbose(2) << "There is no circle of connected points!" << endl; 2561 2776 } 2562 2777 } 2563 2778 2564 2779 if ((triangles == NULL) || (triangles->empty())) { 2565 Log() << Verbose(0) << "ERROR:There is no nearest triangle. Please check the tesselation structure.";2780 eLog() << Verbose(1) << "There is no nearest triangle. Please check the tesselation structure."; 2566 2781 delete(triangles); 2567 2782 return NULL; … … 2578 2793 class BoundaryTriangleSet * Tesselation::FindClosestTriangleToPoint(const Vector *x, const LinkedCell* LC) const 2579 2794 { 2795 Info FunctionInfo(__func__); 2580 2796 class BoundaryTriangleSet *result = NULL; 2581 2797 list<BoundaryTriangleSet*> *triangles = FindClosestTrianglesToPoint(x, LC); … … 2587 2803 if (triangles->size() == 1) { // there is no degenerate case 2588 2804 result = triangles->front(); 2589 Log() << Verbose( 2) << "Normal Vector of this triangle is " << result->NormalVector << "." << endl;2805 Log() << Verbose(1) << "Normal Vector of this triangle is " << result->NormalVector << "." << endl; 2590 2806 } else { 2591 2807 result = triangles->front(); 2592 2808 result->GetCenter(&Center); 2593 2809 Center.SubtractVector(x); 2594 Log() << Verbose( 2) << "Normal Vector of this front side is " << result->NormalVector << "." << endl;2810 Log() << Verbose(1) << "Normal Vector of this front side is " << result->NormalVector << "." << endl; 2595 2811 if (Center.ScalarProduct(&result->NormalVector) < 0) { 2596 2812 result = triangles->back(); 2597 Log() << Verbose( 2) << "Normal Vector of this back side is " << result->NormalVector << "." << endl;2813 Log() << Verbose(1) << "Normal Vector of this back side is " << result->NormalVector << "." << endl; 2598 2814 if (Center.ScalarProduct(&result->NormalVector) < 0) { 2599 Log() << Verbose(1) << "ERROR:Front and back side yield NormalVector in wrong direction!" << endl;2815 eLog() << Verbose(1) << "Front and back side yield NormalVector in wrong direction!" << endl; 2600 2816 } 2601 2817 } … … 2614 2830 bool Tesselation::IsInnerPoint(const Vector &Point, const LinkedCell* const LC) const 2615 2831 { 2832 Info FunctionInfo(__func__); 2616 2833 class BoundaryTriangleSet *result = FindClosestTriangleToPoint(&Point, LC); 2617 2834 Vector Center; … … 2623 2840 2624 2841 result->GetCenter(&Center); 2625 Log() << Verbose( 3) << "INFO: Central point of the triangle is " << Center << "." << endl;2842 Log() << Verbose(2) << "INFO: Central point of the triangle is " << Center << "." << endl; 2626 2843 Center.SubtractVector(&Point); 2627 Log() << Verbose( 3) << "INFO: Vector from center to point to test is " << Center << "." << endl;2844 Log() << Verbose(2) << "INFO: Vector from center to point to test is " << Center << "." << endl; 2628 2845 if (Center.ScalarProduct(&result->NormalVector) > -MYEPSILON) { 2629 2846 Log() << Verbose(1) << Point << " is an inner point." << endl; … … 2644 2861 bool Tesselation::IsInnerPoint(const TesselPoint * const Point, const LinkedCell* const LC) const 2645 2862 { 2863 Info FunctionInfo(__func__); 2646 2864 return IsInnerPoint(*(Point->node), LC); 2647 2865 } … … 2655 2873 set<TesselPoint*> * Tesselation::GetAllConnectedPoints(const TesselPoint* const Point) const 2656 2874 { 2875 Info FunctionInfo(__func__); 2657 2876 set<TesselPoint*> *connectedPoints = new set<TesselPoint*>; 2658 2877 class BoundaryPointSet *ReferencePoint = NULL; 2659 2878 TesselPoint* current; 2660 2879 bool takePoint = false; 2661 2662 Log() << Verbose(3) << "Begin of GetAllConnectedPoints" << endl;2663 2880 2664 2881 // find the respective boundary point … … 2667 2884 ReferencePoint = PointRunner->second; 2668 2885 } else { 2669 Log() << Verbose(2) << "GetAllConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl;2886 eLog() << Verbose(2) << "GetAllConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl; 2670 2887 ReferencePoint = NULL; 2671 2888 } … … 2691 2908 2692 2909 if (takePoint) { 2693 Log() << Verbose( 5) << "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted." << endl;2910 Log() << Verbose(1) << "INFO: Endpoint " << *current << " of line " << *(findLines->second) << " is enlisted." << endl; 2694 2911 connectedPoints->insert(current); 2695 2912 } … … 2699 2916 2700 2917 if (connectedPoints->size() == 0) { // if have not found any points 2701 Log() << Verbose(1) << "ERROR:We have not found any connected points to " << *Point<< "." << endl;2918 eLog() << Verbose(1) << "We have not found any connected points to " << *Point<< "." << endl; 2702 2919 return NULL; 2703 2920 } 2704 2921 2705 Log() << Verbose(3) << "End of GetAllConnectedPoints" << endl;2706 2922 return connectedPoints; 2707 2923 }; … … 2715 2931 * 2716 2932 * @param *out output stream for debugging 2933 * @param *SetOfNeighbours all points for which the angle should be calculated 2717 2934 * @param *Point of which get all connected points 2718 2935 * @param *Reference Reference vector for zero angle or NULL for no preference 2719 2936 * @return list of the all points linked to the provided one 2720 2937 */ 2721 list<TesselPoint*> * Tesselation::GetCircleOfConnectedPoints(const TesselPoint* const Point, const Vector * const Reference) const 2722 { 2938 list<TesselPoint*> * Tesselation::GetCircleOfSetOfPoints(set<TesselPoint*> *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference) const 2939 { 2940 Info FunctionInfo(__func__); 2723 2941 map<double, TesselPoint*> anglesOfPoints; 2724 set<TesselPoint*> *connectedPoints = GetAllConnectedPoints(Point);2725 2942 list<TesselPoint*> *connectedCircle = new list<TesselPoint*>; 2726 2943 Vector center; … … 2730 2947 Vector helper; 2731 2948 2732 if ( connectedPoints == NULL) {2733 Log() << Verbose(2) << "Could not find any connected points!" << endl;2949 if (SetOfNeighbours == NULL) { 2950 eLog() << Verbose(2) << "Could not find any connected points!" << endl; 2734 2951 delete(connectedCircle); 2735 2952 return NULL; 2736 2953 } 2737 Log() << Verbose(2) << "Begin of GetCircleOfConnectedPoints" << endl;2738 2954 2739 2955 // calculate central point 2740 for (set<TesselPoint*>::const_iterator TesselRunner = connectedPoints->begin(); TesselRunner != connectedPoints->end(); TesselRunner++)2956 for (set<TesselPoint*>::const_iterator TesselRunner = SetOfNeighbours->begin(); TesselRunner != SetOfNeighbours->end(); TesselRunner++) 2741 2957 center.AddVector((*TesselRunner)->node); 2742 2958 //Log() << Verbose(0) << "Summed vectors " << center << "; number of points " << connectedPoints.size() 2743 2959 // << "; scale factor " << 1.0/connectedPoints.size(); 2744 center.Scale(1.0/ connectedPoints->size());2745 Log() << Verbose( 4) << "INFO: Calculated center of all circle points is " << center << "." << endl;2960 center.Scale(1.0/SetOfNeighbours->size()); 2961 Log() << Verbose(1) << "INFO: Calculated center of all circle points is " << center << "." << endl; 2746 2962 2747 2963 // projection plane of the circle is at the closes Point and normal is pointing away from center of all circle points … … 2749 2965 PlaneNormal.SubtractVector(¢er); 2750 2966 PlaneNormal.Normalize(); 2751 Log() << Verbose( 4) << "INFO: Calculated plane normal of circle is " << PlaneNormal << "." << endl;2967 Log() << Verbose(1) << "INFO: Calculated plane normal of circle is " << PlaneNormal << "." << endl; 2752 2968 2753 2969 // construct one orthogonal vector … … 2758 2974 } 2759 2975 if ((Reference == NULL) || (AngleZero.NormSquared() < MYEPSILON )) { 2760 Log() << Verbose( 4) << "Using alternatively " << *(*connectedPoints->begin())->node << " as angle 0 referencer." << endl;2761 AngleZero.CopyVector((* connectedPoints->begin())->node);2976 Log() << Verbose(1) << "Using alternatively " << *(*SetOfNeighbours->begin())->node << " as angle 0 referencer." << endl; 2977 AngleZero.CopyVector((*SetOfNeighbours->begin())->node); 2762 2978 AngleZero.SubtractVector(Point->node); 2763 2979 AngleZero.ProjectOntoPlane(&PlaneNormal); … … 2767 2983 } 2768 2984 } 2769 Log() << Verbose( 4) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl;2985 Log() << Verbose(1) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl; 2770 2986 if (AngleZero.NormSquared() > MYEPSILON) 2771 2987 OrthogonalVector.MakeNormalVector(&PlaneNormal, &AngleZero); 2772 2988 else 2773 2989 OrthogonalVector.MakeNormalVector(&PlaneNormal); 2774 Log() << Verbose( 4) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl;2990 Log() << Verbose(1) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl; 2775 2991 2776 2992 // go through all connected points and calculate angle 2777 for (set<TesselPoint*>::iterator listRunner = connectedPoints->begin(); listRunner != connectedPoints->end(); listRunner++) {2993 for (set<TesselPoint*>::iterator listRunner = SetOfNeighbours->begin(); listRunner != SetOfNeighbours->end(); listRunner++) { 2778 2994 helper.CopyVector((*listRunner)->node); 2779 2995 helper.SubtractVector(Point->node); 2780 2996 helper.ProjectOntoPlane(&PlaneNormal); 2781 2997 double angle = GetAngle(helper, AngleZero, OrthogonalVector); 2782 Log() << Verbose( 3) << "INFO: Calculated angle is " << angle << " for point " << **listRunner << "." << endl;2998 Log() << Verbose(0) << "INFO: Calculated angle is " << angle << " for point " << **listRunner << "." << endl; 2783 2999 anglesOfPoints.insert(pair<double, TesselPoint*>(angle, (*listRunner))); 2784 3000 } … … 2787 3003 connectedCircle->push_back(AngleRunner->second); 2788 3004 } 2789 2790 delete(connectedPoints);2791 2792 Log() << Verbose(2) << "End of GetCircleOfConnectedPoints" << endl;2793 3005 2794 3006 return connectedCircle; … … 2803 3015 list<list<TesselPoint*> *> * Tesselation::GetPathsOfConnectedPoints(const TesselPoint* const Point) const 2804 3016 { 3017 Info FunctionInfo(__func__); 2805 3018 map<double, TesselPoint*> anglesOfPoints; 2806 3019 list<list<TesselPoint*> *> *ListOfPaths = new list<list<TesselPoint*> *>; … … 2822 3035 ReferencePoint = PointRunner->second; 2823 3036 } else { 2824 Log() << Verbose(2) << "ERROR:GetPathOfConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl;3037 eLog() << Verbose(1) << "GetPathOfConnectedPoints() could not find the BoundaryPoint belonging to " << *Point << "." << endl; 2825 3038 return NULL; 2826 3039 } … … 2839 3052 LineRunner = TouchedLine.find(runner->second); 2840 3053 if (LineRunner == TouchedLine.end()) { 2841 Log() << Verbose(2) << "ERROR:I could not find " << *runner->second << " in the touched list." << endl;3054 eLog() << Verbose(1) << "I could not find " << *runner->second << " in the touched list." << endl; 2842 3055 } else if (!LineRunner->second) { 2843 3056 LineRunner->second = true; … … 2847 3060 StartLine = CurrentLine; 2848 3061 CurrentPoint = CurrentLine->GetOtherEndpoint(ReferencePoint); 2849 Log() << Verbose( 3)<< "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "." << endl;3062 Log() << Verbose(1)<< "INFO: Beginning path retrieval at " << *CurrentPoint << " of line " << *CurrentLine << "." << endl; 2850 3063 do { 2851 3064 // push current one 2852 Log() << Verbose( 3) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;3065 Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl; 2853 3066 connectedPath->push_back(CurrentPoint->node); 2854 3067 2855 3068 // find next triangle 2856 3069 for (TriangleMap::iterator Runner = CurrentLine->triangles.begin(); Runner != CurrentLine->triangles.end(); Runner++) { 2857 Log() << Verbose( 3) << "INFO: Inspecting triangle " << *Runner->second << "." << endl;3070 Log() << Verbose(1) << "INFO: Inspecting triangle " << *Runner->second << "." << endl; 2858 3071 if ((Runner->second != triangle)) { // look for first triangle not equal to old one 2859 3072 triangle = Runner->second; … … 2862 3075 if (!TriangleRunner->second) { 2863 3076 TriangleRunner->second = true; 2864 Log() << Verbose( 3) << "INFO: Connecting triangle is " << *triangle << "." << endl;3077 Log() << Verbose(1) << "INFO: Connecting triangle is " << *triangle << "." << endl; 2865 3078 break; 2866 3079 } else { 2867 Log() << Verbose( 3) << "INFO: Skipping " << *triangle << ", as we have already visited it." << endl;3080 Log() << Verbose(1) << "INFO: Skipping " << *triangle << ", as we have already visited it." << endl; 2868 3081 triangle = NULL; 2869 3082 } 2870 3083 } else { 2871 Log() << Verbose(2) << "ERROR:I could not find " << *triangle << " in the touched list." << endl;3084 eLog() << Verbose(1) << "I could not find " << *triangle << " in the touched list." << endl; 2872 3085 triangle = NULL; 2873 3086 } … … 2880 3093 if ((triangle->lines[i] != CurrentLine) && (triangle->lines[i]->ContainsBoundaryPoint(ReferencePoint))) { // not the current line and still containing Point 2881 3094 CurrentLine = triangle->lines[i]; 2882 Log() << Verbose( 3) << "INFO: Connecting line is " << *CurrentLine << "." << endl;3095 Log() << Verbose(1) << "INFO: Connecting line is " << *CurrentLine << "." << endl; 2883 3096 break; 2884 3097 } … … 2886 3099 LineRunner = TouchedLine.find(CurrentLine); 2887 3100 if (LineRunner == TouchedLine.end()) 2888 Log() << Verbose(2) << "ERROR:I could not find " << *CurrentLine << " in the touched list." << endl;3101 eLog() << Verbose(1) << "I could not find " << *CurrentLine << " in the touched list." << endl; 2889 3102 else 2890 3103 LineRunner->second = true; … … 2894 3107 } while (CurrentLine != StartLine); 2895 3108 // last point is missing, as it's on start line 2896 Log() << Verbose( 3) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl;3109 Log() << Verbose(1) << "INFO: Putting " << *CurrentPoint << " at end of path." << endl; 2897 3110 if (StartLine->GetOtherEndpoint(ReferencePoint)->node != connectedPath->back()) 2898 3111 connectedPath->push_back(StartLine->GetOtherEndpoint(ReferencePoint)->node); … … 2900 3113 ListOfPaths->push_back(connectedPath); 2901 3114 } else { 2902 Log() << Verbose( 3) << "INFO: Skipping " << *runner->second << ", as we have already visited it." << endl;3115 Log() << Verbose(1) << "INFO: Skipping " << *runner->second << ", as we have already visited it." << endl; 2903 3116 } 2904 3117 } 2905 3118 } else { 2906 Log() << Verbose(1) << "ERROR:There are no lines attached to " << *ReferencePoint << "." << endl;3119 eLog() << Verbose(1) << "There are no lines attached to " << *ReferencePoint << "." << endl; 2907 3120 } 2908 3121 … … 2918 3131 list<list<TesselPoint*> *> * Tesselation::GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const 2919 3132 { 3133 Info FunctionInfo(__func__); 2920 3134 list<list<TesselPoint*> *> *ListofPaths = GetPathsOfConnectedPoints(Point); 2921 3135 list<list<TesselPoint*> *> *ListofClosedPaths = new list<list<TesselPoint*> *>; … … 2931 3145 connectedPath = *ListRunner; 2932 3146 2933 Log() << Verbose( 2) << "INFO: Current path is " << connectedPath << "." << endl;3147 Log() << Verbose(1) << "INFO: Current path is " << connectedPath << "." << endl; 2934 3148 2935 3149 // go through list, look for reappearance of starting Point and count … … 2941 3155 if ((*CircleRunner == *CircleStart) && (CircleRunner != CircleStart)) { // is not the very first point 2942 3156 // we have a closed circle from Marker to new Marker 2943 Log() << Verbose( 3) << count+1 << ". closed path consists of: ";3157 Log() << Verbose(1) << count+1 << ". closed path consists of: "; 2944 3158 newPath = new list<TesselPoint*>; 2945 3159 list<TesselPoint*>::iterator CircleSprinter = Marker; … … 2957 3171 } 2958 3172 } 2959 Log() << Verbose( 3) << "INFO: " << count << " closed additional path(s) have been created." << endl;3173 Log() << Verbose(1) << "INFO: " << count << " closed additional path(s) have been created." << endl; 2960 3174 2961 3175 // delete list of paths … … 2979 3193 set<BoundaryTriangleSet*> *Tesselation::GetAllTriangles(const BoundaryPointSet * const Point) const 2980 3194 { 3195 Info FunctionInfo(__func__); 2981 3196 set<BoundaryTriangleSet*> *connectedTriangles = new set<BoundaryTriangleSet*>; 2982 3197 2983 3198 if (Point == NULL) { 2984 Log() << Verbose(1) << "ERROR:Point given is NULL." << endl;3199 eLog() << Verbose(1) << "Point given is NULL." << endl; 2985 3200 } else { 2986 3201 // go through its lines and insert all triangles … … 3014 3229 3015 3230 if (point == NULL) { 3016 Log() << Verbose(1) << "ERROR:Cannot remove the point " << point << ", it's NULL!" << endl;3231 eLog() << Verbose(1) << "Cannot remove the point " << point << ", it's NULL!" << endl; 3017 3232 return 0.; 3018 3233 } else 3019 Log() << Verbose( 2) << "Removing point " << *point << " from tesselated boundary ..." << endl;3234 Log() << Verbose(0) << "Removing point " << *point << " from tesselated boundary ..." << endl; 3020 3235 3021 3236 // copy old location for the volume … … 3024 3239 // get list of connected points 3025 3240 if (point->lines.empty()) { 3026 Log() << Verbose(1) << "ERROR:Cannot remove the point " << *point << ", it's connected to no lines!" << endl;3241 eLog() << Verbose(1) << "Cannot remove the point " << *point << ", it's connected to no lines!" << endl; 3027 3242 return 0.; 3028 3243 } … … 3047 3262 NormalVector.Zero(); 3048 3263 for (map<class BoundaryTriangleSet *, int>::iterator Runner = Candidates.begin(); Runner != Candidates.end(); Runner++) { 3049 Log() << Verbose( 3) << "INFO: Removing triangle " << *(Runner->first) << "." << endl;3264 Log() << Verbose(1) << "INFO: Removing triangle " << *(Runner->first) << "." << endl; 3050 3265 NormalVector.SubtractVector(&Runner->first->NormalVector); // has to point inward 3051 3266 RemoveTesselationTriangle(Runner->first); … … 3077 3292 smallestangle = 0.; 3078 3293 for (MiddleNode = connectedPath->begin(); MiddleNode != connectedPath->end(); MiddleNode++) { 3079 Log() << Verbose( 3) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;3294 Log() << Verbose(1) << "INFO: MiddleNode is " << **MiddleNode << "." << endl; 3080 3295 // construct vectors to next and previous neighbour 3081 3296 StartNode = MiddleNode; … … 3105 3320 MiddleNode = EndNode; 3106 3321 if (MiddleNode == connectedPath->end()) { 3107 Log() << Verbose(1) << "CRITICAL: Could not find a smallest angle!" << endl;3108 exit(255);3322 eLog() << Verbose(0) << "CRITICAL: Could not find a smallest angle!" << endl; 3323 performCriticalExit(); 3109 3324 } 3110 3325 StartNode = MiddleNode; … … 3115 3330 if (EndNode == connectedPath->end()) 3116 3331 EndNode = connectedPath->begin(); 3117 Log() << Verbose( 4) << "INFO: StartNode is " << **StartNode << "." << endl;3118 Log() << Verbose( 4) << "INFO: MiddleNode is " << **MiddleNode << "." << endl;3119 Log() << Verbose( 4) << "INFO: EndNode is " << **EndNode << "." << endl;3120 Log() << Verbose( 3) << "INFO: Attempting to create triangle " << (*StartNode)->Name << ", " << (*MiddleNode)->Name << " and " << (*EndNode)->Name << "." << endl;3332 Log() << Verbose(2) << "INFO: StartNode is " << **StartNode << "." << endl; 3333 Log() << Verbose(2) << "INFO: MiddleNode is " << **MiddleNode << "." << endl; 3334 Log() << Verbose(2) << "INFO: EndNode is " << **EndNode << "." << endl; 3335 Log() << Verbose(1) << "INFO: Attempting to create triangle " << (*StartNode)->Name << ", " << (*MiddleNode)->Name << " and " << (*EndNode)->Name << "." << endl; 3121 3336 TriangleCandidates[0] = *StartNode; 3122 3337 TriangleCandidates[1] = *MiddleNode; … … 3124 3339 triangle = GetPresentTriangle(TriangleCandidates); 3125 3340 if (triangle != NULL) { 3126 Log() << Verbose(1) << "WARNING:New triangle already present, skipping!" << endl;3341 eLog() << Verbose(0) << "New triangle already present, skipping!" << endl; 3127 3342 StartNode++; 3128 3343 MiddleNode++; … … 3136 3351 continue; 3137 3352 } 3138 Log() << Verbose( 5) << "Adding new triangle points."<< endl;3353 Log() << Verbose(3) << "Adding new triangle points."<< endl; 3139 3354 AddTesselationPoint(*StartNode, 0); 3140 3355 AddTesselationPoint(*MiddleNode, 1); 3141 3356 AddTesselationPoint(*EndNode, 2); 3142 Log() << Verbose( 5) << "Adding new triangle lines."<< endl;3357 Log() << Verbose(3) << "Adding new triangle lines."<< endl; 3143 3358 AddTesselationLine(TPS[0], TPS[1], 0); 3144 3359 AddTesselationLine(TPS[0], TPS[2], 1); … … 3155 3370 // prepare nodes for next triangle 3156 3371 StartNode = EndNode; 3157 Log() << Verbose( 4) << "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "." << endl;3372 Log() << Verbose(2) << "Removing " << **MiddleNode << " from closed path, remaining points: " << connectedPath->size() << "." << endl; 3158 3373 connectedPath->remove(*MiddleNode); // remove the middle node (it is surrounded by triangles) 3159 3374 if (connectedPath->size() == 2) { // we are done … … 3162 3377 break; 3163 3378 } else if (connectedPath->size() < 2) { // something's gone wrong! 3164 Log() << Verbose(1) << "CRITICAL: There are only two endpoints left!" << endl;3165 exit(255);3379 eLog() << Verbose(0) << "CRITICAL: There are only two endpoints left!" << endl; 3380 performCriticalExit(); 3166 3381 } else { 3167 3382 MiddleNode = StartNode; … … 3191 3406 if (maxgain != 0) { 3192 3407 volume += maxgain; 3193 Log() << Verbose( 3) << "Flipping baseline with highest volume" << **Candidate << "." << endl;3408 Log() << Verbose(1) << "Flipping baseline with highest volume" << **Candidate << "." << endl; 3194 3409 OtherBase = FlipBaseline(*Candidate); 3195 3410 NewLines.erase(Candidate); … … 3202 3417 delete(connectedPath); 3203 3418 } 3204 Log() << Verbose( 1) << count << " triangles were created." << endl;3419 Log() << Verbose(0) << count << " triangles were created." << endl; 3205 3420 } else { 3206 3421 while (!ListOfClosedPaths->empty()) { … … 3210 3425 delete(connectedPath); 3211 3426 } 3212 Log() << Verbose( 1) << "No need to create any triangles." << endl;3427 Log() << Verbose(0) << "No need to create any triangles." << endl; 3213 3428 } 3214 3429 delete(ListOfClosedPaths); 3215 3430 3216 Log() << Verbose( 1) << "Removed volume is " << volume << "." << endl;3431 Log() << Verbose(0) << "Removed volume is " << volume << "." << endl; 3217 3432 3218 3433 return volume; … … 3231 3446 list<BoundaryTriangleSet*> *Tesselation::FindTriangles(const TesselPoint* const Points[3]) const 3232 3447 { 3448 Info FunctionInfo(__func__); 3233 3449 list<BoundaryTriangleSet*> *result = new list<BoundaryTriangleSet*>; 3234 3450 LineMap::const_iterator FindLine; … … 3279 3495 map<int, int> * Tesselation::FindAllDegeneratedLines() 3280 3496 { 3497 Info FunctionInfo(__func__); 3281 3498 map<int, class BoundaryLineSet *> AllLines; 3282 3499 map<int, int> * DegeneratedLines = new map<int, int>; … … 3284 3501 // sanity check 3285 3502 if (LinesOnBoundary.empty()) { 3286 Log() << Verbose(1) << "Warning:FindAllDegeneratedTriangles() was called without any tesselation structure.";3503 eLog() << Verbose(2) << "FindAllDegeneratedTriangles() was called without any tesselation structure."; 3287 3504 return DegeneratedLines; 3288 3505 } … … 3300 3517 AllLines.clear(); 3301 3518 3302 Log() << Verbose( 1) << "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines." << endl;3519 Log() << Verbose(0) << "FindAllDegeneratedLines() found " << DegeneratedLines->size() << " lines." << endl; 3303 3520 map<int,int>::iterator it; 3304 3521 for (it = DegeneratedLines->begin(); it != DegeneratedLines->end(); it++) 3305 Log() << Verbose( 2) << (*it).first << " => " << (*it).second << endl;3522 Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl; 3306 3523 3307 3524 return DegeneratedLines; … … 3316 3533 map<int, int> * Tesselation::FindAllDegeneratedTriangles() 3317 3534 { 3535 Info FunctionInfo(__func__); 3318 3536 map<int, int> * DegeneratedLines = FindAllDegeneratedLines(); 3319 3537 map<int, int> * DegeneratedTriangles = new map<int, int>; … … 3343 3561 delete(DegeneratedLines); 3344 3562 3345 Log() << Verbose( 1) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl;3563 Log() << Verbose(0) << "FindAllDegeneratedTriangles() found " << DegeneratedTriangles->size() << " triangles:" << endl; 3346 3564 map<int,int>::iterator it; 3347 3565 for (it = DegeneratedTriangles->begin(); it != DegeneratedTriangles->end(); it++) 3348 Log() << Verbose( 2) << (*it).first << " => " << (*it).second << endl;3566 Log() << Verbose(0) << (*it).first << " => " << (*it).second << endl; 3349 3567 3350 3568 return DegeneratedTriangles; … … 3357 3575 void Tesselation::RemoveDegeneratedTriangles() 3358 3576 { 3577 Info FunctionInfo(__func__); 3359 3578 map<int, int> * DegeneratedTriangles = FindAllDegeneratedTriangles(); 3360 3579 TriangleMap::iterator finder; 3361 3580 BoundaryTriangleSet *triangle = NULL, *partnerTriangle = NULL; 3362 3581 int count = 0; 3363 3364 Log() << Verbose(1) << "Begin of RemoveDegeneratedTriangles" << endl;3365 3582 3366 3583 for (map<int, int>::iterator TriangleKeyRunner = DegeneratedTriangles->begin(); … … 3421 3638 // erase the pair 3422 3639 count += (int) DegeneratedTriangles->erase(triangle->Nr); 3423 Log() << Verbose( 1) << "RemoveDegeneratedTriangles() removes triangle " << *triangle << "." << endl;3640 Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *triangle << "." << endl; 3424 3641 RemoveTesselationTriangle(triangle); 3425 3642 count += (int) DegeneratedTriangles->erase(partnerTriangle->Nr); 3426 Log() << Verbose( 1) << "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "." << endl;3643 Log() << Verbose(0) << "RemoveDegeneratedTriangles() removes triangle " << *partnerTriangle << "." << endl; 3427 3644 RemoveTesselationTriangle(partnerTriangle); 3428 3645 } else { 3429 Log() << Verbose( 1) << "RemoveDegeneratedTriangles() does not remove triangle " << *triangle3646 Log() << Verbose(0) << "RemoveDegeneratedTriangles() does not remove triangle " << *triangle 3430 3647 << " and its partner " << *partnerTriangle << " because it is essential for at" 3431 3648 << " least one of the endpoints to be kept in the tesselation structure." << endl; … … 3433 3650 } 3434 3651 delete(DegeneratedTriangles); 3435 3436 Log() << Verbose(1) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl; 3437 Log() << Verbose(1) << "End of RemoveDegeneratedTriangles" << endl; 3652 if (count > 0) 3653 LastTriangle = NULL; 3654 3655 Log() << Verbose(0) << "RemoveDegeneratedTriangles() removed " << count << " triangles:" << endl; 3438 3656 } 3439 3657 … … 3448 3666 void Tesselation::AddBoundaryPointByDegeneratedTriangle(class TesselPoint *point, LinkedCell *LC) 3449 3667 { 3450 Log() << Verbose(2) << "Begin of AddBoundaryPointByDegeneratedTriangle" << endl; 3451 3668 Info FunctionInfo(__func__); 3452 3669 // find nearest boundary point 3453 3670 class TesselPoint *BackupPoint = NULL; … … 3462 3679 NearestBoundaryPoint = PointRunner->second; 3463 3680 } else { 3464 Log() << Verbose(1) << "ERROR:I cannot find the boundary point." << endl;3681 eLog() << Verbose(1) << "I cannot find the boundary point." << endl; 3465 3682 return; 3466 3683 } 3467 Log() << Verbose( 2) << "Nearest point on boundary is " << NearestPoint->Name << "." << endl;3684 Log() << Verbose(0) << "Nearest point on boundary is " << NearestPoint->Name << "." << endl; 3468 3685 3469 3686 // go through its lines and find the best one to split … … 3498 3715 3499 3716 // create new triangle to connect point (connects automatically with the missing spot of the chosen line) 3500 Log() << Verbose( 5) << "Adding new triangle points."<< endl;3717 Log() << Verbose(2) << "Adding new triangle points."<< endl; 3501 3718 AddTesselationPoint((BestLine->endpoints[0]->node), 0); 3502 3719 AddTesselationPoint((BestLine->endpoints[1]->node), 1); 3503 3720 AddTesselationPoint(point, 2); 3504 Log() << Verbose( 5) << "Adding new triangle lines."<< endl;3721 Log() << Verbose(2) << "Adding new triangle lines."<< endl; 3505 3722 AddTesselationLine(TPS[0], TPS[1], 0); 3506 3723 AddTesselationLine(TPS[0], TPS[2], 1); … … 3509 3726 BTS->GetNormalVector(TempTriangle->NormalVector); 3510 3727 BTS->NormalVector.Scale(-1.); 3511 Log() << Verbose( 3) << "INFO: NormalVector of new triangle is " << BTS->NormalVector << "." << endl;3728 Log() << Verbose(1) << "INFO: NormalVector of new triangle is " << BTS->NormalVector << "." << endl; 3512 3729 AddTesselationTriangle(); 3513 3730 3514 3731 // create other side of this triangle and close both new sides of the first created triangle 3515 Log() << Verbose( 5) << "Adding new triangle points."<< endl;3732 Log() << Verbose(2) << "Adding new triangle points."<< endl; 3516 3733 AddTesselationPoint((BestLine->endpoints[0]->node), 0); 3517 3734 AddTesselationPoint((BestLine->endpoints[1]->node), 1); 3518 3735 AddTesselationPoint(point, 2); 3519 Log() << Verbose( 5) << "Adding new triangle lines."<< endl;3736 Log() << Verbose(2) << "Adding new triangle lines."<< endl; 3520 3737 AddTesselationLine(TPS[0], TPS[1], 0); 3521 3738 AddTesselationLine(TPS[0], TPS[2], 1); … … 3523 3740 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 3524 3741 BTS->GetNormalVector(TempTriangle->NormalVector); 3525 Log() << Verbose( 3) << "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "." << endl;3742 Log() << Verbose(1) << "INFO: NormalVector of other new triangle is " << BTS->NormalVector << "." << endl; 3526 3743 AddTesselationTriangle(); 3527 3744 … … 3530 3747 if ((BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[0])) && (BTS->lines[i]->ContainsBoundaryPoint(BestLine->endpoints[1]))) { 3531 3748 if (BestLine == BTS->lines[i]){ 3532 Log() << Verbose(1) << "CRITICAL:BestLine is same as found line, something's wrong here!" << endl;3533 exit(255);3749 eLog() << Verbose(0) << "BestLine is same as found line, something's wrong here!" << endl; 3750 performCriticalExit(); 3534 3751 } 3535 3752 BTS->lines[i]->triangles.insert( pair<int, class BoundaryTriangleSet *> (TempTriangle->Nr, TempTriangle) ); … … 3538 3755 } 3539 3756 } 3540 3541 // exit3542 Log() << Verbose(2) << "End of AddBoundaryPointByDegeneratedTriangle" << endl;3543 3757 }; 3544 3758 … … 3550 3764 void Tesselation::Output(const char *filename, const PointCloud * const cloud) 3551 3765 { 3766 Info FunctionInfo(__func__); 3552 3767 ofstream *tempstream = NULL; 3553 3768 string NameofTempFile; … … 3562 3777 NameofTempFile.erase(npos, 1); 3563 3778 NameofTempFile.append(TecplotSuffix); 3564 Log() << Verbose( 1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";3779 Log() << Verbose(0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n"; 3565 3780 tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc); 3566 3781 WriteTecplotFile(tempstream, this, cloud, TriangleFilesWritten); … … 3576 3791 NameofTempFile.erase(npos, 1); 3577 3792 NameofTempFile.append(Raster3DSuffix); 3578 Log() << Verbose( 1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";3793 Log() << Verbose(0) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n"; 3579 3794 tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc); 3580 3795 WriteRaster3dFile(tempstream, this, cloud); -
src/tesselation.hpp
r3a0b38 r5ae39c 53 53 #define PointTestPair pair < PointMap::iterator, bool > 54 54 #define CandidateList list <class CandidateForTesselation *> 55 #define CandidateMap map <class BoundaryLineSet *, class CandidateForTesselation *> 55 56 56 57 #define LineMap multimap < int, class BoundaryLineSet * > … … 64 65 #define DistanceMultiMap multimap <double, pair < PointMap::iterator, PointMap::iterator> > 65 66 #define DistanceMultiMapPair pair <double, pair < PointMap::iterator, PointMap::iterator> > 67 68 #define TesselPointList list <TesselPoint *> 66 69 67 70 /********************************************** declarations *******************************/ … … 114 117 TriangleMap triangles; 115 118 int Nr; 119 bool skipped; 116 120 }; 117 121 … … 170 174 virtual ~PointCloud(); 171 175 176 virtual const char * const GetName() const { return "unknown"; }; 172 177 virtual Vector *GetCenter() const { return NULL; }; 173 178 virtual TesselPoint *GetPoint() const { return NULL; }; … … 177 182 virtual void GoToFirst() const {}; 178 183 virtual void GoToLast() const {}; 179 virtual bool IsEmpty() const { return false; };180 virtual bool IsEnd() const { return false; };184 virtual bool IsEmpty() const { return true; }; 185 virtual bool IsEnd() const { return true; }; 181 186 }; 182 187 … … 185 190 class CandidateForTesselation { 186 191 public : 192 CandidateForTesselation(BoundaryLineSet* currentBaseLine); 187 193 CandidateForTesselation(TesselPoint* candidate, BoundaryLineSet* currentBaseLine, Vector OptCandidateCenter, Vector OtherOptCandidateCenter); 188 194 ~CandidateForTesselation(); 189 195 190 TesselPoint *point;196 TesselPointList pointlist; 191 197 BoundaryLineSet *BaseLine; 192 198 Vector OptCenter; 193 199 Vector OtherOptCenter; 194 }; 200 double ShortestAngle; 201 double OtherShortestAngle; 202 }; 203 204 ostream & operator <<(ostream &ost, const CandidateForTesselation &a); 195 205 196 206 // =========================================================== class TESSELATION =========================================== … … 205 215 206 216 void AddTesselationPoint(TesselPoint* Candidate, const int n); 217 void SetTesselationPoint(TesselPoint* Candidate, const int n) const; 207 218 void AddTesselationLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n); 208 219 void AlwaysAddTesselationTriangleLine(class BoundaryPointSet *a, class BoundaryPointSet *b, const int n); 209 220 void AddTesselationTriangle(); 210 221 void AddTesselationTriangle(const int nr); 222 void AddCandidateTriangle(CandidateForTesselation CandidateLine); 211 223 void RemoveTesselationTriangle(class BoundaryTriangleSet *triangle); 212 224 void RemoveTesselationLine(class BoundaryLineSet *line); … … 217 229 void FindStartingTriangle(const double RADIUS, const LinkedCell *LC); 218 230 void FindSecondPointForTesselation(class TesselPoint* a, Vector Oben, class TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell *LC); 219 void FindThirdPointForTesselation(Vector NormalVector, Vector SearchDirection, Vector OldSphereCenter, class BoundaryLineSet *BaseLine, class TesselPoint *ThirdNode, CandidateList* &candidates, double *ShortestAngle, const double RADIUS, const LinkedCell *LC);220 bool FindNextSuitableTriangle( BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC);221 int CheckPresenceOfTriangle(class TesselPoint *Candidates[3]) ;231 void FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, CandidateForTesselation &CandidateLine, const class TesselPoint * const ThirdNode, const double RADIUS, const LinkedCell *LC) const; 232 bool FindNextSuitableTriangle(CandidateForTesselation &CandidateLine, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC); 233 int CheckPresenceOfTriangle(class TesselPoint *Candidates[3]) const; 222 234 class BoundaryTriangleSet * GetPresentTriangle(TesselPoint *Candidates[3]); 223 235 … … 239 251 list<list<TesselPoint*> *> * GetPathsOfConnectedPoints(const TesselPoint* const Point) const; 240 252 list<list<TesselPoint*> *> * GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const; 241 list<TesselPoint*> * GetCircleOf ConnectedPoints(const TesselPoint* const Point, const Vector * const Reference = NULL) const;253 list<TesselPoint*> * GetCircleOfSetOfPoints(set<TesselPoint*> *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference = NULL) const; 242 254 class BoundaryPointSet *GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const; 243 255 list<BoundaryTriangleSet*> *FindTriangles(const TesselPoint* const Points[3]) const; … … 258 270 PointMap PointsOnBoundary; 259 271 LineMap LinesOnBoundary; 272 CandidateMap OpenLines; 260 273 TriangleMap TrianglesOnBoundary; 261 274 int PointsOnBoundaryCount; … … 281 294 282 295 private: 283 class BoundaryPointSet *TPS[3]; //this is a Storage for pointers to triangle points, this and BPS[2] needed due to AddLine restrictions296 mutable class BoundaryPointSet *TPS[3]; //this is a Storage for pointers to triangle points, this and BPS[2] needed due to AddLine restrictions 284 297 285 298 mutable PointMap::const_iterator InternalPointer; 299 300 //bool HasOtherBaselineBetterCandidate(const BoundaryLineSet * const BaseRay, const TesselPoint * const OptCandidate, double ShortestAngle, double RADIUS, const LinkedCell * const LC) const; 286 301 }; 287 302 -
src/tesselationhelpers.cpp
r3a0b38 r5ae39c 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; … … 77 81 78 82 if (fabs(m11) < MYEPSILON) 79 eLog() << Verbose( 0) << "ERROR:three points are colinear." << endl;83 eLog() << Verbose(1) << "three points are colinear." << endl; 80 84 81 85 center->x[0] = 0.5 * m12/ m11; … … 84 88 85 89 if (fabs(a.Distance(center) - RADIUS) > MYEPSILON) 86 eLog() << Verbose( 0) << "ERROR:The given center is further way by " << fabs(a.Distance(center) - RADIUS) << " from a than RADIUS." << endl;90 eLog() << Verbose(1) << "The given center is further way by " << fabs(a.Distance(center) - RADIUS) << " from a than RADIUS." << endl; 87 91 88 92 gsl_matrix_free(A); … … 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; 189 if (fabs(M_PI - alpha - beta - gamma) > HULLEPSILON) 190 eLog() << Verbose(0) << "GetCenterofCircumcircle: Sum of angles " << (alpha+beta+gamma)/M_PI*180. << " > 180 degrees by " << fabs(M_PI - alpha - beta - 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; 193 if (fabs(M_PI - alpha - beta - gamma) > HULLEPSILON) { 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; 195 } 191 196 192 197 Center->Zero(); … … 218 223 double GetPathLengthonCircumCircle(const Vector &CircleCenter, const Vector &CirclePlaneNormal, const double CircleRadius, const Vector &NewSphereCenter, const Vector &OldSphereCenter, const Vector &NormalVector, const Vector &SearchDirection) 219 224 { 225 Info FunctionInfo(__func__); 220 226 Vector helper; 221 227 double radius, alpha; … … 224 230 // test whether new center is on the parameter circle's plane 225 231 if (fabs(helper.ScalarProduct(&CirclePlaneNormal)) > HULLEPSILON) { 226 eLog() << Verbose( 0) << "ERROR:Something's very wrong here: NewSphereCenter is not on the band's plane as desired by " <<fabs(helper.ScalarProduct(&CirclePlaneNormal)) << "!" << endl;232 eLog() << Verbose(1) << "Something's very wrong here: NewSphereCenter is not on the band's plane as desired by " <<fabs(helper.ScalarProduct(&CirclePlaneNormal)) << "!" << endl; 227 233 helper.ProjectOntoPlane(&CirclePlaneNormal); 228 234 } … … 230 236 // test whether the new center vector has length of CircleRadius 231 237 if (fabs(radius - CircleRadius) > HULLEPSILON) 232 eLog() << Verbose(1) << " ERROR:The projected center of the new sphere has radius " << radius << " instead of " << CircleRadius << "." << endl;238 eLog() << Verbose(1) << "The projected center of the new sphere has radius " << radius << " instead of " << CircleRadius << "." << endl; 233 239 alpha = helper.Angle(&OldSphereCenter); 234 240 // make the angle unique by checking the halfplanes/search direction 235 241 if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON) // acos is not unique on [0, 2.*M_PI), hence extra check to decide between two half intervals 236 242 alpha = 2.*M_PI - alpha; 237 //Log() << Verbose( 2) << "INFO: RelativeNewSphereCenter is " << helper << ", RelativeOldSphereCenter is " << OldSphereCenter << " and resulting angle is " << alpha << "." << endl;243 //Log() << Verbose(1) << "INFO: RelativeNewSphereCenter is " << helper << ", RelativeOldSphereCenter is " << OldSphereCenter << " and resulting angle is " << alpha << "." << endl; 238 244 radius = helper.Distance(&OldSphereCenter); 239 245 helper.ProjectOntoPlane(&NormalVector); 240 246 // check whether new center is somewhat away or at least right over the current baseline to prevent intersecting triangles 241 247 if ((radius > HULLEPSILON) || (helper.Norm() < HULLEPSILON)) { 242 //Log() << Verbose( 2) << "INFO: Distance between old and new center is " << radius << " and between new center and baseline center is " << helper.Norm() << "." << endl;248 //Log() << Verbose(1) << "INFO: Distance between old and new center is " << radius << " and between new center and baseline center is " << helper.Norm() << "." << endl; 243 249 return alpha; 244 250 } else { … … 263 269 double MinIntersectDistance(const gsl_vector * x, void *params) 264 270 { 271 Info FunctionInfo(__func__); 265 272 double retval = 0; 266 273 struct Intersection *I = (struct Intersection *)params; … … 283 290 284 291 retval = HeightA.ScalarProduct(&HeightA) + HeightB.ScalarProduct(&HeightB); 285 //Log() << Verbose( 2) << "MinIntersectDistance called, result: " << retval << endl;292 //Log() << Verbose(1) << "MinIntersectDistance called, result: " << retval << endl; 286 293 287 294 return retval; … … 303 310 bool existsIntersection(const Vector &point1, const Vector &point2, const Vector &point3, const Vector &point4) 304 311 { 312 Info FunctionInfo(__func__); 305 313 bool result; 306 314 … … 350 358 351 359 if (status == GSL_SUCCESS) { 352 Log() << Verbose( 2) << "converged to minimum" << endl;360 Log() << Verbose(1) << "converged to minimum" << endl; 353 361 } 354 362 } while (status == GSL_CONTINUE && iter < 100); … … 375 383 t2 = HeightB.ScalarProduct(&SideB)/SideB.ScalarProduct(&SideB); 376 384 377 Log() << Verbose( 2) << "Intersection " << intersection << " is at "385 Log() << Verbose(1) << "Intersection " << intersection << " is at " 378 386 << t1 << " for (" << point1 << "," << point2 << ") and at " 379 387 << t2 << " for (" << point3 << "," << point4 << "): "; 380 388 381 389 if (((t1 >= 0) && (t1 <= 1)) && ((t2 >= 0) && (t2 <= 1))) { 382 Log() << Verbose( 0) << "true intersection." << endl;390 Log() << Verbose(1) << "true intersection." << endl; 383 391 result = true; 384 392 } else { 385 Log() << Verbose( 0) << "intersection out of region of interest." << endl;393 Log() << Verbose(1) << "intersection out of region of interest." << endl; 386 394 result = false; 387 395 } … … 406 414 double GetAngle(const Vector &point, const Vector &reference, const Vector &OrthogonalVector) 407 415 { 416 Info FunctionInfo(__func__); 408 417 if (reference.IsZero()) 409 418 return M_PI; … … 417 426 } 418 427 419 Log() << Verbose( 4) << "INFO: " << point << " has angle " << phi << " with respect to reference " << reference << "." << endl;428 Log() << Verbose(1) << "INFO: " << point << " has angle " << phi << " with respect to reference " << reference << "." << endl; 420 429 421 430 return phi; … … 432 441 double CalculateVolumeofGeneralTetraeder(const Vector &a, const Vector &b, const Vector &c, const Vector &d) 433 442 { 443 Info FunctionInfo(__func__); 434 444 Vector Point, TetraederVector[3]; 435 445 double volume; … … 455 465 bool CheckLineCriteriaForDegeneratedTriangle(const BoundaryPointSet * const nodes[3]) 456 466 { 467 Info FunctionInfo(__func__); 457 468 bool result = false; 458 469 int counter = 0; … … 461 472 for (int i=0;i<3;i++) 462 473 for (int j=i+1; j<3; j++) { 463 if (nodes[i]->lines.find(nodes[j]->node->nr) != nodes[i]->lines.end()) { // there already is a line 474 if (nodes[i] == NULL) { 475 Log() << Verbose(1) << "Node nr. " << i << " is not yet present." << endl; 476 result = true; 477 } else if (nodes[i]->lines.find(nodes[j]->node->nr) != nodes[i]->lines.end()) { // there already is a line 464 478 LineMap::const_iterator FindLine; 465 479 pair<LineMap::const_iterator,LineMap::const_iterator> FindPair; … … 478 492 } 479 493 if ((!result) && (counter > 1)) { 480 Log() << Verbose( 2) << "INFO: Degenerate triangle is ok, at least two, here " << counter << ", existing lines are used." << endl;494 Log() << Verbose(1) << "INFO: Degenerate triangle is ok, at least two, here " << counter << ", existing lines are used." << endl; 481 495 result = true; 482 496 } … … 485 499 486 500 487 /** Sort function for the candidate list. 488 */ 489 bool SortCandidates(const CandidateForTesselation* candidate1, const CandidateForTesselation* candidate2) 490 { 491 Vector BaseLineVector, OrthogonalVector, helper; 492 if (candidate1->BaseLine != candidate2->BaseLine) { // sanity check 493 Log() << Verbose(0) << "ERROR: sortCandidates was called for two different baselines: " << candidate1->BaseLine << " and " << candidate2->BaseLine << "." << endl; 494 //return false; 495 exit(1); 496 } 497 // create baseline vector 498 BaseLineVector.CopyVector(candidate1->BaseLine->endpoints[1]->node->node); 499 BaseLineVector.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node); 500 BaseLineVector.Normalize(); 501 502 // 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!) 503 helper.CopyVector(candidate1->BaseLine->endpoints[0]->node->node); 504 helper.SubtractVector(candidate1->point->node); 505 OrthogonalVector.CopyVector(&helper); 506 helper.VectorProduct(&BaseLineVector); 507 OrthogonalVector.SubtractVector(&helper); 508 OrthogonalVector.Normalize(); 509 510 // calculate both angles and correct with in-plane vector 511 helper.CopyVector(candidate1->point->node); 512 helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node); 513 double phi = BaseLineVector.Angle(&helper); 514 if (OrthogonalVector.ScalarProduct(&helper) > 0) { 515 phi = 2.*M_PI - phi; 516 } 517 helper.CopyVector(candidate2->point->node); 518 helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node); 519 double psi = BaseLineVector.Angle(&helper); 520 if (OrthogonalVector.ScalarProduct(&helper) > 0) { 521 psi = 2.*M_PI - psi; 522 } 523 524 Log() << Verbose(2) << *candidate1->point << " has angle " << phi << endl; 525 Log() << Verbose(2) << *candidate2->point << " has angle " << psi << endl; 526 527 // return comparison 528 return phi < psi; 529 }; 501 ///** Sort function for the candidate list. 502 // */ 503 //bool SortCandidates(const CandidateForTesselation* candidate1, const CandidateForTesselation* candidate2) 504 //{ 505 // Info FunctionInfo(__func__); 506 // Vector BaseLineVector, OrthogonalVector, helper; 507 // if (candidate1->BaseLine != candidate2->BaseLine) { // sanity check 508 // eLog() << Verbose(1) << "sortCandidates was called for two different baselines: " << candidate1->BaseLine << " and " << candidate2->BaseLine << "." << endl; 509 // //return false; 510 // exit(1); 511 // } 512 // // create baseline vector 513 // BaseLineVector.CopyVector(candidate1->BaseLine->endpoints[1]->node->node); 514 // BaseLineVector.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node); 515 // BaseLineVector.Normalize(); 516 // 517 // // 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!) 518 // helper.CopyVector(candidate1->BaseLine->endpoints[0]->node->node); 519 // helper.SubtractVector(candidate1->point->node); 520 // OrthogonalVector.CopyVector(&helper); 521 // helper.VectorProduct(&BaseLineVector); 522 // OrthogonalVector.SubtractVector(&helper); 523 // OrthogonalVector.Normalize(); 524 // 525 // // calculate both angles and correct with in-plane vector 526 // helper.CopyVector(candidate1->point->node); 527 // helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node); 528 // double phi = BaseLineVector.Angle(&helper); 529 // if (OrthogonalVector.ScalarProduct(&helper) > 0) { 530 // phi = 2.*M_PI - phi; 531 // } 532 // helper.CopyVector(candidate2->point->node); 533 // helper.SubtractVector(candidate1->BaseLine->endpoints[0]->node->node); 534 // double psi = BaseLineVector.Angle(&helper); 535 // if (OrthogonalVector.ScalarProduct(&helper) > 0) { 536 // psi = 2.*M_PI - psi; 537 // } 538 // 539 // Log() << Verbose(1) << *candidate1->point << " has angle " << phi << endl; 540 // Log() << Verbose(1) << *candidate2->point << " has angle " << psi << endl; 541 // 542 // // return comparison 543 // return phi < psi; 544 //}; 530 545 531 546 /** … … 539 554 TesselPoint* FindSecondClosestPoint(const Vector* Point, const LinkedCell* const LC) 540 555 { 556 Info FunctionInfo(__func__); 541 557 TesselPoint* closestPoint = NULL; 542 558 TesselPoint* secondClosestPoint = NULL; … … 549 565 for(int i=0;i<NDIM;i++) // store indices of this cell 550 566 N[i] = LC->n[i]; 551 Log() << Verbose( 2) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;567 Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl; 552 568 553 569 LC->GetNeighbourBounds(Nlower, Nupper); 554 //Log() << Verbose( 0) << endl;570 //Log() << Verbose(1) << endl; 555 571 for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++) 556 572 for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++) 557 573 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 558 574 const LinkedNodes *List = LC->GetCurrentCell(); 559 //Log() << Verbose( 3) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;575 //Log() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl; 560 576 if (List != NULL) { 561 577 for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { … … 574 590 } 575 591 } else { 576 eLog() << Verbose( 0) << "ERROR:The current cell " << LC->n[0] << "," << LC->n[1] << ","592 eLog() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," 577 593 << LC->n[2] << " is invalid!" << endl; 578 594 } … … 593 609 TesselPoint* FindClosestPoint(const Vector* Point, TesselPoint *&SecondPoint, const LinkedCell* const LC) 594 610 { 611 Info FunctionInfo(__func__); 595 612 TesselPoint* closestPoint = NULL; 596 613 SecondPoint = NULL; … … 603 620 for(int i=0;i<NDIM;i++) // store indices of this cell 604 621 N[i] = LC->n[i]; 605 Log() << Verbose( 3) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl;622 Log() << Verbose(1) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl; 606 623 607 624 LC->GetNeighbourBounds(Nlower, Nupper); 608 //Log() << Verbose( 0) << endl;625 //Log() << Verbose(1) << endl; 609 626 for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++) 610 627 for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++) 611 628 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 612 629 const LinkedNodes *List = LC->GetCurrentCell(); 613 //Log() << Verbose( 3) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl;630 //Log() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl; 614 631 if (List != NULL) { 615 632 for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { … … 622 639 distance = currentNorm; 623 640 closestPoint = (*Runner); 624 //Log() << Verbose( 2) << "INFO: New Nearest Neighbour is " << *closestPoint << "." << endl;641 //Log() << Verbose(1) << "INFO: New Nearest Neighbour is " << *closestPoint << "." << endl; 625 642 } else if (currentNorm < secondDistance) { 626 643 secondDistance = currentNorm; 627 644 SecondPoint = (*Runner); 628 //Log() << Verbose( 2) << "INFO: New Second Nearest Neighbour is " << *SecondPoint << "." << endl;645 //Log() << Verbose(1) << "INFO: New Second Nearest Neighbour is " << *SecondPoint << "." << endl; 629 646 } 630 647 } 631 648 } else { 632 eLog() << Verbose( 0) << "ERROR:The current cell " << LC->n[0] << "," << LC->n[1] << ","649 eLog() << Verbose(1) << "The current cell " << LC->n[0] << "," << LC->n[1] << "," 633 650 << LC->n[2] << " is invalid!" << endl; 634 651 } … … 636 653 // output 637 654 if (closestPoint != NULL) { 638 Log() << Verbose( 2) << "Closest point is " << *closestPoint;655 Log() << Verbose(1) << "Closest point is " << *closestPoint; 639 656 if (SecondPoint != NULL) 640 657 Log() << Verbose(0) << " and second closest is " << *SecondPoint; … … 652 669 Vector * GetClosestPointBetweenLine(const BoundaryLineSet * const Base, const BoundaryLineSet * const OtherBase) 653 670 { 671 Info FunctionInfo(__func__); 654 672 // construct the plane of the two baselines (i.e. take both their directional vectors) 655 673 Vector Normal; … … 662 680 Normal.VectorProduct(&OtherBaseline); 663 681 Normal.Normalize(); 664 Log() << Verbose( 4) << "First direction is " << Baseline << ", second direction is " << OtherBaseline << ", normal of intersection plane is " << Normal << "." << endl;682 Log() << Verbose(1) << "First direction is " << Baseline << ", second direction is " << OtherBaseline << ", normal of intersection plane is " << Normal << "." << endl; 665 683 666 684 // project one offset point of OtherBase onto this plane (and add plane offset vector) … … 679 697 Normal.CopyVector(Intersection); 680 698 Normal.SubtractVector(Base->endpoints[0]->node->node); 681 Log() << Verbose( 3) << "Found closest point on " << *Base << " at " << *Intersection << ", factor in line is " << fabs(Normal.ScalarProduct(&Baseline)/Baseline.NormSquared()) << "." << endl;699 Log() << Verbose(1) << "Found closest point on " << *Base << " at " << *Intersection << ", factor in line is " << fabs(Normal.ScalarProduct(&Baseline)/Baseline.NormSquared()) << "." << endl; 682 700 683 701 return Intersection; … … 692 710 double DistanceToTrianglePlane(const Vector *x, const BoundaryTriangleSet * const triangle) 693 711 { 712 Info FunctionInfo(__func__); 694 713 double distance = 0.; 695 714 if (x == NULL) { … … 708 727 void WriteVrmlFile(ofstream * const vrmlfile, const Tesselation * const Tess, const PointCloud * const cloud) 709 728 { 729 Info FunctionInfo(__func__); 710 730 TesselPoint *Walker = NULL; 711 731 int i; … … 738 758 } 739 759 } else { 740 eLog() << Verbose( 0) << "ERROR:Given vrmlfile is " << vrmlfile << "." << endl;760 eLog() << Verbose(1) << "Given vrmlfile is " << vrmlfile << "." << endl; 741 761 } 742 762 delete(center); … … 751 771 void IncludeSphereinRaster3D(ofstream * const rasterfile, const Tesselation * const Tess, const PointCloud * const cloud) 752 772 { 773 Info FunctionInfo(__func__); 753 774 Vector helper; 754 // include the current position of the virtual sphere in the temporary raster3d file 755 Vector *center = cloud->GetCenter(); 756 // make the circumsphere's center absolute again 757 helper.CopyVector(Tess->LastTriangle->endpoints[0]->node->node); 758 helper.AddVector(Tess->LastTriangle->endpoints[1]->node->node); 759 helper.AddVector(Tess->LastTriangle->endpoints[2]->node->node); 760 helper.Scale(1./3.); 761 helper.SubtractVector(center); 762 // and add to file plus translucency object 763 *rasterfile << "# current virtual sphere\n"; 764 *rasterfile << "8\n 25.0 0.6 -1.0 -1.0 -1.0 0.2 0 0 0 0\n"; 765 *rasterfile << "2\n " << helper.x[0] << " " << helper.x[1] << " " << helper.x[2] << "\t" << 5. << "\t1 0 0\n"; 766 *rasterfile << "9\n terminating special property\n"; 767 delete(center); 775 776 if (Tess->LastTriangle != NULL) { 777 // include the current position of the virtual sphere in the temporary raster3d file 778 Vector *center = cloud->GetCenter(); 779 // make the circumsphere's center absolute again 780 helper.CopyVector(Tess->LastTriangle->endpoints[0]->node->node); 781 helper.AddVector(Tess->LastTriangle->endpoints[1]->node->node); 782 helper.AddVector(Tess->LastTriangle->endpoints[2]->node->node); 783 helper.Scale(1./3.); 784 helper.SubtractVector(center); 785 // and add to file plus translucency object 786 *rasterfile << "# current virtual sphere\n"; 787 *rasterfile << "8\n 25.0 0.6 -1.0 -1.0 -1.0 0.2 0 0 0 0\n"; 788 *rasterfile << "2\n " << helper.x[0] << " " << helper.x[1] << " " << helper.x[2] << "\t" << 5. << "\t1 0 0\n"; 789 *rasterfile << "9\n terminating special property\n"; 790 delete(center); 791 } 768 792 }; 769 793 … … 776 800 void WriteRaster3dFile(ofstream * const rasterfile, const Tesselation * const Tess, const PointCloud * const cloud) 777 801 { 802 Info FunctionInfo(__func__); 778 803 TesselPoint *Walker = NULL; 779 804 int i; … … 808 833 *rasterfile << "9\n# terminating special property\n"; 809 834 } else { 810 eLog() << Verbose( 0) << "ERROR:Given rasterfile is " << rasterfile << "." << endl;835 eLog() << Verbose(1) << "Given rasterfile is " << rasterfile << "." << endl; 811 836 } 812 837 IncludeSphereinRaster3D(rasterfile, Tess, cloud); … … 821 846 void WriteTecplotFile(ofstream * const tecplot, const Tesselation * const TesselStruct, const PointCloud * const cloud, const int N) 822 847 { 848 Info FunctionInfo(__func__); 823 849 if ((tecplot != NULL) && (TesselStruct != NULL)) { 824 850 // write header 825 851 *tecplot << "TITLE = \"3D CONVEX SHELL\"" << endl; 826 852 *tecplot << "VARIABLES = \"X\" \"Y\" \"Z\" \"U\"" << endl; 827 *tecplot << "ZONE T=\"" << N << "-"; 828 for (int i=0;i<3;i++) 829 *tecplot << (i==0 ? "" : "_") << TesselStruct->LastTriangle->endpoints[i]->node->Name; 853 *tecplot << "ZONE T=\""; 854 if (N < 0) { 855 *tecplot << cloud->GetName(); 856 } else { 857 *tecplot << N << "-"; 858 for (int i=0;i<3;i++) 859 *tecplot << (i==0 ? "" : "_") << TesselStruct->LastTriangle->endpoints[i]->node->Name; 860 } 830 861 *tecplot << "\", N=" << TesselStruct->PointsOnBoundary.size() << ", E=" << TesselStruct->TrianglesOnBoundary.size() << ", DATAPACKING=POINT, ZONETYPE=FETRIANGLE" << endl; 831 862 int i=0; … … 836 867 837 868 // print atom coordinates 838 Log() << Verbose(2) << "The following triangles were created:";839 869 int Counter = 1; 840 870 TesselPoint *Walker = NULL; … … 846 876 *tecplot << endl; 847 877 // print connectivity 878 Log() << Verbose(1) << "The following triangles were created:" << endl; 848 879 for (TriangleMap::const_iterator runner = TesselStruct->TrianglesOnBoundary.begin(); runner != TesselStruct->TrianglesOnBoundary.end(); runner++) { 849 Log() << Verbose( 0) << " " << runner->second->endpoints[0]->node->Name << "<->" << runner->second->endpoints[1]->node->Name << "<->" << runner->second->endpoints[2]->node->Name;880 Log() << Verbose(1) << " " << runner->second->endpoints[0]->node->Name << "<->" << runner->second->endpoints[1]->node->Name << "<->" << runner->second->endpoints[2]->node->Name << endl; 850 881 *tecplot << LookupList[runner->second->endpoints[0]->node->nr] << " " << LookupList[runner->second->endpoints[1]->node->nr] << " " << LookupList[runner->second->endpoints[2]->node->nr] << endl; 851 882 } 852 883 delete[] (LookupList); 853 Log() << Verbose(0) << endl;854 884 } 855 885 }; … … 862 892 void CalculateConcavityPerBoundaryPoint(const Tesselation * const TesselStruct) 863 893 { 894 Info FunctionInfo(__func__); 864 895 class BoundaryPointSet *point = NULL; 865 896 class BoundaryLineSet *line = NULL; 866 897 867 //Log() << Verbose(2) << "Begin of CalculateConcavityPerBoundaryPoint" << endl;868 898 // calculate remaining concavity 869 899 for (PointMap::const_iterator PointRunner = TesselStruct->PointsOnBoundary.begin(); PointRunner != TesselStruct->PointsOnBoundary.end(); PointRunner++) { … … 873 903 for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) { 874 904 line = LineRunner->second; 875 //Log() << Verbose( 2) << "INFO: Current line of point " << *point << " is " << *line << "." << endl;905 //Log() << Verbose(1) << "INFO: Current line of point " << *point << " is " << *line << "." << endl; 876 906 if (!line->CheckConvexityCriterion()) 877 907 point->value += 1; 878 908 } 879 909 } 880 //Log() << Verbose(2) << "End of CalculateConcavityPerBoundaryPoint" << endl;881 910 }; 882 911 … … 889 918 bool CheckListOfBaselines(const Tesselation * const TesselStruct) 890 919 { 920 Info FunctionInfo(__func__); 891 921 LineMap::const_iterator testline; 892 922 bool result = false; … … 896 926 for (testline = TesselStruct->LinesOnBoundary.begin(); testline != TesselStruct->LinesOnBoundary.end(); testline++) { 897 927 if (testline->second->triangles.size() != 2) { 898 Log() << Verbose( 1) << *testline->second << "\t" << testline->second->triangles.size() << endl;928 Log() << Verbose(2) << *testline->second << "\t" << testline->second->triangles.size() << endl; 899 929 counter++; 900 930 } -
src/unittests/Makefile.am
r3a0b38 r5ae39c 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
r3a0b38 r5ae39c 229 229 factor = Direction.ScalarProduct(PlaneNormal); 230 230 if (factor < MYEPSILON) { // Uniqueness: line parallel to plane? 231 Log() << Verbose(2) << "WARNING:Line is parallel to plane, no intersection." << endl;231 eLog() << Verbose(2) << "Line is parallel to plane, no intersection." << endl; 232 232 return false; 233 233 } … … 253 253 return true; 254 254 } else { 255 Log() << Verbose(2) << "WARNING:Intersection point " << *this << " is not on plane." << endl;255 eLog() << Verbose(2) << "Intersection point " << *this << " is not on plane." << endl; 256 256 return false; 257 257 } … … 747 747 x[i] = C.x[i]; 748 748 } else { 749 eLog() << Verbose( 0) << "ERROR:inverse of matrix does not exists: det A = " << detA << "." << endl;749 eLog() << Verbose(1) << "inverse of matrix does not exists: det A = " << detA << "." << endl; 750 750 } 751 751 }; … … 799 799 x2.SubtractVector(y2); 800 800 if ((fabs(x1.Norm()) < MYEPSILON) || (fabs(x2.Norm()) < MYEPSILON) || (fabs(x1.Angle(&x2)) < MYEPSILON)) { 801 Log() << Verbose(4) << "WARNING:Given vectors are linear dependent." << endl;801 eLog() << Verbose(2) << "Given vectors are linear dependent." << endl; 802 802 return false; 803 803 } … … 833 833 Zero(); 834 834 if ((fabs(x1.Norm()) < MYEPSILON) || (fabs(x2.Norm()) < MYEPSILON) || (fabs(x1.Angle(&x2)) < MYEPSILON)) { 835 Log() << Verbose(4) << "WARNING:Given vectors are linear dependent." << endl;835 eLog() << Verbose(2) << "Given vectors are linear dependent." << endl; 836 836 return false; 837 837 } -
src/verbose.cpp
r3a0b38 r5ae39c 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/1_2-dimethoxyethane/NonConvexEnvelope-1_2-dimethoxyethane.dat
r3a0b38 r5ae39c 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" 0- H10_ H15_ H16", N=12, E=20, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="1_2-dimethoxyethane", N=12, E=20, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 9.6489 7.0567 6.6101 2 5 5 6.8975 7.0567 5.9709 2 -
tests/Tesselations/1_2-dimethylbenzene/NonConvexEnvelope-1_2-dimethylbenzene.dat
r3a0b38 r5ae39c 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" 0- C07_ C08_ H09", N=14, E=25, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="1_2-dimethylbenzene", N=14, E=25, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 8.3296 6.7712 6.0321 3 5 5 8.3296 8.1534 6.0305 3 -
tests/Tesselations/2-methylcyclohexanone/NonConvexEnvelope-2-methylcyclohexanone.dat
r3a0b38 r5ae39c 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" 0- H15_ H18_ H19", N=13, E=22, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="2-methylcyclohexanone", N=13, E=22, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 9.2731 9.0957 6.144 1 5 5 10.8392 7.1885 6.8694 0 -
tests/Tesselations/C16_0-Torus/NonConvexEnvelope-C16_0-Torus.dat
r3a0b38 r5ae39c 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" 0- C818_ C1839_ C1904", N=8208, E=16416, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="C16_0-Torus", N=8208, E=16416, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 57.0669 28.4968 10.0318 2 5 5 53.7124 30.5841 10.0363 2 -
tests/Tesselations/Makefile.am
r3a0b38 r5ae39c 2 2 1_2-dimethylbenzene.test \ 3 3 2-methylcyclohexanone.test \ 4 benzene.test \ 4 5 cholesterol.test \ 5 6 cluster.test \ -
tests/Tesselations/N_N-dimethylacetamide/NonConvexEnvelope-N_N-dimethylacetamide.dat
r3a0b38 r5ae39c 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" 0- C03_ O06_ H12", N=11, E=18, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="N_N-dimethylacetamide", N=11, E=18, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 6.4232 7.1074 8.3151 3 5 5 6.5832 7.8674 9.2351 1 -
tests/Tesselations/cholesterol/NonConvexEnvelope-cholesterol.dat
r3a0b38 r5ae39c 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="cholesterol", N=44, E=86, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 19.4519 9.7871 8.0824 1 5 5 12.9054 5.0485 9.284 1 -
tests/Tesselations/cluster/NonConvexEnvelope-cluster.dat
r3a0b38 r5ae39c 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" 0- O4864_ O4865_ O5836", N=434, E=782, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="cluster", N=434, E=782, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 59.3961 67.9193 74.1709 1 5 5 60.8097 66.4885 71.9891 1 -
tests/Tesselations/cycloheptane/NonConvexEnvelope-cycloheptane.dat
r3a0b38 r5ae39c 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" 0- H08_ H12_ H13", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="cycloheptane", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 5 8.6586 6.1486 0 5 5 5.8635 8.4046 7.6783 0 -
tests/Tesselations/defs.in
r3a0b38 r5ae39c 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/Tesselations/dimethyl_bromomalonate/NonConvexEnvelope-dimethyl_bromomalonate.dat
r3a0b38 r5ae39c 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" 0- H12_ H13_ H14", N=12, E=20, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="dimethyl_bromomalonate", N=12, E=20, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 8.1538 5 6.6665 1 5 5 6.8226 7.583 6.9158 4 -
tests/Tesselations/glucose/NonConvexEnvelope-glucose.dat
r3a0b38 r5ae39c 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" 0- C09_ O12_ H17", N=19, E=34, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="glucose", N=19, E=34, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 9.5866 5 7.577 1 5 5 8.4149 7.4116 8.4659 1 -
tests/Tesselations/heptan/NonConvexEnvelope-heptan.dat
r3a0b38 r5ae39c 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" 0- H07_ H08_ H11", N=16, E=28, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="heptan", N=16, E=28, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 9.6377 5 6.78 0 5 5 9.6377 5 5 0 -
tests/Tesselations/isoleucine/NonConvexEnvelope-isoleucine.dat
r3a0b38 r5ae39c 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" 0- H20_ H21_ H22", N=17, E=30, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="isoleucine", N=17, E=30, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 10.8909 7.216 6.6663 5 5 5 9.4763 5.271 6.3191 1 -
tests/Tesselations/neohexane/NonConvexEnvelope-neohexane.dat
r3a0b38 r5ae39c 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" 0- H10_ H15_ H20", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="neohexane", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 7.1525 6.2503 8.0589 1 5 5 7.1525 8.0303 8.0578 1 -
tests/Tesselations/proline/NonConvexEnvelope-proline.dat
r3a0b38 r5ae39c 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" 0- H10_ H13_ H17", N=13, E=22, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="proline", N=13, E=22, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 9.2095 7.1856 6.6953 4 5 5 9.3187 7.948 7.6262 2 -
tests/Tesselations/putrescine/NonConvexEnvelope-putrescine.dat
r3a0b38 r5ae39c 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" 0- N06_ H17_ H18", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="putrescine", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 10.8857 5.9511 6.2964 1 5 5 5.5257 8.9311 6.4164 1 -
tests/Tesselations/round_cluster/NonConvexEnvelope-round_cluster.dat
r3a0b38 r5ae39c 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" 0- O633_ O960_ O1013", N=467, E=930, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="round_cluster", N=467, E=930, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 41.4883 31.1464 29.9646 2 5 5 35.0153 37.6127 31.0313 4 -
tests/Tesselations/tartaric_acid/NonConvexEnvelope-tartaric_acid.dat
r3a0b38 r5ae39c 1 1 TITLE = "3D CONVEX SHELL" 2 2 VARIABLES = "X" "Y" "Z" "U" 3 ZONE T=" 0- C05_ O09_ H12", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE3 ZONE T="tartaric_acid", N=14, E=24, DATAPACKING=POINT, ZONETYPE=FETRIANGLE 4 4 10.156 6.9295 6.2926 4 5 5 8.5078 5.7627 5 1
Note:
See TracChangeset
for help on using the changeset viewer.