Skip to content

Commit 4a91dee

Browse files
committed
Cleanup
1 parent 26e505c commit 4a91dee

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

firedrake/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
# the specific version, here we are more permissive. This is to catch the
44
# case where users don't update their PETSc for a really long time or
55
# accidentally install a too-new release that isn't yet supported.
6-
PETSC_SUPPORTED_VERSIONS = ">=3.24.1"
6+
PETSC_SUPPORTED_VERSIONS = ">=3.24.2"
77

8+
# TODO RELEASE
9+
# PETSC_SUPPORTED_VERSIONS = ">=3.25"
810

911
def init_petsc():
1012
import os

firedrake/mesh.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4740,8 +4740,9 @@ def Submesh(mesh, subdim, subdomain_id, label_name=None, name=None, ignore_halo=
47404740
Parent mesh (`MeshGeometry`).
47414741
subdim : int
47424742
Topological dimension of the submesh.
4743-
subdomain_id : int
4743+
subdomain_id : int | None
47444744
Subdomain ID representing the submesh.
4745+
`None` defines the submesh owned by the sub-communicator.
47454746
label_name : str
47464747
Name of the label to search ``subdomain_id`` in.
47474748
name : str
@@ -4813,23 +4814,22 @@ def Submesh(mesh, subdim, subdomain_id, label_name=None, name=None, ignore_halo=
48134814
raise NotImplementedError("Can not create a submesh of a ``VertexOnlyMesh``")
48144815
plex = mesh.topology_dm
48154816
dim = plex.getDimension()
4816-
if subdim not in [dim, dim - 1]:
4817-
raise NotImplementedError(f"Found submesh dim ({subdim}) and parent dim ({dim})")
4818-
if label_name is None:
4819-
if subdim == dim:
4820-
label_name = dmcommon.CELL_SETS_LABEL
4821-
elif subdim == dim - 1:
4822-
label_name = dmcommon.FACE_SETS_LABEL
4823-
name = name or _generate_default_submesh_name(mesh.name)
4824-
if comm is None or comm == mesh.comm:
4825-
subplex = dmcommon.submesh_create(plex, subdim, label_name, subdomain_id, ignore_halo, comm)
4817+
if subdomain_id is None:
4818+
# Filter the plex with PETSc's default label (cells owned by comm)
4819+
if subdim != dim:
4820+
raise NotImplementedError(f"Found submesh dim ({subdim}) and parent dim ({dim})")
4821+
subplex, _ = plex.filter(sanitizeSubMesh=True, ignoreHalo=ignore_halo, comm=comm)
48264822
else:
4827-
# FIXME
4828-
subplex, _ = plex.filter(label=plex.getLabel(label_name),
4829-
value=subdomain_id,
4830-
sanitizeSubMesh=True,
4831-
ignoreHalo=ignore_halo,
4832-
comm=comm)
4823+
if subdim not in [dim, dim - 1]:
4824+
raise NotImplementedError(f"Found submesh dim ({subdim}) and parent dim ({dim})")
4825+
if label_name is None:
4826+
if subdim == dim:
4827+
label_name = dmcommon.CELL_SETS_LABEL
4828+
elif subdim == dim - 1:
4829+
label_name = dmcommon.FACE_SETS_LABEL
4830+
subplex = dmcommon.submesh_create(plex, subdim, label_name, subdomain_id, ignore_halo, comm=comm)
4831+
4832+
name = name or _generate_default_submesh_name(mesh.name)
48334833
subplex.setName(_generate_default_mesh_topology_name(name))
48344834
if subplex.getDimension() != subdim:
48354835
raise RuntimeError(f"Found subplex dim ({subplex.getDimension()}) != expected ({subdim})")

0 commit comments

Comments
 (0)