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

a base class that represents an element More...

#include <Element.hpp>

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

Public Member Functions

 Element (Shape::Volume &shape, const Geom::Point &point)
 constructor More...
 
 Element (Shape::Volume &shape)
 constructor More...
 
virtual ~Element ()=0
 destructor More...
 
virtual std::string shape_class_ID () const =0
 get the related shape classID More...
 
void add_bond (Bond &b)
 add a bond to the _bondset list More...
 
void erase_bond (Bond &b)
 erase a bond from the _bondset list More...
 
bool is_bonded (const Element &el) const
 ask if the current element is bonded to another one More...
 
bool is_bonded (const Element &el, Bond *&commonBond)
 ask if the current element is bonded to another one More...
 
bool is_bonded (const Element &el, const Bond *&commonBond) const
 similar as is_bonded(const Element& el, Bond*& commonBond), given for convenience More...
 
bool is_bonded (const Bond &bond) const
 ask if the current element is bonded to bond More...
 
Bondcommon_bond (const Element &el)
 returns the bond that bonds the current element with the el element More...
 
const Bondcommon_bond (const Element &el) const
 
void delete_all_bond ()
 delete all the bond connected to the current element More...
 
Core::SetOfBase< Bond > & get_bond_set ()
 get the bond list of the current element More...
 
size_t get_bond_number () const
 get the number of bond connected to the current element More...
 
Core::SetOfBase< Elementget_bonded_element ()
 get a list of bonded element More...
 
bool is_unbonded () const
 util method to know if the current element is unbonded More...
 
bool is_bonded () const
 util method to know if the current element is bonded More...
 
double compute_kinetic_energy () const
 compute the kinetic energy of the current element More...
 
void compute_bond_cluster (Core::SetOfBase< DEM::Element > &cluster_set, Core::SetOfBase< DEM::Bond > &parsed_bond)
 util method for detecting a cluster More...
 
virtual std::string info () const
 get some info on a given element More...
 
NeighbourManager< Element > & neighbour ()
 get a list of neighbour element More...
 
const NeighbourManager< Element > & neighbour () const
 same as Element::neighbour(), provided for convenience More...
 
Core::SetOfBase< Element > & neighbour_set ()
 get a list of neighbour element More...
 
const Core::SetOfBase< Element > & neighbour_set () const
 same as neighbour_set(), provided for convenience More...
 
void make_equal_to (const Element &el)
 for equalizing two elements More...
 
virtual std::ostream & write_ascii (std::ostream &os) const
 dump the current state of the element in a ascii file (standard *.lgdd format) More...
 
virtual std::istream & read_ascii (std::istream &is)
 update the current state of the element from an ascii file format *.lgdd More...
 
virtual bool is_spherical_element () const =0
 util method for knowing if the element is spherical or not More...
 
virtual bool is_polyhedral_element () const =0
 util method for knowing if the element is polyhedral or not More...
 
- Public Member Functions inherited from GranOO3::Physic::Body
 Body (Shape::Volume &shape, const Geom::Point &p, const Geom::Quaternion &q, double mass, const Geom::Tensor &inertia)
 constructor More...
 
 Body (Shape::Volume &shape, const Geom::Point &p)
 constructor More...
 
 Body (Shape::Volume &shape)
 constructor More...
 
virtual ~Body ()=0
 destructor More...
 
void set_inertia_tensor (const Geom::Tensor &inertia)
 set the inertia tensor value More...
 
void set_density (double density)
 set the density value More...
 
Geom::Vector compute_torque_at (const Geom::Point &A) const
 
double get_kinetic_energy () const
 
double get_mass () const
 get the current mass value of the body More...
 
void apply_force_at (const Geom::Vector &, const Geom::Point &)
 
const Shape::Volumeto_volume_shape () const
 cast the current object to Shape::Volume More...
 
Shape::Volumeto_volume_shape ()
 cast the current object to Shape::Volume More...
 
double get_volume () const
 get the current volume of the body More...
 
double get_bounding_radius () const
 get the current bounding radius of the body More...
 
AABB aabb () const
 get the aabb tree the body More...
 
bool collide (const Body &other, Collision::Data &col)
 collision detection with another body More...
 
bool collide (const Body &other)
 collision detection with another body More...
 
void make_equal_to (const Body &other)
 for equalizing two bodies More...
 
std::string info () const
 Display some useful info in the terminal
More...
 
