Changeset 125b3c
- Timestamp:
- Dec 17, 2009, 5:45:35 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:
- 73b510
- Parents:
- 0b2dd2
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tesselation.cpp
r0b2dd2 r125b3c 879 879 CandidateForTesselation::CandidateForTesselation (TesselPoint *candidate, BoundaryLineSet* line, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) : 880 880 BaseLine(line), 881 IsDegenerated(false),882 881 ShortestAngle(2.*M_PI), 883 882 OtherShortestAngle(2.*M_PI) … … 2781 2780 double otherradius; 2782 2781 double alpha, Otheralpha; // angles (i.e. parameter for the circle). 2783 bool IsDegenerated;2784 2782 int N[NDIM], Nlower[NDIM], Nupper[NDIM]; 2785 2783 TesselPoint *Candidate = NULL; 2786 TesselPoint *CandidateTriangle[3];2787 2784 2788 2785 Log() << Verbose(1) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl; … … 2799 2796 RelativeOldSphereCenter.CopyVector(&OldSphereCenter); 2800 2797 RelativeOldSphereCenter.SubtractVector(&CircleCenter); 2801 2802 CandidateTriangle[0] = CandidateLine.BaseLine->endpoints[0]->node;2803 CandidateTriangle[1] = CandidateLine.BaseLine->endpoints[1]->node;2804 2798 2805 2799 // calculate squared radius TesselPoint *ThirdNode,f circle … … 2859 2853 Log() << Verbose(1) << "INFO: NewPlaneCenter is " << NewPlaneCenter << "." << endl; 2860 2854 2861 if ( (NewNormalVector.MakeNormalVector(CandidateLine.BaseLine->endpoints[0]->node->node, CandidateLine.BaseLine->endpoints[1]->node->node, Candidate->node))2855 if (NewNormalVector.MakeNormalVector(CandidateLine.BaseLine->endpoints[0]->node->node, CandidateLine.BaseLine->endpoints[1]->node->node, Candidate->node) 2862 2856 && (fabs(NewNormalVector.NormSquared()) > HULLEPSILON) 2863 2857 ) { … … 2889 2883 alpha = min(alpha, Otheralpha); 2890 2884 2891 CandidateTriangle[2] = Candidate; 2892 // the idea of the IsDegenerated flag is not to put a penalty on degenerated triangles, but to push them to the 2893 // very end of the Tesselation::OpenLines list. 2894 IsDegenerated = (CheckPresenceOfTriangle(CandidateTriangle) >= 3); 2895 if (!IsDegenerated && CandidateLine.IsDegenerated) { // if current is not, but old one was, comparison would be unfair 2896 // if there is a better candidate, drop the current list and add the new candidate 2897 // otherwise ignore the new candidate and keep the list 2898 if (CandidateLine.ShortestAngle-2.*M_PI > (alpha - HULLEPSILON)) { 2899 if (fabs(alpha - Otheralpha) > MYEPSILON) { 2900 CandidateLine.OptCenter.CopyVector(&NewSphereCenter); 2901 CandidateLine.OtherOptCenter.CopyVector(&OtherNewSphereCenter); 2902 } else { 2903 CandidateLine.OptCenter.CopyVector(&OtherNewSphereCenter); 2904 CandidateLine.OtherOptCenter.CopyVector(&NewSphereCenter); 2905 } 2906 // if there is an equal candidate, add it to the list without clearing the list 2907 if ((CandidateLine.ShortestAngle-2.*M_PI - HULLEPSILON) < alpha) { 2908 CandidateLine.pointlist.push_back(Candidate); 2909 Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with " 2910 << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl; 2911 } else { 2912 // remove all candidates from the list and then the list itself 2913 CandidateLine.pointlist.clear(); 2914 CandidateLine.pointlist.push_back(Candidate); 2915 Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with " 2916 << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl; 2917 } 2918 CandidateLine.ShortestAngle = alpha; 2919 CandidateLine.IsDegenerated = IsDegenerated; 2920 if (IsDegenerated) 2921 CandidateLine.ShortestAngle += 2.*M_PI; 2922 Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl; 2885 // if there is a better candidate, drop the current list and add the new candidate 2886 // otherwise ignore the new candidate and keep the list 2887 if (CandidateLine.ShortestAngle > (alpha - HULLEPSILON)) { 2888 if (fabs(alpha - Otheralpha) > MYEPSILON) { 2889 CandidateLine.OptCenter.CopyVector(&NewSphereCenter); 2890 CandidateLine.OtherOptCenter.CopyVector(&OtherNewSphereCenter); 2923 2891 } else { 2924 if ((Candidate != NULL) && (CandidateLine.pointlist.begin() != CandidateLine.pointlist.end())) { 2925 Log() << Verbose(1) << "REJECT: Old candidate " << *(Candidate) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl; 2926 } else { 2927 Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl; 2928 } 2892 CandidateLine.OptCenter.CopyVector(&OtherNewSphereCenter); 2893 CandidateLine.OtherOptCenter.CopyVector(&NewSphereCenter); 2929 2894 } 2895 // if there is an equal candidate, add it to the list without clearing the list 2896 if ((CandidateLine.ShortestAngle - HULLEPSILON) < alpha) { 2897 CandidateLine.pointlist.push_back(Candidate); 2898 Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with " 2899 << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl; 2900 } else { 2901 // remove all candidates from the list and then the list itself 2902 CandidateLine.pointlist.clear(); 2903 CandidateLine.pointlist.push_back(Candidate); 2904 Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with " 2905 << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl; 2906 } 2907 CandidateLine.ShortestAngle = alpha; 2908 Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl; 2930 2909 } else { 2931 // if there is a better candidate, drop the current list and add the new candidate 2932 // otherwise ignore the new candidate and keep the list 2933 if (CandidateLine.ShortestAngle > (alpha - HULLEPSILON)) { 2934 if (fabs(alpha - Otheralpha) > MYEPSILON) { 2935 CandidateLine.OptCenter.CopyVector(&NewSphereCenter); 2936 CandidateLine.OtherOptCenter.CopyVector(&OtherNewSphereCenter); 2937 } else { 2938 CandidateLine.OptCenter.CopyVector(&OtherNewSphereCenter); 2939 CandidateLine.OtherOptCenter.CopyVector(&NewSphereCenter); 2940 } 2941 // if there is an equal candidate, add it to the list without clearing the list 2942 if ((CandidateLine.ShortestAngle - HULLEPSILON) < alpha) { 2943 CandidateLine.pointlist.push_back(Candidate); 2944 Log() << Verbose(0) << "ACCEPT: We have found an equally good candidate: " << *(Candidate) << " with " 2945 << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl; 2946 } else { 2947 // remove all candidates from the list and then the list itself 2948 CandidateLine.pointlist.clear(); 2949 CandidateLine.pointlist.push_back(Candidate); 2950 Log() << Verbose(0) << "ACCEPT: We have found a better candidate: " << *(Candidate) << " with " 2951 << alpha << " and circumsphere's center at " << CandidateLine.OptCenter << "." << endl; 2952 } 2953 CandidateLine.ShortestAngle = alpha; 2954 Log() << Verbose(0) << "INFO: There are " << CandidateLine.pointlist.size() << " candidates in the list now." << endl; 2910 if ((Candidate != NULL) && (CandidateLine.pointlist.begin() != CandidateLine.pointlist.end())) { 2911 Log() << Verbose(1) << "REJECT: Old candidate " << *(Candidate) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl; 2955 2912 } else { 2956 if ((Candidate != NULL) && (CandidateLine.pointlist.begin() != CandidateLine.pointlist.end())) { 2957 Log() << Verbose(1) << "REJECT: Old candidate " << *(Candidate) << " with " << CandidateLine.ShortestAngle << " is better than new one " << *Candidate << " with " << alpha << " ." << endl; 2958 } else { 2959 Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl; 2960 } 2913 Log() << Verbose(1) << "REJECT: Candidate " << *Candidate << " with " << alpha << " was rejected." << endl; 2961 2914 } 2962 2915 } 2963 2964 2916 } else { 2965 2917 Log() << Verbose(1) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl; … … 4288 4240 TriangleSet *T = (*PolygonRunner)->GetAllContainedTrianglesFromEndpoints(); 4289 4241 4242 // check whether number is bigger than 2, otherwise it's just a simply degenerated one and nothing to do. 4290 4243 if (T->size() == 2) { 4291 4244 Log() << Verbose(1) << " Skipping degenerated polygon, is just a (already simply degenerated) triangle." << endl; 4292 4245 delete(T); 4293 4246 continue; 4247 } 4248 4249 // check whether number is even 4250 // If this case occurs, we have to think about it! 4251 // The Problem is probably due to two degenerated polygons being connected by a bridging, non-degenerated polygon, as somehow one node has 4252 // connections to either polygon ... 4253 if (T->size() % 2 != 0) { 4254 eLog() << Verbose(0) << " degenerated polygon contains an odd number of triangles, probably contains bridging non-degenerated ones, too!" << endl; 4255 performCriticalExit(); 4294 4256 } 4295 4257 -
src/tesselation.hpp
r0b2dd2 r125b3c 246 246 Vector OptCenter; 247 247 Vector OtherOptCenter; 248 bool IsDegenerated;249 248 double ShortestAngle; 250 249 double OtherShortestAngle;
Note:
See TracChangeset
for help on using the changeset viewer.