yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #02325
Re: material -- state couples
For now, I solved that in python only: most/all python code calls
utils.sphere to create sphere etc. Material::newAssocState returns
instance of required State (sub)class.
> Are you just trying to make the code foolproof or is there another reason?
Yes, that's it.
> 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...
Good idea, I could check in the BoundingVolumeMetaEngine or Collider.
BoundingVolumeMetaEngine is called just once when using VelocityBins,
though... And putting that inside the collider seems like a little
abuse. But it might work. Will do that.
> 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...
That; and also code that wouldn't use this special method to assign
material would fool us.
> So, initializers perhaps?
We don't use them for quite long now, and I don't feel like reinventing
them (in fact dropping initializers would be a nice clean-up :-) ).
Cheers, V.
Follow ups
References