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)
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)
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];
334 compressedReceive(commsType, tfld.ref());
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
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.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
bool empty() const noexcept
True if List is empty (ie, size() is zero).
const T * cdata() const noexcept
Return pointer to the underlying array serving as data storage.
T * data() noexcept
Return pointer to the underlying array serving as data storage.
void size(const label n)
Older name for setAddressableSize.
T & last()
Access last element of the list, position [size()-1].
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.
commsTypes
Communications types.
@ scheduled
"scheduled" (MPI standard) : (MPI_Send, MPI_Recv)
@ nonBlocking
"nonBlocking" (immediate) : (MPI_Isend, MPI_Irecv)
@ buffered
"buffered" : (MPI_Bsend, MPI_Recv)
static bool floatTransfer
Should compact transfer be used in which floats replace doubles reducing the bandwidth requirement at...
virtual label comm() const =0
Return communicator used for parallel communication.
virtual int neighbProcNo() const =0
Return neighbour processor number (rank in communicator).
void compressedReceive(const UPstream::commsTypes commsType, UList< Type > &f) const
Raw receive function with data compression.
void receive(const UPstream::commsTypes commsType, UList< Type > &f) const
Raw receive function.
void compressedSend(const UPstream::commsTypes commsType, const UList< Type > &f) const
Raw send function with data compression.
virtual int tag() const =0
Return message tag used for sending.
void send(const UPstream::commsTypes commsType, const UList< Type > &f) const
Raw send function.
A class for managing temporary objects.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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.
errorManip< error > abort(error &err)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
constexpr bool is_contiguous_v
The is_contiguous value of Type (after stripping of qualifiers).
errorManipArg< error, int > exit(error &err, const int errNo=1)