SPHinXsys  alpha version
geometric_shape.h
1 /* -------------------------------------------------------------------------*
2  * SPHinXsys *
3  * --------------------------------------------------------------------------*
4  * SPHinXsys (pronunciation: s'finksis) is an acronym from Smoothed Particle *
5  * Hydrodynamics for industrial compleX systems. It provides C++ APIs for *
6  * physical accurate simulation and aims to model coupled industrial dynamic *
7  * systems including fluid, solid, multi-body dynamics and beyond with SPH *
8  * (smoothed particle hydrodynamics), a meshless computational method using *
9  * particle discretization. *
10  * *
11  * SPHinXsys is partially funded by German Research Foundation *
12  * (Deutsche Forschungsgemeinschaft) DFG HU1527/6-1, HU1527/10-1 *
13  * and HU1527/12-1. *
14  * *
15  * Portions copyright (c) 2017-2020 Technical University of Munich and *
16  * the authors' affiliations. *
17  * *
18  * Licensed under the Apache License, Version 2.0 (the "License"); you may *
19  * not use this file except in compliance with the License. You may obtain a *
20  * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. *
21  * *
22  * --------------------------------------------------------------------------*/
30 #ifndef GEOMETRIC_SHAPE_H
31 #define GEOMETRIC_SHAPE_H
32 
33 #include "base_geometry.h"
34 #include "multi_polygon_shape.h"
35 
36 namespace SPH
37 {
38  class GeometricShapeBox : public Shape
39  {
40  public:
41  explicit GeometricShapeBox(const Vec2d &halfsize,
42  const std::string &shape_name = "GeometricShapeBox");
43  virtual ~GeometricShapeBox(){};
44 
45  virtual bool checkContain(const Vec2d &pnt, bool BOUNDARY_INCLUDED = true) override;
46  virtual Vec2d findClosestPoint(const Vec2d &pnt) override;
47 
48  protected:
49  Vec2d halfsize_;
50  MultiPolygon multi_polygon_;
51 
52 
53  virtual BoundingBox findBounds() override;
54  };
55 
56  class GeometricShapeBall : public Shape
57  {
58  Vec2d center_;
59  Real radius_;
60 
61  public:
62  explicit GeometricShapeBall(const Vec2d &center, Real radius,
63  const std::string &shape_name = "GeometricShapeBall");
64  virtual ~GeometricShapeBall(){};
65 
66  virtual bool checkContain(const Vec2d &pnt, bool BOUNDARY_INCLUDED = true) override;
67  virtual Vec2d findClosestPoint(const Vec2d &pnt) override;
68 
69  protected:
70  virtual BoundingBox findBounds() override;
71  };
72 }
73 
74 #endif // GEOMETRIC_SHAPE_H
Definition: geometric_shape.h:38
Base class for all volumetric geometries Note that checkContain and findClosest point are basic funct...
Definition: base_geometry.h:64
used to define a closed region
Definition: multi_polygon_shape.h:52
Here, we define the 2D geometric algortihms. they are based on the boost library. ...
Definition: geometric_shape.h:56
Shape is the base class for all geometries.
Definition: solid_body_supplementary.cpp:9