ENH: add internal parRun guards to some UPstream methods

- simplifies coding
  * finishedRequest(), waitRequest(), waitRequests() with parRun guards
  * nRequests() is noexcept

- more consistent use of UPstream::defaultCommsType in branching
This commit is contained in:
Mark Olesen
2022-09-08 13:53:22 +02:00
parent 716d330547
commit 47e172e6ef
34 changed files with 146 additions and 158 deletions

View File

@ -38,7 +38,8 @@ void Foam::functionObjects::mapFields::evaluateConstraintTypes
{
auto& fldBf = fld.boundaryFieldRef();
const UPstream::commsTypes commsType(UPstream::defaultCommsType);
const UPstream::commsTypes commsType = UPstream::defaultCommsType;
const label startOfRequests = UPstream::nRequests();
if
(
@ -46,8 +47,6 @@ void Foam::functionObjects::mapFields::evaluateConstraintTypes
|| commsType == UPstream::commsTypes::nonBlocking
)
{
const label startOfRequests = UPstream::nRequests();
forAll(fldBf, patchi)
{
fvPatchField<Type>& tgtField = fldBf[patchi];
@ -63,11 +62,7 @@ void Foam::functionObjects::mapFields::evaluateConstraintTypes
}
// Wait for outstanding requests
if
(
UPstream::parRun()
&& commsType == UPstream::commsTypes::nonBlocking
)
if (commsType == UPstream::commsTypes::nonBlocking)
{
UPstream::waitRequests(startOfRequests);
}