It is generally useful to be able to get a particle based on its unique id (e.g. to implement bonds). This can be implemented by having a map from id -> index that is updated whenever particles are inserted, deleted or reordered.
Could use std::map , but this is not suitable for either multithreaded or gpus
custom implementation? At the simplest, could do two key value vectors sorted by key? searches are then log(n), which isn't great, but could be vectorized, and thus suitable for gpus
or combination of the above. choose between gpu, std::map or concurrent options....
I'm currently thinking of implementing the simple custom implementation above for gpus, and falling back on std::map otherwise, just to get the functionality in there. I'm assuming that radial searches are the speed limiting issue for users, and things like bonds are relatively cheap. Later on, more sophisticated implementations can be considered
It is generally useful to be able to get a particle based on its unique id (e.g. to implement bonds). This can be implemented by having a map from id -> index that is updated whenever particles are inserted, deleted or reordered.
std::map
, but this is not suitable for either multithreaded or gpusI'm currently thinking of implementing the simple custom implementation above for gpus, and falling back on std::map otherwise, just to get the functionality in there. I'm assuming that radial searches are the speed limiting issue for users, and things like bonds are relatively cheap. Later on, more sophisticated implementations can be considered