Removed compressedSend/compressedReceive
This commit is contained in:
parent
dee7645a8f
commit
0b1dc2b2cd
8 changed files with 20 additions and 188 deletions
|
@ -176,7 +176,7 @@ void processorFaPatchField<Type>::initEvaluate
|
|||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
procPatch_.compressedSend(commsType, this->patchInternalField()());
|
||||
procPatch_.send(commsType, this->patchInternalField()());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ void processorFaPatchField<Type>::evaluate
|
|||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
procPatch_.compressedReceive<Type>(commsType, *this);
|
||||
procPatch_.receive<Type>(commsType, *this);
|
||||
|
||||
if (doTransform())
|
||||
{
|
||||
|
@ -218,7 +218,7 @@ void processorFaPatchField<Type>::initInterfaceMatrixUpdate
|
|||
const bool switchToLhs
|
||||
) const
|
||||
{
|
||||
procPatch_.compressedSend
|
||||
procPatch_.send
|
||||
(
|
||||
commsType,
|
||||
this->patch().patchInternalField(psiInternal)()
|
||||
|
@ -240,7 +240,7 @@ void processorFaPatchField<Type>::updateInterfaceMatrix
|
|||
{
|
||||
scalarField pnf
|
||||
(
|
||||
procPatch_.compressedReceive<scalar>(commsType, this->size())()
|
||||
procPatch_.receive<scalar>(commsType, this->size())()
|
||||
);
|
||||
|
||||
// Transform according to the transformation tensor
|
||||
|
|
|
@ -52,7 +52,7 @@ void processorFaPatchField<scalar>::initInterfaceMatrixUpdate
|
|||
const bool switchToLhs
|
||||
) const
|
||||
{
|
||||
procPatch_.compressedSend
|
||||
procPatch_.send
|
||||
(
|
||||
commsType,
|
||||
patch().patchInternalField(psiInternal)()
|
||||
|
@ -74,7 +74,7 @@ void processorFaPatchField<scalar>::updateInterfaceMatrix
|
|||
{
|
||||
scalarField pnf
|
||||
(
|
||||
procPatch_.compressedReceive<scalar>(commsType, this->size())()
|
||||
procPatch_.receive<scalar>(commsType, this->size())()
|
||||
);
|
||||
|
||||
const unallocLabelList& edgeFaces = patch().edgeFaces();
|
||||
|
|
|
@ -180,7 +180,7 @@ void processorFvPatchField<Type>::initEvaluate
|
|||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
procPatch_.compressedSend(commsType, this->patchInternalField()());
|
||||
procPatch_.send(commsType, this->patchInternalField()());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ void processorFvPatchField<Type>::evaluate
|
|||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
procPatch_.compressedReceive<Type>(commsType, *this);
|
||||
procPatch_.receive<Type>(commsType, *this);
|
||||
|
||||
if (doTransform())
|
||||
{
|
||||
|
@ -222,7 +222,7 @@ void processorFvPatchField<Type>::initInterfaceMatrixUpdate
|
|||
const bool switchToLhs
|
||||
) const
|
||||
{
|
||||
procPatch_.compressedSend
|
||||
procPatch_.send
|
||||
(
|
||||
commsType,
|
||||
this->patch().patchInternalField(psiInternal)()
|
||||
|
@ -244,7 +244,7 @@ void processorFvPatchField<Type>::updateInterfaceMatrix
|
|||
{
|
||||
scalarField pnf
|
||||
(
|
||||
procPatch_.compressedReceive<scalar>(commsType, this->size())()
|
||||
procPatch_.receive<scalar>(commsType, this->size())()
|
||||
);
|
||||
|
||||
// Transform according to the transformation tensor
|
||||
|
@ -281,7 +281,7 @@ void processorFvPatchField<Type>::initInterfaceMatrixUpdate
|
|||
const bool switchToLhs
|
||||
) const
|
||||
{
|
||||
procPatch_.compressedSend
|
||||
procPatch_.send
|
||||
(
|
||||
commsType,
|
||||
this->patch().patchInternalField(psiInternal)()
|
||||
|
@ -302,7 +302,7 @@ void processorFvPatchField<Type>::updateInterfaceMatrix
|
|||
{
|
||||
Field<Type> pnf
|
||||
(
|
||||
procPatch_.compressedReceive<Type>(commsType, this->size())()
|
||||
procPatch_.receive<Type>(commsType, this->size())()
|
||||
);
|
||||
|
||||
// Multiply neighbour field with coeffs and re-use pnf for result
|
||||
|
|
|
@ -44,7 +44,7 @@ void processorFvPatchField<scalar>::initInterfaceMatrixUpdate
|
|||
const bool switchToLhs
|
||||
) const
|
||||
{
|
||||
procPatch_.compressedSend
|
||||
procPatch_.send
|
||||
(
|
||||
commsType,
|
||||
patch().patchInternalField(psiInternal)()
|
||||
|
@ -66,7 +66,7 @@ void processorFvPatchField<scalar>::updateInterfaceMatrix
|
|||
{
|
||||
scalarField pnf
|
||||
(
|
||||
procPatch_.compressedReceive<scalar>(commsType, this->size())()
|
||||
procPatch_.receive<scalar>(commsType, this->size())()
|
||||
);
|
||||
|
||||
const unallocLabelList& faceCells = patch().faceCells();
|
||||
|
@ -99,7 +99,7 @@ void processorFvPatchField<scalar>::initInterfaceMatrixUpdate
|
|||
const bool switchToLhs
|
||||
) const
|
||||
{
|
||||
procPatch_.compressedSend
|
||||
procPatch_.send
|
||||
(
|
||||
commsType,
|
||||
patch().patchInternalField(psiInternal)()
|
||||
|
@ -120,7 +120,7 @@ void processorFvPatchField<scalar>::updateInterfaceMatrix
|
|||
{
|
||||
scalarField pnf
|
||||
(
|
||||
procPatch_.compressedReceive<scalar>(commsType, this->size())()
|
||||
procPatch_.receive<scalar>(commsType, this->size())()
|
||||
);
|
||||
|
||||
const unallocLabelList& faceCells = patch().faceCells();
|
||||
|
|
|
@ -94,7 +94,7 @@ void Foam::ProcessorBlockAMGInterfaceField<Type>::initInterfaceMatrixUpdate
|
|||
const bool switchToLhs
|
||||
) const
|
||||
{
|
||||
procInterface_.compressedSend
|
||||
procInterface_.send
|
||||
(
|
||||
commsType,
|
||||
procInterface_.interfaceInternalField(psiInternal)()
|
||||
|
@ -115,7 +115,7 @@ void Foam::ProcessorBlockAMGInterfaceField<Type>::updateInterfaceMatrix
|
|||
{
|
||||
Field<Type> pnf
|
||||
(
|
||||
procInterface_.compressedReceive<Type>(commsType, this->size())
|
||||
procInterface_.receive<Type>(commsType, this->size())
|
||||
);
|
||||
|
||||
// Multiply neighbour field with coeffs and re-use pnf for result
|
||||
|
|
|
@ -128,32 +128,6 @@ public:
|
|||
const Pstream::commsTypes commsType,
|
||||
const label size
|
||||
) const;
|
||||
|
||||
|
||||
//- Raw field send function with data compression
|
||||
template<class Type>
|
||||
void compressedSend
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const UList<Type>&
|
||||
) const;
|
||||
|
||||
//- Raw field receive function with data compression
|
||||
template<class Type>
|
||||
void compressedReceive
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
UList<Type>&
|
||||
) const;
|
||||
|
||||
//- Raw field receive function with data compression,
|
||||
// returning a field
|
||||
template<class Type>
|
||||
tmp<Field<Type> > compressedReceive
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const label size
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -131,146 +131,4 @@ Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::receive
|
|||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::processorLduInterface::compressedSend
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const UList<Type>& 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<const scalar*>(f.begin());
|
||||
const scalar *slast = &sArray[nm1];
|
||||
resizeBuf(sendBuf_, nBytes);
|
||||
float *fArray = reinterpret_cast<float*>(sendBuf_.begin());
|
||||
|
||||
for (register label i = 0; i < nm1; i++)
|
||||
{
|
||||
fArray[i] = sArray[i] - slast[i%nCmpts];
|
||||
}
|
||||
|
||||
reinterpret_cast<Type&>(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<class Type>
|
||||
void Foam::processorLduInterface::compressedReceive
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
UList<Type>& 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<const float*>(receiveBuf_.begin());
|
||||
f[f.size() - 1] = reinterpret_cast<const Type&>(fArray[nm1]);
|
||||
scalar *sArray = reinterpret_cast<scalar*>(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<Type>(commsType, f);
|
||||
}
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive
|
||||
(
|
||||
const Pstream::commsTypes commsType,
|
||||
const label size
|
||||
) const
|
||||
{
|
||||
tmp<Field<Type> > tf(new Field<Type>(size));
|
||||
compressedReceive(commsType, tf());
|
||||
return tf;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
|
@ -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<scalar>(commsType, coeffs.size())
|
||||
procInterface_.receive<scalar>(commsType, coeffs.size())
|
||||
);
|
||||
transformCoupleField(pnf, cmpt);
|
||||
|
||||
|
|
Reference in a new issue