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

Method RequestDataImpl

Filters/Extraction/vtkExtractGrid.cxx:162–208  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

160
161//------------------------------------------------------------------------------
162bool vtkExtractGrid::RequestDataImpl(
163 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
164{
165 if ((this->SampleRate[0] < 1) || (this->SampleRate[1] < 1) || (this->SampleRate[2] < 1))
166 {
167 vtkErrorMacro("SampleRate must be >= 1 in all 3 dimensions!");
168 return false;
169 }
170
171 // get the info objects
172 vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
173 vtkInformation* outInfo = outputVector->GetInformationObject(0);
174
175 // get the input and output
176 vtkStructuredGrid* input =
177 vtkStructuredGrid::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
178 vtkStructuredGrid* output =
179 vtkStructuredGrid::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
180
181 if (input->GetNumberOfPoints() == 0)
182 {
183 return true;
184 }
185
186 vtkPointData* pd = input->GetPointData();
187 vtkCellData* cd = input->GetCellData();
188 vtkPointData* outPD = output->GetPointData();
189 vtkCellData* outCD = output->GetCellData();
190
191 vtkPoints* inPts = input->GetPoints();
192 int* inExt = input->GetExtent();
193
194 vtkPoints* newPts = inPts->NewInstance();
195 int* outExt = output->GetExtent();
196
197 vtkDebugMacro(<< "Extracting Grid");
198
199 this->Internal->CopyPointsAndPointData(inExt, outExt, pd, inPts, outPD, newPts);
200 output->SetPoints(newPts);
201 newPts->Delete();
202
203 this->Internal->CopyCellData(inExt, outExt, cd, outCD);
204
205 this->CheckAbort();
206
207 return true;
208}
209
210void vtkExtractGrid::PrintSelf(ostream& os, vtkIndent indent)
211{

Callers 1

RequestDataMethod · 0.95

Calls 13

GetInformationObjectMethod · 0.80
CheckAbortMethod · 0.80
DeleteMethod · 0.65
GetMethod · 0.45
GetNumberOfPointsMethod · 0.45
GetPointDataMethod · 0.45
GetCellDataMethod · 0.45
GetPointsMethod · 0.45
GetExtentMethod · 0.45
NewInstanceMethod · 0.45
SetPointsMethod · 0.45

Tested by

no test coverage detected