Skip to content

Commit d9eaece

Browse files
authored
Merge branch 'main' into mscroggs/ufl_coordinate_elements
2 parents b06ea2e + 8b2c4be commit d9eaece

File tree

159 files changed

+3562
-2167
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+3562
-2167
lines changed

.clang-tidy

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
WarningsAsErrors: "*"
2+
UseColor: true
3+
HeaderFilterRegex: '^(?!MPI_api.h$|PETSc_api.h$).*' # Pulled in from python packages and not classified as system headers
4+
ExtraArgsBefore:
5+
- '-Wno-unknown-warning-option'
6+
Checks: >
7+
-*,
8+
performance*

.github/workflows/ccpp.yml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ jobs:
9696
- name: Install dependencies
9797
run: |
9898
sudo apt-get update
99-
sudo apt-get install catch2 cmake g++ libblas-dev libboost-dev libhdf5-mpi-dev \
100-
liblapack-dev libparmetis-dev libpugixml-dev libspdlog-dev mpi-default-dev \
101-
ninja-build pkg-config
99+
sudo apt-get install catch2 cmake g++ libblas-dev libboost-dev \
100+
libhdf5-mpi-dev liblapack-dev libparmetis-dev libpugixml-dev \
101+
libspdlog-dev mpi-default-dev ninja-build pkg-config
102102
- name: Set up Python
103103
uses: actions/setup-python@v5
104104
with:
@@ -129,7 +129,7 @@ jobs:
129129
- name: Build C++ unit tests
130130
run: |
131131
cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build/test/ -S cpp/test/
132-
cmake --build build/test --parallel 3
132+
cmake --build build/test
133133
- name: Run C++ unit tests (serial)
134134
run: |
135135
cd build/test
@@ -147,11 +147,17 @@ jobs:
147147
- name: Run mypy
148148
working-directory: python
149149
run: |
150-
pip install mypy
151-
mypy dolfinx
152-
# mypy test (--check-untyped-defs)
150+
pip install mypy types-cffi scipy-stubs
151+
mypy -p dolfinx
152+
# mypy test
153153
# mypy demo
154154

155+
- name: Install gmsh and pyvista (and dependencies)
156+
run: |
157+
sudo apt-get install libglu1-mesa libgl1 libxrender1 libxcursor1 libxft2 libxinerama1
158+
sudo apt-get install libegl1
159+
pip install gmsh pyvista
160+
155161
- name: Run demos (Python, serial)
156162
run: |
157163
pip install pytest-xdist
@@ -212,7 +218,7 @@ jobs:
212218
- name: Build C++ unit tests
213219
run: |
214220
cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build/test/ -S cpp/test/
215-
cmake --build build/test --parallel 3
221+
cmake --build build/test
216222
- name: Run C++ unit tests (serial)
217223
run: |
218224
cd build/test
@@ -224,7 +230,7 @@ jobs:
224230
- name: Build and run C++ regression tests (serial and MPI (np=2))
225231
run: |
226232
cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build/demo/ -S cpp/demo/
227-
cmake --build build/demo --parallel 3
233+
cmake --build build/demo
228234
cd build/demo
229235
ctest -V -R demo -R serial
230236
ctest --output-on-failure -V -R demo -R mpi_2
@@ -237,11 +243,24 @@ jobs:
237243
pip install --check-build-dependencies --no-build-isolation --config-settings=cmake.build-type="Debug" 'python/[test]'
238244
python -c "from mpi4py import MPI; import dolfinx; assert dolfinx.has_adios2; assert dolfinx.has_kahip; assert not dolfinx.has_parmetis; assert dolfinx.has_petsc; assert dolfinx.has_petsc4py; assert dolfinx.has_ptscotch; assert dolfinx.has_slepc; assert dolfinx.has_complex_ufcx_kernels"
239245
246+
- name: Run mypy
247+
working-directory: python
248+
run: |
249+
pip install mypy types-cffi scipy-stubs
250+
mypy -p dolfinx
251+
# mypy test
252+
# mypy demo
253+
240254
- name: Set default DOLFINx JIT options
241255
run: |
242256
mkdir -p ~/.config/dolfinx
243257
echo '{ "cffi_extra_compile_args": ["-g0", "-O0" ] }' > ~/.config/dolfinx/dolfinx_jit_options.json
244258
259+
- name: Install pyvista (and dependencies)
260+
run: |
261+
apt-get install libegl1 libxrender1
262+
pip install pyvista
263+
245264
- name: Run demos (Python, serial)
246265
run: |
247266
pip install pytest-xdist

