diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduCalculatedProcessorField/lduCalculatedProcessorField.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduCalculatedProcessorField/lduCalculatedProcessorField.C index 11e837c53034cbe3392f7e65b5e1cab92d4fbebe..d60692571d1bfeccb9c9a15ea4d24eebdcdb2dd9 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduCalculatedProcessorField/lduCalculatedProcessorField.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduCalculatedProcessorField/lduCalculatedProcessorField.C @@ -60,13 +60,7 @@ Foam::lduCalculatedProcessorField<Type>::lduCalculatedProcessorField template<class Type> bool Foam::lduCalculatedProcessorField<Type>::ready() const { - if (!UPstream::finishedRequest(this->sendRequest_)) return false; - this->sendRequest_ = -1; - - if (!UPstream::finishedRequest(this->recvRequest_)) return false; - this->recvRequest_ = -1; - - return true; + return UPstream::finishedRequestPair(recvRequest_, sendRequest_); } @@ -173,10 +167,12 @@ void Foam::lduCalculatedProcessorField<Type>::updateInterfaceMatrix return; } - // Treat send as finished when recv is done - UPstream::waitRequest(recvRequest_); - recvRequest_ = -1; - sendRequest_ = -1; + // Require receive data. Update the send request state. + // OR: UPstream::waitRequestPair(recvRequest_, sendRequest_); + + UPstream::waitRequest(recvRequest_); recvRequest_ = -1; + if (UPstream::finishedRequest(sendRequest_)) sendRequest_ = -1; + // Consume straight from receive buffer. Note use of our own // helper to avoid using fvPatch addressing diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.C index 8309c1b31a56cf349a9f4a0a515eb8551fb4a4d1..0e4b2215352ab2a844766c4ebdac0b93dac9fd08 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/processorGAMGInterfaceField/processorGAMGInterfaceField.C @@ -171,10 +171,11 @@ void Foam::processorGAMGInterfaceField::updateInterfaceMatrix { // Fast path: consume straight from receive buffer - // Treat send as finished when recv is done - UPstream::waitRequest(recvRequest_); - recvRequest_ = -1; - sendRequest_ = -1; + // Require receive data. Update the send request state. + // OR: UPstream::waitRequestPair(recvRequest_, sendRequest_); + + UPstream::waitRequest(recvRequest_); recvRequest_ = -1; + if (UPstream::finishedRequest(sendRequest_)) sendRequest_ = -1; } else { diff --git a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C index d65ea2637d4e924e8edee9a2435026aa8fc4d702..70935bcf79262be9128836a9086e90e3d8833b55 100644 --- a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C @@ -176,13 +176,7 @@ Foam::processorFaPatchField<Type>::processorFaPatchField template<class Type> bool Foam::processorFaPatchField<Type>::ready() const { - if (!UPstream::finishedRequest(sendRequest_)) return false; - sendRequest_ = -1; - - if (!UPstream::finishedRequest(recvRequest_)) return false; - recvRequest_ = -1; - - return true; + return UPstream::finishedRequestPair(recvRequest_, sendRequest_); } @@ -207,7 +201,7 @@ void Foam::processorFaPatchField<Type>::initEvaluate const Pstream::commsTypes commsType ) { - if (Pstream::parRun()) + if (UPstream::parRun()) { this->patchInternalField(sendBuf_); @@ -259,16 +253,17 @@ void Foam::processorFaPatchField<Type>::evaluate const Pstream::commsTypes commsType ) { - if (Pstream::parRun()) + if (UPstream::parRun()) { if (commsType == UPstream::commsTypes::nonBlocking) { // Fast path. Received into *this - // Treat send as finished when recv is done - UPstream::waitRequest(recvRequest_); - recvRequest_ = -1; - sendRequest_ = -1; + // Require receive data. Update the send request state. + // OR: UPstream::waitRequestPair(recvRequest_, sendRequest_); + + UPstream::waitRequest(recvRequest_); recvRequest_ = -1; + if (UPstream::finishedRequest(sendRequest_)) sendRequest_ = -1; } else { @@ -373,10 +368,11 @@ void Foam::processorFaPatchField<Type>::updateInterfaceMatrix { // Fast path: consume straight from receive buffer - // Treat send as finished when recv is done - UPstream::waitRequest(recvRequest_); - recvRequest_ = -1; - sendRequest_ = -1; + // Require receive data. Update the send request state. + // OR: UPstream::waitRequestPair(recvRequest_, sendRequest_); + + UPstream::waitRequest(recvRequest_); recvRequest_ = -1; + if (UPstream::finishedRequest(sendRequest_)) sendRequest_ = -1; } else { @@ -479,10 +475,11 @@ void Foam::processorFaPatchField<Type>::updateInterfaceMatrix { // Fast path: consume straight from receive buffer - // Treat send as finished when recv is done - UPstream::waitRequest(recvRequest_); - recvRequest_ = -1; - sendRequest_ = -1; + // Require receive data. Update the send request state. + // OR: UPstream::waitRequestPair(recvRequest_, sendRequest_); + + UPstream::waitRequest(recvRequest_); recvRequest_ = -1; + if (UPstream::finishedRequest(sendRequest_)) sendRequest_ = -1; } else { diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/calculatedProcessor/calculatedProcessorFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/calculatedProcessor/calculatedProcessorFvPatchField.C index 875c98105f3d4eb181a137deb54fe520495655e0..25e6ee5a23422fb72769024962308937a7c38211 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/calculatedProcessor/calculatedProcessorFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/calculatedProcessor/calculatedProcessorFvPatchField.C @@ -76,13 +76,7 @@ Foam::calculatedProcessorFvPatchField<Type>::calculatedProcessorFvPatchField template<class Type> bool Foam::calculatedProcessorFvPatchField<Type>::ready() const { - if (!UPstream::finishedRequest(this->sendRequest_)) return false; - this->sendRequest_ = -1; - - if (!UPstream::finishedRequest(this->recvRequest_)) return false; - this->recvRequest_ = -1; - - return true; + return UPstream::finishedRequestPair(recvRequest_, sendRequest_); } @@ -109,7 +103,7 @@ void Foam::calculatedProcessorFvPatchField<Type>::initEvaluate const Pstream::commsTypes commsType ) { - if (Pstream::parRun()) + if (UPstream::parRun()) { if (!is_contiguous<Type>::value) { @@ -164,12 +158,13 @@ void Foam::calculatedProcessorFvPatchField<Type>::evaluate const Pstream::commsTypes commsType ) { - if (Pstream::parRun()) + if (UPstream::parRun()) { - // Treat send as finished when recv is done - UPstream::waitRequest(recvRequest_); - recvRequest_ = -1; - sendRequest_ = -1; + // Require receive data. Update the send request state. + // OR: UPstream::waitRequestPair(recvRequest_, sendRequest_); + + UPstream::waitRequest(recvRequest_); recvRequest_ = -1; + if (UPstream::finishedRequest(sendRequest_)) sendRequest_ = -1; } } @@ -278,14 +273,16 @@ void Foam::calculatedProcessorFvPatchField<Type>::updateInterfaceMatrix return; } - if (Pstream::parRun()) + if (UPstream::parRun()) { - // Treat send as finished when recv is done - UPstream::waitRequest(recvRequest_); - recvRequest_ = -1; - sendRequest_ = -1; + // Require receive data. Update the send request state. + // OR: UPstream::waitRequestPair(recvRequest_, sendRequest_); + + UPstream::waitRequest(recvRequest_); recvRequest_ = -1; + if (UPstream::finishedRequest(sendRequest_)) sendRequest_ = -1; } + // Consume straight from receive buffer. Note use of our own // helper to avoid using fvPatch addressing addToInternalField(result, !add, coeffs, scalarRecvBuf_); diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C index b5350e4f3ff26f4c18800a018056aea80a42c192..3fdec71d9644f7bdf0ab7ae7072334f8c000848b 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C @@ -111,6 +111,7 @@ Foam::processorFvPatchField<Type>::processorFvPatchField if (!isA<processorFvPatch>(this->patch())) { FatalErrorInFunction + << "\n patch type '" << p.type() << "' not constraint type '" << typeName << "'" << "\n for patch " << p.name() << " of field " << this->internalField().name() @@ -177,13 +178,7 @@ Foam::processorFvPatchField<Type>::processorFvPatchField template<class Type> bool Foam::processorFvPatchField<Type>::ready() const { - if (!UPstream::finishedRequest(sendRequest_)) return false; - sendRequest_ = -1; - - if (!UPstream::finishedRequest(recvRequest_)) return false; - recvRequest_ = -1; - - return true; + return UPstream::finishedRequestPair(recvRequest_, sendRequest_); } @@ -208,7 +203,7 @@ void Foam::processorFvPatchField<Type>::initEvaluate const Pstream::commsTypes commsType ) { - if (Pstream::parRun()) + if (UPstream::parRun()) { this->patchInternalField(sendBuf_); @@ -264,7 +259,7 @@ void Foam::processorFvPatchField<Type>::evaluate const Pstream::commsTypes commsType ) { - if (Pstream::parRun()) + if (UPstream::parRun()) { if ( @@ -274,10 +269,11 @@ void Foam::processorFvPatchField<Type>::evaluate { // Fast path: received into *this - // Treat send as finished when recv is done - UPstream::waitRequest(recvRequest_); - recvRequest_ = -1; - sendRequest_ = -1; + // Require receive data. Update the send request state. + // OR: UPstream::waitRequestPair(recvRequest_, sendRequest_); + + UPstream::waitRequest(recvRequest_); recvRequest_ = -1; + if (UPstream::finishedRequest(sendRequest_)) sendRequest_ = -1; } else { @@ -402,10 +398,11 @@ void Foam::processorFvPatchField<Type>::updateInterfaceMatrix { // Fast path: consume straight from receive buffer - // Treat send as finished when recv is done - UPstream::waitRequest(recvRequest_); - recvRequest_ = -1; - sendRequest_ = -1; + // Require receive data. Update the send request state. + // OR: UPstream::waitRequestPair(recvRequest_, sendRequest_); + + UPstream::waitRequest(recvRequest_); recvRequest_ = -1; + if (UPstream::finishedRequest(sendRequest_)) sendRequest_ = -1; } else { @@ -523,10 +520,11 @@ void Foam::processorFvPatchField<Type>::updateInterfaceMatrix { // Fast path: consume straight from receive buffer - // Treat send as finished when recv is done - UPstream::waitRequest(recvRequest_); - recvRequest_ = -1; - sendRequest_ = -1; + // Require receive data. Update the send request state. + // OR: UPstream::waitRequestPair(recvRequest_, sendRequest_); + + UPstream::waitRequest(recvRequest_); recvRequest_ = -1; + if (UPstream::finishedRequest(sendRequest_)) sendRequest_ = -1; } else { diff --git a/src/overset/lduPrimitiveProcessorInterface/GAMG/calculatedProcessorGAMGInterfaceField.C b/src/overset/lduPrimitiveProcessorInterface/GAMG/calculatedProcessorGAMGInterfaceField.C index cc58546967d233d2154454ea11619ca990db8a3f..adf9b74a17a539ff422f74c73651b166d05e7d9b 100644 --- a/src/overset/lduPrimitiveProcessorInterface/GAMG/calculatedProcessorGAMGInterfaceField.C +++ b/src/overset/lduPrimitiveProcessorInterface/GAMG/calculatedProcessorGAMGInterfaceField.C @@ -172,10 +172,11 @@ void Foam::calculatedProcessorGAMGInterfaceField::updateInterfaceMatrix { // Fast path: consume straight from receive buffer - // Treat send as finished when recv is done - UPstream::waitRequest(recvRequest_); - recvRequest_ = -1; - sendRequest_ = -1; + // Require receive data. Update the send request state. + // OR: UPstream::waitRequestPair(recvRequest_, sendRequest_); + + UPstream::waitRequest(recvRequest_); recvRequest_ = -1; + if (UPstream::finishedRequest(sendRequest_)) sendRequest_ = -1; } else {