mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-27 13:20:34 +05:00
distribute
This commit is contained in:
parent
ae2eb4d0d8
commit
f661e4a30d
@ -521,15 +521,22 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
.def_property_readonly("_timestamp", &Mesh::GetTimeStamp)
|
.def_property_readonly("_timestamp", &Mesh::GetTimeStamp)
|
||||||
.def("Distribute", [](Mesh & self, shared_ptr<PyMPI_Comm> pycomm) {
|
.def("Distribute", [](shared_ptr<Mesh> self, shared_ptr<PyMPI_Comm> pycomm) {
|
||||||
MPI_Comm comm = pycomm!=nullptr ? pycomm->comm : self.GetCommunicator();
|
MPI_Comm comm = pycomm!=nullptr ? pycomm->comm : self->GetCommunicator();
|
||||||
self.SetCommunicator(comm);
|
self->SetCommunicator(comm);
|
||||||
if(MyMPI_GetNTasks(comm)==1) return;
|
if(MyMPI_GetNTasks(comm)==1) return self;
|
||||||
if(MyMPI_GetNTasks(comm)==2) throw NgException("Sorry, cannot handle communicators with NP=2!");
|
if(MyMPI_GetNTasks(comm)==2) throw NgException("Sorry, cannot handle communicators with NP=2!");
|
||||||
cout << " rank " << MyMPI_GetId(comm) << " of " << MyMPI_GetNTasks(comm) << " called Distribute " << endl;
|
cout << " rank " << MyMPI_GetId(comm) << " of " << MyMPI_GetNTasks(comm) << " called Distribute " << endl;
|
||||||
if(MyMPI_GetId(comm)==0) self.Distribute();
|
if(MyMPI_GetId(comm)==0) self->Distribute();
|
||||||
else self.SendRecvMesh();
|
else self->SendRecvMesh();
|
||||||
|
return self;
|
||||||
}, py::arg("comm")=nullptr)
|
}, py::arg("comm")=nullptr)
|
||||||
|
.def("Receive", [](shared_ptr<PyMPI_Comm> pycomm) {
|
||||||
|
auto mesh = make_shared<Mesh>();
|
||||||
|
mesh->SetCommunicator(pycomm->comm);
|
||||||
|
mesh->SendRecvMesh();
|
||||||
|
return mesh;
|
||||||
|
})
|
||||||
.def("Load", FunctionPointer
|
.def("Load", FunctionPointer
|
||||||
([](Mesh & self, const string & filename)
|
([](Mesh & self, const string & filename)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user