Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hoisting (?) non-determinacy #91

Closed
wence- opened this issue Sep 5, 2016 · 13 comments · Fixed by #92
Closed

hoisting (?) non-determinacy #91

wence- opened this issue Sep 5, 2016 · 13 comments · Fixed by #92

Comments

@wence-
Copy link
Contributor

wence- commented Sep 5, 2016

In a form, I don't know what right now, I get different code generated across MPI ranks:

diff -u --label /scp\:yam-ic\:/data/lmitche1/pyop2-cache/mismatching-kernels/src-rank2.c --label /scp\:yam-ic\:/data/lmitche1/pyop2-cache/mismatching-kernels/src-rank0.c /var/folders/0c/9jbzks6x2sz3gm1zg5bt_5800000gn/T/tramp.865ZFe.c /var/folders/0c/9jbzks6x2sz3gm1zg5bt_5800000gn/T/tramp.865mPk.c
--- /scp:yam-ic:/data/lmitche1/pyop2-cache/mismatching-kernels/src-rank2.c
+++ /scp:yam-ic:/data/lmitche1/pyop2-cache/mismatching-kernels/src-rank0.c
@@ -394,6 +394,7 @@
   double  c_84_0_3  = (t100 * t84);
   double  c_84_0_4  = (t101 * -1);
   double  c_84_0_5  = (t100 * -1);
+  double  j_84_0_0[12] ;
   double  k_84_0_0[12] ;
   double  k_84_0_1[12] ;
   double  k_84_0_2[12] ;
@@ -427,6 +428,7 @@
   double  k_86_0_3[12] ;
   double  k_86_0_4[12] ;
   double  k_86_0_5[12] ;
+  double  j_86_0_0[12] ;
   double  c_87_0_0  = (t117 * -1);
   double  c_87_0_1  = (t117 * t84);
   double  c_87_0_2  = (t116 * t84);
@@ -444,13 +446,14 @@

   for (int  j  = 0; j < 12; j += 1)
   {
+    j_84_0_0[j] = t195[j] * -1;
     k_84_0_0[j] = t174[j] * c_84_0_1;
     k_84_0_1[j] = (t161[j] * c_84_0_4) + (t168[j] * c_84_0_5);
     k_84_0_2[j] = t175[j] * c_84_0_1;
     k_84_0_3[j] = (t170[j] * c_84_0_5) + (t164[j] * c_84_0_4);
     k_84_0_4[j] = t177[j] * c_84_0_1;
     k_84_0_5[j] = (t173[j] * c_84_0_5) + (t167[j] * c_84_0_4);
-    j_85_0_0[j] = t195[j] * -1;
+    j_85_0_0[j] = j_84_0_0[j];
     j_85_0_1[j] = t190[j] * -1;
     j_85_0_2[j] = t193[j] * -1;
     k_85_0_0[j] = t156[j] * c_85_0_2;
@@ -465,6 +468,7 @@
     k_86_0_3[j] = (t170[j] * c_86_0_5) + (t164[j] * c_86_0_4);
     k_86_0_4[j] = t174[j] * c_86_0_0;
     k_86_0_5[j] = (t161[j] * c_86_0_4) + (t168[j] * c_86_0_5);
+    j_86_0_0[j] = t178[j] * -1;
     k_87_0_0[j] = t159[j] * c_87_0_0;
     k_87_0_1[j] = (t149[j] * c_87_0_4) + (t155[j] * c_87_0_5);
     k_87_0_2[j] = t157[j] * c_87_0_0;
@@ -472,7 +476,7 @@
     k_87_0_4[j] = (t156[j] * c_87_0_0) + ((t143[j] * c_87_0_4) + (t150[j] * c_87_0_5));
     j_87_0_0[j] = t181[j] * -1;
     j_87_0_1[j] = t184[j] * -1;
-    j_87_0_2[j] = t178[j] * -1;
+    j_87_0_2[j] = j_86_0_0[j];

   }

@@ -616,7 +620,7 @@
       ip_k_84_0_8[j] = t235[j] * -1;
       ip_k_84_0_9[j] = t241[j] * -1;
       ip_k_84_0_10[j] = t131[facet[0]][ip][j] * t202;
-      ip_j_84_1_0[j] = j_85_0_0[j] + (t130[facet[0]][ip][j] * c_84_0_0);
+      ip_j_84_1_0[j] = j_84_0_0[j] + (t130[facet[0]][ip][j] * c_84_0_0);
       ip_k_84_1_0[j] = (k_84_0_0[j] + ((t228[j] * c_84_0_2) + (t241[j] * c_84_0_0))) + ((t235[j] * c_84_0_3) + k_84_0_1[j]);
       ip_k_84_1_1[j] = (k_84_0_2[j] + ((t231[j] * c_84_0_2) + (t237[j] * c_84_0_3))) + ((t242[j] * c_84_0_0) + k_84_0_3[j]);
       ip_k_84_1_2[j] = (k_84_0_4[j] + (t240[j] * c_84_0_3)) + ((t234[j] * c_84_0_2) + k_84_0_5[j]);
@@ -646,7 +650,7 @@
       ip_k_86_1_0[j] = (k_86_0_0[j] + ((t240[j] * c_86_0_1) + (t244[j] * c_86_0_2))) + ((t234[j] * c_86_0_3) + k_86_0_1[j]);
       ip_k_86_1_1[j] = (k_86_0_2[j] + ((t231[j] * c_86_0_3) + (t242[j] * c_86_0_2))) + ((t237[j] * c_86_0_1) + k_86_0_3[j]);
       ip_k_86_1_2[j] = (k_86_0_4[j] + (t241[j] * c_86_0_2)) + ((t235[j] * c_86_0_1) + k_86_0_5[j]);
-      ip_j_86_1_0[j] = j_87_0_2[j] + (t132[facet[1]][ip][j] * c_86_0_3);
+      ip_j_86_1_0[j] = j_86_0_0[j] + (t132[facet[1]][ip][j] * c_86_0_3);
       ip_k_87_0_0[j] = t223[j] * -1;
       ip_k_87_0_1[j] = ip_k_85_0_1[j];
       ip_k_87_0_2[j] = ip_k_85_0_0[j];

Diff finished.  Mon Sep  5 15:39:30 2016

Here are two kernels:

        #include <petsc.h>
        #include <stdbool.h>
        #include <math.h>



            #include <immintrin.h>

