ESyS-Particle  2.3.4
NeighbourTable.h
Go to the documentation of this file.
1 // //
3 // Copyright (c) 2003-2017 by The University of Queensland //
4 // Centre for Geoscience Computing //
5 // http://earth.uq.edu.au/centre-geoscience-computing //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.apache.org/licenses/LICENSE-2.0 //
10 // //
12 
13 
14 #ifndef ESYS_LSMNEIGHBOURTABLE_H
15 #define ESYS_LSMNEIGHBOURTABLE_H
16 
17 #include <Foundation/BoundingBox.h>
18 #include <Foundation/StlIterator.h>
19 #include <Geometry/Vec3L.h>
20 #include <vector>
21 #include <algorithm>
22 #include <boost/shared_array.hpp>
23 
24 namespace esys
25 {
26  namespace lsm
27  {
31  template <class TmplParticle>
33  {
34  public:
35  typedef TmplParticle Particle;
36  typedef std::vector<Particle *> ParticleVector;
37 
38  NeighbourTable(const BoundingBox &bBox, double gridSpacing);
39 
40  NeighbourTable(const NeighbourTable &nTable);
41 
42  virtual ~NeighbourTable();
43 
44  void clear();
45 
46  double getGridSpacing() const;
47 
48  void resize(const BoundingBox &bBox, double gridSpacing);
49 
50  const Vec3L &getDimensions() const;
51 
52  const BoundingBox &getBBox() const;
53 
54  const Vec3 &getMinPt() const;
55 
59  size_t size() const;
60 
61  int getScalarIndex(int xIdx, int yIdx, int zIdx) const;
62 
63  int getScalarIndex(const Vec3L &index) const;
64 
65  int getScalarIndex(const Vec3 &pt) const;
66 
67  const Vec3L &getMinVecIndex() const;
68 
69  const Vec3L &getMaxVecIndex() const;
70 
71  Vec3L getVecIndex(const Vec3 &pt) const;
72 
73  ParticleVector getNeighbourVector(const Vec3 &pt, double radius) const;
74 
75  ParticleVector getUniqueNeighbourVector(const Vec3 &pt, double radius) const;
76 
77  ParticleVector getNeighbourVector(const Vec3 &pt) const;
78 
79  void insert(Particle *pParticle);
80 
81  void insert(Particle &particle);
82 
85 
87 
89 
90  protected:
91 
92  void insertInTable(Particle *pParticle, const Vec3L &minIdx, const Vec3L &maxIdx);
93 
94  void addInserted(Particle *pParticle);
95 
96  int getNumCells() const;
97 
99 
100  void clearAndRecomputeGrid(const BoundingBox &bBox, double gridSpacing);
101 
102  private:
103  typedef boost::shared_array<ParticleVector> ParticleVectorArrayPtr;
104 
112  };
113  }
114 }
115 
117 
118 #endif
esys::lsm::NeighbourTable::m_bBox
BoundingBox m_bBox
Definition: NeighbourTable.h:109
esys::lsm::NeighbourTable::insert
void insert(Particle *pParticle)
Definition: NeighbourTable.hpp:233
esys::lsm::NeighbourTable::NeighbourTable
NeighbourTable(const BoundingBox &bBox, double gridSpacing)
Definition: NeighbourTable.hpp:22
esys::lsm::NeighbourTable::clearAndRecomputeGrid
void clearAndRecomputeGrid(const BoundingBox &bBox, double gridSpacing)
Definition: NeighbourTable.hpp:297
esys::lsm::NeighbourTable::getDimensions
const Vec3L & getDimensions() const
Definition: NeighbourTable.hpp:103
esys::lsm::NeighbourTable::Particle
TmplParticle Particle
Definition: NeighbourTable.h:35
esys::lsm::NeighbourTable
Definition: NeighbourTable.h:33
esys::lsm::NeighbourTable::m_maxIndex
Vec3L m_maxIndex
Definition: NeighbourTable.h:107
NeighbourTable.hpp
esys::lsm::NeighbourTable::getMaxVecIndex
const Vec3L & getMaxVecIndex() const
Definition: NeighbourTable.hpp:165
StlIterator.h
Vec3L.h
esys::lsm::NeighbourTable::m_dimensions
Vec3L m_dimensions
Definition: NeighbourTable.h:105
esys::lsm::NeighbourTable::m_tablePtr
ParticleVectorArrayPtr m_tablePtr
Definition: NeighbourTable.h:111
esys::lsm::NeighbourTable::insertInTable
void insertInTable(Particle *pParticle, const Vec3L &minIdx, const Vec3L &maxIdx)
Definition: NeighbourTable.hpp:262
esys::lsm::NeighbourTable::m_gridSpacing
double m_gridSpacing
Definition: NeighbourTable.h:108
esys::lsm::NeighbourTable::getNeighbourVector
ParticleVector getNeighbourVector(const Vec3 &pt, double radius) const
Definition: NeighbourTable.hpp:181
esys::lsm::NeighbourTable::getMinPt
const Vec3 & getMinPt() const
Definition: NeighbourTable.hpp:117
esys::lsm::NeighbourTable::getParticleIterator
ParticleIterator getParticleIterator()
Definition: NeighbourTable.hpp:249
esys::lsm::NeighbourTable::getScalarIndex
int getScalarIndex(int xIdx, int yIdx, int zIdx) const
Definition: NeighbourTable.hpp:129
esys::lsm::NeighbourTable::addInserted
void addInserted(Particle *pParticle)
Definition: NeighbourTable.hpp:278
esys::lsm::NeighbourTable::ParticleVectorArrayPtr
boost::shared_array< ParticleVector > ParticleVectorArrayPtr
Definition: NeighbourTable.h:103
esys::lsm::BoundingBox
3D bounding box
Definition: BoundingBox.h:28
esys
Definition: CheckPointable.cpp:17
esys::lsm::NeighbourTable::ParticleVector
std::vector< Particle * > ParticleVector
Definition: NeighbourTable.h:36
esys::lsm::NeighbourTable::m_insertedParticles
ParticleVector m_insertedParticles
Definition: NeighbourTable.h:110
esys::lsm::NeighbourTable::getMinVecIndex
const Vec3L & getMinVecIndex() const
Definition: NeighbourTable.hpp:158
esys::lsm::NeighbourTable::getGridSpacing
double getGridSpacing() const
Definition: NeighbourTable.hpp:78
esys::lsm::NeighbourTable::clear
void clear()
Definition: NeighbourTable.hpp:65
esys::lsm::NeighbourTable::getInsertedParticles
ParticleVector getInsertedParticles() const
Definition: NeighbourTable.hpp:291
esys::lsm::NeighbourTable::size
size_t size() const
Definition: NeighbourTable.hpp:123
esys::lsm::NeighbourTable::m_minIndex
Vec3L m_minIndex
Definition: NeighbourTable.h:106
esys::lsm::NeighbourTable::~NeighbourTable
virtual ~NeighbourTable()
Definition: NeighbourTable.hpp:60
esys::lsm::NeighbourTable::getNumCells
int getNumCells() const
Definition: NeighbourTable.hpp:284
esys::lsm::NeighbourTable::ParticleIterator
ForwardIterator< ParticleVector > ParticleIterator
Definition: NeighbourTable.h:83
Vec3
Definition: vec3.h:47
esys::lsm::ForwardIterator
Definition: StlIterator.h:30
esys::lsm::ForwardConstIterator
Definition: StlIterator.h:76
NeighbourTable.h
esys::lsm::NeighbourTable::resize
void resize(const BoundingBox &bBox, double gridSpacing)
Definition: NeighbourTable.hpp:84
esys::lsm::Vec3L
Definition: Vec3L.h:29
esys::lsm::NeighbourTable::getBBox
const BoundingBox & getBBox() const
Definition: NeighbourTable.hpp:110
esys::lsm::NeighbourTable::getUniqueNeighbourVector
ParticleVector getUniqueNeighbourVector(const Vec3 &pt, double radius) const
Definition: NeighbourTable.hpp:206
esys::lsm::NeighbourTable::ParticleConstIterator
ForwardConstIterator< ParticleVector > ParticleConstIterator
Definition: NeighbourTable.h:84
esys::lsm::NeighbourTable::getVecIndex
Vec3L getVecIndex(const Vec3 &pt) const
Definition: NeighbourTable.hpp:172
BoundingBox.h