use 1_ip instead of ip.x

Old format still as fallback option to support legacy files
This commit is contained in:
Martin Diehl 2015-03-09 12:52:43 +00:00
parent 6b0a2ed5a4
commit 271c9eed8b
8 changed files with 48 additions and 34 deletions

View File

@ -58,10 +58,13 @@ for file in files:
# --------------- figure out size and grid ---------------------------------------------------------
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:
file['croak'].write('no coordinate data (%s.x) found...\n'%options.coords)
continue
try:
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 = [{},{},{}]
while table.data_read(): # read next data line of ASCII table
@ -101,7 +104,7 @@ for file in files:
# ------------------------------------------ read deformation gradient field -----------------------
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
while table.data_read():
(x,y,z) = damask.util.gridLocation(idx,grid) # figure out (x,y,z) position from line count

View File

@ -62,10 +62,13 @@ for file in files:
# --------------- figure out size and grid ---------------------------------------------------------
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:
file['croak'].write('no coordinate data (%s.x) found...\n'%options.coords)
continue
try:
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 = [{},{},{}]
while table.data_read(): # read next data line of ASCII table

View File

@ -24,11 +24,8 @@ parser.add_option('-c','--coordinates', dest='coords', metavar='string',
help='column heading for coordinates [%default]')
parser.add_option('-f','--defgrad', dest='defgrad', metavar='string',
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(defgrad = 'f' )
parser.set_defaults(linearreconstruction = False)
(options,filenames) = parser.parse_args()
@ -55,10 +52,13 @@ for file in files:
# --------------- figure out size and grid ---------------------------------------------------------
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:
file['croak'].write('no coordinate data (%s.x) found...\n'%options.coords)
continue
try:
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 = [{},{},{}]
while table.data_read(): # read next data line of ASCII table
@ -106,10 +106,7 @@ for file in files:
# ------------------------------------------ calculate coordinates ---------------------------------
Favg = damask.core.math.tensorAvg(F)
if options.linearreconstruction:
centroids = damask.core.mesh.deformedCoordsLin(size,F,Favg)
else:
centroids = damask.core.mesh.deformedCoordsFFT(size,F,Favg)
centroids = damask.core.mesh.deformedCoordsFFT(size,F,Favg)
# ------------------------------------------ process data ------------------------------------------
table.data_rewind()

View File

@ -78,9 +78,9 @@ for file in files:
locationCol = table.labels.index('1_%s'%options.coords) # columns containing location data
except ValueError:
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:
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
coords = [{},{},{}]

View File

@ -133,12 +133,15 @@ for file in files:
table.head_read() # read ASCII header info
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
# --------------- figure out position of labels and coordinates ------------------------------------
# --------------- figure out size and grid ---------------------------------------------------------
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:
file['croak'].write('no coordinate data (%s.x) found...\n'%options.coords)
continue
try:
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:
file['croak'].write('column %s not found...\n'%options.id)

View File

@ -59,11 +59,13 @@ for file in files:
# --------------- figure out size and grid ---------------------------------------------------------
try:
locationCol = table.labels.index('%s.x'%options.coords) # columns containing location data
elemCol = table.labels.index('elem')
locationCol = table.labels.index('1_%s'%options.coords) # columns containing location data
except ValueError:
file['croak'].write('no coordinate (%s.x) and/or elem data found...\n'%options.coords)
continue
try:
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):
coords = [{},{},{}]

View File

@ -54,11 +54,14 @@ for file in files:
# --------------- figure out size and grid ---------------------------------------------------------
try:
locationCol = table.labels.index('%s.x'%options.coords) # columns containing location data
elemCol = table.labels.index('elem')
locationCol = table.labels.index('1_%s'%options.coords) # columns containing location data
except ValueError:
file['croak'].write('no coordinate (%s.x) and/or elem data found...\n'%options.coords)
continue
try:
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):
coords = [{},{},{}]

View File

@ -73,12 +73,15 @@ for file in files:
'\t' + ' '.join(sys.argv[1:]))
# --------------- figure out size and grid ---------------------------------------------------------
try:
locationCol = table.labels.index('%s.x'%options.coords) # columns containing location data
elemCol = table.labels.index('elem') # columns containing location data
locationCol = table.labels.index('1_%s'%options.coords) # columns containing location data
except ValueError:
print 'no coordinate data or element data found...'
continue
try:
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):
grid = [{},{},{}]