base class ??

Asked by Rioual

Hello,

I am writing iPhys for a new contact law and I have to complete the YADE_CLASS_BASE_DOC_ATTRS_CTOR()
My question is simple:
what is the base class i have to precise ?? what is its role ??
For instance for FrictPhys the base class is NormShearPhys:
https://gitlab.com/yade-dev/trunk/-/blob/master/pkg/dem/FrictPhys.hpp#L21

In my case, my new law doesn't include any elasticity and is independant: what should i put as
 a base class in YADE_CLASS_BASE_DOC_ATTRS_CTOR ??

Thanks,

Vincent

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:
Last reply:
Revision history for this message
Jérôme Duriez (jduriez) said :
#1

Base class corresponds to the mother class concept in the C++ (or any other object oriented language?) universe. For the constitutive laws Law2* classes, usually we do not use much inheritance and just derive from LawFunctor:

see the nice diagram at https://yade-dem.org/doc/yade.wrapper.html#lawfunctor

PS: in case you're not yet familiar with C++, the good news is using YADE is a good motivation to learn it (also from true C++ resources), the bad news is you have to really dive into it at some point (something which I did not complete myself yet....) in order to be 100% efficient

Revision history for this message
Best Jan Stránský (honzik) said :
#2

Also have a look at IPhys inheritance diagram [1], choice of NormShearPhys or directly IPhys as a base class sounds OK for this case.
As another source of inspiration, have a look at Bubble* stuff [2,3]
cheers
Jan

[1] https://yade-dem.org/doc/yade.wrapper.html#iphys
[2] https://gitlab.com/yade-dev/trunk/-/blob/master/pkg/dem/BubbleMat.hpp
[3] https://gitlab.com/yade-dev/trunk/-/blob/master/pkg/dem/BubbleMat.cpp

Revision history for this message
Rioual (francois-rioual-v) said :
#3

Thanks Jan Stránský, that solved my question.