← Back to team overview

yade-dev team mailing list archive

Re: Dynamic vs Fixed for bodies utils functions

 

Hi Jérôme, I discover the situation with your email and I agree that it can
be improved (looks like).
A good fix would need to clarify the meaning (or is it already clear that
fixed == !dynamic everywhere?), then it is easy to make both accepted
through aliasing.
Removing one of the two seems awkward based on your summary.
Cheers
B

Le jeu. 26 juil. 2018 18:07, Jerome Duriez <jerome.duriez@xxxxxxxxx> a
écrit :

> Hi,
>
> As you may know, the Python (utils module) functions for creating bodies
> make a more or less redundant use of the two "dynamic" and "fixed"
> boolean parameters.
>
>
> It seems to me both are usually accepted with different behaviors:
> - for sphere() and box(), both are passed to _commonBodySetup where
> /dynamic/ (when given by the user) will rule without mercy over /fixed/.
> [1]
> - facet(), tetraPoly(), tetra(), polyhedron() also accept both but makes
> no use whatsoever of /dynamic/ ;-)
>
> As a matter of fact, and since one commit in 2010 [2], the /dynamic/
> keyword is said to be deprecated but the fact is it is still here... It
> also directly appears in the rest of the code (contrary to /fixed/) as
> Body.dynamic [3] and is commented as such in the doc [4].
>
> On the other hand, the use of fixed seems to be more frequent in the
> script examples (I did not try here to distinguish between the working
> examples and the non-working ones ;-) though..)...
>
>
> In case you agree with my description, would you also agree with some
> changes here ?
>
> If yes, my personal choice would be to just keep /dynamic/. Note that
> the risks for breaking backwards compatibility for old Python scripts
> may be reduced by:
> - keeping just the /dynamic/ attribute in _commonBodySetup() which is
> never used directly by the users
> - removing the fixed parameter from sphere() and box()
> - modify the facet(), tetraPoly(), tetra(), polyhedron() code to just
> pass /dynamic/ to _commonBodySetup(), possibly keeping the /fi//xed/
> name in these functions signatures if you prefer to.
> (?)
>
>
> What are your opinions / use of these keywords ?
>
>
> Jérôme
>
> [1] https://github.com/yade/trunk/blob/master/py/utils.py#L131
> [2]
>
> https://github.com/yade/trunk/commit/d8e420ed569c6b4ec3569282df925a5035513d24
> [3] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.Body.dynamic
> [4] https://yade-dem.org/doc/user.html#motion-constraints
>
> ------
> Chargé de Recherche / Research Associate
> Irstea, RECOVER
> 3275 route de Cezanne – CS 40061 13182 Aix-en-Provence Cedex 5 FRANCE
> +33 (0)4 42 66 99 21
>
>
> _______________________________________________
> 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
>

Follow ups

References