Hi all.
I get an error trying to read a boundary XDMF file, created with pygmsh and meshio, into a dolfin MeshValueCollection.
*** Error: Unable to find entity in map.
*** Reason: Error reading MeshValueCollection.
*** Where: This error was encountered inside HDF5File.cpp.
I am using dolfin master.
2D MWE:
import pygmsh
import meshio
geom = pygmsh.built_in.Geometry()
rect = geom.add_rectangle(0, 1, 0, 1, 0, lcar=0.1)
geom.add_physical(rect.surface, 0)
for i, line in enumerate(rect.lines):
geom.add_physical(line, i + 1)
mesh = pygmsh.generate_mesh(geom)
# write to XDMF, strip 3rd dimension
meshio.write('test.xdmf',
meshio.Mesh(points=mesh.points[:, 0:2],
cells={'triangle':
mesh.cells['triangle']}))
# write boundary markers to separate file
meshio.write(
'test_bound.xdmf',
meshio.Mesh(
points=mesh.points[:, 0:2],
cells={'line': mesh.cells['line']},
cell_data={'line':
{'markers': mesh.cell_data['line']['gmsh:physical']}
}
)
)
# read mesh and markers
from dolfin import *
mesh = Mesh()
XDMFFile('test.xdmf').read(mesh)
mvc = MeshValueCollection('size_t', mesh)
# gives an error
XDMFFile('test_bound.xdmf').read(mvc, 'markers')
Any help is much appreciated!