.github/workflows/clang-tidy.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: clang-tidy
2+
3+
on:
4+
# schedule:
5+
# # daily at 1am
6+
# - cron: "0 1 * * *"
7+
# pull_request:
8+
# branches:
9+
# - main
10+
# push:
11+
# branches:
12+
# - "**"
13+
# tags:
14+
# - "v*"
15+
# merge_group:
16+
# branches:
17+
# - main
18+
workflow_dispatch:
19+
20+
jobs:
21+
clang-tidy:
22+
runs-on: ubuntu-latest
23+
container: "ghcr.io/fenics/test-env:current-openmpi"
24+
env:
25+
PETSC_ARCH: linux-gnu-real64-32
26+
OMPI_ALLOW_RUN_AS_ROOT: 1
27+
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
28+
PRTE_MCA_rmaps_default_mapping_policy: :oversubscribe
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- name: Install dependencies
33+
run: |
34+
apt-get update
35+
apt-get install -y clang-tidy catch2
36+
pip install -r python/build-requirements.txt
37+
38+
- name: Load environment variables
39+
run: cat .github/workflows/fenicsx-refs.env >> $GITHUB_ENV
40+
41+
- name: Install FEniCS Python components
42+
run: |
43+
pip install git+https://github.com/FEniCS/ufl.git@${{ env.ufl_ref }}
44+
pip install git+https://github.com/FEniCS/basix.git@${{ env.basix_ref }}
45+
pip install git+https://github.com/FEniCS/ffcx.git@${{ env.ffcx_ref }}
46+
47+
- name: Configure (C++ lib)
48+
run: >
49+
cmake -G Ninja
50+
-B build
51+
-S cpp/
52+
-DCMAKE_BUILD_TYPE=Developer
53+
-DENABLE_CLANG_TIDY=ON
54+
-DDOLFINX_ENABLE_ADIOS2=ON
55+
-DDOLFINX_ENABLE_KAHIP=ON
56+
-DDOLFINX_ENABLE_PETSC=ON
57+
-DDOLFINX_ENABLE_SCOTCH=ON
58+
-DDOLFINX_ENABLE_SLEPC=ON
59+
-DDOLFINX_ENABLE_PARMETIS=OFF
60+
61+
- name: Build (C++ lib)
62+
run: cmake --build build
63+
64+
- name: Install (C++ lib)
65+
run: cmake --install build
66+
67+
- name: Configure (C++ test)
68+
run: >
69+
cmake -G Ninja
70+
-B build-test
71+
-S cpp/test/
72+
-DENABLE_CLANG_TIDY=ON
73+
74+
- name: Build (C++ test)
75+
run: cmake --build build-test
76+
77+
- name: Build (Python)
78+
working-directory: python
79+
run: >
80+
pip install .
81+
--no-build-isolation
82+
--verbose
83+
--config-settings=cmake.define.ENABLE_CLANG_TIDY=ON

python/conda-oneapi-test-env.yml renamed to .github/workflows/oneapi-conda/environment.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,14 @@ dependencies:
2727
- petsc4py
2828
- pkg-config
2929
- pugixml
30+
- pyamg
3031
- pytest
3132
- pytest-xdist
33+
- python-gmsh
34+
- pyvista
3235
- scikit-build-core
33-
- scipy
36+
- scipy<1.16.0
37+
- slepc
38+
- slepc4py
3439
- spdlog
3540
- uv

