------------------------------------------------------------------------------
| 558 | |
| 559 | //------------------------------------------------------------------------------ |
| 560 | int vtkIntegrateAttributes::PieceNodeMinToNode0( |
| 561 | vtkUnstructuredGrid* data, double& totalSum, double totalSumCenter[3], int& integrationDimension) |
| 562 | { |
| 563 | int numProcs = this->Controller ? this->Controller->GetNumberOfProcesses() : 1; |
| 564 | int processId = this->Controller ? this->Controller->GetLocalProcessId() : 0; |
| 565 | int localMin = (data->GetNumberOfCells() == 0 ? numProcs : processId); |
| 566 | int globalMin = numProcs; |
| 567 | if (numProcs == 1) |
| 568 | { |
| 569 | return 0; |
| 570 | } |
| 571 | this->Controller->AllReduce(&localMin, &globalMin, 1, vtkCommunicator::MIN_OP); |
| 572 | if (globalMin == 0 || globalMin == numProcs) |
| 573 | { |
| 574 | return globalMin; |
| 575 | } |
| 576 | if (processId == 0) |
| 577 | { |
| 578 | this->ReceivePiece(data, globalMin, totalSum, totalSumCenter, integrationDimension); |
| 579 | } |
| 580 | else if (processId == globalMin) |
| 581 | { |
| 582 | this->SendPiece(data, totalSum, totalSumCenter, integrationDimension); |
| 583 | } |
| 584 | return globalMin; |
| 585 | } |
| 586 | |
| 587 | //------------------------------------------------------------------------------ |
| 588 | void vtkIntegrateAttributes::SendPiece(vtkUnstructuredGrid* src, const double totalSum, |
no test coverage detected