Changeset 797126


Ignore:
Timestamp:
Jul 2, 2010, 3:58:53 PM (14 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:
08d9595
Parents:
417813
Message:

Removed two more unused functions

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/tesselationhelpers.cpp

    r417813 r797126  
    217217  Vector x3;
    218218  Vector x4;
    219 };
    220 
    221 /**
    222  * Intersection calculation function.
    223  *
    224  * @param x to find the result for
    225  * @param function parameter
    226  */
    227 double MinIntersectDistance(const gsl_vector * x, void *params)
    228 {
    229         Info FunctionInfo(__func__);
    230   double retval = 0;
    231   struct Intersection *I = (struct Intersection *)params;
    232   Vector intersection;
    233   for (int i=0;i<NDIM;i++)
    234     intersection[i] = gsl_vector_get(x, i);
    235 
    236   Vector SideA = I->x1 -I->x2 ;
    237   Vector HeightA = intersection - I->x1;
    238   HeightA.ProjectOntoPlane(SideA);
    239 
    240   Vector SideB = I->x3 - I->x4;
    241   Vector HeightB = intersection - I->x3;
    242   HeightB.ProjectOntoPlane(SideB);
    243 
    244   retval = HeightA.ScalarProduct(HeightA) + HeightB.ScalarProduct(HeightB);
    245   //Log() << Verbose(1) << "MinIntersectDistance called, result: " << retval << endl;
    246 
    247   return retval;
    248 };
    249 
    250 
    251 /**
    252  * Calculates whether there is an intersection between two lines. The first line
    253  * always goes through point 1 and point 2 and the second line is given by the
    254  * connection between point 4 and point 5.
    255  *
    256  * @param point 1 of line 1
    257  * @param point 2 of line 1
    258  * @param point 1 of line 2
    259  * @param point 2 of line 2
    260  *
    261  * @return true if there is an intersection between the given lines, false otherwise
    262  */
    263 bool existsIntersection(const Vector &point1, const Vector &point2, const Vector &point3, const Vector &point4)
    264 {
    265         Info FunctionInfo(__func__);
    266   bool result;
    267 
    268   struct Intersection par;
    269     par.x1 = point1;
    270     par.x2 = point2;
    271     par.x3 = point3;
    272     par.x4 = point4;
    273 
    274     const gsl_multimin_fminimizer_type *T = gsl_multimin_fminimizer_nmsimplex;
    275     gsl_multimin_fminimizer *s = NULL;
    276     gsl_vector *ss, *x;
    277     gsl_multimin_function minexFunction;
    278 
    279     size_t iter = 0;
    280     int status;
    281     double size;
    282 
    283     /* Starting point */
    284     x = gsl_vector_alloc(NDIM);
    285     gsl_vector_set(x, 0, point1[0]);
    286     gsl_vector_set(x, 1, point1[1]);
    287     gsl_vector_set(x, 2, point1[2]);
    288 
    289     /* Set initial step sizes to 1 */
    290     ss = gsl_vector_alloc(NDIM);
    291     gsl_vector_set_all(ss, 1.0);
    292 
    293     /* Initialize method and iterate */
    294     minexFunction.n = NDIM;
    295     minexFunction.f = &MinIntersectDistance;
    296     minexFunction.params = (void *)&par;
    297 
    298     s = gsl_multimin_fminimizer_alloc(T, NDIM);
    299     gsl_multimin_fminimizer_set(s, &minexFunction, x, ss);
    300 
    301     do {
    302         iter++;
    303         status = gsl_multimin_fminimizer_iterate(s);
    304 
    305         if (status) {
    306           break;
    307         }
    308 
    309         size = gsl_multimin_fminimizer_size(s);
    310         status = gsl_multimin_test_size(size, 1e-2);
    311 
    312         if (status == GSL_SUCCESS) {
    313           DoLog(1) && (Log() << Verbose(1) << "converged to minimum" <<  endl);
    314         }
    315     } while (status == GSL_CONTINUE && iter < 100);
    316 
    317     // check whether intersection is in between or not
    318   Vector intersection;
    319   double t1, t2;
    320   for (int i = 0; i < NDIM; i++) {
    321     intersection[i] = gsl_vector_get(s->x, i);
    322   }
    323 
    324   Vector SideA = par.x2 - par.x1;
    325   Vector HeightA = intersection - par.x1;
    326 
    327   t1 = HeightA.ScalarProduct(SideA)/SideA.ScalarProduct(SideA);
    328 
    329   Vector SideB = par.x4 - par.x3;
    330   Vector HeightB = intersection - par.x3;
    331 
    332   t2 = HeightB.ScalarProduct(SideB)/SideB.ScalarProduct(SideB);
    333 
    334   Log() << Verbose(1) << "Intersection " << intersection << " is at "
    335     << t1 << " for (" << point1 << "," << point2 << ") and at "
    336     << t2 << " for (" << point3 << "," << point4 << "): ";
    337 
    338   if (((t1 >= 0) && (t1 <= 1)) && ((t2 >= 0) && (t2 <= 1))) {
    339     DoLog(1) && (Log() << Verbose(1) << "true intersection." << endl);
    340     result = true;
    341   } else {
    342     DoLog(1) && (Log() << Verbose(1) << "intersection out of region of interest." << endl);
    343     result = false;
    344   }
    345 
    346   // free minimizer stuff
    347     gsl_vector_free(x);
    348     gsl_vector_free(ss);
    349     gsl_multimin_fminimizer_free(s);
    350 
    351   return result;
    352219};
    353220
  • src/tesselationhelpers.hpp

    r417813 r797126  
    5151void GetCenterofCircumcircle(Vector * const Center, const Vector &a, const Vector &b, const Vector &c);
    5252double GetPathLengthonCircumCircle(const Vector &CircleCenter, const Vector &CirclePlaneNormal, const double CircleRadius, const Vector &NewSphereCenter, const Vector &OldSphereCenter, const Vector &NormalVector, const Vector &SearchDirection);
    53 double MinIntersectDistance(const gsl_vector * x, void *params);
    54 bool existsIntersection(const Vector &point1, const Vector &point2, const Vector &point3, const Vector &point4);
    5553double CalculateVolumeofGeneralTetraeder(const Vector &a, const Vector &b, const Vector &c, const Vector &d);
    5654double CalculateAreaofGeneralTriangle(const Vector &A, const Vector &B, const Vector &C);
Note: See TracChangeset for help on using the changeset viewer.