diff --git a/libsrc/general/ngpython.hpp b/libsrc/general/ngpython.hpp index 0604cb00..722709c5 100644 --- a/libsrc/general/ngpython.hpp +++ b/libsrc/general/ngpython.hpp @@ -3,6 +3,7 @@ #include #include #include +#include namespace py = pybind11; #include #include diff --git a/libsrc/meshing/python_mesh.cpp b/libsrc/meshing/python_mesh.cpp index c3d3a2fb..16d84c63 100644 --- a/libsrc/meshing/python_mesh.cpp +++ b/libsrc/meshing/python_mesh.cpp @@ -954,13 +954,12 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m) .def("Sum", [](PyMPI_Comm & c, size_t x) { return MyMPI_AllReduceNG(x, MPI_SUM, c.comm); }) .def("Min", [](PyMPI_Comm & c, size_t x) { return MyMPI_AllReduceNG(x, MPI_MIN, c.comm); }) .def("Max", [](PyMPI_Comm & c, size_t x) { return MyMPI_AllReduceNG(x, MPI_MAX, c.comm); }) - .def("SubComm", [](PyMPI_Comm & c, py::list proc_list) { - Array procs(py::len(proc_list)); + .def("SubComm", [](PyMPI_Comm & c, std::vector proc_list) { + Array procs(proc_list.size()); for (int i = 0; i < procs.Size(); i++) - procs[i] = py::extract(proc_list[i])(); - if (!procs.Size()) - return make_shared(MPI_COMM_NULL); - + procs[i] = proc_list[i]; + if (!procs.Contains(c.Rank())) + throw Exception("rank "+ToString(c.Rank())+" not in subcomm"); MPI_Comm subcomm = MyMPI_SubCommunicator(c.comm, procs); return make_shared(subcomm, true);