GranOO  3.0
A robust and versatile workbench to build 3D dynamic simulations based on the Discrete Element Method
VoronoiBond.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_Prop_VoronoiBond_HPP
31 #define _LibDEM_Prop_VoronoiBond_HPP
32 
33 #include "GranOO3/Core/Prop.hpp"
34 #include "GranOO3/DEM/Bond.hpp"
35 #include "GranOO3/DEM/ElementT.hpp"
37 
38 namespace GranOO3
39 {
40  namespace DEM
41  {
42 
43  template<class T> class ElementT;
44 
45  class VoronoiBond : public Core::Prop<Bond>,
46  public Core::Register<VoronoiBond>
47  {
48 
49  GRANOO_CLASS(DEM::VoronoiBond, Core::Prop<Bond>);
50 
51  public:
52  // Constructors and destructor
53  VoronoiBond();
54  virtual ~VoronoiBond();
55 
56  void init();
57  void update_element();
58 
59  GRANOO_ACCESS_GET(facet_center, Geom::Point, _facet_center);
60 
61  GRANOO_ACCESS(facet_vertex1, std::vector<double*>, _vertex1);
62  GRANOO_ACCESS(facet_vertex2, std::vector<double*>, _vertex2);
63  GRANOO_ACCESS(normal , Geom::Vector , _normal );
64 
65  GRANOO_ACCESS_REF (el1, ElementT<Shape::Polyhedron>, *_el1);
66  GRANOO_ACCESS_REF (el2, ElementT<Shape::Polyhedron>, *_el2);
67  GRANOO_ACCESS_REF_CONST(el1, ElementT<Shape::Polyhedron>, *_el1);
68  GRANOO_ACCESS_REF_CONST(el2, ElementT<Shape::Polyhedron>, *_el2);
69 
70  GRANOO_ACCESS_GET(basefacet_index1, unsigned int, _basefacet_index1);
71  GRANOO_ACCESS_GET(basefacet_index2, unsigned int, _basefacet_index2);
72 
76 
77  unsigned int get_basefacet_index_of(const Element&) const;
78  bool is_inconsistent() const;
79 
80  private:
82  template<class Archive> void serialize(Archive& ar, const unsigned int );
83 
84  private:
87  unsigned int _basefacet_index1;
88  unsigned int _basefacet_index2;
92  std::vector<double*> _vertex1;
93  std::vector<double*> _vertex2;
95  };
96 
97  template<class Archive> void
98  VoronoiBond::serialize(Archive& ar, const unsigned int) {
99  ar & boost::serialization::base_object<Core::Prop<Bond> >(*this);
100  ar & _el1;
101  ar & _el2;
102  ar & _basefacet_index1;
103  ar & _basefacet_index2;
104  ar & _normal;
105  ar & _center;
106  ar & _facet_center;
107  }
108 
109  }
110 }
111 
112 namespace GranOO3
113 {
114  GRANOO_CLASS_DECLARE_TPL(DEM::VoronoiBond);
115 }
116 
117 
118 
119 #endif
120 
Definition: Prop.hpp:48
Definition: SetOf.hpp:346
a base class that represents an element
Definition: Element.hpp:55
a template class that model an element with a given shape
Definition: ElementT.hpp:59
a bond property which is dedicated to voronoi domain.
Definition: VoronoiBond.hpp:47
void init()
initialize the voronoi bond
Definition: VoronoiBond.cpp:60
ElementT< Shape::Polyhedron > * _el2
a pointer to the element2 which is a polyhedral element (mandatory)
Definition: VoronoiBond.hpp:86
std::vector< double * > _vertex1
the list of vertices that defines the facet of the _el1
Definition: VoronoiBond.hpp:92
Geom::Point compute_facet_center() const
compute the facet center
Definition: VoronoiBond.cpp:186
unsigned int _basefacet_index2
Definition: VoronoiBond.hpp:88
Geom::Vector _normal
a unit vector which is normal to the facet oriented from the center of the _el1 to the center of _el2...
Definition: VoronoiBond.hpp:91
virtual ~VoronoiBond()
destructor
Definition: VoronoiBond.cpp:138
VoronoiBond()
constructor
Definition: VoronoiBond.cpp:44
void update_element()
update both element shapes for being contiguous
Definition: VoronoiBond.cpp:142
unsigned int get_basefacet_index_of(const Element &) const
Definition: VoronoiBond.cpp:210
Geom::Point compute_facet_center1() const
compute the facet center of the element1
Definition: VoronoiBond.cpp:195
void serialize(Archive &ar, const unsigned int)
complete serializing of the instance in the *.gdd format
Definition: VoronoiBond.hpp:98
bool _inconsistent
a flag to tell if the voronoi bond is inconsistent or not
Definition: VoronoiBond.hpp:94
Geom::Point _center
the center of the voronoi bond which is simply the mean value between the _el1 and _el2 positions
Definition: VoronoiBond.hpp:89
Geom::Point compute_facet_center2() const
compute the facet center of the element2
Definition: VoronoiBond.cpp:200
unsigned int _basefacet_index1
the number ID that identify the facet on the _el1
Definition: VoronoiBond.hpp:87
friend class boost::serialization::access
Definition: VoronoiBond.hpp:81
Geom::Point _facet_center
the facet center is simply the center of the _el1 facet which is (theoretically) equals to center of ...
Definition: VoronoiBond.hpp:90
bool is_inconsistent() const
tell if the bond is inconsistent or not
Definition: VoronoiBond.cpp:204
ElementT< Shape::Polyhedron > * _el1
a pointer to the element1 which is a polyhedral element (mandatory)
Definition: VoronoiBond.hpp:85
std::vector< double * > _vertex2
the list of vertices that defines the facet of the _el2
Definition: VoronoiBond.hpp:93
Definition: Point.hpp:62
Definition: Vector.hpp:75
Definition: Common.hpp:198