| 398 | |
| 399 | |
| 400 | bool Foam::functionObjects::streamLine::write() |
| 401 | { |
| 402 | Info<< type() << " " << name() << " write:" << nl; |
| 403 | |
| 404 | const Time& runTime = obr_.time(); |
| 405 | |
| 406 | // Do all injection and tracking |
| 407 | track(); |
| 408 | |
| 409 | |
| 410 | if (Pstream::parRun()) |
| 411 | { |
| 412 | // Append slave tracks to master ones |
| 413 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 414 | |
| 415 | globalIndex globalTrackIDs(allTracks_.size()); |
| 416 | |
| 417 | // Construct a distribution map to pull all to the master. |
| 418 | labelListList sendMap(Pstream::nProcs()); |
| 419 | labelListList recvMap(Pstream::nProcs()); |
| 420 | |
| 421 | if (Pstream::master()) |
| 422 | { |
| 423 | // Master: receive all. My own first, then consecutive |
| 424 | // processors. |
| 425 | label trackI = 0; |
| 426 | |
| 427 | forAll(recvMap, proci) |
| 428 | { |
| 429 | labelList& fromProc = recvMap[proci]; |
| 430 | fromProc.setSize(globalTrackIDs.localSize(proci)); |
| 431 | forAll(fromProc, i) |
| 432 | { |
| 433 | fromProc[i] = trackI++; |
| 434 | } |
| 435 | } |
| 436 | } |
| 437 | |
| 438 | labelList& toMaster = sendMap[0]; |
| 439 | toMaster.setSize(globalTrackIDs.localSize()); |
| 440 | forAll(toMaster, i) |
| 441 | { |
| 442 | toMaster[i] = i; |
| 443 | } |
| 444 | |
| 445 | const mapDistribute distMap |
| 446 | ( |
| 447 | globalTrackIDs.size(), |
| 448 | sendMap.xfer(), |
| 449 | recvMap.xfer() |
| 450 | ); |
| 451 | |
| 452 | |
| 453 | // Distribute the track positions. Note: use scheduled comms |
| 454 | // to prevent buffering. |
| 455 | mapDistributeBase::distribute |
| 456 | ( |
| 457 | Pstream::commsTypes::scheduled, |
nothing calls this directly
no test coverage detected