Let's say you have an xml mesh in the current directory, write 'h5' file as follows:
import dolfin as df
mesh = df.Mesh(xml_mesh_name)
mesh_file = df.HDF5File(df.mpi_comm_world(), h5_file_name, 'w')
mesh_file.write(mesh, '/mesh')
# maybe you have defined a mesh-function (boundaries, domains ec.)
# in the xml_mesh aswell, in this case use the following two lines
domains = df.MeshFunction("size_t", mesh, 3, mesh.domains())
mesh_file.write(domains, "/domains")
read in parallel:
mesh = df.Mesh()
hdf5 = df.HDF5File(df.mpi_comm_world(), h5_file_name, 'r')
hdf5.read(mesh, '/mesh', False)
# in case mesh-functions are available ...
domains = df.CellFunction("size_t", mesh)
hdf5.read(domains, "/domains")