ASCII table unable to handle inhomogeneous situations

This commit is contained in:
Martin Diehl 2019-11-24 21:23:43 +01:00
parent a2e01d9ace
commit 406ca39b2c
2 changed files with 25 additions and 26 deletions

View File

@ -59,35 +59,35 @@ for filename in options.filenames:
data = np.concatenate((data,coords),1) data = np.concatenate((data,coords),1)
header+=' 1_pos 2_pos 3_pos' header+=' 1_pos 2_pos 3_pos'
results.set_visible('materialpoints',False)
results.set_visible('constituents', True)
for label in options.con: for label in options.con:
for p in results.iter_visible('con_physics'): x = results.get_dataset_location(label)
for c in results.iter_visible('constituents'): if len(x) == 0:
x = results.get_dataset_location(label) continue
if len(x) == 0: array = results.read_dataset(x,0,plain=True)
continue d = np.product(np.shape(array)[1:])
array = results.read_dataset(x,0,plain=True) data = np.concatenate((data,np.reshape(array,[np.product(results.grid),d])),1)
d = int(np.product(np.shape(array)[1:]))
data = np.concatenate((data,np.reshape(array,[np.product(results.grid),d])),1)
if d>1:
header+= ''.join([' {}_{}'.format(j+1,label) for j in range(d)])
else:
header+=' '+label
if d>1:
header+= ''.join([' {}_{}'.format(j+1,label) for j in range(d)])
else:
header+=' '+label
results.set_visible('constituents', False)
results.set_visible('materialpoints',True)
for label in options.mat: for label in options.mat:
for p in results.iter_visible('mat_physics'): x = results.get_dataset_location(label)
for m in results.iter_visible('materialpoints'): if len(x) == 0:
x = results.get_dataset_location(label) continue
if len(x) == 0: array = results.read_dataset(x,0,plain=True)
continue d = np.product(np.shape(array)[1:])
array = results.read_dataset(x,0,plain=True) data = np.concatenate((data,np.reshape(array,[np.product(results.grid),d])),1)
d = int(np.product(np.shape(array)[1:]))
data = np.concatenate((data,np.reshape(array,[np.product(results.grid),d])),1)
if d>1: if d>1:
header+= ''.join([' {}_{}'.format(j+1,label) for j in range(d)]) header+= ''.join([' {}_{}'.format(j+1,label) for j in range(d)])
else: else:
header+=' '+label header+=' '+label
dirname = os.path.abspath(os.path.join(os.path.dirname(filename),options.dir)) dirname = os.path.abspath(os.path.join(os.path.dirname(filename),options.dir))
if not os.path.isdir(dirname): if not os.path.isdir(dirname):

View File

@ -74,7 +74,6 @@ for filename in options.filenames:
results.set_visible('materialpoints',False) results.set_visible('materialpoints',False)
results.set_visible('constituents', True) results.set_visible('constituents', True)
for label in options.con: for label in options.con:
for p in results.iter_visible('con_physics'): for p in results.iter_visible('con_physics'):
if p != 'generic': if p != 'generic':
for c in results.iter_visible('constituents'): for c in results.iter_visible('constituents'):