Skip to content

functions/attributes not reflecting the changes in interaction storage

As pointed out by Jan here (#3 (closed)): https://answers.launchpad.net/yade/+question/212834, the function returning the interactions for a given body Id is iterating on all the interaction container, while we have now access of interactions per-body after Anton's changes.

Then the code below is suboptimal (Body.cpp):

// return list of interactions of this particle
python::list Body::py_intrs(){
 Scene* scene=Omega::instance().getScene().get(); // potentially unsafe with multiple simulations
 python::list ret;
 FOREACH(const shared_ptr<Interaction>& I, *scene->interactions){
  if(!I->isReal()) continue;
  if(I->getId1()==id || I->getId2()==id) ret.append(I);
 }
 return ret;
}

There is also a body attribute that could be updated (or the documentation, at least is outdated):

((MapId2IntrT,intrs,,Attr::hidden,"Map from otherId to Interaction with otherId, managed by InteractionContainer. NOTE: (currently) does not contain all interactions with this body (only those where otherId>id), since performance issues with such data duplication have not yet been investigated."))

Possibly many other places would benefit from a new eye now that each body stores interactions.

Original bug report by Bruno Chareyre on 2013-01-15 : https://bugs.launchpad.net/yade/+bug/1099812

Edited by Janek Kozicki