COMP: add compressed send/recv placeholder (instantiation for integrals)

This commit is contained in:
Mark Olesen
2023-01-16 09:51:34 +01:00
parent 2641dc4c3a
commit 0fa129e83c

View File

@ -67,6 +67,12 @@ void Foam::processorLduInterface::send
resizeBuf(byteRecvBuf_, nBytes); resizeBuf(byteRecvBuf_, nBytes);
if (!nBytes)
{
// Can skip empty messages
return;
}
UIPstream::read UIPstream::read
( (
commsType, commsType,
@ -164,11 +170,15 @@ void Foam::processorLduInterface::compressedSend
&& (!std::is_integral<Type>::value && sizeof(scalar) != sizeof(float)) && (!std::is_integral<Type>::value && sizeof(scalar) != sizeof(float))
) )
{ {
static const label nCmpts = sizeof(Type)/sizeof(scalar); static const label nCmpts =
label nm1 = (f.size() - 1)*nCmpts; (
label nlast = sizeof(Type)/sizeof(float); // Placeholder value for unusable template instantiation
label nFloats = nm1 + nlast; std::is_integral<Type>::value
label nBytes = nFloats*sizeof(float); ? 1
: sizeof(Type)/sizeof(scalar)
);
const label nm1 = (f.size() - 1)*nCmpts;
const label nBytes = f.size()*nCmpts*sizeof(float);
const scalar *sArray = reinterpret_cast<const scalar*>(f.cdata()); const scalar *sArray = reinterpret_cast<const scalar*>(f.cdata());
const scalar *slast = &sArray[nm1]; const scalar *slast = &sArray[nm1];
@ -250,11 +260,15 @@ void Foam::processorLduInterface::compressedReceive
&& (!std::is_integral<Type>::value && sizeof(scalar) != sizeof(float)) && (!std::is_integral<Type>::value && sizeof(scalar) != sizeof(float))
) )
{ {
static const label nCmpts = sizeof(Type)/sizeof(scalar); static const label nCmpts =
label nm1 = (f.size() - 1)*nCmpts; (
label nlast = sizeof(Type)/sizeof(float); // Placeholder value for unusable template instantiation
label nFloats = nm1 + nlast; std::is_integral<Type>::value
label nBytes = nFloats*sizeof(float); ? 1
: sizeof(Type)/sizeof(scalar)
);
const label nm1 = (f.size() - 1)*nCmpts;
const label nBytes = f.size()*nCmpts*sizeof(float);
if if
( (