You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment self.elements.moving is an integer array full of 0 and 1. Its purpose is to select operations only for moving elements
I suggest that it becomes a boolean array as such that it can be directly used to modify only the values of moving (or with np.logical_not() "not moving") elements.
For example:
at the moment a lot of operations are made as such
elements.property + self.elements.moving*(mathematic operation)
That implies that all the array is multiplicated by either 0 or 1
whereas if it was a boolean array it would be:
elements.property[self.elements.moving] += mathematic operation
The operation is applied only to the moving elements.
This optimisation can accelerate the copmutations significantly in particular in models where particles appear and desactivate all the time. There is no need for computing the whole elements array
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
At the moment
self.elements.moving
is an integer array full of 0 and 1. Its purpose is to select operations only for moving elementsI suggest that it becomes a boolean array as such that it can be directly used to modify only the values of moving (or with np.logical_not() "not moving") elements.
For example:
elements.property + self.elements.moving*(mathematic operation)
That implies that all the array is multiplicated by either 0 or 1
elements.property[self.elements.moving] += mathematic operation
The operation is applied only to the moving elements.
This optimisation can accelerate the copmutations significantly in particular in models where particles appear and desactivate all the time. There is no need for computing the whole elements array
Beta Was this translation helpful? Give feedback.
All reactions