------------------------------------------------------------------------------
| 755 | |
| 756 | //------------------------------------------------------------------------------ |
| 757 | void vtkDataSet::GenerateGhostArray(int zeroExt[6], bool cellOnly) |
| 758 | { |
| 759 | // Make sure this is a structured data set. |
| 760 | if (this->GetExtentType() != VTK_3D_EXTENT) |
| 761 | { |
| 762 | return; |
| 763 | } |
| 764 | |
| 765 | int extent[6]; |
| 766 | this->Information->Get(vtkDataObject::DATA_EXTENT(), extent); |
| 767 | |
| 768 | int i, j, k, di, dj, dk, dist; |
| 769 | |
| 770 | bool sameExtent = true; |
| 771 | for (i = 0; i < 6; i++) |
| 772 | { |
| 773 | if (extent[i] != zeroExt[i]) |
| 774 | { |
| 775 | sameExtent = false; |
| 776 | break; |
| 777 | } |
| 778 | } |
| 779 | if (sameExtent) |
| 780 | { |
| 781 | return; |
| 782 | } |
| 783 | |
| 784 | vtkIdType index = 0; |
| 785 | |
| 786 | // ---- POINTS ---- |
| 787 | |
| 788 | if (!cellOnly) |
| 789 | { |
| 790 | vtkSmartPointer<vtkUnsignedCharArray> ghostPoints = vtkArrayDownCast<vtkUnsignedCharArray>( |
| 791 | this->PointData->GetArray(vtkDataSetAttributes::GhostArrayName())); |
| 792 | if (!ghostPoints) |
| 793 | { |
| 794 | ghostPoints.TakeReference(vtkUnsignedCharArray::New()); |
| 795 | ghostPoints->SetName(vtkDataSetAttributes::GhostArrayName()); |
| 796 | ghostPoints->SetNumberOfValues(vtkStructuredData::GetNumberOfPoints(extent)); |
| 797 | ghostPoints->FillValue(0); |
| 798 | this->PointData->AddArray(ghostPoints); |
| 799 | } |
| 800 | |
| 801 | // Loop through the points in this image. |
| 802 | for (k = extent[4]; k <= extent[5]; ++k) |
| 803 | { |
| 804 | dk = 0; |
| 805 | if (k < zeroExt[4]) |
| 806 | { |
| 807 | dk = zeroExt[4] - k; |
| 808 | } |
| 809 | if (k > zeroExt[5]) |
| 810 | { // Special case for last tile. |
| 811 | dk = k - zeroExt[5] + 1; |
| 812 | } |
| 813 | for (j = extent[2]; j <= extent[3]; ++j) |
| 814 | { |
no test coverage detected