42 if constexpr (!is_contiguous_v<Type>)
45 <<
"Invalid for non-contiguous data types" 72 const label nBytes =
fld.size_bytes();
74 resizeBuf(byteSendBuf_, nBytes);
75 resizeBuf(byteRecvBuf_, nBytes);
79 static_cast<void*>(byteSendBuf_.
data()),
fld.cdata(), nBytes
105 <<
"Unsupported communications type " << int(commsType)
118 if constexpr (!is_contiguous_v<Type>)
121 <<
"Invalid for non-contiguous data types" 142 const label nBytes =
fld.size_bytes();
146 static_cast<void*>(
fld.data()), byteRecvBuf_.cdata(), nBytes
152 <<
"Unsupported communications type " << int(commsType)
165 auto tfld = tmp<Field<Type>>
::New(size);
166 receive(commsType, tfld.ref());
180 std::is_integral_v<Type>
181 || (
sizeof(
float) ==
sizeof(scalar))
185 this->send(commsType,
f);
190 this->send(commsType,
f);
194 static const label nCmpts = (
sizeof(Type)/
sizeof(scalar));
195 const label nm1 = (
f.
size() - 1)*nCmpts;
196 const label nBytes =
f.
size()*nCmpts*
sizeof(float);
198 const scalar *sArray =
reinterpret_cast<const scalar*
>(
f.
cdata());
199 const scalar *slast = &sArray[nm1];
200 resizeBuf(byteSendBuf_, nBytes);
201 float *fArray =
reinterpret_cast<float*
>(byteSendBuf_.data());
203 for (label i=0; i<nm1; i++)
205 fArray[i] = sArray[i] - slast[i%nCmpts];
208 reinterpret_cast<Type&
>(fArray[nm1]) =
f.
last();
220 byteSendBuf_.cdata(),
228 resizeBuf(byteRecvBuf_, nBytes);
244 byteSendBuf_.cdata(),
253 <<
"Unsupported communications type " << int(commsType)
269 std::is_integral_v<Type>
270 || (
sizeof(
float) ==
sizeof(scalar))
274 this->receive<Type>(commsType,
f);
279 this->receive<Type>(commsType,
f);
283 static const label nCmpts = (
sizeof(Type)/
sizeof(scalar));
284 const label nm1 = (
f.
size() - 1)*nCmpts;
285 const label nBytes =
f.
size()*nCmpts*
sizeof(float);
293 resizeBuf(byteRecvBuf_, nBytes);
308 <<
"Unsupported communications type " << int(commsType)
312 const float *fArray =
313 reinterpret_cast<const float*
>(byteRecvBuf_.cdata());
314 f.
last() =
reinterpret_cast<const Type&
>(fArray[nm1]);
315 scalar *sArray =
reinterpret_cast<scalar*
>(
f.
data());
316 const scalar *slast = &sArray[nm1];
318 for (label i=0; i<nm1; i++)
320 sArray[i] = fArray[i] + slast[i%nCmpts];
333 auto tfld = tmp<Field<Type>>
::New(size);
334 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.
bool empty() const noexcept
True if List is empty (ie, size() is zero)
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.
static std::streamsize read(const UPstream::commsTypes commsType, const int fromProcNo, Type *buffer, std::streamsize count, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm, UPstream::Request *req=nullptr)
Receive buffer contents (contiguous types) from given processor.
"scheduled" (MPI standard) : (MPI_Send, MPI_Recv)
static bool write(const UPstream::commsTypes commsType, const int toProcNo, const Type *buffer, std::streamsize count, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm, UPstream::Request *req=nullptr, const UPstream::sendModes sendMode=UPstream::sendModes::normal)
Write buffer contents (contiguous types only) to given processor.
virtual label comm() const =0
Return communicator used for parallel communication.
virtual int tag() const =0
Return message tag used for sending.
errorManip< error > abort(error &err)
T & last()
Access last element of the list, position [size()-1].
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
void compressedReceive(const UPstream::commsTypes commsType, UList< Type > &f) const
Raw receive function with data compression.
virtual int neighbProcNo() const =0
Return neighbour processor number (rank in communicator)
"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.