ESyS-Particle
2.3.4
Packer.hpp
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
namespace
esys
15
{
16
namespace
lsm
17
{
18
template
<
typename
TmplParticleCollection>
19
Packer<TmplParticleCollection>::Packer
(
NTablePtr
nTablePtr)
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>
30
Packer<TmplParticleCollection>::Packer
(
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>
44
Packer<TmplParticleCollection>::~Packer
()
45
{
46
}
47
48
template
<
typename
TmplParticleCollection>
49
void
Packer<TmplParticleCollection>::setNTablePtr
(
NTablePtr
nTablePtr)
50
{
51
m_nTablePtr = nTablePtr;
52
}
53
54
template
<
typename
TmplParticleCollection>
55
typename
Packer<TmplParticleCollection>::NTable
&
Packer<TmplParticleCollection>::getNTable
()
56
{
57
return
*(m_nTablePtr);
58
}
59
60
template
<
typename
TmplParticleCollection>
61
const
typename
Packer<TmplParticleCollection>::NTable
&
62
Packer<TmplParticleCollection>::getNTable
()
const
63
{
64
return
*m_nTablePtr;
65
}
66
67
template
<
typename
TmplParticleCollection>
68
typename
Packer<TmplParticleCollection>::ParticlePool
&
69
Packer<TmplParticleCollection>::getParticlePool
()
70
{
71
return
*m_particlePoolPtr;
72
}
73
74
template
<
typename
TmplParticleCollection>
75
typename
Packer<TmplParticleCollection>::ParticlePoolPtr
76
Packer<TmplParticleCollection>::getParticlePoolPtr
()
77
{
78
return
m_particlePoolPtr;
79
}
80
81
template
<
typename
TmplParticleCollection>
82
const
typename
Packer<TmplParticleCollection>::ParticlePool
&
83
Packer<TmplParticleCollection>::getParticlePool
()
const
84
{
85
return
*m_particlePoolPtr;
86
}
87
88
template
<
typename
TmplParticleCollection>
89
typename
Packer<TmplParticleCollection>::ParticleCollection
&
90
Packer<TmplParticleCollection>::getParticleCollection
()
91
{
92
return
*m_particleCollectionPtr;
93
}
94
95
template
<
typename
TmplParticleCollection>
96
const
typename
Packer<TmplParticleCollection>::ParticleCollection
&
97
Packer<TmplParticleCollection>::getParticleCollection
()
const
98
{
99
return
*m_particleCollectionPtr;
100
}
101
102
template
<
typename
TmplParticleCollection>
103
typename
Packer<TmplParticleCollection>::Particle
&
104
Packer<TmplParticleCollection>::constructParticle
(
const
Particle
&particle)
105
{
106
return
getParticleCollection().createParticle(particle);
107
}
108
109
template
<
typename
TmplParticleCollection>
110
typename
Packer<TmplParticleCollection>::ParticleIterator
111
Packer<TmplParticleCollection>::getParticleIterator
()
112
{
113
return
getParticleCollection().
getParticleIterator
();
114
}
115
116
template
<
typename
TmplParticleCollection>
117
typename
Packer<TmplParticleCollection>::ParticleConstIterator
118
Packer<TmplParticleCollection>::getParticleIterator
()
const
119
{
120
return
getParticleCollection().
getParticleIterator
();
121
}
122
123
template
<
typename
TmplParticleCollection>
124
int
125
Packer<TmplParticleCollection>::getNumParticles
()
const
126
{
127
return
getParticleCollection().
getNumParticles
();
128
}
129
130
template
<
typename
TmplParticleCollection>
131
int
Packer<TmplParticleCollection>::getNextParticleId
()
132
{
133
return
static_cast<int>(getNTable().getNumParticles());
134
}
135
136
137
template
<
typename
TmplParticleCollection>
138
typename
Packer<TmplParticleCollection>::Particle
&
139
Packer<TmplParticleCollection>::createAndInsertParticle
(
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>
151
bool
Packer<TmplParticleCollection>::contains
(
const
Particle
&particle)
const
152
{
153
return
(m_idSet.find(particle.
getID
()) != m_idSet.end());
154
}
155
}
156
}
esys::lsm::SimpleSphereCollectionPy
Definition:
SimpleSphereCollectionPy.h:27
esys::lsm::SimpleParticleData::setId
void setId(const Id &id)
Definition:
SimpleParticleData.hpp:99
esys::lsm::SimpleParticleData::getID
Id getID() const
Definition:
SimpleParticleData.hpp:109
esys::lsm::Packer::getParticleIterator
ParticleIterator getParticleIterator()
Definition:
Packer.hpp:111
esys::lsm::Packer< SimpleSphereCollectionPy >::NTablePtr
boost::shared_ptr< NTable > NTablePtr
Definition:
Packer.h:42
esys::lsm::SimpleSpherePy
Definition:
SimpleSpherePy.h:24
esys::lsm::ParticleCollection::ParticleConstIterator
Definition:
ParticleCollection.h:68
esys::lsm::ParticleCollection::ParticleIterator
Definition:
ParticleCollection.h:48
esys::lsm::SimpleParticleData::getId
Id getId() const
Definition:
SimpleParticleData.hpp:94
esys::lsm::Packer::ParticleCollection
TmplParticleCollection ParticleCollection
Definition:
Packer.h:35
esys
Definition:
CheckPointable.cpp:16
esys::lsm::Packer< SimpleSphereCollectionPy >::ParticlePoolPtr
boost::shared_ptr< ParticlePool > ParticlePoolPtr
Definition:
Packer.h:40
esys::lsm::Packer< SimpleSphereCollectionPy >::ParticlePool
boost::object_pool< Particle > ParticlePool
Definition:
Packer.h:39
esys::lsm::Packer::Packer
Packer(NTablePtr nTablePtr)
Definition:
Packer.hpp:19
esys::lsm::Packer
Definition:
Packer.h:32
esys::lsm::Packer::Particle
ParticleCollection::Particle Particle
Definition:
Packer.h:38
esys::lsm::Packer::getNumParticles
int getNumParticles() const
Definition:
Packer.hpp:125
esys::lsm::CircularNeighbourTable
Definition:
CircularNeighbourTable.h:33
Geometry
Packer.hpp
Generated by
1.8.16