virtual std::ostream & export_to_povray (std::ostream &out) const
 exporting to povray format More...
 
- Public Member Functions inherited from GranOO3::Physic::Node
 Node (const Geom::Vector &position)
 
 Node (const Geom::Point &position)
 
 Node ()
 
virtual ~Node ()
 
void clear_force ()
 
void clear_torque ()
 
const Geom::Framelocal_frame () const
 
void incremental_move (const Geom::Vector &vec)
 
void incremental_unmove (const Geom::Vector &vec)
 
void update_position_from_displacement ()
 
void update_displacement_from_position ()
 
void set_displacement (const Geom::Vector &)
 
void clear_displacement ()
 
void set_displacement_x (const double &)
 
void set_displacement_y (const double &)
 
void set_displacement_z (const double &)
 
void set_position (const Geom::Vector &)
 
void set_position_x (const double &)
 
void set_position_y (const double &)
 
void set_position_z (const double &)
 
void set_center (const Geom::Point &)
 
void update_initial_parameter_to_current_parameter ()
 
void update_from_fem ()
 
void update_from_dem ()
 
void add_interaction (Node &)
 
void erase_interaction (Node &)
 
bool interact_with (const Node &) const
 
bool interact_with (const Ground &) const
 
bool interact_with (const FEM::Surface &) const
 
void apply_force (const Geom::Vector &)
 
void apply_torque (const Geom::Vector &)
 
void set_quaternion_velocity_from_angular_velocity (const Geom::Vector &angularVelocity)
 
void set_quaternion_acceleration_from_angular_acceleration (const Geom::Vector &angularAcceleration, const Geom::Vector &angularVelocity)
 
void update_angular_velocity ()
 
virtual void clear_kinematic ()
 
Geom::Vector get_linear_velocity_at (const Geom::Point &) const
 
void make_equal_to (const Node &)
 
virtual void draw ()
 
- Public Member Functions inherited from GranOO3::Core::Base
virtual ~Base ()
 
size_t numID () 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 ()
 
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 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_color (const Color &)
 
void apply_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 ()
 
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::PropClass< Node >
 PropClass ()
 
virtual ~PropClass ()
 
T & new_object ()
 
T & get ()
 
const T & get () const
 
bool prop_exist () const
 
void add_prop (Core::Prop< Node > *)
 
void remove_prop (Core::Prop< Node > *)
 
std::string info () const
 
- Public Member Functions inherited from GranOO3::Core::Register< Node >
 Register ()
 
virtual ~Register ()
 
void erase_from_all_setof ()
 
bool belong_to_setof (const std::string &setOfId) const
 
bool belong_to_setof (const SetOf< Node > &set) const
 
std::list< SetOf< Node > * > & get_setof_list ()
 
unsigned long long int get_numeric_ID () const
 
- Public Member Functions inherited from GranOO3::Core::PropClass< Body >
 PropClass ()
 
virtual ~PropClass ()
 
T & new_object ()
 
T & get ()
 
const T & get () const
 
bool prop_exist () const
 
void add_prop (Core::Prop< Body > *)
 
void remove_prop (Core::Prop< Body > *)
 
std::string info () const
 
- Public Member Functions inherited from GranOO3::Core::Register< Body >
 Register ()
 
virtual ~Register ()
 
void erase_from_all_setof ()
 
bool belong_to_setof (const std::string &setOfId) const
 
bool belong_to_setof (const SetOf< Body > &set) const
 
std::list< SetOf< Body > * > & get_setof_list ()
 
unsigned long long int get_numeric_ID () const
 
- Public Member Functions inherited from GranOO3::Core::PropClass< Element >
 PropClass ()
 
virtual ~PropClass ()
 
T & new_object ()
 
T & get ()
 
const T & get () const
 
bool prop_exist () const
 
void add_prop (Core::Prop< Element > *)
 
void remove_prop (Core::Prop< Element > *)
 
std::string info () const
 
- Public Member Functions inherited from GranOO3::Core::Register< Element >
 Register ()
 
virtual ~Register ()
 
void erase_from_all_setof ()
 
bool belong_to_setof (const std::string &setOfId) const
 
bool belong_to_setof (const SetOf< Element > &set) const
 
std::list< SetOf< Element > * > & get_setof_list ()
 
unsigned long long int get_numeric_ID () const
 

Static Public Member Functions

static Elementnew_object (const TiXmlElement *el)
 instantiate a new element from an XML input file More...
 
