# Reading a mesh stored in XDMF format with multiple cell\_data

**URL:** <https://fenicsproject.discourse.group/t/reading-a-mesh-stored-in-xdmf-format-with-multiple-cell-data/3256>\
**Category:** mesh\
**Created:** [May 19, 2020, 9:46pm UTC](https://fenicsproject.discourse.group/t/reading-a-mesh-stored-in-xdmf-format-with-multiple-cell-data/3256 "2020-05-19T21:46:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhaveshshrimali](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/bhaveshshrimali/32/124_2.png) [@bhaveshshrimali](https://fenicsproject.discourse.group/u/bhaveshshrimali)\
**Post date:** [May 19, 2020, 9:46pm UTC](https://fenicsproject.discourse.group/t/reading-a-mesh-stored-in-xdmf-format-with-multiple-cell-data/3256/1 "2020-05-19T21:46:43Z")

</div>

Hi,

See the corresponding [binder](https://mybinder.org/v2/gh/bhaveshshrimali/FEniCSdiscourse/master?filepath=testDolfinIO.ipynb) notebook for reproducing the error (tried several different ways but the same error).

I have been trying to store cell\_data to load into `MeshValueCollection` and then create corresponding `MeshFunction`s as follows:

```python
from dolfin import *
msh = Mesh()
mvc = MeshValueCollection("size_t", msh, 3)
mvc2 = cpp.mesh.MeshValueCollection_double(msh, 3)
mvc3 = cpp.mesh.MeshValueCollection_double(msh, 3)
with XDMFFile(comm, os.path.join(workDir, "SphereinCube.xdmf")) as infile:
    infile.read(msh)
    infile.read(mvc, "domains")
    infile.read(mvc2, "mu") # it throws the following error here 
    infile.read(mvc3, "eta")

domainMarks = MeshFunction("size_t", msh, mvc) 
# muFunc = MeshFunction("double", msh, mvc2)
# etaFunc = MeshFunction("double", msh, mvc3)

```

```auto
*** Error: Unable to recognise cell type.
*** Reason: Unknown value "".

```

I checked the `XDMF` file and it has the required attributes:

```auto
<Xdmf Version="3.0"><Domain><Grid Name="Grid"><Information Name="Information" Value="0">
<![CDATA[<main />]]>
</Information><Geometry GeometryType="XYZ"><DataItem DataType="Float" Dimensions="8737 3" Format="HDF" Precision="8">SphereinCube.h5:/data0</DataItem></Geometry><Topology NumberOfElements="43650" TopologyType="Tetrahedron"><DataItem DataType="Int" Dimensions="43650 4" Format="HDF" Precision="4">SphereinCube.h5:/data1</DataItem></Topology><Attribute AttributeType="Scalar" Center="Cell" Name="domains"><DataItem DataType="Int" Dimensions="43650" Format="HDF" Precision="4">SphereinCube.h5:/data2</DataItem></Attribute><Attribute AttributeType="Scalar" Center="Cell" Name="mu"><DataItem DataType="Float" Dimensions="43650" Format="HDF" Precision="8">SphereinCube.h5:/data3</DataItem></Attribute><Attribute AttributeType="Scalar" Center="Cell" Name="eta"><DataItem DataType="Float" Dimensions="43650" Format="HDF" Precision="8">SphereinCube.h5:/data4</DataItem></Attribute></Grid></Domain></Xdmf>

```

and loads fine in `Paraview`

 ![image](https://global.discourse-cdn.com/free1/uploads/fenicsproject1/original/2X/6/6465ba8e75bce2e5461720f1a3caff28ad1f4635.png)

And ideas on what could be going wrong ?

---

<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 19, 2020, 10:18pm UTC](https://fenicsproject.discourse.group/t/reading-a-mesh-stored-in-xdmf-format-with-multiple-cell-data/3256/2 "2020-05-19T22:18:28Z")

</div>

Save the different domain data in multiple files, that avoids this issue. As far as I can tell the read function is only able to read the first set of attributes of a given dimension.
