------------------------------------------------------------------------------
| 503 | |
| 504 | //------------------------------------------------------------------------------ |
| 505 | void vtkPStructuredGridConnectivity::PostReceives() |
| 506 | { |
| 507 | // STEP 0: Acquire MPI controller from supplied Multi-Process controller |
| 508 | vtkMPIController* myMPIController = vtkMPIController::SafeDownCast(this->Controller); |
| 509 | assert("pre: Cannot acquire MPI controller" && (myMPIController != nullptr)); |
| 510 | |
| 511 | // STEP 1: Loop through all local grids and post receives |
| 512 | int rqstIdx = 0; |
| 513 | for (unsigned int idx = 0; idx < this->GridIds.size(); ++idx) |
| 514 | { |
| 515 | int gridIdx = this->GridIds[idx]; |
| 516 | assert("ERROR: grid index is out-of-bounds" && (gridIdx >= 0) && |
| 517 | (gridIdx < static_cast<int>(this->NumberOfGrids))); |
| 518 | assert("ERROR: grid must be local" && this->IsGridLocal(gridIdx)); |
| 519 | assert("ERROR: grid rcv buffers must be 1-to-1 with the grid neighbors" && |
| 520 | this->Neighbors[gridIdx].size() == this->RcvBuffers[gridIdx].size()); |
| 521 | assert("ERROR: grid rcv buffers must be 1-to-1 with the rcv buffer sizes" && |
| 522 | this->RcvBufferSizes[gridIdx].size() == this->RcvBuffers[gridIdx].size()); |
| 523 | |
| 524 | size_t NumNeis = this->Neighbors[gridIdx].size(); |
| 525 | for (size_t nei = 0; nei < NumNeis; ++nei) |
| 526 | { |
| 527 | int neiGridIdx = this->Neighbors[gridIdx][nei].NeighborID; |
| 528 | assert("ERROR: Neighbor grid index is out-of-bounds!" && (neiGridIdx >= 0) && |
| 529 | (neiGridIdx < static_cast<int>(this->NumberOfGrids))); |
| 530 | if (this->IsGridLocal(neiGridIdx)) |
| 531 | { |
| 532 | // The neighboring grid is local, thus, the ghost data are transferred |
| 533 | // directly using vtkStructuredGrid::TransferLocalNeighborData(). |
| 534 | // Consequently, there is no need for any communication. |
| 535 | continue; |
| 536 | } |
| 537 | |
| 538 | int NeighborRank = this->GetGridRank(neiGridIdx); |
| 539 | |
| 540 | assert("pre: RcvBuffer must be nullptr!" && (this->RcvBuffers[gridIdx][nei] == nullptr)); |
| 541 | |
| 542 | this->RcvBuffers[gridIdx][nei] = new unsigned char[this->RcvBufferSizes[gridIdx][nei]]; |
| 543 | assert("ERROR: Could not allocate RcvBuffer!" && this->RcvBuffers[gridIdx][nei]); |
| 544 | assert("pre: RequestIndex is out-of-bounds!" && (rqstIdx >= 0) && |
| 545 | (rqstIdx < this->TotalNumberOfMsgs)); |
| 546 | |
| 547 | unsigned char* bufferPtr = this->RcvBuffers[gridIdx][nei]; |
| 548 | int length = this->RcvBufferSizes[gridIdx][nei]; |
| 549 | myMPIController->NoBlockReceive( |
| 550 | bufferPtr, length, NeighborRank, neiGridIdx, this->MPIRequests[rqstIdx]); |
| 551 | ++rqstIdx; |
| 552 | } // END for all neis |
| 553 | } // END for all local grids |
| 554 | |
| 555 | assert(this->TotalNumberOfRcvs == rqstIdx); |
| 556 | } |
| 557 | |
| 558 | //------------------------------------------------------------------------------ |
| 559 | void vtkPStructuredGridConnectivity::PostSends() |
no test coverage detected