ESyS-Particle  2.3.2
GougeBlock3D.h
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 #ifndef ESYS_LSMGOUGEBLOCK3D_H
15 #define ESYS_LSMGOUGEBLOCK3D_H
16 
17 #include "Foundation/BoundingBox.h"
20 #include "Geometry/Plane3D.h"
22 
23 #include <boost/shared_ptr.hpp>
24 
25 #include <vector>
26 #include <float.h>
27 
28 namespace esys
29 {
30  namespace lsm
31  {
32  typedef std::vector<Plane3D> PlaneVector;
34  {
35  XY,
36  XZ,
38  };
39 
41  {
42  public:
44 
45  ParticleBlockPrms(double size, double minRadius, double maxRadius);
46 
48 
49  double m_size;
50  double m_minRadius;
51  double m_maxRadius;
52  };
53 
54  typedef std::vector<bool> BoolVector;
55  typedef std::vector<BoundingBox> BoundingBoxVector;
56 
58  {
59  public:
61  const BoundingBox &bBox,
62  const BoolVector &periodicDimensions,
63  Orientation orientation,
64  double minRadius,
65  double maxRadius
66  );
67 
68  bool is3d() const;
69 
71 
72  const BoundingBox &getBBox() const;
73 
74  const PlaneVector &getFitPlaneVector() const;
75 
76  double getMinRadius() const;
77 
78  double getMaxRadius() const;
79 
80  const BoolVector &getPeriodicDimensions() const;
81  private:
85  double m_minRadius;
86  double m_maxRadius;
88  };
89 
90  typedef std::vector<PackingInfo> PackingInfoVector;
92  {
93  public:
99  const BoundingBox &bBox,
100  double padRadius,
101  Orientation orientation,
102  const ParticleBlockPrms &faultRegionPrms,
103  const ParticleBlockPrms &gougeRegionPrms,
104  const BoolVector &peridicDimensions=BoolVector(3, false),
105  int maxInsertionFailures=100,
106  double tolerance = DBL_EPSILON*128,
107  double connectionTolerance = DBL_EPSILON*128*10
108  );
109 
110  ~GougeBlockPrms();
111 
112  double getTolerance() const;
113 
114  double getConnectionTolerance() const;
115 
116  const BoundingBox &getBBox() const;
117 
118  int getMaxInsertionFailures() const;
119 
120  double getRegularBlockRadius() const;
121 
122  double getFaultMinRadius() const;
123 
124  double getFaultMaxRadius() const;
125 
126  double getGougeMinRadius() const;
127 
128  double getGougeMaxRadius() const;
129 
130  const BoolVector &getPeriodicDimensions() const;
131 
133 
135 
137 
138  BoundingBox cutFromCentre(double d1, double d2) const;
139 
140  Orientation getOrientation() const;
141 
142  int getOrientationIndex() const;
143 
144  double getOrientationSize() const;
145 
146  double getMaxRadius() const;
147 
148  double getMinRadius() const;
149 
150  bool is2d() const;
151 
152  private:
154  double m_padRadius;
160  double m_tolerance;
162  };
163 
169  {
170  public:
172  GougeBlock3D(const GougeBlockPrms &prms);
173 
174  virtual ~GougeBlock3D();
175 
176  virtual void generate();
177 
178  int getNumParticles() const;
179 
181  typedef boost::shared_ptr<NTable> NTablePtr;
182  typedef boost::shared_ptr<BlockGenerator> GeneratorPtr;
183  typedef std::vector<GeneratorPtr> GeneratorPtrVector;
186 
188 
190 
191  bool isGougeParticle(const SimpleParticle &particle) const;
192 
194  const SimpleParticle &p1,
195  const SimpleParticle &p2
196  ) const;
197 
198  virtual void write(std::ostream &oStream) const;
199 
200  void writeToFile(const std::string &fileName) const;
201 
202  void tagGougeParticles(int tag);
203 
204  void tagFaultParticles(int tag);
205 
207  int minDrivingTag,
208  int maxDrivingTag,
209  double distanceFromBBoxEdge
210  );
211 
212  typedef std::set<BasicInteraction,BILess> InteractionSet;
213 
214  virtual void createInteractionSet();
215 
216  const InteractionSet &getInteractionSet() const;
217 
218  template <typename TmplVisitor>
219  void visitParticles(TmplVisitor &visitor)
220  {
221  for (
222  GeneratorPtrVector::iterator it = m_genPtrVector.begin();
223  it != m_genPtrVector.end();
224  it++
225  )
226  {
227  BlockGenerator::ParticleIterator particleIt = (*it)->getParticleIterator();
228  while (particleIt.hasNext()) {
229  particleIt.next()->visit(visitor);
230  }
231  }
232  }
233 
234  template <typename TmplVisitor>
235  void visitParticles(const TmplVisitor &visitor) const
236  {
237  for (
238  GeneratorPtrVector::const_iterator it = m_genPtrVector.begin();
239  it != m_genPtrVector.end();
240  it++
241  )
242  {
243  BlockGenerator::ParticleIterator particleIt = (*it)->getParticleIterator();
244  while (particleIt.hasNext()) {
245  particleIt.next()->visit(visitor);
246  }
247  }
248  }
249 
250  template <typename TmplVisitor>
251  void visitInteractions(TmplVisitor &visitor) const
252  {
253  const InteractionSet &interactionSet = getInteractionSet();
254  for (
255  InteractionSet::const_iterator it = interactionSet.begin();
256  it != interactionSet.end();
257  it++
258  )
259  {
260  it->visit(visitor);
261  }
262  }
263 
264  const GougeBlockPrms &getPrms() const
265  {
266  return m_prms;
267  }
268 
269  protected:
276 
279  virtual void createGougeBlockGenerators();
280 
281  private:
284  };
285  }
286 }
287 
288 #endif