66
77from __future__ import annotations
88
9+ import inspect
910import pathlib
1011import typing
1112from pathlib import Path
@@ -149,6 +150,7 @@ def read_mesh_from_legacy_h5(
149150 group : str ,
150151 cell_type : str = "tetrahedron" ,
151152 backend : str = "adios2" ,
153+ max_facet_to_cell_links : int = 2 ,
152154) -> dolfinx .mesh .Mesh :
153155 """
154156 Read mesh from `h5`-file generated by legacy DOLFIN `HDF5File.write` or `XDMF.write_checkpoint`.
@@ -158,6 +160,10 @@ def read_mesh_from_legacy_h5(
158160 filename: Path to `h5` or `xdmf` file
159161 group: Name of mesh in `h5`-file
160162 cell_type: What type of cell type, by default tetrahedron.
163+ backend: The IO backend to use when reading the mesh (must
164+ support legacy mesh reading, e.g., "adios2").
165+ max_facet_to_cell_links: Maximum number of cells a facet
166+ can be connected to.
161167 """
162168 # Make sure we use the HDF5File and check that the file is present
163169 check_file_exists (filename )
@@ -175,9 +181,18 @@ def read_mesh_from_legacy_h5(
175181 shape = (mesh_geometry .shape [1 ],),
176182 )
177183 domain = ufl .Mesh (element )
184+ sig = inspect .signature (dolfinx .mesh .create_mesh )
185+ kwargs : dict [str , int ] = {}
186+ if "max_facet_to_cell_links" in list (sig .parameters .keys ()):
187+ kwargs ["max_facet_to_cell_links" ] = max_facet_to_cell_links
178188
179189 return dolfinx .mesh .create_mesh (
180- comm = MPI .COMM_WORLD , cells = mesh_topology , x = mesh_geometry , e = domain
190+ comm = MPI .COMM_WORLD ,
191+ cells = mesh_topology ,
192+ x = mesh_geometry ,
193+ e = domain ,
194+ partitioner = None ,
195+ ** kwargs ,
181196 )
182197
183198
0 commit comments