I cannot reproduce this with:
import meshio
import numpy
from dolfin import *
mesh = meshio.read("Square.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)
points = mesh.points
if prune_z:
points = mesh.points[:, :2]
out_mesh = meshio.Mesh(points=points, cells={cell_type: cells}, cell_data={
"name_to_read": [cell_data]})
return out_mesh
line_mesh = create_mesh(mesh, "line", prune_z=True)
meshio.write("facet_mesh.xdmf", line_mesh)
triangle_mesh = create_mesh(mesh, "triangle", prune_z=True)
meshio.write("mesh.xdmf", triangle_mesh)
Geo file
//+
Point(1) = {0, 0, 0, 1.0};
//+
Point(2) = {25, 0, 0, 1.0};
//+
Point(3) = {25, 1, 0, 1.0};
//+
Point(4) = {0, 1, 0, 1.0};
//+
Line(1) = {1, 2};
//+
Line(2) = {2, 3};
//+
Line(3) = {3, 4};
//+
Line(4) = {4, 1};
//+
Curve Loop(1) = {3, 4, 1, 2};
//+
Plane Surface(1) = {1};
//+
Physical Curve("botside", 1) = {1};
//+
Physical Curve("rightside", 2) = {2};
//+
Physical Curve("upside", 3) = {3};
//+
Physical Curve("leftside", 4) = {4};
//+
Physical Surface("Dam1", 5) = {1};
Environment:
docker run -ti --network=host -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v $(pwd):/fenics/shared -w /fenics/shared --rm --shm-size=512m quay.io/fenicsproject/dev:latest
python -m pip install --no-binary=h5py h5py meshio