Re: [Yade-dev] shared_ptrPhysicalAction
Václav Šmilauer said: (by the date of Tue, 17 Feb 2009 08:38:07 +0100) Hi there, any reason PhysicalActionContainer contains shared_ptr's? Wouldn't it be better to contain just array of PhysicalActions? It would allow for very fast resetting with memset(action[0],0,sizeof(thisAction)) and perhaps would save some shared_ptr overhead we have currently. V. the only reason was we use shared_ptr everywhere, because we're too stupid to manage memory leaks. afaik, shared_ptr provides some lock free mechanisms, but I didn't check. feel free to experiment. -- Janek Kozicki | ___ 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] shared_ptrPhysicalAction
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 vectorForce vectorMoment 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 vectorvectorVector3r , 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 | ___ 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] shared_ptrPhysicalAction
Václav Šmilauer a écrit : Hi there, any reason PhysicalActionContainer contains shared_ptr's? Wouldn't it be better to contain just array of PhysicalActions? It would allow for very fast resetting with memset(action[0],0,sizeof(thisAction)) and perhaps would save some shared_ptr overhead we have currently. V. I thought it would be used for parallelisation. If not, I'm all for removing shared_pointers when it is possible. B. ___ 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 -- ___ Chareyre Bruno Maitre de conference Grenoble INP Laboratoire 3SR - bureau E145 BP 53 - 38041, Grenoble cedex 9 - France Tél : 33 4 56 52 86 21 Fax : 33 4 76 82 70 43 ___ 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] shared_ptrPhysicalAction
Hi there, any reason PhysicalActionContainer contains shared_ptr's? Wouldn't it be better to contain just array of PhysicalActions? It would allow for very fast resetting with memset(action[0],0,sizeof(thisAction)) and perhaps would save some shared_ptr overhead we have currently. V. ___ 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