Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make dolfinx.mesh.Mesh.input_global_indices a numpy array #3069

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions python/dolfinx/wrappers/mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,16 @@ void declare_mesh(nb::module_& m, std::string type)
.def_prop_ro(
"cmap", [](dolfinx::mesh::Geometry<T>& self) { return self.cmap(); },
"The coordinate map")
.def_prop_ro("input_global_indices",
&dolfinx::mesh::Geometry<T>::input_global_indices);
.def_prop_ro(
"input_global_indices",
[](const dolfinx::mesh::Geometry<T>& self)
{
const std::vector<std::int64_t>& id_to_global
= self.input_global_indices();
return nb::ndarray<const std::int64_t, nb::numpy>(
id_to_global.data(), {id_to_global.size()});
},
nb::rv_policy::reference_internal);

std::string pyclass_mesh_name = std::string("Mesh_") + type;
nb::class_<dolfinx::mesh::Mesh<T>>(m, pyclass_mesh_name.c_str(),
Expand Down
Loading