- 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 ()
 

Protected Attributes

Core::SetOfBase< Bond_bondset
 the always up-to-date list of bond which are bonded to the current element More...
 
NeighbourManager< Element_neighbour
 the always up-to-date list of bond which are bonded to the current element More...
 
- Protected Attributes inherited from GranOO3::Physic::Body
double _density
 the density value of the body More...
 
double _mass
 the mass value of the body More...
 
Geom::Tensor _inertia_tensor
 the inertia tensor of the body More...
 
Geom::Tensor _inverse_inertia_tensor
 the inverse of the inertia tensor of the body More...
 
- Protected Attributes inherited from GranOO3::Core::PropClass< Node >
std::vector< Core::Prop< Node > * > _prop
 
- Protected Attributes inherited from GranOO3::Core::PropClass< Body >
std::vector< Core::Prop< Body > * > _prop
 
- Protected Attributes inherited from GranOO3::Core::PropClass< Element >
std::vector< Core::Prop< Element > * > _prop
 

Private Member Functions

 Element (const Element &)=delete
 
Elementoperator= (const Element &)=delete
 
template<class Archive >
void serialize (Archive &, const unsigned int)
 complete serializing of the element in the *.gdd format More...
 

Friends

class boost::serialization::access
 

Additional Inherited Members

- Static Public Attributes inherited from GranOO3::Core::Null
static Null null = Null()
 
- 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 base class that represents an element

Be aware, an Element has no associated shape, so this is a pure virtual class. A shape is associated to an Element through its child template class ElementT.
Note that, for GranOO, a DiscreteElement is simply a spherical Element.

Constructor & Destructor Documentation

◆ Element() [1/3]

GranOO3::DEM::Element::Element ( Shape::Volume shape,
const Geom::Point point 
)

constructor

Parameters
[in]shape: the shape to clone
[in]point: initial position of the element

◆ Element() [2/3]

GranOO3::DEM::Element::Element ( Shape::Volume shape)

constructor

Parameters
[in]shape: the shape to clone

◆ ~Element()

GranOO3::DEM::Element::~Element ( )
pure virtual

destructor

Note that the destructor send a message to its related DEM::Bond for destructing them

◆ Element() [3/3]

GranOO3::DEM::Element::Element ( const Element )
privatedelete

Member Function Documentation

◆ add_bond()

void GranOO3::DEM::Element::add_bond ( Bond bond)

add a bond to the _bondset list

Parameters
[in]bond: the bond to add

This is a utility method for managing the _bondset list. In addition to the _bondset list, this method add the bonded Element to the _neighbour list

◆ common_bond() [1/2]

Bond & GranOO3::DEM::Element::common_bond ( const Element el)

returns the bond that bonds the current element with the el element

Parameters
[in]el: the element to check
Returns
a reference to the common bond

This is a useful method for extracting a common bond between to element. Note that, if no common bond are detected, this method raises an assertion. So, you have to be sure that the el element is connected to the current one.

◆ common_bond() [2/2]

const Bond & GranOO3::DEM::Element::common_bond ( const Element el) const

◆ compute_bond_cluster()

void GranOO3::DEM::Element::compute_bond_cluster ( Core::SetOfBase< DEM::Element > &  cluster_set,
Core::SetOfBase< DEM::Bond > &  parsed_bond 
)

util method for detecting a cluster

Parameters
[out]cluster_set: a list of element that represents the cluster of element
[out]parsed_bond: a list of the bond that was parsed for creating the cluster

This method can be used for retrieving a cluster of Element. A cluster is is simply a set of Element which are bonded. This method can be used for retrieving pieces of
element that detach from another one. Note that this method requires huge computational time as it use a recursive algorithm for finding cluster.

◆ compute_kinetic_energy()

double GranOO3::DEM::Element::compute_kinetic_energy ( ) const
inline

compute the kinetic energy of the current element

Returns
the kinetic energy value

Here, the kinetic energy includes the linear and angular velocity part. Note that the way the kinetic energy is computed for the angular volicity is too simple (it is correct only for spherical element). TODO (we must revise this)

◆ delete_all_bond()

void GranOO3::DEM::Element::delete_all_bond ( )

delete all the bond connected to the current element

Note that this method, really delete the bonds by invoking their destructors

◆ erase_bond()

void GranOO3::DEM::Element::erase_bond ( Bond bond)

