GranOO  3.0
A robust and versatile workbench to build 3D dynamic simulations based on the Discrete Element Method
DiscreteElement.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 _DEM_DiscreteElement_T
31 #define _DEM_DiscreteElement_T
32 
33 #include "GranOO3/Shape/Sphere.hpp"
34 #include "GranOO3/DEM/ElementT.hpp"
36 
37 
38 
39 namespace GranOO3
40 {
41  namespace DEM
42  {
43 
44  class DiscreteElement : public ElementT<Shape::Sphere>,
45  public Core::PropClass< DiscreteElement>,
46  public Core::Register< DiscreteElement>
47  {
49 
50  public:
51  using Physic::Body::aabb;
52 
53  public:
54  // Constructors and destructor
55  DiscreteElement(const Geom::Point& center, double radius, double density); //Just for spherical DE
56  DiscreteElement(const Geom::Point& center);
58 
59  virtual ~DiscreteElement();
60 
61  // cloning
62  virtual Core::Base& clone();
63  void make_equal_to(const DiscreteElement&);
64 
65  // Access
66  double get_radius() const;
67 
68  // IO
69  virtual std::string info() const;
70  virtual std::ostream& write_ascii (std::ostream& out) const;
71  virtual std::istream& read_ascii (std::istream& in);
72 
73 
74  private:
75  DiscreteElement(const DiscreteElement&) = delete;
77 
78  //BOOST SERIALIZATION
80  template<class Archive> void serialize(Archive&, const unsigned int);
81 
82  };
83 
84  inline double
87  }
88 
89  template<class Archive>void
90  DiscreteElement::serialize(Archive & ar, const unsigned int version) {
91  ar & boost::serialization::base_object<ElementT<Shape::Sphere> >(*this);
92  ar & boost::serialization::base_object<Core::PropClass< DiscreteElement> >(*this);
93  }
94 
95  }
96 }
97 
98 
99 
100 
101 namespace GranOO3
102 {
103  namespace Core
104  {
105 
106  template<>
107  struct Read<DEM::DiscreteElement>
108  {
109  static Base* new_object(const std::string& classID, std::istream& in);
110  };
111 
112  }
113 }
114 
115 
116 namespace GranOO3
117 {
118  GRANOO_CLASS_DECLARE_TPL(DEM::DiscreteElement);
119  extern template class Core::PropClass< DEM::Element >;
120 }
121 
122 
123 
124 #endif
Definition: Base.hpp:61
Definition: PropClass.hpp:47
Definition: SetOf.hpp:346
the discrete element is just a spherical Element with additional dedicated features
Definition: DiscreteElement.hpp:47
void serialize(Archive &, const unsigned int)
Definition: DiscreteElement.hpp:90
void make_equal_to(const DiscreteElement &)
equalize a DiscreteElement
Definition: DiscreteElement.cpp:74
DiscreteElement(const DiscreteElement &)=delete
virtual ~DiscreteElement()
destructor
Definition: DiscreteElement.cpp:63
double get_radius() const
get the radius
Definition: DiscreteElement.hpp:85
DiscreteElement & operator=(const DiscreteElement &)=delete
friend class boost::serialization::access
Definition: DiscreteElement.hpp:79
virtual Core::Base & clone()
clone the object
Definition: DiscreteElement.cpp:67
DiscreteElement()
constructor
Definition: DiscreteElement.cpp:59
virtual std::istream & read_ascii(std::istream &in)
update the current state of the discrete element from an ascii file format *.lgdd
Definition: DiscreteElement.cpp:94
virtual std::ostream & write_ascii(std::ostream &out) const
dump the current state of the discrete element in a ascii file (standard *.lgdd format)
Definition: DiscreteElement.cpp:88
virtual std::string info() const
Display some useful info in the terminal
Definition: DiscreteElement.cpp:79
a template class that model an element with a given shape
Definition: ElementT.hpp:59
Definition: Point.hpp:62
AABB aabb() const
get the aabb tree the body
Definition: Body.hpp:161
Definition: Common.hpp:198
static char_cptr version
Definition: Exprtk.hpp:44221
Definition: SetOfManager.hpp:63
static Base * new_object(const std::string &classID, std::istream &in)
Definition: SetOfManager.hpp:64