42 const label nBytes =
f.byteSize();
62 resizeBuf(byteSendBuf_, nBytes);
65 static_cast<void*>(byteSendBuf_.
data()),
f.cdata(), nBytes
68 resizeBuf(byteRecvBuf_, nBytes);
99 <<
"Unsupported communications type " << int(commsType)
134 static_cast<void*>(
f.
data()), byteRecvBuf_.cdata(), nBytes
140 <<
"Unsupported communications type " << int(commsType)
153 auto tfld = tmp<Field<Type>>
::New(size);
154 receive(commsType, tfld.ref());
170 && (!std::is_integral<Type>::value &&
sizeof(scalar) !=
sizeof(
float))
173 static const label nCmpts =
176 std::is_integral<Type>::value
178 :
sizeof(Type)/
sizeof(scalar)
180 const label nm1 = (
f.
size() - 1)*nCmpts;
181 const label nBytes =
f.
size()*nCmpts*
sizeof(float);
183 const scalar *sArray =
reinterpret_cast<const scalar*
>(
f.
cdata());
184 const scalar *slast = &sArray[nm1];
185 resizeBuf(byteSendBuf_, nBytes);
186 float *fArray =
reinterpret_cast<float*
>(byteSendBuf_.data());
188 for (label i=0; i<nm1; i++)
190 fArray[i] = sArray[i] - slast[i%nCmpts];
193 reinterpret_cast<Type&
>(fArray[nm1]) =
f.
last();
205 byteSendBuf_.cdata(),
213 resizeBuf(byteRecvBuf_, nBytes);
229 byteSendBuf_.cdata(),
238 <<
"Unsupported communications type " << int(commsType)
244 this->send(commsType,
f);
260 && (!std::is_integral<Type>::value &&
sizeof(scalar) !=
sizeof(
float))
263 static const label nCmpts =
266 std::is_integral<Type>::value
268 :
sizeof(Type)/
sizeof(scalar)
270 const label nm1 = (
f.
size() - 1)*nCmpts;
271 const label nBytes =
f.
size()*nCmpts*
sizeof(float);
279 resizeBuf(byteRecvBuf_, nBytes);
294 <<
"Unsupported communications type " << int(commsType)
298 const float *fArray =
299 reinterpret_cast<const float*
>(byteRecvBuf_.cdata());
300 f.
last() =
reinterpret_cast<const Type&
>(fArray[nm1]);
301 scalar *sArray =
reinterpret_cast<scalar*
>(
f.
data());
302 const scalar *slast = &sArray[nm1];
304 for (label i=0; i<nm1; i++)
306 sArray[i] = fArray[i] + slast[i%nCmpts];
311 this->receive<Type>(commsType,
f);
323 auto tfld = tmp<Field<Type>>
::New(size);
324 compressedReceive(commsType, tfld.ref());
static bool floatTransfer
Should compact transfer be used in which floats replace doubles reducing the bandwidth requirement at...
void size(const label n)
Older name for setAddressableSize.
void send(const UPstream::commsTypes commsType, const UList< Type > &f) const
Raw send function.
errorManipArg< error, int > exit(error &err, const int errNo=1)
commsTypes
Communications types.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
T * data() noexcept
Return pointer to the underlying array serving as data storage.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
char * data_bytes() noexcept
Return pointer to the underlying array serving as data storage,.
"scheduled" (MPI standard) : (MPI_Send, MPI_Recv)
virtual label comm() const =0
Return communicator used for parallel communication.
virtual int tag() const =0
Return message tag used for sending.
T & last()
Access last element of the list, position [size()-1].
void compressedReceive(const UPstream::commsTypes commsType, UList< Type > &f) const
Raw receive function with data compression.
std::streamsize byteSize() const
Number of contiguous bytes for the List data, runtime FatalError if type is not contiguous.
virtual int neighbProcNo() const =0
Return neighbour processor number (rank in communicator)
static bool write(const UPstream::commsTypes commsType, const int toProcNo, const char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, UPstream::Request *req=nullptr, const UPstream::sendModes sendMode=UPstream::sendModes::normal)
Write buffer contents to given processor.
"nonBlocking" (immediate) : (MPI_Isend, MPI_Irecv)
const T * cdata() const noexcept
Return pointer to the underlying array serving as data storage.
A class for managing temporary objects.
"buffered" : (MPI_Bsend, MPI_Recv)
void compressedSend(const UPstream::commsTypes commsType, const UList< Type > &f) const
Raw send function with data compression.
void receive(const UPstream::commsTypes commsType, UList< Type > &f) const
Raw receive function.
static std::streamsize read(const UPstream::commsTypes commsType, const int fromProcNo, char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, UPstream::Request *req=nullptr)
Read buffer contents from given processor.