30 #ifndef _libDEM_SupportShape_tpp_
31 #define _libDEM_SupportShape_tpp_
47 extern template class Core::SetOf<DEM::DiscreteElement>;
57 GRANOO_CLASS_DEFAULT_COLOR(.2, .8, .4, .2);
61 static bool exist(
const std::string& ID);
76 void update_average_discrete_element_radius();
77 double get_continuous_volume()
const;
78 double get_volumic_fraction()
const;
79 double set_continuous_density(
double density);
80 virtual std::string info()
const;
87 bool is_attach()
const;
89 virtual void recoverer_boundary();
91 double get_average_discrete_element_radius()
const;
94 double get_discrete_volume()
const;
100 virtual std::ostream& write_ascii (std::ostream& out)
const;
101 virtual std::istream& read_ascii (std::istream& in);
110 friend class boost::serialization::access;
111 template<
class Archive>
void save(Archive&,
const unsigned int )
const;
112 template<
class Archive>
void load(Archive&,
const unsigned int);
128 for (
unsigned int i = 0; i<set.
size(); ++i) {
129 if (set[i]->get_ID()==
id)
132 UserAssert(0,
"can't find SupportShape named " +
id);
136 inline bool SupportShape::exist(
const std::string&
id) {
138 for (
unsigned int i = 0; i<set.
size(); ++i) {
139 if (set[i]->get_ID()==
id)
146 SupportShape::info()
const {
147 std::ostringstream os;
153 SupportShape::get_boundary() {
154 AssertMsg(_attached ==
true,
"The support shape must be attached first");
159 SupportShape::get_boundary()
const {
160 AssertMsg(_attached ==
true,
"The support shape must be attached first");
164 template<
class Archive>
166 SupportShape::save(Archive& ar,
const unsigned int)
const {
167 ar << boost::serialization::base_object<Physic::Ground>(*
this);
169 ar << _average_discrete_element_radius;
174 template<
class Archive>
176 SupportShape::load(Archive& ar,
const unsigned int) {
177 ar >> boost::serialization::base_object<Physic::Ground>(*
this);
179 ar >> _average_discrete_element_radius;
182 local_frame().update_glMatrix();
190 GRANOO_CLASS_DECLARE_TPL(DEM::SupportShape);
#define AssertMsg(condition, message)
Definition: Macro.hpp:67
#define UserAssert(condition, message)
Definition: Macro.hpp:54
virtual std::string info() const
Definition: Base.hpp:194
Definition: SetOf.hpp:236
static SetOf< type > & get_global_set()
a class that represents the discrete boundary of SupportShape
Definition: SupportShapeBoundary.hpp:56
a pure virtual class that represents a perfect shape associated with a collection of discrete element
Definition: SupportShape.hpp:54
virtual Shape::Volume & to_volume_shape()=0
cast the current SupportShape to the corresponding Shape::Volume
virtual void update()=0
update the support shape length, position and orientation
SupportShape(const SupportShape &)=delete
BOOST_SERIALIZATION_SPLIT_MEMBER()
Core::SetOf< DiscreteElement > * _all
the whole collection of discrete element associated with the support shape
Definition: SupportShape.hpp:121
virtual std::string shape_class_ID() const =0
get the class ID of the support shape ("Cylinder", "Cone", etc...)
virtual const Shape::Volume & to_volume_shape() const =0
cast the current SupportShape to the corresponding Shape::Volume
static SupportShape * new_object(const TiXmlElement *el)
instantiate a new support shape from the xml input file
bool _attached
a flag to know if the support shape is attached or not
Definition: SupportShape.hpp:119
static SupportShape & glob(const std::string &ID)
similar as get(std::string ID)
SupportShape & operator=(const SupportShape &)=delete
SupportShapeBoundary _boundary
the SupportShapeBoundary associated to the support shape
Definition: SupportShape.hpp:122
virtual void add_glob(const std::string &)=0
util method for reading an xml element
virtual void read_xml_element(const TiXmlElement *el)
read an xml element
virtual std::istream & read_ascii_shape(std::istream &in)=0
for internal use only (.agdd compatibility)
double _average_discrete_element_radius
a variable that contains the average value of the discrete element collection attached to the support...
Definition: SupportShape.hpp:120
virtual std::ostream & write_ascii_shape(std::ostream &out) const =0
for internal use only (.agdd compatibility)
Definition: Ground.hpp:61
Definition: Volume.hpp:103
Definition: Common.hpp:198