static inline void form00_interior_facet_integral_otherwise (double  A[24][24] , const double *restrict *restrict coords , const double *restrict *restrict w_0_ , const unsigned int  facet[2] )
{
  double  A00[12][12]  = {0.0};
  double  A01[12][12]  = {0.0};
  double  A10[12][12]  = {0.0};
  double  A11[12][12]  = {0.0};
  double  w_0[2][12] ;

  for (int  i  = 0; i < 4; i += 1)
  {
    w_0[0][i] = w_0_[i][0];

  }

  for (int  i  = 0; i < 4; i += 1)
  {
    w_0[1][i] = w_0_[i+4][0];

  }

  for (int  i  = 0; i < 4; i += 1)
  {
    w_0[0][i+4] = w_0_[i+8][0];

  }

  for (int  i  = 0; i < 4; i += 1)
  {
    w_0[1][i+4] = w_0_[i+12][0];

  }

  for (int  i  = 0; i < 4; i += 1)
  {
    w_0[0][i+8] = w_0_[i+16][0];
    w_0[1][i+8] = w_0_[i+20][0];

  }
  double  t143[12] ;
  double  t146[12] ;
  double  t149[12] ;
  double  t150[12] ;
  double  t152[12] ;
  double  t155[12] ;
  double  t156[12] ;
  double  t157[12] ;
  double  t159[12] ;
  double  t161[12] ;
  double  t164[12] ;
  double  t167[12] ;
  double  t168[12] ;
  double  t170[12] ;
  double  t173[12] ;
  double  t174[12] ;
  double  t175[12] ;
  double  t177[12] ;
  double  t178[12] ;
  double  t179[12] ;
  double  t180[12] ;
  double  t181[12] ;
  double  t182[12] ;
  double  t183[12] ;
  double  t184[12] ;
  double  t185[12] ;
  double  t186[12] ;
  double  t187[12] ;
  double  t188[12] ;
  double  t189[12] ;
  double  t190[12] ;
  double  t191[12] ;
  double  t192[12] ;
  double  t193[12] ;
  double  t194[12] ;
  double  t195[12] ;
  double  t0  = (-1 * coords[0][0]);
  double  t1  = (t0 + (1 * coords[2][0]));
  double  t2  = (-1 * t1);
  double  t3  = (t0 + (1 * coords[3][0]));
  double  t4  = (1 * t3);
  double  t5  = (t2 + t4);
  double  t6  = (-1 * coords[8][0]);
  double  t7  = (t6 + (1 * coords[10][0]));
  double  t8  = (t6 + (1 * coords[11][0]));
  double  t9  = (1 * t8);
  double  t10  = ((-1 * t7) + t9);
  double  t11  = (-1 * coords[16][0]);
  double  t12  = (t11 + (1 * coords[18][0]));
  double  t13  = (t11 + (1 * coords[19][0]));
  double  t14  = (1 * t13);
  double  t15  = ((-1 * t12) + t14);
  double  t16  = (t0 + (1 * coords[1][0]));
  double  t17  = (1 * t16);
  double  t18  = (t6 + (1 * coords[9][0]));
  double  t19  = (1 * t18);
  double  t20  = (t11 + (1 * coords[17][0]));
  double  t21  = (1 * t20);
  double  t22  = (sqrt(((t5 * t5) + (t10 * t10)) + (t15 * t15)) * sqrt(((t17 * t17) + (t19 * t19)) + (t21 * t21)));
  double  t23  = (-1 * t16);
  double  t24  = (1 * t1);
  double  t25  = (t23 + t24);
  double  t26  = (-1 * t18);
  double  t27  = (1 * t7);
  double  t28  = (t26 + t27);
  double  t29  = (-1 * t20);
  double  t30  = (1 * t12);
  double  t31  = (t29 + t30);
  double  t32  = (sqrt(((t25 * t25) + (t28 * t28)) + (t31 * t31)) * sqrt(((t4 * t4) + (t9 * t9)) + (t14 * t14)));
  double  t33  = (t23 + t4);
  double  t34  = (t26 + t9);
  double  t35  = (t29 + t14);
  double  t36  = (sqrt(((t33 * t33) + (t34 * t34)) + (t35 * t35)) * sqrt(((t24 * t24) + (t27 * t27)) + (t30 * t30)));
  double  t37  = (((t32 + t36) + t22) / 2);
  double  t38  = ((t7 * t13) + (-1 * (t8 * t12)));
  double  t39  = (t8 * t20);
  double  t40  = ((t18 * t12) + (-1 * (t7 * t20)));
  double  t41  = (((t16 * t38) + (t1 * (t39 + (-1 * (t18 * t13))))) + (t3 * t40));
  double  t42  = (-1 * coords[4][0]);
  double  t43  = (t42 + (1 * coords[6][0]));
  double  t44  = (-1 * t43);
  double  t45  = (t42 + (1 * coords[7][0]));
  double  t46  = (1 * t45);
  double  t47  = (t44 + t46);
  double  t48  = (-1 * coords[12][0]);
  double  t49  = (t48 + (1 * coords[14][0]));
  double  t50  = (t48 + (1 * coords[15][0]));
  double  t51  = (1 * t50);
  double  t52  = ((-1 * t49) + t51);
  double  t53  = (-1 * coords[20][0]);
  double  t54  = (t53 + (1 * coords[22][0]));
  double  t55  = (t53 + (1 * coords[23][0]));
  double  t56  = (1 * t55);
  double  t57  = ((-1 * t54) + t56);
  double  t58  = (t42 + (1 * coords[5][0]));
  double  t59  = (1 * t58);
  double  t60  = (t48 + (1 * coords[13][0]));
  double  t61  = (1 * t60);
  double  t62  = (t53 + (1 * coords[21][0]));
  double  t63  = (1 * t62);
  double  t64  = (sqrt(((t47 * t47) + (t52 * t52)) + (t57 * t57)) * sqrt(((t59 * t59) + (t61 * t61)) + (t63 * t63)));
  double  t65  = (-1 * t58);
  double  t66  = (1 * t43);
  double  t67  = (t65 + t66);
  double  t68  = (-1 * t60);
  double  t69  = (1 * t49);
  double  t70  = (t68 + t69);
  double  t71  = (-1 * t62);
  double  t72  = (1 * t54);
  double  t73  = (t71 + t72);
  double  t74  = (sqrt(((t67 * t67) + (t70 * t70)) + (t73 * t73)) * sqrt(((t46 * t46) + (t51 * t51)) + (t56 * t56)));
  double  t75  = (t65 + t46);
  double  t76  = (t68 + t51);
  double  t77  = (t71 + t56);
  double  t78  = (sqrt(((t75 * t75) + (t76 * t76)) + (t77 * t77)) * sqrt(((t66 * t66) + (t69 * t69)) + (t72 * t72)));
  double  t79  = (((t74 + t78) + t64) / 2);
  double  t80  = ((t49 * t55) + (-1 * (t50 * t54)));
  double  t81  = (t50 * t62);
  double  t82  = ((t60 * t54) + (-1 * (t49 * t62)));
  double  t83  = (((t58 * t80) + (t43 * (t81 + (-1 * (t60 * t55))))) + (t45 * t82));
  double  t84  = (340.27690917706 / (0.5 * ((2 * (sqrt(((-1 * t22) + t37) * (((-1 * t36) + t37) * (((-1 * t32) + t37) * t37))) / (6 * (0.16666666666667 * fabs(t41))))) + (2 * (sqrt(((-1 * t64) + t79) * (((-1 * t78) + t79) * (((-1 * t74) + t79) * t79))) / (6 * (0.16666666666667 * fabs(t83))))))));
  double  t85  = (t38 / t41);
  static const double  t86[4][3]  = {{1.0, 1.0, 1.0}, 
  {-1.0, 0.0, 0.0}, 
  {0.0, -1.0, 0.0}, 
  {0.0, 0.0, -1.0}};
  double  t87  = ((t39 + (t18 * (-1 * t13))) / t41);
  double  t88  = (t40 / t41);
  double  t89  = (((t85 * t86[facet[0]][0]) + (t87 * t86[facet[0]][1])) + (t88 * t86[facet[0]][2]));
  double  t90  = (((t3 * t12) + (t13 * t2)) / t41);
  double  t91  = (((t16 * t13) + (t20 * (-1 * t3))) / t41);
  double  t92  = (((t1 * t20) + (-1 * (t16 * t12))) / t41);
  double  t93  = (((t90 * t86[facet[0]][0]) + (t91 * t86[facet[0]][1])) + (t92 * t86[facet[0]][2]));
  double  t94  = (((t1 * t8) + (-1 * (t3 * t7))) / t41);
  double  t95  = (((t3 * t18) + (-1 * (t16 * t8))) / t41);
  double  t96  = (((t16 * t7) + (-1 * (t1 * t18))) / t41);
  double  t97  = (((t94 * t86[facet[0]][0]) + (t95 * t86[facet[0]][1])) + (t96 * t86[facet[0]][2]));
  double  t98  = sqrt(((t89 * t89) + (t93 * t93)) + (t97 * t97));
  double  t99  = (t89 / t98);
  double  t100  = (t93 / t98);
  double  t101  = (t97 / t98);
  double  t102  = (t80 / t83);
  double  t103  = ((t81 + (t60 * (-1 * t55))) / t83);
  double  t104  = (t82 / t83);
  double  t105  = (((t102 * t86[facet[1]][0]) + (t103 * t86[facet[1]][1])) + (t104 * t86[facet[1]][2]));
  double  t106  = (((t45 * t54) + (t55 * t44)) / t83);
  double  t107  = (((t58 * t55) + (t62 * (-1 * t45))) / t83);
  double  t108  = (((t43 * t62) + (-1 * (t58 * t54))) / t83);
  double  t109  = (((t106 * t86[facet[1]][0]) + (t107 * t86[facet[1]][1])) + (t108 * t86[facet[1]][2]));
  double  t110  = (((t43 * t50) + (-1 * (t45 * t49))) / t83);
  double  t111  = (((t45 * t60) + (-1 * (t58 * t50))) / t83);
  double  t112  = (((t58 * t49) + (-1 * (t43 * t60))) / t83);
  double  t113  = (((t110 * t86[facet[1]][0]) + (t111 * t86[facet[1]][1])) + (t112 * t86[facet[1]][2]));
  double  t114  = sqrt(((t105 * t105) + (t109 * t109)) + (t113 * t113));
  double  t115  = (t113 / t114);
  double  t116  = (t109 / t114);
  double  t117  = (t105 / t114);
  static const double  t118[4][3][2]  = {{{-1.0, -1.0}, 
  {1.0, 0.0}, 
  {0.0, 1.0}}, 
  {{0.0, 0.0}, 
  {1.0, 0.0}, 
  {0.0, 1.0}}, 
  {{1.0, 0.0}, 
  {0.0, 0.0}, 
  {0.0, 1.0}}, 
  {{1.0, 0.0}, 
  {0.0, 1.0}, 
  {0.0, 0.0}}};
  double  t119  = (((t118[facet[0]][0][0] * t18) + (t118[facet[0]][1][0] * t7)) + (t118[facet[0]][2][0] * t8));
  double  t120  = (((t118[facet[0]][0][1] * t20) + (t118[facet[0]][1][1] * t12)) + (t118[facet[0]][2][1] * t13));
  double  t121  = (((t118[facet[0]][0][1] * t18) + (t118[facet[0]][1][1] * t7)) + (t118[facet[0]][2][1] * t8));
  double  t122  = (((t118[facet[0]][0][0] * t20) + (t118[facet[0]][1][0] * t12)) + (t118[facet[0]][2][0] * t13));
  double  t123  = ((t119 * t120) + (-1 * (t121 * t122)));
  double  t124  = (((t118[facet[0]][0][1] * t16) + (t118[facet[0]][1][1] * t1)) + (t118[facet[0]][2][1] * t3));
  double  t125  = (((t118[facet[0]][0][0] * t16) + (t118[facet[0]][1][0] * t1)) + (t118[facet[0]][2][0] * t3));
  double  t126  = ((t124 * t122) + (-1 * (t125 * t120)));
  double  t127  = ((t125 * t121) + (-1 * (t124 * t119)));
  double  t128  = sqrt(((t123 * t123) + (t126 * t126)) + (t127 * t127));
  static const double  t129[7]  = {0.1125, 0.0629695902724136, 0.0629695902724136, 0.0629695902724136, 0.0661970763942531, 0.0661970763942531, 0.0661970763942531};
  static const double  t130[4][7][12]  = {{{0.0, 0.333333333333333, 0.333333333333333, 0.333333333333333, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.101286507323456, 0.797426985353087, 0.101286507323456, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.101286507323456, 0.101286507323456, 0.797426985353087, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.797426985353087, 0.101286507323456, 0.101286507323456, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.470142064105115, 0.0597158717897697, 0.470142064105115, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.470142064105115, 0.470142064105115, 0.0597158717897698, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0597158717897699, 0.470142064105115, 0.470142064105115, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}}, 
  {{0.333333333333333, 0.0, 0.333333333333333, 0.333333333333333, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.101286507323457, 0.0, 0.797426985353087, 0.101286507323456, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.101286507323457, 0.0, 0.101286507323456, 0.797426985353087, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.797426985353087, 0.0, 0.101286507323456, 0.101286507323456, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.470142064105115, 0.0, 0.0597158717897697, 0.470142064105115, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.470142064105115, 0.0, 0.470142064105115, 0.0597158717897698, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0597158717897699, 0.0, 0.470142064105115, 0.470142064105115, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}}, 
  {{0.333333333333333, 0.333333333333333, 0.0, 0.333333333333333, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.101286507323457, 0.797426985353087, 0.0, 0.101286507323456, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.101286507323457, 0.101286507323456, 0.0, 0.797426985353087, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.797426985353087, 0.101286507323456, 0.0, 0.101286507323456, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.470142064105115, 0.0597158717897698, 0.0, 0.470142064105115, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.470142064105115, 0.470142064105115, 0.0, 0.0597158717897698, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.05971587178977, 0.470142064105115, 0.0, 0.470142064105115, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}}, 
  {{0.333333333333333, 0.333333333333333, 0.333333333333333, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.101286507323457, 0.797426985353087, 0.101286507323456, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.101286507323456, 0.101286507323456, 0.797426985353087, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.797426985353087, 0.101286507323456, 0.101286507323456, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.470142064105115, 0.0597158717897697, 0.470142064105115, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.470142064105115, 0.470142064105115, 0.0597158717897698, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.05971587178977, 0.470142064105115, 0.470142064105115, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}}};
  static const double  t131[4][7][12]  = {{{0.0, 0.0, 0.0, 0.0, 0.0, 0.333333333333333, 0.333333333333333, 0.333333333333333, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.101286507323456, 0.797426985353087, 0.101286507323456, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.101286507323456, 0.101286507323456, 0.797426985353087, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.797426985353087, 0.101286507323456, 0.101286507323456, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.0597158717897697, 0.470142064105115, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.470142064105115, 0.0597158717897698, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0597158717897699, 0.470142064105115, 0.470142064105115, 0.0, 0.0, 0.0, 0.0}}, 
  {{0.0, 0.0, 0.0, 0.0, 0.333333333333333, 0.0, 0.333333333333333, 0.333333333333333, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.101286507323457, 0.0, 0.797426985353087, 0.101286507323456, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.101286507323457, 0.0, 0.101286507323456, 0.797426985353087, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.797426985353087, 0.0, 0.101286507323456, 0.101286507323456, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.0, 0.0597158717897697, 0.470142064105115, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.0, 0.470142064105115, 0.0597158717897698, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0597158717897699, 0.0, 0.470142064105115, 0.470142064105115, 0.0, 0.0, 0.0, 0.0}}, 
  {{0.0, 0.0, 0.0, 0.0, 0.333333333333333, 0.333333333333333, 0.0, 0.333333333333333, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.101286507323457, 0.797426985353087, 0.0, 0.101286507323456, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.101286507323457, 0.101286507323456, 0.0, 0.797426985353087, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.797426985353087, 0.101286507323456, 0.0, 0.101286507323456, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.0597158717897698, 0.0, 0.470142064105115, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.470142064105115, 0.0, 0.0597158717897698, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.05971587178977, 0.470142064105115, 0.0, 0.470142064105115, 0.0, 0.0, 0.0, 0.0}}, 
  {{0.0, 0.0, 0.0, 0.0, 0.333333333333333, 0.333333333333333, 0.333333333333333, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.101286507323457, 0.797426985353087, 0.101286507323456, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.101286507323456, 0.101286507323456, 0.797426985353087, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.797426985353087, 0.101286507323456, 0.101286507323456, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.0597158717897697, 0.470142064105115, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.470142064105115, 0.0597158717897698, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.05971587178977, 0.470142064105115, 0.470142064105115, 0.0, 0.0, 0.0, 0.0, 0.0}}};
  static const double  t132[4][7][12]  = {{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.333333333333333, 0.333333333333333, 0.333333333333333}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.101286507323456, 0.797426985353087, 0.101286507323456}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.101286507323456, 0.101286507323456, 0.797426985353087}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.797426985353087, 0.101286507323456, 0.101286507323456}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.0597158717897697, 0.470142064105115}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.470142064105115, 0.0597158717897698}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0597158717897699, 0.470142064105115, 0.470142064105115}}, 
  {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.333333333333333, 0.0, 0.333333333333333, 0.333333333333333}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.101286507323457, 0.0, 0.797426985353087, 0.101286507323456}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.101286507323457, 0.0, 0.101286507323456, 0.797426985353087}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.797426985353087, 0.0, 0.101286507323456, 0.101286507323456}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.0, 0.0597158717897697, 0.470142064105115}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.0, 0.470142064105115, 0.0597158717897698}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0597158717897699, 0.0, 0.470142064105115, 0.470142064105115}}, 
  {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.333333333333333, 0.333333333333333, 0.0, 0.333333333333333}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.101286507323457, 0.797426985353087, 0.0, 0.101286507323456}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.101286507323457, 0.101286507323456, 0.0, 0.797426985353087}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.797426985353087, 0.101286507323456, 0.0, 0.101286507323456}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.0597158717897698, 0.0, 0.470142064105115}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.470142064105115, 0.0, 0.0597158717897698}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.05971587178977, 0.470142064105115, 0.0, 0.470142064105115}}, 
  {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.333333333333333, 0.333333333333333, 0.333333333333333, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.101286507323457, 0.797426985353087, 0.101286507323456, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.101286507323456, 0.101286507323456, 0.797426985353087, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.797426985353087, 0.101286507323456, 0.101286507323456, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.0597158717897697, 0.470142064105115, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.470142064105115, 0.0597158717897698, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.05971587178977, 0.470142064105115, 0.470142064105115, 0.0}}};
  static const double  t133[12]  = {-1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
  static const double  t134[12]  = {-1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
  static const double  t135[12]  = {-1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
  static const double  t136[12]  = {0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0};
  static const double  t137[12]  = {0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0};
  static const double  t138[12]  = {0.0, 0.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
  static const double  t139[12]  = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0};
  static const double  t140[12]  = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0};
  static const double  t141[12]  = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0};

  for (int  k  = 0; k < 12; k += 1)
  {
    double  t142  = (((t110 * t141[k]) + (t111 * t140[k])) + (t112 * t139[k]));
    t143[k] = 0.5 * (1.81e-05 * (t142 + t142));
    double  t144  = (((t106 * t141[k]) + (t107 * t140[k])) + (t108 * t139[k]));
    double  t145  = (((t110 * t138[k]) + (t111 * t137[k])) + (t112 * t136[k]));
    t146[k] = 0.5 * (1.81e-05 * (t144 + t145));
    double  t147  = (((t102 * t141[k]) + (t103 * t140[k])) + (t104 * t139[k]));
    double  t148  = (((t110 * t135[k]) + (t111 * t134[k])) + (t112 * t133[k]));
    t149[k] = 0.5 * (1.81e-05 * (t147 + t148));
    t150[k] = 0.5 * (1.81e-05 * (t145 + t144));
    double  t151  = (((t106 * t138[k]) + (t107 * t137[k])) + (t108 * t136[k]));
    t152[k] = 0.5 * (1.81e-05 * (t151 + t151));
    double  t153  = (((t102 * t138[k]) + (t103 * t137[k])) + (t104 * t136[k]));
    double  t154  = (((t106 * t135[k]) + (t107 * t134[k])) + (t108 * t133[k]));
    t155[k] = 0.5 * (1.81e-05 * (t153 + t154));
    t156[k] = 0.5 * (1.81e-05 * (t148 + t147));
    t157[k] = 0.5 * (1.81e-05 * (t154 + t153));
    double  t158  = (((t102 * t135[k]) + (t103 * t134[k])) + (t104 * t133[k]));
    t159[k] = 0.5 * (1.81e-05 * (t158 + t158));
    double  t160  = (((t94 * t141[k]) + (t95 * t140[k])) + (t96 * t139[k]));
    t161[k] = 0.5 * (1.81e-05 * (t160 + t160));
    double  t162  = (((t90 * t141[k]) + (t91 * t140[k])) + (t92 * t139[k]));
    double  t163  = (((t94 * t138[k]) + (t95 * t137[k])) + (t96 * t136[k]));
    t164[k] = 0.5 * (1.81e-05 * (t162 + t163));
    double  t165  = (((t85 * t141[k]) + (t87 * t140[k])) + (t88 * t139[k]));
    double  t166  = (((t94 * t135[k]) + (t95 * t134[k])) + (t96 * t133[k]));
    t167[k] = 0.5 * (1.81e-05 * (t165 + t166));
    t168[k] = 0.5 * (1.81e-05 * (t163 + t162));
    double  t169  = (((t90 * t138[k]) + (t91 * t137[k])) + (t92 * t136[k]));
    t170[k] = 0.5 * (1.81e-05 * (t169 + t169));
    double  t171  = (((t85 * t138[k]) + (t87 * t137[k])) + (t88 * t136[k]));
    double  t172  = (((t90 * t135[k]) + (t91 * t134[k])) + (t92 * t133[k]));
    t173[k] = 0.5 * (1.81e-05 * (t171 + t172));
    t174[k] = 0.5 * (1.81e-05 * (t166 + t165));
    t175[k] = 0.5 * (1.81e-05 * (t172 + t171));
    double  t176  = (((t85 * t135[k]) + (t87 * t134[k])) + (t88 * t133[k]));
    t177[k] = 0.5 * (1.81e-05 * (t176 + t176));

  }

  for (int  j  = 0; j < 12; j += 1)
  {
    t178[j] = 0.5 * ((t141[j] * t110) + ((t140[j] * t111) + (t139[j] * t112)));
    t179[j] = 0.5 * ((t138[j] * t110) + ((t137[j] * t111) + (t136[j] * t112)));
    t180[j] = 0.5 * ((t135[j] * t110) + ((t134[j] * t111) + (t133[j] * t112)));
    t181[j] = 0.5 * ((t141[j] * t106) + ((t140[j] * t107) + (t139[j] * t108)));
    t182[j] = 0.5 * ((t138[j] * t106) + ((t137[j] * t107) + (t136[j] * t108)));
    t183[j] = 0.5 * ((t135[j] * t106) + ((t134[j] * t107) + (t133[j] * t108)));
    t184[j] = 0.5 * ((t141[j] * t102) + ((t140[j] * t103) + (t139[j] * t104)));
    t185[j] = 0.5 * ((t138[j] * t102) + ((t137[j] * t103) + (t136[j] * t104)));
    t186[j] = 0.5 * ((t135[j] * t102) + ((t134[j] * t103) + (t133[j] * t104)));
    t187[j] = 0.5 * ((t141[j] * t94) + ((t140[j] * t95) + (t139[j] * t96)));
    t188[j] = 0.5 * ((t138[j] * t94) + ((t137[j] * t95) + (t136[j] * t96)));
    t189[j] = 0.5 * ((t135[j] * t94) + ((t134[j] * t95) + (t133[j] * t96)));
    t190[j] = 0.5 * ((t141[j] * t90) + ((t140[j] * t91) + (t139[j] * t92)));
    t191[j] = 0.5 * ((t138[j] * t90) + ((t137[j] * t91) + (t136[j] * t92)));
    t192[j] = 0.5 * ((t135[j] * t90) + ((t134[j] * t91) + (t133[j] * t92)));
    t193[j] = 0.5 * ((t141[j] * t85) + ((t140[j] * t87) + (t139[j] * t88)));
    t194[j] = 0.5 * ((t138[j] * t85) + ((t137[j] * t87) + (t136[j] * t88)));
    t195[j] = 0.5 * ((t135[j] * t85) + ((t134[j] * t87) + (t133[j] * t88)));

  }
  double  c_42_0_0  = (t115 * (1.81e-05 * 2));
  double  c_46_0_0  = (t116 * (1.81e-05 * 2));
  double  c_50_0_0  = (t117 * (1.81e-05 * 2));
  double  c_51_0_0  = (t101 * (1.81e-05 * 2));
  double  c_55_0_0  = (t100 * (1.81e-05 * 2));
  double  c_59_0_0  = (t99 * (1.81e-05 * 2));
  double  c_84_0_0  = (t99 * t84);
  double  c_84_0_1  = (t99 * -1);
  double  c_84_0_2  = (t101 * t84);
  double  c_84_0_3  = (t100 * t84);
  double  c_84_0_4  = (t101 * -1);
  double  c_84_0_5  = (t100 * -1);
  double  j_84_0_0[12] ;
  double  k_84_0_0[12] ;
  double  k_84_0_1[12] ;
  double  k_84_0_2[12] ;
  double  k_84_0_3[12] ;
  double  k_84_0_4[12] ;
  double  k_84_0_5[12] ;
  double  c_85_0_0  = (t99 * t84);
  double  c_85_0_1  = (t100 * t84);
  double  c_85_0_2  = (t99 * -1);
  double  c_85_0_3  = (t101 * t84);
  double  c_85_0_4  = (t101 * -1);
  double  c_85_0_5  = (t100 * -1);
  double  j_85_0_0[12] ;
  double  j_85_0_1[12] ;
  double  j_85_0_2[12] ;
  double  k_85_0_0[12] ;
  double  k_85_0_1[12] ;
  double  k_85_0_2[12] ;
  double  k_85_0_3[12] ;
  double  k_85_0_4[12] ;
  double  k_85_0_5[12] ;
  double  c_86_0_0  = (t117 * -1);
  double  c_86_0_1  = (t116 * t84);
  double  c_86_0_2  = (t117 * t84);
  double  c_86_0_3  = (t115 * t84);
  double  c_86_0_4  = (t115 * -1);
  double  c_86_0_5  = (t116 * -1);
  double  k_86_0_0[12] ;
  double  k_86_0_1[12] ;
  double  k_86_0_2[12] ;
  double  k_86_0_3[12] ;
  double  k_86_0_4[12] ;
  double  k_86_0_5[12] ;
  double  j_86_0_0[12] ;
  double  c_87_0_0  = (t117 * -1);
  double  c_87_0_1  = (t117 * t84);
  double  c_87_0_2  = (t116 * t84);
  double  c_87_0_3  = (t115 * t84);
  double  c_87_0_4  = (t115 * -1);
  double  c_87_0_5  = (t116 * -1);
  double  k_87_0_0[12] ;
  double  k_87_0_1[12] ;
  double  k_87_0_2[12] ;
  double  k_87_0_3[12] ;
  double  k_87_0_4[12] ;
  double  j_87_0_0[12] ;
  double  j_87_0_1[12] ;
  double  j_87_0_2[12] ;

  for (int  j  = 0; j < 12; j += 1)
  {
    j_84_0_0[j] = t195[j] * -1;
    k_84_0_0[j] = t174[j] * c_84_0_1;
    k_84_0_1[j] = (t161[j] * c_84_0_4) + (t168[j] * c_84_0_5);
    k_84_0_2[j] = t175[j] * c_84_0_1;
    k_84_0_3[j] = (t170[j] * c_84_0_5) + (t164[j] * c_84_0_4);
    k_84_0_4[j] = t177[j] * c_84_0_1;
    k_84_0_5[j] = (t173[j] * c_84_0_5) + (t167[j] * c_84_0_4);
    j_85_0_0[j] = j_84_0_0[j];
    j_85_0_1[j] = t190[j] * -1;
    j_85_0_2[j] = t193[j] * -1;
    k_85_0_0[j] = t156[j] * c_85_0_2;
    k_85_0_1[j] = (t143[j] * c_85_0_4) + (t150[j] * c_85_0_5);
    k_85_0_2[j] = t159[j] * c_85_0_2;
    k_85_0_3[j] = (t149[j] * c_85_0_4) + (t155[j] * c_85_0_5);
    k_85_0_4[j] = t157[j] * c_85_0_2;
    k_85_0_5[j] = (t146[j] * c_85_0_4) + (t152[j] * c_85_0_5);
    k_86_0_0[j] = t177[j] * c_86_0_0;
    k_86_0_1[j] = (t167[j] * c_86_0_4) + (t173[j] * c_86_0_5);
    k_86_0_2[j] = t175[j] * c_86_0_0;
    k_86_0_3[j] = (t170[j] * c_86_0_5) + (t164[j] * c_86_0_4);
    k_86_0_4[j] = t174[j] * c_86_0_0;
    k_86_0_5[j] = (t161[j] * c_86_0_4) + (t168[j] * c_86_0_5);
    j_86_0_0[j] = t178[j] * -1;
    k_87_0_0[j] = t159[j] * c_87_0_0;
    k_87_0_1[j] = (t149[j] * c_87_0_4) + (t155[j] * c_87_0_5);
    k_87_0_2[j] = t157[j] * c_87_0_0;
    k_87_0_3[j] = (t146[j] * c_87_0_4) + (t152[j] * c_87_0_5);
    k_87_0_4[j] = (t156[j] * c_87_0_0) + ((t143[j] * c_87_0_4) + (t150[j] * c_87_0_5));
    j_87_0_0[j] = t181[j] * -1;
    j_87_0_1[j] = t184[j] * -1;
    j_87_0_2[j] = j_86_0_0[j];

  }

  for (int  ip  = 0; ip < 7; ip += 1)
  {
    double  t203[12] ;
    double  t204[12] ;
    double  t205[12] ;
    double  t207[12] ;
    double  t210[12] ;
    double  t213[12] ;
    double  t214[12] ;
    double  t216[12] ;
    double  t219[12] ;
    double  t220[12] ;
    double  t221[12] ;
    double  t223[12] ;
    double  t224[12] ;
    double  t225[12] ;
    double  t226[12] ;
    double  t228[12] ;
    double  t231[12] ;
    double  t234[12] ;
    double  t235[12] ;
    double  t237[12] ;
    double  t240[12] ;
    double  t241[12] ;
    double  t242[12] ;
    double  t244[12] ;
    double  t198  = 0.0;
    double  t197  = 0.0;
    double  t196  = 0.0;

    for (int  i_0  = 0; i_0 < 4; i_0 += 1)
    {
      t196 += t132[facet[0]][ip][i_0+8] * w_0[0][i_0+8];
      t197 += t131[facet[0]][ip][i_0+4] * w_0[0][i_0+4];
      t198 += t130[facet[0]][ip][i_0] * w_0[0][i_0];

    }
    double  t199  = (t129[ip] * t128);
    double  t200  = (((t117 * t198) + (t116 * t197)) + (t115 * t196));
    double  t201  = (0.5 + (0.5 * (t200 == 0 ? 0 : (t200 < 0 ? -1 : 1))));
    double  t202  = (1 + (-1 * t201));

    for (int  k  = 0; k < 12; k += 1)
    {
      t203[k] = t132[facet[1]][ip][k] * t201;
      t204[k] = t131[facet[1]][ip][k] * t201;
      t205[k] = t130[facet[1]][ip][k] * t201;
      t207[k] = t132[facet[1]][ip][k] * c_42_0_0;
      t210[k] = 1.81e-05 * ((t132[facet[1]][ip][k] * t116) + (t131[facet[1]][ip][k] * t115));
      t213[k] = 1.81e-05 * ((t132[facet[1]][ip][k] * t117) + (t130[facet[1]][ip][k] * t115));
      t214[k] = 1.81e-05 * ((t131[facet[1]][ip][k] * t115) + (t132[facet[1]][ip][k] * t116));
      t216[k] = t131[facet[1]][ip][k] * c_46_0_0;
      t219[k] = 1.81e-05 * ((t131[facet[1]][ip][k] * t117) + (t130[facet[1]][ip][k] * t116));
      t220[k] = 1.81e-05 * ((t130[facet[1]][ip][k] * t115) + (t132[facet[1]][ip][k] * t117));
      t221[k] = 1.81e-05 * ((t130[facet[1]][ip][k] * t116) + (t131[facet[1]][ip][k] * t117));
      t223[k] = t130[facet[1]][ip][k] * c_50_0_0;
      t224[k] = t132[facet[0]][ip][k] * t202;
      t225[k] = t131[facet[0]][ip][k] * t202;
      t226[k] = t130[facet[0]][ip][k] * t202;
      t228[k] = t132[facet[0]][ip][k] * c_51_0_0;
      t231[k] = 1.81e-05 * ((t132[facet[0]][ip][k] * t100) + (t131[facet[0]][ip][k] * t101));
      t234[k] = 1.81e-05 * ((t132[facet[0]][ip][k] * t99) + (t130[facet[0]][ip][k] * t101));
      t235[k] = 1.81e-05 * ((t131[facet[0]][ip][k] * t101) + (t132[facet[0]][ip][k] * t100));
      t237[k] = t131[facet[0]][ip][k] * c_55_0_0;
      t240[k] = 1.81e-05 * ((t131[facet[0]][ip][k] * t99) + (t130[facet[0]][ip][k] * t100));
      t241[k] = 1.81e-05 * ((t130[facet[0]][ip][k] * t101) + (t132[facet[0]][ip][k] * t99));
      t242[k] = 1.81e-05 * ((t130[facet[0]][ip][k] * t100) + (t131[facet[0]][ip][k] * t99));
      t244[k] = t130[facet[0]][ip][k] * c_59_0_0;

    }
    double  ip_78_0_0  = ((t117 * t198) + ((t116 * t197) + (t115 * t196)));
    double  ip_81_0_0  = ((t99 * t198) + ((t100 * t197) + (t101 * t196)));
    double  ip_k_84_0_0[12] ;
    double  ip_k_84_0_1[12] ;
    double  ip_k_84_0_2[12] ;
    double  ip_k_84_0_3[12] ;
    double  ip_k_84_0_4[12] ;
    double  ip_k_84_0_5[12] ;
    double  ip_k_84_0_6[12] ;
    double  ip_k_84_0_7[12] ;
    double  ip_k_84_0_8[12] ;
    double  ip_k_84_0_9[12] ;
    double  ip_k_84_0_10[12] ;
    double  ip_j_84_1_0[12] ;
    double  ip_k_84_1_0[12] ;
    double  ip_k_84_1_1[12] ;
    double  ip_k_84_1_2[12] ;
    double  ip_k_85_0_0[12] ;
    double  ip_k_85_0_1[12] ;
    double  ip_k_85_0_2[12] ;
    double  ip_k_85_0_3[12] ;
    double  ip_k_85_0_4[12] ;
    double  ip_k_85_0_5[12] ;
    double  ip_k_85_0_6[12] ;
    double  ip_j_85_1_0[12] ;
    double  ip_j_85_1_1[12] ;
    double  ip_j_85_1_2[12] ;
    double  ip_k_85_1_0[12] ;
    double  ip_k_85_1_1[12] ;
    double  ip_k_85_1_2[12] ;
    double  ip_k_86_0_0[12] ;
    double  ip_k_86_0_1[12] ;
    double  ip_k_86_0_2[12] ;
    double  ip_k_86_0_3[12] ;
    double  ip_k_86_0_4[12] ;
    double  ip_k_86_0_5[12] ;
    double  ip_k_86_0_6[12] ;
    double  ip_k_86_0_7[12] ;
    double  ip_k_86_0_8[12] ;
    double  ip_k_86_0_9[12] ;
    double  ip_k_86_1_0[12] ;
    double  ip_k_86_1_1[12] ;
    double  ip_k_86_1_2[12] ;
    double  ip_j_86_1_0[12] ;
    double  ip_k_87_0_0[12] ;
    double  ip_k_87_0_1[12] ;
    double  ip_k_87_0_2[12] ;
    double  ip_k_87_0_3[12] ;
    double  ip_k_87_0_4[12] ;
    double  ip_k_87_0_5[12] ;
    double  ip_k_87_0_6[12] ;
    double  ip_k_87_1_0[12] ;
    double  ip_k_87_1_1[12] ;
    double  ip_j_87_1_0[12] ;
    double  ip_j_87_1_1[12] ;
    double  ip_j_87_1_2[12] ;

    for (int  j  = 0; j < 12; j += 1)
    {
      ip_k_84_0_0[j] = t242[j] * -1;
      ip_k_84_0_1[j] = t237[j] * -1;
      ip_k_84_0_2[j] = t234[j] * -1;
      ip_k_84_0_3[j] = t130[facet[0]][ip][j] * t202;
      ip_k_84_0_4[j] = t231[j] * -1;
      ip_k_84_0_5[j] = t228[j] * -1;
      ip_k_84_0_6[j] = t132[facet[0]][ip][j] * t202;
      ip_k_84_0_7[j] = t240[j] * -1;
      ip_k_84_0_8[j] = t235[j] * -1;
      ip_k_84_0_9[j] = t241[j] * -1;
      ip_k_84_0_10[j] = t131[facet[0]][ip][j] * t202;
      ip_j_84_1_0[j] = j_84_0_0[j] + (t130[facet[0]][ip][j] * c_84_0_0);
      ip_k_84_1_0[j] = (k_84_0_0[j] + ((t228[j] * c_84_0_2) + (t241[j] * c_84_0_0))) + ((t235[j] * c_84_0_3) + k_84_0_1[j]);
      ip_k_84_1_1[j] = (k_84_0_2[j] + ((t231[j] * c_84_0_2) + (t237[j] * c_84_0_3))) + ((t242[j] * c_84_0_0) + k_84_0_3[j]);
      ip_k_84_1_2[j] = (k_84_0_4[j] + (t240[j] * c_84_0_3)) + ((t234[j] * c_84_0_2) + k_84_0_5[j]);
      ip_k_85_0_0[j] = t221[j] * -1;
      ip_k_85_0_1[j] = t213[j] * -1;
      ip_k_85_0_2[j] = t210[j] * -1;
      ip_k_85_0_3[j] = t207[j] * -1;
      ip_k_85_0_4[j] = t216[j] * -1;
      ip_k_85_0_5[j] = t132[facet[1]][ip][j] * t201;
      ip_k_85_0_6[j] = t219[j] * -1;
      ip_j_85_1_0[j] = j_85_0_0[j] + (t130[facet[0]][ip][j] * c_85_0_0);
      ip_j_85_1_1[j] = j_85_0_1[j] + (t132[facet[0]][ip][j] * c_85_0_1);
      ip_j_85_1_2[j] = j_85_0_2[j] + (t132[facet[0]][ip][j] * c_85_0_0);
      ip_k_85_1_0[j] = (k_85_0_0[j] + (t207[j] * c_85_0_3)) + k_85_0_1[j];
      ip_k_85_1_1[j] = (k_85_0_2[j] + (t219[j] * c_85_0_1)) + ((t213[j] * c_85_0_3) + k_85_0_3[j]);
      ip_k_85_1_2[j] = (k_85_0_4[j] + ((t216[j] * c_85_0_1) + (t221[j] * c_85_0_0))) + ((t210[j] * c_85_0_3) + k_85_0_5[j]);
      ip_k_86_0_0[j] = t244[j] * -1;
      ip_k_86_0_1[j] = ip_k_84_0_8[j];
      ip_k_86_0_2[j] = ip_k_84_0_2[j];
      ip_k_86_0_3[j] = ip_k_84_0_0[j];
      ip_k_86_0_4[j] = ip_k_84_0_9[j];
      ip_k_86_0_5[j] = ip_k_84_0_7[j];
      ip_k_86_0_6[j] = ip_k_84_0_3[j];
      ip_k_86_0_7[j] = ip_k_84_0_4[j];
      ip_k_86_0_8[j] = ip_k_84_0_10[j];
      ip_k_86_0_9[j] = ip_k_84_0_1[j];
      ip_k_86_1_0[j] = (k_86_0_0[j] + ((t240[j] * c_86_0_1) + (t244[j] * c_86_0_2))) + ((t234[j] * c_86_0_3) + k_86_0_1[j]);
      ip_k_86_1_1[j] = (k_86_0_2[j] + ((t231[j] * c_86_0_3) + (t242[j] * c_86_0_2))) + ((t237[j] * c_86_0_1) + k_86_0_3[j]);
      ip_k_86_1_2[j] = (k_86_0_4[j] + (t241[j] * c_86_0_2)) + ((t235[j] * c_86_0_1) + k_86_0_5[j]);
      ip_j_86_1_0[j] = j_86_0_0[j] + (t132[facet[1]][ip][j] * c_86_0_3);
      ip_k_87_0_0[j] = t223[j] * -1;
      ip_k_87_0_1[j] = ip_k_85_0_1[j];
      ip_k_87_0_2[j] = ip_k_85_0_0[j];
      ip_k_87_0_3[j] = t130[facet[1]][ip][j] * t201;
      ip_k_87_0_4[j] = ip_k_85_0_6[j];
      ip_k_87_0_5[j] = ip_k_85_0_2[j];
      ip_k_87_0_6[j] = ip_k_85_0_4[j];
      ip_k_87_1_0[j] = (k_87_0_0[j] + ((t223[j] * c_87_0_1) + (t219[j] * c_87_0_2))) + ((t213[j] * c_87_0_3) + k_87_0_1[j]);
      ip_k_87_1_1[j] = (k_87_0_2[j] + ((t216[j] * c_87_0_2) + (t221[j] * c_87_0_1))) + ((t210[j] * c_87_0_3) + k_87_0_3[j]);
      ip_j_87_1_0[j] = j_87_0_0[j] + (t132[facet[1]][ip][j] * c_87_0_2);
      ip_j_87_1_1[j] = j_87_0_1[j] + (t132[facet[1]][ip][j] * c_87_0_1);
      ip_j_87_1_2[j] = j_87_0_2[j] + (t132[facet[1]][ip][j] * c_87_0_3);

    }

    for (int  j  = 0; j < 12; j += 1)
    {
      double  t245  = (t132[facet[1]][ip][j] * t117);
      double  t246  = (t132[facet[1]][ip][j] * t116);
      double  t247  = (t132[facet[1]][ip][j] * t115);
      double  t248  = (t132[facet[1]][ip][j] * ip_78_0_0);
      double  t249  = (t131[facet[1]][ip][j] * t117);
      double  t250  = (t131[facet[1]][ip][j] * t116);
      double  t251  = (t131[facet[1]][ip][j] * t115);
      double  t252  = (t131[facet[1]][ip][j] * ip_78_0_0);
      double  t253  = (t130[facet[1]][ip][j] * t117);
      double  t254  = (t130[facet[1]][ip][j] * t116);
      double  t255  = (t130[facet[1]][ip][j] * t115);
      double  t256  = (t130[facet[1]][ip][j] * ip_78_0_0);
      double  t257  = (t132[facet[0]][ip][j] * t99);
      double  t258  = (t132[facet[0]][ip][j] * t100);
      double  t259  = (t132[facet[0]][ip][j] * t101);
      double  t260  = (t132[facet[0]][ip][j] * ip_81_0_0);
      double  t261  = (t131[facet[0]][ip][j] * t99);
      double  t262  = (t131[facet[0]][ip][j] * t100);
      double  t263  = (t131[facet[0]][ip][j] * t101);
      double  t264  = (t131[facet[0]][ip][j] * ip_81_0_0);
      double  t265  = (t130[facet[0]][ip][j] * t99);
      double  t266  = (t130[facet[0]][ip][j] * t100);
      double  t267  = (t130[facet[0]][ip][j] * t101);
      double  t268  = (t130[facet[0]][ip][j] * ip_81_0_0);
      double  ip_j_85_0_0  = (t268 * t201);
      double  ip_j_85_0_1  = (t264 * t201);
      double  ip_j_86_0_0  = (t248 * t202);
      double  ip_j_87_0_0  = (t252 * t201);
      double  ip_j_87_0_1  = (t248 * t201);

      for (int  k  = 0; k < 4; k += 1)
      {
        A01[j][k+4] += (t131[facet[1]][ip][k+4] * ip_j_85_0_1) * t199;
        A01[j][k] += (t130[facet[1]][ip][k] * ip_j_85_0_0) * t199;
        A10[j][k+8] += (t132[facet[0]][ip][k+8] * ip_j_86_0_0) * t199;
        A11[j][k+8] += (t132[facet[1]][ip][k+8] * ip_j_87_0_1) * t199;
        A11[j][k+4] += (t131[facet[1]][ip][k+4] * ip_j_87_0_0) * t199;

      }

      for (int  k  = 0; k < 12; k += 1)
      {
        A00[j][k] += t199 * ((((t264 * ip_k_84_0_10[k]) + ((t193[j] * ip_k_84_0_9[k]) + (t189[j] * ip_k_84_0_2[k]))) + (((t187[j] * ip_k_84_0_5[k]) + (t192[j] * ip_k_84_0_7[k])) + ((t190[j] * ip_k_84_0_8[k]) + (t260 * ip_k_84_0_6[k])))) + ((((t268 * ip_k_84_0_3[k]) + (t188[j] * ip_k_84_0_4[k])) + ((t131[facet[0]][ip][j] * ip_k_84_1_1[k]) + (t194[j] * ip_k_84_0_0[k]))) + (((t191[j] * ip_k_84_0_1[k]) + (t130[facet[0]][ip][j] * ip_k_84_1_2[k])) + ((t244[k] * ip_j_84_1_0[j]) + (t132[facet[0]][ip][j] * ip_k_84_1_0[k])))));
        A01[j][k] += t199 * ((((t192[j] * ip_k_85_0_6[k]) + ((t194[j] * ip_k_85_0_0[k]) + (t188[j] * ip_k_85_0_2[k]))) + ((t191[j] * ip_k_85_0_4[k]) + ((t260 * ip_k_85_0_5[k]) + (t187[j] * ip_k_85_0_3[k])))) + (((t189[j] * ip_k_85_0_1[k]) + ((t220[k] * ip_j_85_1_2[j]) + (t130[facet[0]][ip][j] * ip_k_85_1_1[k]))) + (((t131[facet[0]][ip][j] * ip_k_85_1_2[k]) + (t132[facet[0]][ip][j] * ip_k_85_1_0[k])) + ((t223[k] * ip_j_85_1_0[j]) + (t214[k] * ip_j_85_1_1[j])))));
        A10[j][k] += t199 * ((((t182[j] * ip_k_86_0_9[k]) + ((t252 * ip_k_86_0_8[k]) + (t180[j] * ip_k_86_0_2[k]))) + (((t256 * ip_k_86_0_6[k]) + (t179[j] * ip_k_86_0_7[k])) + ((t183[j] * ip_k_86_0_5[k]) + (t185[j] * ip_k_86_0_3[k])))) + (((t184[j] * ip_k_86_0_4[k]) + ((t131[facet[1]][ip][j] * ip_k_86_1_1[k]) + (t132[facet[1]][ip][j] * ip_k_86_1_2[k]))) + (((t181[j] * ip_k_86_0_1[k]) + (t228[k] * ip_j_86_1_0[j])) + ((t186[j] * ip_k_86_0_0[k]) + (t130[facet[1]][ip][j] * ip_k_86_1_0[k])))));
        A11[j][k] += t199 * ((((t182[j] * ip_k_87_0_6[k]) + ((t132[facet[1]][ip][j] * k_87_0_4[k]) + (t256 * ip_k_87_0_3[k]))) + ((t179[j] * ip_k_87_0_5[k]) + ((t183[j] * ip_k_87_0_4[k]) + (t180[j] * ip_k_87_0_1[k])))) + (((t185[j] * ip_k_87_0_2[k]) + ((t214[k] * ip_j_87_1_0[j]) + (t131[facet[1]][ip][j] * ip_k_87_1_1[k]))) + (((t207[k] * ip_j_87_1_2[j]) + (t220[k] * ip_j_87_1_1[j])) + ((t186[j] * ip_k_87_0_0[k]) + (t130[facet[1]][ip][j] * ip_k_87_1_0[k])))));

      }

    }

  }
  A[0][0] = A00[0][0];
  A[0][1] = A00[0][1];
  A[0][2] = A00[0][2];
  A[0][3] = A00[0][3];
  A[0][4] = A01[0][0];
  A[0][5] = A01[0][1];
  A[0][6] = A01[0][2];
  A[0][7] = A01[0][3];
  A[0][8] = A00[0][4];
  A[0][9] = A00[0][5];
  A[0][10] = A00[0][6];
  A[0][11] = A00[0][7];
  A[0][12] = A01[0][4];
  A[0][13] = A01[0][5];
  A[0][14] = A01[0][6];
  A[0][15] = A01[0][7];
  A[0][16] = A00[0][8];
  A[0][17] = A00[0][9];
  A[0][18] = A00[0][10];
  A[0][19] = A00[0][11];
  A[0][20] = A01[0][8];
  A[0][21] = A01[0][9];
  A[0][22] = A01[0][10];
  A[0][23] = A01[0][11];
  A[1][0] = A00[1][0];
  A[1][1] = A00[1][1];
  A[1][2] = A00[1][2];
  A[1][3] = A00[1][3];
  A[1][4] = A01[1][0];
  A[1][5] = A01[1][1];
  A[1][6] = A01[1][2];
  A[1][7] = A01[1][3];
  A[1][8] = A00[1][4];
  A[1][9] = A00[1][5];
  A[1][10] = A00[1][6];
  A[1][11] = A00[1][7];
  A[1][12] = A01[1][4];
  A[1][13] = A01[1][5];
  A[1][14] = A01[1][6];
  A[1][15] = A01[1][7];
  A[1][16] = A00[1][8];
  A[1][17] = A00[1][9];
  A[1][18] = A00[1][10];
  A[1][19] = A00[1][11];
  A[1][20] = A01[1][8];
  A[1][21] = A01[1][9];
  A[1][22] = A01[1][10];
  A[1][23] = A01[1][11];
  A[2][0] = A00[2][0];
  A[2][1] = A00[2][1];
  A[2][2] = A00[2][2];
  A[2][3] = A00[2][3];
  A[2][4] = A01[2][0];
  A[2][5] = A01[2][1];
  A[2][6] = A01[2][2];
  A[2][7] = A01[2][3];
  A[2][8] = A00[2][4];
  A[2][9] = A00[2][5];
  A[2][10] = A00[2][6];
  A[2][11] = A00[2][7];
  A[2][12] = A01[2][4];
  A[2][13] = A01[2][5];
  A[2][14] = A01[2][6];
  A[2][15] = A01[2][7];
  A[2][16] = A00[2][8];
  A[2][17] = A00[2][9];
  A[2][18] = A00[2][10];
  A[2][19] = A00[2][11];
  A[2][20] = A01[2][8];
  A[2][21] = A01[2][9];
  A[2][22] = A01[2][10];
  A[2][23] = A01[2][11];
  A[3][0] = A00[3][0];
  A[3][1] = A00[3][1];
  A[3][2] = A00[3][2];
  A[3][3] = A00[3][3];
  A[3][4] = A01[3][0];
  A[3][5] = A01[3][1];
  A[3][6] = A01[3][2];
  A[3][7] = A01[3][3];
  A[3][8] = A00[3][4];
  A[3][9] = A00[3][5];
  A[3][10] = A00[3][6];
  A[3][11] = A00[3][7];
  A[3][12] = A01[3][4];
  A[3][13] = A01[3][5];
  A[3][14] = A01[3][6];
  A[3][15] = A01[3][7];
  A[3][16] = A00[3][8];
  A[3][17] = A00[3][9];
  A[3][18] = A00[3][10];
  A[3][19] = A00[3][11];
  A[3][20] = A01[3][8];
  A[3][21] = A01[3][9];
  A[3][22] = A01[3][10];
  A[3][23] = A01[3][11];
  A[4][0] = A10[0][0];
  A[4][1] = A10[0][1];
  A[4][2] = A10[0][2];
  A[4][3] = A10[0][3];
  A[4][4] = A11[0][0];
  A[4][5] = A11[0][1];
  A[4][6] = A11[0][2];
  A[4][7] = A11[0][3];
  A[4][8] = A10[0][4];
  A[4][9] = A10[0][5];
  A[4][10] = A10[0][6];
  A[4][11] = A10[0][7];
  A[4][12] = A11[0][4];
  A[4][13] = A11[0][5];
  A[4][14] = A11[0][6];
  A[4][15] = A11[0][7];
  A[4][16] = A10[0][8];
  A[4][17] = A10[0][9];
  A[4][18] = A10[0][10];
  A[4][19] = A10[0][11];
  A[4][20] = A11[0][8];
  A[4][21] = A11[0][9];
  A[4][22] = A11[0][10];
  A[4][23] = A11[0][11];
  A[5][0] = A10[1][0];
  A[5][1] = A10[1][1];
  A[5][2] = A10[1][2];
  A[5][3] = A10[1][3];
  A[5][4] = A11[1][0];
  A[5][5] = A11[1][1];
  A[5][6] = A11[1][2];
  A[5][7] = A11[1][3];
  A[5][8] = A10[1][4];
  A[5][9] = A10[1][5];
  A[5][10] = A10[1][6];
  A[5][11] = A10[1][7];
  A[5][12] = A11[1][4];
  A[5][13] = A11[1][5];
  A[5][14] = A11[1][6];
  A[5][15] = A11[1][7];
  A[5][16] = A10[1][8];
  A[5][17] = A10[1][9];
  A[5][18] = A10[1][10];
  A[5][19] = A10[1][11];
  A[5][20] = A11[1][8];
  A[5][21] = A11[1][9];
  A[5][22] = A11[1][10];
  A[5][23] = A11[1][11];
  A[6][0] = A10[2][0];
  A[6][1] = A10[2][1];
  A[6][2] = A10[2][2];
  A[6][3] = A10[2][3];
  A[6][4] = A11[2][0];
  A[6][5] = A11[2][1];
  A[6][6] = A11[2][2];
  A[6][7] = A11[2][3];
  A[6][8] = A10[2][4];
  A[6][9] = A10[2][5];
  A[6][10] = A10[2][6];
  A[6][11] = A10[2][7];
  A[6][12] = A11[2][4];
  A[6][13] = A11[2][5];
  A[6][14] = A11[2][6];
  A[6][15] = A11[2][7];
  A[6][16] = A10[2][8];
  A[6][17] = A10[2][9];
  A[6][18] = A10[2][10];
  A[6][19] = A10[2][11];
  A[6][20] = A11[2][8];
  A[6][21] = A11[2][9];
  A[6][22] = A11[2][10];
  A[6][23] = A11[2][11];
  A[7][0] = A10[3][0];
  A[7][1] = A10[3][1];
  A[7][2] = A10[3][2];
  A[7][3] = A10[3][3];
  A[7][4] = A11[3][0];
  A[7][5] = A11[3][1];
  A[7][6] = A11[3][2];
  A[7][7] = A11[3][3];
  A[7][8] = A10[3][4];
  A[7][9] = A10[3][5];
  A[7][10] = A10[3][6];
  A[7][11] = A10[3][7];
  A[7][12] = A11[3][4];
  A[7][13] = A11[3][5];
  A[7][14] = A11[3][6];
  A[7][15] = A11[3][7];
  A[7][16] = A10[3][8];
  A[7][17] = A10[3][9];
  A[7][18] = A10[3][10];
  A[7][19] = A10[3][11];
  A[7][20] = A11[3][8];
  A[7][21] = A11[3][9];
  A[7][22] = A11[3][10];
  A[7][23] = A11[3][11];
  A[8][0] = A00[4][0];
  A[8][1] = A00[4][1];
  A[8][2] = A00[4][2];
  A[8][3] = A00[4][3];
  A[8][4] = A01[4][0];
  A[8][5] = A01[4][1];
  A[8][6] = A01[4][2];
  A[8][7] = A01[4][3];
  A[8][8] = A00[4][4];
  A[8][9] = A00[4][5];
  A[8][10] = A00[4][6];
  A[8][11] = A00[4][7];
  A[8][12] = A01[4][4];
  A[8][13] = A01[4][5];
  A[8][14] = A01[4][6];
  A[8][15] = A01[4][7];
  A[8][16] = A00[4][8];
  A[8][17] = A00[4][9];
  A[8][18] = A00[4][10];
  A[8][19] = A00[4][11];
  A[8][20] = A01[4][8];
  A[8][21] = A01[4][9];
  A[8][22] = A01[4][10];
  A[8][23] = A01[4][11];
  A[9][0] = A00[5][0];
  A[9][1] = A00[5][1];
  A[9][2] = A00[5][2];
  A[9][3] = A00[5][3];
  A[9][4] = A01[5][0];
  A[9][5] = A01[5][1];
  A[9][6] = A01[5][2];
  A[9][7] = A01[5][3];
  A[9][8] = A00[5][4];
  A[9][9] = A00[5][5];
  A[9][10] = A00[5][6];
  A[9][11] = A00[5][7];
  A[9][12] = A01[5][4];
  A[9][13] = A01[5][5];
  A[9][14] = A01[5][6];
  A[9][15] = A01[5][7];
  A[9][16] = A00[5][8];
  A[9][17] = A00[5][9];
  A[9][18] = A00[5][10];
  A[9][19] = A00[5][11];
  A[9][20] = A01[5][8];
  A[9][21] = A01[5][9];
  A[9][22] = A01[5][10];
  A[9][23] = A01[5][11];
  A[10][0] = A00[6][0];
  A[10][1] = A00[6][1];
  A[10][2] = A00[6][2];
  A[10][3] = A00[6][3];
  A[10][4] = A01[6][0];
  A[10][5] = A01[6][1];
  A[10][6] = A01[6][2];
  A[10][7] = A01[6][3];
  A[10][8] = A00[6][4];
  A[10][9] = A00[6][5];
  A[10][10] = A00[6][6];
  A[10][11] = A00[6][7];
  A[10][12] = A01[6][4];
  A[10][13] = A01[6][5];
  A[10][14] = A01[6][6];
  A[10][15] = A01[6][7];
  A[10][16] = A00[6][8];
  A[10][17] = A00[6][9];
  A[10][18] = A00[6][10];
  A[10][19] = A00[6][11];
  A[10][20] = A01[6][8];
  A[10][21] = A01[6][9];
  A[10][22] = A01[6][10];
  A[10][23] = A01[6][11];
  A[11][0] = A00[7][0];
  A[11][1] = A00[7][1];
  A[11][2] = A00[7][2];
  A[11][3] = A00[7][3];
  A[11][4] = A01[7][0];
  A[11][5] = A01[7][1];
  A[11][6] = A01[7][2];
  A[11][7] = A01[7][3];
  A[11][8] = A00[7][4];
  A[11][9] = A00[7][5];
  A[11][10] = A00[7][6];
  A[11][11] = A00[7][7];
  A[11][12] = A01[7][4];
  A[11][13] = A01[7][5];
  A[11][14] = A01[7][6];
  A[11][15] = A01[7][7];
  A[11][16] = A00[7][8];
  A[11][17] = A00[7][9];
  A[11][18] = A00[7][10];
  A[11][19] = A00[7][11];
  A[11][20] = A01[7][8];
  A[11][21] = A01[7][9];
  A[11][22] = A01[7][10];
  A[11][23] = A01[7][11];
  A[12][0] = A10[4][0];
  A[12][1] = A10[4][1];
  A[12][2] = A10[4][2];
  A[12][3] = A10[4][3];
  A[12][4] = A11[4][0];
  A[12][5] = A11[4][1];
  A[12][6] = A11[4][2];
  A[12][7] = A11[4][3];
  A[12][8] = A10[4][4];
  A[12][9] = A10[4][5];
  A[12][10] = A10[4][6];
  A[12][11] = A10[4][7];
  A[12][12] = A11[4][4];
  A[12][13] = A11[4][5];
  A[12][14] = A11[4][6];
  A[12][15] = A11[4][7];
  A[12][16] = A10[4][8];
  A[12][17] = A10[4][9];
  A[12][18] = A10[4][10];
  A[12][19] = A10[4][11];
  A[12][20] = A11[4][8];
  A[12][21] = A11[4][9];
  A[12][22] = A11[4][10];
  A[12][23] = A11[4][11];
  A[13][0] = A10[5][0];
  A[13][1] = A10[5][1];
  A[13][2] = A10[5][2];
  A[13][3] = A10[5][3];
  A[13][4] = A11[5][0];
  A[13][5] = A11[5][1];
  A[13][6] = A11[5][2];
  A[13][7] = A11[5][3];
  A[13][8] = A10[5][4];
  A[13][9] = A10[5][5];
  A[13][10] = A10[5][6];
  A[13][11] = A10[5][7];
  A[13][12] = A11[5][4];
  A[13][13] = A11[5][5];
  A[13][14] = A11[5][6];
  A[13][15] = A11[5][7];
  A[13][16] = A10[5][8];
  A[13][17] = A10[5][9];
  A[13][18] = A10[5][10];
  A[13][19] = A10[5][11];
  A[13][20] = A11[5][8];
  A[13][21] = A11[5][9];
  A[13][22] = A11[5][10];
  A[13][23] = A11[5][11];
  A[14][0] = A10[6][0];
  A[14][1] = A10[6][1];
  A[14][2] = A10[6][2];
  A[14][3] = A10[6][3];
  A[14][4] = A11[6][0];
  A[14][5] = A11[6][1];
  A[14][6] = A11[6][2];
  A[14][7] = A11[6][3];
  A[14][8] = A10[6][4];
  A[14][9] = A10[6][5];
  A[14][10] = A10[6][6];
  A[14][11] = A10[6][7];
  A[14][12] = A11[6][4];
  A[14][13] = A11[6][5];
  A[14][14] = A11[6][6];
  A[14][15] = A11[6][7];
  A[14][16] = A10[6][8];
  A[14][17] = A10[6][9];
  A[14][18] = A10[6][10];
  A[14][19] = A10[6][11];
  A[14][20] = A11[6][8];
  A[14][21] = A11[6][9];
  A[14][22] = A11[6][10];
  A[14][23] = A11[6][11];
  A[15][0] = A10[7][0];
  A[15][1] = A10[7][1];
  A[15][2] = A10[7][2];
  A[15][3] = A10[7][3];
  A[15][4] = A11[7][0];
  A[15][5] = A11[7][1];
  A[15][6] = A11[7][2];
  A[15][7] = A11[7][3];
  A[15][8] = A10[7][4];
  A[15][9] = A10[7][5];
  A[15][10] = A10[7][6];
  A[15][11] = A10[7][7];
  A[15][12] = A11[7][4];
  A[15][13] = A11[7][5];
  A[15][14] = A11[7][6];
  A[15][15] = A11[7][7];
  A[15][16] = A10[7][8];
  A[15][17] = A10[7][9];
  A[15][18] = A10[7][10];
  A[15][19] = A10[7][11];
  A[15][20] = A11[7][8];
  A[15][21] = A11[7][9];
  A[15][22] = A11[7][10];
  A[15][23] = A11[7][11];
  A[16][0] = A00[8][0];
  A[16][1] = A00[8][1];
  A[16][2] = A00[8][2];
  A[16][3] = A00[8][3];
  A[16][4] = A01[8][0];
  A[16][5] = A01[8][1];
  A[16][6] = A01[8][2];
  A[16][7] = A01[8][3];
  A[16][8] = A00[8][4];
  A[16][9] = A00[8][5];
  A[16][10] = A00[8][6];
  A[16][11] = A00[8][7];
  A[16][12] = A01[8][4];
  A[16][13] = A01[8][5];
  A[16][14] = A01[8][6];
  A[16][15] = A01[8][7];
  A[16][16] = A00[8][8];
  A[16][17] = A00[8][9];
  A[16][18] = A00[8][10];
  A[16][19] = A00[8][11];
  A[16][20] = A01[8][8];
  A[16][21] = A01[8][9];
  A[16][22] = A01[8][10];
  A[16][23] = A01[8][11];
  A[17][0] = A00[9][0];
  A[17][1] = A00[9][1];
  A[17][2] = A00[9][2];
  A[17][3] = A00[9][3];
  A[17][4] = A01[9][0];
  A[17][5] = A01[9][1];
  A[17][6] = A01[9][2];
  A[17][7] = A01[9][3];
  A[17][8] = A00[9][4];
  A[17][9] = A00[9][5];
  A[17][10] = A00[9][6];
  A[17][11] = A00[9][7];
  A[17][12] = A01[9][4];
  A[17][13] = A01[9][5];
  A[17][14] = A01[9][6];
  A[17][15] = A01[9][7];
  A[17][16] = A00[9][8];
  A[17][17] = A00[9][9];
  A[17][18] = A00[9][10];
  A[17][19] = A00[9][11];
  A[17][20] = A01[9][8];
  A[17][21] = A01[9][9];
  A[17][22] = A01[9][10];
  A[17][23] = A01[9][11];
  A[18][0] = A00[10][0];
  A[18][1] = A00[10][1];
  A[18][2] = A00[10][2];
  A[18][3] = A00[10][3];
  A[18][4] = A01[10][0];
  A[18][5] = A01[10][1];
  A[18][6] = A01[10][2];
  A[18][7] = A01[10][3];
  A[18][8] = A00[10][4];
  A[18][9] = A00[10][5];
  A[18][10] = A00[10][6];
  A[18][11] = A00[10][7];
  A[18][12] = A01[10][4];
  A[18][13] = A01[10][5];
  A[18][14] = A01[10][6];
  A[18][15] = A01[10][7];
  A[18][16] = A00[10][8];
  A[18][17] = A00[10][9];
  A[18][18] = A00[10][10];
  A[18][19] = A00[10][11];
  A[18][20] = A01[10][8];
  A[18][21] = A01[10][9];
  A[18][22] = A01[10][10];
  A[18][23] = A01[10][11];
  A[19][0] = A00[11][0];
  A[19][1] = A00[11][1];
  A[19][2] = A00[11][2];
  A[19][3] = A00[11][3];
  A[19][4] = A01[11][0];
  A[19][5] = A01[11][1];
  A[19][6] = A01[11][2];
  A[19][7] = A01[11][3];
  A[19][8] = A00[11][4];
  A[19][9] = A00[11][5];
  A[19][10] = A00[11][6];
  A[19][11] = A00[11][7];
  A[19][12] = A01[11][4];
  A[19][13] = A01[11][5];
  A[19][14] = A01[11][6];
  A[19][15] = A01[11][7];
  A[19][16] = A00[11][8];
  A[19][17] = A00[11][9];
  A[19][18] = A00[11][10];
  A[19][19] = A00[11][11];
  A[19][20] = A01[11][8];
  A[19][21] = A01[11][9];
  A[19][22] = A01[11][10];
  A[19][23] = A01[11][11];
  A[20][0] = A10[8][0];
  A[20][1] = A10[8][1];
  A[20][2] = A10[8][2];
  A[20][3] = A10[8][3];
  A[20][4] = A11[8][0];
  A[20][5] = A11[8][1];
  A[20][6] = A11[8][2];
  A[20][7] = A11[8][3];
  A[20][8] = A10[8][4];
  A[20][9] = A10[8][5];
  A[20][10] = A10[8][6];
  A[20][11] = A10[8][7];
  A[20][12] = A11[8][4];
  A[20][13] = A11[8][5];
  A[20][14] = A11[8][6];
  A[20][15] = A11[8][7];
  A[20][16] = A10[8][8];
  A[20][17] = A10[8][9];
  A[20][18] = A10[8][10];
  A[20][19] = A10[8][11];
  A[20][20] = A11[8][8];
  A[20][21] = A11[8][9];
  A[20][22] = A11[8][10];
  A[20][23] = A11[8][11];
  A[21][0] = A10[9][0];
  A[21][1] = A10[9][1];
  A[21][2] = A10[9][2];
  A[21][3] = A10[9][3];
  A[21][4] = A11[9][0];
  A[21][5] = A11[9][1];
  A[21][6] = A11[9][2];
  A[21][7] = A11[9][3];
  A[21][8] = A10[9][4];
  A[21][9] = A10[9][5];
  A[21][10] = A10[9][6];
  A[21][11] = A10[9][7];
  A[21][12] = A11[9][4];
  A[21][13] = A11[9][5];
  A[21][14] = A11[9][6];
  A[21][15] = A11[9][7];
  A[21][16] = A10[9][8];
  A[21][17] = A10[9][9];
  A[21][18] = A10[9][10];
  A[21][19] = A10[9][11];
  A[21][20] = A11[9][8];
  A[21][21] = A11[9][9];
  A[21][22] = A11[9][10];
  A[21][23] = A11[9][11];
  A[22][0] = A10[10][0];
  A[22][1] = A10[10][1];
  A[22][2] = A10[10][2];
  A[22][3] = A10[10][3];
  A[22][4] = A11[10][0];
  A[22][5] = A11[10][1];
  A[22][6] = A11[10][2];
  A[22][7] = A11[10][3];
  A[22][8] = A10[10][4];
  A[22][9] = A10[10][5];
  A[22][10] = A10[10][6];
  A[22][11] = A10[10][7];
  A[22][12] = A11[10][4];
  A[22][13] = A11[10][5];
  A[22][14] = A11[10][6];
  A[22][15] = A11[10][7];
  A[22][16] = A10[10][8];
  A[22][17] = A10[10][9];
  A[22][18] = A10[10][10];
  A[22][19] = A10[10][11];
  A[22][20] = A11[10][8];
  A[22][21] = A11[10][9];
  A[22][22] = A11[10][10];
  A[22][23] = A11[10][11];
  A[23][0] = A10[11][0];
  A[23][1] = A10[11][1];
  A[23][2] = A10[11][2];
  A[23][3] = A10[11][3];
  A[23][4] = A11[11][0];
  A[23][5] = A11[11][1];
  A[23][6] = A11[11][2];
  A[23][7] = A11[11][3];
  A[23][8] = A10[11][4];
  A[23][9] = A10[11][5];
  A[23][10] = A10[11][6];
  A[23][11] = A10[11][7];
  A[23][12] = A11[11][4];
  A[23][13] = A11[11][5];
  A[23][14] = A11[11][6];
  A[23][15] = A11[11][7];
  A[23][16] = A10[11][8];
  A[23][17] = A10[11][9];
  A[23][18] = A10[11][10];
  A[23][19] = A10[11][11];
  A[23][20] = A11[11][8];
  A[23][21] = A11[11][9];
  A[23][22] = A11[11][10];
  A[23][23] = A11[11][11];

}



        void wrap_form00_interior_facet_integral_otherwise(int start, int end,
                      Mat arg0_0_, int *arg0_0_map0_0, int *arg0_0_map1_0, double *arg1_0, int *arg1_0_map0_0, double *arg2_0, int *arg2_0_map0_0, unsigned int *arg3_0
                      ) {
  Mat arg0_0_0 = arg0_0_;
  double *arg1_0_vec[24];
    double *arg2_0_vec[24];
  for ( int n = start; n < end; n++ ) {
    int i = n;
    arg1_0_vec[0] = arg1_0 + (arg1_0_map0_0[i * 8 + 0])* 3;
    arg1_0_vec[1] = arg1_0 + (arg1_0_map0_0[i * 8 + 1])* 3;
    arg1_0_vec[2] = arg1_0 + (arg1_0_map0_0[i * 8 + 2])* 3;
    arg1_0_vec[3] = arg1_0 + (arg1_0_map0_0[i * 8 + 3])* 3;
    arg1_0_vec[4] = arg1_0 + (arg1_0_map0_0[i * 8 + 4])* 3;
    arg1_0_vec[5] = arg1_0 + (arg1_0_map0_0[i * 8 + 5])* 3;
    arg1_0_vec[6] = arg1_0 + (arg1_0_map0_0[i * 8 + 6])* 3;
    arg1_0_vec[7] = arg1_0 + (arg1_0_map0_0[i * 8 + 7])* 3;
    arg1_0_vec[8] = arg1_0 + (arg1_0_map0_0[i * 8 + 0])* 3 + 1;
    arg1_0_vec[9] = arg1_0 + (arg1_0_map0_0[i * 8 + 1])* 3 + 1;
    arg1_0_vec[10] = arg1_0 + (arg1_0_map0_0[i * 8 + 2])* 3 + 1;
    arg1_0_vec[11] = arg1_0 + (arg1_0_map0_0[i * 8 + 3])* 3 + 1;
    arg1_0_vec[12] = arg1_0 + (arg1_0_map0_0[i * 8 + 4])* 3 + 1;
    arg1_0_vec[13] = arg1_0 + (arg1_0_map0_0[i * 8 + 5])* 3 + 1;
    arg1_0_vec[14] = arg1_0 + (arg1_0_map0_0[i * 8 + 6])* 3 + 1;
    arg1_0_vec[15] = arg1_0 + (arg1_0_map0_0[i * 8 + 7])* 3 + 1;
    arg1_0_vec[16] = arg1_0 + (arg1_0_map0_0[i * 8 + 0])* 3 + 2;
    arg1_0_vec[17] = arg1_0 + (arg1_0_map0_0[i * 8 + 1])* 3 + 2;
    arg1_0_vec[18] = arg1_0 + (arg1_0_map0_0[i * 8 + 2])* 3 + 2;
    arg1_0_vec[19] = arg1_0 + (arg1_0_map0_0[i * 8 + 3])* 3 + 2;
    arg1_0_vec[20] = arg1_0 + (arg1_0_map0_0[i * 8 + 4])* 3 + 2;
    arg1_0_vec[21] = arg1_0 + (arg1_0_map0_0[i * 8 + 5])* 3 + 2;
    arg1_0_vec[22] = arg1_0 + (arg1_0_map0_0[i * 8 + 6])* 3 + 2;
    arg1_0_vec[23] = arg1_0 + (arg1_0_map0_0[i * 8 + 7])* 3 + 2;
    arg2_0_vec[0] = arg2_0 + (arg2_0_map0_0[i * 8 + 0])* 3;
    arg2_0_vec[1] = arg2_0 + (arg2_0_map0_0[i * 8 + 1])* 3;
    arg2_0_vec[2] = arg2_0 + (arg2_0_map0_0[i * 8 + 2])* 3;
    arg2_0_vec[3] = arg2_0 + (arg2_0_map0_0[i * 8 + 3])* 3;
    arg2_0_vec[4] = arg2_0 + (arg2_0_map0_0[i * 8 + 4])* 3;
    arg2_0_vec[5] = arg2_0 + (arg2_0_map0_0[i * 8 + 5])* 3;
    arg2_0_vec[6] = arg2_0 + (arg2_0_map0_0[i * 8 + 6])* 3;
    arg2_0_vec[7] = arg2_0 + (arg2_0_map0_0[i * 8 + 7])* 3;
    arg2_0_vec[8] = arg2_0 + (arg2_0_map0_0[i * 8 + 0])* 3 + 1;
    arg2_0_vec[9] = arg2_0 + (arg2_0_map0_0[i * 8 + 1])* 3 + 1;
    arg2_0_vec[10] = arg2_0 + (arg2_0_map0_0[i * 8 + 2])* 3 + 1;
    arg2_0_vec[11] = arg2_0 + (arg2_0_map0_0[i * 8 + 3])* 3 + 1;
    arg2_0_vec[12] = arg2_0 + (arg2_0_map0_0[i * 8 + 4])* 3 + 1;
    arg2_0_vec[13] = arg2_0 + (arg2_0_map0_0[i * 8 + 5])* 3 + 1;
    arg2_0_vec[14] = arg2_0 + (arg2_0_map0_0[i * 8 + 6])* 3 + 1;
    arg2_0_vec[15] = arg2_0 + (arg2_0_map0_0[i * 8 + 7])* 3 + 1;
    arg2_0_vec[16] = arg2_0 + (arg2_0_map0_0[i * 8 + 0])* 3 + 2;
    arg2_0_vec[17] = arg2_0 + (arg2_0_map0_0[i * 8 + 1])* 3 + 2;
    arg2_0_vec[18] = arg2_0 + (arg2_0_map0_0[i * 8 + 2])* 3 + 2;
    arg2_0_vec[19] = arg2_0 + (arg2_0_map0_0[i * 8 + 3])* 3 + 2;
    arg2_0_vec[20] = arg2_0 + (arg2_0_map0_0[i * 8 + 4])* 3 + 2;
    arg2_0_vec[21] = arg2_0 + (arg2_0_map0_0[i * 8 + 5])* 3 + 2;
    arg2_0_vec[22] = arg2_0 + (arg2_0_map0_0[i * 8 + 6])* 3 + 2;
    arg2_0_vec[23] = arg2_0 + (arg2_0_map0_0[i * 8 + 7])* 3 + 2;
    double buffer_arg0_0[24][24] __attribute__((aligned(16))) = {{0.0}};
    form00_interior_facet_integral_otherwise(buffer_arg0_0, arg1_0_vec, arg2_0_vec, arg3_0 + (i * 2));
                    double tmp_buffer_arg0_0[24][24] __attribute__((aligned(16)));
                    for ( int j = 0; j < 8; j++ ) {
                       for ( int k = 0; k < 3; k++ ) {
                          for ( int l = 0; l < 8; l++ ) {
                             for ( int m = 0; m < 3; m++ ) {
                                tmp_buffer_arg0_0[3*j + k][3*l + m] = buffer_arg0_0[j + 8*k][l + 8*m];
                             }
                          }
                       }
                    }
    MatSetValuesBlockedLocal(arg0_0_0, 8, arg0_0_map0_0 + i * 8,
                                             8, arg0_0_map1_0 + i * 8,
                                             (const PetscScalar *)tmp_buffer_arg0_0,
                                             ADD_VALUES);;
  }
}
        ```

and

```c

        #include <petsc.h>
        #include <stdbool.h>
        #include <math.h>



            #include <immintrin.h>

