Bugfix: parallel comms usage in gather-scatter

This commit is contained in:
Hrvoje Jasak 2016-09-19 16:21:03 +01:00
parent ceebeca087
commit 913aa4a443
2 changed files with 11 additions and 11 deletions

View file

@ -50,10 +50,10 @@ void Pstream::gather
const label comm const label comm
) )
{ {
if (Pstream::nProcs() > 1) if (Pstream::nProcs(comm) > 1)
{ {
// Get my communication order // Get my communication order
const commsStruct& myComm = comms[Pstream::myProcNo()]; const commsStruct& myComm = comms[Pstream::myProcNo(comm)];
// Receive from my downstairs neighbours // Receive from my downstairs neighbours
forAll (myComm.below(), belowI) forAll (myComm.below(), belowI)
@ -129,13 +129,13 @@ void Pstream::gather
const label comm const label comm
) )
{ {
if (Pstream::nProcs() < Pstream::nProcsSimpleSum()) if (Pstream::nProcs(comm) < Pstream::nProcsSimpleSum())
{ {
gather(Pstream::linearCommunication(), Value, bop, tag, comm); gather(Pstream::linearCommunication(comm), Value, bop, tag, comm);
} }
else else
{ {
gather(Pstream::treeCommunication(), Value, bop, tag, comm); gather(Pstream::treeCommunication(comm), Value, bop, tag, comm);
} }
} }
@ -149,10 +149,10 @@ void Pstream::scatter
const label comm const label comm
) )
{ {
if (Pstream::nProcs() > 1) if (Pstream::nProcs(comm) > 1)
{ {
// Get my communication order // Get my communication order
const commsStruct& myComm = comms[Pstream::myProcNo()]; const commsStruct& myComm = comms[Pstream::myProcNo(comm)];
// Receive from up // Receive from up
if (myComm.above() != -1) if (myComm.above() != -1)
@ -221,13 +221,13 @@ void Pstream::scatter
template <class T> template <class T>
void Pstream::scatter(T& Value, const int tag, const label comm) void Pstream::scatter(T& Value, const int tag, const label comm)
{ {
if (Pstream::nProcs() < Pstream::nProcsSimpleSum()) if (Pstream::nProcs(comm) < Pstream::nProcsSimpleSum())
{ {
scatter(Pstream::linearCommunication(), Value, tag, comm); scatter(Pstream::linearCommunication(comm), Value, tag, comm);
} }
else else
{ {
scatter(Pstream::treeCommunication(), Value, tag, comm); scatter(Pstream::treeCommunication(comm), Value, tag, comm);
} }
} }

View file

@ -233,7 +233,7 @@ void Pstream::scatterList
")" ")"
) << "Size of list:" << Values.size() ) << "Size of list:" << Values.size()
<< " does not equal the number of processors:" << " does not equal the number of processors:"
<< Pstream::nProcs() << Pstream::nProcs(comm)
<< Foam::abort(FatalError); << Foam::abort(FatalError);
} }