yade-users team mailing list archive
Mailing list archive
Re: [Question #684115]: Some basic concepts in FrictPhys.cpp
Question #684115 on Yade changed:
Status: Open => Answered
Jan Stránský proposed the following answer:
> Is the shared_ptr<FrictMat> a template class
yes. But as C++ newcomer, you can consider shared_ptr<SomeClass> as
normal pointer SomeClass* with "automatic destruction"
> will instantiate a pointer to FricMat?
no, the pointer already exists. It just change (cast) it for C++ from
> I have checked the definition of shared_ptr but it is too complicated
for a c++ newer to understand.
apart from definitions, try to google some simple examples.
> The YADE_PTR_CAST will do change the b1 type to FrictMat?
yes, see above
> But if b1 is not a pointer to FrictMat, like a CohFrictMat, will it
cause a material type mismatch between the particle material and the
if b1 is not FrictMat, than mat1 will be nullptr, causing segmentation
fault. But this function is called from Yade internals, specifically
IPhysDispatcher, who sends there only correct types.
CohFrictMat is not a good example, because CohFrictMat **IS** FrictMat
(it is derived from it) and the code would work OK.
> Why these two values could be negative?
who not? :-)
This condition is there from (at least, was too lazy to search more) 2009, probably its meaning was Sphere-Facet interaction or something like that
const shared_ptr<FrictPhys>& contactPhysics
means that the pointer is constant (the FrictPhys instance), not its content. You can change its content, but you cannot change, where the pointer points.
kn is MatchMaker 
You received this question notification because your team yade-users is
an answer contact for Yade.