| 2881 | //---------------------------------------------------------------------------- |
| 2882 | template <class PointSetT> |
| 2883 | ::LinkMap ComputeLinkMapForUnstructuredData( |
| 2884 | const diy::Master& master, std::vector<PointSetT*>& inputs, int outputGhostLevels) |
| 2885 | { |
| 2886 | using BlockType = typename ::DataSetTypeToBlockTypeConverter<PointSetT>::BlockType; |
| 2887 | using BlockStructureType = typename BlockType::BlockStructureType; |
| 2888 | using BlockInformationType = typename BlockType::InformationType; |
| 2889 | |
| 2890 | using Dispatcher = vtkArrayDispatch::Dispatch; |
| 2891 | |
| 2892 | ::LinkMap linkMap(inputs.size()); |
| 2893 | |
| 2894 | // For each local point id to be sent to connected blocks, this multimap |
| 2895 | // stores which block id this point is to be sent to, as well as its position in the buffer being |
| 2896 | // sent to its corresponding block. |
| 2897 | std::vector<std::multimap<vtkIdType, std::pair<int, vtkIdType>>> |
| 2898 | localPointIdsToSendBufferMultimaps(inputs.size()); |
| 2899 | |
| 2900 | for (int localId = 0; localId < static_cast<int>(inputs.size()); ++localId) |
| 2901 | { |
| 2902 | BlockType* block = master.block<BlockType>(localId); |
| 2903 | ::BlockMapType<BlockStructureType>& blockStructures = block->BlockStructures; |
| 2904 | BlockInformationType& info = block->Information; |
| 2905 | |
| 2906 | if (!info.InterfacePoints) |
| 2907 | { |
| 2908 | blockStructures.clear(); |
| 2909 | continue; |
| 2910 | } |
| 2911 | |
| 2912 | vtkIdTypeArray* globalPointIds = info.InterfaceGlobalPointIds; |
| 2913 | ::Links& localLinks = linkMap[localId]; |
| 2914 | |
| 2915 | ::MatchingPointExtractor matchingPointExtractor(info.InterfacePointIds, |
| 2916 | vtkPointSet::SafeDownCast(info.InterfaceExtractor->GetOutputDataObject(0)), |
| 2917 | info.InterfacePoints, globalPointIds, info.InputToOutputPointIdRedirectionMap); |
| 2918 | |
| 2919 | for (auto it = blockStructures.begin(); it != blockStructures.end();) |
| 2920 | { |
| 2921 | BlockStructureType& blockStructure = it->second; |
| 2922 | vtkIdList* matchingReceivedPointIds = blockStructure.MatchingReceivedPointIds; |
| 2923 | matchingPointExtractor.MatchingSourcePointIds = matchingReceivedPointIds; |
| 2924 | matchingPointExtractor.RemappedMatchingReceivedPointIdsSortedLikeTarget = |
| 2925 | blockStructure.RemappedMatchingReceivedPointIdsSortedLikeTarget; |
| 2926 | vtkDataArray* interfacingPointsArray = blockStructure.InterfacingPoints->GetData(); |
| 2927 | vtkIdTypeArray* interfacingGlobalPointIds = blockStructure.InterfacingGlobalPointIds; |
| 2928 | |
| 2929 | if ((interfacingGlobalPointIds == nullptr) != |
| 2930 | matchingPointExtractor.SourceGlobalPointIds.empty()) |
| 2931 | { |
| 2932 | vtkLog(ERROR, |
| 2933 | "Inconsistency in the presence of global point ids across partitions. " |
| 2934 | "The pipeline will fail at generating ghost cells"); |
| 2935 | return LinkMap(); |
| 2936 | } |
| 2937 | |
| 2938 | if (!Dispatcher::Execute( |
| 2939 | interfacingPointsArray, matchingPointExtractor, interfacingGlobalPointIds)) |
| 2940 | { |
no test coverage detected