![]() |
GranOO
3.0
A robust and versatile workbench to build 3D dynamic simulations based on the Discrete Element Method
|
a property for adding periodic behavior to DEM::Element More...
#include <Periodic.hpp>
Public Member Functions | |
Periodic () | |
constructor More... | |
virtual | ~Periodic () |
destructor More... | |
void | make_master (std::function< Geom::Vector(const Geom::Vector &, bool &)> f) |
set the element as a master one More... | |
void | set_master_function (std::function< Geom::Vector(const Geom::Vector &, bool &)> f) |
set the master function (only allowed for master element) More... | |
void | set_teleport_master_function (std::function< Geom::Vector(const Geom::Vector &, bool &)> f) |
similar as set_master_function (with a more explicit name), provided for convenience More... | |
void | make_slave (Periodic &master, std::function< Geom::Vector(const Geom::Vector &)> f, int slave_number=0) |
set the element as a slave one More... | |
void | set_slave_function (std::function< Geom::Vector(const Geom::Vector &)> f) |
set the slave function (only allowed for slave element) More... | |
void | set_follow_master_function (std::function< Geom::Vector(const Geom::Vector &)> f) |
similar as set_slave_function (with a more explicit name), provided for convenience More... | |
unsigned int | get_slave_number () const |
get the slave number More... | |
unsigned int | get_total_slave_number () const |
get the total slave number More... | |
bool | is_slave () const |
for knowing if the element is a slave or not More... | |
bool | is_master () const |
for knowing if the element is a master or not More... | |
bool | has_slave () const |
for knowing if the element has slave or not More... | |
void | teleport_master () |
this method allows to teleport the master element if it crosses a boundary More... | |
void | follow_master_motion (bool follow_master_velocity) |
this method allows for a slave to follow its master motion More... | |
void | follow_master_strain () |
void | swap_bond (Core::SetOfBase< Element > &set, const Geom::Point &p) |
this method allows to swap a bond if a master becomes a slave More... | |
void | remove_slave (Periodic &) |
Core::SetOfBase< Periodic > & | slave () |
Periodic * | get_master () |
an accessor to the master element More... | |
const Periodic * | get_master () const |
similar as get_master(), provided for convenience More... | |
void | set_master_from_element () |
Element * | get_master_element () |
an accessor to the master element More... | |
const Element * | get_master_element () const |
similar as get_master_element(), provided for convenience More... | |
virtual std::ostream & | write_ascii (std::ostream &out) const |
virtual std::istream & | read_ascii (std::istream &in) |
![]() | |
Prop () | |
virtual | ~Prop () |
Element & | item () |
const Element & | item () const |
void | set_item (Element &) |
virtual std::string | info () const |
virtual void | set_color (const Core::Color &) |
Core::Color & | get_color () |
float & | get_line_width () |
virtual void | add (SetOf< Prop< Element > > *) |
virtual void | erase (SetOf< Prop< Element > > *) |
![]() | |
virtual | ~Base () |
size_t | numID () const |
size_t | uID () const |
void | set_numID (size_t val) |
void | clear_numID () |
Physic::Material & | get_mat () const |
void | set_mat (Physic::Material *) |
Base & | item () |
const Base & | item () const |
bool | is_same (const Base &) const |
template<class T > | |
T & | cast_to () |
template<class T > | |
const T & | cast_to () const |
template<class T > | |
bool | is () const |
virtual bool | is (size_t) const |
virtual const std::string & | get_ID () const |
virtual Base & | clone () |
template<class T > | |
T & | clone_to () |
virtual std::ostream & | export_to_povray (std::ostream &out) const |
Signal< Base & > & | deleted_signal () |
![]() | |
Null () | |
virtual | ~Null () |
![]() | |
Drawable () | |
virtual | ~Drawable () |
virtual void | draw () |
virtual void | draw_edge () |
virtual void | init_default_color () |
virtual std::ostream & | get_info (std::ostream &os) const |
virtual const Color & | default_color () const |
Color & | get_color () |
const Color & | get_color () const |
virtual void | set_alpha (float alpha) |
void | apply_color () const |
void | apply_edge_color () const |
void | apply_default_color () |
void | apply_selected_color () |
void | set_line_width (float) |
float | get_line_width () const |
float & | get_line_width () |
void | apply_line_width () const |
bool | is_visible () const |
void | set_visible (bool) |
void | paint () |
void | paint_edge () |
unsigned int | get_item_glkey () const |
![]() | |
Register () | |
virtual | ~Register () |
void | erase_from_all_setof () |
bool | belong_to_setof (const std::string &setOfId) const |
bool | belong_to_setof (const SetOf< Base > &set) const |
std::list< SetOf< Base > * > & | get_setof_list () |
unsigned long long int | get_numeric_ID () const |
![]() | |
Register () | |
virtual | ~Register () |
void | erase_from_all_setof () |
bool | belong_to_setof (const std::string &setOfId) const |
bool | belong_to_setof (const SetOf< type > &set) const |
std::list< SetOf< type > * > & | get_setof_list () |
unsigned long long int | get_numeric_ID () const |
![]() | |
Register () | |
virtual | ~Register () |
void | erase_from_all_setof () |
bool | belong_to_setof (const std::string &setOfId) const |
bool | belong_to_setof (const SetOf< Periodic > &set) const |
std::list< SetOf< Periodic > * > & | get_setof_list () |
unsigned long long int | get_numeric_ID () const |
Private Member Functions | |
template<class Archive > | |
void | serialize (Archive &, const unsigned int) |
Private Attributes | |
Core::SetOfBase< Periodic > * | _slave |
the list of slave periodic elements More... | |
bool | _has_slave |
a variable that stores if the element has slave or not More... | |
bool | _is_slave |
a variable that stores if the element is a slave or not More... | |
unsigned int | _slave_number |
a variable that stores the number of slave More... | |
bool | _is_master |
a variable that stores if the element is a master or not More... | |
Periodic * | _master |
a variable that stores the master periodic element More... | |
Element * | _master_element |
a variable that stores the master element More... | |
std::function< Geom::Vector(const Geom::Vector &, bool &)> | _function_teleport_master |
std::function< Geom::Vector(const Geom::Vector &)> | _function_follow_master |
Friends | |
class | boost::serialization::access |
Additional Inherited Members | |
![]() | |
typedef Element | Owner |
![]() | |
static Base & | get_by_numID (size_t) |
static void | clear_all_numID () |
static unsigned int | get_sub_class_number () |
![]() | |
static Drawable & | get_drawable_item_by_glkey (int) |
static void | set_draw_precision (unsigned int p) |
static void | increase_draw_precision () |
static void | decrease_draw_precision () |
static unsigned int | get_draw_precision () |
![]() | |
static Null | null = Null() |
![]() | |
virtual Base & | base_item () |
virtual const Base & | base_item () const |
void | serialize (Archive &ar, const unsigned int) |
![]() | |
Base () | |
![]() | |
static unsigned int | affect_class_rank_ID () |
a property for adding periodic behavior to DEM::Element
The aim of this DEM::Element property is to add periodical behavior to DEM::Element. A periodic element could be a slave or a master element. A master element is a classical element inside the periodic domain which is able to move freely. In contrast, slave elements can be considered as a copy of a master element. Slave elements are situated outside the periodic domain and they follow the motion of their master elements. You can retrieve slave and master elements in two dedicated SetOf named "Master" and "Slave".
GranOO3::DEM::Periodic::Periodic | ( | ) |
constructor
Construct a new Periodic element. Do not call this constructor. To build a new Periodic instance, you must create a new property by invoking the Element::new_prop<Periodic>() method of the Element class. In case of periodic element, this job is done by the make_periodic()
method of the DEM::PeriodicBoundary singleton class.
|
virtual |
void GranOO3::DEM::Periodic::follow_master_motion | ( | bool | follow_master_velocity | ) |
this method allows for a slave to follow its master motion
This method is only available for slave element. It allows for a slave element to follow the motion of its master. It simply applies the _function_follow_master which was set through the make_slave, the set_slave_function or the set_follow_master_function methods. This method must be only activated for granular simulation where discrete element are free to move. For simulation with bonds that model a continuum, this feature must not be activated. (TODO : enable this feature with bonded domain).
void GranOO3::DEM::Periodic::follow_master_strain | ( | ) |
Periodic * GranOO3::DEM::Periodic::get_master | ( | ) |
an accessor to the master element
nullptr
otherwiseThis method returns the master element (which is stored in the _master attribute). Be aware, if the element is a master, so it have no master and this method returns a nullptr
.
const Periodic * GranOO3::DEM::Periodic::get_master | ( | ) | const |
similar as get_master(), provided for convenience
Element * GranOO3::DEM::Periodic::get_master_element | ( | ) |
an accessor to the master element
nullptr
otherwiseThis method returns the master element (which is stored in the _master_element attribute). Be aware, if the element is a master, so it have no master and this method returns a nullptr
.
const Element * GranOO3::DEM::Periodic::get_master_element | ( | ) | const |
similar as get_master_element(), provided for convenience
unsigned int GranOO3::DEM::Periodic::get_slave_number | ( | ) | const |
get the slave number
The slave number is used to identify the slave among the other slaves for a given master element. For instance, with the DEM::Full3D periodic boundary (which is a box), a master has 27 slaves. So, the slave_number
is used for numbering the slave element among its 26 friends.
unsigned int GranOO3::DEM::Periodic::get_total_slave_number | ( | ) | const |
get the total slave number
If the element is a master one, this method returns simply the total number of slave. For instance, with the DEM::Full3D periodic boundary (which is a box), a master has 27 slaves, so this method will return 27.
bool GranOO3::DEM::Periodic::has_slave | ( | ) | const |
for knowing if the element has slave or not
true
if the element has slave, false
otherwise bool GranOO3::DEM::Periodic::is_master | ( | ) | const |
for knowing if the element is a master or not
true
if the element is a master, false
otherwise bool GranOO3::DEM::Periodic::is_slave | ( | ) | const |
for knowing if the element is a slave or not
true
if the element is a slave, false
otherwise void GranOO3::DEM::Periodic::make_master | ( | std::function< Geom::Vector(const Geom::Vector &, bool &)> | f | ) |
set the element as a master one
[in] | f | : a function able to "teleport" the element |
This method allows to set the element as a master one. The element is added in the "Master" element set. This method also set the "master_function" f
. For more detail about what is the master_function
, please refer to the set_master_function documentation.
GranOO3::DEM::Periodic::make_slave | ( | Periodic & | master, |
std::function< Geom::Vector(const Geom::Vector &)> | f, | ||
int | slave_number = 0 |
||
) |
set the element as a slave one
[in] | master | : the master element |
[in] | f | : a function for following the master element |
[in] | slave_number | : a number for identifying the slave among the other one |
This method allows to set the element as a master one. The element is added in the "Slave" element set. This method also set the "slave_function" f
. For more detail about what is the slave_function
, please refer to the set_slave_function documentation. For more detail about what is the slave_number
, please refer to the get_slave_number method.
|
virtual |
Reimplemented from GranOO3::Core::Prop< Element >.
void GranOO3::DEM::Periodic::remove_slave | ( | Periodic & | slave | ) |
|
private |
void GranOO3::DEM::Periodic::set_follow_master_function | ( | std::function< Geom::Vector(const Geom::Vector &)> | f | ) |
similar as set_slave_function (with a more explicit name), provided for convenience
void GranOO3::DEM::Periodic::set_master_from_element | ( | ) |
void GranOO3::DEM::Periodic::set_master_function | ( | std::function< Geom::Vector(const Geom::Vector &, bool &)> | f | ) |
set the master function (only allowed for master element)
[in] | f | : a function able to "teleport" the element |
The f
function is a function that takes a Geom::Vector as argument and returns another one. The input Geom::Vector corresponds to the current position of the element. The returned Geom::Vector is the new position taking into account periodic conditions. The boolean (output) argument of the f
function is used for knowing if the new position must be applied or not to the master element. If this boolean argument is set to true, it means that the correspnding element cross a periodic boundary and must be teleport on the other boundary using the returned position. You must see this trick for "teleporting" element if it crosses a periodic boundary.
void GranOO3::DEM::Periodic::set_slave_function | ( | std::function< Geom::Vector(const Geom::Vector &)> | f | ) |
set the slave function (only allowed for slave element)
[in] | f | : a function for following the master element |
The f
function is a function that takes a Geom::Vector as argument and returns another one. The input Geom::Vector corresponds to the current position of the master element. The returned Geom::Vector is the new position of the slave element taking into account periodic conditions.You must see this function as a way for a slave for following the motion of its master element.
void GranOO3::DEM::Periodic::set_teleport_master_function | ( | std::function< Geom::Vector(const Geom::Vector &, bool &)> | f | ) |
similar as set_master_function (with a more explicit name), provided for convenience
Core::SetOfBase< Periodic > & GranOO3::DEM::Periodic::slave | ( | ) |
void GranOO3::DEM::Periodic::swap_bond | ( | Core::SetOfBase< Element > & | set, |
const Geom::Point & | p | ||
) |
this method allows to swap a bond if a master becomes a slave
[in] | set | : the set of slave element |
[in] | p | : the new location of the master element |
TODO : EXPERIMENTAL FEATURE, it does not work
void GranOO3::DEM::Periodic::teleport_master | ( | ) |
this method allows to teleport the master element if it crosses a boundary
This method is only available for master element. It simply applies the _function_teleport_master which was set through the make_master, the set_master_function or the set_teleport_master_function methods. This method must be only activated for granular simulation where discrete element are free to move. For simulation with bonds that model a continuum, this feature must not be activated (TODO : enable this feature with bonded domain).
|
virtual |
Reimplemented from GranOO3::Core::Prop< Element >.
|
friend |
|
private |
|
private |
|
private |
a variable that stores if the element has slave or not
|
private |
a variable that stores if the element is a master or not
|
private |
a variable that stores if the element is a slave or not
|
private |
a variable that stores the master periodic element
Be aware, if the element is a master, it points to nullptr
.
|
private |
a variable that stores the master element
Be aware, if the element is a master, it points to nullptr
. It is quite similar to the _master attribute whereas the pointer points directly on DEM::Element object and not on a DEM::Periodic object.
|
private |
the list of slave periodic elements
Be aware, if the element is a slave, the list is a nullptr
.
|
private |
a variable that stores the number of slave
Be aware, if the element is a slave, the number is zero