← Back to team overview

yade-users team mailing list archive

Re: [Question #232493]: yade crashes when opening

 

Question #232493 on Yade changed:
https://answers.launchpad.net/yade/+question/232493

Bruno Chareyre posted a new comment:
Back to this.
Equilibrium distance is also present in Law*CohesionMoment (LCM) through "unp", so the only difference left is the normal (good thing to integrate this, btw).
In fact the question is not wether the behavior is very different or not. It is only a matter of how much additional data is needed in IP/IG. Adding hundreds of functions and data to a functor will never hurt in terms of performance. OTOH, adding a lot of data in interactions for an optional feature is not good as it would increase memory usage for everyone.
So if you need, let's say, only a pointer to a fracture plane in each interaction, it is not a big deal to integrate what you need in LCM.
The only limit of this reasoning is that reading a 2000+ line source file is painful. We have to balance the different aspects.

If you find that there is a real reason for a new class, then there is still an alternative to plain duplicate. You could inherit form LCM and write only the parts of the code that are modified. Some code blocks that are the same (e.g. computing moments, if it applies) could be moved to separate functions in LCM, so that your action() would use them unmodified.
The advantage of this is that you automatically get features like elastic energy, graphical display of the interactions, etc. Anything available for LCM will be also available for your law. Also you would not have to track the changes in LCM to duplicate them in the other law (which is really boring in the long run and generates a lot of noise).

B

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.