polishing

This commit is contained in:
Martin Diehl 2019-11-27 08:44:38 +01:00
parent 882a11c5f8
commit eb033e11b2
3 changed files with 10 additions and 14 deletions

View File

@ -35,7 +35,6 @@ parser.set_defaults(defgrad = 'f',
) )
(options,filenames) = parser.parse_args() (options,filenames) = parser.parse_args()
if filenames == []: filenames = [None] if filenames == []: filenames = [None]
for name in filenames: for name in filenames:
@ -45,5 +44,6 @@ for name in filenames:
table.add_array('Cauchy', table.add_array('Cauchy',
damask.mechanics.Cauchy(table.get_array(options.defgrad).reshape(-1,3,3), damask.mechanics.Cauchy(table.get_array(options.defgrad).reshape(-1,3,3),
table.get_array(options.stress).reshape(-1,3,3)).reshape(-1,9), table.get_array(options.stress).reshape(-1,3,3)).reshape(-1,9),
scriptID) scriptID+' '+' '.join(sys.argv[1:]))
table.to_ASCII(sys.stdout if name is None else name) table.to_ASCII(sys.stdout if name is None else name)

View File

@ -27,14 +27,11 @@ parser.add_option('-t','--tensor',
help = 'heading of columns containing tensor field values') help = 'heading of columns containing tensor field values')
(options,filenames) = parser.parse_args() (options,filenames) = parser.parse_args()
if filenames == []: filenames = [None]
if options.tensor is None: if options.tensor is None:
parser.error('no data column specified.') parser.error('no data column specified.')
# --- loop over input files -------------------------------------------------------------------------
if filenames == []: filenames = [None]
for name in filenames: for name in filenames:
damask.util.report(scriptName,name) damask.util.report(scriptName,name)
@ -42,5 +39,6 @@ for name in filenames:
for tensor in options.tensor: for tensor in options.tensor:
table.add_array('det({})'.format(tensor), table.add_array('det({})'.format(tensor),
np.linalg.det(table.get_array(tensor).reshape(-1,3,3)), np.linalg.det(table.get_array(tensor).reshape(-1,3,3)),
scriptID) scriptID+' '+' '.join(sys.argv[1:]))
table.to_ASCII(sys.stdout if name is None else name) table.to_ASCII(sys.stdout if name is None else name)

View File

@ -30,13 +30,10 @@ parser.add_option('-s','--spherical',
help = 'report spherical part of tensor (hydrostatic component, pressure)') help = 'report spherical part of tensor (hydrostatic component, pressure)')
(options,filenames) = parser.parse_args() (options,filenames) = parser.parse_args()
if filenames == []: filenames = [None]
if options.tensor is None: if options.tensor is None:
parser.error('no data column specified...') parser.error('no data column specified...')
# --- loop over input files -------------------------------------------------------------------------
if filenames == []: filenames = [None]
for name in filenames: for name in filenames:
damask.util.report(scriptName,name) damask.util.report(scriptName,name)
@ -45,9 +42,10 @@ for name in filenames:
for tensor in options.tensor: for tensor in options.tensor:
table.add_array('dev({})'.format(tensor), table.add_array('dev({})'.format(tensor),
damask.mechanics.deviatoric_part(table.get_array(tensor).reshape(-1,3,3)).reshape((-1,9)), damask.mechanics.deviatoric_part(table.get_array(tensor).reshape(-1,3,3)).reshape((-1,9)),
scriptID) scriptID+' '+' '.join(sys.argv[1:]))
if options.spherical: if options.spherical:
table.add_array('sph({})'.format(tensor), table.add_array('sph({})'.format(tensor),
damask.mechanics.spherical_part(table.get_array(tensor).reshape(-1,3,3)), damask.mechanics.spherical_part(table.get_array(tensor).reshape(-1,3,3)),
scriptID) scriptID+' '+' '.join(sys.argv[1:]))
table.to_ASCII(sys.stdout if name is None else name) table.to_ASCII(sys.stdout if name is None else name)