| 392 | vtkPConnectivityFilter::~vtkPConnectivityFilter() = default; |
| 393 | |
| 394 | int vtkPConnectivityFilter::RequestData( |
| 395 | vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 396 | { |
| 397 | // Get the input |
| 398 | vtkInformation* inInfo = inputVector[0]->GetInformationObject(0); |
| 399 | if (!inInfo) |
| 400 | { |
| 401 | return 0; |
| 402 | } |
| 403 | vtkDataSet* input = vtkDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 404 | |
| 405 | vtkMultiProcessController* globalController = vtkMultiProcessController::GetGlobalController(); |
| 406 | |
| 407 | // Check how many ranks have data. If it is only one, running the superclass |
| 408 | // RequestData is sufficient as no global data exchange and RegionId |
| 409 | // relabeling is needed. It is worth checking to avoid issuing an |
| 410 | // unnecessary warning when a dataset resides entirely on one process. |
| 411 | int numRanks = 1; |
| 412 | int myRank = 0; |
| 413 | int ranksWithCells = 0; |
| 414 | int hasCells = input->GetNumberOfCells() > 0 ? 1 : 0; |
| 415 | |
| 416 | if (globalController) |
| 417 | { |
| 418 | globalController->AllReduce(&hasCells, &ranksWithCells, 1, vtkCommunicator::SUM_OP); |
| 419 | numRanks = globalController->GetNumberOfProcesses(); |
| 420 | myRank = globalController->GetLocalProcessId(); |
| 421 | } |
| 422 | |
| 423 | // Compute local connectivity. If we are running in parallel, we need the full |
| 424 | // connectivity first, and will handle the extraction mode later. |
| 425 | int success = 1; |
| 426 | if (numRanks > 1 && ranksWithCells > 1) |
| 427 | { |
| 428 | if (this->ExtractionMode == VTK_EXTRACT_POINT_SEEDED_REGIONS || |
| 429 | this->ExtractionMode == VTK_EXTRACT_CELL_SEEDED_REGIONS || |
| 430 | this->ExtractionMode == VTK_EXTRACT_SPECIFIED_REGIONS) |
| 431 | { |
| 432 | vtkErrorMacro("ExtractionMode " << this->GetExtractionModeAsString() |
| 433 | << " is not supported in " << this->GetClassName() |
| 434 | << " when the number of ranks with data is greater than 1."); |
| 435 | return 1; |
| 436 | } |
| 437 | |
| 438 | int saveScalarConnectivity = this->ScalarConnectivity; |
| 439 | int saveExtractionMode = this->ExtractionMode; |
| 440 | int saveColorRegions = this->ColorRegions; |
| 441 | int saveRegionIdAssignmentMode = this->RegionIdAssignmentMode; |
| 442 | bool compressArrays = this->GetCompressArrays(); |
| 443 | |
| 444 | // Overwrite custom member variables temporarily. |
| 445 | this->ScalarConnectivity = 0; |
| 446 | this->ExtractionMode = VTK_EXTRACT_ALL_REGIONS; |
| 447 | this->ColorRegions = 1; |
| 448 | this->RegionIdAssignmentMode = UNSPECIFIED; |
| 449 | this->CompressArraysOff(); |
| 450 | |
| 451 | // Invoke the connectivity algorithm in the superclass. |
nothing calls this directly
no test coverage detected