15 #include "../coefficient.hpp"
22 const double ND_HexahedronElement::tk[18] =
23 { 1.,0.,0., 0.,1.,0., 0.,0.,1., -1.,0.,0., 0.,-1.,0., 0.,0.,-1. };
26 const int cb_type,
const int ob_type)
29 dof2tk(dof), cp(
poly1d.ClosedPoints(p, cb_type))
36 const int dof3 =
dof/3;
38 #ifndef MFEM_THREAD_SAFE
52 for (
int i = 0; i <
p; i++)
54 dof_map[0*dof3 + i + (0 + 0*(p + 1))*
p] = o++;
56 for (
int i = 0; i <
p; i++)
58 dof_map[1*dof3 + p + (i + 0*
p)*(p + 1)] = o++;
60 for (
int i = 0; i <
p; i++)
62 dof_map[0*dof3 + i + (p + 0*(p + 1))*
p] = o++;
64 for (
int i = 0; i <
p; i++)
66 dof_map[1*dof3 + 0 + (i + 0*
p)*(p + 1)] = o++;
68 for (
int i = 0; i <
p; i++)
70 dof_map[0*dof3 + i + (0 + p*(p + 1))*
p] = o++;
72 for (
int i = 0; i <
p; i++)
74 dof_map[1*dof3 + p + (i + p*
p)*(p + 1)] = o++;
76 for (
int i = 0; i <
p; i++)
78 dof_map[0*dof3 + i + (p + p*(p + 1))*
p] = o++;
80 for (
int i = 0; i <
p; i++)
82 dof_map[1*dof3 + 0 + (i + p*
p)*(p + 1)] = o++;
84 for (
int i = 0; i <
p; i++)
86 dof_map[2*dof3 + 0 + (0 + i*(p + 1))*(p + 1)] = o++;
88 for (
int i = 0; i <
p; i++)
90 dof_map[2*dof3 + p + (0 + i*(p + 1))*(p + 1)] = o++;
92 for (
int i = 0; i <
p; i++)
94 dof_map[2*dof3 + p + (p + i*(p + 1))*(p + 1)] = o++;
96 for (
int i = 0; i <
p; i++)
98 dof_map[2*dof3 + 0 + (p + i*(p + 1))*(p + 1)] = o++;
103 for (
int j = 1; j <
p; j++)
104 for (
int i = 0; i <
p; i++)
106 dof_map[0*dof3 + i + ((p - j) + 0*(p + 1))*p] = o++;
108 for (
int j = 0; j <
p; j++)
109 for (
int i = 1; i <
p; i++)
111 dof_map[1*dof3 + i + ((p - 1 - j) + 0*p)*(p + 1)] = -1 - (o++);
114 for (
int k = 1; k <
p; k++)
115 for (
int i = 0; i <
p; i++)
117 dof_map[0*dof3 + i + (0 + k*(p + 1))*
p] = o++;
119 for (
int k = 0; k <
p; k++)
120 for (
int i = 1; i <
p; i++ )
122 dof_map[2*dof3 + i + (0 + k*(p + 1))*(p + 1)] = o++;
125 for (
int k = 1; k <
p; k++)
126 for (
int j = 0; j <
p; j++)
128 dof_map[1*dof3 + p + (j + k*
p)*(p + 1)] = o++;
130 for (
int k = 0; k <
p; k++)
131 for (
int j = 1; j <
p; j++)
133 dof_map[2*dof3 + p + (j + k*(p + 1))*(p + 1)] = o++;
136 for (
int k = 1; k <
p; k++)
137 for (
int i = 0; i <
p; i++)
139 dof_map[0*dof3 + (p - 1 - i) + (p + k*(p + 1))*p] = -1 - (o++);
141 for (
int k = 0; k <
p; k++)
142 for (
int i = 1; i <
p; i++)
144 dof_map[2*dof3 + (p - i) + (p + k*(p + 1))*(p + 1)] = o++;
147 for (
int k = 1; k <
p; k++)
148 for (
int j = 0; j <
p; j++)
150 dof_map[1*dof3 + 0 + ((p - 1 - j) + k*p)*(p + 1)] = -1 - (o++);
152 for (
int k = 0; k <
p; k++)
153 for (
int j = 1; j <
p; j++)
155 dof_map[2*dof3 + 0 + ((p - j) + k*(p + 1))*(p + 1)] = o++;
158 for (
int j = 1; j <
p; j++)
159 for (
int i = 0; i <
p; i++)
161 dof_map[0*dof3 + i + (j + p*(p + 1))*
p] = o++;
163 for (
int j = 0; j <
p; j++)
164 for (
int i = 1; i <
p; i++)
166 dof_map[1*dof3 + i + (j + p*
p)*(p + 1)] = o++;
171 for (
int k = 1; k <
p; k++)
172 for (
int j = 1; j <
p; j++)
173 for (
int i = 0; i <
p; i++)
175 dof_map[0*dof3 + i + (j + k*(p + 1))*
p] = o++;
178 for (
int k = 1; k <
p; k++)
179 for (
int j = 0; j <
p; j++)
180 for (
int i = 1; i <
p; i++)
182 dof_map[1*dof3 + i + (j + k*
p)*(p + 1)] = o++;
185 for (
int k = 0; k <
p; k++)
186 for (
int j = 1; j <
p; j++)
187 for (
int i = 1; i <
p; i++)
189 dof_map[2*dof3 + i + (j + k*(p + 1))*(p + 1)] = o++;
195 for (
int k = 0; k <=
p; k++)
196 for (
int j = 0; j <=
p; j++)
197 for (
int i = 0; i <
p; i++)
202 dof2tk[idx = -1 - idx] = 3;
211 for (
int k = 0; k <=
p; k++)
212 for (
int j = 0; j <
p; j++)
213 for (
int i = 0; i <=
p; i++)
218 dof2tk[idx = -1 - idx] = 4;
227 for (
int k = 0; k <
p; k++)
228 for (
int j = 0; j <=
p; j++)
229 for (
int i = 0; i <=
p; i++)
234 dof2tk[idx = -1 - idx] = 5;
258 for (
int c = 0; c < 3; ++c)
264 for (
int k = 0; k <= km; k++)
265 for (
int j = 0; j <= jm; j++)
266 for (
int i = 0; i <= im; i++)
274 const int id1 = c == 0 ? i : (c == 1 ? j : k);
275 const double h = cp[id1+1] - cp[id1];
279 for (
int q = 0; q < nqpt; q++)
285 ip3d.
Set3(cp[i] + (h*ip1d.
x), cp[j], cp[k]);
289 ip3d.
Set3(cp[i], cp[j] + (h*ip1d.
x), cp[k]);
293 ip3d.
Set3(cp[i], cp[j], cp[k] + (h*ip1d.
x));
297 vc.
Eval(xk, Trans, ip3d);
301 val += ip1d.
weight * ipval;
314 #ifdef MFEM_THREAD_SAFE
315 Vector shape_cx(p + 1), shape_ox(p), shape_cy(p + 1), shape_oy(p);
316 Vector shape_cz(p + 1), shape_oz(p);
317 Vector dshape_cx, dshape_cy, dshape_cz;
341 for (
int k = 0; k <=
p; k++)
342 for (
int j = 0; j <=
p; j++)
343 for (
int i = 0; i <
p; i++)
348 idx = -1 - idx, s = -1;
354 shape(idx,0) = s*shape_ox(i)*shape_cy(j)*shape_cz(k);
359 for (
int k = 0; k <=
p; k++)
360 for (
int j = 0; j <
p; j++)
361 for (
int i = 0; i <=
p; i++)
366 idx = -1 - idx, s = -1;
373 shape(idx,1) = s*shape_cx(i)*shape_oy(j)*shape_cz(k);
377 for (
int k = 0; k <
p; k++)
378 for (
int j = 0; j <=
p; j++)
379 for (
int i = 0; i <=
p; i++)
384 idx = -1 - idx, s = -1;
392 shape(idx,2) = s*shape_cx(i)*shape_cy(j)*shape_oz(k);
401 #ifdef MFEM_THREAD_SAFE
402 Vector shape_cx(p + 1), shape_ox(p), shape_cy(p + 1), shape_oy(p);
403 Vector shape_cz(p + 1), shape_oz(p);
404 Vector dshape_cx(p + 1), dshape_cy(p + 1), dshape_cz(p + 1);
425 for (
int k = 0; k <=
p; k++)
426 for (
int j = 0; j <=
p; j++)
427 for (
int i = 0; i <
p; i++)
432 idx = -1 - idx, s = -1;
438 curl_shape(idx,0) = 0.;
439 curl_shape(idx,1) = s*shape_ox(i)* shape_cy(j)*dshape_cz(k);
440 curl_shape(idx,2) = -s*shape_ox(i)*dshape_cy(j)* shape_cz(k);
443 for (
int k = 0; k <=
p; k++)
444 for (
int j = 0; j <
p; j++)
445 for (
int i = 0; i <=
p; i++)
450 idx = -1 - idx, s = -1;
456 curl_shape(idx,0) = -s* shape_cx(i)*shape_oy(j)*dshape_cz(k);
457 curl_shape(idx,1) = 0.;
458 curl_shape(idx,2) = s*dshape_cx(i)*shape_oy(j)* shape_cz(k);
461 for (
int k = 0; k <
p; k++)
462 for (
int j = 0; j <=
p; j++)
463 for (
int i = 0; i <=
p; i++)
468 idx = -1 - idx, s = -1;
474 curl_shape(idx,0) = s* shape_cx(i)*dshape_cy(j)*shape_oz(k);
475 curl_shape(idx,1) = -s*dshape_cx(i)* shape_cy(j)*shape_oz(k);
476 curl_shape(idx,2) = 0.;
480 const double ND_QuadrilateralElement::tk[8] =
481 { 1.,0., 0.,1., -1.,0., 0.,-1. };
489 cp(
poly1d.ClosedPoints(p, cb_type))
496 const int dof2 =
dof/2;
498 #ifndef MFEM_THREAD_SAFE
509 for (
int i = 0; i <
p; i++)
513 for (
int j = 0; j <
p; j++)
515 dof_map[1*dof2 + p + j*(p + 1)] = o++;
517 for (
int i = 0; i <
p; i++)
519 dof_map[0*dof2 + (p - 1 - i) + p*p] = -1 - (o++);
521 for (
int j = 0; j <
p; j++)
523 dof_map[1*dof2 + 0 + (p - 1 - j)*(p + 1)] = -1 - (o++);
528 for (
int j = 1; j <
p; j++)
529 for (
int i = 0; i <
p; i++)
534 for (
int j = 0; j <
p; j++)
535 for (
int i = 1; i <
p; i++)
537 dof_map[1*dof2 + i + j*(p + 1)] = o++;
543 for (
int j = 0; j <=
p; j++)
544 for (
int i = 0; i <
p; i++)
549 dof2tk[idx = -1 - idx] = 2;
558 for (
int j = 0; j <
p; j++)
559 for (
int i = 0; i <=
p; i++)
564 dof2tk[idx = -1 - idx] = 3;
589 for (
int j = 0; j <=
order; j++)
590 for (
int i = 0; i <
order; i++)
598 const double h = cp[i+1] - cp[i];
602 for (
int k = 0; k < nqpt; k++)
606 ip2d.
Set2(cp[i] + (h*ip1d.
x), cp[j]);
609 vc.
Eval(xk, Trans, ip2d);
613 val += ip1d.
weight * ipval;
619 for (
int j = 0; j <
order; j++)
620 for (
int i = 0; i <=
order; i++)
628 const double h = cp[j+1] - cp[j];
632 for (
int k = 0; k < nqpt; k++)
636 ip2d.
Set2(cp[i], cp[j] + (h*ip1d.
x));
639 vc.
Eval(xk, Trans, ip2d);
643 val += ip1d.
weight * ipval;
655 #ifdef MFEM_THREAD_SAFE
656 Vector shape_cx(p + 1), shape_ox(p), shape_cy(p + 1), shape_oy(p);
657 Vector dshape_cx, dshape_cy;
677 for (
int j = 0; j <=
p; j++)
678 for (
int i = 0; i <
p; i++)
683 idx = -1 - idx, s = -1;
689 shape(idx,0) = s*shape_ox(i)*shape_cy(j);
693 for (
int j = 0; j <
p; j++)
694 for (
int i = 0; i <=
p; i++)
699 idx = -1 - idx, s = -1;
706 shape(idx,1) = s*shape_cx(i)*shape_oy(j);
715 #ifdef MFEM_THREAD_SAFE
716 Vector shape_cx(p + 1), shape_ox(p), shape_cy(p + 1), shape_oy(p);
717 Vector dshape_cx(p + 1), dshape_cy(p + 1);
735 for (
int j = 0; j <=
p; j++)
736 for (
int i = 0; i <
p; i++)
741 idx = -1 - idx, s = -1;
747 curl_shape(idx,0) = -s*shape_ox(i)*dshape_cy(j);
750 for (
int j = 0; j <
p; j++)
751 for (
int i = 0; i <=
p; i++)
756 idx = -1 - idx, s = -1;
762 curl_shape(idx,0) = s*dshape_cx(i)*shape_oy(j);
767 const double ND_TetrahedronElement::tk[18] =
768 { 1.,0.,0., 0.,1.,0., 0.,0.,1., -1.,1.,0., -1.,0.,1., 0.,-1.,1. };
770 const double ND_TetrahedronElement::c = 1./4.;
780 const int pm1 = p - 1, pm2 = p - 2, pm3 = p - 3;
782 #ifndef MFEM_THREAD_SAFE
793 Vector shape_x(p), shape_y(p), shape_z(p), shape_l(p);
798 for (
int i = 0; i <
p; i++)
803 for (
int i = 0; i <
p; i++)
808 for (
int i = 0; i <
p; i++)
813 for (
int i = 0; i <
p; i++)
818 for (
int i = 0; i <
p; i++)
823 for (
int i = 0; i <
p; i++)
830 for (
int j = 0; j <= pm2; j++)
831 for (
int i = 0; i + j <= pm2; i++)
833 double w = fop[i] + fop[j] + fop[pm2-i-j];
839 for (
int j = 0; j <= pm2; j++)
840 for (
int i = 0; i + j <= pm2; i++)
842 double w = fop[i] + fop[j] + fop[pm2-i-j];
848 for (
int j = 0; j <= pm2; j++)
849 for (
int i = 0; i + j <= pm2; i++)
851 double w = fop[i] + fop[j] + fop[pm2-i-j];
857 for (
int j = 0; j <= pm2; j++)
858 for (
int i = 0; i + j <= pm2; i++)
860 double w = fop[i] + fop[j] + fop[pm2-i-j];
868 for (
int k = 0; k <= pm3; k++)
869 for (
int j = 0; j + k <= pm3; j++)
870 for (
int i = 0; i + j + k <= pm3; i++)
872 double w = iop[i] + iop[j] + iop[k] + iop[pm3-i-j-k];
882 for (
int m = 0; m <
dof; m++)
885 const double *tm = tk + 3*dof2tk[m];
893 for (
int k = 0; k <= pm1; k++)
894 for (
int j = 0; j + k <= pm1; j++)
895 for (
int i = 0; i + j + k <= pm1; i++)
897 double s = shape_x(i)*shape_y(j)*shape_z(k)*shape_l(pm1-i-j-k);
898 T(o++, m) = s * tm[0];
899 T(o++, m) = s * tm[1];
900 T(o++, m) = s * tm[2];
902 for (
int k = 0; k <= pm1; k++)
903 for (
int j = 0; j + k <= pm1; j++)
905 double s = shape_x(pm1-j-k)*shape_y(j)*shape_z(k);
906 T(o++, m) = s*((ip.
y - c)*tm[0] - (ip.
x - c)*tm[1]);
907 T(o++, m) = s*((ip.
z - c)*tm[0] - (ip.
x - c)*tm[2]);
909 for (
int k = 0; k <= pm1; k++)
912 shape_y(pm1-k)*shape_z(k)*((ip.
z - c)*tm[1] - (ip.
y - c)*tm[2]);
923 const int pm1 =
order - 1;
925 #ifdef MFEM_THREAD_SAFE
927 Vector shape_x(p), shape_y(p), shape_z(p), shape_l(p);
937 for (
int k = 0; k <= pm1; k++)
938 for (
int j = 0; j + k <= pm1; j++)
939 for (
int i = 0; i + j + k <= pm1; i++)
941 double s = shape_x(i)*shape_y(j)*shape_z(k)*shape_l(pm1-i-j-k);
942 u(n,0) =
s; u(n,1) = 0.; u(n,2) = 0.; n++;
943 u(n,0) = 0.; u(n,1) =
s; u(n,2) = 0.; n++;
944 u(n,0) = 0.; u(n,1) = 0.; u(n,2) =
s; n++;
946 for (
int k = 0; k <= pm1; k++)
947 for (
int j = 0; j + k <= pm1; j++)
949 double s = shape_x(pm1-j-k)*shape_y(j)*shape_z(k);
950 u(n,0) = s*(ip.
y - c); u(n,1) = -s*(ip.
x - c); u(n,2) = 0.; n++;
951 u(n,0) = s*(ip.
z - c); u(n,1) = 0.; u(n,2) = -s*(ip.
x - c); n++;
953 for (
int k = 0; k <= pm1; k++)
955 double s = shape_y(pm1-k)*shape_z(k);
956 u(n,0) = 0.; u(n,1) = s*(ip.
z - c); u(n,2) = -s*(ip.
y - c); n++;
965 const int pm1 =
order - 1;
967 #ifdef MFEM_THREAD_SAFE
969 Vector shape_x(p), shape_y(p), shape_z(p), shape_l(p);
970 Vector dshape_x(p), dshape_y(p), dshape_z(p), dshape_l(p);
980 for (
int k = 0; k <= pm1; k++)
981 for (
int j = 0; j + k <= pm1; j++)
982 for (
int i = 0; i + j + k <= pm1; i++)
985 const double dx = (dshape_x(i)*shape_l(l) -
986 shape_x(i)*dshape_l(l))*shape_y(j)*shape_z(k);
987 const double dy = (dshape_y(j)*shape_l(l) -
988 shape_y(j)*dshape_l(l))*shape_x(i)*shape_z(k);
989 const double dz = (dshape_z(k)*shape_l(l) -
990 shape_z(k)*dshape_l(l))*shape_x(i)*shape_y(j);
992 u(n,0) = 0.; u(n,1) = dz; u(n,2) = -dy; n++;
993 u(n,0) = -dz; u(n,1) = 0.; u(n,2) = dx; n++;
994 u(n,0) = dy; u(n,1) = -dx; u(n,2) = 0.; n++;
996 for (
int k = 0; k <= pm1; k++)
997 for (
int j = 0; j + k <= pm1; j++)
1002 u(n,0) = shape_x(i)*(ip.
x - c)*shape_y(j)*dshape_z(k);
1003 u(n,1) = shape_x(i)*shape_y(j)*(ip.
y - c)*dshape_z(k);
1005 -((dshape_x(i)*(ip.
x - c) + shape_x(i))*shape_y(j)*shape_z(k) +
1006 (dshape_y(j)*(ip.
y - c) + shape_y(j))*shape_x(i)*shape_z(k));
1009 u(n,0) = -shape_x(i)*(ip.
x - c)*dshape_y(j)*shape_z(k);
1010 u(n,1) = (shape_x(i)*shape_y(j)*(dshape_z(k)*(ip.
z - c) + shape_z(k)) +
1011 (dshape_x(i)*(ip.
x - c) + shape_x(i))*shape_y(j)*shape_z(k));
1012 u(n,2) = -shape_x(i)*dshape_y(j)*shape_z(k)*(ip.
z - c);
1015 for (
int k = 0; k <= pm1; k++)
1019 u(n,0) = -((dshape_y(j)*(ip.
y - c) + shape_y(j))*shape_z(k) +
1020 shape_y(j)*(dshape_z(k)*(ip.
z - c) + shape_z(k)));
1025 Ti.
Mult(u, curl_shape);
1029 const double ND_TriangleElement::tk[8] =
1030 { 1.,0., -1.,1., 0.,-1., 0.,1. };
1032 const double ND_TriangleElement::c = 1./3.;
1042 const int pm1 = p - 1, pm2 = p - 2;
1044 #ifndef MFEM_THREAD_SAFE
1054 Vector shape_x(p), shape_y(p), shape_l(p);
1059 for (
int i = 0; i <
p; i++)
1064 for (
int i = 0; i <
p; i++)
1069 for (
int i = 0; i <
p; i++)
1076 for (
int j = 0; j <= pm2; j++)
1077 for (
int i = 0; i + j <= pm2; i++)
1079 double w = iop[i] + iop[j] + iop[pm2-i-j];
1087 for (
int m = 0; m <
dof; m++)
1090 const double *tm = tk + 2*dof2tk[m];
1097 for (
int j = 0; j <= pm1; j++)
1098 for (
int i = 0; i + j <= pm1; i++)
1100 double s = shape_x(i)*shape_y(j)*shape_l(pm1-i-j);
1101 T(n++, m) = s * tm[0];
1102 T(n++, m) = s * tm[1];
1104 for (
int j = 0; j <= pm1; j++)
1107 shape_x(pm1-j)*shape_y(j)*((ip.
y - c)*tm[0] - (ip.
x - c)*tm[1]);
1118 const int pm1 =
order - 1;
1120 #ifdef MFEM_THREAD_SAFE
1122 Vector shape_x(p), shape_y(p), shape_l(p);
1131 for (
int j = 0; j <= pm1; j++)
1132 for (
int i = 0; i + j <= pm1; i++)
1134 double s = shape_x(i)*shape_y(j)*shape_l(pm1-i-j);
1135 u(n,0) =
s; u(n,1) = 0; n++;
1136 u(n,0) = 0; u(n,1) =
s; n++;
1138 for (
int j = 0; j <= pm1; j++)
1140 double s = shape_x(pm1-j)*shape_y(j);
1141 u(n,0) = s*(ip.
y - c);
1142 u(n,1) = -s*(ip.
x - c);
1152 const int pm1 =
order - 1;
1154 #ifdef MFEM_THREAD_SAFE
1156 Vector shape_x(p), shape_y(p), shape_l(p);
1157 Vector dshape_x(p), dshape_y(p), dshape_l(p);
1166 for (
int j = 0; j <= pm1; j++)
1167 for (
int i = 0; i + j <= pm1; i++)
1170 const double dx = (dshape_x(i)*shape_l(l) -
1171 shape_x(i)*dshape_l(l)) * shape_y(j);
1172 const double dy = (dshape_y(j)*shape_l(l) -
1173 shape_y(j)*dshape_l(l)) * shape_x(i);
1179 for (
int j = 0; j <= pm1; j++)
1183 curlu(n++) = -((dshape_x(i)*(ip.
x - c) + shape_x(i)) * shape_y(j) +
1184 (dshape_y(j)*(ip.
y - c) + shape_y(j)) * shape_x(i));
1188 Ti.
Mult(curlu, curl2d);
1192 const double ND_SegmentElement::tk[1] = { 1. };
1204 for (
int i = 0; i <
p; i++)
1219 const double ND_WedgeElement::tk[15] =
1220 { 1.,0.,0., -1.,1.,0., 0.,-1.,0., 0.,0.,1., 0.,1.,0. };
1226 3 * p * ((p + 1) * (p + 2))/2, p,
1231 H1TriangleFE(p, cb_type),
1233 H1SegmentFE(p, cb_type),
1234 NDSegmentFE(p, ob_type)
1236 MFEM_ASSERT(H1TriangleFE.
GetDof() * NDSegmentFE.
GetDof() +
1238 "Mismatch in number of degrees of freedom "
1239 "when building ND_WedgeElement!");
1241 #ifndef MFEM_THREAD_SAFE
1251 const int pm1 = p - 1, pm2 = p - 2;
1260 for (
int i = 0; i <
p; i++)
1262 t_dof[o] = i; s_dof[o] = 0; dof2tk[o] = 0;
1267 for (
int i = 0; i <
p; i++)
1269 t_dof[o] = p + i; s_dof[o] = 0; dof2tk[o] = 1;
1274 for (
int i = 0; i <
p; i++)
1276 t_dof[o] = 2 * p + i; s_dof[o] = 0; dof2tk[o] = 2;
1281 for (
int i = 0; i <
p; i++)
1283 t_dof[o] = i; s_dof[o] = 1; dof2tk[o] = 0;
1288 for (
int i = 0; i <
p; i++)
1290 t_dof[o] = p + i; s_dof[o] = 1; dof2tk[o] = 1;
1295 for (
int i = 0; i <
p; i++)
1297 t_dof[o] = 2 * p + i; s_dof[o] = 1; dof2tk[o] = 2;
1302 for (
int i = 0; i <
p; i++)
1304 t_dof[o] = 0; s_dof[o] = i; dof2tk[o] = 3;
1309 for (
int i = 0; i <
p; i++)
1311 t_dof[o] = 1; s_dof[o] = i; dof2tk[o] = 3;
1316 for (
int i = 0; i <
p; i++)
1318 t_dof[o] = 2; s_dof[o] = i; dof2tk[o] = 3;
1327 for (
int j = 0; j <= pm2; j++)
1328 for (
int i = 0; i + j <= pm2; i++)
1330 l = j + ( 2 * p - 1 - i) * i / 2;
1331 t_dof[o] = 3 * p + 2*l+1; s_dof[o] = 0; dof2tk[o] = 4;
1335 t_dof[o] = 3 * p + 2*l; s_dof[o] = 0; dof2tk[o] = 0;
1342 for (
int j = 0; j <= pm2; j++)
1343 for (
int i = 0; i + j <= pm2; i++)
1345 t_dof[o] = 3 * p + m; s_dof[o] = 1; dof2tk[o] = 0; m++;
1349 t_dof[o] = 3 * p + m; s_dof[o] = 1; dof2tk[o] = 4; m++;
1355 for (
int j = 2; j <=
p; j++)
1356 for (
int i = 0; i <
p; i++)
1358 t_dof[o] = i; s_dof[o] = j; dof2tk[o] = 0;
1363 for (
int j = 0; j <
p; j++)
1364 for (
int i = 0; i < pm1; i++)
1366 t_dof[o] = 3 + i; s_dof[o] = j; dof2tk[o] = 3;
1372 for (
int j = 2; j <=
p; j++)
1373 for (
int i = 0; i <
p; i++)
1375 t_dof[o] = p + i; s_dof[o] = j; dof2tk[o] = 1;
1380 for (
int j = 0; j <
p; j++)
1381 for (
int i = 0; i < pm1; i++)
1383 t_dof[o] = p + 2 + i; s_dof[o] = j; dof2tk[o] = 3;
1389 for (
int j = 2; j <=
p; j++)
1390 for (
int i = 0; i <
p; i++)
1392 t_dof[o] = 2 * p + i; s_dof[o] = j; dof2tk[o] = 2;
1397 for (
int j = 0; j <
p; j++)
1398 for (
int i = 0; i < pm1; i++)
1400 t_dof[o] = 2 * p + 1 + i; s_dof[o] = j; dof2tk[o] = 3;
1407 for (
int k = 2; k <=
p; k++)
1410 for (
int j = 0; j <= pm2; j++)
1411 for (
int i = 0; i + j <= pm2; i++)
1413 t_dof[o] = 3 * p + l; s_dof[o] = k; dof2tk[o] = 0; l++;
1417 t_dof[o] = 3 * p + l; s_dof[o] = k; dof2tk[o] = 4; l++;
1423 for (
int k = 0; k <
p; k++)
1426 for (
int j = 0; j < pm2; j++)
1427 for (
int i = 0; i + j < pm2; i++)
1429 t_dof[o] = 3 * p + l; s_dof[o] = k; dof2tk[o] = 3; l++;
1440 #ifdef MFEM_THREAD_SAFE
1454 for (
int i=0; i<
dof; i++)
1456 if ( dof2tk[i] != 3 )
1458 shape(i, 0) = tn_shape(t_dof[i], 0) * s1_shape[s_dof[i]];
1459 shape(i, 1) = tn_shape(t_dof[i], 1) * s1_shape[s_dof[i]];
1466 shape(i, 2) = t1_shape[t_dof[i]] * sn_shape(s_dof[i], 0);
1474 #ifdef MFEM_THREAD_SAFE
1492 for (
int i=0; i<
dof; i++)
1494 if ( dof2tk[i] != 3 )
1496 curl_shape(i, 0) = -tn_shape(t_dof[i], 1) * s1_dshape(s_dof[i], 0);
1497 curl_shape(i, 1) = tn_shape(t_dof[i], 0) * s1_dshape(s_dof[i], 0);
1498 curl_shape(i, 2) = tn_dshape(t_dof[i], 0) * s1_shape[s_dof[i]];
1502 curl_shape(i, 0) = t1_dshape(t_dof[i], 1) * sn_shape(s_dof[i], 0);
1503 curl_shape(i, 1) = -t1_dshape(t_dof[i], 0) * sn_shape(s_dof[i], 0);
1504 curl_shape(i, 2) = 0.0;
1536 const double ND_R1D_SegmentElement::tk[9] = { 1.,0.,0., 0.,1.,0., 0.,0.,1. };
1544 cbasis1d(
poly1d.GetBasis(p, VerifyClosed(cb_type))),
1545 obasis1d(
poly1d.GetBasis(p - 1, VerifyOpen(ob_type)))
1559 #ifndef MFEM_THREAD_SAFE
1571 dof_map[
p] = o; dof2tk[o++] = 1;
1573 dof_map[2*p+1] = o; dof2tk[o++] = 2;
1577 dof_map[2*
p] = o; dof2tk[o++] = 1;
1579 dof_map[3*p+1] = o; dof2tk[o++] = 2;
1583 for (
int i = 0; i <
p; i++)
1586 dof_map[i] = o; dof2tk[o++] = 0;
1589 for (
int i = 1; i <
p; i++)
1592 dof_map[p+i] = o; dof2tk[o++] = 1;
1595 for (
int i = 1; i <
p; i++)
1598 dof_map[2*p+1+i] = o; dof2tk[o++] = 2;
1607 #ifdef MFEM_THREAD_SAFE
1608 Vector shape_cx(p + 1), shape_ox(p);
1611 cbasis1d.
Eval(ip.
x, shape_cx);
1612 obasis1d.
Eval(ip.
x, shape_ox);
1616 for (
int i = 0; i <
p; i++)
1618 int idx = dof_map[o++];
1619 shape(idx,0) = shape_ox(i);
1624 for (
int i = 0; i <=
p; i++)
1626 int idx = dof_map[o++];
1628 shape(idx,1) = shape_cx(i);
1632 for (
int i = 0; i <=
p; i++)
1634 int idx = dof_map[o++];
1637 shape(idx,2) = shape_cx(i);
1646 MFEM_ASSERT(JI.Width() == 1 && JI.Height() == 1,
1647 "ND_R1D_SegmentElement cannot be embedded in "
1648 "2 or 3 dimensional spaces");
1649 for (
int i=0; i<
dof; i++)
1651 shape(i, 0) *= JI(0,0);
1660 #ifdef MFEM_THREAD_SAFE
1661 Vector shape_cx(p + 1), shape_ox(p);
1665 cbasis1d.
Eval(ip.
x, shape_cx, dshape_cx);
1666 obasis1d.
Eval(ip.
x, shape_ox);
1670 for (
int i = 0; i <
p; i++)
1672 int idx = dof_map[o++];
1673 curl_shape(idx,0) = 0.;
1674 curl_shape(idx,1) = 0.;
1675 curl_shape(idx,2) = 0.;
1678 for (
int i = 0; i <=
p; i++)
1680 int idx = dof_map[o++];
1681 curl_shape(idx,0) = 0.;
1682 curl_shape(idx,1) = 0.;
1683 curl_shape(idx,2) = dshape_cx(i);
1686 for (
int i = 0; i <=
p; i++)
1688 int idx = dof_map[o++];
1689 curl_shape(idx,0) = 0.;
1690 curl_shape(idx,1) = -dshape_cx(i);
1691 curl_shape(idx,2) = 0.;
1700 MFEM_ASSERT(J.Width() == 1 && J.Height() == 1,
1701 "ND_R1D_SegmentElement cannot be embedded in "
1702 "2 or 3 dimensional spaces");
1703 curl_shape *= (1.0 / J.Weight());
1713 for (
int k = 0; k <
dof; k++)
1719 Vector t(const_cast<double*>(&tk[dof2tk[k] * 3]), 3);
1720 dofs(k) = Trans.
Jacobian()(0,0) *
t(0) * vk(0) +
1721 t(1) * vk(1) +
t(2) * vk(2);
1735 double * tk_ptr =
const_cast<double*
>(tk);
1738 for (
int k = 0; k <
dof; k++)
1742 Vector t1(&tk_ptr[dof2tk[k] * 3], 1);
1743 Vector t3(&tk_ptr[dof2tk[k] * 3], 3);
1754 double w = 1.0/Trans.
Weight();
1755 for (
int d = 0; d <
vdim; d++)
1761 for (
int j = 0; j < shape.Size(); j++)
1763 double s = shape(j);
1764 if (fabs(s) < 1e-12)
1770 for (
int d = 0; d <
vdim; d++)
1772 I(k, j + d*shape.Size()) = s*vk[d];
1782 double * tk_ptr =
const_cast<double*
>(tk);
1785 for (
int k = 0; k <
dof; k++)
1789 Vector t1(&tk_ptr[dof2tk[k] * 3], 1);
1790 Vector t3(&tk_ptr[dof2tk[k] * 3], 3);
1802 I(k, j) +=
vshape(j, 0) * vk[0];
1805 I(k, j) +=
vshape(j, 1) * t3(1);
1806 I(k, j) +=
vshape(j, 2) * t3(2);
1813 const double ND_R2D_SegmentElement::tk[4] = { 1.,0., 0.,1. };
1821 cbasis1d(
poly1d.GetBasis(p, VerifyClosed(cb_type))),
1822 obasis1d(
poly1d.GetBasis(p - 1, VerifyOpen(ob_type)))
1831 #ifndef MFEM_THREAD_SAFE
1843 dof_map[
p] = o; dof2tk[o++] = 1;
1847 dof_map[2*
p] = o; dof2tk[o++] = 1;
1851 for (
int i = 0; i <
p; i++)
1854 dof_map[i] = o; dof2tk[o++] = 0;
1857 for (
int i = 1; i <
p; i++)
1860 dof_map[p+i] = o; dof2tk[o++] = 1;
1869 #ifdef MFEM_THREAD_SAFE
1870 Vector shape_cx(p + 1), shape_ox(p);
1873 cbasis1d.
Eval(ip.
x, shape_cx);
1874 obasis1d.
Eval(ip.
x, shape_ox);
1878 for (
int i = 0; i <
p; i++)
1880 int idx = dof_map[o++];
1881 shape(idx,0) = shape_ox(i);
1885 for (
int i = 0; i <=
p; i++)
1887 int idx = dof_map[o++];
1889 shape(idx,1) = shape_cx(i);
1898 MFEM_ASSERT(JI.Width() == 1 && JI.Height() == 1,
1899 "ND_R2D_SegmentElement cannot be embedded in "
1900 "2 or 3 dimensional spaces");
1901 for (
int i=0; i<
dof; i++)
1903 shape(i, 0) *= JI(0,0);
1912 #ifdef MFEM_THREAD_SAFE
1913 Vector shape_cx(p + 1), shape_ox(p);
1917 cbasis1d.
Eval(ip.
x, shape_cx, dshape_cx);
1918 obasis1d.
Eval(ip.
x, shape_ox);
1922 for (
int i = 0; i <
p; i++)
1924 int idx = dof_map[o++];
1925 curl_shape(idx,0) = 0.;
1928 for (
int i = 0; i <=
p; i++)
1930 int idx = dof_map[o++];
1931 curl_shape(idx,0) = -dshape_cx(i);
1944 double * tk_ptr =
const_cast<double*
>(tk);
1951 for (
int k = 0; k <
dof; k++)
1953 Vector t1(&tk_ptr[dof2tk[k] * 2], 1);
1954 Vector t2(&tk_ptr[dof2tk[k] * 2], 2);
1965 for (
int i = 0; i <
dim; i++)
1967 Ikj +=
vshape(j, i) * vk[i];
1969 Ikj +=
vshape(j, 1) * t2(1);
1970 I(k, j) = (fabs(Ikj) < 1e-12) ? 0.0 : Ikj;
1984 double * tk_ptr =
const_cast<double*
>(tk);
1986 for (
int k = 0; k <
dof; k++)
1992 Vector t1(&tk_ptr[dof2tk[k] * 2], 1);
1993 Vector t2(&tk_ptr[dof2tk[k] * 2], 2);
2001 const double *tk_fe)
2023 MFEM_ASSERT(JI.Width() == 2 && JI.Height() == 2,
2024 "ND_R2D_FiniteElement cannot be embedded in "
2025 "3 dimensional spaces");
2026 for (
int i=0; i<
dof; i++)
2028 double sx = shape(i, 0);
2029 double sy = shape(i, 1);
2030 shape(i, 0) = sx * JI(0, 0) + sy * JI(1, 0);
2031 shape(i, 1) = sx * JI(0, 1) + sy * JI(1, 1);
2040 MFEM_ASSERT(J.Width() == 2 && J.Height() == 2,
2041 "ND_R2D_FiniteElement cannot be embedded in "
2042 "3 dimensional spaces");
2043 for (
int i=0; i<
dof; i++)
2045 double sx = curl_shape(i, 0);
2046 double sy = curl_shape(i, 1);
2047 curl_shape(i, 0) = sx * J(0, 0) + sy * J(0, 1);
2048 curl_shape(i, 1) = sx * J(1, 0) + sy * J(1, 1);
2050 curl_shape *= (1.0 / Trans.
Weight());
2053 void ND_R2D_FiniteElement::LocalInterpolation(
2061 #ifdef MFEM_THREAD_SAFE
2067 double * tk_ptr =
const_cast<double*
>(
tk);
2074 for (
int k = 0; k <
dof; k++)
2088 for (
int i = 0; i <
dim; i++)
2090 Ikj +=
vshape(j, i) * vk[i];
2092 Ikj +=
vshape(j, 2) * t3(2);
2093 I(k, j) = (fabs(Ikj) < 1e-12) ? 0.0 : Ikj;
2105 #ifdef MFEM_THREAD_SAFE
2109 double * tk_ptr =
const_cast<double*
>(
tk);
2113 for (
int j = 0; j <
dof; j++)
2123 Jinv.
Mult(t2, pt_data);
2124 for (
int k = 0; k <
dof; k++)
2127 for (
int d = 0; d <
dim; d++)
2129 R_jk +=
vshape(k,d)*pt_data[d];
2131 R_jk +=
vshape(k, 2) * t3(2);
2152 double * tk_ptr =
const_cast<double*
>(
tk);
2154 for (
int k = 0; k <
dof; k++)
2177 double * tk_ptr =
const_cast<double*
>(
tk);
2180 for (
int k = 0; k <
dof; k++)
2195 double w = 1.0/Trans.
Weight();
2196 for (
int d = 0; d <
vdim; d++)
2202 for (
int j = 0; j < shape.Size(); j++)
2204 double s = shape(j);
2205 if (fabs(s) < 1e-12)
2211 for (
int d = 0; d <
vdim; d++)
2213 I(k, j + d*shape.Size()) = s*vk[d];
2223 double * tk_ptr =
const_cast<double*
>(
tk);
2226 for (
int k = 0; k <
dof; k++)
2243 for (
int i=0; i<2; i++)
2245 I(k, j) +=
vshape(j, i) * vk[i];
2249 I(k, j) +=
vshape(j, 2) * t3(2);
2266 for (
int k = 0; k <
dof; k++)
2270 for (
int j = 0; j < grad_k.Size(); j++)
2272 grad(k,j) = (fabs(grad_k(j)) < 1e-12) ? 0.0 : grad_k(j);
2277 const double ND_R2D_TriangleElement::tk_t[15] =
2278 { 1.,0.,0., -1.,1.,0., 0.,-1.,0., 0.,1.,0., 0.,0.,1. };
2286 int pm1 = p - 1, pm2 = p - 2;
2288 #ifndef MFEM_THREAD_SAFE
2304 for (
int e=0; e<3; e++)
2307 for (
int i=0; i<
p; i++)
2312 for (
int i=0; i<pm1; i++)
2319 for (
int j = 0; j <= pm2; j++)
2320 for (
int i = 0; i + j <= pm2; i++)
2327 for (
int j = 0; j < pm1; j++)
2328 for (
int i = 0; i + j < pm2; i++)
2333 MFEM_VERIFY(n == ND_FE.
GetDof(),
2334 "ND_R2D_Triangle incorrect number of ND dofs.");
2335 MFEM_VERIFY(h == H1_FE.
GetDof(),
2336 "ND_R2D_Triangle incorrect number of H1 dofs.");
2337 MFEM_VERIFY(o ==
GetDof(),
2338 "ND_R2D_Triangle incorrect number of dofs.");
2343 for (
int i=0; i<
dof; i++)
2362 #ifdef MFEM_THREAD_SAFE
2370 for (
int i=0; i<
dof; i++)
2375 shape(i, 0) = nd_shape(idx, 0);
2376 shape(i, 1) = nd_shape(idx, 1);
2383 shape(i, 2) = h1_shape(-idx-1);
2391 #ifdef MFEM_THREAD_SAFE
2399 for (
int i=0; i<
dof; i++)
2404 curl_shape(i, 0) = 0.0;
2405 curl_shape(i, 1) = 0.0;
2406 curl_shape(i, 2) = nd_dshape(idx, 0);
2410 curl_shape(i, 0) = h1_dshape(-idx-1, 1);
2411 curl_shape(i, 1) = -h1_dshape(-idx-1, 0);
2412 curl_shape(i, 2) = 0.0;
2418 const double ND_R2D_QuadrilateralElement::tk_q[15] =
2419 { 1.,0.,0., 0.,1.,0., -1.,0.,0., 0.,-1.,0., 0.,0.,1. };
2425 cbasis1d(
poly1d.GetBasis(p, VerifyClosed(cb_type))),
2426 obasis1d(
poly1d.GetBasis(p - 1, VerifyOpen(ob_type)))
2430 const int dofx = p*(p+1);
2431 const int dofy = p*(p+1);
2432 const int dofxy = dofx+dofy;
2434 #ifndef MFEM_THREAD_SAFE
2453 for (
int i = 0; i <
p; i++)
2457 for (
int i = 1; i <
p; i++)
2459 dof_map[dofxy + i + 0*(p+1)] = o++;
2461 for (
int j = 0; j <
p; j++)
2463 dof_map[dofx + p + j*(p + 1)] = o++;
2465 for (
int j = 1; j <
p; j++)
2467 dof_map[dofxy + p + j*(p + 1)] = o++;
2469 for (
int i = 0; i <
p; i++)
2471 dof_map[(p - 1 - i) + p*p] = -1 - (o++);
2473 for (
int i = 1; i <
p; i++)
2475 dof_map[dofxy + (p - i) + p*(p + 1)] = o++;
2477 for (
int j = 0; j <
p; j++)
2479 dof_map[dofx + 0 + (p - 1 - j)*(p + 1)] = -1 - (o++);
2481 for (
int j = 1; j <
p; j++)
2483 dof_map[dofxy + (p - j)*(p + 1)] = o++;
2488 for (
int j = 1; j <
p; j++)
2489 for (
int i = 0; i <
p; i++)
2494 for (
int j = 0; j <
p; j++)
2495 for (
int i = 1; i <
p; i++)
2497 dof_map[dofx + i + j*(p + 1)] = o++;
2500 for (
int j = 1; j <
p; j++)
2501 for (
int i = 1; i <
p; i++)
2503 dof_map[dofxy + i + j*(p + 1)] = o++;
2509 for (
int j = 0; j <=
p; j++)
2510 for (
int i = 0; i <
p; i++)
2515 dof2tk[idx = -1 - idx] = 2;
2524 for (
int j = 0; j <
p; j++)
2525 for (
int i = 0; i <=
p; i++)
2530 dof2tk[idx = -1 - idx] = 3;
2539 for (
int j = 0; j <=
p; j++)
2540 for (
int i = 0; i <=
p; i++)
2553 #ifdef MFEM_THREAD_SAFE
2554 Vector shape_cx(p + 1), shape_ox(p), shape_cy(p + 1), shape_oy(p);
2557 cbasis1d.
Eval(ip.
x, shape_cx);
2558 obasis1d.
Eval(ip.
x, shape_ox);
2559 cbasis1d.
Eval(ip.
y, shape_cy);
2560 obasis1d.
Eval(ip.
y, shape_oy);
2564 for (
int j = 0; j <=
p; j++)
2565 for (
int i = 0; i <
p; i++)
2570 idx = -1 - idx, s = -1;
2576 shape(idx,0) = s*shape_ox(i)*shape_cy(j);
2581 for (
int j = 0; j <
p; j++)
2582 for (
int i = 0; i <=
p; i++)
2587 idx = -1 - idx, s = -1;
2594 shape(idx,1) = s*shape_cx(i)*shape_oy(j);
2598 for (
int j = 0; j <=
p; j++)
2599 for (
int i = 0; i <=
p; i++)
2604 shape(idx,2) = shape_cx(i)*shape_cy(j);
2613 #ifdef MFEM_THREAD_SAFE
2614 Vector shape_cx(p + 1), shape_ox(p), shape_cy(p + 1), shape_oy(p);
2615 Vector dshape_cx(p + 1), dshape_cy(p + 1);
2618 cbasis1d.
Eval(ip.
x, shape_cx, dshape_cx);
2619 obasis1d.
Eval(ip.
x, shape_ox);
2620 cbasis1d.
Eval(ip.
y, shape_cy, dshape_cy);
2621 obasis1d.
Eval(ip.
y, shape_oy);
2625 for (
int j = 0; j <=
p; j++)
2626 for (
int i = 0; i <
p; i++)
2631 idx = -1 - idx, s = -1;
2637 curl_shape(idx,0) = 0.;
2638 curl_shape(idx,1) = 0.;
2639 curl_shape(idx,2) = -s*shape_ox(i)*dshape_cy(j);
2642 for (
int j = 0; j <
p; j++)
2643 for (
int i = 0; i <=
p; i++)
2648 idx = -1 - idx, s = -1;
2654 curl_shape(idx,0) = 0.;
2655 curl_shape(idx,1) = 0.;
2656 curl_shape(idx,2) = s*dshape_cx(i)*shape_oy(j);
2659 for (
int j = 0; j <=
p; j++)
2660 for (
int i = 0; i <=
p; i++)
2663 curl_shape(idx,0) = shape_cx(i)*dshape_cy(j);
2664 curl_shape(idx,1) = -dshape_cx(i)*shape_cy(j);
2665 curl_shape(idx,2) = 0.;
int GetNPoints() const
Returns the number of the points in the integration rule.
Abstract class for all finite elements.
void Set(const double *p, const int dim)
ND_SegmentElement(const int p, const int ob_type=BasisType::GaussLegendre)
Construct the ND_SegmentElement of order p and open BasisType ob_type.
virtual void CalcPhysCurlShape(ElementTransformation &Trans, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in physical space at the point de...
void ProjectIntegrated(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const
int GetDim() const
Returns the reference space dimension for the finite element.
Class for an integration rule - an Array of IntegrationPoint.
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
bool IsIntegratedType() const
Returns true if the basis is "integrated", false otherwise.
Base class for vector Coefficients that optionally depend on time and space.
void SetRow(int r, const double *row)
ND_R1D_PointElement(int p)
Construct the ND_R1D_PointElement.
virtual void Eval(Vector &V, ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the vector coefficient in the element described by T at the point ip, storing the result in ...
void SetSize(int s)
Resize the vector to size s.
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
int dim
Dimension of reference space.
double InnerProduct(const double *x, const double *y) const
Compute y^t A x.
Data type dense matrix using column-major storage.
ND_R2D_TriangleElement(const int p, const int cb_type=BasisType::GaussLobatto)
Construct the ND_R2D_TriangleElement of order p.
ND_R2D_SegmentElement(const int p, const int cb_type=BasisType::GaussLobatto, const int ob_type=BasisType::GaussLegendre)
Construct the ND_R2D_SegmentElement of order p and closed and open BasisType cb_type and ob_type...
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
virtual void CalcVShape(ElementTransformation &Trans, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in physical space at the point ...
int GetMapType() const
Returns the FiniteElement::MapType of the element describing how reference functions are mapped to ph...
void Factor()
Factor the current DenseMatrix, *a.
Geometry::Type geom_type
Geometry::Type of the reference element.
Intermediate class for finite elements whose basis functions return vector values.
const IntegrationPoint & GetCenter(int GeomType)
Return the center of the given Geometry::Type, GeomType.
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
virtual void CalcCurlShape(const IntegrationPoint &ip, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in reference space at the given p...
const double * ClosedPoints(const int p, const int btype=BasisType::GaussLobatto)
Get coordinates of a closed (GaussLegendre) set of points if degree p.
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
ND_WedgeElement(const int p, const int cb_type=BasisType::GaussLobatto, const int ob_type=BasisType::GaussLegendre)
virtual void CalcCurlShape(const IntegrationPoint &ip, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in reference space at the given p...
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
ND_TriangleElement(const int p)
Construct the ND_TriangleElement of order p.
int cdim
Dimension of curl for vector-valued basis functions.
int vdim
Vector dimension of vector-valued basis functions.
static void CalcBasis(const int p, const double x, double *u)
Evaluate the values of a hierarchical 1D basis at point x hierarchical = k-th basis function is degre...
Poly_1D::Basis & obasis1d
ND_R2D_QuadrilateralElement(const int p, const int cb_type=BasisType::GaussLobatto, const int ob_type=BasisType::GaussLegendre)
Construct the ND_R2D_QuadrilateralElement of order p and closed and open BasisType cb_type and ob_typ...
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
Poly_1D::Basis & cbasis1d
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
ND_HexahedronElement(const int p, const int cb_type=BasisType::GaussLobatto, const int ob_type=BasisType::GaussLegendre)
Construct the ND_HexahedronElement of order p and closed and open BasisType cb_type and ob_type...
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
virtual void CalcPhysCurlShape(ElementTransformation &Trans, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in physical space at the point de...
virtual void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
ND_R2D_FiniteElement(int p, Geometry::Type G, int Do, const double *tk_fe)
ND_TetrahedronElement(const int p)
Construct the ND_TetrahedronElement of order p.
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const =0
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
const IntegrationRule & GetNodes() const
Get a const reference to the nodes of the element.
void EvalIntegrated(const Vector &d, Vector &i) const
Evaluate the "integrated" basis type using pre-computed closed basis derivatives. ...
ND_R1D_SegmentElement(const int p, const int cb_type=BasisType::GaussLobatto, const int ob_type=BasisType::GaussLegendre)
Construct the ND_R1D_SegmentElement of order p and closed and open BasisType cb_type and ob_type...
void Set2(const double x1, const double x2)
int GetVDim()
Returns dimension of the vector.
virtual void CalcCurlShape(const IntegrationPoint &ip, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in reference space at the given p...
const double * OpenPoints(const int p, const int btype=BasisType::GaussLegendre)
Get coordinates of an open (GaussLegendre) set of points if degree p.
void Threshold(double eps)
Replace small entries, abs(a_ij) <= eps, with zero.
int GetVDim() const
Returns the vector dimension for vector-valued finite elements.
virtual void CalcCurlShape(const IntegrationPoint &ip, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in reference space at the given p...
void Set3(const double x1, const double x2, const double x3)
double * Data() const
Returns the matrix data array.
virtual void CalcCurlShape(const IntegrationPoint &ip, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in reference space at the given p...
double p(const Vector &x, double t)
ND_QuadrilateralElement(const int p, const int cb_type=BasisType::GaussLobatto, const int ob_type=BasisType::GaussLegendre)
Construct the ND_QuadrilateralElement of order p and closed and open BasisType cb_type and ob_type...
int GetDof() const
Returns the number of degrees of freedom in the finite element.
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
virtual void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
void Mult(const double *x, double *y) const
Matrix vector multiplication with the inverse of dense matrix.
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
virtual void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
virtual void CalcCurlShape(const IntegrationPoint &ip, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in reference space at the given p...
virtual void CalcCurlShape(const IntegrationPoint &ip, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in reference space at the given p...
virtual void CalcCurlShape(const IntegrationPoint &ip, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in reference space at the given p...
Class for integration point with weight.
int dof
Number of degrees of freedom.
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
double infinity()
Define a shortcut for std::numeric_limits<double>::infinity()
virtual void GetLocalRestriction(ElementTransformation &Trans, DenseMatrix &R) const
Return a local restriction matrix R (Dof x Dof) mapping fine dofs to coarse dofs. ...
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
virtual void CalcCurlShape(const IntegrationPoint &ip, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in reference space at the given p...
void Eval(const double x, Vector &u) const
Evaluate the basis functions at point x in [0,1].
void InvertLinearTrans(ElementTransformation &trans, const IntegrationPoint &pt, Vector &x)
void Mult(const double *x, double *y) const
Matrix vector multiplication.
virtual void ProjectGrad(const FiniteElement &fe, ElementTransformation &Trans, DenseMatrix &grad) const
Compute the discrete gradient matrix from the given FiniteElement onto 'this' FiniteElement. The ElementTransformation is included to support cases when the matrix depends on it.
static bool CheckPoint(int GeomType, const IntegrationPoint &ip)
Check if the given point is inside the given reference element.
Describes the function space on each element.
virtual void CalcCurlShape(const IntegrationPoint &ip, DenseMatrix &curl_shape) const
Evaluate the curl of all shape functions of a vector finite element in reference space at the given p...
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const =0
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
int GetRangeType() const
Returns the FiniteElement::RangeType of the element, one of {SCALAR, VECTOR}.
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
void ProjectIntegrated(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const
int order
Order/degree of the shape functions.
Implements CalcCurlShape methods.
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...