← Back to team overview

yade-dev team mailing list archive

Re: shared_ptr<PhysicalAction>

 

Václav Šmilauer said:     (by the date of Tue, 17 Feb 2009 13:48:55 +0100)

> 
> >>> memset(action[0],0,sizeof(thisAction)) and perhaps would save some
> >>> shared_ptr overhead we have currently. V.
> >>>       
> >> feel free to experiment.
> >>     
> >
> > you could try memset(.....get(),0,sizeof(thisAction)); maybe?
> >   
> My mistake, I wanted to write
> memset(action[0],0,sizeof(thisAction)*numberOfBodies), that would reset
> the whole array at once, which was the point. What you suggest wouldn't
> be any faster thatn the current was, I think, except the reset() call
> overhead. V.

you would need a separate vector<Force> vector<Moment> etc.. for each
type of physical action to do that. If you just store raw pointers in
a vector it won't work (you know why ;). You cannot store different
types of actions without pointers - because only pointers (shared or
not) provide the polymorphic behaviour.

The only alternative is to have vector<vector<Vector3r> >, and remember
that 0th column is Force, and 1st column is Moment .... In fact we
already remember that - it's the classIndex().

I don't know how good/useful it might be, though. And not possible
currently without some extra work, I recall that come physical
actions are overly complex currently (their data is bigger than
sizeof(Vector3r)).

-- 
Janek Kozicki                                                         |



Follow ups

References