Changeset 09898c
- Timestamp:
- Apr 12, 2010, 4:44:29 PM (15 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- f8bd7d
- Parents:
- ffe885
- git-author:
- Frederik Heber <heber@…> (04/12/10 16:35:12)
- git-committer:
- Frederik Heber <heber@…> (04/12/10 16:44:29)
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tesselation.cpp
rffe885 r09898c 326 326 */ 327 327 BoundaryTriangleSet::BoundaryTriangleSet() : 328 top(NULL), 329 AngleFromTop(-1.), 328 330 Nr(-1) 329 331 { … … 341 343 */ 342 344 BoundaryTriangleSet::BoundaryTriangleSet(class BoundaryLineSet * const line[3], const int number) : 345 top(NULL), 346 AngleFromTop(-1.), 343 347 Nr(number) 344 348 { … … 393 397 } 394 398 //Log() << Verbose(0) << "Erasing triangle Nr." << Nr << " itself." << endl; 399 }; 400 401 void BoundaryTriangleSet::SetTopNode(const BoundaryTriangleSet * const topnode) 402 { 403 top = topnode; 395 404 }; 396 405 … … 995 1004 CandidateForTesselation::CandidateForTesselation (BoundaryLineSet* line) : 996 1005 BaseLine(line), 1006 ThirdPoint(NULL), 1007 T(NULL), 997 1008 ShortestAngle(2.*M_PI), 998 1009 OtherShortestAngle(2.*M_PI) … … 1004 1015 /** Constructor of class CandidateForTesselation. 1005 1016 */ 1006 CandidateForTesselation::CandidateForTesselation (TesselPoint *candidate, BoundaryLineSet* line, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) :1017 CandidateForTesselation::CandidateForTesselation (TesselPoint *candidate, BoundaryLineSet* line, BoundaryPointSet* point, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) : 1007 1018 BaseLine(line), 1019 ThirdPoint(point), 1020 T(NULL), 1008 1021 ShortestAngle(2.*M_PI), 1009 1022 OtherShortestAngle(2.*M_PI) … … 1017 1030 */ 1018 1031 CandidateForTesselation::~CandidateForTesselation() { 1019 BaseLine = NULL;1020 1032 }; 1021 1033 … … 1028 1040 bool CandidateForTesselation::CheckValidity(const double RADIUS, const LinkedCell *LC) const 1029 1041 { 1042 Info FunctionInfo(__func__); 1043 1030 1044 const double radiusSquared = RADIUS; 1031 1045 list<const Vector *> VectorList; 1032 1046 VectorList.push_back(&OptCenter); 1033 VectorList.push_back(&OtherOptCenter); 1034 1047 //VectorList.push_back(&OtherOptCenter); // don't check the other (wrong) center 1048 1049 if (!pointlist.empty()) 1050 DoLog(1) && (Log() << Verbose(1) << "INFO: Checking whether sphere contains candidate list " << *(*pointlist.begin()) << " and baseline " << *BaseLine->endpoints[0] << "<->" << *BaseLine->endpoints[1] << " only ..." << endl); 1051 else 1052 DoLog(1) && (Log() << Verbose(1) << "INFO: Checking whether sphere with no candidates contains baseline " << *BaseLine->endpoints[0] << "<->" << *BaseLine->endpoints[1] << " only ..." << endl); 1035 1053 // check baseline for OptCenter and OtherOptCenter being on sphere's surface 1036 1054 for (list<const Vector *>::const_iterator VRunner = VectorList.begin(); VRunner != VectorList.end(); ++VRunner) { 1037 1055 for (int i=0;i<2;i++) 1038 1056 if (fabs((*VRunner)->DistanceSquared(BaseLine->endpoints[i]->node->node) - radiusSquared) < MYEPSILON) { 1039 DoeLog(1) && (eLog() << Verbose(1) << "Endpoint " << BaseLine->endpoints[i] << " is out of sphere at " << (*VRunner) << "." << endl);1057 DoeLog(1) && (eLog() << Verbose(1) << "Endpoint " << BaseLine->endpoints[i] << " is out of sphere at " << *(*VRunner) << "." << endl); 1040 1058 return false; 1041 1059 } … … 1047 1065 for (list<const Vector *>::const_iterator VRunner = VectorList.begin(); VRunner != VectorList.end(); ++VRunner) { 1048 1066 if (fabs((*VRunner)->DistanceSquared(Walker->node) - radiusSquared) < MYEPSILON) { 1049 DoeLog(1) && (eLog() << Verbose(1) << "Candidate " << Walker << " is out of sphere at " << (*VRunner) << "." << endl);1067 DoeLog(1) && (eLog() << Verbose(1) << "Candidate " << Walker << " is out of sphere at " << *(*VRunner) << "." << endl); 1050 1068 return false; 1051 1069 } … … 1053 1071 } 1054 1072 1055 // check for no other points being inside the sphere1073 DoLog(1) && (Log() << Verbose(1) << "INFO: Checking whether sphere contains no others points ..." << endl); 1056 1074 bool flag = true; 1057 1075 for (list<const Vector *>::const_iterator VRunner = VectorList.begin(); VRunner != VectorList.end(); ++VRunner) { 1058 1076 // get all points inside the sphere 1059 1077 TesselPointList *ListofPoints = LC->GetPointsInsideSphere(RADIUS, (*VRunner)); 1060 cout << Verbose(1) << "CheckValidity: There are " << ListofPoints->size() << " points inside the sphere at " << (*VRunner) << "." << endl;1061 1078 // remove baseline's endpoints and candidates 1062 1079 for (int i=0;i<2;i++) 1063 1080 ListofPoints->remove(BaseLine->endpoints[i]->node); 1064 for (TesselPointList::const_iterator Runner = pointlist.begin(); Runner != pointlist. begin(); ++Runner)1081 for (TesselPointList::const_iterator Runner = pointlist.begin(); Runner != pointlist.end(); ++Runner) 1065 1082 ListofPoints->remove(*Runner); 1066 1083 if (!ListofPoints->empty()) { 1084 cout << Verbose(1) << "CheckValidity: There are still " << ListofPoints->size() << " points inside the sphere." << endl; 1067 1085 flag = false; 1068 DoeLog(1) && (eLog() << Verbose(1) << "External atoms inside of sphere at " << (*VRunner) << ":" << endl);1069 for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints-> begin(); ++Runner)1070 DoeLog(1) && (eLog() << Verbose(1) << " " << * Runner<< endl);1086 DoeLog(1) && (eLog() << Verbose(1) << "External atoms inside of sphere at " << *(*VRunner) << ":" << endl); 1087 for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner) 1088 DoeLog(1) && (eLog() << Verbose(1) << " " << *(*Runner) << endl); 1071 1089 } 1072 1090 delete(ListofPoints); 1091 1092 // check with animate_sphere.tcl VMD script 1093 if (ThirdPoint != NULL) { 1094 cout << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr+1 << " " << BaseLine->endpoints[1]->Nr+1 << " " << ThirdPoint->Nr+1 << " " << RADIUS << " "; 1095 cout << OldCenter.x[0] << " " << OldCenter.x[1] << " " << OldCenter.x[2] << " "; 1096 cout << (*VRunner)->x[0] << " " << (*VRunner)->x[1] << " " << (*VRunner)->x[2] << endl; 1097 } else { 1098 cout << Verbose(1) << "Check by: ... missing third point ..." << endl; 1099 cout << Verbose(1) << "Check by: animate_sphere 0 " << BaseLine->endpoints[0]->Nr+1 << " " << BaseLine->endpoints[1]->Nr+1 << " ??? " << RADIUS << " "; 1100 cout << OldCenter.x[0] << " " << OldCenter.x[1] << " " << OldCenter.x[2] << " "; 1101 cout << (*VRunner)->x[0] << " " << (*VRunner)->x[1] << " " << (*VRunner)->x[2] << endl; 1102 } 1073 1103 } 1074 1104 return flag; … … 2362 2392 Vector SearchDirection; 2363 2393 Vector helper; 2364 TesselPoint *ThirdNode= NULL;2394 BoundaryPointSet *ThirdPoint = NULL; 2365 2395 LineMap::iterator testline; 2366 2396 double radius, CircleRadius; 2367 2397 2368 2398 for (int i=0;i<3;i++) 2369 if ((T.endpoints[i] ->node != CandidateLine.BaseLine->endpoints[0]->node) && (T.endpoints[i]->node != CandidateLine.BaseLine->endpoints[1]->node)) {2370 Third Node = T.endpoints[i]->node;2399 if ((T.endpoints[i] != CandidateLine.BaseLine->endpoints[0]) && (T.endpoints[i] != CandidateLine.BaseLine->endpoints[1])) { 2400 ThirdPoint = T.endpoints[i]; 2371 2401 break; 2372 2402 } 2373 Log() << Verbose(0) << "Current baseline is " << *CandidateLine.BaseLine << " with ThirdNode " << *ThirdNode << " of triangle " << T << "." << endl; 2403 Log() << Verbose(0) << "Current baseline is " << *CandidateLine.BaseLine << " with ThirdPoint " << *ThirdPoint << " of triangle " << T << "." << endl; 2404 2405 CandidateLine.T = &T; 2374 2406 2375 2407 // construct center of circle … … 2398 2430 SearchDirection.MakeNormalVector(&RelativeSphereCenter, &CirclePlaneNormal); 2399 2431 helper.CopyVector(&CircleCenter); 2400 helper.SubtractVector(Third Node->node);2432 helper.SubtractVector(ThirdPoint->node->node); 2401 2433 if (helper.ScalarProduct(&SearchDirection) < -HULLEPSILON)// ohoh, SearchDirection points inwards! 2402 2434 SearchDirection.Scale(-1.); … … 2408 2440 2409 2441 // add third point 2410 FindThirdPointForTesselation(T.NormalVector, SearchDirection, T.SphereCenter, CandidateLine, Third Node, RADIUS, LC);2442 FindThirdPointForTesselation(T.NormalVector, SearchDirection, T.SphereCenter, CandidateLine, ThirdPoint, RADIUS, LC); 2411 2443 2412 2444 } else { … … 2519 2551 Vector Center; 2520 2552 TesselPoint * const TurningPoint = CandidateLine.BaseLine->endpoints[0]->node; 2553 TesselPointList::iterator Runner; 2554 TesselPointList::iterator Sprinter; 2521 2555 2522 2556 // fill the set of neighbours … … 2527 2561 TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(&SetOfNeighbours, TurningPoint, CandidateLine.BaseLine->endpoints[1]->node->node); 2528 2562 2529 // go through all angle-sorted candidates (in degenerate n-nodes case we may have to add multiple triangles)2530 2563 Log() << Verbose(0) << "List of Candidates for Turning Point " << *TurningPoint << ":" << endl; 2531 2564 for (TesselPointList::iterator TesselRunner = connectedClosestPoints->begin(); TesselRunner != connectedClosestPoints->end(); ++TesselRunner) 2532 2565 Log() << Verbose(0) << " " << **TesselRunner << endl; 2533 TesselPointList::iterator Runner = connectedClosestPoints->begin(); 2534 TesselPointList::iterator Sprinter = Runner; 2566 2567 // go through all angle-sorted candidates (in degenerate n-nodes case we may have to add multiple triangles) 2568 Runner = connectedClosestPoints->begin(); 2569 Sprinter = Runner; 2535 2570 Sprinter++; 2536 2571 while(Sprinter != connectedClosestPoints->end()) { … … 2549 2584 AddTesselationTriangle(); 2550 2585 BTS->GetCenter(&Center); 2586 BTS->SetTopNode(CandidateLine.T); 2587 if (CandidateLine.T != NULL) // start triangle has angle from top of -1 2588 BTS->AngleFromTop = CandidateLine.ShortestAngle; 2589 else 2590 BTS->AngleFromTop = -1.; 2551 2591 Center.SubtractVector(&CandidateLine.OptCenter); 2552 2592 BTS->SphereCenter.CopyVector(&CandidateLine.OptCenter); 2553 2593 BTS->GetNormalVector(Center); 2554 2594 2555 Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector << "." << endl; 2595 if (CandidateLine.T != NULL) 2596 Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector << ", from " << *CandidateLine.T << " and angle " << CandidateLine.ShortestAngle << "." << endl; 2597 else 2598 Log() << Verbose(0) << "--> New starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle." << endl; 2556 2599 Runner = Sprinter; 2557 2600 Sprinter++; … … 2946 2989 * @param OldSphereCenter center of sphere for base triangle, relative to center of BaseLine, giving null angle for the parameter circle 2947 2990 * @param CandidateLine CandidateForTesselation with the current base line and list of candidates and ShortestAngle 2948 * @param Third Nodethird point to avoid in search2991 * @param ThirdPoint third point to avoid in search 2949 2992 * @param RADIUS radius of sphere 2950 2993 * @param *LC LinkedCell structure with neighbouring points 2951 2994 */ 2952 void Tesselation::FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, CandidateForTesselation &CandidateLine, const class TesselPoint * const ThirdNode, const double RADIUS, const LinkedCell *LC) const2995 void Tesselation::FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, CandidateForTesselation &CandidateLine, const class BoundaryPointSet * const ThirdPoint, const double RADIUS, const LinkedCell *LC) const 2953 2996 { 2954 2997 Info FunctionInfo(__func__); … … 2971 3014 Log() << Verbose(1) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl; 2972 3015 3016 // copy old center 3017 CandidateLine.OldCenter.CopyVector(&OldSphereCenter); 3018 CandidateLine.ThirdPoint = ThirdPoint; 3019 CandidateLine.pointlist.clear(); 3020 2973 3021 // construct center of circle 2974 3022 CircleCenter.CopyVector(CandidateLine.BaseLine->endpoints[0]->node->node); … … 2983 3031 RelativeOldSphereCenter.SubtractVector(&CircleCenter); 2984 3032 2985 // calculate squared radius TesselPoint *Third Node,f circle3033 // calculate squared radius TesselPoint *ThirdPoint,f circle 2986 3034 radius = CirclePlaneNormal.NormSquared()/4.; 2987 3035 if (radius < RADIUS*RADIUS) { … … 3095 3143 } else { 3096 3144 if ((Candidate != NULL) && (CandidateLine.pointlist.begin() != CandidateLine.pointlist.end())) { 3097 Log() << Verbose(1) << "REJECT: Old candidate " << *( CandidateLine.pointlist.begin()) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl;3145 Log() << Verbose(1) << "REJECT: Old candidate " << *(*CandidateLine.pointlist.begin()) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl; 3098 3146 } else { 3099 3147 Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl; … … 3107 3155 } 3108 3156 } else { 3109 if (Third Node!= NULL) {3110 Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " and " << *Third Node<< " contains Candidate " << *Candidate << "." << endl;3157 if (ThirdPoint != NULL) { 3158 Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " and " << *ThirdPoint << " contains Candidate " << *Candidate << "." << endl; 3111 3159 } else { 3112 3160 Log() << Verbose(1) << "REJECT: Base triangle " << *CandidateLine.BaseLine << " contains Candidate " << *Candidate << "." << endl; … … 3120 3168 } 3121 3169 } else { 3122 if (Third Node!= NULL)3123 Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and third node " << *Third Node<< " is too big!" << endl;3170 if (ThirdPoint != NULL) 3171 Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " and third node " << *ThirdPoint << " is too big!" << endl; 3124 3172 else 3125 3173 Log() << Verbose(1) << "Circumcircle for base line " << *CandidateLine.BaseLine << " is too big!" << endl; 3126 3174 } 3127 3175 3128 DoLog(1) && (Log() << Verbose(1) << "INFO: Checking whether sphere contains candidate list and baseline only ..." << endl);3129 3176 if (!CandidateLine.CheckValidity(RADIUS, LC)) { 3130 3177 DoeLog(0) && (eLog() << Verbose(0) << "There were other points contained in the rolling sphere as well!" << endl); -
src/tesselation.hpp
rffe885 r09898c 42 42 43 43 #define DoTecplotOutput 1 44 #define DoRaster3DOutput 044 #define DoRaster3DOutput 1 45 45 #define DoVRMLOutput 0 46 46 #define TecplotSuffix ".dat" … … 163 163 bool IsPresentTupel(const BoundaryPointSet * const Points[3]) const; 164 164 bool IsPresentTupel(const BoundaryTriangleSet * const T) const; 165 void SetTopNode(const BoundaryTriangleSet * const topnode); 165 166 166 167 class BoundaryPointSet *endpoints[3]; 167 168 class BoundaryLineSet *lines[3]; 169 const BoundaryTriangleSet *top; //!< triangle was instantiated during tesselation from this triangle 170 double AngleFromTop; 168 171 Vector NormalVector; 169 172 Vector SphereCenter; … … 249 252 public : 250 253 CandidateForTesselation(BoundaryLineSet* currentBaseLine); 251 CandidateForTesselation(TesselPoint* candidate, BoundaryLineSet* currentBaseLine, Vector OptCandidateCenter, Vector OtherOptCandidateCenter);254 CandidateForTesselation(TesselPoint* candidate, BoundaryLineSet* currentBaseLine, BoundaryPointSet *point, Vector OptCandidateCenter, Vector OtherOptCandidateCenter); 252 255 ~CandidateForTesselation(); 253 256 … … 255 258 256 259 TesselPointList pointlist; 257 BoundaryLineSet *BaseLine; 260 const BoundaryLineSet * BaseLine; 261 const BoundaryPointSet * ThirdPoint; 262 const BoundaryTriangleSet *T; 263 Vector OldCenter; 258 264 Vector OptCenter; 259 265 Vector OtherOptCenter; … … 289 295 void FindStartingTriangle(const double RADIUS, const LinkedCell *LC); 290 296 void FindSecondPointForTesselation(class TesselPoint* a, Vector Oben, class TesselPoint*& OptCandidate, double Storage[3], double RADIUS, const LinkedCell *LC); 291 void FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, CandidateForTesselation &CandidateLine, const class TesselPoint * const ThirdNode, const double RADIUS, const LinkedCell *LC) const;297 void FindThirdPointForTesselation(Vector &NormalVector, Vector &SearchDirection, Vector &OldSphereCenter, CandidateForTesselation &CandidateLine, const class BoundaryPointSet * const ThirdNode, const double RADIUS, const LinkedCell *LC) const; 292 298 bool FindNextSuitableTriangle(CandidateForTesselation &CandidateLine, BoundaryTriangleSet &T, const double& RADIUS, const LinkedCell *LC); 293 299 int CheckPresenceOfTriangle(class TesselPoint *Candidates[3]) const;
Note:
See TracChangeset
for help on using the changeset viewer.