52 : airfoil_type(
"NACA")
54 , joukowski_center(-0.1, 0.14)
60 , incline_factor(0.35)
63 , n_subdivision_x_0(3)
64 , n_subdivision_x_1(2)
65 , n_subdivision_x_2(5)
67 , airfoil_sampling_factor(2)
70 airfoil_length <= height,
72 "Mesh is to small to enclose airfoil! Choose larger field or smaller"
74 Assert(incline_factor < 1.0 && incline_factor >= 0.0,
75 ExcMessage(
"incline_factor has to be in [0,1)!"));
88 "Mesh height measured from airfoil nose to horizontal boundaries");
92 "Length measured from airfoil leading edge to vertical outlet boundary");
96 "Define obliqueness of the vertical mesh around the airfoil");
105 "Type of airfoil geometry, either NACA or Joukowski airfoil",
120 "Joukowski circle center coordinates");
123 "Joukowski airfoil length leading to trailing edge");
131 "Number of global refinements");
133 "NumberSubdivisionX0",
135 "Number of subdivisions along the airfoil in blocks with material ID 1 and 4");
137 "NumberSubdivisionX1",
139 "Number of subdivisions along the airfoil in blocks with material ID 2 and 5");
141 "NumberSubdivisionX2",
143 "Number of subdivisions in horizontal direction on the right of the trailing edge, i.e., blocks with material ID 3 and 6");
146 "Number of subdivisions normal to airfoil");
150 "Factor to obtain a finer mesh at the airfoil surface");
165 static const unsigned int id_block_1 = 1;
166 static const unsigned int id_block_2 = 2;
167 static const unsigned int id_block_3 = 3;
168 static const unsigned int id_block_4 = 4;
169 static const unsigned int id_block_5 = 5;
170 static const unsigned int id_block_6 = 6;
175 MeshGenerator(
const AdditionalData &data)
176 : refinements(data.refinements)
177 , n_subdivision_x_0(data.n_subdivision_x_0)
178 , n_subdivision_x_1(data.n_subdivision_x_1)
179 , n_subdivision_x_2(data.n_subdivision_x_2)
180 , n_subdivision_y(data.n_subdivision_y)
181 , height(data.height)
182 , length_b2(data.length_b2)
183 , incline_factor(data.incline_factor)
184 , bias_factor(data.bias_factor)
186 , n_cells_x_0(
Utilities::
pow(2, refinements) * n_subdivision_x_0)
187 , n_cells_x_1(
Utilities::
pow(2, refinements) * n_subdivision_x_1)
188 , n_cells_x_2(
Utilities::
pow(2, refinements) * n_subdivision_x_2)
189 , n_cells_y(
Utilities::
pow(2, refinements) * n_subdivision_y)
190 , n_points_on_each_side(n_cells_x_0 + n_cells_x_1 + 1)
192 , airfoil_1D(set_airfoil_length(
194 data.airfoil_type ==
"Joukowski" ?
195 joukowski(data.joukowski_center,
196 n_points_on_each_side,
197 data.airfoil_sampling_factor) :
198 (data.airfoil_type ==
"NACA" ?
200 n_points_on_each_side,
201 data.airfoil_sampling_factor) :
204 std::vector<Point<2>>{
208 data.airfoil_length))
209 , end_b0_x_u(airfoil_1D[0][n_cells_x_0](0))
210 , end_b0_x_l(airfoil_1D[1][n_cells_x_0](0))
211 , nose_x(airfoil_1D[0].front()(0))
212 , tail_x(airfoil_1D[0].back()(0))
213 , tail_y(airfoil_1D[0].back()(1))
214 , center_mesh(0.5 *
std::abs(end_b0_x_u + end_b0_x_l))
215 , length_b1_x(tail_x - center_mesh)
216 ,
gamma(std::atan(height /
217 (edge_length +
std::abs(nose_x - center_mesh))))
221 , A(nose_x - edge_length, 0)
224 , D(center_mesh, height)
226 ,
F(center_mesh, -height)
230 , J(tail_x + length_b2, 0)
234 Assert(data.airfoil_type ==
"Joukowski" ||
235 data.airfoil_type ==
"NACA",
248 make_coarse_grid(tria_grid);
250 set_boundary_ids(tria_grid);
252 if (periodic_faces !=
nullptr)
255 tria_grid, 5, 4, 1, *periodic_faces);
273 (void)periodic_faces;
280 const unsigned int refinements;
283 const unsigned int n_subdivision_x_0;
286 const unsigned int n_subdivision_x_1;
289 const unsigned int n_subdivision_x_2;
293 const unsigned int n_subdivision_y;
300 const double length_b2;
304 const double incline_factor;
307 const double bias_factor;
310 const double edge_length;
313 const unsigned int n_cells_x_0;
316 const unsigned int n_cells_x_1;
319 const unsigned int n_cells_x_2;
323 const unsigned int n_cells_y;
326 const unsigned int n_points_on_each_side;
330 const std::array<std::vector<Point<2>>, 2> airfoil_1D;
334 const double end_b0_x_u;
338 const double end_b0_x_l;
352 const double center_mesh;
355 const double length_b1_x;
382 const Point<2> A, B,
C, D,
E,
F, G, H, I, J,
K, L;
421 static std::array<std::vector<Point<2>>, 2>
422 joukowski(
const Point<2> & centerpoint,
423 const unsigned int number_points,
424 const unsigned int factor)
426 std::array<std::vector<Point<2>>, 2> airfoil_1D;
427 const unsigned int total_points = 2 * number_points - 2;
428 const unsigned int n_airfoilpoints = factor * total_points;
430 const auto jouk_points =
431 joukowski_transform(joukowski_circle(centerpoint, n_airfoilpoints));
434 std::vector<Point<2>> upper_points;
435 std::vector<Point<2>> lower_points;
439 unsigned int nose_index = 0;
440 unsigned int tail_index = 0;
441 double nose_x_coordinate = 0;
442 double tail_x_coordinate = 0;
446 for (
unsigned int i = 0; i < jouk_points.size(); ++i)
448 if (jouk_points[i](0) < nose_x_coordinate)
450 nose_x_coordinate = jouk_points[i](0);
453 if (jouk_points[i](0) > tail_x_coordinate)
455 tail_x_coordinate = jouk_points[i](0);
461 for (
unsigned int i = tail_index; i < jouk_points.size(); ++i)
462 upper_points.emplace_back(jouk_points[i]);
463 for (
unsigned int i = 0; i <= nose_index; ++i)
464 upper_points.emplace_back(jouk_points[i]);
465 std::reverse(upper_points.begin(), upper_points.end());
468 lower_points.insert(lower_points.end(),
469 jouk_points.begin() + nose_index,
470 jouk_points.begin() + tail_index + 1);
473 airfoil_1D[0] = make_points_equidistant(upper_points, number_points);
474 airfoil_1D[1] = make_points_equidistant(lower_points, number_points);
477 auto move_nose_to_origin = [](std::vector<Point<2>> &vector) {
478 const double nose_x_pos = vector.front()(0);
479 for (
auto &i : vector)
483 move_nose_to_origin(airfoil_1D[1]);
484 move_nose_to_origin(airfoil_1D[0]);
513 static std::vector<Point<2>>
515 const unsigned int number_points)
517 std::vector<Point<2>> circle_points;
531 radius_test < radius,
533 "Error creating lower circle: Circle for Joukowski-transform does"
534 " not enclose point zeta = -1! Choose different center "
538 const double theta = 2 *
numbers::PI / number_points;
540 for (
unsigned int i = 0; i < number_points; ++i)
541 circle_points.emplace_back(
center[0] - radius *
cos(i * theta),
544 return circle_points;
555 static std::vector<Point<2>>
556 joukowski_transform(
const std::vector<
Point<2>> &circle_points)
558 std::vector<Point<2>> joukowski_points(circle_points.size());
561 for (
unsigned int i = 0; i < circle_points.size(); ++i)
563 const double chi = circle_points[i](0);
564 const double eta = circle_points[i](1);
565 const std::complex<double> zeta(chi, eta);
566 const std::complex<double> z = zeta + 1. / zeta;
568 joukowski_points[i] = {real(z), imag(z)};
570 return joukowski_points;
589 static std::array<std::vector<Point<2>>, 2>
590 naca(
const std::string &serialnumber,
591 const unsigned int number_points,
592 const unsigned int factor)
596 const unsigned int n_airfoilpoints = factor * number_points;
599 return {{make_points_equidistant(
600 naca_create_points(serialnumber, n_airfoilpoints,
true),
602 make_points_equidistant(
603 naca_create_points(serialnumber, n_airfoilpoints,
false),
618 static std::vector<Point<2>>
619 naca_create_points(
const std::string &serialnumber,
620 const unsigned int number_points,
623 Assert(serialnumber.size() == 4,
624 ExcMessage(
"This NACA-serial number is not implemented!"));
626 return naca_create_points_4_digits(serialnumber,
645 static std::vector<Point<2>>
646 naca_create_points_4_digits(
const std::string &serialnumber,
647 const unsigned int number_points,
651 const unsigned int digit_0 = (serialnumber[0] -
'0');
652 const unsigned int digit_1 = (serialnumber[1] -
'0');
653 const unsigned int digit_2 = (serialnumber[2] -
'0');
654 const unsigned int digit_3 = (serialnumber[3] -
'0');
656 const unsigned int digit_23 = 10 * digit_2 + digit_3;
659 const double t =
static_cast<double>(digit_23) / 100.0;
661 std::vector<Point<2>> naca_points;
663 if (digit_0 == 0 && digit_1 == 0)
664 for (
unsigned int i = 0; i < number_points; ++i)
666 const double x = i * 1 / (1.0 * number_points - 1);
669 (0.2969 *
std::pow(x, 0.5) - 0.126 * x -
670 0.3516 * Utilities::fixed_power<2>(x) +
671 0.2843 * Utilities::fixed_power<3>(x) -
672 0.1036 * Utilities::fixed_power<4>(
676 naca_points.emplace_back(x, +y_t);
678 naca_points.emplace_back(x, -y_t);
681 for (
unsigned int i = 0; i < number_points; ++i)
683 const double m = 1.0 * digit_0 / 100;
684 const double p = 1.0 * digit_1 / 10;
685 const double x = i * 1 / (1.0 * number_points - 1);
689 m / Utilities::fixed_power<2>(p) *
690 (2 * p * x - Utilities::fixed_power<2>(x)) :
695 (x <= p) ? 2 * m / Utilities::fixed_power<2>(p) * (p - x) :
700 (0.2969 *
std::pow(x, 0.5) - 0.126 * x -
701 0.3516 * Utilities::fixed_power<2>(x) +
702 0.2843 * Utilities::fixed_power<3>(x) -
703 0.1036 * Utilities::fixed_power<4>(
706 const double theta = std::atan(dy_c);
709 naca_points.emplace_back(x - y_t *
std::sin(theta),
712 naca_points.emplace_back(x + y_t *
std::sin(theta),
729 static std::array<std::vector<Point<2>>, 2>
730 set_airfoil_length(
const std::array<std::vector<
Point<2>>, 2> &input,
731 const double desired_len)
733 std::array<std::vector<Point<2>>, 2> output;
734 output[0] = set_airfoil_length(input[0], desired_len);
735 output[1] = set_airfoil_length(input[1], desired_len);
747 static std::vector<Point<2>>
748 set_airfoil_length(
const std::vector<
Point<2>> &input,
749 const double desired_len)
751 std::vector<Point<2>> output = input;
754 desired_len / input.front().distance(input.back());
756 for (
auto &x : output)
772 static std::vector<Point<2>>
773 make_points_equidistant(
774 const std::vector<
Point<2>> &non_equidistant_points,
775 const unsigned int number_points)
777 const unsigned int n_points =
778 non_equidistant_points
782 std::vector<double> arclength_L(non_equidistant_points.size(), 0);
783 for (
unsigned int i = 0; i < non_equidistant_points.size() - 1; ++i)
786 non_equidistant_points[i + 1].distance(non_equidistant_points[i]);
789 const auto airfoil_length =
791 const auto deltaX = airfoil_length / (number_points - 1);
795 std::vector<Point<2>> equidist(
798 equidist[0] = non_equidistant_points[0];
799 equidist[number_points - 1] = non_equidistant_points[n_points - 1];
803 for (
unsigned int j = 0, i = 1; j < n_points - 1; ++j)
806 const auto Lj = arclength_L[j];
807 const auto Ljp = arclength_L[j + 1];
809 while (Lj <= i * deltaX && i * deltaX <= Ljp &&
810 i < number_points - 1)
812 equidist[i] =
Point<2>((i * deltaX - Lj) / (Ljp - Lj) *
813 (non_equidistant_points[j + 1] -
814 non_equidistant_points[j]) +
815 non_equidistant_points[j]);
835 std::vector<Triangulation<2>> trias(10);
839 const std::vector<Point<2>> & corner_vertices,
840 const std::vector<unsigned int> &repetitions,
852 auto &
point = it->vertex();
853 const double xi =
point(0);
854 const double eta =
point(1);
857 point = 0.25 * ((1 - xi) * (1 - eta) * corner_vertices[0] +
858 (1 + xi) * (1 - eta) * corner_vertices[1] +
859 (1 - xi) * (1 + eta) * corner_vertices[2] +
860 (1 + xi) * (1 + eta) * corner_vertices[3]);
864 for (
auto cell :
tria.active_cell_iterators())
872 {n_subdivision_y, n_subdivision_x_0},
876 {n_subdivision_y, n_subdivision_x_0},
880 {n_subdivision_x_1, n_subdivision_y},
884 {n_subdivision_x_1, n_subdivision_y},
888 {n_subdivision_x_2, n_subdivision_y},
892 {n_subdivision_x_2, n_subdivision_y},
919 for (
auto cell :
tria.active_cell_iterators())
922 if (cell->face(f)->at_boundary() ==
false)
925 const auto mid = cell->material_id();
927 if ((mid == id_block_1 && f == 0) ||
928 (mid == id_block_4 && f == 0))
929 cell->face(f)->set_boundary_id(0);
930 else if ((mid == id_block_3 && f == 0) ||
931 (mid == id_block_6 && f == 2))
932 cell->face(f)->set_boundary_id(1);
933 else if ((mid == id_block_1 && f == 1) ||
934 (mid == id_block_2 && f == 1))
935 cell->face(f)->set_boundary_id(2);
936 else if ((mid == id_block_4 && f == 1) ||
937 (mid == id_block_5 && f == 3))
938 cell->face(f)->set_boundary_id(3);
939 else if ((mid == id_block_2 && f == 0) ||
940 (mid == id_block_3 && f == 2))
941 cell->face(f)->set_boundary_id(4);
942 else if ((mid == id_block_5 && f == 2) ||
943 (mid == id_block_6 && f == 0))
944 cell->face(f)->set_boundary_id(5);
981 for (
auto &cell :
tria)
985 if (vertex_processed[cell.vertex_index(v)])
989 vertex_processed[cell.vertex_index(v)] =
true;
991 auto &node = cell.vertex(v);
994 if (cell.material_id() == id_block_1 ||
995 cell.material_id() == id_block_4)
1004 if (cell.material_id() == id_block_1)
1007 (node - horizontal_offset) +
1013 else if (cell.material_id() == id_block_4)
1016 (node - horizontal_offset) -
1022 const double trapeze_height =
1024 const double L = height /
std::sin(gamma);
1025 const double l_a =
std::cos(gamma) * edge_length;
1026 const double l_b = trapeze_height *
std::tan(gamma);
1028 const double x2 = L - l_a - l_b;
1030 const double Dx = x1 + x2 + x3;
1031 const double deltax =
1033 const double dx = Dx / n_cells_x_0;
1034 const double dy = trapeze_height / n_cells_y;
1036 static_cast<int>(std::round((node_(0) - deltax) / dx));
1038 static_cast<int>(std::round(
std::abs(node_(1)) / dy));
1040 node_(0) =
numbers::PI / 2 * (1.0 * ix) / n_cells_x_0;
1041 node_(1) = height * (1.0 * iy) / n_cells_y;
1048 const double dy = height / n_cells_y;
1050 static_cast<int>(std::round(node_(0) / dx));
1052 static_cast<int>(std::round(node_(1) / dy));
1053 const double alpha =
1054 bias_alpha(1 - (1.0 * iy) / n_cells_y);
1055 const double theta = node_(0);
1057 ((cell.material_id() == id_block_1) ?
1063 (cell.material_id() == id_block_1) ? (0) : (1))][ix] *
1068 else if (cell.material_id() == id_block_2 ||
1069 cell.material_id() == id_block_5)
1077 "Points D,C,G and E,F,I are not defined symmetric to "
1078 "x-axis, which is required to interpolate block 2"
1079 " and 5 with same geometric computations."));
1080 const double l_y = D(1) -
C(1);
1081 const double l_h = D(1) - l_y;
1082 const double by = -l_h / length_b1_x * (node(0) - H(0));
1083 const double dy = (height - by) / n_cells_y;
1084 const int iy =
static_cast<int>(
1085 std::round((
std::abs(node(1)) - by) / dy));
1086 const double dx = length_b1_x / n_cells_x_1;
1087 const int ix =
static_cast<int>(
1088 std::round(
std::abs(node(0) - center_mesh) / dx));
1090 const double alpha = bias_alpha(1 - (1.0 * iy) / n_cells_y);
1094 const Point<2> p(ix * dx + center_mesh +
1095 incline_factor * length_b2 * ix /
1097 ((cell.material_id() == id_block_2) ?
1103 (cell.material_id() == id_block_2) ? (0) : (1))]
1104 [n_cells_x_0 + ix] *
1108 else if (cell.material_id() == id_block_3 ||
1109 cell.material_id() == id_block_6)
1112 const double dx = length_b2 / n_cells_x_2;
1113 const double dy = height / n_cells_y;
1114 const int ix =
static_cast<int>(
1115 std::round(
std::abs(node(0) - H(0)) / dx));
1117 static_cast<int>(std::round(
std::abs(node(1)) / dy));
1119 const double alpha_y = bias_alpha(1 - 1.0 * iy / n_cells_y);
1120 const double alpha_x =
1121 bias_alpha(1 - (
static_cast<double>(ix)) / n_cells_x_2);
1125 const Point<2> p1(J(0) - (1 - incline_factor) * length_b2 *
1127 ((cell.material_id() == id_block_3) ?
1132 const Point<2> p2(J(0) - alpha_x * length_b2, tail_y);
1133 node = p1 * (1 - alpha_y) + p2 * alpha_y;
1153 bias_alpha(
double alpha)
const
1155 return std::tanh(bias_factor * alpha) / std::tanh(bias_factor);
1163 internal_create_triangulation(
1167 const AdditionalData & additional_data)
1169 MeshGenerator mesh_generator(additional_data);
1172 if (
auto parallel_tria =
1175 mesh_generator.create_triangulation(*parallel_tria, periodic_faces);
1176 else if (
auto parallel_tria =
dynamic_cast<
1179 mesh_generator.create_triangulation(*parallel_tria, periodic_faces);
1181 mesh_generator.create_triangulation(
tria, periodic_faces);
1198 const AdditionalData &)
1208 const AdditionalData &additional_data)
1210 internal_create_triangulation(
tria,
nullptr, additional_data);
1221 const AdditionalData & additional_data)
1223 internal_create_triangulation(
tria, &periodic_faces, additional_data);
1234 const AdditionalData & additional_data)
1238 (void)additional_data;
1239 (void)periodic_faces;
1250 template <
int dim,
int spacedim>
1262 cell->face(f)->set_boundary_id(f);
1268 template <
int spacedim>
1279 if (cell->center()(0) > 0)
1280 cell->set_material_id(1);
1287 template <
int dim,
int spacedim>
1292 const double epsilon)
1305 for (; face != endface; ++face)
1306 if (face->at_boundary())
1307 if (face->boundary_id() == 0)
1312 face->set_boundary_id(0);
1314 face->set_boundary_id(1);
1316 face->set_boundary_id(2);
1318 face->set_boundary_id(3);
1320 face->set_boundary_id(4);
1322 face->set_boundary_id(5);
1331 for (
const auto &cell :
tria.cell_iterators())
1334 for (
unsigned int d = 0;
d < dim; ++
d)
1335 if (cell->center()(d) > 0)
1337 cell->set_material_id(
id);
1363 cell->face(2)->set_all_boundary_ids(1);
1387 cell->face(4)->set_all_boundary_ids(1);
1391 cell->face(2)->set_all_boundary_ids(1);
1395 cell->face(2)->set_all_boundary_ids(1);
1399 cell->face(0)->set_all_boundary_ids(1);
1403 cell->face(2)->set_all_boundary_ids(1);
1407 cell->face(0)->set_all_boundary_ids(1);
1418 cell->face(5)->set_all_boundary_ids(1);
1429 unsigned int count = 0;
1431 for (
const auto &cell :
tria.cell_iterators())
1432 if (cell->face(5)->at_boundary())
1434 cell->face(5)->set_all_boundary_ids(1);
1455 const double inner_radius,
1456 const double outer_radius)
1461 double middle = (outer_radius - inner_radius) / 2e0 + inner_radius;
1462 double eps = 1
e-3 * middle;
1465 for (; cell !=
tria.
end(); ++cell)
1466 for (
const unsigned int f :
GeometryInfo<3>::face_indices())
1468 if (!cell->face(f)->at_boundary())
1471 double radius = cell->face(f)->center().norm() -
center.
norm();
1472 if (std::fabs(cell->face(f)->center()(0)) <
1475 cell->face(f)->set_boundary_id(2);
1476 for (
unsigned int j = 0; j < GeometryInfo<3>::lines_per_face;
1478 if (cell->face(f)->line(j)->at_boundary())
1479 if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() -
1480 cell->face(f)->line(j)->vertex(1).norm()) >
1482 cell->face(f)->line(j)->set_boundary_id(2);
1484 else if (std::fabs(cell->face(f)->center()(1)) <
1487 cell->face(f)->set_boundary_id(3);
1488 for (
unsigned int j = 0; j < GeometryInfo<3>::lines_per_face;
1490 if (cell->face(f)->line(j)->at_boundary())
1491 if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() -
1492 cell->face(f)->line(j)->vertex(1).norm()) >
1494 cell->face(f)->line(j)->set_boundary_id(3);
1496 else if (std::fabs(cell->face(f)->center()(2)) <
1499 cell->face(f)->set_boundary_id(4);
1500 for (
unsigned int j = 0; j < GeometryInfo<3>::lines_per_face;
1502 if (cell->face(f)->line(j)->at_boundary())
1503 if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() -
1504 cell->face(f)->line(j)->vertex(1).norm()) >
1506 cell->face(f)->line(j)->set_boundary_id(4);
1508 else if (radius < middle)
1510 cell->face(f)->set_boundary_id(0);
1511 for (
unsigned int j = 0; j < GeometryInfo<3>::lines_per_face;
1513 if (cell->face(f)->line(j)->at_boundary())
1514 if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() -
1515 cell->face(f)->line(j)->vertex(1).norm()) <
1517 cell->face(f)->line(j)->set_boundary_id(0);
1519 else if (radius > middle)
1521 cell->face(f)->set_boundary_id(1);
1522 for (
unsigned int j = 0; j < GeometryInfo<3>::lines_per_face;
1524 if (cell->face(f)->line(j)->at_boundary())
1525 if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() -
1526 cell->face(f)->line(j)->vertex(1).norm()) <
1528 cell->face(f)->line(j)->set_boundary_id(1);
1538 template <
int dim,
int spacedim>
1549 for (
unsigned int i = 0; i < dim; ++i)
1589 std::vector<CellData<dim>> cells(1);
1592 cells[0].material_id = 0;
1598 colorize_hyper_rectangle(
tria);
1603 template <
int dim,
int spacedim>
1611 ExcMessage(
"Invalid left-to-right bounds of hypercube"));
1614 for (
unsigned int i = 0; i < dim; ++i)
1634 for (
unsigned int d = 0;
d < dim; ++
d)
1635 for (
unsigned int c = 1; c <= dim; ++c)
1638 ExcMessage(
"Vertices of simplex must form a right handed system"));
1642 std::vector<Point<dim>> points =
vertices;
1646 for (
unsigned int i = 0; i <= dim; ++i)
1648 points.push_back(0.5 * (points[i] + points[(i + 1) % (dim + 1)]));
1654 for (
unsigned int i = 1; i < dim; ++i)
1655 points.push_back(0.5 * (points[i - 1] + points[i + 1]));
1657 for (
unsigned int i = 0; i <= dim; ++i)
1658 points.push_back(1. / 3. *
1659 (points[i] + points[(i + 1) % (dim + 1)] +
1660 points[(i + 2) % (dim + 1)]));
1662 points.push_back((1. / (dim + 1)) *
center);
1664 std::vector<CellData<dim>> cells(dim + 1);
1669 cells[0].vertices[0] = 0;
1670 cells[0].vertices[1] = 3;
1671 cells[0].vertices[2] = 5;
1672 cells[0].vertices[3] = 6;
1673 cells[0].material_id = 0;
1675 cells[1].vertices[0] = 3;
1676 cells[1].vertices[1] = 1;
1677 cells[1].vertices[2] = 6;
1678 cells[1].vertices[3] = 4;
1679 cells[1].material_id = 0;
1681 cells[2].vertices[0] = 5;
1682 cells[2].vertices[1] = 6;
1683 cells[2].vertices[2] = 2;
1684 cells[2].vertices[3] = 4;
1685 cells[2].material_id = 0;
1689 cells[0].vertices[0] = 0;
1690 cells[0].vertices[1] = 4;
1691 cells[0].vertices[2] = 8;
1692 cells[0].vertices[3] = 10;
1693 cells[0].vertices[4] = 7;
1694 cells[0].vertices[5] = 13;
1695 cells[0].vertices[6] = 12;
1696 cells[0].vertices[7] = 14;
1697 cells[0].material_id = 0;
1699 cells[1].vertices[0] = 4;
1700 cells[1].vertices[1] = 1;
1701 cells[1].vertices[2] = 10;
1702 cells[1].vertices[3] = 5;
1703 cells[1].vertices[4] = 13;
1704 cells[1].vertices[5] = 9;
1705 cells[1].vertices[6] = 14;
1706 cells[1].vertices[7] = 11;
1707 cells[1].material_id = 0;
1709 cells[2].vertices[0] = 8;
1710 cells[2].vertices[1] = 10;
1711 cells[2].vertices[2] = 2;
1712 cells[2].vertices[3] = 5;
1713 cells[2].vertices[4] = 12;
1714 cells[2].vertices[5] = 14;
1715 cells[2].vertices[6] = 6;
1716 cells[2].vertices[7] = 11;
1717 cells[2].material_id = 0;
1719 cells[3].vertices[0] = 7;
1720 cells[3].vertices[1] = 13;
1721 cells[3].vertices[2] = 12;
1722 cells[3].vertices[3] = 14;
1723 cells[3].vertices[4] = 3;
1724 cells[3].vertices[5] = 9;
1725 cells[3].vertices[6] = 6;
1726 cells[3].vertices[7] = 11;
1727 cells[3].material_id = 0;
1737 template <
int dim,
int spacedim>
1744 if (reference_cell == ReferenceCells::get_hypercube<dim>())
1757 for (
unsigned int d = 0;
d < dim; ++
d)
1766 std::vector<CellData<dim>> cells(1);
1778 const unsigned int n_cells,
1779 const unsigned int n_rotations,
1783 const unsigned int dim = 3;
1786 "More than 4 cells are needed to create a moebius grid."));
1788 ExcMessage(
"Outer and inner radius must be positive."));
1790 ExcMessage(
"Outer radius must be greater than inner radius."));
1793 std::vector<Point<dim>>
vertices(4 * n_cells);
1797 for (
unsigned int i = 0; i <
n_cells; ++i)
1798 for (
unsigned int j = 0; j < 4; ++j)
1812 unsigned int offset = 0;
1817 static constexpr std::array<unsigned int, 8> local_vertex_numbering{
1818 {0, 1, 5, 4, 2, 3, 7, 6}};
1819 std::vector<CellData<dim>> cells(n_cells);
1820 for (
unsigned int i = 0; i <
n_cells; ++i)
1822 for (
unsigned int j = 0; j < 2; ++j)
1824 cells[i].vertices[local_vertex_numbering[0 + 4 * j]] =
1826 cells[i].vertices[local_vertex_numbering[1 + 4 * j]] =
1828 cells[i].vertices[local_vertex_numbering[2 + 4 * j]] =
1830 cells[i].vertices[local_vertex_numbering[3 + 4 * j]] =
1834 cells[i].material_id = 0;
1838 cells[
n_cells - 1].vertices[local_vertex_numbering[4]] =
1839 (0 + n_rotations) % 4;
1840 cells[
n_cells - 1].vertices[local_vertex_numbering[5]] =
1841 (3 + n_rotations) % 4;
1842 cells[
n_cells - 1].vertices[local_vertex_numbering[6]] =
1843 (2 + n_rotations) % 4;
1844 cells[
n_cells - 1].vertices[local_vertex_numbering[7]] =
1845 (1 + n_rotations) % 4;
1862 ExcMessage(
"Outer radius R must be greater than the inner "
1866 const unsigned int dim = 2;
1867 const unsigned int spacedim = 3;
1868 std::vector<Point<spacedim>>
vertices(16);
1887 std::vector<CellData<dim>> cells(16);
1889 cells[0].vertices[0] = 0;
1890 cells[0].vertices[1] = 4;
1891 cells[0].vertices[2] = 3;
1892 cells[0].vertices[3] = 7;
1893 cells[0].material_id = 0;
1895 cells[1].vertices[0] = 1;
1896 cells[1].vertices[1] = 5;
1897 cells[1].vertices[2] = 0;
1898 cells[1].vertices[3] = 4;
1899 cells[1].material_id = 0;
1901 cells[2].vertices[0] = 2;
1902 cells[2].vertices[1] = 6;
1903 cells[2].vertices[2] = 1;
1904 cells[2].vertices[3] = 5;
1905 cells[2].material_id = 0;
1907 cells[3].vertices[0] = 3;
1908 cells[3].vertices[1] = 7;
1909 cells[3].vertices[2] = 2;
1910 cells[3].vertices[3] = 6;
1911 cells[3].material_id = 0;
1913 cells[4].vertices[0] = 4;
1914 cells[4].vertices[1] = 8;
1915 cells[4].vertices[2] = 7;
1916 cells[4].vertices[3] = 11;
1917 cells[4].material_id = 0;
1919 cells[5].vertices[0] = 5;
1920 cells[5].vertices[1] = 9;
1921 cells[5].vertices[2] = 4;
1922 cells[5].vertices[3] = 8;
1923 cells[5].material_id = 0;
1925 cells[6].vertices[0] = 6;
1926 cells[6].vertices[1] = 10;
1927 cells[6].vertices[2] = 5;
1928 cells[6].vertices[3] = 9;
1929 cells[6].material_id = 0;
1931 cells[7].vertices[0] = 7;
1932 cells[7].vertices[1] = 11;
1933 cells[7].vertices[2] = 6;
1934 cells[7].vertices[3] = 10;
1935 cells[7].material_id = 0;
1937 cells[8].vertices[0] = 8;
1938 cells[8].vertices[1] = 12;
1939 cells[8].vertices[2] = 11;
1940 cells[8].vertices[3] = 15;
1941 cells[8].material_id = 0;
1943 cells[9].vertices[0] = 9;
1944 cells[9].vertices[1] = 13;
1945 cells[9].vertices[2] = 8;
1946 cells[9].vertices[3] = 12;
1947 cells[9].material_id = 0;
1949 cells[10].vertices[0] = 10;
1950 cells[10].vertices[1] = 14;
1951 cells[10].vertices[2] = 9;
1952 cells[10].vertices[3] = 13;
1953 cells[10].material_id = 0;
1955 cells[11].vertices[0] = 11;
1956 cells[11].vertices[1] = 15;
1957 cells[11].vertices[2] = 10;
1958 cells[11].vertices[3] = 14;
1959 cells[11].material_id = 0;
1961 cells[12].vertices[0] = 12;
1962 cells[12].vertices[1] = 0;
1963 cells[12].vertices[2] = 15;
1964 cells[12].vertices[3] = 3;
1965 cells[12].material_id = 0;
1967 cells[13].vertices[0] = 13;
1968 cells[13].vertices[1] = 1;
1969 cells[13].vertices[2] = 12;
1970 cells[13].vertices[3] = 0;
1971 cells[13].material_id = 0;
1973 cells[14].vertices[0] = 14;
1974 cells[14].vertices[1] = 2;
1975 cells[14].vertices[2] = 13;
1976 cells[14].vertices[3] = 1;
1977 cells[14].material_id = 0;
1979 cells[15].vertices[0] = 15;
1980 cells[15].vertices[1] = 3;
1981 cells[15].vertices[2] = 14;
1982 cells[15].vertices[3] = 2;
1983 cells[15].material_id = 0;
1999 const unsigned int n_cells_toroidal,
2003 ExcMessage(
"Outer radius R must be greater than the inner "
2006 Assert(n_cells_toroidal > 2,
2007 ExcMessage(
"Number of cells in toroidal direction has "
2008 "to be at least 3."));
2014 double const a = 1. / (1 +
std::sqrt(2.0));
2017 const unsigned int additional_layer =
2021 const unsigned int n_point_layers_toroidal =
2022 n_cells_toroidal + additional_layer;
2023 std::vector<Point<3>>
vertices(8 * n_point_layers_toroidal);
2035 double const phi_cell = phi / n_cells_toroidal;
2036 for (
unsigned int c = 1; c < n_point_layers_toroidal; ++c)
2038 for (
unsigned int v = 0; v < 8; ++v)
2040 double const r_2d =
vertices[v][0];
2048 std::vector<CellData<3>> cells(5 * n_cells_toroidal);
2049 for (
unsigned int c = 0; c < n_cells_toroidal; ++c)
2051 for (
unsigned int j = 0; j < 2; ++j)
2053 const unsigned int offset =
2054 (8 * (c + j)) % (8 * n_point_layers_toroidal);
2057 cells[5 * c].vertices[0 + j * 4] = offset + 0;
2058 cells[5 * c].vertices[1 + j * 4] = offset + 1;
2059 cells[5 * c].vertices[2 + j * 4] = offset + 2;
2060 cells[5 * c].vertices[3 + j * 4] = offset + 3;
2062 cells[5 * c + 1].vertices[0 + j * 4] = offset + 2;
2063 cells[5 * c + 1].vertices[1 + j * 4] = offset + 3;
2064 cells[5 * c + 1].vertices[2 + j * 4] = offset + 4;
2065 cells[5 * c + 1].vertices[3 + j * 4] = offset + 5;
2067 cells[5 * c + 2].vertices[0 + j * 4] = offset + 4;
2068 cells[5 * c + 2].vertices[1 + j * 4] = offset + 5;
2069 cells[5 * c + 2].vertices[2 + j * 4] = offset + 6;
2070 cells[5 * c + 2].vertices[3 + j * 4] = offset + 7;
2072 cells[5 * c + 3].vertices[0 + j * 4] = offset + 0;
2073 cells[5 * c + 3].vertices[1 + j * 4] = offset + 2;
2074 cells[5 * c + 3].vertices[2 + j * 4] = offset + 6;
2075 cells[5 * c + 3].vertices[3 + j * 4] = offset + 4;
2077 cells[5 * c + 4].vertices[0 + j * 4] = offset + 3;
2078 cells[5 * c + 4].vertices[1 + j * 4] = offset + 1;
2079 cells[5 * c + 4].vertices[2 + j * 4] = offset + 5;
2080 cells[5 * c + 4].vertices[3 + j * 4] = offset + 7;
2083 cells[5 * c].material_id = 0;
2085 cells[5 * c + 1].material_id = 1;
2086 cells[5 * c + 2].material_id = 0;
2087 cells[5 * c + 3].material_id = 0;
2088 cells[5 * c + 4].material_id = 0;
2096 for (
auto &cell :
tria.cell_iterators())
2099 for (
const unsigned int f :
GeometryInfo<3>::face_indices())
2103 if (cell->face(f)->at_boundary() && f != 4 && f != 5)
2105 cell->face(f)->set_all_manifold_ids(1);
2110 if (cell->material_id() == 1)
2112 cell->set_all_manifold_ids(2);
2114 cell->set_material_id(0);
2129 template <
int dim,
int spacedim>
2150 "The volume of the cell is not greater than zero. "
2151 "This could be due to the wrong ordering of the vertices."));
2182 std::array<Tensor<1, 2>, 2> edges;
2183 edges[0] = corners[0];
2184 edges[1] = corners[1];
2185 std::vector<unsigned int> subdivisions;
2186 subdivided_parallelepiped<2, 2>(
2198 unsigned int n_subdivisions[dim];
2199 for (
unsigned int i = 0; i < dim; ++i)
2200 n_subdivisions[i] = 1;
2209 const unsigned int n_subdivisions,
2215 unsigned int n_subdivisions_[dim];
2216 for (
unsigned int i = 0; i < dim; ++i)
2217 n_subdivisions_[i] = n_subdivisions;
2227 const unsigned int (&n_subdivisions)[dim],
2229 const unsigned int *n_subdivisions,
2235 std::vector<unsigned int> subdivisions;
2236 std::array<Tensor<1, dim>, dim> edges;
2237 for (
unsigned int i = 0; i < dim; ++i)
2239 subdivisions.push_back(n_subdivisions[i]);
2240 edges[i] = corners[i];
2243 subdivided_parallelepiped<dim, dim>(
2250 template <
int dim,
int spacedim>
2255 const std::vector<unsigned int> &subdivisions,
2258 std::vector<unsigned int> compute_subdivisions = subdivisions;
2259 if (compute_subdivisions.size() == 0)
2261 compute_subdivisions.resize(dim, 1);
2264 Assert(compute_subdivisions.size() == dim,
2265 ExcMessage(
"One subdivision must be provided for each dimension."));
2267 for (
unsigned int i = 0; i < dim; ++i)
2269 Assert(compute_subdivisions[i] > 0,
2270 ExcInvalidRepetitions(subdivisions[i]));
2272 edges[i].
norm() > 0,
2274 "Edges in subdivided_parallelepiped() must not be degenerate."));
2282 bool twisted_data =
false;
2287 twisted_data = (edges[0][0] < 0);
2294 const double plane_normal =
2295 edges[0][0] * edges[1][1] - edges[0][1] * edges[1][0];
2296 twisted_data = (plane_normal < 0.0);
2305 (edges[0].
norm() * edges[1].
norm()) -
2308 "Edges in subdivided_parallelepiped() must point in"
2309 " different directions."));
2311 cross_product_3d(edges[0], edges[1]);
2325 twisted_data = (plane_normal * edges[2] < 0.0);
2334 ExcInvalidInputOrientation(
2335 "The triangulation you are trying to create will consist of cells"
2336 " with negative measures. This is usually the result of input data"
2337 " that does not define a right-handed coordinate system. The usual"
2338 " fix for this is to ensure that in 1d the given point is to the"
2339 " right of the origin (or the given edge tensor is positive), in 2d"
2340 " that the two edges (and their cross product) obey the right-hand"
2341 " rule (which may usually be done by switching the order of the"
2342 " points or edge tensors), or in 3d that the edges form a"
2343 " right-handed coordinate system (which may also be accomplished by"
2344 " switching the order of the first two points or edge tensors)."));
2347 for (
unsigned int i = 0; i < dim; ++i)
2348 for (
unsigned int j = i + 1; j < dim; ++j)
2349 Assert((edges[i] != edges[j]),
2351 "Degenerate edges of subdivided_parallelepiped encountered."));
2354 std::vector<Point<spacedim>> points;
2359 for (
unsigned int x = 0; x <= compute_subdivisions[0]; ++x)
2360 points.push_back(origin + edges[0] / compute_subdivisions[0] * x);
2364 for (
unsigned int y = 0; y <= compute_subdivisions[1]; ++y)
2365 for (
unsigned int x = 0; x <= compute_subdivisions[0]; ++x)
2366 points.push_back(origin + edges[0] / compute_subdivisions[0] * x +
2367 edges[1] / compute_subdivisions[1] * y);
2371 for (
unsigned int z = 0; z <= compute_subdivisions[2]; ++z)
2372 for (
unsigned int y = 0; y <= compute_subdivisions[1]; ++y)
2373 for (
unsigned int x = 0; x <= compute_subdivisions[0]; ++x)
2374 points.push_back(origin +
2375 edges[0] / compute_subdivisions[0] * x +
2376 edges[1] / compute_subdivisions[1] * y +
2377 edges[2] / compute_subdivisions[2] * z);
2386 for (
unsigned int i = 0; i < dim; ++i)
2387 n_cells *= compute_subdivisions[i];
2388 std::vector<CellData<dim>> cells(n_cells);
2394 for (
unsigned int x = 0; x < compute_subdivisions[0]; ++x)
2396 cells[x].vertices[0] = x;
2397 cells[x].vertices[1] = x + 1;
2400 cells[x].material_id = 0;
2407 const unsigned int n_dy = compute_subdivisions[1];
2408 const unsigned int n_dx = compute_subdivisions[0];
2410 for (
unsigned int y = 0; y < n_dy; ++y)
2411 for (
unsigned int x = 0; x < n_dx; ++x)
2413 const unsigned int c = y * n_dx + x;
2414 cells[c].vertices[0] = y * (n_dx + 1) + x;
2415 cells[c].vertices[1] = y * (n_dx + 1) + x + 1;
2416 cells[c].vertices[2] = (y + 1) * (n_dx + 1) + x;
2417 cells[c].vertices[3] = (y + 1) * (n_dx + 1) + x + 1;
2420 cells[c].material_id = 0;
2428 const unsigned int n_dz = compute_subdivisions[2];
2429 const unsigned int n_dy = compute_subdivisions[1];
2430 const unsigned int n_dx = compute_subdivisions[0];
2432 for (
unsigned int z = 0; z < n_dz; ++z)
2433 for (
unsigned int y = 0; y < n_dy; ++y)
2434 for (
unsigned int x = 0; x < n_dx; ++x)
2436 const unsigned int c = z * n_dy * n_dx + y * n_dx + x;
2438 cells[c].vertices[0] =
2439 z * (n_dy + 1) * (n_dx + 1) + y * (n_dx + 1) + x;
2440 cells[c].vertices[1] =
2441 z * (n_dy + 1) * (n_dx + 1) + y * (n_dx + 1) + x + 1;
2442 cells[c].vertices[2] =
2443 z * (n_dy + 1) * (n_dx + 1) + (y + 1) * (n_dx + 1) + x;
2444 cells[c].vertices[3] = z * (n_dy + 1) * (n_dx + 1) +
2445 (y + 1) * (n_dx + 1) + x + 1;
2446 cells[c].vertices[4] =
2447 (z + 1) * (n_dy + 1) * (n_dx + 1) + y * (n_dx + 1) + x;
2448 cells[c].vertices[5] = (z + 1) * (n_dy + 1) * (n_dx + 1) +
2449 y * (n_dx + 1) + x + 1;
2450 cells[c].vertices[6] = (z + 1) * (n_dy + 1) * (n_dx + 1) +
2451 (y + 1) * (n_dx + 1) + x;
2452 cells[c].vertices[7] = (z + 1) * (n_dy + 1) * (n_dx + 1) +
2453 (y + 1) * (n_dx + 1) + x + 1;
2456 cells[c].material_id = 0;
2477 for (; cell != endc; ++cell)
2479 for (
const unsigned int face :
GeometryInfo<dim>::face_indices())
2481 if (cell->face(face)->at_boundary())
2482 cell->face(face)->set_boundary_id(face);
2489 template <
int dim,
int spacedim>
2492 const unsigned int repetitions,
2497 Assert(repetitions >= 1, ExcInvalidRepetitions(repetitions));
2499 ExcMessage(
"Invalid left-to-right bounds of hypercube"));
2502 for (
unsigned int i = 0; i < dim; ++i)
2508 std::vector<unsigned int> reps(dim, repetitions);
2514 template <
int dim,
int spacedim>
2517 const std::vector<unsigned int> &repetitions,
2522 Assert(repetitions.size() == dim, ExcInvalidRepetitionsDimension(dim));
2528 for (
unsigned int i = 0; i < dim; ++i)
2535 std::array<Point<spacedim>, dim> delta;
2536 for (
unsigned int i = 0; i < dim; ++i)
2538 Assert(repetitions[i] >= 1, ExcInvalidRepetitions(repetitions[i]));
2540 delta[i][i] = (p2[i] - p1[i]) / repetitions[i];
2544 "The first dim entries of coordinates of p1 and p2 need to be different."));
2548 std::vector<Point<spacedim>> points;
2552 for (
unsigned int x = 0; x <= repetitions[0]; ++x)
2553 points.push_back(p1 + x * delta[0]);
2557 for (
unsigned int y = 0; y <= repetitions[1]; ++y)
2558 for (
unsigned int x = 0; x <= repetitions[0]; ++x)
2559 points.push_back(p1 + x * delta[0] + y * delta[1]);
2563 for (
unsigned int z = 0; z <= repetitions[2]; ++z)
2564 for (
unsigned int y = 0; y <= repetitions[1]; ++y)
2565 for (
unsigned int x = 0; x <= repetitions[0]; ++x)
2566 points.push_back(p1 + x * delta[0] + y * delta[1] +
2575 std::vector<CellData<dim>> cells;
2580 cells.resize(repetitions[0]);
2581 for (
unsigned int x = 0; x < repetitions[0]; ++x)
2583 cells[x].vertices[0] = x;
2584 cells[x].vertices[1] = x + 1;
2585 cells[x].material_id = 0;
2592 cells.resize(repetitions[1] * repetitions[0]);
2593 for (
unsigned int y = 0; y < repetitions[1]; ++y)
2594 for (
unsigned int x = 0; x < repetitions[0]; ++x)
2596 const unsigned int c = x + y * repetitions[0];
2597 cells[c].vertices[0] = y * (repetitions[0] + 1) + x;
2598 cells[c].vertices[1] = y * (repetitions[0] + 1) + x + 1;
2599 cells[c].vertices[2] = (y + 1) * (repetitions[0] + 1) + x;
2600 cells[c].vertices[3] = (y + 1) * (repetitions[0] + 1) + x + 1;
2601 cells[c].material_id = 0;
2608 const unsigned int n_x = (repetitions[0] + 1);
2609 const unsigned int n_xy =
2610 (repetitions[0] + 1) * (repetitions[1] + 1);
2612 cells.resize(repetitions[2] * repetitions[1] * repetitions[0]);
2613 for (
unsigned int z = 0; z < repetitions[2]; ++z)
2614 for (
unsigned int y = 0; y < repetitions[1]; ++y)
2615 for (
unsigned int x = 0; x < repetitions[0]; ++x)
2617 const unsigned int c = x + y * repetitions[0] +
2618 z * repetitions[0] * repetitions[1];
2619 cells[c].vertices[0] = z * n_xy + y * n_x + x;
2620 cells[c].vertices[1] = z * n_xy + y * n_x + x + 1;
2621 cells[c].vertices[2] = z * n_xy + (y + 1) * n_x + x;
2622 cells[c].vertices[3] = z * n_xy + (y + 1) * n_x + x + 1;
2623 cells[c].vertices[4] = (z + 1) * n_xy + y * n_x + x;
2624 cells[c].vertices[5] = (z + 1) * n_xy + y * n_x + x + 1;
2625 cells[c].vertices[6] = (z + 1) * n_xy + (y + 1) * n_x + x;
2626 cells[c].vertices[7] =
2627 (z + 1) * n_xy + (y + 1) * n_x + x + 1;
2628 cells[c].material_id = 0;
2650 for (
unsigned int i = 0; i < dim; ++i)
2651 epsilon =
std::min(epsilon, 0.01 * delta[i][i]);
2654 "The distance between corner points must be positive."))
2658 colorize_subdivided_hyper_rectangle(
tria, p1, p2, epsilon);
2667 const
std::vector<
std::vector<
double>> &step_sz,
2668 const
Point<dim> & p_1,
2669 const
Point<dim> & p_2,
2672 Assert(step_sz.size() == dim, ExcInvalidRepetitionsDimension(dim));
2682 std::vector<std::vector<double>> step_sizes(step_sz);
2684 for (
unsigned int i = 0; i < dim; ++i)
2688 std::swap(p1(i), p2(i));
2689 std::reverse(step_sizes[i].
begin(), step_sizes[i].
end());
2694 for (
unsigned int j = 0; j < step_sizes.at(i).size(); ++j)
2695 x += step_sizes[i][j];
2696 Assert(std::fabs(x - (p2(i) - p1(i))) <= 1e-12 * std::fabs(x),
2698 "The sequence of step sizes in coordinate direction " +
2700 " must be equal to the distance of the two given "
2701 "points in this coordinate direction."));
2708 std::vector<Point<dim>> points;
2714 for (
unsigned int i = 0;; ++i)
2723 if (i == step_sizes[0].size())
2726 x += step_sizes[0][i];
2734 for (
unsigned int j = 0;; ++j)
2737 for (
unsigned int i = 0;; ++i)
2739 points.push_back(
Point<dim>(p1[0] + x, p1[1] + y));
2740 if (i == step_sizes[0].size())
2743 x += step_sizes[0][i];
2746 if (j == step_sizes[1].size())
2749 y += step_sizes[1][j];
2756 for (
unsigned int k = 0;; ++k)
2759 for (
unsigned int j = 0;; ++j)
2762 for (
unsigned int i = 0;; ++i)
2765 Point<dim>(p1[0] + x, p1[1] + y, p1[2] + z));
2766 if (i == step_sizes[0].size())
2769 x += step_sizes[0][i];
2772 if (j == step_sizes[1].size())
2775 y += step_sizes[1][j];
2778 if (k == step_sizes[2].size())
2781 z += step_sizes[2][k];
2792 std::vector<CellData<dim>> cells;
2797 cells.resize(step_sizes[0].size());
2798 for (
unsigned int x = 0; x < step_sizes[0].size(); ++x)
2800 cells[x].vertices[0] = x;
2801 cells[x].vertices[1] = x + 1;
2802 cells[x].material_id = 0;
2809 cells.resize(step_sizes[1].size() * step_sizes[0].size());
2810 for (
unsigned int y = 0; y < step_sizes[1].size(); ++y)
2811 for (
unsigned int x = 0; x < step_sizes[0].size(); ++x)
2813 const unsigned int c = x + y * step_sizes[0].size();
2814 cells[c].vertices[0] = y * (step_sizes[0].size() + 1) + x;
2815 cells[c].vertices[1] = y * (step_sizes[0].size() + 1) + x + 1;
2816 cells[c].vertices[2] =
2817 (y + 1) * (step_sizes[0].size() + 1) + x;
2818 cells[c].vertices[3] =
2819 (y + 1) * (step_sizes[0].size() + 1) + x + 1;
2820 cells[c].material_id = 0;
2827 const unsigned int n_x = (step_sizes[0].size() + 1);
2828 const unsigned int n_xy =
2829 (step_sizes[0].size() + 1) * (step_sizes[1].size() + 1);
2831 cells.resize(step_sizes[2].size() * step_sizes[1].size() *
2832 step_sizes[0].size());
2833 for (
unsigned int z = 0; z < step_sizes[2].size(); ++z)
2834 for (
unsigned int y = 0; y < step_sizes[1].size(); ++y)
2835 for (
unsigned int x = 0; x < step_sizes[0].size(); ++x)
2837 const unsigned int c =
2838 x + y * step_sizes[0].size() +
2839 z * step_sizes[0].size() * step_sizes[1].size();
2840 cells[c].vertices[0] = z * n_xy + y * n_x + x;
2841 cells[c].vertices[1] = z * n_xy + y * n_x + x + 1;
2842 cells[c].vertices[2] = z * n_xy + (y + 1) * n_x + x;
2843 cells[c].vertices[3] = z * n_xy + (y + 1) * n_x + x + 1;
2844 cells[c].vertices[4] = (z + 1) * n_xy + y * n_x + x;
2845 cells[c].vertices[5] = (z + 1) * n_xy + y * n_x + x + 1;
2846 cells[c].vertices[6] = (z + 1) * n_xy + (y + 1) * n_x + x;
2847 cells[c].vertices[7] =
2848 (z + 1) * n_xy + (y + 1) * n_x + x + 1;
2849 cells[c].material_id = 0;
2871 *std::min_element(step_sizes[0].
begin(), step_sizes[0].
end());
2872 for (
unsigned int i = 1; i < dim; ++i)
2874 *std::min_element(step_sizes[i].
begin(),
2875 step_sizes[i].
end()));
2876 const double epsilon = 0.01 * min_size;
2880 colorize_subdivided_hyper_rectangle(
tria, p1, p2, epsilon);
2889 const std::vector<std::vector<double>> &spacing,
2894 Assert(spacing.size() == 1, ExcInvalidRepetitionsDimension(1));
2898 Assert(spacing[0].size() == n_cells, ExcInvalidRepetitionsDimension(1));
2900 double delta = std::numeric_limits<double>::max();
2901 for (
unsigned int i = 0; i <
n_cells; ++i)
2903 Assert(spacing[0][i] >= 0, ExcInvalidRepetitions(-1));
2904 delta =
std::min(delta, spacing[0][i]);
2908 std::vector<Point<1>> points;
2910 for (
unsigned int x = 0; x <=
n_cells; ++x)
2912 points.emplace_back(ax);
2914 ax += spacing[0][x];
2917 unsigned int n_val_cells = 0;
2918 for (
unsigned int i = 0; i <
n_cells; ++i)
2922 std::vector<CellData<1>> cells(n_val_cells);
2923 unsigned int id = 0;
2924 for (
unsigned int x = 0; x <
n_cells; ++x)
2927 cells[id].vertices[0] = x;
2928 cells[id].vertices[1] = x + 1;
2947 const std::vector<std::vector<double>> &spacing,
2952 Assert(spacing.size() == 2, ExcInvalidRepetitionsDimension(2));
2954 std::vector<unsigned int> repetitions(2);
2955 double delta = std::numeric_limits<double>::max();
2956 for (
unsigned int i = 0; i < 2; ++i)
2958 repetitions[i] = spacing[i].size();
2959 for (
unsigned int j = 0; j < repetitions[i]; ++j)
2961 Assert(spacing[i][j] >= 0, ExcInvalidRepetitions(-1));
2962 delta =
std::min(delta, spacing[i][j]);
2965 ExcInvalidRepetitionsDimension(i));
2969 std::vector<Point<2>> points;
2971 for (
unsigned int y = 0; y <= repetitions[1]; ++y)
2974 for (
unsigned int x = 0; x <= repetitions[0]; ++x)
2976 points.emplace_back(ax, ay);
2977 if (x < repetitions[0])
2978 ax += spacing[0][x];
2980 if (y < repetitions[1])
2981 ay += spacing[1][y];
2985 unsigned int n_val_cells = 0;
2986 for (
unsigned int i = 0; i <
material_id.size(0); ++i)
2987 for (
unsigned int j = 0; j <
material_id.size(1); ++j)
2991 std::vector<CellData<2>> cells(n_val_cells);
2992 unsigned int id = 0;
2993 for (
unsigned int y = 0; y < repetitions[1]; ++y)
2994 for (
unsigned int x = 0; x < repetitions[0]; ++x)
2997 cells[id].vertices[0] = y * (repetitions[0] + 1) + x;
2998 cells[id].vertices[1] = y * (repetitions[0] + 1) + x + 1;
2999 cells[id].vertices[2] = (y + 1) * (repetitions[0] + 1) + x;
3000 cells[id].vertices[3] = (y + 1) * (repetitions[0] + 1) + x + 1;
3014 double eps = 0.01 * delta;
3016 for (; cell != endc; ++cell)
3018 Point<2> cell_center = cell->center();
3019 for (
const unsigned int f :
GeometryInfo<2>::face_indices())
3022 Point<2> face_center = cell->face(f)->center();
3023 for (
unsigned int i = 0; i < 2; ++i)
3025 if (face_center[i] < cell_center[i] - eps)
3026 cell->face(f)->set_boundary_id(i * 2);
3027 if (face_center[i] > cell_center[i] + eps)
3028 cell->face(f)->set_boundary_id(i * 2 + 1);
3039 const std::vector<std::vector<double>> &spacing,
3044 const unsigned int dim = 3;
3046 Assert(spacing.size() == dim, ExcInvalidRepetitionsDimension(dim));
3048 std::array<unsigned int, dim> repetitions;
3049 double delta = std::numeric_limits<double>::max();
3050 for (
unsigned int i = 0; i < dim; ++i)
3052 repetitions[i] = spacing[i].size();
3053 for (
unsigned int j = 0; j < repetitions[i]; ++j)
3055 Assert(spacing[i][j] >= 0, ExcInvalidRepetitions(-1));
3056 delta =
std::min(delta, spacing[i][j]);
3059 ExcInvalidRepetitionsDimension(i));
3063 std::vector<Point<dim>> points;
3065 for (
unsigned int z = 0; z <= repetitions[2]; ++z)
3068 for (
unsigned int y = 0; y <= repetitions[1]; ++y)
3071 for (
unsigned int x = 0; x <= repetitions[0]; ++x)
3073 points.emplace_back(ax, ay, az);
3074 if (x < repetitions[0])
3075 ax += spacing[0][x];
3077 if (y < repetitions[1])
3078 ay += spacing[1][y];
3080 if (z < repetitions[2])
3081 az += spacing[2][z];
3085 unsigned int n_val_cells = 0;
3086 for (
unsigned int i = 0; i <
material_id.size(0); ++i)
3087 for (
unsigned int j = 0; j <
material_id.size(1); ++j)
3088 for (
unsigned int k = 0; k <
material_id.size(2); ++k)
3092 std::vector<CellData<dim>> cells(n_val_cells);
3093 unsigned int id = 0;
3094 const unsigned int n_x = (repetitions[0] + 1);
3095 const unsigned int n_xy = (repetitions[0] + 1) * (repetitions[1] + 1);
3096 for (
unsigned int z = 0; z < repetitions[2]; ++z)
3097 for (
unsigned int y = 0; y < repetitions[1]; ++y)
3098 for (
unsigned int x = 0; x < repetitions[0]; ++x)
3101 cells[id].vertices[0] = z * n_xy + y * n_x + x;
3102 cells[id].vertices[1] = z * n_xy + y * n_x + x + 1;
3103 cells[id].vertices[2] = z * n_xy + (y + 1) * n_x + x;
3104 cells[id].vertices[3] = z * n_xy + (y + 1) * n_x + x + 1;
3105 cells[id].vertices[4] = (z + 1) * n_xy + y * n_x + x;
3106 cells[id].vertices[5] = (z + 1) * n_xy + y * n_x + x + 1;
3107 cells[id].vertices[6] = (z + 1) * n_xy + (y + 1) * n_x + x;
3108 cells[id].vertices[7] = (z + 1) * n_xy + (y + 1) * n_x + x + 1;
3122 double eps = 0.01 * delta;
3125 for (; cell != endc; ++cell)
3131 Point<dim> face_center = cell->face(f)->center();
3132 for (
unsigned int i = 0; i < dim; ++i)
3134 if (face_center[i] < cell_center[i] - eps)
3135 cell->face(f)->set_boundary_id(i * 2);
3136 if (face_center[i] > cell_center[i] + eps)
3137 cell->face(f)->set_boundary_id(i * 2 + 1);
3144 template <
int dim,
int spacedim>
3147 const std::vector<unsigned int> &holes)
3156 for (
unsigned int d = 0;
d < dim; ++
d)
3163 std::array<Point<spacedim>, dim> delta;
3164 std::array<unsigned int, dim> repetitions;
3165 for (
unsigned int i = 0; i < dim; ++i)
3168 ExcMessage(
"At least one hole needed in each direction"));
3169 repetitions[i] = 2 * holes[i] + 1;
3170 delta[i][i] = (p2[i] - p1[i]);
3175 std::vector<Point<spacedim>> points;
3179 for (
unsigned int x = 0; x <= repetitions[0]; ++x)
3180 points.push_back(p1 + x * delta[0]);
3184 for (
unsigned int y = 0; y <= repetitions[1]; ++y)
3185 for (
unsigned int x = 0; x <= repetitions[0]; ++x)
3186 points.push_back(p1 + x * delta[0] + y * delta[1]);
3190 for (
unsigned int z = 0; z <= repetitions[2]; ++z)
3191 for (
unsigned int y = 0; y <= repetitions[1]; ++y)
3192 for (
unsigned int x = 0; x <= repetitions[0]; ++x)
3193 points.push_back(p1 + x * delta[0] + y * delta[1] +
3203 std::vector<CellData<dim>> cells;
3208 cells.resize(repetitions[1] * repetitions[0] - holes[1] * holes[0]);
3210 for (
unsigned int y = 0; y < repetitions[1]; ++y)
3211 for (
unsigned int x = 0; x < repetitions[0]; ++x)
3213 if ((x % 2 == 1) && (y % 2 == 1))
3216 cells[c].vertices[0] = y * (repetitions[0] + 1) + x;
3217 cells[c].vertices[1] = y * (repetitions[0] + 1) + x + 1;
3218 cells[c].vertices[2] = (y + 1) * (repetitions[0] + 1) + x;
3219 cells[c].vertices[3] = (y + 1) * (repetitions[0] + 1) + x + 1;
3220 cells[c].material_id = 0;
3228 const unsigned int n_x = (repetitions[0] + 1);
3229 const unsigned int n_xy =
3230 (repetitions[0] + 1) * (repetitions[1] + 1);
3232 cells.resize(repetitions[2] * repetitions[1] * repetitions[0]);
3235 for (
unsigned int z = 0; z < repetitions[2]; ++z)
3236 for (
unsigned int y = 0; y < repetitions[1]; ++y)
3237 for (
unsigned int x = 0; x < repetitions[0]; ++x)
3240 cells[c].vertices[0] = z * n_xy + y * n_x + x;
3241 cells[c].vertices[1] = z * n_xy + y * n_x + x + 1;
3242 cells[c].vertices[2] = z * n_xy + (y + 1) * n_x + x;
3243 cells[c].vertices[3] = z * n_xy + (y + 1) * n_x + x + 1;
3244 cells[c].vertices[4] = (z + 1) * n_xy + y * n_x + x;
3245 cells[c].vertices[5] = (z + 1) * n_xy + y * n_x + x + 1;
3246 cells[c].vertices[6] = (z + 1) * n_xy + (y + 1) * n_x + x;
3247 cells[c].vertices[7] =
3248 (z + 1) * n_xy + (y + 1) * n_x + x + 1;
3249 cells[c].material_id = 0;
3277 const unsigned int ,
3289 const unsigned int ,
3301 bool inline point_in_2d_box(
const Point<2> &p,
3303 const double radius)
3305 return (
std::abs(p[0] - c[0]) < radius) &&
3314 template <
int dim,
int spacedim>
3318 double length = std::numeric_limits<double>::max();
3319 for (
const auto &cell :
triangulation.active_cell_iterators())
3320 for (unsigned
int n = 0; n < GeometryInfo<dim>::lines_per_cell; ++n)
3321 length =
std::min(length, cell->line(n)->diameter());
3331 const double inner_radius,
3332 const double outer_radius,
3333 const double pad_bottom,
3334 const double pad_top,
3335 const double pad_left,
3336 const double pad_right,
3341 const unsigned int ,
3344 const bool with_padding =
3345 pad_bottom > 0 || pad_top > 0 || pad_left > 0 || pad_right > 0;
3355 double length = std::numeric_limits<double>::max();
3356 for (
const auto &cell :
tria.active_cell_iterators())
3357 for (unsigned
int n = 0; n < GeometryInfo<2>::lines_per_cell; ++n)
3358 length =
std::min(length, cell->line(n)->diameter());
3373 for (
const auto &cell : cylinder_tria.active_cell_iterators())
3374 cell->set_manifold_id(tfi_manifold_id);
3376 const Point<2> bl(-outer_radius - pad_left, -outer_radius - pad_bottom);
3377 const Point<2> tr(outer_radius + pad_right, outer_radius + pad_top);
3383 auto add_sizes = [](std::vector<double> &step_sizes,
3384 const double padding,
3385 const double h) ->
void {
3388 const auto rounded =
3389 static_cast<unsigned int>(std::round(padding / h));
3392 const unsigned int num = (padding > 0. && rounded == 0) ? 1 : rounded;
3393 for (
unsigned int i = 0; i < num; ++i)
3394 step_sizes.push_back(padding / num);
3397 std::vector<std::vector<double>> step_sizes(2);
3400 add_sizes(step_sizes[0], pad_left, outer_radius);
3402 step_sizes[0].push_back(outer_radius);
3403 step_sizes[0].push_back(outer_radius);
3405 add_sizes(step_sizes[0], pad_right, outer_radius);
3408 add_sizes(step_sizes[1], pad_bottom, outer_radius);
3410 step_sizes[1].push_back(outer_radius);
3411 step_sizes[1].push_back(outer_radius);
3413 add_sizes(step_sizes[1], pad_top, outer_radius);
3418 bulk_tria, step_sizes, bl, tr,
colorize);
3421 std::set<Triangulation<2>::active_cell_iterator> cells_to_remove;
3422 for (
const auto &cell : bulk_tria.active_cell_iterators())
3424 cells_to_remove.
insert(cell);
3428 bulk_tria, cells_to_remove, tria_without_cylinder);
3430 const double tolerance =
3431 std::min(min_line_length(tria_without_cylinder),
3432 min_line_length(cylinder_tria)) /
3442 for (
const auto &cell :
tria.active_cell_iterators())
3446 if (cell->manifold_id() == tfi_manifold_id)
3448 for (
const unsigned int face_n :
GeometryInfo<2>::face_indices())
3450 const auto &face = cell->face(face_n);
3451 if (face->at_boundary() &&
3452 internal::point_in_2d_box(face->center(),
3455 face->set_manifold_id(polar_manifold_id);
3457 face->set_manifold_id(tfi_manifold_id);
3468 static constexpr double tol =
3469 std::numeric_limits<double>::epsilon() * 10000;
3471 for (
const auto &cell :
tria.active_cell_iterators())
3474 const auto face = cell->face(face_n);
3475 if (face->at_boundary())
3480 face->set_boundary_id(0);
3483 face->set_boundary_id(1);
3486 face->set_boundary_id(2);
3489 face->set_boundary_id(3);
3493 Assert(cell->manifold_id() == tfi_manifold_id,
3495 face->set_boundary_id(4);
3515 const double inner_radius,
3516 const double outer_radius,
3517 const double pad_bottom,
3518 const double pad_top,
3519 const double pad_left,
3520 const double pad_right,
3525 const unsigned int n_slices,
3536 Point<2>(new_center[0], new_center[1]),
3565 const double shell_region_width,
3566 const unsigned int n_shells,
3567 const double skewness,
3570 Assert(0.0 <= shell_region_width && shell_region_width < 0.05,
3571 ExcMessage(
"The width of the shell region must be less than 0.05 "
3572 "(and preferably close to 0.03)"));
3606 std::set<Triangulation<2>::active_cell_iterator> cells_to_remove;
3608 for (
const auto &cell : bulk_tria.active_cell_iterators())
3610 if ((cell->center() -
Point<2>(0.2, 0.2)).norm() < 0.15)
3611 cells_to_remove.insert(cell);
3615 for (
const unsigned int vertex_n :
3617 if (cell->vertex(vertex_n) ==
Point<2>())
3621 cylinder_triangulation_offset =
3622 2.0 * (cell->vertex(3) -
Point<2>());
3629 bulk_tria, cells_to_remove, tria_without_cylinder);
3636 0.05 + shell_region_width,
3641 for (
const auto &cell : cylinder_tria.active_cell_iterators())
3644 if (
std::abs(cell->vertex(vertex_n)[0] - -0.41 / 4.0) < 1e-10)
3645 cell->vertex(vertex_n)[0] = -0.1;
3646 else if (
std::abs(cell->vertex(vertex_n)[0] - 0.41 / 4.0) < 1e-10)
3647 cell->vertex(vertex_n)[0] = 0.1;
3651 for (
const auto &cell : cylinder_tria.active_cell_iterators())
3653 cell->set_manifold_id(tfi_manifold_id);
3654 for (
const unsigned int face_n :
GeometryInfo<2>::face_indices())
3655 if (!cell->face(face_n)->at_boundary())
3656 cell->face(face_n)->set_manifold_id(tfi_manifold_id);
3658 if (0.0 < shell_region_width)
3661 ExcMessage(
"If the shell region has positive width then "
3662 "there must be at least one shell."));
3667 0.05 + shell_region_width,
3674 const double vertex_tolerance =
3675 std::min(internal::minimal_vertex_distance(shell_tria),
3676 internal::minimal_vertex_distance(cylinder_tria)) *
3682 shell_tria, cylinder_tria, temp, vertex_tolerance,
true);
3683 cylinder_tria = std::move(temp);
3689 const double vertex_tolerance =
3690 std::min(internal::minimal_vertex_distance(tria_without_cylinder),
3691 internal::minimal_vertex_distance(cylinder_tria)) /
3694 tria_without_cylinder, cylinder_tria,
tria, vertex_tolerance,
true);
3707 const double shift =
3708 std::min(0.125 + shell_region_width * 0.5, 0.1 * 4. / 3.);
3709 for (
const auto &cell :
tria.active_cell_iterators())
3711 if (cell->vertex(v).distance(
Point<2>(0.1, 0.205)) < 1
e-10)
3712 cell->vertex(v) =
Point<2>(0.2 -
shift, 0.205);
3713 else if (cell->vertex(v).distance(
Point<2>(0.3, 0.205)) < 1e-10)
3714 cell->vertex(v) =
Point<2>(0.2 + shift, 0.205);
3715 else if (cell->vertex(v).distance(
Point<2>(0.2, 0.1025)) < 1e-10)
3716 cell->vertex(v) =
Point<2>(0.2, 0.2 - shift);
3717 else if (cell->vertex(v).distance(
Point<2>(0.2, 0.3075)) < 1e-10)
3718 cell->vertex(v) =
Point<2>(0.2, 0.2 + shift);
3723 for (
const auto &cell :
tria.active_cell_iterators())
3725 cell->set_all_manifold_ids(polar_manifold_id);
3729 for (
const auto &cell :
tria.active_cell_iterators())
3736 std::vector<Point<2> *> cylinder_pointers;
3737 for (
const auto &face :
tria.active_face_iterators())
3740 cylinder_pointers.push_back(&face->vertex(0));
3741 cylinder_pointers.push_back(&face->vertex(1));
3744 std::sort(cylinder_pointers.begin(), cylinder_pointers.end());
3745 cylinder_pointers.erase(std::unique(cylinder_pointers.begin(),
3746 cylinder_pointers.end()),
3747 cylinder_pointers.end());
3751 for (
const Point<2> *
const ptr : cylinder_pointers)
3752 center += *ptr / double(cylinder_pointers.size());
3755 for (
Point<2> *
const ptr : cylinder_pointers)
3766 for (
const auto &face :
tria.active_face_iterators())
3767 if (face->at_boundary())
3772 face->set_boundary_id(0);
3775 face->set_boundary_id(1);
3777 else if (face->manifold_id() == polar_manifold_id)
3778 face->set_boundary_id(2);
3785 face->set_boundary_id(3);
3795 const double shell_region_width,
3796 const unsigned int n_shells,
3797 const double skewness,
3802 tria_2, shell_region_width, n_shells, skewness,
colorize);
3825 for (
const auto &face :
tria.active_face_iterators())
3827 face->set_boundary_id(3);
3832 template <
int dim,
int spacedim>
3835 const std::vector<unsigned int> &sizes,
3845 for (
unsigned int d = 0;
d < dim; ++
d)
3848 std::vector<Point<spacedim>> points;
3850 for (
const unsigned int i :
GeometryInfo<dim>::face_indices())
3853 std::vector<CellData<dim>> cells(n_cells);
3858 for (
unsigned int d = 0;
d < dim; ++
d)
3859 p(d) = 0.5 * dimensions[
d] *
3862 points.push_back(p);
3863 cells[0].vertices[i] = i;
3865 cells[0].material_id = 0;
3870 for (
const unsigned int face :
GeometryInfo<dim>::face_indices())
3876 for (
unsigned int j = 0; j < sizes[face]; ++j, ++
cell_index)
3878 const unsigned int last_cell = (j == 0) ? 0U : (
cell_index - 1);
3880 for (
unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_face;
3883 const unsigned int cellv =
3885 const unsigned int ocellv =
3889 cells[last_cell].vertices[cellv];
3892 cells[
cell_index].vertices[cellv] = points.size();
3897 points.push_back(p);
4054 const double thickness,
4058 ExcMessage(
"Invalid left-to-right bounds of enclosed hypercube"));
4060 std::vector<Point<2>>
vertices(16);
4062 coords[0] = left - thickness;
4065 coords[3] = right + thickness;
4068 for (
const double y : coords)
4069 for (const double x : coords)
4074 std::vector<CellData<2>> cells(9);
4076 for (
unsigned int i0 = 0; i0 < 3; ++i0)
4077 for (
unsigned int i1 = 0; i1 < 3; ++i1)
4079 cells[k].vertices[0] = i1 + 4 * i0;
4080 cells[k].vertices[1] = i1 + 4 * i0 + 1;
4081 cells[k].vertices[2] = i1 + 4 * i0 + 4;
4082 cells[k].vertices[3] = i1 + 4 * i0 + 5;
4084 cells[k].material_id = materials[k];
4102 const double rl2 = (right + left) / 2;
4113 const int cell_vertices[4][4] = {{0, 1, 3, 2},
4118 for (
unsigned int i = 0; i < 4; ++i)
4120 for (
unsigned int j = 0; j < 4; ++j)
4121 cells[i].
vertices[j] = cell_vertices[i][j];
4122 cells[i].material_id = 0;
4132 cell->face(1)->set_boundary_id(1);
4134 cell->face(0)->set_boundary_id(2);
4143 const double radius_0,
4144 const double radius_1,
4145 const double half_length)
4149 vertices_tmp[0] =
Point<2>(-half_length, -radius_0);
4150 vertices_tmp[1] =
Point<2>(half_length, -radius_1);
4151 vertices_tmp[2] =
Point<2>(-half_length, radius_0);
4152 vertices_tmp[3] =
Point<2>(half_length, radius_1);
4154 const std::vector<Point<2>>
vertices(std::begin(vertices_tmp),
4155 std::end(vertices_tmp));
4159 cell_vertices[0][i] = i;
4164 cells[0].
vertices[i] = cell_vertices[0][i];
4166 cells[0].material_id = 0;
4171 cell->face(0)->set_boundary_id(1);
4172 cell->face(1)->set_boundary_id(2);
4174 for (
unsigned int i = 2; i < 4; ++i)
4175 cell->face(i)->set_boundary_id(0);
4192 Point<2>((a + b) / 2, (a + b) / 2),
4196 const int cell_vertices[3][4] = {{0, 1, 3, 4}, {1, 2, 4, 5}, {3, 4, 6, 7}};
4200 for (
unsigned int i = 0; i < 3; ++i)
4202 for (
unsigned int j = 0; j < 4; ++j)
4203 cells[i].
vertices[j] = cell_vertices[i][j];
4204 cells[i].material_id = 0;
4216 cell->face(0)->set_boundary_id(0);
4217 cell->face(2)->set_boundary_id(1);
4220 cell->face(1)->set_boundary_id(2);
4221 cell->face(2)->set_boundary_id(1);
4222 cell->face(3)->set_boundary_id(3);
4225 cell->face(0)->set_boundary_id(0);
4226 cell->face(1)->set_boundary_id(4);
4227 cell->face(3)->set_boundary_id(5);
4233 template <
int dim,
int spacedim>
4236 const std::vector<unsigned int> &repetitions,
4239 const std::vector<int> & n_cells_to_remove)
4245 for (
unsigned int d = 0;
d < dim; ++
d)
4247 Assert(std::fabs(n_cells_to_remove[d]) <= repetitions[d],
4248 ExcMessage(
"Attempting to cut away too many cells."));
4258 std::array<double, dim> h;
4260 for (
unsigned int d = 0;
d < dim; ++
d)
4263 h[
d] = (top_right[
d] - bottom_left[
d]) / repetitions[d];
4265 if (n_cells_to_remove[d] >= 0)
4269 h[
d] * std::fabs(n_cells_to_remove[d]) + bottom_left[
d];
4274 cut_step[
d] = top_right[
d] - h[
d] * std::fabs(n_cells_to_remove[d]);
4280 std::set<typename Triangulation<dim, spacedim>::active_cell_iterator>
4282 for (
const auto &cell : rectangle.active_cell_iterators())
4284 bool remove_cell =
true;
4285 for (
unsigned int d = 0;
d < dim && remove_cell; ++
d)
4286 if ((n_cells_to_remove[d] > 0 && cell->center()[d] >= cut_step[d]) ||
4287 (n_cells_to_remove[d] < 0 && cell->center()[d] <= cut_step[d]))
4288 remove_cell =
false;
4290 cells_to_remove.insert(cell);
4305 const double radius,
4306 const bool internal_manifolds)
4311 const double a = 1. / (1 +
std::sqrt(2.0));
4322 const int cell_vertices[5][4] = {
4323 {0, 1, 2, 3}, {0, 2, 6, 4}, {2, 3, 4, 5}, {1, 7, 3, 5}, {6, 4, 7, 5}};
4327 for (
unsigned int i = 0; i < 5; ++i)
4329 for (
unsigned int j = 0; j < 4; ++j)
4330 cells[i].
vertices[j] = cell_vertices[i][j];
4331 cells[i].material_id = 0;
4341 if (internal_manifolds)
4351 const double inner_radius,
4352 const double outer_radius,
4353 const unsigned int n_cells,
4356 Assert((inner_radius > 0) && (inner_radius < outer_radius),
4370 const unsigned int N =
4371 (
n_cells == 0 ?
static_cast<unsigned int>(
4372 std::ceil((2 * pi * (outer_radius + inner_radius) / 2) /
4373 (outer_radius - inner_radius))) :
4382 std::vector<Point<2>>
vertices(2 * N);
4383 for (
unsigned int i = 0; i < N; ++i)
4396 for (
unsigned int i = 0; i < N; ++i)
4398 cells[i].vertices[0] = i;
4399 cells[i].vertices[1] = (i + 1) % N;
4400 cells[i].vertices[2] = N + i;
4401 cells[i].vertices[3] = N + ((i + 1) % N);
4403 cells[i].material_id = 0;
4409 colorize_hyper_shell(
tria,
center, inner_radius, outer_radius);
4422 const double inner_radius,
4423 const double outer_radius,
4424 const unsigned int n_cells)
4427 tria, outer_center, inner_radius, outer_radius, n_cells,
true);
4431 outer_radius - inner_radius > outer_center.
distance(inner_center),
4433 "The inner radius is greater than or equal to the outer radius plus eccentricity."));
4437 std::set<Point<dim> *> vertices_to_move;
4439 for (
const auto &face :
tria.active_face_iterators())
4441 for (unsigned
int v = 0; v < GeometryInfo<dim>::vertices_per_face; ++v)
4442 vertices_to_move.insert(&face->vertex(v));
4444 const auto shift = inner_center - outer_center;
4445 for (
const auto &p : vertices_to_move)
4473 const double radius,
4474 const double half_length)
4476 Point<2> p1(-half_length, -radius);
4485 switch (f->boundary_id())
4488 f->set_boundary_id(1);
4491 f->set_boundary_id(2);
4494 f->set_boundary_id(0);
4531 const double radius)
4533 const unsigned int dim = 2;
4547 const int cell_vertices[3][4] = {{0, 2, 3, 4}, {1, 6, 2, 4}, {5, 3, 6, 4}};
4551 for (
unsigned int i = 0; i < 3; ++i)
4553 for (
unsigned int j = 0; j < 4; ++j)
4554 cells[i].
vertices[j] = cell_vertices[i][j];
4555 cells[i].material_id = 0;
4570 for (
const unsigned int i :
GeometryInfo<dim>::face_indices())
4572 if (cell->face(i)->boundary_id() ==
4578 if (cell->face(i)->center()(0) < p(0) + 1.e-5 * radius ||
4579 cell->face(i)->center()(1) < p(1) + 1.e-5 * radius)
4581 cell->face(i)->set_boundary_id(1);
4595 const double radius)
4600 const double a = 1. / (1 +
std::sqrt(2.0));
4611 const int cell_vertices[5][4] = {{0, 1, 2, 3},
4618 for (
unsigned int i = 0; i < 4; ++i)
4620 for (
unsigned int j = 0; j < 4; ++j)
4621 cells[i].
vertices[j] = cell_vertices[i][j];
4622 cells[i].material_id = 0;
4637 for (
const unsigned int i :
GeometryInfo<2>::face_indices())
4639 if (cell->face(i)->boundary_id() ==
4644 if (cell->face(i)->center()(0) < p(0) + 1.e-5 * radius)
4646 cell->face(i)->set_boundary_id(1);
4662 const double inner_radius,
4663 const double outer_radius,
4664 const unsigned int n_cells,
4667 Assert((inner_radius > 0) && (inner_radius < outer_radius),
4680 const unsigned int N =
4681 (
n_cells == 0 ?
static_cast<unsigned int>(
4682 std::ceil((pi * (outer_radius + inner_radius) / 2) /
4683 (outer_radius - inner_radius))) :
4692 std::vector<Point<2>>
vertices(2 * (N + 1));
4693 for (
unsigned int i = 0; i <= N; ++i)
4702 Point<2>(((i == 0) || (i == N) ? 0 :
std::
cos(pi * i / N - pi / 2)),
4703 std::
sin(pi * i / N - pi / 2)) *
4714 for (
unsigned int i = 0; i < N; ++i)
4716 cells[i].vertices[0] = i;
4717 cells[i].vertices[1] = (i + 1) % (N + 1);
4718 cells[i].vertices[2] = N + 1 + i;
4719 cells[i].vertices[3] = N + 1 + ((i + 1) % (N + 1));
4721 cells[i].material_id = 0;
4729 for (; cell !=
tria.
end(); ++cell)
4731 cell->face(2)->set_boundary_id(1);
4733 tria.
begin()->face(0)->set_boundary_id(3);
4735 tria.
last()->face(1)->set_boundary_id(2);
4746 const double inner_radius,
4747 const double outer_radius,
4748 const unsigned int n_cells,
4751 Assert((inner_radius > 0) && (inner_radius < outer_radius),
4764 const unsigned int N =
4765 (
n_cells == 0 ?
static_cast<unsigned int>(
4766 std::ceil((pi * (outer_radius + inner_radius) / 4) /
4767 (outer_radius - inner_radius))) :
4776 std::vector<Point<2>>
vertices(2 * (N + 1));
4777 for (
unsigned int i = 0; i <= N; ++i)
4785 std::
sin(pi * i / N / 2)) *
4796 for (
unsigned int i = 0; i < N; ++i)
4798 cells[i].vertices[0] = i;
4799 cells[i].vertices[1] = (i + 1) % (N + 1);
4800 cells[i].vertices[2] = N + 1 + i;
4801 cells[i].vertices[3] = N + 1 + ((i + 1) % (N + 1));
4803 cells[i].material_id = 0;
4811 for (; cell !=
tria.
end(); ++cell)
4813 cell->face(2)->set_boundary_id(1);
4815 tria.
begin()->face(0)->set_boundary_id(3);
4817 tria.
last()->face(1)->set_boundary_id(2);
4834 const double rl2 = (right + left) / 2;
4835 const double len = (right - left) / 2.;
4848 const int cell_vertices[4][8] = {{0, 1, 3, 2, 10, 11, 13, 12},
4849 {9, 4, 2, 5, 19, 14, 12, 15},
4850 {3, 2, 7, 6, 13, 12, 17, 16},
4851 {2, 5, 6, 8, 12, 15, 16, 18}};
4853 for (
unsigned int i = 0; i < 4; ++i)
4855 for (
unsigned int j = 0; j < 8; ++j)
4856 cells[i].
vertices[j] = cell_vertices[i][j];
4857 cells[i].material_id = 0;
4867 cell->face(1)->set_boundary_id(1);
4869 cell->face(0)->set_boundary_id(2);
4881 const double thickness,
4885 ExcMessage(
"Invalid left-to-right bounds of enclosed hypercube"));
4887 std::vector<Point<3>>
vertices(64);
4889 coords[0] = left - thickness;
4892 coords[3] = right + thickness;
4895 for (
const double z : coords)
4896 for (const double y : coords)
4897 for (const double x : coords)
4901 24, 26, 5, 4, 6, 1, 0,
4902 2, 9, 8, 10, 37, 36, 38,
4903 33, 32, 34, 41, 40, 42};
4905 std::vector<CellData<3>> cells(27);
4907 for (
unsigned int z = 0; z < 3; ++z)
4908 for (
unsigned int y = 0; y < 3; ++y)
4909 for (
unsigned int x = 0; x < 3; ++x)
4911 cells[k].vertices[0] = x + 4 * y + 16 * z;
4912 cells[k].vertices[1] = x + 4 * y + 16 * z + 1;
4913 cells[k].vertices[2] = x + 4 * y + 16 * z + 4;
4914 cells[k].vertices[3] = x + 4 * y + 16 * z + 5;
4915 cells[k].vertices[4] = x + 4 * y + 16 * z + 16;
4916 cells[k].vertices[5] = x + 4 * y + 16 * z + 17;
4917 cells[k].vertices[6] = x + 4 * y + 16 * z + 20;
4918 cells[k].vertices[7] = x + 4 * y + 16 * z + 21;
4920 cells[k].material_id = materials[k];
4933 const double radius_0,
4934 const double radius_1,
4935 const double half_length)
4938 ExcMessage(
"The output triangulation object needs to be empty."));
4943 const auto n_slices = 1 +
static_cast<unsigned int>(std::ceil(
4944 half_length /
std::max(radius_0, radius_1)));
4957 auto shift_radii = [=](
const Point<3> &p) {
4958 const double slope = (radius_1 / radius_0 - 1.0) / (2.0 * half_length);
4959 const double factor = slope * (p[0] - -half_length) + 1.0;
4960 return Point<3>(p[0], factor * p[1], factor * p[2]);
4966 for (
const auto &face :
triangulation.active_face_iterators())
4967 if (face->at_boundary())
4969 if (
std::abs(face->center()[0] - -half_length) < 1e-8 * half_length)
4970 face->set_boundary_id(1);
4971 else if (
std::abs(face->center()[0] - half_length) <
4973 face->set_boundary_id(2);
4975 face->set_all_manifold_ids(0);
4998 Point<3>((a + b) / 2, a, (a + b) / 2),
5005 Point<3>((a + b) / 2, (a + b) / 2, a),
5007 Point<3>(a, (a + b) / 2, (a + b) / 2),
5008 Point<3>((a + b) / 2, (a + b) / 2, (a + b) / 2),
5009 Point<3>(b, (a + b) / 2, (a + b) / 2),
5011 Point<3>((a + b) / 2, (a + b) / 2, b),
5019 Point<3>((a + b) / 2, b, (a + b) / 2),
5023 const int cell_vertices[7][8] = {{0, 1, 9, 10, 3, 4, 12, 13},
5024 {1, 2, 10, 11, 4, 5, 13, 14},
5025 {3, 4, 12, 13, 6, 7, 15, 16},
5026 {4, 5, 13, 14, 7, 8, 16, 17},
5027 {9, 10, 18, 19, 12, 13, 21, 22},
5028 {10, 11, 19, 20, 13, 14, 22, 23},
5029 {12, 13, 21, 22, 15, 16, 24, 25}};
5033 for (
unsigned int i = 0; i < 7; ++i)
5035 for (
unsigned int j = 0; j < 8; ++j)
5036 cells[i].
vertices[j] = cell_vertices[i][j];
5037 cells[i].material_id = 0;
5058 const double radius,
5059 const bool internal_manifold)
5065 const unsigned int n_vertices = 16;
5091 const unsigned int n_cells = 7;
5092 const int cell_vertices[
n_cells][8] = {
5093 {0, 1, 4, 5, 3, 2, 7, 6},
5094 {8, 9, 12, 13, 0, 1, 4, 5},
5095 {9, 13, 1, 5, 10, 14, 2, 6},
5096 {11, 10, 3, 2, 15, 14, 7, 6},
5097 {8, 0, 12, 4, 11, 3, 15, 7},
5098 {8, 9, 0, 1, 11, 10, 3, 2},
5099 {12, 4, 13, 5, 15, 7, 14, 6}};
5101 std::vector<CellData<3>> cells(n_cells,
CellData<3>());
5103 for (
unsigned int i = 0; i <
n_cells; ++i)
5106 cells[i].
vertices[j] = cell_vertices[i][j];
5107 cells[i].material_id = 0;
5117 if (internal_manifold)
5125 const unsigned int n_rotate_middle_square)
5128 ExcMessage(
"The number of rotation by pi/2 of the right square "
5129 "must be in the half-open range [0,4)."))
5131 constexpr
unsigned int dim = 2;
5133 const
unsigned int n_cells = 5;
5152 unsigned int cell_vertices[
n_cells][4] = {{0, 1, 2, 3},
5158 switch (n_rotate_middle_square)
5162 cell_vertices[1][0] = 4;
5163 cell_vertices[1][1] = 5;
5164 cell_vertices[1][2] = 1;
5165 cell_vertices[1][3] = 3;
5171 cell_vertices[1][0] = 5;
5172 cell_vertices[1][1] = 3;
5173 cell_vertices[1][2] = 4;
5174 cell_vertices[1][3] = 1;
5180 cell_vertices[1][0] = 3;
5181 cell_vertices[1][1] = 1;
5182 cell_vertices[1][2] = 5;
5183 cell_vertices[1][3] = 4;
5195 for (
const unsigned int vertex_index :
5210 const bool face_orientation,
5211 const bool face_flip,
5212 const bool face_rotation,
5213 const bool manipulate_left_cube)
5215 constexpr unsigned int dim = 3;
5217 const unsigned int n_cells = 2;
5218 std::vector<CellData<dim>> cells(n_cells);
5234 unsigned int cell_vertices[
n_cells][8] = {
5235 {0, 1, 2, 3, 4, 5, 6, 7},
5236 {1, 8, 3, 9, 5, 10, 7, 11}};
5239 const unsigned int this_case = 4 *
static_cast<int>(face_orientation) +
5240 2 *
static_cast<int>(face_flip) +
5241 static_cast<int>(face_rotation);
5243 if (manipulate_left_cube)
5249 cell_vertices[0][0] = 1;
5250 cell_vertices[0][1] = 0;
5251 cell_vertices[0][2] = 5;
5252 cell_vertices[0][3] = 4;
5253 cell_vertices[0][4] = 3;
5254 cell_vertices[0][5] = 2;
5255 cell_vertices[0][6] = 7;
5256 cell_vertices[0][7] = 6;
5262 cell_vertices[0][0] = 5;
5263 cell_vertices[0][1] = 4;
5264 cell_vertices[0][2] = 7;
5265 cell_vertices[0][3] = 6;
5266 cell_vertices[0][4] = 1;
5267 cell_vertices[0][5] = 0;
5268 cell_vertices[0][6] = 3;
5269 cell_vertices[0][7] = 2;
5275 cell_vertices[0][0] = 7;
5276 cell_vertices[0][1] = 6;
5277 cell_vertices[0][2] = 3;
5278 cell_vertices[0][3] = 2;
5279 cell_vertices[0][4] = 5;
5280 cell_vertices[0][5] = 4;
5281 cell_vertices[0][6] = 1;
5282 cell_vertices[0][7] = 0;
5287 cell_vertices[0][0] = 3;
5288 cell_vertices[0][1] = 2;
5289 cell_vertices[0][2] = 1;
5290 cell_vertices[0][3] = 0;
5291 cell_vertices[0][4] = 7;
5292 cell_vertices[0][5] = 6;
5293 cell_vertices[0][6] = 5;
5294 cell_vertices[0][7] = 4;
5300 cell_vertices[0][0] = 0;
5301 cell_vertices[0][1] = 1;
5302 cell_vertices[0][2] = 2;
5303 cell_vertices[0][3] = 3;
5304 cell_vertices[0][4] = 4;
5305 cell_vertices[0][5] = 5;
5306 cell_vertices[0][6] = 6;
5307 cell_vertices[0][7] = 7;
5313 cell_vertices[0][0] = 2;
5314 cell_vertices[0][1] = 3;
5315 cell_vertices[0][2] = 6;
5316 cell_vertices[0][3] = 7;
5317 cell_vertices[0][4] = 0;
5318 cell_vertices[0][5] = 1;
5319 cell_vertices[0][6] = 4;
5320 cell_vertices[0][7] = 5;
5326 cell_vertices[0][0] = 6;
5327 cell_vertices[0][1] = 7;
5328 cell_vertices[0][2] = 4;
5329 cell_vertices[0][3] = 5;
5330 cell_vertices[0][4] = 2;
5331 cell_vertices[0][5] = 3;
5332 cell_vertices[0][6] = 0;
5333 cell_vertices[0][7] = 1;
5339 cell_vertices[0][0] = 4;
5340 cell_vertices[0][1] = 5;
5341 cell_vertices[0][2] = 0;
5342 cell_vertices[0][3] = 1;
5343 cell_vertices[0][4] = 6;
5344 cell_vertices[0][5] = 7;
5345 cell_vertices[0][6] = 2;
5346 cell_vertices[0][7] = 3;
5357 cell_vertices[1][0] = 8;
5358 cell_vertices[1][1] = 1;
5359 cell_vertices[1][2] = 10;
5360 cell_vertices[1][3] = 5;
5361 cell_vertices[1][4] = 9;
5362 cell_vertices[1][5] = 3;
5363 cell_vertices[1][6] = 11;
5364 cell_vertices[1][7] = 7;
5370 cell_vertices[1][0] = 10;
5371 cell_vertices[1][1] = 5;
5372 cell_vertices[1][2] = 11;
5373 cell_vertices[1][3] = 7;
5374 cell_vertices[1][4] = 8;
5375 cell_vertices[1][5] = 1;
5376 cell_vertices[1][6] = 9;
5377 cell_vertices[1][7] = 3;
5383 cell_vertices[1][0] = 11;
5384 cell_vertices[1][1] = 7;
5385 cell_vertices[1][2] = 9;
5386 cell_vertices[1][3] = 3;
5387 cell_vertices[1][4] = 10;
5388 cell_vertices[1][5] = 5;
5389 cell_vertices[1][6] = 8;
5390 cell_vertices[1][7] = 1;
5396 cell_vertices[1][0] = 9;
5397 cell_vertices[1][1] = 3;
5398 cell_vertices[1][2] = 8;
5399 cell_vertices[1][3] = 1;
5400 cell_vertices[1][4] = 11;
5401 cell_vertices[1][5] = 7;
5402 cell_vertices[1][6] = 10;
5403 cell_vertices[1][7] = 5;
5409 cell_vertices[1][0] = 1;
5410 cell_vertices[1][1] = 8;
5411 cell_vertices[1][2] = 3;
5412 cell_vertices[1][3] = 9;
5413 cell_vertices[1][4] = 5;
5414 cell_vertices[1][5] = 10;
5415 cell_vertices[1][6] = 7;
5416 cell_vertices[1][7] = 11;
5422 cell_vertices[1][0] = 5;
5423 cell_vertices[1][1] = 10;
5424 cell_vertices[1][2] = 1;
5425 cell_vertices[1][3] = 8;
5426 cell_vertices[1][4] = 7;
5427 cell_vertices[1][5] = 11;
5428 cell_vertices[1][6] = 3;
5429 cell_vertices[1][7] = 9;
5435 cell_vertices[1][0] = 7;
5436 cell_vertices[1][1] = 11;
5437 cell_vertices[1][2] = 5;
5438 cell_vertices[1][3] = 10;
5439 cell_vertices[1][4] = 3;
5440 cell_vertices[1][5] = 9;
5441 cell_vertices[1][6] = 1;
5442 cell_vertices[1][7] = 8;
5448 cell_vertices[1][0] = 3;
5449 cell_vertices[1][1] = 9;
5450 cell_vertices[1][2] = 7;
5451 cell_vertices[1][3] = 11;
5452 cell_vertices[1][4] = 1;
5453 cell_vertices[1][5] = 8;
5454 cell_vertices[1][6] = 5;
5455 cell_vertices[1][7] = 10;
5465 for (
const unsigned int vertex_index :
5479 template <
int spacedim>
5483 const double radius)
5487 const std::set<types::boundary_id> boundary_ids = {0};
5499 const unsigned int x_subdivisions,
5500 const double radius,
5501 const double half_length)
5509 const double initial_height = -half_length;
5510 const double height_increment = 2. * half_length / x_subdivisions;
5512 for (
unsigned int rep = 0; rep < (x_subdivisions + 1); ++rep)
5514 const double height = initial_height + height_increment * rep;
5516 vertices.emplace_back(-d, height, -d);
5517 vertices.emplace_back(d, height, -d);
5518 vertices.emplace_back(-a, height, -a);
5519 vertices.emplace_back(a, height, -a);
5520 vertices.emplace_back(-a, height, a);
5521 vertices.emplace_back(a, height, a);
5522 vertices.emplace_back(-d, height, d);
5523 vertices.emplace_back(d, height, d);
5529 const double h = vertex(1);
5530 vertex(1) = -vertex(0);
5534 std::vector<std::vector<int>> cell_vertices;
5535 cell_vertices.push_back({0, 1, 8, 9, 2, 3, 10, 11});
5536 cell_vertices.push_back({0, 2, 8, 10, 6, 4, 14, 12});
5537 cell_vertices.push_back({2, 3, 10, 11, 4, 5, 12, 13});
5538 cell_vertices.push_back({1, 7, 9, 15, 3, 5, 11, 13});
5539 cell_vertices.push_back({6, 4, 14, 12, 7, 5, 15, 13});
5541 for (
unsigned int rep = 1; rep < x_subdivisions; ++rep)
5543 for (
unsigned int i = 0; i < 5; ++i)
5545 std::vector<int> new_cell_vertices(8);
5546 for (
unsigned int j = 0; j < 8; ++j)
5547 new_cell_vertices[j] = cell_vertices[i][j] + 8 * rep;
5548 cell_vertices.push_back(new_cell_vertices);
5552 unsigned int n_cells = x_subdivisions * 5;
5554 std::vector<CellData<3>> cells(n_cells,
CellData<3>());
5556 for (
unsigned int i = 0; i <
n_cells; ++i)
5558 for (
unsigned int j = 0; j < 8; ++j)
5559 cells[i].
vertices[j] = cell_vertices[i][j];
5560 cells[i].material_id = 0;
5582 const double tolerance = 1
e-5 *
std::min(radius, half_length);
5584 for (
const auto &cell :
tria.cell_iterators())
5586 if (cell->at_boundary(i))
5588 if (cell->face(i)->center()(0) > half_length - tolerance)
5590 cell->face(i)->set_boundary_id(2);
5593 for (
unsigned int e = 0; e < GeometryInfo<3>::lines_per_face;
5595 if ((std::fabs(cell->face(i)->line(e)->vertex(0)[1]) == a) ||
5596 (std::fabs(cell->face(i)->line(e)->vertex(0)[2]) == a) ||
5597 (std::fabs(cell->face(i)->line(e)->vertex(1)[1]) == a) ||
5598 (std::fabs(cell->face(i)->line(e)->vertex(1)[2]) == a))
5600 cell->face(i)->line(e)->set_boundary_id(2);
5601 cell->face(i)->line(e)->set_manifold_id(
5605 else if (cell->face(i)->center()(0) < -half_length + tolerance)
5607 cell->face(i)->set_boundary_id(1);
5610 for (
unsigned int e = 0; e < GeometryInfo<3>::lines_per_face;
5612 if ((std::fabs(cell->face(i)->line(e)->vertex(0)[1]) == a) ||
5613 (std::fabs(cell->face(i)->line(e)->vertex(0)[2]) == a) ||
5614 (std::fabs(cell->face(i)->line(e)->vertex(1)[1]) == a) ||
5615 (std::fabs(cell->face(i)->line(e)->vertex(1)[2]) == a))
5617 cell->face(i)->line(e)->set_boundary_id(1);
5618 cell->face(i)->line(e)->set_manifold_id(
5630 const double radius,
5631 const double half_length)
5640 const double radius)
5642 const unsigned int dim = 3;
5650 const double a = 0.528;
5651 const double b = 0.4533;
5652 const double c = 0.3752;
5669 const int cell_vertices[4][8] = {{0, 2, 3, 4, 7, 9, 10, 11},
5670 {1, 6, 2, 4, 8, 13, 9, 11},
5671 {5, 3, 6, 4, 12, 10, 13, 11},
5672 {7, 9, 10, 11, 14, 8, 12, 13}};
5676 for (
unsigned int i = 0; i < 4; ++i)
5678 for (
unsigned int j = 0; j < 8; ++j)
5679 cells[i].
vertices[j] = cell_vertices[i][j];
5680 cells[i].material_id = 0;
5694 for (
const unsigned int i :
GeometryInfo<dim>::face_indices())
5696 if (cell->face(i)->boundary_id() ==
5701 if (cell->face(i)->center()(0) <
center(0) + 1.e-5 * radius ||
5702 cell->face(i)->center()(1) <
center(1) + 1.e-5 * radius ||
5703 cell->face(i)->center()(2) <
center(2) + 1.e-5 * radius)
5705 cell->face(i)->set_boundary_id(1);
5709 for (
unsigned int j = 0; j < GeometryInfo<3>::lines_per_face;
5712 const Point<3> line_vertices[2] = {
5713 cell->face(i)->line(j)->vertex(0),
5714 cell->face(i)->line(j)->vertex(1)};
5715 if ((std::fabs(line_vertices[0].distance(
center) - radius) >
5717 (std::fabs(line_vertices[1].distance(
center) - radius) >
5720 cell->face(i)->line(j)->set_boundary_id(1);
5721 cell->face(i)->line(j)->set_manifold_id(
5739 const double radius)
5745 const double b = a / 2.0;
5746 const double c =
d / 2.0;
5748 const double hb = radius *
std::sqrt(3.0) / 4.0;
5749 const double hc = radius *
std::sqrt(3.0) / 2.0;
5771 int cell_vertices[6][8] = {{0, 1, 8, 9, 2, 3, 10, 11},
5772 {0, 2, 8, 10, 6, 4, 14, 12},
5773 {2, 3, 10, 11, 4, 5, 12, 13},
5774 {1, 7, 9, 15, 3, 5, 11, 13},
5775 {6, 4, 14, 12, 7, 5, 15, 13},
5776 {8, 10, 9, 11, 14, 12, 15, 13}};
5780 for (
unsigned int i = 0; i < 6; ++i)
5782 for (
unsigned int j = 0; j < 8; ++j)
5783 cells[i].
vertices[j] = cell_vertices[i][j];
5784 cells[i].material_id = 0;
5804 for (
const unsigned int i :
GeometryInfo<3>::face_indices())
5806 if (!cell->at_boundary(i))
5812 if (cell->face(i)->center()(0) <
center(0) + 1.e-5 * radius)
5814 cell->face(i)->set_boundary_id(1);
5816 for (
unsigned int j = 0; j < GeometryInfo<3>::lines_per_face;
5819 const Point<3> line_vertices[2] = {
5820 cell->face(i)->line(j)->vertex(0),
5821 cell->face(i)->line(j)->vertex(1)};
5822 if ((std::fabs(line_vertices[0].distance(
center) - radius) >
5824 (std::fabs(line_vertices[1].distance(
center) - radius) >
5827 cell->face(i)->line(j)->set_boundary_id(1);
5828 cell->face(i)->line(j)->set_manifold_id(
5845 const double radius)
5858 for (
unsigned int round = 0; round < dim; ++round)
5863 std::vector<Point<dim>> new_points(tria_copy.
n_vertices());
5865 for (
unsigned int v = 0; v < tria_copy.
n_vertices(); ++v)
5873 else if (round == 1)
5875 for (
unsigned int v = 0; v < tria_copy.
n_vertices(); ++v)
5884 else if (round == 2)
5885 for (
unsigned int v = 0; v < tria_copy.
n_vertices(); ++v)
5898 std::vector<CellData<dim>> cells;
5899 cells.reserve(tria_copy.
n_cells());
5900 for (
const auto &cell : tria_copy.cell_iterators())
5904 data.
vertices[v] = cell->vertex_index(v);
5907 cells.push_back(data);
5915 if (round == dim - 1)
5924 for (
const auto &cell :
tria.cell_iterators())
5925 if (cell->
center().norm_square() > 0.4 * radius)
5926 cell->set_manifold_id(1);
5945 const double inner_radius,
5946 const double outer_radius)
5949 std::vector<CellData<3>> cells;
5951 const double irad = inner_radius /
std::sqrt(3.0);
5952 const double orad = outer_radius /
std::sqrt(3.0);
5955 static const std::array<Point<3>, 8> hexahedron = {{{-1, -1, -1},
5965 for (
unsigned int i = 0; i < 8; ++i)
5966 vertices.push_back(p + hexahedron[i] * irad);
5967 for (
unsigned int i = 0; i < 8; ++i)
5968 vertices.push_back(p + hexahedron[i] * orad);
5970 const unsigned int n_cells = 6;
5971 const int cell_vertices[
n_cells][8] = {
5972 {8, 9, 10, 11, 0, 1, 2, 3},
5973 {9, 11, 1, 3, 13, 15, 5, 7},
5974 {12, 13, 4, 5, 14, 15, 6, 7},
5975 {8, 0, 10, 2, 12, 4, 14, 6},
5976 {8, 9, 0, 1, 12, 13, 4, 5},
5977 {10, 2, 11, 3, 14, 6, 15, 7}};
5981 for (
unsigned int i = 0; i <
n_cells; ++i)
5984 cells[i].
vertices[j] = cell_vertices[i][j];
5985 cells[i].material_id = 0;
5996 const double inner_radius,
5997 const double outer_radius)
6000 std::vector<CellData<3>> cells;
6002 const double irad = inner_radius /
std::sqrt(3.0);
6003 const double orad = outer_radius /
std::sqrt(3.0);
6009 static const std::array<Point<3>, 6> octahedron = {{{-1, 0, 0},
6017 static const std::array<Point<3>, 8> hexahedron = {{{-1, -1, -1},
6026 for (
unsigned int i = 0; i < 8; ++i)
6027 vertices.push_back(p + hexahedron[i] * irad);
6028 for (
unsigned int i = 0; i < 6; ++i)
6029 vertices.push_back(p + octahedron[i] * inner_radius);
6030 for (
unsigned int i = 0; i < 8; ++i)
6031 vertices.push_back(p + hexahedron[i] * orad);
6032 for (
unsigned int i = 0; i < 6; ++i)
6033 vertices.push_back(p + octahedron[i] * outer_radius);
6035 const unsigned int n_cells = 12;
6036 const unsigned int rhombi[
n_cells][4] = {{10, 4, 0, 8},
6051 for (
unsigned int i = 0; i <
n_cells; ++i)
6053 for (
unsigned int j = 0; j < 4; ++j)
6055 cells[i].vertices[j] = rhombi[i][j];
6056 cells[i].vertices[j + 4] = rhombi[i][j] + 14;
6058 cells[i].material_id = 0;
6068 const unsigned int n,
6069 const unsigned int n_refinement_steps,
6071 const double inner_radius,
6072 const double outer_radius)
6085 const unsigned int outer_radius_factor = 1 << n_refinement_steps;
6090 outer_radius_factor * outer_radius -
6091 (outer_radius_factor - 1) * inner_radius);
6096 outer_radius_factor * outer_radius -
6097 (outer_radius_factor - 1) * inner_radius);
6100 for (
unsigned int r = 0; r < n_refinement_steps; ++r)
6103 std::set<Triangulation<3>::active_cell_iterator> cells_to_remove;
6107 for (
const auto &cell : tmp.active_cell_iterators())
6109 unsigned int n_vertices_inside = 0;
6111 if ((cell->vertex(v) - p).norm_square() <
6112 inner_radius * inner_radius * (1 + 1
e-12))
6113 ++n_vertices_inside;
6114 if (n_vertices_inside < 4)
6115 cells_to_remove.insert(cell);
6119 if (r == n_refinement_steps - 1)
6129 tmp = std::move(copy);
6147 const double inner_radius,
6148 const double outer_radius,
6149 const unsigned int n_cells,
6152 Assert((inner_radius > 0) && (inner_radius < outer_radius),
6155 unsigned int n_refinement_steps = 0;
6156 unsigned int n_cells_coarsened =
n_cells;
6157 if (n_cells != 96 && n_cells > 12)
6158 while (n_cells_coarsened > 12 && n_cells_coarsened % 4 == 0)
6160 ++n_refinement_steps;
6161 n_cells_coarsened /= 4;
6163 Assert(n_cells == 0 || n_cells == 6 || n_cells == 12 || n_cells == 96 ||
6164 (n_refinement_steps > 0 &&
6165 (n_cells_coarsened == 6 || n_cells_coarsened == 12)),
6166 ExcMessage(
"Invalid number of coarse mesh cells"));
6168 const unsigned int n = n_refinement_steps > 0 ?
6169 4 * n_cells_coarsened :
6175 internal::hyper_shell_6(
tria, p, inner_radius, outer_radius);
6178 internal::hyper_shell_12(
tria, p, inner_radius, outer_radius);
6182 internal::hyper_shell_24_48(
6183 tria, n, n_refinement_steps, p, inner_radius, outer_radius);
6192 internal::hyper_shell_12(tmp, p, inner_radius, outer_radius);
6209 colorize_hyper_shell(
tria, p, inner_radius, outer_radius);
6219 const double inner_radius,
6220 const double outer_radius,
6221 const unsigned int ,
6224 Assert((inner_radius > 0) && (inner_radius < outer_radius),
6228 const double d = outer_radius /
std::sqrt(2.0);
6229 const double a = inner_radius /
std::sqrt(2.0);
6231 const double b = a / 2.0;
6232 const double c =
d / 2.0;
6234 const double hb = inner_radius *
std::sqrt(3.0) / 2.0;
6235 const double hc = outer_radius *
std::sqrt(3.0) / 2.0;
6257 int cell_vertices[5][8] = {{0, 1, 8, 9, 2, 3, 10, 11},
6258 {0, 2, 8, 10, 6, 4, 14, 12},
6259 {1, 7, 9, 15, 3, 5, 11, 13},
6260 {6, 4, 14, 12, 7, 5, 15, 13},
6261 {8, 10, 9, 11, 14, 12, 15, 13}};
6265 for (
unsigned int i = 0; i < 5; ++i)
6267 for (
unsigned int j = 0; j < 8; ++j)
6268 cells[i].
vertices[j] = cell_vertices[i][j];
6269 cells[i].material_id = 0;
6283 for (; cell !=
tria.
end(); ++cell)
6284 for (
const unsigned int i :
GeometryInfo<3>::face_indices())
6285 if (cell->at_boundary(i))
6286 cell->face(i)->set_all_boundary_ids(2);
6293 for (
const unsigned int i :
GeometryInfo<3>::face_indices())
6294 if (cell->at_boundary(i))
6298 const Point<3> face_center(face->center());
6300 1.e-6 * face_center.
norm())
6304 face->set_all_boundary_ids(0);
6306 face->set_all_boundary_ids(1);
6320 const double inner_radius,
6321 const double outer_radius,
6322 const unsigned int n,
6325 Assert((inner_radius > 0) && (inner_radius < outer_radius),
6327 if (n == 0 || n == 3)
6329 const double a = inner_radius *
std::sqrt(2.0) / 2e0;
6330 const double b = outer_radius *
std::sqrt(2.0) / 2e0;
6331 const double c = a *
std::sqrt(3.0) / 2e0;
6333 const double e = outer_radius / 2e0;
6334 const double h = inner_radius / 2e0;
6353 const int cell_vertices[3][8] = {
6354 {0, 1, 3, 2, 4, 5, 7, 6},
6355 {1, 8, 2, 9, 5, 10, 6, 11},
6356 {4, 5, 7, 6, 12, 10, 13, 11},
6358 std::vector<CellData<3>> cells(3);
6360 for (
unsigned int i = 0; i < 3; ++i)
6362 for (
unsigned int j = 0; j < 8; ++j)
6363 cells[i].
vertices[j] = cell_vertices[i][j];
6364 cells[i].material_id = 0;
6377 colorize_quarter_hyper_shell(
tria,
center, inner_radius, outer_radius);
6388 const double length,
6389 const double inner_radius,
6390 const double outer_radius,
6391 const unsigned int n_radial_cells,
6392 const unsigned int n_axial_cells)
6394 Assert((inner_radius > 0) && (inner_radius < outer_radius),
6408 const unsigned int N_r =
6409 (n_radial_cells == 0 ?
static_cast<unsigned int>(std::ceil(
6410 (2 * pi * (outer_radius + inner_radius) / 2) /
6411 (outer_radius - inner_radius))) :
6413 const unsigned int N_z =
6414 (n_axial_cells == 0 ?
6415 static_cast<unsigned int>(std::ceil(
6416 length / (2 * pi * (outer_radius + inner_radius) / 2 / N_r))) :
6425 std::vector<Point<2>> vertices_2d(2 * N_r);
6426 for (
unsigned int i = 0; i < N_r; ++i)
6431 vertices_2d[i + N_r] = vertices_2d[i] * (inner_radius / outer_radius);
6434 std::vector<Point<3>> vertices_3d;
6435 vertices_3d.reserve(2 * N_r * (N_z + 1));
6436 for (
unsigned int j = 0; j <= N_z; ++j)
6437 for (
unsigned int i = 0; i < 2 * N_r; ++i)
6439 const Point<3> v(vertices_2d[i][0],
6442 vertices_3d.push_back(v);
6445 std::vector<CellData<3>> cells(N_r * N_z,
CellData<3>());
6447 for (
unsigned int j = 0; j < N_z; ++j)
6448 for (
unsigned int i = 0; i < N_r; ++i)
6450 cells[i + j * N_r].vertices[0] = i + (j + 1) * 2 * N_r;
6451 cells[i + j * N_r].vertices[1] = (i + 1) % N_r + (j + 1) * 2 * N_r;
6452 cells[i + j * N_r].vertices[2] = i + j * 2 * N_r;
6453 cells[i + j * N_r].vertices[3] = (i + 1) % N_r + j * 2 * N_r;
6455 cells[i + j * N_r].vertices[4] = N_r + i + (j + 1) * 2 * N_r;
6456 cells[i + j * N_r].vertices[5] =
6457 N_r + ((i + 1) % N_r) + (j + 1) * 2 * N_r;
6458 cells[i + j * N_r].vertices[6] = N_r + i + j * 2 * N_r;
6459 cells[i + j * N_r].vertices[7] = N_r + ((i + 1) % N_r) + j * 2 * N_r;
6461 cells[i + j * N_r].material_id = 0;
6471 template <
int dim,
int spacedim>
6476 const double duplicated_vertex_tolerance,
6477 const bool copy_manifold_ids,
6478 const bool copy_boundary_ids)
6480 std::vector<Point<spacedim>>
vertices;
6481 std::vector<CellData<dim>> cells;
6484 unsigned int n_accumulated_vertices = 0;
6488 ExcMessage(
"The input triangulations must be non-empty "
6489 "and must not be refined."));
6491 std::vector<Point<spacedim>> tria_vertices;
6492 std::vector<CellData<dim>> tria_cells;
6494 std::tie(tria_vertices, tria_cells, tria_subcell_data) =
6498 tria_vertices.begin(),
6499 tria_vertices.end());
6502 for (
unsigned int &vertex_n : cell_data.
vertices)
6503 vertex_n += n_accumulated_vertices;
6504 cells.push_back(cell_data);
6508 if (copy_manifold_ids)
6510 for (
CellData<1> &line_data : tria_subcell_data.boundary_lines)
6514 for (
unsigned int &vertex_n : line_data.
vertices)
6515 vertex_n += n_accumulated_vertices;
6516 line_data.boundary_id =
6521 for (
CellData<2> &quad_data : tria_subcell_data.boundary_quads)
6525 for (
unsigned int &vertex_n : quad_data.
vertices)
6526 vertex_n += n_accumulated_vertices;
6527 quad_data.boundary_id =
6537 std::vector<unsigned int> considered_vertices;
6541 considered_vertices,
6542 duplicated_vertex_tolerance);
6546 if (std::all_of(cells.begin(), cells.end(), [](
const auto &cell) {
6547 return cell.vertices.size() ==
6548 ReferenceCells::get_hypercube<dim>().n_vertices();
6554 if (copy_boundary_ids)
6556 auto result_cell = result.
begin();
6557 for (
const auto &
tria : triangulations)
6559 for (
const auto &cell :
tria->cell_iterators())
6561 for (
auto const &f : cell->face_indices())
6562 if (result_cell->face(f)->at_boundary())
6563 result_cell->face(f)->set_boundary_id(
6570 Assert(duplicated_vertex_tolerance > 0.0 ||
6571 n_accumulated_vertices == result.
n_vertices(),
6577 template <
int dim,
int spacedim>
6582 const double duplicated_vertex_tolerance,
6583 const bool copy_manifold_ids,
6584 const bool copy_boundary_ids)
6587 if (triangulation_1.
n_cells() == 0)
6592 if (triangulation_2.
n_cells() == 0)
6599 duplicated_vertex_tolerance,
6629 template <
int structdim>
6633 static_assert(structdim == 1 || structdim == 2,
6634 "This function is only implemented for lines and "
6642 std::sort(std::begin(cell_data.vertices),
6643 std::end(cell_data.vertices));
6644 else if (structdim == 2)
6647 std::array<unsigned int, 4> renumbering{};
6648 std::copy(std::begin(cell_data.vertices),
6649 std::end(cell_data.vertices),
6650 renumbering.begin());
6661 std::swap(renumbering[2], renumbering[3]);
6662 std::rotate(renumbering.begin(),
6663 std::min_element(renumbering.begin(),
6667 std::swap(renumbering[2], renumbering[3]);
6675 if (renumbering[1] > renumbering[2])
6676 std::swap(renumbering[1], renumbering[2]);
6677 std::copy(renumbering.begin(),
6679 std::begin(cell_data.vertices));
6686 return std::lexicographical_compare(std::begin(a.
vertices),
6688 std::begin(
b.vertices),
6689 std::end(
b.vertices));
6691 std::sort(subcell_data.begin(), subcell_data.end(), compare);
6696 auto left = subcell_data.begin();
6697 while (left != subcell_data.end())
6700 std::upper_bound(left, subcell_data.end(), *left, compare);
6703 if (left + 1 != right)
6704 for (
auto it = left; it != right; ++it)
6707 Assert(it->manifold_id == left->manifold_id,
6709 "In the process of grid generation a single "
6710 "line or quadrilateral has been assigned two "
6711 "different manifold ids. This can happen when "
6712 "a Triangulation is copied, e.g., via "
6713 "GridGenerator::replicate_triangulation() and "
6714 "not all external boundary faces have the same "
6715 "manifold id. Double check that all faces "
6716 "which you expect to be merged together have "
6717 "the same manifold id."));
6722 subcell_data.erase(std::unique(subcell_data.begin(), subcell_data.end()),
6723 subcell_data.end());
6729 template <
int dim,
int spacedim>
6732 const std::vector<unsigned int> & extents,
6737 for (
const auto &extent : extents)
6739 ExcMessage(
"The Triangulation must be copied at least one time in "
6740 "each coordinate dimension."));
6743 const auto &
min = bbox.get_boundary_points().first;
6744 const auto &
max = bbox.get_boundary_points().second;
6746 std::array<Tensor<1, spacedim>, dim> offsets;
6747 for (
unsigned int d = 0;
d < dim; ++
d)
6748 offsets[d][d] = max[d] - min[d];
6752 for (
unsigned int d = 0;
d < dim; ++
d)
6754 std::vector<Point<spacedim>> input_vertices;
6755 std::vector<CellData<dim>> input_cell_data;
6757 std::tie(input_vertices, input_cell_data, input_subcell_data) =
6759 std::vector<Point<spacedim>> output_vertices = input_vertices;
6760 std::vector<CellData<dim>> output_cell_data = input_cell_data;
6761 SubCellData output_subcell_data = input_subcell_data;
6763 for (
unsigned int k = 1; k < extents[
d]; ++k)
6765 const std::size_t vertex_offset = k * input_vertices.size();
6768 output_vertices.push_back(
point + double(k) * offsets[
d]);
6772 output_cell_data.push_back(cell_data);
6773 for (
unsigned int &vertex : output_cell_data.back().
vertices)
6774 vertex += vertex_offset;
6778 input_subcell_data.boundary_lines)
6781 for (
unsigned int &vertex :
6782 output_subcell_data.boundary_lines.back().
vertices)
6783 vertex += vertex_offset;
6786 input_subcell_data.boundary_quads)
6789 for (
unsigned int &vertex :
6790 output_subcell_data.boundary_quads.back().
vertices)
6791 vertex += vertex_offset;
6796 std::vector<unsigned int> boundary_vertices;
6800 output_subcell_data,
6815 output_subcell_data.boundary_lines)
6821 tria_to_replicate.
clear();
6824 output_subcell_data);
6832 template <
int dim,
int spacedim>
6840 ExcMessage(
"The two input triangulations are not derived from "
6841 "the same coarse mesh as required."));
6844 &triangulation_1) ==
nullptr) &&
6847 &triangulation_2) ==
nullptr),
6848 ExcMessage(
"The source triangulations for this function must both "
6849 "be available entirely locally, and not be distributed "
6850 "triangulations."));
6867 for (
unsigned int iteration = 0; iteration < triangulation_2.
n_levels();
6873 bool any_cell_flagged =
false;
6874 for (
const auto &result_cell : result.active_cell_iterators())
6875 if (intergrid_map[result_cell]->has_children())
6877 any_cell_flagged =
true;
6878 result_cell->set_refine_flag();
6881 if (any_cell_flagged ==
false)
6890 template <
int dim,
int spacedim>
6904 std::vector<CellData<dim>> cells;
6905 for (
const auto &cell : input_triangulation.active_cell_iterators())
6906 if (cells_to_remove.find(cell) == cells_to_remove.
end())
6908 Assert(
static_cast<unsigned int>(cell->level()) ==
6909 input_triangulation.
n_levels() - 1,
6911 "Your input triangulation appears to have "
6912 "adaptively refined cells. This is not allowed. You can "
6913 "only call this function on a triangulation in which "
6914 "all cells are on the same refinement level."));
6918 this_cell.
vertices[v] = cell->vertex_index(v);
6920 cells.push_back(this_cell);
6926 std::vector<unsigned int> considered_vertices;
6930 considered_vertices);
6942 const unsigned int n_slices,
6943 const double height,
6945 const bool copy_manifold_ids,
6946 const std::vector<types::manifold_id> &manifold_priorities)
6950 "The input triangulation must be a coarse mesh, i.e., it must "
6951 "not have been refined."));
6953 ExcMessage(
"The output triangulation object needs to be empty."));
6955 ExcMessage(
"The given height for extrusion must be positive."));
6958 "The number of slices for extrusion must be at least 2."));
6960 const double delta_h = height / (n_slices - 1);
6961 std::vector<double> slices_z_values;
6962 for (
unsigned int i = 0; i < n_slices; ++i)
6963 slices_z_values.push_back(i * delta_h);
6965 input, slices_z_values, result, copy_manifold_ids, manifold_priorities);
6973 const unsigned int n_slices,
6974 const double height,
6976 const bool copy_manifold_ids,
6977 const std::vector<types::manifold_id> &manifold_priorities)
6983 (void)copy_manifold_ids;
6984 (void)manifold_priorities;
6988 "GridTools::extrude_triangulation() is only available "
6989 "for Triangulation<3, 3> as output triangulation."));
6997 const std::vector<double> & slice_coordinates,
6999 const bool copy_manifold_ids,
7000 const std::vector<types::manifold_id> &manifold_priorities)
7004 "The input triangulation must be a coarse mesh, i.e., it must "
7005 "not have been refined."));
7007 ExcMessage(
"The output triangulation object needs to be empty."));
7008 Assert(slice_coordinates.size() >= 2,
7010 "The number of slices for extrusion must be at least 2."));
7011 Assert(std::is_sorted(slice_coordinates.begin(), slice_coordinates.end()),
7012 ExcMessage(
"Slice z-coordinates should be in ascending order"));
7014 const auto priorities = [&]() -> std::vector<types::manifold_id> {
7018 if (0 < manifold_priorities.size())
7022 std::vector<types::manifold_id> sorted_manifold_priorities =
7023 manifold_priorities;
7024 std::sort(sorted_manifold_priorities.begin(),
7025 sorted_manifold_priorities.end());
7026 Assert(std::unique(sorted_manifold_priorities.begin(),
7027 sorted_manifold_priorities.end()) ==
7028 sorted_manifold_priorities.end(),
7030 "The given vector of manifold ids may not contain any "
7031 "duplicated entries."));
7032 std::vector<types::manifold_id> sorted_manifold_ids =
7034 std::sort(sorted_manifold_ids.begin(), sorted_manifold_ids.end());
7035 if (sorted_manifold_priorities != sorted_manifold_ids)
7037 std::ostringstream message;
7038 message <<
"The given triangulation has manifold ids {";
7042 message << sorted_manifold_ids.back() <<
"}, but \n"
7043 <<
" the given vector of manifold ids is {";
7048 << manifold_priorities.back() <<
"}.\n"
7049 <<
" These vectors should contain the same elements.\n";
7050 const std::string m = message.str();
7054 return manifold_priorities;
7058 std::vector<types::manifold_id> default_priorities =
7060 const auto first_tfi_it = std::partition(
7061 default_priorities.begin(),
7062 default_priorities.end(),
7064 return dynamic_cast<const TransfiniteInterpolationManifold<2, 2> *>(
7065 &input.get_manifold(id)) == nullptr;
7067 std::sort(default_priorities.begin(), first_tfi_it);
7068 std::sort(first_tfi_it, default_priorities.end());
7070 return default_priorities;
7073 const std::size_t n_slices = slice_coordinates.size();
7074 std::vector<Point<3>> points(n_slices * input.
n_vertices());
7075 std::vector<CellData<3>> cells;
7080 for (std::size_t slice_n = 0; slice_n < n_slices; ++slice_n)
7082 for (std::size_t vertex_n = 0; vertex_n < input.
n_vertices();
7086 points[slice_n * input.
n_vertices() + vertex_n] =
7087 Point<3>(vertex[0], vertex[1], slice_coordinates[slice_n]);
7093 for (
const auto &cell : input.active_cell_iterators())
7095 for (std::size_t slice_n = 0; slice_n < n_slices - 1; ++slice_n)
7098 for (
const unsigned int vertex_n :
7102 cell->vertex_index(vertex_n) + slice_n * input.
n_vertices();
7105 cell->vertex_index(vertex_n) +
7110 if (copy_manifold_ids)
7112 cells.push_back(this_cell);
7123 for (
const auto &face : input.active_face_iterators())
7127 if (face->at_boundary())
7129 if (copy_manifold_ids)
7131 for (std::size_t slice_n = 0; slice_n < n_slices - 1; ++slice_n)
7134 face->vertex_index(0) + slice_n * input.
n_vertices();
7136 face->vertex_index(1) + slice_n * input.
n_vertices();
7138 face->vertex_index(0) + (slice_n + 1) * input.
n_vertices();
7140 face->vertex_index(1) + (slice_n + 1) * input.
n_vertices();
7141 quads.push_back(quad);
7147 if (copy_manifold_ids)
7148 for (
const auto &cell : input.active_cell_iterators())
7153 for (std::size_t slice_n = 1; slice_n < n_slices - 1; ++slice_n)
7156 cell->vertex_index(0) + slice_n * input.
n_vertices();
7158 cell->vertex_index(1) + slice_n * input.
n_vertices();
7160 cell->vertex_index(2) + slice_n * input.
n_vertices();
7162 cell->vertex_index(3) + slice_n * input.
n_vertices();
7163 quads.push_back(quad);
7174 "The input triangulation to this function is using boundary "
7175 "indicators in a range that do not allow using "
7176 "max_boundary_id+1 and max_boundary_id+2 as boundary "
7177 "indicators for the bottom and top faces of the "
7178 "extruded triangulation."));
7181 for (
const auto &cell : input.active_cell_iterators())
7185 quad.
vertices[0] = cell->vertex_index(0);
7186 quad.
vertices[1] = cell->vertex_index(1);
7187 quad.
vertices[2] = cell->vertex_index(2);
7188 quad.
vertices[3] = cell->vertex_index(3);
7189 if (copy_manifold_ids)
7191 quads.push_back(quad);
7194 for (
unsigned int &vertex : quad.
vertices)
7195 vertex += (n_slices - 1) * input.n_vertices();
7196 if (copy_manifold_ids)
7198 quads.push_back(quad);
7211 for (
auto manifold_id_it = priorities.rbegin();
7212 manifold_id_it != priorities.rend();
7214 for (
const auto &face : result.active_face_iterators())
7216 for (unsigned
int line_n = 0;
7217 line_n < GeometryInfo<3>::lines_per_face;
7219 face->line(line_n)->set_manifold_id(*manifold_id_it);
7227 const std::vector<double> & slice_coordinates,
7229 const bool copy_manifold_ids,
7230 const std::vector<types::manifold_id> &manifold_priorities)
7233 (void)slice_coordinates;
7235 (void)copy_manifold_ids;
7236 (void)manifold_priorities;
7240 "GridTools::extrude_triangulation() is only available "
7241 "for Triangulation<3, 3> as output triangulation."));
7263 const double inner_radius,
7264 const double outer_radius,
7271 Assert(inner_radius < outer_radius,
7272 ExcMessage(
"outer_radius has to be bigger than inner_radius."));
7281 std::vector<bool> treated_vertices(
triangulation.n_vertices(),
false);
7282 for (; cell != endc; ++cell)
7285 if (cell->face(f)->at_boundary())
7287 for (
unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_face;
7290 unsigned int vv = cell->face(f)->vertex_index(v);
7291 if (treated_vertices[vv] ==
false)
7293 treated_vertices[vv] =
true;
7297 cell->face(f)->vertex(v) =
7301 cell->face(f)->vertex(v) =
7305 cell->face(f)->vertex(v) =
7309 cell->face(f)->vertex(v) =
7319 double eps = 1
e-3 * outer_radius;
7321 for (; cell != endc; ++cell)
7324 if (cell->face(f)->at_boundary())
7326 double dx = cell->face(f)->center()(0) -
center(0);
7327 double dy = cell->face(f)->center()(1) -
center(1);
7331 cell->face(f)->set_boundary_id(0);
7333 cell->face(f)->set_boundary_id(1);
7335 cell->face(f)->set_boundary_id(2);
7337 cell->face(f)->set_boundary_id(3);
7340 cell->face(f)->set_boundary_id(4);
7341 cell->face(f)->set_manifold_id(0);
7346 double d = (cell->face(f)->center() -
center).
norm();
7347 if (d - inner_radius < 0)
7349 cell->face(f)->set_boundary_id(1);
7350 cell->face(f)->set_manifold_id(0);
7353 cell->face(f)->set_boundary_id(0);
7366 const double inner_radius,
7367 const double outer_radius,
7368 const unsigned int n_shells,
7369 const double skewness,
7370 const unsigned int n_cells,
7376 Assert(inner_radius < outer_radius,
7377 ExcMessage(
"outer_radius has to be bigger than inner_radius."));
7381 std::vector<double> radii;
7382 radii.push_back(inner_radius);
7383 for (
unsigned int shell_n = 1; shell_n < n_shells; ++shell_n)
7384 if (skewness == 0.0)
7386 radii.push_back(inner_radius +
7387 (outer_radius - inner_radius) *
7388 (1.0 - (1.0 -
double(shell_n) / n_shells)));
7392 (outer_radius - inner_radius) *
7393 (1.0 - std::tanh(skewness * (1.0 -
double(shell_n) / n_shells)) /
7394 std::tanh(skewness)));
7395 radii.push_back(outer_radius);
7397 double grid_vertex_tolerance = 0.0;
7398 for (
unsigned int shell_n = 0; shell_n < radii.size() - 1; ++shell_n)
7405 n_cells == 0 ? (dim == 2 ? 8 : 12) :
7410 if (grid_vertex_tolerance == 0.0)
7411 grid_vertex_tolerance =
7412 0.5 * internal::minimal_vertex_distance(current_shell);
7419 grid_vertex_tolerance);
7431 constexpr double radial_vertex_tolerance =
7432 100.0 * std::numeric_limits<double>::epsilon();
7433 auto assert_vertex_distance_within_tolerance =
7434 [
center, radial_vertex_tolerance](
7436 const double radius) {
7438 (void)radial_vertex_tolerance;
7441 for (
unsigned int vertex_n = 0;
7442 vertex_n < GeometryInfo<dim>::vertices_per_face;
7446 (
center.
norm() + radius) * radial_vertex_tolerance,
7451 for (
const auto &cell :
triangulation.active_cell_iterators())
7454 auto face = cell->face(face_n);
7455 if (face->at_boundary())
7457 if (((face->vertex(0) -
center).norm() - inner_radius) <
7458 (
center.
norm() + inner_radius) * radial_vertex_tolerance)
7461 assert_vertex_distance_within_tolerance(face, inner_radius);
7462 face->set_all_boundary_ids(0);
7467 assert_vertex_distance_within_tolerance(face, outer_radius);
7468 face->set_all_boundary_ids(1);
7479 const double inner_radius,
7480 const double outer_radius,
7482 const unsigned int Nz,
7487 Assert(inner_radius < outer_radius,
7488 ExcMessage(
"outer_radius has to be bigger than inner_radius."));
7498 std::vector<bool> treated_vertices(
triangulation.n_vertices(),
false);
7499 for (; cell != endc; ++cell)
7502 if (cell->face(f)->at_boundary())
7504 for (
unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_face;
7507 unsigned int vv = cell->face(f)->vertex_index(v);
7508 if (treated_vertices[vv] ==
false)
7510 treated_vertices[vv] =
true;
7511 for (
unsigned int i = 0; i <= Nz; ++i)
7513 double d = i * L / Nz;
7514 switch (vv - i * 16)
7517 cell->face(f)->vertex(v) =
7521 cell->face(f)->vertex(v) =
7525 cell->face(f)->vertex(v) =
7529 cell->face(f)->vertex(v) =
7540 double eps = 1
e-3 * outer_radius;
7542 for (; cell != endc; ++cell)
7545 if (cell->face(f)->at_boundary())
7547 double dx = cell->face(f)->center()(0);
7548 double dy = cell->face(f)->center()(1);
7549 double dz = cell->face(f)->center()(2);
7554 cell->face(f)->set_boundary_id(0);
7557 cell->face(f)->set_boundary_id(1);
7560 cell->face(f)->set_boundary_id(2);
7563 cell->face(f)->set_boundary_id(3);
7566 cell->face(f)->set_boundary_id(4);
7569 cell->face(f)->set_boundary_id(5);
7573 cell->face(f)->set_all_boundary_ids(6);
7574 cell->face(f)->set_all_manifold_ids(0);
7581 double d = c.
norm();
7582 if (d - inner_radius < 0)
7584 cell->face(f)->set_all_boundary_ids(1);
7585 cell->face(f)->set_all_manifold_ids(0);
7588 cell->face(f)->set_boundary_id(0);
7597 template <
int dim,
int spacedim1,
int spacedim2>
7604 &in_tria) ==
nullptr),
7606 "This function cannot be used on "
7607 "parallel::distributed::Triangulation objects as inputs."));
7609 ExcMessage(
"This function does not work for meshes that have "
7613 const unsigned int spacedim =
std::min(spacedim1, spacedim2);
7614 const std::vector<Point<spacedim1>> &in_vertices = in_tria.
get_vertices();
7618 std::vector<Point<spacedim2>> v(in_vertices.size());
7619 for (
unsigned int i = 0; i < in_vertices.size(); ++i)
7620 for (
unsigned int d = 0;
d < spacedim; ++
d)
7621 v[i][d] = in_vertices[i][d];
7624 for (
const auto &cell : in_tria.active_cell_iterators())
7626 const unsigned int id = cell->active_cell_index();
7628 cells[id].vertices.resize(cell->n_vertices());
7630 cells[id].
vertices[i] = cell->vertex_index(i);
7631 cells[id].material_id = cell->material_id();
7632 cells[id].manifold_id = cell->manifold_id();
7646 std::vector<bool> user_flags_line;
7649 .clear_user_flags_line();
7653 for (
const auto &face : in_tria.active_face_iterators())
7655 if (face->at_boundary())
7659 boundary_line.
vertices.resize(face->n_vertices());
7661 boundary_line.
vertices[i] = face->vertex_index(i);
7666 std::move(boundary_line));
7679 if ((face->user_flag_set() ==
false) &&
7684 boundary_line.
vertices.resize(face->n_vertices());
7686 boundary_line.
vertices[i] = face->vertex_index(i);
7692 std::move(boundary_line));
7694 face->set_user_flag();
7700 .load_user_flags_line(user_flags_line);
7707 std::vector<bool> user_flags_line;
7710 .clear_user_flags_line();
7712 std::vector<bool> user_flags_quad;
7715 .clear_user_flags_quad();
7719 for (
const auto &face : in_tria.active_face_iterators())
7721 if (face->at_boundary())
7725 boundary_face.
vertices.resize(face->n_vertices());
7727 boundary_face.
vertices[i] = face->vertex_index(i);
7732 std::move(boundary_face));
7739 for (
unsigned int e = 0;
e < face->n_lines(); ++
e)
7740 if (face->line(e)->user_flag_set() ==
false)
7743 spacedim1>::line_iterator
7744 edge = face->line(e);
7747 boundary_edge.
vertices.resize(edge->n_vertices());
7749 boundary_edge.
vertices[i] = edge->vertex_index(i);
7754 std::move(boundary_edge));
7756 edge->set_user_flag();
7774 if (face->user_flag_set() ==
false)
7780 boundary_face.
vertices.resize(face->n_vertices());
7782 boundary_face.
vertices[i] = face->vertex_index(i);
7788 std::move(boundary_face));
7790 face->set_user_flag();
7798 for (
unsigned int e = 0;
e < face->n_lines(); ++
e)
7799 if (face->line(e)->at_boundary() ==
false)
7800 if (face->line(e)->user_flag_set() ==
false)
7803 line_iterator edge = face->line(e);
7808 boundary_edge.
vertices[i] = edge->vertex_index(i);
7814 std::move(boundary_edge));
7816 edge->set_user_flag();
7823 .load_user_flags_line(user_flags_line);
7825 .load_user_flags_quad(user_flags_quad);
7838 template <
int dim,
int spacedim>
7878 {{{0, 1, 12, 10}}, {{2, 3, 11, 12}}, {{7, 6, 11, 13}},
7879 {{5, 4, 13, 10}}, {{0, 2, 8, 12}}, {{4, 6, 13, 8}},
7880 {{5, 13, 7, 9}}, {{1, 9, 3, 12}}, {{0, 8, 4, 10}},
7881 {{1, 5, 9, 10}}, {{3, 7, 11, 9}}, {{2, 6, 8, 11}},
7882 {{12, 13, 10, 9}}, {{12, 13, 9, 11}}, {{12, 13, 11, 8}},
7883 {{12, 13, 8, 10}}, {{13, 8, 10, 4}}, {{13, 10, 9, 5}},
7884 {{13, 9, 11, 7}}, {{13, 11, 8, 6}}, {{10, 12, 9, 1}},
7885 {{9, 12, 11, 3}}, {{11, 12, 8, 2}}, {{8, 12, 10, 0}}}};
7893 vertex_ids_for_boundary_faces_2d = {{{{{{0, 4}}, {{4, 2}}}},
7894 {{{{1, 5}}, {{5, 3}}}},
7895 {{{{0, 6}}, {{6, 1}}}},
7896 {{{{2, 7}}, {{7, 3}}}}}};
7904 vertex_ids_for_boundary_faces_3d = {
7905 {{{{{0, 4, 8}}, {{4, 8, 6}}, {{8, 6, 2}}, {{0, 2, 8}}}},
7906 {{{{1, 3, 9}}, {{3, 9, 7}}, {{9, 7, 5}}, {{1, 9, 5}}}},
7907 {{{{0, 1, 10}}, {{1, 10, 5}}, {{10, 5, 4}}, {{0, 10, 4}}}},
7908 {{{{2, 3, 11}}, {{3, 11, 7}}, {{11, 7, 6}}, {{2, 11, 6}}}},
7909 {{{{0, 1, 12}}, {{1, 12, 3}}, {{12, 3, 2}}, {{0, 12, 2}}}},
7910 {{{{4, 5, 13}}, {{5, 13, 7}}, {{13, 7, 6}}, {{4, 13, 6}}}}}};
7931 {{{0, 12, 10}}, {{12, 1, 10}}, {{12, 1, 9}}, {{12, 3, 9}},
7932 {{12, 2, 11}}, {{12, 3, 11}}, {{12, 0, 8}}, {{12, 2, 8}},
7933 {{9, 13, 5}}, {{13, 7, 9}}, {{11, 7, 13}}, {{11, 6, 13}},
7934 {{4, 8, 13}}, {{6, 8, 13}}, {{4, 13, 10}}, {{13, 5, 10}},
7935 {{10, 9, 5}}, {{10, 9, 1}}, {{11, 9, 7}}, {{11, 9, 3}},
7936 {{8, 11, 2}}, {{8, 11, 6}}, {{8, 10, 0}}, {{8, 10, 4}},
7937 {{12, 3, 9}}, {{12, 9, 11}}, {{12, 3, 11}}, {{3, 9, 11}},
7938 {{2, 12, 8}}, {{2, 12, 11}}, {{2, 11, 8}}, {{8, 12, 11}},
7939 {{0, 12, 10}}, {{0, 12, 8}}, {{0, 8, 10}}, {{8, 10, 12}},
7940 {{12, 1, 10}}, {{12, 1, 9}}, {{1, 10, 9}}, {{10, 9, 12}},
7941 {{10, 8, 4}}, {{10, 8, 13}}, {{4, 13, 8}}, {{4, 13, 10}},
7942 {{10, 9, 13}}, {{10, 9, 5}}, {{13, 5, 10}}, {{13, 5, 9}},
7943 {{13, 7, 9}}, {{13, 7, 11}}, {{9, 11, 13}}, {{9, 11, 7}},
7944 {{8, 11, 13}}, {{8, 11, 6}}, {{6, 13, 8}}, {{6, 13, 11}},
7945 {{12, 13, 10}}, {{12, 13, 8}}, {{8, 10, 13}}, {{8, 10, 12}},
7946 {{12, 13, 10}}, {{12, 13, 9}}, {{10, 9, 13}}, {{10, 9, 12}},
7947 {{12, 13, 9}}, {{12, 13, 11}}, {{9, 11, 13}}, {{9, 11, 12}},
7948 {{12, 13, 11}}, {{12, 13, 8}}, {{8, 11, 13}}, {{8, 11, 12}}}};
7955 {{{12, 10}}, {{12, 9}}, {{12, 11}}, {{12, 8}}, {{9, 13}}, {{11, 13}},
7956 {{8, 13}}, {{10, 13}}, {{10, 9}}, {{9, 11}}, {{11, 8}}, {{8, 10}},
7957 {{12, 9}}, {{12, 11}}, {{11, 9}}, {{12, 8}}, {{12, 11}}, {{11, 8}},
7958 {{12, 8}}, {{12, 10}}, {{10, 8}}, {{12, 10}}, {{12, 9}}, {{9, 10}},
7959 {{13, 10}}, {{13, 8}}, {{8, 10}}, {{13, 10}}, {{13, 9}}, {{9, 10}},
7960 {{13, 11}}, {{13, 9}}, {{11, 9}}, {{13, 11}}, {{13, 8}}, {{11, 8}},
7961 {{12, 13}}, {{8, 10}}, {{8, 13}}, {{10, 13}}, {{8, 12}}, {{10, 12}},
7962 {{12, 13}}, {{10, 9}}, {{10, 13}}, {{9, 13}}, {{10, 12}}, {{9, 12}},
7963 {{12, 13}}, {{9, 11}}, {{9, 13}}, {{11, 13}}, {{9, 12}}, {{11, 12}},
7964 {{12, 13}}, {{11, 8}}, {{11, 13}}, {{8, 13}}, {{11, 12}}, {{8, 12}}}};
7977 vertex_ids_for_new_boundary_edges_3d = {
7978 {{{{{4, 8}}, {{6, 8}}, {{0, 8}}, {{2, 8}}}},
7979 {{{{5, 9}}, {{7, 9}}, {{1, 9}}, {{3, 9}}}},
7980 {{{{4, 10}}, {{5, 10}}, {{0, 10}}, {{1, 10}}}},
7981 {{{{6, 11}}, {{7, 11}}, {{2, 11}}, {{3, 11}}}},
7982 {{{{2, 12}}, {{3, 12}}, {{0, 12}}, {{1, 12}}}},
7983 {{{{6, 13}}, {{7, 13}}, {{4, 13}}, {{5, 13}}}}}};
7985 std::vector<Point<spacedim>>
vertices;
7986 std::vector<CellData<dim>> cells;
7991 std::vector<unsigned int> old_to_new_vertex_indices(
7993 std::vector<unsigned int> face_to_new_vertex_indices(
8003 for (
const auto &cell : ref_tria)
8007 std::array<unsigned int, dim == 2 ? 9 : 14> local_vertex_indices;
8012 const auto v_global = cell.vertex_index(v);
8014 if (old_to_new_vertex_indices[v_global] ==
8017 old_to_new_vertex_indices[v_global] =
vertices.size();
8018 vertices.push_back(cell.vertex(v));
8022 local_vertex_indices[v] = old_to_new_vertex_indices[v_global];
8026 for (
const auto f : cell.face_indices())
8028 const auto f_global = cell.face_index(f);
8030 if (face_to_new_vertex_indices[f_global] ==
8033 face_to_new_vertex_indices[f_global] =
vertices.size();
8035 cell.face(f)->center(
true));
8039 local_vertex_indices.size());
8040 local_vertex_indices[cell.n_vertices() + f] =
8041 face_to_new_vertex_indices[f_global];
8048 local_vertex_indices.size());
8049 local_vertex_indices[cell.n_vertices() + cell.n_faces()] =
8051 vertices.push_back(cell.center(
true));
8055 const auto add_cell = [&](
const unsigned int struct_dim,
8056 const auto & index_vertices,
8057 const unsigned int material_or_boundary_id,
8061 if (struct_dim < dim &&
8066 if (struct_dim == dim)
8078 for (
unsigned int i = 0; i < index_vertices.size(); ++i)
8081 local_vertex_indices.size());
8082 cell_data.vertices[i] =
8083 local_vertex_indices[index_vertices[i]];
8084 cell_data.material_id =
8085 material_or_boundary_id;
8086 cell_data.manifold_id =
8089 cells.push_back(cell_data);
8091 else if (dim == 2 && struct_dim == 1)
8095 boundary_line.
boundary_id = material_or_boundary_id;
8097 for (
unsigned int i = 0; i < index_vertices.size(); ++i)
8100 local_vertex_indices.size());
8102 local_vertex_indices[index_vertices[i]];
8106 else if (dim == 3 && struct_dim == 2)
8110 boundary_quad.material_id = material_or_boundary_id;
8112 for (
unsigned int i = 0; i < index_vertices.size(); ++i)
8115 local_vertex_indices.size());
8116 boundary_quad.vertices[i] =
8117 local_vertex_indices[index_vertices[i]];
8121 else if (dim == 3 && struct_dim == 1)
8125 boundary_line.
boundary_id = material_or_boundary_id;
8127 for (
unsigned int i = 0; i < index_vertices.size(); ++i)
8130 local_vertex_indices.size());
8132 local_vertex_indices[index_vertices[i]];
8142 const auto material_id_cell = cell.material_id();
8148 const auto manifold_id_cell = cell.manifold_id();
8150 for (
const auto &cell_vertices : table_2D_cell)
8151 add_cell(dim, cell_vertices, material_id_cell, manifold_id_cell);
8154 for (
const auto &face_vertices : vertex_ids_for_inner_faces_2d)
8166 const auto manifold_id_cell = cell.manifold_id();
8168 for (
const auto &cell_vertices : vertex_ids_for_cells_3d)
8169 add_cell(dim, cell_vertices, material_id_cell, manifold_id_cell);
8173 for (
const auto &face_vertices : vertex_ids_for_inner_faces_3d)
8181 for (
const auto &edge_vertices : vertex_ids_for_inner_edges_3d)
8191 for (
const auto f : cell.face_indices())
8193 const auto bid = cell.face(f)->boundary_id();
8194 const auto mid = cell.face(f)->manifold_id();
8199 for (
const auto &face_vertices :
8200 vertex_ids_for_boundary_faces_2d[f])
8201 add_cell(1, face_vertices, bid, mid);
8207 for (
const auto &face_vertices :
8208 vertex_ids_for_boundary_faces_3d[f])
8209 add_cell(2, face_vertices, bid, mid);
8212 for (
const auto &edge_vertices :
8213 vertex_ids_for_new_boundary_edges_3d[f])
8214 add_cell(1, edge_vertices, bid, mid);
8224 for (
const auto e : cell.line_indices())
8226 auto edge = cell.line(e);
8232 old_to_new_vertex_indices[edge->vertex_index(0)];
8234 old_to_new_vertex_indices[edge->vertex_index(1)];
8248 template <
int spacedim>
8259 template <
template <
int,
int>
class MeshType,
int dim,
int spacedim>
8263 std::map<
typename MeshType<dim - 1, spacedim>::cell_iterator,
8264 typename MeshType<dim, spacedim>::face_iterator>
8266 typename ExtractBoundaryMesh<MeshType, dim, spacedim>::return_type
8269 MeshType<dim - 1, spacedim> & surface_mesh,
8270 const std::set<types::boundary_id> &boundary_ids)
8274 &volume_mesh.get_triangulation()) ==
nullptr),
8283 const unsigned int boundary_dim = dim - 1;
8290 std::pair<typename MeshType<dim, spacedim>::face_iterator,
unsigned int>>
8291 temporary_mapping_level0;
8296 std::vector<bool> touched(volume_mesh.get_triangulation().n_vertices(),
8300 std::vector<CellData<boundary_dim>> cells;
8302 std::vector<Point<spacedim>>
vertices;
8305 std::map<unsigned int, unsigned int> map_vert_index;
8318 for (
unsigned int i1 = 0; i1 < GeometryInfo<spacedim>::faces_per_cell; ++i1)
8320 for (
unsigned int i2 = 0; i2 <
GeometryInfo<dim - 1>::vertices_per_cell;
8322 swap_matrix[i1][i2] = i2;
8328 std::swap(swap_matrix[0][1], swap_matrix[0][2]);
8329 std::swap(swap_matrix[2][1], swap_matrix[2][2]);
8330 std::swap(swap_matrix[4][1], swap_matrix[4][2]);
8334 std::swap(swap_matrix[1][0], swap_matrix[1][1]);
8335 std::swap(swap_matrix[2][0], swap_matrix[2][1]);
8340 for (
typename MeshType<dim, spacedim>::cell_iterator cell =
8341 volume_mesh.begin(0);
8342 cell != volume_mesh.end(0);
8344 for (
const unsigned int i :
GeometryInfo<dim>::face_indices())
8346 const typename MeshType<dim, spacedim>::face_iterator face =
8349 if (face->at_boundary() &&
8350 (boundary_ids.empty() ||
8351 (boundary_ids.find(face->boundary_id()) != boundary_ids.end())))
8355 for (
const unsigned int j :
8358 const unsigned int v_index = face->vertex_index(j);
8360 if (!touched[v_index])
8362 vertices.push_back(face->vertex(j));
8363 map_vert_index[v_index] =
vertices.size() - 1;
8364 touched[v_index] =
true;
8367 c_data.
vertices[swap_matrix[i][j]] = map_vert_index[v_index];
8381 for (
unsigned int e = 0;
e < 4; ++
e)
8387 bool edge_found =
false;
8388 for (
auto &boundary_line : subcell_data.boundary_lines)
8390 map_vert_index[face->line(
e)->vertex_index(0)]) &&
8392 map_vert_index[face->line(
e)->vertex_index(
8395 map_vert_index[face->line(
e)->vertex_index(1)]) &&
8397 map_vert_index[face->line(
e)->vertex_index(0)])))
8404 if (edge_found ==
true)
8411 map_vert_index[face->line(e)->vertex_index(0)];
8413 map_vert_index[face->line(e)->vertex_index(1)];
8420 cells.push_back(c_data);
8421 temporary_mapping_level0.push_back(std::make_pair(face, i));
8428 surface_mesh.get_triangulation())
8434 for (
const auto &cell : surface_mesh.active_cell_iterators())
8435 for (unsigned
int vertex = 0; vertex < 2; ++vertex)
8436 if (cell->face(vertex)->at_boundary())
8437 cell->face(vertex)->set_boundary_id(0);
8445 std::vector<std::pair<
8446 const typename MeshType<dim - 1, spacedim>::cell_iterator,
8447 std::pair<typename MeshType<dim, spacedim>::face_iterator,
unsigned int>>>
8448 temporary_map_boundary_cell_face;
8449 for (
const auto &cell : surface_mesh.active_cell_iterators())
8450 temporary_map_boundary_cell_face.push_back(
8451 std::make_pair(cell, temporary_mapping_level0.at(cell->
index())));
8463 unsigned int index_cells_deepest_level = 0;
8466 bool changed =
false;
8470 std::vector<unsigned int> cells_refined;
8473 for (
unsigned int cell_n = index_cells_deepest_level;
8474 cell_n < temporary_map_boundary_cell_face.size();
8479 if (temporary_map_boundary_cell_face[cell_n]
8480 .
second.first->has_children())
8484 Assert(temporary_map_boundary_cell_face[cell_n]
8485 .
second.first->refinement_case() ==
8488 temporary_map_boundary_cell_face[cell_n]
8489 .first->set_refine_flag();
8490 cells_refined.push_back(cell_n);
8501 surface_mesh.get_triangulation())
8502 .execute_coarsening_and_refinement();
8505 index_cells_deepest_level = temporary_map_boundary_cell_face.size();
8506 for (
const auto &refined_cell_n : cells_refined)
8508 const typename MeshType<dim - 1, spacedim>::cell_iterator
8510 temporary_map_boundary_cell_face[refined_cell_n].first;
8511 const typename MeshType<dim,
8512 spacedim>::face_iterator refined_face =
8513 temporary_map_boundary_cell_face[refined_cell_n].second.first;
8514 const unsigned int refined_face_number =
8515 temporary_map_boundary_cell_face[refined_cell_n]
8517 for (
unsigned int child_n = 0;
8518 child_n < refined_cell->n_children();
8523 temporary_map_boundary_cell_face.push_back(
8524 std::make_pair(refined_cell->child(
8525 swap_matrix[refined_face_number][child_n]),
8526 std::make_pair(refined_face->child(child_n),
8527 refined_face_number)));
8537 std::map<
typename MeshType<dim - 1, spacedim>::cell_iterator,
8538 typename MeshType<dim, spacedim>::face_iterator>
8539 surface_to_volume_mapping;
8540 for (
unsigned int i = 0; i < temporary_map_boundary_cell_face.size(); ++i)
8541 surface_to_volume_mapping[temporary_map_boundary_cell_face[i].
first] =
8542 temporary_map_boundary_cell_face[i].
second.first;
8544 return surface_to_volume_mapping;
8549 template <
int dim,
int spacedim>
8553 const std::vector<unsigned int> &repetitions,
8562 std::vector<Point<spacedim>>
vertices;
8563 std::vector<CellData<dim>> cells;
8569 (p2[1] - p1[1]) / repetitions[1]);
8572 for (
unsigned int j = 0; j <= repetitions[1]; ++j)
8573 for (
unsigned int i = 0; i <= repetitions[0]; ++i)
8578 for (
unsigned int j = 0; j < repetitions[1]; ++j)
8579 for (
unsigned int i = 0; i < repetitions[0]; ++i)
8582 std::array<unsigned int, 4> quad{{
8583 (j + 0) * (repetitions[0] + 1) + i + 0,
8584 (j + 0) * (repetitions[0] + 1) + i + 1,
8585 (j + 1) * (repetitions[0] + 1) + i + 0,
8586 (j + 1) * (repetitions[0] + 1) + i + 1
8592 tri.
vertices = {quad[0], quad[1], quad[2]};
8593 cells.push_back(tri);
8599 tri.
vertices = {quad[3], quad[2], quad[1]};
8600 cells.push_back(tri);
8608 (p2[1] - p1[1]) / repetitions[1],
8609 (p2[2] - p1[2]) / repetitions[2]);
8612 for (
unsigned int k = 0; k <= repetitions[2]; ++k)
8613 for (
unsigned int j = 0; j <= repetitions[1]; ++j)
8614 for (
unsigned int i = 0; i <= repetitions[0]; ++i)
8617 p1[2] + dx[2] * k));
8620 for (
unsigned int k = 0; k < repetitions[2]; ++k)
8621 for (
unsigned int j = 0; j < repetitions[1]; ++j)
8622 for (
unsigned int i = 0; i < repetitions[0]; ++i)
8625 std::array<unsigned int, 8> quad{
8626 {(k + 0) * (repetitions[0] + 1) * (repetitions[1] + 1) +
8627 (j + 0) * (repetitions[0] + 1) + i + 0,
8628 (k + 0) * (repetitions[0] + 1) * (repetitions[1] + 1) +
8629 (j + 0) * (repetitions[0] + 1) + i + 1,
8630 (k + 0) * (repetitions[0] + 1) * (repetitions[1] + 1) +
8631 (j + 1) * (repetitions[0] + 1) + i + 0,
8632 (k + 0) * (repetitions[0] + 1) * (repetitions[1] + 1) +
8633 (j + 1) * (repetitions[0] + 1) + i + 1,
8634 (k + 1) * (repetitions[0] + 1) * (repetitions[1] + 1) +
8635 (j + 0) * (repetitions[0] + 1) + i + 0,
8636 (k + 1) * (repetitions[0] + 1) * (repetitions[1] + 1) +
8637 (j + 0) * (repetitions[0] + 1) + i + 1,
8638 (k + 1) * (repetitions[0] + 1) * (repetitions[1] + 1) +
8639 (j + 1) * (repetitions[0] + 1) + i + 0,
8640 (k + 1) * (repetitions[0] + 1) * (repetitions[1] + 1) +
8641 (j + 1) * (repetitions[0] + 1) + i + 1}};
8646 if (((i % 2) + (j % 2) + (k % 2)) % 2 == 0)
8647 cell.
vertices = {{quad[0], quad[1], quad[2], quad[4]}};
8649 cell.
vertices = {{quad[0], quad[1], quad[3], quad[5]}};
8651 cells.push_back(cell);
8657 if (((i % 2) + (j % 2) + (k % 2)) % 2 == 0)
8658 cell.
vertices = {{quad[2], quad[1], quad[3], quad[7]}};
8660 cell.
vertices = {{quad[0], quad[3], quad[2], quad[6]}};
8661 cells.push_back(cell);
8667 if (((i % 2) + (j % 2) + (k % 2)) % 2 == 0)
8668 cell.
vertices = {{quad[1], quad[4], quad[5], quad[7]}};
8670 cell.
vertices = {{quad[0], quad[4], quad[5], quad[6]}};
8671 cells.push_back(cell);
8677 if (((i % 2) + (j % 2) + (k % 2)) % 2 == 0)
8678 cell.
vertices = {{quad[2], quad[4], quad[7], quad[6]}};
8680 cell.
vertices = {{quad[3], quad[5], quad[7], quad[6]}};
8681 cells.push_back(cell);
8687 if (((i % 2) + (j % 2) + (k % 2)) % 2 == 0)
8688 cell.
vertices = {{quad[1], quad[2], quad[4], quad[7]}};
8690 cell.
vertices = {{quad[0], quad[3], quad[6], quad[5]}};
8691 cells.push_back(cell);
8706 template <
int dim,
int spacedim>
8709 const unsigned int repetitions,
8717 tria, {{repetitions, repetitions}}, {p1, p1}, {p2, p2},
colorize);
8723 {{repetitions, repetitions, repetitions}},
8736# include "grid_generator.inst"
void make_mapping(const MeshType &source_grid, const MeshType &destination_grid)
void add_parameter(const std::string &entry, ParameterType ¶meter, const std::string &documentation="", const Patterns::PatternBase &pattern= *Patterns::Tools::Convert< ParameterType >::to_pattern(), const bool has_to_be_set=false)
void enter_subsection(const std::string &subsection)
numbers::NumberTraits< Number >::real_type distance(const Point< dim, Number > &p) const
const Point< spacedim > center
numbers::NumberTraits< Number >::real_type norm() const
void initialize(const Triangulation< dim, spacedim > &triangulation)
virtual void add_periodicity(const std::vector< GridTools::PeriodicFacePair< cell_iterator > > &)
virtual types::global_cell_index n_global_active_cells() const
virtual void copy_triangulation(const Triangulation< dim, spacedim > &other_tria)
unsigned int n_faces() const
void save_user_flags_line(std::ostream &out) const
face_iterator end_face() const
cell_iterator begin(const unsigned int level=0) const
virtual void create_triangulation(const std::vector< Point< spacedim > > &vertices, const std::vector< CellData< dim > > &cells, const SubCellData &subcelldata)
unsigned int n_active_cells() const
void refine_global(const unsigned int times=1)
const std::vector< Point< spacedim > > & get_vertices() const
unsigned int n_active_lines() const
unsigned int n_levels() const
cell_iterator end() const
virtual bool has_hanging_nodes() const
vertex_iterator begin_vertex() const
vertex_iterator end_vertex() const
virtual void execute_coarsening_and_refinement()
virtual unsigned int n_global_levels() const
cell_iterator last() const
face_iterator begin_face() const
unsigned int n_cells() const
void save_user_flags_quad(std::ostream &out) const
unsigned int n_vertices() const
active_cell_iterator begin_active(const unsigned int level=0) const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_CXX20_REQUIRES(condition)
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcLowerRange(int arg1, int arg2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcIndexRange(std::size_t arg1, std::size_t arg2, std::size_t arg3)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
void set_all_manifold_ids_on_boundary(const types::manifold_id number)
const Manifold< dim, spacedim > & get_manifold(const types::manifold_id number) const
void copy_boundary_to_manifold_id(Triangulation< dim, spacedim > &tria, const bool reset_boundary_ids=false)
virtual std::vector< types::manifold_id > get_manifold_ids() const
void set_manifold(const types::manifold_id number, const Manifold< dim, spacedim > &manifold_object)
void reset_all_manifolds()
void set_all_manifold_ids(const types::manifold_id number)
const Mapping< dim, spacedim > & get_default_linear_mapping(const Triangulation< dim, spacedim > &triangulation)
CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt K
void create_triangulation(Triangulation< dim, dim > &tria, const AdditionalData &additional_data=AdditionalData())
void subdivided_hyper_cube_with_simplices(Triangulation< dim, spacedim > &tria, const unsigned int repetitions, const double p1=0.0, const double p2=1.0, const bool colorize=false)
void parallelepiped(Triangulation< dim > &tria, const Point< dim >(&corners)[dim], const bool colorize=false)
void hyper_cross(Triangulation< dim, spacedim > &tria, const std::vector< unsigned int > &sizes, const bool colorize_cells=false)
A center cell with stacks of cell protruding from each surface.
void hyper_ball_balanced(Triangulation< dim > &tria, const Point< dim > ¢er=Point< dim >(), const double radius=1.)
void plate_with_a_hole(Triangulation< dim > &tria, const double inner_radius=0.4, const double outer_radius=1., const double pad_bottom=2., const double pad_top=2., const double pad_left=1., const double pad_right=1., const Point< dim > ¢er=Point< dim >(), const types::manifold_id polar_manifold_id=0, const types::manifold_id tfi_manifold_id=1, const double L=1., const unsigned int n_slices=2, const bool colorize=false)
Rectangular plate with an (offset) cylindrical hole.
void enclosed_hyper_cube(Triangulation< dim > &tria, const double left=0., const double right=1., const double thickness=1., const bool colorize=false)
void replicate_triangulation(const Triangulation< dim, spacedim > &input, const std::vector< unsigned int > &extents, Triangulation< dim, spacedim > &result)
Replicate a given triangulation in multiple coordinate axes.
void parallelogram(Triangulation< dim > &tria, const Point< dim >(&corners)[dim], const bool colorize=false)
void general_cell(Triangulation< dim, spacedim > &tria, const std::vector< Point< spacedim > > &vertices, const bool colorize=false)
void subdivided_hyper_cube(Triangulation< dim, spacedim > &tria, const unsigned int repetitions, const double left=0., const double right=1., const bool colorize=false)
void hyper_L(Triangulation< dim > &tria, const double left=-1., const double right=1., const bool colorize=false)
void hyper_cube_slit(Triangulation< dim > &tria, const double left=0., const double right=1., const bool colorize=false)
void hyper_ball(Triangulation< dim > &tria, const Point< dim > ¢er=Point< dim >(), const double radius=1., const bool attach_spherical_manifold_on_boundary_cells=false)
void eccentric_hyper_shell(Triangulation< dim > &triangulation, const Point< dim > &inner_center, const Point< dim > &outer_center, const double inner_radius, const double outer_radius, const unsigned int n_cells)
void hyper_rectangle(Triangulation< dim, spacedim > &tria, const Point< dim > &p1, const Point< dim > &p2, const bool colorize=false)
void cylinder(Triangulation< dim > &tria, const double radius=1., const double half_length=1.)
void moebius(Triangulation< 3, 3 > &tria, const unsigned int n_cells, const unsigned int n_rotations, const double R, const double r)
void extrude_triangulation(const Triangulation< 2, 2 > &input, const unsigned int n_slices, const double height, Triangulation< 3, 3 > &result, const bool copy_manifold_ids=false, const std::vector< types::manifold_id > &manifold_priorities={})
void half_hyper_shell(Triangulation< dim > &tria, const Point< dim > ¢er, const double inner_radius, const double outer_radius, const unsigned int n_cells=0, const bool colorize=false)
void quarter_hyper_ball(Triangulation< dim > &tria, const Point< dim > ¢er=Point< dim >(), const double radius=1.)
void cylinder_shell(Triangulation< dim > &tria, const double length, const double inner_radius, const double outer_radius, const unsigned int n_radial_cells=0, const unsigned int n_axial_cells=0)
void cheese(Triangulation< dim, spacedim > &tria, const std::vector< unsigned int > &holes)
Rectangular domain with rectangular pattern of holes.
void create_union_triangulation(const Triangulation< dim, spacedim > &triangulation_1, const Triangulation< dim, spacedim > &triangulation_2, Triangulation< dim, spacedim > &result)
void subdivided_hyper_rectangle_with_simplices(Triangulation< dim, spacedim > &tria, const std::vector< unsigned int > &repetitions, const Point< dim > &p1, const Point< dim > &p2, const bool colorize=false)
void non_standard_orientation_mesh(Triangulation< 2 > &tria, const unsigned int n_rotate_middle_square)
return_type extract_boundary_mesh(const MeshType< dim, spacedim > &volume_mesh, MeshType< dim - 1, spacedim > &surface_mesh, const std::set< types::boundary_id > &boundary_ids=std::set< types::boundary_id >())
void subdivided_parallelepiped(Triangulation< dim > &tria, const unsigned int n_subdivisions, const Point< dim >(&corners)[dim], const bool colorize=false)
void subdivided_cylinder(Triangulation< dim > &tria, const unsigned int x_subdivisions, const double radius=1., const double half_length=1.)
void channel_with_cylinder(Triangulation< dim > &tria, const double shell_region_width=0.03, const unsigned int n_shells=2, const double skewness=2.0, const bool colorize=false)
void subdivided_hyper_L(Triangulation< dim, spacedim > &tria, const std::vector< unsigned int > &repetitions, const Point< dim > &bottom_left, const Point< dim > &top_right, const std::vector< int > &n_cells_to_remove)
void hyper_sphere(Triangulation< spacedim - 1, spacedim > &tria, const Point< spacedim > ¢er=Point< spacedim >(), const double radius=1.)
void concentric_hyper_shells(Triangulation< dim > &triangulation, const Point< dim > ¢er, const double inner_radius=0.125, const double outer_radius=0.25, const unsigned int n_shells=1, const double skewness=0.1, const unsigned int n_cells_per_shell=0, const bool colorize=false)
void convert_hypercube_to_simplex_mesh(const Triangulation< dim, spacedim > &in_tria, Triangulation< dim, spacedim > &out_tria)
void subdivided_hyper_rectangle(Triangulation< dim, spacedim > &tria, const std::vector< unsigned int > &repetitions, const Point< dim > &p1, const Point< dim > &p2, const bool colorize=false)
void quarter_hyper_shell(Triangulation< dim > &tria, const Point< dim > ¢er, const double inner_radius, const double outer_radius, const unsigned int n_cells=0, const bool colorize=false)
void hyper_cube(Triangulation< dim, spacedim > &tria, const double left=0., const double right=1., const bool colorize=false)
void hyper_shell(Triangulation< dim > &tria, const Point< dim > ¢er, const double inner_radius, const double outer_radius, const unsigned int n_cells=0, bool colorize=false)
void create_triangulation_with_removed_cells(const Triangulation< dim, spacedim > &input_triangulation, const std::set< typename Triangulation< dim, spacedim >::active_cell_iterator > &cells_to_remove, Triangulation< dim, spacedim > &result)
void simplex(Triangulation< dim, dim > &tria, const std::vector< Point< dim > > &vertices)
void hyper_cube_with_cylindrical_hole(Triangulation< dim > &triangulation, const double inner_radius=.25, const double outer_radius=.5, const double L=.5, const unsigned int repetitions=1, const bool colorize=false)
void truncated_cone(Triangulation< dim > &tria, const double radius_0=1.0, const double radius_1=0.5, const double half_length=1.0)
void merge_triangulations(const Triangulation< dim, spacedim > &triangulation_1, const Triangulation< dim, spacedim > &triangulation_2, Triangulation< dim, spacedim > &result, const double duplicated_vertex_tolerance=1.0e-12, const bool copy_manifold_ids=false, const bool copy_boundary_ids=false)
void reference_cell(Triangulation< dim, spacedim > &tria, const ReferenceCell &reference_cell)
void half_hyper_ball(Triangulation< dim > &tria, const Point< dim > ¢er=Point< dim >(), const double radius=1.)
void flatten_triangulation(const Triangulation< dim, spacedim1 > &in_tria, Triangulation< dim, spacedim2 > &out_tria)
double norm(const FEValuesBase< dim > &fe, const ArrayView< const std::vector< Tensor< 1, dim > > > &Du)
Point< spacedim > point(const gp_Pnt &p, const double tolerance=1e-10)
SymmetricTensor< 2, dim, Number > C(const Tensor< 2, dim, Number > &F)
SymmetricTensor< 2, dim, Number > E(const Tensor< 2, dim, Number > &F)
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
SymmetricTensor< 2, dim, Number > epsilon(const Tensor< 2, dim, Number > &Grad_u)
Tensor< 2, dim, Number > F(const Tensor< 2, dim, Number > &Grad_u)
VectorType::value_type * end(VectorType &V)
VectorType::value_type * begin(VectorType &V)
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
long double gamma(const unsigned int n)
unsigned int n_cells(const internal::TriangulationImplementation::NumberCache< 1 > &c)
void copy(const T *begin, const T *end, U *dest)
const types::material_id invalid_material_id
static constexpr double PI_2
const types::boundary_id invalid_boundary_id
static constexpr double PI
const types::boundary_id internal_face_boundary_id
static const unsigned int invalid_unsigned_int
const types::manifold_id flat_manifold_id
::VectorizedArray< Number, width > tan(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > min(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > cos(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > sin(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > pow(const ::VectorizedArray< Number, width > &, const Number p)
::VectorizedArray< Number, width > abs(const ::VectorizedArray< Number, width > &)
typename internal::ndarray::HelperArray< T, Ns... >::type ndarray
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation
std::vector< unsigned int > vertices
types::manifold_id manifold_id
types::material_id material_id
types::boundary_id boundary_id
static unsigned int face_to_cell_vertices(const unsigned int face, const unsigned int vertex, const bool face_orientation=true, const bool face_flip=false, const bool face_rotation=false)
std::vector< CellData< 2 > > boundary_quads
std::vector< CellData< 1 > > boundary_lines
DEAL_II_HOST constexpr Number determinant(const SymmetricTensor< 2, dim, Number > &)
const ::Triangulation< dim, spacedim > & tria