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(p + 1), dshape_cy(p + 1), dshape_cz(p + 1);
342 for (
int k = 0; k <=
p; k++)
343 for (
int j = 0; j <=
p; j++)
344 for (
int i = 0; i <
p; i++)
349 idx = -1 - idx, s = -1;
355 shape(idx,0) = s*shape_ox(i)*shape_cy(j)*shape_cz(k);
360 for (
int k = 0; k <=
p; k++)
361 for (
int j = 0; j <
p; j++)
362 for (
int i = 0; i <=
p; i++)
367 idx = -1 - idx, s = -1;
374 shape(idx,1) = s*shape_cx(i)*shape_oy(j)*shape_cz(k);
378 for (
int k = 0; k <
p; k++)
379 for (
int j = 0; j <=
p; j++)
380 for (
int i = 0; i <=
p; i++)
385 idx = -1 - idx, s = -1;
393 shape(idx,2) = s*shape_cx(i)*shape_cy(j)*shape_oz(k);
402 #ifdef MFEM_THREAD_SAFE
403 Vector shape_cx(p + 1), shape_ox(p), shape_cy(p + 1), shape_oy(p);
404 Vector shape_cz(p + 1), shape_oz(p);
405 Vector dshape_cx(p + 1), dshape_cy(p + 1), dshape_cz(p + 1);
427 for (
int k = 0; k <=
p; k++)
428 for (
int j = 0; j <=
p; j++)
429 for (
int i = 0; i <
p; i++)
434 idx = -1 - idx, s = -1;
440 curl_shape(idx,0) = 0.;
441 curl_shape(idx,1) = s*shape_ox(i)* shape_cy(j)*dshape_cz(k);
442 curl_shape(idx,2) = -s*shape_ox(i)*dshape_cy(j)* shape_cz(k);
445 for (
int k = 0; k <=
p; k++)
446 for (
int j = 0; j <
p; j++)
447 for (
int i = 0; i <=
p; i++)
452 idx = -1 - idx, s = -1;
458 curl_shape(idx,0) = -s* shape_cx(i)*shape_oy(j)*dshape_cz(k);
459 curl_shape(idx,1) = 0.;
460 curl_shape(idx,2) = s*dshape_cx(i)*shape_oy(j)* shape_cz(k);
463 for (
int k = 0; k <
p; k++)
464 for (
int j = 0; j <=
p; j++)
465 for (
int i = 0; i <=
p; i++)
470 idx = -1 - idx, s = -1;
476 curl_shape(idx,0) = s* shape_cx(i)*dshape_cy(j)*shape_oz(k);
477 curl_shape(idx,1) = -s*dshape_cx(i)* shape_cy(j)*shape_oz(k);
478 curl_shape(idx,2) = 0.;
482 const double ND_QuadrilateralElement::tk[8] =
483 { 1.,0., 0.,1., -1.,0., 0.,-1. };
491 cp(
poly1d.ClosedPoints(p, cb_type))
498 const int dof2 =
dof/2;
500 #ifndef MFEM_THREAD_SAFE
511 for (
int i = 0; i <
p; i++)
515 for (
int j = 0; j <
p; j++)
517 dof_map[1*dof2 + p + j*(p + 1)] = o++;
519 for (
int i = 0; i <
p; i++)
521 dof_map[0*dof2 + (p - 1 - i) + p*p] = -1 - (o++);
523 for (
int j = 0; j <
p; j++)
525 dof_map[1*dof2 + 0 + (p - 1 - j)*(p + 1)] = -1 - (o++);
530 for (
int j = 1; j <
p; j++)
531 for (
int i = 0; i <
p; i++)
536 for (
int j = 0; j <
p; j++)
537 for (
int i = 1; i <
p; i++)
539 dof_map[1*dof2 + i + j*(p + 1)] = o++;
545 for (
int j = 0; j <=
p; j++)
546 for (
int i = 0; i <
p; i++)
551 dof2tk[idx = -1 - idx] = 2;
560 for (
int j = 0; j <
p; j++)
561 for (
int i = 0; i <=
p; i++)
566 dof2tk[idx = -1 - idx] = 3;
591 for (
int j = 0; j <=
order; j++)
592 for (
int i = 0; i <
order; i++)
600 const double h = cp[i+1] - cp[i];
604 for (
int k = 0; k < nqpt; k++)
608 ip2d.
Set2(cp[i] + (h*ip1d.
x), cp[j]);
611 vc.
Eval(xk, Trans, ip2d);
615 val += ip1d.
weight * ipval;
621 for (
int j = 0; j <
order; j++)
622 for (
int i = 0; i <=
order; i++)
630 const double h = cp[j+1] - cp[j];
634 for (
int k = 0; k < nqpt; k++)
638 ip2d.
Set2(cp[i], cp[j] + (h*ip1d.
x));
641 vc.
Eval(xk, Trans, ip2d);
645 val += ip1d.
weight * ipval;
657 #ifdef MFEM_THREAD_SAFE
658 Vector shape_cx(p + 1), shape_ox(p), shape_cy(p + 1), shape_oy(p);
659 Vector dshape_cx(p + 1), dshape_cy(p + 1);
680 for (
int j = 0; j <=
p; j++)
681 for (
int i = 0; i <
p; i++)
686 idx = -1 - idx, s = -1;
692 shape(idx,0) = s*shape_ox(i)*shape_cy(j);
696 for (
int j = 0; j <
p; j++)
697 for (
int i = 0; i <=
p; i++)
702 idx = -1 - idx, s = -1;
709 shape(idx,1) = s*shape_cx(i)*shape_oy(j);
718 #ifdef MFEM_THREAD_SAFE
719 Vector shape_cx(p + 1), shape_ox(p), shape_cy(p + 1), shape_oy(p);
720 Vector dshape_cx(p + 1), dshape_cy(p + 1);
739 for (
int j = 0; j <=
p; j++)
740 for (
int i = 0; i <
p; i++)
745 idx = -1 - idx, s = -1;
751 curl_shape(idx,0) = -s*shape_ox(i)*dshape_cy(j);
754 for (
int j = 0; j <
p; j++)
755 for (
int i = 0; i <=
p; i++)
760 idx = -1 - idx, s = -1;
766 curl_shape(idx,0) = s*dshape_cx(i)*shape_oy(j);
771 const double ND_TetrahedronElement::tk[18] =
772 { 1.,0.,0., 0.,1.,0., 0.,0.,1., -1.,1.,0., -1.,0.,1., 0.,-1.,1. };
774 const double ND_TetrahedronElement::c = 1./4.;
784 const int pm1 = p - 1, pm2 = p - 2, pm3 = p - 3;
786 #ifndef MFEM_THREAD_SAFE
797 Vector shape_x(p), shape_y(p), shape_z(p), shape_l(p);
802 for (
int i = 0; i <
p; i++)
807 for (
int i = 0; i <
p; i++)
812 for (
int i = 0; i <
p; i++)
817 for (
int i = 0; i <
p; i++)
822 for (
int i = 0; i <
p; i++)
827 for (
int i = 0; i <
p; i++)
834 for (
int j = 0; j <= pm2; j++)
835 for (
int i = 0; i + j <= pm2; i++)
837 double w = fop[i] + fop[j] + fop[pm2-i-j];
843 for (
int j = 0; j <= pm2; j++)
844 for (
int i = 0; i + j <= pm2; i++)
846 double w = fop[i] + fop[j] + fop[pm2-i-j];
852 for (
int j = 0; j <= pm2; j++)
853 for (
int i = 0; i + j <= pm2; i++)
855 double w = fop[i] + fop[j] + fop[pm2-i-j];
861 for (
int j = 0; j <= pm2; j++)
862 for (
int i = 0; i + j <= pm2; i++)
864 double w = fop[i] + fop[j] + fop[pm2-i-j];
872 for (
int k = 0; k <= pm3; k++)
873 for (
int j = 0; j + k <= pm3; j++)
874 for (
int i = 0; i + j + k <= pm3; i++)
876 double w = iop[i] + iop[j] + iop[k] + iop[pm3-i-j-k];
886 for (
int m = 0; m <
dof; m++)
889 const double *tm = tk + 3*dof2tk[m];
897 for (
int k = 0; k <= pm1; k++)
898 for (
int j = 0; j + k <= pm1; j++)
899 for (
int i = 0; i + j + k <= pm1; i++)
901 double s = shape_x(i)*shape_y(j)*shape_z(k)*shape_l(pm1-i-j-k);
902 T(o++, m) = s * tm[0];
903 T(o++, m) = s * tm[1];
904 T(o++, m) = s * tm[2];
906 for (
int k = 0; k <= pm1; k++)
907 for (
int j = 0; j + k <= pm1; j++)
909 double s = shape_x(pm1-j-k)*shape_y(j)*shape_z(k);
910 T(o++, m) = s*((ip.
y - c)*tm[0] - (ip.
x - c)*tm[1]);
911 T(o++, m) = s*((ip.
z - c)*tm[0] - (ip.
x - c)*tm[2]);
913 for (
int k = 0; k <= pm1; k++)
916 shape_y(pm1-k)*shape_z(k)*((ip.
z - c)*tm[1] - (ip.
y - c)*tm[2]);
927 const int pm1 =
order - 1;
929 #ifdef MFEM_THREAD_SAFE
931 Vector shape_x(p), shape_y(p), shape_z(p), shape_l(p);
941 for (
int k = 0; k <= pm1; k++)
942 for (
int j = 0; j + k <= pm1; j++)
943 for (
int i = 0; i + j + k <= pm1; i++)
945 double s = shape_x(i)*shape_y(j)*shape_z(k)*shape_l(pm1-i-j-k);
946 u(n,0) =
s; u(n,1) = 0.; u(n,2) = 0.; n++;
947 u(n,0) = 0.; u(n,1) =
s; u(n,2) = 0.; n++;
948 u(n,0) = 0.; u(n,1) = 0.; u(n,2) =
s; n++;
950 for (
int k = 0; k <= pm1; k++)
951 for (
int j = 0; j + k <= pm1; j++)
953 double s = shape_x(pm1-j-k)*shape_y(j)*shape_z(k);
954 u(n,0) = s*(ip.
y - c); u(n,1) = -s*(ip.
x - c); u(n,2) = 0.; n++;
955 u(n,0) = s*(ip.
z - c); u(n,1) = 0.; u(n,2) = -s*(ip.
x - c); n++;
957 for (
int k = 0; k <= pm1; k++)
959 double s = shape_y(pm1-k)*shape_z(k);
960 u(n,0) = 0.; u(n,1) = s*(ip.
z - c); u(n,2) = -s*(ip.
y - c); n++;
969 const int pm1 =
order - 1;
971 #ifdef MFEM_THREAD_SAFE
973 Vector shape_x(p), shape_y(p), shape_z(p), shape_l(p);
974 Vector dshape_x(p), dshape_y(p), dshape_z(p), dshape_l(p);
984 for (
int k = 0; k <= pm1; k++)
985 for (
int j = 0; j + k <= pm1; j++)
986 for (
int i = 0; i + j + k <= pm1; i++)
989 const double dx = (dshape_x(i)*shape_l(l) -
990 shape_x(i)*dshape_l(l))*shape_y(j)*shape_z(k);
991 const double dy = (dshape_y(j)*shape_l(l) -
992 shape_y(j)*dshape_l(l))*shape_x(i)*shape_z(k);
993 const double dz = (dshape_z(k)*shape_l(l) -
994 shape_z(k)*dshape_l(l))*shape_x(i)*shape_y(j);
996 u(n,0) = 0.; u(n,1) = dz; u(n,2) = -dy; n++;
997 u(n,0) = -dz; u(n,1) = 0.; u(n,2) = dx; n++;
998 u(n,0) = dy; u(n,1) = -dx; u(n,2) = 0.; n++;
1000 for (
int k = 0; k <= pm1; k++)
1001 for (
int j = 0; j + k <= pm1; j++)
1003 int i = pm1 - j - k;
1006 u(n,0) = shape_x(i)*(ip.
x - c)*shape_y(j)*dshape_z(k);
1007 u(n,1) = shape_x(i)*shape_y(j)*(ip.
y - c)*dshape_z(k);
1009 -((dshape_x(i)*(ip.
x - c) + shape_x(i))*shape_y(j)*shape_z(k) +
1010 (dshape_y(j)*(ip.
y - c) + shape_y(j))*shape_x(i)*shape_z(k));
1013 u(n,0) = -shape_x(i)*(ip.
x - c)*dshape_y(j)*shape_z(k);
1014 u(n,1) = (shape_x(i)*shape_y(j)*(dshape_z(k)*(ip.
z - c) + shape_z(k)) +
1015 (dshape_x(i)*(ip.
x - c) + shape_x(i))*shape_y(j)*shape_z(k));
1016 u(n,2) = -shape_x(i)*dshape_y(j)*shape_z(k)*(ip.
z - c);
1019 for (
int k = 0; k <= pm1; k++)
1023 u(n,0) = -((dshape_y(j)*(ip.
y - c) + shape_y(j))*shape_z(k) +
1024 shape_y(j)*(dshape_z(k)*(ip.
z - c) + shape_z(k)));
1029 Ti.
Mult(u, curl_shape);
1033 const double ND_TriangleElement::tk[8] =
1034 { 1.,0., -1.,1., 0.,-1., 0.,1. };
1036 const double ND_TriangleElement::c = 1./3.;
1046 const int pm1 = p - 1, pm2 = p - 2;
1048 #ifndef MFEM_THREAD_SAFE
1058 Vector shape_x(p), shape_y(p), shape_l(p);
1063 for (
int i = 0; i <
p; i++)
1068 for (
int i = 0; i <
p; i++)
1073 for (
int i = 0; i <
p; i++)
1080 for (
int j = 0; j <= pm2; j++)
1081 for (
int i = 0; i + j <= pm2; i++)
1083 double w = iop[i] + iop[j] + iop[pm2-i-j];
1091 for (
int m = 0; m <
dof; m++)
1094 const double *tm = tk + 2*dof2tk[m];
1101 for (
int j = 0; j <= pm1; j++)
1102 for (
int i = 0; i + j <= pm1; i++)
1104 double s = shape_x(i)*shape_y(j)*shape_l(pm1-i-j);
1105 T(n++, m) = s * tm[0];
1106 T(n++, m) = s * tm[1];
1108 for (
int j = 0; j <= pm1; j++)
1111 shape_x(pm1-j)*shape_y(j)*((ip.
y - c)*tm[0] - (ip.
x - c)*tm[1]);
1122 const int pm1 =
order - 1;
1124 #ifdef MFEM_THREAD_SAFE
1126 Vector shape_x(p), shape_y(p), shape_l(p);
1135 for (
int j = 0; j <= pm1; j++)
1136 for (
int i = 0; i + j <= pm1; i++)
1138 double s = shape_x(i)*shape_y(j)*shape_l(pm1-i-j);
1139 u(n,0) =
s; u(n,1) = 0; n++;
1140 u(n,0) = 0; u(n,1) =
s; n++;
1142 for (
int j = 0; j <= pm1; j++)
1144 double s = shape_x(pm1-j)*shape_y(j);
1145 u(n,0) = s*(ip.
y - c);
1146 u(n,1) = -s*(ip.
x - c);
1156 const int pm1 =
order - 1;
1158 #ifdef MFEM_THREAD_SAFE
1160 Vector shape_x(p), shape_y(p), shape_l(p);
1161 Vector dshape_x(p), dshape_y(p), dshape_l(p);
1170 for (
int j = 0; j <= pm1; j++)
1171 for (
int i = 0; i + j <= pm1; i++)
1174 const double dx = (dshape_x(i)*shape_l(l) -
1175 shape_x(i)*dshape_l(l)) * shape_y(j);
1176 const double dy = (dshape_y(j)*shape_l(l) -
1177 shape_y(j)*dshape_l(l)) * shape_x(i);
1183 for (
int j = 0; j <= pm1; j++)
1187 curlu(n++) = -((dshape_x(i)*(ip.
x - c) + shape_x(i)) * shape_y(j) +
1188 (dshape_y(j)*(ip.
y - c) + shape_y(j)) * shape_x(i));
1192 Ti.
Mult(curlu, curl2d);
1196 const double ND_SegmentElement::tk[1] = { 1. };
1208 for (
int i = 0; i <
p; i++)
1223 const double ND_WedgeElement::tk[15] =
1224 { 1.,0.,0., -1.,1.,0., 0.,-1.,0., 0.,0.,1., 0.,1.,0. };
1230 3 * p * ((p + 1) * (p + 2))/2, p,
1235 H1TriangleFE(p, cb_type),
1237 H1SegmentFE(p, cb_type),
1238 NDSegmentFE(p, ob_type)
1240 MFEM_ASSERT(H1TriangleFE.
GetDof() * NDSegmentFE.
GetDof() +
1242 "Mismatch in number of degrees of freedom "
1243 "when building ND_WedgeElement!");
1245 #ifndef MFEM_THREAD_SAFE
1255 const int pm1 = p - 1, pm2 = p - 2;
1264 for (
int i = 0; i <
p; i++)
1266 t_dof[o] = i; s_dof[o] = 0; dof2tk[o] = 0;
1271 for (
int i = 0; i <
p; i++)
1273 t_dof[o] = p + i; s_dof[o] = 0; dof2tk[o] = 1;
1278 for (
int i = 0; i <
p; i++)
1280 t_dof[o] = 2 * p + i; s_dof[o] = 0; dof2tk[o] = 2;
1285 for (
int i = 0; i <
p; i++)
1287 t_dof[o] = i; s_dof[o] = 1; dof2tk[o] = 0;
1292 for (
int i = 0; i <
p; i++)
1294 t_dof[o] = p + i; s_dof[o] = 1; dof2tk[o] = 1;
1299 for (
int i = 0; i <
p; i++)
1301 t_dof[o] = 2 * p + i; s_dof[o] = 1; dof2tk[o] = 2;
1306 for (
int i = 0; i <
p; i++)
1308 t_dof[o] = 0; s_dof[o] = i; dof2tk[o] = 3;
1313 for (
int i = 0; i <
p; i++)
1315 t_dof[o] = 1; s_dof[o] = i; dof2tk[o] = 3;
1320 for (
int i = 0; i <
p; i++)
1322 t_dof[o] = 2; s_dof[o] = i; dof2tk[o] = 3;
1331 for (
int j = 0; j <= pm2; j++)
1332 for (
int i = 0; i + j <= pm2; i++)
1334 l = j + ( 2 * p - 1 - i) * i / 2;
1335 t_dof[o] = 3 * p + 2*l+1; s_dof[o] = 0; dof2tk[o] = 4;
1339 t_dof[o] = 3 * p + 2*l; s_dof[o] = 0; dof2tk[o] = 0;
1346 for (
int j = 0; j <= pm2; j++)
1347 for (
int i = 0; i + j <= pm2; i++)
1349 t_dof[o] = 3 * p + m; s_dof[o] = 1; dof2tk[o] = 0; m++;
1353 t_dof[o] = 3 * p + m; s_dof[o] = 1; dof2tk[o] = 4; m++;
1359 for (
int j = 2; j <=
p; j++)
1360 for (
int i = 0; i <
p; i++)
1362 t_dof[o] = i; s_dof[o] = j; dof2tk[o] = 0;
1367 for (
int j = 0; j <
p; j++)
1368 for (
int i = 0; i < pm1; i++)
1370 t_dof[o] = 3 + i; s_dof[o] = j; dof2tk[o] = 3;
1376 for (
int j = 2; j <=
p; j++)
1377 for (
int i = 0; i <
p; i++)
1379 t_dof[o] = p + i; s_dof[o] = j; dof2tk[o] = 1;
1384 for (
int j = 0; j <
p; j++)
1385 for (
int i = 0; i < pm1; i++)
1387 t_dof[o] = p + 2 + i; s_dof[o] = j; dof2tk[o] = 3;
1393 for (
int j = 2; j <=
p; j++)
1394 for (
int i = 0; i <
p; i++)
1396 t_dof[o] = 2 * p + i; s_dof[o] = j; dof2tk[o] = 2;
1401 for (
int j = 0; j <
p; j++)
1402 for (
int i = 0; i < pm1; i++)
1404 t_dof[o] = 2 * p + 1 + i; s_dof[o] = j; dof2tk[o] = 3;
1411 for (
int k = 2; k <=
p; k++)
1414 for (
int j = 0; j <= pm2; j++)
1415 for (
int i = 0; i + j <= pm2; i++)
1417 t_dof[o] = 3 * p + l; s_dof[o] = k; dof2tk[o] = 0; l++;
1421 t_dof[o] = 3 * p + l; s_dof[o] = k; dof2tk[o] = 4; l++;
1427 for (
int k = 0; k <
p; k++)
1430 for (
int j = 0; j < pm2; j++)
1431 for (
int i = 0; i + j < pm2; i++)
1433 t_dof[o] = 3 * p + l; s_dof[o] = k; dof2tk[o] = 3; l++;
1444 #ifdef MFEM_THREAD_SAFE
1458 for (
int i=0; i<
dof; i++)
1460 if ( dof2tk[i] != 3 )
1462 shape(i, 0) = tn_shape(t_dof[i], 0) * s1_shape[s_dof[i]];
1463 shape(i, 1) = tn_shape(t_dof[i], 1) * s1_shape[s_dof[i]];
1470 shape(i, 2) = t1_shape[t_dof[i]] * sn_shape(s_dof[i], 0);
1478 #ifdef MFEM_THREAD_SAFE
1496 for (
int i=0; i<
dof; i++)
1498 if ( dof2tk[i] != 3 )
1500 curl_shape(i, 0) = -tn_shape(t_dof[i], 1) * s1_dshape(s_dof[i], 0);
1501 curl_shape(i, 1) = tn_shape(t_dof[i], 0) * s1_dshape(s_dof[i], 0);
1502 curl_shape(i, 2) = tn_dshape(t_dof[i], 0) * s1_shape[s_dof[i]];
1506 curl_shape(i, 0) = t1_dshape(t_dof[i], 1) * sn_shape(s_dof[i], 0);
1507 curl_shape(i, 1) = -t1_dshape(t_dof[i], 0) * sn_shape(s_dof[i], 0);
1508 curl_shape(i, 2) = 0.0;
1540 const double ND_R1D_SegmentElement::tk[9] = { 1.,0.,0., 0.,1.,0., 0.,0.,1. };
1548 cbasis1d(
poly1d.GetBasis(p, VerifyClosed(cb_type))),
1549 obasis1d(
poly1d.GetBasis(p - 1, VerifyOpen(ob_type)))
1563 #ifndef MFEM_THREAD_SAFE
1575 dof_map[
p] = o; dof2tk[o++] = 1;
1577 dof_map[2*p+1] = o; dof2tk[o++] = 2;
1581 dof_map[2*
p] = o; dof2tk[o++] = 1;
1583 dof_map[3*p+1] = o; dof2tk[o++] = 2;
1587 for (
int i = 0; i <
p; i++)
1590 dof_map[i] = o; dof2tk[o++] = 0;
1593 for (
int i = 1; i <
p; i++)
1596 dof_map[p+i] = o; dof2tk[o++] = 1;
1599 for (
int i = 1; i <
p; i++)
1602 dof_map[2*p+1+i] = o; dof2tk[o++] = 2;
1611 #ifdef MFEM_THREAD_SAFE
1612 Vector shape_cx(p + 1), shape_ox(p);
1615 cbasis1d.
Eval(ip.
x, shape_cx);
1616 obasis1d.
Eval(ip.
x, shape_ox);
1620 for (
int i = 0; i <
p; i++)
1622 int idx = dof_map[o++];
1623 shape(idx,0) = shape_ox(i);
1628 for (
int i = 0; i <=
p; i++)
1630 int idx = dof_map[o++];
1632 shape(idx,1) = shape_cx(i);
1636 for (
int i = 0; i <=
p; i++)
1638 int idx = dof_map[o++];
1641 shape(idx,2) = shape_cx(i);
1650 MFEM_ASSERT(JI.Width() == 1 && JI.Height() == 1,
1651 "ND_R1D_SegmentElement cannot be embedded in "
1652 "2 or 3 dimensional spaces");
1653 for (
int i=0; i<
dof; i++)
1655 shape(i, 0) *= JI(0,0);
1664 #ifdef MFEM_THREAD_SAFE
1665 Vector shape_cx(p + 1), shape_ox(p);
1669 cbasis1d.
Eval(ip.
x, shape_cx, dshape_cx);
1670 obasis1d.
Eval(ip.
x, shape_ox);
1674 for (
int i = 0; i <
p; i++)
1676 int idx = dof_map[o++];
1677 curl_shape(idx,0) = 0.;
1678 curl_shape(idx,1) = 0.;
1679 curl_shape(idx,2) = 0.;
1682 for (
int i = 0; i <=
p; i++)
1684 int idx = dof_map[o++];
1685 curl_shape(idx,0) = 0.;
1686 curl_shape(idx,1) = 0.;
1687 curl_shape(idx,2) = dshape_cx(i);
1690 for (
int i = 0; i <=
p; i++)
1692 int idx = dof_map[o++];
1693 curl_shape(idx,0) = 0.;
1694 curl_shape(idx,1) = -dshape_cx(i);
1695 curl_shape(idx,2) = 0.;
1704 MFEM_ASSERT(J.Width() == 1 && J.Height() == 1,
1705 "ND_R1D_SegmentElement cannot be embedded in "
1706 "2 or 3 dimensional spaces");
1707 curl_shape *= (1.0 / J.Weight());
1717 for (
int k = 0; k <
dof; k++)
1723 Vector t(const_cast<double*>(&tk[dof2tk[k] * 3]), 3);
1724 dofs(k) = Trans.
Jacobian()(0,0) *
t(0) * vk(0) +
1725 t(1) * vk(1) +
t(2) * vk(2);
1739 double * tk_ptr =
const_cast<double*
>(tk);
1742 for (
int k = 0; k <
dof; k++)
1746 Vector t1(&tk_ptr[dof2tk[k] * 3], 1);
1747 Vector t3(&tk_ptr[dof2tk[k] * 3], 3);
1758 double w = 1.0/Trans.
Weight();
1759 for (
int d = 0; d <
vdim; d++)
1765 for (
int j = 0; j < shape.Size(); j++)
1767 double s = shape(j);
1768 if (fabs(s) < 1e-12)
1774 for (
int d = 0; d <
vdim; d++)
1776 I(k, j + d*shape.Size()) = s*vk[d];
1786 double * tk_ptr =
const_cast<double*
>(tk);
1789 for (
int k = 0; k <
dof; k++)
1793 Vector t1(&tk_ptr[dof2tk[k] * 3], 1);
1794 Vector t3(&tk_ptr[dof2tk[k] * 3], 3);
1806 I(k, j) +=
vshape(j, 0) * vk[0];
1809 I(k, j) +=
vshape(j, 1) * t3(1);
1810 I(k, j) +=
vshape(j, 2) * t3(2);
1817 const double ND_R2D_SegmentElement::tk[4] = { 1.,0., 0.,1. };
1825 cbasis1d(
poly1d.GetBasis(p, VerifyClosed(cb_type))),
1826 obasis1d(
poly1d.GetBasis(p - 1, VerifyOpen(ob_type)))
1835 #ifndef MFEM_THREAD_SAFE
1847 dof_map[
p] = o; dof2tk[o++] = 1;
1851 dof_map[2*
p] = o; dof2tk[o++] = 1;
1855 for (
int i = 0; i <
p; i++)
1858 dof_map[i] = o; dof2tk[o++] = 0;
1861 for (
int i = 1; i <
p; i++)
1864 dof_map[p+i] = o; dof2tk[o++] = 1;
1873 #ifdef MFEM_THREAD_SAFE
1874 Vector shape_cx(p + 1), shape_ox(p);
1877 cbasis1d.
Eval(ip.
x, shape_cx);
1878 obasis1d.
Eval(ip.
x, shape_ox);
1882 for (
int i = 0; i <
p; i++)
1884 int idx = dof_map[o++];
1885 shape(idx,0) = shape_ox(i);
1889 for (
int i = 0; i <=
p; i++)
1891 int idx = dof_map[o++];
1893 shape(idx,1) = shape_cx(i);
1902 MFEM_ASSERT(JI.Width() == 1 && JI.Height() == 1,
1903 "ND_R2D_SegmentElement cannot be embedded in "
1904 "2 or 3 dimensional spaces");
1905 for (
int i=0; i<
dof; i++)
1907 shape(i, 0) *= JI(0,0);
1916 #ifdef MFEM_THREAD_SAFE
1917 Vector shape_cx(p + 1), shape_ox(p);
1921 cbasis1d.
Eval(ip.
x, shape_cx, dshape_cx);
1922 obasis1d.
Eval(ip.
x, shape_ox);
1926 for (
int i = 0; i <
p; i++)
1928 int idx = dof_map[o++];
1929 curl_shape(idx,0) = 0.;
1932 for (
int i = 0; i <=
p; i++)
1934 int idx = dof_map[o++];
1935 curl_shape(idx,0) = -dshape_cx(i);
1948 double * tk_ptr =
const_cast<double*
>(tk);
1955 for (
int k = 0; k <
dof; k++)
1957 Vector t1(&tk_ptr[dof2tk[k] * 2], 1);
1958 Vector t2(&tk_ptr[dof2tk[k] * 2], 2);
1969 for (
int i = 0; i <
dim; i++)
1971 Ikj +=
vshape(j, i) * vk[i];
1973 Ikj +=
vshape(j, 1) * t2(1);
1974 I(k, j) = (fabs(Ikj) < 1e-12) ? 0.0 : Ikj;
1988 double * tk_ptr =
const_cast<double*
>(tk);
1990 for (
int k = 0; k <
dof; k++)
1996 Vector t1(&tk_ptr[dof2tk[k] * 2], 1);
1997 Vector t2(&tk_ptr[dof2tk[k] * 2], 2);
2005 const double *tk_fe)
2027 MFEM_ASSERT(JI.Width() == 2 && JI.Height() == 2,
2028 "ND_R2D_FiniteElement cannot be embedded in "
2029 "3 dimensional spaces");
2030 for (
int i=0; i<
dof; i++)
2032 double sx = shape(i, 0);
2033 double sy = shape(i, 1);
2034 shape(i, 0) = sx * JI(0, 0) + sy * JI(1, 0);
2035 shape(i, 1) = sx * JI(0, 1) + sy * JI(1, 1);
2044 MFEM_ASSERT(J.Width() == 2 && J.Height() == 2,
2045 "ND_R2D_FiniteElement cannot be embedded in "
2046 "3 dimensional spaces");
2047 for (
int i=0; i<
dof; i++)
2049 double sx = curl_shape(i, 0);
2050 double sy = curl_shape(i, 1);
2051 curl_shape(i, 0) = sx * J(0, 0) + sy * J(0, 1);
2052 curl_shape(i, 1) = sx * J(1, 0) + sy * J(1, 1);
2054 curl_shape *= (1.0 / Trans.
Weight());
2057 void ND_R2D_FiniteElement::LocalInterpolation(
2065 #ifdef MFEM_THREAD_SAFE
2071 double * tk_ptr =
const_cast<double*
>(
tk);
2078 for (
int k = 0; k <
dof; k++)
2092 for (
int i = 0; i <
dim; i++)
2094 Ikj +=
vshape(j, i) * vk[i];
2096 Ikj +=
vshape(j, 2) * t3(2);
2097 I(k, j) = (fabs(Ikj) < 1e-12) ? 0.0 : Ikj;
2109 #ifdef MFEM_THREAD_SAFE
2113 double * tk_ptr =
const_cast<double*
>(
tk);
2117 for (
int j = 0; j <
dof; j++)
2127 Jinv.
Mult(t2, pt_data);
2128 for (
int k = 0; k <
dof; k++)
2131 for (
int d = 0; d <
dim; d++)
2133 R_jk +=
vshape(k,d)*pt_data[d];
2135 R_jk +=
vshape(k, 2) * t3(2);
2156 double * tk_ptr =
const_cast<double*
>(
tk);
2158 for (
int k = 0; k <
dof; k++)
2181 double * tk_ptr =
const_cast<double*
>(
tk);
2184 for (
int k = 0; k <
dof; k++)
2199 double w = 1.0/Trans.
Weight();
2200 for (
int d = 0; d <
vdim; d++)
2206 for (
int j = 0; j < shape.Size(); j++)
2208 double s = shape(j);
2209 if (fabs(s) < 1e-12)
2215 for (
int d = 0; d <
vdim; d++)
2217 I(k, j + d*shape.Size()) = s*vk[d];
2227 double * tk_ptr =
const_cast<double*
>(
tk);
2230 for (
int k = 0; k <
dof; k++)
2247 for (
int i=0; i<2; i++)
2249 I(k, j) +=
vshape(j, i) * vk[i];
2253 I(k, j) +=
vshape(j, 2) * t3(2);
2270 for (
int k = 0; k <
dof; k++)
2274 for (
int j = 0; j < grad_k.Size(); j++)
2276 grad(k,j) = (fabs(grad_k(j)) < 1e-12) ? 0.0 : grad_k(j);
2281 const double ND_R2D_TriangleElement::tk_t[15] =
2282 { 1.,0.,0., -1.,1.,0., 0.,-1.,0., 0.,1.,0., 0.,0.,1. };
2290 int pm1 = p - 1, pm2 = p - 2;
2292 #ifndef MFEM_THREAD_SAFE
2308 for (
int e=0; e<3; e++)
2311 for (
int i=0; i<
p; i++)
2316 for (
int i=0; i<pm1; i++)
2323 for (
int j = 0; j <= pm2; j++)
2324 for (
int i = 0; i + j <= pm2; i++)
2331 for (
int j = 0; j < pm1; j++)
2332 for (
int i = 0; i + j < pm2; i++)
2337 MFEM_VERIFY(n == ND_FE.
GetDof(),
2338 "ND_R2D_Triangle incorrect number of ND dofs.");
2339 MFEM_VERIFY(h == H1_FE.
GetDof(),
2340 "ND_R2D_Triangle incorrect number of H1 dofs.");
2341 MFEM_VERIFY(o ==
GetDof(),
2342 "ND_R2D_Triangle incorrect number of dofs.");
2347 for (
int i=0; i<
dof; i++)
2366 #ifdef MFEM_THREAD_SAFE
2374 for (
int i=0; i<
dof; i++)
2379 shape(i, 0) = nd_shape(idx, 0);
2380 shape(i, 1) = nd_shape(idx, 1);
2387 shape(i, 2) = h1_shape(-idx-1);
2395 #ifdef MFEM_THREAD_SAFE
2403 for (
int i=0; i<
dof; i++)
2408 curl_shape(i, 0) = 0.0;
2409 curl_shape(i, 1) = 0.0;
2410 curl_shape(i, 2) = nd_dshape(idx, 0);
2414 curl_shape(i, 0) = h1_dshape(-idx-1, 1);
2415 curl_shape(i, 1) = -h1_dshape(-idx-1, 0);
2416 curl_shape(i, 2) = 0.0;
2422 const double ND_R2D_QuadrilateralElement::tk_q[15] =
2423 { 1.,0.,0., 0.,1.,0., -1.,0.,0., 0.,-1.,0., 0.,0.,1. };
2429 cbasis1d(
poly1d.GetBasis(p, VerifyClosed(cb_type))),
2430 obasis1d(
poly1d.GetBasis(p - 1, VerifyOpen(ob_type)))
2434 const int dofx = p*(p+1);
2435 const int dofy = p*(p+1);
2436 const int dofxy = dofx+dofy;
2438 #ifndef MFEM_THREAD_SAFE
2457 for (
int i = 0; i <
p; i++)
2461 for (
int i = 1; i <
p; i++)
2463 dof_map[dofxy + i + 0*(p+1)] = o++;
2465 for (
int j = 0; j <
p; j++)
2467 dof_map[dofx + p + j*(p + 1)] = o++;
2469 for (
int j = 1; j <
p; j++)
2471 dof_map[dofxy + p + j*(p + 1)] = o++;
2473 for (
int i = 0; i <
p; i++)
2475 dof_map[(p - 1 - i) + p*p] = -1 - (o++);
2477 for (
int i = 1; i <
p; i++)
2479 dof_map[dofxy + (p - i) + p*(p + 1)] = o++;
2481 for (
int j = 0; j <
p; j++)
2483 dof_map[dofx + 0 + (p - 1 - j)*(p + 1)] = -1 - (o++);
2485 for (
int j = 1; j <
p; j++)
2487 dof_map[dofxy + (p - j)*(p + 1)] = o++;
2492 for (
int j = 1; j <
p; j++)
2493 for (
int i = 0; i <
p; i++)
2498 for (
int j = 0; j <
p; j++)
2499 for (
int i = 1; i <
p; i++)
2501 dof_map[dofx + i + j*(p + 1)] = o++;
2504 for (
int j = 1; j <
p; j++)
2505 for (
int i = 1; i <
p; i++)
2507 dof_map[dofxy + i + j*(p + 1)] = o++;
2513 for (
int j = 0; j <=
p; j++)
2514 for (
int i = 0; i <
p; i++)
2519 dof2tk[idx = -1 - idx] = 2;
2528 for (
int j = 0; j <
p; j++)
2529 for (
int i = 0; i <=
p; i++)
2534 dof2tk[idx = -1 - idx] = 3;
2543 for (
int j = 0; j <=
p; j++)
2544 for (
int i = 0; i <=
p; i++)
2557 #ifdef MFEM_THREAD_SAFE
2558 Vector shape_cx(p + 1), shape_ox(p), shape_cy(p + 1), shape_oy(p);
2561 cbasis1d.
Eval(ip.
x, shape_cx);
2562 obasis1d.
Eval(ip.
x, shape_ox);
2563 cbasis1d.
Eval(ip.
y, shape_cy);
2564 obasis1d.
Eval(ip.
y, shape_oy);
2568 for (
int j = 0; j <=
p; j++)
2569 for (
int i = 0; i <
p; i++)
2574 idx = -1 - idx, s = -1;
2580 shape(idx,0) = s*shape_ox(i)*shape_cy(j);
2585 for (
int j = 0; j <
p; j++)
2586 for (
int i = 0; i <=
p; i++)
2591 idx = -1 - idx, s = -1;
2598 shape(idx,1) = s*shape_cx(i)*shape_oy(j);
2602 for (
int j = 0; j <=
p; j++)
2603 for (
int i = 0; i <=
p; i++)
2608 shape(idx,2) = shape_cx(i)*shape_cy(j);
2617 #ifdef MFEM_THREAD_SAFE
2618 Vector shape_cx(p + 1), shape_ox(p), shape_cy(p + 1), shape_oy(p);
2619 Vector dshape_cx(p + 1), dshape_cy(p + 1);
2622 cbasis1d.
Eval(ip.
x, shape_cx, dshape_cx);
2623 obasis1d.
Eval(ip.
x, shape_ox);
2624 cbasis1d.
Eval(ip.
y, shape_cy, dshape_cy);
2625 obasis1d.
Eval(ip.
y, shape_oy);
2629 for (
int j = 0; j <=
p; j++)
2630 for (
int i = 0; i <
p; i++)
2635 idx = -1 - idx, s = -1;
2641 curl_shape(idx,0) = 0.;
2642 curl_shape(idx,1) = 0.;
2643 curl_shape(idx,2) = -s*shape_ox(i)*dshape_cy(j);
2646 for (
int j = 0; j <
p; j++)
2647 for (
int i = 0; i <=
p; i++)
2652 idx = -1 - idx, s = -1;
2658 curl_shape(idx,0) = 0.;
2659 curl_shape(idx,1) = 0.;
2660 curl_shape(idx,2) = s*dshape_cx(i)*shape_oy(j);
2663 for (
int j = 0; j <=
p; j++)
2664 for (
int i = 0; i <=
p; i++)
2667 curl_shape(idx,0) = shape_cx(i)*dshape_cy(j);
2668 curl_shape(idx,1) = -dshape_cx(i)*shape_cy(j);
2669 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...
void ScaleIntegrated(bool scale_integrated_)
Set whether the "integrated" basis should be scaled by the subcell sizes. Has no effect for non-integ...
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...