fixed buggy version
This commit is contained in:
parent
89e4bc800c
commit
2870fdb25b
|
@ -48,30 +48,29 @@ for name in filenames:
|
||||||
damask.util.report(scriptName,name)
|
damask.util.report(scriptName,name)
|
||||||
|
|
||||||
geom = damask.Geom.from_file(StringIO(''.join(sys.stdin.read())) if name is None else name)
|
geom = damask.Geom.from_file(StringIO(''.join(sys.stdin.read())) if name is None else name)
|
||||||
|
origin = geom.get_origin()
|
||||||
grid = geom.get_grid()
|
size = geom.get_size()
|
||||||
|
grid = canvasgrid = geom.get_grid()
|
||||||
offset = np.asarray(options.offset)
|
offset = np.asarray(options.offset)
|
||||||
if options.grid is not None:
|
|
||||||
grid = np.array([int(o*float(n.lower().replace('x',''))) if n.lower().endswith('x') \
|
|
||||||
else int(n) for o,n in zip(grid,options.grid)],dtype=int)
|
|
||||||
grid = np.maximum(grid,1)
|
|
||||||
|
|
||||||
new = np.full(grid,options.fill if options.fill is not None
|
if options.grid is not None:
|
||||||
|
canvasgrid = np.maximum(1,
|
||||||
|
np.array([int(o*float(n.lower().replace('x',''))) if n.lower().endswith('x') \
|
||||||
|
else int(n) for o,n in zip(grid,options.grid)],dtype=int))
|
||||||
|
|
||||||
|
canvas = np.full(canvasgrid,options.fill if options.fill is not None
|
||||||
else np.nanmax(geom.microstructure)+1,geom.microstructure.dtype)
|
else np.nanmax(geom.microstructure)+1,geom.microstructure.dtype)
|
||||||
|
|
||||||
n = np.asarray(new.shape)
|
|
||||||
o = np.asarray(geom.microstructure.shape)
|
|
||||||
|
|
||||||
l = np.clip( offset, 0,np.minimum(o +offset,n))
|
l = np.maximum( 0, offset)
|
||||||
r = np.clip( offset+o,0,np.minimum(o*2+offset,n))
|
r = np.minimum(grid,canvasgrid+offset)
|
||||||
|
L = l - offset
|
||||||
|
R = r - offset
|
||||||
|
|
||||||
L = np.clip(-offset, 0,np.minimum(n -offset,o))
|
canvas [L[0]:R[0],L[1]:R[1],L[2]:R[2]] \
|
||||||
R = np.clip(-offset+n,0,np.minimum(n*2-offset,o))
|
= geom.microstructure[l[0]:r[0],l[1]:r[1],l[2]:r[2]]
|
||||||
|
|
||||||
new[l[0]:r[0],l[1]:r[1],l[2]:r[2]] = geom.microstructure[L[0]:R[0],L[1]:R[1],L[2]:R[2]]
|
damask.util.croak(geom.update(canvas,origin=origin+offset*size/grid,rescale=True))
|
||||||
|
|
||||||
|
|
||||||
damask.util.croak(geom.update(new,origin=(0,0,0),rescale=True))
|
|
||||||
geom.add_comments(scriptID + ' ' + ' '.join(sys.argv[1:]))
|
geom.add_comments(scriptID + ' ' + ' '.join(sys.argv[1:]))
|
||||||
|
|
||||||
if name is None:
|
if name is None:
|
||||||
|
|
Loading…
Reference in New Issue