From cbfc2b2f359a2524b0871ead22e6b297fe8929ff Mon Sep 17 00:00:00 2001 From: MohamedAlyLoutfy <73834061+MohamedAlyLoutfy@users.noreply.github.com> Date: Wed, 15 Jan 2025 16:34:52 +0100 Subject: [PATCH] Preserve default mesh name after Netgen mesh creation (#3951) * Preserve default mesh name after Netgen mesh creation to avoid checkpointing errors * Ensure consistent handling of mesh and topology names for Netgen and non-Netgen meshes --- firedrake/mesh.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/firedrake/mesh.py b/firedrake/mesh.py index 7e9a61773b..8a0f8ec8a9 100644 --- a/firedrake/mesh.py +++ b/firedrake/mesh.py @@ -3073,6 +3073,7 @@ def Mesh(meshfile, **kwargs): netgen_flags = kwargs.get("netgen_flags", {"quad": False, "transform": None, "purify_to_tets": False}) netgen_firedrake_mesh = FiredrakeMesh(meshfile, netgen_flags, user_comm) plex = netgen_firedrake_mesh.meshMap.petscPlex + plex.setName(_generate_default_mesh_topology_name(name)) else: basename, ext = os.path.splitext(meshfile) if ext.lower() in ['.e', '.exo']: @@ -3099,10 +3100,11 @@ def Mesh(meshfile, **kwargs): distribution_name=kwargs.get("distribution_name"), permutation_name=kwargs.get("permutation_name"), comm=user_comm) - mesh = make_mesh_from_mesh_topology(topology, name) if netgen and isinstance(meshfile, netgen.libngpy._meshing.Mesh): - netgen_firedrake_mesh.createFromTopology(topology, name=plex.getName(), comm=user_comm) + netgen_firedrake_mesh.createFromTopology(topology, name=name, comm=user_comm) mesh = netgen_firedrake_mesh.firedrakeMesh + else: + mesh = make_mesh_from_mesh_topology(topology, name) mesh._tolerance = tolerance return mesh