GranOO  3.0
A robust and versatile workbench to build 3D dynamic simulations based on the Discrete Element Method
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
GranOO3::DEM::Periodic Class Reference

a property for adding periodic behavior to DEM::Element More...

#include <Periodic.hpp>

Inheritance diagram for GranOO3::DEM::Periodic:
Inheritance graph
[legend]

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 ()
 
Periodicget_master ()
 an accessor to the master element More...
 
const Periodicget_master () const
 similar as get_master(), provided for convenience More...
 
void set_master_from_element ()
 
Elementget_master_element ()
 an accessor to the master element More...
 
const Elementget_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)
 
- Public Member Functions inherited from GranOO3::Core::Prop< Element >
 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::Colorget_color ()
 
float & get_line_width ()
 
virtual void add (SetOf< Prop< Element > > *)
 
virtual void erase (SetOf< Prop< Element > > *)
 
- Public Member Functions inherited from GranOO3::Core::Base
virtual ~Base ()
 
size_t numID () const
 
size_t uID () const
 
void set_numID (size_t val)
 
void clear_numID ()
 
Physic::Materialget_mat () const
 
void set_mat (Physic::Material *)
 
Baseitem ()
 
const Baseitem () 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 Baseclone ()
 
template<class T >
T & clone_to ()
 
virtual std::ostream & export_to_povray (std::ostream &out) const
 
Signal< Base & > & deleted_signal ()
 
- Public Member Functions inherited from GranOO3::Core::Null
 Null ()
 
virtual ~Null ()
 
- Public Member Functions inherited from GranOO3::Core::Drawable
 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 Colordefault_color () const
 
Colorget_color ()
 
const Colorget_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
 
- Public Member Functions inherited from GranOO3::Core::Register< Base >
 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
 
- Public Member Functions inherited from GranOO3::Core::Register< type >
 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
 
- Public Member Functions inherited from GranOO3::Core::Register< Periodic >
 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

- Public Types inherited from GranOO3::Core::Prop< Element >
typedef Element Owner
 
- Static Public Member Functions inherited from GranOO3::Core::Base
static Baseget_by_numID (size_t)
 
static void clear_all_numID ()
 
static unsigned int get_sub_class_number ()
 
- Static Public Member Functions inherited from GranOO3::Core::Drawable
static Drawableget_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 Public Attributes inherited from GranOO3::Core::Null
static Null null = Null()
 
- Protected Member Functions inherited from GranOO3::Core::Prop< Element >
virtual Basebase_item ()
 
virtual const Basebase_item () const
 
void serialize (Archive &ar, const unsigned int)
 
- Protected Member Functions inherited from GranOO3::Core::Base
 Base ()
 
- Static Protected Member Functions inherited from GranOO3::Core::Base
static unsigned int affect_class_rank_ID ()
 

Detailed Description

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".

Constructor & Destructor Documentation

◆ Periodic()

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.

◆ ~Periodic()

GranOO3::DEM::Periodic::~Periodic ( )
virtual

destructor

Destruct a Periodic instance. Be aware, as Periodic is a property, you must not invoke destructor by yourself, it could lead to unexpected behavior. Note that the Periodic instances are automatically destructed when their associated elements are destructed.

Member Function Documentation

◆ follow_master_motion()

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).

◆ follow_master_strain()

void GranOO3::DEM::Periodic::follow_master_strain ( )

◆ get_master() [1/2]

Periodic * GranOO3::DEM::Periodic::get_master ( )

an accessor to the master element

Returns
the master periodic element if exists, nullptr otherwise

This 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.

◆ get_master() [2/2]

const Periodic * GranOO3::DEM::Periodic::get_master ( ) const

similar as get_master(), provided for convenience

◆ get_master_element() [1/2]

Element * GranOO3::DEM::Periodic::get_master_element ( )

an accessor to the master element

Returns
the master element if exists, nullptr otherwise

This 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.

◆ get_master_element() [2/2]

