[Yade-dev] [Bug 1031703] Re: extra value for bodies

2015-02-28 Thread Christian Jakob
** Changed in: yade
   Status: New = Invalid

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

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

___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


[Yade-dev] [Bug 1031703] Re: extra value for bodies

2012-08-02 Thread Chareyre
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

___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-dev] [Bug 1031703] Re: extra value for bodies

2012-08-02 Thread Jan Stránský
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

___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


[Yade-dev] [Bug 1031703] Re: extra value for bodies

2012-08-02 Thread Chareyre
3/ store the string representation of desired variable

Yes that one too. I aprooved when I read it but didn't recall it.
Not sure it would be easier than void pointer though, since it would need a lot 
of typecasting.
Your example is ok in python but the vector3 can't be used in c++ at this 
point. Getting arbitrary types from a string in c++ is another story.
I guess Christian has in mind to use e.g. clump volume in some c++ algorithm 
(right?), else there is little interest in adding variables to bodies.

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

___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


[Yade-dev] [Bug 1031703] Re: extra value for bodies

2012-08-02 Thread Chareyre
Another option is to keep the data outside bodies in  a separate table.
Saving a table is no big deal, and it doesn't waste memory when the
table is empty.

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

___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Yade-dev] [Bug 1031703] Re: extra value for bodies

2012-08-02 Thread Jan Stránský
2012/8/2 Chareyre 1031...@bugs.launchpad.net

 3/ store the string representation of desired variable

 Yes that one too. I aprooved when I read it but didn't recall it.
 Not sure it would be easier than void pointer though, since it would need
 a lot of typecasting.
 Your example is ok in python but the vector3 can't be used in c++ at this
 point. Getting arbitrary types from a string in c++ is another story.
 I guess Christian has in mind to use e.g. clump volume in some c++
 algorithm (right?), else there is little interest in adding variables to
 bodies.


I was just thinking about using it in python, if it is supposed to be used
in c++, then my solution definitely isn't the best one :-)
Jan
___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp