Skip to content

Commit

Permalink
Update FEniCSx utils due to nanobind changes
Browse files Browse the repository at this point in the history
  • Loading branch information
francesco-ballarin committed Nov 15, 2023
1 parent fe93e80 commit e07b605
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ngsPETSc/utils/fenicsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
XDMF
2 changes: 1 addition & 1 deletion tests/test_fenicsx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit e07b605

Please sign in to comment.