Lagrangian Particle Code for The Simulation of 2D/3D Fluid Dynamics
 All Classes Files Functions Variables Typedefs Friends Pages
geometry.h
Go to the documentation of this file.
1 
16 #ifndef __GEOMETRY_H__
17 #define __GEOMETRY_H__
18 
19 #include <unordered_map>
20 
38 class Geometry {
39 public:
41  virtual ~Geometry() {}
42 
50  virtual bool operator()(double x, double y, double z) const=0;
51 
67  virtual void getBoundingBox(double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax)=0;
68 
69 };
70 
71 
72 
73 
74 
75 
76 
77 
78 
93 class Ball: public Geometry {
94 public:
96  Ball();
97 
99  virtual ~Ball() {}
100 
115  virtual bool operator()(double x, double y, double z) const;
116 
128  virtual void getBoundingBox(double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax);
129 private:
130  double radius;
131  double xCen;
132  double yCen;
133  double zCen;
134 };
135 
136 
137 
138 
139 
140 
141 
142 
143 
158 class Disk: public Geometry {
159 public:
161  Disk();
162 
164  virtual ~Disk() {}
165 
180  virtual bool operator()(double x, double y, double z) const;
181 
193  virtual void getBoundingBox(double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax);
194 private:
195  double radius;
196  double xCen;
197  double yCen;
198 };
199 
200 
201 
202 
203 
204 
205 
206 
207 
208 
209 
227 public:
231  typedef Geometry* (*GeoCreateFunc)();
232 
249  static GeometryFactory& instance();
250 
271  void registerGeometry(std::string name, GeoCreateFunc func);
272 
288  Geometry* createGeometry(std::string name);
289 private:
290  std::unordered_map<std::string,GeoCreateFunc> geoTable;
291  GeometryFactory() {}
292  GeometryFactory(const GeometryFactory& other);
293  GeometryFactory& operator=(const GeometryFactory& other);
294 };
295 
296 
297 #endif // __GEOMETRY_H__
Disk()
Constructor.
Definition: geometry.cpp:37
Ball()
Constructor.
Definition: geometry.cpp:9
Supply functions for generating a 3D ball geometry.
Definition: geometry.h:93
void registerGeometry(std::string name, GeoCreateFunc func)
Registers (links) the geometry name name with the function func for creating objects in the Geometry ...
Definition: geometry.cpp:71
Geometry *(* GeoCreateFunc)()
Defines a function pointer pointing to a function which creates objects in the Geometry family...
Definition: geometry.h:231
virtual ~Ball()
Destructor.
Definition: geometry.h:99
virtual void getBoundingBox(double &xmin, double &xmax, double &ymin, double &ymax, double &zmin, double &zmax)
Calculates the bounding box of 2D disk.
Definition: geometry.cpp:43
virtual bool operator()(double x, double y, double z) const =0
Level set function of particle geometry.
Supply functions for generating a 2D disk geometry.
Definition: geometry.h:158
An abstract class for the initialization of the geometry of fluid objects.
Definition: geometry.h:38
virtual ~Disk()
Desturctor.
Definition: geometry.h:164
The abstract factory class for creating objects in the Geometry family.
Definition: geometry.h:226
virtual ~Geometry()
Destructor.
Definition: geometry.h:41
virtual void getBoundingBox(double &xmin, double &xmax, double &ymin, double &ymax, double &zmin, double &zmax)
Calculates the bounding box of 3D ball.
Definition: geometry.cpp:15
virtual bool operator()(double x, double y, double z) const
Level set function of a 3D ball.
Definition: geometry.cpp:11
virtual bool operator()(double x, double y, double z) const
Level set function of a 2D disk.
Definition: geometry.cpp:39
virtual void getBoundingBox(double &xmin, double &xmax, double &ymin, double &ymax, double &zmin, double &zmax)=0
Calculates the bounding box of a geometric shape.
static GeometryFactory & instance()
Returns reference to a Singleton object of class GeometryFactory.
Definition: geometry.cpp:66