43 commsType == Pstream::commsTypes::blocking
44 || commsType == Pstream::commsTypes::scheduled
51 reinterpret_cast<const char*>(f.
begin()),
57 else if (commsType == Pstream::commsTypes::nonBlocking)
59 resizeBuf(receiveBuf_, nBytes);
71 resizeBuf(sendBuf_, nBytes);
72 memcpy(sendBuf_.begin(), f.
begin(), nBytes);
87 <<
"Unsupported communications type " << int(commsType)
102 commsType == Pstream::commsTypes::blocking
103 || commsType == Pstream::commsTypes::scheduled
110 reinterpret_cast<char*>(f.
begin()),
116 else if (commsType == Pstream::commsTypes::nonBlocking)
123 <<
"Unsupported communications type " << int(commsType)
137 receive(commsType, tf.
ref());
149 if (
sizeof(scalar) !=
sizeof(
float) && Pstream::floatTransfer && f.
size())
151 static const label nCmpts =
sizeof(Type)/
sizeof(scalar);
153 label nlast =
sizeof(Type)/
sizeof(
float);
154 label nFloats = nm1 + nlast;
155 label nBytes = nFloats*
sizeof(float);
157 const scalar *sArray =
reinterpret_cast<const scalar*
>(f.
begin());
158 const scalar *slast = &sArray[nm1];
159 resizeBuf(sendBuf_, nBytes);
160 float *fArray =
reinterpret_cast<float*
>(sendBuf_.begin());
162 for (
label i=0; i<nm1; i++)
164 fArray[i] = sArray[i] - slast[i%nCmpts];
167 reinterpret_cast<Type&
>(fArray[nm1]) = f.
last();
171 commsType == Pstream::commsTypes::blocking
172 || commsType == Pstream::commsTypes::scheduled
185 else if (commsType == Pstream::commsTypes::nonBlocking)
187 resizeBuf(receiveBuf_, nBytes);
212 <<
"Unsupported communications type " << int(commsType)
218 this->send(commsType, f);
229 if (
sizeof(scalar) !=
sizeof(
float) && Pstream::floatTransfer && f.
size())
231 static const label nCmpts =
sizeof(Type)/
sizeof(scalar);
233 label nlast =
sizeof(Type)/
sizeof(
float);
234 label nFloats = nm1 + nlast;
235 label nBytes = nFloats*
sizeof(float);
239 commsType == Pstream::commsTypes::blocking
240 || commsType == Pstream::commsTypes::scheduled
243 resizeBuf(receiveBuf_, nBytes);
255 else if (commsType != Pstream::commsTypes::nonBlocking)
258 <<
"Unsupported communications type " << int(commsType)
262 const float *fArray =
263 reinterpret_cast<const float*
>(receiveBuf_.begin());
264 f.
last() =
reinterpret_cast<const Type&
>(fArray[nm1]);
265 scalar *sArray =
reinterpret_cast<scalar*
>(f.
begin());
266 const scalar *slast = &sArray[nm1];
268 for (
label i=0; i<nm1; i++)
270 sArray[i] = fArray[i] + slast[i%nCmpts];
275 this->receive<Type>(commsType,
f);
287 compressedReceive(commsType, tf.
ref());
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
commsTypes
Types of communications.
T & ref() const
Return non-const reference or generate a fatal error.
void compressedSend(const Pstream::commsTypes commsType, const UList< Type > &) const
Raw field send function with data compression.
Pre-declare SubField and related Field type.
iterator begin()
Return an iterator to begin traversing the UList.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
void receive(const Pstream::commsTypes commsType, UList< Type > &) const
Raw field receive function.
void send(const Pstream::commsTypes commsType, const UList< Type > &) const
Raw send function.
std::streamsize byteSize() const
Return the binary size in number of characters of the UList.
A class for managing temporary objects.
T & last()
Return the last element of the list.
label size() const
Return the number of elements in the UList.
void compressedReceive(const Pstream::commsTypes commsType, UList< Type > &) const
Raw field receive function with data compression.