Skip to content

Commit

Permalink
Merge branch 'pardofs_pythin_init' into 'master'
Browse files Browse the repository at this point in the history
Pardofs pythin init

See merge request jschoeberl/ngsolve!413
  • Loading branch information
JSchoeberl committed Jun 14, 2018
2 parents bced49b + e651f7c commit 64515d3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions linalg/python_linalg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,20 @@ void NGS_DLL_HEADER ExportNgla(py::module &m) {
#ifdef PARALLEL
.def("SubSet", [](const ParallelDofs & self, shared_ptr<BitArray> take_dofs) {
return self.SubSet(take_dofs); })
.def(py::init([](py::object procs, PyMPI_Comm comm) {
size_t n = py::len(procs);
TableCreator<int> ct(n);
while (!ct.Done()) {
size_t rn = 0;
for (auto row:procs) {
for (auto v:row)
ct.Add(rn,v.cast<int>());
rn++;
}
ct++;
}
return new ParallelDofs(comm.comm, ct.MoveTable());
}), "dist_procs"_a, "comm"_a)
#endif
.def_property_readonly ("ndoflocal", [](const ParallelDofs & self)
{ return self.GetNDofLocal(); },
Expand Down

0 comments on commit 64515d3

Please sign in to comment.