------------------------------------------------------------------------------
| 460 | |
| 461 | //------------------------------------------------------------------------------ |
| 462 | bool vtkHyperTreeGridRedistribute::ExchangeHTGMetadata() |
| 463 | { |
| 464 | // Make sure all ranks share the same HTG metadata. |
| 465 | // Metadata mismatch can happen, for instance, when we read a HTG from a .htg file in parallel; |
| 466 | // all ranks have unconfigured HTGs except one rank. |
| 467 | |
| 468 | // Get minimum rank id with an initialized input HTG (correct bounds). |
| 469 | // This rank will broadcast its metadata. |
| 470 | int metadataSourceProcess = 0; |
| 471 | double* bounds = this->InputHTG->GetBounds(); |
| 472 | int processInit = bounds[0] <= bounds[1] ? this->Controller->GetLocalProcessId() |
| 473 | : std::numeric_limits<int>::max(); |
| 474 | this->Controller->AllReduce(&processInit, &metadataSourceProcess, 1, vtkCommunicator::MIN_OP); |
| 475 | |
| 476 | if (metadataSourceProcess == std::numeric_limits<int>::max()) |
| 477 | { |
| 478 | vtkDebugMacro("No valid HTG found in any process"); |
| 479 | return false; |
| 480 | } |
| 481 | |
| 482 | vtkDebugMacro("Metadata source process is " << metadataSourceProcess); |
| 483 | |
| 484 | this->OutputHTG->Initialize(); |
| 485 | |
| 486 | // Exchange BranchFactor |
| 487 | int branchFactor = this->InputHTG->GetBranchFactor(); |
| 488 | this->Controller->Broadcast(&branchFactor, 1, metadataSourceProcess); |
| 489 | this->OutputHTG->SetBranchFactor(branchFactor); |
| 490 | |
| 491 | // Exchange DepthLimiter |
| 492 | int depth = this->InputHTG->GetDepthLimiter(); |
| 493 | this->Controller->Broadcast(&depth, 1, metadataSourceProcess); |
| 494 | this->OutputHTG->SetDepthLimiter(depth); |
| 495 | |
| 496 | // Exchange mask info |
| 497 | int hasMask = this->InputHTG->HasMask(); |
| 498 | this->Controller->Broadcast(&hasMask, 1, metadataSourceProcess); |
| 499 | if (hasMask) |
| 500 | { |
| 501 | this->OutMask = vtkSmartPointer<vtkBitArray>::New(); |
| 502 | this->HasMask = true; |
| 503 | } |
| 504 | |
| 505 | // Exchange TransposedRootIndexing |
| 506 | int transposedRoot = this->InputHTG->GetTransposedRootIndexing(); |
| 507 | this->Controller->Broadcast(&transposedRoot, 1, metadataSourceProcess); |
| 508 | this->OutputHTG->SetTransposedRootIndexing(transposedRoot); |
| 509 | |
| 510 | // Exchange Dimensions |
| 511 | int dims[3]; |
| 512 | this->InputHTG->GetDimensions(dims); |
| 513 | this->Controller->Broadcast(dims, 3, metadataSourceProcess); |
| 514 | this->OutputHTG->SetDimensions(dims); |
| 515 | |
| 516 | // Exchange Interface |
| 517 | int hasInterface = this->InputHTG->GetHasInterface(); |
| 518 | this->Controller->Broadcast(&hasInterface, 1, metadataSourceProcess); |
| 519 | this->OutputHTG->SetHasInterface(hasInterface); |
no test coverage detected