.github/workflows/oneapi.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
run: |
4141
apt-get -y update
4242
apt-get -y install binutils libstdc++-14-dev git
43+
apt-get install -y libglu1-mesa libgl1 libxrender1 libxcursor1 libxft2 libxinerama1 libegl1
4344
4445
- uses: actions/checkout@v4
4546

@@ -49,7 +50,7 @@ jobs:
4950
- uses: conda-incubator/setup-miniconda@v3
5051
with:
5152
activate-environment: oneapi-test-env
52-
environment-file: python/conda-oneapi-test-env.yml
53+
environment-file: .github/workflows/oneapi-conda/environment.yml
5354
auto-activate-base: false
5455
- run: |
5556
conda info

.github/workflows/redhat.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ jobs:
7676
mkdir -p ~/.config/dolfinx
7777
echo '{ "cffi_extra_compile_args": ["-g0", "-O0" ] }' > ~/.config/dolfinx/dolfinx_jit_options.json
7878
79+
- name: Install pyvista and gmsh
80+
run: |
81+
dnf install -y mesa-libGLU libX11 libXrender mesa-libEGL libglvnd-glx libXcursor libXft libXinerama
82+
python3 -m pip install gmsh pyvista
83+
7984
- name: Run demos (Python, serial)
8085
run: |
8186
python3 -m pip install pytest-xdist

RELEASE.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ Check that all CIs on `main` are running green.
99
Check that the `main` documentation looks reasonable at
1010
https://docs.fenicsproject.org.
1111

12+
As of 18/07/2025 the Windows CI is broken and consequently only @minrk
13+
can test the Windows build via the Condaforge CI.
14+
1215
The release proceeds in a bottom up manner (UFL, Basix, FFCx, DOLFINx). pypa
1316
packages cannot be deleted and should be made a number of days after the
1417
creation of git tags so that errors can be fixed. GitHub releases can have their
@@ -60,6 +63,8 @@ UFL still runs on the year-based release scheme.
6063
2. Update version numbers in `pyproject.toml`, `python/pyproject.toml`,
6164
`CMakeLists.txt` and `cpp/CMakeLists.txt`.
6265

66+
3. Update the Basix nanobind type stubs following `basix/python/README/md`.
67+
6368
4. In `pyproject.toml` update the `fenics-ufl` optional dependency version. On
6469
`main` this is often pointing at the git repo, it needs to be changed to a
6570
version bound e.g. `>=2024.1.0,<2024.2.0`.
@@ -141,7 +146,6 @@ FFCx with DOLFINx: https://github.com/FEniCS/ffcx/actions/workflows/dolfinx-test
141146

142147
Full stack: https://github.com/FEniCS/dolfinx/actions/workflows/ccpp.yml
143148

144-
145149
## Tagging
146150

147151
Make appropriate version tags in each repository. UFL does not use the `v` prefix.

cpp/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ add_feature_info(
108108
"Ask Python FFCx module where to find ufcx.h header using MODULE mode. Otherwise use CONFIG mode."
109109
)
110110

111+
# clang-tidy
112+
option(ENABLE_CLANG_TIDY "Run clang-tidy while building" OFF)
113+
add_feature_info(ENABLE_CLANG_TIDY ENABLE_CLANG_TIDY "Run clang-tidy while building")
114+
111115
# ------------------------------------------------------------------------------
112116
# Enable or disable optional packages
113117

cpp/demo/codim_0_assembly/main.cpp

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <dolfinx/fem/petsc.h>
1515
#include <dolfinx/la/MatrixCSR.h>
1616
#include <dolfinx/la/SparsityPattern.h>
17+
#include <dolfinx/mesh/EntityMap.h>
1718
#include <map>
1819
#include <memory>
1920
#include <ranges>
@@ -76,37 +77,25 @@ int main(int argc, char* argv[])
7677
mesh::MeshTags<std::int32_t> cell_marker(mesh->topology(), tdim, cells,
7778
values);
7879

