Assign avoidSelfInteractionMask while detecting contacts in compatible group masks

Asked by Vasileios Angelidakis on 2020-01-08

Hi,

I am wondering what is the best way to avoid detecting self interactions for particles inside a group mask and at the same time keep interactions among particles with a different mask, which is compatible with the former one.

For example in the script cubePBscaled.py [1], I want to ignore interactions for the PBs assembling the box (bodies: bbb, bA, bB, bC, bD etc. with mask=3), but I want to keep interactions among bodies with b.mask=1, i.e. the falling cuboids.

Currently, if I set collider.avoidSelfInteractionMask = 3, the contacts among the bodies with b.mask=1 are not detected either, cause masks 1 and 3 have common bits.

To be clear, what I want is:
- to detect possible contact for particles in the group masks: 1-1 (cuboid-cuboid), 1-3 (cuboid-box) and
- to ignore possible contact for particles in the the group mask: 3-3 (box-box).

Looking in Collider.cpp [2], currently we have:
 !( (b1->groupMask == b2->groupMask) && b1->maskCompatible(avoidSelfInteractionMask) )
and I can achieve what I need, using:
 !( (b1->groupMask == b2->groupMask) && b1->groupMask == avoidSelfInteractionMask )

Is there a chance I can introduce a new flag to do this, e.g. "avoidSelfInteractionMaskOnly" or is there a workaround, without changing the collider?

Thanks in advance!
Vasileios

[1] https://gitlab.com/yade-dev/trunk/blob/master/examples/PotentialBlocks/cubePBscaled.py
[2] https://gitlab.com/yade-dev/trunk/blob/master/pkg/common/Collider.cpp#L40

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
2020-01-09
Last query:
2020-01-09
Last reply:
2020-01-08
Best Jan Stránský (honzik) said : #1

Hello,

just make the cuboid-box common bit to be not present in avoidSelfInteractionMask, e.g. avoidSelfInteractionMask=2

currently:
0b01 # 1, cuboid
0b11 # 3, box
0b11 # 3, avoidSelfInteractionMask

proposed (not tested):
0b01 # 1, cuboid
0b11 # 3, box
0b10 # 2, avoidSelfInteractionMask

this should collide 1-1 and 1-3, but igonre 3-3

let us know
cheers
Jan

Hi Jan,

Thank you for your reply!
I tried setting avoidSelfInteractionMask=2, but I still see the 3-3 interactions.

BTW I am using yade-2020-01-08.git-32000c9 on Ubuntu 18.04 LTS.

All the best,
Vasileios

Janek Kozicki (cosurgi) said : #3

Please have a look at scripts/checks-and-tests/checks/checkAvoidSelfInteractionMask.py , maybe this will give you some hint.

Janek thank you for the helpful recommendation; helped me see this more clearly.

Jan, your recommendation absolutely right. I tried again avoidSelfInteractionMask=2 and it works; must have mixed up the masks of the bodies when I tried earlier. :P

Thank you both!!
Vasileios

Thanks Jan Stránský, that solved my question.