Bug#1072183: fenics-dolfinx: FTBFS with nanobind 2.0
Gianfranco Costamagna
locutusofborg at debian.org
Thu May 30 10:25:27 BST 2024
Hello, I'm attaching a patch that applies cleanly.
I'm testing the build
G.
On Wed, 29 May 2024 23:31:23 +0200 =?utf-8?q?Timo_R=C3=B6hling?= <roehling at debian.org> wrote:
> Source: fenics-dolfinx
> Version: 1:0.8.0-6
> Severity: serious
> Tags: patch
>
> Dear maintainer,
>
> upgrading to nanobind 2.0 made your package FTBFS. I am sorry that I did not
> check this before uploading to unstable, that is on me. I have seen that
> Francesco has already fixed the issue upstream [1]. Depending on how far away
> the next upstream release is, maybe you can backport that fix?
>
>
> Cheers
> Timo
>
> [1]
> https://github.com/FEniCS/dolfinx/commit/42c43485e81ada306f0b3f1dc735d95539174cbc
>
>
>
>
-------------- next part --------------
diff -Nru fenics-dolfinx-0.8.0/debian/changelog fenics-dolfinx-0.8.0/debian/changelog
--- fenics-dolfinx-0.8.0/debian/changelog 2024-05-12 11:17:08.000000000 +0200
+++ fenics-dolfinx-0.8.0/debian/changelog 2024-05-30 11:05:39.000000000 +0200
@@ -1,3 +1,10 @@
+fenics-dolfinx (1:0.8.0-6ubuntu1) oracular; urgency=medium
+
+ * debian/patches/42c43485e81ada306f0b3f1dc735d95539174cbc.patch:
+ - upstream fix for newer nanobind 2.0 (Closes: #1072183)
+
+ -- Gianfranco Costamagna <locutusofborg at debian.org> Thu, 30 May 2024 11:05:39 +0200
+
fenics-dolfinx (1:0.8.0-6) unstable; urgency=medium
* debian patch Newton_KSP_ref_counter_PR3190.patch applies upstream
diff -Nru fenics-dolfinx-0.8.0/debian/control fenics-dolfinx-0.8.0/debian/control
--- fenics-dolfinx-0.8.0/debian/control 2024-05-12 11:17:08.000000000 +0200
+++ fenics-dolfinx-0.8.0/debian/control 2024-05-30 11:05:39.000000000 +0200
@@ -1,7 +1,8 @@
Source: fenics-dolfinx
Section: math
Priority: optional
-Maintainer: Debian Science Team <debian-science-maintainers at lists.alioth.debian.org>
+Maintainer: Ubuntu Developers <ubuntu-devel-discuss at lists.ubuntu.com>
+XSBC-Original-Maintainer: Debian Science Team <debian-science-maintainers at lists.alioth.debian.org>
Uploaders:
Drew Parsons <dparsons at debian.org>,
Francesco Ballarin <francesco.ballarin at unicatt.it>
diff -Nru fenics-dolfinx-0.8.0/debian/patches/42c43485e81ada306f0b3f1dc735d95539174cbc.patch fenics-dolfinx-0.8.0/debian/patches/42c43485e81ada306f0b3f1dc735d95539174cbc.patch
--- fenics-dolfinx-0.8.0/debian/patches/42c43485e81ada306f0b3f1dc735d95539174cbc.patch 1970-01-01 01:00:00.000000000 +0100
+++ fenics-dolfinx-0.8.0/debian/patches/42c43485e81ada306f0b3f1dc735d95539174cbc.patch 2024-05-30 11:05:39.000000000 +0200
@@ -0,0 +1,495 @@
+From 42c43485e81ada306f0b3f1dc735d95539174cbc Mon Sep 17 00:00:00 2001
+From: Francesco Ballarin <francesco.ballarin at unicatt.it>
+Date: Fri, 24 May 2024 09:02:41 +0200
+Subject: [PATCH] Replace `nb::any` with -1 and add argument to `nb::ndarray`
+ in preparation of next nanobind release (#3105)
+
+* Replace nb::any with -1 in preparation of next nanobind release
+
+* nb::ndarray now requires to pass in the owner argument, which used to have a default value. Assign the former defaul value everywhere in nb wrappers
+
+* DROP BEFORE MERGE: install nanobind from source in workflows
+
+* CI update
+
+* Bump min nanobind version
+
+* CI udpates
+
+* System install
+
+* pip install system
+
+* Remove CI change
+
+* More updates
+
+* cmake update
+
+* Run clang-format
+
+---------
+
+Co-authored-by: Garth N. Wells <gnw20 at cam.ac.uk>
+---
+ .github/workflows/ccpp.yml | 14 ++++++++--
+ .github/workflows/conda.yml | 1 -
+ .github/workflows/oneapi.yml | 6 +++-
+ .github/workflows/redhat.yml | 7 +++--
+ cpp/cmake/templates/DOLFINXConfig.cmake.in | 2 +-
+ docker/Dockerfile.test-env | 2 +-
+ python/build-requirements.txt | 2 +-
+ python/dolfinx/wrappers/assemble.cpp | 13 +++++----
+ python/dolfinx/wrappers/common.cpp | 6 ++--
+ python/dolfinx/wrappers/fem.cpp | 30 ++++++++++----------
+ python/dolfinx/wrappers/geometry.cpp | 17 +++++++-----
+ python/dolfinx/wrappers/graph.cpp | 9 +++---
+ python/dolfinx/wrappers/la.cpp | 17 ++++++------
+ python/dolfinx/wrappers/log.cpp | 5 ++--
+ python/dolfinx/wrappers/mesh.cpp | 32 ++++++++++++----------
+ python/pyproject.toml | 2 +-
+ 16 files changed, 94 insertions(+), 71 deletions(-)
+
+diff --git a/cpp/cmake/templates/DOLFINXConfig.cmake.in b/cpp/cmake/templates/DOLFINXConfig.cmake.in
+index 5e22232d333..dfcf1eaa81d 100644
+--- a/cpp/cmake/templates/DOLFINXConfig.cmake.in
++++ b/cpp/cmake/templates/DOLFINXConfig.cmake.in
+@@ -18,7 +18,7 @@ if(DEFINED ENV{BOOST_ROOT} OR DEFINED BOOST_ROOT)
+ endif()
+ set(Boost_USE_MULTITHREADED $ENV{BOOST_USE_MULTITHREADED})
+ set(Boost_VERBOSE TRUE)
+-find_dependency(Boost 1.70 REQUIRED COMPONENTS timer filesystem)
++find_dependency(Boost 1.70 REQUIRED COMPONENTS timer)
+
+ if(@ufcx_FOUND@)
+ find_dependency(ufcx)
+diff --git a/python/dolfinx/wrappers/assemble.cpp b/python/dolfinx/wrappers/assemble.cpp
+index fb4460b49aa..7dc07803e07 100644
+--- a/python/dolfinx/wrappers/assemble.cpp
++++ b/python/dolfinx/wrappers/assemble.cpp
+@@ -362,12 +362,13 @@ void declare_assembly_functions(nb::module_& m)
+ std::span<const std::int32_t> cols,
+ std::span<const T> data)
+ {
+- return fin(nb::ndarray<const std::int32_t, nb::ndim<1>, nb::c_contig,
+- nb::numpy>(rows.data(), {rows.size()}),
+- nb::ndarray<const std::int32_t, nb::ndim<1>, nb::c_contig,
+- nb::numpy>(cols.data(), {cols.size()}),
+- nb::ndarray<const T, nb::ndim<2>, nb::c_contig, nb::numpy>(
+- data.data(), {data.size()}));
++ return fin(
++ nb::ndarray<const std::int32_t, nb::ndim<1>, nb::c_contig,
++ nb::numpy>(rows.data(), {rows.size()}, nb::handle()),
++ nb::ndarray<const std::int32_t, nb::ndim<1>, nb::c_contig,
++ nb::numpy>(cols.data(), {cols.size()}, nb::handle()),
++ nb::ndarray<const T, nb::ndim<2>, nb::c_contig, nb::numpy>(
++ data.data(), {data.size()}, nb::handle()));
+ };
+ dolfinx::fem::assemble_matrix(f, form, bcs);
+ },
+diff --git a/python/dolfinx/wrappers/common.cpp b/python/dolfinx/wrappers/common.cpp
+index 66bbe921e2a..d2bec947a07 100644
+--- a/python/dolfinx/wrappers/common.cpp
++++ b/python/dolfinx/wrappers/common.cpp
+@@ -108,8 +108,8 @@ void common(nb::module_& m)
+ [](const dolfinx::common::IndexMap& self)
+ {
+ std::span ghosts = self.ghosts();
+- return nb::ndarray<const std::int64_t, nb::numpy>(ghosts.data(),
+- {ghosts.size()});
++ return nb::ndarray<const std::int64_t, nb::numpy>(
++ ghosts.data(), {ghosts.size()}, nb::handle());
+ },
+ nb::rv_policy::reference_internal, "Return list of ghost indices")
+ .def_prop_ro(
+@@ -118,7 +118,7 @@ void common(nb::module_& m)
+ {
+ std::span owners = self.owners();
+ return nb::ndarray<nb::numpy, const int, nb::ndim<1>>(
+- owners.data(), {owners.size()});
++ owners.data(), {owners.size()}, nb::handle());
+ },
+ nb::rv_policy::reference_internal)
+ .def(
+diff --git a/python/dolfinx/wrappers/fem.cpp b/python/dolfinx/wrappers/fem.cpp
+index ed057a2aa55..b7b00d728a0 100644
+--- a/python/dolfinx/wrappers/fem.cpp
++++ b/python/dolfinx/wrappers/fem.cpp
+@@ -86,8 +86,8 @@ void declare_function_space(nb::module_& m, std::string type)
+ [](const dolfinx::fem::FunctionSpace<T>& self)
+ {
+ std::span<const std::size_t> vshape = self.value_shape();
+- return nb::ndarray<const std::size_t, nb::numpy>(vshape.data(),
+- {vshape.size()});
++ return nb::ndarray<const std::size_t, nb::numpy>(
++ vshape.data(), {vshape.size()}, nb::handle());
+ },
+ nb::rv_policy::reference_internal)
+ .def("sub", &dolfinx::fem::FunctionSpace<T>::sub, nb::arg("component"))
+@@ -360,7 +360,7 @@ void declare_objects(nb::module_& m, const std::string& type)
+ {
+ auto [dofs, owned] = self.dof_indices();
+ return std::pair(nb::ndarray<const std::int32_t, nb::numpy>(
+- dofs.data(), {dofs.size()}),
++ dofs.data(), {dofs.size()}, nb::handle()),
+ owned);
+ })
+ .def_prop_ro("function_space",
+@@ -512,8 +512,9 @@ void declare_objects(nb::module_& m, const std::string& type)
+ "value",
+ [](dolfinx::fem::Constant<T>& self)
+ {
+- return nb::ndarray<T, nb::numpy>(
+- self.value.data(), self.shape.size(), self.shape.data());
++ return nb::ndarray<T, nb::numpy>(self.value.data(),
++ self.shape.size(),
++ self.shape.data(), nb::handle());
+ },
+ nb::rv_policy::reference_internal);
+
+@@ -718,17 +719,17 @@ void declare_form(nb::module_& m, std::string type)
+ switch (type)
+ {
+ case dolfinx::fem::IntegralType::cell:
+- return nb::ndarray<const std::int32_t, nb::numpy>(_d.data(),
+- {_d.size()});
++ return nb::ndarray<const std::int32_t, nb::numpy>(
++ _d.data(), {_d.size()}, nb::handle());
+ case dolfinx::fem::IntegralType::exterior_facet:
+ {
+ return nb::ndarray<const std::int32_t, nb::numpy>(
+- _d.data(), {_d.size() / 2, 2});
++ _d.data(), {_d.size() / 2, 2}, nb::handle());
+ }
+ case dolfinx::fem::IntegralType::interior_facet:
+ {
+ return nb::ndarray<const std::int32_t, nb::numpy>(
+- _d.data(), {_d.size() / 4, 2, 2});
++ _d.data(), {_d.size() / 4, 2, 2}, nb::handle());
+ }
+ default:
+ throw ::std::runtime_error("Integral type unsupported.");
+@@ -1000,7 +1001,7 @@ void declare_real_functions(nb::module_& m)
+ auto _marker = [&marker](auto x)
+ {
+ nb::ndarray<const T, nb::ndim<2>, nb::numpy> x_view(
+- x.data_handle(), {x.extent(0), x.extent(1)});
++ x.data_handle(), {x.extent(0), x.extent(1)}, nb::handle());
+ auto marked = marker(x_view);
+ return std::vector<std::int8_t>(marked.data(),
+ marked.data() + marked.size());
+@@ -1023,7 +1024,7 @@ void declare_real_functions(nb::module_& m)
+ auto _marker = [&marker](auto x)
+ {
+ nb::ndarray<const T, nb::ndim<2>, nb::numpy> x_view(
+- x.data_handle(), {x.extent(0), x.extent(1)});
++ x.data_handle(), {x.extent(0), x.extent(1)}, nb::handle());
+ auto marked = marker(x_view);
+ return std::vector<std::int8_t>(marked.data(),
+ marked.data() + marked.size());
+@@ -1167,8 +1168,8 @@ void fem(nb::module_& m)
+ [](const dolfinx::fem::DofMap& self, int cell)
+ {
+ std::span<const std::int32_t> dofs = self.cell_dofs(cell);
+- return nb::ndarray<const std::int32_t, nb::numpy>(dofs.data(),
+- {dofs.size()});
++ return nb::ndarray<const std::int32_t, nb::numpy>(
++ dofs.data(), {dofs.size()}, nb::handle());
+ },
+ nb::rv_policy::reference_internal, nb::arg("cell"))
+ .def_prop_ro("bs", &dolfinx::fem::DofMap::bs)
+@@ -1178,7 +1179,8 @@ void fem(nb::module_& m)
+ {
+ auto dofs = self.map();
+ return nb::ndarray<const std::int32_t, nb::numpy>(
+- dofs.data_handle(), {dofs.extent(0), dofs.extent(1)});
++ dofs.data_handle(), {dofs.extent(0), dofs.extent(1)},
++ nb::handle());
+ },
+ nb::rv_policy::reference_internal);
+
+diff --git a/python/dolfinx/wrappers/geometry.cpp b/python/dolfinx/wrappers/geometry.cpp
+index 8bf5524dff9..d64e70cb584 100644
+--- a/python/dolfinx/wrappers/geometry.cpp
++++ b/python/dolfinx/wrappers/geometry.cpp
+@@ -75,7 +75,7 @@ void declare_bbtree(nb::module_& m, std::string type)
+ m.def(
+ "compute_collisions_points",
+ [](const dolfinx::geometry::BoundingBoxTree<T>& tree,
+- nb::ndarray<const T, nb::shape<nb::any, 3>, nb::c_contig> points)
++ nb::ndarray<const T, nb::shape<-1, 3>, nb::c_contig> points)
+ {
+ return dolfinx::geometry::compute_collisions<T>(
+ tree, std::span(points.data(), points.size()));
+@@ -111,7 +111,7 @@ void declare_bbtree(nb::module_& m, std::string type)
+ [](const dolfinx::geometry::BoundingBoxTree<T>& tree,
+ const dolfinx::geometry::BoundingBoxTree<T>& midpoint_tree,
+ const dolfinx::mesh::Mesh<T>& mesh,
+- nb::ndarray<const T, nb::shape<nb::any, 3>, nb::c_contig> points)
++ nb::ndarray<const T, nb::shape<-1, 3>, nb::c_contig> points)
+ {
+ return dolfinx_wrappers::as_nbarray(
+ dolfinx::geometry::compute_closest_entity<T>(
+@@ -144,7 +144,7 @@ void declare_bbtree(nb::module_& m, std::string type)
+ "compute_colliding_cells",
+ [](const dolfinx::mesh::Mesh<T>& mesh,
+ const dolfinx::graph::AdjacencyList<int>& candidate_cells,
+- nb::ndarray<const T, nb::shape<nb::any, 3>, nb::c_contig> points)
++ nb::ndarray<const T, nb::shape<-1, 3>, nb::c_contig> points)
+ {
+ return dolfinx::geometry::compute_colliding_cells<T>(
+ mesh, candidate_cells, std::span(points.data(), points.size()));
+#@@ -220,26 +220,29 @@ void declare_bbtree(nb::module_& m, std::string type)
+# [](const dolfinx::geometry::PointOwnershipData<T>& self)
+# {
+# return nb::ndarray<const int, nb::numpy>(
+#- self.src_owner.data(), {self.src_owner.size()});
+#+ self.src_owner.data(), {self.src_owner.size()},
+#+ nb::handle());
+# })
+# .def_prop_ro("dest_owners",
+# [](const dolfinx::geometry::PointOwnershipData<T>& self)
+# {
+# return nb::ndarray<const int, nb::numpy>(
+#- self.dest_owners.data(), {self.dest_owners.size()});
+#+ self.dest_owners.data(), {self.dest_owners.size()},
+#+ nb::handle());
+# })
+# .def_prop_ro("dest_points",
+# [](const dolfinx::geometry::PointOwnershipData<T>& self)
+# {
+# return nb::ndarray<const T, nb::numpy>(
+# self.dest_points.data(),
+#- {self.dest_points.size() / 3, 3});
+#+ {self.dest_points.size() / 3, 3}, nb::handle());
+# })
+# .def_prop_ro("dest_cells",
+# [](const dolfinx::geometry::PointOwnershipData<T>& self)
+# {
+# return nb::ndarray<const std::int32_t, nb::numpy>(
+#- self.dest_cells.data(), {self.dest_cells.size()});
+#+ self.dest_cells.data(), {self.dest_cells.size()},
+#+ nb::handle());
+# });
+# }
+# } // namespace
+diff --git a/python/dolfinx/wrappers/graph.cpp b/python/dolfinx/wrappers/graph.cpp
+index fa07807c9ae..d20900e908f 100644
+--- a/python/dolfinx/wrappers/graph.cpp
++++ b/python/dolfinx/wrappers/graph.cpp
+@@ -82,7 +82,8 @@ void declare_adjacency_list(nb::module_& m, std::string type)
+ [](const dolfinx::graph::AdjacencyList<T>& self, int i)
+ {
+ std::span<const T> link = self.links(i);
+- return nb::ndarray<const T, nb::numpy>(link.data(), {link.size()});
++ return nb::ndarray<const T, nb::numpy>(link.data(), {link.size()},
++ nb::handle());
+ },
+ nb::rv_policy::reference_internal, nb::arg("i"),
+ "Links (edges) of a node")
+@@ -90,8 +91,8 @@ void declare_adjacency_list(nb::module_& m, std::string type)
+ "array",
+ [](const dolfinx::graph::AdjacencyList<T>& self)
+ {
+- return nb::ndarray<const T, nb::numpy>(self.array().data(),
+- {self.array().size()});
++ return nb::ndarray<const T, nb::numpy>(
++ self.array().data(), {self.array().size()}, nb::handle());
+ },
+ nb::rv_policy::reference_internal)
+ .def_prop_ro(
+@@ -99,7 +100,7 @@ void declare_adjacency_list(nb::module_& m, std::string type)
+ [](const dolfinx::graph::AdjacencyList<T>& self)
+ {
+ return nb::ndarray<const std::int32_t, nb::numpy>(
+- self.offsets().data(), {self.offsets().size()});
++ self.offsets().data(), {self.offsets().size()}, nb::handle());
+ },
+ nb::rv_policy::reference_internal)
+ .def_prop_ro("num_nodes", &dolfinx::graph::AdjacencyList<T>::num_nodes)
+diff --git a/python/dolfinx/wrappers/la.cpp b/python/dolfinx/wrappers/la.cpp
+index 7ae8880d0fc..e84590e31d1 100644
+--- a/python/dolfinx/wrappers/la.cpp
++++ b/python/dolfinx/wrappers/la.cpp
+@@ -55,7 +55,8 @@ void declare_objects(nb::module_& m, const std::string& type)
+ [](dolfinx::la::Vector<T>& self)
+ {
+ return nb::ndarray<T, nb::numpy>(self.mutable_array().data(),
+- {self.array().size()});
++ {self.array().size()},
++ nb::handle());
+ },
+ nb::rv_policy::reference_internal)
+ .def("scatter_forward", &dolfinx::la::Vector<T>::scatter_fwd)
+@@ -144,8 +145,8 @@ void declare_objects(nb::module_& m, const std::string& type)
+ "data",
+ [](dolfinx::la::MatrixCSR<T>& self)
+ {
+- return nb::ndarray<T, nb::numpy>(self.values().data(),
+- {self.values().size()});
++ return nb::ndarray<T, nb::numpy>(
++ self.values().data(), {self.values().size()}, nb::handle());
+ },
+ nb::rv_policy::reference_internal)
+ .def_prop_ro(
+@@ -153,7 +154,7 @@ void declare_objects(nb::module_& m, const std::string& type)
+ [](dolfinx::la::MatrixCSR<T>& self)
+ {
+ return nb::ndarray<const std::int32_t, nb::numpy>(
+- self.cols().data(), {self.cols().size()});
++ self.cols().data(), {self.cols().size()}, nb::handle());
+ },
+ nb::rv_policy::reference_internal)
+ .def_prop_ro(
+@@ -161,8 +162,8 @@ void declare_objects(nb::module_& m, const std::string& type)
+ [](dolfinx::la::MatrixCSR<T>& self)
+ {
+ std::span<const std::int64_t> array = self.row_ptr();
+- return nb::ndarray<const std::int64_t, nb::numpy>(array.data(),
+- {array.size()});
++ return nb::ndarray<const std::int64_t, nb::numpy>(
++ array.data(), {array.size()}, nb::handle());
+ },
+ nb::rv_policy::reference_internal)
+ .def("scatter_rev_begin", &dolfinx::la::MatrixCSR<T>::scatter_rev_begin)
+@@ -276,9 +277,9 @@ void la(nb::module_& m)
+ {
+ auto [edges, ptr] = self.graph();
+ return std::pair(nb::ndarray<const std::int32_t, nb::numpy>(
+- edges.data(), {edges.size()}),
++ edges.data(), {edges.size()}, nb::handle()),
+ nb::ndarray<const std::int64_t, nb::numpy>(
+- ptr.data(), {ptr.size()}));
++ ptr.data(), {ptr.size()}, nb::handle()));
+ },
+ nb::rv_policy::reference_internal);
+
+#diff --git a/python/dolfinx/wrappers/log.cpp b/python/dolfinx/wrappers/log.cpp
+#index 1946df053d9..bb87b8d5d56 100644
+#--- a/python/dolfinx/wrappers/log.cpp
+#+++ b/python/dolfinx/wrappers/log.cpp
+#@@ -54,9 +54,8 @@ void log(nb::module_& m)
+# nb::arg("thread_name"));
+#
+# m.def(
+#- "set_log_level",
+#- [](spdlog::level::level_enum level) { spdlog::set_level(level); },
+#- nb::arg("level"));
+#+ "set_log_level", [](spdlog::level::level_enum level)
+#+ { spdlog::set_level(level); }, nb::arg("level"));
+# m.def("get_log_level", []() { return spdlog::get_level(); });
+# m.def(
+# "log",
+diff --git a/python/dolfinx/wrappers/mesh.cpp b/python/dolfinx/wrappers/mesh.cpp
+index 03f5cf8fcef..8ebdd38029e 100644
+--- a/python/dolfinx/wrappers/mesh.cpp
++++ b/python/dolfinx/wrappers/mesh.cpp
+@@ -122,8 +122,8 @@ void declare_meshtags(nb::module_& m, std::string type)
+ "values",
+ [](dolfinx::mesh::MeshTags<T>& self)
+ {
+- return nb::ndarray<const T, nb::numpy>(self.values().data(),
+- {self.values().size()});
++ return nb::ndarray<const T, nb::numpy>(
++ self.values().data(), {self.values().size()}, nb::handle());
+ },
+ nb::rv_policy::reference_internal)
+ .def_prop_ro(
+@@ -131,7 +131,7 @@ void declare_meshtags(nb::module_& m, std::string type)
+ [](dolfinx::mesh::MeshTags<T>& self)
+ {
+ return nb::ndarray<const std::int32_t, nb::numpy>(
+- self.indices().data(), {self.indices().size()});
++ self.indices().data(), {self.indices().size()}, nb::handle());
+ },
+ nb::rv_policy::reference_internal)
+ .def("find", [](dolfinx::mesh::MeshTags<T>& self, T value)
+@@ -161,7 +161,8 @@ void declare_mesh(nb::module_& m, std::string type)
+ {
+ auto dofs = self.dofmap();
+ return nb::ndarray<const std::int32_t, nb::numpy>(
+- dofs.data_handle(), {dofs.extent(0), dofs.extent(1)});
++ dofs.data_handle(), {dofs.extent(0), dofs.extent(1)},
++ nb::handle());
+ },
+ nb::rv_policy::reference_internal)
+ .def(
+@@ -170,7 +171,8 @@ void declare_mesh(nb::module_& m, std::string type)
+ {
+ auto dofs = self.dofmap(i);
+ return nb::ndarray<const std::int32_t, nb::numpy>(
+- dofs.data_handle(), {dofs.extent(0), dofs.extent(1)});
++ dofs.data_handle(), {dofs.extent(0), dofs.extent(1)},
++ nb::handle());
+ },
+ nb::rv_policy::reference_internal, nb::arg("i"),
+ "Get the geometry dofmap associated with coordinate element i (mixed "
+@@ -180,8 +182,8 @@ void declare_mesh(nb::module_& m, std::string type)
+ "x",
+ [](dolfinx::mesh::Geometry<T>& self)
+ {
+- return nb::ndarray<T, nb::numpy>(self.x().data(),
+- {self.x().size() / 3, 3});
++ return nb::ndarray<T, nb::numpy>(
++ self.x().data(), {self.x().size() / 3, 3}, nb::handle());
+ },
+ nb::rv_policy::reference_internal,
+ "Return coordinates of all geometry points. Each row is the "
+@@ -196,7 +198,7 @@ void declare_mesh(nb::module_& m, std::string type)
+ 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()});
++ id_to_global.data(), {id_to_global.size()}, nb::handle());
+ },
+ nb::rv_policy::reference_internal);
+
+@@ -350,7 +352,7 @@ void declare_mesh(nb::module_& m, std::string type)
+ auto cpp_marker = [&marker](auto x)
+ {
+ nb::ndarray<const T, nb::ndim<2>, nb::numpy> x_view(
+- x.data_handle(), {x.extent(0), x.extent(1)});
++ x.data_handle(), {x.extent(0), x.extent(1)}, nb::handle());
+ auto marked = marker(x_view);
+ return std::vector<std::int8_t>(marked.data(),
+ marked.data() + marked.size());
+@@ -371,7 +373,7 @@ void declare_mesh(nb::module_& m, std::string type)
+ auto cpp_marker = [&marker](auto x)
+ {
+ nb::ndarray<const T, nb::ndim<2>, nb::numpy> x_view(
+- x.data_handle(), {x.extent(0), x.extent(1)});
++ x.data_handle(), {x.extent(0), x.extent(1)}, nb::handle());
+ auto marked = marker(x_view);
+ return std::vector<std::int8_t>(marked.data(),
+ marked.data() + marked.size());
+@@ -507,8 +509,8 @@ void mesh(nb::module_& m)
+ [](const dolfinx::mesh::Topology& self)
+ {
+ const std::vector<std::uint8_t>& p = self.get_facet_permutations();
+- return nb::ndarray<const std::uint8_t, nb::numpy>(p.data(),
+- {p.size()});
++ return nb::ndarray<const std::uint8_t, nb::numpy>(
++ p.data(), {p.size()}, nb::handle());
+ },
+ nb::rv_policy::reference_internal)
+ .def(
+@@ -517,8 +519,8 @@ void mesh(nb::module_& m)
+ {
+ const std::vector<std::uint32_t>& p
+ = self.get_cell_permutation_info();
+- return nb::ndarray<const std::uint32_t, nb::numpy>(p.data(),
+- {p.size()});
++ return nb::ndarray<const std::uint32_t, nb::numpy>(
++ p.data(), {p.size()}, nb::handle());
+ },
+ nb::rv_policy::reference_internal)
+ .def_prop_ro("dim", &dolfinx::mesh::Topology::dim,
+@@ -531,7 +533,7 @@ void mesh(nb::module_& m)
+ throw std::runtime_error("Mixed topology unsupported");
+ return nb::ndarray<const std::int64_t, nb::numpy>(
+ self.original_cell_index[0].data(),
+- {self.original_cell_index[0].size()});
++ {self.original_cell_index[0].size()}, nb::handle());
+ },
+ nb::rv_policy::reference_internal)
+ .def("connectivity",
diff -Nru fenics-dolfinx-0.8.0/debian/patches/series fenics-dolfinx-0.8.0/debian/patches/series
--- fenics-dolfinx-0.8.0/debian/patches/series 2024-05-12 11:17:08.000000000 +0200
+++ fenics-dolfinx-0.8.0/debian/patches/series 2024-05-30 11:05:39.000000000 +0200
@@ -12,3 +12,4 @@
test_adios2_MPI.patch
pusimp.patch
Newton_KSP_ref_counter_PR3190.patch
+42c43485e81ada306f0b3f1dc735d95539174cbc.patch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/debian-science-maintainers/attachments/20240530/855d3991/attachment-0001.sig>
More information about the debian-science-maintainers
mailing list