Changeset 07051c for src


Ignore:
Timestamp:
Oct 17, 2009, 7:46:28 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:
b8b75d
Parents:
44a59b
Message:

Extended class LinkedCell to handle a relative offset to current cell.

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/linkedcell.cpp

    r44a59b r07051c  
    202202};
    203203
     204/** Checks whether LinkedCell::n[] plus relative offset is each within [0,N[]].
     205 * \param relative[NDIM] relative offset to current cell
     206 * \return if all in intervals - true, else -false
     207 */
     208bool LinkedCell::CheckBounds(int relative[NDIM])
     209{
     210  bool status = true;
     211  for(int i=0;i<NDIM;i++)
     212    status = status && ((n[i]+relative[i] >=0) && (n[i]+relative[i] < N[i]));
     213  if (!status)
     214  cerr << "ERROR: indices are out of bounds!" << endl;
     215  return status;
     216};
     217
    204218
    205219/** Returns a pointer to the current cell.
     
    210224  if (CheckBounds()) {
    211225    index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2];
     226    return (&(LC[index]));
     227  } else {
     228    return NULL;
     229  }
     230};
     231
     232/** Returns a pointer to the current cell.
     233 * \param relative[NDIM] offset for each axis with respect to the current cell LinkedCell::n[NDIM]
     234 * \return LinkedAtoms pointer to current cell, NULL if LinkedCell::n[]+relative[] are out of bounds.
     235 */
     236LinkedNodes* LinkedCell::GetRelativeToCurrentCell(int relative[NDIM])
     237{
     238  if (CheckBounds(relative)) {
     239    index = (n[0]+relative[0]) * N[1] * N[2] + (n[1]+relative[1]) * N[2] + (n[2]+relative[2]);
    212240    return (&(LC[index]));
    213241  } else {
  • src/linkedcell.hpp

    r44a59b r07051c  
    5454    ~LinkedCell();
    5555    LinkedNodes* GetCurrentCell();
     56    LinkedNodes* GetRelativeToCurrentCell(int relative[NDIM]);
    5657    bool SetIndexToNode(const TesselPoint *Walker);
    5758    bool SetIndexToVector(const Vector *x);
    5859    bool CheckBounds();
     60    bool CheckBounds(int relative[NDIM]);
    5961    void GetNeighbourBounds(int lower[NDIM], int upper[NDIM]);
    6062
Note: See TracChangeset for help on using the changeset viewer.