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)
115 <<
"Unsupported communications type " << commsType
129 receive(commsType, tf.
ref());
141 if (
sizeof(scalar) !=
sizeof(
float) && Pstream::floatTransfer && f.
size())
143 static const label nCmpts =
sizeof(Type)/
sizeof(scalar);
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);
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.
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.
void compressedReceive(const Pstream::commsTypes commsType, UList< Type > &) const
Raw field receive function with data compression.
std::streamsize byteSize() const
Return the binary size in number of characters of the UList.
bool read(const char *, int32_t &)
Pre-declare SubField and related Field type.
iterator begin()
Return an iterator to begin traversing the UList.
void receive(const Pstream::commsTypes commsType, UList< Type > &) const
Raw field receive function.
label size() const
Return the number of elements in the UList.
void compressedSend(const Pstream::commsTypes commsType, const UList< Type > &) const
Raw field send function with data compression.
void send(const Pstream::commsTypes commsType, const UList< Type > &) const
Raw send function.
A class for managing temporary objects.
T & last()
Return the last element of the list.
T & ref() const
Return non-const reference or generate a fatal error.