← Back to team overview

yade-dev team mailing list archive

Re: Help with changes

 

> Q1.  Also, I noticed InteractionSolver is gone.  It used to come
> together with Constitutive Law.  The former uses the
> "action(*Metabody)" to invoke "go(IG &, IP&, etc.)" of the
> constitutiveLaw.  How is it done now?

ConstitutiveLawDispatcher invokes go(IG&,IP&) of individual
ConstitutiveLaw's (note that ConstitutiveLawDispatcher might be hidden
inside InteractionDispatchers, but functionally it is the same)

InteractionSolver was just empty class to designate such classes that
were looping over all interactions. This approach was removed, since it
forced all interactions to have same types.

> Q2.  When do I use CreateIndex()?  It is different from
> RegisterAttributes() right?

createIndex(): Just for types that appear in the dispatch logic,
currently: BoundingVolume, Material, InteractingGeometry,
InteractionGeometry, InteractionPhysics.

The dispatcher uses the indices to decide which functor should be
called. Depending on whether it decides based on 1 type or combination
of 2 types, it is then Dispatcher1D or Dispatcher2D (and
Functor1D/Functor2D). Each functor declares what types it accepts with
FUNCTOR1D(type1) or FUNCTOR2D(type1,type2) macro. It is like virtual
functions, but works for combination of types and can be changed at
runtime: you can have multiple Ip2_* functors in yade that take
GranularMat for instance, but only the one the dispatcher is given by
the user will be used. You can see that nicely in all the python
scripts.

REGISTER_ATTRIBUTES declares which attributes are saved to xml and also
which are accessible from python with the ['attr'] notation (it is a
rather convoluted macro)

> Sometimes, I just copy-paste and modify but don't really understand
> what's going on..
Try to do your best to understand. Of course it is a gradual process,
but it will make your code much better.

Cheers, Vaclav





Follow ups

References