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

Method BuildTargetPartMap

Filters/ParallelMPI/vtkHyperTreeGridRedistribute.cxx:629–660  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

627}
628//------------------------------------------------------------------------------
629void vtkHyperTreeGridRedistribute::BuildTargetPartMap()
630{
631 /*
632 * The strategy to distribute HyperTrees used is currently very simple:
633 * all the partitions should contain the same number of trees.
634 * There may be better strategies to group trees spatially, and balance partitions
635 * using the number of cells in each tree
636 */
637
638 vtkIdType maxTrees = this->OutputHTG->GetMaxNumberOfTrees();
639
640 for (vtkIdType part = 0; part < this->NumPartitions; part++)
641 {
642 vtkIdType startId = std::ceil(static_cast<double>(part * maxTrees) / this->NumPartitions);
643 vtkIdType endId =
644 std::ceil(static_cast<double>((part + 1) * maxTrees) / this->NumPartitions - 1.0);
645 for (vtkIdType id = startId; id <= endId; id++)
646 {
647 this->TreeTargetPartId[id] = part;
648 }
649 }
650
651 // Compute which trees to send to which processes
652 this->TreesToSend.resize(this->NumPartitions);
653 for (vtkIdType& id : this->LocalTreeIds)
654 {
655 if (this->TreeTargetPartId[id] != this->Controller->GetLocalProcessId())
656 {
657 this->TreesToSend[this->TreeTargetPartId[id]].emplace_back(id);
658 }
659 }
660}
661
662//------------------------------------------------------------------------------
663void vtkHyperTreeGridRedistribute::ExchangeHyperTreeMetaData(vtkBitArray* descriptorSendBuffer,

Callers 1

ProcessTreesMethod · 0.95

Calls 5

GetMaxNumberOfTreesMethod · 0.80
ceilFunction · 0.50
resizeMethod · 0.45
GetLocalProcessIdMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected