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

**URL:** <https://fenicsproject.discourse.group/t/transitioning-from-mesh-xml-to-mesh-xdmf-from-dolfin-convert-to-meshio/412>\
**Category:** mesh\
**Created:** [March 22, 2019, 9:01am UTC](https://fenicsproject.discourse.group/t/transitioning-from-mesh-xml-to-mesh-xdmf-from-dolfin-convert-to-meshio/412 "2019-03-22T09:01:33Z")\
**Posts on this page:** 1\
**Showing post:** 172

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [May 18, 2021, 6:43pm UTC](https://fenicsproject.discourse.group/t/transitioning-from-mesh-xml-to-mesh-xdmf-from-dolfin-convert-to-meshio/412/172 "2021-05-18T18:43:38Z")

</div>

Your msh file does not contain any physical markers (i.e `Physical Line/Volume/Surface`), thus you cannot read in cell\_data.

I would suggest using the following code for reading meshes (from [Accessing and marking imported boundaries - #8 by dokken](https://fenicsproject.discourse.group/t/accessing-and-marking-imported-boundaries/5753/8)). Note that here I have defined a physical surface and physical curve.

```auto
import meshio

msh = meshio.read("cylinder.msh")

def create_mesh(mesh, cell_type, prune_z=False):
    cells = mesh.get_cells_type(cell_type)
    cell_data = mesh.get_cell_data("gmsh:physical", cell_type)
    out_mesh = meshio.Mesh(points=mesh.points, cells={
                           cell_type: cells}, cell_data={"name_to_read": [cell_data]})
    if prune_z:
        out_mesh.prune_z_0()
    return out_mesh

tetra_mesh = create_mesh(msh, "tetra")
triangle_mesh = create_mesh(msh, "triangle")
meshio.write("mesh.xdmf", tetra_mesh)

meshio.write("mf.xdmf", triangle_mesh)

```

---

_[View the full topic](https://fenicsproject.discourse.group/t/transitioning-from-mesh-xml-to-mesh-xdmf-from-dolfin-convert-to-meshio/412)._
