← Back to team overview

yade-users team mailing list archive

Re: [Question #691584]: About periodic simple shear

 

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

    Status: Open => Answered

Jan Stránský proposed the following answer:
Hello,

> I am a new user for yade

welcome :-)

next time please provide also a link to the script

This pattern is to easy switch between two different scenarios
Suppose:
###
if 0:
   createLoosePacking() # possibly a long code block
else:
   createDensePacking() # possibly a long code block
###

As it is, with "if 0:", is equivalent to (as the "if 0:" block is never executed and therefore "else" is always executed):
createDensePacking() # possibly a long code block

If you change it to
###
if 1:
   createLoosePacking() # possibly a long code block
else:
   createDensePacking() # possibly a long code block
###

then it is equivalent to (as "if 1" is always executed and therefore "else" is never executed):
createLoosePacking() # possibly a long code block

This way you can choose one scenario or the other just by altering 0/1
after the "if" keyword.

HTH
cheers
Jan

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.