------------------------------------------------------------------------------
| 50 | |
| 51 | //------------------------------------------------------------------------------ |
| 52 | void vtkLagrangeTriangle::InterpolateFunctions(const double pcoords[3], double* weights) |
| 53 | { |
| 54 | // Adapted from P. Silvester, "High-Order Polynomial Triangular Finite |
| 55 | // Elements for Potential Problems". Int. J. Engng Sci. Vol. 7, pp. 849-861. |
| 56 | // Pergamon Press, 1969. The generic method is valid for all orders, but we |
| 57 | // unroll the first two orders to reduce computational cost. |
| 58 | |
| 59 | double tau[3] = { pcoords[0], pcoords[1], 1. - pcoords[0] - pcoords[1] }; |
| 60 | |
| 61 | vtkIdType n = this->GetOrder(); |
| 62 | |
| 63 | if (n == 1) |
| 64 | { |
| 65 | // for the linear case, we simply return the parametric coordinates, rotated |
| 66 | // into the parametric frame (e.g. barycentric tau_2 = parametric x). |
| 67 | weights[0] = tau[2]; |
| 68 | weights[1] = tau[0]; |
| 69 | weights[2] = tau[1]; |
| 70 | } |
| 71 | else if (n == 2) |
| 72 | { |
| 73 | #ifdef SEVEN_POINT_TRIANGLE |
| 74 | if (this->GetPoints()->GetNumberOfPoints() == 7) |
| 75 | { |
| 76 | double rs = tau[0] * tau[1]; |
| 77 | double rt = tau[0] * tau[2]; |
| 78 | double st = tau[1] * tau[2]; |
| 79 | double rst = rs * tau[2]; |
| 80 | weights[0] = tau[2] + 3.0 * rst - 2.0 * rt - 2.0 * st; |
| 81 | weights[1] = tau[0] + 3.0 * rst - 2.0 * rt - 2.0 * rs; |
| 82 | weights[2] = tau[1] + 3.0 * rst - 2.0 * rs - 2.0 * st; |
| 83 | weights[3] = 4.0 * rt - 12.0 * rst; |
| 84 | weights[4] = 4.0 * rs - 12.0 * rst; |
| 85 | weights[5] = 4.0 * st - 12.0 * rst; |
| 86 | weights[6] = 27.0 * rst; |
| 87 | return; |
| 88 | } |
| 89 | #endif |
| 90 | weights[0] = tau[2] * (2.0 * tau[2] - 1.0); |
| 91 | weights[1] = tau[0] * (2.0 * tau[0] - 1.0); |
| 92 | weights[2] = tau[1] * (2.0 * tau[1] - 1.0); |
| 93 | weights[3] = 4.0 * tau[0] * tau[2]; |
| 94 | weights[4] = 4.0 * tau[0] * tau[1]; |
| 95 | weights[5] = 4.0 * tau[1] * tau[2]; |
| 96 | } |
| 97 | else |
| 98 | { |
| 99 | vtkIdType nPoints = this->GetPoints()->GetNumberOfPoints(); |
| 100 | |
| 101 | for (vtkIdType idx = 0; idx < nPoints; idx++) |
| 102 | { |
| 103 | weights[idx] = 1.; |
| 104 | vtkIdType lambda[3]; |
| 105 | this->ToBarycentricIndex(idx, lambda); |
| 106 | |
| 107 | for (vtkIdType dim = 0; dim < 3; dim++) |
| 108 | { |
| 109 | weights[idx] *= Eta(n, lambda[dim], tau[dim]); |
nothing calls this directly
no test coverage detected