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;
282 const scalar_t b = 2*w/
Get_I2b();
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;
409 const scalar_t a = w/
Get_I2b();
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]);
603 for (
int i = 0; i < 9; i++)
616 for (
int i = 0; i < 9; i++)
629 const scalar_t C[6] =
631 2*(
I1 -
B[0]), 2*(
I1 -
B[1]), 2*(
I1 -
B[2]),
632 -2*
B[3], -2*
B[4], -2*
B[5]
637 dI2[0] = C[0]*
J[0] + C[3]*
J[1] + C[4]*
J[2];
638 dI2[1] = C[3]*J[0] + C[1]*J[1] + C[5]*J[2];
639 dI2[2] = C[4]*J[0] + C[5]*J[1] + C[2]*J[2];
641 dI2[3] = C[0]*J[3] + C[3]*J[4] + C[4]*J[5];
642 dI2[4] = C[3]*J[3] + C[1]*J[4] + C[5]*J[5];
643 dI2[5] = C[4]*J[3] + C[5]*J[4] + C[2]*J[5];
645 dI2[6] = C[0]*J[6] + C[3]*J[7] + C[4]*J[8];
646 dI2[7] = C[3]*J[6] + C[1]*J[7] + C[5]*J[8];
647 dI2[8] = C[4]*J[6] + C[5]*J[7] + C[2]*J[8];
660 for (
int i = 0; i < 9; i++)
670 const scalar_t c1 = 2*
Get_I3b();
672 for (
int i = 0; i < 9; i++)
692 void Eval_DZt(
const scalar_t *Z, scalar_t **DZt_ptr)
694 MFEM_ASSERT(
D != NULL,
"");
696 scalar_t *DZt = *DZt_ptr;
697 if (DZt == NULL) { *DZt_ptr = DZt =
new scalar_t[3*
alloc_height]; }
698 for (
int i = 0; i < nd; i++)
700 const int i0 = i+nd*0, i1 = i+nd*1, i2 = i+nd*2;
701 DZt[i0] =
D[i0]*Z[0] +
D[i1]*Z[3] +
D[i2]*Z[6];
702 DZt[i1] =
D[i0]*Z[1] +
D[i1]*Z[4] +
D[i2]*Z[7];
703 DZt[i2] =
D[i0]*Z[2] +
D[i1]*Z[5] +
D[i2]*Z[8];
748 delete []
DYt;
DYt = NULL;
749 delete []
DXt;
DXt = NULL;
751 delete []
DJt;
DJt = NULL;
752 delete []
DaJ;
DaJ = NULL;
806 const scalar_t a = 2*w;
807 for (
int i = 0; i < nd; i++)
809 const int i0 = i+nd*0, i1 = i+nd*1, i2 = i+nd*2;
810 const scalar_t aDi[3] = { a*
D[i0], a*D[i1], a*D[i2] };
812 const scalar_t aDDt_ii = aDi[0]*
D[i0] + aDi[1]*
D[i1] + aDi[2]*
D[i2];
813 A[i0+ah*i0] += aDDt_ii;
814 A[i1+ah*i1] += aDDt_ii;
815 A[i2+ah*i2] += aDDt_ii;
817 for (
int k = 0; k < i; k++)
819 const int k0 = k+nd*0, k1 = k+nd*1, k2 = k+nd*2;
820 const scalar_t aDDt_ik = aDi[0]*D[k0] + aDi[1]*D[k1] + aDi[2]*D[k2];
821 A[i0+ah*k0] += aDDt_ik;
822 A[k0+ah*i0] += aDDt_ik;
823 A[i1+ah*k1] += aDDt_ik;
824 A[k1+ah*i1] += aDDt_ik;
825 A[i2+ah*k2] += aDDt_ik;
826 A[k2+ah*i2] += aDDt_ik;
852 const scalar_t r23 = scalar_t(2)/3;
853 const scalar_t r53 = scalar_t(5)/3;
856 const scalar_t c = -r23*b/
I3b;
857 for (
int i = 0; i < nd; i++)
884 const int i0 = i+nd*0, i1 = i+nd*1, i2 = i+nd*2;
885 const scalar_t aDaJ_i[3] = { a*
DaJ[i0], a*DaJ[i1], a*DaJ[i2] };
886 const scalar_t bD_i[3] = { b*
D[i0], b*D[i1], b*D[i2] };
887 const scalar_t cDJt_i[3] = { c*
DJt[i0], c*DJt[i1], c*DJt[i2] };
888 const scalar_t cDaJ_i[3] = { c*
DaJ[i0], c*DaJ[i1], c*DaJ[i2] };
892 const scalar_t A2_ii = bD_i[0]*
D[i0]+bD_i[1]*
D[i1]+bD_i[2]*
D[i2];
893 A[i0+ah*i0] += (r53*aDaJ_i[0] + 2*cDJt_i[0])*
DaJ[i0] + A2_ii;
894 A[i1+ah*i1] += (r53*aDaJ_i[1] + 2*cDJt_i[1])*
DaJ[i1] + A2_ii;
895 A[i2+ah*i2] += (r53*aDaJ_i[2] + 2*cDJt_i[2])*
DaJ[i2] + A2_ii;
898 for (
int j = 1; j < 3; j++)
900 const int ij = i+nd*j;
901 for (
int l = 0; l < j; l++)
903 const int il = i+nd*l;
904 const scalar_t A_ii_jl =
905 (r53*aDaJ_i[j] + cDJt_i[j])*
DaJ[il] + cDaJ_i[j]*
DJt[il];
906 A[ij+ah*il] += A_ii_jl;
907 A[il+ah*ij] += A_ii_jl;
912 for (
int k = 0; k < i; k++)
914 const int k0 = k+nd*0, k1 = k+nd*1, k2 = k+nd*2;
916 const scalar_t A2_ik = bD_i[0]*
D[k0]+bD_i[1]*
D[k1]+bD_i[2]*
D[k2];
919 for (
int j = 0; j < 3; j++)
921 const int ij = i+nd*j, kj = k+nd*j;
922 const scalar_t A_ik_jj = (r53*aDaJ_i[j] + cDJt_i[j])*
DaJ[kj] +
923 cDaJ_i[j]*
DJt[kj] + A2_ik;
924 A[ij+ah*kj] += A_ik_jj;
925 A[kj+ah*ij] += A_ik_jj;
929 for (
int j = 1; j < 3; j++)
931 const int ij = i+nd*j, kj = k+nd*j;
932 for (
int l = 0; l < j; l++)
934 const int il = i+nd*l, kl = k+nd*l;
936 const scalar_t A1b_ik_jl = aDaJ_i[l]*
DaJ[kj];
937 const scalar_t A1b_ik_lj = aDaJ_i[j]*DaJ[kl];
941 const scalar_t A_ik_jl = A1b_ik_jl + r23*A1b_ik_lj +
942 cDJt_i[j]*DaJ[kl]+cDaJ_i[j]*
DJt[kl];
943 A[ij+ah*kl] += A_ik_jl;
944 A[kl+ah*ij] += A_ik_jl;
945 const scalar_t A_ik_lj = r23*A1b_ik_jl + A1b_ik_lj +
946 cDJt_i[l]*DaJ[kj]+cDaJ_i[l]*DJt[kj];
947 A[il+ah*kj] += A_ik_lj;
948 A[kj+ah*il] += A_ik_lj;
998 const scalar_t a = 2*w;
999 for (
int i = 0; i < ah; i++)
1001 const scalar_t avi = a*
DJt[i];
1002 A[i+ah*i] += avi*DJt[i];
1003 for (
int j = 0; j < i; j++)
1005 const scalar_t aVVt_ij = avi*DJt[j];
1006 A[i+ah*j] += aVVt_ij;
1007 A[j+ah*i] += aVVt_ij;
1011 for (
int i = 0; i < nd; i++)
1013 const int i0 = i+nd*0, i1 = i+nd*1, i2 = i+nd*2;
1014 const scalar_t aD_i[3] = { a*
D[i0], a*D[i1], a*D[i2] };
1015 const scalar_t aDJt_i[3] = { a*
DJt[i0], a*DJt[i1], a*DJt[i2] };
1018 const scalar_t aDDt_ii =
1019 aD_i[0]*
D[i0] + aD_i[1]*
D[i1] + aD_i[2]*
D[i2];
1020 const scalar_t Z1_ii =
1021 I1*aDDt_ii - (aDJt_i[0]*
DJt[i0] + aDJt_i[1]*
DJt[i1] +
1024 for (
int j = 0; j < 3; j++)
1026 const int ij = i+nd*j;
1027 A[ij+ah*ij] += Z1_ii - aDDt_ii*
B[j];
1030 const scalar_t Z2_ii_01 = aDDt_ii*
B[3];
1031 const scalar_t Z2_ii_02 = aDDt_ii*B[4];
1032 const scalar_t Z2_ii_12 = aDDt_ii*B[5];
1033 A[i0+ah*i1] -= Z2_ii_01;
1034 A[i1+ah*i0] -= Z2_ii_01;
1035 A[i0+ah*i2] -= Z2_ii_02;
1036 A[i2+ah*i0] -= Z2_ii_02;
1037 A[i1+ah*i2] -= Z2_ii_12;
1038 A[i2+ah*i1] -= Z2_ii_12;
1041 for (
int k = 0; k < i; k++)
1043 const int k0 = k+nd*0, k1 = k+nd*1, k2 = k+nd*2;
1044 const scalar_t aDDt_ik =
1045 aD_i[0]*
D[k0] + aD_i[1]*
D[k1] + aD_i[2]*
D[k2];
1046 const scalar_t Z1_ik =
1047 I1*aDDt_ik - (aDJt_i[0]*
DJt[k0] + aDJt_i[1]*
DJt[k1] +
1050 for (
int j = 0; j < 3; j++)
1052 const int ij = i+nd*j, kj = k+nd*j;
1053 const scalar_t Z2_ik_jj = Z1_ik - aDDt_ik*
B[j];
1054 A[ij+ah*kj] += Z2_ik_jj;
1055 A[kj+ah*ij] += Z2_ik_jj;
1059 const scalar_t Z2_ik_01 = aDDt_ik*
B[3];
1060 A[i0+ah*k1] -= Z2_ik_01;
1061 A[i1+ah*k0] -= Z2_ik_01;
1062 A[k0+ah*i1] -= Z2_ik_01;
1063 A[k1+ah*i0] -= Z2_ik_01;
1064 const scalar_t Z2_ik_02 = aDDt_ik*B[4];
1065 A[i0+ah*k2] -= Z2_ik_02;
1066 A[i2+ah*k0] -= Z2_ik_02;
1067 A[k0+ah*i2] -= Z2_ik_02;
1068 A[k2+ah*i0] -= Z2_ik_02;
1069 const scalar_t Z2_ik_12 = aDDt_ik*B[5];
1070 A[i1+ah*k2] -= Z2_ik_12;
1071 A[i2+ah*k1] -= Z2_ik_12;
1072 A[k1+ah*i2] -= Z2_ik_12;
1073 A[k2+ah*i1] -= Z2_ik_12;
1076 for (
int j = 1; j < 3; j++)
1078 const int ij = i+nd*j, kj = k+nd*j;
1079 for (
int l = 0; l < j; l++)
1081 const int il = i+nd*l, kl = k+nd*l;
1082 const scalar_t Z3_ik_jl =
1083 aDJt_i[j]*
DJt[kl] - aDJt_i[l]*
DJt[kj];
1084 A[ij+ah*kl] += Z3_ik_jl;
1085 A[kl+ah*ij] += Z3_ik_jl;
1086 A[il+ah*kj] -= Z3_ik_jl;
1087 A[kj+ah*il] -= Z3_ik_jl;
1129 const int ah = 3*nd;
1131 const scalar_t b = (-4*a)/(3*
I3b);
1133 const scalar_t d = (4*c)/3;
1135 for (
int i = 0; i < ah; i++)
1137 const scalar_t dvi = d*
DaJ[i];
1138 A[i+ah*i] += dvi*DaJ[i];
1139 for (
int j = 0; j < i; j++)
1141 const scalar_t dVVt_ij = dvi*DaJ[j];
1142 A[i+ah*j] += dVVt_ij;
1143 A[j+ah*i] += dVVt_ij;
1147 for (
int i = 0; i < nd; i++)
1149 const int i0 = i+nd*0, i1 = i+nd*1, i2 = i+nd*2;
1150 const scalar_t cDaJ_i[3] = { c*
DaJ[i0], c*DaJ[i1], c*DaJ[i2] };
1151 const scalar_t bDaJ_i[3] = { b*
DaJ[i0], b*DaJ[i1], b*DaJ[i2] };
1152 const scalar_t bDdI2t_i[3] = { b*
DdI2t[i0], b*DdI2t[i1], b*DdI2t[i2] };
1156 for (
int j = 0; j < 3; j++)
1158 const int ij = i+nd*j;
1159 A[ij+ah*ij] += (cDaJ_i[j] + 2*bDdI2t_i[j])*
DaJ[ij];
1162 for (
int j = 1; j < 3; j++)
1164 const int ij = i+nd*j;
1165 for (
int l = 0; l < j; l++)
1167 const int il = i+nd*l;
1168 const scalar_t Z_ii_jl =
1169 (cDaJ_i[l] + bDdI2t_i[l])*
DaJ[ij] + bDdI2t_i[j]*
DaJ[il];
1170 A[ij+ah*il] += Z_ii_jl;
1171 A[il+ah*ij] += Z_ii_jl;
1176 for (
int k = 0; k < i; k++)
1179 for (
int j = 0; j < 3; j++)
1181 const int ij = i+nd*j, kj = k+nd*j;
1182 const scalar_t Z_ik_jj =
1183 (cDaJ_i[j] + bDdI2t_i[j])*
DaJ[kj] + bDaJ_i[j]*
DdI2t[kj];
1184 A[ij+ah*kj] += Z_ik_jj;
1185 A[kj+ah*ij] += Z_ik_jj;
1188 for (
int j = 1; j < 3; j++)
1190 const int ij = i+nd*j, kj = k+nd*j;
1191 for (
int l = 0; l < j; l++)
1193 const int il = i+nd*l, kl = k+nd*l;
1194 const scalar_t Z_ik_jl = cDaJ_i[l]*
DaJ[kj] +
1195 bDdI2t_i[j]*
DaJ[kl] +
1196 bDaJ_i[j]*
DdI2t[kl];
1197 A[ij+ah*kl] += Z_ik_jl;
1198 A[kl+ah*ij] += Z_ik_jl;
1199 const scalar_t Z_ik_lj = cDaJ_i[j]*
DaJ[kl] +
1200 bDdI2t_i[l]*
DaJ[kj] +
1201 bDaJ_i[l]*DdI2t[kj];
1202 A[il+ah*kj] += Z_ik_lj;
1203 A[kj+ah*il] += Z_ik_lj;
1221 const int ah = 3*nd;
1222 const scalar_t a = 2*w;
1224 for (
int i = 0; i < ah; i++)
1226 const scalar_t avi = a*
DaJ[i];
1227 A[i+ah*i] += avi*DaJ[i];
1228 for (
int j = 0; j < i; j++)
1230 const scalar_t aVVt_ij = avi*DaJ[j];
1231 A[i+ah*j] += aVVt_ij;
1232 A[j+ah*i] += aVVt_ij;
1235 for (
int j = 1; j < 3; j++)
1237 for (
int l = 0; l < j; l++)
1239 for (
int i = 0; i < nd; i++)
1241 const int ij = i+nd*j, il = i+nd*l;
1242 const scalar_t aDaJ_ij = a*
DaJ[ij], aDaJ_il = a*DaJ[il];
1243 for (
int k = 0; k < i; k++)
1245 const int kj = k+nd*j, kl = k+nd*l;
1246 const scalar_t A_ijkl = aDaJ_ij*DaJ[kl] - aDaJ_il*DaJ[kj];
1247 A[ij+ah*kl] += A_ijkl;
1248 A[kl+ah*ij] += A_ijkl;
1249 A[kj+ah*il] -= A_ijkl;
1250 A[il+ah*kj] -= A_ijkl;
1267 const int ah = 3*nd;
1268 const scalar_t a = w/
Get_I3b();
1269 for (
int j = 1; j < 3; j++)
1271 for (
int l = 0; l < j; l++)
1273 for (
int i = 0; i < nd; i++)
1275 const int ij = i+nd*j, il = i+nd*l;
1276 const scalar_t aDaJ_ij = a*
DaJ[ij], aDaJ_il = a*DaJ[il];
1277 for (
int k = 0; k < i; k++)
1279 const int kj = k+nd*j, kl = k+nd*l;
1280 const scalar_t A_ijkl = aDaJ_ij*DaJ[kl] - aDaJ_il*DaJ[kj];
1281 A[ij+ah*kl] += A_ijkl;
1282 A[kl+ah*ij] += A_ijkl;
1283 A[kj+ah*il] -= A_ijkl;
1284 A[il+ah*kj] -= A_ijkl;
1306 const int ah = 3*nd;
1308 for (
int i = 0; i < ah; i++)
1310 const scalar_t axi = w*
DXt[i], ayi = w*
DYt[i];
1311 A[i+ah*i] += 2*axi*DYt[i];
1312 for (
int j = 0; j < i; j++)
1314 const scalar_t A_ij = axi*DYt[j] + ayi*DXt[j];
1331 const int ah = 3*nd;
1333 for (
int i = 0; i < ah; i++)
1335 const scalar_t axi = w*
DXt[i];
1336 A[i+ah*i] += axi*DXt[i];
1337 for (
int j = 0; j < i; j++)
1339 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.