← Back to team overview

yade-dev team mailing list archive

Re: material -- state couples

 

Complex stuff!
Are you just trying to make the code foolproof or is there another reason?

Fixing the state type is perhaps not necessary : it would make something not desired by the user anyway, for good or bad. Wouldn't displaying "you picked a wrong mat/state combination" be enough?

In that case, it could be tested only once, e.g. in the constitutive law or IPdispatcher at first iteration, using Material::checkStateType(Body* b). Not very elegant though, since this is a loop on interactions instead of bodies...

Another possible location for this would be in body->assignMatType(MatType* t), which could call t->checkStateType(this). The problem is it requires that the state type is always defined before the mat type...
So, initializers perhaps?

Bruno



Material CpmMat requires that the body has CpmState (deriving from
State), e.g. to record per-body damaged contacts etc. I can imagine some
other materials might have similar requirements. What would be a clean
way to assure that?
Obviously checking that in the constitutive law at every step might be
time-consuming.

My idea was to declare virtual void Material::fixStateType(Body* b),
which would check type of b->state and fix it if necessary (e.g. using
copy constructor of a class derived from State and re-assign b->state to
the new instance). But where to run that? Add it automatically to
initializers?

In the end, the user will have to be aware of this, at least on the c++
side. In python, we can ensure the right type in
utils.{sphere,facet,wall} easily.

Any ideas on it?


_______________________________________________
Mailing list: https://launchpad.net/~yade-dev
Post to     : yade-dev@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp



--

_______________
Chareyre Bruno
Maître de Conférences

Grenoble INP
Laboratoire 3SR - bureau E145
BP 53 - 38041, Grenoble cedex 9 - France
Tél : 33 4 56 52 86 21
Fax : 33 4 76 82 70 43
________________




Follow ups

References