30 #ifndef _libDEM_ContactDetection_hpp_
31 #define _libDEM_ContactDetection_hpp_
57 static std::string
class_ID() {
return "DEM::ContactDetection_" + T::class_ID() +
"_";}
109 template<
class T> std::map<std::string, ContactDetection<T> *>
117 interpenetrationValues_(),
118 recordInterpenetrationValues_(false),
119 excludedBondedDiscreteElement_(false),
120 recordContactIn_(
""),
121 interactionCoeff_(1.) {
128 template<
class T>
void
133 parser.
read_attribute(Attr::GRANOO_OPTIONAL,
"RecordInterpenetrationValues",
134 recordInterpenetrationValues_);
135 parser.
read_attribute(Attr::GRANOO_OPTIONAL,
"ExcludedBondedDiscreteElement",
136 excludedBondedDiscreteElement_);
139 std::string uniqueId =
"";
140 parser.
read_attribute(Attr::GRANOO_OPTIONAL,
"UniqueId", uniqueId);
142 RegisterWithUniqueId(uniqueId);
144 parser.
read_attribute(Attr::GRANOO_OPTIONAL,
"RecordContactIn", recordContactIn_);
145 parser.
read_attribute(Attr::GRANOO_OPTIONAL,
"InteractionCoeff", interactionCoeff_);
146 XmlAssert(interactionCoeff_ > 0.,
"The interaction coeff must be positive");
153 AssertMsg(law_ != 0,
"Problem while reading ContactDetection, the given CallBack can't be casted to a ContactLaw");
156 template<
class T>
void
160 if (recordInterpenetrationValues_)
161 interpenetrationValues_.clear();
163 if (recordContactIn_ !=
"")
164 get_RecordContactSet().clear();
166 get_ContactLaw().pre_contact_detection();
168 get_ContactLaw().post_contact_detection();
183 get_RecordContactSet().add_item(de1);
184 get_RecordContactSet().add_item(de2);
189 get_RecordContactSet().add_item(de1);
195 if (excludedBondedDiscreteElement_)
196 if (is_bonded(de1, de2))
200 get_ContactLaw().compute_reaction(de1, de2, normal, penetration);
202 if (recordInterpenetrationValues_)
203 interpenetrationValues_.push_back(penetration);
205 if (recordContactIn_ !=
"")
206 RecordContact(de1, de2);
211 template<
class T>
unsigned int
213 return contactNumber_;
216 template<
class T>
const std::vector<double>&
218 return interpenetrationValues_;
221 template<
class T>
void
224 number = contactNumber_;
228 template<
class T>
void
231 UniqueIdMap_[id] =
this;
237 return *UniqueIdMap_[id];
248 template<
class T>
double
250 return interactionCoeff_;
263 template<
class T>
void
#define InternAssert(condition)
Definition: Macro.hpp:81
#define AssertMsg(condition, message)
Definition: Macro.hpp:67
#define XmlAssert(condition, message)
Definition: XmlParser.hpp:52
Definition: Manager.hpp:118
Definition: Manager.hpp:58
Definition: NeedSetOf.hpp:51
Definition: SetOf.hpp:236
static SetOf< type > & get()
Definition: XmlParser.hpp:122
void read_attribute(const Attribute::State, const std::string &, T &)
the discrete element is just a spherical Element with additional dedicated features
Definition: DiscreteElement.hpp:47
bool is_bonded(const Element &el) const
ask if the current element is bonded to another one
Definition: Element.cpp:87
Definition: Vector.hpp:75
static void All(const T &, double &ave, double &std, double &min, double &max)
Definition: Stat.hpp:88
Definition: Common.hpp:198
T min(const T v0, const T v1)
Definition: Exprtk.hpp:1456
T max(const T v0, const T v1)
Definition: Exprtk.hpp:1463