static inline void form00_interior_facet_integral_otherwise (double  A[24][24] , const double *restrict *restrict coords , const double *restrict *restrict w_0_ , const unsigned int  facet[2] )
{
  double  A00[12][12]  = {0.0};
  double  A01[12][12]  = {0.0};
  double  A10[12][12]  = {0.0};
  double  A11[12][12]  = {0.0};
  double  w_0[2][12] ;

  for (int  i  = 0; i < 4; i += 1)
  {
    w_0[0][i] = w_0_[i][0];

  }

  for (int  i  = 0; i < 4; i += 1)
  {
    w_0[1][i] = w_0_[i+4][0];

  }

  for (int  i  = 0; i < 4; i += 1)
  {
    w_0[0][i+4] = w_0_[i+8][0];

  }

  for (int  i  = 0; i < 4; i += 1)
  {
    w_0[1][i+4] = w_0_[i+12][0];

  }

  for (int  i  = 0; i < 4; i += 1)
  {
    w_0[0][i+8] = w_0_[i+16][0];
    w_0[1][i+8] = w_0_[i+20][0];

  }
  double  t143[12] ;
  double  t146[12] ;
  double  t149[12] ;
  double  t150[12] ;
  double  t152[12] ;
  double  t155[12] ;
  double  t156[12] ;
  double  t157[12] ;
  double  t159[12] ;
  double  t161[12] ;
  double  t164[12] ;
  double  t167[12] ;
  double  t168[12] ;
  double  t170[12] ;
  double  t173[12] ;
  double  t174[12] ;
  double  t175[12] ;
  double  t177[12] ;
  double  t178[12] ;
  double  t179[12] ;
  double  t180[12] ;
  double  t181[12] ;
  double  t182[12] ;
  double  t183[12] ;
  double  t184[12] ;
  double  t185[12] ;
  double  t186[12] ;
  double  t187[12] ;
  double  t188[12] ;
  double  t189[12] ;
  double  t190[12] ;
  double  t191[12] ;
  double  t192[12] ;
  double  t193[12] ;
  double  t194[12] ;
  double  t195[12] ;
  double  t0  = (-1 * coords[0][0]);
  double  t1  = (t0 + (1 * coords[2][0]));
  double  t2  = (-1 * t1);
  double  t3  = (t0 + (1 * coords[3][0]));
  double  t4  = (1 * t3);
  double  t5  = (t2 + t4);
  double  t6  = (-1 * coords[8][0]);
  double  t7  = (t6 + (1 * coords[10][0]));
  double  t8  = (t6 + (1 * coords[11][0]));
  double  t9  = (1 * t8);
  double  t10  = ((-1 * t7) + t9);
  double  t11  = (-1 * coords[16][0]);
  double  t12  = (t11 + (1 * coords[18][0]));
  double  t13  = (t11 + (1 * coords[19][0]));
  double  t14  = (1 * t13);
  double  t15  = ((-1 * t12) + t14);
  double  t16  = (t0 + (1 * coords[1][0]));
  double  t17  = (1 * t16);
  double  t18  = (t6 + (1 * coords[9][0]));
  double  t19  = (1 * t18);
  double  t20  = (t11 + (1 * coords[17][0]));
  double  t21  = (1 * t20);
  double  t22  = (sqrt(((t5 * t5) + (t10 * t10)) + (t15 * t15)) * sqrt(((t17 * t17) + (t19 * t19)) + (t21 * t21)));
  double  t23  = (-1 * t16);
  double  t24  = (1 * t1);
  double  t25  = (t23 + t24);
  double  t26  = (-1 * t18);
  double  t27  = (1 * t7);
  double  t28  = (t26 + t27);
  double  t29  = (-1 * t20);
  double  t30  = (1 * t12);
  double  t31  = (t29 + t30);
  double  t32  = (sqrt(((t25 * t25) + (t28 * t28)) + (t31 * t31)) * sqrt(((t4 * t4) + (t9 * t9)) + (t14 * t14)));
  double  t33  = (t23 + t4);
  double  t34  = (t26 + t9);
  double  t35  = (t29 + t14);
  double  t36  = (sqrt(((t33 * t33) + (t34 * t34)) + (t35 * t35)) * sqrt(((t24 * t24) + (t27 * t27)) + (t30 * t30)));
  double  t37  = (((t32 + t36) + t22) / 2);
  double  t38  = ((t7 * t13) + (-1 * (t8 * t12)));
  double  t39  = (t8 * t20);
  double  t40  = ((t18 * t12) + (-1 * (t7 * t20)));
  double  t41  = (((t16 * t38) + (t1 * (t39 + (-1 * (t18 * t13))))) + (t3 * t40));
  double  t42  = (-1 * coords[4][0]);
  double  t43  = (t42 + (1 * coords[6][0]));
  double  t44  = (-1 * t43);
  double  t45  = (t42 + (1 * coords[7][0]));
  double  t46  = (1 * t45);
  double  t47  = (t44 + t46);
  double  t48  = (-1 * coords[12][0]);
  double  t49  = (t48 + (1 * coords[14][0]));
  double  t50  = (t48 + (1 * coords[15][0]));
  double  t51  = (1 * t50);
  double  t52  = ((-1 * t49) + t51);
  double  t53  = (-1 * coords[20][0]);
  double  t54  = (t53 + (1 * coords[22][0]));
  double  t55  = (t53 + (1 * coords[23][0]));
  double  t56  = (1 * t55);
  double  t57  = ((-1 * t54) + t56);
  double  t58  = (t42 + (1 * coords[5][0]));
  double  t59  = (1 * t58);
  double  t60  = (t48 + (1 * coords[13][0]));
  double  t61  = (1 * t60);
  double  t62  = (t53 + (1 * coords[21][0]));
  double  t63  = (1 * t62);
  double  t64  = (sqrt(((t47 * t47) + (t52 * t52)) + (t57 * t57)) * sqrt(((t59 * t59) + (t61 * t61)) + (t63 * t63)));
  double  t65  = (-1 * t58);
  double  t66  = (1 * t43);
  double  t67  = (t65 + t66);
  double  t68  = (-1 * t60);
  double  t69  = (1 * t49);
  double  t70  = (t68 + t69);
  double  t71  = (-1 * t62);
  double  t72  = (1 * t54);
  double  t73  = (t71 + t72);
  double  t74  = (sqrt(((t67 * t67) + (t70 * t70)) + (t73 * t73)) * sqrt(((t46 * t46) + (t51 * t51)) + (t56 * t56)));
  double  t75  = (t65 + t46);
  double  t76  = (t68 + t51);
  double  t77  = (t71 + t56);
  double  t78  = (sqrt(((t75 * t75) + (t76 * t76)) + (t77 * t77)) * sqrt(((t66 * t66) + (t69 * t69)) + (t72 * t72)));
  double  t79  = (((t74 + t78) + t64) / 2);
  double  t80  = ((t49 * t55) + (-1 * (t50 * t54)));
  double  t81  = (t50 * t62);
  double  t82  = ((t60 * t54) + (-1 * (t49 * t62)));
  double  t83  = (((t58 * t80) + (t43 * (t81 + (-1 * (t60 * t55))))) + (t45 * t82));
  double  t84  = (340.27690917706 / (0.5 * ((2 * (sqrt(((-1 * t22) + t37) * (((-1 * t36) + t37) * (((-1 * t32) + t37) * t37))) / (6 * (0.16666666666667 * fabs(t41))))) + (2 * (sqrt(((-1 * t64) + t79) * (((-1 * t78) + t79) * (((-1 * t74) + t79) * t79))) / (6 * (0.16666666666667 * fabs(t83))))))));
  double  t85  = (t38 / t41);
  static const double  t86[4][3]  = {{1.0, 1.0, 1.0}, 
  {-1.0, 0.0, 0.0}, 
  {0.0, -1.0, 0.0}, 
  {0.0, 0.0, -1.0}};
  double  t87  = ((t39 + (t18 * (-1 * t13))) / t41);
  double  t88  = (t40 / t41);
  double  t89  = (((t85 * t86[facet[0]][0]) + (t87 * t86[facet[0]][1])) + (t88 * t86[facet[0]][2]));
  double  t90  = (((t3 * t12) + (t13 * t2)) / t41);
  double  t91  = (((t16 * t13) + (t20 * (-1 * t3))) / t41);
  double  t92  = (((t1 * t20) + (-1 * (t16 * t12))) / t41);
  double  t93  = (((t90 * t86[facet[0]][0]) + (t91 * t86[facet[0]][1])) + (t92 * t86[facet[0]][2]));
  double  t94  = (((t1 * t8) + (-1 * (t3 * t7))) / t41);
  double  t95  = (((t3 * t18) + (-1 * (t16 * t8))) / t41);
  double  t96  = (((t16 * t7) + (-1 * (t1 * t18))) / t41);
  double  t97  = (((t94 * t86[facet[0]][0]) + (t95 * t86[facet[0]][1])) + (t96 * t86[facet[0]][2]));
  double  t98  = sqrt(((t89 * t89) + (t93 * t93)) + (t97 * t97));
  double  t99  = (t89 / t98);
  double  t100  = (t93 / t98);
  double  t101  = (t97 / t98);
  double  t102  = (t80 / t83);
  double  t103  = ((t81 + (t60 * (-1 * t55))) / t83);
  double  t104  = (t82 / t83);
  double  t105  = (((t102 * t86[facet[1]][0]) + (t103 * t86[facet[1]][1])) + (t104 * t86[facet[1]][2]));
  double  t106  = (((t45 * t54) + (t55 * t44)) / t83);
  double  t107  = (((t58 * t55) + (t62 * (-1 * t45))) / t83);
  double  t108  = (((t43 * t62) + (-1 * (t58 * t54))) / t83);
  double  t109  = (((t106 * t86[facet[1]][0]) + (t107 * t86[facet[1]][1])) + (t108 * t86[facet[1]][2]));
  double  t110  = (((t43 * t50) + (-1 * (t45 * t49))) / t83);
  double  t111  = (((t45 * t60) + (-1 * (t58 * t50))) / t83);
  double  t112  = (((t58 * t49) + (-1 * (t43 * t60))) / t83);
  double  t113  = (((t110 * t86[facet[1]][0]) + (t111 * t86[facet[1]][1])) + (t112 * t86[facet[1]][2]));
  double  t114  = sqrt(((t105 * t105) + (t109 * t109)) + (t113 * t113));
  double  t115  = (t113 / t114);
  double  t116  = (t109 / t114);
  double  t117  = (t105 / t114);
  static const double  t118[4][3][2]  = {{{-1.0, -1.0}, 
  {1.0, 0.0}, 
  {0.0, 1.0}}, 
  {{0.0, 0.0}, 
  {1.0, 0.0}, 
  {0.0, 1.0}}, 
  {{1.0, 0.0}, 
  {0.0, 0.0}, 
  {0.0, 1.0}}, 
  {{1.0, 0.0}, 
  {0.0, 1.0}, 
  {0.0, 0.0}}};
  double  t119  = (((t118[facet[0]][0][0] * t18) + (t118[facet[0]][1][0] * t7)) + (t118[facet[0]][2][0] * t8));
  double  t120  = (((t118[facet[0]][0][1] * t20) + (t118[facet[0]][1][1] * t12)) + (t118[facet[0]][2][1] * t13));
  double  t121  = (((t118[facet[0]][0][1] * t18) + (t118[facet[0]][1][1] * t7)) + (t118[facet[0]][2][1] * t8));
  double  t122  = (((t118[facet[0]][0][0] * t20) + (t118[facet[0]][1][0] * t12)) + (t118[facet[0]][2][0] * t13));
  double  t123  = ((t119 * t120) + (-1 * (t121 * t122)));
  double  t124  = (((t118[facet[0]][0][1] * t16) + (t118[facet[0]][1][1] * t1)) + (t118[facet[0]][2][1] * t3));
  double  t125  = (((t118[facet[0]][0][0] * t16) + (t118[facet[0]][1][0] * t1)) + (t118[facet[0]][2][0] * t3));
  double  t126  = ((t124 * t122) + (-1 * (t125 * t120)));
  double  t127  = ((t125 * t121) + (-1 * (t124 * t119)));
  double  t128  = sqrt(((t123 * t123) + (t126 * t126)) + (t127 * t127));
  static const double  t129[7]  = {0.1125, 0.0629695902724136, 0.0629695902724136, 0.0629695902724136, 0.0661970763942531, 0.0661970763942531, 0.0661970763942531};
  static const double  t130[4][7][12]  = {{{0.0, 0.333333333333333, 0.333333333333333, 0.333333333333333, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.101286507323456, 0.797426985353087, 0.101286507323456, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.101286507323456, 0.101286507323456, 0.797426985353087, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.797426985353087, 0.101286507323456, 0.101286507323456, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.470142064105115, 0.0597158717897697, 0.470142064105115, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.470142064105115, 0.470142064105115, 0.0597158717897698, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0597158717897699, 0.470142064105115, 0.470142064105115, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}}, 
  {{0.333333333333333, 0.0, 0.333333333333333, 0.333333333333333, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.101286507323457, 0.0, 0.797426985353087, 0.101286507323456, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.101286507323457, 0.0, 0.101286507323456, 0.797426985353087, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.797426985353087, 0.0, 0.101286507323456, 0.101286507323456, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.470142064105115, 0.0, 0.0597158717897697, 0.470142064105115, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.470142064105115, 0.0, 0.470142064105115, 0.0597158717897698, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0597158717897699, 0.0, 0.470142064105115, 0.470142064105115, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}}, 
  {{0.333333333333333, 0.333333333333333, 0.0, 0.333333333333333, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.101286507323457, 0.797426985353087, 0.0, 0.101286507323456, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.101286507323457, 0.101286507323456, 0.0, 0.797426985353087, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.797426985353087, 0.101286507323456, 0.0, 0.101286507323456, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.470142064105115, 0.0597158717897698, 0.0, 0.470142064105115, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.470142064105115, 0.470142064105115, 0.0, 0.0597158717897698, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.05971587178977, 0.470142064105115, 0.0, 0.470142064105115, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}}, 
  {{0.333333333333333, 0.333333333333333, 0.333333333333333, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.101286507323457, 0.797426985353087, 0.101286507323456, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.101286507323456, 0.101286507323456, 0.797426985353087, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.797426985353087, 0.101286507323456, 0.101286507323456, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.470142064105115, 0.0597158717897697, 0.470142064105115, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.470142064105115, 0.470142064105115, 0.0597158717897698, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.05971587178977, 0.470142064105115, 0.470142064105115, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}}};
  static const double  t131[4][7][12]  = {{{0.0, 0.0, 0.0, 0.0, 0.0, 0.333333333333333, 0.333333333333333, 0.333333333333333, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.101286507323456, 0.797426985353087, 0.101286507323456, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.101286507323456, 0.101286507323456, 0.797426985353087, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.797426985353087, 0.101286507323456, 0.101286507323456, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.0597158717897697, 0.470142064105115, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.470142064105115, 0.0597158717897698, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0597158717897699, 0.470142064105115, 0.470142064105115, 0.0, 0.0, 0.0, 0.0}}, 
  {{0.0, 0.0, 0.0, 0.0, 0.333333333333333, 0.0, 0.333333333333333, 0.333333333333333, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.101286507323457, 0.0, 0.797426985353087, 0.101286507323456, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.101286507323457, 0.0, 0.101286507323456, 0.797426985353087, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.797426985353087, 0.0, 0.101286507323456, 0.101286507323456, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.0, 0.0597158717897697, 0.470142064105115, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.0, 0.470142064105115, 0.0597158717897698, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0597158717897699, 0.0, 0.470142064105115, 0.470142064105115, 0.0, 0.0, 0.0, 0.0}}, 
  {{0.0, 0.0, 0.0, 0.0, 0.333333333333333, 0.333333333333333, 0.0, 0.333333333333333, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.101286507323457, 0.797426985353087, 0.0, 0.101286507323456, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.101286507323457, 0.101286507323456, 0.0, 0.797426985353087, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.797426985353087, 0.101286507323456, 0.0, 0.101286507323456, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.0597158717897698, 0.0, 0.470142064105115, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.470142064105115, 0.0, 0.0597158717897698, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.05971587178977, 0.470142064105115, 0.0, 0.470142064105115, 0.0, 0.0, 0.0, 0.0}}, 
  {{0.0, 0.0, 0.0, 0.0, 0.333333333333333, 0.333333333333333, 0.333333333333333, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.101286507323457, 0.797426985353087, 0.101286507323456, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.101286507323456, 0.101286507323456, 0.797426985353087, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.797426985353087, 0.101286507323456, 0.101286507323456, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.0597158717897697, 0.470142064105115, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.470142064105115, 0.0597158717897698, 0.0, 0.0, 0.0, 0.0, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.05971587178977, 0.470142064105115, 0.470142064105115, 0.0, 0.0, 0.0, 0.0, 0.0}}};
  static const double  t132[4][7][12]  = {{{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.333333333333333, 0.333333333333333, 0.333333333333333}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.101286507323456, 0.797426985353087, 0.101286507323456}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.101286507323456, 0.101286507323456, 0.797426985353087}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.797426985353087, 0.101286507323456, 0.101286507323456}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.0597158717897697, 0.470142064105115}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.470142064105115, 0.0597158717897698}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0597158717897699, 0.470142064105115, 0.470142064105115}}, 
  {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.333333333333333, 0.0, 0.333333333333333, 0.333333333333333}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.101286507323457, 0.0, 0.797426985353087, 0.101286507323456}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.101286507323457, 0.0, 0.101286507323456, 0.797426985353087}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.797426985353087, 0.0, 0.101286507323456, 0.101286507323456}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.0, 0.0597158717897697, 0.470142064105115}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.0, 0.470142064105115, 0.0597158717897698}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0597158717897699, 0.0, 0.470142064105115, 0.470142064105115}}, 
  {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.333333333333333, 0.333333333333333, 0.0, 0.333333333333333}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.101286507323457, 0.797426985353087, 0.0, 0.101286507323456}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.101286507323457, 0.101286507323456, 0.0, 0.797426985353087}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.797426985353087, 0.101286507323456, 0.0, 0.101286507323456}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.0597158717897698, 0.0, 0.470142064105115}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.470142064105115, 0.0, 0.0597158717897698}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.05971587178977, 0.470142064105115, 0.0, 0.470142064105115}}, 
  {{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.333333333333333, 0.333333333333333, 0.333333333333333, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.101286507323457, 0.797426985353087, 0.101286507323456, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.101286507323456, 0.101286507323456, 0.797426985353087, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.797426985353087, 0.101286507323456, 0.101286507323456, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.0597158717897697, 0.470142064105115, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.470142064105115, 0.470142064105115, 0.0597158717897698, 0.0}, 
  {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.05971587178977, 0.470142064105115, 0.470142064105115, 0.0}}};
  static const double  t133[12]  = {-1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
  static const double  t134[12]  = {-1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
  static const double  t135[12]  = {-1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
  static const double  t136[12]  = {0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0};
  static const double  t137[12]  = {0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0};
  static const double  t138[12]  = {0.0, 0.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
  static const double  t139[12]  = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 1.0};
  static const double  t140[12]  = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0};
  static const double  t141[12]  = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 1.0, 0.0, 0.0};

  for (int  k  = 0; k < 12; k += 1)
  {
    double  t142  = (((t110 * t141[k]) + (t111 * t140[k])) + (t112 * t139[k]));
    t143[k] = 0.5 * (1.81e-05 * (t142 + t142));
    double  t144  = (((t106 * t141[k]) + (t107 * t140[k])) + (t108 * t139[k]));
    double  t145  = (((t110 * t138[k]) + (t111 * t137[k])) + (t112 * t136[k]));
    t146[k] = 0.5 * (1.81e-05 * (t144 + t145));
    double  t147  = (((t102 * t141[k]) + (t103 * t140[k])) + (t104 * t139[k]));
    double  t148  = (((t110 * t135[k]) + (t111 * t134[k])) + (t112 * t133[k]));
    t149[k] = 0.5 * (1.81e-05 * (t147 + t148));
    t150[k] = 0.5 * (1.81e-05 * (t145 + t144));
    double  t151  = (((t106 * t138[k]) + (t107 * t137[k])) + (t108 * t136[k]));
    t152[k] = 0.5 * (1.81e-05 * (t151 + t151));
    double  t153  = (((t102 * t138[k]) + (t103 * t137[k])) + (t104 * t136[k]));
    double  t154  = (((t106 * t135[k]) + (t107 * t134[k])) + (t108 * t133[k]));
    t155[k] = 0.5 * (1.81e-05 * (t153 + t154));
    t156[k] = 0.5 * (1.81e-05 * (t148 + t147));
    t157[k] = 0.5 * (1.81e-05 * (t154 + t153));
    double  t158  = (((t102 * t135[k]) + (t103 * t134[k])) + (t104 * t133[k]));
    t159[k] = 0.5 * (1.81e-05 * (t158 + t158));
    double  t160  = (((t94 * t141[k]) + (t95 * t140[k])) + (t96 * t139[k]));
    t161[k] = 0.5 * (1.81e-05 * (t160 + t160));
    double  t162  = (((t90 * t141[k]) + (t91 * t140[k])) + (t92 * t139[k]));
    double  t163  = (((t94 * t138[k]) + (t95 * t137[k])) + (t96 * t136[k]));
    t164[k] = 0.5 * (1.81e-05 * (t162 + t163));
    double  t165  = (((t85 * t141[k]) + (t87 * t140[k])) + (t88 * t139[k]));
    double  t166  = (((t94 * t135[k]) + (t95 * t134[k])) + (t96 * t133[k]));
    t167[k] = 0.5 * (1.81e-05 * (t165 + t166));
    t168[k] = 0.5 * (1.81e-05 * (t163 + t162));
    double  t169  = (((t90 * t138[k]) + (t91 * t137[k])) + (t92 * t136[k]));
    t170[k] = 0.5 * (1.81e-05 * (t169 + t169));
    double  t171  = (((t85 * t138[k]) + (t87 * t137[k])) + (t88 * t136[k]));
    double  t172  = (((t90 * t135[k]) + (t91 * t134[k])) + (t92 * t133[k]));
    t173[k] = 0.5 * (1.81e-05 * (t171 + t172));
    t174[k] = 0.5 * (1.81e-05 * (t166 + t165));
    t175[k] = 0.5 * (1.81e-05 * (t172 + t171));
    double  t176  = (((t85 * t135[k]) + (t87 * t134[k])) + (t88 * t133[k]));
    t177[k] = 0.5 * (1.81e-05 * (t176 + t176));

  }

  for (int  j  = 0; j < 12; j += 1)
  {
    t178[j] = 0.5 * ((t141[j] * t110) + ((t140[j] * t111) + (t139[j] * t112)));
    t179[j] = 0.5 * ((t138[j] * t110) + ((t137[j] * t111) + (t136[j] * t112)));
    t180[j] = 0.5 * ((t135[j] * t110) + ((t134[j] * t111) + (t133[j] * t112)));
    t181[j] = 0.5 * ((t141[j] * t106) + ((t140[j] * t107) + (t139[j] * t108)));
    t182[j] = 0.5 * ((t138[j] * t106) + ((t137[j] * t107) + (t136[j] * t108)));
    t183[j] = 0.5 * ((t135[j] * t106) + ((t134[j] * t107) + (t133[j] * t108)));
    t184[j] = 0.5 * ((t141[j] * t102) + ((t140[j] * t103) + (t139[j] * t104)));
    t185[j] = 0.5 * ((t138[j] * t102) + ((t137[j] * t103) + (t136[j] * t104)));
    t186[j] = 0.5 * ((t135[j] * t102) + ((t134[j] * t103) + (t133[j] * t104)));
    t187[j] = 0.5 * ((t141[j] * t94) + ((t140[j] * t95) + (t139[j] * t96)));
    t188[j] = 0.5 * ((t138[j] * t94) + ((t137[j] * t95) + (t136[j] * t96)));
    t189[j] = 0.5 * ((t135[j] * t94) + ((t134[j] * t95) + (t133[j] * t96)));
    t190[j] = 0.5 * ((t141[j] * t90) + ((t140[j] * t91) + (t139[j] * t92)));
    t191[j] = 0.5 * ((t138[j] * t90) + ((t137[j] * t91) + (t136[j] * t92)));
    t192[j] = 0.5 * ((t135[j] * t90) + ((t134[j] * t91) + (t133[j] * t92)));
    t193[j] = 0.5 * ((t141[j] * t85) + ((t140[j] * t87) + (t139[j] * t88)));
    t194[j] = 0.5 * ((t138[j] * t85) + ((t137[j] * t87) + (t136[j] * t88)));
    t195[j] = 0.5 * ((t135[j] * t85) + ((t134[j] * t87) + (t133[j] * t88)));

  }
  double  c_42_0_0  = (t115 * (1.81e-05 * 2));
  double  c_46_0_0  = (t116 * (1.81e-05 * 2));
  double  c_50_0_0  = (t117 * (1.81e-05 * 2));
  double  c_51_0_0  = (t101 * (1.81e-05 * 2));
  double  c_55_0_0  = (t100 * (1.81e-05 * 2));
  double  c_59_0_0  = (t99 * (1.81e-05 * 2));
  double  c_84_0_0  = (t99 * t84);
  double  c_84_0_1  = (t99 * -1);
  double  c_84_0_2  = (t101 * t84);
  double  c_84_0_3  = (t100 * t84);
  double  c_84_0_4  = (t101 * -1);
  double  c_84_0_5  = (t100 * -1);
  double  k_84_0_0[12] ;
  double  k_84_0_1[12] ;
  double  k_84_0_2[12] ;
  double  k_84_0_3[12] ;
  double  k_84_0_4[12] ;
  double  k_84_0_5[12] ;
  double  c_85_0_0  = (t99 * t84);
  double  c_85_0_1  = (t100 * t84);
  double  c_85_0_2  = (t99 * -1);
  double  c_85_0_3  = (t101 * t84);
  double  c_85_0_4  = (t101 * -1);
  double  c_85_0_5  = (t100 * -1);
  double  j_85_0_0[12] ;
  double  j_85_0_1[12] ;
  double  j_85_0_2[12] ;
  double  k_85_0_0[12] ;
  double  k_85_0_1[12] ;
  double  k_85_0_2[12] ;
  double  k_85_0_3[12] ;
  double  k_85_0_4[12] ;
  double  k_85_0_5[12] ;
  double  c_86_0_0  = (t117 * -1);
  double  c_86_0_1  = (t116 * t84);
  double  c_86_0_2  = (t117 * t84);
  double  c_86_0_3  = (t115 * t84);
  double  c_86_0_4  = (t115 * -1);
  double  c_86_0_5  = (t116 * -1);
  double  k_86_0_0[12] ;
  double  k_86_0_1[12] ;
  double  k_86_0_2[12] ;
  double  k_86_0_3[12] ;
  double  k_86_0_4[12] ;
  double  k_86_0_5[12] ;
  double  c_87_0_0  = (t117 * -1);
  double  c_87_0_1  = (t117 * t84);
  double  c_87_0_2  = (t116 * t84);
  double  c_87_0_3  = (t115 * t84);
  double  c_87_0_4  = (t115 * -1);
  double  c_87_0_5  = (t116 * -1);
  double  k_87_0_0[12] ;
  double  k_87_0_1[12] ;
  double  k_87_0_2[12] ;
  double  k_87_0_3[12] ;
  double  k_87_0_4[12] ;
  double  j_87_0_0[12] ;
  double  j_87_0_1[12] ;
  double  j_87_0_2[12] ;

  for (int  j  = 0; j < 12; j += 1)
  {
    k_84_0_0[j] = t174[j] * c_84_0_1;
    k_84_0_1[j] = (t161[j] * c_84_0_4) + (t168[j] * c_84_0_5);
    k_84_0_2[j] = t175[j] * c_84_0_1;
    k_84_0_3[j] = (t170[j] * c_84_0_5) + (t164[j] * c_84_0_4);
    k_84_0_4[j] = t177[j] * c_84_0_1;
    k_84_0_5[j] = (t173[j] * c_84_0_5) + (t167[j] * c_84_0_4);
    j_85_0_0[j] = t195[j] * -1;
    j_85_0_1[j] = t190[j] * -1;
    j_85_0_2[j] = t193[j] * -1;
    k_85_0_0[j] = t156[j] * c_85_0_2;
    k_85_0_1[j] = (t143[j] * c_85_0_4) + (t150[j] * c_85_0_5);
    k_85_0_2[j] = t159[j] * c_85_0_2;
    k_85_0_3[j] = (t149[j] * c_85_0_4) + (t155[j] * c_85_0_5);
    k_85_0_4[j] = t157[j] * c_85_0_2;
    k_85_0_5[j] = (t146[j] * c_85_0_4) + (t152[j] * c_85_0_5);
    k_86_0_0[j] = t177[j] * c_86_0_0;
    k_86_0_1[j] = (t167[j] * c_86_0_4) + (t173[j] * c_86_0_5);
    k_86_0_2[j] = t175[j] * c_86_0_0;
    k_86_0_3[j] = (t170[j] * c_86_0_5) + (t164[j] * c_86_0_4);
    k_86_0_4[j] = t174[j] * c_86_0_0;
    k_86_0_5[j] = (t161[j] * c_86_0_4) + (t168[j] * c_86_0_5);
    k_87_0_0[j] = t159[j] * c_87_0_0;
    k_87_0_1[j] = (t149[j] * c_87_0_4) + (t155[j] * c_87_0_5);
    k_87_0_2[j] = t157[j] * c_87_0_0;
    k_87_0_3[j] = (t146[j] * c_87_0_4) + (t152[j] * c_87_0_5);
    k_87_0_4[j] = (t156[j] * c_87_0_0) + ((t143[j] * c_87_0_4) + (t150[j] * c_87_0_5));
    j_87_0_0[j] = t181[j] * -1;
    j_87_0_1[j] = t184[j] * -1;
    j_87_0_2[j] = t178[j] * -1;

  }

  for (int  ip  = 0; ip < 7; ip += 1)
  {
    double  t203[12] ;
    double  t204[12] ;
    double  t205[12] ;
    double  t207[12] ;
    double  t210[12] ;
    double  t213[12] ;
    double  t214[12] ;
    double  t216[12] ;
    double  t219[12] ;
    double  t220[12] ;
    double  t221[12] ;
    double  t223[12] ;
    double  t224[12] ;
    double  t225[12] ;
    double  t226[12] ;
    double  t228[12] ;
    double  t231[12] ;
    double  t234[12] ;
    double  t235[12] ;
    double  t237[12] ;
    double  t240[12] ;
    double  t241[12] ;
    double  t242[12] ;
    double  t244[12] ;
    double  t198  = 0.0;
    double  t197  = 0.0;
    double  t196  = 0.0;

    for (int  i_0  = 0; i_0 < 4; i_0 += 1)
    {
      t196 += t132[facet[0]][ip][i_0+8] * w_0[0][i_0+8];
      t197 += t131[facet[0]][ip][i_0+4] * w_0[0][i_0+4];
      t198 += t130[facet[0]][ip][i_0] * w_0[0][i_0];

    }
    double  t199  = (t129[ip] * t128);
    double  t200  = (((t117 * t198) + (t116 * t197)) + (t115 * t196));
    double  t201  = (0.5 + (0.5 * (t200 == 0 ? 0 : (t200 < 0 ? -1 : 1))));
    double  t202  = (1 + (-1 * t201));

    for (int  k  = 0; k < 12; k += 1)
    {
      t203[k] = t132[facet[1]][ip][k] * t201;
      t204[k] = t131[facet[1]][ip][k] * t201;
      t205[k] = t130[facet[1]][ip][k] * t201;
      t207[k] = t132[facet[1]][ip][k] * c_42_0_0;
      t210[k] = 1.81e-05 * ((t132[facet[1]][ip][k] * t116) + (t131[facet[1]][ip][k] * t115));
      t213[k] = 1.81e-05 * ((t132[facet[1]][ip][k] * t117) + (t130[facet[1]][ip][k] * t115));
      t214[k] = 1.81e-05 * ((t131[facet[1]][ip][k] * t115) + (t132[facet[1]][ip][k] * t116));
      t216[k] = t131[facet[1]][ip][k] * c_46_0_0;
      t219[k] = 1.81e-05 * ((t131[facet[1]][ip][k] * t117) + (t130[facet[1]][ip][k] * t116));
      t220[k] = 1.81e-05 * ((t130[facet[1]][ip][k] * t115) + (t132[facet[1]][ip][k] * t117));
      t221[k] = 1.81e-05 * ((t130[facet[1]][ip][k] * t116) + (t131[facet[1]][ip][k] * t117));
      t223[k] = t130[facet[1]][ip][k] * c_50_0_0;
      t224[k] = t132[facet[0]][ip][k] * t202;
      t225[k] = t131[facet[0]][ip][k] * t202;
      t226[k] = t130[facet[0]][ip][k] * t202;
      t228[k] = t132[facet[0]][ip][k] * c_51_0_0;
      t231[k] = 1.81e-05 * ((t132[facet[0]][ip][k] * t100) + (t131[facet[0]][ip][k] * t101));
      t234[k] = 1.81e-05 * ((t132[facet[0]][ip][k] * t99) + (t130[facet[0]][ip][k] * t101));
      t235[k] = 1.81e-05 * ((t131[facet[0]][ip][k] * t101) + (t132[facet[0]][ip][k] * t100));
      t237[k] = t131[facet[0]][ip][k] * c_55_0_0;
      t240[k] = 1.81e-05 * ((t131[facet[0]][ip][k] * t99) + (t130[facet[0]][ip][k] * t100));
      t241[k] = 1.81e-05 * ((t130[facet[0]][ip][k] * t101) + (t132[facet[0]][ip][k] * t99));
      t242[k] = 1.81e-05 * ((t130[facet[0]][ip][k] * t100) + (t131[facet[0]][ip][k] * t99));
      t244[k] = t130[facet[0]][ip][k] * c_59_0_0;

    }
    double  ip_78_0_0  = ((t117 * t198) + ((t116 * t197) + (t115 * t196)));
    double  ip_81_0_0  = ((t99 * t198) + ((t100 * t197) + (t101 * t196)));
    double  ip_k_84_0_0[12] ;
    double  ip_k_84_0_1[12] ;
    double  ip_k_84_0_2[12] ;
    double  ip_k_84_0_3[12] ;
    double  ip_k_84_0_4[12] ;
    double  ip_k_84_0_5[12] ;
    double  ip_k_84_0_6[12] ;
    double  ip_k_84_0_7[12] ;
    double  ip_k_84_0_8[12] ;
    double  ip_k_84_0_9[12] ;
    double  ip_k_84_0_10[12] ;
    double  ip_j_84_1_0[12] ;
    double  ip_k_84_1_0[12] ;
    double  ip_k_84_1_1[12] ;
    double  ip_k_84_1_2[12] ;
    double  ip_k_85_0_0[12] ;
    double  ip_k_85_0_1[12] ;
    double  ip_k_85_0_2[12] ;
    double  ip_k_85_0_3[12] ;
    double  ip_k_85_0_4[12] ;
    double  ip_k_85_0_5[12] ;
    double  ip_k_85_0_6[12] ;
    double  ip_j_85_1_0[12] ;
    double  ip_j_85_1_1[12] ;
    double  ip_j_85_1_2[12] ;
    double  ip_k_85_1_0[12] ;
    double  ip_k_85_1_1[12] ;
    double  ip_k_85_1_2[12] ;
    double  ip_k_86_0_0[12] ;
    double  ip_k_86_0_1[12] ;
    double  ip_k_86_0_2[12] ;
    double  ip_k_86_0_3[12] ;
    double  ip_k_86_0_4[12] ;
    double  ip_k_86_0_5[12] ;
    double  ip_k_86_0_6[12] ;
    double  ip_k_86_0_7[12] ;
    double  ip_k_86_0_8[12] ;
    double  ip_k_86_0_9[12] ;
    double  ip_k_86_1_0[12] ;
    double  ip_k_86_1_1[12] ;
    double  ip_k_86_1_2[12] ;
    double  ip_j_86_1_0[12] ;
    double  ip_k_87_0_0[12] ;
    double  ip_k_87_0_1[12] ;
    double  ip_k_87_0_2[12] ;
    double  ip_k_87_0_3[12] ;
    double  ip_k_87_0_4[12] ;
    double  ip_k_87_0_5[12] ;
    double  ip_k_87_0_6[12] ;
    double  ip_k_87_1_0[12] ;
    double  ip_k_87_1_1[12] ;
    double  ip_j_87_1_0[12] ;
    double  ip_j_87_1_1[12] ;
    double  ip_j_87_1_2[12] ;

    for (int  j  = 0; j < 12; j += 1)
    {
      ip_k_84_0_0[j] = t242[j] * -1;
      ip_k_84_0_1[j] = t237[j] * -1;
      ip_k_84_0_2[j] = t234[j] * -1;
      ip_k_84_0_3[j] = t130[facet[0]][ip][j] * t202;
      ip_k_84_0_4[j] = t231[j] * -1;
      ip_k_84_0_5[j] = t228[j] * -1;
      ip_k_84_0_6[j] = t132[facet[0]][ip][j] * t202;
      ip_k_84_0_7[j] = t240[j] * -1;
      ip_k_84_0_8[j] = t235[j] * -1;
      ip_k_84_0_9[j] = t241[j] * -1;
      ip_k_84_0_10[j] = t131[facet[0]][ip][j] * t202;
      ip_j_84_1_0[j] = j_85_0_0[j] + (t130[facet[0]][ip][j] * c_84_0_0);
      ip_k_84_1_0[j] = (k_84_0_0[j] + ((t228[j] * c_84_0_2) + (t241[j] * c_84_0_0))) + ((t235[j] * c_84_0_3) + k_84_0_1[j]);
      ip_k_84_1_1[j] = (k_84_0_2[j] + ((t231[j] * c_84_0_2) + (t237[j] * c_84_0_3))) + ((t242[j] * c_84_0_0) + k_84_0_3[j]);
      ip_k_84_1_2[j] = (k_84_0_4[j] + (t240[j] * c_84_0_3)) + ((t234[j] * c_84_0_2) + k_84_0_5[j]);
      ip_k_85_0_0[j] = t221[j] * -1;
      ip_k_85_0_1[j] = t213[j] * -1;
      ip_k_85_0_2[j] = t210[j] * -1;
      ip_k_85_0_3[j] = t207[j] * -1;
      ip_k_85_0_4[j] = t216[j] * -1;
      ip_k_85_0_5[j] = t132[facet[1]][ip][j] * t201;
      ip_k_85_0_6[j] = t219[j] * -1;
      ip_j_85_1_0[j] = j_85_0_0[j] + (t130[facet[0]][ip][j] * c_85_0_0);
      ip_j_85_1_1[j] = j_85_0_1[j] + (t132[facet[0]][ip][j] * c_85_0_1);
      ip_j_85_1_2[j] = j_85_0_2[j] + (t132[facet[0]][ip][j] * c_85_0_0);
      ip_k_85_1_0[j] = (k_85_0_0[j] + (t207[j] * c_85_0_3)) + k_85_0_1[j];
      ip_k_85_1_1[j] = (k_85_0_2[j] + (t219[j] * c_85_0_1)) + ((t213[j] * c_85_0_3) + k_85_0_3[j]);
      ip_k_85_1_2[j] = (k_85_0_4[j] + ((t216[j] * c_85_0_1) + (t221[j] * c_85_0_0))) + ((t210[j] * c_85_0_3) + k_85_0_5[j]);
      ip_k_86_0_0[j] = t244[j] * -1;
      ip_k_86_0_1[j] = ip_k_84_0_8[j];
      ip_k_86_0_2[j] = ip_k_84_0_2[j];
      ip_k_86_0_3[j] = ip_k_84_0_0[j];
      ip_k_86_0_4[j] = ip_k_84_0_9[j];
      ip_k_86_0_5[j] = ip_k_84_0_7[j];
      ip_k_86_0_6[j] = ip_k_84_0_3[j];
      ip_k_86_0_7[j] = ip_k_84_0_4[j];
      ip_k_86_0_8[j] = ip_k_84_0_10[j];
      ip_k_86_0_9[j] = ip_k_84_0_1[j];
      ip_k_86_1_0[j] = (k_86_0_0[j] + ((t240[j] * c_86_0_1) + (t244[j] * c_86_0_2))) + ((t234[j] * c_86_0_3) + k_86_0_1[j]);
      ip_k_86_1_1[j] = (k_86_0_2[j] + ((t231[j] * c_86_0_3) + (t242[j] * c_86_0_2))) + ((t237[j] * c_86_0_1) + k_86_0_3[j]);
      ip_k_86_1_2[j] = (k_86_0_4[j] + (t241[j] * c_86_0_2)) + ((t235[j] * c_86_0_1) + k_86_0_5[j]);
      ip_j_86_1_0[j] = j_87_0_2[j] + (t132[facet[1]][ip][j] * c_86_0_3);
      ip_k_87_0_0[j] = t223[j] * -1;
      ip_k_87_0_1[j] = ip_k_85_0_1[j];
      ip_k_87_0_2[j] = ip_k_85_0_0[j];
      ip_k_87_0_3[j] = t130[facet[1]][ip][j] * t201;
      ip_k_87_0_4[j] = ip_k_85_0_6[j];
      ip_k_87_0_5[j] = ip_k_85_0_2[j];
      ip_k_87_0_6[j] = ip_k_85_0_4[j];
      ip_k_87_1_0[j] = (k_87_0_0[j] + ((t223[j] * c_87_0_1) + (t219[j] * c_87_0_2))) + ((t213[j] * c_87_0_3) + k_87_0_1[j]);
      ip_k_87_1_1[j] = (k_87_0_2[j] + ((t216[j] * c_87_0_2) + (t221[j] * c_87_0_1))) + ((t210[j] * c_87_0_3) + k_87_0_3[j]);
      ip_j_87_1_0[j] = j_87_0_0[j] + (t132[facet[1]][ip][j] * c_87_0_2);
      ip_j_87_1_1[j] = j_87_0_1[j] + (t132[facet[1]][ip][j] * c_87_0_1);
      ip_j_87_1_2[j] = j_87_0_2[j] + (t132[facet[1]][ip][j] * c_87_0_3);

    }

    for (int  j  = 0; j < 12; j += 1)
    {
      double  t245  = (t132[facet[1]][ip][j] * t117);
      double  t246  = (t132[facet[1]][ip][j] * t116);
      double  t247  = (t132[facet[1]][ip][j] * t115);
      double  t248  = (t132[facet[1]][ip][j] * ip_78_0_0);
      double  t249  = (t131[facet[1]][ip][j] * t117);
      double  t250  = (t131[facet[1]][ip][j] * t116);
      double  t251  = (t131[facet[1]][ip][j] * t115);
      double  t252  = (t131[facet[1]][ip][j] * ip_78_0_0);
      double  t253  = (t130[facet[1]][ip][j] * t117);
      double  t254  = (t130[facet[1]][ip][j] * t116);
      double  t255  = (t130[facet[1]][ip][j] * t115);
      double  t256  = (t130[facet[1]][ip][j] * ip_78_0_0);
      double  t257  = (t132[facet[0]][ip][j] * t99);
      double  t258  = (t132[facet[0]][ip][j] * t100);
      double  t259  = (t132[facet[0]][ip][j] * t101);
      double  t260  = (t132[facet[0]][ip][j] * ip_81_0_0);
      double  t261  = (t131[facet[0]][ip][j] * t99);
      double  t262  = (t131[facet[0]][ip][j] * t100);
      double  t263  = (t131[facet[0]][ip][j] * t101);
      double  t264  = (t131[facet[0]][ip][j] * ip_81_0_0);
      double  t265  = (t130[facet[0]][ip][j] * t99);
      double  t266  = (t130[facet[0]][ip][j] * t100);
      double  t267  = (t130[facet[0]][ip][j] * t101);
      double  t268  = (t130[facet[0]][ip][j] * ip_81_0_0);
      double  ip_j_85_0_0  = (t268 * t201);
      double  ip_j_85_0_1  = (t264 * t201);
      double  ip_j_86_0_0  = (t248 * t202);
      double  ip_j_87_0_0  = (t252 * t201);
      double  ip_j_87_0_1  = (t248 * t201);

      for (int  k  = 0; k < 4; k += 1)
      {
        A01[j][k+4] += (t131[facet[1]][ip][k+4] * ip_j_85_0_1) * t199;
        A01[j][k] += (t130[facet[1]][ip][k] * ip_j_85_0_0) * t199;
        A10[j][k+8] += (t132[facet[0]][ip][k+8] * ip_j_86_0_0) * t199;
        A11[j][k+8] += (t132[facet[1]][ip][k+8] * ip_j_87_0_1) * t199;
        A11[j][k+4] += (t131[facet[1]][ip][k+4] * ip_j_87_0_0) * t199;

      }

      for (int  k  = 0; k < 12; k += 1)
      {
        A00[j][k] += t199 * ((((t264 * ip_k_84_0_10[k]) + ((t193[j] * ip_k_84_0_9[k]) + (t189[j] * ip_k_84_0_2[k]))) + (((t187[j] * ip_k_84_0_5[k]) + (t192[j] * ip_k_84_0_7[k])) + ((t190[j] * ip_k_84_0_8[k]) + (t260 * ip_k_84_0_6[k])))) + ((((t268 * ip_k_84_0_3[k]) + (t188[j] * ip_k_84_0_4[k])) + ((t131[facet[0]][ip][j] * ip_k_84_1_1[k]) + (t194[j] * ip_k_84_0_0[k]))) + (((t191[j] * ip_k_84_0_1[k]) + (t130[facet[0]][ip][j] * ip_k_84_1_2[k])) + ((t244[k] * ip_j_84_1_0[j]) + (t132[facet[0]][ip][j] * ip_k_84_1_0[k])))));
        A01[j][k] += t199 * ((((t192[j] * ip_k_85_0_6[k]) + ((t194[j] * ip_k_85_0_0[k]) + (t188[j] * ip_k_85_0_2[k]))) + ((t191[j] * ip_k_85_0_4[k]) + ((t260 * ip_k_85_0_5[k]) + (t187[j] * ip_k_85_0_3[k])))) + (((t189[j] * ip_k_85_0_1[k]) + ((t220[k] * ip_j_85_1_2[j]) + (t130[facet[0]][ip][j] * ip_k_85_1_1[k]))) + (((t131[facet[0]][ip][j] * ip_k_85_1_2[k]) + (t132[facet[0]][ip][j] * ip_k_85_1_0[k])) + ((t223[k] * ip_j_85_1_0[j]) + (t214[k] * ip_j_85_1_1[j])))));
        A10[j][k] += t199 * ((((t182[j] * ip_k_86_0_9[k]) + ((t252 * ip_k_86_0_8[k]) + (t180[j] * ip_k_86_0_2[k]))) + (((t256 * ip_k_86_0_6[k]) + (t179[j] * ip_k_86_0_7[k])) + ((t183[j] * ip_k_86_0_5[k]) + (t185[j] * ip_k_86_0_3[k])))) + (((t184[j] * ip_k_86_0_4[k]) + ((t131[facet[1]][ip][j] * ip_k_86_1_1[k]) + (t132[facet[1]][ip][j] * ip_k_86_1_2[k]))) + (((t181[j] * ip_k_86_0_1[k]) + (t228[k] * ip_j_86_1_0[j])) + ((t186[j] * ip_k_86_0_0[k]) + (t130[facet[1]][ip][j] * ip_k_86_1_0[k])))));
        A11[j][k] += t199 * ((((t182[j] * ip_k_87_0_6[k]) + ((t132[facet[1]][ip][j] * k_87_0_4[k]) + (t256 * ip_k_87_0_3[k]))) + ((t179[j] * ip_k_87_0_5[k]) + ((t183[j] * ip_k_87_0_4[k]) + (t180[j] * ip_k_87_0_1[k])))) + (((t185[j] * ip_k_87_0_2[k]) + ((t214[k] * ip_j_87_1_0[j]) + (t131[facet[1]][ip][j] * ip_k_87_1_1[k]))) + (((t207[k] * ip_j_87_1_2[j]) + (t220[k] * ip_j_87_1_1[j])) + ((t186[j] * ip_k_87_0_0[k]) + (t130[facet[1]][ip][j] * ip_k_87_1_0[k])))));

      }

    }

  }
  A[0][0] = A00[0][0];
  A[0][1] = A00[0][1];
  A[0][2] = A00[0][2];
  A[0][3] = A00[0][3];
  A[0][4] = A01[0][0];
  A[0][5] = A01[0][1];
  A[0][6] = A01[0][2];
  A[0][7] = A01[0][3];
  A[0][8] = A00[0][4];
  A[0][9] = A00[0][5];
  A[0][10] = A00[0][6];
  A[0][11] = A00[0][7];
  A[0][12] = A01[0][4];
  A[0][13] = A01[0][5];
  A[0][14] = A01[0][6];
  A[0][15] = A01[0][7];
  A[0][16] = A00[0][8];
  A[0][17] = A00[0][9];
  A[0][18] = A00[0][10];
  A[0][19] = A00[0][11];
  A[0][20] = A01[0][8];
  A[0][21] = A01[0][9];
  A[0][22] = A01[0][10];
  A[0][23] = A01[0][11];
  A[1][0] = A00[1][0];
  A[1][1] = A00[1][1];
  A[1][2] = A00[1][2];
  A[1][3] = A00[1][3];
  A[1][4] = A01[1][0];
  A[1][5] = A01[1][1];
  A[1][6] = A01[1][2];
  A[1][7] = A01[1][3];
  A[1][8] = A00[1][4];
  A[1][9] = A00[1][5];
  A[1][10] = A00[1][6];
  A[1][11] = A00[1][7];
  A[1][12] = A01[1][4];
  A[1][13] = A01[1][5];
  A[1][14] = A01[1][6];
  A[1][15] = A01[1][7];
  A[1][16] = A00[1][8];
  A[1][17] = A00[1][9];
  A[1][18] = A00[1][10];
  A[1][19] = A00[1][11];
  A[1][20] = A01[1][8];
  A[1][21] = A01[1][9];
  A[1][22] = A01[1][10];
  A[1][23] = A01[1][11];
  A[2][0] = A00[2][0];
  A[2][1] = A00[2][1];
  A[2][2] = A00[2][2];
  A[2][3] = A00[2][3];
  A[2][4] = A01[2][0];
  A[2][5] = A01[2][1];
  A[2][6] = A01[2][2];
  A[2][7] = A01[2][3];
  A[2][8] = A00[2][4];
  A[2][9] = A00[2][5];
  A[2][10] = A00[2][6];
  A[2][11] = A00[2][7];
  A[2][12] = A01[2][4];
  A[2][13] = A01[2][5];
  A[2][14] = A01[2][6];
  A[2][15] = A01[2][7];
  A[2][16] = A00[2][8];
  A[2][17] = A00[2][9];
  A[2][18] = A00[2][10];
  A[2][19] = A00[2][11];
  A[2][20] = A01[2][8];
  A[2][21] = A01[2][9];
  A[2][22] = A01[2][10];
  A[2][23] = A01[2][11];
  A[3][0] = A00[3][0];
  A[3][1] = A00[3][1];
  A[3][2] = A00[3][2];
  A[3][3] = A00[3][3];
  A[3][4] = A01[3][0];
  A[3][5] = A01[3][1];
  A[3][6] = A01[3][2];
  A[3][7] = A01[3][3];
  A[3][8] = A00[3][4];
  A[3][9] = A00[3][5];
  A[3][10] = A00[3][6];
  A[3][11] = A00[3][7];
  A[3][12] = A01[3][4];
  A[3][13] = A01[3][5];
  A[3][14] = A01[3][6];
  A[3][15] = A01[3][7];
  A[3][16] = A00[3][8];
  A[3][17] = A00[3][9];
  A[3][18] = A00[3][10];
  A[3][19] = A00[3][11];
  A[3][20] = A01[3][8];
  A[3][21] = A01[3][9];
  A[3][22] = A01[3][10];
  A[3][23] = A01[3][11];
  A[4][0] = A10[0][0];
  A[4][1] = A10[0][1];
  A[4][2] = A10[0][2];
  A[4][3] = A10[0][3];
  A[4][4] = A11[0][0];
  A[4][5] = A11[0][1];
  A[4][6] = A11[0][2];
  A[4][7] = A11[0][3];
  A[4][8] = A10[0][4];
  A[4][9] = A10[0][5];
  A[4][10] = A10[0][6];
  A[4][11] = A10[0][7];
  A[4][12] = A11[0][4];
  A[4][13] = A11[0][5];
  A[4][14] = A11[0][6];
  A[4][15] = A11[0][7];
  A[4][16] = A10[0][8];
  A[4][17] = A10[0][9];
  A[4][18] = A10[0][10];
  A[4][19] = A10[0][11];
  A[4][20] = A11[0][8];
  A[4][21] = A11[0][9];
  A[4][22] = A11[0][10];
  A[4][23] = A11[0][11];
  A[5][0] = A10[1][0];
  A[5][1] = A10[1][1];
  A[5][2] = A10[1][2];
  A[5][3] = A10[1][3];
  A[5][4] = A11[1][0];
  A[5][5] = A11[1][1];
  A[5][6] = A11[1][2];
  A[5][7] = A11[1][3];
  A[5][8] = A10[1][4];
  A[5][9] = A10[1][5];
  A[5][10] = A10[1][6];
  A[5][11] = A10[1][7];
  A[5][12] = A11[1][4];
  A[5][13] = A11[1][5];
  A[5][14] = A11[1][6];
  A[5][15] = A11[1][7];
  A[5][16] = A10[1][8];
  A[5][17] = A10[1][9];
  A[5][18] = A10[1][10];
  A[5][19] = A10[1][11];
  A[5][20] = A11[1][8];
  A[5][21] = A11[1][9];
  A[5][22] = A11[1][10];
  A[5][23] = A11[1][11];
  A[6][0] = A10[2][0];
  A[6][1] = A10[2][1];
  A[6][2] = A10[2][2];
  A[6][3] = A10[2][3];
  A[6][4] = A11[2][0];
  A[6][5] = A11[2][1];
  A[6][6] = A11[2][2];
  A[6][7] = A11[2][3];
  A[6][8] = A10[2][4];
  A[6][9] = A10[2][5];
  A[6][10] = A10[2][6];
  A[6][11] = A10[2][7];
  A[6][12] = A11[2][4];
  A[6][13] = A11[2][5];
  A[6][14] = A11[2][6];
  A[6][15] = A11[2][7];
  A[6][16] = A10[2][8];
  A[6][17] = A10[2][9];
  A[6][18] = A10[2][10];
  A[6][19] = A10[2][11];
  A[6][20] = A11[2][8];
  A[6][21] = A11[2][9];
  A[6][22] = A11[2][10];
  A[6][23] = A11[2][11];
  A[7][0] = A10[3][0];
  A[7][1] = A10[3][1];
  A[7][2] = A10[3][2];
  A[7][3] = A10[3][3];
  A[7][4] = A11[3][0];
  A[7][5] = A11[3][1];
  A[7][6] = A11[3][2];
  A[7][7] = A11[3][3];
  A[7][8] = A10[3][4];
  A[7][9] = A10[3][5];
  A[7][10] = A10[3][6];
  A[7][11] = A10[3][7];
  A[7][12] = A11[3][4];
  A[7][13] = A11[3][5];
  A[7][14] = A11[3][6];
  A[7][15] = A11[3][7];
  A[7][16] = A10[3][8];
  A[7][17] = A10[3][9];
  A[7][18] = A10[3][10];
  A[7][19] = A10[3][11];
  A[7][20] = A11[3][8];
  A[7][21] = A11[3][9];
  A[7][22] = A11[3][10];
  A[7][23] = A11[3][11];
  A[8][0] = A00[4][0];
  A[8][1] = A00[4][1];
  A[8][2] = A00[4][2];
  A[8][3] = A00[4][3];
  A[8][4] = A01[4][0];
  A[8][5] = A01[4][1];
  A[8][6] = A01[4][2];
  A[8][7] = A01[4][3];
  A[8][8] = A00[4][4];
  A[8][9] = A00[4][5];
  A[8][10] = A00[4][6];
  A[8][11] = A00[4][7];
  A[8][12] = A01[4][4];
  A[8][13] = A01[4][5];
  A[8][14] = A01[4][6];
  A[8][15] = A01[4][7];
  A[8][16] = A00[4][8];
  A[8][17] = A00[4][9];
  A[8][18] = A00[4][10];
  A[8][19] = A00[4][11];
  A[8][20] = A01[4][8];
  A[8][21] = A01[4][9];
  A[8][22] = A01[4][10];
  A[8][23] = A01[4][11];
  A[9][0] = A00[5][0];
  A[9][1] = A00[5][1];
  A[9][2] = A00[5][2];
  A[9][3] = A00[5][3];
  A[9][4] = A01[5][0];
  A[9][5] = A01[5][1];
  A[9][6] = A01[5][2];
  A[9][7] = A01[5][3];
  A[9][8] = A00[5][4];
  A[9][9] = A00[5][5];
  A[9][10] = A00[5][6];
  A[9][11] = A00[5][7];
  A[9][12] = A01[5][4];
  A[9][13] = A01[5][5];
  A[9][14] = A01[5][6];
  A[9][15] = A01[5][7];
  A[9][16] = A00[5][8];
  A[9][17] = A00[5][9];
  A[9][18] = A00[5][10];
  A[9][19] = A00[5][11];
  A[9][20] = A01[5][8];
  A[9][21] = A01[5][9];
  A[9][22] = A01[5][10];
  A[9][23] = A01[5][11];
  A[10][0] = A00[6][0];
  A[10][1] = A00[6][1];
  A[10][2] = A00[6][2];
  A[10][3] = A00[6][3];
  A[10][4] = A01[6][0];
  A[10][5] = A01[6][1];
  A[10][6] = A01[6][2];
  A[10][7] = A01[6][3];
  A[10][8] = A00[6][4];
  A[10][9] = A00[6][5];
  A[10][10] = A00[6][6];
  A[10][11] = A00[6][7];
  A[10][12] = A01[6][4];
  A[10][13] = A01[6][5];
  A[10][14] = A01[6][6];
  A[10][15] = A01[6][7];
  A[10][16] = A00[6][8];
  A[10][17] = A00[6][9];
  A[10][18] = A00[6][10];
  A[10][19] = A00[6][11];
  A[10][20] = A01[6][8];
  A[10][21] = A01[6][9];
  A[10][22] = A01[6][10];
  A[10][23] = A01[6][11];
  A[11][0] = A00[7][0];
  A[11][1] = A00[7][1];
  A[11][2] = A00[7][2];
  A[11][3] = A00[7][3];
  A[11][4] = A01[7][0];
  A[11][5] = A01[7][1];
  A[11][6] = A01[7][2];
  A[11][7] = A01[7][3];
  A[11][8] = A00[7][4];
  A[11][9] = A00[7][5];
  A[11][10] = A00[7][6];
  A[11][11] = A00[7][7];
  A[11][12] = A01[7][4];
  A[11][13] = A01[7][5];
  A[11][14] = A01[7][6];
  A[11][15] = A01[7][7];
  A[11][16] = A00[7][8];
  A[11][17] = A00[7][9];
  A[11][18] = A00[7][10];
  A[11][19] = A00[7][11];
  A[11][20] = A01[7][8];
  A[11][21] = A01[7][9];
  A[11][22] = A01[7][10];
  A[11][23] = A01[7][11];
  A[12][0] = A10[4][0];
  A[12][1] = A10[4][1];
  A[12][2] = A10[4][2];
  A[12][3] = A10[4][3];
  A[12][4] = A11[4][0];
  A[12][5] = A11[4][1];
  A[12][6] = A11[4][2];
  A[12][7] = A11[4][3];
  A[12][8] = A10[4][4];
  A[12][9] = A10[4][5];
  A[12][10] = A10[4][6];
  A[12][11] = A10[4][7];
  A[12][12] = A11[4][4];
  A[12][13] = A11[4][5];
  A[12][14] = A11[4][6];
  A[12][15] = A11[4][7];
  A[12][16] = A10[4][8];
  A[12][17] = A10[4][9];
  A[12][18] = A10[4][10];
  A[12][19] = A10[4][11];
  A[12][20] = A11[4][8];
  A[12][21] = A11[4][9];
  A[12][22] = A11[4][10];
  A[12][23] = A11[4][11];
  A[13][0] = A10[5][0];
  A[13][1] = A10[5][1];
  A[13][2] = A10[5][2];
  A[13][3] = A10[5][3];
  A[13][4] = A11[5][0];
  A[13][5] = A11[5][1];
  A[13][6] = A11[5][2];
  A[13][7] = A11[5][3];
  A[13][8] = A10[5][4];
  A[13][9] = A10[5][5];
  A[13][10] = A10[5][6];
  A[13][11] = A10[5][7];
  A[13][12] = A11[5][4];
  A[13][13] = A11[5][5];
  A[13][14] = A11[5][6];
  A[13][15] = A11[5][7];
  A[13][16] = A10[5][8];
  A[13][17] = A10[5][9];
  A[13][18] = A10[5][10];
  A[13][19] = A10[5][11];
  A[13][20] = A11[5][8];
  A[13][21] = A11[5][9];
  A[13][22] = A11[5][10];
  A[13][23] = A11[5][11];
  A[14][0] = A10[6][0];
  A[14][1] = A10[6][1];
  A[14][2] = A10[6][2];
  A[14][3] = A10[6][3];
  A[14][4] = A11[6][0];
  A[14][5] = A11[6][1];
  A[14][6] = A11[6][2];
  A[14][7] = A11[6][3];
  A[14][8] = A10[6][4];
  A[14][9] = A10[6][5];
  A[14][10] = A10[6][6];
  A[14][11] = A10[6][7];
  A[14][12] = A11[6][4];
  A[14][13] = A11[6][5];
  A[14][14] = A11[6][6];
  A[14][15] = A11[6][7];
  A[14][16] = A10[6][8];
  A[14][17] = A10[6][9];
  A[14][18] = A10[6][10];
  A[14][19] = A10[6][11];
  A[14][20] = A11[6][8];
  A[14][21] = A11[6][9];
  A[14][22] = A11[6][10];
  A[14][23] = A11[6][11];
  A[15][0] = A10[7][0];
  A[15][1] = A10[7][1];
  A[15][2] = A10[7][2];
  A[15][3] = A10[7][3];
  A[15][4] = A11[7][0];
  A[15][5] = A11[7][1];
  A[15][6] = A11[7][2];
  A[15][7] = A11[7][3];
  A[15][8] = A10[7][4];
  A[15][9] = A10[7][5];
  A[15][10] = A10[7][6];
  A[15][11] = A10[7][7];
  A[15][12] = A11[7][4];
  A[15][13] = A11[7][5];
  A[15][14] = A11[7][6];
  A[15][15] = A11[7][7];
  A[15][16] = A10[7][8];
  A[15][17] = A10[7][9];
  A[15][18] = A10[7][10];
  A[15][19] = A10[7][11];
  A[15][20] = A11[7][8];
  A[15][21] = A11[7][9];
  A[15][22] = A11[7][10];
  A[15][23] = A11[7][11];
  A[16][0] = A00[8][0];
  A[16][1] = A00[8][1];
  A[16][2] = A00[8][2];
  A[16][3] = A00[8][3];
  A[16][4] = A01[8][0];
  A[16][5] = A01[8][1];
  A[16][6] = A01[8][2];
  A[16][7] = A01[8][3];
  A[16][8] = A00[8][4];
  A[16][9] = A00[8][5];
  A[16][10] = A00[8][6];
  A[16][11] = A00[8][7];
  A[16][12] = A01[8][4];
  A[16][13] = A01[8][5];
  A[16][14] = A01[8][6];
  A[16][15] = A01[8][7];
  A[16][16] = A00[8][8];
  A[16][17] = A00[8][9];
  A[16][18] = A00[8][10];
  A[16][19] = A00[8][11];
  A[16][20] = A01[8][8];
  A[16][21] = A01[8][9];
  A[16][22] = A01[8][10];
  A[16][23] = A01[8][11];
  A[17][0] = A00[9][0];
  A[17][1] = A00[9][1];
  A[17][2] = A00[9][2];
  A[17][3] = A00[9][3];
  A[17][4] = A01[9][0];
  A[17][5] = A01[9][1];
  A[17][6] = A01[9][2];
  A[17][7] = A01[9][3];
  A[17][8] = A00[9][4];
  A[17][9] = A00[9][5];
  A[17][10] = A00[9][6];
  A[17][11] = A00[9][7];
  A[17][12] = A01[9][4];
  A[17][13] = A01[9][5];
  A[17][14] = A01[9][6];
  A[17][15] = A01[9][7];
  A[17][16] = A00[9][8];
  A[17][17] = A00[9][9];
  A[17][18] = A00[9][10];
  A[17][19] = A00[9][11];
  A[17][20] = A01[9][8];
  A[17][21] = A01[9][9];
  A[17][22] = A01[9][10];
  A[17][23] = A01[9][11];
  A[18][0] = A00[10][0];
  A[18][1] = A00[10][1];
  A[18][2] = A00[10][2];
  A[18][3] = A00[10][3];
  A[18][4] = A01[10][0];
  A[18][5] = A01[10][1];
  A[18][6] = A01[10][2];
  A[18][7] = A01[10][3];
  A[18][8] = A00[10][4];
  A[18][9] = A00[10][5];
  A[18][10] = A00[10][6];
  A[18][11] = A00[10][7];
  A[18][12] = A01[10][4];
  A[18][13] = A01[10][5];
  A[18][14] = A01[10][6];
  A[18][15] = A01[10][7];
  A[18][16] = A00[10][8];
  A[18][17] = A00[10][9];
  A[18][18] = A00[10][10];
  A[18][19] = A00[10][11];
  A[18][20] = A01[10][8];
  A[18][21] = A01[10][9];
  A[18][22] = A01[10][10];
  A[18][23] = A01[10][11];
  A[19][0] = A00[11][0];
  A[19][1] = A00[11][1];
  A[19][2] = A00[11][2];
  A[19][3] = A00[11][3];
  A[19][4] = A01[11][0];
  A[19][5] = A01[11][1];
  A[19][6] = A01[11][2];
  A[19][7] = A01[11][3];
  A[19][8] = A00[11][4];
  A[19][9] = A00[11][5];
  A[19][10] = A00[11][6];
  A[19][11] = A00[11][7];
  A[19][12] = A01[11][4];
  A[19][13] = A01[11][5];
  A[19][14] = A01[11][6];
  A[19][15] = A01[11][7];
  A[19][16] = A00[11][8];
  A[19][17] = A00[11][9];
  A[19][18] = A00[11][10];
  A[19][19] = A00[11][11];
  A[19][20] = A01[11][8];
  A[19][21] = A01[11][9];
  A[19][22] = A01[11][10];
  A[19][23] = A01[11][11];
  A[20][0] = A10[8][0];
  A[20][1] = A10[8][1];
  A[20][2] = A10[8][2];
  A[20][3] = A10[8][3];
  A[20][4] = A11[8][0];
  A[20][5] = A11[8][1];
  A[20][6] = A11[8][2];
  A[20][7] = A11[8][3];
  A[20][8] = A10[8][4];
  A[20][9] = A10[8][5];
  A[20][10] = A10[8][6];
  A[20][11] = A10[8][7];
  A[20][12] = A11[8][4];
  A[20][13] = A11[8][5];
  A[20][14] = A11[8][6];
  A[20][15] = A11[8][7];
  A[20][16] = A10[8][8];
  A[20][17] = A10[8][9];
  A[20][18] = A10[8][10];
  A[20][19] = A10[8][11];
  A[20][20] = A11[8][8];
  A[20][21] = A11[8][9];
  A[20][22] = A11[8][10];
  A[20][23] = A11[8][11];
  A[21][0] = A10[9][0];
  A[21][1] = A10[9][1];
  A[21][2] = A10[9][2];
  A[21][3] = A10[9][3];
  A[21][4] = A11[9][0];
  A[21][5] = A11[9][1];
  A[21][6] = A11[9][2];
  A[21][7] = A11[9][3];
  A[21][8] = A10[9][4];
  A[21][9] = A10[9][5];
  A[21][10] = A10[9][6];
  A[21][11] = A10[9][7];
  A[21][12] = A11[9][4];
  A[21][13] = A11[9][5];
  A[21][14] = A11[9][6];
  A[21][15] = A11[9][7];
  A[21][16] = A10[9][8];
  A[21][17] = A10[9][9];
  A[21][18] = A10[9][10];
  A[21][19] = A10[9][11];
  A[21][20] = A11[9][8];
  A[21][21] = A11[9][9];
  A[21][22] = A11[9][10];
  A[21][23] = A11[9][11];
  A[22][0] = A10[10][0];
  A[22][1] = A10[10][1];
  A[22][2] = A10[10][2];
  A[22][3] = A10[10][3];
  A[22][4] = A11[10][0];
  A[22][5] = A11[10][1];
  A[22][6] = A11[10][2];
  A[22][7] = A11[10][3];
  A[22][8] = A10[10][4];
  A[22][9] = A10[10][5];
  A[22][10] = A10[10][6];
  A[22][11] = A10[10][7];
  A[22][12] = A11[10][4];
  A[22][13] = A11[10][5];
  A[22][14] = A11[10][6];
  A[22][15] = A11[10][7];
  A[22][16] = A10[10][8];
  A[22][17] = A10[10][9];
  A[22][18] = A10[10][10];
  A[22][19] = A10[10][11];
  A[22][20] = A11[10][8];
  A[22][21] = A11[10][9];
  A[22][22] = A11[10][10];
  A[22][23] = A11[10][11];
  A[23][0] = A10[11][0];
  A[23][1] = A10[11][1];
  A[23][2] = A10[11][2];
  A[23][3] = A10[11][3];
  A[23][4] = A11[11][0];
  A[23][5] = A11[11][1];
  A[23][6] = A11[11][2];
  A[23][7] = A11[11][3];
  A[23][8] = A10[11][4];
  A[23][9] = A10[11][5];
  A[23][10] = A10[11][6];
  A[23][11] = A10[11][7];
  A[23][12] = A11[11][4];
  A[23][13] = A11[11][5];
  A[23][14] = A11[11][6];
  A[23][15] = A11[11][7];
  A[23][16] = A10[11][8];
  A[23][17] = A10[11][9];
  A[23][18] = A10[11][10];
  A[23][19] = A10[11][11];
  A[23][20] = A11[11][8];
  A[23][21] = A11[11][9];
  A[23][22] = A11[11][10];
  A[23][23] = A11[11][11];

}



        void wrap_form00_interior_facet_integral_otherwise(int start, int end,
                      Mat arg0_0_, int *arg0_0_map0_0, int *arg0_0_map1_0, double *arg1_0, int *arg1_0_map0_0, double *arg2_0, int *arg2_0_map0_0, unsigned int *arg3_0
                      ) {
  Mat arg0_0_0 = arg0_0_;
  double *arg1_0_vec[24];
    double *arg2_0_vec[24];
  for ( int n = start; n < end; n++ ) {
    int i = n;
    arg1_0_vec[0] = arg1_0 + (arg1_0_map0_0[i * 8 + 0])* 3;
    arg1_0_vec[1] = arg1_0 + (arg1_0_map0_0[i * 8 + 1])* 3;
    arg1_0_vec[2] = arg1_0 + (arg1_0_map0_0[i * 8 + 2])* 3;
    arg1_0_vec[3] = arg1_0 + (arg1_0_map0_0[i * 8 + 3])* 3;
    arg1_0_vec[4] = arg1_0 + (arg1_0_map0_0[i * 8 + 4])* 3;
    arg1_0_vec[5] = arg1_0 + (arg1_0_map0_0[i * 8 + 5])* 3;
    arg1_0_vec[6] = arg1_0 + (arg1_0_map0_0[i * 8 + 6])* 3;
    arg1_0_vec[7] = arg1_0 + (arg1_0_map0_0[i * 8 + 7])* 3;
    arg1_0_vec[8] = arg1_0 + (arg1_0_map0_0[i * 8 + 0])* 3 + 1;
    arg1_0_vec[9] = arg1_0 + (arg1_0_map0_0[i * 8 + 1])* 3 + 1;
    arg1_0_vec[10] = arg1_0 + (arg1_0_map0_0[i * 8 + 2])* 3 + 1;
    arg1_0_vec[11] = arg1_0 + (arg1_0_map0_0[i * 8 + 3])* 3 + 1;
    arg1_0_vec[12] = arg1_0 + (arg1_0_map0_0[i * 8 + 4])* 3 + 1;
    arg1_0_vec[13] = arg1_0 + (arg1_0_map0_0[i * 8 + 5])* 3 + 1;
    arg1_0_vec[14] = arg1_0 + (arg1_0_map0_0[i * 8 + 6])* 3 + 1;
    arg1_0_vec[15] = arg1_0 + (arg1_0_map0_0[i * 8 + 7])* 3 + 1;
    arg1_0_vec[16] = arg1_0 + (arg1_0_map0_0[i * 8 + 0])* 3 + 2;
    arg1_0_vec[17] = arg1_0 + (arg1_0_map0_0[i * 8 + 1])* 3 + 2;
    arg1_0_vec[18] = arg1_0 + (arg1_0_map0_0[i * 8 + 2])* 3 + 2;
    arg1_0_vec[19] = arg1_0 + (arg1_0_map0_0[i * 8 + 3])* 3 + 2;
    arg1_0_vec[20] = arg1_0 + (arg1_0_map0_0[i * 8 + 4])* 3 + 2;
    arg1_0_vec[21] = arg1_0 + (arg1_0_map0_0[i * 8 + 5])* 3 + 2;
    arg1_0_vec[22] = arg1_0 + (arg1_0_map0_0[i * 8 + 6])* 3 + 2;
    arg1_0_vec[23] = arg1_0 + (arg1_0_map0_0[i * 8 + 7])* 3 + 2;
    arg2_0_vec[0] = arg2_0 + (arg2_0_map0_0[i * 8 + 0])* 3;
    arg2_0_vec[1] = arg2_0 + (arg2_0_map0_0[i * 8 + 1])* 3;
    arg2_0_vec[2] = arg2_0 + (arg2_0_map0_0[i * 8 + 2])* 3;
    arg2_0_vec[3] = arg2_0 + (arg2_0_map0_0[i * 8 + 3])* 3;
    arg2_0_vec[4] = arg2_0 + (arg2_0_map0_0[i * 8 + 4])* 3;
    arg2_0_vec[5] = arg2_0 + (arg2_0_map0_0[i * 8 + 5])* 3;
    arg2_0_vec[6] = arg2_0 + (arg2_0_map0_0[i * 8 + 6])* 3;
    arg2_0_vec[7] = arg2_0 + (arg2_0_map0_0[i * 8 + 7])* 3;
    arg2_0_vec[8] = arg2_0 + (arg2_0_map0_0[i * 8 + 0])* 3 + 1;
    arg2_0_vec[9] = arg2_0 + (arg2_0_map0_0[i * 8 + 1])* 3 + 1;
    arg2_0_vec[10] = arg2_0 + (arg2_0_map0_0[i * 8 + 2])* 3 + 1;
    arg2_0_vec[11] = arg2_0 + (arg2_0_map0_0[i * 8 + 3])* 3 + 1;
    arg2_0_vec[12] = arg2_0 + (arg2_0_map0_0[i * 8 + 4])* 3 + 1;
    arg2_0_vec[13] = arg2_0 + (arg2_0_map0_0[i * 8 + 5])* 3 + 1;
    arg2_0_vec[14] = arg2_0 + (arg2_0_map0_0[i * 8 + 6])* 3 + 1;
    arg2_0_vec[15] = arg2_0 + (arg2_0_map0_0[i * 8 + 7])* 3 + 1;
    arg2_0_vec[16] = arg2_0 + (arg2_0_map0_0[i * 8 + 0])* 3 + 2;
    arg2_0_vec[17] = arg2_0 + (arg2_0_map0_0[i * 8 + 1])* 3 + 2;
    arg2_0_vec[18] = arg2_0 + (arg2_0_map0_0[i * 8 + 2])* 3 + 2;
    arg2_0_vec[19] = arg2_0 + (arg2_0_map0_0[i * 8 + 3])* 3 + 2;
    arg2_0_vec[20] = arg2_0 + (arg2_0_map0_0[i * 8 + 4])* 3 + 2;
    arg2_0_vec[21] = arg2_0 + (arg2_0_map0_0[i * 8 + 5])* 3 + 2;
    arg2_0_vec[22] = arg2_0 + (arg2_0_map0_0[i * 8 + 6])* 3 + 2;
    arg2_0_vec[23] = arg2_0 + (arg2_0_map0_0[i * 8 + 7])* 3 + 2;
    double buffer_arg0_0[24][24] __attribute__((aligned(16))) = {{0.0}};
    form00_interior_facet_integral_otherwise(buffer_arg0_0, arg1_0_vec, arg2_0_vec, arg3_0 + (i * 2));
                    double tmp_buffer_arg0_0[24][24] __attribute__((aligned(16)));
                    for ( int j = 0; j < 8; j++ ) {
                       for ( int k = 0; k < 3; k++ ) {
                          for ( int l = 0; l < 8; l++ ) {
                             for ( int m = 0; m < 3; m++ ) {
                                tmp_buffer_arg0_0[3*j + k][3*l + m] = buffer_arg0_0[j + 8*k][l + 8*m];
                             }
                          }
                       }
                    }
    MatSetValuesBlockedLocal(arg0_0_0, 8, arg0_0_map0_0 + i * 8,
                                             8, arg0_0_map1_0 + i * 8,
                                             (const PetscScalar *)tmp_buffer_arg0_0,
                                             ADD_VALUES);;
  }
}

