Hi everyone,
I’m a beginner in FEniCSx, and I want to import a mesh that is stored in two lists, one with the points coordinates and one with the connectivity of the cells.
I managed to do that by first generating a .xmdf file using meshio and then importing the .xdmf file with dolfinx.io. Here is an example of what I do
import meshio
from dolfinx.io import XDMFFile
from mpi4py import MPI
points = [
[-1.0, -1.0],
[ 0.0, -1.0],
[ 1.0, -1.0],
[-1.0, 0.0],
[ 0.0, 0.0],
[ 1.0, 0.0],
[-1.0, 1.0],
[ 0.0, 1.0],
[ 1.0, 1.0],
]
aux_cells = [
[0,1,3,4],
[1,2,4,5],
[3,4,6,7],
[4,5,7,8],
]
cells = [("quad", aux_cells)]
mesh = meshio.Mesh(points,cells)
meshio.write_points_cells("test.xdmf", points, cells)
with XDMFFile(MPI.COMM_WORLD, "test.xdmf", "r") as xdmf:
msh = xdmf.read_mesh(name="Grid")
That works fine, but I wonder if there’s a more simple and direct approach.