ENH: broadcast lumpedPointState with Foam::scatter instead of manual code

This commit is contained in:
Mark Olesen
2022-02-24 09:22:07 +01:00
committed by Andrew Heather
parent 05b1bc9e79
commit 5368b38b8d

View File

@ -403,47 +403,14 @@ bool Foam::lumpedPointState::readData
if (Pstream::parRun())
{
// Scatter master data using communication scheme
// Broadcast master data to everyone
// Get my communication order
const List<Pstream::commsStruct>& comms = Pstream::whichCommunication();
const Pstream::commsStruct& myComm = comms[Pstream::myProcNo()];
// Receive from up
if (myComm.above() != -1)
{
IPstream fromAbove
(
UPstream::commsTypes::scheduled,
myComm.above(),
0,
Pstream::msgType(),
Pstream::worldComm
);
fromAbove >> points_ >> angles_ >> degrees_;
}
// Send to downstairs neighbours
forAllReverse(myComm.below(), belowI)
{
OPstream toBelow
(
UPstream::commsTypes::scheduled,
myComm.below()[belowI],
0,
Pstream::msgType(),
Pstream::worldComm
);
toBelow << points_ << angles_ << degrees_;
}
rotationPtr_.reset(nullptr);
// MPI barrier
Pstream::scatter(points_);
Pstream::scatter(angles_);
Pstream::scatter(degrees_);
Pstream::scatter(ok);
}
rotationPtr_.reset(nullptr);
return ok;
}