yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #02317
material -- state couples
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?
Follow ups