← Back to team overview

yade-dev team mailing list archive

Re: [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
>
>
3/ store the string representation of desired variable (as suggested a few
mails above). From my point of view it would be the least effort and for
the same functionality. Example:


Yade [1]: b = utils.sphere((1,2,3),4)

Yade [2]: O.bodies.append(b)
 ->  [2]: 0

Yade [3]: a = Vector3(1,2,3)

Yade [4]: b.extra = repr(a)

Yade [5]: b.extra
 ->  [5]: 'Vector3(1,2,3)'

Yade [6]: c = eval(b.extra)

Yade [7]: c
 ->  [7]: Vector3(1,2,3)

Yade [8]: a + c
 ->  [8]: Vector3(2,4,6)


Jan

-- 
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


References