Repository navigation
Replace io4dolfinx.compat with fenicsx-compat - #87
Merged
Merged
Conversation
Cross-version DOLFINx workarounds now come from fenicsx-compat (>=0.3.0), which centralises them for io4dolfinx, scifem and dolfinx-adjoint. - io4dolfinx.compat is removed. cmap, dofmap, cell permutations, index map creation and unwrapping, and index_to_dest_ranks come from fenicsx_compat. index_to_dest_ranks always returns (ranks, offsets) there, so the AdjacencyList/tuple branching in writers.py goes. - Inline duplicates are replaced too: mesh creation with a ghost mode in read_mesh, the C++ finite element constructor, reconstruct_mesh (still deprecated), the PyVista snake_case setting and the ADIOS2 scope. - Branches that cannot run on DOLFINx >= 0.10 become plain DOLFINx calls, checked against the v0.10.0 sources: the block_size element constructor, the value_shape FunctionSpace constructor, the create_mesh call without max_facet_to_cell_links, the element.signature() call and the petsc_options_prefix probe in the legacy reader tests. - The number of closure dofs of an entity is taken as len(entity_closure_dofs(dim, 0)), which is what num_entity_closure_dofs returned on 0.10 and 0.11, and which exists on every version. DOLFINx main removed num_entity_closure_dofs. Fixes for the 10 tests that fail on DOLFINx nightly on main: - The VTKHDF backend gets its cell type from fenicsx_compat.vtk_cell_type, as dolfinx#4621 changed get_vtk_cell_type to take the number of nodes rather than the dimension. - The manifold H(div)/H(curl) submesh test calls fenicsx_compat.create_facet_orientations before creating the spaces, which dolfinx#4625 requires for Raviart-Thomas on a manifold. - The vector reference field in test_submesh.py is linear rather than containing a sine, so it lies in RT2. Interpolating a field outside RT2 on DOLFINx nightly gives dofs that differ by about 1e-6 between mesh numberings, which broke the comparison with the field interpolated again on the mesh read back from file. The round trip itself was exact. `packaging` moves from the runtime dependencies to the test group, as only the tests still use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
finsberg
marked this pull request as draft
October 20, 2026 19:20
finsberg
marked this pull request as ready for review
October 21, 2026 06:48
jorgensd
approved these changes
Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves io4dolfinx's DOLFINx cross-version workarounds to fenicsx-compat, as was done for scifem. It also fixes the 10 tests that fail on DOLFINx nightly on
main.Important
Depends on
fenicsx-compat>=0.3.0.Migration
io4dolfinx.compatremoved. The following now come fromfenicsx_compat:cmap,dofmapindex_to_dest_ranks, which always returns(ranks, offsets), so the AdjacencyList/tuple branching inwriters.pyis gone.read_meshreconstruct_mesh(still deprecated)block_sizeelement constructorvalue_shapeFunctionSpaceconstructorcreate_meshwithoutmax_facet_to_cell_linkselement.signature()as a methodpetsc_options_prefixprobe in the legacy reader testslen(layout.entity_closure_dofs(dim, 0)). That is the valuenum_entity_closure_dofsgave on 0.10/0.11, and it exists on every version. DOLFINx main removednum_entity_closure_dofs.fenicsx-compat>=0.3.0is added andpackagingmoves to the test group, since only the tests still use it.>=0.10.0floor) is gone, and the README now points to fenicsx-compat.Nightly fixes
maintest_vtkhdf.py: "VTK hexahedra need at least 8 nodes"get_vtk_cell_typetakes the node count, not the dimensionfenicsx_compat.vtk_cell_type(cell_type, num_dofs_per_cell)test_manifold_hcurl_roundtrips_but_transfer_raises[*-RT]fenicsx_compat.create_facet_orientationsbefore creating the spacestest_submesh_roundtrip_codim0_vector[*-2-RT]: error 9.4e-7 vs 1e-13sin, which isn't in RT2. On nightly, interpolating it into RT2 gives dofs that differ by about 1e-6 between mesh numberings.The last one is a test bug, not an I/O bug. Outside the suite, the RT2 function read back from file has the same norm (to 15 digits) and the same L2 error against the exact field as the one written. With a field that lies in the space, the re-interpolated DOFs match to 1e-16.
Testing
Run locally against DOLFINx 0.12.0.dev0:
mainmpirun -n 2mpirun -n 3pre-commit run --all-filesandmypy(in the DOLFINx environment, as CI runs it) are clean.🤖 Generated with Claude Code