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

Method ExchangeIdArraysLean

Filters/ParallelGeometry/vtkPDistributedDataFilter.cxx:1476–1594  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1474
1475//------------------------------------------------------------------------------
1476vtkIdTypeArray** vtkPDistributedDataFilter::ExchangeIdArraysLean(
1477 vtkIdTypeArray** myArray, int deleteSendArrays, int tag)
1478{
1479 vtkIdTypeArray** remoteArrays = nullptr;
1480
1481 int i;
1482 int nprocs = this->NumProcesses;
1483 int me = this->MyId;
1484
1485 vtkMPICommunicator::Request req;
1486 vtkMPIController* mpiContr = vtkMPIController::SafeDownCast(this->Controller);
1487
1488 vtkIdType* recvSize = new vtkIdType[nprocs];
1489 vtkIdType* sendSize = new vtkIdType[nprocs];
1490
1491 if (!this->Source)
1492 {
1493 this->SetUpPairWiseExchange();
1494 }
1495
1496 for (i = 0; i < nprocs; i++)
1497 {
1498 sendSize[i] = myArray[i] ? myArray[i]->GetNumberOfTuples() : 0;
1499 recvSize[i] = 0;
1500 }
1501
1502 // Exchange sizes
1503
1504 int nothers = nprocs - 1;
1505
1506 for (i = 0; i < nothers; i++)
1507 {
1508 int source = this->Source[i];
1509 int target = this->Target[i];
1510 mpiContr->NoBlockReceive(recvSize + source, 1, source, tag, req);
1511 mpiContr->Send(sendSize + target, 1, target, tag);
1512 req.Wait();
1513 }
1514
1515 // Exchange int arrays
1516
1517 vtkIdType** recvArrays = new vtkIdType*[nprocs];
1518 std::fill_n(recvArrays, nprocs, nullptr);
1519
1520 if (sendSize[me] > 0) // sent myself an array
1521 {
1522 recvSize[me] = sendSize[me];
1523 recvArrays[me] = new vtkIdType[sendSize[me]];
1524 memcpy(recvArrays[me], myArray[me]->GetPointer(0), sendSize[me] * sizeof(vtkIdType));
1525 }
1526
1527 for (i = 0; i < nothers; i++)
1528 {
1529 int source = this->Source[i];
1530 int target = this->Target[i];
1531 recvArrays[source] = nullptr;
1532
1533 if (recvSize[source] > 0)

Callers 1

ExchangeIdArraysMethod · 0.95

Calls 10

SetUpPairWiseExchangeMethod · 0.95
fill_nFunction · 0.85
NoBlockReceiveMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetNumberOfTuplesMethod · 0.45
SendMethod · 0.45
WaitMethod · 0.45
GetPointerMethod · 0.45
SetArrayMethod · 0.45

Tested by

no test coverage detected