GranOO  3.0
A robust and versatile workbench to build 3D dynamic simulations based on the Discrete Element Method
Between2SetOf.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_ContactDetection_Between2SetOf_hpp_
31 #define _libDEM_ContactDetection_Between2SetOf_hpp_
32 
34 
38 
39 //
40 // Base class for detection method
41 //
42 
43 namespace GranOO3
44 {
45  namespace DEM
46  {
47 
48  class ContactDetection_Between2SetOf : public ContactDetection<DEM::DiscreteElement>,
49  public Core::NeedSetOf< DiscreteElement, 2>
50  {
51 
52  GRANOO_OBJECT_FACTORY(ContactDetection_Between2SetOf)
53 
54  public:
55  static std::string class_ID() {return "Between2SetOf";}
56 
57  public:
58  //CONSTRUCTORS & DESTRUCTORS
61 
62  //USEFULL
63  virtual void detect_contact();
64  virtual void parse_xml();
65 
66  private:
69 
70  private:
71  unsigned int _contact_number;
72  };
73 
74 
75  inline
77  : ContactDetection(),
78  Core::NeedSetOf< DiscreteElement,2 >(true) {
79  }
80 
81  inline
83  }
84 
85  inline void
89 
92 
93 
94  AssertMsg(&set1 != &set2, "you can't assign the same SetOf for both");
95 
96  }
97 
98  inline void
102  for (unsigned int i = 0; i<set1.size(); i++) {
103  for (unsigned int j = 0; j<set2.size(); j++) {
104  DEM::DiscreteElement& part1 = *set1[i];
105  DEM::DiscreteElement& part2 = *set2[j];
106  const Geom::Vector vDist = (part1.get_position() - part2.get_position());
107  const double dist = vDist.norm();
108  if (dist < part1.get_radius() + part2.get_radius()) {
109  ContactDetection::Process(part1, part2, vDist/dist, part1.get_radius() + part2.get_radius()-dist);
110  }
111  }
112  }
113  }
114 
115  }
116 }
117 
118 
119 #endif
#define AssertMsg(condition, message)
Definition: Macro.hpp:67
Definition: NeedSetOf.hpp:51
Core::SetOf< T > & get_setof(unsigned int rank=0)
virtual void parse_xml()
Definition: SetOf.hpp:153
Definition: SetOf.hpp:236
A class for managing contact with discrete elements (obsolete and not documented)
Definition: Between2SetOf.hpp:50
ContactDetection_Between2SetOf & operator=(const ContactDetection_Between2SetOf &)=delete
virtual void detect_contact()
Definition: Between2SetOf.hpp:99
virtual ~ContactDetection_Between2SetOf()
Definition: Between2SetOf.hpp:82
ContactDetection_Between2SetOf()
Definition: Between2SetOf.hpp:76
virtual void parse_xml()
Definition: Between2SetOf.hpp:86
ContactDetection_Between2SetOf(const ContactDetection_Between2SetOf &)=delete
unsigned int _contact_number
Definition: Between2SetOf.hpp:71
A class for managing contact with discrete elements (obsolete and not documented)
Definition: ContactDetection.hpp:54
void Process(DiscreteElement &de1, T &de2, const Geom::Vector &normal, const double &penetration)
Definition: ContactDetection.hpp:193
virtual void parse_xml()
Definition: ContactDetection.hpp:129
static std::string class_ID()
Definition: ContactDetection.hpp:57
the discrete element is just a spherical Element with additional dedicated features
Definition: DiscreteElement.hpp:47
double get_radius() const
get the radius
Definition: DiscreteElement.hpp:85
const Geom::Vector & get_position() const
get the current position vector of the element
Definition: ElementT.hpp:146
Definition: Vector.hpp:75
double norm() const
Definition: Common.hpp:198