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

Method ExchangeFloatArraysLean

Filters/ParallelGeometry/vtkPDistributedDataFilter.cxx:1352–1473  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1350
1351//------------------------------------------------------------------------------
1352vtkFloatArray** vtkPDistributedDataFilter::ExchangeFloatArraysLean(
1353 vtkFloatArray** myArray, int deleteSendArrays, int tag)
1354{
1355 vtkFloatArray** remoteArrays = nullptr;
1356
1357 int i;
1358 int nprocs = this->NumProcesses;
1359 int me = this->MyId;
1360
1361 vtkMPICommunicator::Request req;
1362 vtkMPIController* mpiContr = vtkMPIController::SafeDownCast(this->Controller);
1363
1364 int* recvSize = new int[nprocs];
1365 int* sendSize = new int[nprocs];
1366
1367 if (!this->Source)
1368 {
1369 this->SetUpPairWiseExchange();
1370 }
1371
1372 for (i = 0; i < nprocs; i++)
1373 {
1374 sendSize[i] = myArray[i] ? myArray[i]->GetNumberOfTuples() : 0;
1375 recvSize[i] = 0;
1376 }
1377
1378 // Exchange sizes
1379
1380 int nothers = nprocs - 1;
1381
1382 for (i = 0; i < nothers; i++)
1383 {
1384 int source = this->Source[i];
1385 int target = this->Target[i];
1386 mpiContr->NoBlockReceive(recvSize + source, 1, source, tag, req);
1387 mpiContr->Send(sendSize + target, 1, target, tag);
1388 req.Wait();
1389 }
1390
1391 // Exchange int arrays
1392
1393 float** recvArrays = new float*[nprocs];
1394 std::fill_n(recvArrays, nprocs, nullptr);
1395
1396 if (sendSize[me] > 0) // sent myself an array
1397 {
1398 recvSize[me] = sendSize[me];
1399 recvArrays[me] = new float[sendSize[me]];
1400 memcpy(recvArrays[me], myArray[me]->GetPointer(0), sendSize[me] * sizeof(float));
1401 }
1402
1403 for (i = 0; i < nothers; i++)
1404 {
1405 int source = this->Source[i];
1406 int target = this->Target[i];
1407 recvArrays[source] = nullptr;
1408
1409 if (recvSize[source] > 0)

Callers 1

ExchangeFloatArraysMethod · 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