10 #ifndef vtkm_filter_flow_internal_LagrangianStructureHelpers_h
11 #define vtkm_filter_flow_internal_LagrangianStructureHelpers_h
36 T a = j1[0] * j1[0] + j1[1] * j1[1];
37 T b = j1[0] * j2[0] + j1[1] * j2[1];
39 T d = j2[0] * j2[0] + j2[1] * j2[1];
57 T a = j1[0] * j1[0] + j1[1] * j1[1] + j1[2] * j1[2];
58 T b = j1[0] * j2[0] + j1[1] * j2[1] + j1[2] * j2[2];
59 T c = j1[0] * j3[0] + j1[1] * j3[1] + j1[2] * j3[2];
61 T d = j2[0] * j2[0] + j2[1] * j2[1] + j2[2] * j2[2];
62 T e = j2[0] * j3[0] + j2[1] * j3[1] + j2[2] * j3[2];
64 T f = j3[0] * j3[0] + j3[1] * j3[1] + j3[2] * j3[2];
81 T a = j1[0] * j1[0] + j2[0] * j2[0];
82 T b = j1[0] * j1[1] + j2[0] * j2[1];
84 T d = j1[1] * j1[1] + j2[1] * j2[1];
102 T a = j1[0] * j1[0] + j2[0] * j2[0] + j3[0] * j3[0];
103 T b = j1[0] * j1[1] + j2[0] * j2[1] + j3[0] * j3[1];
104 T c = j1[0] * j1[2] + j2[0] * j2[2] + j3[0] * j3[2];
106 T d = j1[1] * j1[1] + j2[1] * j2[1] + j3[1] * j3[1];
107 T e = j1[1] * j1[2] + j2[1] * j2[2] + j3[1] * j3[2];
109 T f = j1[2] * j1[2] + j2[2] * j2[2] + j3[2] * j3[2];
116 template <
typename T>
129 T trace = (a + c) / 2.0f;
130 T det = a * c - b * b;
134 eigen[0] = trace + sqrtr;
135 eigen[1] = trace - sqrtr;
138 template <
typename T>
156 T x = (a + d + f) / 3.0f;
163 T q = (a * d * f + b * e * c + c * b * e - c * d * c - e * e * a - f * b * b) / 2.0f;
164 T r = (a * a + b * b + c * c + b * b + d * d + e * e + c * c + e * e + f * f) / 6.0f;
166 T D = (r * r * r - q * q);
169 if (D < vtkm::Epsilon<T>())
176 phi +=
static_cast<T
>(vtkm::Pi());
182 T sinphi = 0.0f, cosphi = 0.0f;
186 T w0 = x + 2.0f * sqrtr * cosphi;
187 T w1 = x - sqrtr * (cosphi - sqrt3 * sinphi);
188 T w2 = x - sqrtr * (cosphi + sqrt3 * sinphi);
208 #endif //vtkm_filter_flow_internal_LagrangianStructureHelpers_h