ESyS-Particle  4.0.1
BlockGenerator.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_LSMBLOCKGENERATOR_H
15 #define ESYS_LSMBLOCKGENERATOR_H
16 
17 #include <Geometry/ParticleGenerator.h>
18 #include <Geometry/SimpleParticle.h>
19 #include <Foundation/BoundingBox.h>
20 
21 #include <vector>
22 #include <set>
23 
24 namespace esys
25 {
26  namespace lsm
27  {
28  typedef std::vector<bool> BoolVector;
33  {
34  public:
36  NTable &nTable,
37  ParticlePool &particlePool,
38  const BoundingBox &bBox,
39  const BoolVector &periodicDimensions,
40  double tolerance
41  );
42 
43  virtual ~BlockGenerator();
44 
45  virtual void generate() = 0;
46 
47  virtual void generateSeedParticles();
48 
49  virtual SimpleParticle generateParticle(const Vec3 &point);
50 
51  virtual double getRadius() const = 0;
52 
53  virtual double getGridRadius() const = 0;
54 
55  size_t getNumParticles() const;
56 
57  int getNextId();
58 
59  virtual bool particleFits(const SimpleParticle &particle) const;
60 
61  bool is2d() const;
62 
63  bool particleFitsInBBox(const SimpleParticle &particle) const;
64 
65  bool particleFitsWithNeighbours(const SimpleParticle &particle) const;
66 
67  void insertParticle(const SimpleParticle &particle);
68 
69  double getTolerance() const;
70 
71  const BoundingBox &getBBox() const;
72 
73  bool contains(const SimpleParticle &particle) const;
74 
75  typedef NTable::ParticleVector ParticleVector;
77 
78  ParticleIterator getParticleIterator()
79  {
80  return ParticleIterator(m_particleVector);
81  }
82 
83  typedef std::set<int> IdSet;
84  private:
85  BoundingBox m_bBox;
86  BoolVector m_periodicDimensions;
87  ParticleVector m_particleVector;
88  double m_tolerance;
89  IdSet m_idSet;
90  };
91  };
92 };
93 
94 #endif