From e07b60581f6892f5a691d344c2371297bcb3b6cb Mon Sep 17 00:00:00 2001 From: Francesco Ballarin Date: Wed, 15 Nov 2023 17:52:32 +0100 Subject: [PATCH] Update FEniCSx utils due to nanobind changes --- ngsPETSc/utils/fenicsx.py | 4 ++-- tests/.gitignore | 1 + tests/test_fenicsx.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 tests/.gitignore diff --git a/ngsPETSc/utils/fenicsx.py b/ngsPETSc/utils/fenicsx.py index a16c99e..20f136d 100644 --- a/ngsPETSc/utils/fenicsx.py +++ b/ngsPETSc/utils/fenicsx.py @@ -34,7 +34,7 @@ def model_to_mesh(self, hmax: float, gdim: int = 2, dolfinx.cpp.mesh.MeshTags_int32,dolfinx.cpp.mesh.MeshTags_int32]: """Given a NetGen model, take all physical entities of the highest topological dimension and create the corresponding DOLFINx mesh. - + This function only works in serial, at the moment. Args: @@ -76,6 +76,6 @@ def model_to_mesh(self, hmax: float, gdim: int = 2, ufl_domain = dolfinx.io.gmshio.ufl_mesh(_ngs_to_cells[(gdim,T.shape[1])],gdim) cell_perm = dolfinx.cpp.io.perm_gmsh(dolfinx.cpp.mesh.to_type(str(ufl_domain.ufl_cell())), T.shape[1]) - T = T[:, cell_perm] + T = np.ascontiguousarray(T[:, cell_perm]) mesh = dolfinx.mesh.create_mesh(self.comm, T, V, ufl_domain, partitioner) return mesh diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 0000000..9e68810 --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1 @@ +XDMF diff --git a/tests/test_fenicsx.py b/tests/test_fenicsx.py index 20ac9f3..3374db0 100644 --- a/tests/test_fenicsx.py +++ b/tests/test_fenicsx.py @@ -43,7 +43,7 @@ def test_poisson_netgen(): geo.AddRectangle((0,0),(np.pi,np.pi)) geoModel = ngfx.GeometricModel(geo, MPI.COMM_WORLD) msh = geoModel.model_to_mesh(hmax=0.1) - V = fem.FunctionSpace(msh, ("Lagrange", 2)) #pylint: disable=E1120 + V = fem.functionspace(msh, ("Lagrange", 2)) #pylint: disable=E1120 facetsLR = mesh.locate_entities_boundary(msh, dim=(msh.topology.dim - 1), marker=lambda x: np.logical_or(np.isclose(x[0], 0.0), np.isclose(x[0], np.pi)))