MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / write

Function write

src/Pstream/mpi/UOPwrite.C:36–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
35
36bool Foam::UOPstream::write
37(
38 const commsTypes commsType,
39 const int toProcNo,
40 const char* buf,
41 const std::streamsize bufSize,
42 const int tag,
43 const label communicator
44)
45{
46 if (debug)
47 {
48 Pout<< "UOPstream::write : starting write to:" << toProcNo
49 << " tag:" << tag
50 << " comm:" << communicator << " size:" << label(bufSize)
51 << " commsType:" << UPstream::commsTypeNames[commsType]
52 << Foam::endl;
53 }
54 if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
55 {
56 Pout<< "UOPstream::write : starting write to:" << toProcNo
57 << " tag:" << tag
58 << " comm:" << communicator << " size:" << label(bufSize)
59 << " commsType:" << UPstream::commsTypeNames[commsType]
60 << " warnComm:" << UPstream::warnComm
61 << Foam::endl;
62 error::printStack(Pout);
63 }
64
65
66 PstreamGlobals::checkCommunicator(communicator, toProcNo);
67
68
69 bool transferFailed = true;
70
71 if (commsType == commsTypes::blocking)
72 {
73 transferFailed = MPI_Bsend
74 (
75 const_cast<char*>(buf),
76 bufSize,
77 MPI_BYTE,
78 toProcNo, //procID(toProcNo),
79 tag,
80 PstreamGlobals::MPICommunicators_[communicator] //MPI_COMM_WORLD
81 );
82
83 if (debug)
84 {
85 Pout<< "UOPstream::write : finished write to:" << toProcNo
86 << " tag:" << tag << " size:" << label(bufSize)
87 << " commsType:" << UPstream::commsTypeNames[commsType]
88 << Foam::endl;
89 }
90 }
91 else if (commsType == commsTypes::scheduled)
92 {
93 transferFailed = MPI_Send

Calls 6

labelFunction · 0.85
checkCommunicatorFunction · 0.85
abortFunction · 0.70
printStackFunction · 0.50
sizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected