12#ifndef MFEM_INVARIANTS_HPP
13#define MFEM_INVARIANTS_HPP
26template <
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); }
48template <
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;
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];
493template <
typename scalar_t,
typename scalar_ops = ScalarOps<scalar_t> >
547 B[0] =
J[0]*
J[0] +
J[3]*
J[3] +
J[6]*
J[6];
548 B[1] =
J[1]*
J[1] +
J[4]*
J[4] +
J[7]*
J[7];
549 B[2] =
J[2]*
J[2] +
J[5]*
J[5] +
J[8]*
J[8];
550 I1 =
B[0] +
B[1] +
B[2];
562 B[3] =
J[0]*
J[1] +
J[3]*
J[4] +
J[6]*
J[7];
563 B[4] =
J[0]*
J[2] +
J[3]*
J[5] +
J[6]*
J[8];
564 B[5] =
J[1]*
J[2] +
J[4]*
J[5] +
J[7]*
J[8];
571 const scalar_t BF2 =
B[0]*
B[0] +
B[1]*
B[1] +
B[2]*
B[2] +
572 2*(
B[3]*
B[3] +
B[4]*
B[4] +
B[5]*
B[5]);
584 I3b =
J[0]*(
J[4]*
J[8] -
J[7]*
J[5]) -
J[1]*(
J[3]*
J[8] -
J[5]*
J[6]) +
585 J[2]*(
J[3]*
J[7] -
J[4]*
J[6]);
592 const scalar_t i3b =
Get_I3b();
593 I3b_p = scalar_ops::pow(i3b, -2, 3);
600 for (
int i = 0; i < 9; i++)
613 for (
int i = 0; i < 9; i++)
626 const scalar_t C[6] =
628 2*(
I1 -
B[0]), 2*(
I1 -
B[1]), 2*(
I1 -
B[2]),
629 -2*
B[3], -2*
B[4], -2*
B[5]
634 dI2[0] = C[0]*
J[0] + C[3]*
J[1] + C[4]*
J[2];
635 dI2[1] = C[3]*
J[0] + C[1]*
J[1] + C[5]*
J[2];
636 dI2[2] = C[4]*
J[0] + C[5]*
J[1] + C[2]*
J[2];
638 dI2[3] = C[0]*
J[3] + C[3]*
J[4] + C[4]*
J[5];
639 dI2[4] = C[3]*
J[3] + C[1]*
J[4] + C[5]*
J[5];
640 dI2[5] = C[4]*
J[3] + C[5]*
J[4] + C[2]*
J[5];
642 dI2[6] = C[0]*
J[6] + C[3]*
J[7] + C[4]*
J[8];
643 dI2[7] = C[3]*
J[6] + C[1]*
J[7] + C[5]*
J[8];
644 dI2[8] = C[4]*
J[6] + C[5]*
J[7] + C[2]*
J[8];
657 for (
int i = 0; i < 9; i++)
667 const scalar_t c1 = 2*
Get_I3b();
669 for (
int i = 0; i < 9; i++)
689 void Eval_DZt(
const scalar_t *Z, scalar_t **DZt_ptr)
691 MFEM_ASSERT(
D != NULL,
"");
693 scalar_t *DZt = *DZt_ptr;
694 if (DZt == NULL) { *DZt_ptr = DZt =
new scalar_t[3*
alloc_height]; }
695 for (
int i = 0; i < nd; i++)
697 const int i0 = i+nd*0, i1 = i+nd*1, i2 = i+nd*2;
698 DZt[i0] =
D[i0]*Z[0] +
D[i1]*Z[3] +
D[i2]*Z[6];
699 DZt[i1] =
D[i0]*Z[1] +
D[i1]*Z[4] +
D[i2]*Z[7];
700 DZt[i2] =
D[i0]*Z[2] +
D[i1]*Z[5] +
D[i2]*Z[8];
745 delete []
DYt;
DYt = NULL;
746 delete []
DXt;
DXt = NULL;
748 delete []
DJt;
DJt = NULL;
749 delete []
DaJ;
DaJ = NULL;
803 const scalar_t
a = 2*w;
804 for (
int i = 0; i < nd; i++)
806 const int i0 = i+nd*0, i1 = i+nd*1, i2 = i+nd*2;
807 const scalar_t aDi[3] = {
a*
D[i0],
a*
D[i1],
a*
D[i2] };
809 const scalar_t aDDt_ii = aDi[0]*
D[i0] + aDi[1]*
D[i1] + aDi[2]*
D[i2];
810 A[i0+ah*i0] += aDDt_ii;
811 A[i1+ah*i1] += aDDt_ii;
812 A[i2+ah*i2] += aDDt_ii;
814 for (
int k = 0; k < i; k++)
816 const int k0 = k+nd*0, k1 = k+nd*1, k2 = k+nd*2;
817 const scalar_t aDDt_ik = aDi[0]*
D[k0] + aDi[1]*
D[k1] + aDi[2]*
D[k2];
818 A[i0+ah*k0] += aDDt_ik;
819 A[k0+ah*i0] += aDDt_ik;
820 A[i1+ah*k1] += aDDt_ik;
821 A[k1+ah*i1] += aDDt_ik;
822 A[i2+ah*k2] += aDDt_ik;
823 A[k2+ah*i2] += aDDt_ik;
849 const scalar_t r23 = scalar_t(2)/3;
850 const scalar_t r53 = scalar_t(5)/3;
853 const scalar_t c = -r23*
b/
I3b;
854 for (
int i = 0; i < nd; i++)
881 const int i0 = i+nd*0, i1 = i+nd*1, i2 = i+nd*2;
882 const scalar_t aDaJ_i[3] = {
a*
DaJ[i0],
a*
DaJ[i1],
a*
DaJ[i2] };
883 const scalar_t bD_i[3] = {
b*
D[i0],
b*
D[i1],
b*
D[i2] };
884 const scalar_t cDJt_i[3] = { c*
DJt[i0], c*
DJt[i1], c*
DJt[i2] };
885 const scalar_t cDaJ_i[3] = { c*
DaJ[i0], c*
DaJ[i1], c*
DaJ[i2] };
889 const scalar_t A2_ii = bD_i[0]*
D[i0]+bD_i[1]*
D[i1]+bD_i[2]*
D[i2];
890 A[i0+ah*i0] += (r53*aDaJ_i[0] + 2*cDJt_i[0])*
DaJ[i0] + A2_ii;
891 A[i1+ah*i1] += (r53*aDaJ_i[1] + 2*cDJt_i[1])*
DaJ[i1] + A2_ii;
892 A[i2+ah*i2] += (r53*aDaJ_i[2] + 2*cDJt_i[2])*
DaJ[i2] + A2_ii;
895 for (
int j = 1; j < 3; j++)
897 const int ij = i+nd*j;
898 for (
int l = 0; l < j; l++)
900 const int il = i+nd*l;
901 const scalar_t A_ii_jl =
902 (r53*aDaJ_i[j] + cDJt_i[j])*
DaJ[il] + cDaJ_i[j]*
DJt[il];
903 A[ij+ah*il] += A_ii_jl;
904 A[il+ah*ij] += A_ii_jl;
909 for (
int k = 0; k < i; k++)
911 const int k0 = k+nd*0, k1 = k+nd*1, k2 = k+nd*2;
913 const scalar_t A2_ik = bD_i[0]*
D[k0]+bD_i[1]*
D[k1]+bD_i[2]*
D[k2];
916 for (
int j = 0; j < 3; j++)
918 const int ij = i+nd*j, kj = k+nd*j;
919 const scalar_t A_ik_jj = (r53*aDaJ_i[j] + cDJt_i[j])*
DaJ[kj] +
920 cDaJ_i[j]*
DJt[kj] + A2_ik;
921 A[ij+ah*kj] += A_ik_jj;
922 A[kj+ah*ij] += A_ik_jj;
926 for (
int j = 1; j < 3; j++)
928 const int ij = i+nd*j, kj = k+nd*j;
929 for (
int l = 0; l < j; l++)
931 const int il = i+nd*l, kl = k+nd*l;
933 const scalar_t A1b_ik_jl = aDaJ_i[l]*
DaJ[kj];
934 const scalar_t A1b_ik_lj = aDaJ_i[j]*
DaJ[kl];
938 const scalar_t A_ik_jl = A1b_ik_jl + r23*A1b_ik_lj +
939 cDJt_i[j]*
DaJ[kl]+cDaJ_i[j]*
DJt[kl];
940 A[ij+ah*kl] += A_ik_jl;
941 A[kl+ah*ij] += A_ik_jl;
942 const scalar_t A_ik_lj = r23*A1b_ik_jl + A1b_ik_lj +
943 cDJt_i[l]*
DaJ[kj]+cDaJ_i[l]*
DJt[kj];
944 A[il+ah*kj] += A_ik_lj;
945 A[kj+ah*il] += A_ik_lj;
995 const scalar_t
a = 2*w;
996 for (
int i = 0; i < ah; i++)
998 const scalar_t avi =
a*
DJt[i];
999 A[i+ah*i] += avi*
DJt[i];
1000 for (
int j = 0; j < i; j++)
1002 const scalar_t aVVt_ij = avi*
DJt[j];
1003 A[i+ah*j] += aVVt_ij;
1004 A[j+ah*i] += aVVt_ij;
1008 for (
int i = 0; i < nd; i++)
1010 const int i0 = i+nd*0, i1 = i+nd*1, i2 = i+nd*2;
1011 const scalar_t aD_i[3] = {
a*
D[i0],
a*
D[i1],
a*
D[i2] };
1012 const scalar_t aDJt_i[3] = {
a*
DJt[i0],
a*
DJt[i1],
a*
DJt[i2] };
1015 const scalar_t aDDt_ii =
1016 aD_i[0]*
D[i0] + aD_i[1]*
D[i1] + aD_i[2]*
D[i2];
1017 const scalar_t Z1_ii =
1018 I1*aDDt_ii - (aDJt_i[0]*
DJt[i0] + aDJt_i[1]*
DJt[i1] +
1021 for (
int j = 0; j < 3; j++)
1023 const int ij = i+nd*j;
1024 A[ij+ah*ij] += Z1_ii - aDDt_ii*
B[j];
1027 const scalar_t Z2_ii_01 = aDDt_ii*
B[3];
1028 const scalar_t Z2_ii_02 = aDDt_ii*
B[4];
1029 const scalar_t Z2_ii_12 = aDDt_ii*
B[5];
1030 A[i0+ah*i1] -= Z2_ii_01;
1031 A[i1+ah*i0] -= Z2_ii_01;
1032 A[i0+ah*i2] -= Z2_ii_02;
1033 A[i2+ah*i0] -= Z2_ii_02;
1034 A[i1+ah*i2] -= Z2_ii_12;
1035 A[i2+ah*i1] -= Z2_ii_12;
1038 for (
int k = 0; k < i; k++)
1040 const int k0 = k+nd*0, k1 = k+nd*1, k2 = k+nd*2;
1041 const scalar_t aDDt_ik =
1042 aD_i[0]*
D[k0] + aD_i[1]*
D[k1] + aD_i[2]*
D[k2];
1043 const scalar_t Z1_ik =
1044 I1*aDDt_ik - (aDJt_i[0]*
DJt[k0] + aDJt_i[1]*
DJt[k1] +
1047 for (
int j = 0; j < 3; j++)
1049 const int ij = i+nd*j, kj = k+nd*j;
1050 const scalar_t Z2_ik_jj = Z1_ik - aDDt_ik*
B[j];
1051 A[ij+ah*kj] += Z2_ik_jj;
1052 A[kj+ah*ij] += Z2_ik_jj;
1056 const scalar_t Z2_ik_01 = aDDt_ik*
B[3];
1057 A[i0+ah*k1] -= Z2_ik_01;
1058 A[i1+ah*k0] -= Z2_ik_01;
1059 A[k0+ah*i1] -= Z2_ik_01;
1060 A[k1+ah*i0] -= Z2_ik_01;
1061 const scalar_t Z2_ik_02 = aDDt_ik*
B[4];
1062 A[i0+ah*k2] -= Z2_ik_02;
1063 A[i2+ah*k0] -= Z2_ik_02;
1064 A[k0+ah*i2] -= Z2_ik_02;
1065 A[k2+ah*i0] -= Z2_ik_02;
1066 const scalar_t Z2_ik_12 = aDDt_ik*
B[5];
1067 A[i1+ah*k2] -= Z2_ik_12;
1068 A[i2+ah*k1] -= Z2_ik_12;
1069 A[k1+ah*i2] -= Z2_ik_12;
1070 A[k2+ah*i1] -= Z2_ik_12;
1073 for (
int j = 1; j < 3; j++)
1075 const int ij = i+nd*j, kj = k+nd*j;
1076 for (
int l = 0; l < j; l++)
1078 const int il = i+nd*l, kl = k+nd*l;
1079 const scalar_t Z3_ik_jl =
1080 aDJt_i[j]*
DJt[kl] - aDJt_i[l]*
DJt[kj];
1081 A[ij+ah*kl] += Z3_ik_jl;
1082 A[kl+ah*ij] += Z3_ik_jl;
1083 A[il+ah*kj] -= Z3_ik_jl;
1084 A[kj+ah*il] -= Z3_ik_jl;
1126 const int ah = 3*nd;
1128 const scalar_t
b = (-4*
a)/(3*
I3b);
1130 const scalar_t d = (4*c)/3;
1132 for (
int i = 0; i < ah; i++)
1134 const scalar_t dvi = d*
DaJ[i];
1135 A[i+ah*i] += dvi*
DaJ[i];
1136 for (
int j = 0; j < i; j++)
1138 const scalar_t dVVt_ij = dvi*
DaJ[j];
1139 A[i+ah*j] += dVVt_ij;
1140 A[j+ah*i] += dVVt_ij;
1144 for (
int i = 0; i < nd; i++)
1146 const int i0 = i+nd*0, i1 = i+nd*1, i2 = i+nd*2;
1147 const scalar_t cDaJ_i[3] = { c*
DaJ[i0], c*
DaJ[i1], c*
DaJ[i2] };
1148 const scalar_t bDaJ_i[3] = {
b*
DaJ[i0],
b*
DaJ[i1],
b*
DaJ[i2] };
1153 for (
int j = 0; j < 3; j++)
1155 const int ij = i+nd*j;
1156 A[ij+ah*ij] += (cDaJ_i[j] + 2*bDdI2t_i[j])*
DaJ[ij];
1159 for (
int j = 1; j < 3; j++)
1161 const int ij = i+nd*j;
1162 for (
int l = 0; l < j; l++)
1164 const int il = i+nd*l;
1165 const scalar_t Z_ii_jl =
1166 (cDaJ_i[l] + bDdI2t_i[l])*
DaJ[ij] + bDdI2t_i[j]*
DaJ[il];
1167 A[ij+ah*il] += Z_ii_jl;
1168 A[il+ah*ij] += Z_ii_jl;
1173 for (
int k = 0; k < i; k++)
1176 for (
int j = 0; j < 3; j++)
1178 const int ij = i+nd*j, kj = k+nd*j;
1179 const scalar_t Z_ik_jj =
1180 (cDaJ_i[j] + bDdI2t_i[j])*
DaJ[kj] + bDaJ_i[j]*
DdI2t[kj];
1181 A[ij+ah*kj] += Z_ik_jj;
1182 A[kj+ah*ij] += Z_ik_jj;
1185 for (
int j = 1; j < 3; j++)
1187 const int ij = i+nd*j, kj = k+nd*j;
1188 for (
int l = 0; l < j; l++)
1190 const int il = i+nd*l, kl = k+nd*l;
1191 const scalar_t Z_ik_jl = cDaJ_i[l]*
DaJ[kj] +
1192 bDdI2t_i[j]*
DaJ[kl] +
1193 bDaJ_i[j]*
DdI2t[kl];
1194 A[ij+ah*kl] += Z_ik_jl;
1195 A[kl+ah*ij] += Z_ik_jl;
1196 const scalar_t Z_ik_lj = cDaJ_i[j]*
DaJ[kl] +
1197 bDdI2t_i[l]*
DaJ[kj] +
1198 bDaJ_i[l]*
DdI2t[kj];
1199 A[il+ah*kj] += Z_ik_lj;
1200 A[kj+ah*il] += Z_ik_lj;
1218 const int ah = 3*nd;
1219 const scalar_t
a = 2*w;
1221 for (
int i = 0; i < ah; i++)
1223 const scalar_t avi =
a*
DaJ[i];
1224 A[i+ah*i] += avi*
DaJ[i];
1225 for (
int j = 0; j < i; j++)
1227 const scalar_t aVVt_ij = avi*
DaJ[j];
1228 A[i+ah*j] += aVVt_ij;
1229 A[j+ah*i] += aVVt_ij;
1232 for (
int j = 1; j < 3; j++)
1234 for (
int l = 0; l < j; l++)
1236 for (
int i = 0; i < nd; i++)
1238 const int ij = i+nd*j, il = i+nd*l;
1239 const scalar_t aDaJ_ij =
a*
DaJ[ij], aDaJ_il =
a*
DaJ[il];
1240 for (
int k = 0; k < i; k++)
1242 const int kj = k+nd*j, kl = k+nd*l;
1243 const scalar_t A_ijkl = aDaJ_ij*
DaJ[kl] - aDaJ_il*
DaJ[kj];
1244 A[ij+ah*kl] += A_ijkl;
1245 A[kl+ah*ij] += A_ijkl;
1246 A[kj+ah*il] -= A_ijkl;
1247 A[il+ah*kj] -= A_ijkl;
1264 const int ah = 3*nd;
1266 for (
int j = 1; j < 3; j++)
1268 for (
int l = 0; l < j; l++)
1270 for (
int i = 0; i < nd; i++)
1272 const int ij = i+nd*j, il = i+nd*l;
1273 const scalar_t aDaJ_ij =
a*
DaJ[ij], aDaJ_il =
a*
DaJ[il];
1274 for (
int k = 0; k < i; k++)
1276 const int kj = k+nd*j, kl = k+nd*l;
1277 const scalar_t A_ijkl = aDaJ_ij*
DaJ[kl] - aDaJ_il*
DaJ[kj];
1278 A[ij+ah*kl] += A_ijkl;
1279 A[kl+ah*ij] += A_ijkl;
1280 A[kj+ah*il] -= A_ijkl;
1281 A[il+ah*kj] -= A_ijkl;
1303 const int ah = 3*nd;
1305 for (
int i = 0; i < ah; i++)
1307 const scalar_t axi = w*
DXt[i], ayi = w*
DYt[i];
1308 A[i+ah*i] += 2*axi*
DYt[i];
1309 for (
int j = 0; j < i; j++)
1311 const scalar_t A_ij = axi*
DYt[j] + ayi*
DXt[j];
1328 const int ah = 3*nd;
1330 for (
int i = 0; i < ah; i++)
1332 const scalar_t axi = w*
DXt[i];
1333 A[i+ah*i] += axi*
DXt[i];
1334 for (
int j = 0; j < i; j++)
1336 const scalar_t A_ij = axi*
DXt[j];
Auxiliary class for evaluating the 2x2 matrix invariants and their first and second derivatives.
const scalar_t * Get_dI1b()
void Assemble_ddI1(scalar_t w, scalar_t *A)
bool dont(int have_mask) const
void SetJacobian(const scalar_t *Jac)
The Jacobian should use column-major storage.
void Assemble_ddI1b(scalar_t w, scalar_t *A)
const scalar_t * Get_dI2()
void SetDerivativeMatrix(int height, const scalar_t *Deriv)
The Deriv matrix is dof x 2, using column-major storage.
void Assemble_ddI2b(scalar_t w, scalar_t *A)
void Eval_DZt(const scalar_t *Z, scalar_t **DZt_ptr)
const scalar_t * Get_dI2b()
void Assemble_TProd(scalar_t w, const scalar_t *X, const scalar_t *Y, scalar_t *A)
void Assemble_ddI2(scalar_t w, scalar_t *A)
InvariantsEvaluator2D(const scalar_t *Jac=NULL)
The Jacobian should use column-major storage.
void Assemble_TProd(scalar_t w, const scalar_t *X, scalar_t *A)
const scalar_t * Get_dI1()
Auxiliary class for evaluating the 3x3 matrix invariants and their first and second derivatives.
void SetJacobian(const scalar_t *Jac)
The Jacobian should use column-major storage.
const scalar_t * Get_dI2()
const scalar_t * Get_dI2b()
const scalar_t * Get_dI3()
bool dont(int have_mask) const
void Assemble_TProd(scalar_t w, const scalar_t *X, const scalar_t *Y, scalar_t *A)
const scalar_t * Get_dI1()
void SetDerivativeMatrix(int height, const scalar_t *Deriv)
The Deriv matrix is dof x 3, using column-major storage.
const scalar_t * Get_dI3b()
void Eval_DZt(const scalar_t *Z, scalar_t **DZt_ptr)
InvariantsEvaluator3D(const scalar_t *Jac=NULL)
The Jacobian should use column-major storage.
void Assemble_ddI1(scalar_t w, scalar_t *A)
void Assemble_TProd(scalar_t w, const scalar_t *X, scalar_t *A)
void Assemble_ddI2(scalar_t w, scalar_t *A)
const scalar_t * Get_dI1b()
void Assemble_ddI3(scalar_t w, scalar_t *A)
void Assemble_ddI2b(scalar_t w, scalar_t *A)
void Assemble_ddI3b(scalar_t w, scalar_t *A)
void Assemble_ddI1b(scalar_t w, scalar_t *A)
Auxiliary class used as the default for the second template parameter in the classes InvariantsEvalua...
static scalar_t pow(const scalar_t &x, int m, int n)
static scalar_t sign(const scalar_t &a)