read polygons with the legacy VTK reader
@@ -42,6 +42,16 @@ def read(filetype, filename):
os = offsets[numpy.argwhere(types == vtk_type).transpose()[0]]
num_cells = len(os)
if num_cells > 0:
+ if meshio_type == "polygon":
+ for idx_cell in range(num_cells):
+ num_pts = data[os[idx_cell]]
+ cell = data[os[idx_cell] + 1 : os[idx_cell] + 1 + num_pts]
+ key = meshio_type + str(num_pts)
+ if key in cells:
+ cells[key] = numpy.vstack([cells[key], cell])
+ else:
+ cells[key] = cell
+ else:
num_pts = data[os[0]]
# instantiate the array
arr = numpy.empty((num_cells, num_pts), dtype=int)
