Skip to content

Commit

Permalink
Add numpy interface to dolfinx.cpp.mesh.extract_topology (#3075)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgensd authored Feb 27, 2024
1 parent ab7e056 commit 03ba4a0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions python/dolfinx/wrappers/mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,16 @@ void mesh(nb::module_& m)
nb::arg("type"));
m.def("get_entity_vertices", &dolfinx::mesh::get_entity_vertices,
nb::arg("type"), nb::arg("dim"));
m.def("extract_topology", &dolfinx::mesh::extract_topology,
nb::arg("cell_type"), nb::arg("layout"), nb::arg("cells"));
m.def(
"extract_topology",
[](dolfinx::mesh::CellType cell_type,
const dolfinx::fem::ElementDofLayout& layout,
nb::ndarray<const std::int64_t, nb::ndim<1>, nb::c_contig> cells)
{
return dolfinx_wrappers::as_nbarray(dolfinx::mesh::extract_topology(
cell_type, layout, std::span(cells.data(), cells.size())));
},
nb::arg("cell_type"), nb::arg("layout"), nb::arg("cells"));

m.def(
"build_dual_graph",
Expand Down

0 comments on commit 03ba4a0

Please sign in to comment.