Thoughts on where this might be breaking?

@FabioLuporini
Copy link
Contributor

Uhmm...

Does this systematically appear at least?

Can you try commenting out self._min_temporaries() in optimizer.py and see what happens?

@wence-
Copy link
Contributor Author

wence- commented Sep 13, 2016

Hmm, sorry, I can't recall exactly what I was using to make this problem. I will keep an eye out and try that. That looks like a likely suspect though.

@wence-
Copy link
Contributor Author

wence- commented Sep 13, 2016

That helps, but doesn't solve the problem:

diff -u /data/lmitche1/pyop2-cache/mismatching-kernels/src-rank0.c /data/lmitche1/pyop2-cache/mismatching-kernels/src-rank1.c
--- /data/lmitche1/pyop2-cache/mismatching-kernels/src-rank0.c  2016-09-13 13:45:58.453774754 +0100
+++ /data/lmitche1/pyop2-cache/mismatching-kernels/src-rank1.c  2016-09-13 13:45:58.453774754 +0100
@@ -617,9 +617,9 @@
       ip_k_84_1_0[j] = (k_84_0_0[j] + (t237[j] * c_84_0_1)) + k_84_0_1[j];
       ip_k_84_1_1[j] = (k_84_0_2[j] + ((t245[j] * c_84_0_4) + (t240[j] * c_84_0_5))) + ((t234[j] * c_84_0_1) + k_84_0_3[j]);
       ip_k_84_1_2[j] = ((k_84_0_4[j] + (t231[j] * c_84_0_1)) + ((t238[j] * c_84_0_5) + k_84_0_5[j])) + k_84_0_6[j];