79-
std::shared_ptr<mesh::Mesh<U>> submesh;
80-
std::vector<std::int32_t> submesh_to_mesh;
80+
// We create a submesh consisting of only cells with a given tag by
81+
// calling `create_submesh`. This function also returns an
82+
// `EntityMap` object, which relates entities in the submesh to
83+
// entities in the original mesh. We will need this to assemble our
84+
// mixed-domain form.
85+
auto submesh_data = [](auto& mesh, int tdim, auto&& subcells)
8186
{
82-
auto [_submesh, _submesh_to_mesh, v_map, g_map]
83-
= mesh::create_submesh(*mesh, tdim, cell_marker.find(2));
84-
submesh = std::make_shared<mesh::Mesh<U>>(std::move(_submesh));
85-
submesh_to_mesh = std::move(_submesh_to_mesh);
86-
}
87+
auto [submesh, emap, v_map, g_map]
88+
= mesh::create_submesh(mesh, tdim, subcells);
89+
return std::pair(std::make_shared<mesh::Mesh<U>>(std::move(submesh)),
90+
std::move(emap));
91+
};
92+
auto [submesh, entity_map] = submesh_data(*mesh, tdim, cell_marker.find(2));
8793

8894
// We create the function space used for the trial space
8995
auto W
9096
= std::make_shared<fem::FunctionSpace<U>>(fem::create_functionspace<U>(
9197
submesh, std::make_shared<fem::FiniteElement<U>>(element)));
9298

93-
// A mixed-domain form has functions defined over different meshes.
94-
// The mesh associated with the measure (dx, ds, etc.) is called the
95-
// integration domain. To assemble mixed-domain forms, maps must be
96-
// provided taking entities in the integration domain to entities on
97-
// each mesh in the form. Since one of our forms has a measure
98-
// defined over `mesh` and involves a function defined over
99-
// `submesh`, we must provide a map from entities in `mesh` to
100-
// entities in `submesh`. This is simply the "inverse" of
101-
// `submesh_to_mesh`.
102-
std::vector<std::int32_t> mesh_to_submesh(num_cells_local, -1);
103-
for (std::size_t i = 0; i < submesh_to_mesh.size(); ++i)
104-
mesh_to_submesh[submesh_to_mesh[i]] = i;
105-
106-
std::map<std::shared_ptr<const mesh::Mesh<U>>,
107-
std::span<const std::int32_t>>
108-
entity_maps = {{submesh, mesh_to_submesh}};
109-
11099
// Next we compute the integration entities on the integration
111100
// domain `mesh`
112101
std::vector<std::int32_t> integration_entities
@@ -118,10 +107,21 @@ int main(int argc, char* argv[])
118107
subdomain_data
119108
= {{fem::IntegralType::cell, {{3, integration_entities}}}};
120109

110+
// A mixed-domain form involves functions defined over multiple
111+
// meshes. The mesh passed to `create_form` is called the
112+
// *integration domain mesh*. To assemble a mixed-domain form, we
113+
// must supply an `EntityMap` for each additional mesh involved in
114+
// the form, relating entities in that mesh to the integration
115+
// domain mesh. In our case, `mesh` is the integration domain mesh,
116+
// and the only other mesh in our form is `submesh`. Hence, we must
117+
// provide the entity map object returned when we called
118+
// `create_submesh`, which relates entities in `submesh` to entities
119+
// in `mesh`.
120+
//
121121
// We can now create the bilinear form
122122
fem::Form<T> a_mixed
123123
= fem::create_form<T>(*form_mixed_codim0_a_mixed, {V, W}, {}, {},
124-
subdomain_data, entity_maps, V->mesh());
124+
subdomain_data, {entity_map}, V->mesh());
125125

126126
la::SparsityPattern sp_mixed = fem::create_sparsity_pattern(a_mixed);
127127
sp_mixed.finalize();

0 commit comments

Comments
 (0)