erase a bond from the _bondset list

Parameters
[in]bond: the bond to erase

This is a utility method for managing the _bondset list. In addition to the _bondset list, this method remove the bonded Element to the _neighbour list

◆ get_bond_number()

size_t GranOO3::DEM::Element::get_bond_number ( ) const
inline

get the number of bond connected to the current element

Returns
the number of bond

◆ get_bond_set()

Core::SetOfBase< Bond > & GranOO3::DEM::Element::get_bond_set ( )
inline

get the bond list of the current element

Returns
a reference to the the bond list

Note that this method returns the list in read and write mode. It means that you can modify it. If you modify the list in such way, you must know what you do, because it could lead to unexpected behavior.

◆ get_bonded_element()

Core::SetOfBase< Element > GranOO3::DEM::Element::get_bonded_element ( )

get a list of bonded element

Returns
the list of element

As there is no internal way of storing the list of bonded element, this list is built on-the-fly and this method returns a copy of this list. Note that this method induces some computational cost.

◆ info()

std::string GranOO3::DEM::Element::info ( ) const
virtual

get some info on a given element

Returns
a string that contains some info about the element

Reimplemented from GranOO3::Physic::Node.

Reimplemented in GranOO3::DEM::ElementT< shape >, GranOO3::DEM::ElementT< Shape::Sphere >, GranOO3::DEM::ElementT< GranOO3::Shape::Polyhedron >, and GranOO3::DEM::DiscreteElement.

◆ is_bonded() [1/5]

bool GranOO3::DEM::Element::is_bonded ( ) const

util method to know if the current element is bonded

Returns
true is the the current element isnbonded false otherwise

An element is considered as bonded if one bond at least is connected to the current element.

◆ is_bonded() [2/5]

bool GranOO3::DEM::Element::is_bonded ( const Bond bond) const

ask if the current element is bonded to bond

Parameters
[in]bond: the bond to check if it is connected to the current element
Returns
true if the current element is bonded to the bond one, false otherwise

This is a useful method for detecting if an element is bonded to a specific Bond.

◆ is_bonded() [3/5]

bool GranOO3::DEM::Element::is_bonded ( const Element el) const

ask if the current element is bonded to another one

Parameters
[in]el: the another one element
Returns
true if the current element is bonded to the el one, false otherwise

This is a useful method for detecting if an element is bonded through a Bond to another one.

◆ is_bonded() [4/5]

bool GranOO3::DEM::Element::is_bonded ( const Element el,
Bond *&  commonBond 
)

ask if the current element is bonded to another one

Parameters
[in]el: the another one element
[out]commonBond: a pointer to the common bond (nullptr if it is not bonded)
Returns
true if the current element is bonded to the el one, false otherwise

This is a useful method for detecting if an element is bonded through a Bond to another one. If this is the case, this method retrieve the commonBond.

◆ is_bonded() [5/5]

bool GranOO3::DEM::Element::is_bonded ( const Element el,
const Bond *&  commonBond 
) const

similar as is_bonded(const Element& el, Bond*& commonBond), given for convenience

◆ is_polyhedral_element()

bool GranOO3::DEM::Element::is_polyhedral_element ( ) const
pure virtual

util method for knowing if the element is polyhedral or not

Returns
true if the element is polyhedral, false otherwise

Note that this method is pure virtual because the Element class does not know its real shape

Implemented in GranOO3::DEM::ElementT< shape >, GranOO3::DEM::ElementT< Shape::Sphere >, GranOO3::DEM::ElementT< GranOO3::Shape::Polyhedron >, GranOO3::DEM::ElementT< shape >, GranOO3::DEM::ElementT< Shape::Sphere >, and GranOO3::DEM::ElementT< GranOO3::Shape::Polyhedron >.

◆ is_spherical_element()

bool GranOO3::DEM::Element::is_spherical_element ( ) const
pure virtual

util method for knowing if the element is spherical or not

Returns
true if the element is spherical, false otherwise

Note that this method is pure virtual because the Element class does not know its real shape

Implemented in GranOO3::DEM::ElementT< shape >, GranOO3::DEM::ElementT< Shape::Sphere >, GranOO3::DEM::ElementT< GranOO3::Shape::Polyhedron >, GranOO3::DEM::ElementT< shape >, GranOO3::DEM::ElementT< Shape::Sphere >, and GranOO3::DEM::ElementT< GranOO3::Shape::Polyhedron >.