-      ip_j_84_1_0[j] = j_85_0_1[j] + (t133[facet[0]][ip][j] * c_84_0_4);
+      ip_j_84_1_0[j] = j_84_0_0[j] + (t133[facet[0]][ip][j] * c_84_0_4);
       ip_j_84_1_1[j] = j_84_0_1[j] + (t135[facet[0]][ip][j] * c_84_0_4);
-      ip_j_84_1_2[j] = j_85_0_0[j] + (t133[facet[0]][ip][j] * c_84_0_5);
+      ip_j_84_1_2[j] = j_84_0_2[j] + (t133[facet[0]][ip][j] * c_84_0_5);
       ip_k_85_0_0[j] = t219[j] * -1;
       ip_k_85_0_1[j] = t217[j] * -1;
       ip_k_85_0_2[j] = t134[facet[1]][ip][j] * t204;
@@ -647,7 +647,7 @@
       ip_k_86_1_2[j] = (k_86_0_4[j] + (t238[j] * c_86_0_2)) + k_86_0_5[j];
       ip_j_86_1_0[j] = j_86_0_0[j] + (t134[facet[1]][ip][j] * c_86_0_1);
       ip_j_86_1_1[j] = j_86_0_1[j] + (t135[facet[1]][ip][j] * c_86_0_3);
