323 static const int c_swap_table_0 = 0;
325 static const int c_swap_table_1[8][3][2] = {
351 static const int c_swap_table_2[8][3][6] = {
352 {{-1, -1, -1, -1, -1, -1},
361 {{-1, -1, -1, -1, -1, -1},
364 {{-1, -1, -1, -1, -1, -1},
373 {{-1, -1, -1, -1, -1, -1},
375 {0, 0, 0, 1, 1, 1}}};
377 static const int c_swap_table_3[8][3][12] = {
379 {{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
380 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
381 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
382 {{0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11},
383 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
384 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
385 {{0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11},
386 {1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0},
387 {0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0}},
388 {{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
389 {0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0},
390 {1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0}},
391 {{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
392 {1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0},
393 {1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0}},
394 {{0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11},
395 {1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0},
396 {1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0}},
397 {{0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11},
398 {0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0},
399 {1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0}},
400 {{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
401 {1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0},
402 {0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0}}};
404 static const int c_swap_table_4[8][3][20] = {
408 {{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
409 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
410 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
411 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
412 {{0, 5, 10, 15, 1, 6, 11, 16, 2, 7,
413 12, 17, 3, 8, 13, 18, 4, 9, 14, 19},
414 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
415 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
416 {{0, 5, 10, 15, 1, 6, 11, 16, 2, 7,
417 12, 17, 3, 8, 13, 18, 4, 9, 14, 19},
418 {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1},
419 {1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1}},
420 {{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
421 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
422 {1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1},
423 {0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}},
424 {{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
425 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
426 {1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0},
427 {1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0}},
428 {{0, 5, 10, 15, 1, 6, 11, 16, 2, 7,
429 12, 17, 3, 8, 13, 18, 4, 9, 14, 19},
430 {1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0},
431 {1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0}},
432 {{0, 5, 10, 15, 1, 6, 11, 16, 2, 7,
433 12, 17, 3, 8, 13, 18, 4, 9, 14, 19},
434 {1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1},
435 {0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}},
436 {{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
437 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
438 {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1},
439 {1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1}}};
441 static const int *swap_table_array[5] = {&c_swap_table_0,
442 &c_swap_table_1[0][0][0],
443 &c_swap_table_2[0][0][0],
444 &c_swap_table_3[0][0][0],
445 &c_swap_table_4[0][0][0]};
447 static const int row_length[5] = {0, 2, 6, 12, 20};
448 static const int table_size[5] = {
449 0, 8 * 3 * 2, 8 * 3 * 6, 8 * 3 * 12, 8 * 3 * 20};
473 const unsigned int face_no = 0;
490 const int *swap_table = swap_table_array[k];
492 const unsigned int half_dofs = k * (k + 1);
494 const int rl = row_length[k];
496 combined_orientation <
498 ++combined_orientation)
508 for (
unsigned int indx_x = 0; indx_x < half_dofs; indx_x++)
510 int offset = 3 * rl * combined_orientation + 0 * rl + indx_x;
512 int value = *(swap_table + offset);
518 const unsigned int indx_y =
519 half_dofs +
static_cast<unsigned int>(
value);
523 indx_x, combined_orientation) = indx_y - indx_x;
526 indx_y, combined_orientation) = indx_x - indx_y;
530 offset = 3 * rl * combined_orientation + 1 * rl + indx_x;
532 value = *(swap_table + offset);
536 indx_x, combined_orientation) =
static_cast<bool>(
value);
539 offset = 3 * rl * combined_orientation + 2 * rl + indx_x;
541 value = *(swap_table + offset);
545 indx_x + half_dofs, combined_orientation) =
546 static_cast<bool>(
value);
900 const std::vector<Point<1>> &edge_quadrature_points =
901 edge_quadrature.get_points();
902 const unsigned int n_edge_quadrature_points = edge_quadrature.size();
914 for (
unsigned int q_point = 0; q_point < n_edge_quadrature_points;
917 const double weight = 2.0 * edge_quadrature.weight(q_point);
919 if (edge_quadrature_points[q_point][0] < 0.5)
922 0.0, 2.0 * edge_quadrature_points[q_point][0]);
927 quadrature_point[0] = 1.0;
931 quadrature_point[0] = quadrature_point[1];
932 quadrature_point[1] = 0.0;
933 this->
restriction[index][0](2 * this->degree, dof) +=
936 quadrature_point[1] = 1.0;
937 this->
restriction[index][2](3 * this->degree, dof) +=
945 0.0, 2.0 * edge_quadrature_points[q_point][0] - 1.0);
950 quadrature_point[0] = 1.0;
954 quadrature_point[0] = quadrature_point[1];
955 quadrature_point[1] = 0.0;
956 this->
restriction[index][1](2 * this->degree, dof) +=
959 quadrature_point[1] = 1.0;
960 this->
restriction[index][3](3 * this->degree, dof) +=
972 const unsigned int deg = this->
degree - 1;
973 const std::vector<Polynomials::Polynomial<double>>
974 &legendre_polynomials =
980 n_edge_quadrature_points);
982 for (
unsigned int q_point = 0;
983 q_point < n_edge_quadrature_points;
986 const double weight =
987 std::sqrt(edge_quadrature.weight(q_point));
989 for (
unsigned int i = 0; i < deg; ++i)
990 assembling_matrix(i, q_point) =
991 weight * legendre_polynomials[i + 1].value(
992 edge_quadrature_points[q_point][0]);
997 assembling_matrix.
mTmult(system_matrix, assembling_matrix);
998 system_matrix_inv.
invert(system_matrix);
1005 for (
unsigned int dof = 0; dof < this->n_dofs_per_cell(); ++dof)
1006 for (
unsigned int i = 0; i < 2; ++i)
1010 for (
unsigned int q_point = 0;
1011 q_point < n_edge_quadrature_points;
1014 const double weight = edge_quadrature.weight(q_point);
1016 i, edge_quadrature_points[q_point][0]);
1018 edge_quadrature_points[q_point][0], i);
1020 if (edge_quadrature_points[q_point][0] < 0.5)
1023 i, 2.0 * edge_quadrature_points[q_point][0]);
1028 dof, quadrature_point_2, 1) -
1042 2.0 * edge_quadrature_points[q_point][0], i);
1046 dof, quadrature_point_2, 0) -
1047 this->restriction[index][2 * i]((i + 2) *
1056 this->restriction[index][2 * i + 1](
1057 (i + 2) * this->degree, dof) *
1059 (i + 2) * this->degree, quadrature_point_1, 0);
1074 2.0 * edge_quadrature_points[q_point][0] - 1.0);
1079 dof, quadrature_point_2, 1) -
1080 this->restriction[index][i + 2](i * this->degree,
1087 this->restriction[index][2 * i]((i + 2) *
1091 (i + 2) * this->degree, quadrature_point_1, 0);
1093 2.0 * edge_quadrature_points[q_point][0] - 1.0,
1098 dof, quadrature_point_2, 0) -
1099 this->restriction[index][2 * i + 1](
1100 (i + 2) * this->degree, dof) *
1107 for (
unsigned int j = 0; j < this->
degree - 1; ++j)
1110 legendre_polynomials[j + 1].value(
1111 edge_quadrature_points[q_point][0]);
1113 for (
unsigned int k = 0; k < tmp.
size(); ++k)
1114 system_rhs(j, k) += tmp(k) * L_j;
1118 system_matrix_inv.
mmult(solution, system_rhs);
1120 for (
unsigned int j = 0; j < this->
degree - 1; ++j)
1121 for (
unsigned int k = 0; k < 2; ++k)
1123 if (
std::abs(solution(j, k)) > 1e-14)
1125 i * this->degree + j + 1, dof) = solution(j, k);
1127 if (
std::abs(solution(j, k + 2)) > 1e-14)
1129 (i + 2) * this->degree + j + 1, dof) =
1135 const std::vector<Point<dim>> &quadrature_points =
1136 quadrature.get_points();
1137 const std::vector<Polynomials::Polynomial<double>>
1138 &lobatto_polynomials =
1140 const unsigned int n_boundary_dofs =
1142 const unsigned int n_quadrature_points = quadrature.size();
1147 n_quadrature_points);
1149 for (
unsigned int q_point = 0; q_point < n_quadrature_points;
1152 const double weight =
std::sqrt(quadrature.weight(q_point));
1154 for (
unsigned int i = 0; i < this->degree; ++i)
1157 weight * legendre_polynomials[i].value(
1158 quadrature_points[q_point][0]);
1160 for (
unsigned int j = 0; j < this->degree - 1; ++j)
1161 assembling_matrix(i * (this->degree - 1) + j,
1163 L_i * lobatto_polynomials[j + 2].value(
1164 quadrature_points[q_point][1]);
1169 assembling_matrix.
m());
1171 assembling_matrix.
mTmult(system_matrix, assembling_matrix);
1172 system_matrix_inv.reinit(system_matrix.
m(), system_matrix.
m());
1173 system_matrix_inv.
invert(system_matrix);
1176 solution.reinit(system_matrix_inv.
m(), 8);
1177 system_rhs.reinit(system_matrix_inv.
m(), 8);
1180 for (
unsigned int dof = 0; dof < this->n_dofs_per_cell(); ++dof)
1184 for (
unsigned int q_point = 0; q_point < n_quadrature_points;
1189 if (quadrature_points[q_point][0] < 0.5)
1191 if (quadrature_points[q_point][1] < 0.5)
1194 2.0 * quadrature_points[q_point][0],
1195 2.0 * quadrature_points[q_point][1]);
1198 dof, quadrature_point, 0);
1200 dof, quadrature_point, 1);
1206 2.0 * quadrature_points[q_point][0],
1207 2.0 * quadrature_points[q_point][1] - 1.0);
1210 dof, quadrature_point, 0);
1212 dof, quadrature_point, 1);
1216 else if (quadrature_points[q_point][1] < 0.5)
1219 2.0 * quadrature_points[q_point][0] - 1.0,
1220 2.0 * quadrature_points[q_point][1]);
1235 2.0 * quadrature_points[q_point][0] - 1.0,
1236 2.0 * quadrature_points[q_point][1] - 1.0);
1248 for (
unsigned int i = 0; i < 2; ++i)
1249 for (
unsigned int j = 0; j < this->degree; ++j)
1255 j + 2 * this->degree,
1256 quadrature_points[q_point],
1262 i * this->degree + j,
1263 quadrature_points[q_point],
1265 tmp(2 * (i + 2)) -= this->
restriction[index][i + 2](
1266 j + 3 * this->degree, dof) *
1268 j + 3 * this->degree,
1269 quadrature_points[q_point],
1271 tmp(2 * i + 5) -= this->
restriction[index][i + 2](
1272 i * this->degree + j, dof) *
1274 i * this->degree + j,
1275 quadrature_points[q_point],
1279 tmp *= quadrature.weight(q_point);
1281 for (
unsigned int i = 0; i < this->degree; ++i)
1283 const double L_i_0 = legendre_polynomials[i].value(
1284 quadrature_points[q_point][0]);
1285 const double L_i_1 = legendre_polynomials[i].value(
1286 quadrature_points[q_point][1]);
1288 for (
unsigned int j = 0; j < this->degree - 1; ++j)
1290 const double l_j_0 =
1291 L_i_0 * lobatto_polynomials[j + 2].value(
1292 quadrature_points[q_point][1]);
1293 const double l_j_1 =
1294 L_i_1 * lobatto_polynomials[j + 2].value(
1295 quadrature_points[q_point][0]);
1297 for (
unsigned int k = 0; k < 4; ++k)
1299 system_rhs(i * (this->degree - 1) + j,
1300 2 * k) += tmp(2 * k) * l_j_0;
1301 system_rhs(i * (this->degree - 1) + j,
1303 tmp(2 * k + 1) * l_j_1;
1309 system_matrix_inv.
mmult(solution, system_rhs);
1311 for (
unsigned int i = 0; i < this->degree; ++i)
1312 for (
unsigned int j = 0; j < this->degree - 1; ++j)
1313 for (
unsigned int k = 0; k < 4; ++k)
1315 if (
std::abs(solution(i * (this->degree - 1) + j,
1317 this->
restriction[index][k](i * (this->degree - 1) +
1318 j + n_boundary_dofs,
1320 solution(i * (this->degree - 1) + j, 2 * k);
1322 if (
std::abs(solution(i * (this->degree - 1) + j,
1323 2 * k + 1)) > 1e-14)
1325 i + (this->degree - 1 + j) * this->degree +
1328 solution(i * (this->degree - 1) + j, 2 * k + 1);
1343 for (
unsigned int q_point = 0; q_point < n_edge_quadrature_points;
1346 const double weight = 2.0 * edge_quadrature.weight(q_point);
1348 if (edge_quadrature_points[q_point][0] < 0.5)
1349 for (
unsigned int i = 0; i < 2; ++i)
1350 for (
unsigned int j = 0; j < 2; ++j)
1353 i, 2.0 * edge_quadrature_points[q_point][0], j);
1361 Point<dim>(2.0 * edge_quadrature_points[q_point][0],
1365 (i + 4 * j + 2) * this->degree, dof) +=
1371 2.0 * edge_quadrature_points[q_point][0]);
1372 this->
restriction[index][i + 2 * j]((i + 2 * (j + 4)) *
1376 this->shape_value_component(dof, quadrature_point, 2);
1380 for (
unsigned int i = 0; i < 2; ++i)
1381 for (
unsigned int j = 0; j < 2; ++j)
1384 i, 2.0 * edge_quadrature_points[q_point][0] - 1.0, j);
1386 this->
restriction[index][i + 4 * j + 2]((i + 4 * j) *
1392 2.0 * edge_quadrature_points[q_point][0] - 1.0, i, j);
1394 (i + 4 * j + 2) * this->degree, dof) +=
1398 i, j, 2.0 * edge_quadrature_points[q_point][0] - 1.0);
1400 (i + 2 * (j + 4)) * this->degree, dof) +=
1402 this->shape_value_component(dof, quadrature_point, 2);
1412 const unsigned int deg = this->
degree - 1;
1413 const std::vector<Polynomials::Polynomial<double>>
1414 &legendre_polynomials =
1420 n_edge_quadrature_points);
1422 for (
unsigned int q_point = 0;
1423 q_point < n_edge_quadrature_points;
1426 const double weight =
1427 std::sqrt(edge_quadrature.weight(q_point));
1429 for (
unsigned int i = 0; i < deg; ++i)
1430 assembling_matrix(i, q_point) =
1431 weight * legendre_polynomials[i + 1].value(
1432 edge_quadrature_points[q_point][0]);
1437 assembling_matrix.
mTmult(system_matrix, assembling_matrix);
1438 system_matrix_inv.
invert(system_matrix);
1445 for (
unsigned int i = 0; i < 2; ++i)
1446 for (
unsigned int j = 0; j < 2; ++j)
1447 for (
unsigned int dof = 0; dof < this->n_dofs_per_cell();
1452 for (
unsigned int q_point = 0;
1453 q_point < n_edge_quadrature_points;
1456 const double weight = edge_quadrature.weight(q_point);
1458 i, edge_quadrature_points[q_point][0], j);
1460 edge_quadrature_points[q_point][0], i, j);
1462 i, j, edge_quadrature_points[q_point][0]);
1464 if (edge_quadrature_points[q_point][0] < 0.5)
1467 i, 2.0 * edge_quadrature_points[q_point][0], j);
1471 dof, quadrature_point_3, 1) -
1473 (i + 4 * j) * this->
degree, dof) *
1475 (i + 4 * j) * this->degree,
1481 (i + 4 * j) * this->degree, dof) *
1487 2.0 * edge_quadrature_points[q_point][0], i, j);
1491 dof, quadrature_point_3, 0) -
1492 this->restriction[index][2 * (i + 2 * j)](
1493 (i + 4 * j + 2) * this->degree, dof) *
1495 (i + 4 * j + 2) * this->degree,
1500 this->restriction[index][2 * (i + 2 * j) + 1](
1501 (i + 4 * j + 2) * this->degree, dof) *
1507 i, j, 2.0 * edge_quadrature_points[q_point][0]);
1510 (2.0 * this->shape_value_component(
1511 dof, quadrature_point_3, 2) -
1512 this->restriction[index][i + 2 * j](
1513 (i + 2 * (j + 4)) * this->degree, dof) *
1514 this->shape_value_component(
1515 (i + 2 * (j + 4)) * this->degree,
1520 this->restriction[index][i + 2 * (j + 2)](
1521 (i + 2 * (j + 4)) * this->degree, dof) *
1522 this->shape_value_component((i + 2 * (j + 4)) *
1533 (i + 4 * j) * this->
degree, dof) *
1541 2.0 * edge_quadrature_points[q_point][0] - 1.0,
1546 dof, quadrature_point_3, 1) -
1547 this->restriction[index][i + 4 * j + 2](
1548 (i + 4 * j) * this->degree, dof) *
1550 (i + 4 * j) * this->degree,
1555 this->restriction[index][2 * (i + 2 * j)](
1556 (i + 4 * j + 2) * this->degree, dof) *
1562 2.0 * edge_quadrature_points[q_point][0] - 1.0,
1567 (2.0 * this->shape_value_component(
1568 dof, quadrature_point_3, 0) -
1569 this->restriction[index][2 * (i + 2 * j) + 1](
1570 (i + 4 * j + 2) * this->degree, dof) *
1571 this->shape_value_component(
1572 (i + 4 * j + 2) * this->degree,
1577 this->restriction[index][i + 2 * j](
1578 (i + 2 * (j + 4)) * this->degree, dof) *
1579 this->shape_value_component((i + 2 * (j + 4)) *
1586 2.0 * edge_quadrature_points[q_point][0] - 1.0);
1589 (2.0 * this->shape_value_component(
1590 dof, quadrature_point_3, 2) -
1591 this->restriction[index][i + 2 * (j + 2)](
1592 (i + 2 * (j + 4)) * this->degree, dof) *
1593 this->shape_value_component(
1594 (i + 2 * (j + 4)) * this->degree,
1599 for (
unsigned int k = 0; k < deg; ++k)
1602 legendre_polynomials[k + 1].value(
1603 edge_quadrature_points[q_point][0]);
1605 for (
unsigned int l = 0; l < tmp.
size(); ++l)
1606 system_rhs(k, l) += tmp(l) * L_k;
1610 system_matrix_inv.
mmult(solution, system_rhs);
1612 for (
unsigned int k = 0; k < 2; ++k)
1613 for (
unsigned int l = 0; l < deg; ++l)
1615 if (
std::abs(solution(l, k)) > 1e-14)
1617 (i + 4 * j) * this->
degree + l + 1, dof) =
1620 if (
std::abs(solution(l, k + 2)) > 1e-14)
1622 (i + 4 * j + 2) * this->
degree + l + 1, dof) =
1625 if (
std::abs(solution(l, k + 4)) > 1e-14)
1627 (i + 2 * (j + 4)) * this->
degree + l + 1, dof) =
1633 const std::vector<Point<2>> &face_quadrature_points =
1634 face_quadrature.get_points();
1635 const std::vector<Polynomials::Polynomial<double>>
1636 &lobatto_polynomials =
1638 const unsigned int n_edge_dofs =
1640 const unsigned int n_face_quadrature_points =
1641 face_quadrature.size();
1645 n_face_quadrature_points);
1647 for (
unsigned int q_point = 0;
1648 q_point < n_face_quadrature_points;
1651 const double weight =
1652 std::sqrt(face_quadrature.weight(q_point));
1654 for (
unsigned int i = 0; i <= deg; ++i)
1657 weight * legendre_polynomials[i].value(
1658 face_quadrature_points[q_point][0]);
1660 for (
unsigned int j = 0; j < deg; ++j)
1661 assembling_matrix(i * deg + j, q_point) =
1662 L_i * lobatto_polynomials[j + 2].value(
1663 face_quadrature_points[q_point][1]);
1668 assembling_matrix.
m());
1670 assembling_matrix.
mTmult(system_matrix, assembling_matrix);
1671 system_matrix_inv.reinit(system_matrix.
m(), system_matrix.
m());
1672 system_matrix_inv.
invert(system_matrix);
1675 solution.reinit(system_matrix_inv.
m(), 24);
1676 system_rhs.reinit(system_matrix_inv.
m(), 24);
1679 for (
unsigned int i = 0; i < 2; ++i)
1680 for (
unsigned int dof = 0; dof < this->n_dofs_per_cell(); ++dof)
1684 for (
unsigned int q_point = 0;
1685 q_point < n_face_quadrature_points;
1690 if (face_quadrature_points[q_point][0] < 0.5)
1692 if (face_quadrature_points[q_point][1] < 0.5)
1696 2.0 * face_quadrature_points[q_point][0],
1697 2.0 * face_quadrature_points[q_point][1]);
1700 dof, quadrature_point_0, 1);
1702 dof, quadrature_point_0, 2);
1704 2.0 * face_quadrature_points[q_point][0],
1706 2.0 * face_quadrature_points[q_point][1]);
1708 dof, quadrature_point_0, 2);
1710 dof, quadrature_point_0, 0);
1712 2.0 * face_quadrature_points[q_point][0],
1713 2.0 * face_quadrature_points[q_point][1],
1716 dof, quadrature_point_0, 0);
1718 dof, quadrature_point_0, 1);
1725 2.0 * face_quadrature_points[q_point][0],
1726 2.0 * face_quadrature_points[q_point][1] -
1730 dof, quadrature_point_0, 1);
1732 dof, quadrature_point_0, 2);
1734 2.0 * face_quadrature_points[q_point][0],
1736 2.0 * face_quadrature_points[q_point][1] -
1739 dof, quadrature_point_0, 2);
1741 dof, quadrature_point_0, 0);
1743 2.0 * face_quadrature_points[q_point][0],
1744 2.0 * face_quadrature_points[q_point][1] -
1748 dof, quadrature_point_0, 0);
1750 dof, quadrature_point_0, 1);
1754 else if (face_quadrature_points[q_point][1] < 0.5)
1758 2.0 * face_quadrature_points[q_point][0] - 1.0,
1759 2.0 * face_quadrature_points[q_point][1]);
1762 dof, quadrature_point_0, 1);
1764 dof, quadrature_point_0, 2);
1766 2.0 * face_quadrature_points[q_point][0] - 1.0,
1768 2.0 * face_quadrature_points[q_point][1]);
1770 dof, quadrature_point_0, 2);
1772 dof, quadrature_point_0, 0);
1774 2.0 * face_quadrature_points[q_point][0] - 1.0,
1775 2.0 * face_quadrature_points[q_point][1],
1778 dof, quadrature_point_0, 0);
1780 dof, quadrature_point_0, 1);
1787 2.0 * face_quadrature_points[q_point][0] - 1.0,
1788 2.0 * face_quadrature_points[q_point][1] - 1.0);
1791 dof, quadrature_point_0, 1);
1793 dof, quadrature_point_0, 2);
1795 2.0 * face_quadrature_points[q_point][0] - 1.0,
1797 2.0 * face_quadrature_points[q_point][1] - 1.0);
1799 dof, quadrature_point_0, 2);
1801 dof, quadrature_point_0, 0);
1803 2.0 * face_quadrature_points[q_point][0] - 1.0,
1804 2.0 * face_quadrature_points[q_point][1] - 1.0,
1807 dof, quadrature_point_0, 0);
1809 dof, quadrature_point_0, 1);
1814 face_quadrature_points[q_point][0],
1815 face_quadrature_points[q_point][1]);
1817 face_quadrature_points[q_point][0],
1819 face_quadrature_points[q_point][1]);
1821 face_quadrature_points[q_point][0],
1822 face_quadrature_points[q_point][1],
1825 for (
unsigned int j = 0; j < 2; ++j)
1826 for (
unsigned int k = 0; k < 2; ++k)
1827 for (
unsigned int l = 0; l <= deg; ++l)
1829 tmp(2 * (j + 2 * k)) -=
1831 (i + 4 * j) * this->degree + l, dof) *
1833 (i + 4 * j) * this->degree + l,
1836 tmp(2 * (j + 2 * k) + 1) -=
1838 (i + 2 * (k + 4)) * this->degree + l, dof) *
1840 (i + 2 * (k + 4)) * this->degree + l,
1843 tmp(2 * (j + 2 * (k + 2))) -=
1845 (2 * (i + 4) + k) * this->degree + l, dof) *
1847 (2 * (i + 4) + k) * this->degree + l,
1850 tmp(2 * (j + 2 * k) + 9) -=
1852 (i + 4 * j + 2) * this->degree + l, dof) *
1854 (i + 4 * j + 2) * this->degree + l,
1857 tmp(2 * (j + 2 * (k + 4))) -=
1859 (4 * i + j + 2) * this->degree + l, dof) *
1861 (4 * i + j + 2) * this->degree + l,
1864 tmp(2 * (j + 2 * k) + 17) -=
1866 (4 * i + k) * this->degree + l, dof) *
1868 (4 * i + k) * this->degree + l,
1873 tmp *= face_quadrature.weight(q_point);
1875 for (
unsigned int j = 0; j <= deg; ++j)
1877 const double L_j_0 = legendre_polynomials[j].value(
1878 face_quadrature_points[q_point][0]);
1879 const double L_j_1 = legendre_polynomials[j].value(
1880 face_quadrature_points[q_point][1]);
1882 for (
unsigned int k = 0; k < deg; ++k)
1884 const double l_k_0 =
1885 L_j_0 * lobatto_polynomials[k + 2].value(
1886 face_quadrature_points[q_point][1]);
1887 const double l_k_1 =
1888 L_j_1 * lobatto_polynomials[k + 2].value(
1889 face_quadrature_points[q_point][0]);
1891 for (
unsigned int l = 0; l < 4; ++l)
1893 system_rhs(j * deg + k, 2 * l) +=
1895 system_rhs(j * deg + k, 2 * l + 1) +=
1896 tmp(2 * l + 1) * l_k_1;
1897 system_rhs(j * deg + k, 2 * (l + 4)) +=
1898 tmp(2 * (l + 4)) * l_k_1;
1899 system_rhs(j * deg + k, 2 * l + 9) +=
1900 tmp(2 * l + 9) * l_k_0;
1901 system_rhs(j * deg + k, 2 * (l + 8)) +=
1902 tmp(2 * (l + 8)) * l_k_0;
1903 system_rhs(j * deg + k, 2 * l + 17) +=
1904 tmp(2 * l + 17) * l_k_1;
1910 system_matrix_inv.
mmult(solution, system_rhs);
1912 for (
unsigned int j = 0; j < 2; ++j)
1913 for (
unsigned int k = 0; k < 2; ++k)
1914 for (
unsigned int l = 0; l <= deg; ++l)
1915 for (
unsigned int m = 0; m < deg; ++m)
1918 2 * (j + 2 * k))) > 1e-14)
1920 (2 * i * this->degree + l) * deg + m +
1922 dof) = solution(l * deg + m, 2 * (j + 2 * k));
1925 2 * (j + 2 * k) + 1)) >
1928 ((2 * i + 1) * deg + m) * this->degree + l +
1931 solution(l * deg + m, 2 * (j + 2 * k) + 1);
1934 2 * (j + 2 * (k + 2)))) >
1937 (2 * (i + 2) * this->degree + l) * deg + m +
1940 solution(l * deg + m, 2 * (j + 2 * (k + 2)));
1943 2 * (j + 2 * k) + 9)) >
1946 ((2 * i + 5) * deg + m) * this->degree + l +
1949 solution(l * deg + m, 2 * (j + 2 * k) + 9);
1952 2 * (j + 2 * (k + 4)))) >
1955 (2 * (i + 4) * this->degree + l) * deg + m +
1958 solution(l * deg + m, 2 * (j + 2 * (k + 4)));
1961 2 * (j + 2 * k) + 17)) >
1964 ((2 * i + 9) * deg + m) * this->degree + l +
1967 solution(l * deg + m, 2 * (j + 2 * k) + 17);
1972 const std::vector<Point<dim>> &quadrature_points =
1973 quadrature.get_points();
1974 const unsigned int n_boundary_dofs =
1977 const unsigned int n_quadrature_points = quadrature.size();
1981 n_quadrature_points);
1983 for (
unsigned int q_point = 0; q_point < n_quadrature_points;
1986 const double weight =
std::sqrt(quadrature.weight(q_point));
1988 for (
unsigned int i = 0; i <= deg; ++i)
1991 weight * legendre_polynomials[i].value(
1992 quadrature_points[q_point][0]);
1994 for (
unsigned int j = 0; j < deg; ++j)
1997 L_i * lobatto_polynomials[j + 2].value(
1998 quadrature_points[q_point][1]);
2000 for (
unsigned int k = 0; k < deg; ++k)
2001 assembling_matrix((i * deg + j) * deg + k,
2003 l_j * lobatto_polynomials[k + 2].value(
2004 quadrature_points[q_point][2]);
2010 assembling_matrix.
m());
2012 assembling_matrix.
mTmult(system_matrix, assembling_matrix);
2013 system_matrix_inv.reinit(system_matrix.
m(), system_matrix.
m());
2014 system_matrix_inv.
invert(system_matrix);
2017 solution.reinit(system_matrix_inv.
m(), 24);
2018 system_rhs.reinit(system_matrix_inv.
m(), 24);
2021 for (
unsigned int dof = 0; dof < this->n_dofs_per_cell(); ++dof)
2025 for (
unsigned int q_point = 0; q_point < n_quadrature_points;
2030 if (quadrature_points[q_point][0] < 0.5)
2032 if (quadrature_points[q_point][1] < 0.5)
2034 if (quadrature_points[q_point][2] < 0.5)
2037 2.0 * quadrature_points[q_point][0],
2038 2.0 * quadrature_points[q_point][1],
2039 2.0 * quadrature_points[q_point][2]);
2042 dof, quadrature_point, 0);
2044 dof, quadrature_point, 1);
2046 dof, quadrature_point, 2);
2052 2.0 * quadrature_points[q_point][0],
2053 2.0 * quadrature_points[q_point][1],
2054 2.0 * quadrature_points[q_point][2] - 1.0);
2057 dof, quadrature_point, 0);
2059 dof, quadrature_point, 1);
2061 dof, quadrature_point, 2);
2065 else if (quadrature_points[q_point][2] < 0.5)
2068 2.0 * quadrature_points[q_point][0],
2069 2.0 * quadrature_points[q_point][1] - 1.0,
2070 2.0 * quadrature_points[q_point][2]);
2073 dof, quadrature_point, 0);
2075 dof, quadrature_point, 1);
2077 dof, quadrature_point, 2);
2083 2.0 * quadrature_points[q_point][0],
2084 2.0 * quadrature_points[q_point][1] - 1.0,
2085 2.0 * quadrature_points[q_point][2] - 1.0);
2088 dof, quadrature_point, 0);
2090 dof, quadrature_point, 1);
2092 dof, quadrature_point, 2);
2096 else if (quadrature_points[q_point][1] < 0.5)
2098 if (quadrature_points[q_point][2] < 0.5)
2101 2.0 * quadrature_points[q_point][0] - 1.0,
2102 2.0 * quadrature_points[q_point][1],
2103 2.0 * quadrature_points[q_point][2]);
2106 dof, quadrature_point, 0);
2108 dof, quadrature_point, 1);
2110 dof, quadrature_point, 2);
2116 2.0 * quadrature_points[q_point][0] - 1.0,
2117 2.0 * quadrature_points[q_point][1],
2118 2.0 * quadrature_points[q_point][2] - 1.0);
2121 dof, quadrature_point, 0);
2123 dof, quadrature_point, 1);
2125 dof, quadrature_point, 2);
2129 else if (quadrature_points[q_point][2] < 0.5)
2132 2.0 * quadrature_points[q_point][0] - 1.0,
2133 2.0 * quadrature_points[q_point][1] - 1.0,
2134 2.0 * quadrature_points[q_point][2]);
2153 2.0 * quadrature_points[q_point][0] - 1.0,
2154 2.0 * quadrature_points[q_point][1] - 1.0,
2155 2.0 * quadrature_points[q_point][2] - 1.0);
2171 for (
unsigned int i = 0; i < 2; ++i)
2172 for (
unsigned int j = 0; j < 2; ++j)
2173 for (
unsigned int k = 0; k < 2; ++k)
2174 for (
unsigned int l = 0; l <= deg; ++l)
2176 tmp(3 * (i + 2 * (j + 2 * k))) -=
2178 (4 * i + j + 2) * this->degree + l, dof) *
2180 (4 * i + j + 2) * this->degree + l,
2181 quadrature_points[q_point],
2183 tmp(3 * (i + 2 * (j + 2 * k)) + 1) -=
2185 (4 * i + k) * this->degree + l, dof) *
2187 (4 * i + k) * this->degree + l,
2188 quadrature_points[q_point],
2190 tmp(3 * (i + 2 * (j + 2 * k)) + 2) -=
2192 (2 * (j + 4) + k) * this->degree + l, dof) *
2194 (2 * (j + 4) + k) * this->degree + l,
2195 quadrature_points[q_point],
2198 for (
unsigned int m = 0; m < deg; ++m)
2200 tmp(3 * (i + 2 * (j + 2 * k))) -=
2203 ((2 * j + 5) * deg + m) * this->degree +
2207 ((2 * j + 5) * deg + m) * this->degree +
2209 quadrature_points[q_point],
2211 tmp(3 * (i + 2 * (j + 2 * k))) -=
2214 (2 * (i + 4) * this->degree + l) * deg +
2218 (2 * (i + 4) * this->degree + l) * deg +
2220 quadrature_points[q_point],
2222 tmp(3 * (i + 2 * (j + 2 * k)) + 1) -=
2225 (2 * k * this->degree + l) * deg + m +
2229 (2 * k * this->degree + l) * deg + m +
2231 quadrature_points[q_point],
2233 tmp(3 * (i + 2 * (j + 2 * k)) + 1) -=
2236 ((2 * i + 9) * deg + m) * this->degree +
2240 ((2 * i + 9) * deg + m) * this->degree +
2242 quadrature_points[q_point],
2244 tmp(3 * (i + 2 * (j + 2 * k)) + 2) -=
2247 ((2 * k + 1) * deg + m) * this->degree +
2251 ((2 * k + 1) * deg + m) * this->degree +
2253 quadrature_points[q_point],
2255 tmp(3 * (i + 2 * (j + 2 * k)) + 2) -=
2258 (2 * (j + 2) * this->degree + l) * deg +
2262 (2 * (j + 2) * this->degree + l) * deg +
2264 quadrature_points[q_point],
2269 tmp *= quadrature.weight(q_point);
2271 for (
unsigned int i = 0; i <= deg; ++i)
2273 const double L_i_0 = legendre_polynomials[i].value(
2274 quadrature_points[q_point][0]);
2275 const double L_i_1 = legendre_polynomials[i].value(
2276 quadrature_points[q_point][1]);
2277 const double L_i_2 = legendre_polynomials[i].value(
2278 quadrature_points[q_point][2]);
2280 for (
unsigned int j = 0; j < deg; ++j)
2282 const double l_j_0 =
2283 L_i_0 * lobatto_polynomials[j + 2].value(
2284 quadrature_points[q_point][1]);
2285 const double l_j_1 =
2286 L_i_1 * lobatto_polynomials[j + 2].value(
2287 quadrature_points[q_point][0]);
2288 const double l_j_2 =
2289 L_i_2 * lobatto_polynomials[j + 2].value(
2290 quadrature_points[q_point][0]);
2292 for (
unsigned int k = 0; k < deg; ++k)
2294 const double l_k_0 =
2295 l_j_0 * lobatto_polynomials[k + 2].value(
2296 quadrature_points[q_point][2]);
2297 const double l_k_1 =
2298 l_j_1 * lobatto_polynomials[k + 2].value(
2299 quadrature_points[q_point][2]);
2300 const double l_k_2 =
2301 l_j_2 * lobatto_polynomials[k + 2].value(
2302 quadrature_points[q_point][1]);
2304 for (
unsigned int l = 0; l < 8; ++l)
2306 system_rhs((i * deg + j) * deg + k,
2307 3 * l) += tmp(3 * l) * l_k_0;
2308 system_rhs((i * deg + j) * deg + k,
2310 tmp(3 * l + 1) * l_k_1;
2311 system_rhs((i * deg + j) * deg + k,
2313 tmp(3 * l + 2) * l_k_2;
2320 system_matrix_inv.
mmult(solution, system_rhs);
2322 for (
unsigned int i = 0; i < 2; ++i)
2323 for (
unsigned int j = 0; j < 2; ++j)
2324 for (
unsigned int k = 0; k < 2; ++k)
2325 for (
unsigned int l = 0; l <= deg; ++l)
2326 for (
unsigned int m = 0; m < deg; ++m)
2327 for (
unsigned int n = 0; n < deg; ++n)
2330 solution((l * deg + m) * deg + n,
2331 3 * (i + 2 * (j + 2 * k)))) >
2334 (l * deg + m) * deg + n + n_boundary_dofs,
2335 dof) = solution((l * deg + m) * deg + n,
2336 3 * (i + 2 * (j + 2 * k)));
2339 solution((l * deg + m) * deg + n,
2340 3 * (i + 2 * (j + 2 * k)) + 1)) >
2343 (l + (m + deg) * this->degree) * deg + n +
2346 solution((l * deg + m) * deg + n,
2347 3 * (i + 2 * (j + 2 * k)) + 1);
2350 solution((l * deg + m) * deg + n,
2351 3 * (i + 2 * (j + 2 * k)) + 2)) >
2355 ((m + 2 * deg) * deg + n) * this->degree +
2358 solution((l * deg + m) * deg + n,
2359 3 * (i + 2 * (j + 2 * k)) + 2);
3469 std::vector<double> &nodal_values)
const
3474 const unsigned int face_no = 0;
3476 const unsigned int deg = this->
degree - 1;
3477 Assert(support_point_values.size() == this->generalized_support_points.size(),
3479 this->generalized_support_points.size()));
3483 Assert(nodal_values.size() == this->n_dofs_per_cell(),
3485 std::fill(nodal_values.begin(), nodal_values.end(), 0.0);
3494 const unsigned int n_edge_points = reference_edge_quadrature.size();
3496 for (
unsigned int i = 0; i < 2; ++i)
3497 for (
unsigned int j = 0; j < 2; ++j)
3499 for (
unsigned int q_point = 0; q_point < n_edge_points;
3501 nodal_values[(i + 2 * j) * this->
degree] +=
3502 reference_edge_quadrature.weight(q_point) *
3503 support_point_values[q_point + (i + 2 * j) * n_edge_points]
3510 nodal_values[(i + 2 * j) * this->degree] = 0.0;
3528 const std::vector<Polynomials::Polynomial<double>>
3529 &lobatto_polynomials =
3533 std::vector<Polynomials::Polynomial<double>>
3534 lobatto_polynomials_grad(this->
degree);
3536 for (
unsigned int i = 0; i < lobatto_polynomials_grad.size(); ++i)
3537 lobatto_polynomials_grad[i] =
3538 lobatto_polynomials[i + 1].derivative();
3543 for (
unsigned int i = 0; i < system_matrix.
m(); ++i)
3544 for (
unsigned int j = 0; j < system_matrix.
n(); ++j)
3545 for (
unsigned int q_point = 0; q_point < n_edge_points;
3547 system_matrix(i, j) +=
3549 lobatto_polynomials_grad[i + 1].value(
3556 system_matrix_inv.
invert(system_matrix);
3563 for (
unsigned int line = 0;
3564 line < GeometryInfo<dim>::lines_per_cell;
3570 for (
unsigned int q_point = 0; q_point < n_edge_points;
3574 support_point_values[line * n_edge_points + q_point]
3575 [line_coordinate[line]] -
3576 nodal_values[line * this->
degree] *
3582 line_coordinate[line]);
3584 for (
unsigned int i = 0; i < system_rhs.
size(); ++i)
3588 system_matrix_inv.
vmult(solution, system_rhs);
3594 for (
unsigned int i = 0; i < solution.
size(); ++i)
3596 nodal_values[line * this->
degree + i + 1] = solution(i);
3609 const unsigned int n_interior_points =
3610 reference_quadrature.size();
3611 const std::vector<Polynomials::Polynomial<double>>
3612 &legendre_polynomials =
3616 system_matrix.reinit((this->
degree - 1) * this->
degree,
3620 for (
unsigned int i = 0; i < this->
degree; ++i)
3621 for (
unsigned int j = 0; j < this->degree - 1; ++j)
3622 for (
unsigned int k = 0; k < this->degree; ++k)
3623 for (
unsigned int l = 0; l < this->degree - 1; ++l)
3624 for (
unsigned int q_point = 0;
3625 q_point < n_interior_points;
3627 system_matrix(i * (this->degree - 1) + j,
3628 k * (this->degree - 1) + l) +=
3629 reference_quadrature.weight(q_point) *
3630 legendre_polynomials[i].value(
3633 n_edge_points][0]) *
3634 lobatto_polynomials[j + 2].value(
3637 n_edge_points][1]) *
3638 lobatto_polynomials_grad[k].value(
3641 n_edge_points][0]) *
3642 lobatto_polynomials[l + 2].value(
3647 system_matrix_inv.reinit(system_matrix.
m(), system_matrix.
m());
3648 system_matrix_inv.
invert(system_matrix);
3652 system_rhs.
reinit(system_matrix_inv.
m());
3655 for (
unsigned int q_point = 0; q_point < n_interior_points;
3659 support_point_values[q_point +
3663 for (
unsigned int i = 0; i < 2; ++i)
3664 for (
unsigned int j = 0; j <= deg; ++j)
3665 tmp -= nodal_values[(i + 2) * this->degree + j] *
3667 (i + 2) * this->degree + j,
3673 for (
unsigned int i = 0; i <= deg; ++i)
3674 for (
unsigned int j = 0; j < deg; ++j)
3675 system_rhs(i * deg + j) +=
3676 reference_quadrature.weight(q_point) * tmp *
3677 lobatto_polynomials_grad[i].value(
3680 n_edge_points][0]) *
3681 lobatto_polynomials[j + 2].value(
3687 solution.
reinit(system_matrix.
m());
3688 system_matrix_inv.
vmult(solution, system_rhs);
3694 for (
unsigned int i = 0; i <= deg; ++i)
3695 for (
unsigned int j = 0; j < deg; ++j)
3696 if (
std::abs(solution(i * deg + j)) > 1e-14)
3699 solution(i * deg + j);
3706 for (
unsigned int q_point = 0; q_point < n_interior_points;
3710 support_point_values[q_point +
3714 for (
unsigned int i = 0; i < 2; ++i)
3715 for (
unsigned int j = 0; j <= deg; ++j)
3716 tmp -= nodal_values[i * this->degree + j] *
3718 i * this->degree + j,
3724 for (
unsigned int i = 0; i <= deg; ++i)
3725 for (
unsigned int j = 0; j < deg; ++j)
3726 system_rhs(i * deg + j) +=
3727 reference_quadrature.weight(q_point) * tmp *
3728 lobatto_polynomials_grad[i].value(
3731 n_edge_points][1]) *
3732 lobatto_polynomials[j + 2].value(
3738 system_matrix_inv.
vmult(solution, system_rhs);
3744 for (
unsigned int i = 0; i <= deg; ++i)
3745 for (
unsigned int j = 0; j < deg; ++j)
3746 if (
std::abs(solution(i * deg + j)) > 1e-14)
3749 this->degree] = solution(i * deg + j);
3760 const unsigned int n_edge_points = reference_edge_quadrature.size();
3762 for (
unsigned int q_point = 0; q_point < n_edge_points; ++q_point)
3764 for (
unsigned int i = 0; i < 4; ++i)
3765 nodal_values[(i + 8) * this->
degree] +=
3766 reference_edge_quadrature.weight(q_point) *
3767 support_point_values[q_point + (i + 8) * n_edge_points][2];
3769 for (
unsigned int i = 0; i < 2; ++i)
3770 for (
unsigned int j = 0; j < 2; ++j)
3771 for (
unsigned int k = 0; k < 2; ++k)
3772 nodal_values[(i + 2 * (2 * j + k)) * this->
degree] +=
3773 reference_edge_quadrature.weight(q_point) *
3774 support_point_values[q_point + (i + 2 * (2 * j + k)) *
3775 n_edge_points][1 - k];
3782 for (
unsigned int i = 0; i < 4; ++i)
3784 nodal_values[(i + 8) * this->
degree] = 0.0;
3786 for (
unsigned int i = 0; i < 2; ++i)
3787 for (
unsigned int j = 0; j < 2; ++j)
3788 for (
unsigned int k = 0; k < 2; ++k)
3790 nodal_values[(i + 2 * (2 * j + k)) * this->
degree]) <
3792 nodal_values[(i + 2 * (2 * j + k)) * this->degree] = 0.0;
3803 if (this->degree > 1)
3808 const std::vector<Polynomials::Polynomial<double>>
3809 &lobatto_polynomials =
3813 std::vector<Polynomials::Polynomial<double>>
3814 lobatto_polynomials_grad(this->degree);
3816 for (
unsigned int i = 0; i < lobatto_polynomials_grad.size(); ++i)
3817 lobatto_polynomials_grad[i] =
3818 lobatto_polynomials[i + 1].derivative();
3823 for (
unsigned int i = 0; i < system_matrix.
m(); ++i)
3824 for (
unsigned int j = 0; j < system_matrix.
n(); ++j)
3825 for (
unsigned int q_point = 0; q_point < n_edge_points;
3827 system_matrix(i, j) +=
3829 lobatto_polynomials_grad[i + 1].value(
3836 system_matrix_inv.
invert(system_matrix);
3840 1, 1, 0, 0, 1, 1, 0, 0, 2, 2, 2, 2};
3844 for (
unsigned int line = 0;
3845 line < GeometryInfo<dim>::lines_per_cell;
3851 for (
unsigned int q_point = 0; q_point < this->degree;
3855 support_point_values[line * this->degree + q_point]
3856 [line_coordinate[line]] -
3857 nodal_values[line * this->degree] *
3859 line * this->degree,
3863 line_coordinate[line]);
3865 for (
unsigned int i = 0; i < system_rhs.
size(); ++i)
3869 system_matrix_inv.
vmult(solution, system_rhs);
3875 for (
unsigned int i = 0; i < solution.
size(); ++i)
3877 nodal_values[line * this->degree + i + 1] = solution(i);
3888 const std::vector<Polynomials::Polynomial<double>>
3889 &legendre_polynomials =
3892 const unsigned int n_face_points = n_edge_points * n_edge_points;
3894 system_matrix.reinit((this->degree - 1) * this->degree,
3895 (this->degree - 1) * this->degree);
3898 for (
unsigned int i = 0; i < this->degree; ++i)
3899 for (
unsigned int j = 0; j < this->degree - 1; ++j)
3900 for (
unsigned int k = 0; k < this->degree; ++k)
3901 for (
unsigned int l = 0; l < this->degree - 1; ++l)
3902 for (
unsigned int q_point = 0; q_point < n_face_points;
3904 system_matrix(i * (this->degree - 1) + j,
3905 k * (this->degree - 1) + l) +=
3907 2 * (k * (this->degree - 1) + l)) *
3908 legendre_polynomials[i].value(
3910 [face_no][q_point + 4 * n_edge_points][0]) *
3911 lobatto_polynomials[j + 2].value(
3913 [face_no][q_point + 4 * n_edge_points][1]);
3915 system_matrix_inv.reinit(system_matrix.
m(), system_matrix.
m());
3916 system_matrix_inv.
invert(system_matrix);
3917 solution.
reinit(system_matrix.
m());
3918 system_rhs.
reinit(system_matrix.
m());
3922 {1, 2}, {1, 2}, {2, 0}, {2, 0}, {0, 1}, {0, 1}};
3939 for (
unsigned int q_point = 0; q_point < n_face_points;
3943 support_point_values[q_point +
3946 [face_coordinates[face][0]];
3948 for (
unsigned int i = 0; i < 2; ++i)
3949 for (
unsigned int j = 0; j <= deg; ++j)
3951 nodal_values[edge_indices[face][i] * this->degree +
3954 edge_indices[face][i] * this->degree + j,
3958 face_coordinates[face][0]);
3960 for (
unsigned int i = 0; i <= deg; ++i)
3961 for (
unsigned int j = 0; j < deg; ++j)
3962 system_rhs(i * deg + j) +=
3964 2 * (i * deg + j)) *
3968 system_matrix_inv.
vmult(solution, system_rhs);
3974 for (
unsigned int i = 0; i <= deg; ++i)
3975 for (
unsigned int j = 0; j < deg; ++j)
3976 if (
std::abs(solution(i * deg + j)) > 1e-14)
3977 nodal_values[(2 * face * this->degree + i +
3981 solution(i * deg + j);
3988 for (
unsigned int q_point = 0; q_point < n_face_points;
3992 support_point_values[q_point +
3995 [face_coordinates[face][1]];
3997 for (
unsigned int i = 2;
3998 i < GeometryInfo<dim>::lines_per_face;
4000 for (
unsigned int j = 0; j <= deg; ++j)
4002 nodal_values[edge_indices[face][i] * this->degree +
4005 edge_indices[face][i] * this->degree + j,
4009 face_coordinates[face][1]);
4011 for (
unsigned int i = 0; i <= deg; ++i)
4012 for (
unsigned int j = 0; j < deg; ++j)
4013 system_rhs(i * deg + j) +=
4015 2 * (i * deg + j) + 1) *
4019 system_matrix_inv.
vmult(solution, system_rhs);
4025 for (
unsigned int i = 0; i <= deg; ++i)
4026 for (
unsigned int j = 0; j < deg; ++j)
4027 if (
std::abs(solution(i * deg + j)) > 1e-14)
4028 nodal_values[((2 * face + 1) * deg + j +
4031 i] = solution(i * deg + j);
4039 const QGauss<dim> reference_quadrature(this->degree);
4040 const unsigned int n_interior_points =
4041 reference_quadrature.size();
4045 system_matrix.reinit(this->degree * deg * deg,
4046 this->degree * deg * deg);
4049 for (
unsigned int i = 0; i <= deg; ++i)
4050 for (
unsigned int j = 0; j < deg; ++j)
4051 for (
unsigned int k = 0; k < deg; ++k)
4052 for (
unsigned int l = 0; l <= deg; ++l)
4053 for (
unsigned int m = 0; m < deg; ++m)
4054 for (
unsigned int n = 0; n < deg; ++n)
4055 for (
unsigned int q_point = 0;
4056 q_point < n_interior_points;
4058 system_matrix((i * deg + j) * deg + k,
4059 (l * deg + m) * deg + n) +=
4060 reference_quadrature.weight(q_point) *
4061 legendre_polynomials[i].value(
4067 n_face_points][0]) *
4068 lobatto_polynomials[j + 2].value(
4074 n_face_points][1]) *
4075 lobatto_polynomials[k + 2].value(
4081 n_face_points][2]) *
4082 lobatto_polynomials_grad[l].value(
4088 n_face_points][0]) *
4089 lobatto_polynomials[m + 2].value(
4095 n_face_points][1]) *
4096 lobatto_polynomials[n + 2].value(
4104 system_matrix_inv.reinit(system_matrix.
m(), system_matrix.
m());
4105 system_matrix_inv.
invert(system_matrix);
4107 system_rhs.
reinit(system_matrix.
m());
4110 for (
unsigned int q_point = 0; q_point < n_interior_points;
4114 support_point_values[q_point +
4120 for (
unsigned int i = 0; i <= deg; ++i)
4122 for (
unsigned int j = 0; j < 2; ++j)
4123 for (
unsigned int k = 0; k < 2; ++k)
4125 nodal_values[i + (j + 4 * k + 2) * this->degree] *
4127 i + (j + 4 * k + 2) * this->degree,
4136 for (
unsigned int j = 0; j < deg; ++j)
4137 for (
unsigned int k = 0; k < 4; ++k)
4139 nodal_values[(i + 2 * (k + 2) * this->degree +
4144 this->shape_value_component(
4145 (i + 2 * (k + 2) * this->degree +
4158 for (
unsigned int i = 0; i <= deg; ++i)
4159 for (
unsigned int j = 0; j < deg; ++j)
4160 for (
unsigned int k = 0; k < deg; ++k)
4161 system_rhs((i * deg + j) * deg + k) +=
4162 reference_quadrature.weight(q_point) * tmp *
4163 lobatto_polynomials_grad[i].value(
4169 n_face_points][0]) *
4170 lobatto_polynomials[j + 2].value(
4176 n_face_points][1]) *
4177 lobatto_polynomials[k + 2].value(
4187 system_matrix_inv.
vmult(solution, system_rhs);
4193 for (
unsigned int i = 0; i <= deg; ++i)
4194 for (
unsigned int j = 0; j < deg; ++j)
4195 for (
unsigned int k = 0; k < deg; ++k)
4196 if (
std::abs(solution((i * deg + j) * deg + k)) > 1e-14)
4203 solution((i * deg + j) * deg + k);
4208 for (
unsigned int q_point = 0; q_point < n_interior_points;
4212 support_point_values[q_point +
4218 for (
unsigned int i = 0; i <= deg; ++i)
4219 for (
unsigned int j = 0; j < 2; ++j)
4221 for (
unsigned int k = 0; k < 2; ++k)
4222 tmp -= nodal_values[i + (4 * j + k) * this->degree] *
4224 i + (4 * j + k) * this->degree,
4233 for (
unsigned int k = 0; k < deg; ++k)
4235 nodal_values[(i + 2 * j * this->degree +
4240 this->shape_value_component(
4241 (i + 2 * j * this->degree +
4253 ((2 * j + 9) * deg + k +
4256 this->shape_value_component(
4257 i + ((2 * j + 9) * deg + k +
4269 for (
unsigned int i = 0; i <= deg; ++i)
4270 for (
unsigned int j = 0; j < deg; ++j)
4271 for (
unsigned int k = 0; k < deg; ++k)
4272 system_rhs((i * deg + j) * deg + k) +=
4273 reference_quadrature.weight(q_point) * tmp *
4274 lobatto_polynomials_grad[i].value(
4280 n_face_points][1]) *
4281 lobatto_polynomials[j + 2].value(
4287 n_face_points][0]) *
4288 lobatto_polynomials[k + 2].value(
4297 system_matrix_inv.
vmult(solution, system_rhs);
4303 for (
unsigned int i = 0; i <= deg; ++i)
4304 for (
unsigned int j = 0; j < deg; ++j)
4305 for (
unsigned int k = 0; k < deg; ++k)
4306 if (
std::abs(solution((i * deg + j) * deg + k)) > 1e-14)
4307 nodal_values[((i + this->degree +
4314 solution((i * deg + j) * deg + k);
4319 for (
unsigned int q_point = 0; q_point < n_interior_points;
4323 support_point_values[q_point +
4329 for (
unsigned int i = 0; i <= deg; ++i)
4330 for (
unsigned int j = 0; j < 4; ++j)
4332 tmp -= nodal_values[i + (j + 8) * this->degree] *
4334 i + (j + 8) * this->degree,
4343 for (
unsigned int k = 0; k < deg; ++k)
4346 ((2 * j + 1) * deg + k +
4350 i + ((2 * j + 1) * deg + k +
4362 for (
unsigned int i = 0; i <= deg; ++i)
4363 for (
unsigned int j = 0; j < deg; ++j)
4364 for (
unsigned int k = 0; k < deg; ++k)
4365 system_rhs((i * deg + j) * deg + k) +=
4366 reference_quadrature.weight(q_point) * tmp *
4367 lobatto_polynomials_grad[i].value(
4373 n_face_points][2]) *
4374 lobatto_polynomials[j + 2].value(
4380 n_face_points][0]) *
4381 lobatto_polynomials[k + 2].value(
4390 system_matrix_inv.
vmult(solution, system_rhs);
4396 for (
unsigned int i = 0; i <= deg; ++i)
4397 for (
unsigned int j = 0; j < deg; ++j)
4398 for (
unsigned int k = 0; k < deg; ++k)
4399 if (
std::abs(solution((i * deg + j) * deg + k)) > 1e-14)
4405 this->degree] = solution((i * deg + j) * deg + k);