ESyS-Particle  2.3.2
ParticleCollection.h
Go to the documentation of this file.
1 
2 // //
3 // Copyright (c) 2003-2014 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.opensource.org/licenses/osl-3.0.php //
10 // //
12 
13 #ifndef ESYS_LSMPARTICLECOLLECTION_H
14 #define ESYS_LSMPARTICLECOLLECTION_H
15 
16 #include "Foundation/BoundingBox.h"
17 #include "Foundation/StlIterator.h"
18 #include "Geometry/Vec3L.h"
19 
20 #include <boost/shared_ptr.hpp>
21 #include <boost/pool/object_pool.hpp>
22 
23 #include <vector>
24 #include <float.h>
25 
26 namespace esys
27 {
28  namespace lsm
29  {
33  template <typename TmplParticle>
35  {
36  public:
37  typedef TmplParticle Particle;
38  typedef boost::object_pool<Particle> ParticlePool;
39  typedef boost::shared_ptr<ParticlePool> ParticlePoolPtr;
40 
41  private:
42  typedef std::vector<Particle *> ParticleVector;
45 
46  public:
47 
49  {
50  public:
51  typedef Particle& value_type;
53  : VectorIterator(it)
54  {
55  }
56 
58  {
59  return *(VectorIterator::next());
60  }
61 
63  {
64  return *(VectorIterator::current());
65  }
66  };
67 
69  {
70  public:
71  typedef const Particle& value_type;
74  {
75  }
76 
79  {
80  }
81 
83  {
84  return *(VectorConstIterator::next());
85  }
86 
88  {
89  return *(VectorConstIterator::current());
90  }
91  };
92 
94 
95  ParticleCollection(ParticlePoolPtr particlePoolPtr);
96 
98 
100 
101  virtual ~ParticleCollection();
102 
103  int getNumParticles() const;
104 
106 
108  {
110  }
111 
112  ParticleConstIterator getParticleIterator() const
113  {
114  return ParticleConstIterator(VectorConstIterator(m_particleVector));
115  }
116 
122  void translateBy(const Vec3 &vec);
123 
131  void rotate(const Vec3 &rotation, const Vec3 &posn);
132 
138  void incrementIdBy(typename Particle::Id idIncr);
139 
144  void insertRef(Particle &p);
145 
151  Particle &createParticle(const Particle &p);
152 
153  protected:
158  void noCheckInsertRef(Particle &p);
159 
160  private:
163  };
164  }
165 }
166 
168 
169 #endif