simplified boolean dictionaries to “if else” constructs.

This commit is contained in:
Philip Eisenlohr 2015-05-21 00:13:11 +00:00
parent acc2cb656b
commit df5dd98576
1 changed files with 6 additions and 8 deletions

View File

@ -631,8 +631,7 @@ def ParsePostfile(p,filename, outputFormat):
for (name,N) in outputFormat['Crystallite']['outputs']: # add crystallite outputs
for i in range(N):
label = {False: '%i_%s'%(grain+1, name),
True:'%i_%i_%s'%(grain+1,i+1,name)}[N > 1]
label = '%i_'%(grain+1) + '%i_'%(i+1) if N>1 else '' + name
stat['IndexOfLabel'][label] = startIndex + offset
stat['LabelOfElementalScalar'][startIndex + offset] = label
offset += 1
@ -643,8 +642,7 @@ def ParsePostfile(p,filename, outputFormat):
for (name,N) in outputFormat['Constitutive']['outputs']: # add constitutive outputs
for i in range(N):
label = {False: '%i_%s'%(grain+1, name),
True:'%i_%i_%s'%(grain+1,i+1,name)}[N > 1]
label = '%i_'%(grain+1) + ('%i_'%(i+1) if N>1 else '') + name
stat['IndexOfLabel'][label] = startIndex + offset
try:
stat['LabelOfElementalScalar'][startIndex + offset] = label