ESyS-Particle  4.0.1
Packer.h
1 
2 // //
3 // Copyright (c) 2003-2011 by The University of Queensland //
4 // Earth Systems Science Computational Centre (ESSCC) //
5 // http://www.uq.edu.au/esscc //
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 
14 #ifndef ESYS_LSMPACKER_H
15 #define ESYS_LSMPACKER_H
16 
17 #include "Geometry/CircularNeighbourTable.h"
18 #include "Geometry/ParticleCollection.h"
19 #include <boost/pool/object_pool.hpp>
20 #include <boost/shared_ptr.hpp>
21 
22 #include <set>
23 
24 namespace esys
25 {
26  namespace lsm
27  {
31  template <typename TmplParticleCollection>
32  class Packer
33  {
34  public:
35  typedef TmplParticleCollection ParticleCollection;
37  typedef boost::shared_ptr<ParticleCollection> ParticleCollectionPtr;
38  typedef typename ParticleCollection::Particle Particle;
39  typedef boost::object_pool<Particle> ParticlePool;
40  typedef boost::shared_ptr<ParticlePool> ParticlePoolPtr;
42  typedef boost::shared_ptr<NTable> NTablePtr;
43  typedef
46  typedef
49 
50  Packer(NTablePtr nTablePtr);
51 
52  Packer(ParticlePoolPtr particlePoolPtr, NTablePtr nTablePtr);
53 
54  virtual ~Packer();
55 
56  virtual void generate() = 0;
57 
58  int getNumParticles() const;
59 
60  int getNextParticleId();
61 
62  void setNTablePtr(NTablePtr nTablePtr);
63  NTable &getNTable();
64  const NTable &getNTable() const;
65 
66  ParticlePoolPtr getParticlePoolPtr();
67  ParticlePool &getParticlePool();
68  const ParticlePool &getParticlePool() const;
69 
70  ParticleCollection &getParticleCollection();
71  const ParticleCollection &getParticleCollection() const;
72 
73  Particle &constructParticle(const Particle &particle);
74 
75  ParticleIterator getParticleIterator();
76 
77  ParticleConstIterator getParticleIterator() const;
78 
79  bool contains(const Particle &particle) const;
80 
81  Particle &createAndInsertParticle(const Particle &particle);
82 
83  protected:
84 
85  typedef std::set<int> IdSet;
86 
87  private:
88  NTablePtr m_nTablePtr;
89  ParticlePoolPtr m_particlePoolPtr;
90  ParticleCollectionPtr m_particleCollectionPtr;
91  IdSet m_idSet;
92  };
93  };
94 };
95 
96 #include "Geometry/Packer.hpp"
97 
98 #endif