Changeset 34c43a for src/linkedcell.cpp


Ignore:
Timestamp:
Mar 1, 2011, 10:16:38 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, Candidate_v1.7.0, 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:
caa06ef
Parents:
ba5215
git-author:
Frederik Heber <heber@…> (02/21/11 18:02:41)
git-committer:
Frederik Heber <heber@…> (03/01/11 10:16:38)
Message:

Bigger change: Replaced PointCloud by PointCloudAdaptor.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/linkedcell.cpp

    rba5215 r34c43a  
    2525#include "CodePatterns/Log.hpp"
    2626#include "molecule.hpp"
    27 #include "PointCloud.hpp"
     27#include "IPointCloud.hpp"
    2828#include "tesselation.hpp"
    2929#include "LinearAlgebra/Vector.hpp"
    3030
    3131// ========================================================= class LinkedCell ===========================================
    32 
    33 /** Constructor for class LinkedCell::LinkedNodes.
    34  */
    35 LinkedCell::LinkedNodes::LinkedNodes()
    36 {}
    37 
    38 /** Destructor for class LinkedCell::LinkedNodes.
    39  */
    40 LinkedCell::LinkedNodes::~LinkedNodes()
    41 {}
    42 
    43 TesselPoint * LinkedCell::LinkedNodes::getValue (const_iterator &rhs) const
    44 {
    45   return *rhs;
    46 }
    47 
    48 TesselPoint * LinkedCell::LinkedNodes::getValue (iterator &rhs) const
    49 {
    50   return *rhs;
    51 }
    5232
    5333/** Constructor for class LinkedCell.
     
    6848 * \param RADIUS edge length of cells
    6949 */
    70 LinkedCell::LinkedCell(const PointCloud & set, const double radius) :
     50LinkedCell::LinkedCell(IPointCloud & set, const double radius) :
    7151  LC(NULL),
    7252  RADIUS(radius),
     
    11797  }
    11898  ASSERT(N[0]*N[1]*N[2] < MAX_LINKEDCELLNODES, "Number linked of linked cell nodes exceded hard-coded limit, use greater edge length!");
    119   LC = new LinkedNodes[N[0]*N[1]*N[2]];
     99  LC = new TesselPointSTLList[N[0]*N[1]*N[2]];
    120100  for (index=0;index<N[0]*N[1]*N[2];index++) {
    121101    LC [index].clear();
     
    184164 * \return LinkedAtoms pointer to current cell, NULL if LinkedCell::n[] are out of bounds.
    185165 */
    186 const LinkedCell::LinkedNodes* LinkedCell::GetCurrentCell() const
     166const TesselPointSTLList* LinkedCell::GetCurrentCell() const
    187167{
    188168  if (CheckBounds()) {
     
    198178 * \return LinkedAtoms pointer to current cell, NULL if LinkedCell::n[]+relative[] are out of bounds.
    199179 */
    200 const LinkedCell::LinkedNodes* LinkedCell::GetRelativeToCurrentCell(const int relative[NDIM]) const
     180const TesselPointSTLList* LinkedCell::GetRelativeToCurrentCell(const int relative[NDIM]) const
    201181{
    202182  if (CheckBounds(relative)) {
     
    232212  index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2];
    233213  if (CheckBounds()) {
    234     for (LinkedNodes::iterator Runner = LC[index].begin(); Runner != LC[index].end(); Runner++)
     214    for (TesselPointSTLList::iterator Runner = LC[index].begin(); Runner != LC[index].end(); Runner++)
    235215      status = status || ((*Runner) == Walker);
    236216    return status;
     
    267247 * \return list of tesselpoints
    268248 */
    269 LinkedCell::LinkedNodes* LinkedCell::GetallNeighbours(const double distance) const
     249TesselPointSTLList* LinkedCell::GetallNeighbours(const double distance) const
    270250{
    271251  int Nlower[NDIM], Nupper[NDIM];
    272252  TesselPoint *Walker = NULL;
    273   LinkedNodes *TesselList = new LinkedNodes;
     253  TesselPointSTLList *TesselList = new TesselPointSTLList;
    274254
    275255  // then go through the current and all neighbouring cells and check the contained points for possible candidates
     
    281261    for (n[1] = Nlower[1]; n[1] <= Nupper[1]; n[1]++)
    282262      for (n[2] = Nlower[2]; n[2] <= Nupper[2]; n[2]++) {
    283         const LinkedNodes *List = GetCurrentCell();
     263        const TesselPointSTLList *List = GetCurrentCell();
    284264        //Log() << Verbose(1) << "Current cell is " << n[0] << ", " << n[1] << ", " << n[2] << " with No. " << index << "." << endl;
    285265        if (List != NULL) {
    286           for (LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
     266          for (TesselPointSTLList::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) {
    287267            Walker = *Runner;
    288268            TesselList->push_back(Walker);
     
    346326 * \return list of all points inside sphere
    347327 */
    348 LinkedCell::LinkedNodes* LinkedCell::GetPointsInsideSphere(const double radius, const Vector * const center) const
     328TesselPointSTLList* LinkedCell::GetPointsInsideSphere(const double radius, const Vector * const center) const
    349329{
    350330  const double radiusSquared = radius*radius;
    351331  TesselPoint *Walker = NULL;
    352   LinkedNodes *TesselList = new LinkedNodes;
    353   LinkedNodes *NeighbourList = NULL;
     332  TesselPointSTLList *TesselList = new TesselPointSTLList;
     333  TesselPointSTLList *NeighbourList = NULL;
    354334
    355335  // set index of LC to center of sphere
     
    365345  //Log() << Verbose(1) << "I found " << NeighbourList->size() << " neighbours to check." << endl;
    366346  if (NeighbourList != NULL) {
    367     for (LinkedNodes::const_iterator Runner = NeighbourList->begin(); Runner != NeighbourList->end(); Runner++) {
     347    for (TesselPointSTLList::const_iterator Runner = NeighbourList->begin(); Runner != NeighbourList->end(); Runner++) {
    368348      Walker = *Runner;
    369349      //Log() << Verbose(1) << "Current neighbour is at " << *Walker->node << "." << endl;
Note: See TracChangeset for help on using the changeset viewer.