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

Method EvaluateFunction

Common/DataModel/vtkImplicitDataSet.cxx:41–82  ·  view source on GitHub ↗

Evaluate the implicit function. This returns the interpolated scalar value at x[3].

Source from the content-addressed store, hash-verified

39// Evaluate the implicit function. This returns the interpolated scalar value
40// at x[3].
41double 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
84vtkMTimeType vtkImplicitDataSet::GetMTime()
85{

Callers

nothing calls this directly

Calls 7

GetScalarsMethod · 0.45
GetPointDataMethod · 0.45
GetMaxCellSizeMethod · 0.45
FindAndGetCellMethod · 0.45
GetNumberOfPointsMethod · 0.45
GetIdMethod · 0.45
GetComponentMethod · 0.45

Tested by

no test coverage detected