GranOO  3.0
A robust and versatile workbench to build 3D dynamic simulations based on the Discrete Element Method
ContactLaw.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_ContactLaw_hpp_
31 #define _libDEM_ContactLaw_hpp_
32 
33 #include <iostream>
34 
38 
39 #define APPLY_FORCE(F1, F2, energyLabel) \
40  de1.force() += F1; \
41  de2.force() += F2; \
42  if (Physic::EnergyBalance::get().is_enable()) \
43  { \
44  Physic::EnergyBalance& energy = Physic::EnergyBalance::get(); \
45  energy.add_force_on(de1, energyLabel, F1); \
46  energy.add_force_on(de2, energyLabel, F2); \
47  }
48 
49 
50 
51 
52 #define APPLY_TORQUE(T1, T2, energyLabel) \
53  de1.torque() += T1; \
54  de2.torque() += T2; \
55  if (Physic::EnergyBalance::get().is_enable()) \
56  { \
57  Physic::EnergyBalance& energy = Physic::EnergyBalance::get(); \
58  energy.add_torque_on(de1, energyLabel, T1); \
59  energy.add_torque_on(de2, energyLabel, T2); \
60  }
61 
62 
63 namespace GranOO3
64 {
65  namespace DEM
66  {
67 
68  template<class T>
69  class ContactLaw : public Collision::CallBack<DEM::DiscreteElement, T>
70  {
71  public:
72  static std::string class_ID() {return "DEM::ContactLaw_" + T::class_ID() + "_";}
73 
74  protected:
75  //CONSTRUCTORS & DESTRUCTORS
76  ContactLaw();
77  virtual ~ContactLaw();
78 
79  public:
80  //USEFULL
81  virtual void parse_xml() = 0;
82  virtual void init();
83  virtual void info(std::ostream &) const;
84  virtual void compute_reaction(DEM::DiscreteElement& de1, T& de2,
85  const Geom::Vector& normal, const double& penetration) = 0;
86 
87  virtual void pre_contact_detection();
88  virtual void post_contact_detection();
90  }; // TODO be coherent
91 
92  private:
93  ContactLaw(const ContactLaw&) = delete;
94  ContactLaw& operator=(const ContactLaw&) = delete;
95 
96  };
97 
98 
99  template<class T>
101  }
102 
103  template<class T>
105  }
106 
107  template<class T> void
109  }
110 
111  template<class T> void
113  }
114 
115  template<class T> void
117  }
118 
119  template<class T> void
120  ContactLaw<T>::info(std::ostream & out) const {
121  out << "ContactLaw::Infos: None" << granoo::endl;
122  }
123 
124  }
125 }
126 
127 
128 #endif
Definition: Manager.hpp:220
A class for managing contact with discrete elements (obsolete and not documented)
Definition: ContactLaw.hpp:70
virtual void init()
Definition: ContactLaw.hpp:108
virtual void post_contact_detection()
Definition: ContactLaw.hpp:116
void manage_collision(DEM::DiscreteElement &, T &, const Collision::Data &)
Definition: ContactLaw.hpp:89
ContactLaw & operator=(const ContactLaw &)=delete
virtual void pre_contact_detection()
Definition: ContactLaw.hpp:112
virtual void compute_reaction(DEM::DiscreteElement &de1, T &de2, const Geom::Vector &normal, const double &penetration)=0
virtual ~ContactLaw()
Definition: ContactLaw.hpp:104
ContactLaw(const ContactLaw &)=delete
virtual void info(std::ostream &) const
Definition: ContactLaw.hpp:120
ContactLaw()
Definition: ContactLaw.hpp:100
virtual void parse_xml()=0
static std::string class_ID()
Definition: ContactLaw.hpp:72
the discrete element is just a spherical Element with additional dedicated features
Definition: DiscreteElement.hpp:47
Definition: Vector.hpp:75
static granoo_endl endl
Definition: Out.hpp:106
Definition: Common.hpp:198
Definition: Data.hpp:43