Evaluate the implicit function. This returns the interpolated scalar value at x[3].
| 39 | // Evaluate the implicit function. This returns the interpolated scalar value |
| 40 | // at x[3]. |
| 41 | double vtkImplicitDataSet::EvaluateFunction(double x[3]) |
| 42 | { |
| 43 | vtkDataArray* scalars; |
| 44 | vtkCell* cell; |
| 45 | vtkIdType id; |
| 46 | int subId, i, numPts; |
| 47 | double pcoords[3], s; |
| 48 | |
| 49 | // See if a dataset has been specified |
| 50 | if (!this->DataSet || !(scalars = this->DataSet->GetPointData()->GetScalars())) |
| 51 | { |
| 52 | vtkErrorMacro( |
| 53 | << "Can't evaluate function: either data set is missing or data set has no point data"); |
| 54 | return this->OutValue; |
| 55 | } |
| 56 | |
| 57 | if (this->DataSet->GetMaxCellSize() > this->Size) |
| 58 | { |
| 59 | delete[] this->Weights; |
| 60 | this->Weights = new double[this->DataSet->GetMaxCellSize()]; |
| 61 | this->Size = this->DataSet->GetMaxCellSize(); |
| 62 | } |
| 63 | |
| 64 | // Find the cell that contains xyz and get it |
| 65 | cell = |
| 66 | this->DataSet->FindAndGetCell(x, nullptr, -1, VTK_DBL_EPSILON, subId, pcoords, this->Weights); |
| 67 | |
| 68 | if (cell) |
| 69 | { // Interpolate the point data |
| 70 | numPts = cell->GetNumberOfPoints(); |
| 71 | for (s = 0.0, i = 0; i < numPts; i++) |
| 72 | { |
| 73 | id = cell->PointIds->GetId(i); |
| 74 | s += scalars->GetComponent(id, 0) * this->Weights[i]; |
| 75 | } |
| 76 | return s; |
| 77 | } |
| 78 | else |
| 79 | { // use outside value |
| 80 | return this->OutValue; |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | vtkMTimeType vtkImplicitDataSet::GetMTime() |
| 85 | { |
nothing calls this directly
no test coverage detected