| 56 | // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // |
| 57 | |
| 58 | void 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 | |
| 98 | Foam::List<Foam::UPstream::commsStruct> Foam::UPstream::calcLinearComm |