diff --git a/python/damask/_geom.py b/python/damask/_geom.py index 0f1c35e42..de0b04c79 100644 --- a/python/damask/_geom.py +++ b/python/damask/_geom.py @@ -358,7 +358,7 @@ class Geom: """ g = VTK.from_file(fname).geom N_cells = g.GetNumberOfCells() - microstructure = np.zeros(N_cells) + microstructure = np.zeros(N_cells,'i') grid = np.array(g.GetDimensions())-1 bbox = np.array(g.GetBounds()).reshape(3,2).T size = bbox[1] - bbox[0] diff --git a/python/tests/test_Geom.py b/python/tests/test_Geom.py index 4fb1ae00a..60a4f4fef 100644 --- a/python/tests/test_Geom.py +++ b/python/tests/test_Geom.py @@ -1,3 +1,6 @@ +import os +import time + import pytest import numpy as np @@ -65,8 +68,14 @@ class TestGeom: new = Geom.from_file(f) assert geom_equal(new,default) - def test_export_vtk(self,default,tmpdir): + def test_read_write_vtk(self,default,tmpdir): default.to_vtk(str(tmpdir.join('default'))) + for _ in range(3): + if os.path.exists(tmpdir.join('default.vtr')): break + time.sleep(1) + new = Geom.from_vtk(str(tmpdir.join('default.vtr'))) + assert geom_equal(new,default) + @pytest.mark.parametrize('pack',[True,False]) def test_pack(self,default,tmpdir,pack):