29 #ifndef _DEM_Bond_hpp_
30 #define _DEM_Bond_hpp_
32 #include "GranOO3/3rdParty/Eigen/Dense"
52 GRANOO_CLASS_DEFAULT_COLOR(.8,.0, .1, 1.);
77 virtual std::string
info()
const;
85 GRANOO_ACCESS (surface ,
double ,
_surface );
136 void disable(
bool manage_slave =
true);
138 void enable(
bool manage_slave =
true);
142 void crack(
bool manage_slave =
true);
143 void uncrack(
bool manage_slave =
true);
159 const std::vector<unsigned int>&
get_dof()
const;
177 template<
class Archive>
void save(Archive&,
const unsigned int )
const;
178 template<
class Archive>
void load(Archive&,
const unsigned int);
249 inline const std::vector<unsigned int> &
281 template<
class Archive>
void
283 ar << boost::serialization::base_object<Physic::BodyInteraction>(*
this);
284 ar << boost::serialization::base_object<Core::PropClass<Bond> >(*this);
308 template<
class Archive>
void
310 ar >> boost::serialization::base_object<Physic::BodyInteraction>(*
this);
311 ar >> boost::serialization::base_object<Core::PropClass<Bond> >(*this);
340 #include <boost/serialization/version.hpp>
345 GRANOO_CLASS_DECLARE_TPL(DEM::Bond);
346 extern template class Core::PropClass< DEM::Bond >;
BOOST_CLASS_VERSION(GranOO3::DEM::Bond, 2) namespace GranOO3
Definition: Bond.hpp:341
#define SafeModeAssert(condition, message)
Definition: Macro.hpp:47
#define AssertMsg(condition, message)
Definition: Macro.hpp:67
Definition: PropClass.hpp:47
Definition: SetOf.hpp:346
Definition: SetOf.hpp:153
Definition: Signal.hpp:53
the base class for all bonds between discrete elements.
Definition: Bond.hpp:49
void apply_angular_damping_factor()
similar as apply_linear_damping_factor() for rotation
Definition: Bond.cpp:294
bool _cracked
Definition: Bond.hpp:192
Geom::Vector get_disp2() const
similar as get_disp1()
Definition: Bond.cpp:345
void add_slave(Bond &b)
add a slave bond (useful for periodic simulation)
Definition: Bond.cpp:389
virtual void draw()
OpenGL draw of the bond
Definition: Bond.cpp:428
Element & bonded_element(const Element &)
get the bonded element
Definition: Bond.hpp:219
std::vector< unsigned int > _dofs
a vector that stores the dof of the bond
Definition: Bond.hpp:214
const std::vector< unsigned int > & get_dof() const
get the dof vector
Definition: Bond.hpp:250
Geom::Quaternion _quat_element1
the quaternion used for building the bond local frame (expressed in the _element1 local frame)
Definition: Bond.hpp:198
double _linear_damping_factor
the linear damping factor of the bond
Definition: Bond.hpp:207
Element & get_item1()
Definition: Bond.hpp:256
virtual double get_linear_stiffness() const
compute the linear stiffness of the bond
Definition: Bond.cpp:350
void crack(bool manage_slave=true)
Definition: Bond.cpp:218
bool is_disabled() const
check if the bond is enable or not
Definition: Bond.hpp:239
FailureMode _failure_mode
Definition: Bond.hpp:193
Geom::Vector get_disp1() const
get the displacement of the first bonded element (_element1)
Definition: Bond.cpp:340
Bond(const Bond &)=delete
Bond & operator=(const Bond &)=delete
double _surface
this attribute stores the corresponding normal surface of the bond
Definition: Bond.hpp:212
DrawMode
Definition: Bond.hpp:60
@ NO
Definition: Bond.hpp:60
@ LINE
Definition: Bond.hpp:60
@ SOLID
Definition: Bond.hpp:60
Geom::Frame _local_frame_element2
Definition: Bond.hpp:205
bool is_cracked() const
Definition: Bond.hpp:244
Geom::Quaternion _local_quat
this the quaternion that must be updated for updating the _local_frame
Definition: Bond.hpp:200
void enable(bool manage_slave=true)
simply enable the bond by switching the _disabled attribute to false
Definition: Bond.cpp:207
Geom::Quaternion _quat_element2
same as the _quat_element1 but expressed in the _element2 local frame)
Definition: Bond.hpp:199
void apply_linear_damping_factor()
compute and apply the linear (translation) damping factor of the bond
Definition: Bond.cpp:272
void swap(Element &from, Element &to)
swap the bond from the Element from to to
Definition: Bond.cpp:369
double _max_relative_elongation
a threshold corresponding to a maximal admissible relative elongation (the longitudinal strain)
Definition: Bond.hpp:211
void init_local_frame(bool update_initial_param=false)
initialize the bond local frame
Definition: Bond.cpp:110
Geom::Point _initial_pos1
the initial position of the _element1 expressed in the _element2 local frame
Definition: Bond.hpp:195
static double _disabled_cumulative_surface
the attribute where the total disabled surface is stored
Definition: Bond.hpp:68
void save(Archive &, const unsigned int) const
Definition: Bond.hpp:282
virtual double get_angular_stiffness() const
similar as get_linear_stiffness() for rotation
Definition: Bond.cpp:355
FailureMode
Definition: Bond.hpp:59
@ TENSION
Definition: Bond.hpp:59
@ COMPRESSION
Definition: Bond.hpp:59
@ SHEAR
Definition: Bond.hpp:59
@ NONE
Definition: Bond.hpp:59
void update_current_length()
update the current value of the bond length (see _current_length attribute)
Definition: Bond.cpp:241
void uncrack(bool manage_slave=true)
Definition: Bond.cpp:232
double get_normal_force_intensity() const
Definition: Bond.cpp:396
Geom::Frame _local_frame_element1
this the frame that corresponds to the local _element1 frame expressed in the _local_frame
Definition: Bond.hpp:203
virtual void compute_load()
compute the reaction force and torque of the bond
Definition: Bond.cpp:262
virtual std::ostream & export_to_povray(std::ostream &out) const
exporting to povray format
Definition: Bond.cpp:470
Element & item1()
Definition: Bond.hpp:272
void disable(bool manage_slave=true)
disable the bond
Definition: Bond.cpp:176
Element & item2()
Definition: Bond.hpp:276
void apply_load()
apply the computed reaction force and torque to the bonded Element (_element1 and _element2)
Definition: Bond.cpp:247
static Core::Signal< Bond & > disable_signal
get the signal when a bond is disabled
Definition: Bond.hpp:65
void update_local_frame()
update the bond local frame
Definition: Bond.cpp:151
static DrawMode draw_mode
Definition: Bond.hpp:61
double _current_length
the current length of the bond that correspond to the norm of the vector between the center of the bo...
Definition: Bond.hpp:210
virtual void update_dof()
update the bond dof
Definition: Bond.hpp:158
static double get_disabled_cumulative_surface()
get the total surface disabled surface
Definition: Bond.cpp:63
virtual std::string info() const
Display some useful info in the terminal
Definition: Bond.cpp:415
Geom::Point _local_center_element2
Definition: Bond.hpp:204
double get_tangential_force_intensity() const
Definition: Bond.cpp:405
Geom::Point _local_center_element1
the center of _element1 expressed in the local frame. It is always equal to (0,0,0)
Definition: Bond.hpp:202
void build_voronoi_bond()
build a voronoi bond from the current bond
Definition: Bond.cpp:361
void load(Archive &, const unsigned int)
Definition: Bond.hpp:309
Geom::Vector get_disp(const Element &) const
get the displacement of the el element
Definition: Bond.cpp:328
virtual ~Bond()=0
Destructor.
Definition: Bond.cpp:101
double _initial_length
an attribute that stores the bond initial length
Definition: Bond.hpp:194
friend class boost::serialization::access
Definition: Bond.hpp:176
static double draw_solid_factor
Definition: Bond.hpp:57
BOOST_SERIALIZATION_SPLIT_MEMBER()
void disable_fast_mode(bool manage_slave=true)
simply disable the bond by switching the _disabled attribute to true without doing the lot of things ...
Definition: Bond.cpp:198
const Geom::Point & initial_pos(const Element &) const
get the initial position of the el element
Definition: Bond.cpp:317
const Element & get_bonded_element(const Element &) const
same as bonded_element(const Element&) (provided for convenience)
Definition: Bond.hpp:229
Element & get_item2()
Definition: Bond.hpp:264
Core::SetOfBase< Bond > _slave
a container that list the slave bond
Definition: Bond.hpp:213
Element * _element1
the first of the two bonded Element
Definition: Bond.hpp:187
double _relaxed_length
the relaxed length of the bond.
Definition: Bond.hpp:209
Element * _element2
the second of the two bonded Element
Definition: Bond.hpp:188
virtual void stiffness_matrix(Eigen::MatrixXd &kMatrix)
assemble a stiffness matrix
Definition: Bond.hpp:157
Geom::Point _initial_pos2
the initial position of the _element2 expressed in the _element1 local frame
Definition: Bond.hpp:196
double _angular_damping_factor
the angular damping factor of the bond
Definition: Bond.hpp:208
Geom::Frame _local_frame
the bond local frame, useful for making computation
Definition: Bond.hpp:201
bool _disabled
an attribute that stores the enable/disable state
Definition: Bond.hpp:191
static double epsilon
a very small value used as a threshold
Definition: Bond.hpp:56
a base class that represents an element
Definition: Element.hpp:55
void update_glMatrix()
Definition: Frame.cpp:94
Definition: Quaternion.hpp:54
Definition: Vector.hpp:75
a class that represents a generic physical interaction between two bodies
Definition: BodyInteraction.hpp:44
Definition: Common.hpp:198