-      ip_j_86_1_2[j] = j_87_0_0[j] + (t135[facet[1]][ip][j] * c_86_0_1);
+      ip_j_86_1_2[j] = j_86_0_2[j] + (t135[facet[1]][ip][j] * c_86_0_1);
       ip_k_87_0_0[j] = ip_k_85_0_6[j];
       ip_k_87_0_1[j] = ip_k_85_0_8[j];
       ip_k_87_0_2[j] = t226[j] * -1;

Diff finished.  Tue Sep 13 13:57:56 2016

@wence-
Copy link
Contributor Author

wence- commented Sep 13, 2016

Example code that reproduces

from firedrake import *
mesh = UnitCubeMesh(10, 10, 10)


alpha = 340.27690917706

V = VectorFunctionSpace(mesh, "DG", 1)
Q = FunctionSpace(mesh, "CG", 2)
bcs_u_inlet = Function(V)
bcs_p_outlet = Constant(0)

W = V*Q

nu_bg = Constant(10)
y_star_plus = Constant(10)
Dt = Constant(1)
body_forces = Constant((0, 0, 0))


V_sca = FunctionSpace(mesh, "CG", 1)

u_tau = Function(V_sca)

u_adv = Function(VectorFunctionSpace(mesh, "CG", 1))
u_star = Function(V)

