17#define snprintf _snprintf_s
34 if (fe !=
nullptr) {
break; }
113 MFEM_ABORT(
"unknown geometry type");
120 MFEM_ABORT(
"this method is not implemented in this derived class!");
128 if (!strcmp(name,
"Linear"))
132 else if (!strcmp(name,
"Quadratic"))
136 else if (!strcmp(name,
"QuadraticPos"))
140 else if (!strcmp(name,
"Cubic"))
144 else if (!strcmp(name,
"Const3D"))
148 else if (!strcmp(name,
"Const2D"))
152 else if (!strcmp(name,
"LinearDiscont2D"))
156 else if (!strcmp(name,
"GaussLinearDiscont2D"))
160 else if (!strcmp(name,
"P1OnQuad"))
164 else if (!strcmp(name,
"QuadraticDiscont2D"))
168 else if (!strcmp(name,
"QuadraticPosDiscont2D"))
172 else if (!strcmp(name,
"GaussQuadraticDiscont2D"))
176 else if (!strcmp(name,
"CubicDiscont2D"))
180 else if (!strcmp(name,
"LinearDiscont3D"))
184 else if (!strcmp(name,
"QuadraticDiscont3D"))
188 else if (!strcmp(name,
"LinearNonConf3D"))
192 else if (!strcmp(name,
"CrouzeixRaviart"))
196 else if (!strcmp(name,
"ND1_3D"))
200 else if (!strcmp(name,
"RT0_2D"))
204 else if (!strcmp(name,
"RT1_2D"))
208 else if (!strcmp(name,
"RT2_2D"))
212 else if (!strcmp(name,
"RT0_3D"))
216 else if (!strcmp(name,
"RT1_3D"))
220 else if (!strncmp(name,
"H1_Trace_", 9))
224 else if (!strncmp(name,
"H1_Trace@", 9))
229 else if (!strncmp(name,
"H1_", 3))
232 const char *pyr = strstr(name,
"Pyr");
245 else if (!strncmp(name,
"H1Pos_Trace_", 12))
250 else if (!strncmp(name,
"H1Pos_", 6))
254 else if (!strncmp(name,
"H1Ser_", 6))
258 else if (!strncmp(name,
"H1@", 3))
261 const char *pyr = strstr(name,
"Pyr");
276 else if (!strncmp(name,
"L2", 2))
279 const int mtype = strstr(name,
"Int") == NULL ?
283 const int p = atoi(strstr(name,
"_P") + 2);
286 const int dim = atoi(strstr(name,
"D") - 1);
289 const char *t = strstr(name,
"_T");
293 const char *pyr = strstr(name,
"Pyr");
294 const int ptype = pyr == NULL ? 1 : atoi(pyr + 3);
299 else if (!strncmp(name,
"RT_Trace_", 9))
303 else if (!strncmp(name,
"RT_ValTrace_", 12))
308 else if (!strncmp(name,
"RT_Trace@", 9))
314 else if (!strncmp(name,
"RT_ValTrace@", 12))
320 else if (!strncmp(name,
"DG_Iface_", 9))
324 else if (!strncmp(name,
"DG_Iface@", 9))
330 else if (!strncmp(name,
"DG_IntIface_", 12))
335 else if (!strncmp(name,
"DG_IntIface@", 12))
341 else if (!strncmp(name,
"RT_R1D_", 7))
345 else if (!strncmp(name,
"RT_R1D@", 7))
351 else if (!strncmp(name,
"RT_R2D_", 7))
355 else if (!strncmp(name,
"RT_R2D@", 7))
361 else if (!strncmp(name,
"RT_", 3))
365 else if (!strncmp(name,
"RT@", 3))
371 else if (!strncmp(name,
"ND_Trace_", 9))
375 else if (!strncmp(name,
"ND_Trace@", 9))
381 else if (!strncmp(name,
"ND_R1D_", 7))
385 else if (!strncmp(name,
"ND_R1D@", 7))
391 else if (!strncmp(name,
"ND_R2D_", 7))
395 else if (!strncmp(name,
"ND_R2D@", 7))
401 else if (!strncmp(name,
"ND_", 3))
405 else if (!strncmp(name,
"ND@", 3))
411 else if (!strncmp(name,
"Local_", 6))
415 else if (!strncmp(name,
"NURBS_HDiv", 10))
417 if (name[10] !=
'\0')
428 else if (!strncmp(name,
"NURBS_HCurl", 11))
430 if (name[11] !=
'\0')
441 else if (!strncmp(name,
"NURBS", 5))
456 MFEM_ABORT(
"unknown FiniteElementCollection: " << name);
465 MFEM_ABORT(
"Collection " <<
Name() <<
" does not support variable orders.");
487template <Geometry::Type geom>
492 nv = g_consts::NumVert;
493 ne = g_consts::NumEdges;
496template <Geometry::Type geom,
typename v_t>
498GetEdge(
int &nv, v_t &v,
int &ne,
int &e,
int &eo,
const int edge_info)
503 nv = e_consts::NumVert;
507 MFEM_ASSERT(0 <= e && e < g_consts::NumEdges,
"");
508 MFEM_ASSERT(0 <= eo && eo < e_consts::NumOrient,
"");
509 v[0] = e_consts::Orient[eo][0];
510 v[1] = e_consts::Orient[eo][1];
511 v[0] = g_consts::Edges[e][v[0]];
512 v[1] = g_consts::Edges[e][v[1]];
516 typename v_t,
typename e_t,
typename eo_t>
518GetFace(
int &nv, v_t &v,
int &ne, e_t &e, eo_t &eo,
524 nv = f_consts::NumVert;
529 MFEM_ASSERT(0 <=
f &&
f < g_consts::NumFaces,
"");
530 MFEM_ASSERT(0 <= fo && fo < f_consts::NumOrient,
"");
531 for (
int i = 0; i < f_consts::NumVert; i++)
533 v[i] = f_consts::Orient[fo][i];
534 v[i] = g_consts::FaceVert[
f][v[i]];
536 ne = f_consts::NumEdges;
537 for (
int i = 0; i < f_consts::NumEdges; i++)
539 int v0 = v[f_consts::Edges[i][0]];
540 int v1 = v[f_consts::Edges[i][1]];
542 if (v0 > v1) { std::swap(v0, v1); eor = 1; }
543 for (
int j = g_consts::VertToVert::I[v0];
true; j++)
545 MFEM_ASSERT(j < g_consts::VertToVert::I[v0+1],
546 "internal error, edge not found");
547 if (v1 == g_consts::VertToVert::J[j][0])
549 int en = g_consts::VertToVert::J[j][1];
569 "invalid Geom = " << Geom);
571 "invalid SDim = " << SDim <<
577 const int off = nvd*(Info/64);
579 for (
int i = 0; i < nvd; i++)
586 int v[4], e[4], eo[4],
f[1], fo[1];
587 int av = 0, nv = 0, ae = 0, ne = 0, nf = 0;
609 nv, v, ne, e, eo, nf,
f[0], fg[0], fo[0], Info);
627 nv, v, ne, e, eo, nf,
f[0], fg[0], fo[0], Info);
645 nv, v, ne, e, eo, nf,
f[0], fg[0], fo[0], Info);
663 nv, v, ne, e, eo, nf,
f[0], fg[0], fo[0], Info);
672 MFEM_ABORT(
"invalid Geom = " << Geom);
679 for (
int i = 0; i < nv; i++)
681 for (
int j = 0; j < nvd; j++)
683 dofs[i*nvd+j] = v[i]*nvd+j;
686 int l_off = nv*nvd, g_off = av*nvd;
691 for (
int i = 0; i < ne; i++)
695 for (
int j = 0; j < ned; j++)
697 dofs[l_off+i*ned+j] =
699 g_off+e[i]*ned+ed[j] :
700 -1-(g_off+e[i]*ned+(-1-ed[j]));
712 for (
int i = 0; i < nf; i++)
715 for (
int j = 0; j < nfd; j++)
717 dofs[l_off+i*nfd+j] =
719 g_off+
f[i]*nfd+fd[j] :
720 -1-(g_off+
f[i]*nfd+(-1-fd[j]));
731 ", SDim = " << SDim <<
" is not supported");
749 mfem_error (
"LinearFECollection: unknown geometry type.");
767 mfem_error (
"LinearFECollection: unknown geometry type.");
793 mfem_error (
"QuadraticFECollection: unknown geometry type.");
810 mfem_error (
"QuadraticFECollection: unknown geometry type.");
818 static int indexes[] = { 0 };
834 mfem_error (
"QuadraticPosFECollection: unknown geometry type.");
847 mfem_error (
"QuadraticPosFECollection: unknown geometry type.");
855 static int indexes[] = { 0 };
875 mfem_error (
"CubicFECollection: unknown geometry type.");
892 mfem_error (
"CubicFECollection: unknown geometry type.");
902 static int ind_pos[] = { 0, 1 };
903 static int ind_neg[] = { 1, 0 };
913 static int indexes[] = { 0 };
919 static int sq_ind[8][4] = {{0, 1, 2, 3}, {0, 2, 1, 3},
920 {2, 0, 3, 1}, {1, 0, 3, 2},
921 {3, 2, 1, 0}, {3, 1, 2, 0},
922 {1, 3, 0, 2}, {2, 3, 0, 1}
942 mfem_error (
"CrouzeixRaviartFECollection: unknown geometry type.");
956 mfem_error (
"CrouzeixRaviartFECollection: unknown geometry type.");
964 static int indexes[] = { 0 };
980 mfem_error (
"RT0_2DFECollection: unknown geometry type.");
994 mfem_error (
"RT0_2DFECollection: unknown geometry type.");
1002 static int ind_pos[] = { 0 };
1003 static int ind_neg[] = { -1 };
1023 mfem_error (
"RT1_2DFECollection: unknown geometry type.");
1037 mfem_error (
"RT1_2DFECollection: unknown geometry type.");
1045 static int ind_pos[] = { 0, 1 };
1046 static int ind_neg[] = { -2, -1 };
1065 mfem_error (
"RT2_2DFECollection: unknown geometry type.");
1079 mfem_error (
"RT2_2DFECollection: unknown geometry type.");
1087 static int ind_pos[] = { 0, 1, 2 };
1088 static int ind_neg[] = { -3, -2, -1 };
1107 mfem_error (
"Const2DFECollection: unknown geometry type.");
1121 mfem_error (
"Const2DFECollection: unknown geometry type.");
1143 mfem_error (
"LinearDiscont2DFECollection: unknown geometry type.");
1157 mfem_error (
"LinearDiscont2DFECollection: unknown geometry type.");
1179 mfem_error (
"GaussLinearDiscont2DFECollection:"
1180 " unknown geometry type.");
1195 mfem_error (
"GaussLinearDiscont2DFECollection:"
1196 " unknown geometry type.");
1214 mfem_error (
"P1OnQuadFECollection: unknown geometry type.");
1216 return &QuadrilateralFE;
1227 mfem_error (
"P1OnQuadFECollection: unknown geometry type.");
1249 mfem_error (
"QuadraticDiscont2DFECollection: unknown geometry type.");
1264 mfem_error (
"QuadraticDiscont2DFECollection: unknown geometry type.");
1285 mfem_error (
"QuadraticPosDiscont2DFECollection: unknown geometry type.");
1299 mfem_error (
"QuadraticPosDiscont2DFECollection: unknown geometry type.");
1316 mfem_error (
"GaussQuadraticDiscont2DFECollection:"
1317 " unknown geometry type.");
1319 return &QuadrilateralFE;
1332 mfem_error (
"GaussQuadraticDiscont2DFECollection:"
1333 " unknown geometry type.");
1355 mfem_error (
"CubicDiscont2DFECollection: unknown geometry type.");
1369 mfem_error (
"CubicDiscont2DFECollection: unknown geometry type.");
1393 mfem_error (
"LinearNonConf3DFECollection: unknown geometry type.");
1409 mfem_error (
"LinearNonConf3DFECollection: unknown geometry type.");
1417 static int indexes[] = { 0 };
1434 mfem_error (
"Const3DFECollection: unknown geometry type.");
1436 return &TetrahedronFE;
1452 mfem_error (
"Const3DFECollection: unknown geometry type.");
1476 mfem_error (
"LinearDiscont3DFECollection: unknown geometry type.");
1478 return &TetrahedronFE;
1494 mfem_error (
"LinearDiscont3DFECollection: unknown geometry type.");
1516 mfem_error (
"QuadraticDiscont3DFECollection: unknown geometry type.");
1518 return &TetrahedronFE;
1533 mfem_error (
"QuadraticDiscont3DFECollection: unknown geometry type.");
1558 mfem_error (
"RefinedLinearFECollection: unknown geometry type.");
1574 mfem_error (
"RefinedLinearFECollection: unknown geometry type.");
1582 static int indexes[] = { 0 };
1599 mfem_error (
"ND1_3DFECollection: unknown geometry type.");
1601 return &HexahedronFE;
1617 mfem_error (
"ND1_3DFECollection: unknown geometry type.");
1625 static int ind_pos[] = { 0 };
1626 static int ind_neg[] = { -1 };
1649 mfem_error (
"RT0_3DFECollection: unknown geometry type.");
1651 return &HexahedronFE;
1667 mfem_error (
"RT0_3DFECollection: unknown geometry type.");
1675 static int ind_pos[] = { 0 };
1676 static int ind_neg[] = { -1 };
1699 mfem_error (
"RT1_3DFECollection: unknown geometry type.");
1701 return &HexahedronFE;
1714 mfem_error (
"RT1_3DFECollection: unknown geometry type.");
1724 static int sq_ind[8][4] =
1726 {0, 1, 2, 3}, {-1, -3, -2, -4},
1727 {2, 0, 3, 1}, {-2, -1, -4, -3},
1728 {3, 2, 1, 0}, {-4, -2, -3, -1},
1729 {1, 3, 0, 2}, {-3, -4, -1, -2}
1747 MFEM_VERIFY(
p >= 1,
"H1_FECollection requires order >= 1.");
1748 MFEM_VERIFY(
dim >= 0 &&
dim <= 3,
"H1_FECollection requires 0 <= dim <= 3.");
1750 const int pm1 =
p - 1, pm2 = pm1 - 1, pm3 = pm2 - 1, pm4 = pm3 - 1;
1764 snprintf(
h1_name, 32,
"H1_%dD_P%d_Pyr%d",
dim,
p, pyr_type);
1784 snprintf(
h1_name, 32,
"H1@%c_%dD_P%d",
1794 for (
int i = 0; i < 2; i++)
1798 for (
int i = 0; i < 6; i++)
1802 for (
int i = 0; i < 8; i++)
1806 for (
int i = 0; i < 24; i++)
1826 SegDofOrd[0] = (pm1 > 0) ?
new int[2*pm1] :
nullptr;
1828 for (
int i = 0; i < pm1; i++)
1864 TriDofOrd[0] = (TriDof > 0) ?
new int[6*TriDof] :
nullptr;
1865 for (
int i = 1; i < 6; i++)
1870 for (
int j = 0; j < pm2; j++)
1872 for (
int i = 0; i + j < pm2; i++)
1874 int o = TriDof - ((pm1 - j)*(pm2 - j))/2 + i;
1875 int k = pm3 - j - i;
1877 TriDofOrd[1][o] = TriDof - ((pm1-j)*(pm2-j))/2 + k;
1878 TriDofOrd[2][o] = TriDof - ((pm1-i)*(pm2-i))/2 + k;
1879 TriDofOrd[3][o] = TriDof - ((pm1-k)*(pm2-k))/2 + i;
1880 TriDofOrd[4][o] = TriDof - ((pm1-k)*(pm2-k))/2 + j;
1881 TriDofOrd[5][o] = TriDof - ((pm1-i)*(pm2-i))/2 + j;
1885 QuadDofOrd[0] = (QuadDof > 0) ?
new int[8*QuadDof] :
nullptr;
1886 for (
int i = 1; i < 8; i++)
1909 for (
int j = 0; j < pm3; j++)
1911 for (
int i = 0; i < pm3; i++)
1918 QuadDofOrd[4][o] = (pm4 - i) + (pm4 - j)*pm3;
1919 QuadDofOrd[5][o] = (pm4 - j) + (pm4 - i)*pm3;
1929 for (
int j = 0; j < pm1; j++)
1931 for (
int i = 0; i < pm1; i++)
1938 QuadDofOrd[4][o] = (pm2 - i) + (pm2 - j)*pm1;
1939 QuadDofOrd[5][o] = (pm2 - j) + (pm2 - i)*pm1;
1955 else if (pyr_type == 1)
1989 TetDofOrd[0] = (TetDof > 0) ?
new int[24*TetDof] :
nullptr;
1990 for (
int i = 1; i < 24; i++)
1995 for (
int k = 0; k < pm3; k++)
1997 for (
int j = 0; j + k < pm3; j++)
1999 for (
int i = 0; i + j + k < pm3; i++)
2001 int l = pm4 - k - j - i;
2002 int o = TetDof - ((pm1 - k) * (pm2 - k) * (pm3 - k)) / 6
2003 + (j * (2 *
p - 5 - j - 2 * k)) / 2 + i;
2004 int o1 = TetDof - ((pm1 - j) * (pm2 - j) * (pm3 - j)) / 6
2005 + (k * (2 *
p - 5 - k - 2 * j)) / 2 + i;
2006 int o2 = TetDof - ((pm1 - i) * (pm2 - i) * (pm3 - i)) / 6
2007 + (k * (2 *
p - 5 - k - 2 * i)) / 2 + j;
2008 int o3 = TetDof - ((pm1 - k) * (pm2 - k) * (pm3 - k)) / 6
2009 + (i * (2 *
p - 5 - i - 2 * k)) / 2 + j;
2010 int o4 = TetDof - ((pm1 - j) * (pm2 - j) * (pm3 - j)) / 6
2011 + (i * (2 *
p - 5 - i - 2 * j)) / 2 + k;
2012 int o5 = TetDof - ((pm1 - i) * (pm2 - i) * (pm3 - i)) / 6
2013 + (j * (2 *
p - 5 - j - 2 * i)) / 2 + k;
2014 int o6 = TetDof - ((pm1 - k) * (pm2 - k) * (pm3 - k)) / 6
2015 + (l * (2 *
p - 5 - l - 2 * k)) / 2 + j;
2016 int o7 = TetDof - ((pm1 - l) * (pm2 - l) * (pm3 - l)) / 6
2017 + (k * (2 *
p - 5 - k - 2 * l)) / 2 + j;
2018 int o8 = TetDof - ((pm1 - l) * (pm2 - l) * (pm3 - l)) / 6
2019 + (j * (2 *
p - 5 - j - 2 * l)) / 2 + k;
2020 int o9 = TetDof - ((pm1 - j) * (pm2 - j) * (pm3 - j)) / 6
2021 + (l * (2 *
p - 5 - l - 2 * j)) / 2 + k;
2022 int o10 = TetDof - ((pm1 - j) * (pm2 - j) * (pm3 - j)) / 6
2023 + (k * (2 *
p - 5 - k - 2 * j)) / 2 + l;
2024 int o11 = TetDof - ((pm1 - k) * (pm2 - k) * (pm3 - k)) / 6
2025 + (j * (2 *
p - 5 - j - 2 * k)) / 2 + l;
2026 int o12 = TetDof - ((pm1 - i) * (pm2 - i) * (pm3 - i)) / 6
2027 + (l * (2 *
p - 5 - l - 2 * i)) / 2 + k;
2028 int o13 = TetDof - ((pm1 - l) * (pm2 - l) * (pm3 - l)) / 6
2029 + (i * (2 *
p - 5 - i - 2 * l)) / 2 + k;
2030 int o14 = TetDof - ((pm1 - k) * (pm2 - k) * (pm3 - k)) / 6
2031 + (i * (2 *
p - 5 - i - 2 * k)) / 2 + l;
2032 int o15 = TetDof - ((pm1 - i) * (pm2 - i) * (pm3 - i)) / 6
2033 + (k * (2 *
p - 5 - k - 2 * i)) / 2 + l;
2034 int o16 = TetDof - ((pm1 - l) * (pm2 - l) * (pm3 - l)) / 6
2035 + (k * (2 *
p - 5 - k - 2 * l)) / 2 + i;
2036 int o17 = TetDof - ((pm1 - k) * (pm2 - k) * (pm3 - k)) / 6
2037 + (l * (2 *
p - 5 - l - 2 * k)) / 2 + i;
2038 int o18 = TetDof - ((pm1 - i) * (pm2 - i) * (pm3 - i)) / 6
2039 + (j * (2 *
p - 5 - j - 2 * i)) / 2 + l;
2040 int o19 = TetDof - ((pm1 - j) * (pm2 - j) * (pm3 - j)) / 6
2041 + (i * (2 *
p - 5 - i - 2 * j)) / 2 + l;
2042 int o20 = TetDof - ((pm1 - j) * (pm2 - j) * (pm3 - j)) / 6
2043 + (l * (2 *
p - 5 - l - 2 * j)) / 2 + i;
2044 int o21 = TetDof - ((pm1 - l) * (pm2 - l) * (pm3 - l)) / 6
2045 + (j * (2 *
p - 5 - j - 2 * l)) / 2 + i;
2046 int o22 = TetDof - ((pm1 - l) * (pm2 - l) * (pm3 - l)) / 6
2047 + (i * (2 *
p - 5 - i - 2 * l)) / 2 + j;
2048 int o23 = TetDof - ((pm1 - i) * (pm2 - i) * (pm3 - i)) / 6
2049 + (l * (2 *
p - 5 - l - 2 * i)) / 2 + j;
2113 if (!strncmp(
h1_name,
"H1_", 3))
2117 else if (!strncmp(
h1_name,
"H1Pos_", 6))
2121 else if (!strncmp(
h1_name,
"H1@", 3))
2130 const int *dof_map = NULL;
2140 MFEM_ABORT(
"Geometry type " <<
Geometry::Name[GeomType] <<
" is not "
2172 snprintf(
h1_name, 32,
"H1_Trace_%dD_P%d",
dim,
p);
2176 snprintf(
h1_name, 32,
"H1Pos_Trace_%dD_P%d",
dim,
p);
2180 snprintf(
h1_name, 32,
"H1_Trace@%c_%dD_P%d",
2187 const int map_type,
const int pyr_type)
2193 MFEM_VERIFY(
p >= 0,
"L2_FECollection requires order >= 0.");
2196 const char *prefix = NULL;
2202 MFEM_ABORT(
"invalid map_type: " << map_type);
2209 snprintf(d_name, 32,
"%s_%dD_P%d", prefix,
dim,
p);
2213 snprintf(d_name, 32,
"%s_%dD_P%d_Pyr%d", prefix,
dim,
p, pyr_type);
2219 snprintf(d_name, 32,
"%s_T%d_%dD_P%d", prefix, btype,
dim,
p);
2223 snprintf(d_name, 32,
"%s_T%d_%dD_P%d_Pyr%d",
2224 prefix, btype,
dim,
p, pyr_type);
2230 L2_Elements[g] = NULL;
2231 Tr_Elements[g] = NULL;
2233 for (
int i = 0; i < 2; i++)
2235 SegDofOrd[i] = NULL;
2237 for (
int i = 0; i < 6; i++)
2239 TriDofOrd[i] = NULL;
2241 for (
int i = 0; i < 24; i++)
2243 TetDofOrd[i] = NULL;
2266 const int pp1 =
p + 1;
2267 SegDofOrd[0] = (pp1 > 0) ?
new int[2*pp1] :
nullptr;
2268 SegDofOrd[1] = SegDofOrd[0] + pp1;
2269 for (
int i = 0; i <=
p; i++)
2271 SegDofOrd[0][i] = i;
2272 SegDofOrd[1][i] =
p - i;
2300 TriDofOrd[0] = (TriDof > 0) ?
new int[6*TriDof] :
nullptr;
2301 for (
int i = 1; i < 6; i++)
2303 TriDofOrd[i] = TriDofOrd[i-1] + TriDof;
2305 const int pp1 =
p + 1, pp2 = pp1 + 1;
2306 for (
int j = 0; j <=
p; j++)
2308 for (
int i = 0; i + j <=
p; i++)
2310 int o = TriDof - ((pp2 - j)*(pp1 - j))/2 + i;
2312 TriDofOrd[0][o] = o;
2313 TriDofOrd[1][o] = TriDof - ((pp2-j)*(pp1-j))/2 + k;
2314 TriDofOrd[2][o] = TriDof - ((pp2-i)*(pp1-i))/2 + k;
2315 TriDofOrd[3][o] = TriDof - ((pp2-k)*(pp1-k))/2 + i;
2316 TriDofOrd[4][o] = TriDof - ((pp2-k)*(pp1-k))/2 + j;
2317 TriDofOrd[5][o] = TriDof - ((pp2-i)*(pp1-i))/2 + j;
2321 OtherDofOrd = (QuadDof > 0) ?
new int[QuadDof] :
nullptr;
2322 for (
int j = 0; j < QuadDof; j++)
2378 const int MaxDof = std::max(std::max(TetDof, PyrDof),
2379 std::max(PriDof, HexDof));
2381 TetDofOrd[0] = (TetDof > 0) ?
new int[24*TetDof] :
nullptr;
2382 for (
int i = 1; i < 24; i++)
2384 TetDofOrd[i] = TetDofOrd[i-1] + TetDof;
2387 const int pp1 =
p + 1, pp2 = pp1 + 1, pp3 = pp2 + 1;
2388 for (
int k = 0; k <=
p; k++)
2390 for (
int j = 0; j + k <=
p; j++)
2392 for (
int i = 0; i + j + k <=
p; i++)
2394 int l =
p - k - j - i;
2395 int o = TetDof - ((pp1 - k) * (pp2 - k) * (pp3 - k)) / 6
2396 + (j * (2 *
p + 3 - j - 2 * k)) / 2 + i;
2397 int o1 = TetDof - ((pp1 - j) * (pp2 - j) * (pp3 - j)) / 6
2398 + (k * (2 *
p + 3 - k - 2 * j)) / 2 + i;
2399 int o2 = TetDof - ((pp1 - i) * (pp2 - i) * (pp3 - i)) / 6
2400 + (k * (2 *
p + 3 - k - 2 * i)) / 2 + j;
2401 int o3 = TetDof - ((pp1 - k) * (pp2 - k) * (pp3 - k)) / 6
2402 + (i * (2 *
p + 3 - i - 2 * k)) / 2 + j;
2403 int o4 = TetDof - ((pp1 - j) * (pp2 - j) * (pp3 - j)) / 6
2404 + (i * (2 *
p + 3 - i - 2 * j)) / 2 + k;
2405 int o5 = TetDof - ((pp1 - i) * (pp2 - i) * (pp3 - i)) / 6
2406 + (j * (2 *
p + 3 - j - 2 * i)) / 2 + k;
2407 int o6 = TetDof - ((pp1 - k) * (pp2 - k) * (pp3 - k)) / 6
2408 + (l * (2 *
p + 3 - l - 2 * k)) / 2 + j;
2409 int o7 = TetDof - ((pp1 - l) * (pp2 - l) * (pp3 - l)) / 6
2410 + (k * (2 *
p + 3 - k - 2 * l)) / 2 + j;
2411 int o8 = TetDof - ((pp1 - l) * (pp2 - l) * (pp3 - l)) / 6
2412 + (j * (2 *
p + 3 - j - 2 * l)) / 2 + k;
2413 int o9 = TetDof - ((pp1 - j) * (pp2 - j) * (pp3 - j)) / 6
2414 + (l * (2 *
p + 3 - l - 2 * j)) / 2 + k;
2415 int o10 = TetDof - ((pp1 - j) * (pp2 - j) * (pp3 - j)) / 6
2416 + (k * (2 *
p + 3 - k - 2 * j)) / 2 + l;
2417 int o11 = TetDof - ((pp1 - k) * (pp2 - k) * (pp3 - k)) / 6
2418 + (j * (2 *
p + 3 - j - 2 * k)) / 2 + l;
2419 int o12 = TetDof - ((pp1 - i) * (pp2 - i) * (pp3 - i)) / 6
2420 + (l * (2 *
p + 3 - l - 2 * i)) / 2 + k;
2421 int o13 = TetDof - ((pp1 - l) * (pp2 - l) * (pp3 - l)) / 6
2422 + (i * (2 *
p + 3 - i - 2 * l)) / 2 + k;
2423 int o14 = TetDof - ((pp1 - k) * (pp2 - k) * (pp3 - k)) / 6
2424 + (i * (2 *
p + 3 - i - 2 * k)) / 2 + l;
2425 int o15 = TetDof - ((pp1 - i) * (pp2 - i) * (pp3 - i)) / 6
2426 + (k * (2 *
p + 3 - k - 2 * i)) / 2 + l;
2427 int o16 = TetDof - ((pp1 - l) * (pp2 - l) * (pp3 - l)) / 6
2428 + (k * (2 *
p + 3 - k - 2 * l)) / 2 + i;
2429 int o17 = TetDof - ((pp1 - k) * (pp2 - k) * (pp3 - k)) / 6
2430 + (l * (2 *
p + 3 - l - 2 * k)) / 2 + i;
2431 int o18 = TetDof - ((pp1 - i) * (pp2 - i) * (pp3 - i)) / 6
2432 + (j * (2 *
p + 3 - j - 2 * i)) / 2 + l;
2433 int o19 = TetDof - ((pp1 - j) * (pp2 - j) * (pp3 - j)) / 6
2434 + (i * (2 *
p + 3 - i - 2 * j)) / 2 + l;
2435 int o20 = TetDof - ((pp1 - j) * (pp2 - j) * (pp3 - j)) / 6
2436 + (l * (2 *
p + 3 - l - 2 * j)) / 2 + i;
2437 int o21 = TetDof - ((pp1 - l) * (pp2 - l) * (pp3 - l)) / 6
2438 + (j * (2 *
p + 3 - j - 2 * l)) / 2 + i;
2439 int o22 = TetDof - ((pp1 - l) * (pp2 - l) * (pp3 - l)) / 6
2440 + (i * (2 *
p + 3 - i - 2 * l)) / 2 + j;
2441 int o23 = TetDof - ((pp1 - i) * (pp2 - i) * (pp3 - i)) / 6
2442 + (l * (2 *
p + 3 - l - 2 * i)) / 2 + j;
2443 TetDofOrd[ 0][o] = o;
2444 TetDofOrd[ 1][o] = o1;
2445 TetDofOrd[ 2][o] = o2;
2446 TetDofOrd[ 3][o] = o3;
2447 TetDofOrd[ 4][o] = o4;
2448 TetDofOrd[ 5][o] = o5;
2449 TetDofOrd[ 6][o] = o6;
2450 TetDofOrd[ 7][o] = o7;
2451 TetDofOrd[ 8][o] = o8;
2452 TetDofOrd[ 9][o] = o9;
2453 TetDofOrd[10][o] = o10;
2454 TetDofOrd[11][o] = o11;
2455 TetDofOrd[12][o] = o12;
2456 TetDofOrd[13][o] = o13;
2457 TetDofOrd[14][o] = o14;
2458 TetDofOrd[15][o] = o15;
2459 TetDofOrd[16][o] = o16;
2460 TetDofOrd[17][o] = o17;
2461 TetDofOrd[18][o] = o18;
2462 TetDofOrd[19][o] = o19;
2463 TetDofOrd[20][o] = o20;
2464 TetDofOrd[21][o] = o21;
2465 TetDofOrd[22][o] = o22;
2466 TetDofOrd[23][o] = o23;
2470 OtherDofOrd = (MaxDof > 0) ?
new int[MaxDof] :
nullptr;
2471 for (
int j = 0; j < MaxDof; j++)
2478 mfem::err <<
"L2_FECollection::L2_FECollection : dim = "
2487 return L2_Elements[GeomType];
2496 return (Or > 0) ? SegDofOrd[0] : SegDofOrd[1];
2499 return TriDofOrd[Or%6];
2502 return TetDofOrd[Or%24];
2505 return (Or == 0) ? OtherDofOrd : NULL;
2511 delete [] OtherDofOrd;
2512 delete [] SegDofOrd[0];
2513 delete [] TriDofOrd[0];
2514 delete [] TetDofOrd[0];
2517 delete L2_Elements[i];
2518 delete Tr_Elements[i];
2524 const int cb_type,
const int ob_type)
2531 MFEM_VERIFY(
p >= 0,
"RT_FECollection requires order >= 0.");
2539 MFEM_ABORT(
"unknown closed BasisType: " << cb_name);
2544 MFEM_ABORT(
"unknown open BasisType: " << ob_name);
2560 const int pp1 =
p + 1;
2589 MFEM_ABORT(
"invalid dim = " <<
dim);
2596 const int map_type,
const bool signs,
2606 MFEM_ABORT(
"Invalid open basis type: " << ob_name);
2618 "invalid open point type");
2620 const int pp1 =
p + 1, pp2 =
p + 2;
2628 for (
int i = 0; i < 2; i++)
2632 for (
int i = 0; i < 6; i++)
2636 for (
int i = 0; i < 8; i++)
2648 SegDofOrd[0] = (pp1 > 0) ?
new int[2*pp1] :
nullptr;
2650 for (
int i = 0; i <=
p; i++)
2653 SegDofOrd[1][i] = signs ? (-1 - (
p - i)) : (
p - i);
2669 TriDofOrd[0] = (TriDof > 0) ?
new int[6*TriDof] :
nullptr;
2670 for (
int i = 1; i < 6; i++)
2676 for (
int j = 0; j <=
p; j++)
2678 for (
int i = 0; i + j <=
p; i++)
2680 int o = TriDof - ((pp2 - j)*(pp1 - j))/2 + i;
2683 TriDofOrd[1][o] = -1-(TriDof-((pp2-j)*(pp1-j))/2+k);
2684 TriDofOrd[2][o] = TriDof-((pp2-i)*(pp1-i))/2+k;
2685 TriDofOrd[3][o] = -1-(TriDof-((pp2-k)*(pp1-k))/2+i);
2686 TriDofOrd[4][o] = TriDof-((pp2-k)*(pp1-k))/2+j;
2687 TriDofOrd[5][o] = -1-(TriDof-((pp2-i)*(pp1-i))/2+j);
2690 for (
int kk = 1; kk < 6; kk += 2)
2699 QuadDofOrd[0] = (QuadDof > 0) ?
new int[8*QuadDof] :
nullptr;
2700 for (
int i = 1; i < 8; i++)
2705 for (
int j = 0; j <=
p; j++)
2707 for (
int i = 0; i <=
p; i++)
2720 for (
int k = 1; k < 8; k += 2)
2757 if (!strncmp(
rt_name,
"RT_", 3))
2788 const char *prefix =
2790 char ob_str[3] = {
'\0',
'\0',
'\0' };
2797 snprintf(
rt_name, 32,
"%s%s_%dD_P%d", prefix, ob_str,
dim,
p);
2799 MFEM_VERIFY(
dim == 2 ||
dim == 3,
"Wrong dimension, dim = " <<
dim);
2808 MFEM_VERIFY(
dim == 2 ||
dim == 3,
"Wrong dimension, dim = " <<
dim);
2810 const char *prefix =
2814 snprintf(
rt_name, 32,
"%s_%dD_P%d", prefix,
dim,
p);
2818 snprintf(
rt_name, 32,
"%s@%c_%dD_P%d", prefix,
2824 const int cb_type,
const int ob_type)
2830 MFEM_VERIFY(
p >= 1,
"ND_FECollection requires order >= 1.");
2831 MFEM_VERIFY(
dim >= 1 &&
dim <= 3,
"ND_FECollection requires 1 <= dim <= 3.");
2833 const int pm1 =
p - 1, pm2 =
p - 2;
2851 for (
int i = 0; i < 2; i++)
2855 for (
int i = 0; i < 6; i++)
2859 for (
int i = 0; i < 8; i++)
2871 MFEM_ABORT(
"Invalid open basis point type: " << ob_name);
2876 MFEM_ABORT(
"Invalid closed basis point type: " << cb_name);
2886 for (
int i = 0; i <
p; i++)
2904 QuadDofOrd[0] = (QuadDof > 0) ?
new int[8*QuadDof] :
nullptr;
2905 for (
int i = 1; i < 8; i++)
2910 for (
int j = 0; j < pm1; j++)
2912 for (
int i = 0; i <
p; i++)
2915 int d2 =
p*pm1 + j + i*pm1;
2925 QuadDofOrd[2][d1] = -1 - (
p*pm1 + j + (pm1 - i)*pm1);
2931 QuadDofOrd[4][d1] = -1 - ((pm1 - i) + (pm2 - j)*
p);
2932 QuadDofOrd[4][d2] = -1 - (
p*pm1 + (pm2 - j) + (pm1 - i)*pm1);
2934 QuadDofOrd[5][d1] = -1 - (
p*pm1 + (pm2 - j) + (pm1 - i)*pm1);
2935 QuadDofOrd[5][d2] = -1 - ((pm1 - i) + (pm2 - j)*
p);
2943 QuadDofOrd[7][d2] = -1 - (
p*pm1 + j + (pm1 - i)*pm1);
2948 TriDofOrd[0] = (TriDof > 0) ?
new int[6*TriDof] :
nullptr;
2949 for (
int i = 1; i < 6; i++)
2955 for (
int j = 0; j <= pm2; j++)
2957 for (
int i = 0; i + j <= pm2; i++)
2959 int k0 =
p*pm1 - (
p - j)*(pm1 - j) + 2*i;
2960 int k1 = 2*pm2 - 2*i + ((2*
p-3)-j)*j;
2961 int k2 = 2*pm2 - 2*j + ((2*
p-3)-i)*i;
2962 int k3 =
p*pm1 - 2 - 3*j - i - (i+j)*(i+j);
2963 int k4 =
p*pm1 - 2 - 3*i - j - (i+j)*(i+j);
2964 int k5 =
p*pm1 - (
p - i)*(pm1 - i) + 2*j;
3044 int tr_p, tr_dim, tr_cb_type, tr_ob_type;
3082 snprintf(
nd_name, 32,
"ND_Trace_%dD_P%d",
dim,
p);
3086 snprintf(
nd_name, 32,
"ND_Trace@%c%c_%dD_P%d",
3094 const int cb_type,
const int ob_type)
3097 MFEM_VERIFY(
p >= 1,
"ND_R1D_FECollection requires order >= 1.");
3098 MFEM_VERIFY(
dim == 1,
"ND_R1D_FECollection requires dim == 1.");
3107 snprintf(
nd_name, 32,
"ND_R1D@%c%c_%dD_P%d",
3125 MFEM_ABORT(
"Invalid open basis point type: " << ob_name);
3130 MFEM_ABORT(
"Invalid closed basis point type: " << cb_name);
3163 const int cb_type,
const int ob_type)
3166 MFEM_VERIFY(
p >= 0,
"RT_R1D_FECollection requires order >= 0.");
3167 MFEM_VERIFY(
dim == 1,
"RT_R1D_FECollection requires dim == 1.");
3176 snprintf(
rt_name, 32,
"RT_R1D@%c%c_%dD_P%d",
3194 MFEM_ABORT(
"Invalid open basis point type: " << ob_name);
3199 MFEM_ABORT(
"Invalid closed basis point type: " << cb_name);
3219 MFEM_ABORT(
"this method is not implemented in RT_R1D_FECollection!");
3233 const int cb_type,
const int ob_type)
3236 MFEM_VERIFY(
p >= 1,
"ND_R2D_FECollection requires order >= 1.");
3237 MFEM_VERIFY(
dim >= 1 &&
dim <= 2,
3238 "ND_R2D_FECollection requires 1 <= dim <= 2.");
3240 const int pm1 =
p - 1, pm2 =
p - 2;
3249 snprintf(
nd_name, 32,
"ND_R2D@%c%c_%dD_P%d",
3259 for (
int i = 0; i < 2; i++)
3271 MFEM_ABORT(
"Invalid open basis point type: " << ob_name);
3276 MFEM_ABORT(
"Invalid closed basis point type: " << cb_name);
3288 SegDofOrd[0] = (4*
p > 2) ?
new int[4 *
p - 2] :
nullptr;
3290 for (
int i = 0; i <
p; i++)
3295 for (
int i = 0; i < pm1; i++)
3327 int p,
dim, cb_type, ob_type;
3363 snprintf(
nd_name, 32,
"ND_R2D_Trace_%dD_P%d",
dim,
p);
3367 snprintf(
nd_name, 32,
"ND_R2D_Trace@%c%c_%dD_P%d",
3375 const int cb_type,
const int ob_type)
3379 MFEM_VERIFY(
p >= 0,
"RT_R2D_FECollection requires order >= 0.");
3380 MFEM_VERIFY(
dim >= 1 &&
dim <= 2,
3381 "RT_R2D_FECollection requires 1 <= dim <= 2.");
3389 MFEM_ABORT(
"unknown closed BasisType: " << cb_name);
3394 MFEM_ABORT(
"unknown open BasisType: " << ob_name);
3406 snprintf(
rt_name, 32,
"RT_R2D@%c%c_%dD_P%d",
3411 const int pp1 =
p + 1;
3412 const int pp2 =
p + 2;
3431 const bool signs,
const int ob_type)
3438 MFEM_ABORT(
"Invalid open basis type: " << ob_name);
3450 "invalid open point type");
3452 const int pp1 =
p + 1;
3460 for (
int i = 0; i < 2; i++)
3472 SegDofOrd[0] = (pp1 > 0) ?
new int[2*pp1] :
nullptr;
3474 for (
int i = 0; i <=
p; i++)
3477 SegDofOrd[1][i] = signs ? (-1 - (
p - i)) : (
p - i);
3495 if (!strncmp(
rt_name,
"RT_R2D_", 7))
3523 const char *prefix =
3525 char ob_str[3] = {
'\0',
'\0',
'\0' };
3532 snprintf(
rt_name, 32,
"%s%s_%dD_P%d", prefix, ob_str,
dim,
p);
3534 MFEM_VERIFY(
dim == 2,
"Wrong dimension, dim = " <<
dim);
3540 snprintf(d_name, 32,
"Local_%s", fe_name);
3542 Local_Element = NULL;
3544 if (!strcmp(fe_name,
"BiCubic2DFiniteElement") ||
3545 !strcmp(fe_name,
"Quad_Q3"))
3550 else if (!strcmp(fe_name,
"Nedelec1HexFiniteElement") ||
3551 !strcmp(fe_name,
"Hex_ND1"))
3556 else if (!strncmp(fe_name,
"H1_", 3))
3561 else if (!strncmp(fe_name,
"H1Pos_", 6))
3566 else if (!strncmp(fe_name,
"L2_", 3))
3573 mfem::err <<
"Local_FECollection::Local_FECollection : fe_name = "
3597 snprintf(
name, 16,
"NURBS%i", Order);
3601 snprintf(
name, 16,
"NURBS");
3624 mfem_error (
"NURBSFECollection: unknown geometry type.");
3631 mfem_error(
"NURBSFECollection::DofForGeometry");
3638 mfem_error(
"NURBSFECollection::DofOrderForOrientation");
3644 MFEM_ABORT(
"NURBS finite elements can not be statically condensed!");
3669 qFE = QuadrilateralVFE;
3675 qFE = QuadrilateralFE;
3676 hFE = ParallelepipedVFE;
3681 mfem_error (
"NURBS_HDivFECollection: wrong dimension!");
3688 delete QuadrilateralFE;
3689 delete QuadrilateralVFE;
3690 delete ParallelepipedVFE;
3703 mfem_error (
"NURBS_HDivFECollection: unknown geometry type.");
3705 return QuadrilateralFE;
3713 snprintf(
name, 16,
"NURBS_HDiv%i", Order);
3717 snprintf(
name, 16,
"NURBS_HDiv");
3723 mfem_error(
"NURBS_HDivFECollection::DofForGeometry");
3731 mfem_error(
"NURBS_HDivFECollection::DofOrderForOrientation");
3737 MFEM_ABORT(
"NURBS finite elements can not be statically condensed!");
3760 qFE = QuadrilateralVFE;
3766 qFE = QuadrilateralFE;
3767 hFE = ParallelepipedVFE;
3772 mfem_error (
"NURBS_HCurlFECollection: wrong dimension!");
3781 delete QuadrilateralFE;
3782 delete QuadrilateralVFE;
3783 delete ParallelepipedVFE;
3796 mfem_error (
"NURBS_HCurlFECollection: unknown geometry type.");
3798 return QuadrilateralFE;
3806 snprintf(
name, 16,
"NURBS_HCurl%i", Order);
3810 snprintf(
name, 16,
"NURBS_HCurl");
3816 mfem_error(
"NURBS_HCurlFECollection::DofForGeometry");
3824 mfem_error(
"NURBS_HCurlFECollection::DofOrderForOrientation");
3830 MFEM_ABORT(
"NURBS finite elements can not be statically condensed!");
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
int Size() const
Return the logical size of the array.
T * GetData()
Returns the data.
static int GetQuadrature1D(int b_type)
Get the corresponding Quadrature1D constant, when that makes sense; otherwise return Quadrature1D::In...
static int Check(int b_type)
If the input does not represent a valid BasisType, abort with an error; otherwise return the input.
static char GetChar(int b_type)
Check and convert a BasisType constant to a char basis identifier.
static const char * Name(int b_type)
Check and convert a BasisType constant to a string identifier.
static int GetType(char b_ident)
Convert char basis identifier to a BasisType constant.
@ Serendipity
Serendipity basis (squares / cubes)
@ GaussLobatto
Closed type.
@ GaussLegendre
Open type.
@ Positive
Bernstein polynomials.
A 2D bi-cubic element on a square with uniformly spaces nodes.
Piecewise-constant discontinuous finite elements in 2D. This class is kept only for backward compatib...
int DofForGeometry(Geometry::Type GeomType) const override
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
Piecewise-constant discontinuous finite elements in 3D. This class is kept only for backward compatib...
int DofForGeometry(Geometry::Type GeomType) const override
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
Crouzeix-Raviart nonconforming elements in 2D.
int DofForGeometry(Geometry::Type GeomType) const override
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
Piecewise-cubic discontinuous finite elements in 2D. This class is kept only for backward compatibili...
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
int DofForGeometry(Geometry::Type GeomType) const override
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
Piecewise-(bi)cubic continuous finite elements.
int DofForGeometry(Geometry::Type GeomType) const override
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
DG_Interface_FECollection(const int p, const int dim, const int map_type=FiniteElement::VALUE, const int ob_type=BasisType::GaussLegendre)
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
ErrorMode error_mode
How to treat errors in FiniteElementForGeometry() calls.
virtual const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const =0
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
int GetRangeType(int dim) const
static FiniteElementCollection * New(const char *name)
Factory method: return a newly allocated FiniteElementCollection according to the given name.
int GetOrder() const
Return the order (polynomial degree) of the FE collection, corresponding to the order/degree returned...
int HasFaceDofs(Geometry::Type geom, int p) const
int GetDerivRangeType(int dim) const
virtual FiniteElementCollection * Clone(int p) const
Instantiate a new collection of the same type with a different order.
virtual int DofForGeometry(Geometry::Type GeomType) const =0
virtual ~FiniteElementCollection()
int GetNumDof(Geometry::Type geom, int p) const
Variable order version of DofForGeometry().
virtual const FiniteElement * FiniteElementForDim(int dim) const
Returns the first non-NULL FiniteElement for the given dimension.
static void GetEdge(int &nv, v_t &v, int &ne, int &e, int &eo, const int edge_info)
void InitVarOrder(int p) const
int GetDerivType(int dim) const
const int base_p
Order as returned by GetOrder().
virtual const char * Name() const
int GetRangeDim(int dim) const
int GetDerivMapType(int dim) const
static void GetFace(int &nv, v_t &v, int &ne, e_t &e, eo_t &eo, int &nf, int &f, Geometry::Type &fg, int &fo, const int face_info)
int GetMapType(int dim) const
Array< FiniteElementCollection * > var_orders
virtual const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const =0
virtual FiniteElementCollection * GetTraceCollection() const
Returns a collection of the trace elements.
void SubDofOrder(Geometry::Type Geom, int SDim, int Info, Array< int > &dofs) const
Get the local dofs for a given sub-manifold.
static void GetNVE(int &nv, int &ne)
ErrorMode
How to treat errors in FiniteElementForGeometry() calls.
@ RETURN_NULL
Return NULL on errors.
Abstract class for all finite elements.
int GetDerivMapType() const
Returns the FiniteElement::DerivType of the element describing how reference function derivatives are...
int GetRangeDim() const
Returns the vector dimension for vector-valued finite elements, which is also the dimension of the in...
int GetDerivType() const
Returns the FiniteElement::DerivType of the element describing the spatial derivative method implemen...
virtual const StatelessDofTransformation * GetDofTransformation() const
Return a DoF transformation object for this particular type of basis.
int GetMapType() const
Returns the FiniteElement::MapType of the element describing how reference functions are mapped to ph...
int GetRangeType() const
Returns the FiniteElement::RangeType of the element, one of {SCALAR, VECTOR}.
@ NONE
No derivatives implemented.
int GetDerivRangeType() const
Returns the FiniteElement::RangeType of the element derivative, either SCALAR or VECTOR.
int GetDof() const
Returns the number of degrees of freedom in the finite element.
Version of LinearDiscont2DFECollection with dofs in the Gaussian points.
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
int DofForGeometry(Geometry::Type GeomType) const override
Version of QuadraticDiscont2DFECollection with dofs in the Gaussian points.
int DofForGeometry(Geometry::Type GeomType) const override
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
static const int Dimension[NumGeom]
static const char * Name[NumGeom]
static bool IsTensorProduct(Type geom)
static const int DimStart[MaxDim+2]
Arbitrary order H1-conforming (continuous) finite elements with positive basis functions.
Arbitrary order H1 elements in 3D utilizing the Bernstein basis on a cube.
Arbitrary order H1 elements in 2D utilizing the Bernstein basis on a square.
Arbitrary order H1 elements in 1D utilizing the Bernstein basis.
Arbitrary order H1 elements in 2D utilizing the Bernstein basis on a triangle.
Arbitrary order H1 elements in 3D utilizing the Bernstein basis on a wedge.
Arbitrary order H1 serendipity elements in 2D on a quad.
Arbitrary order H1-conforming (continuous) finite elements.
H1_FECollection(const int p, const int dim=3, const int btype=BasisType::GaussLobatto, const int pyr_type=ScalarPyramid::DefaultType)
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
virtual ~H1_FECollection()
FiniteElementCollection * GetTraceCollection() const override
Returns a collection of the trace elements.
int H1_dof[Geometry::NumGeom]
FiniteElement * H1_Elements[Geometry::NumGeom]
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
const int * GetDofMap(Geometry::Type GeomType) const
Get the Cartesian to local H1 dof map.
Arbitrary order H1 elements in 3D on a cube.
Arbitrary order H1 elements in 2D on a square.
Arbitrary order H1 elements in 1D.
Arbitrary order H1 elements in 3D on a tetrahedron.
Arbitrary order "H^{1/2}-conforming" trace finite elements defined on the interface between mesh elem...
H1_Trace_FECollection(const int p, const int dim, const int btype=BasisType::GaussLobatto)
Arbitrary order H1 elements in 2D on a triangle.
Arbitrary order H1 elements in 3D on a wedge.
Arbitrary order L2 elements in 3D utilizing the Bernstein basis on a cube.
Arbitrary order L2 elements in 3D utilizing the Bernstein basis on a pyramid.
Arbitrary order L2 elements in 2D utilizing the Bernstein basis on a square.
Arbitrary order L2 elements in 1D utilizing the Bernstein basis on a segment.
Arbitrary order L2 elements in 2D utilizing the Bernstein basis on a triangle.
Arbitrary order L2 elements in 3D utilizing the Bernstein basis on a wedge.
Arbitrary order L2 elements in 3D on a pyramid.
Arbitrary order "L2-conforming" discontinuous finite elements.
virtual ~L2_FECollection()
L2_FECollection(const int p, const int dim, const int btype=BasisType::GaussLegendre, const int map_type=FiniteElement::VALUE, const int pyr_type=ScalarPyramid::DefaultType)
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
Arbitrary order L2 elements in 3D on a cube.
Arbitrary order L2 elements in 2D on a square.
Arbitrary order L2 elements in 1D on a segment.
Arbitrary order L2 elements in 3D on a tetrahedron.
Arbitrary order L2 elements in 2D on a triangle.
Arbitrary order L2 elements in 3D on a wedge.
Piecewise-linear discontinuous finite elements in 2D. This class is kept only for backward compatibil...
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
int DofForGeometry(Geometry::Type GeomType) const override
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
Piecewise-linear discontinuous finite elements in 3D. This class is kept only for backward compatibil...
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
int DofForGeometry(Geometry::Type GeomType) const override
Piecewise-(bi/tri)linear continuous finite elements.
int DofForGeometry(Geometry::Type GeomType) const override
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
Piecewise-linear nonconforming finite elements in 3D.
int DofForGeometry(Geometry::Type GeomType) const override
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
Discontinuous collection defined locally by a given finite element.
Local_FECollection(const char *fe_name)
Lowest order Nedelec finite elements in 3D. This class is kept only for backward compatibility,...
int DofForGeometry(Geometry::Type GeomType) const override
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
Arbitrary order H(curl)-conforming Nedelec finite elements.
int ND_dof[Geometry::NumGeom]
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
FiniteElementCollection * GetTraceCollection() const override
Returns a collection of the trace elements.
virtual ~ND_FECollection()
const StatelessDofTransformation * DofTransformationForGeometry(Geometry::Type GeomType) const override
Returns a DoF transformation object compatible with this basis and geometry type.
FiniteElement * ND_Elements[Geometry::NumGeom]
ND_FECollection(const int p, const int dim, const int cb_type=BasisType::GaussLobatto, const int ob_type=BasisType::GaussLegendre)
Arbitrary order Nedelec elements in 3D on a cube.
Arbitrary order Nedelec elements in 2D on a square.
Arbitrary order 3D H(curl)-conforming Nedelec finite elements in 1D.
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
virtual ~ND_R1D_FECollection()
int ND_dof[Geometry::NumGeom]
ND_R1D_FECollection(const int p, const int dim, const int cb_type=BasisType::GaussLobatto, const int ob_type=BasisType::GaussLegendre)
FiniteElement * ND_Elements[Geometry::NumGeom]
FiniteElementCollection * GetTraceCollection() const override
Returns a collection of the trace elements.
A 0D Nedelec finite element for the boundary of a 1D domain.
Arbitrary order, three component, Nedelec elements in 1D on a segment.
Arbitrary order 3D H(curl)-conforming Nedelec finite elements in 2D.
FiniteElementCollection * GetTraceCollection() const override
Returns a collection of the trace elements.
ND_R2D_FECollection(const int p, const int dim, const int cb_type=BasisType::GaussLobatto, const int ob_type=BasisType::GaussLegendre)
virtual ~ND_R2D_FECollection()
FiniteElement * ND_Elements[Geometry::NumGeom]
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
int ND_dof[Geometry::NumGeom]
Arbitrary order Nedelec 3D elements in 2D on a square.
Arbitrary order 3D H(curl)-trace finite elements in 2D defined on the interface between mesh elements...
ND_R2D_Trace_FECollection(const int p, const int dim, const int cb_type=BasisType::GaussLobatto, const int ob_type=BasisType::GaussLegendre)
Arbitrary order Nedelec 3D elements in 2D on a triangle.
Arbitrary order Nedelec elements in 1D on a segment.
Arbitrary order Nedelec elements in 3D on a tetrahedron.
Arbitrary order H(curl)-trace finite elements defined on the interface between mesh elements (faces,...
ND_Trace_FECollection(const int p, const int dim, const int cb_type=BasisType::GaussLobatto, const int ob_type=BasisType::GaussLegendre)
Arbitrary order Nedelec elements in 2D on a triangle.
An arbitrary order 1D NURBS element on a segment.
An arbitrary order 2D NURBS element on a square.
An arbitrary order 3D NURBS element on a cube.
Arbitrary order non-uniform rational B-splines (NURBS) finite elements.
virtual ~NURBSFECollection()
int DofForGeometry(Geometry::Type GeomType) const override
virtual void SetOrder(int Order) const
Set the order and the name, based on the given Order: either a positive number for fixed order,...
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
NURBS2DFiniteElement * QuadrilateralFE
NURBS1DFiniteElement * SegmentFE
NURBSFECollection(int Order=VariableOrder)
The parameter Order must be either a positive number, for fixed order, or VariableOrder (default).
FiniteElementCollection * GetTraceCollection() const override
Returns a collection of the trace elements.
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
NURBS3DFiniteElement * ParallelepipedFE
PointFiniteElement * PointFE
Arbitrary order H(curl) NURBS finite elements.
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
void SetOrder(int Order) const override
Set the order and the name, based on the given Order: either a positive number for fixed order,...
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
NURBS_HCurlFECollection(int Order=VariableOrder, const int vdim=-1)
The parameter Order must be either a positive number, for fixed order, or VariableOrder (default).
void SetDim(const int dim) override
int DofForGeometry(Geometry::Type GeomType) const override
virtual ~NURBS_HCurlFECollection()
FiniteElementCollection * GetTraceCollection() const override
Returns a collection of the trace elements.
Arbitrary order H(div) NURBS finite elements.
void SetDim(const int dim) override
int DofForGeometry(Geometry::Type GeomType) const override
void SetOrder(int Order) const override
Set the order and the name, based on the given Order: either a positive number for fixed order,...
FiniteElementCollection * GetTraceCollection() const override
Returns a collection of the trace elements.
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
NURBS_HDivFECollection(int Order=VariableOrder, const int vdim=-1)
The parameter Order must be either a positive number, for fixed order, or VariableOrder (default).
virtual ~NURBS_HDivFECollection()
A 3D 1st order Nedelec element on a cube.
Class for standard nodal finite elements.
const Array< int > & GetLexicographicOrdering() const
Get an Array<int> that maps lexicographically ordered indices to the indices of the respective nodes/...
void SetMapType(const int map_type_) override
Set the FiniteElement::MapType of the element to either VALUE or INTEGRAL. Also sets the FiniteElemen...
Linear (P1) finite elements on quadrilaterals.
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
int DofForGeometry(Geometry::Type GeomType) const override
A 0D point finite element.
Piecewise-quadratic discontinuous finite elements in 2D. This class is kept only for backward compati...
int DofForGeometry(Geometry::Type GeomType) const override
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
Piecewise-quadratic discontinuous finite elements in 3D. This class is kept only for backward compati...
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
int DofForGeometry(Geometry::Type GeomType) const override
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
Piecewise-(bi)quadratic continuous finite elements.
int DofForGeometry(Geometry::Type GeomType) const override
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
Version of QuadraticDiscont2DFECollection with positive basis functions.
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
int DofForGeometry(Geometry::Type GeomType) const override
Version of QuadraticFECollection with positive basis functions.
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
int DofForGeometry(Geometry::Type GeomType) const override
static int CheckOpen(int type)
If the Quadrature1D type is not open return Invalid; otherwise return type.
static int CheckClosed(int type)
If the Quadrature1D type is not closed return Invalid; otherwise return type.
First order Raviart-Thomas finite elements in 2D. This class is kept only for backward compatibility,...
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
int DofForGeometry(Geometry::Type GeomType) const override
First order Raviart-Thomas finite elements in 3D. This class is kept only for backward compatibility,...
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
int DofForGeometry(Geometry::Type GeomType) const override
Second order Raviart-Thomas finite elements in 2D. This class is kept only for backward compatibility...
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
int DofForGeometry(Geometry::Type GeomType) const override
Second order Raviart-Thomas finite elements in 3D. This class is kept only for backward compatibility...
int DofForGeometry(Geometry::Type GeomType) const override
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
Third order Raviart-Thomas finite elements in 2D. This class is kept only for backward compatibility,...
int DofForGeometry(Geometry::Type GeomType) const override
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
Arbitrary order H(div)-conforming Raviart-Thomas finite elements.
int RT_dof[Geometry::NumGeom]
FiniteElement * RT_Elements[Geometry::NumGeom]
void InitFaces(const int p, const int dim, const int map_type, const bool signs)
virtual ~RT_FECollection()
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
FiniteElementCollection * GetTraceCollection() const override
Returns a collection of the trace elements.
RT_FECollection(const int p, const int dim, const int map_type, const bool signs, const int ob_type=BasisType::GaussLegendre)
Arbitrary order Raviart-Thomas elements in 3D on a cube.
Arbitrary order Raviart-Thomas elements in 2D on a square.
Arbitrary order 3D H(div)-conforming Raviart-Thomas finite elements in 1D.
virtual ~RT_R1D_FECollection()
FiniteElementCollection * GetTraceCollection() const override
Returns a collection of the trace elements.
FiniteElement * RT_Elements[Geometry::NumGeom]
RT_R1D_FECollection(const int p, const int dim, const int cb_type=BasisType::GaussLobatto, const int ob_type=BasisType::GaussLegendre)
int RT_dof[Geometry::NumGeom]
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
Arbitrary order, three component, Raviart-Thomas elements in 1D on a segment.
Arbitrary order 3D H(div)-conforming Raviart-Thomas finite elements in 2D.
void InitFaces(const int p, const int dim, const int map_type, const bool signs)
RT_R2D_FECollection(const int p, const int dim, const int map_type, const bool signs, const int ob_type=BasisType::GaussLegendre)
FiniteElement * RT_Elements[Geometry::NumGeom]
virtual ~RT_R2D_FECollection()
int RT_dof[Geometry::NumGeom]
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
FiniteElementCollection * GetTraceCollection() const override
Returns a collection of the trace elements.
Arbitrary order Raviart-Thomas 3D elements in 2D on a square.
Arbitrary order 3D "H^{-1/2}-conforming" face finite elements defined on the interface between mesh e...
RT_R2D_Trace_FECollection(const int p, const int dim, const int map_type=FiniteElement::INTEGRAL, const int ob_type=BasisType::GaussLegendre)
Arbitrary order Raviart-Thomas 3D elements in 2D on a triangle.
Arbitrary order Raviart-Thomas elements in 3D on a tetrahedron.
Arbitrary order "H^{-1/2}-conforming" face finite elements defined on the interface between mesh elem...
RT_Trace_FECollection(const int p, const int dim, const int map_type=FiniteElement::INTEGRAL, const int ob_type=BasisType::GaussLegendre)
Arbitrary order Raviart-Thomas elements in 2D on a triangle.
const FiniteElement * FiniteElementForGeometry(Geometry::Type GeomType) const override
int DofForGeometry(Geometry::Type GeomType) const override
const int * DofOrderForOrientation(Geometry::Type GeomType, int Or) const override
Returns an array, say p, that maps a local permuted index i to a local base index: base_i = p[i].
virtual void SetMapType(int M)
Set the FiniteElement::MapType of the element to either VALUE or INTEGRAL. Also sets the FiniteElemen...
void mfem_error(const char *msg)
OutStream err(std::cerr)
Global stream used by the library for standard error output. Initially it uses the same std::streambu...
std::function< real_t(const Vector &)> f(real_t mass_coeff)
real_t p(const Vector &x, real_t t)