diff --git a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C index 4e155a0a6..3537b4c27 100644 --- a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C +++ b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchField.C @@ -176,7 +176,7 @@ void processorFaPatchField::initEvaluate { if (Pstream::parRun()) { - procPatch_.compressedSend(commsType, this->patchInternalField()()); + procPatch_.send(commsType, this->patchInternalField()()); } } @@ -189,7 +189,7 @@ void processorFaPatchField::evaluate { if (Pstream::parRun()) { - procPatch_.compressedReceive(commsType, *this); + procPatch_.receive(commsType, *this); if (doTransform()) { @@ -218,7 +218,7 @@ void processorFaPatchField::initInterfaceMatrixUpdate const bool switchToLhs ) const { - procPatch_.compressedSend + procPatch_.send ( commsType, this->patch().patchInternalField(psiInternal)() @@ -240,7 +240,7 @@ void processorFaPatchField::updateInterfaceMatrix { scalarField pnf ( - procPatch_.compressedReceive(commsType, this->size())() + procPatch_.receive(commsType, this->size())() ); // Transform according to the transformation tensor diff --git a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchScalarField.C b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchScalarField.C index 11be0915b..fe5b4dc27 100644 --- a/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchScalarField.C +++ b/src/finiteArea/fields/faPatchFields/constraint/processor/processorFaPatchScalarField.C @@ -52,7 +52,7 @@ void processorFaPatchField::initInterfaceMatrixUpdate const bool switchToLhs ) const { - procPatch_.compressedSend + procPatch_.send ( commsType, patch().patchInternalField(psiInternal)() @@ -74,7 +74,7 @@ void processorFaPatchField::updateInterfaceMatrix { scalarField pnf ( - procPatch_.compressedReceive(commsType, this->size())() + procPatch_.receive(commsType, this->size())() ); const unallocLabelList& edgeFaces = patch().edgeFaces(); diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C index 0a92f62b1..e6ce38d34 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.C @@ -180,7 +180,7 @@ void processorFvPatchField::initEvaluate { if (Pstream::parRun()) { - procPatch_.compressedSend(commsType, this->patchInternalField()()); + procPatch_.send(commsType, this->patchInternalField()()); } } @@ -193,7 +193,7 @@ void processorFvPatchField::evaluate { if (Pstream::parRun()) { - procPatch_.compressedReceive(commsType, *this); + procPatch_.receive(commsType, *this); if (doTransform()) { @@ -222,7 +222,7 @@ void processorFvPatchField::initInterfaceMatrixUpdate const bool switchToLhs ) const { - procPatch_.compressedSend + procPatch_.send ( commsType, this->patch().patchInternalField(psiInternal)() @@ -244,7 +244,7 @@ void processorFvPatchField::updateInterfaceMatrix { scalarField pnf ( - procPatch_.compressedReceive(commsType, this->size())() + procPatch_.receive(commsType, this->size())() ); // Transform according to the transformation tensor @@ -281,7 +281,7 @@ void processorFvPatchField::initInterfaceMatrixUpdate const bool switchToLhs ) const { - procPatch_.compressedSend + procPatch_.send ( commsType, this->patch().patchInternalField(psiInternal)() @@ -302,7 +302,7 @@ void processorFvPatchField::updateInterfaceMatrix { Field pnf ( - procPatch_.compressedReceive(commsType, this->size())() + procPatch_.receive(commsType, this->size())() ); // Multiply neighbour field with coeffs and re-use pnf for result diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchScalarField.C index 105c6b466..36e3392d9 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchScalarField.C @@ -44,7 +44,7 @@ void processorFvPatchField::initInterfaceMatrixUpdate const bool switchToLhs ) const { - procPatch_.compressedSend + procPatch_.send ( commsType, patch().patchInternalField(psiInternal)() @@ -66,7 +66,7 @@ void processorFvPatchField::updateInterfaceMatrix { scalarField pnf ( - procPatch_.compressedReceive(commsType, this->size())() + procPatch_.receive(commsType, this->size())() ); const unallocLabelList& faceCells = patch().faceCells(); @@ -99,7 +99,7 @@ void processorFvPatchField::initInterfaceMatrixUpdate const bool switchToLhs ) const { - procPatch_.compressedSend + procPatch_.send ( commsType, patch().patchInternalField(psiInternal)() @@ -120,7 +120,7 @@ void processorFvPatchField::updateInterfaceMatrix { scalarField pnf ( - procPatch_.compressedReceive(commsType, this->size())() + procPatch_.receive(commsType, this->size())() ); const unallocLabelList& faceCells = patch().faceCells(); diff --git a/src/foam/matrices/blockLduMatrix/BlockAMG/BlockAMGInterfaceFields/ProcessorBlockAMGInterfaceField/ProcessorBlockAMGInterfaceField.C b/src/foam/matrices/blockLduMatrix/BlockAMG/BlockAMGInterfaceFields/ProcessorBlockAMGInterfaceField/ProcessorBlockAMGInterfaceField.C index bc50d1a43..483cbe802 100644 --- a/src/foam/matrices/blockLduMatrix/BlockAMG/BlockAMGInterfaceFields/ProcessorBlockAMGInterfaceField/ProcessorBlockAMGInterfaceField.C +++ b/src/foam/matrices/blockLduMatrix/BlockAMG/BlockAMGInterfaceFields/ProcessorBlockAMGInterfaceField/ProcessorBlockAMGInterfaceField.C @@ -94,7 +94,7 @@ void Foam::ProcessorBlockAMGInterfaceField::initInterfaceMatrixUpdate const bool switchToLhs ) const { - procInterface_.compressedSend + procInterface_.send ( commsType, procInterface_.interfaceInternalField(psiInternal)() @@ -115,7 +115,7 @@ void Foam::ProcessorBlockAMGInterfaceField::updateInterfaceMatrix { Field pnf ( - procInterface_.compressedReceive(commsType, this->size()) + procInterface_.receive(commsType, this->size()) ); // Multiply neighbour field with coeffs and re-use pnf for result diff --git a/src/foam/matrices/lduMatrix/lduAddressing/lduInterfaces/processorLduInterface/processorLduInterface.H b/src/foam/matrices/lduMatrix/lduAddressing/lduInterfaces/processorLduInterface/processorLduInterface.H index a600d27a8..b2b390dcf 100644 --- a/src/foam/matrices/lduMatrix/lduAddressing/lduInterfaces/processorLduInterface/processorLduInterface.H +++ b/src/foam/matrices/lduMatrix/lduAddressing/lduInterfaces/processorLduInterface/processorLduInterface.H @@ -128,32 +128,6 @@ public: const Pstream::commsTypes commsType, const label size ) const; - - - //- Raw field send function with data compression - template - void compressedSend - ( - const Pstream::commsTypes commsType, - const UList& - ) const; - - //- Raw field receive function with data compression - template - void compressedReceive - ( - const Pstream::commsTypes commsType, - UList& - ) const; - - //- Raw field receive function with data compression, - // returning a field - template - tmp > compressedReceive - ( - const Pstream::commsTypes commsType, - const label size - ) const; }; diff --git a/src/foam/matrices/lduMatrix/lduAddressing/lduInterfaces/processorLduInterface/processorLduInterfaceTemplates.C b/src/foam/matrices/lduMatrix/lduAddressing/lduInterfaces/processorLduInterface/processorLduInterfaceTemplates.C index 1645f505c..2a471f2af 100644 --- a/src/foam/matrices/lduMatrix/lduAddressing/lduInterfaces/processorLduInterface/processorLduInterfaceTemplates.C +++ b/src/foam/matrices/lduMatrix/lduAddressing/lduInterfaces/processorLduInterface/processorLduInterfaceTemplates.C @@ -131,146 +131,4 @@ Foam::tmp > Foam::processorLduInterface::receive } -template -void Foam::processorLduInterface::compressedSend -( - const Pstream::commsTypes commsType, - const UList& f -) const -{ - if (sizeof(scalar) != sizeof(float) && f.size()) - { - static const label nCmpts = sizeof(Type)/sizeof(scalar); - label nm1 = (f.size() - 1)*nCmpts; - label nlast = sizeof(Type)/sizeof(float); - label nFloats = nm1 + nlast; - label nBytes = nFloats*sizeof(float); - - const scalar *sArray = reinterpret_cast(f.begin()); - const scalar *slast = &sArray[nm1]; - resizeBuf(sendBuf_, nBytes); - float *fArray = reinterpret_cast(sendBuf_.begin()); - - for (register label i = 0; i < nm1; i++) - { - fArray[i] = sArray[i] - slast[i%nCmpts]; - } - - reinterpret_cast(fArray[nm1]) = f[f.size() - 1]; - - if (commsType == Pstream::blocking || commsType == Pstream::scheduled) - { - OPstream::write - ( - commsType, - neighbProcNo(), - sendBuf_.begin(), - nBytes, - tag(), - comm() - ); - } - else if (commsType == Pstream::nonBlocking) - { - resizeBuf(receiveBuf_, nBytes); - - IPstream::read - ( - commsType, - neighbProcNo(), - receiveBuf_.begin(), - receiveBuf_.size(), - tag(), - comm() - ); - - OPstream::write - ( - commsType, - neighbProcNo(), - sendBuf_.begin(), - nBytes, - tag(), - comm() - ); - } - else - { - FatalErrorIn("processorLduInterface::compressedSend") - << "Unsupported communications type " << commsType - << exit(FatalError); - } - } - else - { - this->send(commsType, f); - } -} - -template -void Foam::processorLduInterface::compressedReceive -( - const Pstream::commsTypes commsType, - UList& f -) const -{ - if (sizeof(scalar) != sizeof(float) && f.size()) - { - static const label nCmpts = sizeof(Type)/sizeof(scalar); - label nm1 = (f.size() - 1)*nCmpts; - label nlast = sizeof(Type)/sizeof(float); - label nFloats = nm1 + nlast; - label nBytes = nFloats*sizeof(float); - - if (commsType == Pstream::blocking || commsType == Pstream::scheduled) - { - resizeBuf(receiveBuf_, nBytes); - - IPstream::read - ( - commsType, - neighbProcNo(), - receiveBuf_.begin(), - nBytes, - tag(), - comm() - ); - } - else if (commsType != Pstream::nonBlocking) - { - FatalErrorIn("processorLduInterface::compressedReceive") - << "Unsupported communications type " << commsType - << exit(FatalError); - } - - const float *fArray = - reinterpret_cast(receiveBuf_.begin()); - f[f.size() - 1] = reinterpret_cast(fArray[nm1]); - scalar *sArray = reinterpret_cast(f.begin()); - const scalar *slast = &sArray[nm1]; - - for (register label i = 0; i < nm1; i++) - { - sArray[i] = fArray[i] + slast[i%nCmpts]; - } - } - else - { - this->receive(commsType, f); - } -} - -template -Foam::tmp > Foam::processorLduInterface::compressedReceive -( - const Pstream::commsTypes commsType, - const label size -) const -{ - tmp > tf(new Field(size)); - compressedReceive(commsType, tf()); - return tf; -} - - // ************************************************************************* // diff --git a/src/foam/matrices/lduMatrix/solvers/AMG/interfaceFields/processorAMGInterfaceField/processorAMGInterfaceField.C b/src/foam/matrices/lduMatrix/solvers/AMG/interfaceFields/processorAMGInterfaceField/processorAMGInterfaceField.C index b258ebb80..e87076154 100644 --- a/src/foam/matrices/lduMatrix/solvers/AMG/interfaceFields/processorAMGInterfaceField/processorAMGInterfaceField.C +++ b/src/foam/matrices/lduMatrix/solvers/AMG/interfaceFields/processorAMGInterfaceField/processorAMGInterfaceField.C @@ -81,7 +81,7 @@ void Foam::processorAMGInterfaceField::initInterfaceMatrixUpdate const bool switchToLhs ) const { - procInterface_.compressedSend + procInterface_.send ( commsType, procInterface_.interfaceInternalField(psiInternal)() @@ -102,7 +102,7 @@ void Foam::processorAMGInterfaceField::updateInterfaceMatrix { scalarField pnf ( - procInterface_.compressedReceive(commsType, coeffs.size()) + procInterface_.receive(commsType, coeffs.size()) ); transformCoupleField(pnf, cmpt);