30 #ifndef _LibDEM_ElementT_TPP
31 #define _LibDEM_ElementT_TPP
35 #include <boost/serialization/version.hpp>
36 #include <boost/serialization/map.hpp>
73 GRANOO_ACCESS_GET (center ,
Geom::Point , Node::get_center() );
78 virtual std::string
info()
const;
105 template<
class Archive>
void serialize(Archive&,
const unsigned int);
110 template<
class shape>
113 shape(
Element::local_frame()) {
116 Body::set_density(density);
119 template<
class shape>
122 shape(
Element::local_frame()) {
126 template<
class shape>
128 :
ElementT<shape>(Geom::global::center) {
131 template<
class shape>
135 template<
class shape> std::string
137 return shape::class_ID();
140 template<
class shape>
142 return shape::get_volume();
147 return Physic::Node::get_position();
151 template<
class shape>
158 template<
class shape>
160 this->shape::make_equal_to(el);
164 template<
class shape>
void
167 Drawable::apply_color();
169 glMultMatrixd(local_frame().get_glMatrix());
175 template<
class shape>
void
178 Drawable::apply_edge_color();
180 glMultMatrixd(local_frame().get_glMatrix());
181 shape::draw_gl_edge();
186 template<
class shape> std::string
188 std::ostringstream os;
190 << Body::info() <<
'\n'
195 template<
class shape> std::ostream&
198 shape::write_ascii(out);
202 template<
class shape> std::istream&
205 shape::read_ascii(in);
211 template<
class shape>
bool
216 template<
class shape>
bool
222 template<
class shape>
template<
class Archive>
void
224 ar & boost::serialization::base_object<Element>(*
this);
225 ar & boost::serialization::base_object<shape>(*
this);
236 template<
class shape>
237 struct Read<DEM::ElementT<shape> >
254 GRANOO_CLASS_DECLARE_TPL(DEM::ElementT<Shape::Sphere>);
255 GRANOO_CLASS_DECLARE_TPL(DEM::ElementT<Shape::Box>);
256 GRANOO_CLASS_DECLARE_TPL(DEM::ElementT<Shape::Cylinder>);
257 GRANOO_CLASS_DECLARE_TPL(DEM::ElementT<Shape::Cone>);
258 GRANOO_CLASS_DECLARE_TPL(DEM::ElementT<Shape::Polyhedron>);
260 extern template class Core::PropClass<DEM::ElementT<Shape::Sphere> >;
261 extern template class Core::PropClass<DEM::ElementT<Shape::Box> >;
262 extern template class Core::PropClass<DEM::ElementT<Shape::Cylinder> >;
263 extern template class Core::PropClass<DEM::ElementT<Shape::Cone> >;
264 extern template class Core::PropClass<DEM::ElementT<Shape::Polyhedron> >;
bool is() const
Definition: Base.hpp:150
Definition: PropClass.hpp:47
Definition: SetOf.hpp:346
a base class that represents an element
Definition: Element.hpp:55
virtual std::ostream & write_ascii(std::ostream &os) const
dump the current state of the element in a ascii file (standard *.lgdd format)
Definition: Element.cpp:218
void make_equal_to(const Element &el)
for equalizing two elements
Definition: Element.cpp:205
virtual std::string info() const
get some info on a given element
Definition: Element.cpp:210
virtual std::istream & read_ascii(std::istream &is)
update the current state of the element from an ascii file format *.lgdd
Definition: Element.cpp:224
a template class that model an element with a given shape
Definition: ElementT.hpp:59
void serialize(Archive &, const unsigned int)
complete serializing of the element in the *.gdd format
Definition: ElementT.hpp:223
virtual ~ElementT()
destructor
Definition: ElementT.hpp:132
ElementT(const Geom::Point &pos, double density)
constructor
Definition: ElementT.hpp:111
virtual bool is_polyhedral_element() const
util method for knowing if the element is polyhedral or not
Definition: ElementT.hpp:217
void make_equal_to(const ElementT &el)
for equalizing two elements
Definition: ElementT.hpp:159
double get_volume() const
get the volume the element
Definition: ElementT.hpp:141
virtual std::ostream & write_ascii(std::ostream &os) const
dump the current state of the element in a ascii file (standard *.lgdd format)
Definition: ElementT.hpp:196
virtual void draw_edge()
Definition: ElementT.hpp:176
std::string shape_class_ID() const
get the related shape classID
Definition: ElementT.hpp:136
virtual std::istream & read_ascii(std::istream &is)
update the current state of the element from an ascii file format *.lgdd
Definition: ElementT.hpp:203
const Geom::Vector & get_position() const
get the current position vector of the element
Definition: ElementT.hpp:146
ElementT()
default constructor
Definition: ElementT.hpp:127
virtual std::string info() const
get some info on a given element
Definition: ElementT.hpp:187
virtual Core::Base & clone()
clone the current ElementT
Definition: ElementT.hpp:152
ElementT & operator=(const ElementT &)=delete
ElementT(const ElementT &)=delete
ElementT(const Geom::Point &pos, double radius, double density)
constructor mainly used for spherical element
virtual bool is_spherical_element() const
util method for knowing if the element is spherical or not
Definition: ElementT.hpp:212
friend class boost::serialization::access
Definition: ElementT.hpp:104
ElementT(const Geom::Point &pos)
constructor
Definition: ElementT.hpp:120
virtual void draw()
util method for GL drawing the element (used by granoo-viewer)
Definition: ElementT.hpp:165
Definition: Quaternion.hpp:54
Definition: Vector.hpp:75
const Geom::Frame & local_frame() const
Definition: Node.hpp:262
void update_bounding_shape()
Definition: Volume.cpp:96
Definition: Common.hpp:198
static Base * new_object(const std::string &classID, std::istream &in)
Definition: ElementT.hpp:239
Definition: SetOfManager.hpp:63