GranOO 3.0
A robust and versatile workbench to build 3D dynamic simulations based on the Discrete Element Method
Loading...
Searching...
No Matches
GranOO3::DEM::ToolT< shape > Class Template Reference

a class that represents a rigid body with various shape into a discrete element simulation More...

#include <ToolT.hpp>

Inheritance diagram for GranOO3::DEM::ToolT< shape >:

Public Member Functions

 ToolT (const std::string &ID, const Geom::Point &p, const Geom::Quaternion &q, double mass, const Geom::Tensor &inertia)
 constructor
 ToolT ()
 default constructor, for internal usage only (serialization)
virtual ~ToolT ()
 destructor
virtual std::string info () const
 Display some useful info in the terminal.
void read_xml_element (const TiXmlElement *el)
 read an xml element
virtual void draw ()
 OpenGL draw of the bond.
virtual void draw_edge ()
std::string shape_class_ID () const
 get the class ID of the tool ("Cylinder", "Cone", etc...)
const Geom::Frame & local_frame () const
 get the local frame of the tool
virtual std::ostream & write_ascii (std::ostream &out) const
 dump the current state of the tool in a ascii file (standard *.lgdd format)
virtual std::istream & read_ascii (std::istream &in)
 update the current state of the element from an ascii file format *.lgdd
virtual std::ostream & write_ascii_shape (std::ostream &out) const
 for internal use only (.agdd compatibility)
virtual std::istream & read_ascii_shape (std::istream &in)
 for internal use only (.agdd compatibility)
Public Member Functions inherited from GranOO3::DEM::Tool
 Tool (Shape::Volume &shape, const std::string &ID, const Geom::Point &p, const Geom::Quaternion &q, double mass, const Geom::Tensor &inertia)
 constructor
 Tool (Shape::Volume &shape)
 constructor
virtual ~Tool ()=0
 destructor
virtual void add_glob (const std::string &)=0
 util method for reading an xml element
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
 Body (Shape::Volume &shape, const Geom::Point &p)
 constructor
 Body (Shape::Volume &shape)
 constructor
virtual ~Body ()=0
 destructor
void set_inertia_tensor (const Geom::Tensor &inertia)
 set the inertia tensor value
void set_density (double density)
 set the density value
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
void apply_force_at (const Geom::Vector &, const Geom::Point &)
const Shape::Volume & to_volume_shape () const
 cast the current object to Shape::Volume
Shape::Volume & to_volume_shape ()
 cast the current object to Shape::Volume
double get_volume () const
 get the current volume of the body
double get_bounding_radius () const
 get the current bounding radius of the body
AABB aabb () const
 get the aabb tree the body
bool collide (const Body &other, Collision::Data &col)
 collision detection with another body
bool collide (const Body &other)
 collision detection with another body
void make_equal_to (const Body &other)
 for equalizing two bodies
virtual std::ostream & export_to_povray (std::ostream &out) const
 exporting to povray format
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::Frame & local_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 &)
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::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 ()
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 Color & default_color () const
Color & get_color ()
const Color & get_color () const
virtual void set_color (const Color &)
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
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 ()
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
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 ()
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
std::list< SetOf< Body > * > & get_setof_list ()
unsigned long long int get_numeric_ID () const
Public Member Functions inherited from GranOO3::Core::Register< Tool >
 Register ()
virtual ~Register ()
void erase_from_all_setof ()
bool belong_to_setof (const std::string &setOfId) const
std::list< SetOf< Tool > * > & get_setof_list ()
unsigned long long int get_numeric_ID () const
Public Member Functions inherited from GranOO3::Core::Register< ToolT< shape > >
 Register ()
virtual ~Register ()
void erase_from_all_setof ()
bool belong_to_setof (const std::string &setOfId) const
std::list< SetOf< ToolT< shape > > * > & get_setof_list ()
unsigned long long int get_numeric_ID () const

Static Public Member Functions

static ToolT< shape > & get (const std::string &ID)
 retrieve a tool with a given ID
static bool exist (const std::string &ID)
 check if the tool with the ID exists
Static Public Member Functions inherited from GranOO3::DEM::Tool
static Tool & get (const std::string &ID)
 retrieve a tool with a given ID
static bool exist (const std::string &ID)
 check if the tool with the ID exists
static Tool & glob (const std::string &ID)
 similar as get(const std::string& ID)
static Tool * new_object (const TiXmlElement *el)
 instantiate a new tool from the xml input file
Static Public Member Functions inherited from GranOO3::Core::Base
static Base & get_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 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 Public Member Functions inherited from GranOO3::Core::ObjectFactoryInterface< Tool, ToolT< shape > >
static Tool * build ()
static bool record (const std::string &id, std::string file_name="", std::string desc="")
Static Public Member Functions inherited from GranOO3::Core::ObjectFactory< Tool >
static void record (std::function< Tool *()>, const std::string &, const std::string file="", const std::string desc="")
static Tool * new_object (const std::string &)
static std::vector< std::string > get_ID ()
static std::map< const std::string, std::function< Tool *()> > & get_map ()

Private Member Functions

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

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::DEM::Tool
 Tool ()
 default constructor (for internal use only with seriaization)
Protected Member Functions inherited from GranOO3::Core::Base
 Base ()
