mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-27 21:30:35 +05:00
handle 2 ranks case
This commit is contained in:
parent
8a165ef8f1
commit
9500f8d8f2
@ -1073,6 +1073,21 @@ namespace netgen
|
|||||||
Array<idx_t> epart(ne), npart(nn);
|
Array<idx_t> epart(ne), npart(nn);
|
||||||
|
|
||||||
idxtype nparts = MyMPI_GetNTasks(GetCommunicator())-1;
|
idxtype nparts = MyMPI_GetNTasks(GetCommunicator())-1;
|
||||||
|
|
||||||
|
if (nparts == 1)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < GetNE(); i++)
|
||||||
|
VolumeElement(i+1).SetPartition(1);
|
||||||
|
for (int i = 0; i < GetNSE(); i++)
|
||||||
|
SurfaceElement(i+1).SetPartition(1);
|
||||||
|
for (int i = 0; i < GetNSeg(); i++)
|
||||||
|
LineSegment(i+1).SetPartition(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
idxtype edgecut;
|
idxtype edgecut;
|
||||||
|
|
||||||
idxtype ncommon = 3;
|
idxtype ncommon = 3;
|
||||||
@ -1094,6 +1109,7 @@ namespace netgen
|
|||||||
SurfaceElement(i+1).SetPartition(epart[i+GetNE()] + 1);
|
SurfaceElement(i+1).SetPartition(epart[i+GetNE()] + 1);
|
||||||
for (int i = 0; i < GetNSeg(); i++)
|
for (int i = 0; i < GetNSeg(); i++)
|
||||||
LineSegment(i+1).SetPartition(epart[i+GetNE()+GetNSE()] + 1);
|
LineSegment(i+1).SetPartition(epart[i+GetNE()+GetNSE()] + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// surface elements attached to volume elements
|
// surface elements attached to volume elements
|
||||||
@ -1370,6 +1386,19 @@ namespace netgen
|
|||||||
Array<idx_t> epart(ne), npart(nn);
|
Array<idx_t> epart(ne), npart(nn);
|
||||||
|
|
||||||
idxtype nparts = MyMPI_GetNTasks(GetCommunicator())-1;
|
idxtype nparts = MyMPI_GetNTasks(GetCommunicator())-1;
|
||||||
|
|
||||||
|
if (nparts == 1)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < GetNE(); i++)
|
||||||
|
VolumeElement(i+1).SetPartition(1);
|
||||||
|
for (int i = 0; i < GetNSE(); i++)
|
||||||
|
SurfaceElement(i+1).SetPartition(1);
|
||||||
|
for (int i = 0; i < GetNSeg(); i++)
|
||||||
|
LineSegment(i+1).SetPartition(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
idxtype edgecut;
|
idxtype edgecut;
|
||||||
|
|
||||||
|
|
||||||
|
@ -525,8 +525,8 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
|||||||
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 self;
|
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;
|
return self;
|
||||||
|
Loading…
Reference in New Issue
Block a user