← Back to team overview

yade-users team mailing list archive

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

 

Question #259419 on Yade changed:
https://answers.launchpad.net/yade/+question/259419

    Status: Open => Answered

Jan Stránský proposed the following answer:
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

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.