w0 = Function(W)
u0, p0 = w0.split()

w1 = Function(W)

u1, p1 = w1.split()

nu_T0 = Function(FunctionSpace(mesh, "DG", 0))
def tensor_jump(vector_field, normal):
    """ Equivalent of jump(scalar, n) for vectorial quantities. The
    inbuilt firedrake jump(vector, n) is as below but uses inner - i.e.
    returning a scalar... this here returns a vector.
    """
    return outer(vector_field('+'), normal('+')) \
           + outer(vector_field('-'), normal('-'))

def get_form(u0, u_adv, u_star, p1, 
             nu_T0=Constant(0), u_tau=None):
    """ The form for the discontinuous galerkin discretisation of the
    equations for the coupled velocity / pressure solve usign schur
    complement pressure projection.

    :var u0: Velocity field
    :type k1: :class:`Function`
    :var nu_T0: The turbulent viscosity
    :type nu_T0: :class:`Function`
    :var u_tau: The friction velocity
    :type u_tau: :class:`Function`

    """
    def tensor_jump(vector_field, normal):
        """ Equivalent of jump(scalar, n) for vectorial quantities. The
        inbuilt firedrake jump(vector, n) is as below but uses inner - i.e.
        returning a scalar... this here returns a vector.
        """
        return outer(vector_field('+'), normal('+')) \
               + outer(vector_field('-'), normal('-'))

    n    = FacetNormal(mesh)
    h    = CellSize(mesh)
    # Define the test and trial functions
    u, p = TrialFunctions(W)
    v, q = TestFunctions(W) 
    # Test and trial functions for the momentum parts
    w = TrialFunction(V)
    r = TestFunction(V)
    # For DG methods we have k at element edge, k_hat. The conditional
    # ensures we upwind - i.e. take upstream values for the edge term.  
    s = 0.5 * sign(dot(n('-'), u_adv)) + 0.5
    u_hat = s * w('-') + (1.0 - s) * w('+')

    # Define free slip condition start with wall-shear stress
    nu_up = (nu_bg + nu_T0)
    tau = nu_up * (nabla_grad(w) + nabla_grad(w).T)
    tau_rem = nu_up * (nabla_grad(u - u_star) + nabla_grad(u - u_star).T)
    t_w = - u_tau / y_star_plus * w
    t_w_rem = - u_tau / y_star_plus * (u - u_star)

    # For this method we split the pressure term out from the first equation
    # and the advection/diffusion terms out of the second. The first
    # equation we shall call Mom (for momentum), the second we shall call
    # Rem (for remainder terms).

    # Domain integrals
    # Transient
    transient_mom = (1 / Dt) * inner(w - u0, r)
    Mom = transient_mom * dx
    transient_rem = (1 / Dt) * inner(u - u_star, v)
    Rem = transient_rem * dx
    # Convection
    convection_vol = inner(w, dot(u_adv, nabla_grad(r)))
    Mom -= convection_vol * dx
    # Diffusion
    diffusion_vol = inner(grad(r), tau)
    Mom += diffusion_vol * dx
    diffusion_rem = inner(grad(v), tau_rem)
    # Pressure
    pressure_mom = dot(grad(p1), r)
    Mom += pressure_mom * dx
    pressure_rem = dot(grad(p - p1), v)
    Rem += pressure_rem * dx
    # Forcing
    f = body_forces
    forcing = inner(f, r)
    Mom -= forcing * dx 
    # Continuity
    continuity = dot(u, grad(q))
    Rem -= continuity * dx

    # Jump terms
    # Convection
    convection_edge = dot(u_hat, dot(tensor_jump(r, n), u_adv))
    Mom += convection_edge * dS
    # Diffusion
    tau_jump = avg(nu_up) * (tensor_jump(w, n) + tensor_jump(w, n).T)
    diffusion_edge = - inner(avg(grad(r)), tau_jump) \
                     - inner(tensor_jump(r, n), avg(tau)) \
                     + (alpha / avg(h)) \
                             * inner(tensor_jump(r, n), tau_jump)
    Mom += diffusion_edge * dS
    tau_jump_rem = avg(nu_up) * (tensor_jump(u - u_star, n) \
                                 + tensor_jump(u - u_star, n).T)
    diffusion_edge_rem = - inner(avg(grad(v)), tau_jump_rem) \
                         - inner(tensor_jump(v, n), avg(tau_rem)) \
                         + (alpha / avg(h)) \
                                 * inner(tensor_jump(v, n), tau_jump_rem)

    # Inlet terms
    inlets = (1, )
    # Convection
    convection_inlet = dot(bcs_u_inlet, r) * dot(n, u_adv)
    for bnd_id in inlets: Mom += convection_inlet * ds(bnd_id)
    # Diffusion
    tau_jump_inlet = nu_up * 2 * sym(outer(w, n) - outer(bcs_u_inlet, n))
    diffusion_inlet = - inner(grad(r), tau_jump_inlet) \
                      - inner(outer(r, n), tau) \
                      + (alpha / h) * inner(outer(r, n), tau_jump_inlet)
    for bnd_id in inlets: Mom += diffusion_inlet * ds(bnd_id)
    tau_jump_inlet_rem = nu_up * 2 * sym(outer(u - u_star, n))
    diffusion_inlet_rem = - inner(grad(v), tau_jump_inlet_rem) \
                          - inner(outer(v, n), tau_rem) \
                          + (alpha / h) \
                                      * inner(outer(v, n), tau_jump_inlet_rem)
    # Continuity
    continuity_inlet = q * dot(bcs_u_inlet, n)
    for bnd_id in inlets: Rem += continuity_inlet * ds(bnd_id)

    # Outlet terms
    outlets = (2, )
    # Convection
    convection_outlet = dot(w, r) * dot(n, u_adv)
    for bnd_id in outlets: Mom += convection_outlet * ds(bnd_id)
    # Pressure
    pressure_outlet_mom = (bcs_p_outlet - p1) * dot(n, r)
    for bnd_id in outlets: Mom += pressure_outlet_mom * ds(bnd_id)
    pressure_outlet_rem = (p - p1) * dot(n, v)
    for bnd_id in outlets: Rem -= pressure_outlet_rem * ds(bnd_id)
    # Continuity
    continuity_outlet = q * dot(u, n)
    for bnd_id in outlets: Rem += continuity_outlet * ds(bnd_id)

    # Wall terms
    walls = (3, 4)
    # Convection
    convection_wall = dot(w, r) * dot(n, u_adv)
    for bnd_id in walls: Mom += convection_wall * ds(bnd_id)
    # Diffusion
    tau_jump_wall = dot(w, n) * outer(n, n)
    diffusion_wall = - inner(grad(r), tau_jump_wall) \
                     - inner(dot(r, n), dot(n, dot(tau, n))) \
                     - inner(t_w, r) \
                     + (alpha / h) * inner(outer(r, n), tau_jump_wall)
    for bnd_id in walls: Mom += diffusion_wall * ds(bnd_id)
    tau_jump_wall_rem = dot(u - u_star, n) * outer(n, n)
    diffusion_wall_rem = - inner(grad(v), tau_jump_wall_rem) \
                         - inner(dot(v, n), dot(n, dot(tau_rem, n))) \
                         - inner(t_w_rem, v) \
                         + (alpha / h) \
                                    * inner(outer(v, n), tau_jump_wall_rem)

    # Free-slip boundaries
    fs_bounds = (5, 6)
    # Convection
    convection_fsb = dot(w, r) * dot(n, u_adv)
    for bnd_id in fs_bounds: Mom += convection_fsb * ds(bnd_id)
    # Diffusion
    tau_jump_fsb = dot(w, n) * outer(n, n)
    diffusion_fsb = - inner(grad(r), tau_jump_fsb) \
                    - inner(dot(r, n), dot(n, dot(tau, n))) \
                    + (alpha / h) * inner(outer(r, n), tau_jump_fsb)
    for bnd_id in fs_bounds: Mom += diffusion_fsb * ds(bnd_id)
    tau_jump_fsb_rem = dot(u - u_star, n) * outer(n, n)
    diffusion_fsb_rem = - inner(grad(v), tau_jump_fsb_rem) \
                        - inner(dot(v, n), dot(n, dot(tau_rem, n))) \
                        + (alpha / h) \
                                * inner(outer(v, n), tau_jump_fsb_rem)

    # Seperate the sides of the momentum equation
    a_mom = lhs(Mom)
    L_mom = rhs(Mom)
    # Seperate the sides of the remainder equation
    a_rem = lhs(Rem)
    L_rem = rhs(Rem)

    return a_mom, L_mom, a_rem, L_rem


a_mom, _, _, _ = get_form(u0, u_adv, u_star, p1, nu_T0, u_tau)
assemble(a_mom).M

@wence-
Copy link
Contributor Author

wence- commented Sep 13, 2016

Slightly reduced example:

from firedrake import *
mesh = UnitCubeMesh(2, 2, 2)


alpha = 340.27690917706

V = VectorFunctionSpace(mesh, "DG", 1)
Q = FunctionSpace(mesh, "CG", 2)
bcs_u_inlet = Function(V)
bcs_p_outlet = Constant(0)

W = V*Q

nu_bg = Constant(10)
y_star_plus = Constant(10)
Dt = Constant(1)
body_forces = Constant((0, 0, 0))


