Changeset 47d041 for src/Tesselation/boundary.cpp
- Timestamp:
- Nov 3, 2011, 7:44:01 PM (13 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 41a467
- Parents:
- 50e4e5
- git-author:
- Frederik Heber <heber@…> (10/27/11 11:53:58)
- git-committer:
- Frederik Heber <heber@…> (11/03/11 19:44:01)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Tesselation/boundary.cpp
r50e4e5 r47d041 84 84 } else { 85 85 BoundaryPoints = BoundaryPtr; 86 DoLog(0) && (Log() << Verbose(0) << "Using given boundary points set." << endl);86 LOG(0, "Using given boundary points set."); 87 87 } 88 88 // determine biggest "diameter" of cluster for each axis … … 91 91 for (int axis = 0; axis < NDIM; axis++) 92 92 { // regard each projected plane 93 //L og() << Verbose(1) << "Current axis is " << axis << "." << endl;93 //LOG(1, "Current axis is " << axis << "."); 94 94 for (int j = 0; j < 2; j++) 95 95 { // and for both axis on the current plane 96 96 component = (axis + j + 1) % NDIM; 97 97 Othercomponent = (axis + 1 + ((j + 1) & 1)) % NDIM; 98 //L og() << Verbose(1) << "Current component is " << component << ", Othercomponent is " << Othercomponent << "." << endl;98 //LOG(1, "Current component is " << component << ", Othercomponent is " << Othercomponent << "."); 99 99 for (Boundaries::const_iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) { 100 //L og() << Verbose(1) << "Current runner is " << *(runner->second.second) << "." << endl;100 //LOG(1, "Current runner is " << *(runner->second.second) << "."); 101 101 // seek for the neighbours pair where the Othercomponent sign flips 102 102 Neighbour = runner; … … 111 111 Neighbour = BoundaryPoints[axis].begin(); 112 112 DistanceVector = (runner->second.second->getPosition()) - (Neighbour->second.second->getPosition()); 113 //L og() << Verbose(2) << "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "." << endl;113 //LOG(2, "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "."); 114 114 } while ((runner != Neighbour) && (fabs(OldComponent / fabs( 115 115 OldComponent) - DistanceVector[Othercomponent] / fabs( … … 120 120 OtherNeighbour = BoundaryPoints[axis].end(); 121 121 OtherNeighbour--; 122 //L og() << Verbose(1) << "The pair, where the sign of OtherComponent flips, is: " << *(Neighbour->second.second) << " and " << *(OtherNeighbour->second.second) << "." << endl;122 //LOG(1, "The pair, where the sign of OtherComponent flips, is: " << *(Neighbour->second.second) << " and " << *(OtherNeighbour->second.second) << "."); 123 123 // now we have found the pair: Neighbour and OtherNeighbour 124 124 OtherVector = (runner->second.second->getPosition()) - (OtherNeighbour->second.second->getPosition()); 125 //L og() << Verbose(1) << "Distances to Neighbour and OtherNeighbour are " << DistanceVector.x[component] << " and " << OtherVector.x[component] << "." << endl;126 //L og() << Verbose(1) << "OtherComponents to Neighbour and OtherNeighbour are " << DistanceVector.x[Othercomponent] << " and " << OtherVector.x[Othercomponent] << "." << endl;125 //LOG(1, "Distances to Neighbour and OtherNeighbour are " << DistanceVector.x[component] << " and " << OtherVector.x[component] << "."); 126 //LOG(1, "OtherComponents to Neighbour and OtherNeighbour are " << DistanceVector.x[Othercomponent] << " and " << OtherVector.x[Othercomponent] << "."); 127 127 // do linear interpolation between points (is exact) to extract exact intersection between Neighbour and OtherNeighbour 128 128 w1 = fabs(OtherVector[Othercomponent]); … … 131 131 * OtherVector[component]) / (w1 + w2)); 132 132 // mark if it has greater diameter 133 //L og() << Verbose(1) << "Comparing current greatest " << GreatestDiameter[component] << " to new " << tmp << "." << endl;133 //LOG(1, "Comparing current greatest " << GreatestDiameter[component] << " to new " << tmp << "."); 134 134 GreatestDiameter[component] = (GreatestDiameter[component] 135 135 > tmp) ? GreatestDiameter[component] : tmp; 136 136 } //else 137 //L og() << Verbose(1) << "Saw no sign flip, probably top or bottom node." << endl;137 //LOG(1, "Saw no sign flip, probably top or bottom node."); 138 138 } 139 139 } 140 140 } 141 L og() << Verbose(0) <<"RESULT: The biggest diameters are "141 LOG(0, "RESULT: The biggest diameters are " 142 142 << GreatestDiameter[0] << " and " << GreatestDiameter[1] << " and " 143 143 << GreatestDiameter[2] << " " << (IsAngstroem ? "angstrom" 144 : "atomiclength") << "." << endl;144 : "atomiclength") << "."); 145 145 146 146 // free reference lists … … 186 186 AngleReferenceNormalVector[(axis + 2) % NDIM] = 1.; 187 187 188 DoLog(1) && (Log() << Verbose(1) << "Axisvector is " << AxisVector << " and AngleReferenceVector is " << AngleReferenceVector << ", and AngleReferenceNormalVector is " << AngleReferenceNormalVector << "." << endl);188 LOG(1, "Axisvector is " << AxisVector << " and AngleReferenceVector is " << AngleReferenceVector << ", and AngleReferenceNormalVector is " << AngleReferenceNormalVector << "."); 189 189 190 190 // 3b. construct set of all points, transformed into cylindrical system and with left and right neighbours … … 200 200 angle = 0.; // otherwise it's a vector in Axis Direction and unimportant for boundary issues 201 201 202 //L og() << Verbose(1) << "Checking sign in quadrant : " << ProjectedVector.Projection(&AngleReferenceNormalVector) << "." << endl;202 //LOG(1, "Checking sign in quadrant : " << ProjectedVector.Projection(&AngleReferenceNormalVector) << "."); 203 203 if (ProjectedVector.ScalarProduct(AngleReferenceNormalVector) > 0) { 204 204 angle = 2. * M_PI - angle; 205 205 } 206 DoLog(1) && (Log() << Verbose(1) << "Inserting " << **iter << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl);206 LOG(1, "Inserting " << **iter << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector); 207 207 BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, TesselPointDistancePair (radius, (*iter)))); 208 208 if (!BoundaryTestPair.second) { // same point exists, check first r, then distance of original vectors to center of gravity 209 DoLog(2) && (Log() << Verbose(2) << "Encountered two vectors whose projection onto axis " << axis << " is equal: " << endl);210 DoLog(2) && (Log() << Verbose(2) << "Present vector: " << *BoundaryTestPair.first->second.second << endl);211 DoLog(2) && (Log() << Verbose(2) << "New vector: " << **iter << endl);209 LOG(2, "Encountered two vectors whose projection onto axis " << axis << " is equal: "); 210 LOG(2, "Present vector: " << *BoundaryTestPair.first->second.second); 211 LOG(2, "New vector: " << **iter); 212 212 const double ProjectedVectorNorm = ProjectedVector.NormSquared(); 213 213 if ((ProjectedVectorNorm - BoundaryTestPair.first->second.first) > MYEPSILON) { 214 214 BoundaryTestPair.first->second.first = ProjectedVectorNorm; 215 215 BoundaryTestPair.first->second.second = (*iter); 216 DoLog(2) && (Log() << Verbose(2) << "Keeping new vector due to larger projected distance " << ProjectedVectorNorm << "." << endl);216 LOG(2, "Keeping new vector due to larger projected distance " << ProjectedVectorNorm << "."); 217 217 } else if (fabs(ProjectedVectorNorm - BoundaryTestPair.first->second.first) < MYEPSILON) { 218 218 helper = (*iter)->getPosition() - (*MolCenter); … … 221 221 if (helper.NormSquared() < oldhelperNorm) { 222 222 BoundaryTestPair.first->second.second = (*iter); 223 DoLog(2) && (Log() << Verbose(2) << "Keeping new vector due to larger distance to molecule center " << helper.NormSquared() << "." << endl);223 LOG(2, "Keeping new vector due to larger distance to molecule center " << helper.NormSquared() << "."); 224 224 } else { 225 DoLog(2) && (Log() << Verbose(2) << "Keeping present vector due to larger distance to molecule center " << oldhelperNorm << "." << endl);225 LOG(2, "Keeping present vector due to larger distance to molecule center " << oldhelperNorm << "."); 226 226 } 227 227 } else { 228 DoLog(2) && (Log() << Verbose(2) << "Keeping present vector due to larger projected distance " << ProjectedVectorNorm << "." << endl);228 LOG(2, "Keeping present vector due to larger projected distance " << ProjectedVectorNorm << "."); 229 229 } 230 230 } … … 232 232 // printing all inserted for debugging 233 233 // { 234 // Log() << Verbose(1) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl; 234 // std::stringstream output; 235 // output << "Printing list of candidates for axis " << axis << " which we have inserted so far: "; 235 236 // int i=0; 236 237 // for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) { 237 238 // if (runner != BoundaryPoints[axis].begin()) 238 // Log() << Verbose(0)<< ", " << i << ": " << *runner->second.second;239 // output << ", " << i << ": " << *runner->second.second; 239 240 // else 240 // Log() << Verbose(0)<< i << ": " << *runner->second.second;241 // output << i << ": " << *runner->second.second; 241 242 // i++; 242 243 // } 243 // L og() << Verbose(0) << endl;244 // LOG(1, output.str()); 244 245 // } 245 246 // 3c. throw out points whose distance is less than the mean of left and right neighbours 246 247 bool flag = false; 247 DoLog(1) && (Log() << Verbose(1) << "Looking for candidates to kick out by convex condition ... " << endl);248 LOG(1, "Looking for candidates to kick out by convex condition ... "); 248 249 do { // do as long as we still throw one out per round 249 250 flag = false; … … 273 274 SideA = left->second.second->getPosition() - (*MolCenter); 274 275 SideA.ProjectOntoPlane(AxisVector); 275 // L og() << Verbose(1) << "SideA: " << SideA << endl;276 // LOG(1, "SideA: " << SideA); 276 277 277 278 SideB = right->second.second->getPosition() -(*MolCenter); 278 279 SideB.ProjectOntoPlane(AxisVector); 279 // L og() << Verbose(1) << "SideB: " << SideB << endl;280 // LOG(1, "SideB: " << SideB); 280 281 281 282 SideC = left->second.second->getPosition() - right->second.second->getPosition(); 282 283 SideC.ProjectOntoPlane(AxisVector); 283 // L og() << Verbose(1) << "SideC: " << SideC << endl;284 // LOG(1, "SideC: " << SideC); 284 285 285 286 SideH = runner->second.second->getPosition() -(*MolCenter); 286 287 SideH.ProjectOntoPlane(AxisVector); 287 // L og() << Verbose(1) << "SideH: " << SideH << endl;288 // LOG(1, "SideH: " << SideH); 288 289 289 290 // calculate each length … … 298 299 const double delta = SideC.Angle(SideH); 299 300 const double MinDistance = a * sin(beta) / (sin(delta)) * (((alpha < M_PI / 2.) || (gamma < M_PI / 2.)) ? 1. : -1.); 300 //L og() << 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;301 DoLog(1) && (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);301 //LOG(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 << "."); 302 LOG(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 << "."); 302 303 if ((fabs(h / fabs(h) - MinDistance / fabs(MinDistance)) < MYEPSILON) && ((h - MinDistance)) < -MYEPSILON) { 303 304 // throw out point 304 DoLog(1) && (Log() << Verbose(1) << "Throwing out " << *runner->second.second << "." << endl);305 LOG(1, "Throwing out " << *runner->second.second << "."); 305 306 BoundaryPoints[axis].erase(runner); 306 307 runner = right; … … 340 341 } else { 341 342 BoundaryPoints = BoundaryPts; 342 DoLog(0) && (Log() << Verbose(0) << "Using given boundary points set." << endl);343 LOG(0, "Using given boundary points set."); 343 344 } 344 345 345 346 // printing all inserted for debugging 346 for (int axis=0; axis < NDIM; axis++) { 347 DoLog(1) && (Log() << Verbose(1) << "Printing list of candidates for axis " << axis << " which we have inserted so far." << endl); 348 int i=0; 349 for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) { 350 if (runner != BoundaryPoints[axis].begin()) 351 DoLog(0) && (Log() << Verbose(0) << ", " << i << ": " << *runner->second.second); 352 else 353 DoLog(0) && (Log() << Verbose(0) << i << ": " << *runner->second.second); 354 i++; 355 } 356 DoLog(0) && (Log() << Verbose(0) << endl); 347 if (DoLog(1)) { 348 for (int axis=0; axis < NDIM; axis++) { 349 std::stringstream output; 350 output << "Printing list of candidates for axis " << axis << " which we have inserted so far: "; 351 int i=0; 352 for(Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) { 353 if (runner != BoundaryPoints[axis].begin()) 354 output << ", " << i << ": " << *runner->second.second; 355 else 356 output << i << ": " << *runner->second.second; 357 i++; 358 } 359 LOG(1, output.str()); 360 } 357 361 } 358 362 … … 361 365 for (Boundaries::iterator runner = BoundaryPoints[axis].begin(); runner != BoundaryPoints[axis].end(); runner++) 362 366 if (!TesselStruct->AddBoundaryPoint(runner->second.second, 0)) 363 DoLog(2) && (Log()<< Verbose(2) << "Point " << *(runner->second.second) << " is already present." << endl);364 365 DoLog(0) && (Log() << Verbose(0) << "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary." << endl);367 LOG(2, "Point " << *(runner->second.second) << " is already present."); 368 369 LOG(0, "I found " << TesselStruct->PointsOnBoundaryCount << " points on the convex boundary."); 366 370 // now we have the whole set of edge points in the BoundaryList 367 371 368 372 // listing for debugging 369 // Log() << Verbose(1) << "Listing PointsOnBoundary:"; 373 //if (DoLog(1)) { 374 // std::stringstream output; 375 // output << "Listing PointsOnBoundary:"; 370 376 // for(PointMap::iterator runner = PointsOnBoundary.begin(); runner != PointsOnBoundary.end(); runner++) { 371 // Log() << Verbose(0)<< " " << *runner->second;377 // output << " " << *runner->second; 372 378 // } 373 // Log() << Verbose(0) << endl; 379 // LOG(1, output.str()); 380 //} 374 381 375 382 // 3a. guess starting triangle … … 382 389 // 3c. check whether all atoms lay inside the boundary, if not, add to boundary points, segment triangle into three with the new point 383 390 if (!TesselStruct->InsertStraddlingPoints(cloud, LCList)) 384 DoeLog(1) && (eLog()<< Verbose(1) << "Insertion of straddling points failed!" << endl);385 386 DoLog(0) && (Log() << Verbose(0) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " intermediate triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl);391 ELOG(1, "Insertion of straddling points failed!"); 392 393 LOG(0, "I created " << TesselStruct->TrianglesOnBoundary.size() << " intermediate triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points."); 387 394 388 395 // 4. Store triangles in tecplot file … … 396 403 for (LineMap::iterator LineRunner = TesselStruct->LinesOnBoundary.begin(); LineRunner != TesselStruct->LinesOnBoundary.end(); LineRunner++) { 397 404 line = LineRunner->second; 398 DoLog(1) && (Log() << Verbose(1) << "INFO: Current line is " << *line << "." << endl);405 LOG(1, "INFO: Current line is " << *line << "."); 399 406 if (!line->CheckConvexityCriterion()) { 400 DoLog(1) && (Log() << Verbose(1) << "... line " << *line << " is concave, flipping it." << endl);407 LOG(1, "... line " << *line << " is concave, flipping it."); 401 408 402 409 // flip the line 403 410 if (TesselStruct->PickFarthestofTwoBaselines(line) == 0.) 404 DoeLog(1) && (eLog()<< Verbose(1) << "Correction of concave baselines failed!" << endl);411 ELOG(1, "Correction of concave baselines failed!"); 405 412 else { 406 413 TesselStruct->FlipBaseline(line); 407 DoLog(1) && (Log() << Verbose(1) << "INFO: Correction of concave baselines worked." << endl);414 LOG(1, "INFO: Correction of concave baselines worked."); 408 415 LineRunner = TesselStruct->LinesOnBoundary.begin(); // LineRunner may have been erase if line was deleted from LinesOnBoundary 409 416 } … … 414 421 // 3e. we need another correction here, for TesselPoints that are below the surface (i.e. have an odd number of concave triangles surrounding it) 415 422 // if (!TesselStruct->CorrectConcaveTesselPoints(out)) 416 // Log() << Verbose(1) << "Correction of concave tesselpoints failed!" << endl;417 418 DoLog(0) && (Log() << Verbose(0) << "I created " << TesselStruct->TrianglesOnBoundary.size() << " triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points." << endl);423 // ELOG(1, "Correction of concave tesselpoints failed!"); 424 425 LOG(0, "I created " << TesselStruct->TrianglesOnBoundary.size() << " triangles with " << TesselStruct->LinesOnBoundary.size() << " lines and " << TesselStruct->PointsOnBoundary.size() << " points."); 419 426 420 427 // 4. Store triangles in tecplot file … … 440 447 441 448 if ((TesselStruct == NULL) || (TesselStruct->PointsOnBoundary.empty())) { 442 DoeLog(1) && (eLog()<< Verbose(1) << "TesselStruct is empty." << endl);449 ELOG(1, "TesselStruct is empty."); 443 450 return false; 444 451 } … … 446 453 PointMap::iterator PointRunner; 447 454 while (!TesselStruct->PointsOnBoundary.empty()) { 448 DoLog(1) && (Log() << Verbose(1) << "Remaining points are: "); 449 for (PointMap::iterator PointSprinter = TesselStruct->PointsOnBoundary.begin(); PointSprinter != TesselStruct->PointsOnBoundary.end(); PointSprinter++) 450 DoLog(0) && (Log() << Verbose(0) << *(PointSprinter->second) << "\t"); 451 DoLog(0) && (Log() << Verbose(0) << endl); 455 if (DoLog(1)) { 456 std::stringstream output; 457 output << "Remaining points are: "; 458 for (PointMap::iterator PointSprinter = TesselStruct->PointsOnBoundary.begin(); PointSprinter != TesselStruct->PointsOnBoundary.end(); PointSprinter++) 459 output << *(PointSprinter->second) << "\t"; 460 LOG(1, output.str()); 461 } 452 462 453 463 PointRunner = TesselStruct->PointsOnBoundary.begin(); … … 505 515 // check whether there is something to work on 506 516 if (TesselStruct == NULL) { 507 DoeLog(1) && (eLog()<< Verbose(1) << "TesselStruct is empty!" << endl);517 ELOG(1, "TesselStruct is empty!"); 508 518 return volume; 509 519 } … … 521 531 PointAdvance++; 522 532 point = PointRunner->second; 523 DoLog(1) && (Log() << Verbose(1) << "INFO: Current point is " << *point << "." << endl);533 LOG(1, "INFO: Current point is " << *point << "."); 524 534 for (LineMap::iterator LineRunner = point->lines.begin(); LineRunner != point->lines.end(); LineRunner++) { 525 535 line = LineRunner->second; 526 DoLog(1) && (Log() << Verbose(1) << "INFO: Current line of point " << *point << " is " << *line << "." << endl);536 LOG(1, "INFO: Current line of point " << *point << " is " << *line << "."); 527 537 if (!line->CheckConvexityCriterion()) { 528 538 // remove the point if needed 529 DoLog(1) && (Log() << Verbose(1) << "... point " << *point << " cannot be on convex envelope." << endl);539 LOG(1, "... point " << *point << " cannot be on convex envelope."); 530 540 volume += TesselStruct->RemovePointFromTesselatedSurface(point); 531 541 sprintf(dummy, "-first-%d", ++run); … … 548 558 LineAdvance++; 549 559 line = LineRunner->second; 550 DoLog(1) && (Log() << Verbose(1) << "INFO: Picking farthest baseline for line is " << *line << "." << endl);560 LOG(1, "INFO: Picking farthest baseline for line is " << *line << "."); 551 561 // take highest of both lines 552 562 if (TesselStruct->IsConvexRectangle(line) == NULL) { … … 571 581 // LineAdvance++; 572 582 // line = LineRunner->second; 573 // L og() << Verbose(1) << "INFO: Current line is " << *line << "." << endl;583 // LOG(1, "INFO: Current line is " << *line << "."); 574 584 // //if (LineAdvance != TesselStruct->LinesOnBoundary.end()) 575 // //L og() << Verbose(1) << "INFO: Next line will be " << *(LineAdvance->second) << "." << endl;585 // //LOG(1, "INFO: Next line will be " << *(LineAdvance->second) << "."); 576 586 // if (!line->CheckConvexityCriterion(out)) { 577 // L og() << Verbose(1) << "... line " << *line << " is concave, flipping it." << endl;587 // LOG(1, "INFO: ... line " << *line << " is concave, flipping it."); 578 588 // 579 589 // // take highest of both lines … … 589 599 590 600 // end 591 DoLog(0) && (Log() << Verbose(0) << "Volume is " << volume << "." << endl);601 LOG(0, "Volume is " << volume << "."); 592 602 return volume; 593 603 }; … … 622 632 const double h = x.Norm(); // distance of CoG to triangle 623 633 const double PyramidVolume = (1. / 3.) * G * h; // this formula holds for _all_ pyramids (independent of n-edge base or (not) centered peak) 624 L og() << Verbose(1) << "Area of triangle is " << setprecision(10) << G << " "634 LOG(1, "INFO: Area of triangle is " << setprecision(10) << G << " " 625 635 << (IsAngstroem ? "angstrom" : "atomiclength") << "^2, height is " 626 636 << h << " and the volume is " << PyramidVolume << " " 627 << (IsAngstroem ? "angstrom" : "atomiclength") << "^3." << endl;637 << (IsAngstroem ? "angstrom" : "atomiclength") << "^3."); 628 638 volume += PyramidVolume; 629 639 } 630 Log() << Verbose(0) << "RESULT: The summed volume is " << setprecision(6) 631 << volume << " " << (IsAngstroem ? "angstrom" : "atomiclength") << "^3." 632 << endl; 640 LOG(0, "RESULT: The summed volume is " << setprecision(6) 641 << volume << " " << (IsAngstroem ? "angstrom" : "atomiclength") << "^3."); 633 642 634 643 return volume; … … 722 731 totalmass += (*iter)->getType()->getMass(); 723 732 } 724 DoLog(0) && (Log() << Verbose(0) << "RESULT: The summed mass is " << setprecision(10) << totalmass << " atomicmassunit." << endl);725 DoLog(0) && (Log() << Verbose(0) << "RESULT: The average density is " << setprecision(10) << totalmass / clustervolume << " atomicmassunit/" << (IsAngstroem ? "angstrom" : "atomiclength") << "^3." << endl);733 LOG(0, "RESULT: The summed mass is " << setprecision(10) << totalmass << " atomicmassunit."); 734 LOG(0, "RESULT: The average density is " << setprecision(10) << totalmass / clustervolume << " atomicmassunit/" << (IsAngstroem ? "angstrom" : "atomiclength") << "^3."); 726 735 727 736 // solve cubic polynomial 728 DoLog(1) && (Log() << Verbose(1) << "Solving equidistant suspension in water problem ..." << endl);737 LOG(1, "Solving equidistant suspension in water problem ..."); 729 738 if (IsAngstroem) 730 739 cellvolume = (TotalNoClusters * totalmass / SOLVENTDENSITY_A - (totalmass / clustervolume)) / (celldensity - 1); 731 740 else 732 741 cellvolume = (TotalNoClusters * totalmass / SOLVENTDENSITY_a0 - (totalmass / clustervolume)) / (celldensity - 1); 733 DoLog(1) && (Log() << Verbose(1) << "Cellvolume needed for a density of " << celldensity << " g/cm^3 is " << cellvolume << " " << (IsAngstroem ? "angstrom" : "atomiclength") << "^3." << endl);742 LOG(1, "Cellvolume needed for a density of " << celldensity << " g/cm^3 is " << cellvolume << " " << (IsAngstroem ? "angstrom" : "atomiclength") << "^3."); 734 743 735 744 double minimumvolume = TotalNoClusters * (GreatestDiameter[0] * GreatestDiameter[1] * GreatestDiameter[2]); 736 DoLog(1) && (Log() << Verbose(1) << "Minimum volume of the convex envelope contained in a rectangular box is " << minimumvolume << " atomicmassunit/" << (IsAngstroem ? "angstrom" : "atomiclength") << "^3." << endl);745 LOG(1, "Minimum volume of the convex envelope contained in a rectangular box is " << minimumvolume << " atomicmassunit/" << (IsAngstroem ? "angstrom" : "atomiclength") << "^3."); 737 746 if (minimumvolume > cellvolume) { 738 DoeLog(1) && (eLog()<< Verbose(1) << "the containing box already has a greater volume than the envisaged cell volume!" << endl);739 DoLog(0) && (Log() << Verbose(0) << "Setting Box dimensions to minimum possible, the greatest diameters." << endl);747 ELOG(1, "the containing box already has a greater volume than the envisaged cell volume!"); 748 LOG(0, "Setting Box dimensions to minimum possible, the greatest diameters."); 740 749 for (int i = 0; i < NDIM; i++) 741 750 BoxLengths[i] = GreatestDiameter[i]; … … 749 758 double x2 = 0.; 750 759 if (gsl_poly_solve_cubic(BoxLengths[0], BoxLengths[1], BoxLengths[2], &x0, &x1, &x2) == 1) // either 1 or 3 on return 751 DoLog(0) && (Log() << Verbose(0) << "RESULT: The resulting spacing is: " << x0 << " ." << endl);760 LOG(0, "RESULT: The resulting spacing is: " << x0 << " ."); 752 761 else { 753 DoLog(0) && (Log() << Verbose(0) << "RESULT: The resulting spacings are: " << x0 << " and " << x1 << " and " << x2 << " ." << endl);762 LOG(0, "RESULT: The resulting spacings are: " << x0 << " and " << x1 << " and " << x2 << " ."); 754 763 x0 = x2; // sorted in ascending order 755 764 } … … 762 771 763 772 // set new box dimensions 764 DoLog(0) && (Log() << Verbose(0) << "Translating to box with these boundaries." << endl);773 LOG(0, "Translating to box with these boundaries."); 765 774 mol->SetBoxDimension(&BoxLengths); 766 775 mol->CenterInBox(); … … 769 778 // update Box of atoms by boundary 770 779 mol->SetBoxDimension(&BoxLengths); 771 DoLog(0) && (Log() << Verbose(0) << "RESULT: The resulting cell dimensions are: " << BoxLengths[0] << " and " << BoxLengths[1] << " and " << BoxLengths[2] << " with total volume of " << cellvolume << " " << (IsAngstroem ? "angstrom" : "atomiclength") << "^3." << endl);780 LOG(0, "RESULT: The resulting cell dimensions are: " << BoxLengths[0] << " and " << BoxLengths[1] << " and " << BoxLengths[2] << " with total volume of " << cellvolume << " " << (IsAngstroem ? "angstrom" : "atomiclength") << "^3."); 772 781 }; 773 782 … … 809 818 for (MoleculeList::iterator ListRunner = List->ListOfMolecules.begin(); ListRunner != List->ListOfMolecules.end(); ListRunner++) 810 819 if ((*ListRunner)->getAtomCount() > 0) { 811 DoLog(1) && (Log() << Verbose(1) << "Pre-creating linked cell lists for molecule " << *ListRunner << "." << endl);820 LOG(1, "Pre-creating linked cell lists for molecule " << *ListRunner << "."); 812 821 PointCloudAdaptor< molecule > cloud(*ListRunner, (*ListRunner)->name); 813 822 LCList[(*ListRunner)] = new LinkedCell(cloud, 10.); // get linked cell list 814 DoLog(1) && (Log() << Verbose(1) << "Pre-creating tesselation for molecule " << *ListRunner << "." << endl);823 LOG(1, "Pre-creating tesselation for molecule " << *ListRunner << "."); 815 824 TesselStruct[(*ListRunner)] = NULL; 816 825 FindNonConvexBorder((*ListRunner), TesselStruct[(*ListRunner)], (const LinkedCell *&)LCList[(*ListRunner)], 5., NULL); … … 820 829 filler->CenterEdge(&Inserter); 821 830 const int FillerCount = filler->getAtomCount(); 822 DoLog(2) && (Log() << Verbose(2) << "INFO: Filler molecule has the following bonds:" << endl);831 LOG(2, "INFO: Filler molecule has the following bonds:"); 823 832 for(molecule::iterator AtomRunner = filler->begin(); AtomRunner != filler->end(); ++AtomRunner) { 824 833 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); … … 827 836 ++BondRunner) { 828 837 if ((*BondRunner)->leftatom == *AtomRunner) 829 DoLog(2) && (Log() << Verbose(2) << " " << *(*BondRunner) << endl);838 LOG(2, " " << *(*BondRunner)); 830 839 } 831 840 } … … 837 846 for(int i=0;i<NDIM;i++) 838 847 N[i] = (int) ceil(1./FillerDistance[i]); 839 DoLog(1) && (Log() << Verbose(1) << "INFO: Grid steps are " << N[0] << ", " << N[1] << ", " << N[2] << "." << endl);848 LOG(1, "INFO: Grid steps are " << N[0] << ", " << N[1] << ", " << N[2] << "."); 840 849 841 850 // initialize seed of random number generator to current time … … 854 863 for (int i=0;i<NDIM;i++) 855 864 FillerTranslations[i] = RandomMolDisplacement*(random()/((rng_max-rng_min)/2.) - 1.); 856 DoLog(2) && (Log() << Verbose(2) << "INFO: Current Position is " << CurrentPosition << "+" << FillerTranslations << "." << endl);865 LOG(2, "INFO: Current Position is " << CurrentPosition << "+" << FillerTranslations << "."); 857 866 858 867 // go through all atoms … … 907 916 // insert into Filling 908 917 if (FillIt) { 909 DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is outer point." << endl);918 LOG(1, "INFO: Position at " << Inserter << " is outer point."); 910 919 // copy atom ... 911 920 CopyAtoms[(*iter)->getNr()] = (*iter)->clone(); 912 921 (*CopyAtoms[(*iter)->getNr()]).setPosition(Inserter); 913 922 Filling->AddAtom(CopyAtoms[(*iter)->getNr()]); 914 DoLog(1) && (Log() << Verbose(1) << "Filling atom " << **iter << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[(*iter)->getNr()]->getPosition()) << "." << endl);923 LOG(1, "Filling atom " << **iter << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[(*iter)->getNr()]->getPosition()) << "."); 915 924 } else { 916 DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is inner point, within boundary or outside of MaxDistance." << endl);925 LOG(1, "INFO: Position at " << Inserter << " is inner point, within boundary or outside of MaxDistance."); 917 926 CopyAtoms[(*iter)->getNr()] = NULL; 918 927 continue; … … 928 937 Binder = (*BondRunner); 929 938 if ((CopyAtoms[Binder->leftatom->getNr()] != NULL) && (CopyAtoms[Binder->rightatom->getNr()] != NULL)) { 930 L og() << Verbose(3) << "Adding Bond between " << *CopyAtoms[Binder->leftatom->getNr()] << " and " << *CopyAtoms[Binder->rightatom->getNr()]<< "." << endl;939 LOG(3, "Adding Bond between " << *CopyAtoms[Binder->leftatom->getNr()] << " and " << *CopyAtoms[Binder->rightatom->getNr()]<< "."); 931 940 Filling->AddBond(CopyAtoms[Binder->leftatom->getNr()], CopyAtoms[Binder->rightatom->getNr()], Binder->BondDegree); 932 941 } … … 997 1006 } 998 1007 if (Filling->empty()) { 999 DoLog(0) && (Log() << Verbose(0) << "Removing molecule " << Filling->getName() << ", all atoms have been removed." << std::endl);1008 LOG(0, "Removing molecule " << Filling->getName() << ", all atoms have been removed."); 1000 1009 World::getInstance().destroyMolecule(Filling); 1001 1010 Filling = NULL; … … 1034 1043 const bool result = (liste->size() == compareTo); 1035 1044 if (!result) { 1036 DoLog(0) && (Log() << Verbose(0) << "Skipping because of the following atoms:" << std::endl);1045 LOG(0, "Skipping because of the following atoms:"); 1037 1046 for (TesselPointSTLList::const_iterator iter = liste->begin(); 1038 1047 iter != liste->end(); 1039 1048 ++iter) { 1040 DoLog(0) && (Log() << Verbose(0) << **iter << std::endl);1049 LOG(0, **iter); 1041 1050 } 1042 1051 } … … 1106 1115 for (std::vector<molecule *>::iterator ListRunner = List.begin(); ListRunner != List.end(); ListRunner++) 1107 1116 if ((*ListRunner)->getAtomCount() > 0) { 1108 DoLog(1) && (Log() << Verbose(1) << "Pre-creating linked cell lists for molecule " << *ListRunner << "." << endl);1117 LOG(1, "Pre-creating linked cell lists for molecule " << *ListRunner << "."); 1109 1118 PointCloudAdaptor< molecule > cloud(*ListRunner, (*ListRunner)->name); 1110 1119 LCList[(*ListRunner)] = new LinkedCell(cloud, 10.); // get linked cell list … … 1116 1125 delete gravity; 1117 1126 //const int FillerCount = filler->getAtomCount(); 1118 DoLog(2) && (Log() << Verbose(2) << "INFO: Filler molecule has the following bonds:" << endl);1127 LOG(2, "INFO: Filler molecule has the following bonds:"); 1119 1128 for(molecule::iterator AtomRunner = filler->begin(); AtomRunner != filler->end(); ++AtomRunner) { 1120 1129 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); … … 1123 1132 ++BondRunner) 1124 1133 if ((*BondRunner)->leftatom == *AtomRunner) 1125 DoLog(2) && (Log() << Verbose(2) << " " << *(*BondRunner) << endl);1134 LOG(2, " " << *(*BondRunner)); 1126 1135 } 1127 1136 … … 1130 1139 for(int i=0;i<NDIM;i++) 1131 1140 N[i] = (int) ceil(1./FillerDistance[i]); 1132 DoLog(1) && (Log() << Verbose(1) << "INFO: Grid steps are " << N[0] << ", " << N[1] << ", " << N[2] << "." << endl);1141 LOG(1, "INFO: Grid steps are " << N[0] << ", " << N[1] << ", " << N[2] << "."); 1133 1142 1134 1143 // initialize seed of random number generator to current time … … 1147 1156 for (int i=0;i<NDIM;i++) // have the random values [-1,1]*RandomMolDisplacement 1148 1157 FillerTranslations[i] = RandomMolDisplacement*(random()/((rng_max-rng_min)/2.) - 1.); 1149 DoLog(2) && (Log() << Verbose(2) << "INFO: Current Position is " << CurrentPosition << "+" << FillerTranslations << "." << endl);1158 LOG(2, "INFO: Current Position is " << CurrentPosition << "+" << FillerTranslations << "."); 1150 1159 1151 1160 // ... and rotation matrix … … 1173 1182 if (FillIt) { 1174 1183 Inserter = CurrentPosition + FillerTranslations; 1175 DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is void point." << endl);1184 LOG(1, "INFO: Position at " << Inserter << " is void point."); 1176 1185 // fill! 1177 1186 Filling = filler->CopyMolecule(); … … 1195 1204 } 1196 1205 } else { 1197 DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is non-void point, within boundary or outside of MaxDistance." << endl);1206 LOG(1, "INFO: Position at " << Inserter << " is non-void point, within boundary or outside of MaxDistance."); 1198 1207 continue; 1199 1208 } … … 1221 1230 } 1222 1231 1223 DoLog(0) && (Log() << Verbose(0) << MolList->ListOfMolecules.size() << " molecules have been inserted." << std::endl);1232 LOG(0, MolList->ListOfMolecules.size() << " molecules have been inserted."); 1224 1233 1225 1234 for (std::map<molecule *, LinkedCell *>::iterator ListRunner = LCList.begin(); !LCList.empty(); ListRunner = LCList.begin()) { … … 1250 1259 1251 1260 if (TesselStruct == NULL) { 1252 DoLog(1) && (Log() << Verbose(1) << "Allocating Tesselation struct ..." << endl);1261 LOG(1, "Allocating Tesselation struct ..."); 1253 1262 TesselStruct= new Tesselation; 1254 1263 } else { 1255 1264 delete(TesselStruct); 1256 DoLog(1) && (Log() << Verbose(1) << "Re-Allocating Tesselation struct ..." << endl);1265 LOG(1, "Re-Allocating Tesselation struct ..."); 1257 1266 TesselStruct = new Tesselation; 1258 1267 } … … 1267 1276 // 1. get starting triangle 1268 1277 if (!TesselStruct->FindStartingTriangle(RADIUS, LCList)) { 1269 DoeLog(0) && (eLog() << Verbose(0) << "No valid starting triangle found." << endl);1278 ELOG(0, "No valid starting triangle found."); 1270 1279 //performCriticalExit(); 1271 1280 } … … 1280 1289 (cerr << "There are " << TesselStruct->TrianglesOnBoundary.size() << " triangles and " << TesselStruct->OpenLines.size() << " open lines to scan for candidates." << endl); 1281 1290 // 2a. print OpenLines without candidates 1282 DoLog(1) && (Log() << Verbose(1) << "There are the following open lines to scan for a candidates:" << endl);1291 LOG(1, "There are the following open lines to scan for a candidates:"); 1283 1292 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) 1284 1293 if (Runner->second->pointlist.empty()) 1285 DoLog(1) && (Log() << Verbose(1) << " " << *(Runner->second) << endl);1294 LOG(1, " " << *(Runner->second)); 1286 1295 1287 1296 // 2b. find best candidate for each OpenLine … … 1289 1298 1290 1299 // 2c. print OpenLines with candidates again 1291 DoLog(1) && (Log() << Verbose(1) << "There are " << TesselStruct->OpenLines.size() << " open lines to scan for the best candidates:" << endl);1300 LOG(1, "There are " << TesselStruct->OpenLines.size() << " open lines to scan for the best candidates:"); 1292 1301 for (CandidateMap::iterator Runner = TesselStruct->OpenLines.begin(); Runner != TesselStruct->OpenLines.end(); Runner++) 1293 DoLog(1) && (Log() << Verbose(1) << " " << *(Runner->second) << endl);1302 LOG(1, " " << *(Runner->second)); 1294 1303 1295 1304 // 2d. search for smallest ShortestAngle among all candidates … … 1299 1308 baseline = Runner->second; 1300 1309 ShortestAngle = baseline->ShortestAngle; 1301 DoLog(1) && (Log() << Verbose(1) << "New best candidate is " << *baseline->BaseLine << " with point " << *(*baseline->pointlist.begin()) << " and angle " << baseline->ShortestAngle << endl);1310 LOG(1, "New best candidate is " << *baseline->BaseLine << " with point " << *(*baseline->pointlist.begin()) << " and angle " << baseline->ShortestAngle); 1302 1311 } 1303 1312 } … … 1324 1333 // class TesselPoint *Runner = NULL; 1325 1334 // Runner = *iter; 1326 // L og() << Verbose(1) << "Checking on " << Runner->Name << " ... " << endl;1335 // LOG(1, "Checking on " << Runner->Name << " ... "); 1327 1336 // if (!->IsInnerPoint(Runner, LCList)) { 1328 // L og() << Verbose(2) << Runner->Name << " is outside of envelope, adding via degenerated triangles." << endl;1337 // LOG(2, Runner->Name << " is outside of envelope, adding via degenerated triangles."); 1329 1338 // ->AddBoundaryPointByDegeneratedTriangle(Runner, LCList); 1330 1339 // } else { 1331 // L og() << Verbose(2) << Runner->Name << " is inside of or on envelope." << endl;1340 // LOG(2, Runner->Name << " is inside of or on envelope."); 1332 1341 // } 1333 1342 // }
Note:
See TracChangeset
for help on using the changeset viewer.