Changeset ad8b0d


Ignore:
Timestamp:
Oct 17, 2009, 4:49:59 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:
09048c
Parents:
3a9fe9
Message:

Templated version of flip now operates with references instead of pointers.

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/helpers.hpp

    • Property mode changed from 100755 to 100644
    r3a9fe9 rad8b0d  
    5555
    5656/** Flips two values.
    57  * \param *x pointer to first value
    58  * \param *y pointer to second value
     57 * \param x first value
     58 * \param y second value
    5959 */
    60 template <typename T> void flip(T *x, T *y)
     60template <typename T> void flip(T &x, T &y)
    6161{
    6262  T tmp;
    63   tmp = *x;
    64   *x = *y;
    65   *y = tmp;
     63  tmp = x;
     64  x = y;
     65  y = tmp;
    6666};
    6767
  • src/vector.cpp

    • Property mode changed from 100755 to 100644
    r3a9fe9 rad8b0d  
    11391139      break;
    11401140    case 2:
    1141       flip(&x1->x[0],&x1->x[1]);
    1142       flip(&x2->x[0],&x2->x[1]);
    1143       flip(&y->x[0],&y->x[1]);
    1144       //flip(&x[0],&x[1]);
    1145       flip(&x1->x[1],&x1->x[2]);
    1146       flip(&x2->x[1],&x2->x[2]);
    1147       flip(&y->x[1],&y->x[2]);
    1148       //flip(&x[1],&x[2]);
     1141      flip(x1->x[0],x1->x[1]);
     1142      flip(x2->x[0],x2->x[1]);
     1143      flip(y->x[0],y->x[1]);
     1144      //flip(x[0],x[1]);
     1145      flip(x1->x[1],x1->x[2]);
     1146      flip(x2->x[1],x2->x[2]);
     1147      flip(y->x[1],y->x[2]);
     1148      //flip(x[1],x[2]);
    11491149    case 1:
    1150       flip(&x1->x[0],&x1->x[1]);
    1151       flip(&x2->x[0],&x2->x[1]);
    1152       flip(&y->x[0],&y->x[1]);
    1153       //flip(&x[0],&x[1]);
    1154       flip(&x1->x[1],&x1->x[2]);
    1155       flip(&x2->x[1],&x2->x[2]);
    1156       flip(&y->x[1],&y->x[2]);
    1157       //flip(&x[1],&x[2]);
     1150      flip(x1->x[0],x1->x[1]);
     1151      flip(x2->x[0],x2->x[1]);
     1152      flip(y->x[0],y->x[1]);
     1153      //flip(x[0],x[1]);
     1154      flip(x1->x[1],x1->x[2]);
     1155      flip(x2->x[1],x2->x[2]);
     1156      flip(y->x[1],y->x[2]);
     1157      //flip(x[1],x[2]);
    11581158      break;
    11591159  }
     
    12241224      break;
    12251225    case 2:
    1226       flip(&x1->x[0],&x1->x[1]);
    1227       flip(&x2->x[0],&x2->x[1]);
    1228       flip(&y->x[0],&y->x[1]);
    1229       flip(&x[0],&x[1]);
    1230       flip(&x1->x[1],&x1->x[2]);
    1231       flip(&x2->x[1],&x2->x[2]);
    1232       flip(&y->x[1],&y->x[2]);
    1233       flip(&x[1],&x[2]);
     1226      flip(x1->x[0],x1->x[1]);
     1227      flip(x2->x[0],x2->x[1]);
     1228      flip(y->x[0],y->x[1]);
     1229      flip(x[0],x[1]);
     1230      flip(x1->x[1],x1->x[2]);
     1231      flip(x2->x[1],x2->x[2]);
     1232      flip(y->x[1],y->x[2]);
     1233      flip(x[1],x[2]);
    12341234    case 1:
    1235       flip(&x1->x[0],&x1->x[1]);
    1236       flip(&x2->x[0],&x2->x[1]);
    1237       flip(&y->x[0],&y->x[1]);
    1238       //flip(&x[0],&x[1]);
    1239       flip(&x1->x[1],&x1->x[2]);
    1240       flip(&x2->x[1],&x2->x[2]);
    1241       flip(&y->x[1],&y->x[2]);
    1242       flip(&x[1],&x[2]);
     1235      flip(x1->x[0],x1->x[1]);
     1236      flip(x2->x[0],x2->x[1]);
     1237      flip(y->x[0],y->x[1]);
     1238      //flip(x[0],x[1]);
     1239      flip(x1->x[1],x1->x[2]);
     1240      flip(x2->x[1],x2->x[2]);
     1241      flip(y->x[1],y->x[2]);
     1242      flip(x[1],x[2]);
    12431243      break;
    12441244  }
Note: See TracChangeset for help on using the changeset viewer.