Send input points that overlap remote's source bounds
| 698 | |
| 699 | // Send input points that overlap remote's source bounds |
| 700 | void FindPointsToSend(DiyBlock* block, const diy::Master::ProxyWithLink& cp) |
| 701 | { |
| 702 | diy::Link* link = cp.link(); |
| 703 | for (int l = 0; l < link->size(); ++l) |
| 704 | { |
| 705 | diy::BlockID neighbor = link->target(l); |
| 706 | PointsList points; |
| 707 | |
| 708 | vtkBoundingBox fullBounds; |
| 709 | std::vector<double>& boundsArray = block->SourceBlocksBounds[neighbor.proc]; |
| 710 | for (size_t next = 0; next < boundsArray.size(); next += 6) |
| 711 | { |
| 712 | double* sbounds = &boundsArray[next]; |
| 713 | block->PointsLookup->FindPointsInBounds(sbounds, points.Explicit); |
| 714 | fullBounds.AddBounds(sbounds); |
| 715 | } |
| 716 | // group the points by BlockId |
| 717 | std::sort(points.Explicit.begin(), points.Explicit.end(), ComparePointsByBlockId); |
| 718 | |
| 719 | for (size_t i = 0; i < block->InputBlocks.size(); ++i) |
| 720 | { |
| 721 | vtkImageData* img = vtkImageData::SafeDownCast(block->InputBlocks[i]); |
| 722 | if (img) |
| 723 | { |
| 724 | vtkBoundingBox imgBounds(img->GetBounds()); |
| 725 | if (imgBounds.IntersectBox(fullBounds)) |
| 726 | { |
| 727 | int* inExtents = img->GetExtent(); |
| 728 | double* inOrigin = img->GetOrigin(); |
| 729 | double* inSpacing = img->GetSpacing(); |
| 730 | |
| 731 | double sendBounds[6]; |
| 732 | imgBounds.GetBounds(sendBounds); |
| 733 | int sendExtents[6]; |
| 734 | ComputeExtentsForBounds(inOrigin, inSpacing, inExtents, sendBounds, sendExtents); |
| 735 | |
| 736 | ImplicitPoints pts; |
| 737 | std::copy(sendExtents, sendExtents + 6, pts.Extents); |
| 738 | std::copy(inOrigin, inOrigin + 3, pts.Origin); |
| 739 | std::copy(inSpacing, inSpacing + 3, pts.Spacing); |
| 740 | for (int j = 0; j < 3; ++j) |
| 741 | { |
| 742 | pts.BlockStart[j] = inExtents[2 * j]; |
| 743 | pts.BlockDim[j] = inExtents[2 * j + 1] - inExtents[2 * j] + 1; |
| 744 | } |
| 745 | pts.BlockId = static_cast<int>(i); |
| 746 | points.Implicit.push_back(pts); |
| 747 | } |
| 748 | } |
| 749 | } |
| 750 | |
| 751 | cp.enqueue(neighbor, points); |
| 752 | } |
| 753 | } |
| 754 | |
| 755 | class EnqueueDataArray |
| 756 | { |
nothing calls this directly
no test coverage detected