MCPcopy Create free account
hub / github.com/Kitware/VTK / ExtractSubGridPoints

Method ExtractSubGridPoints

Filters/Geometry/vtkStructuredGridPartitioner.cxx:60–91  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

58
59//------------------------------------------------------------------------------
60vtkPoints* 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//------------------------------------------------------------------------------
94int vtkStructuredGridPartitioner::RequestData(vtkInformation* vtkNotUsed(request),

Callers 1

RequestDataMethod · 0.95

Calls 6

assertFunction · 0.50
GetNumberOfPointsFunction · 0.50
NewFunction · 0.50
SetNumberOfPointsMethod · 0.45
GetPointMethod · 0.45
SetPointMethod · 0.45

Tested by

no test coverage detected