Changeset 215df0


Ignore:
Timestamp:
May 27, 2010, 11:28:37 AM (15 years ago)
Author:
Tillmann Crueger <crueger@…>
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:
47191b
Parents:
8f215d
Message:

Simplified some methods.

Location:
src
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • src/Makefile.am

    r8f215d r215df0  
    8888                                  Exceptions/LinearDependenceException.cpp \
    8989                                  Exceptions/MathException.cpp \
     90                                  Exceptions/SkewException.cpp \
    9091                                  Exceptions/ZeroVectorException.cpp
    9192                                 
     
    9394                                  Exceptions/LinearDependenceException.hpp \
    9495                                  Exceptions/MathException.hpp \
     96                                  Exceptions/SkewException.hpp \
    9597                                  Exceptions/ZeroVectorException.hpp
    9698
  • src/atom.cpp

    r8f215d r215df0  
    6868atom *atom::GetTrueFather()
    6969{
    70   atom *walker = this;
    71   do {
    72     if (walker == walker->father) // top most father is the one that points on itself
    73       break;
    74     walker = walker->father;
    75   } while (walker != NULL);
    76   return walker;
     70  if(father == this){ // top most father is the one that points on itself
     71    return this;
     72  }
     73  else if(!father) {
     74    return 0;
     75  }
     76  else {
     77    return father->GetTrueFather();
     78  }
    7779};
    7880
  • src/tesselation.cpp

    r8f215d r215df0  
    442442  try {
    443443    *Intersection = Plane(NormalVector, *(endpoints[0]->node->node)).GetIntersection(*MolCenter, *x);
    444   }
    445   catch (LinearDependenceException &excp) {
    446     Log() << Verbose(1) << excp;
    447     DoeLog(1) && (eLog() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl);
    448     return false;
    449   }
    450 
    451   DoLog(1) && (Log() << Verbose(1) << "INFO: Triangle is " << *this << "." << endl);
    452   DoLog(1) && (Log() << Verbose(1) << "INFO: Line is from " << *MolCenter << " to " << *x << "." << endl);
    453   DoLog(1) && (Log() << Verbose(1) << "INFO: Intersection is " << *Intersection << "." << endl);
    454 
    455   if (Intersection->DistanceSquared(*endpoints[0]->node->node) < MYEPSILON) {
    456     DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with first endpoint." << endl);
    457     return true;
    458   }   else if (Intersection->DistanceSquared(*endpoints[1]->node->node) < MYEPSILON) {
    459     DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with second endpoint." << endl);
    460     return true;
    461   }   else if (Intersection->DistanceSquared(*endpoints[2]->node->node) < MYEPSILON) {
    462     DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with third endpoint." << endl);
    463     return true;
    464   }
    465   // Calculate cross point between one baseline and the line from the third endpoint to intersection
    466   int i = 0;
    467   do {
    468     try {
     444
     445    DoLog(1) && (Log() << Verbose(1) << "INFO: Triangle is " << *this << "." << endl);
     446    DoLog(1) && (Log() << Verbose(1) << "INFO: Line is from " << *MolCenter << " to " << *x << "." << endl);
     447    DoLog(1) && (Log() << Verbose(1) << "INFO: Intersection is " << *Intersection << "." << endl);
     448
     449    if (Intersection->DistanceSquared(*endpoints[0]->node->node) < MYEPSILON) {
     450      DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with first endpoint." << endl);
     451      return true;
     452    }   else if (Intersection->DistanceSquared(*endpoints[1]->node->node) < MYEPSILON) {
     453      DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with second endpoint." << endl);
     454      return true;
     455    }   else if (Intersection->DistanceSquared(*endpoints[2]->node->node) < MYEPSILON) {
     456      DoLog(1) && (Log() << Verbose(1) << "Intersection coindices with third endpoint." << endl);
     457      return true;
     458    }
     459    // Calculate cross point between one baseline and the line from the third endpoint to intersection
     460    int i = 0;
     461    do {
    469462      CrossPoint = GetIntersectionOfTwoLinesOnPlane(*(endpoints[i%3]->node->node),
    470463                                                    *(endpoints[(i+1)%3]->node->node),
     
    477470      if ((s < -MYEPSILON) || ((s-1.) > MYEPSILON)) {
    478471        DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << "outside of triangle." << endl);
    479         i=4;
    480         break;
     472        return false;
    481473      }
    482474      i++;
    483     } catch (LinearDependenceException &excp){
    484       break;
    485     }
    486   } while (i < 3);
    487   if (i == 3) {
     475    } while (i < 3);
    488476    DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " inside of triangle." << endl);
    489477    return true;
    490   } else {
    491     DoLog(1) && (Log() << Verbose(1) << "INFO: Crosspoint " << CrossPoint << " outside of triangle." << endl);
     478  }
     479  catch (MathException &excp) {
     480    Log() << Verbose(1) << excp;
     481    DoeLog(1) && (eLog() << Verbose(1) << "Alas! Intersection with plane failed - at least numerically - the intersection is not on the plane!" << endl);
    492482    return false;
    493483  }
     484
     485
    494486}
    495487;
  • src/vector_ops.cpp

    r8f215d r215df0  
    1515#include "Helpers/fast_functions.hpp"
    1616#include "Exceptions/LinearDependenceException.hpp"
     17#include "Exceptions/SkewException.hpp"
    1718
    1819#include <gsl/gsl_linalg.h>
     
    176177  if (fabs(M->Determinant()) > MYEPSILON) {
    177178    Log() << Verbose(1) << "Determinant of coefficient matrix is NOT zero." << endl;
    178     throw LinearDependenceException(__FILE__,__LINE__);
     179    throw SkewException(__FILE__,__LINE__);
    179180  }
    180181
Note: See TracChangeset for help on using the changeset viewer.