5921 const bool check_for_distorted_cells)
5923 static const int dim = 3;
5925 using raw_line_iterator =
5927 using raw_quad_iterator =
5938 for (
const auto &cell :
triangulation.active_cell_iterators_on_level(
5940 if (cell->refine_flag_set())
5966 unsigned int needed_vertices = 0;
5967 unsigned int needed_lines_single = 0;
5968 unsigned int needed_quads_single = 0;
5969 unsigned int needed_lines_pair = 0;
5970 unsigned int needed_quads_pair = 0;
5973 unsigned int new_cells = 0;
5975 for (
const auto &cell :
5977 if (cell->refine_flag_set())
5980 Assert(cell->refine_flag_set() ==
5986 new_cells += cell->reference_cell().n_isotropic_children();
5991 needed_lines_single += 6;
5992 needed_quads_single += 12;
5994 else if (cell->reference_cell() ==
5997 needed_lines_single += 1;
5998 needed_quads_single += 8;
6009 for (
const auto face : cell->face_indices())
6010 if (cell->face(face)->n_children() == 0)
6011 cell->face(face)->set_user_flag();
6013 Assert(cell->face(face)->n_children() ==
6014 cell->reference_cell()
6015 .face_reference_cell(face)
6016 .n_isotropic_children(),
6019 for (
const auto line : cell->line_indices())
6020 if (cell->line(line)->has_children() ==
false)
6021 cell->line(line)->set_user_flag();
6023 Assert(cell->line(line)->n_children() == 2,
6027 const unsigned int used_cells =
6034 used_cells + new_cells,
6040 used_cells + new_cells,
6055 if (quad->user_flag_set() ==
false)
6060 needed_quads_pair += 4;
6061 needed_lines_pair += 4;
6062 needed_vertices += 1;
6066 needed_quads_pair += 4;
6067 needed_lines_single += 3;
6080 if (line->user_flag_set() ==
false)
6083 needed_lines_pair += 2;
6084 needed_vertices += 1;
6089 needed_lines_single);
6092 needed_quads_single);
6095 needed_quads_single);
6099 needed_vertices += std::count(
triangulation.vertices_used.begin(),
6120 for (
const auto &cell :
triangulation.active_cell_iterators())
6121 if (!cell->refine_flag_set())
6122 for (
unsigned int line_n = 0; line_n < cell->n_lines(); ++line_n)
6123 if (cell->line(line_n)->has_children())
6124 for (
unsigned int c = 0; c < 2; ++c)
6125 Assert(cell->line(line_n)->child(c)->user_flag_set() ==
false,
6129 unsigned int current_vertex = 0;
6133 auto get_next_unused_vertex = [](
const unsigned int current_vertex,
6134 std::vector<bool> &vertices_used) {
6135 unsigned int next_vertex = current_vertex;
6136 while (next_vertex < vertices_used.size() &&
6137 vertices_used[next_vertex] ==
true)
6140 vertices_used[next_vertex] =
true;
6150 raw_line_iterator next_unused_line =
triangulation.begin_raw_line();
6152 for (; line != endl; ++line)
6154 if (line->user_flag_set() ==
false)
6158 triangulation.faces->lines.template next_free_pair_object<1>(
6166 line->set_children(0, next_unused_line->index());
6168 const std::array<raw_line_iterator, 2> children{
6169 {next_unused_line, ++next_unused_line}};
6175 get_next_unused_vertex(current_vertex,
6177 triangulation.vertices[current_vertex] = line->center(
true);
6179 children[0]->set_bounding_object_indices(
6180 {line->vertex_index(0), current_vertex});
6181 children[1]->set_bounding_object_indices(
6182 {current_vertex, line->vertex_index(1)});
6184 const auto manifold_id = line->manifold_id();
6185 const auto boundary_id = line->boundary_id();
6186 for (
const auto &child : children)
6188 child->set_used_flag();
6189 child->clear_children();
6191 child->clear_user_flag();
6192 child->set_boundary_id_internal(boundary_id);
6193 child->set_manifold_id(manifold_id);
6196 line->clear_user_flag();
6206 for (; quad != endq; ++quad)
6208 if (quad->user_flag_set() ==
false)
6211 const auto reference_face_type = quad->reference_cell();
6215 std::array<raw_line_iterator, 4> new_lines;
6218 for (
unsigned int l = 0; l < 2; ++l)
6220 auto next_unused_line =
6223 new_lines[2 * l] = next_unused_line;
6224 new_lines[2 * l + 1] = ++next_unused_line;
6229 for (
unsigned int l = 0; l < 3; ++l)
6240 for (
const unsigned int line : quad->line_indices())
6246 std::array<raw_quad_iterator, 4> new_quads;
6247 for (
unsigned int q = 0; q < 2; ++q)
6249 auto next_unused_quad =
6253 new_quads[2 * q] = next_unused_quad;
6254 new_quads[2 * q + 1] = ++next_unused_quad;
6256 quad->set_children(2 * q, new_quads[2 * q]->
index());
6261 for (
const auto &quad : new_quads)
6271 for (
const auto i : quad->vertex_indices())
6274 for (
const auto i : quad->line_indices())
6280 get_next_unused_vertex(current_vertex,
6285 quad->center(
true,
true);
6289 std::array<raw_line_iterator, 12> lines;
6290 unsigned int n_lines = 0;
6291 for (
unsigned int l = 0; l < quad->
n_lines(); ++l)
6292 for (
unsigned int c = 0; c < 2; ++c)
6294 static constexpr ::ndarray<unsigned int, 2, 2>
index =
6301 quad->line(l)->child(
index[c][quad->line_orientation(l)]);
6304 for (
unsigned int l = 0; l < quad->
n_lines(); ++l)
6305 lines[n_lines++] = new_lines[l];
6307 std::array<int, 12> line_indices;
6308 for (
unsigned int i = 0; i < n_lines; ++i)
6309 line_indices[i] = lines[i]->
index();
6311 static constexpr ::ndarray<unsigned int, 12, 2>
6312 line_vertices_quad{{{{0, 4}},
6325 static constexpr ::ndarray<unsigned int, 4, 4>
6326 quad_lines_quad{{{{0, 8, 4, 10}},
6331 static constexpr ::ndarray<unsigned int, 12, 2>
6332 line_vertices_tri{{{{0, 3}},
6345 static constexpr ::ndarray<unsigned int, 4, 4>
6346 quad_lines_tri{{{{0, 8, 5, X}},
6351 static constexpr ::ndarray<unsigned int, 4, 4, 2>
6352 quad_line_vertices_tri{
6353 {{{{{0, 3}}, {{3, 5}}, {{5, 0}}, {{X, X}}}},
6354 {{{{3, 1}}, {{1, 4}}, {{4, 3}}, {{X, X}}}},
6355 {{{{5, 4}}, {{4, 2}}, {{2, 5}}, {{X, X}}}},
6356 {{{{3, 4}}, {{4, 5}}, {{5, 3}}, {{X, X}}}}}};
6358 const auto &line_vertices =
6360 line_vertices_quad :
6362 const auto &quad_lines =
6367 for (
unsigned int i = 0, j = 2 * quad->
n_lines();
6371 auto &new_line = new_lines[i];
6372 new_line->set_bounding_object_indices(
6375 new_line->set_used_flag();
6376 new_line->clear_user_flag();
6377 new_line->clear_user_data();
6378 new_line->clear_children();
6379 new_line->set_boundary_id_internal(quad->boundary_id());
6380 new_line->set_manifold_id(quad->manifold_id());
6384 for (
unsigned int i = 0; i < new_quads.size(); ++i)
6386 auto &new_quad = new_quads[i];
6391 reference_face_type);
6394 new_quad->set_bounding_object_indices(
6395 {line_indices[quad_lines[i][0]],
6396 line_indices[quad_lines[i][1]],
6397 line_indices[quad_lines[i][2]]});
6399 new_quad->set_bounding_object_indices(
6400 {line_indices[quad_lines[i][0]],
6401 line_indices[quad_lines[i][1]],
6402 line_indices[quad_lines[i][2]],
6403 line_indices[quad_lines[i][3]]});
6407 new_quad->set_used_flag();
6408 new_quad->clear_user_flag();
6409 new_quad->clear_user_data();
6410 new_quad->clear_children();
6411 new_quad->set_boundary_id_internal(quad->boundary_id());
6412 new_quad->set_manifold_id(quad->manifold_id());
6415 std::set<unsigned int> s;
6423 for (
const auto f : new_quad->line_indices())
6425 const std::array<unsigned int, 2> vertices_0 = {
6426 {lines[quad_lines[i][f]]->vertex_index(0),
6427 lines[quad_lines[i][f]]->vertex_index(1)}};
6429 const std::array<unsigned int, 2> vertices_1 = {
6433 const auto orientation =
6439 for (
const auto i : vertices_0)
6441 for (
const auto i : vertices_1)
6445 new_quad->set_line_orientation(
6449 default_combined_face_orientation());
6461 static constexpr ::ndarray<unsigned int, 4, 2>
6462 quad_child_boundary_lines{
6463 {{{0, 2}}, {{1, 3}}, {{0, 1}}, {{2, 3}}}};
6465 for (
unsigned int i = 0; i < 4; ++i)
6466 for (
unsigned int j = 0; j < 2; ++j)
6467 new_quads[quad_child_boundary_lines[i][j]]
6468 ->set_line_orientation(i, quad->line_orientation(i));
6471 quad->clear_user_flag();
6476 cells_with_distorted_children;
6486 hex->level() >=
static_cast<int>(
level),
6490 hex->level() ==
static_cast<int>(
level);
6493 if (hex->refine_flag_set() ==
6497 const auto &reference_cell_type = hex->reference_cell();
6500 hex->clear_refine_flag();
6501 hex->set_refinement_case(ref_case);
6503 unsigned int n_new_lines = 0;
6504 unsigned int n_new_quads = 0;
6505 unsigned int n_new_hexes = 0;
6522 std::array<raw_line_iterator, 6> new_lines;
6523 for (
unsigned int i = 0; i < n_new_lines; ++i)
6530 new_lines[i]->set_used_flag();
6531 new_lines[i]->clear_user_flag();
6532 new_lines[i]->clear_user_data();
6533 new_lines[i]->clear_children();
6534 new_lines[i]->set_boundary_id_internal(
6536 new_lines[i]->set_manifold_id(hex->manifold_id());
6539 std::array<raw_quad_iterator, 12> new_quads;
6540 for (
unsigned int i = 0; i < n_new_quads; ++i)
6546 auto &new_quad = new_quads[i];
6552 reference_cell_type.face_reference_cell(0));
6555 new_quad->set_used_flag();
6556 new_quad->clear_user_flag();
6557 new_quad->clear_user_data();
6558 new_quad->clear_children();
6559 new_quad->set_boundary_id_internal(
6561 new_quad->set_manifold_id(hex->manifold_id());
6562 for (
const auto j : new_quads[i]->line_indices())
6563 new_quad->set_line_orientation(j,
true);
6572 for (
unsigned int i = 0; i < n_new_hexes; ++i)
6581 new_hexes[i] = next_unused_hex;
6583 auto &new_hex = new_hexes[i];
6587 ->reference_cell[new_hex->index()] =
6588 reference_cell_type;
6591 new_hex->set_used_flag();
6592 new_hex->clear_user_flag();
6593 new_hex->clear_user_data();
6594 new_hex->clear_children();
6595 new_hex->set_material_id(hex->material_id());
6596 new_hex->set_manifold_id(hex->manifold_id());
6597 new_hex->set_subdomain_id(hex->subdomain_id());
6600 new_hex->set_parent(hex->index());
6605 for (
const auto f : new_hex->face_indices())
6606 new_hex->set_combined_face_orientation(
6610 for (
unsigned int i = 0; i < n_new_hexes / 2; ++i)
6611 hex->set_children(2 * i, new_hexes[2 * i]->index());
6623 const unsigned int n_vertices =
6625 for (
unsigned int i = 0; i < n_vertices; ++i)
6628 const std::array<unsigned int, 12> line_indices =
6629 TriaAccessorImplementation::Implementation::
6630 get_line_indices_of_cell(*hex);
6642 for (
unsigned int l = 0; l < n_lines; ++l)
6652 for (
const unsigned int i : hex->face_indices())
6654 hex->face(i)->child(0)->vertex_index(3);
6658 get_next_unused_vertex(current_vertex,
6663 hex->center(
true,
true);
6667 unsigned int chosen_line_tetrahedron = 0;
6671 static constexpr ::ndarray<unsigned int, 6, 2>
6672 new_line_vertices = {{{{22, 26}},
6678 for (
unsigned int i = 0; i < n_new_lines; ++i)
6679 new_lines[i]->set_bounding_object_indices(
6689 static constexpr ::ndarray<unsigned int, 3, 2>
6690 new_line_vertices = {{{{6, 8}}, {{5, 7}}, {{4, 9}}}};
6694 std::uint8_t refinement_choice = hex->refine_choice();
6695 if (refinement_choice ==
6700 double min_distance =
6701 std::numeric_limits<double>::infinity();
6702 for (
unsigned int i = 0; i < new_line_vertices.size();
6705 const double current_distance =
6710 [new_line_vertices[i][1]]]);
6711 if (current_distance < min_distance)
6713 chosen_line_tetrahedron = i;
6714 min_distance = current_distance;
6718 else if (refinement_choice ==
6721 chosen_line_tetrahedron = 0;
6722 else if (refinement_choice ==
6725 chosen_line_tetrahedron = 1;
6726 else if (refinement_choice ==
6729 chosen_line_tetrahedron = 2;
6733 hex->set_refinement_case(
6736 new_lines[0]->set_bounding_object_indices(
6738 [new_line_vertices[chosen_line_tetrahedron][0]],
6740 [new_line_vertices[chosen_line_tetrahedron][1]]});
6745 boost::container::small_vector<raw_line_iterator, 30>
6750 relevant_lines.resize(30);
6751 for (
unsigned int f = 0, k = 0; f < 6; ++f)
6752 for (
unsigned int c = 0; c < 4; ++c, ++k)
6755 ndarray<unsigned int, 4, 2>
6757 {{{0, 1}}, {{3, 0}}, {{0, 3}}, {{3, 2}}}};
6763 standard_to_real_face_vertex(
6765 hex->face_orientation(f),
6767 hex->face_rotation(f)))
6769 standard_to_real_face_line(
6771 hex->face_orientation(f),
6773 hex->face_rotation(f)));
6776 for (
unsigned int i = 0, k = 24; i < 6; ++i, ++k)
6777 relevant_lines[k] = new_lines[i];
6792 relevant_lines.resize(13);
6795 for (
unsigned int f = 0; f < 4; ++f)
6796 for (
unsigned int l = 0; l < 3; ++l, ++k)
6800 array<std::array<unsigned int, 3>, 6>
6801 table = {{{{1, 0, 2}},
6808 const unsigned char combined_orientation =
6809 hex->combined_face_orientation(f);
6813 ->line(table[combined_orientation][l]);
6816 relevant_lines[k++] = new_lines[0];
6822 boost::container::small_vector<unsigned int, 30>
6823 relevant_line_indices(relevant_lines.size());
6824 for (
unsigned int i = 0; i < relevant_line_indices.size();
6826 relevant_line_indices[i] = relevant_lines[i]->
index();
6835 const auto &new_quad_lines =
6836 hex->reference_cell().new_isotropic_child_face_lines(
6837 chosen_line_tetrahedron);
6850 hex->reference_cell()
6851 .new_isotropic_child_face_line_vertices(
6852 chosen_line_tetrahedron);
6854 static constexpr ::ndarray<unsigned int, 4, 2>
6855 representative_lines{
6856 {{{0, 2}}, {{2, 0}}, {{3, 3}}, {{1, 1}}}};
6858 for (
unsigned int q = 0; q < n_new_quads; ++q)
6860 auto &new_quad = new_quads[q];
6862 if (new_quad->n_lines() == 3)
6863 new_quad->set_bounding_object_indices(
6864 {relevant_line_indices[new_quad_lines[q][0]],
6865 relevant_line_indices[new_quad_lines[q][1]],
6866 relevant_line_indices[new_quad_lines[q][2]]});
6867 else if (new_quad->n_lines() == 4)
6868 new_quad->set_bounding_object_indices(
6869 {relevant_line_indices[new_quad_lines[q][0]],
6870 relevant_line_indices[new_quad_lines[q][1]],
6871 relevant_line_indices[new_quad_lines[q][2]],
6872 relevant_line_indices[new_quad_lines[q][3]]});
6880 const unsigned int n_compute_lines =
6884 for (
unsigned int line = 0; line < n_compute_lines;
6887 const unsigned int l =
6888 (reference_cell_type ==
6890 representative_lines[q % 4][0] :
6893 const std::array<unsigned int, 2> vertices_0 = {
6894 {relevant_lines[new_quad_lines[q][l]]
6896 relevant_lines[new_quad_lines[q][l]]
6897 ->vertex_index(1)}};
6899 const std::array<unsigned int, 2> vertices_1 = {
6903 const auto orientation =
6908 new_quad->set_line_orientation(
6912 default_combined_face_orientation());
6917 if (reference_cell_type ==
6919 new_quads[representative_lines[q % 4][1] + q -
6921 ->set_line_orientation(
6925 default_combined_face_orientation());
6932 std::array<int, 36> quad_indices;
6936 for (
unsigned int i = 0; i < n_new_quads; ++i)
6937 quad_indices[i] = new_quads[i]->
index();
6939 for (
unsigned int f = 0, k = n_new_quads; f < 6; ++f)
6940 for (
unsigned int c = 0; c < 4; ++c, ++k)
6942 hex->face(f)->isotropic_child_index(
6945 hex->face_orientation(f),
6947 hex->face_rotation(f)));
6957 for (
unsigned int i = 0; i < n_new_quads; ++i)
6958 quad_indices[i] = new_quads[i]->
index();
6960 for (
unsigned int f = 0, k = n_new_quads; f < 4; ++f)
6961 for (
unsigned int c = 0; c < 4; ++c, ++k)
6963 const unsigned char combined_orientation =
6964 hex->combined_face_orientation(f);
6965 quad_indices[k] = hex->face(f)->child_index(
6968 .standard_to_real_face_vertex(
6969 c, f, combined_orientation));
6985 const auto &cell_quads =
6986 hex->reference_cell().new_isotropic_child_cell_faces(
6987 chosen_line_tetrahedron);
6989 for (
unsigned int c = 0;
6990 c < GeometryInfo<dim>::max_children_per_cell;
6993 auto &new_hex = new_hexes[c];
6995 if (new_hex->n_faces() == 4)
6997 new_hex->set_bounding_object_indices(
6998 {quad_indices[cell_quads[c][0]],
6999 quad_indices[cell_quads[c][1]],
7000 quad_indices[cell_quads[c][2]],
7001 quad_indices[cell_quads[c][3]]});
7006 for (
const auto f : new_hex->face_indices())
7008 const auto &face = new_hex->face(f);
7010 Assert(face->n_vertices() == 3,
7013 const std::array<unsigned int, 3> vertices_0 = {
7014 {face->vertex_index(0),
7015 face->vertex_index(1),
7016 face->vertex_index(2)}};
7025 const auto new_hex_vertices =
7026 hex->reference_cell()
7027 .new_isotropic_child_cell_vertices(
7028 chosen_line_tetrahedron)[c];
7032 const std::array<unsigned int, 3> vertices_1 = {
7048 new_hex->set_combined_face_orientation(
7050 face->reference_cell()
7051 .get_combined_orientation(
7056 else if (new_hex->n_faces() == 6)
7057 new_hex->set_bounding_object_indices(
7058 {quad_indices[cell_quads[c][0]],
7059 quad_indices[cell_quads[c][1]],
7060 quad_indices[cell_quads[c][2]],
7061 quad_indices[cell_quads[c][3]],
7062 quad_indices[cell_quads[c][4]],
7063 quad_indices[cell_quads[c][5]]});
7072 static constexpr ::ndarray<unsigned int, 6, 4>
7073 face_to_child_indices_hex{{{{0, 2, 4, 6}},
7080 for (
const auto f : hex->face_indices())
7082 const unsigned char combined_orientation =
7083 hex->combined_face_orientation(f);
7084 for (
unsigned int c = 0; c < 4; ++c)
7085 new_hexes[face_to_child_indices_hex[f][c]]
7086 ->set_combined_face_orientation(
7087 f, combined_orientation);
7092 if (check_for_distorted_cells &&
7093 has_distorted_children<dim, spacedim>(hex))
7102 return cells_with_distorted_children;
7112 const bool check_for_distorted_cells)
7114 const unsigned int dim = 3;
7117 bool flag_isotropic_mesh =
true;
7121 for (; cell != endc; ++cell)
7131 flag_isotropic_mesh =
false;
7135 if (flag_isotropic_mesh)
7137 check_for_distorted_cells);
7148 for (
const auto &cell :
triangulation.active_cell_iterators_on_level(
7150 if (cell->refine_flag_set())
7167 line->clear_user_flag();
7172 quad->clear_user_flag();
7195 unsigned int needed_vertices = 0;
7196 unsigned int needed_lines_single = 0;
7197 unsigned int needed_quads_single = 0;
7198 unsigned int needed_lines_pair = 0;
7199 unsigned int needed_quads_pair = 0;
7204 unsigned int new_cells = 0;
7206 for (
const auto &acell :
7208 if (acell->refine_flag_set())
7218 ++needed_quads_single;
7226 ++needed_lines_single;
7227 needed_quads_single += 4;
7234 needed_lines_single += 6;
7235 needed_quads_single += 12;
7249 for (
const unsigned int face :
7253 aface = acell->face(face);
7260 acell->face_orientation(face),
7261 acell->face_flip(face),
7262 acell->face_rotation(face));
7267 if (face_ref_case ==
7270 if (aface->n_active_descendants() < 4)
7273 aface->set_user_flag();
7275 else if (aface->refinement_case() != face_ref_case)
7286 Assert(aface->refinement_case() ==
7289 aface->refinement_case() ==
7292 aface->set_user_index(face_ref_case);
7298 for (
unsigned int line = 0;
7299 line < GeometryInfo<dim>::lines_per_cell;
7303 !acell->line(line)->has_children())
7304 acell->line(line)->set_user_flag();
7310 const unsigned int used_cells =
7320 used_cells + new_cells,
7334 if (quad->user_flag_set())
7340 needed_quads_pair += 4;
7341 needed_lines_pair += 4;
7342 needed_vertices += 1;
7344 if (quad->user_index())
7348 needed_quads_pair += 2;
7349 needed_lines_single += 1;
7362 if (quad->has_children())
7364 Assert(quad->refinement_case() ==
7367 if ((face_refinement_cases[quad->user_index()] ==
7369 (quad->child(0)->line_index(1) + 1 !=
7370 quad->child(2)->line_index(1))) ||
7371 (face_refinement_cases[quad->user_index()] ==
7373 (quad->child(0)->line_index(3) + 1 !=
7374 quad->child(1)->line_index(3))))
7375 needed_lines_pair += 2;
7384 if (line->user_flag_set())
7386 needed_lines_pair += 2;
7387 needed_vertices += 1;
7393 needed_lines_single);
7397 needed_quads_single);
7400 needed_quads_single);
7404 needed_vertices += std::count(
triangulation.vertices_used.begin(),
7428 for (
const auto &cell :
triangulation.active_cell_iterators())
7429 if (!cell->refine_flag_set())
7430 for (
unsigned int line = 0;
7431 line < GeometryInfo<dim>::lines_per_cell;
7433 if (cell->line(line)->has_children())
7434 for (
unsigned int c = 0; c < 2; ++c)
7435 Assert(cell->line(line)->child(c)->user_flag_set() ==
false,
7447 unsigned int next_unused_vertex = 0;
7458 for (; line != endl; ++line)
7459 if (line->user_flag_set())
7465 while (
triangulation.vertices_used[next_unused_vertex] ==
true)
7466 ++next_unused_vertex;
7470 "Internal error: During refinement, the triangulation wants to access an element of the 'vertices' array but it turns out that the array is not large enough."));
7473 triangulation.vertices[next_unused_vertex] = line->center(
true);
7487 line->set_children(0, next_unused_line->index());
7491 children[2] = {next_unused_line, ++next_unused_line};
7498 children[0]->set_bounding_object_indices(
7499 {line->vertex_index(0), next_unused_vertex});
7500 children[1]->set_bounding_object_indices(
7501 {next_unused_vertex, line->vertex_index(1)});
7503 children[0]->set_used_flag();
7504 children[1]->set_used_flag();
7505 children[0]->clear_children();
7506 children[1]->clear_children();
7509 children[0]->clear_user_flag();
7510 children[1]->clear_user_flag();
7512 children[0]->set_boundary_id_internal(line->boundary_id());
7513 children[1]->set_boundary_id_internal(line->boundary_id());
7515 children[0]->set_manifold_id(line->manifold_id());
7516 children[1]->set_manifold_id(line->manifold_id());
7521 line->clear_user_flag();
7551 for (
unsigned int loop = 0; loop < 2; ++loop)
7564 for (; quad != endq; ++quad)
7566 if (quad->user_index())
7569 face_refinement_cases[quad->user_index()];
7578 if (aniso_quad_ref_case == quad->refinement_case())
7581 Assert(quad->refinement_case() ==
7583 quad->refinement_case() ==
7588 Assert(quad->user_index() ==
7590 quad->user_index() ==
7620 quad->line(2)->child(0)->vertex_index(1);
7622 quad->line(3)->child(0)->vertex_index(1);
7627 quad->line(0)->child(0)->vertex_index(1);
7629 quad->line(1)->child(0)->vertex_index(1);
7632 new_line->set_bounding_object_indices(
7634 new_line->set_used_flag();
7635 new_line->clear_user_flag();
7637 new_line->clear_children();
7638 new_line->set_boundary_id_internal(quad->boundary_id());
7639 new_line->set_manifold_id(quad->manifold_id());
7647 const unsigned int index[2][2] = {
7659 new_quads[0] = next_unused_quad;
7663 new_quads[1] = next_unused_quad;
7668 new_quads[0]->set_bounding_object_indices(
7669 {
static_cast<int>(quad->line_index(0)),
7672 ->child(
index[0][quad->line_orientation(2)])
7675 ->child(
index[0][quad->line_orientation(3)])
7677 new_quads[1]->set_bounding_object_indices(
7679 static_cast<int>(quad->line_index(1)),
7681 ->child(
index[1][quad->line_orientation(2)])
7684 ->child(
index[1][quad->line_orientation(3)])
7689 new_quads[0]->set_bounding_object_indices(
7691 ->child(
index[0][quad->line_orientation(0)])
7694 ->child(
index[0][quad->line_orientation(1)])
7696 static_cast<int>(quad->line_index(2)),
7697 new_line->index()});
7698 new_quads[1]->set_bounding_object_indices(
7700 ->child(
index[1][quad->line_orientation(0)])
7703 ->child(
index[1][quad->line_orientation(1)])
7706 static_cast<int>(quad->line_index(3))});
7709 for (
const auto &new_quad : new_quads)
7711 new_quad->set_used_flag();
7712 new_quad->clear_user_flag();
7714 new_quad->clear_children();
7715 new_quad->set_boundary_id_internal(quad->boundary_id());
7716 new_quad->set_manifold_id(quad->manifold_id());
7720 for (
unsigned int j = 0;
7721 j < GeometryInfo<dim>::lines_per_face;
7723 new_quad->set_line_orientation(j,
true);
7729 new_quads[0]->set_line_orientation(
7730 0, quad->line_orientation(0));
7731 new_quads[0]->set_line_orientation(
7732 2, quad->line_orientation(2));
7733 new_quads[1]->set_line_orientation(
7734 1, quad->line_orientation(1));
7735 new_quads[1]->set_line_orientation(
7736 3, quad->line_orientation(3));
7739 new_quads[0]->set_line_orientation(
7740 3, quad->line_orientation(3));
7741 new_quads[1]->set_line_orientation(
7742 2, quad->line_orientation(2));
7746 new_quads[0]->set_line_orientation(
7747 1, quad->line_orientation(1));
7748 new_quads[1]->set_line_orientation(
7749 0, quad->line_orientation(0));
7755 if (quad->refinement_case() ==
7778 if (aniso_quad_ref_case ==
7781 old_child[0] = quad->child(0)->line(1);
7782 old_child[1] = quad->child(2)->line(1);
7786 Assert(aniso_quad_ref_case ==
7790 old_child[0] = quad->child(0)->line(3);
7791 old_child[1] = quad->child(1)->line(3);
7794 if (old_child[0]->
index() + 1 != old_child[1]->
index())
7800 spacedim>::raw_line_iterator
7803 new_child[0] = new_child[1] =
7805 .template next_free_pair_object<1>(
7809 new_child[0]->set_used_flag();
7810 new_child[1]->set_used_flag();
7812 const int old_index_0 = old_child[0]->index(),
7813 old_index_1 = old_child[1]->index(),
7814 new_index_0 = new_child[0]->index(),
7815 new_index_1 = new_child[1]->index();
7819 for (
unsigned int q = 0;
7822 for (
unsigned int l = 0;
7823 l < GeometryInfo<dim>::lines_per_face;
7826 const int this_index =
7828 .get_bounding_object_indices(q)[l];
7829 if (this_index == old_index_0)
7831 .get_bounding_object_indices(q)[l] =
7833 else if (this_index == old_index_1)
7835 .get_bounding_object_indices(q)[l] =
7840 for (
unsigned int i = 0; i < 2; ++i)
7842 Assert(!old_child[i]->has_children(),
7845 new_child[i]->set_bounding_object_indices(
7846 {old_child[i]->vertex_index(0),
7847 old_child[i]->vertex_index(1)});
7848 new_child[i]->set_boundary_id_internal(
7849 old_child[i]->boundary_id());
7850 new_child[i]->set_manifold_id(
7851 old_child[i]->manifold_id());
7852 new_child[i]->set_user_index(
7853 old_child[i]->user_index());
7854 if (old_child[i]->user_flag_set())
7855 new_child[i]->set_user_flag();
7857 new_child[i]->clear_user_flag();
7859 new_child[i]->clear_children();
7861 old_child[i]->clear_user_flag();
7862 old_child[i]->clear_user_index();
7863 old_child[i]->clear_used_flag();
7869 if (aniso_quad_ref_case ==
7872 new_line->set_children(
7873 0, quad->child(0)->line_index(1));
7874 Assert(new_line->child(1) ==
7875 quad->child(2)->line(1),
7912 quad_iterator switch_1 = quad->child(1),
7913 switch_2 = quad->child(2);
7914 const int switch_1_index = switch_1->index();
7915 const int switch_2_index = switch_2->index();
7916 for (
unsigned int l = 0;
7919 for (
unsigned int h = 0;
7923 for (
const unsigned int q :
7926 const int face_index =
7928 ->cells.get_bounding_object_indices(
7930 if (face_index == switch_1_index)
7932 ->cells.get_bounding_object_indices(
7933 h)[q] = switch_2_index;
7934 else if (face_index == switch_2_index)
7936 ->cells.get_bounding_object_indices(
7937 h)[q] = switch_1_index;
7941 const unsigned int switch_1_lines[4] = {
7942 switch_1->line_index(0),
7943 switch_1->line_index(1),
7944 switch_1->line_index(2),
7945 switch_1->line_index(3)};
7946 const bool switch_1_line_orientations[4] = {
7947 switch_1->line_orientation(0),
7948 switch_1->line_orientation(1),
7949 switch_1->line_orientation(2),
7950 switch_1->line_orientation(3)};
7952 switch_1->boundary_id();
7953 const unsigned int switch_1_user_index =
7954 switch_1->user_index();
7955 const bool switch_1_user_flag =
7956 switch_1->user_flag_set();
7958 switch_1_refinement_case =
7959 switch_1->refinement_case();
7960 const int switch_1_first_child_pair =
7961 (switch_1_refinement_case ?
7962 switch_1->child_index(0) :
7964 const int switch_1_second_child_pair =
7965 (switch_1_refinement_case ==
7967 switch_1->child_index(2) :
7970 switch_1->set_bounding_object_indices(
7971 {switch_2->line_index(0),
7972 switch_2->line_index(1),
7973 switch_2->line_index(2),
7974 switch_2->line_index(3)});
7975 switch_1->set_line_orientation(
7976 0, switch_2->line_orientation(0));
7977 switch_1->set_line_orientation(
7978 1, switch_2->line_orientation(1));
7979 switch_1->set_line_orientation(
7980 2, switch_2->line_orientation(2));
7981 switch_1->set_line_orientation(
7982 3, switch_2->line_orientation(3));
7983 switch_1->set_boundary_id_internal(
7984 switch_2->boundary_id());
7985 switch_1->set_manifold_id(switch_2->manifold_id());
7986 switch_1->set_user_index(switch_2->user_index());
7987 if (switch_2->user_flag_set())
7988 switch_1->set_user_flag();
7990 switch_1->clear_user_flag();
7991 switch_1->clear_refinement_case();
7992 switch_1->set_refinement_case(
7993 switch_2->refinement_case());
7994 switch_1->clear_children();
7995 if (switch_2->refinement_case())
7996 switch_1->set_children(0,
7997 switch_2->child_index(0));
7998 if (switch_2->refinement_case() ==
8000 switch_1->set_children(2,
8001 switch_2->child_index(2));
8003 switch_2->set_bounding_object_indices(
8007 switch_1_lines[3]});
8008 switch_2->set_line_orientation(
8009 0, switch_1_line_orientations[0]);
8010 switch_2->set_line_orientation(
8011 1, switch_1_line_orientations[1]);
8012 switch_2->set_line_orientation(
8013 2, switch_1_line_orientations[2]);
8014 switch_2->set_line_orientation(
8015 3, switch_1_line_orientations[3]);
8016 switch_2->set_boundary_id_internal(
8017 switch_1_boundary_id);
8018 switch_2->set_manifold_id(switch_1->manifold_id());
8019 switch_2->set_user_index(switch_1_user_index);
8020 if (switch_1_user_flag)
8021 switch_2->set_user_flag();
8023 switch_2->clear_user_flag();
8024 switch_2->clear_refinement_case();
8025 switch_2->set_refinement_case(
8026 switch_1_refinement_case);
8027 switch_2->clear_children();
8028 switch_2->set_children(0,
8029 switch_1_first_child_pair);
8030 switch_2->set_children(2,
8031 switch_1_second_child_pair);
8033 new_quads[0]->set_refinement_case(
8035 new_quads[0]->set_children(0, quad->child_index(0));
8036 new_quads[1]->set_refinement_case(
8038 new_quads[1]->set_children(0, quad->child_index(2));
8042 new_quads[0]->set_refinement_case(
8044 new_quads[0]->set_children(0, quad->child_index(0));
8045 new_quads[1]->set_refinement_case(
8047 new_quads[1]->set_children(0, quad->child_index(2));
8048 new_line->set_children(
8049 0, quad->child(0)->line_index(3));
8050 Assert(new_line->child(1) ==
8051 quad->child(1)->line(3),
8054 quad->clear_children();
8058 quad->set_children(0, new_quads[0]->
index());
8060 quad->set_refinement_case(aniso_quad_ref_case);
8067 if (quad->user_flag_set())
8079 ++next_unused_vertex;
8083 "Internal error: During refinement, the triangulation wants to access an element of the 'vertices' array but it turns out that the array is not large enough."));
8091 quad->refinement_case();
8097 quad->child(0)->set_user_index(
8099 quad->child(1)->set_user_index(
8105 middle_line = quad->child(0)->line(1);
8107 middle_line = quad->child(0)->line(3);
8114 if (!middle_line->has_children())
8122 middle_line->center(
true);
8130 .template next_free_pair_object<1>(
8135 middle_line->set_children(
8136 0, next_unused_line->index());
8140 raw_line_iterator children[2] = {
8141 next_unused_line, ++next_unused_line};
8149 children[0]->set_bounding_object_indices(
8150 {middle_line->vertex_index(0),
8151 next_unused_vertex});
8152 children[1]->set_bounding_object_indices(
8153 {next_unused_vertex,
8154 middle_line->vertex_index(1)});
8156 children[0]->set_used_flag();
8157 children[1]->set_used_flag();
8158 children[0]->clear_children();
8159 children[1]->clear_children();
8162 children[0]->clear_user_flag();
8163 children[1]->clear_user_flag();
8165 children[0]->set_boundary_id_internal(
8166 middle_line->boundary_id());
8167 children[1]->set_boundary_id_internal(
8168 middle_line->boundary_id());
8170 children[0]->set_manifold_id(
8171 middle_line->manifold_id());
8172 children[1]->set_manifold_id(
8173 middle_line->manifold_id());
8179 quad->clear_user_flag();
8209 quad->center(
true,
true);
8218 for (
unsigned int i = 0; i < 4; ++i)
8231 new_lines[i] = next_unused_line;
8255 quad->line(0)->child(0)->vertex_index(1),
8256 quad->line(1)->child(0)->vertex_index(1),
8257 quad->line(2)->child(0)->vertex_index(1),
8258 quad->line(3)->child(0)->vertex_index(1),
8259 next_unused_vertex};
8261 new_lines[0]->set_bounding_object_indices(
8263 new_lines[1]->set_bounding_object_indices(
8265 new_lines[2]->set_bounding_object_indices(
8267 new_lines[3]->set_bounding_object_indices(
8270 for (
const auto &new_line : new_lines)
8272 new_line->set_used_flag();
8273 new_line->clear_user_flag();
8275 new_line->clear_children();
8276 new_line->set_boundary_id_internal(quad->boundary_id());
8277 new_line->set_manifold_id(quad->manifold_id());
8296 const unsigned int index[2][2] = {
8300 const int line_indices[12] = {
8302 ->child(
index[0][quad->line_orientation(0)])
8305 ->child(
index[1][quad->line_orientation(0)])
8308 ->child(
index[0][quad->line_orientation(1)])
8311 ->child(
index[1][quad->line_orientation(1)])
8314 ->child(
index[0][quad->line_orientation(2)])
8317 ->child(
index[1][quad->line_orientation(2)])
8320 ->child(
index[0][quad->line_orientation(3)])
8323 ->child(
index[1][quad->line_orientation(3)])
8325 new_lines[0]->index(),
8326 new_lines[1]->index(),
8327 new_lines[2]->index(),
8328 new_lines[3]->index()};
8340 new_quads[0] = next_unused_quad;
8344 new_quads[1] = next_unused_quad;
8350 new_quads[2] = next_unused_quad;
8354 new_quads[3] = next_unused_quad;
8358 quad->set_children(0, new_quads[0]->
index());
8359 quad->set_children(2, new_quads[2]->
index());
8362 new_quads[0]->set_bounding_object_indices(
8367 new_quads[1]->set_bounding_object_indices(
8372 new_quads[2]->set_bounding_object_indices(
8377 new_quads[3]->set_bounding_object_indices(
8382 for (
const auto &new_quad : new_quads)
8384 new_quad->set_used_flag();
8385 new_quad->clear_user_flag();
8387 new_quad->clear_children();
8388 new_quad->set_boundary_id_internal(quad->boundary_id());
8389 new_quad->set_manifold_id(quad->manifold_id());
8393 for (
unsigned int j = 0;
8394 j < GeometryInfo<dim>::lines_per_face;
8396 new_quad->set_line_orientation(j,
true);
8402 new_quads[0]->set_line_orientation(
8403 0, quad->line_orientation(0));
8404 new_quads[0]->set_line_orientation(
8405 2, quad->line_orientation(2));
8406 new_quads[1]->set_line_orientation(
8407 1, quad->line_orientation(1));
8408 new_quads[1]->set_line_orientation(
8409 2, quad->line_orientation(2));
8410 new_quads[2]->set_line_orientation(
8411 0, quad->line_orientation(0));
8412 new_quads[2]->set_line_orientation(
8413 3, quad->line_orientation(3));
8414 new_quads[3]->set_line_orientation(
8415 1, quad->line_orientation(1));
8416 new_quads[3]->set_line_orientation(
8417 3, quad->line_orientation(3));
8421 quad->clear_user_flag();
8432 cells_with_distorted_children;
8446 for (; hex != endh; ++hex)
8447 if (hex->refine_flag_set())
8455 hex->clear_refine_flag();
8456 hex->set_refinement_case(ref_case);
8467 unsigned int n_new_lines = 0;
8468 unsigned int n_new_quads = 0;
8469 unsigned int n_new_hexes = 0;
8500 new_lines(n_new_lines);
8501 for (
unsigned int i = 0; i < n_new_lines; ++i)
8508 new_lines[i]->set_used_flag();
8509 new_lines[i]->clear_user_flag();
8510 new_lines[i]->clear_user_data();
8511 new_lines[i]->clear_children();
8513 new_lines[i]->set_boundary_id_internal(
8517 new_lines[i]->set_manifold_id(hex->manifold_id());
8524 new_quads(n_new_quads);
8525 for (
unsigned int i = 0; i < n_new_quads; ++i)
8532 new_quads[i]->set_used_flag();
8533 new_quads[i]->clear_user_flag();
8534 new_quads[i]->clear_user_data();
8535 new_quads[i]->clear_children();
8537 new_quads[i]->set_boundary_id_internal(
8541 new_quads[i]->set_manifold_id(hex->manifold_id());
8544 for (
unsigned int j = 0;
8545 j < GeometryInfo<dim>::lines_per_face;
8547 new_quads[i]->set_line_orientation(j,
true);
8556 new_hexes(n_new_hexes);
8557 for (
unsigned int i = 0; i < n_new_hexes; ++i)
8566 new_hexes[i] = next_unused_hex;
8569 new_hexes[i]->set_used_flag();
8570 new_hexes[i]->clear_user_flag();
8571 new_hexes[i]->clear_user_data();
8572 new_hexes[i]->clear_children();
8575 new_hexes[i]->set_material_id(hex->material_id());
8576 new_hexes[i]->set_manifold_id(hex->manifold_id());
8577 new_hexes[i]->set_subdomain_id(subdomainid);
8580 new_hexes[i]->set_parent(hex->index());
8592 for (
const unsigned int f :
8594 new_hexes[i]->set_combined_face_orientation(
8599 for (
unsigned int i = 0; i < n_new_hexes / 2; ++i)
8600 hex->set_children(2 * i, new_hexes[2 * i]->index());
8607 const bool f_or[6] = {hex->face_orientation(0),
8608 hex->face_orientation(1),
8609 hex->face_orientation(2),
8610 hex->face_orientation(3),
8611 hex->face_orientation(4),
8612 hex->face_orientation(5)};
8615 const bool f_fl[6] = {hex->face_flip(0),
8623 const bool f_ro[6] = {hex->face_rotation(0),
8624 hex->face_rotation(1),
8625 hex->face_rotation(2),
8626 hex->face_rotation(3),
8627 hex->face_rotation(4),
8628 hex->face_rotation(5)};
8631 const unsigned char f_co[6] = {
8632 hex->combined_face_orientation(0),
8633 hex->combined_face_orientation(1),
8634 hex->combined_face_orientation(2),
8635 hex->combined_face_orientation(3),
8636 hex->combined_face_orientation(4),
8637 hex->combined_face_orientation(5)};
8647 const unsigned int child_at_origin[2][2][2] = {
8734 raw_line_iterator lines[4] = {
8735 hex->face(2)->child(0)->line(
8736 (hex->face(2)->refinement_case() ==
8740 hex->face(3)->child(0)->line(
8741 (hex->face(3)->refinement_case() ==
8745 hex->face(4)->child(0)->line(
8746 (hex->face(4)->refinement_case() ==
8750 hex->face(5)->child(0)->line(
8751 (hex->face(5)->refinement_case() ==
8757 unsigned int line_indices[4];
8758 for (
unsigned int i = 0; i < 4; ++i)
8759 line_indices[i] = lines[i]->
index();
8766 bool line_orientation[4];
8772 const unsigned int middle_vertices[2] = {
8773 hex->line(2)->child(0)->vertex_index(1),
8774 hex->line(7)->child(0)->vertex_index(1)};
8776 for (
unsigned int i = 0; i < 4; ++i)
8777 if (lines[i]->vertex_index(i % 2) ==
8778 middle_vertices[i % 2])
8779 line_orientation[i] =
true;
8784 Assert(lines[i]->vertex_index((i + 1) % 2) ==
8785 middle_vertices[i % 2],
8787 line_orientation[i] =
false;
8792 new_quads[0]->set_bounding_object_indices(
8798 new_quads[0]->set_line_orientation(
8799 0, line_orientation[0]);
8800 new_quads[0]->set_line_orientation(
8801 1, line_orientation[1]);
8802 new_quads[0]->set_line_orientation(
8803 2, line_orientation[2]);
8804 new_quads[0]->set_line_orientation(
8805 3, line_orientation[3]);
8838 const int quad_indices[11] = {
8839 new_quads[0]->index(),
8841 hex->face(0)->index(),
8843 hex->face(1)->index(),
8845 hex->face(2)->child_index(
8846 child_at_origin[hex->face(2)->refinement_case() -
8847 1][f_fl[2]][f_ro[2]]),
8848 hex->face(2)->child_index(
8850 child_at_origin[hex->face(2)->refinement_case() -
8851 1][f_fl[2]][f_ro[2]]),
8853 hex->face(3)->child_index(
8854 child_at_origin[hex->face(3)->refinement_case() -
8855 1][f_fl[3]][f_ro[3]]),
8856 hex->face(3)->child_index(
8858 child_at_origin[hex->face(3)->refinement_case() -
8859 1][f_fl[3]][f_ro[3]]),
8861 hex->face(4)->child_index(
8862 child_at_origin[hex->face(4)->refinement_case() -
8863 1][f_fl[4]][f_ro[4]]),
8864 hex->face(4)->child_index(
8866 child_at_origin[hex->face(4)->refinement_case() -
8867 1][f_fl[4]][f_ro[4]]),
8869 hex->face(5)->child_index(
8870 child_at_origin[hex->face(5)->refinement_case() -
8871 1][f_fl[5]][f_ro[5]]),
8872 hex->face(5)->child_index(
8874 child_at_origin[hex->face(5)->refinement_case() -
8875 1][f_fl[5]][f_ro[5]])
8879 new_hexes[0]->set_bounding_object_indices(
8886 new_hexes[1]->set_bounding_object_indices(
8961 raw_line_iterator lines[4] = {
8962 hex->face(0)->child(0)->line(
8963 (hex->face(0)->refinement_case() ==
8967 hex->face(1)->child(0)->line(
8968 (hex->face(1)->refinement_case() ==
8972 hex->face(4)->child(0)->line(
8973 (hex->face(4)->refinement_case() ==
8977 hex->face(5)->child(0)->line(
8978 (hex->face(5)->refinement_case() ==
8984 unsigned int line_indices[4];
8985 for (
unsigned int i = 0; i < 4; ++i)
8986 line_indices[i] = lines[i]->
index();
8993 bool line_orientation[4];
8999 const unsigned int middle_vertices[2] = {
9000 hex->line(0)->child(0)->vertex_index(1),
9001 hex->line(5)->child(0)->vertex_index(1)};
9003 for (
unsigned int i = 0; i < 4; ++i)
9004 if (lines[i]->vertex_index(i % 2) ==
9005 middle_vertices[i % 2])
9006 line_orientation[i] =
true;
9010 Assert(lines[i]->vertex_index((i + 1) % 2) ==
9011 middle_vertices[i % 2],
9013 line_orientation[i] =
false;
9018 new_quads[0]->set_bounding_object_indices(
9024 new_quads[0]->set_line_orientation(
9025 0, line_orientation[2]);
9026 new_quads[0]->set_line_orientation(
9027 1, line_orientation[3]);
9028 new_quads[0]->set_line_orientation(
9029 2, line_orientation[0]);
9030 new_quads[0]->set_line_orientation(
9031 3, line_orientation[1]);
9064 const int quad_indices[11] = {
9065 new_quads[0]->index(),
9067 hex->face(0)->child_index(
9068 child_at_origin[hex->face(0)->refinement_case() -
9069 1][f_fl[0]][f_ro[0]]),
9070 hex->face(0)->child_index(
9072 child_at_origin[hex->face(0)->refinement_case() -
9073 1][f_fl[0]][f_ro[0]]),
9075 hex->face(1)->child_index(
9076 child_at_origin[hex->face(1)->refinement_case() -
9077 1][f_fl[1]][f_ro[1]]),
9078 hex->face(1)->child_index(
9080 child_at_origin[hex->face(1)->refinement_case() -
9081 1][f_fl[1]][f_ro[1]]),
9083 hex->face(2)->index(),
9085 hex->face(3)->index(),
9087 hex->face(4)->child_index(
9088 child_at_origin[hex->face(4)->refinement_case() -
9089 1][f_fl[4]][f_ro[4]]),
9090 hex->face(4)->child_index(
9092 child_at_origin[hex->face(4)->refinement_case() -
9093 1][f_fl[4]][f_ro[4]]),
9095 hex->face(5)->child_index(
9096 child_at_origin[hex->face(5)->refinement_case() -
9097 1][f_fl[5]][f_ro[5]]),
9098 hex->face(5)->child_index(
9100 child_at_origin[hex->face(5)->refinement_case() -
9101 1][f_fl[5]][f_ro[5]])
9105 new_hexes[0]->set_bounding_object_indices(
9112 new_hexes[1]->set_bounding_object_indices(
9189 raw_line_iterator lines[4] = {
9190 hex->face(0)->child(0)->line(
9191 (hex->face(0)->refinement_case() ==
9195 hex->face(1)->child(0)->line(
9196 (hex->face(1)->refinement_case() ==
9200 hex->face(2)->child(0)->line(
9201 (hex->face(2)->refinement_case() ==
9205 hex->face(3)->child(0)->line(
9206 (hex->face(3)->refinement_case() ==
9212 unsigned int line_indices[4];
9213 for (
unsigned int i = 0; i < 4; ++i)
9214 line_indices[i] = lines[i]->
index();
9221 bool line_orientation[4];
9227 const unsigned int middle_vertices[2] = {
9228 middle_vertex_index<dim, spacedim>(hex->line(8)),
9229 middle_vertex_index<dim, spacedim>(hex->line(11))};
9231 for (
unsigned int i = 0; i < 4; ++i)
9232 if (lines[i]->vertex_index(i % 2) ==
9233 middle_vertices[i % 2])
9234 line_orientation[i] =
true;
9238 Assert(lines[i]->vertex_index((i + 1) % 2) ==
9239 middle_vertices[i % 2],
9241 line_orientation[i] =
false;
9246 new_quads[0]->set_bounding_object_indices(
9252 new_quads[0]->set_line_orientation(
9253 0, line_orientation[0]);
9254 new_quads[0]->set_line_orientation(
9255 1, line_orientation[1]);
9256 new_quads[0]->set_line_orientation(
9257 2, line_orientation[2]);
9258 new_quads[0]->set_line_orientation(
9259 3, line_orientation[3]);
9293 const int quad_indices[11] = {
9294 new_quads[0]->index(),
9296 hex->face(0)->child_index(
9297 child_at_origin[hex->face(0)->refinement_case() -
9298 1][f_fl[0]][f_ro[0]]),
9299 hex->face(0)->child_index(
9301 child_at_origin[hex->face(0)->refinement_case() -
9302 1][f_fl[0]][f_ro[0]]),
9304 hex->face(1)->child_index(
9305 child_at_origin[hex->face(1)->refinement_case() -
9306 1][f_fl[1]][f_ro[1]]),
9307 hex->face(1)->child_index(
9309 child_at_origin[hex->face(1)->refinement_case() -
9310 1][f_fl[1]][f_ro[1]]),
9312 hex->face(2)->child_index(
9313 child_at_origin[hex->face(2)->refinement_case() -
9314 1][f_fl[2]][f_ro[2]]),
9315 hex->face(2)->child_index(
9317 child_at_origin[hex->face(2)->refinement_case() -
9318 1][f_fl[2]][f_ro[2]]),
9320 hex->face(3)->child_index(
9321 child_at_origin[hex->face(3)->refinement_case() -
9322 1][f_fl[3]][f_ro[3]]),
9323 hex->face(3)->child_index(
9325 child_at_origin[hex->face(3)->refinement_case() -
9326 1][f_fl[3]][f_ro[3]]),
9328 hex->face(4)->index(),
9330 hex->face(5)->index()
9333 new_hexes[0]->set_bounding_object_indices(
9340 new_hexes[1]->set_bounding_object_indices(
9372 new_lines[0]->set_bounding_object_indices(
9373 {middle_vertex_index<dim, spacedim>(hex->face(4)),
9374 middle_vertex_index<dim, spacedim>(hex->face(5))});
9442 spacedim>::raw_line_iterator lines[13] = {
9443 hex->face(0)->child(0)->line(
9444 (hex->face(0)->refinement_case() ==
9448 hex->face(1)->child(0)->line(
9449 (hex->face(1)->refinement_case() ==
9453 hex->face(2)->child(0)->line(
9454 (hex->face(2)->refinement_case() ==
9458 hex->face(3)->child(0)->line(
9459 (hex->face(3)->refinement_case() ==
9467 0, f_or[4], f_fl[4], f_ro[4]))
9470 1, f_or[4], f_fl[4], f_ro[4])),
9474 3, f_or[4], f_fl[4], f_ro[4]))
9477 0, f_or[4], f_fl[4], f_ro[4])),
9481 0, f_or[4], f_fl[4], f_ro[4]))
9484 3, f_or[4], f_fl[4], f_ro[4])),
9488 3, f_or[4], f_fl[4], f_ro[4]))
9491 2, f_or[4], f_fl[4], f_ro[4])),
9496 0, f_or[5], f_fl[5], f_ro[5]))
9499 1, f_or[5], f_fl[5], f_ro[5])),
9503 3, f_or[5], f_fl[5], f_ro[5]))
9506 0, f_or[5], f_fl[5], f_ro[5])),
9510 0, f_or[5], f_fl[5], f_ro[5]))
9513 3, f_or[5], f_fl[5], f_ro[5])),
9517 3, f_or[5], f_fl[5], f_ro[5]))
9520 2, f_or[5], f_fl[5], f_ro[5])),
9525 unsigned int line_indices[13];
9526 for (
unsigned int i = 0; i < 13; ++i)
9527 line_indices[i] = lines[i]->
index();
9534 bool line_orientation[13];
9538 const unsigned int middle_vertices[4] = {
9539 hex->line(0)->child(0)->vertex_index(1),
9540 hex->line(1)->child(0)->vertex_index(1),
9541 hex->line(2)->child(0)->vertex_index(1),
9542 hex->line(3)->child(0)->vertex_index(1),
9548 for (
unsigned int i = 0; i < 4; ++i)
9549 if (lines[i]->vertex_index(0) == middle_vertices[i])
9550 line_orientation[i] =
true;
9554 Assert(lines[i]->vertex_index(1) ==
9557 line_orientation[i] =
false;
9566 for (
unsigned int i = 4; i < 12; ++i)
9567 if (lines[i]->vertex_index((i + 1) % 2) ==
9568 middle_vertex_index<dim, spacedim>(
9569 hex->face(3 + i / 4)))
9570 line_orientation[i] =
true;
9575 Assert(lines[i]->vertex_index(i % 2) ==
9576 (middle_vertex_index<dim, spacedim>(
9577 hex->face(3 + i / 4))),
9579 line_orientation[i] =
false;
9584 line_orientation[12] =
true;
9609 new_quads[0]->set_bounding_object_indices(
9614 new_quads[1]->set_bounding_object_indices(
9619 new_quads[2]->set_bounding_object_indices(
9624 new_quads[3]->set_bounding_object_indices(
9630 new_quads[0]->set_line_orientation(
9631 0, line_orientation[2]);
9632 new_quads[0]->set_line_orientation(
9633 2, line_orientation[4]);
9634 new_quads[0]->set_line_orientation(
9635 3, line_orientation[8]);
9637 new_quads[1]->set_line_orientation(
9638 1, line_orientation[3]);
9639 new_quads[1]->set_line_orientation(
9640 2, line_orientation[5]);
9641 new_quads[1]->set_line_orientation(
9642 3, line_orientation[9]);
9644 new_quads[2]->set_line_orientation(
9645 0, line_orientation[6]);
9646 new_quads[2]->set_line_orientation(
9647 1, line_orientation[10]);
9648 new_quads[2]->set_line_orientation(
9649 2, line_orientation[0]);
9651 new_quads[3]->set_line_orientation(
9652 0, line_orientation[7]);
9653 new_quads[3]->set_line_orientation(
9654 1, line_orientation[11]);
9655 new_quads[3]->set_line_orientation(
9656 3, line_orientation[1]);
9689 const int quad_indices[20] = {
9690 new_quads[0]->index(),
9691 new_quads[1]->index(),
9692 new_quads[2]->index(),
9693 new_quads[3]->index(),
9695 hex->face(0)->child_index(
9696 child_at_origin[hex->face(0)->refinement_case() -
9697 1][f_fl[0]][f_ro[0]]),
9698 hex->face(0)->child_index(
9700 child_at_origin[hex->face(0)->refinement_case() -
9701 1][f_fl[0]][f_ro[0]]),
9703 hex->face(1)->child_index(
9704 child_at_origin[hex->face(1)->refinement_case() -
9705 1][f_fl[1]][f_ro[1]]),
9706 hex->face(1)->child_index(
9708 child_at_origin[hex->face(1)->refinement_case() -
9709 1][f_fl[1]][f_ro[1]]),
9711 hex->face(2)->child_index(
9712 child_at_origin[hex->face(2)->refinement_case() -
9713 1][f_fl[2]][f_ro[2]]),
9714 hex->face(2)->child_index(
9716 child_at_origin[hex->face(2)->refinement_case() -
9717 1][f_fl[2]][f_ro[2]]),
9719 hex->face(3)->child_index(
9720 child_at_origin[hex->face(3)->refinement_case() -
9721 1][f_fl[3]][f_ro[3]]),
9722 hex->face(3)->child_index(
9724 child_at_origin[hex->face(3)->refinement_case() -
9725 1][f_fl[3]][f_ro[3]]),
9727 hex->face(4)->isotropic_child_index(
9729 0, f_or[4], f_fl[4], f_ro[4])),
9730 hex->face(4)->isotropic_child_index(
9732 1, f_or[4], f_fl[4], f_ro[4])),
9733 hex->face(4)->isotropic_child_index(
9735 2, f_or[4], f_fl[4], f_ro[4])),
9736 hex->face(4)->isotropic_child_index(
9738 3, f_or[4], f_fl[4], f_ro[4])),
9740 hex->face(5)->isotropic_child_index(
9742 0, f_or[5], f_fl[5], f_ro[5])),
9743 hex->face(5)->isotropic_child_index(
9745 1, f_or[5], f_fl[5], f_ro[5])),
9746 hex->face(5)->isotropic_child_index(
9748 2, f_or[5], f_fl[5], f_ro[5])),
9749 hex->face(5)->isotropic_child_index(
9751 3, f_or[5], f_fl[5], f_ro[5]))};
9753 new_hexes[0]->set_bounding_object_indices(
9760 new_hexes[1]->set_bounding_object_indices(
9767 new_hexes[2]->set_bounding_object_indices(
9774 new_hexes[3]->set_bounding_object_indices(
9806 new_lines[0]->set_bounding_object_indices(
9807 {middle_vertex_index<dim, spacedim>(hex->face(2)),
9808 middle_vertex_index<dim, spacedim>(hex->face(3))});
9876 spacedim>::raw_line_iterator lines[13] = {
9877 hex->face(0)->child(0)->line(
9878 (hex->face(0)->refinement_case() ==
9882 hex->face(1)->child(0)->line(
9883 (hex->face(1)->refinement_case() ==
9887 hex->face(4)->child(0)->line(
9888 (hex->face(4)->refinement_case() ==
9892 hex->face(5)->child(0)->line(
9893 (hex->face(5)->refinement_case() ==
9901 0, f_or[2], f_fl[2], f_ro[2]))
9904 3, f_or[2], f_fl[2], f_ro[2])),
9908 3, f_or[2], f_fl[2], f_ro[2]))
9911 2, f_or[2], f_fl[2], f_ro[2])),
9915 0, f_or[2], f_fl[2], f_ro[2]))
9918 1, f_or[2], f_fl[2], f_ro[2])),
9922 3, f_or[2], f_fl[2], f_ro[2]))
9925 0, f_or[2], f_fl[2], f_ro[2])),
9930 0, f_or[3], f_fl[3], f_ro[3]))
9933 3, f_or[3], f_fl[3], f_ro[3])),
9937 3, f_or[3], f_fl[3], f_ro[3]))
9940 2, f_or[3], f_fl[3], f_ro[3])),
9944 0, f_or[3], f_fl[3], f_ro[3]))
9947 1, f_or[3], f_fl[3], f_ro[3])),
9951 3, f_or[3], f_fl[3], f_ro[3]))
9954 0, f_or[3], f_fl[3], f_ro[3])),
9959 unsigned int line_indices[13];
9960 for (
unsigned int i = 0; i < 13; ++i)
9961 line_indices[i] = lines[i]->
index();
9968 bool line_orientation[13];
9972 const unsigned int middle_vertices[4] = {
9973 hex->line(8)->child(0)->vertex_index(1),
9974 hex->line(9)->child(0)->vertex_index(1),
9975 hex->line(2)->child(0)->vertex_index(1),
9976 hex->line(6)->child(0)->vertex_index(1),
9981 for (
unsigned int i = 0; i < 4; ++i)
9982 if (lines[i]->vertex_index(0) == middle_vertices[i])
9983 line_orientation[i] =
true;
9987 Assert(lines[i]->vertex_index(1) ==
9990 line_orientation[i] =
false;
9999 for (
unsigned int i = 4; i < 12; ++i)
10000 if (lines[i]->vertex_index((i + 1) % 2) ==
10001 middle_vertex_index<dim, spacedim>(
10002 hex->face(1 + i / 4)))
10003 line_orientation[i] =
true;
10008 Assert(lines[i]->vertex_index(i % 2) ==
10009 (middle_vertex_index<dim, spacedim>(
10010 hex->face(1 + i / 4))),
10012 line_orientation[i] =
false;
10017 line_orientation[12] =
true;
10043 new_quads[0]->set_bounding_object_indices(
10047 line_indices[10]});
10048 new_quads[1]->set_bounding_object_indices(
10052 line_indices[11]});
10053 new_quads[2]->set_bounding_object_indices(
10057 line_indices[12]});
10058 new_quads[3]->set_bounding_object_indices(
10064 new_quads[0]->set_line_orientation(
10065 0, line_orientation[0]);
10066 new_quads[0]->set_line_orientation(
10067 2, line_orientation[6]);
10068 new_quads[0]->set_line_orientation(
10069 3, line_orientation[10]);
10071 new_quads[1]->set_line_orientation(
10072 1, line_orientation[1]);
10073 new_quads[1]->set_line_orientation(
10074 2, line_orientation[7]);
10075 new_quads[1]->set_line_orientation(
10076 3, line_orientation[11]);
10078 new_quads[2]->set_line_orientation(
10079 0, line_orientation[4]);
10080 new_quads[2]->set_line_orientation(
10081 1, line_orientation[8]);
10082 new_quads[2]->set_line_orientation(
10083 2, line_orientation[2]);
10085 new_quads[3]->set_line_orientation(
10086 0, line_orientation[5]);
10087 new_quads[3]->set_line_orientation(
10088 1, line_orientation[9]);
10089 new_quads[3]->set_line_orientation(
10090 3, line_orientation[3]);
10124 const int quad_indices[20] = {
10125 new_quads[0]->index(),
10126 new_quads[1]->index(),
10127 new_quads[2]->index(),
10128 new_quads[3]->index(),
10130 hex->face(0)->child_index(
10131 child_at_origin[hex->face(0)->refinement_case() -
10132 1][f_fl[0]][f_ro[0]]),
10133 hex->face(0)->child_index(
10135 child_at_origin[hex->face(0)->refinement_case() -
10136 1][f_fl[0]][f_ro[0]]),
10138 hex->face(1)->child_index(
10139 child_at_origin[hex->face(1)->refinement_case() -
10140 1][f_fl[1]][f_ro[1]]),
10141 hex->face(1)->child_index(
10143 child_at_origin[hex->face(1)->refinement_case() -
10144 1][f_fl[1]][f_ro[1]]),
10146 hex->face(2)->isotropic_child_index(
10148 0, f_or[2], f_fl[2], f_ro[2])),
10149 hex->face(2)->isotropic_child_index(
10151 1, f_or[2], f_fl[2], f_ro[2])),
10152 hex->face(2)->isotropic_child_index(
10154 2, f_or[2], f_fl[2], f_ro[2])),
10155 hex->face(2)->isotropic_child_index(
10157 3, f_or[2], f_fl[2], f_ro[2])),
10159 hex->face(3)->isotropic_child_index(
10161 0, f_or[3], f_fl[3], f_ro[3])),
10162 hex->face(3)->isotropic_child_index(
10164 1, f_or[3], f_fl[3], f_ro[3])),
10165 hex->face(3)->isotropic_child_index(
10167 2, f_or[3], f_fl[3], f_ro[3])),
10168 hex->face(3)->isotropic_child_index(
10170 3, f_or[3], f_fl[3], f_ro[3])),
10172 hex->face(4)->child_index(
10173 child_at_origin[hex->face(4)->refinement_case() -
10174 1][f_fl[4]][f_ro[4]]),
10175 hex->face(4)->child_index(
10177 child_at_origin[hex->face(4)->refinement_case() -
10178 1][f_fl[4]][f_ro[4]]),
10180 hex->face(5)->child_index(
10181 child_at_origin[hex->face(5)->refinement_case() -
10182 1][f_fl[5]][f_ro[5]]),
10183 hex->face(5)->child_index(
10185 child_at_origin[hex->face(5)->refinement_case() -
10186 1][f_fl[5]][f_ro[5]])};
10197 new_hexes[0]->set_bounding_object_indices(
10204 new_hexes[1]->set_bounding_object_indices(
10210 quad_indices[18]});
10211 new_hexes[2]->set_bounding_object_indices(
10218 new_hexes[3]->set_bounding_object_indices(
10224 quad_indices[19]});
10251 new_lines[0]->set_bounding_object_indices(
10253 {middle_vertex_index<dim, spacedim>(hex->face(0)),
10254 middle_vertex_index<dim, spacedim>(hex->face(1))});
10323 spacedim>::raw_line_iterator lines[13] = {
10324 hex->face(2)->child(0)->line(
10325 (hex->face(2)->refinement_case() ==
10329 hex->face(3)->child(0)->line(
10330 (hex->face(3)->refinement_case() ==
10334 hex->face(4)->child(0)->line(
10335 (hex->face(4)->refinement_case() ==
10339 hex->face(5)->child(0)->line(
10340 (hex->face(5)->refinement_case() ==
10348 0, f_or[0], f_fl[0], f_ro[0]))
10351 1, f_or[0], f_fl[0], f_ro[0])),
10355 3, f_or[0], f_fl[0], f_ro[0]))
10358 0, f_or[0], f_fl[0], f_ro[0])),
10362 0, f_or[0], f_fl[0], f_ro[0]))
10365 3, f_or[0], f_fl[0], f_ro[0])),
10369 3, f_or[0], f_fl[0], f_ro[0]))
10372 2, f_or[0], f_fl[0], f_ro[0])),
10377 0, f_or[1], f_fl[1], f_ro[1]))
10380 1, f_or[1], f_fl[1], f_ro[1])),
10384 3, f_or[1], f_fl[1], f_ro[1]))
10387 0, f_or[1], f_fl[1], f_ro[1])),
10391 0, f_or[1], f_fl[1], f_ro[1]))
10394 3, f_or[1], f_fl[1], f_ro[1])),
10398 3, f_or[1], f_fl[1], f_ro[1]))
10401 2, f_or[1], f_fl[1], f_ro[1])),
10406 unsigned int line_indices[13];
10408 for (
unsigned int i = 0; i < 13; ++i)
10409 line_indices[i] = lines[i]->
index();
10416 bool line_orientation[13];
10420 const unsigned int middle_vertices[4] = {
10421 hex->line(8)->child(0)->vertex_index(1),
10422 hex->line(10)->child(0)->vertex_index(1),
10423 hex->line(0)->child(0)->vertex_index(1),
10424 hex->line(4)->child(0)->vertex_index(1),
10429 for (
unsigned int i = 0; i < 4; ++i)
10430 if (lines[i]->vertex_index(0) == middle_vertices[i])
10431 line_orientation[i] =
true;
10435 Assert(lines[i]->vertex_index(1) ==
10436 middle_vertices[i],
10438 line_orientation[i] =
false;
10447 for (
unsigned int i = 4; i < 12; ++i)
10448 if (lines[i]->vertex_index((i + 1) % 2) ==
10449 middle_vertex_index<dim, spacedim>(
10450 hex->face(i / 4 - 1)))
10451 line_orientation[i] =
true;
10456 Assert(lines[i]->vertex_index(i % 2) ==
10457 (middle_vertex_index<dim, spacedim>(
10458 hex->face(i / 4 - 1))),
10460 line_orientation[i] =
false;
10465 line_orientation[12] =
true;
10485 new_quads[0]->set_bounding_object_indices(
10489 line_indices[12]});
10490 new_quads[1]->set_bounding_object_indices(
10495 new_quads[2]->set_bounding_object_indices(
10500 new_quads[3]->set_bounding_object_indices(
10506 new_quads[0]->set_line_orientation(
10507 0, line_orientation[6]);
10508 new_quads[0]->set_line_orientation(
10509 1, line_orientation[10]);
10510 new_quads[0]->set_line_orientation(
10511 2, line_orientation[0]);
10513 new_quads[1]->set_line_orientation(
10514 0, line_orientation[7]);
10515 new_quads[1]->set_line_orientation(
10516 1, line_orientation[11]);
10517 new_quads[1]->set_line_orientation(
10518 3, line_orientation[1]);
10520 new_quads[2]->set_line_orientation(
10521 0, line_orientation[2]);
10522 new_quads[2]->set_line_orientation(
10523 2, line_orientation[4]);
10524 new_quads[2]->set_line_orientation(
10525 3, line_orientation[8]);
10527 new_quads[3]->set_line_orientation(
10528 1, line_orientation[3]);
10529 new_quads[3]->set_line_orientation(
10530 2, line_orientation[5]);
10531 new_quads[3]->set_line_orientation(
10532 3, line_orientation[9]);
10566 const int quad_indices[20] = {
10567 new_quads[0]->index(),
10568 new_quads[1]->index(),
10569 new_quads[2]->index(),
10570 new_quads[3]->index(),
10572 hex->face(0)->isotropic_child_index(
10574 0, f_or[0], f_fl[0], f_ro[0])),
10575 hex->face(0)->isotropic_child_index(
10577 1, f_or[0], f_fl[0], f_ro[0])),
10578 hex->face(0)->isotropic_child_index(
10580 2, f_or[0], f_fl[0], f_ro[0])),
10581 hex->face(0)->isotropic_child_index(
10583 3, f_or[0], f_fl[0], f_ro[0])),
10585 hex->face(1)->isotropic_child_index(
10587 0, f_or[1], f_fl[1], f_ro[1])),
10588 hex->face(1)->isotropic_child_index(
10590 1, f_or[1], f_fl[1], f_ro[1])),
10591 hex->face(1)->isotropic_child_index(
10593 2, f_or[1], f_fl[1], f_ro[1])),
10594 hex->face(1)->isotropic_child_index(
10596 3, f_or[1], f_fl[1], f_ro[1])),
10598 hex->face(2)->child_index(
10599 child_at_origin[hex->face(2)->refinement_case() -
10600 1][f_fl[2]][f_ro[2]]),
10601 hex->face(2)->child_index(
10603 child_at_origin[hex->face(2)->refinement_case() -
10604 1][f_fl[2]][f_ro[2]]),
10606 hex->face(3)->child_index(
10607 child_at_origin[hex->face(3)->refinement_case() -
10608 1][f_fl[3]][f_ro[3]]),
10609 hex->face(3)->child_index(
10611 child_at_origin[hex->face(3)->refinement_case() -
10612 1][f_fl[3]][f_ro[3]]),
10614 hex->face(4)->child_index(
10615 child_at_origin[hex->face(4)->refinement_case() -
10616 1][f_fl[4]][f_ro[4]]),
10617 hex->face(4)->child_index(
10619 child_at_origin[hex->face(4)->refinement_case() -
10620 1][f_fl[4]][f_ro[4]]),
10622 hex->face(5)->child_index(
10623 child_at_origin[hex->face(5)->refinement_case() -
10624 1][f_fl[5]][f_ro[5]]),
10625 hex->face(5)->child_index(
10627 child_at_origin[hex->face(5)->refinement_case() -
10628 1][f_fl[5]][f_ro[5]])};
10630 new_hexes[0]->set_bounding_object_indices(
10637 new_hexes[1]->set_bounding_object_indices(
10644 new_hexes[2]->set_bounding_object_indices(
10650 quad_indices[18]});
10651 new_hexes[3]->set_bounding_object_indices(
10657 quad_indices[19]});
10689 ++next_unused_vertex;
10693 "Internal error: During refinement, the triangulation wants to access an element of the 'vertices' array but it turns out that the array is not large enough."));
10704 hex->center(
true,
true);
10726 middle_vertex_index<dim, spacedim>(hex->face(0)),
10727 middle_vertex_index<dim, spacedim>(hex->face(1)),
10728 middle_vertex_index<dim, spacedim>(hex->face(2)),
10729 middle_vertex_index<dim, spacedim>(hex->face(3)),
10730 middle_vertex_index<dim, spacedim>(hex->face(4)),
10731 middle_vertex_index<dim, spacedim>(hex->face(5)),
10732 next_unused_vertex};
10734 new_lines[0]->set_bounding_object_indices(
10736 new_lines[1]->set_bounding_object_indices(
10738 new_lines[2]->set_bounding_object_indices(
10740 new_lines[3]->set_bounding_object_indices(
10742 new_lines[4]->set_bounding_object_indices(
10744 new_lines[5]->set_bounding_object_indices(
10814 spacedim>::raw_line_iterator lines[30] = {
10818 0, f_or[0], f_fl[0], f_ro[0]))
10821 1, f_or[0], f_fl[0], f_ro[0])),
10825 3, f_or[0], f_fl[0], f_ro[0]))
10828 0, f_or[0], f_fl[0], f_ro[0])),
10832 0, f_or[0], f_fl[0], f_ro[0]))
10835 3, f_or[0], f_fl[0], f_ro[0])),
10839 3, f_or[0], f_fl[0], f_ro[0]))
10842 2, f_or[0], f_fl[0], f_ro[0])),
10847 0, f_or[1], f_fl[1], f_ro[1]))
10850 1, f_or[1], f_fl[1], f_ro[1])),
10854 3, f_or[1], f_fl[1], f_ro[1]))
10857 0, f_or[1], f_fl[1], f_ro[1])),
10861 0, f_or[1], f_fl[1], f_ro[1]))
10864 3, f_or[1], f_fl[1], f_ro[1])),
10868 3, f_or[1], f_fl[1], f_ro[1]))
10871 2, f_or[1], f_fl[1], f_ro[1])),
10876 0, f_or[2], f_fl[2], f_ro[2]))
10879 1, f_or[2], f_fl[2], f_ro[2])),
10883 3, f_or[2], f_fl[2], f_ro[2]))
10886 0, f_or[2], f_fl[2], f_ro[2])),
10890 0, f_or[2], f_fl[2], f_ro[2]))
10893 3, f_or[2], f_fl[2], f_ro[2])),
10897 3, f_or[2], f_fl[2], f_ro[2]))
10900 2, f_or[2], f_fl[2], f_ro[2])),
10905 0, f_or[3], f_fl[3], f_ro[3]))
10908 1, f_or[3], f_fl[3], f_ro[3])),
10912 3, f_or[3], f_fl[3], f_ro[3]))
10915 0, f_or[3], f_fl[3], f_ro[3])),
10919 0, f_or[3], f_fl[3], f_ro[3]))
10922 3, f_or[3], f_fl[3], f_ro[3])),
10926 3, f_or[3], f_fl[3], f_ro[3]))
10929 2, f_or[3], f_fl[3], f_ro[3])),
10934 0, f_or[4], f_fl[4], f_ro[4]))
10937 1, f_or[4], f_fl[4], f_ro[4])),
10941 3, f_or[4], f_fl[4], f_ro[4]))
10944 0, f_or[4], f_fl[4], f_ro[4])),
10948 0, f_or[4], f_fl[4], f_ro[4]))
10951 3, f_or[4], f_fl[4], f_ro[4])),
10955 3, f_or[4], f_fl[4], f_ro[4]))
10958 2, f_or[4], f_fl[4], f_ro[4])),
10963 0, f_or[5], f_fl[5], f_ro[5]))
10966 1, f_or[5], f_fl[5], f_ro[5])),
10970 3, f_or[5], f_fl[5], f_ro[5]))
10973 0, f_or[5], f_fl[5], f_ro[5])),
10977 0, f_or[5], f_fl[5], f_ro[5]))
10980 3, f_or[5], f_fl[5], f_ro[5])),
10984 3, f_or[5], f_fl[5], f_ro[5]))
10987 2, f_or[5], f_fl[5], f_ro[5])),
10997 unsigned int line_indices[30];
10998 for (
unsigned int i = 0; i < 30; ++i)
10999 line_indices[i] = lines[i]->
index();
11006 bool line_orientation[30];
11014 for (
unsigned int i = 0; i < 24; ++i)
11015 if (lines[i]->vertex_index((i + 1) % 2) ==
11017 line_orientation[i] =
true;
11022 Assert(lines[i]->vertex_index(i % 2) ==
11025 line_orientation[i] =
false;
11030 for (
unsigned int i = 24; i < 30; ++i)
11031 line_orientation[i] =
true;
11063 new_quads[0]->set_bounding_object_indices(
11067 line_indices[24]});
11068 new_quads[1]->set_bounding_object_indices(
11072 line_indices[25]});
11073 new_quads[2]->set_bounding_object_indices(
11077 line_indices[20]});
11078 new_quads[3]->set_bounding_object_indices(
11082 line_indices[21]});
11083 new_quads[4]->set_bounding_object_indices(
11087 line_indices[28]});
11088 new_quads[5]->set_bounding_object_indices(
11092 line_indices[29]});
11093 new_quads[6]->set_bounding_object_indices(
11098 new_quads[7]->set_bounding_object_indices(
11103 new_quads[8]->set_bounding_object_indices(
11107 line_indices[26]});
11108 new_quads[9]->set_bounding_object_indices(
11112 line_indices[27]});
11113 new_quads[10]->set_bounding_object_indices(
11117 line_indices[12]});
11118 new_quads[11]->set_bounding_object_indices(
11122 line_indices[13]});
11127 new_quads[0]->set_line_orientation(
11128 0, line_orientation[10]);
11129 new_quads[0]->set_line_orientation(
11130 2, line_orientation[16]);
11132 new_quads[1]->set_line_orientation(
11133 1, line_orientation[14]);
11134 new_quads[1]->set_line_orientation(
11135 2, line_orientation[17]);
11137 new_quads[2]->set_line_orientation(
11138 0, line_orientation[11]);
11139 new_quads[2]->set_line_orientation(
11140 3, line_orientation[20]);
11142 new_quads[3]->set_line_orientation(
11143 1, line_orientation[15]);
11144 new_quads[3]->set_line_orientation(
11145 3, line_orientation[21]);
11147 new_quads[4]->set_line_orientation(
11148 0, line_orientation[18]);
11149 new_quads[4]->set_line_orientation(
11150 2, line_orientation[0]);
11152 new_quads[5]->set_line_orientation(
11153 1, line_orientation[22]);
11154 new_quads[5]->set_line_orientation(
11155 2, line_orientation[1]);
11157 new_quads[6]->set_line_orientation(
11158 0, line_orientation[19]);
11159 new_quads[6]->set_line_orientation(
11160 3, line_orientation[4]);
11162 new_quads[7]->set_line_orientation(
11163 1, line_orientation[23]);
11164 new_quads[7]->set_line_orientation(
11165 3, line_orientation[5]);
11167 new_quads[8]->set_line_orientation(
11168 0, line_orientation[2]);
11169 new_quads[8]->set_line_orientation(
11170 2, line_orientation[8]);
11172 new_quads[9]->set_line_orientation(
11173 1, line_orientation[6]);
11174 new_quads[9]->set_line_orientation(
11175 2, line_orientation[9]);
11177 new_quads[10]->set_line_orientation(
11178 0, line_orientation[3]);
11179 new_quads[10]->set_line_orientation(
11180 3, line_orientation[12]);
11182 new_quads[11]->set_line_orientation(
11183 1, line_orientation[7]);
11184 new_quads[11]->set_line_orientation(
11185 3, line_orientation[13]);
11226 const int quad_indices[36] = {
11227 new_quads[0]->index(),
11228 new_quads[1]->index(),
11229 new_quads[2]->index(),
11230 new_quads[3]->index(),
11231 new_quads[4]->index(),
11232 new_quads[5]->index(),
11233 new_quads[6]->index(),
11234 new_quads[7]->index(),
11235 new_quads[8]->index(),
11236 new_quads[9]->index(),
11237 new_quads[10]->index(),
11238 new_quads[11]->index(),
11240 hex->face(0)->isotropic_child_index(
11242 0, f_or[0], f_fl[0], f_ro[0])),
11243 hex->face(0)->isotropic_child_index(
11245 1, f_or[0], f_fl[0], f_ro[0])),
11246 hex->face(0)->isotropic_child_index(
11248 2, f_or[0], f_fl[0], f_ro[0])),
11249 hex->face(0)->isotropic_child_index(
11251 3, f_or[0], f_fl[0], f_ro[0])),
11253 hex->face(1)->isotropic_child_index(
11255 0, f_or[1], f_fl[1], f_ro[1])),
11256 hex->face(1)->isotropic_child_index(
11258 1, f_or[1], f_fl[1], f_ro[1])),
11259 hex->face(1)->isotropic_child_index(
11261 2, f_or[1], f_fl[1], f_ro[1])),
11262 hex->face(1)->isotropic_child_index(
11264 3, f_or[1], f_fl[1], f_ro[1])),
11266 hex->face(2)->isotropic_child_index(
11268 0, f_or[2], f_fl[2], f_ro[2])),
11269 hex->face(2)->isotropic_child_index(
11271 1, f_or[2], f_fl[2], f_ro[2])),
11272 hex->face(2)->isotropic_child_index(
11274 2, f_or[2], f_fl[2], f_ro[2])),
11275 hex->face(2)->isotropic_child_index(
11277 3, f_or[2], f_fl[2], f_ro[2])),
11279 hex->face(3)->isotropic_child_index(
11281 0, f_or[3], f_fl[3], f_ro[3])),
11282 hex->face(3)->isotropic_child_index(
11284 1, f_or[3], f_fl[3], f_ro[3])),
11285 hex->face(3)->isotropic_child_index(
11287 2, f_or[3], f_fl[3], f_ro[3])),
11288 hex->face(3)->isotropic_child_index(
11290 3, f_or[3], f_fl[3], f_ro[3])),
11292 hex->face(4)->isotropic_child_index(
11294 0, f_or[4], f_fl[4], f_ro[4])),
11295 hex->face(4)->isotropic_child_index(
11297 1, f_or[4], f_fl[4], f_ro[4])),
11298 hex->face(4)->isotropic_child_index(
11300 2, f_or[4], f_fl[4], f_ro[4])),
11301 hex->face(4)->isotropic_child_index(
11303 3, f_or[4], f_fl[4], f_ro[4])),
11305 hex->face(5)->isotropic_child_index(
11307 0, f_or[5], f_fl[5], f_ro[5])),
11308 hex->face(5)->isotropic_child_index(
11310 1, f_or[5], f_fl[5], f_ro[5])),
11311 hex->face(5)->isotropic_child_index(
11313 2, f_or[5], f_fl[5], f_ro[5])),
11314 hex->face(5)->isotropic_child_index(
11316 3, f_or[5], f_fl[5], f_ro[5]))};
11319 new_hexes[0]->set_bounding_object_indices(
11326 new_hexes[1]->set_bounding_object_indices(
11333 new_hexes[2]->set_bounding_object_indices(
11339 quad_indices[10]});
11340 new_hexes[3]->set_bounding_object_indices(
11346 quad_indices[11]});
11349 new_hexes[4]->set_bounding_object_indices(
11355 quad_indices[32]});
11356 new_hexes[5]->set_bounding_object_indices(
11362 quad_indices[33]});
11363 new_hexes[6]->set_bounding_object_indices(
11369 quad_indices[34]});
11370 new_hexes[7]->set_bounding_object_indices(
11376 quad_indices[35]});
11410 for (
unsigned int s = 0;
11417 const unsigned int current_child =
11426 ref_case, f, f_or[f], f_fl[f], f_ro[f]));
11427 new_hexes[current_child]->set_combined_face_orientation(
11433 if (check_for_distorted_cells &&
11434 has_distorted_children<dim, spacedim>(hex))
11454 return cells_with_distorted_children;