GranOO  3.0
A robust and versatile workbench to build 3D dynamic simulations based on the Discrete Element Method
Plate.hpp
Go to the documentation of this file.
1 #ifndef _DEM_Plate_hpp_
2 #define _DEM_Plate_hpp_
3 
4 //#include "GranOO/Physic/Node.hpp"
5 
6 
7 // #include "GranOO/3rdParty/Eigen/Dense"
8 
9 #include "GranOO3/Core/Base.hpp"
10 // #include "GranOO/Core/Prop.hpp"
11 // #include "GranOO/Core/SetOf.hpp"
12 // #include "GranOO/Core/PropClass.hpp"
13 //#include "GranOO/Physic/BodyInteraction.hpp"
14 #include "GranOO3/DEM/Element.hpp"
15 // #include "GranOO/Physic/CriticalTime.hpp"
16 // #include "GranOO/Util/Signal.hpp"
17 
18 namespace GranOO3
19 {
20  namespace DEM
21  {
22  class Element;
23 
24  class Plate : public Core::Base, public Core::Register<Plate>
25  {
26 
27  GRANOO_CLASS(DEM::Plate, Core::Base);
28  GRANOO_CLASS_DEFAULT_COLOR(.5,.0, .5, 1.);
29 
30  public:
31  // Constructors and destructor
32  Plate(Element& de1, Element& de2, Element& de3);
33  virtual ~Plate();
34 
35  virtual void draw();
36  virtual std::string info() const;
37 
38  virtual void compute_load();
39  void apply_load();
41 
42  // Accessing to discrete elements
43  GRANOO_ACCESS_GET (element1, Element, *_element1);
44  GRANOO_ACCESS_REF (element1, Element, *_element1);
45  GRANOO_ACCESS_REF_CONST(element1, Element, *_element1);
46  GRANOO_ACCESS_GET (element2, Element, *_element2);
47  GRANOO_ACCESS_REF (element2, Element, *_element2);
48  GRANOO_ACCESS_REF_CONST(element2, Element, *_element2);
49  GRANOO_ACCESS_GET (element3, Element, *_element3);
50  GRANOO_ACCESS_REF (element3, Element, *_element3);
51  GRANOO_ACCESS_REF_CONST(element3, Element, *_element3);
52 
53 
54  GRANOO_ACCESS_GET(force_on1, Geom::Vector, _force_on1);
55  GRANOO_ACCESS_GET(force_on2, Geom::Vector, _force_on2);
56  GRANOO_ACCESS_GET(force_on3, Geom::Vector, _force_on3);
57  GRANOO_ACCESS_GET(torque_on1, Geom::Vector, _torque_on1);
58  GRANOO_ACCESS_GET(torque_on2, Geom::Vector, _torque_on2);
59  GRANOO_ACCESS_GET(torque_on3, Geom::Vector, _torque_on3);
60 
61  // Enabled-disabled management
62  void disable();
63  bool is_disabled() const;
64 
65  // IO
66  virtual std::ostream& write_ascii (std::ostream& out) const;
67 
68  protected:
78 
79  private:
80  bool _disabled;
81 
82  private:
83  Plate() = delete;
84  Plate(const Plate&) = delete;
85  Plate & operator=(const Plate &) = delete;
86 
87  //BOOST SERIALIZATION
89  template<class Archive> void serialize(Archive&, const unsigned int);
90  };
91 
92 #ifndef DOXYGEN_SHOULD_SKIP_THIS
93 
94  inline bool
95  Plate::is_disabled() const {
96  return _disabled;
97  }
98 
99  //BOOST SERIALIZATION
100  template<class Archive>
101  void
102  Plate::serialize(Archive & ar, const unsigned int version) {
103  ar & boost::serialization::base_object<Core::Base>(*this);
104  }
105 #endif
106  }
107 }
108 
109 #include <boost/serialization/version.hpp>
111 
112 
113 // need placement new snippet because no default constructor exist
114 namespace boost
115 {
116  namespace serialization
117  {
118 
119  template<class Archive>
120  void save_construct_data(Archive & ar,
121  const GranOO3::DEM::Plate * t,
122  const unsigned int) {
123  const GranOO3::DEM::Element* de1 = &t->get_element1();
124  const GranOO3::DEM::Element* de2 = &t->get_element2();
125  const GranOO3::DEM::Element* de3 = &t->get_element3();
126  ar << de1;
127  ar << de2;
128  ar << de3;
129  }
130 
131  template<class Archive>
132  void load_construct_data(Archive & ar,
134  const unsigned int) {
135  GranOO3::DEM::Element* de1 = nullptr;
136  GranOO3::DEM::Element* de2 = nullptr;
137  GranOO3::DEM::Element* de3 = nullptr;
138  ar >> de1;
139  ar >> de2;
140  ar >> de3;
141  ::new(t)GranOO3::DEM::Plate(*de1,*de2,*de3);
142  }
143 
144  }
145 } // namespace ...
146 
147 
148 
149 
150 
151 
152 
153 namespace GranOO3
154 {
155  GRANOO_CLASS_DECLARE_TPL(DEM::Plate);
156  //extern template class Core::PropClass< DEM::Plate >;
157 }
158 
159 #endif
BOOST_CLASS_VERSION(GranOO3::DEM::Plate, 0) namespace boost
Definition: Plate.hpp:110
Definition: Base.hpp:61
Definition: SetOf.hpp:346
a base class that represents an element
Definition: Element.hpp:55
Definition: Plate.hpp:25
void apply_load()
Definition: Plate.cpp:36
Element * _element1
Definition: Plate.hpp:69
Geom::Vector _torque_on1
Definition: Plate.hpp:76
Geom::Vector _force_on2
Definition: Plate.hpp:73
bool _disabled
Definition: Plate.hpp:80
void disable()
Definition: Plate.cpp:78
Geom::Vector _torque_on3
Definition: Plate.hpp:77
bool is_disabled() const
Geom::Vector _force_on3
Definition: Plate.hpp:74
Plate & operator=(const Plate &)=delete
Element * _element3
Definition: Plate.hpp:71
void serialize(Archive &, const unsigned int)
virtual ~Plate()
Definition: Plate.cpp:32
virtual void compute_load()
Definition: Plate.cpp:53
friend class boost::serialization::access
Definition: Plate.hpp:88
Geom::Vector _torque_on2
Definition: Plate.hpp:75
Plate(const Plate &)=delete
virtual std::string info() const
Definition: Plate.cpp:60
virtual std::ostream & write_ascii(std::ostream &out) const
Definition: Plate.cpp:70
Geom::Vector _force_on1
Definition: Plate.hpp:72
virtual void draw()
Definition: Plate.cpp:83
Element * _element2
Definition: Plate.hpp:70
Definition: Vector.hpp:75
Definition: Common.hpp:198
void save_construct_data(Archive &ar, const GranOO3::Core::Pair< type > *t, const unsigned int)
Definition: Pair.hpp:207
void load_construct_data(Archive &ar, GranOO3::Core::Pair< type > *t, const unsigned int)
Definition: Pair.hpp:217
Definition: Pair.hpp:202
x y t t *t x y t t t x y t t t x *y t *t t x *y t *t t x y t t t x y t t t t(t+t)") define_sfop3(16
static char_cptr version
Definition: Exprtk.hpp:44221