mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add UPstream::parRun(const bool)
- slightly neater code when disabling/restoring parallel state
New
const bool oldParRun = Pstream::parRun(false);
...
Pstream::parRun(oldParRun);
Old
const bool oldParRun = Pstream::parRun();
Pstream::parRun() = false;
...
Pstream::parRun() = oldParRun;
This commit is contained in:
@ -1951,8 +1951,8 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
// What to send to neighbouring domains
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
bool oldParRun = UPstream::parRun();
|
||||
UPstream::parRun() = false;
|
||||
// Disable parallel.
|
||||
const bool oldParRun = UPstream::parRun(false);
|
||||
|
||||
forAll(nSendCells, recvProc)
|
||||
{
|
||||
@ -2162,7 +2162,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
}
|
||||
|
||||
|
||||
UPstream::parRun() = oldParRun;
|
||||
UPstream::parRun(oldParRun); // Restore parallel state
|
||||
|
||||
|
||||
// Start sending&receiving from buffers
|
||||
@ -2279,8 +2279,8 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
// Receive and add what was sent
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
oldParRun = UPstream::parRun();
|
||||
UPstream::parRun() = false;
|
||||
// Disable parallel. Original state already known.
|
||||
UPstream::parRun(false);
|
||||
|
||||
forAll(nRevcCells, sendProc)
|
||||
{
|
||||
@ -2697,7 +2697,8 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
}
|
||||
}
|
||||
|
||||
UPstream::parRun() = oldParRun;
|
||||
UPstream::parRun(oldParRun); // Restore parallel state
|
||||
|
||||
|
||||
// Print a bit.
|
||||
if (debug)
|
||||
|
||||
Reference in New Issue
Block a user