GranOO  3.0
A robust and versatile workbench to build 3D dynamic simulations based on the Discrete Element Method
AttractiveSpring.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 _libDEM_AttractiveSpring_hpp_
31 #define _libDEM_AttractiveSpring_hpp_
32 
33 #include <string>
34 #include <vector>
35 
37 
38 namespace GranOO3
39 {
40  namespace DEM
41  {
42 
43  class AttractiveSpring : public Spring,
44  public Core::Register<AttractiveSpring> {
45 
46  GRANOO_CLASS(DEM::AttractiveSpring, Spring);
47 
48  public:
49  //CONSTRUCTORS & DESTRUCTORS
50  AttractiveSpring(Element& el1, Element& el2, double stiffness, double damping);
51  AttractiveSpring(Element& el1, Element& el2);
52 
53  virtual ~AttractiveSpring();
54 
55  //USEFULL
56  virtual void compute_load();
57  virtual std::string info() const;
58 
59  private:
60  AttractiveSpring() = delete;
63 
64  private:
65  //BOOST SERIALIZATION
67  template<class Archive> void serialize(Archive&, const unsigned int);
68  };
69 
70  //BOOST SERIALIZATION
71  template<class Archive> void
72  AttractiveSpring::serialize(Archive & ar, const unsigned int) {
73  ar & boost::serialization::base_object<Spring>(*this);
74  }
75 
76  }
77 }
78 
79 
80 // need placement new snippet because no default constructor exist
81 namespace boost
82 {
83  namespace serialization
84  {
85 
86  template<class Archive> void
87  save_construct_data(Archive & ar,
89  const unsigned int) {
90  const GranOO3::DEM::Element* de1 = &t->get_element1();
91  const GranOO3::DEM::Element* de2 = &t->get_element2();
92  ar << de1;
93  ar << de2;
94  }
95 
96  template<class Archive> void
97  load_construct_data(Archive &ar, GranOO3::DEM::AttractiveSpring *t, const unsigned int) {
98  GranOO3::DEM::Element* de1 = nullptr;
99  GranOO3::DEM::Element* de2 = nullptr;
100  ar >> de1;
101  ar >> de2;
102  ::new(t)GranOO3::DEM::AttractiveSpring(*de1,*de2);
103  }
104  }
105 } // namespace ...
106 
107 namespace GranOO3
108 {
109  GRANOO_CLASS_DECLARE_TPL(DEM::AttractiveSpring);
110 }
111 
112 #endif
Definition: SetOf.hpp:346
a bond spring that works only in tension
Definition: AttractiveSpring.hpp:44
void serialize(Archive &, const unsigned int)
complete serializing of the bond in the *.gdd format
Definition: AttractiveSpring.hpp:72
AttractiveSpring & operator=(const AttractiveSpring &)=delete
virtual ~AttractiveSpring()
destructor
Definition: AttractiveSpring.cpp:49
friend class boost::serialization::access
Definition: AttractiveSpring.hpp:66
virtual void compute_load()
compute the reaction force and torque of the attractive spring
Definition: AttractiveSpring.cpp:53
virtual std::string info() const
Display some useful info in the terminal
Definition: AttractiveSpring.cpp:66
AttractiveSpring(const AttractiveSpring &)=delete
a base class that represents an element
Definition: Element.hpp:55
a bond spring
Definition: Spring.hpp:46
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