Changeset 7273fc


Ignore:
Timestamp:
Nov 25, 2009, 3:52:27 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:
27bd2f
Parents:
f67b6e
Message:

Tesselation::FindStartingTriangle() now also uses AddCandidateTriangle()

  • this is necessary, as we might find more than one candidate for the third point when looking for the candidate
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tesselation.cpp

    rf67b6e r7273fc  
    16571657        Info FunctionInfo(__func__);
    16581658  int i = 0;
    1659   TesselPoint* FirstPoint = NULL;
    1660   TesselPoint* SecondPoint = NULL;
    16611659  TesselPoint* MaxPoint[NDIM];
     1660  TesselPoint* Temporary;
    16621661  double maxCoordinate[NDIM];
     1662  BoundaryLineSet BaseLine;
    16631663  Vector Oben;
    16641664  Vector helper;
     
    17031703    Oben.Zero();
    17041704    Oben.x[k] = 1.;
    1705     FirstPoint = MaxPoint[k];
    1706     Log() << Verbose(0) << "Coordinates of start node at " << *FirstPoint->node << "." << endl;
     1705    BaseLine.endpoints[0] = new BoundaryPointSet(MaxPoint[k]);
     1706    Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine.endpoints[0]->node << "." << endl;
    17071707
    17081708    double ShortestAngle;
    1709     TesselPoint* OptCandidate = NULL;
    17101709    ShortestAngle = 999999.; // This will contain the angle, which will be always positive (when looking for second point), when looking for third point this will be the quadrant.
    17111710
    1712     FindSecondPointForTesselation(FirstPoint, Oben, OptCandidate, &ShortestAngle, RADIUS, LC); // we give same point as next candidate as its bonds are looked into in find_second_...
    1713     SecondPoint = OptCandidate;
    1714     if (SecondPoint == NULL)  // have we found a second point?
     1711    FindSecondPointForTesselation(BaseLine.endpoints[0]->node, Oben, Temporary, &ShortestAngle, RADIUS, LC); // we give same point as next candidate as its bonds are looked into in find_second_...
     1712    if (Temporary == NULL)  // have we found a second point?
    17151713      continue;
    1716 
    1717     helper.CopyVector(FirstPoint->node);
    1718     helper.SubtractVector(SecondPoint->node);
     1714    BaseLine.endpoints[1] = new BoundaryPointSet(Temporary);
     1715
     1716    helper.CopyVector(BaseLine.endpoints[0]->node->node);
     1717    helper.SubtractVector(BaseLine.endpoints[1]->node->node);
    17191718    helper.Normalize();
    17201719    Oben.ProjectOntoPlane(&helper);
     
    17231722    ShortestAngle = 2.*M_PI; // This will indicate the quadrant.
    17241723
    1725     Chord.CopyVector(FirstPoint->node); // bring into calling function
    1726     Chord.SubtractVector(SecondPoint->node);
     1724    Chord.CopyVector(BaseLine.endpoints[0]->node->node); // bring into calling function
     1725    Chord.SubtractVector(BaseLine.endpoints[1]->node->node);
    17271726    double radius = Chord.ScalarProduct(&Chord);
    17281727    double CircleRadius = sqrt(RADIUS*RADIUS - radius/4.);
     
    17351734
    17361735    // adding point 1 and point 2 and add the line between them
    1737     Log() << Verbose(0) << "Coordinates of start node at " << *FirstPoint->node << "." << endl;
    1738     AddTesselationPoint(FirstPoint, 0);
    1739     Log() << Verbose(0) << "Found second point is at " << *SecondPoint->node << ".\n";
    1740     AddTesselationPoint(SecondPoint, 1);
    1741     AddTesselationLine(TPS[0], TPS[1], 0);
     1736    Log() << Verbose(0) << "Coordinates of start node at " << *BaseLine.endpoints[0]->node << "." << endl;
     1737    Log() << Verbose(0) << "Found second point is at " << *BaseLine.endpoints[1]->node << ".\n";
    17421738
    17431739    //Log() << Verbose(1) << "INFO: OldSphereCenter is at " << helper << ".\n";
    1744     CandidateForTesselation OptCandidates(BLS[0]);
     1740    CandidateForTesselation OptCandidates(&BaseLine);
    17451741    FindThirdPointForTesselation(Oben, SearchDirection, helper, OptCandidates, NULL, RADIUS, LC);
    17461742    Log() << Verbose(0) << "List of third Points is:" << endl;
     
    17491745    }
    17501746
    1751     for (TesselPointList::iterator it = OptCandidates.pointlist.begin(); it != OptCandidates.pointlist.end(); it++) {
    1752       // add third triangle point
    1753       AddTesselationPoint((*it), 2);
    1754       // add the second and third line
    1755       AddTesselationLine(TPS[1], TPS[2], 1);
    1756       AddTesselationLine(TPS[0], TPS[2], 2);
    1757       // ... and triangles to the Maps of the Tesselation class
    1758       BTS = new class BoundaryTriangleSet(BLS, TrianglesOnBoundaryCount);
    1759       AddTesselationTriangle();
    1760       // ... and calculate its normal vector (with correct orientation)
    1761       OptCandidates.OptCenter.Scale(-1.);
    1762       Log() << Verbose(1) << "Anti-Oben is currently " << OptCandidates.OptCenter << "." << endl;
    1763       BTS->GetNormalVector(OptCandidates.OptCenter);  // vector to compare with should point inwards
    1764       OptCandidates.OptCenter.Scale(-1.);
    1765       Log() << Verbose(0) << "==> Found starting triangle consists of " << *FirstPoint << ", " << *SecondPoint << " and "
    1766       << (*it) << " with normal vector " << BTS->NormalVector << ".\n";
    1767 
    1768 //      // if we do not reach the end with the next step of iteration, we need to setup a new first line
    1769 //      if (it != OptCandidates->end()--) {
    1770 //        FirstPoint = (*it)->BaseLine->endpoints[0]->node;
    1771 //        SecondPoint = (*it)->point;
    1772 //        // adding point 1 and point 2 and the line between them
    1773 //        AddTesselationPoint(FirstPoint, 0);
    1774 //        AddTesselationPoint(SecondPoint, 1);
    1775 //        AddTesselationLine(TPS[0], TPS[1], 0);
    1776 //      }
    1777       Log() << Verbose(1) << "Projection is " << BTS->NormalVector.ScalarProduct(&Oben) << "." << endl;
    1778     }
     1747    BTS = NULL;
     1748    AddCandidateTriangle(OptCandidates);
     1749//    delete(BaseLine.endpoints[0]);
     1750//    delete(BaseLine.endpoints[1]);
     1751
    17791752    if (BTS != NULL) // we have created one starting triangle
    17801753      break;
    17811754    else {
    17821755      // remove all candidates from the list and then the list itself
     1756      OptCandidates.pointlist.clear();
    17831757    }
    17841758  }
     
    21072081    Log() << Verbose(2) << "BaseLine is :" << *(BaseLine) << " with current candidate " << *(*Runner) << "." << endl;
    21082082    // add the points
    2109     AddTesselationPoint((*Runner), 0);
    2110     AddTesselationPoint(BaseLine->endpoints[0]->node, 1);
    2111     AddTesselationPoint(BaseLine->endpoints[1]->node, 2);
     2083    AddTesselationPoint(BaseLine->endpoints[0]->node, 0);
     2084    AddTesselationPoint(BaseLine->endpoints[1]->node, 1);
     2085    AddTesselationPoint((*Runner), 2);
    21122086
    21132087    Center.CopyVector(&CandidateLine.OptCenter);
    21142088    // add the lines
    2115     AddTesselationLine(TPS[0], TPS[1], 0);
    2116     AddTesselationLine(TPS[0], TPS[2], 1);
    2117     AddTesselationLine(TPS[1], TPS[2], 2);
     2089    AddTesselationLine(TPS[2], TPS[0], 0);
     2090    AddTesselationLine(TPS[2], TPS[1], 1);
     2091    AddTesselationLine(TPS[0], TPS[1], 2);
    21182092
    21192093    // add the triangles
Note: See TracChangeset for help on using the changeset viewer.