------------------------------------------------------------------------------
| 661 | |
| 662 | //------------------------------------------------------------------------------ |
| 663 | void vtkHyperTreeGridRedistribute::ExchangeHyperTreeMetaData(vtkBitArray* descriptorSendBuffer, |
| 664 | std::vector<int>& descriptorSizesReceivedBuffer, std::vector<int>& treeSizesSendBuffer, |
| 665 | std::vector<int>& maskSizesSendBuffer, std::vector<int>& treeSizesReceivedBuffer, |
| 666 | std::vector<int>& maskSizesReceivedBuffer, std::vector<int>& descriptorsByteOffsets) |
| 667 | { |
| 668 | std::vector<int> descriptorSizesSendBuffer; |
| 669 | std::vector<int> treeIdSendBuffer; |
| 670 | |
| 671 | this->NbTreesSentPerPart.resize(this->NumPartitions); |
| 672 | std::vector<int> treeTargetPartId(this->NumPartitions, 0); |
| 673 | this->NbDescriptorsBytesPerPart.resize(this->NumPartitions); |
| 674 | descriptorsByteOffsets.resize(this->NumPartitions, 0); |
| 675 | |
| 676 | // Browse local trees to collect information about descriptor size, number of cell data and mask |
| 677 | // size. These are all different informations because there is no descriptor for the lowest level, |
| 678 | // and masked cells have a value for the mask array but not for cell data arrays. |
| 679 | vtkNew<vtkHyperTreeGridNonOrientedCursor> cursor; |
| 680 | for (vtkIdType part = 0; part < this->NumPartitions; part++) |
| 681 | { |
| 682 | int descriptorSizeCum = 0; |
| 683 | for (vtkIdType& id : this->TreesToSend[part]) |
| 684 | { |
| 685 | vtkNew<vtkTypeInt64Array> numberOfVerticesPerDepth; |
| 686 | vtkNew<vtkBitArray> descriptor; |
| 687 | vtkNew<vtkIdList> breadthFirstIdMap; |
| 688 | this->InputHTG->GetTree(id)->ComputeBreadthFirstOrderDescriptor( |
| 689 | this->InputHTG->GetDepthLimiter(), this->InputHTG->GetMask(), numberOfVerticesPerDepth, |
| 690 | descriptor, breadthFirstIdMap); |
| 691 | descriptorSizesSendBuffer.emplace_back(descriptor->GetNumberOfTuples()); |
| 692 | treeIdSendBuffer.emplace_back(id); |
| 693 | |
| 694 | descriptorSendBuffer->InsertTuples( |
| 695 | descriptorSendBuffer->GetNumberOfTuples(), descriptor->GetNumberOfTuples(), 0, descriptor); |
| 696 | descriptorSizeCum += descriptor->GetNumberOfTuples(); |
| 697 | |
| 698 | this->InputHTG->InitializeNonOrientedCursor(cursor, id); |
| 699 | int countCells = 0, countMask = 0; |
| 700 | ::CountTreeCells(cursor, countCells, countMask); |
| 701 | treeSizesSendBuffer.emplace_back(countCells); |
| 702 | maskSizesSendBuffer.emplace_back(countMask); |
| 703 | } |
| 704 | |
| 705 | // Make sure that we're starting the partition on a full byte |
| 706 | int byteAlignedSize = ::GetNumberOfBytes(descriptorSizeCum) * 8; |
| 707 | descriptorSendBuffer->Resize( |
| 708 | descriptorSendBuffer->GetNumberOfTuples() + (byteAlignedSize - descriptorSizeCum)); |
| 709 | |
| 710 | this->NbDescriptorsBytesPerPart[part] = byteAlignedSize / 8; |
| 711 | if (part > 0) |
| 712 | { |
| 713 | descriptorsByteOffsets[part] = |
| 714 | descriptorsByteOffsets[part - 1] + this->NbDescriptorsBytesPerPart[part - 1]; |
| 715 | } |
| 716 | |
| 717 | this->NbTreesSentPerPart[part] = static_cast<int>(this->TreesToSend[part].size()); |
| 718 | if (part > 0) |
| 719 | { |
| 720 | treeTargetPartId[part] = treeTargetPartId[part - 1] + this->NbTreesSentPerPart[part - 1]; |
no test coverage detected