12 #ifndef MFEM_INVARIANTS_HPP
13 #define MFEM_INVARIANTS_HPP
15 #include "../config/config.hpp"
16 #include "../general/error.hpp"
26 template <
typename scalar_t>
29 static scalar_t
sign(
const scalar_t &
a)
30 {
return (a >= scalar_t(0)) ? scalar_t(1) : scalar_t(-1); }
32 static scalar_t
pow(
const scalar_t &x,
int m,
int n)
33 {
return std::pow(x, scalar_t(m)/n); }
48 template <
typename scalar_t,
typename scalar_ops = ScalarOps<scalar_t> >
86 I1 =
J[0]*
J[0] +
J[1]*
J[1] +
J[2]*
J[2] +
J[3]*
J[3];
96 const scalar_t det =
J[0]*
J[3] -
J[1]*
J[2];
110 const scalar_t c1 = 2/
Get_I2b();
111 const scalar_t c2 =
Get_I1b()/2;
115 dI1b[2] = c1*(
J[2] - c2*
dI2b[2]);
116 dI1b[3] = c1*(
J[3] - c2*
dI2b[3]);
123 const scalar_t c1 = 2*
Get_I2b();
152 void Eval_DZt(
const scalar_t *Z, scalar_t **DZt_ptr)
154 MFEM_ASSERT(
D != NULL,
"");
156 scalar_t *DZt = *DZt_ptr;
157 if (DZt == NULL) { *DZt_ptr = DZt =
new scalar_t[2*
alloc_height]; }
158 for (
int i = 0; i < nd; i++)
160 const int i0 = i+nd*0, i1 = i+nd*1;
161 DZt[i0] =
D[i0]*Z[0] +
D[i1]*Z[2];
162 DZt[i1] =
D[i0]*Z[1] +
D[i1]*Z[3];
189 delete []
DYt;
DYt = NULL;
190 delete []
DXt;
DXt = NULL;
191 delete []
DJt;
DJt = NULL;
192 delete []
DaJ;
DaJ = NULL;
236 const scalar_t
a = 2*w;
237 for (
int i = 0; i < nd; i++)
239 const int i0 = i+nd*0, i1 = i+nd*1;
240 const scalar_t aDi[2] = { a*
D[i0], a*D[i1] };
242 const scalar_t aDDt_ii = aDi[0]*
D[i0] + aDi[1]*
D[i1];
243 A[i0+ah*i0] += aDDt_ii;
244 A[i1+ah*i1] += aDDt_ii;
246 for (
int k = 0; k < i; k++)
248 const int k0 = k+nd*0, k1 = k+nd*1;
249 const scalar_t aDDt_ik = aDi[0]*D[k0] + aDi[1]*D[k1];
250 A[i0+ah*k0] += aDDt_ik;
251 A[k0+ah*i0] += aDDt_ik;
252 A[i1+ah*k1] += aDDt_ik;
253 A[k1+ah*i1] += aDDt_ik;
280 const scalar_t c = -2*w/
Get_I2();
281 for (
int i = 0; i < nd; i++)
283 const int i0 = i+nd*0, i1 = i+nd*1;
284 const scalar_t aDaJ_i[2] = { a*
DaJ[i0], a*DaJ[i1] };
285 const scalar_t bD_i[2] = { b*
D[i0], b*D[i1] };
286 const scalar_t cDJt_i[2] = { c*
DJt[i0], c*DJt[i1] };
287 const scalar_t cDaJ_i[2] = { c*
DaJ[i0], c*DaJ[i1] };
291 const scalar_t A2_ii = bD_i[0]*
D[i0] + bD_i[1]*
D[i1];
293 A[i0+ah*i0] += 2*(aDaJ_i[0] + cDJt_i[0])*
DaJ[i0] + A2_ii;
296 const scalar_t A_ii_01 =
297 (2*aDaJ_i[0] + cDJt_i[0])*
DaJ[i1] + cDaJ_i[0]*
DJt[i1];
298 A[i0+ah*i1] += A_ii_01;
299 A[i1+ah*i0] += A_ii_01;
301 A[i1+ah*i1] += 2*(aDaJ_i[1] + cDJt_i[1])*
DaJ[i1] + A2_ii;
304 for (
int k = 0; k < i; k++)
306 const int k0 = k+nd*0, k1 = k+nd*1;
308 const scalar_t A1_ik_01 = aDaJ_i[0]*
DaJ[k1] + aDaJ_i[1]*
DaJ[k0];
311 const scalar_t A2_ik = bD_i[0]*
D[k0] + bD_i[1]*
D[k1];
313 const scalar_t A_ik_00 =
314 (2*aDaJ_i[0] + cDJt_i[0])*DaJ[k0] + A2_ik + cDaJ_i[0]*
DJt[k0];
315 A[i0+ah*k0] += A_ik_00;
316 A[k0+ah*i0] += A_ik_00;
318 const scalar_t A_ik_01 =
319 A1_ik_01 + cDJt_i[0]*DaJ[k1] + cDaJ_i[0]*
DJt[k1];
320 A[i0+ah*k1] += A_ik_01;
321 A[k1+ah*i0] += A_ik_01;
323 const scalar_t A_ik_10 =
324 A1_ik_01 + cDJt_i[1]*DaJ[k0] + cDaJ_i[1]*DJt[k0];
325 A[i1+ah*k0] += A_ik_10;
326 A[k0+ah*i1] += A_ik_10;
328 const scalar_t A_ik_11 =
329 (2*aDaJ_i[1] + cDJt_i[1])*DaJ[k1] + A2_ik + cDaJ_i[1]*DJt[k1];
330 A[i1+ah*k1] += A_ik_11;
331 A[k1+ah*i1] += A_ik_11;
356 const scalar_t
a = 2*w;
357 for (
int i = 0; i < ah; i++)
359 const scalar_t avi = a*
DaJ[i];
360 A[i+ah*i] += avi*DaJ[i];
361 for (
int j = 0; j < i; j++)
363 const scalar_t aVVt_ij = avi*DaJ[j];
364 A[i+ah*j] += aVVt_ij;
365 A[j+ah*i] += aVVt_ij;
368 const int j = 1, l = 0;
369 for (
int i = 0; i < nd; i++)
371 const int ij = i+nd*j, il = i+nd*l;
372 const scalar_t aDaJ_ij = a*
DaJ[ij], aDaJ_il = a*DaJ[il];
373 for (
int k = 0; k < i; k++)
375 const int kj = k+nd*j, kl = k+nd*l;
376 const scalar_t A_ijkl = aDaJ_ij*DaJ[kl] - aDaJ_il*DaJ[kj];
377 A[ij+ah*kl] += A_ijkl;
378 A[kl+ah*ij] += A_ijkl;
379 A[kj+ah*il] -= A_ijkl;
380 A[il+ah*kj] -= A_ijkl;
405 const int j = 1, l = 0;
407 for (
int i = 0; i < nd; i++)
409 const int ij = i+nd*j, il = i+nd*l;
410 const scalar_t aDaJ_ij = a*
DaJ[ij], aDaJ_il = a*DaJ[il];
411 for (
int k = 0; k < i; k++)
413 const int kj = k+nd*j, kl = k+nd*l;
414 const scalar_t A_ijkl = aDaJ_ij*DaJ[kl] - aDaJ_il*DaJ[kj];
415 A[ij+ah*kl] += A_ijkl;
416 A[kl+ah*ij] += A_ijkl;
417 A[kj+ah*il] -= A_ijkl;
418 A[il+ah*kj] -= A_ijkl;
440 for (
int i = 0; i < ah; i++)
442 const scalar_t axi = w*
DXt[i], ayi = w*
DYt[i];
443 A[i+ah*i] += 2*axi*DYt[i];
444 for (
int j = 0; j < i; j++)
446 const scalar_t A_ij = axi*DYt[j] + ayi*DXt[j];
466 for (
int i = 0; i < ah; i++)
468 const scalar_t axi = w*
DXt[i];
469 A[i+ah*i] += axi*DXt[i];
470 for (
int j = 0; j < i; j++)
472 const scalar_t A_ij = axi*DXt[j];
493 template <
typename scalar_t,
typename scalar_ops = ScalarOps<scalar_t> >
544 B[0] =
J[0]*
J[0] +
J[3]*
J[3] +
J[6]*
J[6];
545 B[1] = J[1]*J[1] + J[4]*J[4] + J[7]*J[7];
546 B[2] = J[2]*J[2] + J[5]*J[5] + J[8]*J[8];
547 I1 =
B[0] +
B[1] +
B[2];
559 B[3] =
J[0]*
J[1] +
J[3]*
J[4] +
J[6]*
J[7];
560 B[4] = J[0]*J[2] + J[3]*J[5] + J[6]*J[8];
561 B[5] = J[1]*J[2] + J[4]*J[5] + J[7]*J[8];
568 const scalar_t BF2 =
B[0]*
B[0] +
B[1]*
B[1] +
B[2]*
B[2] +
569 2*(
B[3]*
B[3] +
B[4]*
B[4] +
B[5]*
B[5]);
581 I3b =
J[0]*(
J[4]*
J[8] -
J[7]*
J[5]) -
J[1]*(
J[3]*
J[8] -
J[5]*
J[6]) +
582 J[2]*(J[3]*J[7] - J[4]*J[6]);
589 const scalar_t i3b =
Get_I3b();
590 I3b_p = scalar_ops::pow(i3b, -2, 3);
597 for (
int i = 0; i < 9; i++)
610 for (
int i = 0; i < 9; i++)
623 const scalar_t C[6] =
625 2*(
I1 -
B[0]), 2*(
I1 -
B[1]), 2*(
I1 -
B[2]),
626 -2*
B[3], -2*
B[4], -2*
B[5]
631 dI2[0] = C[0]*
J[0] + C[3]*
J[1] + C[4]*
J[2];
632 dI2[1] = C[3]*J[0] + C[1]*J[1] + C[5]*J[2];
633 dI2[2] = C[4]*J[0] + C[5]*J[1] + C[2]*J[2];
635 dI2[3] = C[0]*J[3] + C[3]*J[4] + C[4]*J[5];
636 dI2[4] = C[3]*J[3] + C[1]*J[4] + C[5]*J[5];
637 dI2[5] = C[4]*J[3] + C[5]*J[4] + C[2]*J[5];
639 dI2[6] = C[0]*J[6] + C[3]*J[7] + C[4]*J[8];
640 dI2[7] = C[3]*J[6] + C[1]*J[7] + C[5]*J[8];
641 dI2[8] = C[4]*J[6] + C[5]*J[7] + C[2]*J[8];
654 for (
int i = 0; i < 9; i++)
664 const scalar_t c1 = 2*
Get_I3b();
666 for (
int i = 0; i < 9; i++)
677 dI3b[1] = J[5]*J[6] - J[3]*J[8];
678 dI3b[2] = J[3]*J[7] - J[4]*J[6];
679 dI3b[3] = J[2]*J[7] - J[1]*J[8];
680 dI3b[4] = J[0]*J[8] - J[2]*J[6];
681 dI3b[5] = J[1]*J[6] - J[0]*J[7];
682 dI3b[6] = J[1]*J[5] - J[2]*J[4];
683 dI3b[7] = J[2]*J[3] - J[0]*J[5];
684 dI3b[8] = J[0]*J[4] - J[1]*J[3];
686 void Eval_DZt(
const scalar_t *Z, scalar_t **DZt_ptr)
688 MFEM_ASSERT(
D != NULL,
"");
690 scalar_t *DZt = *DZt_ptr;
691 if (DZt == NULL) { *DZt_ptr = DZt =
new scalar_t[3*
alloc_height]; }
692 for (
int i = 0; i < nd; i++)
694 const int i0 = i+nd*0, i1 = i+nd*1, i2 = i+nd*2;
695 DZt[i0] =
D[i0]*Z[0] +
D[i1]*Z[3] +
D[i2]*Z[6];
696 DZt[i1] =
D[i0]*Z[1] +
D[i1]*Z[4] +
D[i2]*Z[7];
697 DZt[i2] =
D[i0]*Z[2] +
D[i1]*Z[5] +
D[i2]*Z[8];
742 delete []
DYt;
DYt = NULL;
743 delete []
DXt;
DXt = NULL;
745 delete []
DJt;
DJt = NULL;
746 delete []
DaJ;
DaJ = NULL;
800 const scalar_t
a = 2*w;
801 for (
int i = 0; i < nd; i++)
803 const int i0 = i+nd*0, i1 = i+nd*1, i2 = i+nd*2;
804 const scalar_t aDi[3] = { a*
D[i0], a*D[i1], a*D[i2] };
806 const scalar_t aDDt_ii = aDi[0]*
D[i0] + aDi[1]*
D[i1] + aDi[2]*
D[i2];
807 A[i0+ah*i0] += aDDt_ii;
808 A[i1+ah*i1] += aDDt_ii;
809 A[i2+ah*i2] += aDDt_ii;
811 for (
int k = 0; k < i; k++)
813 const int k0 = k+nd*0, k1 = k+nd*1, k2 = k+nd*2;
814 const scalar_t aDDt_ik = aDi[0]*D[k0] + aDi[1]*D[k1] + aDi[2]*D[k2];
815 A[i0+ah*k0] += aDDt_ik;
816 A[k0+ah*i0] += aDDt_ik;
817 A[i1+ah*k1] += aDDt_ik;
818 A[k1+ah*i1] += aDDt_ik;
819 A[i2+ah*k2] += aDDt_ik;
820 A[k2+ah*i2] += aDDt_ik;
846 const scalar_t r23 = scalar_t(2)/3;
847 const scalar_t r53 = scalar_t(5)/3;
850 const scalar_t c = -r23*b/
I3b;
851 for (
int i = 0; i < nd; i++)
878 const int i0 = i+nd*0, i1 = i+nd*1, i2 = i+nd*2;
879 const scalar_t aDaJ_i[3] = { a*
DaJ[i0], a*DaJ[i1], a*DaJ[i2] };
880 const scalar_t bD_i[3] = { b*
D[i0], b*D[i1], b*D[i2] };
881 const scalar_t cDJt_i[3] = { c*
DJt[i0], c*DJt[i1], c*DJt[i2] };
882 const scalar_t cDaJ_i[3] = { c*
DaJ[i0], c*DaJ[i1], c*DaJ[i2] };
886 const scalar_t A2_ii = bD_i[0]*
D[i0]+bD_i[1]*
D[i1]+bD_i[2]*
D[i2];
887 A[i0+ah*i0] += (r53*aDaJ_i[0] + 2*cDJt_i[0])*
DaJ[i0] + A2_ii;
888 A[i1+ah*i1] += (r53*aDaJ_i[1] + 2*cDJt_i[1])*
DaJ[i1] + A2_ii;
889 A[i2+ah*i2] += (r53*aDaJ_i[2] + 2*cDJt_i[2])*
DaJ[i2] + A2_ii;
892 for (
int j = 1; j < 3; j++)
894 const int ij = i+nd*j;
895 for (
int l = 0; l < j; l++)
897 const int il = i+nd*l;
898 const scalar_t A_ii_jl =
899 (r53*aDaJ_i[j] + cDJt_i[j])*
DaJ[il] + cDaJ_i[j]*
DJt[il];
900 A[ij+ah*il] += A_ii_jl;
901 A[il+ah*ij] += A_ii_jl;
906 for (
int k = 0; k < i; k++)
908 const int k0 = k+nd*0, k1 = k+nd*1, k2 = k+nd*2;
910 const scalar_t A2_ik = bD_i[0]*
D[k0]+bD_i[1]*
D[k1]+bD_i[2]*
D[k2];
913 for (
int j = 0; j < 3; j++)
915 const int ij = i+nd*j, kj = k+nd*j;
916 const scalar_t A_ik_jj = (r53*aDaJ_i[j] + cDJt_i[j])*
DaJ[kj] +
917 cDaJ_i[j]*
DJt[kj] + A2_ik;
918 A[ij+ah*kj] += A_ik_jj;
919 A[kj+ah*ij] += A_ik_jj;
923 for (
int j = 1; j < 3; j++)
925 const int ij = i+nd*j, kj = k+nd*j;
926 for (
int l = 0; l < j; l++)
928 const int il = i+nd*l, kl = k+nd*l;
930 const scalar_t A1b_ik_jl = aDaJ_i[l]*
DaJ[kj];
931 const scalar_t A1b_ik_lj = aDaJ_i[j]*DaJ[kl];
935 const scalar_t A_ik_jl = A1b_ik_jl + r23*A1b_ik_lj +
936 cDJt_i[j]*DaJ[kl]+cDaJ_i[j]*
DJt[kl];
937 A[ij+ah*kl] += A_ik_jl;
938 A[kl+ah*ij] += A_ik_jl;
939 const scalar_t A_ik_lj = r23*A1b_ik_jl + A1b_ik_lj +
940 cDJt_i[l]*DaJ[kj]+cDaJ_i[l]*DJt[kj];
941 A[il+ah*kj] += A_ik_lj;
942 A[kj+ah*il] += A_ik_lj;
992 const scalar_t
a = 2*w;
993 for (
int i = 0; i < ah; i++)
995 const scalar_t avi = a*
DJt[i];
996 A[i+ah*i] += avi*DJt[i];
997 for (
int j = 0; j < i; j++)
999 const scalar_t aVVt_ij = avi*DJt[j];
1000 A[i+ah*j] += aVVt_ij;
1001 A[j+ah*i] += aVVt_ij;
1005 for (
int i = 0; i < nd; i++)
1007 const int i0 = i+nd*0, i1 = i+nd*1, i2 = i+nd*2;
1008 const scalar_t aD_i[3] = { a*
D[i0], a*D[i1], a*D[i2] };
1009 const scalar_t aDJt_i[3] = { a*
DJt[i0], a*DJt[i1], a*DJt[i2] };
1012 const scalar_t aDDt_ii =
1013 aD_i[0]*
D[i0] + aD_i[1]*
D[i1] + aD_i[2]*
D[i2];
1014 const scalar_t Z1_ii =
1015 I1*aDDt_ii - (aDJt_i[0]*
DJt[i0] + aDJt_i[1]*
DJt[i1] +
1018 for (
int j = 0; j < 3; j++)
1020 const int ij = i+nd*j;
1021 A[ij+ah*ij] += Z1_ii - aDDt_ii*
B[j];
1024 const scalar_t Z2_ii_01 = aDDt_ii*
B[3];
1025 const scalar_t Z2_ii_02 = aDDt_ii*B[4];
1026 const scalar_t Z2_ii_12 = aDDt_ii*B[5];
1027 A[i0+ah*i1] -= Z2_ii_01;
1028 A[i1+ah*i0] -= Z2_ii_01;
1029 A[i0+ah*i2] -= Z2_ii_02;
1030 A[i2+ah*i0] -= Z2_ii_02;
1031 A[i1+ah*i2] -= Z2_ii_12;
1032 A[i2+ah*i1] -= Z2_ii_12;
1035 for (
int k = 0; k < i; k++)
1037 const int k0 = k+nd*0, k1 = k+nd*1, k2 = k+nd*2;
1038 const scalar_t aDDt_ik =
1039 aD_i[0]*
D[k0] + aD_i[1]*
D[k1] + aD_i[2]*
D[k2];
1040 const scalar_t Z1_ik =
1041 I1*aDDt_ik - (aDJt_i[0]*
DJt[k0] + aDJt_i[1]*
DJt[k1] +
1044 for (
int j = 0; j < 3; j++)
1046 const int ij = i+nd*j, kj = k+nd*j;
1047 const scalar_t Z2_ik_jj = Z1_ik - aDDt_ik*
B[j];
1048 A[ij+ah*kj] += Z2_ik_jj;
1049 A[kj+ah*ij] += Z2_ik_jj;
1053 const scalar_t Z2_ik_01 = aDDt_ik*
B[3];
1054 A[i0+ah*k1] -= Z2_ik_01;
1055 A[i1+ah*k0] -= Z2_ik_01;
1056 A[k0+ah*i1] -= Z2_ik_01;
1057 A[k1+ah*i0] -= Z2_ik_01;
1058 const scalar_t Z2_ik_02 = aDDt_ik*B[4];
1059 A[i0+ah*k2] -= Z2_ik_02;
1060 A[i2+ah*k0] -= Z2_ik_02;
1061 A[k0+ah*i2] -= Z2_ik_02;
1062 A[k2+ah*i0] -= Z2_ik_02;
1063 const scalar_t Z2_ik_12 = aDDt_ik*B[5];
1064 A[i1+ah*k2] -= Z2_ik_12;
1065 A[i2+ah*k1] -= Z2_ik_12;
1066 A[k1+ah*i2] -= Z2_ik_12;
1067 A[k2+ah*i1] -= Z2_ik_12;
1070 for (
int j = 1; j < 3; j++)
1072 const int ij = i+nd*j, kj = k+nd*j;
1073 for (
int l = 0; l < j; l++)
1075 const int il = i+nd*l, kl = k+nd*l;
1076 const scalar_t Z3_ik_jl =
1077 aDJt_i[j]*
DJt[kl] - aDJt_i[l]*
DJt[kj];
1078 A[ij+ah*kl] += Z3_ik_jl;
1079 A[kl+ah*ij] += Z3_ik_jl;
1080 A[il+ah*kj] -= Z3_ik_jl;
1081 A[kj+ah*il] -= Z3_ik_jl;
1123 const int ah = 3*nd;
1125 const scalar_t
b = (-4*
a)/(3*
I3b);
1127 const scalar_t d = (4*c)/3;
1129 for (
int i = 0; i < ah; i++)
1131 const scalar_t dvi = d*
DaJ[i];
1132 A[i+ah*i] += dvi*DaJ[i];
1133 for (
int j = 0; j < i; j++)
1135 const scalar_t dVVt_ij = dvi*DaJ[j];
1136 A[i+ah*j] += dVVt_ij;
1137 A[j+ah*i] += dVVt_ij;
1141 for (
int i = 0; i < nd; i++)
1143 const int i0 = i+nd*0, i1 = i+nd*1, i2 = i+nd*2;
1144 const scalar_t cDaJ_i[3] = { c*
DaJ[i0], c*DaJ[i1], c*DaJ[i2] };
1145 const scalar_t bDaJ_i[3] = { b*
DaJ[i0], b*DaJ[i1], b*DaJ[i2] };
1146 const scalar_t bDdI2t_i[3] = { b*
DdI2t[i0], b*DdI2t[i1], b*DdI2t[i2] };
1150 for (
int j = 0; j < 3; j++)
1152 const int ij = i+nd*j;
1153 A[ij+ah*ij] += (cDaJ_i[j] + 2*bDdI2t_i[j])*
DaJ[ij];
1156 for (
int j = 1; j < 3; j++)
1158 const int ij = i+nd*j;
1159 for (
int l = 0; l < j; l++)
1161 const int il = i+nd*l;
1162 const scalar_t Z_ii_jl =
1163 (cDaJ_i[l] + bDdI2t_i[l])*
DaJ[ij] + bDdI2t_i[j]*
DaJ[il];
1164 A[ij+ah*il] += Z_ii_jl;
1165 A[il+ah*ij] += Z_ii_jl;
1170 for (
int k = 0; k < i; k++)
1173 for (
int j = 0; j < 3; j++)
1175 const int ij = i+nd*j, kj = k+nd*j;
1176 const scalar_t Z_ik_jj =
1177 (cDaJ_i[j] + bDdI2t_i[j])*
DaJ[kj] + bDaJ_i[j]*
DdI2t[kj];
1178 A[ij+ah*kj] += Z_ik_jj;
1179 A[kj+ah*ij] += Z_ik_jj;
1182 for (
int j = 1; j < 3; j++)
1184 const int ij = i+nd*j, kj = k+nd*j;
1185 for (
int l = 0; l < j; l++)
1187 const int il = i+nd*l, kl = k+nd*l;
1188 const scalar_t Z_ik_jl = cDaJ_i[l]*
DaJ[kj] +
1189 bDdI2t_i[j]*
DaJ[kl] +
1190 bDaJ_i[j]*
DdI2t[kl];
1191 A[ij+ah*kl] += Z_ik_jl;
1192 A[kl+ah*ij] += Z_ik_jl;
1193 const scalar_t Z_ik_lj = cDaJ_i[j]*
DaJ[kl] +
1194 bDdI2t_i[l]*
DaJ[kj] +
1195 bDaJ_i[l]*DdI2t[kj];
1196 A[il+ah*kj] += Z_ik_lj;
1197 A[kj+ah*il] += Z_ik_lj;
1215 const int ah = 3*nd;
1216 const scalar_t
a = 2*w;
1218 for (
int i = 0; i < ah; i++)
1220 const scalar_t avi = a*
DaJ[i];
1221 A[i+ah*i] += avi*DaJ[i];
1222 for (
int j = 0; j < i; j++)
1224 const scalar_t aVVt_ij = avi*DaJ[j];
1225 A[i+ah*j] += aVVt_ij;
1226 A[j+ah*i] += aVVt_ij;
1229 for (
int j = 1; j < 3; j++)
1231 for (
int l = 0; l < j; l++)
1233 for (
int i = 0; i < nd; i++)
1235 const int ij = i+nd*j, il = i+nd*l;
1236 const scalar_t aDaJ_ij = a*
DaJ[ij], aDaJ_il = a*DaJ[il];
1237 for (
int k = 0; k < i; k++)
1239 const int kj = k+nd*j, kl = k+nd*l;
1240 const scalar_t A_ijkl = aDaJ_ij*DaJ[kl] - aDaJ_il*DaJ[kj];
1241 A[ij+ah*kl] += A_ijkl;
1242 A[kl+ah*ij] += A_ijkl;
1243 A[kj+ah*il] -= A_ijkl;
1244 A[il+ah*kj] -= A_ijkl;
1261 const int ah = 3*nd;
1263 for (
int j = 1; j < 3; j++)
1265 for (
int l = 0; l < j; l++)
1267 for (
int i = 0; i < nd; i++)
1269 const int ij = i+nd*j, il = i+nd*l;
1270 const scalar_t aDaJ_ij = a*
DaJ[ij], aDaJ_il = a*DaJ[il];
1271 for (
int k = 0; k < i; k++)
1273 const int kj = k+nd*j, kl = k+nd*l;
1274 const scalar_t A_ijkl = aDaJ_ij*DaJ[kl] - aDaJ_il*DaJ[kj];
1275 A[ij+ah*kl] += A_ijkl;
1276 A[kl+ah*ij] += A_ijkl;
1277 A[kj+ah*il] -= A_ijkl;
1278 A[il+ah*kj] -= A_ijkl;
1300 const int ah = 3*nd;
1302 for (
int i = 0; i < ah; i++)
1304 const scalar_t axi = w*
DXt[i], ayi = w*
DYt[i];
1305 A[i+ah*i] += 2*axi*DYt[i];
1306 for (
int j = 0; j < i; j++)
1308 const scalar_t A_ij = axi*DYt[j] + ayi*DXt[j];
1325 const int ah = 3*nd;
1327 for (
int i = 0; i < ah; i++)
1329 const scalar_t axi = w*
DXt[i];
1330 A[i+ah*i] += axi*DXt[i];
1331 for (
int j = 0; j < i; j++)
1333 const scalar_t A_ij = axi*DXt[j];
bool dont(int have_mask) const
void Assemble_ddI3(scalar_t w, scalar_t *A)
void Assemble_ddI2b(scalar_t w, scalar_t *A)
InvariantsEvaluator2D(const scalar_t *Jac=NULL)
The Jacobian should use column-major storage.
static scalar_t pow(const scalar_t &x, int m, int n)
void Assemble_ddI2b(scalar_t w, scalar_t *A)
void SetDerivativeMatrix(int height, const scalar_t *Deriv)
The Deriv matrix is dof x 2, using column-major storage.
const scalar_t * Get_dI3b()
static scalar_t sign(const scalar_t &a)
void Eval_DZt(const scalar_t *Z, scalar_t **DZt_ptr)
bool dont(int have_mask) const
void Assemble_TProd(scalar_t w, const scalar_t *X, const scalar_t *Y, scalar_t *A)
void Assemble_ddI1(scalar_t w, scalar_t *A)
Auxiliary class for evaluating the 2x2 matrix invariants and their first and second derivatives...
void Assemble_ddI2(scalar_t w, scalar_t *A)
void Eval_DZt(const scalar_t *Z, scalar_t **DZt_ptr)
void SetJacobian(const scalar_t *Jac)
The Jacobian should use column-major storage.
void Assemble_ddI3b(scalar_t w, scalar_t *A)
Auxiliary class used as the default for the second template parameter in the classes InvariantsEvalua...
void Assemble_TProd(scalar_t w, const scalar_t *X, scalar_t *A)
const scalar_t * Get_dI2b()
void SetDerivativeMatrix(int height, const scalar_t *Deriv)
The Deriv matrix is dof x 3, using column-major storage.
void Assemble_TProd(scalar_t w, const scalar_t *X, scalar_t *A)
void Assemble_ddI1b(scalar_t w, scalar_t *A)
const scalar_t * Get_dI3()
void Assemble_ddI2(scalar_t w, scalar_t *A)
const scalar_t * Get_dI1()
const scalar_t * Get_dI1()
const scalar_t * Get_dI1b()
const scalar_t * Get_dI1b()
const scalar_t * Get_dI2b()
void Assemble_TProd(scalar_t w, const scalar_t *X, const scalar_t *Y, scalar_t *A)
const scalar_t * Get_dI2()
void Assemble_ddI1(scalar_t w, scalar_t *A)
Auxiliary class for evaluating the 3x3 matrix invariants and their first and second derivatives...
const scalar_t * Get_dI2()
void Assemble_ddI1b(scalar_t w, scalar_t *A)
InvariantsEvaluator3D(const scalar_t *Jac=NULL)
The Jacobian should use column-major storage.
void SetJacobian(const scalar_t *Jac)
The Jacobian should use column-major storage.