ESyS-Particle
2.2
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
GrainCollection.h
Go to the documentation of this file.
1
2
// //
3
// Copyright (c) 2003-2013 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
#ifndef ESYS_LSMGRAINCOLLECTION_H
14
#define ESYS_LSMGRAINCOLLECTION_H
15
16
#include "
Foundation/StlIterator.h
"
17
#include <boost/shared_ptr.hpp>
18
#include <boost/pool/object_pool.hpp>
19
20
#include <vector>
21
22
namespace
esys
23
{
24
namespace
lsm
25
{
29
template
<
typename
TmplGrain>
30
class
GrainCollection
31
{
32
public
:
33
typedef
TmplGrain
Grain
;
34
typedef
typename
Grain::Particle
Particle
;
35
typedef
typename
Grain::ParticleCollection
ParticleCollection
;
36
typedef
typename
ParticleCollection::ParticlePool
ParticlePool
;
37
typedef
typename
ParticleCollection::ParticlePoolPtr
ParticlePoolPtr
;
38
typedef
typename
ParticleCollection::ParticleIterator
ParticleIterator
;
39
typedef
typename
ParticleCollection::ParticleConstIterator
ParticleConstIterator
;
40
typedef
boost::object_pool<Grain>
GrainPool
;
41
typedef
boost::shared_ptr<GrainPool>
GrainPoolPtr
;
42
typedef
std::vector<Grain *>
GrainVector
;
43
44
protected
:
45
typedef
ForwardIterator<GrainVector>
VectorIterator
;
46
typedef
ForwardConstIterator<GrainVector>
VectorConstIterator
;
47
48
public
:
49
50
class
GrainIterator
:
public
VectorIterator
51
{
52
public
:
53
typedef
Grain
&
value_type
;
54
GrainIterator
(
const
VectorIterator
&it)
55
:
VectorIterator
(it)
56
{
57
}
58
59
value_type
next
()
60
{
61
return
*(
VectorIterator::next
());
62
}
63
64
value_type
current
()
const
65
{
66
return
*(
VectorIterator::current
());
67
}
68
};
69
70
class
GrainConstIterator
:
public
VectorConstIterator
71
{
72
public
:
73
typedef
const
Grain
&
value_type
;
74
GrainConstIterator
(
const
VectorConstIterator
&it)
75
:
VectorConstIterator
(it)
76
{
77
}
78
79
GrainConstIterator
(
const
VectorIterator
&it)
80
:
VectorConstIterator
(it)
81
{
82
}
83
84
value_type
next
()
85
{
86
return
*(
VectorConstIterator::next
());
87
}
88
89
value_type
current
()
const
90
{
91
return
*(
VectorConstIterator::current
());
92
}
93
};
94
95
GrainCollection
();
96
97
GrainCollection
(
ParticlePoolPtr
particlePoolPtr);
98
99
GrainCollection
(
ParticlePoolPtr
particlePoolPtr,
GrainPoolPtr
grainPoolPtr);
100
101
virtual
~GrainCollection
();
102
106
int
getNumGrains
()
const
;
107
112
int
getNumParticles
()
const
;
113
121
void
insertRef
(
Grain
&g);
122
127
Grain
&
createGrain
();
128
134
Grain
&
createGrain
(
typename
Grain::Id
id
);
135
141
Grain
&
createGrain
(
const
Grain
&g);
142
143
GrainIterator
getGrainIterator
();
144
145
GrainConstIterator
getGrainIterator
()
const
;
146
147
protected
:
148
ParticlePoolPtr
getParticlePoolPtr
();
149
150
GrainPoolPtr
getGrainPoolPtr
();
151
152
private
:
153
ParticlePoolPtr
m_particlePoolPtr
;
154
GrainPoolPtr
m_grainPoolPtr
;
155
GrainVector
m_grainVector
;
156
};
157
}
158
}
159
160
#include "
Geometry/GrainCollection.hpp
"
161
162
#endif
Geometry
GrainCollection.h
Generated on Mon May 6 2013 23:26:29 for ESyS-Particle by
1.8.3.1