GranOO 3.0
A robust and versatile workbench to build 3D dynamic simulations based on the Discrete Element Method
Loading...
Searching...
No Matches
NodeInteraction.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#ifndef _libPhysic_NodeInteraction_tpp_
30#define _libPhysic_NodeInteraction_tpp_
31
33
34
35namespace GranOO3
36{
37 namespace Physic
38 {
39
40 class NodeInteraction : public Core::Base, public Core::Register< NodeInteraction >
41 {
42
44
45 public:
46 // Constructors and destructor
47 NodeInteraction(Node& de1, Node& de2, bool build_node_interaction);
48 virtual ~NodeInteraction();
49
50
51 // Accessing to discrete elements
52 GRANOO_ACCESS_GET_PTR (node1, Node, _node1);
53 GRANOO_ACCESS_REF_PTR (node1, Node, _node1);
54 GRANOO_ACCESS_REF_CONST_PTR(node1, Node, _node1);
55
56 GRANOO_ACCESS_GET_PTR (node2, Node, _node2);
57 GRANOO_ACCESS_REF_PTR (node2, Node, _node2);
58 GRANOO_ACCESS_REF_CONST_PTR(node2, Node, _node2);
59
60 GRANOO_ACCESS_GET(force_on1, Geom::Vector, _force_on1);
61 GRANOO_ACCESS_GET(force_on2, Geom::Vector, _force_on2);
62
63 bool contact_interaction() const;
64
65 void apply_force();
66 void clear_force();
67 Geom::Vector &force_on(const Node &);
68 const Geom::Vector &force_on(const Node &) const;
69
70 // swap node
71 void swap(Node& from, Node& to);
72
73 // IO
74 virtual std::ostream& write_ascii (std::ostream& out) const;
75 void add_label_force(const std::string &label, const Geom::Vector &f1, const Geom::Vector &f2);
76
77 protected:
79
82
85
86 private:
87 std::map<std::string, Geom::Vector> _energy_balance_force1;
88 std::map<std::string, Geom::Vector> _energy_balance_force2;
89
90 private:
91 NodeInteraction() = delete;
92 NodeInteraction(const NodeInteraction& frame) = delete;
94
95 //SERIALIZATION
97 template<class Archive> void serialize(Archive&, const unsigned int);
98 };
99
100 #ifndef DOXYGEN_SHOULD_SKIP_THIS
101
102
103 template<class Archive>
104 void
105 NodeInteraction::serialize(Archive & ar, const unsigned int ) {
106 ar & boost::serialization::base_object<Core::Base>(*this);
107 }
108
109#endif
110
111 }
112}
113
114#include <boost/serialization/version.hpp>
116
117
118// need placement new snippet because no default constructor exist
119namespace boost
120{
121 namespace serialization
122 {
123
124 template<class Archive>
125 void save_construct_data(Archive & ar,
127 const unsigned int) {
128 const GranOO3::Physic::Node* de1 = &t->get_node1();
129 const GranOO3::Physic::Node* de2 = &t->get_node2();
130 ar << de1;
131 ar << de2;
132 }
133
134 template<class Archive>
135 void load_construct_data(Archive & ar,
137 const unsigned int) {
138 GranOO3::Physic::Node* de1 = nullptr;
139 GranOO3::Physic::Node* de2 = nullptr;
140 ar >> de1;
141 ar >> de2;
142 ::new(t)GranOO3::Physic::NodeInteraction(*de1,*de2, true);
143 }
144
145 }
146} // namespace ...
147
148
149namespace GranOO3
150{
151 GRANOO_CLASS_DECLARE_TPL(Physic::Node);
152}
153
154
155
156#endif
BOOST_CLASS_VERSION(GranOO3::Physic::NodeInteraction, 0) namespace boost
Definition NodeInteraction.hpp:115
Definition Base.hpp:61
Definition SetOf.hpp:346
Definition Vector.hpp:75
Definition Node.hpp:58
Definition NodeInteraction.hpp:41
void clear_force()
Definition NodeInteraction.cpp:95
Node * _node2
Definition NodeInteraction.hpp:81
Node * _node1
Definition NodeInteraction.hpp:80
NodeInteraction(const NodeInteraction &frame)=delete
NodeInteraction & operator=(const NodeInteraction &)=delete
void serialize(Archive &, const unsigned int)
bool contact_interaction() const
Definition NodeInteraction.cpp:57
void apply_force()
Definition NodeInteraction.cpp:102
NodeInteraction(Node &de1, Node &de2, bool build_node_interaction)
Definition NodeInteraction.cpp:42
Geom::Vector & force_on(const Node &)
Definition NodeInteraction.cpp:73
virtual ~NodeInteraction()
Definition NodeInteraction.cpp:62
const bool _contact_interaction
Definition NodeInteraction.hpp:78
std::map< std::string, Geom::Vector > _energy_balance_force1
Definition NodeInteraction.hpp:87
Geom::Vector _force_on2
Definition NodeInteraction.hpp:84
void add_label_force(const std::string &label, const Geom::Vector &f1, const Geom::Vector &f2)
Definition NodeInteraction.cpp:112
friend class boost::serialization::access
Definition NodeInteraction.hpp:96
void swap(Node &from, Node &to)
Definition NodeInteraction.cpp:119
std::map< std::string, Geom::Vector > _energy_balance_force2
Definition NodeInteraction.hpp:88
Geom::Vector _force_on1
Definition NodeInteraction.hpp:83
virtual std::ostream & write_ascii(std::ostream &out) const
Definition NodeInteraction.cpp:130
This namespace group the entire Physic library.
Definition Common.hpp:198
Definition Pair.hpp:202