------------------------------------------------------------------------------
| 58 | |
| 59 | //------------------------------------------------------------------------------ |
| 60 | vtkPoints* vtkStructuredGridPartitioner::ExtractSubGridPoints( |
| 61 | vtkStructuredGrid* wholeGrid, int subext[6]) |
| 62 | { |
| 63 | assert("pre: whole grid is nullptr" && (wholeGrid != nullptr)); |
| 64 | |
| 65 | int numNodes = vtkStructuredData::GetNumberOfPoints(subext); |
| 66 | vtkPoints* pnts = vtkPoints::New(); |
| 67 | pnts->SetDataTypeToDouble(); |
| 68 | pnts->SetNumberOfPoints(numNodes); |
| 69 | |
| 70 | int ijk[3]; |
| 71 | double p[3]; |
| 72 | int dataDescription = vtkStructuredData::GetDataDescriptionFromExtent(subext); |
| 73 | for (int i = subext[0]; i <= subext[1]; ++i) |
| 74 | { |
| 75 | for (int j = subext[2]; j <= subext[3]; ++j) |
| 76 | { |
| 77 | for (int k = subext[4]; k <= subext[5]; ++k) |
| 78 | { |
| 79 | wholeGrid->GetPoint(i, j, k, p, false); |
| 80 | |
| 81 | ijk[0] = i; |
| 82 | ijk[1] = j; |
| 83 | ijk[2] = k; |
| 84 | vtkIdType pntIdx = vtkStructuredData::ComputePointIdForExtent(subext, ijk, dataDescription); |
| 85 | assert("pre: point index is out-of-bounds!" && (pntIdx >= 0) && (pntIdx < numNodes)); |
| 86 | pnts->SetPoint(pntIdx, p); |
| 87 | } // END for all k |
| 88 | } // END for all j |
| 89 | } // END for all i |
| 90 | return (pnts); |
| 91 | } |
| 92 | |
| 93 | //------------------------------------------------------------------------------ |
| 94 | int vtkStructuredGridPartitioner::RequestData(vtkInformation* vtkNotUsed(request), |
no test coverage detected