------------------------------------------------------------------------------
| 840 | |
| 841 | //------------------------------------------------------------------------------ |
| 842 | void vtkHyperTreeGridRedistribute::ExchangeMask( |
| 843 | std::vector<int>& maskSizesSendBuffer, std::vector<int>& maskSizesReceivedBuffer) |
| 844 | { |
| 845 | // Collect number of mask values sent |
| 846 | std::vector<int> maskSendBytesPerPart(this->NumPartitions, 0); |
| 847 | std::vector<int> maskSendOffsetsPerPart(this->NumPartitions); |
| 848 | for (int part = 0, count = 0; part < this->NumPartitions; part++) |
| 849 | { |
| 850 | for (int id = 0; id < this->NbTreesSentPerPart[part]; id++) |
| 851 | { |
| 852 | maskSendBytesPerPart[part] += maskSizesSendBuffer[count++]; |
| 853 | } |
| 854 | // Count in bytes |
| 855 | maskSendBytesPerPart[part] = ::GetNumberOfBytes(maskSendBytesPerPart[part]); |
| 856 | |
| 857 | if (part > 0) |
| 858 | { |
| 859 | maskSendOffsetsPerPart[part] = |
| 860 | maskSendBytesPerPart[part - 1] + maskSendOffsetsPerPart[part - 1]; |
| 861 | } |
| 862 | } |
| 863 | |
| 864 | // Collect number of mask values to be received |
| 865 | std::vector<int> maskRecvBytesPerPart(this->NumPartitions); |
| 866 | std::vector<int> maskRecvOffsetsPerPart(this->NumPartitions); |
| 867 | for (int part = 0, count = 0; part < this->NumPartitions; part++) |
| 868 | { |
| 869 | for (int id = 0; id < this->NbTreesReceivedPerPart[part]; id++) |
| 870 | { |
| 871 | maskRecvBytesPerPart[part] += maskSizesReceivedBuffer[count++]; |
| 872 | } |
| 873 | |
| 874 | maskRecvBytesPerPart[part] = ::GetNumberOfBytes(maskRecvBytesPerPart[part]); |
| 875 | |
| 876 | if (part > 0) |
| 877 | { |
| 878 | maskRecvOffsetsPerPart[part] = |
| 879 | maskRecvOffsetsPerPart[part - 1] + maskRecvBytesPerPart[part - 1]; |
| 880 | } |
| 881 | } |
| 882 | int totalNbMaskBytesReceived = |
| 883 | std::accumulate(maskRecvBytesPerPart.begin(), maskRecvBytesPerPart.end(), 0); |
| 884 | |
| 885 | // Collect mask values |
| 886 | vtkNew<vtkBitArray> maskSendBuffer; |
| 887 | int sendMaskOffsetBits = 0; |
| 888 | vtkNew<vtkHyperTreeGridNonOrientedCursor> maskCursor; |
| 889 | for (int part = 0; part < this->NumPartitions; part++) |
| 890 | { |
| 891 | for (size_t id = 0; id < this->TreesToSend[part].size(); id++) |
| 892 | { |
| 893 | this->InputHTG->InitializeNonOrientedCursor(maskCursor, this->TreesToSend[part][id]); |
| 894 | ::CollectMask(maskCursor, maskSendBuffer, sendMaskOffsetBits); |
| 895 | } |
| 896 | |
| 897 | // Add padding to finish on a full byte |
| 898 | sendMaskOffsetBits = ::GetNumberOfBytes(sendMaskOffsetBits) * 8; |
| 899 | } |
no test coverage detected