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++)
60 for (
int i = 0; i <
p; i++)
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++)
72 for (
int i = 0; i <
p; i++)
76 for (
int i = 0; i <
p; i++)
80 for (
int i = 0; i <
p; i++)
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));
296 Trans.SetIntPoint(&ip3d);
300 const double ipval =
Trans.Jacobian().InnerProduct(tk + dof2tk[idx]*
dim, vk);
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);
321 #ifdef MFEM_THREAD_SAFE 322 Vector dshape_cx(
p + 1), dshape_cy(
p + 1), dshape_cz(
p + 1);
344 for (
int k = 0; k <=
p; k++)
345 for (
int j = 0; j <=
p; j++)
346 for (
int i = 0; i <
p; i++)
351 idx = -1 - idx,
s = -1;
357 shape(idx,0) =
s*shape_ox(i)*shape_cy(j)*shape_cz(k);
362 for (
int k = 0; k <=
p; k++)
363 for (
int j = 0; j <
p; j++)
364 for (
int i = 0; i <=
p; i++)
369 idx = -1 - idx,
s = -1;
376 shape(idx,1) =
s*shape_cx(i)*shape_oy(j)*shape_cz(k);
380 for (
int k = 0; k <
p; k++)
381 for (
int j = 0; j <=
p; j++)
382 for (
int i = 0; i <=
p; i++)
387 idx = -1 - idx,
s = -1;
395 shape(idx,2) =
s*shape_cx(i)*shape_cy(j)*shape_oz(k);
404 #ifdef MFEM_THREAD_SAFE 405 Vector shape_cx(
p + 1), shape_ox(
p), shape_cy(
p + 1), shape_oy(
p);
406 Vector shape_cz(
p + 1), shape_oz(
p);
407 Vector dshape_cx(
p + 1), dshape_cy(
p + 1), dshape_cz(
p + 1);
429 for (
int k = 0; k <=
p; k++)
430 for (
int j = 0; j <=
p; j++)
431 for (
int i = 0; i <
p; i++)
436 idx = -1 - idx,
s = -1;
442 curl_shape(idx,0) = 0.;
443 curl_shape(idx,1) =
s*shape_ox(i)* shape_cy(j)*dshape_cz(k);
444 curl_shape(idx,2) = -
s*shape_ox(i)*dshape_cy(j)* shape_cz(k);
447 for (
int k = 0; k <=
p; k++)
448 for (
int j = 0; j <
p; j++)
449 for (
int i = 0; i <=
p; i++)
454 idx = -1 - idx,
s = -1;
460 curl_shape(idx,0) = -
s* shape_cx(i)*shape_oy(j)*dshape_cz(k);
461 curl_shape(idx,1) = 0.;
462 curl_shape(idx,2) =
s*dshape_cx(i)*shape_oy(j)* shape_cz(k);
465 for (
int k = 0; k <
p; k++)
466 for (
int j = 0; j <=
p; j++)
467 for (
int i = 0; i <=
p; i++)
472 idx = -1 - idx,
s = -1;
478 curl_shape(idx,0) =
s* shape_cx(i)*dshape_cy(j)*shape_oz(k);
479 curl_shape(idx,1) = -
s*dshape_cx(i)* shape_cy(j)*shape_oz(k);
480 curl_shape(idx,2) = 0.;
484 const double ND_QuadrilateralElement::tk[8] =
485 { 1.,0., 0.,1., -1.,0., 0.,-1. };
493 cp(
poly1d.ClosedPoints(
p, cb_type))
500 const int dof2 =
dof/2;
502 #ifndef MFEM_THREAD_SAFE 513 for (
int i = 0; i <
p; i++)
517 for (
int j = 0; j <
p; j++)
521 for (
int i = 0; i <
p; i++)
523 dof_map[0*dof2 + (
p - 1 - i) +
p*
p] = -1 - (o++);
525 for (
int j = 0; j <
p; j++)
527 dof_map[1*dof2 + 0 + (
p - 1 - j)*(
p + 1)] = -1 - (o++);
532 for (
int j = 1; j <
p; j++)
533 for (
int i = 0; i <
p; i++)
538 for (
int j = 0; j <
p; j++)
539 for (
int i = 1; i <
p; i++)
541 dof_map[1*dof2 + i + j*(
p + 1)] = o++;
547 for (
int j = 0; j <=
p; j++)
548 for (
int i = 0; i <
p; i++)
553 dof2tk[idx = -1 - idx] = 2;
562 for (
int j = 0; j <
p; j++)
563 for (
int i = 0; i <=
p; i++)
568 dof2tk[idx = -1 - idx] = 3;
593 for (
int j = 0; j <=
order; j++)
594 for (
int i = 0; i <
order; i++)
602 const double h = cp[i+1] - cp[i];
606 for (
int k = 0; k < nqpt; k++)
610 ip2d.
Set2(cp[i] + (h*ip1d.
x), cp[j]);
612 Trans.SetIntPoint(&ip2d);
616 const double ipval =
Trans.Jacobian().InnerProduct(tk + dof2tk[idx]*
dim, vk);
617 val += ip1d.
weight * ipval;
623 for (
int j = 0; j <
order; j++)
624 for (
int i = 0; i <=
order; i++)
632 const double h = cp[j+1] - cp[j];
636 for (
int k = 0; k < nqpt; k++)
640 ip2d.
Set2(cp[i], cp[j] + (h*ip1d.
x));
642 Trans.SetIntPoint(&ip2d);
646 const double ipval =
Trans.Jacobian().InnerProduct(tk + dof2tk[idx]*
dim, vk);
647 val += ip1d.
weight * ipval;
659 #ifdef MFEM_THREAD_SAFE 660 Vector shape_cx(
p + 1), shape_ox(
p), shape_cy(
p + 1), shape_oy(
p);
665 #ifdef MFEM_THREAD_SAFE 666 Vector dshape_cx(
p + 1), dshape_cy(
p + 1);
684 for (
int j = 0; j <=
p; j++)
685 for (
int i = 0; i <
p; i++)
690 idx = -1 - idx,
s = -1;
696 shape(idx,0) =
s*shape_ox(i)*shape_cy(j);
700 for (
int j = 0; j <
p; j++)
701 for (
int i = 0; i <=
p; i++)
706 idx = -1 - idx,
s = -1;
713 shape(idx,1) =
s*shape_cx(i)*shape_oy(j);
722 #ifdef MFEM_THREAD_SAFE 723 Vector shape_cx(
p + 1), shape_ox(
p), shape_cy(
p + 1), shape_oy(
p);
724 Vector dshape_cx(
p + 1), dshape_cy(
p + 1);
743 for (
int j = 0; j <=
p; j++)
744 for (
int i = 0; i <
p; i++)
749 idx = -1 - idx,
s = -1;
755 curl_shape(idx,0) = -
s*shape_ox(i)*dshape_cy(j);
758 for (
int j = 0; j <
p; j++)
759 for (
int i = 0; i <=
p; i++)
764 idx = -1 - idx,
s = -1;
770 curl_shape(idx,0) =
s*dshape_cx(i)*shape_oy(j);
775 const double ND_TetrahedronElement::tk[18] =
776 { 1.,0.,0., 0.,1.,0., 0.,0.,1., -1.,1.,0., -1.,0.,1., 0.,-1.,1. };
778 const double ND_TetrahedronElement::c = 1./4.;
788 const int pm1 =
p - 1, pm2 =
p - 2, pm3 =
p - 3;
790 #ifndef MFEM_THREAD_SAFE 801 Vector shape_x(
p), shape_y(
p), shape_z(
p), shape_l(
p);
806 for (
int i = 0; i <
p; i++)
811 for (
int i = 0; i <
p; i++)
816 for (
int i = 0; i <
p; i++)
821 for (
int i = 0; i <
p; i++)
826 for (
int i = 0; i <
p; i++)
831 for (
int i = 0; i <
p; i++)
838 for (
int j = 0; j <= pm2; j++)
839 for (
int i = 0; i + j <= pm2; i++)
841 double w = fop[i] + fop[j] + fop[pm2-i-j];
847 for (
int j = 0; j <= pm2; j++)
848 for (
int i = 0; i + j <= pm2; i++)
850 double w = fop[i] + fop[j] + fop[pm2-i-j];
856 for (
int j = 0; j <= pm2; j++)
857 for (
int i = 0; i + j <= pm2; i++)
859 double w = fop[i] + fop[j] + fop[pm2-i-j];
865 for (
int j = 0; j <= pm2; j++)
866 for (
int i = 0; i + j <= pm2; i++)
868 double w = fop[i] + fop[j] + fop[pm2-i-j];
876 for (
int k = 0; k <= pm3; k++)
877 for (
int j = 0; j + k <= pm3; j++)
878 for (
int i = 0; i + j + k <= pm3; i++)
880 double w = iop[i] + iop[j] + iop[k] + iop[pm3-i-j-k];
890 for (
int m = 0; m <
dof; m++)
893 const double *tm = tk + 3*dof2tk[m];
901 for (
int k = 0; k <= pm1; k++)
902 for (
int j = 0; j + k <= pm1; j++)
903 for (
int i = 0; i + j + k <= pm1; i++)
905 double s = shape_x(i)*shape_y(j)*shape_z(k)*shape_l(pm1-i-j-k);
906 T(o++, m) =
s * tm[0];
907 T(o++, m) =
s * tm[1];
908 T(o++, m) =
s * tm[2];
910 for (
int k = 0; k <= pm1; k++)
911 for (
int j = 0; j + k <= pm1; j++)
913 double s = shape_x(pm1-j-k)*shape_y(j)*shape_z(k);
914 T(o++, m) =
s*((ip.
y - c)*tm[0] - (ip.
x - c)*tm[1]);
915 T(o++, m) =
s*((ip.
z - c)*tm[0] - (ip.
x - c)*tm[2]);
917 for (
int k = 0; k <= pm1; k++)
920 shape_y(pm1-k)*shape_z(k)*((ip.
z - c)*tm[1] - (ip.
y - c)*tm[2]);
931 const int pm1 =
order - 1;
933 #ifdef MFEM_THREAD_SAFE 935 Vector shape_x(
p), shape_y(
p), shape_z(
p), shape_l(
p);
945 for (
int k = 0; k <= pm1; k++)
946 for (
int j = 0; j + k <= pm1; j++)
947 for (
int i = 0; i + j + k <= pm1; i++)
949 double s = shape_x(i)*shape_y(j)*shape_z(k)*shape_l(pm1-i-j-k);
950 u(n,0) =
s;
u(n,1) = 0.;
u(n,2) = 0.; n++;
951 u(n,0) = 0.;
u(n,1) =
s;
u(n,2) = 0.; n++;
952 u(n,0) = 0.;
u(n,1) = 0.;
u(n,2) =
s; n++;
954 for (
int k = 0; k <= pm1; k++)
955 for (
int j = 0; j + k <= pm1; j++)
957 double s = shape_x(pm1-j-k)*shape_y(j)*shape_z(k);
958 u(n,0) =
s*(ip.
y - c);
u(n,1) = -
s*(ip.
x - c);
u(n,2) = 0.; n++;
959 u(n,0) =
s*(ip.
z - c);
u(n,1) = 0.;
u(n,2) = -
s*(ip.
x - c); n++;
961 for (
int k = 0; k <= pm1; k++)
963 double s = shape_y(pm1-k)*shape_z(k);
964 u(n,0) = 0.;
u(n,1) =
s*(ip.
z - c);
u(n,2) = -
s*(ip.
y - c); n++;
973 const int pm1 =
order - 1;
975 #ifdef MFEM_THREAD_SAFE 977 Vector shape_x(
p), shape_y(
p), shape_z(
p), shape_l(
p);
978 Vector dshape_x(
p), dshape_y(
p), dshape_z(
p), dshape_l(
p);
988 for (
int k = 0; k <= pm1; k++)
989 for (
int j = 0; j + k <= pm1; j++)
990 for (
int i = 0; i + j + k <= pm1; i++)
993 const double dx = (dshape_x(i)*shape_l(l) -
994 shape_x(i)*dshape_l(l))*shape_y(j)*shape_z(k);
995 const double dy = (dshape_y(j)*shape_l(l) -
996 shape_y(j)*dshape_l(l))*shape_x(i)*shape_z(k);
997 const double dz = (dshape_z(k)*shape_l(l) -
998 shape_z(k)*dshape_l(l))*shape_x(i)*shape_y(j);
1000 u(n,0) = 0.;
u(n,1) = dz;
u(n,2) = -dy; n++;
1001 u(n,0) = -dz;
u(n,1) = 0.;
u(n,2) = dx; n++;
1002 u(n,0) = dy;
u(n,1) = -dx;
u(n,2) = 0.; n++;
1004 for (
int k = 0; k <= pm1; k++)
1005 for (
int j = 0; j + k <= pm1; j++)
1007 int i = pm1 - j - k;
1010 u(n,0) = shape_x(i)*(ip.
x - c)*shape_y(j)*dshape_z(k);
1011 u(n,1) = shape_x(i)*shape_y(j)*(ip.
y - c)*dshape_z(k);
1013 -((dshape_x(i)*(ip.
x - c) + shape_x(i))*shape_y(j)*shape_z(k) +
1014 (dshape_y(j)*(ip.
y - c) + shape_y(j))*shape_x(i)*shape_z(k));
1017 u(n,0) = -shape_x(i)*(ip.
x - c)*dshape_y(j)*shape_z(k);
1018 u(n,1) = (shape_x(i)*shape_y(j)*(dshape_z(k)*(ip.
z - c) + shape_z(k)) +
1019 (dshape_x(i)*(ip.
x - c) + shape_x(i))*shape_y(j)*shape_z(k));
1020 u(n,2) = -shape_x(i)*dshape_y(j)*shape_z(k)*(ip.
z - c);
1023 for (
int k = 0; k <= pm1; k++)
1027 u(n,0) = -((dshape_y(j)*(ip.
y - c) + shape_y(j))*shape_z(k) +
1028 shape_y(j)*(dshape_z(k)*(ip.
z - c) + shape_z(k)));
1033 Ti.
Mult(
u, curl_shape);
1037 const double ND_TriangleElement::tk[8] =
1038 { 1.,0., -1.,1., 0.,-1., 0.,1. };
1040 const double ND_TriangleElement::c = 1./3.;
1050 const int pm1 =
p - 1, pm2 =
p - 2;
1052 #ifndef MFEM_THREAD_SAFE 1062 Vector shape_x(
p), shape_y(
p), shape_l(
p);
1067 for (
int i = 0; i <
p; i++)
1072 for (
int i = 0; i <
p; i++)
1077 for (
int i = 0; i <
p; i++)
1084 for (
int j = 0; j <= pm2; j++)
1085 for (
int i = 0; i + j <= pm2; i++)
1087 double w = iop[i] + iop[j] + iop[pm2-i-j];
1095 for (
int m = 0; m <
dof; m++)
1098 const double *tm = tk + 2*dof2tk[m];
1105 for (
int j = 0; j <= pm1; j++)
1106 for (
int i = 0; i + j <= pm1; i++)
1108 double s = shape_x(i)*shape_y(j)*shape_l(pm1-i-j);
1109 T(n++, m) =
s * tm[0];
1110 T(n++, m) =
s * tm[1];
1112 for (
int j = 0; j <= pm1; j++)
1115 shape_x(pm1-j)*shape_y(j)*((ip.
y - c)*tm[0] - (ip.
x - c)*tm[1]);
1126 const int pm1 =
order - 1;
1128 #ifdef MFEM_THREAD_SAFE 1130 Vector shape_x(
p), shape_y(
p), shape_l(
p);
1139 for (
int j = 0; j <= pm1; j++)
1140 for (
int i = 0; i + j <= pm1; i++)
1142 double s = shape_x(i)*shape_y(j)*shape_l(pm1-i-j);
1143 u(n,0) =
s;
u(n,1) = 0; n++;
1144 u(n,0) = 0;
u(n,1) =
s; n++;
1146 for (
int j = 0; j <= pm1; j++)
1148 double s = shape_x(pm1-j)*shape_y(j);
1149 u(n,0) =
s*(ip.
y - c);
1150 u(n,1) = -
s*(ip.
x - c);
1160 const int pm1 =
order - 1;
1162 #ifdef MFEM_THREAD_SAFE 1164 Vector shape_x(
p), shape_y(
p), shape_l(
p);
1165 Vector dshape_x(
p), dshape_y(
p), dshape_l(
p);
1174 for (
int j = 0; j <= pm1; j++)
1175 for (
int i = 0; i + j <= pm1; i++)
1178 const double dx = (dshape_x(i)*shape_l(l) -
1179 shape_x(i)*dshape_l(l)) * shape_y(j);
1180 const double dy = (dshape_y(j)*shape_l(l) -
1181 shape_y(j)*dshape_l(l)) * shape_x(i);
1187 for (
int j = 0; j <= pm1; j++)
1191 curlu(n++) = -((dshape_x(i)*(ip.
x - c) + shape_x(i)) * shape_y(j) +
1192 (dshape_y(j)*(ip.
y - c) + shape_y(j)) * shape_x(i));
1196 Ti.
Mult(curlu, curl2d);
1200 const double ND_SegmentElement::tk[1] = { 1. };
1212 for (
int i = 0; i <
p; i++)
1227 const double ND_WedgeElement::tk[15] =
1228 { 1.,0.,0., -1.,1.,0., 0.,-1.,0., 0.,0.,1., 0.,1.,0. };
1234 3 *
p * ((
p + 1) * (
p + 2))/2,
p,
1239 H1TriangleFE(
p, cb_type),
1241 H1SegmentFE(
p, cb_type),
1242 NDSegmentFE(
p, ob_type)
1244 MFEM_ASSERT(H1TriangleFE.
GetDof() * NDSegmentFE.
GetDof() +
1246 "Mismatch in number of degrees of freedom " 1247 "when building ND_WedgeElement!");
1249 #ifndef MFEM_THREAD_SAFE 1259 const int pm1 =
p - 1, pm2 =
p - 2;
1268 for (
int i = 0; i <
p; i++)
1270 t_dof[o] = i; s_dof[o] = 0; dof2tk[o] = 0;
1275 for (
int i = 0; i <
p; i++)
1277 t_dof[o] =
p + i; s_dof[o] = 0; dof2tk[o] = 1;
1282 for (
int i = 0; i <
p; i++)
1284 t_dof[o] = 2 *
p + i; s_dof[o] = 0; dof2tk[o] = 2;
1289 for (
int i = 0; i <
p; i++)
1291 t_dof[o] = i; s_dof[o] = 1; dof2tk[o] = 0;
1296 for (
int i = 0; i <
p; i++)
1298 t_dof[o] =
p + i; s_dof[o] = 1; dof2tk[o] = 1;
1303 for (
int i = 0; i <
p; i++)
1305 t_dof[o] = 2 *
p + i; s_dof[o] = 1; dof2tk[o] = 2;
1310 for (
int i = 0; i <
p; i++)
1312 t_dof[o] = 0; s_dof[o] = i; dof2tk[o] = 3;
1317 for (
int i = 0; i <
p; i++)
1319 t_dof[o] = 1; s_dof[o] = i; dof2tk[o] = 3;
1324 for (
int i = 0; i <
p; i++)
1326 t_dof[o] = 2; s_dof[o] = i; dof2tk[o] = 3;
1335 for (
int j = 0; j <= pm2; j++)
1336 for (
int i = 0; i + j <= pm2; i++)
1338 l = j + ( 2 *
p - 1 - i) * i / 2;
1339 t_dof[o] = 3 *
p + 2*l+1; s_dof[o] = 0; dof2tk[o] = 4;
1343 t_dof[o] = 3 *
p + 2*l; s_dof[o] = 0; dof2tk[o] = 0;
1350 for (
int j = 0; j <= pm2; j++)
1351 for (
int i = 0; i + j <= pm2; i++)
1353 t_dof[o] = 3 *
p + m; s_dof[o] = 1; dof2tk[o] = 0; m++;
1357 t_dof[o] = 3 *
p + m; s_dof[o] = 1; dof2tk[o] = 4; m++;
1363 for (
int j = 2; j <=
p; j++)
1364 for (
int i = 0; i <
p; i++)
1366 t_dof[o] = i; s_dof[o] = j; dof2tk[o] = 0;
1371 for (
int j = 0; j <
p; j++)
1372 for (
int i = 0; i < pm1; i++)
1374 t_dof[o] = 3 + i; s_dof[o] = j; dof2tk[o] = 3;
1380 for (
int j = 2; j <=
p; j++)
1381 for (
int i = 0; i <
p; i++)
1383 t_dof[o] =
p + i; s_dof[o] = j; dof2tk[o] = 1;
1388 for (
int j = 0; j <
p; j++)
1389 for (
int i = 0; i < pm1; i++)
1391 t_dof[o] =
p + 2 + i; s_dof[o] = j; dof2tk[o] = 3;
1397 for (
int j = 2; j <=
p; j++)
1398 for (
int i = 0; i <
p; i++)
1400 t_dof[o] = 2 *
p + i; s_dof[o] = j; dof2tk[o] = 2;
1405 for (
int j = 0; j <
p; j++)
1406 for (
int i = 0; i < pm1; i++)
1408 t_dof[o] = 2 *
p + 1 + i; s_dof[o] = j; dof2tk[o] = 3;
1415 for (
int k = 2; k <=
p; k++)
1418 for (
int j = 0; j <= pm2; j++)
1419 for (
int i = 0; i + j <= pm2; i++)
1421 t_dof[o] = 3 *
p + l; s_dof[o] = k; dof2tk[o] = 0; l++;
1425 t_dof[o] = 3 *
p + l; s_dof[o] = k; dof2tk[o] = 4; l++;
1431 for (
int k = 0; k <
p; k++)
1434 for (
int j = 0; j < pm2; j++)
1435 for (
int i = 0; i + j < pm2; i++)
1437 t_dof[o] = 3 *
p + l; s_dof[o] = k; dof2tk[o] = 3; l++;
1448 #ifdef MFEM_THREAD_SAFE 1462 for (
int i=0; i<
dof; i++)
1464 if ( dof2tk[i] != 3 )
1466 shape(i, 0) = tn_shape(t_dof[i], 0) * s1_shape[s_dof[i]];
1467 shape(i, 1) = tn_shape(t_dof[i], 1) * s1_shape[s_dof[i]];
1474 shape(i, 2) = t1_shape[t_dof[i]] * sn_shape(s_dof[i], 0);
1482 #ifdef MFEM_THREAD_SAFE 1500 for (
int i=0; i<
dof; i++)
1502 if ( dof2tk[i] != 3 )
1504 curl_shape(i, 0) = -tn_shape(t_dof[i], 1) * s1_dshape(s_dof[i], 0);
1505 curl_shape(i, 1) = tn_shape(t_dof[i], 0) * s1_dshape(s_dof[i], 0);
1506 curl_shape(i, 2) = tn_dshape(t_dof[i], 0) * s1_shape[s_dof[i]];
1510 curl_shape(i, 0) = t1_dshape(t_dof[i], 1) * sn_shape(s_dof[i], 0);
1511 curl_shape(i, 1) = -t1_dshape(t_dof[i], 0) * sn_shape(s_dof[i], 0);
1512 curl_shape(i, 2) = 0.0;
1544 const double ND_R1D_SegmentElement::tk[9] = { 1.,0.,0., 0.,1.,0., 0.,0.,1. };
1552 cbasis1d(
poly1d.GetBasis(
p, VerifyClosed(cb_type))),
1553 obasis1d(
poly1d.GetBasis(
p - 1, VerifyOpen(ob_type)))
1567 #ifndef MFEM_THREAD_SAFE 1579 dof_map[
p] = o; dof2tk[o++] = 1;
1581 dof_map[2*
p+1] = o; dof2tk[o++] = 2;
1585 dof_map[2*
p] = o; dof2tk[o++] = 1;
1587 dof_map[3*
p+1] = o; dof2tk[o++] = 2;
1591 for (
int i = 0; i <
p; i++)
1594 dof_map[i] = o; dof2tk[o++] = 0;
1597 for (
int i = 1; i <
p; i++)
1600 dof_map[
p+i] = o; dof2tk[o++] = 1;
1603 for (
int i = 1; i <
p; i++)
1606 dof_map[2*
p+1+i] = o; dof2tk[o++] = 2;
1615 #ifdef MFEM_THREAD_SAFE 1616 Vector shape_cx(
p + 1), shape_ox(
p);
1619 cbasis1d.
Eval(ip.
x, shape_cx);
1620 obasis1d.
Eval(ip.
x, shape_ox);
1624 for (
int i = 0; i <
p; i++)
1626 int idx = dof_map[o++];
1627 shape(idx,0) = shape_ox(i);
1632 for (
int i = 0; i <=
p; i++)
1634 int idx = dof_map[o++];
1636 shape(idx,1) = shape_cx(i);
1640 for (
int i = 0; i <=
p; i++)
1642 int idx = dof_map[o++];
1645 shape(idx,2) = shape_cx(i);
1654 MFEM_ASSERT(JI.Width() == 1 && JI.Height() == 1,
1655 "ND_R1D_SegmentElement cannot be embedded in " 1656 "2 or 3 dimensional spaces");
1657 for (
int i=0; i<
dof; i++)
1659 shape(i, 0) *= JI(0,0);
1668 #ifdef MFEM_THREAD_SAFE 1669 Vector shape_cx(
p + 1), shape_ox(
p);
1673 cbasis1d.
Eval(ip.
x, shape_cx, dshape_cx);
1674 obasis1d.
Eval(ip.
x, shape_ox);
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) = 0.;
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) = 0.;
1691 curl_shape(idx,2) = dshape_cx(i);
1694 for (
int i = 0; i <=
p; i++)
1696 int idx = dof_map[o++];
1697 curl_shape(idx,0) = 0.;
1698 curl_shape(idx,1) = -dshape_cx(i);
1699 curl_shape(idx,2) = 0.;
1708 MFEM_ASSERT(J.Width() == 1 && J.Height() == 1,
1709 "ND_R1D_SegmentElement cannot be embedded in " 1710 "2 or 3 dimensional spaces");
1711 curl_shape *= (1.0 / J.Weight());
1721 for (
int k = 0; k <
dof; k++)
1727 Vector t(const_cast<double*>(&tk[dof2tk[k] * 3]), 3);
1728 dofs(k) =
Trans.Jacobian()(0,0) *
t(0) * vk(0) +
1729 t(1) * vk(1) +
t(2) * vk(2);
1743 double * tk_ptr =
const_cast<double*
>(tk);
1746 for (
int k = 0; k <
dof; k++)
1750 Vector t1(&tk_ptr[dof2tk[k] * 3], 1);
1751 Vector t3(&tk_ptr[dof2tk[k] * 3], 3);
1754 Trans.SetIntPoint(&ip);
1757 Trans.Jacobian().Mult(t1, vk);
1762 double w = 1.0/
Trans.Weight();
1763 for (
int d = 0; d <
vdim; d++)
1769 for (
int j = 0; j < shape.Size(); j++)
1771 double s = shape(j);
1772 if (fabs(
s) < 1e-12)
1778 for (
int d = 0; d <
vdim; d++)
1780 I(k, j + d*shape.Size()) =
s*vk[d];
1790 double * tk_ptr =
const_cast<double*
>(tk);
1793 for (
int k = 0; k <
dof; k++)
1797 Vector t1(&tk_ptr[dof2tk[k] * 3], 1);
1798 Vector t3(&tk_ptr[dof2tk[k] * 3], 3);
1800 Trans.SetIntPoint(&ip);
1803 Trans.Jacobian().Mult(t1, vk);
1810 I(k, j) +=
vshape(j, 0) * vk[0];
1813 I(k, j) +=
vshape(j, 1) * t3(1);
1814 I(k, j) +=
vshape(j, 2) * t3(2);
1821 const double ND_R2D_SegmentElement::tk[4] = { 1.,0., 0.,1. };
1829 cbasis1d(
poly1d.GetBasis(
p, VerifyClosed(cb_type))),
1830 obasis1d(
poly1d.GetBasis(
p - 1, VerifyOpen(ob_type)))
1839 #ifndef MFEM_THREAD_SAFE 1851 dof_map[
p] = o; dof2tk[o++] = 1;
1855 dof_map[2*
p] = o; dof2tk[o++] = 1;
1859 for (
int i = 0; i <
p; i++)
1862 dof_map[i] = o; dof2tk[o++] = 0;
1865 for (
int i = 1; i <
p; i++)
1868 dof_map[
p+i] = o; dof2tk[o++] = 1;
1877 #ifdef MFEM_THREAD_SAFE 1878 Vector shape_cx(
p + 1), shape_ox(
p);
1881 cbasis1d.
Eval(ip.
x, shape_cx);
1882 obasis1d.
Eval(ip.
x, shape_ox);
1886 for (
int i = 0; i <
p; i++)
1888 int idx = dof_map[o++];
1889 shape(idx,0) = shape_ox(i);
1893 for (
int i = 0; i <=
p; i++)
1895 int idx = dof_map[o++];
1897 shape(idx,1) = shape_cx(i);
1906 MFEM_ASSERT(JI.Width() == 1 && JI.Height() == 1,
1907 "ND_R2D_SegmentElement cannot be embedded in " 1908 "2 or 3 dimensional spaces");
1909 for (
int i=0; i<
dof; i++)
1911 shape(i, 0) *= JI(0,0);
1920 #ifdef MFEM_THREAD_SAFE 1921 Vector shape_cx(
p + 1), shape_ox(
p);
1925 cbasis1d.
Eval(ip.
x, shape_cx, dshape_cx);
1926 obasis1d.
Eval(ip.
x, shape_ox);
1930 for (
int i = 0; i <
p; i++)
1932 int idx = dof_map[o++];
1933 curl_shape(idx,0) = 0.;
1936 for (
int i = 0; i <=
p; i++)
1938 int idx = dof_map[o++];
1939 curl_shape(idx,0) = -dshape_cx(i);
1952 double * tk_ptr =
const_cast<double*
>(tk);
1959 for (
int k = 0; k <
dof; k++)
1961 Vector t1(&tk_ptr[dof2tk[k] * 2], 1);
1962 Vector t2(&tk_ptr[dof2tk[k] * 2], 2);
1973 for (
int i = 0; i <
dim; i++)
1975 Ikj +=
vshape(j, i) * vk[i];
1977 Ikj +=
vshape(j, 1) * t2(1);
1978 I(k, j) = (fabs(Ikj) < 1e-12) ? 0.0 : Ikj;
1992 double * tk_ptr =
const_cast<double*
>(tk);
1994 for (
int k = 0; k <
dof; k++)
2000 Vector t1(&tk_ptr[dof2tk[k] * 2], 1);
2001 Vector t2(&tk_ptr[dof2tk[k] * 2], 2);
2003 dofs(k) =
Trans.Jacobian().InnerProduct(t1, vk2) + t2(1) * vk3(2);
2009 const double *tk_fe)
2031 MFEM_ASSERT(JI.Width() == 2 && JI.Height() == 2,
2032 "ND_R2D_FiniteElement cannot be embedded in " 2033 "3 dimensional spaces");
2034 for (
int i=0; i<
dof; i++)
2036 double sx = shape(i, 0);
2037 double sy = shape(i, 1);
2038 shape(i, 0) = sx * JI(0, 0) + sy * JI(1, 0);
2039 shape(i, 1) = sx * JI(0, 1) + sy * JI(1, 1);
2048 MFEM_ASSERT(J.Width() == 2 && J.Height() == 2,
2049 "ND_R2D_FiniteElement cannot be embedded in " 2050 "3 dimensional spaces");
2051 for (
int i=0; i<
dof; i++)
2053 double sx = curl_shape(i, 0);
2054 double sy = curl_shape(i, 1);
2055 curl_shape(i, 0) = sx * J(0, 0) + sy * J(0, 1);
2056 curl_shape(i, 1) = sx * J(1, 0) + sy * J(1, 1);
2058 curl_shape *= (1.0 /
Trans.Weight());
2061 void ND_R2D_FiniteElement::LocalInterpolation(
2069 #ifdef MFEM_THREAD_SAFE 2075 double * tk_ptr =
const_cast<double*
>(
tk);
2082 for (
int k = 0; k <
dof; k++)
2096 for (
int i = 0; i <
dim; i++)
2098 Ikj +=
vshape(j, i) * vk[i];
2100 Ikj +=
vshape(j, 2) * t3(2);
2101 I(k, j) = (fabs(Ikj) < 1e-12) ? 0.0 : Ikj;
2113 #ifdef MFEM_THREAD_SAFE 2117 double * tk_ptr =
const_cast<double*
>(
tk);
2121 for (
int j = 0; j <
dof; j++)
2131 Jinv.
Mult(t2, pt_data);
2132 for (
int k = 0; k <
dof; k++)
2135 for (
int d = 0; d <
dim; d++)
2137 R_jk +=
vshape(k,d)*pt_data[d];
2139 R_jk +=
vshape(k, 2) * t3(2);
2160 double * tk_ptr =
const_cast<double*
>(
tk);
2162 for (
int k = 0; k <
dof; k++)
2171 dofs(k) =
Trans.Jacobian().InnerProduct(t2, vk2) + t3(2) * vk3(2);
2185 double * tk_ptr =
const_cast<double*
>(
tk);
2188 for (
int k = 0; k <
dof; k++)
2196 Trans.SetIntPoint(&ip);
2199 Trans.Jacobian().Mult(t2, vk);
2203 double w = 1.0/
Trans.Weight();
2204 for (
int d = 0; d <
vdim; d++)
2210 for (
int j = 0; j < shape.Size(); j++)
2212 double s = shape(j);
2213 if (fabs(
s) < 1e-12)
2219 for (
int d = 0; d <
vdim; d++)
2221 I(k, j + d*shape.Size()) =
s*vk[d];
2231 double * tk_ptr =
const_cast<double*
>(
tk);
2234 for (
int k = 0; k <
dof; k++)
2241 Trans.SetIntPoint(&ip);
2244 Trans.Jacobian().Mult(t2, vk);
2251 for (
int i=0; i<2; i++)
2253 I(k, j) +=
vshape(j, i) * vk[i];
2257 I(k, j) +=
vshape(j, 2) * t3(2);
2274 for (
int k = 0; k <
dof; k++)
2278 for (
int j = 0; j < grad_k.Size(); j++)
2280 grad(k,j) = (fabs(grad_k(j)) < 1e-12) ? 0.0 : grad_k(j);
2285 const double ND_R2D_TriangleElement::tk_t[15] =
2286 { 1.,0.,0., -1.,1.,0., 0.,-1.,0., 0.,1.,0., 0.,0.,1. };
2294 int pm1 =
p - 1, pm2 =
p - 2;
2296 #ifndef MFEM_THREAD_SAFE 2312 for (
int e=0; e<3; e++)
2315 for (
int i=0; i<
p; i++)
2320 for (
int i=0; i<pm1; i++)
2327 for (
int j = 0; j <= pm2; j++)
2328 for (
int i = 0; i + j <= pm2; i++)
2335 for (
int j = 0; j < pm1; j++)
2336 for (
int i = 0; i + j < pm2; i++)
2341 MFEM_VERIFY(n == ND_FE.
GetDof(),
2342 "ND_R2D_Triangle incorrect number of ND dofs.");
2343 MFEM_VERIFY(h == H1_FE.
GetDof(),
2344 "ND_R2D_Triangle incorrect number of H1 dofs.");
2345 MFEM_VERIFY(o ==
GetDof(),
2346 "ND_R2D_Triangle incorrect number of dofs.");
2351 for (
int i=0; i<
dof; i++)
2370 #ifdef MFEM_THREAD_SAFE 2378 for (
int i=0; i<
dof; i++)
2383 shape(i, 0) = nd_shape(idx, 0);
2384 shape(i, 1) = nd_shape(idx, 1);
2391 shape(i, 2) = h1_shape(-idx-1);
2399 #ifdef MFEM_THREAD_SAFE 2407 for (
int i=0; i<
dof; i++)
2412 curl_shape(i, 0) = 0.0;
2413 curl_shape(i, 1) = 0.0;
2414 curl_shape(i, 2) = nd_dshape(idx, 0);
2418 curl_shape(i, 0) = h1_dshape(-idx-1, 1);
2419 curl_shape(i, 1) = -h1_dshape(-idx-1, 0);
2420 curl_shape(i, 2) = 0.0;
2426 const double ND_R2D_QuadrilateralElement::tk_q[15] =
2427 { 1.,0.,0., 0.,1.,0., -1.,0.,0., 0.,-1.,0., 0.,0.,1. };
2433 cbasis1d(
poly1d.GetBasis(
p, VerifyClosed(cb_type))),
2434 obasis1d(
poly1d.GetBasis(
p - 1, VerifyOpen(ob_type)))
2438 const int dofx =
p*(
p+1);
2439 const int dofy =
p*(
p+1);
2440 const int dofxy = dofx+dofy;
2442 #ifndef MFEM_THREAD_SAFE 2461 for (
int i = 0; i <
p; i++)
2465 for (
int i = 1; i <
p; i++)
2467 dof_map[dofxy + i + 0*(
p+1)] = o++;
2469 for (
int j = 0; j <
p; j++)
2473 for (
int j = 1; j <
p; j++)
2477 for (
int i = 0; i <
p; i++)
2481 for (
int i = 1; i <
p; i++)
2485 for (
int j = 0; j <
p; j++)
2487 dof_map[dofx + 0 + (
p - 1 - j)*(
p + 1)] = -1 - (o++);
2489 for (
int j = 1; j <
p; j++)
2496 for (
int j = 1; j <
p; j++)
2497 for (
int i = 0; i <
p; i++)
2502 for (
int j = 0; j <
p; j++)
2503 for (
int i = 1; i <
p; i++)
2505 dof_map[dofx + i + j*(
p + 1)] = o++;
2508 for (
int j = 1; j <
p; j++)
2509 for (
int i = 1; i <
p; i++)
2511 dof_map[dofxy + i + j*(
p + 1)] = o++;
2517 for (
int j = 0; j <=
p; j++)
2518 for (
int i = 0; i <
p; i++)
2523 dof2tk[idx = -1 - idx] = 2;
2532 for (
int j = 0; j <
p; j++)
2533 for (
int i = 0; i <=
p; i++)
2538 dof2tk[idx = -1 - idx] = 3;
2547 for (
int j = 0; j <=
p; j++)
2548 for (
int i = 0; i <=
p; i++)
2561 #ifdef MFEM_THREAD_SAFE 2562 Vector shape_cx(
p + 1), shape_ox(
p), shape_cy(
p + 1), shape_oy(
p);
2565 cbasis1d.
Eval(ip.
x, shape_cx);
2566 obasis1d.
Eval(ip.
x, shape_ox);
2567 cbasis1d.
Eval(ip.
y, shape_cy);
2568 obasis1d.
Eval(ip.
y, shape_oy);
2572 for (
int j = 0; j <=
p; j++)
2573 for (
int i = 0; i <
p; i++)
2578 idx = -1 - idx,
s = -1;
2584 shape(idx,0) =
s*shape_ox(i)*shape_cy(j);
2589 for (
int j = 0; j <
p; j++)
2590 for (
int i = 0; i <=
p; i++)
2595 idx = -1 - idx,
s = -1;
2602 shape(idx,1) =
s*shape_cx(i)*shape_oy(j);
2606 for (
int j = 0; j <=
p; j++)
2607 for (
int i = 0; i <=
p; i++)
2612 shape(idx,2) = shape_cx(i)*shape_cy(j);
2621 #ifdef MFEM_THREAD_SAFE 2622 Vector shape_cx(
p + 1), shape_ox(
p), shape_cy(
p + 1), shape_oy(
p);
2623 Vector dshape_cx(
p + 1), dshape_cy(
p + 1);
2626 cbasis1d.
Eval(ip.
x, shape_cx, dshape_cx);
2627 obasis1d.
Eval(ip.
x, shape_ox);
2628 cbasis1d.
Eval(ip.
y, shape_cy, dshape_cy);
2629 obasis1d.
Eval(ip.
y, shape_oy);
2633 for (
int j = 0; j <=
p; j++)
2634 for (
int i = 0; i <
p; i++)
2639 idx = -1 - idx,
s = -1;
2645 curl_shape(idx,0) = 0.;
2646 curl_shape(idx,1) = 0.;
2647 curl_shape(idx,2) = -
s*shape_ox(i)*dshape_cy(j);
2650 for (
int j = 0; j <
p; j++)
2651 for (
int i = 0; i <=
p; i++)
2656 idx = -1 - idx,
s = -1;
2662 curl_shape(idx,0) = 0.;
2663 curl_shape(idx,1) = 0.;
2664 curl_shape(idx,2) =
s*dshape_cx(i)*shape_oy(j);
2667 for (
int j = 0; j <=
p; j++)
2668 for (
int i = 0; i <=
p; i++)
2671 curl_shape(idx,0) = shape_cx(i)*dshape_cy(j);
2672 curl_shape(idx,1) = -dshape_cx(i)*shape_cy(j);
2673 curl_shape(idx,2) = 0.;
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 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...
int GetNPoints() const
Returns the number of the points in the integration rule.
bool IsIntegratedType() const
Returns true if the basis is "integrated", false otherwise.
Class for an integration rule - an Array of IntegrationPoint.
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 ScaleIntegrated(bool scale_integrated_)
Set whether the "integrated" basis should be scaled by the subcell sizes. Has no effect for non-integ...
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.
Base class for vector Coefficients that optionally depend on time and space.
void SetRow(int r, const double *row)
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...
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 Mult(const double *x, double *y) const
Matrix vector multiplication with the inverse of dense matrix.
void SetSize(int s)
Resize the vector to size s.
void ProjectIntegrated(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const
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...
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
int dim
Dimension of reference space.
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...
Data type dense matrix using column-major storage.
double * Data() const
Returns the matrix data array.
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...
void Eval(const double x, Vector &u) const
Evaluate the basis functions at point x in [0,1].
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 ...
Poly_1D::Basis & obasis1d
void Factor()
Factor the current DenseMatrix, *a.
Geometry::Type geom_type
Geometry::Type of the reference element.
void ProjectIntegrated(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const
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...
const double * ClosedPoints(const int p, const int btype=BasisType::GaussLobatto)
Get coordinates of a closed (GaussLegendre) set of points if degree p.
ND_WedgeElement(const int p, const int cb_type=BasisType::GaussLobatto, const int ob_type=BasisType::GaussLegendre)
ND_TriangleElement(const int p)
Construct the ND_TriangleElement of order p.
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
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...
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...
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...
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...
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
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 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...
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 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...
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 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 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...
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...
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...
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_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)
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...
int GetVDim()
Returns dimension of the vector.
void Mult(const double *x, double *y) const
Matrix vector multiplication.
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 double * OpenPoints(const int p, const int btype=BasisType::GaussLegendre)
Get coordinates of an open (GaussLegendre) set of points if degree 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...
void EvalIntegrated(const Vector &d, Vector &i) const
Evaluate the "integrated" basis type using pre-computed closed basis derivatives. ...
void Threshold(double eps)
Replace small entries, abs(a_ij) <= eps, with zero.
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 Set3(const double x1, const double x2, const double x3)
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 GetDim() const
Returns the reference space dimension for the finite element.
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
int GetDof() const
Returns the number of degrees of freedom in the finite element.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
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...
Class for integration point with weight.
int dof
Number of degrees of freedom.
int GetVDim() const
Returns the vector dimension for vector-valued finite elements.
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...
int GetMapType() const
Returns the FiniteElement::MapType of the element describing how reference functions are mapped to ph...
double infinity()
Define a shortcut for std::numeric_limits<double>::infinity()
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 GetLocalRestriction(ElementTransformation &Trans, DenseMatrix &R) const
Return a local restriction matrix R (Dof x Dof) mapping fine dofs to coarse dofs. ...
void InvertLinearTrans(ElementTransformation &trans, const IntegrationPoint &pt, Vector &x)
int GetRangeType() const
Returns the FiniteElement::RangeType of the element, one of {SCALAR, VECTOR}.
virtual void Project(VectorCoefficient &vc, ElementTransformation &Trans, Vector &dofs) const
Given a vector coefficient and a transformation, compute its projection (approximation) in the local ...
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 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...
double u(const Vector &xvec)
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
const IntegrationRule & GetNodes() const
Get a const reference to the nodes of the element.
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...
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...
int order
Order/degree of the shape functions.
Implements CalcCurlShape methods.
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.