Protected Member Functions inherited from GranOO3::Core::ObjectFactoryInterface< Tool, ToolT< shape > >
 ObjectFactoryInterface ()
virtual ~ObjectFactoryInterface ()
Protected Member Functions inherited from GranOO3::Core::ObjectFactory< Tool >
 ObjectFactory ()
virtual ~ObjectFactory ()
Static Protected Member Functions inherited from GranOO3::Core::Base
static unsigned int affect_class_rank_ID ()
Protected Attributes inherited from GranOO3::Physic::Body
double _density
 the density value of the body
double _mass
 the mass value of the body
Geom::Tensor _inertia_tensor
 the inertia tensor of the body
Geom::Tensor _inverse_inertia_tensor
 the inverse of the inertia tensor of the body
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

Detailed Description

template<class shape>
class GranOO3::DEM::ToolT< shape >

a class that represents a rigid body with various shape into a discrete element simulation

Template Parameters
shapethe real shape of the ToolT

The aim of this class is to model a rigid body. This template class ToolT<shape> derives from two classes :

You can get more info in the documentation of the Tool class.

Constructor & Destructor Documentation

◆ ToolT() [1/3]

template<class shape>
GranOO3::DEM::ToolT< shape >::ToolT ( const std::string & ID,
const Geom::Point & p,
const Geom::Quaternion & q,
double mass,
const Geom::Tensor & inertia )

constructor

Parameters
[in]ID: the ID of the tool (must be unique)
[in]p: initial position of the tool
[in]q: initial orientation of the tool
[in]mass: mass of the tool
[in]inertia: inertia tensor of the tool

Construct a new ToolT and set directly its string ID, position, orientation, mass and inertia.

◆ ToolT() [2/3]

template<class shape>
GranOO3::DEM::ToolT< shape >::ToolT ( )

default constructor, for internal usage only (serialization)

◆ ~ToolT()

template<class shape>
GranOO3::DEM::ToolT< shape >::~ToolT ( )
virtual

destructor

◆ ToolT() [3/3]

template<class shape>
GranOO3::DEM::ToolT< shape >::ToolT ( const ToolT< shape > & )
privatedelete

Member Function Documentation

◆ draw()

template<class shape>
void GranOO3::DEM::ToolT< shape >::draw ( )
virtual

OpenGL draw of the bond.

This method is used for drawing the bond. It is used by the granoo-viewer vizualization tool

Implements GranOO3::DEM::Tool.

◆ draw_edge()

template<class shape>
void GranOO3::DEM::ToolT< shape >::draw_edge ( )
virtual

Reimplemented from GranOO3::Core::Drawable.

◆ exist()

template<typename shape>
bool GranOO3::DEM::ToolT< shape >::exist ( const std::string & ID)
static

check if the tool with the ID exists

Parameters
[in]ID: the ID of the tool
Returns
: true if a ToolT corresponds to the given ID, false otherwise.n.

◆ get()

template<typename shape>
ToolT< shape > & GranOO3::DEM::ToolT< shape >::get ( const std::string & ID)
static

retrieve a tool with a given ID

Parameters
[in]ID: the ID of the tool
Returns
: a tool that corresponds to the given ID

Note that if no ToolT exists, this method raises an assertion.

◆ info()

template<class shape>
std::string GranOO3::DEM::ToolT< shape >::info ( ) const
virtual

Display some useful info in the terminal.

Reimplemented from GranOO3::DEM::Tool.

◆ local_frame()

template<class shape>
const Geom::Frame & GranOO3::DEM::ToolT< shape >::local_frame ( ) const

get the local frame of the tool

Returns
the local frame

◆ operator=()

template<class shape>
ToolT & GranOO3::DEM::ToolT< shape >::operator= ( const ToolT< shape > & )
privatedelete

◆ read_ascii()

template<class shape>
std::istream & GranOO3::DEM::ToolT< shape >::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::DEM::Tool.

◆ read_ascii_shape()

template<class shape>
std::istream & GranOO3::DEM::ToolT< shape >::read_ascii_shape ( std::istream & in)
virtual

for internal use only (.agdd compatibility)

Implements GranOO3::DEM::Tool.

◆ read_xml_element()

template<class shape>
void GranOO3::DEM::ToolT< shape >::read_xml_element ( const TiXmlElement * el)
virtual

read an xml element

Parameters
[in]el: the xml element that describes the tool

Note that this method is mainly for internal use (XML parsing process).

Reimplemented from GranOO3::DEM::Tool.

◆ serialize()

template<class shape>
template<class Archive>
void GranOO3::DEM::ToolT< shape >::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()

template<class shape>
std::string GranOO3::DEM::ToolT< shape >::shape_class_ID ( ) const
virtual

get the class ID of the tool ("Cylinder", "Cone", etc...)

Returns
the shape class ID

Implements GranOO3::DEM::Tool.

◆ write_ascii()

template<class shape>
std::ostream & GranOO3::DEM::ToolT< shape >::write_ascii ( std::ostream & os) const
virtual

dump the current state of the tool 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::DEM::Tool.

◆ write_ascii_shape()

template<class shape>
std::ostream & GranOO3::DEM::ToolT< shape >::write_ascii_shape ( std::ostream & out) const
virtual

for internal use only (.agdd compatibility)

Implements GranOO3::DEM::Tool.

◆ boost::serialization::access

template<class shape>
friend class boost::serialization::access
friend

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