← Back to team overview

yade-users team mailing list archive

Re: [Question #259419]: How to record the breakage of the cohesion?

 

Ah, sorry, I forgot the isReal check. Your solution is correct, but more
clean way is to put

if not i.isReal: continue

line:

def numBroken():
   ret = 0
   for id1,id2 in intrsOrigIds:
      try:
         i = O.interactions[id1,id2]
         if not i.isReal:
            continue
         if i.phys.cohesionBroken:
            ret += 1
      except IndexError: # the interaction does not exist any more
         ret += 1

cheers
Jan

Follow ups

References