------------------------------------------------------------------------------
| 180 | |
| 181 | //------------------------------------------------------------------------------ |
| 182 | int vtkExtractVectorComponents::RequestData(vtkInformation* vtkNotUsed(request), |
| 183 | vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 184 | { |
| 185 | // get the info objects |
| 186 | vtkInformation* inInfo = inputVector[0]->GetInformationObject(0); |
| 187 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 188 | |
| 189 | // get the input and output |
| 190 | vtkDataSet* input = vtkDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 191 | vtkDataSet* output = vtkDataSet::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 192 | |
| 193 | vtkIdType numVectors = 0, numVectorsc = 0; |
| 194 | vtkDataArray *vectors, *vectorsc; |
| 195 | vtkDataArray *vx, *vy, *vz; |
| 196 | vtkDataArray *vxc, *vyc, *vzc; |
| 197 | vtkPointData *pd, *outVx, *outVy = nullptr, *outVz = nullptr; |
| 198 | vtkCellData *cd, *outVxc, *outVyc = nullptr, *outVzc = nullptr; |
| 199 | |
| 200 | vtkDebugMacro(<< "Extracting vector components..."); |
| 201 | |
| 202 | // taken out of previous update method. |
| 203 | output->CopyStructure(input); |
| 204 | if (!this->ExtractToFieldData) |
| 205 | { |
| 206 | this->GetVyComponent()->CopyStructure(input); |
| 207 | this->GetVzComponent()->CopyStructure(input); |
| 208 | } |
| 209 | |
| 210 | pd = input->GetPointData(); |
| 211 | cd = input->GetCellData(); |
| 212 | outVx = output->GetPointData(); |
| 213 | outVxc = output->GetCellData(); |
| 214 | if (!this->ExtractToFieldData) |
| 215 | { |
| 216 | outVy = this->GetVyComponent()->GetPointData(); |
| 217 | outVz = this->GetVzComponent()->GetPointData(); |
| 218 | outVyc = this->GetVyComponent()->GetCellData(); |
| 219 | outVzc = this->GetVzComponent()->GetCellData(); |
| 220 | } |
| 221 | |
| 222 | vectors = pd->GetVectors(); |
| 223 | vectorsc = cd->GetVectors(); |
| 224 | if ((vectors == nullptr || ((numVectors = vectors->GetNumberOfTuples()) < 1)) && |
| 225 | (vectorsc == nullptr || ((numVectorsc = vectorsc->GetNumberOfTuples()) < 1))) |
| 226 | { |
| 227 | vtkErrorMacro(<< "No vector data to extract!"); |
| 228 | return 1; |
| 229 | } |
| 230 | |
| 231 | const char* name = nullptr; |
| 232 | if (vectors && vectors->GetName()) |
| 233 | { |
| 234 | name = vectors->GetName(); |
| 235 | } |
| 236 | else if (vectorsc && vectorsc->GetName()) |
| 237 | { |
| 238 | name = vectorsc->GetName(); |
| 239 | } |
nothing calls this directly
no test coverage detected