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