Interpolate the data
| 50 | |
| 51 | // Interpolate the data |
| 52 | int vtkInterpolateDataSetAttributes::RequestData(vtkInformation* vtkNotUsed(request), |
| 53 | vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 54 | { |
| 55 | // get the info object |
| 56 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 57 | |
| 58 | // get the output |
| 59 | vtkDataSet* output = vtkDataSet::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 60 | |
| 61 | vtkIdType numPts, numCells, i; |
| 62 | int numInputs = this->GetNumberOfInputConnections(0); |
| 63 | int lowDS, highDS; |
| 64 | vtkDataSet *ds, *ds2; |
| 65 | vtkPointData* outputPD = output->GetPointData(); |
| 66 | vtkCellData* outputCD = output->GetCellData(); |
| 67 | vtkPointData *inputPD, *input2PD; |
| 68 | vtkCellData *inputCD, *input2CD; |
| 69 | double t; |
| 70 | |
| 71 | if (numInputs < 2) |
| 72 | { |
| 73 | vtkErrorMacro(<< "Need at least two inputs to interpolate!"); |
| 74 | return 1; |
| 75 | } |
| 76 | |
| 77 | vtkDebugMacro(<< "Interpolating data..."); |
| 78 | |
| 79 | // Check input and determine between which data sets the interpolation |
| 80 | // is to occur. |
| 81 | if (this->T > static_cast<double>(numInputs)) |
| 82 | { |
| 83 | vtkErrorMacro(<< "Bad interpolation parameter"); |
| 84 | return 1; |
| 85 | } |
| 86 | |
| 87 | lowDS = static_cast<int>(this->T); |
| 88 | if (lowDS >= (numInputs - 1)) |
| 89 | { |
| 90 | lowDS = numInputs - 2; |
| 91 | } |
| 92 | |
| 93 | highDS = lowDS + 1; |
| 94 | t = this->T - static_cast<double>(lowDS); |
| 95 | t = std::min(t, 1.0); |
| 96 | |
| 97 | vtkInformation* dsInfo = inputVector[0]->GetInformationObject(lowDS); |
| 98 | vtkInformation* ds2Info = inputVector[0]->GetInformationObject(highDS); |
| 99 | ds = vtkDataSet::SafeDownCast(dsInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 100 | ds2 = vtkDataSet::SafeDownCast(ds2Info->Get(vtkDataObject::DATA_OBJECT())); |
| 101 | |
| 102 | numPts = ds->GetNumberOfPoints(); |
| 103 | numCells = ds->GetNumberOfCells(); |
| 104 | |
| 105 | if (numPts != ds2->GetNumberOfPoints() || numCells != ds2->GetNumberOfCells()) |
| 106 | { |
| 107 | vtkErrorMacro(<< "Data sets not consistent!"); |
| 108 | return 1; |
| 109 | } |
nothing calls this directly
no test coverage detected