MCPcopy Create free account
hub / github.com/Kitware/VTK / PostSends

Method PostSends

Filters/ParallelGeometry/vtkPStructuredGridConnectivity.cxx:559–606  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

557
558//------------------------------------------------------------------------------
559void vtkPStructuredGridConnectivity::PostSends()
560{
561 // STEP 0: Acquire MPI controller from supplied Multi-Process controller
562 vtkMPIController* myMPIController = vtkMPIController::SafeDownCast(this->Controller);
563 assert("pre: Cannot acquire MPI controller" && (myMPIController != nullptr));
564
565 // STEP 1: Loop through all local grids and post receives
566 int rqstIdx = this->TotalNumberOfRcvs;
567 for (unsigned int idx = 0; idx < this->GridIds.size(); ++idx)
568 {
569 int gridIdx = this->GridIds[idx];
570 assert("ERROR: grid index is out-of-bounds" && (gridIdx >= 0) &&
571 (gridIdx < static_cast<int>(this->NumberOfGrids)));
572 assert("ERROR: grid must be local" && this->IsGridLocal(gridIdx));
573 assert("ERROR: grid rcv buffers must be 1-to-1 with the grid neighbors" &&
574 this->Neighbors[gridIdx].size() == this->SendBuffers[gridIdx].size());
575 assert("ERROR: grid rcv buffers must be 1-to-1 with the rcv buffer sizes" &&
576 this->SendBufferSizes[gridIdx].size() == this->SendBuffers[gridIdx].size());
577
578 int NumNeis = static_cast<int>(this->Neighbors[gridIdx].size());
579 for (int nei = 0; nei < NumNeis; ++nei)
580 {
581 int neiGridIdx = this->Neighbors[gridIdx][nei].NeighborID;
582 assert("ERROR: Neighbor grid index is out-of-bounds!" && (neiGridIdx >= 0) &&
583 (neiGridIdx < static_cast<int>(this->NumberOfGrids)));
584 if (this->IsGridLocal(neiGridIdx))
585 {
586 // The neighboring grid is local, thus, the ghost data are transferred
587 // directly using vtkStructuredGrid::TransferLocalNeighborData().
588 // Consequently, there is no need for any communication.
589 continue;
590 }
591
592 int NeighborRank = this->GetGridRank(neiGridIdx);
593
594 assert("pre: RcvBuffer must be nullptr!" && (this->SendBuffers[gridIdx][nei] != nullptr));
595 assert("pre: RequestIndex is out-of-bounds!" && (rqstIdx >= 0) &&
596 (rqstIdx < this->TotalNumberOfMsgs));
597 unsigned char* bufferPtr = this->SendBuffers[gridIdx][nei];
598 int length = this->SendBufferSizes[gridIdx][nei];
599 myMPIController->NoBlockSend(
600 bufferPtr, length, NeighborRank, gridIdx, this->MPIRequests[rqstIdx]);
601 ++rqstIdx;
602 } // END for all neis
603 } // END for all local grids
604
605 assert(rqstIdx == this->TotalNumberOfMsgs);
606}
607
608//------------------------------------------------------------------------------
609void vtkPStructuredGridConnectivity::CommunicateGhostData()

Callers 1

CommunicateGhostDataMethod · 0.95

Calls 5

IsGridLocalMethod · 0.95
GetGridRankMethod · 0.95
NoBlockSendMethod · 0.80
assertFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected