store microstructure indices as integers

This commit is contained in:
Martin Diehl 2020-03-20 06:00:42 +01:00
parent 064dabe34b
commit 3caad0bdf4
1 changed files with 7 additions and 8 deletions

View File

@ -54,17 +54,16 @@ for name in filenames:
np.in1d(microstructure,options.blacklist,invert=True) if options.blacklist else \ np.in1d(microstructure,options.blacklist,invert=True) if options.blacklist else \
np.full(geom.grid.prod(),True,dtype=bool)) np.full(geom.grid.prod(),True,dtype=bool))
seeds = np.concatenate((damask.grid_filters.cell_coord0(geom.grid,geom.size).reshape(-1,3), seeds = damask.grid_filters.cell_coord0(geom.grid,geom.size).reshape(-1,3)
microstructure),
axis=1)[mask]
comments = geom.comments \ comments = geom.comments \
+ [scriptID + ' ' + ' '.join(sys.argv[1:]), + [scriptID + ' ' + ' '.join(sys.argv[1:]),
"grid\ta {}\tb {}\tc {}".format(*geom.grid), 'grid\ta {}\tb {}\tc {}'.format(*geom.grid),
"size\tx {}\ty {}\tz {}".format(*geom.size), 'size\tx {}\ty {}\tz {}'.format(*geom.size),
"origin\tx {}\ty {}\tz {}".format(*geom.origin), 'origin\tx {}\ty {}\tz {}'.format(*geom.origin),
"homogenization\t{}".format(geom.homogenization)] 'homogenization\t{}'.format(geom.homogenization)]
table = damask.Table(seeds,{'pos':(3,),'microstructure':(1,)},comments) table = damask.Table(seeds[mask],{'pos':(3,)},comments)
table.add('microstructure',microstructure[mask])
table.to_ASCII(sys.stdout if name is None else \ table.to_ASCII(sys.stdout if name is None else \
os.path.splitext(name)[0]+'.seeds') os.path.splitext(name)[0]+'.seeds')