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

Method ExchangeHTGMetadata

Filters/ParallelMPI/vtkHyperTreeGridRedistribute.cxx:462–605  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

460
461//------------------------------------------------------------------------------
462bool 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);

Callers 1

ProcessTreesMethod · 0.95

Calls 15

SetBranchFactorMethod · 0.80
HasMaskMethod · 0.80
GetHasInterfaceMethod · 0.80
FastDeleteMethod · 0.80
maxFunction · 0.50
NewFunction · 0.50
CreateDataArrayFunction · 0.50
GetBoundsMethod · 0.45
GetLocalProcessIdMethod · 0.45
AllReduceMethod · 0.45
InitializeMethod · 0.45
BroadcastMethod · 0.45

Tested by

no test coverage detected