Changeset 27bd2f for src


Ignore:
Timestamp:
Nov 26, 2009, 11:36:44 AM (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:
4fc93f
Parents:
7273fc
Message:

BUGFIX: testcase heptan was not correctly tesselated, as edges of a (degenerated) polygon were not correctly created.

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/tesselation.cpp

    r7273fc r27bd2f  
    4242{
    4343        Info FunctionInfo(__func__);
    44   Log() << Verbose(1) << "Adding at " << *(node->node) << endl;
     44  Log() << Verbose(1) << "Adding Node " << *Walker << endl;
    4545};
    4646
     
    593593{
    594594        Info FunctionInfo(__func__);
    595   ost << "[" << (Name) << "|" << this << "]";
     595  ost << "[" << (nr) << "|" << this << "]";
    596596  return ost;
    597597};
     
    20752075        Info FunctionInfo(__func__);
    20762076  Vector Center;
    2077   BoundaryLineSet *BaseLine = CandidateLine.BaseLine;
    2078 
    2079   // go through all candidates (in degenerate n-nodes case we may have to add multiple triangles)
    2080   for (TesselPointList::iterator Runner = CandidateLine.pointlist.begin(); Runner != CandidateLine.pointlist.end(); Runner++) {
    2081     Log() << Verbose(2) << "BaseLine is :" << *(BaseLine) << " with current candidate " << *(*Runner) << "." << endl;
     2077  TesselPoint * const TurningPoint = CandidateLine.BaseLine->endpoints[0]->node;
     2078
     2079  // fill the set of neighbours
     2080  Center.CopyVector(CandidateLine.BaseLine->endpoints[1]->node->node);
     2081  Center.SubtractVector(TurningPoint->node);
     2082  set<TesselPoint*> SetOfNeighbours;
     2083  SetOfNeighbours.insert(CandidateLine.BaseLine->endpoints[1]->node);
     2084  for (TesselPointList::iterator Runner = CandidateLine.pointlist.begin(); Runner != CandidateLine.pointlist.end(); Runner++)
     2085    SetOfNeighbours.insert(*Runner);
     2086  TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(&SetOfNeighbours, TurningPoint, &Center);
     2087
     2088  // go through all angle-sorted candidates (in degenerate n-nodes case we may have to add multiple triangles)
     2089  TesselPointList::iterator Runner = connectedClosestPoints->begin();
     2090  TesselPointList::iterator Sprinter = Runner;
     2091  Sprinter++;
     2092  while(Sprinter != connectedClosestPoints->end()) {
    20822093    // add the points
    2083     AddTesselationPoint(BaseLine->endpoints[0]->node, 0);
    2084     AddTesselationPoint(BaseLine->endpoints[1]->node, 1);
    2085     AddTesselationPoint((*Runner), 2);
     2094    AddTesselationPoint(TurningPoint, 0);
     2095    AddTesselationPoint((*Runner), 1);
     2096    AddTesselationPoint((*Sprinter), 2);
    20862097
    20872098    Center.CopyVector(&CandidateLine.OptCenter);
    20882099    // add the lines
    2089     AddTesselationLine(TPS[2], TPS[0], 0);
    2090     AddTesselationLine(TPS[2], TPS[1], 1);
    2091     AddTesselationLine(TPS[0], TPS[1], 2);
     2100    AddTesselationLine(TPS[0], TPS[1], 0);
     2101    AddTesselationLine(TPS[0], TPS[2], 1);
     2102    AddTesselationLine(TPS[1], TPS[2], 2);
    20922103
    20932104    // add the triangles
     
    20982109
    20992110    Log() << Verbose(0) << "--> New triangle with " << *BTS << " and normal vector " << BTS->NormalVector << "." << endl;
    2100     BaseLine = BLS[0];  // go to next baseline, in order to add in star formation from CandidateLine.BaseLine->endpoints[0]->node
     2111    Runner = Sprinter;
     2112    Sprinter++;
    21012113  }
    21022114};
     
    27392751    }
    27402752  } else {
    2741     list<TesselPoint*> *connectedClosestPoints = GetCircleOfConnectedPoints(trianglePoints[0], x);
     2753    set<TesselPoint*> *connectedPoints = GetAllConnectedPoints(trianglePoints[0]);
     2754    TesselPointList *connectedClosestPoints = GetCircleOfSetOfPoints(connectedPoints, trianglePoints[0], x);
     2755    delete(connectedPoints);
    27422756    if (connectedClosestPoints != NULL) {
    27432757      trianglePoints[1] = connectedClosestPoints->front();
     
    29172931 *
    29182932 * @param *out output stream for debugging
     2933 * @param *SetOfNeighbours all points for which the angle should be calculated
    29192934 * @param *Point of which get all connected points
    29202935 * @param *Reference Reference vector for zero angle or NULL for no preference
    29212936 * @return list of the all points linked to the provided one
    29222937 */
    2923 list<TesselPoint*> * Tesselation::GetCircleOfConnectedPoints(const TesselPoint* const Point, const Vector * const Reference) const
     2938list<TesselPoint*> * Tesselation::GetCircleOfSetOfPoints(set<TesselPoint*> *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference) const
    29242939{
    29252940        Info FunctionInfo(__func__);
    29262941  map<double, TesselPoint*> anglesOfPoints;
    2927   set<TesselPoint*> *connectedPoints = GetAllConnectedPoints(Point);
    29282942  list<TesselPoint*> *connectedCircle = new list<TesselPoint*>;
    29292943  Vector center;
     
    29332947  Vector helper;
    29342948
    2935   if (connectedPoints == NULL) {
     2949  if (SetOfNeighbours == NULL) {
    29362950    eLog() << Verbose(2) << "Could not find any connected points!" << endl;
    29372951    delete(connectedCircle);
     
    29402954
    29412955  // calculate central point
    2942   for (set<TesselPoint*>::const_iterator TesselRunner = connectedPoints->begin(); TesselRunner != connectedPoints->end(); TesselRunner++)
     2956  for (set<TesselPoint*>::const_iterator TesselRunner = SetOfNeighbours->begin(); TesselRunner != SetOfNeighbours->end(); TesselRunner++)
    29432957    center.AddVector((*TesselRunner)->node);
    29442958  //Log() << Verbose(0) << "Summed vectors " << center << "; number of points " << connectedPoints.size()
    29452959  //  << "; scale factor " << 1.0/connectedPoints.size();
    2946   center.Scale(1.0/connectedPoints->size());
     2960  center.Scale(1.0/SetOfNeighbours->size());
    29472961  Log() << Verbose(1) << "INFO: Calculated center of all circle points is " << center << "." << endl;
    29482962
     
    29602974  }
    29612975  if ((Reference == NULL) || (AngleZero.NormSquared() < MYEPSILON )) {
    2962     Log() << Verbose(1) << "Using alternatively " << *(*connectedPoints->begin())->node << " as angle 0 referencer." << endl;
    2963     AngleZero.CopyVector((*connectedPoints->begin())->node);
     2976    Log() << Verbose(1) << "Using alternatively " << *(*SetOfNeighbours->begin())->node << " as angle 0 referencer." << endl;
     2977    AngleZero.CopyVector((*SetOfNeighbours->begin())->node);
    29642978    AngleZero.SubtractVector(Point->node);
    29652979    AngleZero.ProjectOntoPlane(&PlaneNormal);
     
    29772991
    29782992  // go through all connected points and calculate angle
    2979   for (set<TesselPoint*>::iterator listRunner = connectedPoints->begin(); listRunner != connectedPoints->end(); listRunner++) {
     2993  for (set<TesselPoint*>::iterator listRunner = SetOfNeighbours->begin(); listRunner != SetOfNeighbours->end(); listRunner++) {
    29802994    helper.CopyVector((*listRunner)->node);
    29812995    helper.SubtractVector(Point->node);
     
    29893003    connectedCircle->push_back(AngleRunner->second);
    29903004  }
    2991 
    2992   delete(connectedPoints);
    29933005
    29943006  return connectedCircle;
  • src/tesselation.hpp

    r7273fc r27bd2f  
    251251    list<list<TesselPoint*> *> * GetPathsOfConnectedPoints(const TesselPoint* const Point) const;
    252252    list<list<TesselPoint*> *> * GetClosedPathsOfConnectedPoints(const TesselPoint* const Point) const;
    253     list<TesselPoint*> * GetCircleOfConnectedPoints(const TesselPoint* const Point, const Vector * const Reference = NULL) const;
     253    list<TesselPoint*> * GetCircleOfSetOfPoints(set<TesselPoint*> *SetOfNeighbours, const TesselPoint* const Point, const Vector * const Reference = NULL) const;
    254254    class BoundaryPointSet *GetCommonEndpoint(const BoundaryLineSet * line1, const BoundaryLineSet * line2) const;
    255255    list<BoundaryTriangleSet*> *FindTriangles(const TesselPoint* const Points[3]) const;
Note: See TracChangeset for help on using the changeset viewer.