39 label nBytes =
f.byteSize();
51 reinterpret_cast<const char*
>(
f.begin()),
59 resizeBuf(receiveBuf_, nBytes);
71 resizeBuf(sendBuf_, nBytes);
72 memcpy(sendBuf_.
begin(),
f.begin(), nBytes);
87 <<
"Unsupported communications type " << int(commsType)
110 reinterpret_cast<char*
>(
f.
begin()),
123 <<
"Unsupported communications type " << int(commsType)
137 receive(commsType,
tf.ref());
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();
187 resizeBuf(receiveBuf_, nBytes);
212 <<
"Unsupported communications type " << int(commsType)
218 this->send(commsType,
f);
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);
243 resizeBuf(receiveBuf_, nBytes);
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());
Pre-declare SubField and related Field type.
void size(const label)
Override size to be inconsistent with allocated storage.
static label read(const commsTypes commsType, const int fromProcNo, char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label communicator=0)
Read into given buffer from given processor and return the.
iterator begin()
Return an iterator to begin traversing the UList.
std::streamsize byteSize() const
Return the binary size in number of characters of the UList.
T & last()
Return the last element of the list.
static bool write(const commsTypes commsType, const int toProcNo, const char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label communicator=0)
Write given buffer to given processor.
commsTypes
Types of communications.
static bool floatTransfer
Should compact transfer be used in which floats replace doubles.
virtual label comm() const =0
Return communicator used for parallel communication.
void send(const Pstream::commsTypes commsType, const UList< Type > &) const
Raw send function.
void receive(const Pstream::commsTypes commsType, UList< Type > &) const
Raw field receive function.
virtual int neighbProcNo() const =0
Return neighbour processor number (rank in communicator)
void compressedSend(const Pstream::commsTypes commsType, const UList< Type > &) const
Raw field send function with data compression.
void compressedReceive(const Pstream::commsTypes commsType, UList< Type > &) const
Raw field receive function with data compression.
virtual int tag() const =0
Return message tag used for sending.
A class for managing temporary objects.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.