V_sca = FunctionSpace(mesh, "CG", 1)

u_tau = Function(V_sca)

u_adv = Function(VectorFunctionSpace(mesh, "CG", 1))
u_star = Function(V)

w0 = Function(W)
u0, p0 = w0.split()

w1 = Function(W)

u1, p1 = w1.split()

nu_T0 = Function(FunctionSpace(mesh, "DG", 0))
def tensor_jump(vector_field, normal):
    """ Equivalent of jump(scalar, n) for vectorial quantities. The
    inbuilt firedrake jump(vector, n) is as below but uses inner - i.e.
    returning a scalar... this here returns a vector.
    """
    return outer(vector_field('+'), normal('+')) \
           + outer(vector_field('-'), normal('-'))

def get_form(u0, u_adv, u_star, p1, 
             nu_T0=Constant(0), u_tau=None):
    """ The form for the discontinuous galerkin discretisation of the
    equations for the coupled velocity / pressure solve usign schur
    complement pressure projection.

    :var u0: Velocity field
    :type k1: :class:`Function`
    :var nu_T0: The turbulent viscosity
    :type nu_T0: :class:`Function`
    :var u_tau: The friction velocity
    :type u_tau: :class:`Function`

    """
    def tensor_jump(vector_field, normal):
        """ Equivalent of jump(scalar, n) for vectorial quantities. The
        inbuilt firedrake jump(vector, n) is as below but uses inner - i.e.
        returning a scalar... this here returns a vector.
        """
        return outer(vector_field('+'), normal('+')) \
               + outer(vector_field('-'), normal('-'))

    n    = FacetNormal(mesh)
    h    = CellSize(mesh)
    # Define the test and trial functions
    u, p = TrialFunctions(W)
    v, q = TestFunctions(W) 
    # Test and trial functions for the momentum parts
    w = TrialFunction(V)
    r = TestFunction(V)
    # For DG methods we have k at element edge, k_hat. The conditional
    # ensures we upwind - i.e. take upstream values for the edge term.  
    s = 0.5 * sign(dot(n('-'), u_adv)) + 0.5
    u_hat = s * w('-') + (1.0 - s) * w('+')

    # Define free slip condition start with wall-shear stress
    nu_up = (nu_bg + nu_T0)
    tau = nu_up * (nabla_grad(w) + nabla_grad(w).T)

    # For this method we split the pressure term out from the first equation
    # and the advection/diffusion terms out of the second. The first
    # equation we shall call Mom (for momentum), the second we shall call
    # Rem (for remainder terms).

    # Domain integrals
    # Transient
    Mom = 0
    # Convection
    convection_edge = dot(u_hat, dot(tensor_jump(r, n), u_adv))
    Mom += convection_edge * dS
    # Diffusion
    tau_jump = avg(nu_up) * (tensor_jump(w, n) + tensor_jump(w, n).T)
    diffusion_edge = - inner(avg(grad(r)), tau_jump) \
                     - inner(tensor_jump(r, n), avg(tau)) \
                     + (alpha / avg(h)) \
                             * inner(tensor_jump(r, n), tau_jump)
    Mom += diffusion_edge * dS

    return lhs(Mom) # , L_mom, a_rem, L_rem


a_mom = get_form(u0, u_adv, u_star, p1, nu_T0, u_tau)
assemble(a_mom).M

@FabioLuporini
Copy link
Contributor

ugh, painful. I can't reproduce it.

This is supposed to produce a single kernel and terminate, right?

How many processes did you use to run this?

@FabioLuporini
Copy link
Contributor

btw, are you sure you haven't accidentally cut anything from the last diff that you pasted ?

@FabioLuporini
Copy link
Contributor

Could you try commenting out lines [142,152] in optimizer.py ?

If that fixed the problem, could you then uncomment them, and only comment out line 188 (self._simplify(...)) in scheduler.py ?

@wence-
Copy link
Contributor Author

wence- commented Sep 15, 2016

I used 16 processes. It doesn't always happen, you have to run firedrake-clean in between each run.

@wence-
Copy link
Contributor Author

wence- commented Sep 15, 2016

Yes, if I comment out lines 142-152 then the problem goes away. Similarly if I comment out line 188 in scheduler.py only. I did a little bit more digging, this is what I found. SSALoopMerger.merge computes the loops to merge and turns it into merged_loops. These are then sent to SSALoopMerger._simplify. But, the loops found to merge are not guaranteed to come out in the same order on all processes. So we have on (say) rank 0 an ordering [A, B, C] and on rank 1 an ordering [B, A, C]. The temporary replacement walks the loops in the order it sees them and for each statement in the loop builds a dict: {rvalue: lvalue}, now if we see a new statement whose rvalue is already found in the dict, we just reuse the temporary. But now imagine that A and B both have statements whose rvalue is the same, but which write to different lvalues:

loop A:
    lvalueA = rvalue;
loop B:
    lvalueB = rvalue;
    use_lvalueB;

If I visit loop A first, this is transformed into:

loop A:
   lvalueA = rvalue;
loop B:
   use_lvalueA;

And vice versa if loop B is visited first.

Concretely this is what I see happening in this example. I've pasted below the order in which the merged loops are visited on two ranks that disagree. And then the resulting temporaries-replaced loops (with diff).

On rank 0:


for (int  j  = 0; j < 12; j += 1)
{
  ip_k_84_0_0[j] = t240[j] * -1;
  ip_k_84_0_1[j] = t234[j] * -1;
  ip_k_84_0_2[j] = t245[j] * -1;
  ip_k_84_0_3[j] = t133[facet[0]][ip][j] * t205;
  ip_k_84_0_4[j] = t237[j] * -1;
  ip_k_84_0_5[j] = t231[j] * -1;
  ip_k_84_0_6[j] = t238[j] * -1;
  ip_k_84_1_0[j] = (k_84_0_0[j] + (t237[j] * c_84_0_1)) + k_84_0_1[j];
  ip_k_84_1_1[j] = (k_84_0_2[j] + ((t245[j] * c_84_0_4) + (t240[j] * c_84_0_5))) + ((t234[j] * c_84_0_1) + k_84_0_3[j]);
  ip_k_84_1_2[j] = ((k_84_0_4[j] + (t231[j] * c_84_0_1)) + ((t238[j] * c_84_0_5) + k_84_0_5[j])) + k_84_0_6[j];
  ip_j_84_1_0[j] = j_84_0_0[j] + (t133[facet[0]][ip][j] * c_84_0_4);
  ip_j_84_1_1[j] = j_84_0_1[j] + (t135[facet[0]][ip][j] * c_84_0_4);
  ip_j_84_1_2[j] = j_84_0_2[j] + (t133[facet[0]][ip][j] * c_84_0_5);
  ip_k_85_0_0[j] = t219[j] * -1;
  ip_k_85_0_1[j] = t217[j] * -1;
  ip_k_85_0_2[j] = t134[facet[1]][ip][j] * t204;
  ip_k_85_0_3[j] = t223[j] * -1;
  ip_k_85_0_4[j] = t224[j] * -1;
  ip_k_85_0_5[j] = t213[j] * -1;
  ip_k_85_0_6[j] = t133[facet[1]][ip][j] * t204;
  ip_k_85_0_7[j] = t216[j] * -1;
  ip_k_85_0_8[j] = t210[j] * -1;
  ip_k_85_1_0[j] = (k_85_0_0[j] + (t216[j] * c_85_0_1)) + k_85_0_1[j];
  ip_k_85_1_1[j] = (k_85_0_2[j] + ((t224[j] * c_85_0_5) + (t219[j] * c_85_0_4))) + ((t213[j] * c_85_0_1) + k_85_0_3[j]);
  ip_k_85_1_2[j] = (k_85_0_4[j] + ((t223[j] * c_85_0_5) + (t217[j] * c_85_0_4))) + ((t210[j] * c_85_0_1) + k_85_0_5[j]);
  ip_j_85_1_0[j] = j_85_0_0[j] + (t133[facet[0]][ip][j] * c_85_0_4);
  ip_j_85_1_1[j] = j_85_0_1[j] + (t133[facet[0]][ip][j] * c_85_0_5);
  ip_k_86_0_0[j] = t133[facet[0]][ip][j] * t205;
  ip_k_86_0_1[j] = t247[j] * -1;
  ip_k_86_0_2[j] = t240[j] * -1;
  ip_k_86_0_3[j] = t134[facet[0]][ip][j] * t205;
  ip_k_86_0_4[j] = t238[j] * -1;
  ip_k_86_0_5[j] = t237[j] * -1;
  ip_k_86_0_6[j] = t243[j] * -1;
  ip_k_86_0_7[j] = t234[j] * -1;
  ip_k_86_1_0[j] = (k_86_0_0[j] + ((t247[j] * c_86_0_1) + (t243[j] * c_86_0_2))) + ((t237[j] * c_86_0_3) + k_86_0_1[j]);
  ip_k_86_1_1[j] = (k_86_0_2[j] + (t240[j] * c_86_0_2)) + ((t234[j] * c_86_0_3) + k_86_0_3[j]);
  ip_k_86_1_2[j] = (k_86_0_4[j] + (t238[j] * c_86_0_2)) + k_86_0_5[j];
  ip_j_86_1_0[j] = j_86_0_0[j] + (t134[facet[1]][ip][j] * c_86_0_1);
  ip_j_86_1_1[j] = j_86_0_1[j] + (t135[facet[1]][ip][j] * c_86_0_3);
  ip_j_86_1_2[j] = j_86_0_2[j] + (t135[facet[1]][ip][j] * c_86_0_1);
  ip_k_87_0_0[j] = t133[facet[1]][ip][j] * t204;
  ip_k_87_0_1[j] = t210[j] * -1;
  ip_k_87_0_2[j] = t226[j] * -1;
  ip_k_87_0_3[j] = t224[j] * -1;
  ip_k_87_0_4[j] = t219[j] * -1;
  ip_k_87_0_5[j] = t134[facet[1]][ip][j] * t204;
  ip_k_87_0_6[j] = t217[j] * -1;
  ip_k_87_0_7[j] = t216[j] * -1;
  ip_k_87_0_8[j] = t222[j] * -1;
  ip_k_87_0_9[j] = t213[j] * -1;
  ip_k_87_1_0[j] = (k_87_0_0[j] + ((t222[j] * c_87_0_1) + (t226[j] * c_87_0_2))) + ((t216[j] * c_87_0_3) + k_87_0_1[j]);
  ip_k_87_1_1[j] = (k_87_0_2[j] + ((t224[j] * c_87_0_2) + (t219[j] * c_87_0_1))) + ((t213[j] * c_87_0_3) + k_87_0_3[j]);
  ip_k_87_1_2[j] = (k_87_0_4[j] + (t217[j] * c_87_0_1)) + ((t210[j] * c_87_0_3) + k_87_0_5[j]);
  ip_j_87_1_0[j] = j_87_0_0[j] + (t135[facet[1]][ip][j] * c_87_0_2);

}




for (int  j  = 0; j < 12; j += 1)
{
  k_84_0_0[j] = t180[j] * c_84_0_0;
  k_84_0_1[j] = (t176[j] * c_84_0_2) + (t170[j] * c_84_0_3);
  k_84_0_2[j] = t178[j] * c_84_0_0;
  k_84_0_3[j] = (t167[j] * c_84_0_3) + (t173[j] * c_84_0_2);
  k_84_0_4[j] = t177[j] * c_84_0_0;
  k_84_0_5[j] = t171[j] * c_84_0_2;
  k_84_0_6[j] = t164[j] * c_84_0_3;
  j_84_0_0[j] = t198[j] * -1;
  j_84_0_1[j] = t196[j] * -1;
  j_84_0_2[j] = t195[j] * -1;
  k_85_0_0[j] = t162[j] * c_85_0_0;
  k_85_0_1[j] = (t158[j] * c_85_0_2) + (t152[j] * c_85_0_3);
  k_85_0_2[j] = t160[j] * c_85_0_0;
  k_85_0_3[j] = (t149[j] * c_85_0_3) + (t155[j] * c_85_0_2);
  k_85_0_4[j] = t159[j] * c_85_0_0;
  k_85_0_5[j] = (t146[j] * c_85_0_3) + (t153[j] * c_85_0_2);
  j_85_0_0[j] = t195[j] * -1;
  j_85_0_1[j] = t198[j] * -1;
  k_86_0_0[j] = t180[j] * c_86_0_0;
  k_86_0_1[j] = (t176[j] * c_86_0_4) + (t170[j] * c_86_0_5);
  k_86_0_2[j] = t178[j] * c_86_0_0;
  k_86_0_3[j] = (t167[j] * c_86_0_5) + (t173[j] * c_86_0_4);
  k_86_0_4[j] = t177[j] * c_86_0_0;
  k_86_0_5[j] = (t171[j] * c_86_0_4) + (t164[j] * c_86_0_5);
  j_86_0_0[j] = t188[j] * -1;
  j_86_0_1[j] = t181[j] * -1;
  j_86_0_2[j] = t187[j] * -1;
  k_87_0_0[j] = t162[j] * c_87_0_0;
  k_87_0_1[j] = (t158[j] * c_87_0_4) + (t152[j] * c_87_0_5);
  k_87_0_2[j] = t160[j] * c_87_0_0;
  k_87_0_3[j] = (t149[j] * c_87_0_5) + (t155[j] * c_87_0_4);
  k_87_0_4[j] = t159[j] * c_87_0_0;
  k_87_0_5[j] = (t146[j] * c_87_0_5) + (t153[j] * c_87_0_4);
  j_87_0_0[j] = t187[j] * -1;

}




for (int  i  = 0; i < 4; i += 1)
{
  w_1[0][i+8] = w_1_[i+16][0];
  w_1[1][i+8] = w_1_[i+20][0];

}

On rank 1:


for (int  j  = 0; j < 12; j += 1)
{
  k_84_0_0[j] = t180[j] * c_84_0_0;
  k_84_0_1[j] = (t176[j] * c_84_0_2) + (t170[j] * c_84_0_3);
  k_84_0_2[j] = t178[j] * c_84_0_0;
  k_84_0_3[j] = (t167[j] * c_84_0_3) + (t173[j] * c_84_0_2);
  k_84_0_4[j] = t177[j] * c_84_0_0;
  k_84_0_5[j] = t171[j] * c_84_0_2;
  k_84_0_6[j] = t164[j] * c_84_0_3;
  j_84_0_0[j] = t198[j] * -1;
  j_84_0_1[j] = t196[j] * -1;
  j_84_0_2[j] = t195[j] * -1;
  k_85_0_0[j] = t162[j] * c_85_0_0;
  k_85_0_1[j] = (t158[j] * c_85_0_2) + (t152[j] * c_85_0_3);
  k_85_0_2[j] = t160[j] * c_85_0_0;
  k_85_0_3[j] = (t149[j] * c_85_0_3) + (t155[j] * c_85_0_2);
  k_85_0_4[j] = t159[j] * c_85_0_0;
  k_85_0_5[j] = (t146[j] * c_85_0_3) + (t153[j] * c_85_0_2);
  j_85_0_0[j] = t195[j] * -1;
  j_85_0_1[j] = t198[j] * -1;
  k_86_0_0[j] = t180[j] * c_86_0_0;
  k_86_0_1[j] = (t176[j] * c_86_0_4) + (t170[j] * c_86_0_5);
  k_86_0_2[j] = t178[j] * c_86_0_0;
  k_86_0_3[j] = (t167[j] * c_86_0_5) + (t173[j] * c_86_0_4);
  k_86_0_4[j] = t177[j] * c_86_0_0;
  k_86_0_5[j] = (t171[j] * c_86_0_4) + (t164[j] * c_86_0_5);
  j_86_0_0[j] = t188[j] * -1;
  j_86_0_1[j] = t181[j] * -1;
  j_86_0_2[j] = t187[j] * -1;
  k_87_0_0[j] = t162[j] * c_87_0_0;
  k_87_0_1[j] = (t158[j] * c_87_0_4) + (t152[j] * c_87_0_5);
  k_87_0_2[j] = t160[j] * c_87_0_0;
  k_87_0_3[j] = (t149[j] * c_87_0_5) + (t155[j] * c_87_0_4);
  k_87_0_4[j] = t159[j] * c_87_0_0;
  k_87_0_5[j] = (t146[j] * c_87_0_5) + (t153[j] * c_87_0_4);
  j_87_0_0[j] = t187[j] * -1;

}




for (int  j  = 0; j < 12; j += 1)
{
  ip_k_84_0_0[j] = t240[j] * -1;
  ip_k_84_0_1[j] = t234[j] * -1;
  ip_k_84_0_2[j] = t245[j] * -1;
  ip_k_84_0_3[j] = t133[facet[0]][ip][j] * t205;
  ip_k_84_0_4[j] = t237[j] * -1;
  ip_k_84_0_5[j] = t231[j] * -1;
  ip_k_84_0_6[j] = t238[j] * -1;
  ip_k_84_1_0[j] = (k_84_0_0[j] + (t237[j] * c_84_0_1)) + k_84_0_1[j];
  ip_k_84_1_1[j] = (k_84_0_2[j] + ((t245[j] * c_84_0_4) + (t240[j] * c_84_0_5))) + ((t234[j] * c_84_0_1) + k_84_0_3[j]);
  ip_k_84_1_2[j] = ((k_84_0_4[j] + (t231[j] * c_84_0_1)) + ((t238[j] * c_84_0_5) + k_84_0_5[j])) + k_84_0_6[j];
  ip_j_84_1_0[j] = j_84_0_0[j] + (t133[facet[0]][ip][j] * c_84_0_4);
  ip_j_84_1_1[j] = j_84_0_1[j] + (t135[facet[0]][ip][j] * c_84_0_4);
  ip_j_84_1_2[j] = j_84_0_2[j] + (t133[facet[0]][ip][j] * c_84_0_5);
  ip_k_85_0_0[j] = t219[j] * -1;
  ip_k_85_0_1[j] = t217[j] * -1;
  ip_k_85_0_2[j] = t134[facet[1]][ip][j] * t204;
  ip_k_85_0_3[j] = t223[j] * -1;
  ip_k_85_0_4[j] = t224[j] * -1;
  ip_k_85_0_5[j] = t213[j] * -1;
  ip_k_85_0_6[j] = t133[facet[1]][ip][j] * t204;
  ip_k_85_0_7[j] = t216[j] * -1;
  ip_k_85_0_8[j] = t210[j] * -1;
  ip_k_85_1_0[j] = (k_85_0_0[j] + (t216[j] * c_85_0_1)) + k_85_0_1[j];
  ip_k_85_1_1[j] = (k_85_0_2[j] + ((t224[j] * c_85_0_5) + (t219[j] * c_85_0_4))) + ((t213[j] * c_85_0_1) + k_85_0_3[j]);
  ip_k_85_1_2[j] = (k_85_0_4[j] + ((t223[j] * c_85_0_5) + (t217[j] * c_85_0_4))) + ((t210[j] * c_85_0_1) + k_85_0_5[j]);
  ip_j_85_1_0[j] = j_85_0_0[j] + (t133[facet[0]][ip][j] * c_85_0_4);
  ip_j_85_1_1[j] = j_85_0_1[j] + (t133[facet[0]][ip][j] * c_85_0_5);
  ip_k_86_0_0[j] = t133[facet[0]][ip][j] * t205;
  ip_k_86_0_1[j] = t247[j] * -1;
  ip_k_86_0_2[j] = t240[j] * -1;
  ip_k_86_0_3[j] = t134[facet[0]][ip][j] * t205;
  ip_k_86_0_4[j] = t238[j] * -1;
  ip_k_86_0_5[j] = t237[j] * -1;
  ip_k_86_0_6[j] = t243[j] * -1;
  ip_k_86_0_7[j] = t234[j] * -1;
  ip_k_86_1_0[j] = (k_86_0_0[j] + ((t247[j] * c_86_0_1) + (t243[j] * c_86_0_2))) + ((t237[j] * c_86_0_3) + k_86_0_1[j]);
  ip_k_86_1_1[j] = (k_86_0_2[j] + (t240[j] * c_86_0_2)) + ((t234[j] * c_86_0_3) + k_86_0_3[j]);
  ip_k_86_1_2[j] = (k_86_0_4[j] + (t238[j] * c_86_0_2)) + k_86_0_5[j];
  ip_j_86_1_0[j] = j_86_0_0[j] + (t134[facet[1]][ip][j] * c_86_0_1);
  ip_j_86_1_1[j] = j_86_0_1[j] + (t135[facet[1]][ip][j] * c_86_0_3);
  ip_j_86_1_2[j] = j_86_0_2[j] + (t135[facet[1]][ip][j] * c_86_0_1);
  ip_k_87_0_0[j] = t133[facet[1]][ip][j] * t204;
  ip_k_87_0_1[j] = t210[j] * -1;
  ip_k_87_0_2[j] = t226[j] * -1;
  ip_k_87_0_3[j] = t224[j] * -1;
  ip_k_87_0_4[j] = t219[j] * -1;
  ip_k_87_0_5[j] = t134[facet[1]][ip][j] * t204;
  ip_k_87_0_6[j] = t217[j] * -1;
  ip_k_87_0_7[j] = t216[j] * -1;
  ip_k_87_0_8[j] = t222[j] * -1;
  ip_k_87_0_9[j] = t213[j] * -1;
  ip_k_87_1_0[j] = (k_87_0_0[j] + ((t222[j] * c_87_0_1) + (t226[j] * c_87_0_2))) + ((t216[j] * c_87_0_3) + k_87_0_1[j]);
  ip_k_87_1_1[j] = (k_87_0_2[j] + ((t224[j] * c_87_0_2) + (t219[j] * c_87_0_1))) + ((t213[j] * c_87_0_3) + k_87_0_3[j]);
  ip_k_87_1_2[j] = (k_87_0_4[j] + (t217[j] * c_87_0_1)) + ((t210[j] * c_87_0_3) + k_87_0_5[j]);
  ip_j_87_1_0[j] = j_87_0_0[j] + (t135[facet[1]][ip][j] * c_87_0_2);

}




for (int  i  = 0; i < 4; i += 1)
{
  w_1[0][i+8] = w_1_[i+16][0];
  w_1[1][i+8] = w_1_[i+20][0];

}

The resulting difference between the loops:

@@ -10,9 +10,9 @@
   ip_k_84_1_0[j] = (k_84_0_0[j] + (t237[j] * c_84_0_1)) + k_84_0_1[j];
   ip_k_84_1_1[j] = (k_84_0_2[j] + ((t245[j] * c_84_0_4) + (t240[j] * c_84_0_5))) + ((t234[j] * c_84_0_1) + k_84_0_3[j]);
   ip_k_84_1_2[j] = ((k_84_0_4[j] + (t231[j] * c_84_0_1)) + ((t238[j] * c_84_0_5) + k_84_0_5[j])) + k_84_0_6[j];
-  ip_j_84_1_0[j] = j_84_0_0[j] + (t133[facet[0]][ip][j] * c_84_0_4);
+  ip_j_84_1_0[j] = j_85_0_1[j] + (t133[facet[0]][ip][j] * c_84_0_4);
   ip_j_84_1_1[j] = j_84_0_1[j] + (t135[facet[0]][ip][j] * c_84_0_4);
-  ip_j_84_1_2[j] = j_84_0_2[j] + (t133[facet[0]][ip][j] * c_84_0_5);
+  ip_j_84_1_2[j] = j_85_0_0[j] + (t133[facet[0]][ip][j] * c_84_0_5);
   ip_k_85_0_0[j] = t219[j] * -1;
   ip_k_85_0_1[j] = t217[j] * -1;
   ip_k_85_0_2[j] = t134[facet[1]][ip][j] * t204;
@@ -40,7 +40,7 @@
   ip_k_86_1_2[j] = (k_86_0_4[j] + (t238[j] * c_86_0_2)) + k_86_0_5[j];
   ip_j_86_1_0[j] = j_86_0_0[j] + (t134[facet[1]][ip][j] * c_86_0_1);
   ip_j_86_1_1[j] = j_86_0_1[j] + (t135[facet[1]][ip][j] * c_86_0_3);
-  ip_j_86_1_2[j] = j_86_0_2[j] + (t135[facet[1]][ip][j] * c_86_0_1);
+  ip_j_86_1_2[j] = j_87_0_0[j] + (t135[facet[1]][ip][j] * c_86_0_1);
   ip_k_87_0_0[j] = ip_k_85_0_6[j];
   ip_k_87_0_1[j] = ip_k_85_0_8[j];
   ip_k_87_0_2[j] = t226[j] * -1;

@FabioLuporini
Copy link
Contributor

Yes, that's what I thought although I'm still unable to reproduce the bug. That's why I pointed you to those lines.

Can you replace these two lines:
found_nests = defaultdict(list) ---> OrderedDict()
found_nests[key].append(loops[-1]) ---> found_nests.setdefault(key, []).append(loops[-1])

and see if the problem goes away?

Sorry I can't test it myself

@wence-
Copy link
Contributor Author

wence- commented Sep 15, 2016

That seems to work.

@FabioLuporini
Copy link
Contributor

Right, thanks, fix in #92

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants