ESyS-Particle  2.3.2
BoxPacker.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_LSMBOXPACKER_H
15 #define ESYS_LSMBOXPACKER_H
16 
17 #include <Geometry/Packer.h>
18 #include <Foundation/vec3.h>
19 #include <Foundation/BoundingBox.h>
20 
21 #include <vector>
22 
23 namespace esys
24 {
25  namespace lsm
26  {
27  typedef std::vector<bool> BoolVector;
31  template <typename TmplPackerBase>
32  class BoxPacker : public TmplPackerBase
33  {
34  public:
35  typedef TmplPackerBase Inherited;
36  typedef typename Inherited::Particle Particle;
37  typedef typename Inherited::NTable NTable;
38  typedef typename Inherited::NTablePtr NTablePtr;
39  typedef typename Inherited::ParticlePool ParticlePool;
40  typedef typename Inherited::ParticlePoolPtr ParticlePoolPtr;
41 
42  BoxPacker(
43  ParticlePoolPtr particlePoolPtr,
44  NTablePtr nTablePtr,
45  const BoundingBox &bBox,
46  const BoolVector &periodicDimensions,
47  double tolerance
48  );
49 
50  virtual ~BoxPacker();
51 
52  virtual void generate() = 0;
53 
54  bool particleFitsInBBox(const Particle &particle) const;
55 
56  bool is2d() const;
57 
58  bool particleFitsInBBoxWithNeighbours(const Particle &particle) const;
59 
60  bool particleFitsWithNeighbours(const Particle &particle) const;
61 
62  double getTolerance() const;
63 
64  const BoundingBox &getBBox() const;
65 
66 
67  const BoolVector &getPeriodicDimensions() const;
68 
69  private:
72  double m_tolerance;
73  };
74  }
75 }
76 
77 #include "Geometry/BoxPacker.hpp"
78 
79 #endif