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

Method EvaluateGradient

Common/DataModel/vtkImplicitSum.cxx:129–158  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Evaluate gradient of sum of functions (valid only if linear)

Source from the content-addressed store, hash-verified

127//------------------------------------------------------------------------------
128// Evaluate gradient of sum of functions (valid only if linear)
129void vtkImplicitSum::EvaluateGradient(double x[3], double g[3])
130{
131 double c;
132 int i;
133 double gtmp[3];
134 vtkImplicitFunction* f;
135 double* weights = this->Weights->GetPointer(0);
136
137 g[0] = g[1] = g[2] = 0.0;
138 vtkCollectionSimpleIterator sit;
139 for (i = 0, this->FunctionList->InitTraversal(sit);
140 (f = this->FunctionList->GetNextImplicitFunction(sit)); i++)
141 {
142 c = weights[i];
143 if (c != 0.0)
144 {
145 f->FunctionGradient(x, gtmp);
146 g[0] += gtmp[0] * c;
147 g[1] += gtmp[1] * c;
148 g[2] += gtmp[2] * c;
149 }
150 }
151
152 if (this->NormalizeByWeight && this->TotalWeight != 0.0)
153 {
154 g[0] /= this->TotalWeight;
155 g[1] /= this->TotalWeight;
156 g[2] /= this->TotalWeight;
157 }
158}
159
160//------------------------------------------------------------------------------
161void vtkImplicitSum::PrintSelf(ostream& os, vtkIndent indent)

Callers

nothing calls this directly

Calls 3

FunctionGradientMethod · 0.80
GetPointerMethod · 0.45
InitTraversalMethod · 0.45

Tested by

no test coverage detected