| 39 | namespace part::impl |
| 40 | { |
| 41 | CppCellPartitionFunction |
| 42 | create_cell_partitioner_cpp(const PythonCellPartitionFunction& p) |
| 43 | { |
| 44 | if (p) |
| 45 | { |
| 46 | return [p](MPI_Comm comm, int n, |
| 47 | const std::vector<dolfinx::mesh::CellType>& cell_types, |
| 48 | const std::vector<std::span<const std::int64_t>>& cells) |
| 49 | { |
| 50 | std::vector<nb::ndarray<const std::int64_t, nb::numpy>> cells_nb; |
| 51 | std::ranges::transform( |
| 52 | cells, std::back_inserter(cells_nb), |
| 53 | [](auto c) |
| 54 | { |
| 55 | return nb::ndarray<const std::int64_t, nb::numpy>(c.data(), |
| 56 | {c.size()}); |
| 57 | }); |
| 58 | return p(dolfinx_wrappers::MPICommWrapper(comm), n, cell_types, cells_nb); |
| 59 | }; |
| 60 | } |
| 61 | else |
| 62 | return nullptr; |
| 63 | } |
| 64 | } // namespace part::impl |
| 65 | |
| 66 | void mesh(nb::module_& m) |
no test coverage detected