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> >
88 I1 =
J[0]*
J[0] +
J[1]*
J[1] +
J[2]*
J[2] +
J[3]*
J[3];
98 const scalar_t det =
J[0]*
J[3] -
J[1]*
J[2];
113 const scalar_t c1 = 2/
Get_I2b();
114 const scalar_t c2 =
Get_I1b()/2;
118 dI1b[2] = c1*(
J[2] - c2*
dI2b[2]);
119 dI1b[3] = c1*(
J[3] - c2*
dI2b[3]);
126 const scalar_t c1 = 2*
Get_I2b();
155 void Eval_DZt(
const scalar_t *Z, scalar_t **DZt_ptr)
157 MFEM_ASSERT(
D != NULL,
"");
159 scalar_t *DZt = *DZt_ptr;
160 if (DZt == NULL) { *DZt_ptr = DZt =
new scalar_t[2*
alloc_height]; }
161 for (
int i = 0; i < nd; i++)
163 const int i0 = i+nd*0, i1 = i+nd*1;
164 DZt[i0] =
D[i0]*Z[0] +
D[i1]*Z[2];
165 DZt[i1] =
D[i0]*Z[1] +
D[i1]*Z[3];
192 delete []
DYt;
DYt = NULL;
193 delete []
DXt;
DXt = NULL;
194 delete []
DJt;
DJt = NULL;
195 delete []
DaJ;
DaJ = NULL;
239 const scalar_t
a = 2*w;
240 for (
int i = 0; i < nd; i++)
242 const int i0 = i+nd*0, i1 = i+nd*1;
243 const scalar_t aDi[2] = { a*
D[i0], a*D[i1] };
245 const scalar_t aDDt_ii = aDi[0]*
D[i0] + aDi[1]*
D[i1];
246 A[i0+ah*i0] += aDDt_ii;
247 A[i1+ah*i1] += aDDt_ii;
249 for (
int k = 0; k < i; k++)
251 const int k0 = k+nd*0, k1 = k+nd*1;
252 const scalar_t aDDt_ik = aDi[0]*D[k0] + aDi[1]*D[k1];
253 A[i0+ah*k0] += aDDt_ik;
254 A[k0+ah*i0] += aDDt_ik;
255 A[i1+ah*k1] += aDDt_ik;
256 A[k1+ah*i1] += aDDt_ik;
283 const scalar_t c = -2*w/
Get_I2();
284 for (
int i = 0; i < nd; i++)
286 const int i0 = i+nd*0, i1 = i+nd*1;
287 const scalar_t aDaJ_i[2] = { a*
DaJ[i0], a*DaJ[i1] };
288 const scalar_t bD_i[2] = { b*
D[i0], b*D[i1] };
289 const scalar_t cDJt_i[2] = { c*
DJt[i0], c*DJt[i1] };
290 const scalar_t cDaJ_i[2] = { c*
DaJ[i0], c*DaJ[i1] };
294 const scalar_t A2_ii = bD_i[0]*
D[i0] + bD_i[1]*
D[i1];
296 A[i0+ah*i0] += 2*(aDaJ_i[0] + cDJt_i[0])*
DaJ[i0] + A2_ii;
299 const scalar_t A_ii_01 =
300 (2*aDaJ_i[0] + cDJt_i[0])*
DaJ[i1] + cDaJ_i[0]*
DJt[i1];
301 A[i0+ah*i1] += A_ii_01;
302 A[i1+ah*i0] += A_ii_01;
304 A[i1+ah*i1] += 2*(aDaJ_i[1] + cDJt_i[1])*
DaJ[i1] + A2_ii;
307 for (
int k = 0; k < i; k++)
309 const int k0 = k+nd*0, k1 = k+nd*1;
311 const scalar_t A1_ik_01 = aDaJ_i[0]*
DaJ[k1] + aDaJ_i[1]*
DaJ[k0];
314 const scalar_t A2_ik = bD_i[0]*
D[k0] + bD_i[1]*
D[k1];
316 const scalar_t A_ik_00 =
317 (2*aDaJ_i[0] + cDJt_i[0])*DaJ[k0] + A2_ik + cDaJ_i[0]*
DJt[k0];
318 A[i0+ah*k0] += A_ik_00;
319 A[k0+ah*i0] += A_ik_00;
321 const scalar_t A_ik_01 =
322 A1_ik_01 + cDJt_i[0]*DaJ[k1] + cDaJ_i[0]*
DJt[k1];
323 A[i0+ah*k1] += A_ik_01;
324 A[k1+ah*i0] += A_ik_01;
326 const scalar_t A_ik_10 =
327 A1_ik_01 + cDJt_i[1]*DaJ[k0] + cDaJ_i[1]*DJt[k0];
328 A[i1+ah*k0] += A_ik_10;
329 A[k0+ah*i1] += A_ik_10;
331 const scalar_t A_ik_11 =
332 (2*aDaJ_i[1] + cDJt_i[1])*DaJ[k1] + A2_ik + cDaJ_i[1]*DJt[k1];
333 A[i1+ah*k1] += A_ik_11;
334 A[k1+ah*i1] += A_ik_11;
359 const scalar_t
a = 2*w;
360 for (
int i = 0; i < ah; i++)
362 const scalar_t avi = a*
DaJ[i];
363 A[i+ah*i] += avi*DaJ[i];
364 for (
int j = 0; j < i; j++)
366 const scalar_t aVVt_ij = avi*DaJ[j];
367 A[i+ah*j] += aVVt_ij;
368 A[j+ah*i] += aVVt_ij;
371 const int j = 1, l = 0;
372 for (
int i = 0; i < nd; i++)
374 const int ij = i+nd*j, il = i+nd*l;
375 const scalar_t aDaJ_ij = a*
DaJ[ij], aDaJ_il = a*DaJ[il];
376 for (
int k = 0; k < i; k++)
378 const int kj = k+nd*j, kl = k+nd*l;
379 const scalar_t A_ijkl = aDaJ_ij*DaJ[kl] - aDaJ_il*DaJ[kj];
380 A[ij+ah*kl] += A_ijkl;
381 A[kl+ah*ij] += A_ijkl;
382 A[kj+ah*il] -= A_ijkl;
383 A[il+ah*kj] -= A_ijkl;
408 const int j = 1, l = 0;
410 for (
int i = 0; i < nd; i++)
412 const int ij = i+nd*j, il = i+nd*l;
413 const scalar_t aDaJ_ij = a*
DaJ[ij], aDaJ_il = a*DaJ[il];
414 for (
int k = 0; k < i; k++)
416 const int kj = k+nd*j, kl = k+nd*l;
417 const scalar_t A_ijkl = aDaJ_ij*DaJ[kl] - aDaJ_il*DaJ[kj];
418 A[ij+ah*kl] += A_ijkl;
419 A[kl+ah*ij] += A_ijkl;
420 A[kj+ah*il] -= A_ijkl;
421 A[il+ah*kj] -= A_ijkl;
443 for (
int i = 0; i < ah; i++)
445 const scalar_t axi = w*
DXt[i], ayi = w*
DYt[i];
446 A[i+ah*i] += 2*axi*DYt[i];
447 for (
int j = 0; j < i; j++)
449 const scalar_t A_ij = axi*DYt[j] + ayi*DXt[j];
469 for (
int i = 0; i < ah; i++)
471 const scalar_t axi = w*
DXt[i];
472 A[i+ah*i] += axi*DXt[i];
473 for (
int j = 0; j < i; j++)
475 const scalar_t A_ij = axi*DXt[j];
496 template <
typename scalar_t,
typename scalar_ops = ScalarOps<scalar_t> >
549 B[0] =
J[0]*
J[0] +
J[3]*
J[3] +
J[6]*
J[6];
550 B[1] = J[1]*J[1] + J[4]*J[4] + J[7]*J[7];
551 B[2] = J[2]*J[2] + J[5]*J[5] + J[8]*J[8];
552 I1 =
B[0] +
B[1] +
B[2];
564 B[3] =
J[0]*
J[1] +
J[3]*
J[4] +
J[6]*
J[7];
565 B[4] = J[0]*J[2] + J[3]*J[5] + J[6]*J[8];
566 B[5] = J[1]*J[2] + J[4]*J[5] + J[7]*J[8];
573 const scalar_t BF2 =
B[0]*
B[0] +
B[1]*
B[1] +
B[2]*
B[2] +
574 2*(
B[3]*
B[3] +
B[4]*
B[4] +
B[5]*
B[5]);
586 I3b =
J[0]*(
J[4]*
J[8] -
J[7]*
J[5]) -
J[1]*(
J[3]*
J[8] -
J[5]*
J[6]) +
587 J[2]*(J[3]*J[7] - J[4]*J[6]);
596 const scalar_t i3b =
Get_I3b();
604 for (
int i = 0; i < 9; i++)
617 for (
int i = 0; i < 9; i++)
630 const scalar_t C[6] =
632 2*(
I1 -
B[0]), 2*(
I1 -
B[1]), 2*(
I1 -
B[2]),
633 -2*
B[3], -2*
B[4], -2*
B[5]
638 dI2[0] = C[0]*
J[0] + C[3]*
J[1] + C[4]*
J[2];
639 dI2[1] = C[3]*J[0] + C[1]*J[1] + C[5]*J[2];
640 dI2[2] = C[4]*J[0] + C[5]*J[1] + C[2]*J[2];
642 dI2[3] = C[0]*J[3] + C[3]*J[4] + C[4]*J[5];
643 dI2[4] = C[3]*J[3] + C[1]*J[4] + C[5]*J[5];
644 dI2[5] = C[4]*J[3] + C[5]*J[4] + C[2]*J[5];
646 dI2[6] = C[0]*J[6] + C[3]*J[7] + C[4]*J[8];
647 dI2[7] = C[3]*J[6] + C[1]*J[7] + C[5]*J[8];
648 dI2[8] = C[4]*J[6] + C[5]*J[7] + C[2]*J[8];
661 for (
int i = 0; i < 9; i++)
671 const scalar_t c1 = 2*
Get_I3b();
673 for (
int i = 0; i < 9; i++)
693 void Eval_DZt(
const scalar_t *Z, scalar_t **DZt_ptr)
695 MFEM_ASSERT(
D != NULL,
"");
697 scalar_t *DZt = *DZt_ptr;
698 if (DZt == NULL) { *DZt_ptr = DZt =
new scalar_t[3*
alloc_height]; }
699 for (
int i = 0; i < nd; i++)
701 const int i0 = i+nd*0, i1 = i+nd*1, i2 = i+nd*2;
702 DZt[i0] =
D[i0]*Z[0] +
D[i1]*Z[3] +
D[i2]*Z[6];
703 DZt[i1] =
D[i0]*Z[1] +
D[i1]*Z[4] +
D[i2]*Z[7];
704 DZt[i2] =
D[i0]*Z[2] +
D[i1]*Z[5] +
D[i2]*Z[8];
749 delete []
DYt;
DYt = NULL;
750 delete []
DXt;
DXt = NULL;
752 delete []
DJt;
DJt = NULL;
753 delete []
DaJ;
DaJ = NULL;
807 const scalar_t
a = 2*w;
808 for (
int i = 0; i < nd; i++)
810 const int i0 = i+nd*0, i1 = i+nd*1, i2 = i+nd*2;
811 const scalar_t aDi[3] = { a*
D[i0], a*D[i1], a*D[i2] };
813 const scalar_t aDDt_ii = aDi[0]*
D[i0] + aDi[1]*
D[i1] + aDi[2]*
D[i2];
814 A[i0+ah*i0] += aDDt_ii;
815 A[i1+ah*i1] += aDDt_ii;
816 A[i2+ah*i2] += aDDt_ii;
818 for (
int k = 0; k < i; k++)
820 const int k0 = k+nd*0, k1 = k+nd*1, k2 = k+nd*2;
821 const scalar_t aDDt_ik = aDi[0]*D[k0] + aDi[1]*D[k1] + aDi[2]*D[k2];
822 A[i0+ah*k0] += aDDt_ik;
823 A[k0+ah*i0] += aDDt_ik;
824 A[i1+ah*k1] += aDDt_ik;
825 A[k1+ah*i1] += aDDt_ik;
826 A[i2+ah*k2] += aDDt_ik;
827 A[k2+ah*i2] += aDDt_ik;
853 const scalar_t r23 = scalar_t(2)/3;
854 const scalar_t r53 = scalar_t(5)/3;
857 const scalar_t c = -r23*b/
I3b;
858 for (
int i = 0; i < nd; i++)
885 const int i0 = i+nd*0, i1 = i+nd*1, i2 = i+nd*2;
886 const scalar_t aDaJ_i[3] = { a*
DaJ[i0], a*DaJ[i1], a*DaJ[i2] };
887 const scalar_t bD_i[3] = { b*
D[i0], b*D[i1], b*D[i2] };
888 const scalar_t cDJt_i[3] = { c*
DJt[i0], c*DJt[i1], c*DJt[i2] };
889 const scalar_t cDaJ_i[3] = { c*
DaJ[i0], c*DaJ[i1], c*DaJ[i2] };
893 const scalar_t A2_ii = bD_i[0]*
D[i0]+bD_i[1]*
D[i1]+bD_i[2]*
D[i2];
894 A[i0+ah*i0] += (r53*aDaJ_i[0] + 2*cDJt_i[0])*
DaJ[i0] + A2_ii;
895 A[i1+ah*i1] += (r53*aDaJ_i[1] + 2*cDJt_i[1])*
DaJ[i1] + A2_ii;
896 A[i2+ah*i2] += (r53*aDaJ_i[2] + 2*cDJt_i[2])*
DaJ[i2] + A2_ii;
899 for (
int j = 1; j < 3; j++)
901 const int ij = i+nd*j;
902 for (
int l = 0; l < j; l++)
904 const int il = i+nd*l;
905 const scalar_t A_ii_jl =
906 (r53*aDaJ_i[j] + cDJt_i[j])*
DaJ[il] + cDaJ_i[j]*
DJt[il];
907 A[ij+ah*il] += A_ii_jl;
908 A[il+ah*ij] += A_ii_jl;
913 for (
int k = 0; k < i; k++)
915 const int k0 = k+nd*0, k1 = k+nd*1, k2 = k+nd*2;
917 const scalar_t A2_ik = bD_i[0]*
D[k0]+bD_i[1]*
D[k1]+bD_i[2]*
D[k2];
920 for (
int j = 0; j < 3; j++)
922 const int ij = i+nd*j, kj = k+nd*j;
923 const scalar_t A_ik_jj = (r53*aDaJ_i[j] + cDJt_i[j])*
DaJ[kj] +
924 cDaJ_i[j]*
DJt[kj] + A2_ik;
925 A[ij+ah*kj] += A_ik_jj;
926 A[kj+ah*ij] += A_ik_jj;
930 for (
int j = 1; j < 3; j++)
932 const int ij = i+nd*j, kj = k+nd*j;
933 for (
int l = 0; l < j; l++)
935 const int il = i+nd*l, kl = k+nd*l;
937 const scalar_t A1b_ik_jl = aDaJ_i[l]*
DaJ[kj];
938 const scalar_t A1b_ik_lj = aDaJ_i[j]*DaJ[kl];
942 const scalar_t A_ik_jl = A1b_ik_jl + r23*A1b_ik_lj +
943 cDJt_i[j]*DaJ[kl]+cDaJ_i[j]*
DJt[kl];
944 A[ij+ah*kl] += A_ik_jl;
945 A[kl+ah*ij] += A_ik_jl;
946 const scalar_t A_ik_lj = r23*A1b_ik_jl + A1b_ik_lj +
947 cDJt_i[l]*DaJ[kj]+cDaJ_i[l]*DJt[kj];
948 A[il+ah*kj] += A_ik_lj;
949 A[kj+ah*il] += A_ik_lj;
999 const scalar_t
a = 2*w;
1000 for (
int i = 0; i < ah; i++)
1002 const scalar_t avi = a*
DJt[i];
1003 A[i+ah*i] += avi*DJt[i];
1004 for (
int j = 0; j < i; j++)
1006 const scalar_t aVVt_ij = avi*DJt[j];
1007 A[i+ah*j] += aVVt_ij;
1008 A[j+ah*i] += aVVt_ij;
1012 for (
int i = 0; i < nd; i++)
1014 const int i0 = i+nd*0, i1 = i+nd*1, i2 = i+nd*2;
1015 const scalar_t aD_i[3] = { a*
D[i0], a*D[i1], a*D[i2] };
1016 const scalar_t aDJt_i[3] = { a*
DJt[i0], a*DJt[i1], a*DJt[i2] };
1019 const scalar_t aDDt_ii =
1020 aD_i[0]*
D[i0] + aD_i[1]*
D[i1] + aD_i[2]*
D[i2];
1021 const scalar_t Z1_ii =
1022 I1*aDDt_ii - (aDJt_i[0]*
DJt[i0] + aDJt_i[1]*
DJt[i1] +
1025 for (
int j = 0; j < 3; j++)
1027 const int ij = i+nd*j;
1028 A[ij+ah*ij] += Z1_ii - aDDt_ii*
B[j];
1031 const scalar_t Z2_ii_01 = aDDt_ii*
B[3];
1032 const scalar_t Z2_ii_02 = aDDt_ii*B[4];
1033 const scalar_t Z2_ii_12 = aDDt_ii*B[5];
1034 A[i0+ah*i1] -= Z2_ii_01;
1035 A[i1+ah*i0] -= Z2_ii_01;
1036 A[i0+ah*i2] -= Z2_ii_02;
1037 A[i2+ah*i0] -= Z2_ii_02;
1038 A[i1+ah*i2] -= Z2_ii_12;
1039 A[i2+ah*i1] -= Z2_ii_12;
1042 for (
int k = 0; k < i; k++)
1044 const int k0 = k+nd*0, k1 = k+nd*1, k2 = k+nd*2;
1045 const scalar_t aDDt_ik =
1046 aD_i[0]*
D[k0] + aD_i[1]*
D[k1] + aD_i[2]*
D[k2];
1047 const scalar_t Z1_ik =
1048 I1*aDDt_ik - (aDJt_i[0]*
DJt[k0] + aDJt_i[1]*
DJt[k1] +
1051 for (
int j = 0; j < 3; j++)
1053 const int ij = i+nd*j, kj = k+nd*j;
1054 const scalar_t Z2_ik_jj = Z1_ik - aDDt_ik*
B[j];
1055 A[ij+ah*kj] += Z2_ik_jj;
1056 A[kj+ah*ij] += Z2_ik_jj;
1060 const scalar_t Z2_ik_01 = aDDt_ik*
B[3];
1061 A[i0+ah*k1] -= Z2_ik_01;
1062 A[i1+ah*k0] -= Z2_ik_01;
1063 A[k0+ah*i1] -= Z2_ik_01;
1064 A[k1+ah*i0] -= Z2_ik_01;
1065 const scalar_t Z2_ik_02 = aDDt_ik*B[4];
1066 A[i0+ah*k2] -= Z2_ik_02;
1067 A[i2+ah*k0] -= Z2_ik_02;
1068 A[k0+ah*i2] -= Z2_ik_02;
1069 A[k2+ah*i0] -= Z2_ik_02;
1070 const scalar_t Z2_ik_12 = aDDt_ik*B[5];
1071 A[i1+ah*k2] -= Z2_ik_12;
1072 A[i2+ah*k1] -= Z2_ik_12;
1073 A[k1+ah*i2] -= Z2_ik_12;
1074 A[k2+ah*i1] -= Z2_ik_12;
1077 for (
int j = 1; j < 3; j++)
1079 const int ij = i+nd*j, kj = k+nd*j;
1080 for (
int l = 0; l < j; l++)
1082 const int il = i+nd*l, kl = k+nd*l;
1083 const scalar_t Z3_ik_jl =
1084 aDJt_i[j]*
DJt[kl] - aDJt_i[l]*
DJt[kj];
1085 A[ij+ah*kl] += Z3_ik_jl;
1086 A[kl+ah*ij] += Z3_ik_jl;
1087 A[il+ah*kj] -= Z3_ik_jl;
1088 A[kj+ah*il] -= Z3_ik_jl;
1130 const int ah = 3*nd;
1132 const scalar_t
b = (-4*
a)/(3*
I3b);
1134 const scalar_t d = (4*c)/3;
1136 for (
int i = 0; i < ah; i++)
1138 const scalar_t dvi = d*
DaJ[i];
1139 A[i+ah*i] += dvi*DaJ[i];
1140 for (
int j = 0; j < i; j++)
1142 const scalar_t dVVt_ij = dvi*DaJ[j];
1143 A[i+ah*j] += dVVt_ij;
1144 A[j+ah*i] += dVVt_ij;
1148 for (
int i = 0; i < nd; i++)
1150 const int i0 = i+nd*0, i1 = i+nd*1, i2 = i+nd*2;
1151 const scalar_t cDaJ_i[3] = { c*
DaJ[i0], c*DaJ[i1], c*DaJ[i2] };
1152 const scalar_t bDaJ_i[3] = { b*
DaJ[i0], b*DaJ[i1], b*DaJ[i2] };
1153 const scalar_t bDdI2t_i[3] = { b*
DdI2t[i0], b*DdI2t[i1], b*DdI2t[i2] };
1157 for (
int j = 0; j < 3; j++)
1159 const int ij = i+nd*j;
1160 A[ij+ah*ij] += (cDaJ_i[j] + 2*bDdI2t_i[j])*
DaJ[ij];
1163 for (
int j = 1; j < 3; j++)
1165 const int ij = i+nd*j;
1166 for (
int l = 0; l < j; l++)
1168 const int il = i+nd*l;
1169 const scalar_t Z_ii_jl =
1170 (cDaJ_i[l] + bDdI2t_i[l])*
DaJ[ij] + bDdI2t_i[j]*
DaJ[il];
1171 A[ij+ah*il] += Z_ii_jl;
1172 A[il+ah*ij] += Z_ii_jl;
1177 for (
int k = 0; k < i; k++)
1180 for (
int j = 0; j < 3; j++)
1182 const int ij = i+nd*j, kj = k+nd*j;
1183 const scalar_t Z_ik_jj =
1184 (cDaJ_i[j] + bDdI2t_i[j])*
DaJ[kj] + bDaJ_i[j]*
DdI2t[kj];
1185 A[ij+ah*kj] += Z_ik_jj;
1186 A[kj+ah*ij] += Z_ik_jj;
1189 for (
int j = 1; j < 3; j++)
1191 const int ij = i+nd*j, kj = k+nd*j;
1192 for (
int l = 0; l < j; l++)
1194 const int il = i+nd*l, kl = k+nd*l;
1195 const scalar_t Z_ik_jl = cDaJ_i[l]*
DaJ[kj] +
1196 bDdI2t_i[j]*
DaJ[kl] +
1197 bDaJ_i[j]*
DdI2t[kl];
1198 A[ij+ah*kl] += Z_ik_jl;
1199 A[kl+ah*ij] += Z_ik_jl;
1200 const scalar_t Z_ik_lj = cDaJ_i[j]*
DaJ[kl] +
1201 bDdI2t_i[l]*
DaJ[kj] +
1202 bDaJ_i[l]*DdI2t[kj];
1203 A[il+ah*kj] += Z_ik_lj;
1204 A[kj+ah*il] += Z_ik_lj;
1222 const int ah = 3*nd;
1223 const scalar_t
a = 2*w;
1225 for (
int i = 0; i < ah; i++)
1227 const scalar_t avi = a*
DaJ[i];
1228 A[i+ah*i] += avi*DaJ[i];
1229 for (
int j = 0; j < i; j++)
1231 const scalar_t aVVt_ij = avi*DaJ[j];
1232 A[i+ah*j] += aVVt_ij;
1233 A[j+ah*i] += aVVt_ij;
1236 for (
int j = 1; j < 3; j++)
1238 for (
int l = 0; l < j; l++)
1240 for (
int i = 0; i < nd; i++)
1242 const int ij = i+nd*j, il = i+nd*l;
1243 const scalar_t aDaJ_ij = a*
DaJ[ij], aDaJ_il = a*DaJ[il];
1244 for (
int k = 0; k < i; k++)
1246 const int kj = k+nd*j, kl = k+nd*l;
1247 const scalar_t A_ijkl = aDaJ_ij*DaJ[kl] - aDaJ_il*DaJ[kj];
1248 A[ij+ah*kl] += A_ijkl;
1249 A[kl+ah*ij] += A_ijkl;
1250 A[kj+ah*il] -= A_ijkl;
1251 A[il+ah*kj] -= A_ijkl;
1268 const int ah = 3*nd;
1270 for (
int j = 1; j < 3; j++)
1272 for (
int l = 0; l < j; l++)
1274 for (
int i = 0; i < nd; i++)
1276 const int ij = i+nd*j, il = i+nd*l;
1277 const scalar_t aDaJ_ij = a*
DaJ[ij], aDaJ_il = a*DaJ[il];
1278 for (
int k = 0; k < i; k++)
1280 const int kj = k+nd*j, kl = k+nd*l;
1281 const scalar_t A_ijkl = aDaJ_ij*DaJ[kl] - aDaJ_il*DaJ[kj];
1282 A[ij+ah*kl] += A_ijkl;
1283 A[kl+ah*ij] += A_ijkl;
1284 A[kj+ah*il] -= A_ijkl;
1285 A[il+ah*kj] -= A_ijkl;
1307 const int ah = 3*nd;
1309 for (
int i = 0; i < ah; i++)
1311 const scalar_t axi = w*
DXt[i], ayi = w*
DYt[i];
1312 A[i+ah*i] += 2*axi*DYt[i];
1313 for (
int j = 0; j < i; j++)
1315 const scalar_t A_ij = axi*DYt[j] + ayi*DXt[j];
1332 const int ah = 3*nd;
1334 for (
int i = 0; i < ah; i++)
1336 const scalar_t axi = w*
DXt[i];
1337 A[i+ah*i] += axi*DXt[i];
1338 for (
int j = 0; j < i; j++)
1340 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.