43 #if defined(DEBUG) && !defined(NDEBUG) 119 const int n_iter = (k > n-
k) ? n-k : k;
120 for (
int j = 1; j <= n_iter; j++, n--) {
123 else if (ret % j == 0)
270 v[0] = xb[0] - xa[0];
271 v[1] = xb[1] - xa[1];
272 v[2] = xb[2] - xa[2];
274 return sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
294 return ((xb[0] - xa[0])*xc[0]+(xb[1] - xa[1])*xc[1]+(xb[2] - xa[2])*xc[2]);
317 return (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
335 cs_real_t uv = u[0]*v[0] + u[1]*v[1] + u[2]*v[2];
358 = ( n1[0]*t[0][0]*n2[0] + n1[1]*t[1][0]*n2[0] + n1[2]*t[2][0]*n2[0]
359 + n1[0]*t[0][1]*n2[1] + n1[1]*t[1][1]*n2[1] + n1[2]*t[2][1]*n2[1]
360 + n1[0]*t[0][2]*n2[2] + n1[1]*t[1][2]*n2[2] + n1[2]*t[2][2]*n2[2]);
386 = ( n1[0]*t[0]*n2[0] + n1[1]*t[3]*n2[0] + n1[2]*t[5]*n2[0]
387 + n1[0]*t[3]*n2[1] + n1[1]*t[1]*n2[1] + n1[2]*t[4]*n2[1]
388 + n1[0]*t[5]*n2[2] + n1[1]*t[4]*n2[2] + n1[2]*t[2]*n2[2]);
405 return sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
421 cs_real_t v2 = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
445 vout[0] = inv_norm * vin[0];
446 vout[1] = inv_norm * vin[1];
447 vout[2] = inv_norm * vin[2];
469 vout[0] = inv_norm * vin[0];
470 vout[1] = inv_norm * vin[1];
471 vout[2] = inv_norm * vin[2];
490 vout[0] = v[0]*(1.-n[0]*n[0])- v[1]* n[1]*n[0] - v[2]* n[2]*n[0];
491 vout[1] = -v[0]* n[0]*n[1] + v[1]*(1.-n[1]*n[1])- v[2]* n[2]*n[1];
492 vout[2] = -v[0]* n[0]*n[2] - v[1]* n[1]*n[2] + v[2]*(1.-n[2]*n[2]);
512 for (
int i = 0; i < 3; i++)
513 v[i] += v_dot_n * n[i];
534 ( n[0] * t[0][0] * n[0] + n[1] * t[1][0] * n[0] + n[2] * t[2][0] * n[0]
535 + n[0] * t[0][1] * n[1] + n[1] * t[1][1] * n[1] + n[2] * t[2][1] * n[1]
536 + n[0] * t[0][2] * n[2] + n[1] * t[1][2] * n[2] + n[2] * t[2][2] * n[2]);
537 for (
int i = 0; i < 3; i++) {
538 for (
int j = 0; j < 3; j++)
539 t[i][j] += n_t_n * n[i] * n[j];
558 mv[0] = m[0][0]*v[0] + m[0][1]*v[1] + m[0][2]*v[2];
559 mv[1] = m[1][0]*v[0] + m[1][1]*v[1] + m[1][2]*v[2];
560 mv[2] = m[2][0]*v[0] + m[2][1]*v[1] + m[2][2]*v[2];
579 mv[0] += m[0][0]*v[0] + m[0][1]*v[1] + m[0][2]*v[2];
580 mv[1] += m[1][0]*v[0] + m[1][1]*v[1] + m[1][2]*v[2];
581 mv[2] += m[2][0]*v[0] + m[2][1]*v[1] + m[2][2]*v[2];
600 mv[0] = m[0][0]*v[0] + m[1][0]*v[1] + m[2][0]*v[2];
601 mv[1] = m[0][1]*v[0] + m[1][1]*v[1] + m[2][1]*v[2];
602 mv[2] = m[0][2]*v[0] + m[1][2]*v[1] + m[2][2]*v[2];
622 mv[0] = m[0] * v[0] + m[3] * v[1] + m[5] * v[2];
623 mv[1] = m[3] * v[0] + m[1] * v[1] + m[4] * v[2];
624 mv[2] = m[5] * v[0] + m[4] * v[1] + m[2] * v[2];
644 mv[0] += m[0] * v[0] + m[3] * v[1] + m[5] * v[2];
645 mv[1] += m[3] * v[0] + m[1] * v[1] + m[4] * v[2];
646 mv[2] += m[5] * v[0] + m[4] * v[1] + m[2] * v[2];
662 return (t[0] + t[1] + t[2]);
681 for (
int i = 0; i < 6; i++) {
682 for (
int j = 0; j < 6; j++)
683 mv[i] = m[i][j] * v[j];
703 for (
int i = 0; i < 6; i++) {
704 for (
int j = 0; j < 6; j++)
705 mv[i] += m[i][j] * v[j];
722 const cs_real_t com0 = m[1][1]*m[2][2] - m[2][1]*m[1][2];
723 const cs_real_t com1 = m[2][1]*m[0][2] - m[0][1]*m[2][2];
724 const cs_real_t com2 = m[0][1]*m[1][2] - m[1][1]*m[0][2];
726 return m[0][0]*com0 + m[1][0]*com1 + m[2][0]*com2;
742 const cs_real_t com0 = m[1]*m[2] - m[4]*m[4];
743 const cs_real_t com1 = m[4]*m[5] - m[3]*m[2];
744 const cs_real_t com2 = m[3]*m[4] - m[1]*m[5];
746 return m[0]*com0 + m[3]*com1 + m[5]*com2;
759 #if defined(__INTEL_COMPILER) 760 #pragma optimization_level 0 768 uv[0] = u[1]*v[2] - u[2]*v[1];
769 uv[1] = u[2]*v[0] - u[0]*v[2];
770 uv[2] = u[0]*v[1] - u[1]*v[0];
785 #if defined(__INTEL_COMPILER) 786 #pragma optimization_level 0 794 return (u[1]*v[2] - u[2]*v[1]) * w[0]
795 + (u[2]*v[0] - u[0]*v[2]) * w[1]
796 + (u[0]*v[1] - u[1]*v[0]) * w[2];
812 out[0][0] = in[1][1]*in[2][2] - in[2][1]*in[1][2];
813 out[0][1] = in[2][1]*in[0][2] - in[0][1]*in[2][2];
814 out[0][2] = in[0][1]*in[1][2] - in[1][1]*in[0][2];
816 out[1][0] = in[2][0]*in[1][2] - in[1][0]*in[2][2];
817 out[1][1] = in[0][0]*in[2][2] - in[2][0]*in[0][2];
818 out[1][2] = in[1][0]*in[0][2] - in[0][0]*in[1][2];
820 out[2][0] = in[1][0]*in[2][1] - in[2][0]*in[1][1];
821 out[2][1] = in[2][0]*in[0][1] - in[0][0]*in[2][1];
822 out[2][2] = in[0][0]*in[1][1] - in[1][0]*in[0][1];
824 const double det = in[0][0]*out[0][0]+in[1][0]*out[0][1]+in[2][0]*out[0][2];
825 const double invdet = 1./det;
827 out[0][0] *= invdet, out[0][1] *= invdet, out[0][2] *= invdet;
828 out[1][0] *= invdet, out[1][1] *= invdet, out[1][2] *= invdet;
829 out[2][0] *= invdet, out[2][1] *= invdet, out[2][2] *= invdet;
843 cs_real_t a00 = a[1][1]*a[2][2] - a[2][1]*a[1][2];
844 cs_real_t a01 = a[2][1]*a[0][2] - a[0][1]*a[2][2];
845 cs_real_t a02 = a[0][1]*a[1][2] - a[1][1]*a[0][2];
846 cs_real_t a10 = a[2][0]*a[1][2] - a[1][0]*a[2][2];
847 cs_real_t a11 = a[0][0]*a[2][2] - a[2][0]*a[0][2];
848 cs_real_t a12 = a[1][0]*a[0][2] - a[0][0]*a[1][2];
849 cs_real_t a20 = a[1][0]*a[2][1] - a[2][0]*a[1][1];
850 cs_real_t a21 = a[2][0]*a[0][1] - a[0][0]*a[2][1];
851 cs_real_t a22 = a[0][0]*a[1][1] - a[1][0]*a[0][1];
853 double det_inv = 1. / (a[0][0]*a00 + a[1][0]*a01 + a[2][0]*a02);
855 a[0][0] = a00 * det_inv;
856 a[0][1] = a01 * det_inv;
857 a[0][2] = a02 * det_inv;
858 a[1][0] = a10 * det_inv;
859 a[1][1] = a11 * det_inv;
860 a[1][2] = a12 * det_inv;
861 a[2][0] = a20 * det_inv;
862 a[2][1] = a21 * det_inv;
863 a[2][2] = a22 * det_inv;
878 cs_real_t a00 = a[1][1]*a[2][2] - a[2][1]*a[1][2];
879 cs_real_t a01 = a[2][1]*a[0][2] - a[0][1]*a[2][2];
880 cs_real_t a02 = a[0][1]*a[1][2] - a[1][1]*a[0][2];
881 cs_real_t a11 = a[0][0]*a[2][2] - a[2][0]*a[0][2];
882 cs_real_t a12 = a[1][0]*a[0][2] - a[0][0]*a[1][2];
883 cs_real_t a22 = a[0][0]*a[1][1] - a[1][0]*a[0][1];
885 double det_inv = 1. / (a[0][0]*a00 + a[1][0]*a01 + a[2][0]*a02);
887 a[0][0] = a00 * det_inv;
888 a[0][1] = a01 * det_inv;
889 a[0][2] = a02 * det_inv;
890 a[1][0] = a01 * det_inv;
891 a[1][1] = a11 * det_inv;
892 a[1][2] = a12 * det_inv;
893 a[2][0] = a02 * det_inv;
894 a[2][1] = a12 * det_inv;
895 a[2][2] = a22 * det_inv;
916 sout[0] = s[1]*s[2] - s[4]*s[4];
917 sout[1] = s[0]*s[2] - s[5]*s[5];
918 sout[2] = s[0]*s[1] - s[3]*s[3];
919 sout[3] = s[4]*s[5] - s[3]*s[2];
920 sout[4] = s[3]*s[5] - s[0]*s[4];
921 sout[5] = s[3]*s[4] - s[1]*s[5];
923 detinv = 1. / (s[0]*sout[0] + s[3]*sout[3] + s[5]*sout[5]);
948 mout[0][0] = m1[0][0]*m2[0][0] + m1[0][1]*m2[1][0] + m1[0][2]*m2[2][0];
949 mout[0][1] = m1[0][0]*m2[0][1] + m1[0][1]*m2[1][1] + m1[0][2]*m2[2][1];
950 mout[0][2] = m1[0][0]*m2[0][2] + m1[0][1]*m2[1][2] + m1[0][2]*m2[2][2];
952 mout[1][0] = m1[1][0]*m2[0][0] + m1[1][1]*m2[1][0] + m1[1][2]*m2[2][0];
953 mout[1][1] = m1[1][0]*m2[0][1] + m1[1][1]*m2[1][1] + m1[1][2]*m2[2][1];
954 mout[1][2] = m1[1][0]*m2[0][2] + m1[1][1]*m2[1][2] + m1[1][2]*m2[2][2];
956 mout[2][0] = m1[2][0]*m2[0][0] + m1[2][1]*m2[1][0] + m1[2][2]*m2[2][0];
957 mout[2][1] = m1[2][0]*m2[0][1] + m1[2][1]*m2[1][1] + m1[2][2]*m2[2][1];
958 mout[2][2] = m1[2][0]*m2[0][2] + m1[2][1]*m2[1][2] + m1[2][2]*m2[2][2];
979 _m[0][0] = m[0][0]*q[0][0] + m[0][1]*q[1][0] + m[0][2]*q[2][0];
980 _m[0][1] = m[0][0]*q[0][1] + m[0][1]*q[1][1] + m[0][2]*q[2][1];
981 _m[0][2] = m[0][0]*q[0][2] + m[0][1]*q[1][2] + m[0][2]*q[2][2];
983 _m[1][0] = m[1][0]*q[0][0] + m[1][1]*q[1][0] + m[1][2]*q[2][0];
984 _m[1][1] = m[1][0]*q[0][1] + m[1][1]*q[1][1] + m[1][2]*q[2][1];
985 _m[1][2] = m[1][0]*q[0][2] + m[1][1]*q[1][2] + m[1][2]*q[2][2];
987 _m[2][0] = m[2][0]*q[0][0] + m[2][1]*q[1][0] + m[2][2]*q[2][0];
988 _m[2][1] = m[2][0]*q[0][1] + m[2][1]*q[1][1] + m[2][2]*q[2][1];
989 _m[2][2] = m[2][0]*q[0][2] + m[2][1]*q[1][2] + m[2][2]*q[2][2];
992 mout[0][0] = q[0][0]*_m[0][0] + q[1][0]*_m[1][0] + q[2][0]*_m[2][0];
993 mout[0][1] = q[0][0]*_m[0][1] + q[1][0]*_m[1][1] + q[2][0]*_m[2][1];
994 mout[0][2] = q[0][0]*_m[0][2] + q[1][0]*_m[1][2] + q[2][0]*_m[2][2];
996 mout[1][0] = q[0][1]*_m[0][0] + q[1][1]*_m[1][0] + q[2][1]*_m[2][0];
997 mout[1][1] = q[0][1]*_m[0][1] + q[1][1]*_m[1][1] + q[2][1]*_m[2][1];
998 mout[1][2] = q[0][1]*_m[0][2] + q[1][1]*_m[1][2] + q[2][1]*_m[2][2];
1000 mout[2][0] = q[0][2]*_m[0][0] + q[1][2]*_m[1][0] + q[2][2]*_m[2][0];
1001 mout[2][1] = q[0][2]*_m[0][1] + q[1][2]*_m[1][1] + q[2][2]*_m[2][1];
1002 mout[2][2] = q[0][2]*_m[0][2] + q[1][2]*_m[1][2] + q[2][2]*_m[2][2];
1023 _m[0][0] = m[0]*q[0][0] + m[3]*q[1][0] + m[5]*q[2][0];
1024 _m[0][1] = m[0]*q[0][1] + m[3]*q[1][1] + m[5]*q[2][1];
1025 _m[0][2] = m[0]*q[0][2] + m[3]*q[1][2] + m[5]*q[2][2];
1027 _m[1][0] = m[3]*q[0][0] + m[1]*q[1][0] + m[4]*q[2][0];
1028 _m[1][1] = m[3]*q[0][1] + m[1]*q[1][1] + m[4]*q[2][1];
1029 _m[1][2] = m[3]*q[0][2] + m[1]*q[1][2] + m[4]*q[2][2];
1031 _m[2][0] = m[5]*q[0][0] + m[4]*q[1][0] + m[2]*q[2][0];
1032 _m[2][1] = m[5]*q[0][1] + m[4]*q[1][1] + m[2]*q[2][1];
1033 _m[2][2] = m[5]*q[0][2] + m[4]*q[1][2] + m[2]*q[2][2];
1036 mout[0] = q[0][0]*_m[0][0] + q[1][0]*_m[1][0] + q[2][0]*_m[2][0];
1037 mout[1] = q[0][1]*_m[0][1] + q[1][1]*_m[1][1] + q[2][1]*_m[2][1];
1038 mout[2] = q[0][2]*_m[0][2] + q[1][2]*_m[1][2] + q[2][2]*_m[2][2];
1040 mout[3] = q[0][0]*_m[0][1] + q[1][0]*_m[1][1] + q[2][0]*_m[2][1];
1041 mout[4] = q[0][1]*_m[0][2] + q[1][1]*_m[1][2] + q[2][1]*_m[2][2];
1042 mout[5] = q[0][0]*_m[0][2] + q[1][0]*_m[1][2] + q[2][0]*_m[2][2];
1064 _m[0][0] = m[0][0]*q[0][0] + m[0][1]*q[0][1] + m[0][2]*q[0][2];
1065 _m[0][1] = m[0][0]*q[1][0] + m[0][1]*q[1][1] + m[0][2]*q[1][2];
1066 _m[0][2] = m[0][0]*q[2][0] + m[0][1]*q[2][1] + m[0][2]*q[2][2];
1068 _m[1][0] = m[1][0]*q[0][0] + m[1][1]*q[0][1] + m[1][2]*q[0][2];
1069 _m[1][1] = m[1][0]*q[1][0] + m[1][1]*q[1][1] + m[1][2]*q[1][2];
1070 _m[1][2] = m[1][0]*q[2][0] + m[1][1]*q[2][1] + m[1][2]*q[2][2];
1072 _m[2][0] = m[2][0]*q[0][0] + m[2][1]*q[0][1] + m[2][2]*q[0][2];
1073 _m[2][1] = m[2][0]*q[1][0] + m[2][1]*q[1][1] + m[2][2]*q[1][2];
1074 _m[2][2] = m[2][0]*q[2][0] + m[2][1]*q[2][1] + m[2][2]*q[2][2];
1077 mout[0][0] = q[0][0]*_m[0][0] + q[0][1]*_m[1][0] + q[0][2]*_m[2][0];
1078 mout[0][1] = q[0][0]*_m[0][1] + q[0][1]*_m[1][1] + q[0][2]*_m[2][1];
1079 mout[0][2] = q[0][0]*_m[0][2] + q[0][1]*_m[1][2] + q[0][2]*_m[2][2];
1081 mout[1][0] = q[1][0]*_m[0][0] + q[1][1]*_m[1][0] + q[1][2]*_m[2][0];
1082 mout[1][1] = q[1][0]*_m[0][1] + q[1][1]*_m[1][1] + q[1][2]*_m[2][1];
1083 mout[1][2] = q[1][0]*_m[0][2] + q[1][1]*_m[1][2] + q[1][2]*_m[2][2];
1085 mout[2][0] = q[2][0]*_m[0][0] + q[2][1]*_m[1][0] + q[2][2]*_m[2][0];
1086 mout[2][1] = q[2][0]*_m[0][1] + q[2][1]*_m[1][1] + q[2][2]*_m[2][1];
1087 mout[2][2] = q[2][0]*_m[0][2] + q[2][1]*_m[1][2] + q[2][2]*_m[2][2];
1108 _m[0][0] = m[0]*q[0][0] + m[3]*q[0][1] + m[5]*q[0][2];
1109 _m[0][1] = m[0]*q[1][0] + m[3]*q[1][1] + m[5]*q[1][2];
1110 _m[0][2] = m[0]*q[2][0] + m[3]*q[2][1] + m[5]*q[2][2];
1112 _m[1][0] = m[3]*q[0][0] + m[1]*q[0][1] + m[4]*q[0][2];
1113 _m[1][1] = m[3]*q[1][0] + m[1]*q[1][1] + m[4]*q[1][2];
1114 _m[1][2] = m[3]*q[2][0] + m[1]*q[2][1] + m[4]*q[2][2];
1116 _m[2][0] = m[5]*q[0][0] + m[4]*q[0][1] + m[2]*q[0][2];
1117 _m[2][1] = m[5]*q[1][0] + m[4]*q[1][1] + m[2]*q[1][2];
1118 _m[2][2] = m[5]*q[2][0] + m[4]*q[2][1] + m[2]*q[2][2];
1121 mout[0] = q[0][0]*_m[0][0] + q[0][1]*_m[1][0] + q[0][2]*_m[2][0];
1122 mout[1] = q[1][0]*_m[0][1] + q[1][1]*_m[1][1] + q[1][2]*_m[2][1];
1123 mout[2] = q[2][0]*_m[0][2] + q[2][1]*_m[1][2] + q[2][2]*_m[2][2];
1126 mout[3] = q[0][0]*_m[0][1] + q[0][1]*_m[1][1] + q[0][2]*_m[2][1];
1127 mout[4] = q[1][0]*_m[0][2] + q[1][1]*_m[1][2] + q[1][2]*_m[2][2];
1128 mout[5] = q[0][0]*_m[0][2] + q[0][1]*_m[1][2] + q[0][2]*_m[2][2];
1148 m_sym[0][0] = 0.5 * (m[0][0] + m[0][0]);
1149 m_sym[0][1] = 0.5 * (m[0][1] + m[1][0]);
1150 m_sym[0][2] = 0.5 * (m[0][2] + m[2][0]);
1151 m_sym[1][0] = 0.5 * (m[1][0] + m[0][1]);
1152 m_sym[1][1] = 0.5 * (m[1][1] + m[1][1]);
1153 m_sym[1][2] = 0.5 * (m[1][2] + m[2][1]);
1154 m_sym[2][0] = 0.5 * (m[2][0] + m[0][2]);
1155 m_sym[2][1] = 0.5 * (m[2][1] + m[1][2]);
1156 m_sym[2][2] = 0.5 * (m[2][2] + m[2][2]);
1159 m_ant[0][0] = 0.5 * (m[0][0] - m[0][0]);
1160 m_ant[0][1] = 0.5 * (m[0][1] - m[1][0]);
1161 m_ant[0][2] = 0.5 * (m[0][2] - m[2][0]);
1162 m_ant[1][0] = 0.5 * (m[1][0] - m[0][1]);
1163 m_ant[1][1] = 0.5 * (m[1][1] - m[1][1]);
1164 m_ant[1][2] = 0.5 * (m[1][2] - m[2][1]);
1165 m_ant[2][0] = 0.5 * (m[2][0] - m[0][2]);
1166 m_ant[2][1] = 0.5 * (m[2][1] - m[1][2]);
1167 m_ant[2][2] = 0.5 * (m[2][2] - m[2][2]);
1185 mout[0][0] += m1[0][0]*m2[0][0] + m1[0][1]*m2[1][0] + m1[0][2]*m2[2][0];
1186 mout[0][1] += m1[0][0]*m2[0][1] + m1[0][1]*m2[1][1] + m1[0][2]*m2[2][1];
1187 mout[0][2] += m1[0][0]*m2[0][2] + m1[0][1]*m2[1][2] + m1[0][2]*m2[2][2];
1189 mout[1][0] += m1[1][0]*m2[0][0] + m1[1][1]*m2[1][0] + m1[1][2]*m2[2][0];
1190 mout[1][1] += m1[1][0]*m2[0][1] + m1[1][1]*m2[1][1] + m1[1][2]*m2[2][1];
1191 mout[1][2] += m1[1][0]*m2[0][2] + m1[1][1]*m2[1][2] + m1[1][2]*m2[2][2];
1193 mout[2][0] += m1[2][0]*m2[0][0] + m1[2][1]*m2[1][0] + m1[2][2]*m2[2][0];
1194 mout[2][1] += m1[2][0]*m2[0][1] + m1[2][1]*m2[1][1] + m1[2][2]*m2[2][1];
1195 mout[2][2] += m1[2][0]*m2[0][2] + m1[2][1]*m2[1][2] + m1[2][2]*m2[2][2];
1220 sout[0] = s1[0]*s2[0] + s1[3]*s2[3] + s1[5]*s2[5];
1222 sout[1] = s1[3]*s2[3] + s1[1]*s2[1] + s1[4]*s2[4];
1224 sout[2] = s1[5]*s2[5] + s1[4]*s2[4] + s1[2]*s2[2];
1226 sout[3] = s1[0]*s2[3] + s1[3]*s2[1] + s1[5]*s2[4];
1228 sout[4] = s1[3]*s2[5] + s1[1]*s2[4] + s1[4]*s2[2];
1230 sout[5] = s1[0]*s2[5] + s1[3]*s2[4] + s1[5]*s2[2];
1247 int tens2vect[3][3];
1248 int iindex[6], jindex[6];
1250 tens2vect[0][0] = 0; tens2vect[0][1] = 3; tens2vect[0][2] = 5;
1251 tens2vect[1][0] = 3; tens2vect[1][1] = 1; tens2vect[1][2] = 4;
1252 tens2vect[2][0] = 5; tens2vect[2][1] = 4; tens2vect[2][2] = 2;
1254 iindex[0] = 0; iindex[1] = 1; iindex[2] = 2;
1255 iindex[3] = 0; iindex[4] = 1; iindex[5] = 0;
1257 jindex[0] = 0; jindex[1] = 1; jindex[2] = 2;
1258 jindex[3] = 1; jindex[4] = 2; jindex[5] = 2;
1264 for (
int i = 0; i < 6; i++) {
1267 for (
int k = 0;
k < 3;
k++) {
1268 int ik = tens2vect[
k][ii];
1269 int jk = tens2vect[
k][jj];
1271 sout[
ik][i] += s[
k][jj];
1273 sout[jk][i] += s[
k][ii];
1301 _sout[0][0] = s1[0]*s2[0] + s1[3]*s2[3] + s1[5]*s2[5];
1303 _sout[1][1] = s1[3]*s2[3] + s1[1]*s2[1] + s1[4]*s2[4];
1305 _sout[2][2] = s1[5]*s2[5] + s1[4]*s2[4] + s1[2]*s2[2];
1307 _sout[0][1] = s1[0]*s2[3] + s1[3]*s2[1] + s1[5]*s2[4];
1309 _sout[1][0] = s2[0]*s1[3] + s2[3]*s1[1] + s2[5]*s1[4];
1311 _sout[1][2] = s1[3]*s2[5] + s1[1]*s2[4] + s1[4]*s2[2];
1313 _sout[2][1] = s2[3]*s1[5] + s2[1]*s1[4] + s2[4]*s1[2];
1315 _sout[0][2] = s1[0]*s2[5] + s1[3]*s2[4] + s1[5]*s2[2];
1317 _sout[2][0] = s2[0]*s1[5] + s2[3]*s1[4] + s2[5]*s1[2];
1319 sout[0][0] = _sout[0][0]*s3[0] + _sout[0][1]*s3[3] + _sout[0][2]*s3[5];
1321 sout[1][1] = _sout[1][0]*s3[3] + _sout[1][1]*s3[1] + _sout[1][2]*s3[4];
1323 sout[2][2] = _sout[2][0]*s3[5] + _sout[2][1]*s3[4] + _sout[2][2]*s3[2];
1325 sout[0][1] = _sout[0][0]*s3[3] + _sout[0][1]*s3[1] + _sout[0][2]*s3[4];
1327 sout[1][0] = s3[0]*_sout[1][0] + s3[3]*_sout[1][1] + s3[5]*_sout[1][2];
1329 sout[1][2] = _sout[1][0]*s3[5] + _sout[1][1]*s3[4] + _sout[1][2]*s3[2];
1331 sout[2][1] = s3[3]*_sout[2][0] + s3[1]*_sout[2][1] + s3[4]*_sout[2][2];
1333 sout[0][2] = _sout[0][0]*s3[5] + _sout[0][1]*s3[4] + _sout[0][2]*s3[2];
1335 sout[2][0] = s3[0]*_sout[2][0] + s3[3]*_sout[2][1] + s3[5]*_sout[2][2];
1351 cs_real_t magnitude = sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]);
1353 qv->
meas = magnitude;
1357 qv->
unitv[0] = inv * v[0];
1358 qv->
unitv[1] = inv * v[1];
1359 qv->
unitv[2] = inv * v[2];
static void cs_math_sym_33_inv_cramer(const cs_real_t s[6], cs_real_t sout[restrict 6])
Compute the inverse of a symmetric matrix using Cramer's rule.
Definition: cs_math.h:911
Definition: cs_field_pointer.h:70
integer, save ik
Definition: numvar.f90:75
static cs_real_t cs_math_fabs(cs_real_t x)
Compute the absolute value of a real value.
Definition: cs_math.h:143
static cs_real_t cs_math_3_distance_dot_product(const cs_real_t xa[3], const cs_real_t xb[3], const cs_real_t xc[3])
Compute .
Definition: cs_math.h:290
#define restrict
Definition: cs_defs.h:142
static cs_real_t cs_math_3_dot_product(const cs_real_t u[3], const cs_real_t v[3])
Compute the dot product of two vectors of 3 real values.
Definition: cs_math.h:332
static const cs_real_6_t cs_math_sym_33_identity
Definition: cs_math.h:95
static cs_real_t cs_math_6_trace(const cs_real_t t[6])
Compute the trace of a symmetric tensor.
Definition: cs_math.h:660
static cs_real_t cs_math_fmin(cs_real_t x, cs_real_t y)
Compute the min value of two real values.
Definition: cs_math.h:161
cs_real_t cs_real_6_t[6]
vector of 6 floating-point values
Definition: cs_defs.h:337
const cs_real_t cs_math_big_r
static void cs_math_sym_33_3_product_add(const cs_real_t m[6], const cs_real_t v[3], cs_real_t mv[restrict 3])
Compute the product of a symmetric matrix of 3x3 real values by a vector of 3 real values and add it ...
Definition: cs_math.h:640
static void cs_math_33t_3_product(const cs_real_t m[3][3], const cs_real_t v[3], cs_real_t mv[restrict 3])
Compute the product of the transpose of a matrix of 3x3 real values by a vector of 3 real values...
Definition: cs_math.h:596
cs_math_sym_tensor_component_t
Definition: cs_math.h:61
static void cs_math_66_6_product(const cs_real_t m[6][6], const cs_real_t v[6], cs_real_t mv[restrict 6])
Compute the product of a matrix of 6x6 real values by a vector of 6 real values.
Definition: cs_math.h:677
static cs_real_t cs_math_pow3(cs_real_t x)
Compute the cube of a real value.
Definition: cs_math.h:231
static void cs_math_33_inv_cramer_in_place(cs_real_t a[3][3])
Inverse a 3x3 matrix in place, using Cramer's rule.
Definition: cs_math.h:841
const cs_real_t cs_math_pi
static void cs_math_3_normalise(const cs_real_t vin[3], cs_real_t vout[3])
Normalize a vector of 3 real values.
Definition: cs_math.h:438
static void cs_math_33_normal_scaling_add(const cs_real_t n[3], cs_real_t factor, cs_real_t t[3][3])
Add the dot product with a normal vector to the normal,normal component of a tensor: t += factor * n...
Definition: cs_math.h:529
static cs_real_t cs_math_3_triple_product(const cs_real_t u[3], const cs_real_t v[3], const cs_real_t w[3])
Compute the triple product.
Definition: cs_math.h:790
const cs_real_t cs_math_1ov6
#define BEGIN_C_DECLS
Definition: cs_defs.h:510
void cs_math_fw_and_bw_lu(const cs_real_t a_lu[], const int n, cs_real_t x[], const cs_real_t b[])
Block Jacobi utilities. Compute forward and backward to solve an LU P*P system.
Definition: cs_math.c:715
const cs_real_t cs_math_epzero
static cs_real_t cs_math_sym_33_determinant(const cs_real_6_t m)
Compute the determinant of a 3x3 symmetric matrix.
Definition: cs_math.h:740
const cs_real_t cs_math_1ov24
const cs_real_t cs_math_1ov12
const cs_real_t cs_math_2ov3
const cs_real_t cs_math_4ov3
static cs_real_t cs_math_3_distance(const cs_real_t xa[3], const cs_real_t xb[3])
Compute the (euclidean) distance between two points xa and xb in a Cartesian coordinate system of dim...
Definition: cs_math.h:265
void cs_math_33_eigen(const cs_real_t m[3][3], cs_real_t *eig_ratio, cs_real_t *eig_max)
Compute max/min eigenvalues ratio and max. eigenvalue of a 3x3 symmetric matrix with non-symmetric st...
Definition: cs_math.c:351
static void cs_math_sym_33_double_product(const cs_real_t s1[6], const cs_real_t s2[6], const cs_real_t s3[6], cs_real_t sout[restrict 3][3])
Compute the product of three symmetric matrices.
Definition: cs_math.h:1293
double cs_real_t
Floating-point value.
Definition: cs_defs.h:322
static cs_real_t cs_math_3_33_3_dot_product(const cs_real_t n1[3], const cs_real_t t[3][3], const cs_real_t n2[3])
Compute the dot product of a tensor t with two vectors, n1 and n2.
Definition: cs_math.h:353
Definition: cs_defs.h:368
static cs_real_t cs_math_3_square_norm(const cs_real_t v[3])
Compute the square norm of a vector of 3 real values.
Definition: cs_math.h:419
static void cs_math_3_normalize(const cs_real_t vin[3], cs_real_t vout[3])
Normalise a vector of 3 real values.
Definition: cs_math.h:462
static cs_real_t cs_math_sq(cs_real_t x)
Compute the square of a real value.
Definition: cs_math.h:199
static int cs_math_binom(int n, int k)
Computes the binomial coefficient of n and k.
Definition: cs_math.h:113
double cs_math_surftri(const cs_real_t xv[3], const cs_real_t xe[3], const cs_real_t xf[3])
Compute the area of the convex_hull generated by 3 points. This corresponds to the computation of the...
Definition: cs_math.c:471
double precision, dimension(:,:,:), allocatable v
Definition: atimbr.f90:114
static void cs_math_sym_33_transform_r_to_a(const cs_real_t m[6], const cs_real_t q[3][3], cs_real_t mout[6])
Compute transformation from relative to absolute reference frame Q^t M Q.
Definition: cs_math.h:1017
static void cs_math_3_normal_scaling(const cs_real_t n[3], cs_real_t factor, cs_real_t v[3])
Add the dot product with a normal vector to the normal direction to a vector.
Definition: cs_math.h:507
static void cs_math_sym_33_product(const cs_real_t s1[6], const cs_real_t s2[6], cs_real_t sout[restrict 6])
Compute the product of two symmetric matrices.
Definition: cs_math.h:1215
const cs_real_t cs_math_1ov3
static void cs_math_33_transform_a_to_r(const cs_real_t m[3][3], const cs_real_t q[3][3], cs_real_t mout[3][3])
Compute transformation from absolute to relative reference frame Q M Q^t.
Definition: cs_math.h:1058
static void cs_math_66_6_product_add(const cs_real_t m[6][6], const cs_real_t v[6], cs_real_t mv[restrict 6])
Compute the product of a matrix of 6x6 real values by a vector of 6 real values and add it to the vec...
Definition: cs_math.h:699
double cs_math_get_machine_epsilon(void)
Get the value related to the machine precision.
Definition: cs_math.c:245
static void cs_math_33_product_add(const cs_real_t m1[3][3], const cs_real_t m2[3][3], cs_real_t mout[restrict 3][3])
Add the product of two 3x3 real matrices to a matrix.
Definition: cs_math.h:1181
static void cs_math_33_inv_cramer_sym_in_place(cs_real_t a[3][3])
Inverse a 3x3 symmetric matrix (with non-symmetric storage) in place, using Cramer's rule...
Definition: cs_math.h:876
static void cs_math_33_transform_r_to_a(const cs_real_t m[3][3], const cs_real_t q[3][3], cs_real_t mout[3][3])
Compute transformation from relative to absolute reference frame Q^t M Q.
Definition: cs_math.h:973
void cs_math_set_machine_epsilon(void)
Compute the value related to the machine precision.
Definition: cs_math.c:224
static cs_real_t cs_math_pow2(cs_real_t x)
Compute the square of a real value.
Definition: cs_math.h:215
double precision, save a
Definition: cs_fuel_incl.f90:146
double cs_math_voltet(const cs_real_t xv[3], const cs_real_t xe[3], const cs_real_t xf[3], const cs_real_t xc[3])
Compute the volume of the convex_hull generated by 4 points. This is equivalent to the computation of...
Definition: cs_math.c:501
double meas
Definition: cs_defs.h:370
void cs_math_sym_33_eigen(const cs_real_t m[6], cs_real_t eig_vals[3])
Compute all eigenvalues of a 3x3 symmetric matrix with symmetric storage.
Definition: cs_math.c:265
static cs_real_t cs_math_33_determinant(const cs_real_t m[3][3])
Compute the determinant of a 3x3 matrix.
Definition: cs_math.h:720
const cs_real_t cs_math_5ov3
double precision, dimension(:,:,:), allocatable u
Definition: atimbr.f90:113
static cs_real_t cs_math_3_norm(const cs_real_t v[3])
Compute the euclidean norm of a vector of dimension 3.
Definition: cs_math.h:403
static void cs_math_33_inv_cramer(const cs_real_t in[3][3], cs_real_t out[3][3])
Inverse a 3x3 matrix.
Definition: cs_math.h:809
void cs_math_33_eig_val_vec(const cs_real_t m_in[3][3], const cs_real_t tol_err, cs_real_t eig_val[restrict 3], cs_real_t eig_vec[restrict 3][3])
Evaluate eigenvalues and eigenvectors of a real symmetric matrix m1[3,3]: m1*m2 = lambda*m2...
Definition: cs_math.c:533
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:335
static void cs_math_3_orthogonal_projection(const cs_real_t n[3], const cs_real_t v[3], cs_real_t vout[restrict 3])
Orthogonal projection of a vector with respect to a normalised vector.
Definition: cs_math.h:486
static void cs_math_3_cross_product(const cs_real_t u[3], const cs_real_t v[3], cs_real_t uv[restrict 3])
Compute the cross product of two vectors of 3 real values.
Definition: cs_math.h:764
const cs_real_t cs_math_zero_threshold
static const cs_real_33_t cs_math_33_identity
Definition: cs_math.h:92
double unitv[3]
Definition: cs_defs.h:371
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:316
static cs_real_t cs_math_pow4(cs_real_t x)
Compute the 4-th power of a real value.
Definition: cs_math.h:247
static cs_real_t cs_math_3_square_distance(const cs_real_t xa[3], const cs_real_t xb[3])
Compute the squared distance between two points xa and xb in a Cartesian coordinate system of dimensi...
Definition: cs_math.h:310
static void cs_nvec3(const cs_real_3_t v, cs_nvec3_t *qv)
Define a cs_nvec3_t structure from a cs_real_3_t.
Definition: cs_math.h:1348
#define END_C_DECLS
Definition: cs_defs.h:511
static void cs_math_33_product(const cs_real_t m1[3][3], const cs_real_t m2[3][3], cs_real_t mout[3][3])
Compute the product of two 3x3 real valued matrices.
Definition: cs_math.h:944
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:342
static cs_real_t cs_math_3_sym_33_3_dot_product(const cs_real_t n1[3], const cs_real_t t[6], const cs_real_t n2[3])
Compute the dot product of a symmetric tensor t with two vectors, n1 and n2.
Definition: cs_math.h:381
Definition: cs_field_pointer.h:92
static void cs_math_sym_33_3_product(const cs_real_t m[6], const cs_real_t v[3], cs_real_t mv[restrict 3])
Compute the product of a symmetric matrix of 3x3 real values by a vector of 3 real values...
Definition: cs_math.h:618
void cs_math_3_length_unitv(const cs_real_t xa[3], const cs_real_t xb[3], cs_real_t *len, cs_real_3_t unitv)
Compute the length (Euclidean norm) between two points xa and xb in a Cartesian coordinate system of ...
Definition: cs_math.c:438
static void cs_math_33_extract_sym_ant(const cs_real_t m[3][3], cs_real_t m_sym[3][3], cs_real_t m_ant[3][3])
Extract from the given matrix its symmetric and anti-symmetric part.
Definition: cs_math.h:1143
static cs_real_t cs_math_fmax(cs_real_t x, cs_real_t y)
Compute the max value of two real values.
Definition: cs_math.h:180
static void cs_math_33_3_product_add(const cs_real_t m[3][3], const cs_real_t v[3], cs_real_t mv[restrict 3])
Compute the product of a matrix of 3x3 real values by a vector of 3 real values add.
Definition: cs_math.h:575
const cs_real_t cs_math_infinite_r
static void cs_math_33_3_product(const cs_real_t m[3][3], const cs_real_t v[3], cs_real_t mv[restrict 3])
Compute the product of a matrix of 3x3 real values by a vector of 3 real values.
Definition: cs_math.h:554
void cs_math_fact_lu(cs_lnum_t n_blocks, const int b_size, const cs_real_t *a, cs_real_t *a_lu)
Compute LU factorization of an array of dense matrices of identical size.
Definition: cs_math.c:657
static void cs_math_reduce_sym_prod_33_to_66(const cs_real_t s[3][3], cs_real_t sout[restrict 6][6])
Compute a 6x6 matrix A, equivalent to a 3x3 matrix s, such as: A*R_6 = R*s^t + s*R.
Definition: cs_math.h:1244
static void cs_math_sym_33_transform_a_to_r(const cs_real_t m[6], const cs_real_t q[3][3], cs_real_t mout[6])
Compute transformation from absolute to relative reference frame Q M Q^t.
Definition: cs_math.h:1102
double precision, save b
Definition: cs_fuel_incl.f90:146