diff --git a/python/damask/_grid.py b/python/damask/_grid.py index c984dd000..bc9d0f78c 100644 --- a/python/damask/_grid.py +++ b/python/damask/_grid.py @@ -249,6 +249,30 @@ class Grid: return Grid(material.reshape(cells,order='F'),size,origin,comments) + @staticmethod + def load_Neper(fname): + """ + Load from Neper VTK file. + + Parameters + ---------- + fname : str, pathlib.Path, or file handle + Geometry file to read. + + Returns + ------- + loaded : damask.Grid + Grid-based geometry from file. + + """ + v = VTK.load(fname,'vtkImageData') + cells = np.array(v.vtk_data.GetDimensions())-1 + bbox = np.array(v.vtk_data.GetBounds()).reshape(3,2).T + + return Grid(v.get('MaterialId').reshape(cells,order='F') - 1, bbox[1] - bbox[0], bbox[0], + util.execution_stamp('Grid','load_Neper')) + + @staticmethod def load_DREAM3D(fname, feature_IDs=None,cell_data=None, diff --git a/python/damask/_vtk.py b/python/damask/_vtk.py index 7761b7758..7ca794f70 100644 --- a/python/damask/_vtk.py +++ b/python/damask/_vtk.py @@ -199,7 +199,7 @@ class VTK: raise TypeError('Dataset type for *.vtk file not given.') elif dataset_type.lower().endswith(('imagedata','image_data')): reader.Update() - vtk_data = reader.GetImageDataOutput() + vtk_data = reader.GetStructuredPointsOutput() elif dataset_type.lower().endswith(('rectilineargrid','rectilinear_grid')): reader.Update() vtk_data = reader.GetRectilinearGridOutput()