From a645e069f1a57be774e02e771f1e0987e2036ffa Mon Sep 17 00:00:00 2001 From: Pablo Brubeck Date: Wed, 20 Nov 2024 00:00:05 +0000 Subject: [PATCH] Fixes for Cell.geometric_dimension (#63) --- ngsPETSc/utils/firedrake/hierarchies.py | 6 +++--- ngsPETSc/utils/firedrake/meshes.py | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ngsPETSc/utils/firedrake/hierarchies.py b/ngsPETSc/utils/firedrake/hierarchies.py index 2aaae93..9fba641 100644 --- a/ngsPETSc/utils/firedrake/hierarchies.py +++ b/ngsPETSc/utils/firedrake/hierarchies.py @@ -191,7 +191,7 @@ def NetgenHierarchy(mesh, levs, flags): -degree, either an integer denoting the degree of curvature of all levels of the mesh or a list of levs+1 integers denoting the degree of curvature of each level of the mesh. - -tol, geometric tollerance adopted in snapToNetgenDMPlex. + -tol, geometric tolerance adopted in snapToNetgenDMPlex. -refinement_type, the refinment type to be used: uniform (default), Alfeld ''' if mesh.geometric_dimension() == 3: @@ -238,8 +238,8 @@ def NetgenHierarchy(mesh, levs, flags): if snap == "geometry": snapToNetgenDMPlex(ngmesh, rdm) #We construct a Firedrake mesh from the DMPlex mesh - mesh = fd.Mesh(rdm, dim=meshes[-1].ufl_cell().geometric_dimension(), reorder=False, - distribution_parameters=params, comm=comm) + mesh = fd.Mesh(rdm, dim=meshes[-1].geometric_dimension(), reorder=False, + distribution_parameters=params, comm=comm) if optMoves: #Optimises the mesh, for example smoothing if ngmesh.dim == 2: diff --git a/ngsPETSc/utils/firedrake/meshes.py b/ngsPETSc/utils/firedrake/meshes.py index 43411e3..79fdb11 100644 --- a/ngsPETSc/utils/firedrake/meshes.py +++ b/ngsPETSc/utils/firedrake/meshes.py @@ -289,8 +289,7 @@ def createFromTopology(self, topology, name, comm): ''' cell = topology.ufl_cell() geometric_dim = topology.topology_dm.getCoordinateDim() - cell = cell.reconstruct(geometric_dimension=geometric_dim) - element = fd.VectorElement("Lagrange", cell, 1) + element = fd.VectorElement("Lagrange", cell, 1, dim=geometric_dim) # Create mesh object self.firedrakeMesh = fd.MeshGeometry.__new__(fd.MeshGeometry, element, comm) self.firedrakeMesh._init_topology(topology)