From 96826dca735443f695075603b162581d40510b3e Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 19 Nov 2020 09:40:19 +0100 Subject: [PATCH] Geom.load_ASCII now auto-shifts material indices --- python/damask/_geom.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/damask/_geom.py b/python/damask/_geom.py index f75a48fff..5b545fa41 100644 --- a/python/damask/_geom.py +++ b/python/damask/_geom.py @@ -228,7 +228,7 @@ class Geom: else: comments.append(line.strip()) - material = np.empty(grid.prod()) # initialize as flat array + material = np.empty(grid.prod()) # initialize as flat array i = 0 for line in content[header_length:]: items = line.split('#')[0].split() @@ -246,8 +246,8 @@ class Geom: if i != grid.prod(): raise TypeError(f'Invalid file: expected {grid.prod()} entries, found {i}') - if not np.any(np.mod(material,1) != 0.0): # no float present - material = material.astype('int') + if not np.any(np.mod(material,1) != 0.0): # no float present + material = material.astype('int') - (1 if material.min() > 0 else 0) return Geom(material.reshape(grid,order='F'),size,origin,comments)