Skip to content

Commit d905c57

Browse files
committed
Fix labelling for UnitSquareMesh (expect others to fail)
1 parent 37f7512 commit d905c57

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

firedrake/utility_meshes.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -736,12 +736,13 @@ def TensorRectangleMesh(
736736
)
737737

738738
# mark boundary facets
739-
plex.createLabel(dmcommon.FACE_SETS_LABEL)
740-
plex.markBoundaryFaces("boundary_faces")
739+
topology_dm = plex.getCoordinateDM()
740+
topology_dm.createLabel(dmcommon.FACE_SETS_LABEL)
741+
topology_dm.markBoundaryFaces("boundary_faces")
741742
coords = plex.getCoordinates()
742743
coord_sec = plex.getCoordinateSection()
743-
if plex.getStratumSize("boundary_faces", 1) > 0:
744-
boundary_faces = plex.getStratumIS("boundary_faces", 1).getIndices()
744+
if topology_dm.getStratumSize("boundary_faces", 1) > 0:
745+
boundary_faces = topology_dm.getStratumIS("boundary_faces", 1).getIndices()
745746
xtol = 0.5 * min(xcoords[1] - xcoords[0], xcoords[-1] - xcoords[-2])
746747
ytol = 0.5 * min(ycoords[1] - ycoords[0], ycoords[-1] - ycoords[-2])
747748
x0 = xcoords[0]
@@ -751,14 +752,14 @@ def TensorRectangleMesh(
751752
for face in boundary_faces:
752753
face_coords = plex.vecGetClosure(coord_sec, coords, face)
753754
if abs(face_coords[0] - x0) < xtol and abs(face_coords[2] - x0) < xtol:
754-
plex.setLabelValue(dmcommon.FACE_SETS_LABEL, face, 1)
755+
topology_dm.setLabelValue(dmcommon.FACE_SETS_LABEL, face, 1)
755756
if abs(face_coords[0] - x1) < xtol and abs(face_coords[2] - x1) < xtol:
756-
plex.setLabelValue(dmcommon.FACE_SETS_LABEL, face, 2)
757+
topology_dm.setLabelValue(dmcommon.FACE_SETS_LABEL, face, 2)
757758
if abs(face_coords[1] - y0) < ytol and abs(face_coords[3] - y0) < ytol:
758-
plex.setLabelValue(dmcommon.FACE_SETS_LABEL, face, 3)
759+
topology_dm.setLabelValue(dmcommon.FACE_SETS_LABEL, face, 3)
759760
if abs(face_coords[1] - y1) < ytol and abs(face_coords[3] - y1) < ytol:
760-
plex.setLabelValue(dmcommon.FACE_SETS_LABEL, face, 4)
761-
plex.removeLabel("boundary_faces")
761+
topology_dm.setLabelValue(dmcommon.FACE_SETS_LABEL, face, 4)
762+
topology_dm.removeLabel("boundary_faces")
762763
m = mesh.Mesh(
763764
plex,
764765
reorder=reorder,

0 commit comments

Comments
 (0)