This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Error reading HDF5 file

0 votes

I'm trying to read a mesh into my program using HDF5File. This is my code:

f = HDF5File(mpi_comm_world(),'trmesh.h5', 'r')
mesh = Mesh()
f.read(mesh, 'mesh', False)

I get the following error when i try to run the code:

Error:   Unable to complete call to function has_dataset().
Reason:  Assertion link_status >= 0 failed.

I got this code from this question: http://fenicsproject.org/qa/274/consistent-io-of-mesh-and-function-in-parallel but somehow, they don't get this error.

What am I doing wrong?

Thanks!

closed with the note: Resolved
asked Sep 3, 2014 by hannesvdc FEniCS Novice (180 points)
closed Sep 4, 2014 by chris_richardson

Can you have a look in your hdf5 file using

h5ls -r trmesh.h5

What does that show?

The output of that command is the following:

/                        Group
/Data0                   Dataset {1670, 3} 
/Data1                   Dataset {944, 3}
/Data2                   Dataset {1670}
/Data3                   Dataset {1670}
/Data4                   Dataset {1670}
/Data5                   Dataset {944, 3}

2 Answers

0 votes

OK, so there is no dataset or group in your hdf5 file called "mesh". If you are trying to
read a mesh, it must exist in the hdf5 file with the name used in the f.read() line.
How did you create the file trmesh.h5?

answered Sep 4, 2014 by chris_richardson FEniCS Expert (31,740 points)
+1 vote

I used ParaView to create this xdmf file, but it seems that paraview didn't export the file well. If I export a mesh using FEniCS and import it afterwards, the code runs just fine. This question can be closed. Thank you.

answered Sep 4, 2014 by hannesvdc FEniCS Novice (180 points)

It's not really paraview's fault - it just isn't explained anywhere that the hdf5/xdmf output from
paraview is not FEniCS compatible...

Ok, this makes sense. Will this be fixed in the (near) future?

It's not on the radar.
If you want to raise an issue on bitbucket.org/fenics-project/dolfin, you can.

...