------------------------------------------------------------------------------
| 160 | |
| 161 | //------------------------------------------------------------------------------ |
| 162 | bool 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 | |
| 210 | void vtkExtractGrid::PrintSelf(ostream& os, vtkIndent indent) |
| 211 | { |
no test coverage detected