Element type mixtures not allowed?

My noob random walk in the world of FEniCS/dolfinx has recently allowed me to generate 2D meshes with gmsh, which I then import with dolfinx.io.gmshio.read_from_mesh.I have even managed to get PyVista up and running inside my jupyter notebook.

However, when I recently tried to use a 2D mesh with a mixture of (2nd order) tri and quad elements, read_from_mesh stopped and complained. The code comment at the point of the assert(in gmshio.py), states that “Assumes that each entity only have one cell-type“.

So, is it just read_from_mesh which cannot handle this, or is this a limitation of, say, the implementation of the function spaces? That is, can I hope for a workaround, or should I keep my paws away from mixed meshes?

The GMSH interface does not support reading in mixed cell meshes (yet). There is experimental support for these meshes in DOLFINx, see for instance: Poisson equation — DOLFINx 0.10.0.post0 documentation
but the API is subject to change and is not super-clean at the moment.