fenicsx-compat#
Cross-version compatibility helpers for DOLFINx.
Centralizes workarounds for breaking API changes across dolfinx versions
(nightly/main, stable, and back to release 0.10), previously duplicated
across dolfinx-adjoint, io4dolfinx, and scifem.
Pure Python, no compiled extensions. Supports dolfinx >= 0.10.0.
Supported versions#
Supported |
|
|---|---|
DOLFINx |
0.10, 0.11 and |
Python |
3.12 and newer |
Throughout this guide, main means the current development branch of DOLFINx, which will become 0.12.
How to use this guide#
Which function do I need? maps the cross-version problem you have to the function that solves it. Start there.
The function guide has one entry per function. Each entry says what the function does, how DOLFINx 0.10, 0.11 and main do the same thing natively, and how to call the function so that one piece of code runs on all three.
Already the same on every version lists the things that look version-dependent but are not: from 0.10 on, plain DOLFINx calls work on every supported version, and there is no wrapper for them.
The API reference has the full docstrings.
Every function is importable from the top-level package:
import fenicsx_compat
cmap = fenicsx_compat.cmap(mesh)
The examples in the guide are short, and assume
from mpi4py import MPI
import dolfinx
import numpy as np
import fenicsx_compat
and, where they use one, an existing mesh, function space V or form.