39 label nBytes =
f.byteSize();
41 if (commsType == Pstream::blocking || commsType == Pstream::scheduled)
47 reinterpret_cast<const char*
>(
f.begin()),
53 else if (commsType == Pstream::nonBlocking)
55 resizeBuf(receiveBuf_, nBytes);
67 resizeBuf(sendBuf_, nBytes);
68 memcpy(sendBuf_.begin(),
f.begin(), nBytes);
83 <<
"Unsupported communications type " << commsType
96 if (commsType == Pstream::blocking || commsType == Pstream::scheduled)
102 reinterpret_cast<char*
>(
f.begin()),
108 else if (commsType == Pstream::nonBlocking)
110 memcpy(
f.begin(), receiveBuf_.begin(),
f.byteSize());
115 <<
"Unsupported communications type " << commsType
129 receive(commsType,
tf());
141 if (
sizeof(scalar) !=
sizeof(
float) && Pstream::floatTransfer &&
f.size())
143 static const label nCmpts =
sizeof(Type)/
sizeof(scalar);
144 label nm1 = (
f.size() - 1)*nCmpts;
145 label nlast =
sizeof(Type)/
sizeof(
float);
146 label nFloats = nm1 + nlast;
147 label nBytes = nFloats*
sizeof(float);
149 const scalar *sArray =
reinterpret_cast<const scalar*
>(
f.begin());
150 const scalar *slast = &sArray[nm1];
151 resizeBuf(sendBuf_, nBytes);
152 float *fArray =
reinterpret_cast<float*
>(sendBuf_.begin());
154 for (
label i=0; i<nm1; i++)
156 fArray[i] = sArray[i] - slast[i%nCmpts];
159 reinterpret_cast<Type&
>(fArray[nm1]) =
f.last();
161 if (commsType == Pstream::blocking || commsType == Pstream::scheduled)
173 else if (commsType == Pstream::nonBlocking)
175 resizeBuf(receiveBuf_, nBytes);
200 <<
"Unsupported communications type " << commsType
206 this->send(commsType,
f);
217 if (
sizeof(scalar) !=
sizeof(
float) && Pstream::floatTransfer &&
f.size())
219 static const label nCmpts =
sizeof(Type)/
sizeof(scalar);
220 label nm1 = (
f.size() - 1)*nCmpts;
221 label nlast =
sizeof(Type)/
sizeof(
float);
222 label nFloats = nm1 + nlast;
223 label nBytes = nFloats*
sizeof(float);
225 if (commsType == Pstream::blocking || commsType == Pstream::scheduled)
227 resizeBuf(receiveBuf_, nBytes);
239 else if (commsType != Pstream::nonBlocking)
242 <<
"Unsupported communications type " << commsType
246 const float *fArray =
247 reinterpret_cast<const float*
>(receiveBuf_.begin());
248 f.last() =
reinterpret_cast<const Type&
>(fArray[nm1]);
249 scalar *sArray =
reinterpret_cast<scalar*
>(
f.begin());
250 const scalar *slast = &sArray[nm1];
252 for (
label i=0; i<nm1; i++)
254 sArray[i] = fArray[i] + slast[i%nCmpts];
259 this->receive<Type>(commsType,
f);
271 compressedReceive(commsType,
tf());