Changeset 125b3c


Ignore:
Timestamp:
Dec 17, 2009, 5:45:35 PM (15 years ago)
Author:
Frederik Heber <heber@…>
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
Message:

Non-convex tesselation seems to be working.

Seems like it has been working already. Only, we had some stupid test code still present after fixing the CorrectAllDegeneratedPolygons().

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/tesselation.cpp

    r0b2dd2 r125b3c  
    879879CandidateForTesselation::CandidateForTesselation (TesselPoint *candidate, BoundaryLineSet* line, Vector OptCandidateCenter, Vector OtherOptCandidateCenter) :
    880880    BaseLine(line),
    881     IsDegenerated(false),
    882881    ShortestAngle(2.*M_PI),
    883882    OtherShortestAngle(2.*M_PI)
     
    27812780  double otherradius;
    27822781  double alpha, Otheralpha; // angles (i.e. parameter for the circle).
    2783   bool IsDegenerated;
    27842782  int N[NDIM], Nlower[NDIM], Nupper[NDIM];
    27852783  TesselPoint *Candidate = NULL;
    2786   TesselPoint *CandidateTriangle[3];
    27872784
    27882785  Log() << Verbose(1) << "INFO: NormalVector of BaseTriangle is " << NormalVector << "." << endl;
     
    27992796  RelativeOldSphereCenter.CopyVector(&OldSphereCenter);
    28002797  RelativeOldSphereCenter.SubtractVector(&CircleCenter);
    2801 
    2802   CandidateTriangle[0] = CandidateLine.BaseLine->endpoints[0]->node;
    2803   CandidateTriangle[1] = CandidateLine.BaseLine->endpoints[1]->node;
    28042798
    28052799  // calculate squared radius TesselPoint *ThirdNode,f circle
     
    28592853                  Log() << Verbose(1) << "INFO: NewPlaneCenter is " << NewPlaneCenter << "." << endl;
    28602854
    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)
    28622856                  && (fabs(NewNormalVector.NormSquared()) > HULLEPSILON)
    28632857                  ) {
     
    28892883                      alpha = min(alpha, Otheralpha);
    28902884
    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);
    29232891                        } 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);
    29292894                        }
     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;
    29302909                      } 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;
    29552912                        } 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;
    29612914                        }
    29622915                      }
    2963 
    29642916                    } else {
    29652917                      Log() << Verbose(1) << "REJECT: NewSphereCenter " << NewSphereCenter << " for " << *Candidate << " is too far away: " << radius << "." << endl;
     
    42884240    TriangleSet *T = (*PolygonRunner)->GetAllContainedTrianglesFromEndpoints();
    42894241
     4242    // check whether number is bigger than 2, otherwise it's just a simply degenerated one and nothing to do.
    42904243    if (T->size() == 2) {
    42914244      Log() << Verbose(1) << " Skipping degenerated polygon, is just a (already simply degenerated) triangle." << endl;
    42924245      delete(T);
    42934246      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();
    42944256    }
    42954257
  • src/tesselation.hpp

    r0b2dd2 r125b3c  
    246246  Vector OptCenter;
    247247  Vector OtherOptCenter;
    248   bool IsDegenerated;
    249248  double ShortestAngle;
    250249  double OtherShortestAngle;
Note: See TracChangeset for help on using the changeset viewer.