GranOO 3.0
A robust and versatile workbench to build 3D dynamic simulations based on the Discrete Element Method
Loading...
Searching...
No Matches
PeriodicBoundary.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_PeriodicBoundary_H
31#define _LibDEM_PeriodicBoundary_H
32
33#include "GranOO3/Core/Base.hpp"
38
39namespace GranOO3
40{
41 namespace DEM
42 {
43
44 class Element;
45
47 public Core::PropClass< PeriodicBoundary >,
48 public Core::Register< PeriodicBoundary >
49 {
50
51 GRANOO_CLASS(DEM::PeriodicBoundary, Core::Base);
52 GRANOO_CLASS_DEFAULT_COLOR(.2, .8, .4, .2);
53
54 public:
55 static PeriodicBoundary& get();
56
57 public:
58 // Constructors and destructor
60 virtual ~PeriodicBoundary();
61
62 GRANOO_ACCESS(follow_master_function, std::vector<std::function<Geom::Vector(const Geom::Vector&)>>, _follow_master_function);
63
64 virtual void init_function() = 0;
65 virtual void draw() = 0;
66
67 void make_periodic(Element& el);
69 void retrieve_slave();
71
72 virtual std::string info() const;
73
74 std::function<Geom::Vector(const Geom::Vector&, bool&)>& get_periodic_mv_function();
75 std::function<Geom::Vector(const Geom::Vector&)>& get_follow_master_function(unsigned int rank);
76
77 // IO
78 virtual std::ostream& write_ascii (std::ostream& out) const;
79 virtual std::istream& read_ascii (std::istream& in);
80
81 protected:
82 //BOOST SERIALIZATION
84 template<class Archive> void serialize(Archive&, const unsigned int);
85
86 private:
88
89
90 private:
93
94 protected:
95 std::function<Geom::Vector(const Geom::Vector&, bool&)> _periodic_mv_function;
96 std::vector<std::function<Geom::Vector(const Geom::Vector&)> > _follow_master_function;
97 };
98
99
100 template<class Archive> void
101 PeriodicBoundary::serialize(Archive & ar, const unsigned int version) {
102 ar & boost::serialization::base_object<Core::Base>(*this);
103 }
104
105
106 inline std::function<Geom::Vector(const Geom::Vector&, bool&)>&
110
111 inline std::function<Geom::Vector(const Geom::Vector&)>&
115
116
117 }
118}
119
120
121#include <boost/serialization/version.hpp>
123
124
125namespace GranOO3 {
126 GRANOO_CLASS_DECLARE_TPL(DEM::PeriodicBoundary);
127}
128
129#endif
130
BOOST_CLASS_VERSION(GranOO3::DEM::PeriodicBoundary, 0) namespace GranOO3
Definition PeriodicBoundary.hpp:122
Definition Base.hpp:61
Definition PropClass.hpp:47
Definition SetOf.hpp:346
a base class that represents an element
Definition Element.hpp:55
a singleton virtual class for representing periodic boundaries
Definition PeriodicBoundary.hpp:49
void make_periodic(Element &el)
a function that transforms a normal element into a periodic master element with its related slaves
Definition PeriodicBoundary.cpp:69
virtual void init_function()=0
a pure virtual function that must be overridden
std::function< Geom::Vector(const Geom::Vector &, bool &)> & get_periodic_mv_function()
get the move function
Definition PeriodicBoundary.hpp:107
void serialize(Archive &, const unsigned int)
complete serializing of the FractureFacet in the *.gdd format
Definition PeriodicBoundary.hpp:101
std::function< Geom::Vector(const Geom::Vector &)> & get_follow_master_function(unsigned int rank)
get the "follow master"
Definition PeriodicBoundary.hpp:112
PeriodicBoundary()
constructor
Definition PeriodicBoundary.cpp:55
static PeriodicBoundary & get()
get the singleton instance of the periodic boundaries
Definition PeriodicBoundary.cpp:50
void retrieve_slave()
Definition PeriodicBoundary.cpp:108
virtual ~PeriodicBoundary()
destructor
Definition PeriodicBoundary.cpp:63
virtual void draw()=0
a pure virtual function to draw the domain
void clean_slave_element_without_master()
Definition PeriodicBoundary.cpp:120
static PeriodicBoundary * _me
a pointer to the singleton
Definition PeriodicBoundary.hpp:87
PeriodicBoundary(const PeriodicBoundary &)=delete
std::function< Geom::Vector(const Geom::Vector &, bool &)> _periodic_mv_function
a simple function for moving master elements from one boundary to another
Definition PeriodicBoundary.hpp:95
PeriodicBoundary & operator=(const PeriodicBoundary &)=delete
std::vector< std::function< Geom::Vector(const Geom::Vector &)> > _follow_master_function
a list of simple functions for moving slave elements considering the master
Definition PeriodicBoundary.hpp:96
virtual std::string info() const
a util method to get some info
Definition PeriodicBoundary.cpp:135
virtual std::istream & read_ascii(std::istream &in)
Definition PeriodicBoundary.cpp:145
friend class boost::serialization::access
Definition PeriodicBoundary.hpp:83
void init_periodic_object()
a function that initializes all the Periodic instances
Definition PeriodicBoundary.cpp:83
virtual std::ostream & write_ascii(std::ostream &out) const
Definition PeriodicBoundary.cpp:140
Definition Vector.hpp:75
This namespace group the entire DEM library.
Definition Common.hpp:198