const Element * GranOO3::DEM::Periodic::get_master_element ( ) const

similar as get_master_element(), provided for convenience

◆ get_slave_number()

unsigned int GranOO3::DEM::Periodic::get_slave_number ( ) const

get the slave number

Returns
: the current slave number of the item

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.

◆ get_total_slave_number()

unsigned int GranOO3::DEM::Periodic::get_total_slave_number ( ) const

get the total slave number

Returns
: the total slave number of the master element

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.

◆ has_slave()

bool GranOO3::DEM::Periodic::has_slave ( ) const

for knowing if the element has slave or not

Returns
: true if the element has slave, false otherwise

◆ is_master()

bool GranOO3::DEM::Periodic::is_master ( ) const

for knowing if the element is a master or not

Returns
: true if the element is a master, false otherwise

◆ is_slave()

bool GranOO3::DEM::Periodic::is_slave ( ) const

for knowing if the element is a slave or not

Returns
: true if the element is a slave, false otherwise

◆ make_master()

void GranOO3::DEM::Periodic::make_master ( std::function< Geom::Vector(const Geom::Vector &, bool &)>  f)

set the element as a master one

Parameters
[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.

◆ make_slave()

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

Parameters
[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.

◆ read_ascii()

std::istream & GranOO3::DEM::Periodic::read_ascii ( std::istream &  in)
virtual

Reimplemented from GranOO3::Core::Prop< Element >.

◆ remove_slave()

void GranOO3::DEM::Periodic::remove_slave ( Periodic slave)

◆ serialize()

template<class Archive >
void GranOO3::DEM::Periodic::serialize ( Archive &  ar,
const unsigned int  version 
)
private

◆ set_follow_master_function()

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

◆ set_master_from_element()

void GranOO3::DEM::Periodic::set_master_from_element ( )

◆ set_master_function()

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)

Parameters
[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.

◆ set_slave_function()

void GranOO3::DEM::Periodic::set_slave_function ( std::function< Geom::Vector(const Geom::Vector &)>  f)

set the slave function (only allowed for slave element)

Parameters
[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.

◆ set_teleport_master_function()

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

◆ slave()

Core::SetOfBase< Periodic > & GranOO3::DEM::Periodic::slave ( )

◆ swap_bond()

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

Parameters
[in]set: the set of slave element
[in]p: the new location of the master element

TODO : EXPERIMENTAL FEATURE, it does not work

◆ teleport_master()

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).

◆ write_ascii()

std::ostream & GranOO3::DEM::Periodic::write_ascii ( std::ostream &  out) const
virtual

Reimplemented from GranOO3::Core::Prop< Element >.

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Member Data Documentation

◆ _function_follow_master

std::function<Geom::Vector (const Geom::Vector&)> GranOO3::DEM::Periodic::_function_follow_master
private

◆ _function_teleport_master

std::function<Geom::Vector (const Geom::Vector&, bool&)> GranOO3::DEM::Periodic::_function_teleport_master
private

◆ _has_slave

bool GranOO3::DEM::Periodic::_has_slave
private

a variable that stores if the element has slave or not

◆ _is_master

bool GranOO3::DEM::Periodic::_is_master
private

a variable that stores if the element is a master or not

◆ _is_slave

bool GranOO3::DEM::Periodic::_is_slave
private

a variable that stores if the element is a slave or not

◆ _master

Periodic * GranOO3::DEM::Periodic::_master
private

a variable that stores the master periodic element

Be aware, if the element is a master, it points to nullptr.

◆ _master_element

Element * GranOO3::DEM::Periodic::_master_element
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.

◆ _slave

Core::SetOfBase< Periodic > * GranOO3::DEM::Periodic::_slave
private

the list of slave periodic elements

Be aware, if the element is a slave, the list is a nullptr.

◆ _slave_number

unsigned int GranOO3::DEM::Periodic::_slave_number
private

a variable that stores the number of slave

Be aware, if the element is a slave, the number is zero


The documentation for this class was generated from the following files: