ESyS-Particle  4.0.1
RandomBlockGenerator.h
1 
2 // //
3 // Copyright (c) 2003-2011 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 
14 #ifndef ESYS_LSMRANDOMBLOCKGENERATOR_H
15 #define ESYS_LSMRANDOMBLOCKGENERATOR_H
16 
17 #include <Geometry/BlockGenerator.h>
18 #include <Geometry/Plane.h>
19 
20 #include <vector>
21 #include <boost/shared_ptr.hpp>
22 
23 namespace esys
24 {
25  namespace lsm
26  {
27  class ParticleFitter;
28 
29  typedef std::vector<Plane> PlaneVector;
30  typedef boost::shared_ptr<ParticleFitter> FitterPtr;
31  typedef std::vector<FitterPtr> FitterPtrVector;
32 
37  {
38  public:
40  NTable &nTable,
41  ParticlePool &particlePool,
42  const BoundingBox &bBox,
43  const BoolVector &periodicDimensions,
44  double tolerance,
45  double minSphereRadius,
46  double maxSphereRadius,
47  const PlaneVector &fitPlaneVector,
48  int maxInsertionFailures
49  );
50 
51  virtual ~RandomBlockGenerator();
52 
53  virtual bool particleFits(const SimpleParticle &particle) const;
54 
55  virtual void generate();
56 
57  double getRandom(double min, double max) const;
58 
59  virtual double getRadius() const;
60 
61  virtual double getGridRadius() const;
62 
63  Vec3 getRandomPoint() const;
64 
65  ParticleVector getClosestNeighbors(const SimpleParticle& particle, int numClosest);
66 
67  int getMaxInsertionFailures() const;
68 
69  FitterPtrVector getFitterPtrVector();
70 
71  void generateFillParticles();
72 
73  const PlaneVector &getFitPlaneVector() const;
74 
75  Plane getClosestFitPlane(const SimpleParticle &particle) const;
76 
77  private:
78  double m_minRadius;
79  double m_maxRadius;
80  PlaneVector m_fitPlaneVector;
81  int m_maxInsertionFailures;
82  };
83  };
84 };
85 
86 #endif