Question #682290 on Yade changed: https://answers.launchpad.net/yade/+question/682290
Bruno Chareyre proposed the following answer: I tried again with yadedaily (2018.02b-290bf6a54e~xenial), the results are correct again. @Luc, can't you try on a different computer to be sure we are on the same page? I can't imagine that compiler options change the behavior of bitwise operators... @Jan, > "by luck" because avoidSelfInteractionMask is defined as static Interesting... I wonder why it was defined static at all (probably off-topic though). Jan's script made me realize my mistake, correct list in #12 was: - if you set avoidSelf=1 you kill the 1-1 and 3-3 interactions. - if you set avoidSelf=2 you kill the 2-2 and 3-3 interactions. - if you set avoidSelf=3 you kill 1-1, 2-2, and 3-3; only 3-1 and 3-2 are left. Below is a modified script which will not break python interpreter (and is Python3 friendly). Note the explicit call to collider and interactions.all() to get virtual interactions. ### # mask values, "colors" mb,mg,mr = 0b10, 0b01, 0b11 # mask to string dict m2c = {mb:"b", mg:"g", mr:"r"} # testing spheres, 2 of each color sb1 = sphere((0,0,0),1,mask=mb) sb2 = sphere((0,0.1,0),1,mask=mb) sg1 = sphere((0.1,0,0),1,mask=mg) sg2 = sphere((0,0,0.1),1,mask=mg) sr1 = sphere((-0.1,0,0),1,mask=mr) sr2 = sphere((0,-0.1,0),1,mask=mr) O.bodies.append((sb1,sb2,sg1,sg2,sr1,sr2)) # collider.avoidSelfInteractionMask = 0b00 collider.boundDispatcher.__call__() collider.__call__() idss = [(i.id1,i.id2) for i in O.interactions.all()] # id couples for each interaction bss = [[O.bodies[i] for i in ids] for ids in idss] # body couple of each interaction mss = [[b.mask for b in bs] for bs in bss] # mask couple of each interaction mss = [tuple(sorted(ms)) for ms in mss] # make the mask couple of type tuple (needs by set below). Also sort it for proper deletion of duplicates mss = set(mss) # make the entries unique (i.e. deleting duplicates) css = ["".join(m2c[m] for m in ms) for ms in mss] # convert mask couples to strings css.sort() # sort the result css = " ".join(css) # make it one string print(css) # print interacting color couples ### -- You received this question notification because your team yade-users is an answer contact for Yade. _______________________________________________ Mailing list: https://launchpad.net/~yade-users Post to : yade-users@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-users More help : https://help.launchpad.net/ListHelp