added flag for skipping right-handedness check of eigenvector basis

separate names for min,mid,max eigvals and vecs
This commit is contained in:
Unknown 2017-07-28 13:44:17 -04:00
parent 68d0b5c6b4
commit 269eacb11d
1 changed files with 14 additions and 6 deletions

View File

@ -22,7 +22,13 @@ parser.add_option('-t','--tensor',
dest = 'tensor',
action = 'extend', metavar = '<string LIST>',
help = 'heading of columns containing tensor field values')
parser.add_option('--no-check',
dest = 'rh',
action = 'store_false',
help = 'skip check for right-handed eigenvector basis')
parser.set_defaults(rh = True,
)
(options,filenames) = parser.parse_args()
if options.tensor is None:
@ -57,8 +63,10 @@ for name in filenames:
if dim != data['dim']: remarks.append('column {} is not a {}...'.format(what,type))
else:
items[type]['column'].append(table.label_index(what))
table.labels_append(['{}_eigval({})'.format(i+1,what) for i in range(3)]) # extend ASCII header with new labels
table.labels_append(['{}_eigvec({})'.format(i+1,what) for i in range(9)]) # extend ASCII header with new labels
for order in ['Min','Mid','Max']:
table.labels_append(['eigval{}({})'.format(order,what)]) # extend ASCII header with new labels
for order in ['Min','Mid','Max']:
table.labels_append(['{}_eigvec{}({})'.format(i+1,order,what) for i in range(3)]) # extend ASCII header with new labels
if remarks != []: damask.util.croak(remarks)
if errors != []:
@ -78,10 +86,10 @@ for name in filenames:
for type, data in items.iteritems():
for column in data['column']:
(u,v) = np.linalg.eigh(np.array(map(float,table.data[column:column+data['dim']])).reshape(data['shape']))
if np.dot(np.cross(v[:,0], v[:,1]), v[:,2]) < 0.0 : v[:, 2] *= -1.0 # ensure right-handed coordinate system
table.data_append(list(u))
table.data_append(list(v.transpose().reshape(data['dim'])))
outputAlive = table.data_write() # output processed line
if options.rh and np.dot(np.cross(v[:,0], v[:,1]), v[:,2]) < 0.0 : v[:, 2] *= -1.0 # ensure right-handed eigenvector basis
table.data_append(list(u)) # vector of max,mid,min eigval
table.data_append(list(v.transpose().reshape(data['dim']))) # 3x3=9 combo vector of max,mid,min eigvec coordinates
outputAlive = table.data_write() # output processed line in accordance with column labeling
# ------------------------------------------ output finalization -----------------------------------