Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions firedrake/cython/dmcommon.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3838,6 +3838,10 @@ def submesh_create(PETSc.DM dm,
subdm.removeLabel(temp_label_name)
submesh_update_facet_labels(dm, subdm)
submesh_correct_entity_classes(dm, subdm, ownership_transfer_sf)

# Propagate python attributes
for key, value in dm.getDict().items():
subdm.setAttr(key, value)
return subdm


Expand Down
10 changes: 10 additions & 0 deletions firedrake/dmhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,3 +499,13 @@ def attach_hooks(dm, level=None, sf=None, section=None):
# a non-mixed space)
dm.setCreateFieldDecomposition(create_field_decomposition)
dm.setCreateSubDM(create_subdm)


def migrate_dm_attrs(parent_dm, child_dm):
"""Migrate python attributes from one DM to another.

:arg parent_dm: the parent DM
:arg child_dm: the child DM
"""
for key, value in parent_dm.getDict().items():
child_dm.setAttr(key, value)
2 changes: 2 additions & 0 deletions firedrake/functionspacedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,8 @@ def __str__(self):

@PETSc.Log.EventDecorator()
def boundary_nodes(self, V, sub_domain):
region_names = V.mesh().topology_dm.getAttr("face_region_names") or {}
sub_domain = region_names.get(sub_domain, sub_domain)
if sub_domain in ["bottom", "top"]:
if not V.extruded:
raise ValueError("Invalid subdomain '%s' for non-extruded mesh",
Expand Down
2 changes: 2 additions & 0 deletions firedrake/mg/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from firedrake import utils
from firedrake.cython import mgimpl as impl
from firedrake.dmhooks import migrate_dm_attrs
from .utils import set_level

__all__ = ("HierarchyBase", "MeshHierarchy", "ExtrudedMeshHierarchy", "NonNestedHierarchy",
Expand Down Expand Up @@ -142,6 +143,7 @@ def MeshHierarchy(mesh, refinement_levels,
if i % refinements_per_level == 0:
before(cdm, i)
rdm = cdm.refine()
migrate_dm_attrs(cdm, rdm)
if i % refinements_per_level == 0:
after(rdm, i)
dms.append(rdm)
Expand Down
1 change: 1 addition & 0 deletions firedrake/mg/netgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def uniformRefinementRoutine(ngmesh, cdm):
logger.info(f"\t\t\t[{time.time()}]Refining the plex")
cdm.setRefinementUniform(True)
rdm = cdm.refine()
dmhooks.migrate_dm_attrs(cdm, rdm)
rdm.removeLabel("pyop2_core")
rdm.removeLabel("pyop2_owned")
rdm.removeLabel("pyop2_ghost")
Expand Down
Loading