------------------------------------------------------------------------------ Evaluate gradient of sum of functions (valid only if linear)
| 127 | //------------------------------------------------------------------------------ |
| 128 | // Evaluate gradient of sum of functions (valid only if linear) |
| 129 | void 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 | //------------------------------------------------------------------------------ |
| 161 | void vtkImplicitSum::PrintSelf(ostream& os, vtkIndent indent) |
nothing calls this directly
no test coverage detected