diff --git a/python/dolfinx/wrappers/mesh.cpp b/python/dolfinx/wrappers/mesh.cpp index 0afa399f92d..7c87bca9e39 100644 --- a/python/dolfinx/wrappers/mesh.cpp +++ b/python/dolfinx/wrappers/mesh.cpp @@ -178,8 +178,16 @@ void declare_mesh(nb::module_& m, std::string type) .def_prop_ro( "cmap", [](dolfinx::mesh::Geometry& self) { return self.cmap(); }, "The coordinate map") - .def_prop_ro("input_global_indices", - &dolfinx::mesh::Geometry::input_global_indices); + .def_prop_ro( + "input_global_indices", + [](const dolfinx::mesh::Geometry& self) + { + const std::vector& id_to_global + = self.input_global_indices(); + return nb::ndarray( + id_to_global.data(), {id_to_global.size()}); + }, + nb::rv_policy::reference_internal); std::string pyclass_mesh_name = std::string("Mesh_") + type; nb::class_>(m, pyclass_mesh_name.c_str(),