| 313 | |
| 314 | |
| 315 | void Foam::UPstream::allToAll |
| 316 | ( |
| 317 | const labelUList& sendData, |
| 318 | labelUList& recvData, |
| 319 | const label communicator |
| 320 | ) |
| 321 | { |
| 322 | label np = nProcs(communicator); |
| 323 | |
| 324 | if (sendData.size() != np || recvData.size() != np) |
| 325 | { |
| 326 | FatalErrorInFunction |
| 327 | << "Size of sendData " << sendData.size() |
| 328 | << " or size of recvData " << recvData.size() |
| 329 | << " is not equal to the number of processors in the domain " |
| 330 | << np |
| 331 | << Foam::abort(FatalError); |
| 332 | } |
| 333 | |
| 334 | if (!UPstream::parRun()) |
| 335 | { |
| 336 | recvData.deepCopy(sendData); |
| 337 | } |
| 338 | else |
| 339 | { |
| 340 | if |
| 341 | ( |
| 342 | MPI_Alltoall |
| 343 | ( |
| 344 | // NOTE: const_cast is a temporary hack for |
| 345 | // backward-compatibility with versions of OpenMPI < 1.7.4 |
| 346 | const_cast<label*>(sendData.begin()), |
| 347 | sizeof(label), |
| 348 | MPI_BYTE, |
| 349 | recvData.begin(), |
| 350 | sizeof(label), |
| 351 | MPI_BYTE, |
| 352 | PstreamGlobals::MPICommunicators_[communicator] |
| 353 | ) |
| 354 | ) |
| 355 | { |
| 356 | FatalErrorInFunction |
| 357 | << "MPI_Alltoall failed for " << sendData |
| 358 | << " on communicator " << communicator |
| 359 | << Foam::abort(FatalError); |
| 360 | } |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | |
| 365 | void Foam::UPstream::allocatePstreamCommunicator |
no test coverage detected