added option to suppress writing of material.config part in header

This commit is contained in:
Philip Eisenlohr 2016-12-06 21:36:25 -05:00
parent f5a10ae480
commit a2db7e9ba1
1 changed files with 18 additions and 12 deletions

View File

@ -178,6 +178,10 @@ parser.add_option_group(group)
group = OptionGroup(parser, "Configuration","") group = OptionGroup(parser, "Configuration","")
group.add_option('--no-config',
dest = 'config',
action = 'store_false',
help = 'omit material configuration header')
group.add_option('--homogenization', group.add_option('--homogenization',
dest = 'homogenization', dest = 'homogenization',
type = 'int', metavar = 'int', type = 'int', metavar = 'int',
@ -203,6 +207,7 @@ parser.set_defaults(pos = 'pos',
cpus = 2, cpus = 2,
laguerre = False, laguerre = False,
nonperiodic = False, nonperiodic = False,
config = True,
) )
(options,filenames) = parser.parse_args() (options,filenames) = parser.parse_args()
@ -303,20 +308,21 @@ for name in filenames:
config_header = [] config_header = []
formatwidth = 1+int(math.log10(NgrainIDs)) formatwidth = 1+int(math.log10(NgrainIDs))
config_header += ['<microstructure>'] if options.config:
for i,ID in enumerate(grainIDs): config_header += ['<microstructure>']
config_header += ['[Grain{}]'.format(str(ID).zfill(formatwidth)), for i,ID in enumerate(grainIDs):
'crystallite {}'.format(options.crystallite),
'(constituent)\tphase {}\ttexture {}\tfraction 1.0'.format(options.phase,str(ID).rjust(formatwidth)),
]
if hasEulers:
config_header += ['<texture>']
for ID in grainIDs:
eulerID = np.nonzero(grains == ID)[0][0] # find first occurrence of this grain id
config_header += ['[Grain{}]'.format(str(ID).zfill(formatwidth)), config_header += ['[Grain{}]'.format(str(ID).zfill(formatwidth)),
'(gauss)\tphi1 {:g}\tPhi {:g}\tphi2 {:g}\tscatter 0.0\tfraction 1.0'.format(*eulers[eulerID]) 'crystallite {}'.format(options.crystallite),
'(constituent)\tphase {}\ttexture {}\tfraction 1.0'.format(options.phase,str(ID).rjust(formatwidth)),
] ]
if options.axes is not None: config_header.append('axes\t{} {} {}'.format(*options.axes)) if hasEulers:
config_header += ['<texture>']
for ID in grainIDs:
eulerID = np.nonzero(grains == ID)[0][0] # find first occurrence of this grain id
config_header += ['[Grain{}]'.format(str(ID).zfill(formatwidth)),
'(gauss)\tphi1 {:g}\tPhi {:g}\tphi2 {:g}\tscatter 0.0\tfraction 1.0'.format(*eulers[eulerID])
]
if options.axes is not None: config_header.append('axes\t{} {} {}'.format(*options.axes))
table.labels_clear() table.labels_clear()
table.info_clear() table.info_clear()