Yes, the tetra_data is a simple list of shape (numcells,). To illustrate this, you could use this example:
import numpy as np
import pygmsh
import meshio
def create_mesh_gmsh():
geom = pygmsh.built_in.Geometry()
rect = geom.add_rectangle(0.0, 2.0, 0.0, 1.0, 0.0, lcar=0.2)
geom.add_physical([rect.line_loop.lines[0], rect.line_loop.lines[2]], 1)
geom.add_physical([rect.line_loop.lines[1]], 2)
geom.add_physical([rect.line_loop.lines[3]], 3)
geom.add_physical([rect.surface], 4)
# Generate mesh
mesh = pygmsh.generate_mesh(geom, dim=2, prune_z_0=True)
cells = np.vstack(np.array([cells.data for cells in mesh.cells
if cells.type == "triangle"]))
triangle_mesh = meshio.Mesh(points=mesh.points,
cells=[("triangle", cells)])
facet_cells = np.vstack(np.array([cells.data for cells in mesh.cells
if cells.type == "line"]))
facet_data = mesh.cell_data_dict["gmsh:physical"]["line"]
facet_mesh = meshio.Mesh(points=mesh.points,
cells=[("line", facet_cells)],
cell_data={"name_to_read": [facet_data]})
# Write mesh
meshio.xdmf.write("mesh.xdmf", triangle_mesh)
meshio.xdmf.write("facet_mesh.xdmf", facet_mesh)
Here mesh.cells
contains 5 CellBlock, four of them with facet data.