← Back to team overview

yade-dev team mailing list archive

[Bug 1031703] Re: "extra" value for bodies

 

The problem is not how to access the extra variables in python but how to implement them in c++.
For storing arbitrary types, I see at least two ways:
1/ void pointers + some typecasting
2/ add template parameters to the class Body

(2) is forbidden in yade as serialization and python wrapping don't seem to like templates.
(1) would be complex to implement but it could work maybe.

Of course, it is possible to add a float and a int to each body, call
them extraInt/extraReal, and let the users use them or not. However, it
can't be extended since it means a waste of memory as soon as the extra
variables are not used.

If the only problem of Jan's suggestion is that the values are not
saved, then the simpler thing would be to find a convenient way to save
them.

Now, to be honest, I should mention that there are already 7 extra values in each body:
((Vector3r,refPos,Vector3r::Zero(),,"Reference position"))
((Quaternionr,refOri,Quaternionr::Identity(),,"Reference orientation"))

Since they are only used for a very specific type of postprocessing, you
can assign any value to them without interfering with the computation.
However, it is a short term solution since I would like to remove these
parameters one day.

-- 
You received this bug notification because you are a member of Yade
developers, which is subscribed to Yade.
https://bugs.launchpad.net/bugs/1031703

Title:
  "extra" value for bodies

Status in Yet Another Dynamic Engine:
  New

Bug description:
  Hi,

  It would be very helpful, if there would be an "extra" value for every
  body. This value can be set by the user. It must be a very fexible
  value (bool, int, float, vector, array, etc.).

  Example:
  I create a clump, which consists of two hardly overlapping spheres and sometimes I need the volume of the clump (which is not the sum of the volumes of the two spheres in this case). So this could be easily managed by this "extra" value. Where i could set either the volume of the clump as extra value to the clump or i could set the volume fractions as extra values to the spheres.

To manage notifications about this bug go to:
https://bugs.launchpad.net/yade/+bug/1031703/+subscriptions


Follow ups

References