ESyS-Particle  2.3.2
Packer.hpp
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 
14 namespace esys
15 {
16  namespace lsm
17  {
18  template <typename TmplParticleCollection>
20  : m_nTablePtr(nTablePtr),
21  m_particlePoolPtr(new ParticlePool),
22  m_particleCollectionPtr(
23  new ParticleCollection(m_particlePoolPtr)
24  ),
25  m_idSet()
26  {
27  }
28 
29  template <typename TmplParticleCollection>
31  ParticlePoolPtr particlePoolPtr,
32  NTablePtr nTablePtr
33  )
34  : m_nTablePtr(nTablePtr),
35  m_particlePoolPtr(particlePoolPtr),
36  m_particleCollectionPtr(
37  new ParticleCollection(m_particlePoolPtr)
38  ),
39  m_idSet()
40  {
41  }
42 
43  template <typename TmplParticleCollection>
45  {
46  }
47 
48  template <typename TmplParticleCollection>
50  {
51  m_nTablePtr = nTablePtr;
52  }
53 
54  template <typename TmplParticleCollection>
56  {
57  return *(m_nTablePtr);
58  }
59 
60  template <typename TmplParticleCollection>
63  {
64  return *m_nTablePtr;
65  }
66 
67  template <typename TmplParticleCollection>
70  {
71  return *m_particlePoolPtr;
72  }
73 
74  template <typename TmplParticleCollection>
77  {
78  return m_particlePoolPtr;
79  }
80 
81  template <typename TmplParticleCollection>
84  {
85  return *m_particlePoolPtr;
86  }
87 
88  template <typename TmplParticleCollection>
91  {
92  return *m_particleCollectionPtr;
93  }
94 
95  template <typename TmplParticleCollection>
98  {
99  return *m_particleCollectionPtr;
100  }
101 
102  template <typename TmplParticleCollection>
105  {
106  return getParticleCollection().createParticle(particle);
107  }
108 
109  template <typename TmplParticleCollection>
112  {
113  return getParticleCollection().getParticleIterator();
114  }
115 
116  template <typename TmplParticleCollection>
119  {
120  return getParticleCollection().getParticleIterator();
121  }
122 
123  template <typename TmplParticleCollection>
124  int
126  {
127  return getParticleCollection().getNumParticles();
128  }
129 
130  template <typename TmplParticleCollection>
132  {
133  return static_cast<int>(getNTable().getNumParticles());
134  }
135 
136 
137  template <typename TmplParticleCollection>
140  const Particle &particle
141  )
142  {
143  Particle *pParticle = &(constructParticle(particle));
144  pParticle->setId(getNextParticleId());
145  m_idSet.insert(pParticle->getId());
146  getNTable().insert(pParticle);
147  return *pParticle;
148  }
149 
150  template <typename TmplParticleCollection>
152  {
153  return (m_idSet.find(particle.getID()) != m_idSet.end());
154  }
155  }
156 }