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

Method EvaluateFunction

Common/DataModel/vtkImplicitVolume.cxx:46–78  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Evaluate the ImplicitVolume. This returns the interpolated scalar value at x[3].

Source from the content-addressed store, hash-verified

44// Evaluate the ImplicitVolume. This returns the interpolated scalar value
45// at x[3].
46double vtkImplicitVolume::EvaluateFunction(double x[3])
47{
48 vtkDataArray* scalars;
49 int ijk[3];
50 vtkIdType numPts, i;
51 double pcoords[3], weights[8], s;
52
53 // See if a volume is defined
54 if (!this->Volume || !(scalars = this->Volume->GetPointData()->GetScalars()))
55 {
56 vtkErrorMacro(
57 << "Can't evaluate function: either volume is missing or volume has no point data");
58 return this->OutValue;
59 }
60
61 // Find the cell that contains xyz and get it
62 if (this->Volume->ComputeStructuredCoordinates(x, ijk, pcoords))
63 {
64 this->Volume->GetCellPoints(this->Volume->ComputeCellId(ijk), this->PointIds);
65 vtkVoxel::InterpolationFunctions(pcoords, weights);
66
67 numPts = this->PointIds->GetNumberOfIds();
68 for (s = 0.0, i = 0; i < numPts; i++)
69 {
70 s += scalars->GetComponent(this->PointIds->GetId(i), 0) * weights[i];
71 }
72 return s;
73 }
74 else
75 {
76 return this->OutValue;
77 }
78}
79
80//------------------------------------------------------------------------------
81vtkMTimeType vtkImplicitVolume::GetMTime()

Callers

nothing calls this directly

Calls 8

GetScalarsMethod · 0.45
GetPointDataMethod · 0.45
GetCellPointsMethod · 0.45
ComputeCellIdMethod · 0.45
GetNumberOfIdsMethod · 0.45
GetComponentMethod · 0.45
GetIdMethod · 0.45

Tested by

no test coverage detected