can now read legacy VTK files with unstructured grid data
This commit is contained in:
parent
a554bc5267
commit
98a8b47a09
|
@ -53,12 +53,22 @@ datainfo = { # lis
|
||||||
if not os.path.exists(options.vtk):
|
if not os.path.exists(options.vtk):
|
||||||
parser.error('VTK file does not exist')
|
parser.error('VTK file does not exist')
|
||||||
|
|
||||||
reader = vtk.vtkXMLUnstructuredGridReader()
|
if os.path.splitext(options.vtk)[1] == '.vtu':
|
||||||
reader.SetFileName(options.vtk)
|
reader = vtk.vtkXMLUnstructuredGridReader()
|
||||||
reader.Update()
|
reader.SetFileName(options.vtk)
|
||||||
Npoints = reader.GetNumberOfPoints()
|
reader.Update()
|
||||||
Ncells = reader.GetNumberOfCells()
|
uGrid = reader.GetOutput()
|
||||||
uGrid = reader.GetOutput()
|
elif os.path.splitext(options.vtk)[1] == '.vtk':
|
||||||
|
reader = vtk.vtkGenericDataObjectReader()
|
||||||
|
reader.SetFileName(options.vtk)
|
||||||
|
reader.Update()
|
||||||
|
uGrid = reader.GetUnstructuredGridOutput()
|
||||||
|
else:
|
||||||
|
parser.error('unsupported VTK file type extension')
|
||||||
|
|
||||||
|
|
||||||
|
Npoints = uGrid.GetNumberOfPoints()
|
||||||
|
Ncells = uGrid.GetNumberOfCells()
|
||||||
|
|
||||||
#if Npoints != Ncells or Npoints != Nvertices:
|
#if Npoints != Ncells or Npoints != Nvertices:
|
||||||
# parser.error('Number of points, cells, and vertices in VTK differ from each other'); sys.exit()
|
# parser.error('Number of points, cells, and vertices in VTK differ from each other'); sys.exit()
|
||||||
|
|
Loading…
Reference in New Issue