11 #ifndef PANZER_CONVERT_NORMAL_TO_ROTATION_MATRIX_HPP
12 #define PANZER_CONVERT_NORMAL_TO_ROTATION_MATRIX_HPP
16 template <
typename Scalar>
17 KOKKOS_INLINE_FUNCTION
23 const T n = sqrt(normal[0]*normal[0]+normal[1]*normal[1]+normal[2]*normal[2]);
28 transverse[0]=0.;transverse[1]=1.;transverse[2]=0.;
29 if(Kokkos::fabs(normal[0]*transverse[0]+normal[1]*transverse[1])>0.9){
30 transverse[0]=1.;transverse[1]=0.;
33 const T nt = normal[0]*transverse[0]+normal[1]*transverse[1]+normal[2]*transverse[2];
36 const T mult = nt/(n*n);
39 for(
int dim=0;dim<3;++dim){
40 transverse[dim] = transverse[dim] - mult * normal[dim];
43 const T t = sqrt(transverse[0]*transverse[0]+transverse[1]*transverse[1]+transverse[2]*transverse[2]);
44 KOKKOS_ASSERT(t != 0.);
45 for(
int dim=0;dim<3;++dim){
50 binormal[0] = (normal[1] * transverse[2] - normal[2] * transverse[1]);
51 binormal[1] = (normal[2] * transverse[0] - normal[0] * transverse[2]);
52 binormal[2] = (normal[0] * transverse[1] - normal[1] * transverse[0]);
55 const T b = sqrt(binormal[0]*binormal[0]+binormal[1]*binormal[1]+binormal[2]*binormal[2]);
56 for(
int dim=0;dim<3;++dim){
KOKKOS_INLINE_FUNCTION void convertNormalToRotationMatrix(const Scalar normal[3], Scalar transverse[3], Scalar binormal[3])