use 1_ip instead of ip.x
Old format still as fallback option to support legacy files
This commit is contained in:
parent
6b0a2ed5a4
commit
271c9eed8b
|
@ -58,10 +58,13 @@ for file in files:
|
||||||
|
|
||||||
# --------------- figure out size and grid ---------------------------------------------------------
|
# --------------- figure out size and grid ---------------------------------------------------------
|
||||||
try:
|
try:
|
||||||
locationCol = table.labels.index('%s.x'%options.coords) # columns containing location data
|
locationCol = table.labels.index('1_%s'%options.coords) # columns containing location data
|
||||||
except ValueError:
|
except ValueError:
|
||||||
file['croak'].write('no coordinate data (%s.x) found...\n'%options.coords)
|
try:
|
||||||
continue
|
locationCol = table.labels.index('%s.x'%options.coords) # columns containing location data (legacy naming scheme)
|
||||||
|
except ValueError:
|
||||||
|
file['croak'].write('no coordinate data (1_%s/%s.x) found...\n'%(options.coords,options.coords))
|
||||||
|
continue
|
||||||
|
|
||||||
coords = [{},{},{}]
|
coords = [{},{},{}]
|
||||||
while table.data_read(): # read next data line of ASCII table
|
while table.data_read(): # read next data line of ASCII table
|
||||||
|
@ -101,7 +104,7 @@ for file in files:
|
||||||
|
|
||||||
# ------------------------------------------ read deformation gradient field -----------------------
|
# ------------------------------------------ read deformation gradient field -----------------------
|
||||||
table.data_rewind()
|
table.data_rewind()
|
||||||
F = np.array([0.0 for i in xrange(N*9)]).reshape([3,3]+list(grid))
|
F = np.zeros(N*9,'d').reshape([3,3]+list(grid))
|
||||||
idx = 0
|
idx = 0
|
||||||
while table.data_read():
|
while table.data_read():
|
||||||
(x,y,z) = damask.util.gridLocation(idx,grid) # figure out (x,y,z) position from line count
|
(x,y,z) = damask.util.gridLocation(idx,grid) # figure out (x,y,z) position from line count
|
||||||
|
|
|
@ -62,10 +62,13 @@ for file in files:
|
||||||
|
|
||||||
# --------------- figure out size and grid ---------------------------------------------------------
|
# --------------- figure out size and grid ---------------------------------------------------------
|
||||||
try:
|
try:
|
||||||
locationCol = table.labels.index('%s.x'%options.coords) # columns containing location data
|
locationCol = table.labels.index('1_%s'%options.coords) # columns containing location data
|
||||||
except ValueError:
|
except ValueError:
|
||||||
file['croak'].write('no coordinate data (%s.x) found...\n'%options.coords)
|
try:
|
||||||
continue
|
locationCol = table.labels.index('%s.x'%options.coords) # columns containing location data (legacy naming scheme)
|
||||||
|
except ValueError:
|
||||||
|
file['croak'].write('no coordinate data (1_%s/%s.x) found...\n'%(options.coords,options.coords))
|
||||||
|
continue
|
||||||
|
|
||||||
coords = [{},{},{}]
|
coords = [{},{},{}]
|
||||||
while table.data_read(): # read next data line of ASCII table
|
while table.data_read(): # read next data line of ASCII table
|
||||||
|
|
|
@ -24,11 +24,8 @@ parser.add_option('-c','--coordinates', dest='coords', metavar='string',
|
||||||
help='column heading for coordinates [%default]')
|
help='column heading for coordinates [%default]')
|
||||||
parser.add_option('-f','--defgrad', dest='defgrad', metavar='string',
|
parser.add_option('-f','--defgrad', dest='defgrad', metavar='string',
|
||||||
help='heading of columns containing tensor field values')
|
help='heading of columns containing tensor field values')
|
||||||
parser.add_option('-l', '--linear', dest='linearreconstruction', action='store_true',
|
|
||||||
help='use linear reconstruction of geometry [%default]')
|
|
||||||
parser.set_defaults(coords = 'ip')
|
parser.set_defaults(coords = 'ip')
|
||||||
parser.set_defaults(defgrad = 'f' )
|
parser.set_defaults(defgrad = 'f' )
|
||||||
parser.set_defaults(linearreconstruction = False)
|
|
||||||
|
|
||||||
(options,filenames) = parser.parse_args()
|
(options,filenames) = parser.parse_args()
|
||||||
|
|
||||||
|
@ -55,10 +52,13 @@ for file in files:
|
||||||
|
|
||||||
# --------------- figure out size and grid ---------------------------------------------------------
|
# --------------- figure out size and grid ---------------------------------------------------------
|
||||||
try:
|
try:
|
||||||
locationCol = table.labels.index('%s.x'%options.coords) # columns containing location data
|
locationCol = table.labels.index('1_%s'%options.coords) # columns containing location data
|
||||||
except ValueError:
|
except ValueError:
|
||||||
file['croak'].write('no coordinate data (%s.x) found...\n'%options.coords)
|
try:
|
||||||
continue
|
locationCol = table.labels.index('%s.x'%options.coords) # columns containing location data (legacy naming scheme)
|
||||||
|
except ValueError:
|
||||||
|
file['croak'].write('no coordinate data (1_%s/%s.x) found...\n'%(options.coords,options.coords))
|
||||||
|
continue
|
||||||
|
|
||||||
coords = [{},{},{}]
|
coords = [{},{},{}]
|
||||||
while table.data_read(): # read next data line of ASCII table
|
while table.data_read(): # read next data line of ASCII table
|
||||||
|
@ -106,10 +106,7 @@ for file in files:
|
||||||
|
|
||||||
# ------------------------------------------ calculate coordinates ---------------------------------
|
# ------------------------------------------ calculate coordinates ---------------------------------
|
||||||
Favg = damask.core.math.tensorAvg(F)
|
Favg = damask.core.math.tensorAvg(F)
|
||||||
if options.linearreconstruction:
|
centroids = damask.core.mesh.deformedCoordsFFT(size,F,Favg)
|
||||||
centroids = damask.core.mesh.deformedCoordsLin(size,F,Favg)
|
|
||||||
else:
|
|
||||||
centroids = damask.core.mesh.deformedCoordsFFT(size,F,Favg)
|
|
||||||
|
|
||||||
# ------------------------------------------ process data ------------------------------------------
|
# ------------------------------------------ process data ------------------------------------------
|
||||||
table.data_rewind()
|
table.data_rewind()
|
||||||
|
|
|
@ -78,9 +78,9 @@ for file in files:
|
||||||
locationCol = table.labels.index('1_%s'%options.coords) # columns containing location data
|
locationCol = table.labels.index('1_%s'%options.coords) # columns containing location data
|
||||||
except ValueError:
|
except ValueError:
|
||||||
try:
|
try:
|
||||||
locationCol = table.labels.index('1_%s'%options.coords) # columns containing location data
|
locationCol = table.labels.index('%s.x'%options.coords) # columns containing location data (legacy naming scheme)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
file['croak'].write('no coordinate data (1_%s/%s.x) found...\n'%(options.coords,options.coords)
|
file['croak'].write('no coordinate data (1_%s/%s.x) found...\n'%(options.coords,options.coords))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
coords = [{},{},{}]
|
coords = [{},{},{}]
|
||||||
|
|
|
@ -133,12 +133,15 @@ for file in files:
|
||||||
table.head_read() # read ASCII header info
|
table.head_read() # read ASCII header info
|
||||||
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
|
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
|
||||||
|
|
||||||
# --------------- figure out position of labels and coordinates ------------------------------------
|
# --------------- figure out size and grid ---------------------------------------------------------
|
||||||
try:
|
try:
|
||||||
locationCol = table.labels.index('%s.x'%options.coords) # columns containing location data
|
locationCol = table.labels.index('1_%s'%options.coords) # columns containing location data
|
||||||
except ValueError:
|
except ValueError:
|
||||||
file['croak'].write('no coordinate data (%s.x) found...\n'%options.coords)
|
try:
|
||||||
continue
|
locationCol = table.labels.index('%s.x'%options.coords) # columns containing location data (legacy naming scheme)
|
||||||
|
except ValueError:
|
||||||
|
file['croak'].write('no coordinate data (1_%s/%s.x) found...\n'%(options.coords,options.coords))
|
||||||
|
continue
|
||||||
|
|
||||||
if options.id not in table.labels:
|
if options.id not in table.labels:
|
||||||
file['croak'].write('column %s not found...\n'%options.id)
|
file['croak'].write('column %s not found...\n'%options.id)
|
||||||
|
|
|
@ -59,11 +59,13 @@ for file in files:
|
||||||
|
|
||||||
# --------------- figure out size and grid ---------------------------------------------------------
|
# --------------- figure out size and grid ---------------------------------------------------------
|
||||||
try:
|
try:
|
||||||
locationCol = table.labels.index('%s.x'%options.coords) # columns containing location data
|
locationCol = table.labels.index('1_%s'%options.coords) # columns containing location data
|
||||||
elemCol = table.labels.index('elem')
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
file['croak'].write('no coordinate (%s.x) and/or elem data found...\n'%options.coords)
|
try:
|
||||||
continue
|
locationCol = table.labels.index('%s.x'%options.coords) # columns containing location data (legacy naming scheme)
|
||||||
|
except ValueError:
|
||||||
|
file['croak'].write('no coordinate data (1_%s/%s.x) found...\n'%(options.coords,options.coords))
|
||||||
|
continue
|
||||||
|
|
||||||
if (any(options.grid)==0 or any(options.size)==0.0):
|
if (any(options.grid)==0 or any(options.size)==0.0):
|
||||||
coords = [{},{},{}]
|
coords = [{},{},{}]
|
||||||
|
|
|
@ -54,11 +54,14 @@ for file in files:
|
||||||
|
|
||||||
# --------------- figure out size and grid ---------------------------------------------------------
|
# --------------- figure out size and grid ---------------------------------------------------------
|
||||||
try:
|
try:
|
||||||
locationCol = table.labels.index('%s.x'%options.coords) # columns containing location data
|
|
||||||
elemCol = table.labels.index('elem')
|
elemCol = table.labels.index('elem')
|
||||||
|
locationCol = table.labels.index('1_%s'%options.coords) # columns containing location data
|
||||||
except ValueError:
|
except ValueError:
|
||||||
file['croak'].write('no coordinate (%s.x) and/or elem data found...\n'%options.coords)
|
try:
|
||||||
continue
|
locationCol = table.labels.index('%s.x'%options.coords) # columns containing location data (legacy naming scheme)
|
||||||
|
except ValueError:
|
||||||
|
file['croak'].write('no coordinate (1_%s/%s.x) and/or elem data found...\n'%(options.coords,options.coords))
|
||||||
|
continue
|
||||||
|
|
||||||
if (any(options.grid)==0 or any(options.size)==0.0):
|
if (any(options.grid)==0 or any(options.size)==0.0):
|
||||||
coords = [{},{},{}]
|
coords = [{},{},{}]
|
||||||
|
|
|
@ -73,12 +73,15 @@ for file in files:
|
||||||
'\t' + ' '.join(sys.argv[1:]))
|
'\t' + ' '.join(sys.argv[1:]))
|
||||||
|
|
||||||
|
|
||||||
|
# --------------- figure out size and grid ---------------------------------------------------------
|
||||||
try:
|
try:
|
||||||
locationCol = table.labels.index('%s.x'%options.coords) # columns containing location data
|
locationCol = table.labels.index('1_%s'%options.coords) # columns containing location data
|
||||||
elemCol = table.labels.index('elem') # columns containing location data
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print 'no coordinate data or element data found...'
|
try:
|
||||||
continue
|
locationCol = table.labels.index('%s.x'%options.coords) # columns containing location data (legacy naming scheme)
|
||||||
|
except ValueError:
|
||||||
|
file['croak'].write('no coordinate data (1_%s/%s.x) found...\n'%(options.coords,options.coords))
|
||||||
|
continue
|
||||||
|
|
||||||
if (any(options.resolution)==0 or any(options.dimension)==0.0):
|
if (any(options.resolution)==0 or any(options.dimension)==0.0):
|
||||||
grid = [{},{},{}]
|
grid = [{},{},{}]
|
||||||
|
|
Loading…
Reference in New Issue