← Back to team overview

yade-dev team mailing list archive

Re: removing PhysicalAction genericity?

 

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

So,

vector< vector< shared_ptr<PhysicalAction> > > physicalActions;

(1) will be simply

vector< vector< Vector3r > > physicalActions;

or even 

vector< Vector3r > physicalActions;

i.e. any action should be Vector3r?

(2) or it will be two (and more) separate vectors:

vector< Vector3r > _force;
vector< Vector3r > _momentum;
vector< SomeComplexAction > _complexAction;
etc

with corresponding get-functions:

Vector3r& force(body_id_t);
Vector3r& momentum(body_id_t);
SomeComplexAction& complexAction(body_id_t);

I prefer the case (2) because it is more general. 
But in any case, choosing between the speed and generality, I give my voice for speed.

-- 
Best regards, Sergei D.

Follow ups

References