Changeset a2028e


Ignore:
Timestamp:
Oct 14, 2009, 11:10:47 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:
6cd79d
Parents:
f74d08
Message:

UnitTest AnalysisCorrelationToSurface revealed two bugs:

  • BUGFIX: if multiple triangles are closest to a point, the code failed in Tesselation::FindTriangles(). This is fixed: the externalized initialization steps were put together again into the four loops, hence the ..->end() check was in the loop again.
  • BUGFIX: If the AngleZero derived from the reference in Tesselation::GetCircleOfConnectedPoints() is 0, we end up with no closest triangle. This is fixed: first point in connected circle taken as reference instead, and criticalExit() if still not unzero
Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/tesselation.cpp

    rf74d08 ra2028e  
    88#include <fstream>
    99
     10#include "helpers.hpp"
    1011#include "linkedcell.hpp"
    1112#include "tesselation.hpp"
     
    25112512    return NULL;
    25122513  }
    2513 
     2514  *out << Verbose(1) << "Finding closest Tesselpoint to " << *x << " ... " << endl;
    25142515  trianglePoints[0] = FindClosestPoint(x, SecondPoint, LC);
    25152516 
     
    26612662  bool takePoint = false;
    26622663
     2664  *out << Verbose(3) << "Begin of GetAllConnectedPoints" << endl;
     2665
    26632666  // find the respective boundary point
    26642667  PointMap::iterator PointRunner = PointsOnBoundary.find(Point->nr);
     
    27002703  }
    27012704
     2705  *out << Verbose(3) << "End of GetAllConnectedPoints" << endl;
    27022706  return connectedPoints;
    27032707};
     
    27262730  Vector helper;
    27272731
     2732  *out << Verbose(2) << "Begin of GetCircleOfConnectedPoints" << endl;
     2733
    27282734  // calculate central point
    27292735  for (set<TesselPoint*>::iterator TesselRunner = connectedPoints->begin(); TesselRunner != connectedPoints->end(); TesselRunner++)
     
    27412747
    27422748  // construct one orthogonal vector
    2743   if (Reference != NULL)
     2749  if (Reference != NULL) {
    27442750    AngleZero.CopyVector(Reference);
     2751    AngleZero.SubtractVector(Point->node);
     2752    AngleZero.ProjectOntoPlane(&PlaneNormal);
     2753  }
     2754  if ((Reference == NULL) || (AngleZero.NormSquared() < MYEPSILON )) {
     2755    *out << Verbose(4) << "Using alternatively " << *(*connectedPoints->begin())->node << " as angle 0 referencer." << endl;
     2756    AngleZero.CopyVector((*connectedPoints->begin())->node);
     2757    AngleZero.SubtractVector(Point->node);
     2758    AngleZero.ProjectOntoPlane(&PlaneNormal);
     2759    if (AngleZero.NormSquared() < MYEPSILON) {
     2760      cerr << Verbose(0) << "CRITIAL: AngleZero is 0 even with alternative reference. The algorithm has to be changed here!" << endl;
     2761      performCriticalExit();
     2762    }
     2763  }
     2764  *out << Verbose(4) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl;
     2765  if (AngleZero.NormSquared() > MYEPSILON)
     2766    OrthogonalVector.MakeNormalVector(&PlaneNormal, &AngleZero);
    27452767  else
    2746     AngleZero.CopyVector((*connectedPoints->begin())->node);
    2747   AngleZero.SubtractVector(Point->node);
    2748   AngleZero.ProjectOntoPlane(&PlaneNormal);
    2749   *out << Verbose(4) << "INFO: Reference vector on this plane representing angle 0 is " << AngleZero << "." << endl;
    2750   OrthogonalVector.MakeNormalVector(&PlaneNormal, &AngleZero);
     2768    OrthogonalVector.MakeNormalVector(&PlaneNormal);
    27512769  *out << Verbose(4) << "INFO: OrthogonalVector on plane is " << OrthogonalVector << "." << endl;
    27522770
     
    27662784
    27672785  delete(connectedPoints);
     2786
     2787  *out << Verbose(2) << "End of GetCircleOfConnectedPoints" << endl;
     2788
    27682789  return connectedCircle;
    27692790}
     
    32233244  for (int i = 0; i < 3; i++) {
    32243245    if (TrianglePoints[i] != NULL) {
    3225       for (int j = i; j < 3; j++) {
     3246      for (int j = i+1; j < 3; j++) {
    32263247        if (TrianglePoints[j] != NULL) {
    3227           FindLine = TrianglePoints[i]->lines.find(TrianglePoints[j]->node->nr);
    3228           if (FindLine != TrianglePoints[i]->lines.end()) {
    3229             for (; FindLine->first == TrianglePoints[j]->node->nr; FindLine++) {
    3230               FindTriangle = FindLine->second->triangles.begin();
    3231               for (; FindTriangle != FindLine->second->triangles.end(); FindTriangle++) {
    3232                 if (FindTriangle->second->IsPresentTupel(TrianglePoints)) {
    3233                   result->push_back(FindTriangle->second);
    3234                 }
     3248          for (FindLine = TrianglePoints[i]->lines.find(TrianglePoints[j]->node->nr); // is a multimap!
     3249              (FindLine != TrianglePoints[i]->lines.end()) && (FindLine->first == TrianglePoints[j]->node->nr);
     3250              FindLine++) {
     3251            for (FindTriangle = FindLine->second->triangles.begin();
     3252                FindTriangle != FindLine->second->triangles.end();
     3253                FindTriangle++) {
     3254              if (FindTriangle->second->IsPresentTupel(TrianglePoints)) {
     3255                result->push_back(FindTriangle->second);
    32353256              }
    32363257            }
    3237             // Is it sufficient to consider one of the triangle lines for this.
    3238             return result;
    3239 
    32403258          }
     3259          // Is it sufficient to consider one of the triangle lines for this.
     3260          return result;
    32413261        }
    32423262      }
  • src/tesselationhelpers.cpp

    rf74d08 ra2028e  
    635635        }
    636636      }
    637 
     637  // output
     638  if (closestPoint != NULL) {
     639    cout << Verbose(2) << "Closest point is " << *closestPoint;
     640    if (SecondPoint != NULL)
     641      cout << " and second closest is " << *SecondPoint;
     642    cout << "." << endl;
     643  }
    638644  return closestPoint;
    639645};
Note: See TracChangeset for help on using the changeset viewer.