------------------------------------------------------------------------------
| 287 | |
| 288 | //------------------------------------------------------------------------------ |
| 289 | void vtkPStructuredGridConnectivity::PackGhostData() |
| 290 | { |
| 291 | assert("pre: SendBuffers is not properly allocated!" && |
| 292 | this->SendBuffers.size() == this->NumberOfGrids); |
| 293 | assert( |
| 294 | "pre: RcvBuffers is not properly allocated!" && this->RcvBuffers.size() == this->NumberOfGrids); |
| 295 | |
| 296 | for (unsigned int idx = 0; idx < this->GridIds.size(); ++idx) |
| 297 | { |
| 298 | int gridIdx = this->GridIds[idx]; |
| 299 | assert("ERROR: grid index is out-of-bounds!" && (gridIdx >= 0) && |
| 300 | (gridIdx < static_cast<int>(this->NumberOfGrids))); |
| 301 | |
| 302 | int NumNeis = this->GetNumberOfNeighbors(gridIdx); |
| 303 | this->SendBuffers[gridIdx].resize(NumNeis, nullptr); |
| 304 | this->RcvBuffers[gridIdx].resize(NumNeis, nullptr); |
| 305 | this->RcvBufferSizes[gridIdx].resize(NumNeis, 0); |
| 306 | this->SendBufferSizes[gridIdx].resize(NumNeis, 0); |
| 307 | |
| 308 | for (int nei = 0; nei < NumNeis; ++nei) |
| 309 | { |
| 310 | this->RcvBufferSizes[gridIdx][nei] = 0; |
| 311 | |
| 312 | int neiGridIdx = this->Neighbors[gridIdx][nei].NeighborID; |
| 313 | assert("ERROR: neighbor grid index is out-of-bounds" && (neiGridIdx >= 0) && |
| 314 | (neiGridIdx < static_cast<int>(this->NumberOfGrids))); |
| 315 | |
| 316 | if (this->IsGridRemote(neiGridIdx)) |
| 317 | { |
| 318 | this->TotalNumberOfSends++; |
| 319 | this->TotalNumberOfRcvs++; |
| 320 | |
| 321 | this->SerializeGhostData(gridIdx, neiGridIdx, this->Neighbors[gridIdx][nei].SendExtent, |
| 322 | this->SendBuffers[gridIdx][nei], this->SendBufferSizes[gridIdx][nei]); |
| 323 | } // END if the neighboring grid is remote |
| 324 | |
| 325 | } // END for all neighbors |
| 326 | } // END for all local grids |
| 327 | |
| 328 | this->TotalNumberOfMsgs = this->TotalNumberOfRcvs + this->TotalNumberOfSends; |
| 329 | } |
| 330 | |
| 331 | //------------------------------------------------------------------------------ |
| 332 | void vtkPStructuredGridConnectivity::SerializeBufferSizes(int*& sizesbuf, vtkIdType& N) |
no test coverage detected