16 #include "../coefficient.hpp" 23 const double ND_HexahedronElement::tk[18] =
24 { 1.,0.,0., 0.,1.,0., 0.,0.,1., -1.,0.,0., 0.,-1.,0., 0.,0.,-1. };
27 const int cb_type,
const int ob_type)
30 dof2tk(dof), cp(
poly1d.ClosedPoints(
p, cb_type))
37 const int dof3 =
dof/3;
39 #ifndef MFEM_THREAD_SAFE 53 for (
int i = 0; i <
p; i++)
55 dof_map[0*dof3 + i + (0 + 0*(
p + 1))*
p] = o++;
57 for (
int i = 0; i <
p; i++)
61 for (
int i = 0; i <
p; i++)
65 for (
int i = 0; i <
p; i++)
67 dof_map[1*dof3 + 0 + (i + 0*
p)*(
p + 1)] = o++;
69 for (
int i = 0; i <
p; i++)
73 for (
int i = 0; i <
p; i++)
77 for (
int i = 0; i <
p; i++)
81 for (
int i = 0; i <
p; i++)
85 for (
int i = 0; i <
p; i++)
87 dof_map[2*dof3 + 0 + (0 + i*(
p + 1))*(
p + 1)] = o++;
89 for (
int i = 0; i <
p; i++)
91 dof_map[2*dof3 +
p + (0 + i*(
p + 1))*(
p + 1)] = o++;
93 for (
int i = 0; i <
p; i++)
95 dof_map[2*dof3 +
p + (
p + i*(
p + 1))*(
p + 1)] = o++;
97 for (
int i = 0; i <
p; i++)
99 dof_map[2*dof3 + 0 + (
p + i*(
p + 1))*(
p + 1)] = o++;
104 for (
int j = 1; j <
p; j++)
105 for (
int i = 0; i <
p; i++)
107 dof_map[0*dof3 + i + ((
p - j) + 0*(
p + 1))*
p] = o++;
109 for (
int j = 0; j <
p; j++)
110 for (
int i = 1; i <
p; i++)
112 dof_map[1*dof3 + i + ((
p - 1 - j) + 0*
p)*(
p + 1)] = -1 - (o++);
115 for (
int k = 1; k <
p; k++)
116 for (
int i = 0; i <
p; i++)
118 dof_map[0*dof3 + i + (0 + k*(
p + 1))*
p] = o++;
120 for (
int k = 0; k <
p; k++)
121 for (
int i = 1; i <
p; i++ )
123 dof_map[2*dof3 + i + (0 + k*(
p + 1))*(
p + 1)] = o++;
126 for (
int k = 1; k <
p; k++)
127 for (
int j = 0; j <
p; j++)
129 dof_map[1*dof3 +
p + (j + k*
p)*(
p + 1)] = o++;
131 for (
int k = 0; k <
p; k++)
132 for (
int j = 1; j <
p; j++)
134 dof_map[2*dof3 +
p + (j + k*(
p + 1))*(
p + 1)] = o++;
137 for (
int k = 1; k <
p; k++)
138 for (
int i = 0; i <
p; i++)
140 dof_map[0*dof3 + (
p - 1 - i) + (
p + k*(
p + 1))*
p] = -1 - (o++);
142 for (
int k = 0; k <
p; k++)
143 for (
int i = 1; i <
p; i++)
145 dof_map[2*dof3 + (
p - i) + (
p + k*(
p + 1))*(
p + 1)] = o++;
148 for (
int k = 1; k <
p; k++)
149 for (
int j = 0; j <
p; j++)
151 dof_map[1*dof3 + 0 + ((
p - 1 - j) + k*
p)*(
p + 1)] = -1 - (o++);
153 for (
int k = 0; k <
p; k++)
154 for (
int j = 1; j <
p; j++)
156 dof_map[2*dof3 + 0 + ((
p - j) + k*(
p + 1))*(
p + 1)] = o++;
159 for (
int j = 1; j <
p; j++)
160 for (
int i = 0; i <
p; i++)
162 dof_map[0*dof3 + i + (j +
p*(
p + 1))*
p] = o++;
164 for (
int j = 0; j <
p; j++)
165 for (
int i = 1; i <
p; i++)
167 dof_map[1*dof3 + i + (j +
p*
p)*(
p + 1)] = o++;
172 for (
int k = 1; k <
p; k++)
173 for (
int j = 1; j <
p; j++)
174 for (
int i = 0; i <
p; i++)
176 dof_map[0*dof3 + i + (j + k*(
p + 1))*
p] = o++;
179 for (
int k = 1; k <
p; k++)
180 for (
int j = 0; j <
p; j++)
181 for (
int i = 1; i <
p; i++)
183 dof_map[1*dof3 + i + (j + k*
p)*(
p + 1)] = o++;
186 for (
int k = 0; k <
p; k++)
187 for (
int j = 1; j <
p; j++)
188 for (
int i = 1; i <
p; i++)
190 dof_map[2*dof3 + i + (j + k*(
p + 1))*(
p + 1)] = o++;
196 for (
int k = 0; k <=
p; k++)
197 for (
int j = 0; j <=
p; j++)
198 for (
int i = 0; i <
p; i++)
203 dof2tk[idx = -1 - idx] = 3;
212 for (
int k = 0; k <=
p; k++)
213 for (
int j = 0; j <
p; j++)
214 for (
int i = 0; i <=
p; i++)
219 dof2tk[idx = -1 - idx] = 4;
228 for (
int k = 0; k <
p; k++)
229 for (
int j = 0; j <=
p; j++)
230 for (
int i = 0; i <=
p; i++)
235 dof2tk[idx = -1 - idx] = 5;
259 for (
int c = 0; c < 3; ++c)
265 for (
int k = 0; k <= km; k++)
266 for (
int j = 0; j <= jm; j++)
267 for (
int i = 0; i <= im; i++)
275 const int id1 = c == 0 ? i : (c == 1 ? j : k);
276 const double h = cp[id1+1] - cp[id1];
280 for (
int q = 0; q < nqpt; q++)
286 ip3d.
Set3(cp[i] + (h*ip1d.
x), cp[j], cp[k]);
290 ip3d.
Set3(cp[i], cp[j] + (h*ip1d.
x), cp[k]);
294 ip3d.
Set3(cp[i], cp[j], cp[k] + (h*ip1d.
x));
298 vc.
Eval(xk, Trans, ip3d);
302 val += ip1d.
weight * ipval;
315 #ifdef MFEM_THREAD_SAFE 316 Vector shape_cx(
p + 1), shape_ox(
p), shape_cy(
p + 1), shape_oy(
p);
317 Vector shape_cz(
p + 1), shape_oz(
p);
322 #ifdef MFEM_THREAD_SAFE 323 Vector dshape_cx(
p + 1), dshape_cy(
p + 1), dshape_cz(
p + 1);
345 for (
int k = 0; k <=
p; k++)
346 for (
int j = 0; j <=
p; j++)
347 for (
int i = 0; i <
p; i++)
352 idx = -1 - idx,
s = -1;
358 shape(idx,0) =
s*shape_ox(i)*shape_cy(j)*shape_cz(k);
363 for (
int k = 0; k <=
p; k++)
364 for (
int j = 0; j <
p; j++)
365 for (
int i = 0; i <=
p; i++)
370 idx = -1 - idx,
s = -1;
377 shape(idx,1) =
s*shape_cx(i)*shape_oy(j)*shape_cz(k);
381 for (
int k = 0; k <
p; k++)
382 for (
int j = 0; j <=
p; j++)
383 for (
int i = 0; i <=
p; i++)
388 idx = -1 - idx,
s = -1;
396 shape(idx,2) =
s*shape_cx(i)*shape_cy(j)*shape_oz(k);
405 #ifdef MFEM_THREAD_SAFE 406 Vector shape_cx(
p + 1), shape_ox(
p), shape_cy(
p + 1), shape_oy(
p);
407 Vector shape_cz(
p + 1), shape_oz(
p);
408 Vector dshape_cx(
p + 1), dshape_cy(
p + 1), dshape_cz(
p + 1);
430 for (
int k = 0; k <=
p; k++)
431 for (
int j = 0; j <=
p; j++)
432 for (
int i = 0; i <
p; i++)
437 idx = -1 - idx,
s = -1;
443 curl_shape(idx,0) = 0.;
444 curl_shape(idx,1) =
s*shape_ox(i)* shape_cy(j)*dshape_cz(k);
445 curl_shape(idx,2) = -
s*shape_ox(i)*dshape_cy(j)* shape_cz(k);
448 for (
int k = 0; k <=
p; k++)
449 for (
int j = 0; j <
p; j++)
450 for (
int i = 0; i <=
p; i++)
455 idx = -1 - idx,
s = -1;
461 curl_shape(idx,0) = -
s* shape_cx(i)*shape_oy(j)*dshape_cz(k);
462 curl_shape(idx,1) = 0.;
463 curl_shape(idx,2) =
s*dshape_cx(i)*shape_oy(j)* shape_cz(k);
466 for (
int k = 0; k <
p; k++)
467 for (
int j = 0; j <=
p; j++)
468 for (
int i = 0; i <=
p; i++)
473 idx = -1 - idx,
s = -1;
479 curl_shape(idx,0) =
s* shape_cx(i)*dshape_cy(j)*shape_oz(k);
480 curl_shape(idx,1) = -
s*dshape_cx(i)* shape_cy(j)*shape_oz(k);
481 curl_shape(idx,2) = 0.;
489 const int pp1 =
p + 1;
490 const int n_face_dofs_per_component =
p*pp1;
491 const int n_dof_per_dim =
p*pp1*pp1;
493 std::vector<int> n_dofs = {
p, pp1, pp1,
p};
494 std::vector<int> offsets, strides;
496 const auto f = internal::GetFaceNormal3D(face_id);
497 const int face_normal =
f.first, level =
f.second;
498 if (face_normal == 0)
502 n_dof_per_dim + (level ? pp1 - 1 : 0),
503 2*n_dof_per_dim + (level ? pp1 - 1 : 0)
505 strides = {pp1,
p*pp1, pp1, pp1*pp1};
507 else if (face_normal == 1)
511 level ?
p*(pp1 - 1) : 0,
512 2*n_dof_per_dim + (level ? pp1*(pp1 - 1) : 0)
514 strides = {1,
p*pp1, 1, pp1*pp1};
516 else if (face_normal == 2)
520 level ?
p*pp1*(pp1 - 1) : 0,
521 n_dof_per_dim + (level ?
p*pp1*(pp1 - 1) : 0)
523 strides = {1,
p, 1, pp1};
526 internal::FillFaceMap(n_face_dofs_per_component, offsets, strides, n_dofs,
530 const double ND_QuadrilateralElement::tk[8] =
531 { 1.,0., 0.,1., -1.,0., 0.,-1. };
539 cp(
poly1d.ClosedPoints(
p, cb_type))
546 const int dof2 =
dof/2;
548 #ifndef MFEM_THREAD_SAFE 559 for (
int i = 0; i <
p; i++)
563 for (
int j = 0; j <
p; j++)
567 for (
int i = 0; i <
p; i++)
569 dof_map[0*dof2 + (
p - 1 - i) +
p*
p] = -1 - (o++);
571 for (
int j = 0; j <
p; j++)
573 dof_map[1*dof2 + 0 + (
p - 1 - j)*(
p + 1)] = -1 - (o++);
578 for (
int j = 1; j <
p; j++)
579 for (
int i = 0; i <
p; i++)
584 for (
int j = 0; j <
p; j++)
585 for (
int i = 1; i <
p; i++)
587 dof_map[1*dof2 + i + j*(
p + 1)] = o++;
593 for (
int j = 0; j <=
p; j++)
594 for (
int i = 0; i <
p; i++)
599 dof2tk[idx = -1 - idx] = 2;
608 for (
int j = 0; j <
p; j++)
609 for (
int i = 0; i <=
p; i++)
614 dof2tk[idx = -1 - idx] = 3;
639 for (
int j = 0; j <=
order; j++)
640 for (
int i = 0; i <
order; i++)
648 const double h = cp[i+1] - cp[i];
652 for (
int k = 0; k < nqpt; k++)
656 ip2d.
Set2(cp[i] + (h*ip1d.
x), cp[j]);
659 vc.
Eval(xk, Trans, ip2d);
663 val += ip1d.
weight * ipval;
669 for (
int j = 0; j <
order; j++)
670 for (
int i = 0; i <=
order; i++)
678 const double h = cp[j+1] - cp[j];
682 for (
int k = 0; k < nqpt; k++)
686 ip2d.
Set2(cp[i], cp[j] + (h*ip1d.
x));
689 vc.
Eval(xk, Trans, ip2d);
693 val += ip1d.
weight * ipval;
705 #ifdef MFEM_THREAD_SAFE 706 Vector shape_cx(
p + 1), shape_ox(
p), shape_cy(
p + 1), shape_oy(
p);
711 #ifdef MFEM_THREAD_SAFE 712 Vector dshape_cx(
p + 1), dshape_cy(
p + 1);
730 for (
int j = 0; j <=
p; j++)
731 for (
int i = 0; i <
p; i++)
736 idx = -1 - idx,
s = -1;
742 shape(idx,0) =
s*shape_ox(i)*shape_cy(j);
746 for (
int j = 0; j <
p; j++)
747 for (
int i = 0; i <=
p; i++)
752 idx = -1 - idx,
s = -1;
759 shape(idx,1) =
s*shape_cx(i)*shape_oy(j);
768 #ifdef MFEM_THREAD_SAFE 769 Vector shape_cx(
p + 1), shape_ox(
p), shape_cy(
p + 1), shape_oy(
p);
770 Vector dshape_cx(
p + 1), dshape_cy(
p + 1);
789 for (
int j = 0; j <=
p; j++)
790 for (
int i = 0; i <
p; i++)
795 idx = -1 - idx,
s = -1;
801 curl_shape(idx,0) = -
s*shape_ox(i)*dshape_cy(j);
804 for (
int j = 0; j <
p; j++)
805 for (
int i = 0; i <=
p; i++)
810 idx = -1 - idx,
s = -1;
816 curl_shape(idx,0) =
s*dshape_cx(i)*shape_oy(j);
824 const int pp1 =
order + 1;
825 const int n_face_dofs_per_component =
p;
826 std::vector<int> strides = {(face_id == 0 || face_id == 2) ? 1 : pp1};
827 std::vector<int> n_dofs = {
p};
828 std::vector<int> offsets;
831 case 0: offsets = {0};
break;
832 case 1: offsets = {
p*pp1 + pp1 - 1};
break;
833 case 2: offsets = {
p*(pp1 - 1)};
break;
834 case 3: offsets = {
p*pp1};
break;
836 internal::FillFaceMap(n_face_dofs_per_component, offsets, strides, n_dofs,
841 const double ND_TetrahedronElement::tk[18] =
842 { 1.,0.,0., 0.,1.,0., 0.,0.,1., -1.,1.,0., -1.,0.,1., 0.,-1.,1. };
844 const double ND_TetrahedronElement::c = 1./4.;
854 const int pm1 =
p - 1, pm2 =
p - 2, pm3 =
p - 3;
856 #ifndef MFEM_THREAD_SAFE 867 Vector shape_x(
p), shape_y(
p), shape_z(
p), shape_l(
p);
872 for (
int i = 0; i <
p; i++)
877 for (
int i = 0; i <
p; i++)
882 for (
int i = 0; i <
p; i++)
887 for (
int i = 0; i <
p; i++)
892 for (
int i = 0; i <
p; i++)
897 for (
int i = 0; i <
p; i++)
904 for (
int j = 0; j <= pm2; j++)
905 for (
int i = 0; i + j <= pm2; i++)
907 double w = fop[i] + fop[j] + fop[pm2-i-j];
913 for (
int j = 0; j <= pm2; j++)
914 for (
int i = 0; i + j <= pm2; i++)
916 double w = fop[i] + fop[j] + fop[pm2-i-j];
922 for (
int j = 0; j <= pm2; j++)
923 for (
int i = 0; i + j <= pm2; i++)
925 double w = fop[i] + fop[j] + fop[pm2-i-j];
931 for (
int j = 0; j <= pm2; j++)
932 for (
int i = 0; i + j <= pm2; i++)
934 double w = fop[i] + fop[j] + fop[pm2-i-j];
942 for (
int k = 0; k <= pm3; k++)
943 for (
int j = 0; j + k <= pm3; j++)
944 for (
int i = 0; i + j + k <= pm3; i++)
946 double w = iop[i] + iop[j] + iop[k] + iop[pm3-i-j-k];
956 for (
int m = 0; m <
dof; m++)
959 const double *tm = tk + 3*dof2tk[m];
967 for (
int k = 0; k <= pm1; k++)
968 for (
int j = 0; j + k <= pm1; j++)
969 for (
int i = 0; i + j + k <= pm1; i++)
971 double s = shape_x(i)*shape_y(j)*shape_z(k)*shape_l(pm1-i-j-k);
972 T(o++, m) =
s * tm[0];
973 T(o++, m) =
s * tm[1];
974 T(o++, m) =
s * tm[2];
976 for (
int k = 0; k <= pm1; k++)
977 for (
int j = 0; j + k <= pm1; j++)
979 double s = shape_x(pm1-j-k)*shape_y(j)*shape_z(k);
980 T(o++, m) =
s*((ip.
y - c)*tm[0] - (ip.
x - c)*tm[1]);
981 T(o++, m) =
s*((ip.
z - c)*tm[0] - (ip.
x - c)*tm[2]);
983 for (
int k = 0; k <= pm1; k++)
986 shape_y(pm1-k)*shape_z(k)*((ip.
z - c)*tm[1] - (ip.
y - c)*tm[2]);
997 const int pm1 =
order - 1;
999 #ifdef MFEM_THREAD_SAFE 1001 Vector shape_x(
p), shape_y(
p), shape_z(
p), shape_l(
p);
1011 for (
int k = 0; k <= pm1; k++)
1012 for (
int j = 0; j + k <= pm1; j++)
1013 for (
int i = 0; i + j + k <= pm1; i++)
1015 double s = shape_x(i)*shape_y(j)*shape_z(k)*shape_l(pm1-i-j-k);
1016 u(n,0) =
s;
u(n,1) = 0.;
u(n,2) = 0.; n++;
1017 u(n,0) = 0.;
u(n,1) =
s;
u(n,2) = 0.; n++;
1018 u(n,0) = 0.;
u(n,1) = 0.;
u(n,2) =
s; n++;
1020 for (
int k = 0; k <= pm1; k++)
1021 for (
int j = 0; j + k <= pm1; j++)
1023 double s = shape_x(pm1-j-k)*shape_y(j)*shape_z(k);
1024 u(n,0) =
s*(ip.
y - c);
u(n,1) = -
s*(ip.
x - c);
u(n,2) = 0.; n++;
1025 u(n,0) =
s*(ip.
z - c);
u(n,1) = 0.;
u(n,2) = -
s*(ip.
x - c); n++;
1027 for (
int k = 0; k <= pm1; k++)
1029 double s = shape_y(pm1-k)*shape_z(k);
1030 u(n,0) = 0.;
u(n,1) =
s*(ip.
z - c);
u(n,2) = -
s*(ip.
y - c); n++;
1039 const int pm1 =
order - 1;
1041 #ifdef MFEM_THREAD_SAFE 1043 Vector shape_x(
p), shape_y(
p), shape_z(
p), shape_l(
p);
1044 Vector dshape_x(
p), dshape_y(
p), dshape_z(
p), dshape_l(
p);
1054 for (
int k = 0; k <= pm1; k++)
1055 for (
int j = 0; j + k <= pm1; j++)
1056 for (
int i = 0; i + j + k <= pm1; i++)
1059 const double dx = (dshape_x(i)*shape_l(l) -
1060 shape_x(i)*dshape_l(l))*shape_y(j)*shape_z(k);
1061 const double dy = (dshape_y(j)*shape_l(l) -
1062 shape_y(j)*dshape_l(l))*shape_x(i)*shape_z(k);
1063 const double dz = (dshape_z(k)*shape_l(l) -
1064 shape_z(k)*dshape_l(l))*shape_x(i)*shape_y(j);
1066 u(n,0) = 0.;
u(n,1) = dz;
u(n,2) = -dy; n++;
1067 u(n,0) = -dz;
u(n,1) = 0.;
u(n,2) = dx; n++;
1068 u(n,0) = dy;
u(n,1) = -dx;
u(n,2) = 0.; n++;
1070 for (
int k = 0; k <= pm1; k++)
1071 for (
int j = 0; j + k <= pm1; j++)
1073 int i = pm1 - j - k;
1076 u(n,0) = shape_x(i)*(ip.
x - c)*shape_y(j)*dshape_z(k);
1077 u(n,1) = shape_x(i)*shape_y(j)*(ip.
y - c)*dshape_z(k);
1079 -((dshape_x(i)*(ip.
x - c) + shape_x(i))*shape_y(j)*shape_z(k) +
1080 (dshape_y(j)*(ip.
y - c) + shape_y(j))*shape_x(i)*shape_z(k));
1083 u(n,0) = -shape_x(i)*(ip.
x - c)*dshape_y(j)*shape_z(k);
1084 u(n,1) = (shape_x(i)*shape_y(j)*(dshape_z(k)*(ip.
z - c) + shape_z(k)) +
1085 (dshape_x(i)*(ip.
x - c) + shape_x(i))*shape_y(j)*shape_z(k));
1086 u(n,2) = -shape_x(i)*dshape_y(j)*shape_z(k)*(ip.
z - c);
1089 for (
int k = 0; k <= pm1; k++)
1093 u(n,0) = -((dshape_y(j)*(ip.
y - c) + shape_y(j))*shape_z(k) +
1094 shape_y(j)*(dshape_z(k)*(ip.
z - c) + shape_z(k)));
1099 Ti.
Mult(
u, curl_shape);
1103 const double ND_TriangleElement::tk[8] =
1104 { 1.,0., -1.,1., 0.,-1., 0.,1. };
1106 const double ND_TriangleElement::c = 1./3.;
1111 dof2tk(dof), doftrans(
p)
1116 const int pm1 =
p - 1, pm2 =
p - 2;
1118 #ifndef MFEM_THREAD_SAFE 1128 Vector shape_x(
p), shape_y(
p), shape_l(
p);
1133 for (
int i = 0; i <
p; i++)
1138 for (
int i = 0; i <
p; i++)
1143 for (
int i = 0; i <
p; i++)
1150 for (
int j = 0; j <= pm2; j++)
1151 for (
int i = 0; i + j <= pm2; i++)
1153 double w = iop[i] + iop[j] + iop[pm2-i-j];
1161 for (
int m = 0; m <
dof; m++)
1164 const double *tm = tk + 2*dof2tk[m];
1171 for (
int j = 0; j <= pm1; j++)
1172 for (
int i = 0; i + j <= pm1; i++)
1174 double s = shape_x(i)*shape_y(j)*shape_l(pm1-i-j);
1175 T(n++, m) =
s * tm[0];
1176 T(n++, m) =
s * tm[1];
1178 for (
int j = 0; j <= pm1; j++)
1181 shape_x(pm1-j)*shape_y(j)*((ip.
y - c)*tm[0] - (ip.
x - c)*tm[1]);
1192 const int pm1 =
order - 1;
1194 #ifdef MFEM_THREAD_SAFE 1196 Vector shape_x(
p), shape_y(
p), shape_l(
p);
1205 for (
int j = 0; j <= pm1; j++)
1206 for (
int i = 0; i + j <= pm1; i++)
1208 double s = shape_x(i)*shape_y(j)*shape_l(pm1-i-j);
1209 u(n,0) =
s;
u(n,1) = 0; n++;
1210 u(n,0) = 0;
u(n,1) =
s; n++;
1212 for (
int j = 0; j <= pm1; j++)
1214 double s = shape_x(pm1-j)*shape_y(j);
1215 u(n,0) =
s*(ip.
y - c);
1216 u(n,1) = -
s*(ip.
x - c);
1226 const int pm1 =
order - 1;
1228 #ifdef MFEM_THREAD_SAFE 1230 Vector shape_x(
p), shape_y(
p), shape_l(
p);
1231 Vector dshape_x(
p), dshape_y(
p), dshape_l(
p);
1240 for (
int j = 0; j <= pm1; j++)
1241 for (
int i = 0; i + j <= pm1; i++)
1244 const double dx = (dshape_x(i)*shape_l(l) -
1245 shape_x(i)*dshape_l(l)) * shape_y(j);
1246 const double dy = (dshape_y(j)*shape_l(l) -
1247 shape_y(j)*dshape_l(l)) * shape_x(i);
1253 for (
int j = 0; j <= pm1; j++)
1257 curlu(n++) = -((dshape_x(i)*(ip.
x - c) + shape_x(i)) * shape_y(j) +
1258 (dshape_y(j)*(ip.
y - c) + shape_y(j)) * shape_x(i));
1262 Ti.
Mult(curlu, curl2d);
1266 const double ND_SegmentElement::tk[1] = { 1. };
1278 for (
int i = 0; i <
p; i++)
1293 const double ND_WedgeElement::tk[15] =
1294 { 1.,0.,0., -1.,1.,0., 0.,-1.,0., 0.,0.,1., 0.,1.,0. };
1300 3 *
p * ((
p + 1) * (
p + 2))/2,
p,
1306 H1TriangleFE(
p, cb_type),
1308 H1SegmentFE(
p, cb_type),
1309 NDSegmentFE(
p, ob_type)
1311 MFEM_ASSERT(H1TriangleFE.
GetDof() * NDSegmentFE.
GetDof() +
1313 "Mismatch in number of degrees of freedom " 1314 "when building ND_WedgeElement!");
1316 #ifndef MFEM_THREAD_SAFE 1326 const int pm1 =
p - 1, pm2 =
p - 2;
1335 for (
int i = 0; i <
p; i++)
1337 t_dof[o] = i; s_dof[o] = 0; dof2tk[o] = 0;
1342 for (
int i = 0; i <
p; i++)
1344 t_dof[o] =
p + i; s_dof[o] = 0; dof2tk[o] = 1;
1349 for (
int i = 0; i <
p; i++)
1351 t_dof[o] = 2 *
p + i; s_dof[o] = 0; dof2tk[o] = 2;
1356 for (
int i = 0; i <
p; i++)
1358 t_dof[o] = i; s_dof[o] = 1; dof2tk[o] = 0;
1363 for (
int i = 0; i <
p; i++)
1365 t_dof[o] =
p + i; s_dof[o] = 1; dof2tk[o] = 1;
1370 for (
int i = 0; i <
p; i++)
1372 t_dof[o] = 2 *
p + i; s_dof[o] = 1; dof2tk[o] = 2;
1377 for (
int i = 0; i <
p; i++)
1379 t_dof[o] = 0; s_dof[o] = i; dof2tk[o] = 3;
1384 for (
int i = 0; i <
p; i++)
1386 t_dof[o] = 1; s_dof[o] = i; dof2tk[o] = 3;
1391 for (
int i = 0; i <
p; i++)
1393 t_dof[o] = 2; s_dof[o] = i; dof2tk[o] = 3;
1402 for (
int j = 0; j <= pm2; j++)
1403 for (
int i = 0; i + j <= pm2; i++)
1405 l = j + ( 2 *
p - 1 - i) * i / 2;
1406 t_dof[o] = 3 *
p + 2*l+1; s_dof[o] = 0; dof2tk[o] = 4;
1410 t_dof[o] = 3 *
p + 2*l; s_dof[o] = 0; dof2tk[o] = 0;
1417 for (
int j = 0; j <= pm2; j++)
1418 for (
int i = 0; i + j <= pm2; i++)
1420 t_dof[o] = 3 *
p + m; s_dof[o] = 1; dof2tk[o] = 0; m++;
1424 t_dof[o] = 3 *
p + m; s_dof[o] = 1; dof2tk[o] = 4; m++;
1430 for (
int j = 2; j <=
p; j++)
1431 for (
int i = 0; i <
p; i++)
1433 t_dof[o] = i; s_dof[o] = j; dof2tk[o] = 0;
1438 for (
int j = 0; j <
p; j++)
1439 for (
int i = 0; i < pm1; i++)
1441 t_dof[o] = 3 + i; s_dof[o] = j; dof2tk[o] = 3;
1447 for (
int j = 2; j <=
p; j++)
1448 for (
int i = 0; i <
p; i++)
1450 t_dof[o] =
p + i; s_dof[o] = j; dof2tk[o] = 1;
1455 for (
int j = 0; j <
p; j++)
1456 for (
int i = 0; i < pm1; i++)
1458 t_dof[o] =
p + 2 + i; s_dof[o] = j; dof2tk[o] = 3;
1464 for (
int j = 2; j <=
p; j++)
1465 for (
int i = 0; i <
p; i++)
1467 t_dof[o] = 2 *
p + i; s_dof[o] = j; dof2tk[o] = 2;
1472 for (
int j = 0; j <
p; j++)
1473 for (
int i = 0; i < pm1; i++)
1475 t_dof[o] = 2 *
p + 1 + i; s_dof[o] = j; dof2tk[o] = 3;
1482 for (
int k = 2; k <=
p; k++)
1485 for (
int j = 0; j <= pm2; j++)
1486 for (
int i = 0; i + j <= pm2; i++)
1488 t_dof[o] = 3 *
p + l; s_dof[o] = k; dof2tk[o] = 0; l++;
1492 t_dof[o] = 3 *
p + l; s_dof[o] = k; dof2tk[o] = 4; l++;
1498 for (
int k = 0; k <
p; k++)
1501 for (
int j = 0; j < pm2; j++)
1502 for (
int i = 0; i + j < pm2; i++)
1504 t_dof[o] = 3 *
p + l; s_dof[o] = k; dof2tk[o] = 3; l++;
1515 #ifdef MFEM_THREAD_SAFE 1529 for (
int i=0; i<
dof; i++)
1531 if ( dof2tk[i] != 3 )
1533 shape(i, 0) = tn_shape(t_dof[i], 0) * s1_shape[s_dof[i]];
1534 shape(i, 1) = tn_shape(t_dof[i], 1) * s1_shape[s_dof[i]];
1541 shape(i, 2) = t1_shape[t_dof[i]] * sn_shape(s_dof[i], 0);
1549 #ifdef MFEM_THREAD_SAFE 1567 for (
int i=0; i<
dof; i++)
1569 if ( dof2tk[i] != 3 )
1571 curl_shape(i, 0) = -tn_shape(t_dof[i], 1) * s1_dshape(s_dof[i], 0);
1572 curl_shape(i, 1) = tn_shape(t_dof[i], 0) * s1_dshape(s_dof[i], 0);
1573 curl_shape(i, 2) = tn_dshape(t_dof[i], 0) * s1_shape[s_dof[i]];
1577 curl_shape(i, 0) = t1_dshape(t_dof[i], 1) * sn_shape(s_dof[i], 0);
1578 curl_shape(i, 1) = -t1_dshape(t_dof[i], 0) * sn_shape(s_dof[i], 0);
1579 curl_shape(i, 2) = 0.0;
1611 const double ND_R1D_SegmentElement::tk[9] = { 1.,0.,0., 0.,1.,0., 0.,0.,1. };
1619 cbasis1d(
poly1d.GetBasis(
p, VerifyClosed(cb_type))),
1620 obasis1d(
poly1d.GetBasis(
p - 1, VerifyOpen(ob_type)))
1634 #ifndef MFEM_THREAD_SAFE 1646 dof_map[
p] = o; dof2tk[o++] = 1;
1648 dof_map[2*
p+1] = o; dof2tk[o++] = 2;
1652 dof_map[2*
p] = o; dof2tk[o++] = 1;
1654 dof_map[3*
p+1] = o; dof2tk[o++] = 2;
1658 for (
int i = 0; i <
p; i++)
1661 dof_map[i] = o; dof2tk[o++] = 0;
1664 for (
int i = 1; i <
p; i++)
1667 dof_map[
p+i] = o; dof2tk[o++] = 1;
1670 for (
int i = 1; i <
p; i++)
1673 dof_map[2*
p+1+i] = o; dof2tk[o++] = 2;
1682 #ifdef MFEM_THREAD_SAFE 1683 Vector shape_cx(
p + 1), shape_ox(
p);
1686 cbasis1d.
Eval(ip.
x, shape_cx);
1687 obasis1d.
Eval(ip.
x, shape_ox);
1691 for (
int i = 0; i <
p; i++)
1693 int idx = dof_map[o++];
1694 shape(idx,0) = shape_ox(i);
1699 for (
int i = 0; i <=
p; i++)
1701 int idx = dof_map[o++];
1703 shape(idx,1) = shape_cx(i);
1707 for (
int i = 0; i <=
p; i++)
1709 int idx = dof_map[o++];
1712 shape(idx,2) = shape_cx(i);
1721 MFEM_ASSERT(JI.Width() == 1 && JI.Height() == 1,
1722 "ND_R1D_SegmentElement cannot be embedded in " 1723 "2 or 3 dimensional spaces");
1724 for (
int i=0; i<
dof; i++)
1726 shape(i, 0) *= JI(0,0);
1735 #ifdef MFEM_THREAD_SAFE 1736 Vector shape_cx(
p + 1), shape_ox(
p);
1740 cbasis1d.
Eval(ip.
x, shape_cx, dshape_cx);
1741 obasis1d.
Eval(ip.
x, shape_ox);
1745 for (
int i = 0; i <
p; i++)
1747 int idx = dof_map[o++];
1748 curl_shape(idx,0) = 0.;
1749 curl_shape(idx,1) = 0.;
1750 curl_shape(idx,2) = 0.;
1753 for (
int i = 0; i <=
p; i++)
1755 int idx = dof_map[o++];
1756 curl_shape(idx,0) = 0.;
1757 curl_shape(idx,1) = 0.;
1758 curl_shape(idx,2) = dshape_cx(i);
1761 for (
int i = 0; i <=
p; i++)
1763 int idx = dof_map[o++];
1764 curl_shape(idx,0) = 0.;
1765 curl_shape(idx,1) = -dshape_cx(i);
1766 curl_shape(idx,2) = 0.;
1775 MFEM_ASSERT(J.Width() == 1 && J.Height() == 1,
1776 "ND_R1D_SegmentElement cannot be embedded in " 1777 "2 or 3 dimensional spaces");
1778 curl_shape *= (1.0 / J.Weight());
1788 for (
int k = 0; k <
dof; k++)
1794 Vector t(const_cast<double*>(&tk[dof2tk[k] * 3]), 3);
1795 dofs(k) = Trans.
Jacobian()(0,0) *
t(0) * vk(0) +
1796 t(1) * vk(1) +
t(2) * vk(2);
1810 double * tk_ptr =
const_cast<double*
>(tk);
1813 for (
int k = 0; k <
dof; k++)
1817 Vector t1(&tk_ptr[dof2tk[k] * 3], 1);
1818 Vector t3(&tk_ptr[dof2tk[k] * 3], 3);
1829 double w = 1.0/Trans.
Weight();
1830 for (
int d = 0; d <
vdim; d++)
1836 for (
int j = 0; j < shape.Size(); j++)
1838 double s = shape(j);
1839 if (fabs(
s) < 1e-12)
1845 for (
int d = 0; d <
vdim; d++)
1847 I(k, j + d*shape.Size()) =
s*vk[d];
1857 double * tk_ptr =
const_cast<double*
>(tk);
1860 for (
int k = 0; k <
dof; k++)
1864 Vector t1(&tk_ptr[dof2tk[k] * 3], 1);
1865 Vector t3(&tk_ptr[dof2tk[k] * 3], 3);
1877 I(k, j) +=
vshape(j, 0) * vk[0];
1880 I(k, j) +=
vshape(j, 1) * t3(1);
1881 I(k, j) +=
vshape(j, 2) * t3(2);
1888 const double ND_R2D_SegmentElement::tk[4] = { 1.,0., 0.,1. };
1896 cbasis1d(
poly1d.GetBasis(
p, VerifyClosed(cb_type))),
1897 obasis1d(
poly1d.GetBasis(
p - 1, VerifyOpen(ob_type)))
1906 #ifndef MFEM_THREAD_SAFE 1918 dof_map[
p] = o; dof2tk[o++] = 1;
1922 dof_map[2*
p] = o; dof2tk[o++] = 1;
1926 for (
int i = 0; i <
p; i++)
1929 dof_map[i] = o; dof2tk[o++] = 0;
1932 for (
int i = 1; i <
p; i++)
1935 dof_map[
p+i] = o; dof2tk[o++] = 1;
1944 #ifdef MFEM_THREAD_SAFE 1945 Vector shape_cx(
p + 1), shape_ox(
p);
1948 cbasis1d.
Eval(ip.
x, shape_cx);
1949 obasis1d.
Eval(ip.
x, shape_ox);
1953 for (
int i = 0; i <
p; i++)
1955 int idx = dof_map[o++];
1956 shape(idx,0) = shape_ox(i);
1960 for (
int i = 0; i <=
p; i++)
1962 int idx = dof_map[o++];
1964 shape(idx,1) = shape_cx(i);
1973 MFEM_ASSERT(JI.Width() == 1 && JI.Height() == 1,
1974 "ND_R2D_SegmentElement cannot be embedded in " 1975 "2 or 3 dimensional spaces");
1976 for (
int i=0; i<
dof; i++)
1978 shape(i, 0) *= JI(0,0);
1987 #ifdef MFEM_THREAD_SAFE 1988 Vector shape_cx(
p + 1), shape_ox(
p);
1992 cbasis1d.
Eval(ip.
x, shape_cx, dshape_cx);
1993 obasis1d.
Eval(ip.
x, shape_ox);
1997 for (
int i = 0; i <
p; i++)
1999 int idx = dof_map[o++];
2000 curl_shape(idx,0) = 0.;
2003 for (
int i = 0; i <=
p; i++)
2005 int idx = dof_map[o++];
2006 curl_shape(idx,0) = -dshape_cx(i);
2019 double * tk_ptr =
const_cast<double*
>(tk);
2026 for (
int k = 0; k <
dof; k++)
2028 Vector t1(&tk_ptr[dof2tk[k] * 2], 1);
2029 Vector t2(&tk_ptr[dof2tk[k] * 2], 2);
2040 for (
int i = 0; i <
dim; i++)
2042 Ikj +=
vshape(j, i) * vk[i];
2044 Ikj +=
vshape(j, 1) * t2(1);
2045 I(k, j) = (fabs(Ikj) < 1e-12) ? 0.0 : Ikj;
2059 double * tk_ptr =
const_cast<double*
>(tk);
2061 for (
int k = 0; k <
dof; k++)
2067 Vector t1(&tk_ptr[dof2tk[k] * 2], 1);
2068 Vector t2(&tk_ptr[dof2tk[k] * 2], 2);
2076 const double *tk_fe)
2098 MFEM_ASSERT(JI.Width() == 2 && JI.Height() == 2,
2099 "ND_R2D_FiniteElement cannot be embedded in " 2100 "3 dimensional spaces");
2101 for (
int i=0; i<
dof; i++)
2103 double sx = shape(i, 0);
2104 double sy = shape(i, 1);
2105 shape(i, 0) = sx * JI(0, 0) + sy * JI(1, 0);
2106 shape(i, 1) = sx * JI(0, 1) + sy * JI(1, 1);
2115 MFEM_ASSERT(J.Width() == 2 && J.Height() == 2,
2116 "ND_R2D_FiniteElement cannot be embedded in " 2117 "3 dimensional spaces");
2118 for (
int i=0; i<
dof; i++)
2120 double sx = curl_shape(i, 0);
2121 double sy = curl_shape(i, 1);
2122 curl_shape(i, 0) = sx * J(0, 0) + sy * J(0, 1);
2123 curl_shape(i, 1) = sx * J(1, 0) + sy * J(1, 1);
2125 curl_shape *= (1.0 / Trans.
Weight());
2128 void ND_R2D_FiniteElement::LocalInterpolation(
2136 #ifdef MFEM_THREAD_SAFE 2142 double * tk_ptr =
const_cast<double*
>(
tk);
2149 for (
int k = 0; k <
dof; k++)
2163 for (
int i = 0; i <
dim; i++)
2165 Ikj +=
vshape(j, i) * vk[i];
2167 Ikj +=
vshape(j, 2) * t3(2);
2168 I(k, j) = (fabs(Ikj) < 1e-12) ? 0.0 : Ikj;
2180 #ifdef MFEM_THREAD_SAFE 2184 double * tk_ptr =
const_cast<double*
>(
tk);
2188 for (
int j = 0; j <
dof; j++)
2198 Jinv.
Mult(t2, pt_data);
2199 for (
int k = 0; k <
dof; k++)
2202 for (
int d = 0; d <
dim; d++)
2204 R_jk +=
vshape(k,d)*pt_data[d];
2206 R_jk +=
vshape(k, 2) * t3(2);
2227 double * tk_ptr =
const_cast<double*
>(
tk);
2229 for (
int k = 0; k <
dof; k++)
2252 double * tk_ptr =
const_cast<double*
>(
tk);
2255 for (
int k = 0; k <
dof; k++)
2270 double w = 1.0/Trans.
Weight();
2271 for (
int d = 0; d <
vdim; d++)
2277 for (
int j = 0; j < shape.Size(); j++)
2279 double s = shape(j);
2280 if (fabs(
s) < 1e-12)
2286 for (
int d = 0; d <
vdim; d++)
2288 I(k, j + d*shape.Size()) =
s*vk[d];
2298 double * tk_ptr =
const_cast<double*
>(
tk);
2301 for (
int k = 0; k <
dof; k++)
2318 for (
int i=0; i<2; i++)
2320 I(k, j) +=
vshape(j, i) * vk[i];
2324 I(k, j) +=
vshape(j, 2) * t3(2);
2341 for (
int k = 0; k <
dof; k++)
2345 for (
int j = 0; j < grad_k.Size(); j++)
2347 grad(k,j) = (fabs(grad_k(j)) < 1e-12) ? 0.0 : grad_k(j);
2352 const double ND_R2D_TriangleElement::tk_t[15] =
2353 { 1.,0.,0., -1.,1.,0., 0.,-1.,0., 0.,1.,0., 0.,0.,1. };
2361 int pm1 =
p - 1, pm2 =
p - 2;
2363 #ifndef MFEM_THREAD_SAFE 2379 for (
int e=0; e<3; e++)
2382 for (
int i=0; i<
p; i++)
2387 for (
int i=0; i<pm1; i++)
2394 for (
int j = 0; j <= pm2; j++)
2395 for (
int i = 0; i + j <= pm2; i++)
2402 for (
int j = 0; j < pm1; j++)
2403 for (
int i = 0; i + j < pm2; i++)
2408 MFEM_VERIFY(n == ND_FE.
GetDof(),
2409 "ND_R2D_Triangle incorrect number of ND dofs.");
2410 MFEM_VERIFY(h == H1_FE.
GetDof(),
2411 "ND_R2D_Triangle incorrect number of H1 dofs.");
2412 MFEM_VERIFY(o ==
GetDof(),
2413 "ND_R2D_Triangle incorrect number of dofs.");
2418 for (
int i=0; i<
dof; i++)
2437 #ifdef MFEM_THREAD_SAFE 2445 for (
int i=0; i<
dof; i++)
2450 shape(i, 0) = nd_shape(idx, 0);
2451 shape(i, 1) = nd_shape(idx, 1);
2458 shape(i, 2) = h1_shape(-idx-1);
2466 #ifdef MFEM_THREAD_SAFE 2474 for (
int i=0; i<
dof; i++)
2479 curl_shape(i, 0) = 0.0;
2480 curl_shape(i, 1) = 0.0;
2481 curl_shape(i, 2) = nd_dshape(idx, 0);
2485 curl_shape(i, 0) = h1_dshape(-idx-1, 1);
2486 curl_shape(i, 1) = -h1_dshape(-idx-1, 0);
2487 curl_shape(i, 2) = 0.0;
2493 const double ND_R2D_QuadrilateralElement::tk_q[15] =
2494 { 1.,0.,0., 0.,1.,0., -1.,0.,0., 0.,-1.,0., 0.,0.,1. };
2500 cbasis1d(
poly1d.GetBasis(
p, VerifyClosed(cb_type))),
2501 obasis1d(
poly1d.GetBasis(
p - 1, VerifyOpen(ob_type)))
2505 const int dofx =
p*(
p+1);
2506 const int dofy =
p*(
p+1);
2507 const int dofxy = dofx+dofy;
2509 #ifndef MFEM_THREAD_SAFE 2528 for (
int i = 0; i <
p; i++)
2532 for (
int i = 1; i <
p; i++)
2534 dof_map[dofxy + i + 0*(
p+1)] = o++;
2536 for (
int j = 0; j <
p; j++)
2540 for (
int j = 1; j <
p; j++)
2544 for (
int i = 0; i <
p; i++)
2548 for (
int i = 1; i <
p; i++)
2552 for (
int j = 0; j <
p; j++)
2554 dof_map[dofx + 0 + (
p - 1 - j)*(
p + 1)] = -1 - (o++);
2556 for (
int j = 1; j <
p; j++)
2563 for (
int j = 1; j <
p; j++)
2564 for (
int i = 0; i <
p; i++)
2569 for (
int j = 0; j <
p; j++)
2570 for (
int i = 1; i <
p; i++)
2572 dof_map[dofx + i + j*(
p + 1)] = o++;
2575 for (
int j = 1; j <
p; j++)
2576 for (
int i = 1; i <
p; i++)
2578 dof_map[dofxy + i + j*(
p + 1)] = o++;
2584 for (
int j = 0; j <=
p; j++)
2585 for (
int i = 0; i <
p; i++)
2590 dof2tk[idx = -1 - idx] = 2;
2599 for (
int j = 0; j <
p; j++)
2600 for (
int i = 0; i <=
p; i++)
2605 dof2tk[idx = -1 - idx] = 3;
2614 for (
int j = 0; j <=
p; j++)
2615 for (
int i = 0; i <=
p; i++)
2628 #ifdef MFEM_THREAD_SAFE 2629 Vector shape_cx(
p + 1), shape_ox(
p), shape_cy(
p + 1), shape_oy(
p);
2632 cbasis1d.
Eval(ip.
x, shape_cx);
2633 obasis1d.
Eval(ip.
x, shape_ox);
2634 cbasis1d.
Eval(ip.
y, shape_cy);
2635 obasis1d.
Eval(ip.
y, shape_oy);
2639 for (
int j = 0; j <=
p; j++)
2640 for (
int i = 0; i <
p; i++)
2645 idx = -1 - idx,
s = -1;
2651 shape(idx,0) =
s*shape_ox(i)*shape_cy(j);
2656 for (
int j = 0; j <
p; j++)
2657 for (
int i = 0; i <=
p; i++)
2662 idx = -1 - idx,
s = -1;
2669 shape(idx,1) =
s*shape_cx(i)*shape_oy(j);
2673 for (
int j = 0; j <=
p; j++)
2674 for (
int i = 0; i <=
p; i++)
2679 shape(idx,2) = shape_cx(i)*shape_cy(j);
2688 #ifdef MFEM_THREAD_SAFE 2689 Vector shape_cx(
p + 1), shape_ox(
p), shape_cy(
p + 1), shape_oy(
p);
2690 Vector dshape_cx(
p + 1), dshape_cy(
p + 1);
2693 cbasis1d.
Eval(ip.
x, shape_cx, dshape_cx);
2694 obasis1d.
Eval(ip.
x, shape_ox);
2695 cbasis1d.
Eval(ip.
y, shape_cy, dshape_cy);
2696 obasis1d.
Eval(ip.
y, shape_oy);
2700 for (
int j = 0; j <=
p; j++)
2701 for (
int i = 0; i <
p; i++)
2706 idx = -1 - idx,
s = -1;
2712 curl_shape(idx,0) = 0.;
2713 curl_shape(idx,1) = 0.;
2714 curl_shape(idx,2) = -
s*shape_ox(i)*dshape_cy(j);
2717 for (
int j = 0; j <
p; j++)
2718 for (
int i = 0; i <=
p; i++)
2723 idx = -1 - idx,
s = -1;
2729 curl_shape(idx,0) = 0.;
2730 curl_shape(idx,1) = 0.;
2731 curl_shape(idx,2) =
s*dshape_cx(i)*shape_oy(j);
2734 for (
int j = 0; j <=
p; j++)
2735 for (
int i = 0; i <=
p; i++)
2738 curl_shape(idx,0) = shape_cx(i)*dshape_cy(j);
2739 curl_shape(idx,1) = -dshape_cx(i)*shape_cy(j);
2740 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...
std::function< double(const Vector &)> f(double mass_coeff)
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.
double InnerProduct(const double *x, const double *y) const
Compute y^t A x.
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.
virtual void GetFaceMap(const int face_id, Array< int > &face_map) const
Return the mapping from lexicographic face DOFs to lexicographic element DOFs for the given local fac...
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. ...
virtual void GetFaceMap(const int face_id, Array< int > &face_map) const
Return the mapping from lexicographic face DOFs to lexicographic element DOFs for the given local fac...
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.