Skip to content

Commit 1329a1d

Browse files
committed
Add second order VTK cells to pyvista backend at the request of @MariusCausemann
1 parent 1b21a88 commit 1329a1d

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/io4dolfinx/backends/pyvista/backend.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@
4444
74: "pyramid",
4545
}
4646

47+
_quadratric_vtk = {
48+
21: "interval",
49+
22: "triangle",
50+
23: "quadrilateral",
51+
24: "tetrahedron",
52+
25: "hexahedron",
53+
}
54+
4755

4856
read_mode = ReadMode.serial
4957

@@ -161,9 +169,14 @@ def read_mesh_data(
161169
if (cell_type := cell_types[0]) in _first_order_vtk.keys():
162170
cell_type = _first_order_vtk[cell_type]
163171
order = 1
172+
elif cell_type in _quadratric_vtk.keys():
173+
cell_type = _quadratric_vtk[cell_type]
174+
order = 2
164175
elif cell_type in _arbitrary_lagrange_vtk.keys():
165176
cell_type = _arbitrary_lagrange_vtk[cell_type]
166177
order = _cell_degree(cell_type, cells.shape[1])
178+
else:
179+
raise NotImplementedError(f"Cell type {cell_type} not supported in Pyvista backend.")
167180
perm = dolfinx.cpp.io.perm_vtk(dolfinx.mesh.to_type(cell_type), cells.shape[1])
168181
cells = cells[:, perm]
169182
lvar = int(basix.LagrangeVariant.equispaced)

0 commit comments

Comments
 (0)