GranOO  3.0
A robust and versatile workbench to build 3D dynamic simulations based on the Discrete Element Method
Plane.hpp
Go to the documentation of this file.
1 // This file is part of GranOO, a workbench for DEM simulation.
2 //
3 // Author(s) : - Damien Andre IRCER/UNILIM, Limoges France
4 // <damien.andre@unilim.fr>
5 // - Jean-luc Charles Arts et Metiers ParisTech, CNRS, I2M, Bordeaux France
6 // <jean-luc.charles@ensam.eu>
7 // - Jeremie Girardot Arts et Metiers ParisTech, CNRS, I2M, Bordeaux France
8 // <jeremie.girardot@ensam.eu>
9 // - Cedric Hubert LAMIH/UPHF, Valenciennes France
10 // <cedric.hubert@uphf.fr>
11 // - Ivan Iordanoff Arts et Metiers ParisTech, CNRS, I2M, Bordeaux France
12 // <ivan.iordanoff@ensam.eu>
13 //
14 // Copyright (C) 2008-2019 D. Andre, JL. Charles, J. Girardot, C. Hubert, I. Iordanoff
15 //
16 // This program is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 // This program is distributed in the hope that it will be useful,
22 // but WITHOUT ANY WARRANTY; without even the implied warranty of
23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 // GNU General Public License for more details.
25 //
26 // You should have received a copy of the GNU General Public License
27 // along with this program. If not, see <http://www.gnu.org/licenses/>.
28 
29 
30 #ifndef _GranOO_LibShape_Plane_hh_
31 #define _GranOO_LibShape_Plane_hh_
32 
33 #include <iostream>
34 #include <string>
35 
36 #include <vtkUnstructuredGrid.h>
37 
39 
40 #include "GranOO3/Geom/Point.hpp"
42 
43 #include "GranOO3/Core/String.hpp"
45 
46 namespace GranOO3
47 {
48  namespace Shape
49  {
50 
51  class Plane : public Surface,
52  public Core::ObjectFactoryInterface< Base, Plane>
53  {
54 
55  GRANOO_OBJECT_FACTORY(Plane);
56 
57  public:
58  static std::string class_ID() {return std::string("Plane");}
59  static std::string desc();
60 
61  public:
62  Plane();
63  Plane(const Geom::Frame& frame);
64  Plane(const Plane &);
65  ~Plane();
66 
67  //USEFULL
68  void read_xml_element(const TiXmlElement* el);
69  std::string description() const;
70  std::string get_str_type_key() const {return Plane::class_ID();}
71  double area() const {return std::numeric_limits<double>::max();}
72 
73  void draw_gl() const;
74  void scale(double); // It has no effect on a plane
75 
76  //CONTACT DETECTION v2
77  bool collide(const Volume&, Collision::Data&) const;
78  bool collide(const Geom::Point&, Collision::Data&) const;
79 
80  virtual void to_vtk(vtkUnstructuredGrid* data);
81  std::ostream& to_povray (std::ostream& out, const Core::Color& ) const;
82 
83  private:
85  template<class Archive> void serialize(Archive & ar, const unsigned int );
86  };
87 
88 
89  inline
90  Plane::Plane(const Geom::Frame& frame)
91  : Surface(frame) {
92  }
93 
94  inline
96  : Surface(Geom::Frame::global) {
97  }
98 
99  inline
100  Plane::Plane(const Plane& p)
101  : Surface(p.local_frame()) {
102  }
103 
104  inline
106  }
107 
108  template<class Archive>
109  inline void
110  Plane::serialize(Archive & ar, const unsigned int ) {
111  ar & boost::serialization::base_object<Surface>(*this);
112  }
113 
114  }
115 }
116 
117 //Don't forget to export for dynamic serialization of child class
118 #include <boost/serialization/export.hpp>
120 
121 
122 #include <boost/serialization/version.hpp>
124 GRANOO_SERIALIZE_SHAPE(Plane)
125 
126 
127 namespace GranOO3
128 {
129  extern template class Core::ObjectFactoryInterface<Shape::Base, Shape::Plane>;
130 }
131 
132 
133 #endif
BOOST_CLASS_EXPORT_KEY(GranOO3::Shape::Box) namespace GranOO3
Definition: Box.hpp:319
BOOST_CLASS_VERSION(GranOO3::Core::Base, 1) namespace GranOO3
Definition: Base.hpp:277
Definition: Color.hpp:44
Definition: ObjectFactory.hpp:235
Definition: Frame.hpp:68
Definition: Point.hpp:62
Definition: Plane.hpp:53
static std::string desc()
~Plane()
Definition: Plane.hpp:105
std::ostream & to_povray(std::ostream &out, const Core::Color &) const
bool collide(const Geom::Point &, Collision::Data &) const
void serialize(Archive &ar, const unsigned int)
Definition: Plane.hpp:110
bool collide(const Volume &, Collision::Data &) const
void draw_gl() const
virtual void to_vtk(vtkUnstructuredGrid *data)
void read_xml_element(const TiXmlElement *el)
std::string description() const
double area() const
Definition: Plane.hpp:71
Plane()
Definition: Plane.hpp:95
static std::string class_ID()
Definition: Plane.hpp:58
std::string get_str_type_key() const
Definition: Plane.hpp:70
friend class boost::serialization::access
Definition: Plane.hpp:84
Definition: Surface.hpp:55
Definition: Volume.hpp:103
Definition: Common.hpp:198
T max(const T v0, const T v1)
Definition: Exprtk.hpp:1463
static std::string data()
Definition: Exprtk.hpp:44228
Definition: Data.hpp:43