42 const label nBytes =
f.byteSize();
62 resizeBuf(receiveBuf_, nBytes);
74 resizeBuf(sendBuf_, nBytes);
77 static_cast<void*>(sendBuf_.
data()),
f.cdata(), nBytes
93 <<
"Unsupported communications type " << int(commsType)
132 <<
"Unsupported communications type " << int(commsType)
145 auto tfld = tmp<Field<Type>>
::New(size);
146 receive(commsType, tfld.ref());
160 static const label nCmpts =
sizeof(Type)/
sizeof(scalar);
161 label nm1 = (
f.
size() - 1)*nCmpts;
162 label nlast =
sizeof(Type)/
sizeof(
float);
163 label nFloats = nm1 + nlast;
164 label nBytes = nFloats*
sizeof(float);
166 const scalar *sArray =
reinterpret_cast<const scalar*
>(
f.
cdata());
167 const scalar *slast = &sArray[nm1];
168 resizeBuf(sendBuf_, nBytes);
169 float *fArray =
reinterpret_cast<float*
>(sendBuf_.data());
171 for (label i=0; i<nm1; i++)
173 fArray[i] = sArray[i] - slast[i%nCmpts];
176 reinterpret_cast<Type&
>(fArray[nm1]) =
f.
last();
196 resizeBuf(receiveBuf_, nBytes);
221 <<
"Unsupported communications type " << int(commsType)
227 this->send(commsType,
f);
241 static const label nCmpts =
sizeof(Type)/
sizeof(scalar);
242 label nm1 = (
f.
size() - 1)*nCmpts;
243 label nlast =
sizeof(Type)/
sizeof(
float);
244 label nFloats = nm1 + nlast;
245 label nBytes = nFloats*
sizeof(float);
253 resizeBuf(receiveBuf_, nBytes);
268 <<
"Unsupported communications type " << int(commsType)
272 const float *fArray =
273 reinterpret_cast<const float*
>(receiveBuf_.cdata());
274 f.
last() =
reinterpret_cast<const Type&
>(fArray[nm1]);
275 scalar *sArray =
reinterpret_cast<scalar*
>(
f.
data());
276 const scalar *slast = &sArray[nm1];
278 for (label i=0; i<nm1; i++)
280 sArray[i] = fArray[i] + slast[i%nCmpts];
285 this->receive<Type>(commsType,
f);
297 auto tfld = tmp<Field<Type>>
::New(size);
298 compressedReceive(commsType, tfld.ref());
void compressedReceive(const Pstream::commsTypes commsType, UList< Type > &f) const
Raw receive function with data compression.
static bool floatTransfer
Should compact transfer be used in which floats replace doubles reducing the bandwidth requirement at...
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)
Write buffer contents to given processor.
void size(const label n)
Older name for setAddressableSize.
"blocking" : (MPI_Bsend, MPI_Recv)
errorManipArg< error, int > exit(error &err, const int errNo=1)
commsTypes
Types of communications.
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 >> &tdf1, 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,.
void send(const Pstream::commsTypes commsType, const UList< Type > &f) const
Raw send function.
void compressedSend(const Pstream::commsTypes commsType, const UList< Type > &f) const
Raw send function with data compression.
void receive(const Pstream::commsTypes commsType, UList< Type > &f) const
Raw receive function.
"scheduled" : (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].
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)
"nonBlocking" : (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.
static label read(const commsTypes commsType, const int fromProcNo, char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Read buffer contents from given processor.