◆ is_unbonded()

bool GranOO3::DEM::Element::is_unbonded ( ) const

util method to know if the current element is unbonded

Returns
true is the the current element is unbonded false otherwise

An element is considered as unbonded if no bond is connected to the current element.

◆ make_equal_to()

void GranOO3::DEM::Element::make_equal_to ( const Element el)

for equalizing two elements

Parameters
[in]el: the element which will be used as a model for equalizing

This method can be used for equalizing the current element (this) to another one (el). When you equalize two elements, they have the same position, velocity, mass, etc. This method can be used used for cloning elements.

◆ neighbour() [1/2]

NeighbourManager< Element > & GranOO3::DEM::Element::neighbour ( )
inline

get a list of neighbour element

Returns
a list of neighbour element

An element is considered as a neighbour of another one if it is bonded to this element. Note that the neighbour list could potentially be used with contact but this not implemented.

Warning
This list is automatically updated. If you modify it could lead to unexpected result.

◆ neighbour() [2/2]

const NeighbourManager< Element > & GranOO3::DEM::Element::neighbour ( ) const
inline

same as Element::neighbour(), provided for convenience

◆ neighbour_set() [1/2]

Core::SetOfBase< Element > & GranOO3::DEM::Element::neighbour_set ( )
inline

get a list of neighbour element

Returns
a list of neighbour element

This method is quite similar to Element::neighbour() The sole difference is that it returns directly a list (SetOfBase) of Element instead of returning a NeighbourManager<Element> object.

Warning
This list is automatically updated. If you modify it could lead to unexpected result.

◆ neighbour_set() [2/2]

const Core::SetOfBase< Element > & GranOO3::DEM::Element::neighbour_set ( ) const
inline

same as neighbour_set(), provided for convenience

◆ new_object()

Element * GranOO3::DEM::Element::new_object ( const TiXmlElement *  el)
static

instantiate a new element from an XML input file

Parameters
[in]el: a pointer to the xml element where the element is described
Returns
a new Element instance

This method is mainly used for internal usage

◆ operator=()

Element& GranOO3::DEM::Element::operator= ( const Element )
privatedelete

◆ read_ascii()

std::istream & GranOO3::DEM::Element::read_ascii ( std::istream &  is)
virtual

update the current state of the element from an ascii file format *.lgdd

Parameters
[in]is: the stream where the data are read
Returns
the stream
See also
the Domain classes to get additional info about I/O

Reimplemented from GranOO3::Physic::Body.

Reimplemented in GranOO3::DEM::ElementT< shape >, GranOO3::DEM::ElementT< Shape::Sphere >, GranOO3::DEM::ElementT< GranOO3::Shape::Polyhedron >, and GranOO3::DEM::DiscreteElement.

◆ serialize()

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

complete serializing of the element in the *.gdd format

See also
the Domain classes to get additional info about I/O

◆ shape_class_ID()

std::string GranOO3::DEM::Element::shape_class_ID ( ) const
pure virtual

get the related shape classID

Returns
the shape classID

As this method is pure virtual, this method returns the "true" class_ID of the shape ("Sphere", "Cone", etc.)

Returns
the shape classID

Implemented in GranOO3::DEM::ElementT< shape >, GranOO3::DEM::ElementT< Shape::Sphere >, and GranOO3::DEM::ElementT< GranOO3::Shape::Polyhedron >.

◆ write_ascii()

std::ostream & GranOO3::DEM::Element::write_ascii ( std::ostream &  os) const
virtual

dump the current state of the element in a ascii file (standard *.lgdd format)

Parameters
[in]os: the stream where the data will be written
Returns
the stream (with the expected additional data)
See also
the Domain classes to get additional info about I/O

Reimplemented from GranOO3::Physic::Body.

Reimplemented in GranOO3::DEM::DiscreteElement, GranOO3::DEM::ElementT< shape >, GranOO3::DEM::ElementT< Shape::Sphere >, and GranOO3::DEM::ElementT< GranOO3::Shape::Polyhedron >.

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Member Data Documentation

◆ _bondset

Core::SetOfBase< Bond > GranOO3::DEM::Element::_bondset
protected

the always up-to-date list of bond which are bonded to the current element

◆ _neighbour

NeighbourManager< Element > GranOO3::DEM::Element::_neighbour
protected

the always up-to-date list of bond which are bonded to the current element


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