1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
|
From 6c678866d1c628de4d09bfa78acc76758279b2b0 Mon Sep 17 00:00:00 2001
From: schnellerhase <56360279+schnellerhase@users.noreply.github.com>
Date: Mon, 24 Nov 2025 15:22:09 +0100
Subject: [PATCH 1/6] Parametrize test over partitioners
---
python/test/unit/mesh/test_mesh.py | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/python/test/unit/mesh/test_mesh.py b/python/test/unit/mesh/test_mesh.py
index 2fcad72e94..f8f9d6261b 100644
--- a/python/test/unit/mesh/test_mesh.py
+++ b/python/test/unit/mesh/test_mesh.py
@@ -13,6 +13,7 @@
import pytest
import basix
+import dolfinx.cpp.graph
import ufl
from basix.ufl import element
from dolfinx import cpp as _cpp
@@ -736,7 +737,17 @@ def test_mesh_create_cmap(dtype):
assert msh.ufl_domain() is None
-def test_mesh_single_process_distribution():
+avail_partioners = []
+if dolfinx.has_ptscotch:
+ avail_partioners.append(dolfinx.cpp.graph.partitioner_scotch)
+if dolfinx.has_kahip:
+ avail_partioners.append(dolfinx.cpp.graph.partitioner_kahip)
+if dolfinx.has_parmetis:
+ avail_partioners.append(dolfinx.cpp.graph.partitioner_parmetis)
+
+
+@pytest.mark.parametrize("partitioner", avail_partioners)
+def test_mesh_single_process_distribution(partitioner):
comm = MPI.COMM_WORLD
if comm.rank == 0:
@@ -750,7 +761,13 @@ def test_mesh_single_process_distribution():
x = np.zeros((0, 3), dtype=np.float64)
element = ufl.Mesh(basix.ufl.element("Lagrange", "interval", 1, shape=(3,)))
- mesh = _mesh.create_mesh(MPI.COMM_WORLD, cells, element, x)
+ mesh = _mesh.create_mesh(
+ MPI.COMM_WORLD,
+ cells,
+ element,
+ x,
+ partitioner=dolfinx.mesh.create_cell_partitioner(partitioner()),
+ )
assert mesh.topology.index_map(0).size_global == 3
assert mesh.topology.index_map(1).size_global == 3
From 2eeffee3955dad822924f18ed0e6a63820b834c2 Mon Sep 17 00:00:00 2001
From: schnellerhase <56360279+schnellerhase@users.noreply.github.com>
Date: Mon, 24 Nov 2025 16:20:25 +0100
Subject: [PATCH 2/6] xfail broken test
---
python/test/unit/mesh/test_mesh.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/python/test/unit/mesh/test_mesh.py b/python/test/unit/mesh/test_mesh.py
index f8f9d6261b..b5af9cad3f 100644
--- a/python/test/unit/mesh/test_mesh.py
+++ b/python/test/unit/mesh/test_mesh.py
@@ -739,7 +739,9 @@ def test_mesh_create_cmap(dtype):
avail_partioners = []
if dolfinx.has_ptscotch:
- avail_partioners.append(dolfinx.cpp.graph.partitioner_scotch)
+ avail_partioners.append(
+ pytest.param(dolfinx.cpp.graph.partitioner_scotch, marks=pytest.mark.xfail(reason="Bug"))
+ )
if dolfinx.has_kahip:
avail_partioners.append(dolfinx.cpp.graph.partitioner_kahip)
if dolfinx.has_parmetis:
@@ -775,5 +777,6 @@ def test_mesh_single_process_distribution(partitioner):
for conn in ((0, 1), (1, 0)):
mesh.topology.create_connectivity(*conn)
adj = mesh.topology.connectivity(*conn)
+ print(adj.array)
for i in range(adj.num_nodes):
assert adj.links(i).size == 2
From c750f4a1717afc8bb06b077ff781b20681b01442 Mon Sep 17 00:00:00 2001
From: schnellerhase <56360279+schnellerhase@users.noreply.github.com>
Date: Mon, 24 Nov 2025 17:10:38 +0100
Subject: [PATCH 3/6] Context to skip
---
python/test/unit/mesh/test_mesh.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/python/test/unit/mesh/test_mesh.py b/python/test/unit/mesh/test_mesh.py
index b5af9cad3f..56df1b2fe7 100644
--- a/python/test/unit/mesh/test_mesh.py
+++ b/python/test/unit/mesh/test_mesh.py
@@ -740,7 +740,12 @@ def test_mesh_create_cmap(dtype):
avail_partioners = []
if dolfinx.has_ptscotch:
avail_partioners.append(
- pytest.param(dolfinx.cpp.graph.partitioner_scotch, marks=pytest.mark.xfail(reason="Bug"))
+ pytest.param(
+ dolfinx.cpp.graph.partitioner_scotch,
+ marks=pytest.mark.xfail(
+ reason="SCOTCH partitioner results in parallel in unpexpected mesh connectivity."
+ ),
+ )
)
if dolfinx.has_kahip:
avail_partioners.append(dolfinx.cpp.graph.partitioner_kahip)
From f81cf30ed6fe9f1c8c7cbb86ba4eb8df607d0de5 Mon Sep 17 00:00:00 2001
From: Drew Parsons <dparsons@debian.org>
Date: Mon, 24 Nov 2025 17:35:42 +0100
Subject: [PATCH 4/6] minor spelling correction
---
python/test/unit/mesh/test_mesh.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/python/test/unit/mesh/test_mesh.py b/python/test/unit/mesh/test_mesh.py
index 56df1b2fe7..b79fd24305 100644
--- a/python/test/unit/mesh/test_mesh.py
+++ b/python/test/unit/mesh/test_mesh.py
@@ -650,10 +650,10 @@ def test_boundary_facets(n, d, ghost_mode, dtype):
"""Test that the correct number of boundary facets are computed"""
if d == 2:
mesh = create_unit_square(MPI.COMM_WORLD, n, n, ghost_mode=ghost_mode, dtype=dtype)
- expected_num_boundary_facets = 4 * n
+ exd_num_boundary_facets = 4 * n
else:
mesh = create_unit_cube(MPI.COMM_WORLD, n, n, n, ghost_mode=ghost_mode, dtype=dtype)
- expected_num_boundary_facets = 6 * n**2 * 2
+ exd_num_boundary_facets = 6 * n**2 * 2
assert compute_num_boundary_facets(mesh) == expected_num_boundary_facets
@@ -743,7 +743,7 @@ def test_mesh_create_cmap(dtype):
pytest.param(
dolfinx.cpp.graph.partitioner_scotch,
marks=pytest.mark.xfail(
- reason="SCOTCH partitioner results in parallel in unpexpected mesh connectivity."
+ reason="SCOTCH partitioner in parallel results in unexpected mesh connectivity."
),
)
)
From 25d7ec7b408ed75528fa7c471631b8184d9f8c5e Mon Sep 17 00:00:00 2001
From: schnellerhase <56360279+schnellerhase@users.noreply.github.com>
Date: Mon, 24 Nov 2025 18:38:30 +0100
Subject: [PATCH 5/6] fix
---
python/test/unit/mesh/test_mesh.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/python/test/unit/mesh/test_mesh.py b/python/test/unit/mesh/test_mesh.py
index b79fd24305..c27515d81a 100644
--- a/python/test/unit/mesh/test_mesh.py
+++ b/python/test/unit/mesh/test_mesh.py
@@ -655,7 +655,7 @@ def test_boundary_facets(n, d, ghost_mode, dtype):
mesh = create_unit_cube(MPI.COMM_WORLD, n, n, n, ghost_mode=ghost_mode, dtype=dtype)
exd_num_boundary_facets = 6 * n**2 * 2
- assert compute_num_boundary_facets(mesh) == expected_num_boundary_facets
+ assert compute_num_boundary_facets(mesh) == exd_num_boundary_facets
@pytest.mark.parametrize("n", [3, 5])
From f99c6f1719664ab58eb2e94679a826934c8e1732 Mon Sep 17 00:00:00 2001
From: schnellerhase <56360279+schnellerhase@users.noreply.github.com>
Date: Mon, 24 Nov 2025 18:39:50 +0100
Subject: [PATCH 6/6] Remove debug output
---
python/test/unit/mesh/test_mesh.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/python/test/unit/mesh/test_mesh.py b/python/test/unit/mesh/test_mesh.py
index c27515d81a..d93da73cb1 100644
--- a/python/test/unit/mesh/test_mesh.py
+++ b/python/test/unit/mesh/test_mesh.py
@@ -782,6 +782,5 @@ def test_mesh_single_process_distribution(partitioner):
for conn in ((0, 1), (1, 0)):
mesh.topology.create_connectivity(*conn)
adj = mesh.topology.connectivity(*conn)
- print(adj.array)
for i in range(adj.num_nodes):
assert adj.links(i).size == 2
|