import from Neper
This commit is contained in:
parent
1bfbd30ae2
commit
01a32ea236
|
@ -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,
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue