ENH: simpler use of broadcast (via Pstream::scatter)

- avoids worrying about forgetting a (Pstream::parRun()) guard
  and reduces code. The Pstream::scatter does the same thing under the
  hood.
This commit is contained in:
Mark Olesen
2022-02-24 19:50:58 +01:00
committed by Andrew Heather
parent 5368b38b8d
commit f3674eee36
5 changed files with 45 additions and 125 deletions

View File

@ -90,21 +90,8 @@ Foam::autoPtr<Foam::fvMesh> Foam::loadOrCreateMesh
Pstream::parRun(oldParRun);
}
if (Pstream::parRun())
{
if (Pstream::master())
{
// Broadcast: send patches
OPBstream toAll(Pstream::masterNo());
toAll << patchEntries;
}
else
{
// Broadcast: receive patches
IPBstream fromMaster(Pstream::masterNo());
fromMaster >> patchEntries;
}
}
// Broadcast: send patches to all
Pstream::scatter(patchEntries); // == worldComm;
// Dummy meshes