ESyS-Particle  2.3
ClosePackBlock.hpp
Go to the documentation of this file.
1 // //
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 #ifndef ESYS_LSMCLOSEPACKBLOCK_HPP
15 #define ESYS_LSMCLOSEPACKBLOCK_HPP
16 
19 
20 namespace esys
21 {
22  namespace lsm
23  {
24  template <typename TmplClosePackIterator,typename TmplParticle>
26  unsigned int numX,
27  unsigned int numY,
28  unsigned int numZ,
29  double radius,
30  ClosePackOrientation orientation
31  )
32  : m_radius(radius),
33  m_dimCounts(numX, numY, numZ),
34  m_orientation(orientation)
35  {
36  }
37 
38  template <typename TmplClosePackIterator,typename TmplParticle>
39  template <typename TmplParticleCollection>
40  void
42  TmplParticleCollection &particleCollection
43  )
44  {
45  int id = 0;
48  m_dimCounts[0],
49  m_dimCounts[1],
50  m_dimCounts[2],
51  getRadius(),
52  ((m_orientation == DEFAULT_ORIENT) && (m_dimCounts[2] <= 1)) ? XYZ : m_orientation
53  );
54 
55  while (it.hasNext())
56  {
57  particleCollection.createParticle(
58  TmplParticle(
59  it.next(),
60  getRadius(),
61  id,
62  0
63  )
64  );
65  id++;
66  }
67  }
68 
69  template <typename TmplClosePackIterator,typename TmplParticle>
71  {
72  }
73 
74  template <typename TmplClosePackIterator,typename TmplParticle>
76  {
77  return m_radius;
78  }
79 
80 
81 
82 
83 
84 
85 
86  template <typename TmplClosePackIterator,typename TmplParticle>
88  unsigned int numX,
89  unsigned int numY,
90  unsigned int numZ,
91  double radius,
92  ClosePackOrientation orientation
93  )
94  : ParticleCollection<TmplParticle>(),
95  m_generator(numX, numY, numZ, radius)
96  {
98  }
99 
100  template <typename TmplClosePackIterator,typename TmplParticle>
102  {
103  }
104 
105  template <typename TmplClosePackIterator,typename TmplParticle>
107  {
108  m_generator.createParticles(*this);
109  }
110 
111  template <typename TmplClosePackIterator,typename TmplParticle>
113  {
114  return m_generator.getRadius();
115  }
116  }
117 }
118 
119 #endif
Definition: ClosePackOrientation.h:27
double getRadius() const
Definition: ClosePackBlock.hpp:112
void createParticles()
Definition: ClosePackBlock.hpp:106
virtual ~ClosePackBlock()
Definition: ClosePackBlock.hpp:101
Definition: CheckPointable.cpp:16
ClosePackBlock(unsigned int numX, unsigned int numY, unsigned int numZ, double radius=0.5, ClosePackOrientation orientation=DEFAULT_ORIENT)
Definition: ClosePackBlock.hpp:87
Definition: ClosePackOrientation.h:28
virtual ~ClosePackBlockGenerator()
Definition: ClosePackBlock.hpp:70
double getRadius() const
Definition: ClosePackBlock.hpp:75
void createParticles(TmplParticleCollection &particleCollection)
Definition: ClosePackBlock.hpp:41
ClosePackBlockGenerator(unsigned int numX, unsigned int numY, unsigned int numZ, double radius=0.5, ClosePackOrientation orientation=DEFAULT_ORIENT)
Definition: ClosePackBlock.hpp:25
ClosePackOrientation
Definition: ClosePackOrientation.h:25
TmplClosePackIterator CentrePointIterator
Definition: ClosePackBlock.h:31
Definition: ParticleCollection.h:34