Detect newly appeared interactions between two states of the same model
Hello everybody,
I want to ask a question about contact detection of two different states of the same specimen. Here is my problem:
I have a saved model, named 'begin.xml', from this specimen, I apply a force and after certain number of iterations, I have the specimen named 'end.xml'.
I want to detect the different interactions in 'begin.xml' and 'end.xml', I sort them into 3 types:
1. Permanent interactions: interaction that stays the same from 'begin' to 'end'
2. Newly formed interactions: interaction that is not available in 'begin', but appears in 'end'
3. Lost interactions: interaction that once was in 'begin' but in 'end' it's no longer available.
And based on that sorting method, I want to extract information from those bodies like positions and forces of the both 'base' and 'end' state. (position as x1, x2 and force as f, if interaction is not available, f=0)
Here is what I drafted for my idea:
O.load('end')
for i in O.interactions:
x_1_end=
x_2_end=
f_end=
O.load('begin')
for j in O.interactions:
if j.id1==i.id1 and j.id2==i.id2: # condition of the permanent interaction
x_
x_
f_
Till this point, this certainly handles the permanent interactions but I don't know how to continue with the lost and new interactions between 'begin' and 'end'. Maybe I might continue my script as:
elif j.id1==i.id1 and j.id2!=i.id2:
x_
x_
f_
elif j.id1!=i.id1 and j.id2==i.id2:...
else:
continue
But I'm not sure this should work (the condition seems silly but I haven't found another better one). So I have questions:
1. How to effectively discriminate those three types of interaction between two states I mentioned above. Most of all the *newly formed interaction* and the *lost interaction*.
2. In which manner YADE sorts the interactions when we loop all over them, I do:
for i in O.interactions:
print i.id1, i.id2
and I see the list is quite in random order, but I do the script again and list is still the same so I convince myself that YADE is using certain sorting method for such looping, is that true? Can you enlighten me on this point?
Thanks in advance!
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Jan Stránský
- Solved:
- Last query:
- Last reply: