Transitioning from mesh.xml to mesh.xdmf, from dolfin-convert to meshio

As you can see in the code snippet above, I first read the boundary data to the file mf.xdmf. this is equivalent to facet_region.xml.
For the cellfunction:

meshio.write("cf.xdmf", meshio.Mesh(
    points=msh.points, cells={"tetra": msh.cells["tetra"]},
    cell_data={"tetra": {"name_to_read":
                            msh.cell_data["tetra"]["gmsh:physical"]}}))
mvc = MeshValueCollection("size_t", mesh, 3)
with XDMFFile("cf.xdmf") as infile:
    infile.read(mvc, "name_to_read")
cf = cpp.mesh.MeshFunctionSizet(mesh, mvc)

1 Like