← Back to team overview

yade-dev team mailing list archive

Re: random-access container for interactions

 

Hi, cool!!! I just wanted to hack InteractionVecSet so that interactions
could be accessed randomly with interger index and you've done it before
I did... :-)



> 1. How to set interaction container from python gui?
>   
No easy way... The default container is constructed in
MetaBody::MetaBody() initializers. You could add some method to pyOmega
to switch container to InteractionVecMap.
> 2. How to incorporate random access to Interaction*MetaEngines?
>   
See the loop over all interactions in
InteractionPhysicsMetaEngine::action? It would have to be changed there.
For openMP, you need integer indexing (with constant time access, of
course), so you would loop like this

# pragma omp parallel for
for(long i=0; i<transientInteractions.size() /* or something like that
*/; i++){
   shared_ptr<Interaction>=transientInteractions.getNth(i);
   ...
}

If you can benchmark that openmp loop with OMP_NUM_THREADS==1 is as fast
as non-openmp for, then it could be there by default.
> and PhysicalActionVectorVector::find break a parallel computations because it resize
> physicalActions container.
>   
? It should resize only when number of bodies changes.

Vaclav




Follow ups

References