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

Function setParRun

src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C:58–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
57
58void Foam::UPstream::setParRun(const label nProcs)
59{
60 if (nProcs == 0)
61 {
62 parRun_ = false;
63 freeCommunicator(UPstream::worldComm);
64 label comm = allocateCommunicator(-1, labelList(1, label(0)), false);
65 if (comm != UPstream::worldComm)
66 {
67 FatalErrorIn("UPstream::setParRun(const label)")
68 << "problem : comm:" << comm
69 << " UPstream::worldComm:" << UPstream::worldComm
70 << Foam::exit(FatalError);
71 }
72
73 Pout.prefix() = "";
74 Perr.prefix() = "";
75 }
76 else
77 {
78 parRun_ = true;
79
80 // Redo worldComm communicator (this has been created at static
81 // initialisation time)
82 freeCommunicator(UPstream::worldComm);
83 label comm = allocateCommunicator(-1, identity(nProcs), true);
84 if (comm != UPstream::worldComm)
85 {
86 FatalErrorInFunction
87 << "problem : comm:" << comm
88 << " UPstream::worldComm:" << UPstream::worldComm
89 << Foam::exit(FatalError);
90 }
91
92 Pout.prefix() = '[' + name(myProcNo(Pstream::worldComm)) + "] ";
93 Perr.prefix() = '[' + name(myProcNo(Pstream::worldComm)) + "] ";
94 }
95}
96
97
98Foam::List<Foam::UPstream::commsStruct> Foam::UPstream::calcLinearComm

Callers 1

initFunction · 0.85

Calls 3

labelFunction · 0.85
exitFunction · 0.50
nameFunction · 0.50

Tested by

no test coverage detected