- Timestamp:
- Apr 20, 2010, 12:20:10 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:
- 90f680
- Parents:
- a26ca5
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tesselation.cpp
ra26ca5 r711ac2 326 326 */ 327 327 BoundaryTriangleSet::BoundaryTriangleSet() : 328 top(NULL),329 AngleFromTop(-1.),330 328 Nr(-1) 331 329 { … … 343 341 */ 344 342 BoundaryTriangleSet::BoundaryTriangleSet(class BoundaryLineSet * const line[3], const int number) : 345 top(NULL),346 AngleFromTop(-1.),347 343 Nr(number) 348 344 { … … 397 393 } 398 394 //Log() << Verbose(0) << "Erasing triangle Nr." << Nr << " itself." << endl; 399 };400 401 void BoundaryTriangleSet::SetTopNode(const BoundaryTriangleSet * const topnode)402 {403 top = topnode;404 395 }; 405 396 … … 2252 2243 2253 2244 FindSecondPointForTesselation(BaseLine->endpoints[0]->node, NormalVector, Temporary, &ShortestAngle, RADIUS, LC); // we give same point as next candidate as its bonds are looked into in find_second_... 2254 if (Temporary == NULL) // have we found a second point? 2245 if (Temporary == NULL) { 2246 // have we found a second point? 2247 delete BaseLine; 2255 2248 continue; 2249 } 2256 2250 BaseLine->endpoints[1] = new BoundaryPointSet(Temporary); 2257 2251 … … 2299 2293 } 2300 2294 2301 if (BTS != NULL) // we have created one starting triangle 2295 if (BTS != NULL) { // we have created one starting triangle 2296 delete BaseLine; 2302 2297 break; 2303 else {2298 } else { 2304 2299 // remove all candidates from the list and then the list itself 2305 2300 OptCandidates.pointlist.clear(); … … 2655 2650 // add normal and degenerate triangles 2656 2651 Log() << Verbose(1) << "Triangle of endpoints " << *TPS[0] << "," << *TPS[1] << " and " << *TPS[2] << " is degenerated, adding both sides." << endl; 2657 BoundaryTriangleSet * const triangle =AddDegeneratedTriangle(CandidateLine, RADIUS, LC);2652 AddDegeneratedTriangle(CandidateLine, RADIUS, LC); 2658 2653 } else { 2659 2654 // add this triangle … … 2676 2671 * \param RADIUS radius of sphere 2677 2672 * \param *LC pointer to LinkedCell structure 2678 * \return pointer to created other triangle 2679 */ 2680 BoundaryTriangleSet * const Tesselation::AddDegeneratedTriangle(CandidateForTesselation &CandidateLine, const double RADIUS, const LinkedCell *LC) 2673 */ 2674 void Tesselation::AddDegeneratedTriangle(CandidateForTesselation &CandidateLine, const double RADIUS, const LinkedCell *LC) 2681 2675 { 2682 2676 Info FunctionInfo(__func__); 2683 BoundaryTriangleSet *triangle = NULL;2684 pair<LineMap::iterator,LineMap::iterator> FindPair[3];2685 int LineCase[3];2686 int count[3];2687 2677 Vector Center; 2688 2678 CandidateMap::const_iterator CandidateCheck = OpenLines.end(); 2689 2690 /// 1. For each new pair of endpoints, find and count the number of present lines 2691 Log() << Verbose(0) << "INFO: Counting present open lines ..." << endl; 2692 for (int i=0;i<3;i++) { 2693 BLS[i] = NULL; 2694 LineCase[i] = -1; 2695 // find already present lines 2696 FindPair[i] = TPS[(i+0)%3]->lines.equal_range(TPS[(i+1)%3]->Nr); 2697 // count their number 2698 count[i] = 0; 2699 Log() << Verbose(1) << "For line between " << *TPS[(i+0)%3] << " and " << *TPS[(i+1)%3] << ":" << endl; 2700 for (LineMap::iterator FindLine = FindPair[i].first; FindLine != FindPair[i].second; FindLine++) 2701 if (FindLine->second->triangles.size() == 1) { 2702 Log() << Verbose(1) << " open line " << *FindLine->second << "." << endl; 2703 count[i]++; 2704 } 2705 Log() << Verbose(1) << " SUM: there are " << count[i] << " line(s) present." << endl; 2706 } 2707 2708 /// 2. Create or pick the lines for the first triangle 2709 // for each count we have a different case: 2679 BoundaryTriangleSet *triangle = NULL; 2680 2681 /// 1. Create or pick the lines for the first triangle 2682 // for each amount of open lines we have a different case: 2710 2683 // case 0: no triangles at this line and not closed 2711 2684 // case 1: no triangles at new line is closed … … 2715 2688 Log() << Verbose(0) << "INFO: Creating/Picking lines for first triangle ..." << endl; 2716 2689 for (int i=0;i<3;i++) { 2690 BLS[i] = NULL; 2717 2691 Log() << Verbose(0) << "Current line is between " << *TPS[(i+0)%3] << " and " << *TPS[(i+1)%3] << ":" << endl; 2718 switch (count[i]) { 2719 case 0: 2720 AddNewTesselationTriangleLine(TPS[(i+0)%3], TPS[(i+1)%3], i); 2721 break; 2722 case 1: 2723 // // check whether present line has right candidate 2724 // CandidateCheck = OpenLines.find(FindPair[i].first->second); 2725 // if (CandidateCheck != OpenLines.end()) { 2726 // if (!CandidateCheck->second->pointlist.empty()) { 2727 // for (TesselPointList::const_iterator Runner = CandidateCheck->second->pointlist.begin(); Runner != CandidateCheck->second->pointlist.end(); ++Runner) { 2728 // Log() << Verbose(1) << "Found candidate " << *(*Runner) << " with Candidate center is " << CandidateCheck->second->OptCenter << ", desired opt center is " << CandidateLine.OptCenter << "." << endl; 2729 // if (((*Runner) == TPS[(i+2)%3]->node) && (CandidateLine.OptCenter == CandidateCheck->second->OptCenter)) { // seems like we found a line to connect to 2730 // AddExistingTesselationTriangleLine(CandidateCheck->first, i); 2731 // break; // have to break as a AddExistingTesselationTriangleLine changes OpenLines 2732 // } 2733 // } 2734 // } else { 2735 // Log() << Verbose(1) << "Open line between " << *TPS[(i+0)%3] << " and " << *TPS[(i+1)%3] << " has no candidate." << endl; 2736 // } 2737 // } else { 2738 // Log() << Verbose(1) << "No open lines present for line between " << *TPS[(i+0)%3] << " and " << *TPS[(i+1)%3] << "." << endl; 2739 // } 2740 // if (BLS[i] == NULL) { 2741 // AddNewTesselationTriangleLine(TPS[(i+0)%3], TPS[(i+1)%3], i); 2742 // } 2743 AddTesselationLine(&CandidateLine.OptCenter, TPS[(i+2)%3], TPS[(i+0)%3], TPS[(i+1)%3], i); 2744 break; 2745 default: 2746 case 2: 2747 AddTesselationLine(&CandidateLine.OptCenter, TPS[(i+2)%3], TPS[(i+0)%3], TPS[(i+1)%3], i); 2748 break; 2749 // DoeLog(0) && (eLog() << Verbose(0) << "There are more than two BoundaryPointSets between " << *TPS[(i+0)%3] << " and " << *TPS[(i+1)%3] << "." << endl); 2750 // performCriticalExit(); 2751 // break; 2752 } 2753 } 2754 2755 /// 3. create the first triangle and NormalVector and so on 2692 AddTesselationLine(&CandidateLine.OptCenter, TPS[(i+2)%3], TPS[(i+0)%3], TPS[(i+1)%3], i); 2693 } 2694 2695 /// 2. create the first triangle and NormalVector and so on 2756 2696 Log() << Verbose(0) << "INFO: Adding first triangle with center at " << CandidateLine.OptCenter << " ..." << endl; 2757 2697 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 2758 2698 AddTesselationTriangle(); 2759 // check whether triangle has been created 2760 BTS->SetTopNode(CandidateLine.T); 2761 if (CandidateLine.T != NULL) // start triangle has angle from top of -1 2762 BTS->AngleFromTop = CandidateLine.ShortestAngle; 2763 else 2764 BTS->AngleFromTop = -1.; 2699 2765 2700 // create normal vector 2766 2701 BTS->GetCenter(&Center); … … 2775 2710 triangle = BTS; 2776 2711 2777 /// 4. Gather candidates for each new line2712 /// 3. Gather candidates for each new line 2778 2713 Log() << Verbose(0) << "INFO: Adding candidates to new lines ..." << endl; 2779 2714 for (int i=0;i<3;i++) { … … 2787 2722 } 2788 2723 2789 /// 5. Create or pick the lines for the second triangle2724 /// 4. Create or pick the lines for the second triangle 2790 2725 Log() << Verbose(0) << "INFO: Creating/Picking lines for second triangle ..." << endl; 2791 2726 for (int i=0;i<3;i++) { 2792 2727 Log() << Verbose(0) << "Current line is between " << *TPS[(i+0)%3] << " and " << *TPS[(i+1)%3] << ":" << endl; 2793 switch (count[i]) { 2794 case 0: 2795 AddTesselationLine(&CandidateLine.OtherOptCenter, TPS[(i+2)%3], TPS[(i+0)%3], TPS[(i+1)%3], i); 2796 break; 2797 case 1: 2798 // // check whether present line has right candidate 2799 // CandidateCheck = OpenLines.find(BLS[i]); 2800 // BLS[i] = NULL; 2801 // if (CandidateCheck == OpenLines.end()) { // first triangle has closed present line 2802 // AddNewTesselationTriangleLine(TPS[(i+0)%3], TPS[(i+1)%3], i); 2803 // } else { 2804 // for (TesselPointList::const_iterator Runner = CandidateCheck->second->pointlist.begin(); Runner != CandidateCheck->second->pointlist.end(); ++Runner) { 2805 // Log() << Verbose(1) << "Found candidate " << *(*Runner) << " with Candidate center is " << CandidateCheck->second->OptCenter << ", desired other opt center is " << CandidateLine.OtherOptCenter << "." << endl; 2806 // if (((*Runner) == TPS[(i+2)%3]->node) && (CandidateLine.OtherOptCenter == CandidateCheck->second->OptCenter)) { // seems like we found a line to connect to 2807 // AddExistingTesselationTriangleLine(CandidateCheck->first, i); 2808 // break; // have to break as a AddExistingTesselationTriangleLine changes OpenLines 2809 // } 2810 // } 2811 // } 2812 // if (BLS[i] == NULL) { 2813 // DoeLog(0) && (eLog() << Verbose(0) << "BoundaryLine between " << TPS[(i+0)%3] << " and " << TPS[(i+1)%3] << " has not the correct candidate, i.e. the third endpoint: " << *TPS[(i+2)%3] << endl); 2814 // performCriticalExit(); 2815 // } 2816 AddTesselationLine(&CandidateLine.OtherOptCenter, TPS[(i+2)%3], TPS[(i+0)%3], TPS[(i+1)%3], i); 2817 break; 2818 case 2: 2819 default: 2820 AddTesselationLine(&CandidateLine.OtherOptCenter, TPS[(i+2)%3], TPS[(i+0)%3], TPS[(i+1)%3], i); 2821 break; 2822 // DoeLog(0) && (eLog() << Verbose(0) << "There are more than two BoundaryPointSets between " << *TPS[(i+0)%3] << " and " << *TPS[(i+1)%3] << "." << endl); 2823 // performCriticalExit(); 2824 // break; 2825 } 2826 } 2827 2828 /// 6. create the second triangle and NormalVector and so on 2728 AddTesselationLine(&CandidateLine.OtherOptCenter, TPS[(i+2)%3], TPS[(i+0)%3], TPS[(i+1)%3], i); 2729 } 2730 2731 /// 5. create the second triangle and NormalVector and so on 2829 2732 Log() << Verbose(0) << "INFO: Adding second triangle with center at " << CandidateLine.OtherOptCenter << " ..." << endl; 2830 2733 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 2831 2734 AddTesselationTriangle(); 2832 // check whether triangle has been created 2833 BTS->SetTopNode(CandidateLine.T); 2834 if (CandidateLine.T != NULL) // start triangle has angle from top of -1 2835 BTS->AngleFromTop = CandidateLine.ShortestAngle; 2836 else 2837 BTS->AngleFromTop = -1.; 2735 2838 2736 BTS->SphereCenter.CopyVector(&CandidateLine.OtherOptCenter); 2839 2737 // create normal vector in other direction … … 2846 2744 Log() << Verbose(0) << "--> New degenerate starting triangle with " << *BTS << " and normal vector " << BTS->NormalVector << " and no top triangle." << endl; 2847 2745 2848 return triangle; 2746 /// 6. Adding triangle to new lines 2747 Log() << Verbose(0) << "INFO: Adding second triangles to new lines ..." << endl; 2748 for (int i=0;i<3;i++) { 2749 Log() << Verbose(0) << "Current line is between " << *TPS[(i+0)%3] << " and " << *TPS[(i+1)%3] << ":" << endl; 2750 CandidateCheck = OpenLines.find(BLS[i]); 2751 if ((CandidateCheck != OpenLines.end()) && (CandidateCheck->second->pointlist.empty())) { 2752 if (CandidateCheck->second->T == NULL) 2753 CandidateCheck->second->T = BTS; 2754 } 2755 } 2849 2756 }; 2850 2757 … … 2866 2773 BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount); 2867 2774 AddTesselationTriangle(); 2868 // store values from tesselation procedure therein2869 BTS->SetTopNode(CandidateLine.T);2870 if (CandidateLine.T != NULL) // start triangle has angle from top of -12871 BTS->AngleFromTop = CandidateLine.ShortestAngle;2872 else2873 BTS->AngleFromTop = -1.;2874 2775 2875 2776 // create normal vector … … 5064 4965 } 5065 4966 } 4967 delete(DegeneratedTriangles); 5066 4968 5067 4969 /// 3. Find connected endpoint candidates and put them into a polygon -
src/tesselation.hpp
ra26ca5 r711ac2 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);166 165 167 166 class BoundaryPointSet *endpoints[3]; 168 167 class BoundaryLineSet *lines[3]; 169 const BoundaryTriangleSet *top; //!< triangle was instantiated during tesselation from this triangle170 double AngleFromTop;171 168 Vector NormalVector; 172 169 Vector SphereCenter; … … 288 285 void AddTesselationTriangle(const int nr); 289 286 void AddCandidateTriangle(CandidateForTesselation &CandidateLine); 290 BoundaryTriangleSet * constAddDegeneratedTriangle(CandidateForTesselation &CandidateLine, const double RADIUS, const LinkedCell *LC);287 void AddDegeneratedTriangle(CandidateForTesselation &CandidateLine, const double RADIUS, const LinkedCell *LC); 291 288 void AddCandidatePolygon(CandidateForTesselation CandidateLine, const double RADIUS, const LinkedCell *LC); 292 289 void RemoveTesselationTriangle(class BoundaryTriangleSet *triangle);
Note:
See TracChangeset
for help on using the changeset viewer.