removed handling for old legacy format (we might introduce a new one)
This commit is contained in:
parent
9e824d029e
commit
913c5347a5
|
@ -523,15 +523,12 @@ def ParseOutputFormat(filename,what,me):
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
def ParsePostfile(p,filename, outputFormat, legacyFormat):
|
def ParsePostfile(p,filename, outputFormat):
|
||||||
#
|
#
|
||||||
# parse postfile in order to get position and labels of outputs
|
# parse postfile in order to get position and labels of outputs
|
||||||
# needs "outputFormat" for mapping of output names to postfile output indices
|
# needs "outputFormat" for mapping of output names to postfile output indices
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
|
|
||||||
startVar = {True: 'GrainCount',
|
|
||||||
False:'HomogenizationCount'}
|
|
||||||
|
|
||||||
# --- build statistics
|
# --- build statistics
|
||||||
|
|
||||||
stat = { \
|
stat = { \
|
||||||
|
@ -567,21 +564,17 @@ def ParsePostfile(p,filename, outputFormat, legacyFormat):
|
||||||
stat['LabelOfElementalTensor'][labelIndex] = label
|
stat['LabelOfElementalTensor'][labelIndex] = label
|
||||||
|
|
||||||
if 'User Defined Variable 1' in stat['IndexOfLabel']: # output format without dedicated names?
|
if 'User Defined Variable 1' in stat['IndexOfLabel']: # output format without dedicated names?
|
||||||
stat['IndexOfLabel'][startVar[legacyFormat]] = stat['IndexOfLabel']['User Defined Variable 1'] # adjust first named entry
|
stat['IndexOfLabel']['HomogenizationCount'] = stat['IndexOfLabel']['User Defined Variable 1'] # adjust first named entry
|
||||||
|
|
||||||
if startVar[legacyFormat] in stat['IndexOfLabel']: # does the result file contain relevant user defined output at all?
|
if 'HomogenizationCount' in stat['IndexOfLabel']: # does the result file contain relevant user defined output at all?
|
||||||
startIndex = stat['IndexOfLabel'][startVar[legacyFormat]]
|
startIndex = stat['IndexOfLabel']['HomogenizationCount']
|
||||||
stat['LabelOfElementalScalar'][startIndex] = startVar[legacyFormat]
|
stat['LabelOfElementalScalar'][startIndex] = 'HomogenizationCount'
|
||||||
|
|
||||||
# We now have to find a mapping for each output label as defined in the .output* files to the output position in the post file
|
# We now have to find a mapping for each output label as defined in the .output* files to the output position in the post file
|
||||||
# Since we know where the user defined outputs start ("startIndex"), we can simply assign increasing indices to the labels
|
# Since we know where the user defined outputs start ("startIndex"), we can simply assign increasing indices to the labels
|
||||||
# given in the .output* file
|
# given in the .output* file
|
||||||
|
|
||||||
offset = 1
|
offset = 1
|
||||||
if legacyFormat:
|
|
||||||
stat['LabelOfElementalScalar'][startIndex + offset] = startVar[not legacyFormat] # add HomogenizationCount as second
|
|
||||||
offset += 1
|
|
||||||
|
|
||||||
for (name,N) in outputFormat['Homogenization']['outputs']:
|
for (name,N) in outputFormat['Homogenization']['outputs']:
|
||||||
for i in range(N):
|
for i in range(N):
|
||||||
label = {False: '%s'%( name),
|
label = {False: '%s'%( name),
|
||||||
|
@ -589,20 +582,18 @@ def ParsePostfile(p,filename, outputFormat, legacyFormat):
|
||||||
stat['IndexOfLabel'][label] = startIndex + offset
|
stat['IndexOfLabel'][label] = startIndex + offset
|
||||||
stat['LabelOfElementalScalar'][startIndex + offset] = label
|
stat['LabelOfElementalScalar'][startIndex + offset] = label
|
||||||
offset += 1
|
offset += 1
|
||||||
|
stat['IndexOfLabel']['GrainCount'] = startIndex + offset
|
||||||
if not legacyFormat:
|
stat['LabelOfElementalScalar'][startIndex + offset] = 'GrainCount' # add GrainCount
|
||||||
stat['IndexOfLabel'][startVar[not legacyFormat]] = startIndex + offset
|
offset += 1
|
||||||
stat['LabelOfElementalScalar'][startIndex + offset] = startVar[not legacyFormat] # add GrainCount
|
|
||||||
offset += 1
|
|
||||||
|
|
||||||
if '(ngrains)' in outputFormat['Homogenization']['specials']:
|
if '(ngrains)' in outputFormat['Homogenization']['specials']:
|
||||||
for grain in range(outputFormat['Homogenization']['specials']['(ngrains)']):
|
for grain in range(outputFormat['Homogenization']['specials']['(ngrains)']):
|
||||||
|
|
||||||
stat['IndexOfLabel']['%i_CrystalliteCount'%(grain+1)] = startIndex + offset # report crystallite count
|
stat['IndexOfLabel']['%i_CrystalliteCount'%(grain+1)] = startIndex + offset # report crystallite count
|
||||||
stat['LabelOfElementalScalar'][startIndex + offset] = '%i_CrystalliteCount'%(grain+1) # add GrainCount
|
stat['LabelOfElementalScalar'][startIndex + offset] = '%i_CrystalliteCount'%(grain+1) # add GrainCount
|
||||||
offset += 1
|
offset += 1
|
||||||
|
|
||||||
for (name,N) in outputFormat['Crystallite']['outputs']: # add crystallite outputs
|
for (name,N) in outputFormat['Crystallite']['outputs']: # add crystallite outputs
|
||||||
for i in range(N):
|
for i in range(N):
|
||||||
label = {False: '%i_%s'%(grain+1, name),
|
label = {False: '%i_%s'%(grain+1, name),
|
||||||
True:'%i_%i_%s'%(grain+1,i+1,name)}[N > 1]
|
True:'%i_%i_%s'%(grain+1,i+1,name)}[N > 1]
|
||||||
|
@ -673,8 +664,6 @@ of already processed data points for evaluation.
|
||||||
|
|
||||||
parser.add_option('-i','--info', action='store_true', dest='info', \
|
parser.add_option('-i','--info', action='store_true', dest='info', \
|
||||||
help='list contents of resultfile [%default]')
|
help='list contents of resultfile [%default]')
|
||||||
parser.add_option('-l','--legacy', action='store_true', dest='legacy', \
|
|
||||||
help='legacy user result block (starts with GrainCount) [%default]')
|
|
||||||
parser.add_option('-n','--nodal', action='store_true', dest='nodal', \
|
parser.add_option('-n','--nodal', action='store_true', dest='nodal', \
|
||||||
help='data is extrapolated to nodal value [%default]')
|
help='data is extrapolated to nodal value [%default]')
|
||||||
parser.add_option( '--prefix', dest='prefix', \
|
parser.add_option( '--prefix', dest='prefix', \
|
||||||
|
@ -734,7 +723,6 @@ parser.add_option_group(group_general)
|
||||||
parser.add_option_group(group_special)
|
parser.add_option_group(group_special)
|
||||||
|
|
||||||
parser.set_defaults(info = False)
|
parser.set_defaults(info = False)
|
||||||
parser.set_defaults(legacy = False)
|
|
||||||
parser.set_defaults(nodal = False)
|
parser.set_defaults(nodal = False)
|
||||||
parser.set_defaults(prefix = '')
|
parser.set_defaults(prefix = '')
|
||||||
parser.set_defaults(suffix = '')
|
parser.set_defaults(suffix = '')
|
||||||
|
@ -849,7 +837,7 @@ for what in me:
|
||||||
bg.set_message('opening result file...')
|
bg.set_message('opening result file...')
|
||||||
p = OpenPostfile(filename+extension,options.filetype,options.nodal)
|
p = OpenPostfile(filename+extension,options.filetype,options.nodal)
|
||||||
bg.set_message('parsing result file...')
|
bg.set_message('parsing result file...')
|
||||||
stat = ParsePostfile(p, filename, outputFormat,options.legacy)
|
stat = ParsePostfile(p, filename, outputFormat)
|
||||||
if options.filetype == 'marc':
|
if options.filetype == 'marc':
|
||||||
stat['NumberOfIncrements'] -= 1 # t16 contains one "virtual" increment (at 0)
|
stat['NumberOfIncrements'] -= 1 # t16 contains one "virtual" increment (at 0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue