← Back to team overview

yade-dev team mailing list archive

removing PhysicalAction genericity?

 

Hi,

I would like to have some discussion whether it would be OK to remove
generic PhysicalAction approach and replace it by handful of hard-coded
physical actions. Now, there is just Force and Momentum (and Stiffness,
which doesn't really count) and there was not anything added since I
remember. It would be much simpler to ask PhysicalActionContainer for
Force or Momentum (both Vector3r&) directly instead of the current
approach. If someone wanted to add his own PhysicalAction, he/she would
have to modify the container (easy).

Otherwise, in order to remove unnecessary shared_ptr's, each
PhysicalAction class would define something like dataSize()
(==sizeof(Vector3r) for both Force and Momentum) and the container would
return void* address that the user (or some helper function) would have
to cast to Vector3r*. In this case, the PhysicalAction object would
really only serve as holder of the class index, since the data would be
written directly to the container's arrays.

Which approach is better? Have another idea?

Vaclav



Follow ups