From 68b3ab7be228da396de4445af01428ee98a5ad20 Mon Sep 17 00:00:00 2001 From: Matthew Scroggs Date: Wed, 28 Sep 2022 15:33:20 +0100 Subject: [PATCH] Basix calls these elements P --- python/dolfinx/plot.py | 2 +- python/test/unit/io/test_vtk.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/python/dolfinx/plot.py b/python/dolfinx/plot.py index c728848a141..ad773581f7f 100644 --- a/python/dolfinx/plot.py +++ b/python/dolfinx/plot.py @@ -84,7 +84,7 @@ def _(V: fem.FunctionSpace, entities=None): discontinuous) only. """ - if not (V.ufl_element().family() in ['Discontinuous Lagrange', "Lagrange", "DQ", "Q"]): + if not (V.ufl_element().family() in ['Discontinuous Lagrange', "Lagrange", "DQ", "Q", "DP", "P"]): raise RuntimeError("Can only create meshes from continuous or discontinuous Lagrange spaces") degree = V.ufl_element().degree() diff --git a/python/test/unit/io/test_vtk.py b/python/test/unit/io/test_vtk.py index f8dabafa93a..e1b7ac295ac 100644 --- a/python/test/unit/io/test_vtk.py +++ b/python/test/unit/io/test_vtk.py @@ -15,6 +15,8 @@ from dolfinx.io import VTKFile from dolfinx.mesh import (CellType, create_mesh, create_unit_cube, create_unit_interval, create_unit_square) +from dolfinx.plot import create_vtk_mesh + from mpi4py import MPI @@ -216,3 +218,10 @@ def test_save_3d_tensor(tempdir): filename = Path(tempdir, "u.pvd") with VTKFile(mesh.comm, filename, "w") as vtk: vtk.write_function(u, 0.) + + +def test_vtk_mesh(): + comm = MPI.COMM_WORLD + mesh = create_unit_square(comm, 2 * comm.size, 2 * comm.size) + V = FunctionSpace(mesh, ("Lagrange", 1)) + create_vtk_mesh(V)