From 8b49a4904276e27c6fbe3ef77d7d8e1257de1e50 Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 19 Nov 2020 01:11:46 +0100 Subject: [PATCH 1/3] [skip ci] updated version information after successful test of v3.0.0-alpha-785-gb22ef7c54 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index d50ee7c7e..4727ed6eb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v3.0.0-alpha-782-ga0b6c2690 +v3.0.0-alpha-785-gb22ef7c54 From 96826dca735443f695075603b162581d40510b3e Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 19 Nov 2020 09:40:19 +0100 Subject: [PATCH 2/3] 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) From af3a87b197140e06e1c63625b08077ae653a9b48 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 19 Nov 2020 11:34:55 +0100 Subject: [PATCH 3/3] adjust to new auto-convert of 1-based geom files --- python/tests/test_Geom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/tests/test_Geom.py b/python/tests/test_Geom.py index 5fd4d3b1c..0eeffd7b8 100644 --- a/python/tests/test_Geom.py +++ b/python/tests/test_Geom.py @@ -73,8 +73,8 @@ class TestGeom: size=np.ones(2)) def test_save_load_ASCII(self,default,tmp_path): - default.save_ASCII(tmp_path/'ASCII') - assert geom_equal(Geom.load_ASCII(tmp_path/'ASCII'),default) + default.renumber().save_ASCII(tmp_path/'ASCII') + assert geom_equal(Geom.load_ASCII(tmp_path/'ASCII'),default.renumber()) def test_invalid_origin(self,default): with pytest.raises(ValueError):