GranOO  3.0
A robust and versatile workbench to build 3D dynamic simulations based on the Discrete Element Method
Full3D.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 _DEM_Full3D_T
31 #define _DEM_Full3D_T
32 
33 
35 #include "GranOO3/DEM/Bond.hpp"
36 
37 
38 namespace GranOO3
39 {
40  namespace DEM
41  {
42 
43  class Full3D : public PeriodicBoundary,
44  public Core::PropClass<Full3D>,
45  public Core::Register<Full3D>
46  {
47  GRANOO_CLASS(DEM::Full3D, PeriodicBoundary);
48 
49  public:
50  static Full3D& get();
51 
52  public:
53  // Constructors and destructor
54  Full3D();
55  virtual ~Full3D();
56 
57  GRANOO_ACCESS(vector_a, Geom::Vector, _a);
58  GRANOO_ACCESS(vector_b, Geom::Vector, _b);
59  GRANOO_ACCESS(vector_c, Geom::Vector, _c);
60 
61  void set_bounding_box(const Shape::Box& box);
62  void set_bounding_box(double lx, double ly, double lz);
63  void scale_bounding_box(double factor);
64  void init_function();
65 
66  double get_lx() const;
67  double get_ly() const;
68  double get_lz() const;
69 
70  void set_length_on_x(double value);
71  void set_length_on_y(double value);
72  void set_length_on_z(double value);
73 
74  void distort_on_x(double angle);
75  void distort_on_y(double angle);
76  void distort_on_z(double angle);
77 
78  // IO
79  virtual void draw();
80  virtual std::string info() const;
81  virtual std::ostream& write_ascii (std::ostream& out) const;
82  virtual std::istream& read_ascii (std::istream& in);
83 
84  private:
85  Full3D(const Full3D&) = delete;
86  Full3D & operator=(const Full3D &) = delete;
87 
88  //BOOST SERIALIZATION
90  template<class Archive> void serialize(Archive&, const unsigned int);
91 
92  private:
93  static Full3D* _me;
94 
95  private:
99  };
100 
101 
102  template<class Archive>
103  void
104  Full3D::serialize(Archive & ar, const unsigned int version) {
105  ar & boost::serialization::base_object<PeriodicBoundary>(*this);
106  ar & boost::serialization::base_object<Core::PropClass<Full3D>>(*this);
107  ar & _a;
108  ar & _b;
109  ar & _c;
110  }
111 
112  }
113 }
114 
115 
116 
117 
118 namespace GranOO3
119 {
120  namespace Core
121  {
122 
123  template<>
124  struct Read<DEM::Full3D>
125  {
126  static Base* new_object(const std::string& classID, std::istream& in);
127  };
128 
129  }
130 }
131 
132 
133 namespace GranOO3
134 {
135  GRANOO_CLASS_DECLARE_TPL(DEM::Full3D);
136  extern template class Core::PropClass< DEM::Element >;
137 }
138 
139 
140 
141 #endif
Definition: Base.hpp:61
Definition: PropClass.hpp:47
Definition: SetOf.hpp:346
a singleton virtual class for representing periodic boundaries
Definition: Full3D.hpp:46
Geom::Vector _b
a vector, representing the length along y
Definition: Full3D.hpp:97
void distort_on_x(double angle)
distort the periodic domain along x
Definition: Full3D.cpp:120
void distort_on_y(double angle)
distort the periodic domain along y
Definition: Full3D.cpp:131
virtual std::ostream & write_ascii(std::ostream &out) const
dump the current state of the periodic boundary in a ascii file (standard *.lgdd format)
Definition: Full3D.cpp:298
double get_ly() const
get the length of the periodic box along y
Definition: Full3D.cpp:160
Full3D(const Full3D &)=delete
virtual void draw()
a pure virtual function to draw the domain
Definition: Full3D.cpp:226
Full3D()
constructor
Definition: Full3D.cpp:60
void serialize(Archive &, const unsigned int)
complete serializing of the periodic boundary in the *.gdd format
Definition: Full3D.hpp:104
void set_length_on_y(double value)
set the length of the periodic box along y
Definition: Full3D.cpp:110
void init_function()
a function that must be triggered to initialize the periodic boundary
Definition: Full3D.cpp:170
double get_lz() const
get the length of the periodic box along z
Definition: Full3D.cpp:165
double get_lx() const
get the length of the periodic box along x
Definition: Full3D.cpp:155
Geom::Vector _a
a vector, representing the length along x
Definition: Full3D.hpp:96
void distort_on_z(double angle)
distort the periodic domain along z
Definition: Full3D.cpp:142
void set_bounding_box(const Shape::Box &box)
set the length of the periodic box
Definition: Full3D.cpp:77
virtual std::string info() const
get some info on the periodic bounday
Definition: Full3D.cpp:286
virtual ~Full3D()
destructor
Definition: Full3D.cpp:71
static Full3D * _me
a pointer to the singleton
Definition: Full3D.hpp:93
friend class boost::serialization::access
Definition: Full3D.hpp:89
Full3D & operator=(const Full3D &)=delete
void set_length_on_x(double value)
set the length of the periodic box along x
Definition: Full3D.cpp:105
void scale_bounding_box(double factor)
apply an expansion factor to the length of the periodic box
Definition: Full3D.cpp:98
void set_length_on_z(double value)
set the length of the periodic box along z
Definition: Full3D.cpp:115
static Full3D & get()
get the singleton instance of the periodic boundaries
Definition: Full3D.cpp:55
virtual std::istream & read_ascii(std::istream &in)
update the current state of periodic boundary from an ascii file format *.lgdd
Definition: Full3D.cpp:307
Geom::Vector _c
a vector, representing the length along z
Definition: Full3D.hpp:98
a singleton virtual class for representing periodic boundaries
Definition: PeriodicBoundary.hpp:49
Definition: Vector.hpp:75
Definition: Box.hpp:57
Definition: Common.hpp:198
T value(details::expression_node< T > *n)
Definition: Exprtk.hpp:15070
static char_cptr version
Definition: Exprtk.hpp:44221
Definition: SetOfManager.hpp:63
static Base * new_object(const std::string &classID, std::istream &in)
Definition: SetOfManager.hpp:64