5926 const bool check_for_distorted_cells)
5928 static const int dim = 3;
5930 using raw_line_iterator =
5932 using raw_quad_iterator =
5945 if (cell->refine_flag_set())
5971 unsigned int needed_vertices = 0;
5972 unsigned int needed_lines_single = 0;
5973 unsigned int needed_quads_single = 0;
5974 unsigned int needed_lines_pair = 0;
5975 unsigned int needed_quads_pair = 0;
5978 unsigned int new_cells = 0;
5980 for (
const auto &cell :
5982 if (cell->refine_flag_set())
5985 Assert(cell->refine_flag_set() ==
5991 new_cells += cell->reference_cell().n_isotropic_children();
5996 needed_lines_single += 6;
5997 needed_quads_single += 12;
5999 else if (cell->reference_cell() ==
6002 needed_lines_single += 1;
6003 needed_quads_single += 8;
6014 for (
const auto face : cell->face_indices())
6015 if (cell->face(face)->n_children() == 0)
6016 cell->face(face)->set_user_flag();
6018 Assert(cell->face(face)->n_children() ==
6019 cell->reference_cell()
6020 .face_reference_cell(face)
6021 .n_isotropic_children(),
6024 for (
const auto line : cell->line_indices())
6025 if (cell->line(line)->has_children() ==
false)
6026 cell->line(line)->set_user_flag();
6028 Assert(cell->line(line)->n_children() == 2,
6032 const unsigned int used_cells =
6039 used_cells + new_cells,
6045 used_cells + new_cells,
6060 if (quad->user_flag_set() ==
false)
6065 needed_quads_pair += 4;
6066 needed_lines_pair += 4;
6067 needed_vertices += 1;
6071 needed_quads_pair += 4;
6072 needed_lines_single += 3;
6085 if (line->user_flag_set() ==
false)
6088 needed_lines_pair += 2;
6089 needed_vertices += 1;
6094 needed_lines_single);
6097 needed_quads_single);
6100 needed_quads_single);
6126 if (!cell->refine_flag_set())
6127 for (
unsigned int line_n = 0; line_n < cell->n_lines(); ++line_n)
6128 if (cell->line(line_n)->has_children())
6129 for (
unsigned int c = 0; c < 2; ++c)
6130 Assert(cell->line(line_n)->child(c)->user_flag_set() ==
false,
6134 unsigned int current_vertex = 0;
6138 auto get_next_unused_vertex = [](
const unsigned int current_vertex,
6139 std::vector<bool> &vertices_used) {
6140 unsigned int next_vertex = current_vertex;
6141 while (next_vertex < vertices_used.size() &&
6142 vertices_used[next_vertex] ==
true)
6145 vertices_used[next_vertex] =
true;
6157 for (; line != endl; ++line)
6159 if (line->user_flag_set() ==
false)
6171 line->set_children(0, next_unused_line->index());
6173 const std::array<raw_line_iterator, 2> children{
6174 {next_unused_line, ++next_unused_line}};
6180 get_next_unused_vertex(current_vertex,
6184 children[0]->set_bounding_object_indices(
6185 {line->vertex_index(0), current_vertex});
6186 children[1]->set_bounding_object_indices(
6187 {current_vertex, line->vertex_index(1)});
6189 const auto manifold_id = line->manifold_id();
6190 const auto boundary_id = line->boundary_id();
6191 for (
const auto &child : children)
6193 child->set_used_flag();
6194 child->clear_children();
6196 child->clear_user_flag();
6197 child->set_boundary_id_internal(boundary_id);
6198 child->set_manifold_id(manifold_id);
6201 line->clear_user_flag();
6211 for (; quad != endq; ++quad)
6213 if (quad->user_flag_set() ==
false)
6216 const auto reference_face_type = quad->reference_cell();
6220 std::array<raw_line_iterator, 4> new_lines;
6223 for (
unsigned int l = 0; l < 2; ++l)
6225 auto next_unused_line =
6228 new_lines[2 * l] = next_unused_line;
6229 new_lines[2 * l + 1] = ++next_unused_line;
6234 for (
unsigned int l = 0; l < 3; ++l)
6244 for (
const unsigned int line : quad->line_indices())
6252 std::array<raw_quad_iterator, 4> new_quads;
6253 for (
unsigned int q = 0; q < 2; ++q)
6255 auto next_unused_quad =
6259 new_quads[2 * q] = next_unused_quad;
6260 new_quads[2 * q + 1] = ++next_unused_quad;
6262 quad->set_children(2 * q, new_quads[2 * q]->
index());
6266 for (
const auto &quad : new_quads)
6278 for (
const auto i : quad->vertex_indices())
6281 for (
const auto i : quad->line_indices())
6287 get_next_unused_vertex(current_vertex,
6292 quad->center(
true,
true);
6296 std::array<raw_line_iterator, 12> lines;
6297 unsigned int n_lines = 0;
6298 for (
unsigned int l = 0; l < quad->
n_lines(); ++l)
6299 for (
unsigned int c = 0; c < 2; ++c)
6301 static constexpr ::ndarray<unsigned int, 2, 2>
index =
6308 quad->line(l)->child(
index[c][quad->line_orientation(l)]);
6311 for (
unsigned int l = 0; l < quad->
n_lines(); ++l)
6312 lines[n_lines++] = new_lines[l];
6314 std::array<int, 12> line_indices;
6315 for (
unsigned int i = 0; i < n_lines; ++i)
6316 line_indices[i] = lines[i]->
index();
6318 static constexpr ::ndarray<unsigned int, 12, 2>
6319 line_vertices_quad{{{{0, 4}},
6332 static constexpr ::ndarray<unsigned int, 4, 4>
6333 quad_lines_quad{{{{0, 8, 4, 10}},
6338 static constexpr ::ndarray<unsigned int, 12, 2>
6339 line_vertices_tri{{{{0, 3}},
6352 static constexpr ::ndarray<unsigned int, 4, 4>
6353 quad_lines_tri{{{{0, 8, 5, X}},
6358 static constexpr ::ndarray<unsigned int, 4, 4, 2>
6359 quad_line_vertices_tri{
6360 {{{{{0, 3}}, {{3, 5}}, {{5, 0}}, {{X, X}}}},
6361 {{{{3, 1}}, {{1, 4}}, {{4, 3}}, {{X, X}}}},
6362 {{{{5, 4}}, {{4, 2}}, {{2, 5}}, {{X, X}}}},
6363 {{{{3, 4}}, {{4, 5}}, {{5, 3}}, {{X, X}}}}}};
6365 const auto &line_vertices =
6367 line_vertices_quad :
6369 const auto &quad_lines =
6374 for (
unsigned int i = 0, j = 2 * quad->
n_lines();
6378 auto &new_line = new_lines[i];
6379 new_line->set_bounding_object_indices(
6382 new_line->set_used_flag();
6383 new_line->clear_user_flag();
6384 new_line->clear_user_data();
6385 new_line->clear_children();
6386 new_line->set_boundary_id_internal(quad->boundary_id());
6387 new_line->set_manifold_id(quad->manifold_id());
6391 for (
unsigned int i = 0; i < new_quads.size(); ++i)
6393 auto &new_quad = new_quads[i];
6398 reference_face_type);
6401 new_quad->set_bounding_object_indices(
6402 {line_indices[quad_lines[i][0]],
6403 line_indices[quad_lines[i][1]],
6404 line_indices[quad_lines[i][2]]});
6406 new_quad->set_bounding_object_indices(
6407 {line_indices[quad_lines[i][0]],
6408 line_indices[quad_lines[i][1]],
6409 line_indices[quad_lines[i][2]],
6410 line_indices[quad_lines[i][3]]});
6414 new_quad->set_used_flag();
6415 new_quad->clear_user_flag();
6416 new_quad->clear_user_data();
6417 new_quad->clear_children();
6418 new_quad->set_boundary_id_internal(quad->boundary_id());
6419 new_quad->set_manifold_id(quad->manifold_id());
6422 std::set<unsigned int> s;
6430 for (
const auto f : new_quad->line_indices())
6432 const std::array<unsigned int, 2> vertices_0 = {
6433 {lines[quad_lines[i][f]]->vertex_index(0),
6434 lines[quad_lines[i][f]]->vertex_index(1)}};
6436 const std::array<unsigned int, 2> vertices_1 = {
6440 const auto orientation =
6446 for (
const auto i : vertices_0)
6448 for (
const auto i : vertices_1)
6452 new_quad->set_line_orientation(
6456 default_combined_face_orientation());
6468 static constexpr ::ndarray<unsigned int, 4, 2>
6469 quad_child_boundary_lines{
6470 {{{0, 2}}, {{1, 3}}, {{0, 1}}, {{2, 3}}}};
6472 for (
unsigned int i = 0; i < 4; ++i)
6473 for (
unsigned int j = 0; j < 2; ++j)
6474 new_quads[quad_child_boundary_lines[i][j]]
6475 ->set_line_orientation(i, quad->line_orientation(i));
6478 quad->clear_user_flag();
6483 cells_with_distorted_children;
6493 hex->level() >=
static_cast<int>(
level),
6497 hex->level() ==
static_cast<int>(
level);
6500 if (hex->refine_flag_set() ==
6504 const auto &reference_cell_type = hex->reference_cell();
6507 hex->clear_refine_flag();
6508 hex->set_refinement_case(ref_case);
6510 unsigned int n_new_lines = 0;
6511 unsigned int n_new_quads = 0;
6512 unsigned int n_new_hexes = 0;
6529 std::array<raw_line_iterator, 6> new_lines;
6530 for (
unsigned int i = 0; i < n_new_lines; ++i)
6537 new_lines[i]->set_used_flag();
6538 new_lines[i]->clear_user_flag();
6539 new_lines[i]->clear_user_data();
6540 new_lines[i]->clear_children();
6541 new_lines[i]->set_boundary_id_internal(
6543 new_lines[i]->set_manifold_id(hex->manifold_id());
6546 std::array<raw_quad_iterator, 12> new_quads;
6547 for (
unsigned int i = 0; i < n_new_quads; ++i)
6553 auto &new_quad = new_quads[i];
6559 reference_cell_type.face_reference_cell(0));
6562 new_quad->set_used_flag();
6563 new_quad->clear_user_flag();
6564 new_quad->clear_user_data();
6565 new_quad->clear_children();
6566 new_quad->set_boundary_id_internal(
6568 new_quad->set_manifold_id(hex->manifold_id());
6569 for (
const auto j : new_quads[i]->line_indices())
6570 new_quad->set_line_orientation(j,
true);
6579 for (
unsigned int i = 0; i < n_new_hexes; ++i)
6588 new_hexes[i] = next_unused_hex;
6590 auto &new_hex = new_hexes[i];
6594 ->reference_cell[new_hex->index()] =
6595 reference_cell_type;
6598 new_hex->set_used_flag();
6599 new_hex->clear_user_flag();
6600 new_hex->clear_user_data();
6601 new_hex->clear_children();
6602 new_hex->set_material_id(hex->material_id());
6603 new_hex->set_manifold_id(hex->manifold_id());
6604 new_hex->set_subdomain_id(hex->subdomain_id());
6607 new_hex->set_parent(hex->index());
6612 for (
const auto f : new_hex->face_indices())
6613 new_hex->set_combined_face_orientation(
6617 for (
unsigned int i = 0; i < n_new_hexes / 2; ++i)
6618 hex->set_children(2 * i, new_hexes[2 * i]->index());
6630 const unsigned int n_vertices =
6632 for (
unsigned int i = 0; i < n_vertices; ++i)
6635 const std::array<unsigned int, 12> line_indices =
6636 TriaAccessorImplementation::Implementation::
6637 get_line_indices_of_cell(*hex);
6649 for (
unsigned int l = 0; l < n_lines; ++l)
6659 for (
const unsigned int i : hex->face_indices())
6661 hex->face(i)->child(0)->vertex_index(3);
6665 get_next_unused_vertex(current_vertex,
6670 hex->center(
true,
true);
6674 unsigned int chosen_line_tetrahedron = 0;
6678 static constexpr ::ndarray<unsigned int, 6, 2>
6679 new_line_vertices = {{{{22, 26}},
6685 for (
unsigned int i = 0; i < n_new_lines; ++i)
6686 new_lines[i]->set_bounding_object_indices(
6696 static constexpr ::ndarray<unsigned int, 3, 2>
6697 new_line_vertices = {{{{6, 8}}, {{5, 7}}, {{4, 9}}}};
6701 std::uint8_t refinement_choice = hex->refine_choice();
6702 if (refinement_choice ==
6707 double min_distance =
6708 std::numeric_limits<double>::infinity();
6709 for (
unsigned int i = 0; i < new_line_vertices.size();
6712 const double current_distance =
6717 [new_line_vertices[i][1]]]);
6718 if (current_distance < min_distance)
6720 chosen_line_tetrahedron = i;
6721 min_distance = current_distance;
6725 else if (refinement_choice ==
6728 chosen_line_tetrahedron = 0;
6729 else if (refinement_choice ==
6732 chosen_line_tetrahedron = 1;
6733 else if (refinement_choice ==
6736 chosen_line_tetrahedron = 2;
6740 hex->set_refinement_case(
6743 new_lines[0]->set_bounding_object_indices(
6745 [new_line_vertices[chosen_line_tetrahedron][0]],
6747 [new_line_vertices[chosen_line_tetrahedron][1]]});
6752 boost::container::small_vector<raw_line_iterator, 30>
6757 relevant_lines.resize(30);
6758 for (
unsigned int f = 0, k = 0; f < 6; ++f)
6759 for (
unsigned int c = 0; c < 4; ++c, ++k)
6762 ndarray<unsigned int, 4, 2>
6764 {{{0, 1}}, {{3, 0}}, {{0, 3}}, {{3, 2}}}};
6770 standard_to_real_face_vertex(
6772 hex->face_orientation(f),
6774 hex->face_rotation(f)))
6776 standard_to_real_face_line(
6778 hex->face_orientation(f),
6780 hex->face_rotation(f)));
6783 for (
unsigned int i = 0, k = 24; i < 6; ++i, ++k)
6784 relevant_lines[k] = new_lines[i];
6799 relevant_lines.resize(13);
6802 for (
unsigned int f = 0; f < 4; ++f)
6803 for (
unsigned int l = 0; l < 3; ++l, ++k)
6807 array<std::array<unsigned int, 3>, 6>
6808 table = {{{{1, 0, 2}},
6815 const unsigned char combined_orientation =
6816 hex->combined_face_orientation(f);
6820 ->line(table[combined_orientation][l]);
6823 relevant_lines[k++] = new_lines[0];
6829 boost::container::small_vector<unsigned int, 30>
6830 relevant_line_indices(relevant_lines.size());
6831 for (
unsigned int i = 0; i < relevant_line_indices.size();
6833 relevant_line_indices[i] = relevant_lines[i]->
index();
6842 const auto &new_quad_lines =
6843 hex->reference_cell().new_isotropic_child_face_lines(
6844 chosen_line_tetrahedron);
6857 hex->reference_cell()
6858 .new_isotropic_child_face_line_vertices(
6859 chosen_line_tetrahedron);
6861 static constexpr ::ndarray<unsigned int, 4, 2>
6862 representative_lines{
6863 {{{0, 2}}, {{2, 0}}, {{3, 3}}, {{1, 1}}}};
6865 for (
unsigned int q = 0; q < n_new_quads; ++q)
6867 auto &new_quad = new_quads[q];
6869 if (new_quad->n_lines() == 3)
6870 new_quad->set_bounding_object_indices(
6871 {relevant_line_indices[new_quad_lines[q][0]],
6872 relevant_line_indices[new_quad_lines[q][1]],
6873 relevant_line_indices[new_quad_lines[q][2]]});
6874 else if (new_quad->n_lines() == 4)
6875 new_quad->set_bounding_object_indices(
6876 {relevant_line_indices[new_quad_lines[q][0]],
6877 relevant_line_indices[new_quad_lines[q][1]],
6878 relevant_line_indices[new_quad_lines[q][2]],
6879 relevant_line_indices[new_quad_lines[q][3]]});
6887 const unsigned int n_compute_lines =
6891 for (
unsigned int line = 0; line < n_compute_lines;
6894 const unsigned int l =
6895 (reference_cell_type ==
6897 representative_lines[q % 4][0] :
6900 const std::array<unsigned int, 2> vertices_0 = {
6901 {relevant_lines[new_quad_lines[q][l]]
6903 relevant_lines[new_quad_lines[q][l]]
6904 ->vertex_index(1)}};
6906 const std::array<unsigned int, 2> vertices_1 = {
6910 const auto orientation =
6915 new_quad->set_line_orientation(
6919 default_combined_face_orientation());
6924 if (reference_cell_type ==
6926 new_quads[representative_lines[q % 4][1] + q -
6928 ->set_line_orientation(
6932 default_combined_face_orientation());
6939 std::array<int, 36> quad_indices;
6943 for (
unsigned int i = 0; i < n_new_quads; ++i)
6944 quad_indices[i] = new_quads[i]->
index();
6946 for (
unsigned int f = 0, k = n_new_quads; f < 6; ++f)
6947 for (
unsigned int c = 0; c < 4; ++c, ++k)
6949 hex->face(f)->isotropic_child_index(
6952 hex->face_orientation(f),
6954 hex->face_rotation(f)));
6964 for (
unsigned int i = 0; i < n_new_quads; ++i)
6965 quad_indices[i] = new_quads[i]->
index();
6967 for (
unsigned int f = 0, k = n_new_quads; f < 4; ++f)
6968 for (
unsigned int c = 0; c < 4; ++c, ++k)
6970 const unsigned char combined_orientation =
6971 hex->combined_face_orientation(f);
6972 quad_indices[k] = hex->face(f)->child_index(
6975 .standard_to_real_face_vertex(
6976 c, f, combined_orientation));
6992 const auto &cell_quads =
6993 hex->reference_cell().new_isotropic_child_cell_faces(
6994 chosen_line_tetrahedron);
6996 for (
unsigned int c = 0;
6997 c < GeometryInfo<dim>::max_children_per_cell;
7000 auto &new_hex = new_hexes[c];
7002 if (new_hex->n_faces() == 4)
7004 new_hex->set_bounding_object_indices(
7005 {quad_indices[cell_quads[c][0]],
7006 quad_indices[cell_quads[c][1]],
7007 quad_indices[cell_quads[c][2]],
7008 quad_indices[cell_quads[c][3]]});
7013 for (
const auto f : new_hex->face_indices())
7015 const auto &face = new_hex->face(f);
7017 Assert(face->n_vertices() == 3,
7020 const std::array<unsigned int, 3> vertices_0 = {
7021 {face->vertex_index(0),
7022 face->vertex_index(1),
7023 face->vertex_index(2)}};
7032 const auto new_hex_vertices =
7033 hex->reference_cell()
7034 .new_isotropic_child_cell_vertices(
7035 chosen_line_tetrahedron)[c];
7039 const std::array<unsigned int, 3> vertices_1 = {
7055 new_hex->set_combined_face_orientation(
7057 face->reference_cell()
7058 .get_combined_orientation(
7063 else if (new_hex->n_faces() == 6)
7064 new_hex->set_bounding_object_indices(
7065 {quad_indices[cell_quads[c][0]],
7066 quad_indices[cell_quads[c][1]],
7067 quad_indices[cell_quads[c][2]],
7068 quad_indices[cell_quads[c][3]],
7069 quad_indices[cell_quads[c][4]],
7070 quad_indices[cell_quads[c][5]]});
7079 static constexpr ::ndarray<unsigned int, 6, 4>
7080 face_to_child_indices_hex{{{{0, 2, 4, 6}},
7087 for (
const auto f : hex->face_indices())
7089 const unsigned char combined_orientation =
7090 hex->combined_face_orientation(f);
7091 for (
unsigned int c = 0; c < 4; ++c)
7092 new_hexes[face_to_child_indices_hex[f][c]]
7093 ->set_combined_face_orientation(
7094 f, combined_orientation);
7099 if (check_for_distorted_cells &&
7100 has_distorted_children<dim, spacedim>(hex))
7109 return cells_with_distorted_children;
7119 const bool check_for_distorted_cells)
7121 const unsigned int dim = 3;
7124 bool flag_isotropic_mesh =
true;
7128 for (; cell != endc; ++cell)
7138 flag_isotropic_mesh =
false;
7142 if (flag_isotropic_mesh)
7144 check_for_distorted_cells);
7157 if (cell->refine_flag_set())
7174 line->clear_user_flag();
7179 quad->clear_user_flag();
7202 unsigned int needed_vertices = 0;
7203 unsigned int needed_lines_single = 0;
7204 unsigned int needed_quads_single = 0;
7205 unsigned int needed_lines_pair = 0;
7206 unsigned int needed_quads_pair = 0;
7211 unsigned int new_cells = 0;
7213 for (
const auto &acell :
7215 if (acell->refine_flag_set())
7225 ++needed_quads_single;
7233 ++needed_lines_single;
7234 needed_quads_single += 4;
7241 needed_lines_single += 6;
7242 needed_quads_single += 12;
7256 for (
const unsigned int face :
7260 aface = acell->face(face);
7267 acell->face_orientation(face),
7268 acell->face_flip(face),
7269 acell->face_rotation(face));
7274 if (face_ref_case ==
7277 if (aface->n_active_descendants() < 4)
7280 aface->set_user_flag();
7282 else if (aface->refinement_case() != face_ref_case)
7293 Assert(aface->refinement_case() ==
7296 aface->refinement_case() ==
7299 aface->set_user_index(face_ref_case);
7305 for (
unsigned int line = 0;
7306 line < GeometryInfo<dim>::lines_per_cell;
7310 !acell->line(line)->has_children())
7311 acell->line(line)->set_user_flag();
7317 const unsigned int used_cells =
7327 used_cells + new_cells,
7341 if (quad->user_flag_set())
7347 needed_quads_pair += 4;
7348 needed_lines_pair += 4;
7349 needed_vertices += 1;
7351 if (quad->user_index())
7355 needed_quads_pair += 2;
7356 needed_lines_single += 1;
7369 if (quad->has_children())
7371 Assert(quad->refinement_case() ==
7374 if ((face_refinement_cases[quad->user_index()] ==
7376 (quad->child(0)->line_index(1) + 1 !=
7377 quad->child(2)->line_index(1))) ||
7378 (face_refinement_cases[quad->user_index()] ==
7380 (quad->child(0)->line_index(3) + 1 !=
7381 quad->child(1)->line_index(3))))
7382 needed_lines_pair += 2;
7391 if (line->user_flag_set())
7393 needed_lines_pair += 2;
7394 needed_vertices += 1;
7400 needed_lines_single);
7404 needed_quads_single);
7407 needed_quads_single);
7436 if (!cell->refine_flag_set())
7437 for (
unsigned int line = 0;
7438 line < GeometryInfo<dim>::lines_per_cell;
7440 if (cell->line(line)->has_children())
7441 for (
unsigned int c = 0; c < 2; ++c)
7442 Assert(cell->line(line)->child(c)->user_flag_set() ==
false,
7454 unsigned int next_unused_vertex = 0;
7465 for (; line != endl; ++line)
7466 if (line->user_flag_set())
7473 ++next_unused_vertex;
7477 "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."));
7494 line->set_children(0, next_unused_line->index());
7498 children[2] = {next_unused_line, ++next_unused_line};
7505 children[0]->set_bounding_object_indices(
7506 {line->vertex_index(0), next_unused_vertex});
7507 children[1]->set_bounding_object_indices(
7508 {next_unused_vertex, line->vertex_index(1)});
7510 children[0]->set_used_flag();
7511 children[1]->set_used_flag();
7512 children[0]->clear_children();
7513 children[1]->clear_children();
7516 children[0]->clear_user_flag();
7517 children[1]->clear_user_flag();
7519 children[0]->set_boundary_id_internal(line->boundary_id());
7520 children[1]->set_boundary_id_internal(line->boundary_id());
7522 children[0]->set_manifold_id(line->manifold_id());
7523 children[1]->set_manifold_id(line->manifold_id());
7528 line->clear_user_flag();
7558 for (
unsigned int loop = 0; loop < 2; ++loop)
7571 for (; quad != endq; ++quad)
7573 if (quad->user_index())
7576 face_refinement_cases[quad->user_index()];
7585 if (aniso_quad_ref_case == quad->refinement_case())
7588 Assert(quad->refinement_case() ==
7590 quad->refinement_case() ==
7595 Assert(quad->user_index() ==
7597 quad->user_index() ==
7627 quad->line(2)->child(0)->vertex_index(1);
7629 quad->line(3)->child(0)->vertex_index(1);
7634 quad->line(0)->child(0)->vertex_index(1);
7636 quad->line(1)->child(0)->vertex_index(1);
7639 new_line->set_bounding_object_indices(
7641 new_line->set_used_flag();
7642 new_line->clear_user_flag();
7644 new_line->clear_children();
7645 new_line->set_boundary_id_internal(quad->boundary_id());
7646 new_line->set_manifold_id(quad->manifold_id());
7654 const unsigned int index[2][2] = {
7666 new_quads[0] = next_unused_quad;
7670 new_quads[1] = next_unused_quad;
7675 new_quads[0]->set_bounding_object_indices(
7676 {
static_cast<int>(quad->line_index(0)),
7679 ->child(
index[0][quad->line_orientation(2)])
7682 ->child(
index[0][quad->line_orientation(3)])
7684 new_quads[1]->set_bounding_object_indices(
7686 static_cast<int>(quad->line_index(1)),
7688 ->child(
index[1][quad->line_orientation(2)])
7691 ->child(
index[1][quad->line_orientation(3)])
7696 new_quads[0]->set_bounding_object_indices(
7698 ->child(
index[0][quad->line_orientation(0)])
7701 ->child(
index[0][quad->line_orientation(1)])
7703 static_cast<int>(quad->line_index(2)),
7704 new_line->index()});
7705 new_quads[1]->set_bounding_object_indices(
7707 ->child(
index[1][quad->line_orientation(0)])
7710 ->child(
index[1][quad->line_orientation(1)])
7713 static_cast<int>(quad->line_index(3))});
7716 for (
const auto &new_quad : new_quads)
7718 new_quad->set_used_flag();
7719 new_quad->clear_user_flag();
7721 new_quad->clear_children();
7722 new_quad->set_boundary_id_internal(quad->boundary_id());
7723 new_quad->set_manifold_id(quad->manifold_id());
7727 for (
unsigned int j = 0;
7728 j < GeometryInfo<dim>::lines_per_face;
7730 new_quad->set_line_orientation(j,
true);
7736 new_quads[0]->set_line_orientation(
7737 0, quad->line_orientation(0));
7738 new_quads[0]->set_line_orientation(
7739 2, quad->line_orientation(2));
7740 new_quads[1]->set_line_orientation(
7741 1, quad->line_orientation(1));
7742 new_quads[1]->set_line_orientation(
7743 3, quad->line_orientation(3));
7746 new_quads[0]->set_line_orientation(
7747 3, quad->line_orientation(3));
7748 new_quads[1]->set_line_orientation(
7749 2, quad->line_orientation(2));
7753 new_quads[0]->set_line_orientation(
7754 1, quad->line_orientation(1));
7755 new_quads[1]->set_line_orientation(
7756 0, quad->line_orientation(0));
7762 if (quad->refinement_case() ==
7785 if (aniso_quad_ref_case ==
7788 old_child[0] = quad->child(0)->line(1);
7789 old_child[1] = quad->child(2)->line(1);
7793 Assert(aniso_quad_ref_case ==
7797 old_child[0] = quad->child(0)->line(3);
7798 old_child[1] = quad->child(1)->line(3);
7801 if (old_child[0]->
index() + 1 != old_child[1]->
index())
7807 spacedim>::raw_line_iterator
7810 new_child[0] = new_child[1] =
7812 .template next_free_pair_object<1>(
7816 new_child[0]->set_used_flag();
7817 new_child[1]->set_used_flag();
7819 const int old_index_0 = old_child[0]->index(),
7820 old_index_1 = old_child[1]->index(),
7821 new_index_0 = new_child[0]->index(),
7822 new_index_1 = new_child[1]->index();
7826 for (
unsigned int q = 0;
7829 for (
unsigned int l = 0;
7830 l < GeometryInfo<dim>::lines_per_face;
7833 const int this_index =
7835 .get_bounding_object_indices(q)[l];
7836 if (this_index == old_index_0)
7838 .get_bounding_object_indices(q)[l] =
7840 else if (this_index == old_index_1)
7842 .get_bounding_object_indices(q)[l] =
7847 for (
unsigned int i = 0; i < 2; ++i)
7849 Assert(!old_child[i]->has_children(),
7852 new_child[i]->set_bounding_object_indices(
7853 {old_child[i]->vertex_index(0),
7854 old_child[i]->vertex_index(1)});
7855 new_child[i]->set_boundary_id_internal(
7856 old_child[i]->boundary_id());
7857 new_child[i]->set_manifold_id(
7858 old_child[i]->manifold_id());
7859 new_child[i]->set_user_index(
7860 old_child[i]->user_index());
7861 if (old_child[i]->user_flag_set())
7862 new_child[i]->set_user_flag();
7864 new_child[i]->clear_user_flag();
7866 new_child[i]->clear_children();
7868 old_child[i]->clear_user_flag();
7869 old_child[i]->clear_user_index();
7870 old_child[i]->clear_used_flag();
7876 if (aniso_quad_ref_case ==
7879 new_line->set_children(
7880 0, quad->child(0)->line_index(1));
7881 Assert(new_line->child(1) ==
7882 quad->child(2)->line(1),
7919 quad_iterator switch_1 = quad->child(1),
7920 switch_2 = quad->child(2);
7921 const int switch_1_index = switch_1->index();
7922 const int switch_2_index = switch_2->index();
7923 for (
unsigned int l = 0;
7926 for (
unsigned int h = 0;
7930 for (
const unsigned int q :
7933 const int face_index =
7935 ->cells.get_bounding_object_indices(
7937 if (face_index == switch_1_index)
7939 ->cells.get_bounding_object_indices(
7940 h)[q] = switch_2_index;
7941 else if (face_index == switch_2_index)
7943 ->cells.get_bounding_object_indices(
7944 h)[q] = switch_1_index;
7948 const unsigned int switch_1_lines[4] = {
7949 switch_1->line_index(0),
7950 switch_1->line_index(1),
7951 switch_1->line_index(2),
7952 switch_1->line_index(3)};
7953 const bool switch_1_line_orientations[4] = {
7954 switch_1->line_orientation(0),
7955 switch_1->line_orientation(1),
7956 switch_1->line_orientation(2),
7957 switch_1->line_orientation(3)};
7959 switch_1->boundary_id();
7960 const unsigned int switch_1_user_index =
7961 switch_1->user_index();
7962 const bool switch_1_user_flag =
7963 switch_1->user_flag_set();
7965 switch_1_refinement_case =
7966 switch_1->refinement_case();
7967 const int switch_1_first_child_pair =
7968 (switch_1_refinement_case ?
7969 switch_1->child_index(0) :
7971 const int switch_1_second_child_pair =
7972 (switch_1_refinement_case ==
7974 switch_1->child_index(2) :
7977 switch_1->set_bounding_object_indices(
7978 {switch_2->line_index(0),
7979 switch_2->line_index(1),
7980 switch_2->line_index(2),
7981 switch_2->line_index(3)});
7982 switch_1->set_line_orientation(
7983 0, switch_2->line_orientation(0));
7984 switch_1->set_line_orientation(
7985 1, switch_2->line_orientation(1));
7986 switch_1->set_line_orientation(
7987 2, switch_2->line_orientation(2));
7988 switch_1->set_line_orientation(
7989 3, switch_2->line_orientation(3));
7990 switch_1->set_boundary_id_internal(
7991 switch_2->boundary_id());
7992 switch_1->set_manifold_id(switch_2->manifold_id());
7993 switch_1->set_user_index(switch_2->user_index());
7994 if (switch_2->user_flag_set())
7995 switch_1->set_user_flag();
7997 switch_1->clear_user_flag();
7998 switch_1->clear_refinement_case();
7999 switch_1->set_refinement_case(
8000 switch_2->refinement_case());
8001 switch_1->clear_children();
8002 if (switch_2->refinement_case())
8003 switch_1->set_children(0,
8004 switch_2->child_index(0));
8005 if (switch_2->refinement_case() ==
8007 switch_1->set_children(2,
8008 switch_2->child_index(2));
8010 switch_2->set_bounding_object_indices(
8014 switch_1_lines[3]});
8015 switch_2->set_line_orientation(
8016 0, switch_1_line_orientations[0]);
8017 switch_2->set_line_orientation(
8018 1, switch_1_line_orientations[1]);
8019 switch_2->set_line_orientation(
8020 2, switch_1_line_orientations[2]);
8021 switch_2->set_line_orientation(
8022 3, switch_1_line_orientations[3]);
8023 switch_2->set_boundary_id_internal(
8024 switch_1_boundary_id);
8025 switch_2->set_manifold_id(switch_1->manifold_id());
8026 switch_2->set_user_index(switch_1_user_index);
8027 if (switch_1_user_flag)
8028 switch_2->set_user_flag();
8030 switch_2->clear_user_flag();
8031 switch_2->clear_refinement_case();
8032 switch_2->set_refinement_case(
8033 switch_1_refinement_case);
8034 switch_2->clear_children();
8035 switch_2->set_children(0,
8036 switch_1_first_child_pair);
8037 switch_2->set_children(2,
8038 switch_1_second_child_pair);
8040 new_quads[0]->set_refinement_case(
8042 new_quads[0]->set_children(0, quad->child_index(0));
8043 new_quads[1]->set_refinement_case(
8045 new_quads[1]->set_children(0, quad->child_index(2));
8049 new_quads[0]->set_refinement_case(
8051 new_quads[0]->set_children(0, quad->child_index(0));
8052 new_quads[1]->set_refinement_case(
8054 new_quads[1]->set_children(0, quad->child_index(2));
8055 new_line->set_children(
8056 0, quad->child(0)->line_index(3));
8057 Assert(new_line->child(1) ==
8058 quad->child(1)->line(3),
8061 quad->clear_children();
8065 quad->set_children(0, new_quads[0]->
index());
8067 quad->set_refinement_case(aniso_quad_ref_case);
8074 if (quad->user_flag_set())
8086 ++next_unused_vertex;
8090 "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."));
8098 quad->refinement_case();
8104 quad->child(0)->set_user_index(
8106 quad->child(1)->set_user_index(
8112 middle_line = quad->child(0)->line(1);
8114 middle_line = quad->child(0)->line(3);
8121 if (!middle_line->has_children())
8129 middle_line->center(
true);
8137 .template next_free_pair_object<1>(
8142 middle_line->set_children(
8143 0, next_unused_line->index());
8147 raw_line_iterator children[2] = {
8148 next_unused_line, ++next_unused_line};
8156 children[0]->set_bounding_object_indices(
8157 {middle_line->vertex_index(0),
8158 next_unused_vertex});
8159 children[1]->set_bounding_object_indices(
8160 {next_unused_vertex,
8161 middle_line->vertex_index(1)});
8163 children[0]->set_used_flag();
8164 children[1]->set_used_flag();
8165 children[0]->clear_children();
8166 children[1]->clear_children();
8169 children[0]->clear_user_flag();
8170 children[1]->clear_user_flag();
8172 children[0]->set_boundary_id_internal(
8173 middle_line->boundary_id());
8174 children[1]->set_boundary_id_internal(
8175 middle_line->boundary_id());
8177 children[0]->set_manifold_id(
8178 middle_line->manifold_id());
8179 children[1]->set_manifold_id(
8180 middle_line->manifold_id());
8186 quad->clear_user_flag();
8216 quad->center(
true,
true);
8225 for (
unsigned int i = 0; i < 4; ++i)
8238 new_lines[i] = next_unused_line;
8262 quad->line(0)->child(0)->vertex_index(1),
8263 quad->line(1)->child(0)->vertex_index(1),
8264 quad->line(2)->child(0)->vertex_index(1),
8265 quad->line(3)->child(0)->vertex_index(1),
8266 next_unused_vertex};
8268 new_lines[0]->set_bounding_object_indices(
8270 new_lines[1]->set_bounding_object_indices(
8272 new_lines[2]->set_bounding_object_indices(
8274 new_lines[3]->set_bounding_object_indices(
8277 for (
const auto &new_line : new_lines)
8279 new_line->set_used_flag();
8280 new_line->clear_user_flag();
8282 new_line->clear_children();
8283 new_line->set_boundary_id_internal(quad->boundary_id());
8284 new_line->set_manifold_id(quad->manifold_id());
8303 const unsigned int index[2][2] = {
8307 const int line_indices[12] = {
8309 ->child(
index[0][quad->line_orientation(0)])
8312 ->child(
index[1][quad->line_orientation(0)])
8315 ->child(
index[0][quad->line_orientation(1)])
8318 ->child(
index[1][quad->line_orientation(1)])
8321 ->child(
index[0][quad->line_orientation(2)])
8324 ->child(
index[1][quad->line_orientation(2)])
8327 ->child(
index[0][quad->line_orientation(3)])
8330 ->child(
index[1][quad->line_orientation(3)])
8332 new_lines[0]->index(),
8333 new_lines[1]->index(),
8334 new_lines[2]->index(),
8335 new_lines[3]->index()};
8347 new_quads[0] = next_unused_quad;
8351 new_quads[1] = next_unused_quad;
8357 new_quads[2] = next_unused_quad;
8361 new_quads[3] = next_unused_quad;
8365 quad->set_children(0, new_quads[0]->
index());
8366 quad->set_children(2, new_quads[2]->
index());
8369 new_quads[0]->set_bounding_object_indices(
8374 new_quads[1]->set_bounding_object_indices(
8379 new_quads[2]->set_bounding_object_indices(
8384 new_quads[3]->set_bounding_object_indices(
8389 for (
const auto &new_quad : new_quads)
8391 new_quad->set_used_flag();
8392 new_quad->clear_user_flag();
8394 new_quad->clear_children();
8395 new_quad->set_boundary_id_internal(quad->boundary_id());
8396 new_quad->set_manifold_id(quad->manifold_id());
8400 for (
unsigned int j = 0;
8401 j < GeometryInfo<dim>::lines_per_face;
8403 new_quad->set_line_orientation(j,
true);
8409 new_quads[0]->set_line_orientation(
8410 0, quad->line_orientation(0));
8411 new_quads[0]->set_line_orientation(
8412 2, quad->line_orientation(2));
8413 new_quads[1]->set_line_orientation(
8414 1, quad->line_orientation(1));
8415 new_quads[1]->set_line_orientation(
8416 2, quad->line_orientation(2));
8417 new_quads[2]->set_line_orientation(
8418 0, quad->line_orientation(0));
8419 new_quads[2]->set_line_orientation(
8420 3, quad->line_orientation(3));
8421 new_quads[3]->set_line_orientation(
8422 1, quad->line_orientation(1));
8423 new_quads[3]->set_line_orientation(
8424 3, quad->line_orientation(3));
8428 quad->clear_user_flag();
8439 cells_with_distorted_children;
8453 for (; hex != endh; ++hex)
8454 if (hex->refine_flag_set())
8462 hex->clear_refine_flag();
8463 hex->set_refinement_case(ref_case);
8474 unsigned int n_new_lines = 0;
8475 unsigned int n_new_quads = 0;
8476 unsigned int n_new_hexes = 0;
8507 new_lines(n_new_lines);
8508 for (
unsigned int i = 0; i < n_new_lines; ++i)
8515 new_lines[i]->set_used_flag();
8516 new_lines[i]->clear_user_flag();
8517 new_lines[i]->clear_user_data();
8518 new_lines[i]->clear_children();
8520 new_lines[i]->set_boundary_id_internal(
8524 new_lines[i]->set_manifold_id(hex->manifold_id());
8531 new_quads(n_new_quads);
8532 for (
unsigned int i = 0; i < n_new_quads; ++i)
8539 new_quads[i]->set_used_flag();
8540 new_quads[i]->clear_user_flag();
8541 new_quads[i]->clear_user_data();
8542 new_quads[i]->clear_children();
8544 new_quads[i]->set_boundary_id_internal(
8548 new_quads[i]->set_manifold_id(hex->manifold_id());
8551 for (
unsigned int j = 0;
8552 j < GeometryInfo<dim>::lines_per_face;
8554 new_quads[i]->set_line_orientation(j,
true);
8563 new_hexes(n_new_hexes);
8564 for (
unsigned int i = 0; i < n_new_hexes; ++i)
8573 new_hexes[i] = next_unused_hex;
8576 new_hexes[i]->set_used_flag();
8577 new_hexes[i]->clear_user_flag();
8578 new_hexes[i]->clear_user_data();
8579 new_hexes[i]->clear_children();
8582 new_hexes[i]->set_material_id(hex->material_id());
8583 new_hexes[i]->set_manifold_id(hex->manifold_id());
8584 new_hexes[i]->set_subdomain_id(subdomainid);
8587 new_hexes[i]->set_parent(hex->index());
8599 for (
const unsigned int f :
8601 new_hexes[i]->set_combined_face_orientation(
8606 for (
unsigned int i = 0; i < n_new_hexes / 2; ++i)
8607 hex->set_children(2 * i, new_hexes[2 * i]->index());
8614 const bool f_or[6] = {hex->face_orientation(0),
8615 hex->face_orientation(1),
8616 hex->face_orientation(2),
8617 hex->face_orientation(3),
8618 hex->face_orientation(4),
8619 hex->face_orientation(5)};
8622 const bool f_fl[6] = {hex->face_flip(0),
8630 const bool f_ro[6] = {hex->face_rotation(0),
8631 hex->face_rotation(1),
8632 hex->face_rotation(2),
8633 hex->face_rotation(3),
8634 hex->face_rotation(4),
8635 hex->face_rotation(5)};
8638 const unsigned char f_co[6] = {
8639 hex->combined_face_orientation(0),
8640 hex->combined_face_orientation(1),
8641 hex->combined_face_orientation(2),
8642 hex->combined_face_orientation(3),
8643 hex->combined_face_orientation(4),
8644 hex->combined_face_orientation(5)};
8654 const unsigned int child_at_origin[2][2][2] = {
8741 raw_line_iterator lines[4] = {
8742 hex->face(2)->child(0)->line(
8743 (hex->face(2)->refinement_case() ==
8747 hex->face(3)->child(0)->line(
8748 (hex->face(3)->refinement_case() ==
8752 hex->face(4)->child(0)->line(
8753 (hex->face(4)->refinement_case() ==
8757 hex->face(5)->child(0)->line(
8758 (hex->face(5)->refinement_case() ==
8764 unsigned int line_indices[4];
8765 for (
unsigned int i = 0; i < 4; ++i)
8766 line_indices[i] = lines[i]->
index();
8773 bool line_orientation[4];
8779 const unsigned int middle_vertices[2] = {
8780 hex->line(2)->child(0)->vertex_index(1),
8781 hex->line(7)->child(0)->vertex_index(1)};
8783 for (
unsigned int i = 0; i < 4; ++i)
8784 if (lines[i]->vertex_index(i % 2) ==
8785 middle_vertices[i % 2])
8786 line_orientation[i] =
true;
8791 Assert(lines[i]->vertex_index((i + 1) % 2) ==
8792 middle_vertices[i % 2],
8794 line_orientation[i] =
false;
8799 new_quads[0]->set_bounding_object_indices(
8805 new_quads[0]->set_line_orientation(
8806 0, line_orientation[0]);
8807 new_quads[0]->set_line_orientation(
8808 1, line_orientation[1]);
8809 new_quads[0]->set_line_orientation(
8810 2, line_orientation[2]);
8811 new_quads[0]->set_line_orientation(
8812 3, line_orientation[3]);
8845 const int quad_indices[11] = {
8846 new_quads[0]->index(),
8848 hex->face(0)->index(),
8850 hex->face(1)->index(),
8852 hex->face(2)->child_index(
8853 child_at_origin[hex->face(2)->refinement_case() -
8854 1][f_fl[2]][f_ro[2]]),
8855 hex->face(2)->child_index(
8857 child_at_origin[hex->face(2)->refinement_case() -
8858 1][f_fl[2]][f_ro[2]]),
8860 hex->face(3)->child_index(
8861 child_at_origin[hex->face(3)->refinement_case() -
8862 1][f_fl[3]][f_ro[3]]),
8863 hex->face(3)->child_index(
8865 child_at_origin[hex->face(3)->refinement_case() -
8866 1][f_fl[3]][f_ro[3]]),
8868 hex->face(4)->child_index(
8869 child_at_origin[hex->face(4)->refinement_case() -
8870 1][f_fl[4]][f_ro[4]]),
8871 hex->face(4)->child_index(
8873 child_at_origin[hex->face(4)->refinement_case() -
8874 1][f_fl[4]][f_ro[4]]),
8876 hex->face(5)->child_index(
8877 child_at_origin[hex->face(5)->refinement_case() -
8878 1][f_fl[5]][f_ro[5]]),
8879 hex->face(5)->child_index(
8881 child_at_origin[hex->face(5)->refinement_case() -
8882 1][f_fl[5]][f_ro[5]])
8886 new_hexes[0]->set_bounding_object_indices(
8893 new_hexes[1]->set_bounding_object_indices(
8968 raw_line_iterator lines[4] = {
8969 hex->face(0)->child(0)->line(
8970 (hex->face(0)->refinement_case() ==
8974 hex->face(1)->child(0)->line(
8975 (hex->face(1)->refinement_case() ==
8979 hex->face(4)->child(0)->line(
8980 (hex->face(4)->refinement_case() ==
8984 hex->face(5)->child(0)->line(
8985 (hex->face(5)->refinement_case() ==
8991 unsigned int line_indices[4];
8992 for (
unsigned int i = 0; i < 4; ++i)
8993 line_indices[i] = lines[i]->
index();
9000 bool line_orientation[4];
9006 const unsigned int middle_vertices[2] = {
9007 hex->line(0)->child(0)->vertex_index(1),
9008 hex->line(5)->child(0)->vertex_index(1)};
9010 for (
unsigned int i = 0; i < 4; ++i)
9011 if (lines[i]->vertex_index(i % 2) ==
9012 middle_vertices[i % 2])
9013 line_orientation[i] =
true;
9017 Assert(lines[i]->vertex_index((i + 1) % 2) ==
9018 middle_vertices[i % 2],
9020 line_orientation[i] =
false;
9025 new_quads[0]->set_bounding_object_indices(
9031 new_quads[0]->set_line_orientation(
9032 0, line_orientation[2]);
9033 new_quads[0]->set_line_orientation(
9034 1, line_orientation[3]);
9035 new_quads[0]->set_line_orientation(
9036 2, line_orientation[0]);
9037 new_quads[0]->set_line_orientation(
9038 3, line_orientation[1]);
9071 const int quad_indices[11] = {
9072 new_quads[0]->index(),
9074 hex->face(0)->child_index(
9075 child_at_origin[hex->face(0)->refinement_case() -
9076 1][f_fl[0]][f_ro[0]]),
9077 hex->face(0)->child_index(
9079 child_at_origin[hex->face(0)->refinement_case() -
9080 1][f_fl[0]][f_ro[0]]),
9082 hex->face(1)->child_index(
9083 child_at_origin[hex->face(1)->refinement_case() -
9084 1][f_fl[1]][f_ro[1]]),
9085 hex->face(1)->child_index(
9087 child_at_origin[hex->face(1)->refinement_case() -
9088 1][f_fl[1]][f_ro[1]]),
9090 hex->face(2)->index(),
9092 hex->face(3)->index(),
9094 hex->face(4)->child_index(
9095 child_at_origin[hex->face(4)->refinement_case() -
9096 1][f_fl[4]][f_ro[4]]),
9097 hex->face(4)->child_index(
9099 child_at_origin[hex->face(4)->refinement_case() -
9100 1][f_fl[4]][f_ro[4]]),
9102 hex->face(5)->child_index(
9103 child_at_origin[hex->face(5)->refinement_case() -
9104 1][f_fl[5]][f_ro[5]]),
9105 hex->face(5)->child_index(
9107 child_at_origin[hex->face(5)->refinement_case() -
9108 1][f_fl[5]][f_ro[5]])
9112 new_hexes[0]->set_bounding_object_indices(
9119 new_hexes[1]->set_bounding_object_indices(
9196 raw_line_iterator lines[4] = {
9197 hex->face(0)->child(0)->line(
9198 (hex->face(0)->refinement_case() ==
9202 hex->face(1)->child(0)->line(
9203 (hex->face(1)->refinement_case() ==
9207 hex->face(2)->child(0)->line(
9208 (hex->face(2)->refinement_case() ==
9212 hex->face(3)->child(0)->line(
9213 (hex->face(3)->refinement_case() ==
9219 unsigned int line_indices[4];
9220 for (
unsigned int i = 0; i < 4; ++i)
9221 line_indices[i] = lines[i]->
index();
9228 bool line_orientation[4];
9234 const unsigned int middle_vertices[2] = {
9235 middle_vertex_index<dim, spacedim>(hex->line(8)),
9236 middle_vertex_index<dim, spacedim>(hex->line(11))};
9238 for (
unsigned int i = 0; i < 4; ++i)
9239 if (lines[i]->vertex_index(i % 2) ==
9240 middle_vertices[i % 2])
9241 line_orientation[i] =
true;
9245 Assert(lines[i]->vertex_index((i + 1) % 2) ==
9246 middle_vertices[i % 2],
9248 line_orientation[i] =
false;
9253 new_quads[0]->set_bounding_object_indices(
9259 new_quads[0]->set_line_orientation(
9260 0, line_orientation[0]);
9261 new_quads[0]->set_line_orientation(
9262 1, line_orientation[1]);
9263 new_quads[0]->set_line_orientation(
9264 2, line_orientation[2]);
9265 new_quads[0]->set_line_orientation(
9266 3, line_orientation[3]);
9300 const int quad_indices[11] = {
9301 new_quads[0]->index(),
9303 hex->face(0)->child_index(
9304 child_at_origin[hex->face(0)->refinement_case() -
9305 1][f_fl[0]][f_ro[0]]),
9306 hex->face(0)->child_index(
9308 child_at_origin[hex->face(0)->refinement_case() -
9309 1][f_fl[0]][f_ro[0]]),
9311 hex->face(1)->child_index(
9312 child_at_origin[hex->face(1)->refinement_case() -
9313 1][f_fl[1]][f_ro[1]]),
9314 hex->face(1)->child_index(
9316 child_at_origin[hex->face(1)->refinement_case() -
9317 1][f_fl[1]][f_ro[1]]),
9319 hex->face(2)->child_index(
9320 child_at_origin[hex->face(2)->refinement_case() -
9321 1][f_fl[2]][f_ro[2]]),
9322 hex->face(2)->child_index(
9324 child_at_origin[hex->face(2)->refinement_case() -
9325 1][f_fl[2]][f_ro[2]]),
9327 hex->face(3)->child_index(
9328 child_at_origin[hex->face(3)->refinement_case() -
9329 1][f_fl[3]][f_ro[3]]),
9330 hex->face(3)->child_index(
9332 child_at_origin[hex->face(3)->refinement_case() -
9333 1][f_fl[3]][f_ro[3]]),
9335 hex->face(4)->index(),
9337 hex->face(5)->index()
9340 new_hexes[0]->set_bounding_object_indices(
9347 new_hexes[1]->set_bounding_object_indices(
9379 new_lines[0]->set_bounding_object_indices(
9380 {middle_vertex_index<dim, spacedim>(hex->face(4)),
9381 middle_vertex_index<dim, spacedim>(hex->face(5))});
9449 spacedim>::raw_line_iterator lines[13] = {
9450 hex->face(0)->child(0)->line(
9451 (hex->face(0)->refinement_case() ==
9455 hex->face(1)->child(0)->line(
9456 (hex->face(1)->refinement_case() ==
9460 hex->face(2)->child(0)->line(
9461 (hex->face(2)->refinement_case() ==
9465 hex->face(3)->child(0)->line(
9466 (hex->face(3)->refinement_case() ==
9474 0, f_or[4], f_fl[4], f_ro[4]))
9477 1, f_or[4], f_fl[4], f_ro[4])),
9481 3, f_or[4], f_fl[4], f_ro[4]))
9484 0, f_or[4], f_fl[4], f_ro[4])),
9488 0, f_or[4], f_fl[4], f_ro[4]))
9491 3, f_or[4], f_fl[4], f_ro[4])),
9495 3, f_or[4], f_fl[4], f_ro[4]))
9498 2, f_or[4], f_fl[4], f_ro[4])),
9503 0, f_or[5], f_fl[5], f_ro[5]))
9506 1, f_or[5], f_fl[5], f_ro[5])),
9510 3, f_or[5], f_fl[5], f_ro[5]))
9513 0, f_or[5], f_fl[5], f_ro[5])),
9517 0, f_or[5], f_fl[5], f_ro[5]))
9520 3, f_or[5], f_fl[5], f_ro[5])),
9524 3, f_or[5], f_fl[5], f_ro[5]))
9527 2, f_or[5], f_fl[5], f_ro[5])),
9532 unsigned int line_indices[13];
9533 for (
unsigned int i = 0; i < 13; ++i)
9534 line_indices[i] = lines[i]->
index();
9541 bool line_orientation[13];
9545 const unsigned int middle_vertices[4] = {
9546 hex->line(0)->child(0)->vertex_index(1),
9547 hex->line(1)->child(0)->vertex_index(1),
9548 hex->line(2)->child(0)->vertex_index(1),
9549 hex->line(3)->child(0)->vertex_index(1),
9555 for (
unsigned int i = 0; i < 4; ++i)
9556 if (lines[i]->vertex_index(0) == middle_vertices[i])
9557 line_orientation[i] =
true;
9561 Assert(lines[i]->vertex_index(1) ==
9564 line_orientation[i] =
false;
9573 for (
unsigned int i = 4; i < 12; ++i)
9574 if (lines[i]->vertex_index((i + 1) % 2) ==
9575 middle_vertex_index<dim, spacedim>(
9576 hex->face(3 + i / 4)))
9577 line_orientation[i] =
true;
9582 Assert(lines[i]->vertex_index(i % 2) ==
9583 (middle_vertex_index<dim, spacedim>(
9584 hex->face(3 + i / 4))),
9586 line_orientation[i] =
false;
9591 line_orientation[12] =
true;
9616 new_quads[0]->set_bounding_object_indices(
9621 new_quads[1]->set_bounding_object_indices(
9626 new_quads[2]->set_bounding_object_indices(
9631 new_quads[3]->set_bounding_object_indices(
9637 new_quads[0]->set_line_orientation(
9638 0, line_orientation[2]);
9639 new_quads[0]->set_line_orientation(
9640 2, line_orientation[4]);
9641 new_quads[0]->set_line_orientation(
9642 3, line_orientation[8]);
9644 new_quads[1]->set_line_orientation(
9645 1, line_orientation[3]);
9646 new_quads[1]->set_line_orientation(
9647 2, line_orientation[5]);
9648 new_quads[1]->set_line_orientation(
9649 3, line_orientation[9]);
9651 new_quads[2]->set_line_orientation(
9652 0, line_orientation[6]);
9653 new_quads[2]->set_line_orientation(
9654 1, line_orientation[10]);
9655 new_quads[2]->set_line_orientation(
9656 2, line_orientation[0]);
9658 new_quads[3]->set_line_orientation(
9659 0, line_orientation[7]);
9660 new_quads[3]->set_line_orientation(
9661 1, line_orientation[11]);
9662 new_quads[3]->set_line_orientation(
9663 3, line_orientation[1]);
9696 const int quad_indices[20] = {
9697 new_quads[0]->index(),
9698 new_quads[1]->index(),
9699 new_quads[2]->index(),
9700 new_quads[3]->index(),
9702 hex->face(0)->child_index(
9703 child_at_origin[hex->face(0)->refinement_case() -
9704 1][f_fl[0]][f_ro[0]]),
9705 hex->face(0)->child_index(
9707 child_at_origin[hex->face(0)->refinement_case() -
9708 1][f_fl[0]][f_ro[0]]),
9710 hex->face(1)->child_index(
9711 child_at_origin[hex->face(1)->refinement_case() -
9712 1][f_fl[1]][f_ro[1]]),
9713 hex->face(1)->child_index(
9715 child_at_origin[hex->face(1)->refinement_case() -
9716 1][f_fl[1]][f_ro[1]]),
9718 hex->face(2)->child_index(
9719 child_at_origin[hex->face(2)->refinement_case() -
9720 1][f_fl[2]][f_ro[2]]),
9721 hex->face(2)->child_index(
9723 child_at_origin[hex->face(2)->refinement_case() -
9724 1][f_fl[2]][f_ro[2]]),
9726 hex->face(3)->child_index(
9727 child_at_origin[hex->face(3)->refinement_case() -
9728 1][f_fl[3]][f_ro[3]]),
9729 hex->face(3)->child_index(
9731 child_at_origin[hex->face(3)->refinement_case() -
9732 1][f_fl[3]][f_ro[3]]),
9734 hex->face(4)->isotropic_child_index(
9736 0, f_or[4], f_fl[4], f_ro[4])),
9737 hex->face(4)->isotropic_child_index(
9739 1, f_or[4], f_fl[4], f_ro[4])),
9740 hex->face(4)->isotropic_child_index(
9742 2, f_or[4], f_fl[4], f_ro[4])),
9743 hex->face(4)->isotropic_child_index(
9745 3, f_or[4], f_fl[4], f_ro[4])),
9747 hex->face(5)->isotropic_child_index(
9749 0, f_or[5], f_fl[5], f_ro[5])),
9750 hex->face(5)->isotropic_child_index(
9752 1, f_or[5], f_fl[5], f_ro[5])),
9753 hex->face(5)->isotropic_child_index(
9755 2, f_or[5], f_fl[5], f_ro[5])),
9756 hex->face(5)->isotropic_child_index(
9758 3, f_or[5], f_fl[5], f_ro[5]))};
9760 new_hexes[0]->set_bounding_object_indices(
9767 new_hexes[1]->set_bounding_object_indices(
9774 new_hexes[2]->set_bounding_object_indices(
9781 new_hexes[3]->set_bounding_object_indices(
9813 new_lines[0]->set_bounding_object_indices(
9814 {middle_vertex_index<dim, spacedim>(hex->face(2)),
9815 middle_vertex_index<dim, spacedim>(hex->face(3))});
9883 spacedim>::raw_line_iterator lines[13] = {
9884 hex->face(0)->child(0)->line(
9885 (hex->face(0)->refinement_case() ==
9889 hex->face(1)->child(0)->line(
9890 (hex->face(1)->refinement_case() ==
9894 hex->face(4)->child(0)->line(
9895 (hex->face(4)->refinement_case() ==
9899 hex->face(5)->child(0)->line(
9900 (hex->face(5)->refinement_case() ==
9908 0, f_or[2], f_fl[2], f_ro[2]))
9911 3, f_or[2], f_fl[2], f_ro[2])),
9915 3, f_or[2], f_fl[2], f_ro[2]))
9918 2, f_or[2], f_fl[2], f_ro[2])),
9922 0, f_or[2], f_fl[2], f_ro[2]))
9925 1, f_or[2], f_fl[2], f_ro[2])),
9929 3, f_or[2], f_fl[2], f_ro[2]))
9932 0, f_or[2], f_fl[2], f_ro[2])),
9937 0, f_or[3], f_fl[3], f_ro[3]))
9940 3, f_or[3], f_fl[3], f_ro[3])),
9944 3, f_or[3], f_fl[3], f_ro[3]))
9947 2, f_or[3], f_fl[3], f_ro[3])),
9951 0, f_or[3], f_fl[3], f_ro[3]))
9954 1, f_or[3], f_fl[3], f_ro[3])),
9958 3, f_or[3], f_fl[3], f_ro[3]))
9961 0, f_or[3], f_fl[3], f_ro[3])),
9966 unsigned int line_indices[13];
9967 for (
unsigned int i = 0; i < 13; ++i)
9968 line_indices[i] = lines[i]->
index();
9975 bool line_orientation[13];
9979 const unsigned int middle_vertices[4] = {
9980 hex->line(8)->child(0)->vertex_index(1),
9981 hex->line(9)->child(0)->vertex_index(1),
9982 hex->line(2)->child(0)->vertex_index(1),
9983 hex->line(6)->child(0)->vertex_index(1),
9988 for (
unsigned int i = 0; i < 4; ++i)
9989 if (lines[i]->vertex_index(0) == middle_vertices[i])
9990 line_orientation[i] =
true;
9994 Assert(lines[i]->vertex_index(1) ==
9997 line_orientation[i] =
false;
10006 for (
unsigned int i = 4; i < 12; ++i)
10007 if (lines[i]->vertex_index((i + 1) % 2) ==
10008 middle_vertex_index<dim, spacedim>(
10009 hex->face(1 + i / 4)))
10010 line_orientation[i] =
true;
10015 Assert(lines[i]->vertex_index(i % 2) ==
10016 (middle_vertex_index<dim, spacedim>(
10017 hex->face(1 + i / 4))),
10019 line_orientation[i] =
false;
10024 line_orientation[12] =
true;
10050 new_quads[0]->set_bounding_object_indices(
10054 line_indices[10]});
10055 new_quads[1]->set_bounding_object_indices(
10059 line_indices[11]});
10060 new_quads[2]->set_bounding_object_indices(
10064 line_indices[12]});
10065 new_quads[3]->set_bounding_object_indices(
10071 new_quads[0]->set_line_orientation(
10072 0, line_orientation[0]);
10073 new_quads[0]->set_line_orientation(
10074 2, line_orientation[6]);
10075 new_quads[0]->set_line_orientation(
10076 3, line_orientation[10]);
10078 new_quads[1]->set_line_orientation(
10079 1, line_orientation[1]);
10080 new_quads[1]->set_line_orientation(
10081 2, line_orientation[7]);
10082 new_quads[1]->set_line_orientation(
10083 3, line_orientation[11]);
10085 new_quads[2]->set_line_orientation(
10086 0, line_orientation[4]);
10087 new_quads[2]->set_line_orientation(
10088 1, line_orientation[8]);
10089 new_quads[2]->set_line_orientation(
10090 2, line_orientation[2]);
10092 new_quads[3]->set_line_orientation(
10093 0, line_orientation[5]);
10094 new_quads[3]->set_line_orientation(
10095 1, line_orientation[9]);
10096 new_quads[3]->set_line_orientation(
10097 3, line_orientation[3]);
10131 const int quad_indices[20] = {
10132 new_quads[0]->index(),
10133 new_quads[1]->index(),
10134 new_quads[2]->index(),
10135 new_quads[3]->index(),
10137 hex->face(0)->child_index(
10138 child_at_origin[hex->face(0)->refinement_case() -
10139 1][f_fl[0]][f_ro[0]]),
10140 hex->face(0)->child_index(
10142 child_at_origin[hex->face(0)->refinement_case() -
10143 1][f_fl[0]][f_ro[0]]),
10145 hex->face(1)->child_index(
10146 child_at_origin[hex->face(1)->refinement_case() -
10147 1][f_fl[1]][f_ro[1]]),
10148 hex->face(1)->child_index(
10150 child_at_origin[hex->face(1)->refinement_case() -
10151 1][f_fl[1]][f_ro[1]]),
10153 hex->face(2)->isotropic_child_index(
10155 0, f_or[2], f_fl[2], f_ro[2])),
10156 hex->face(2)->isotropic_child_index(
10158 1, f_or[2], f_fl[2], f_ro[2])),
10159 hex->face(2)->isotropic_child_index(
10161 2, f_or[2], f_fl[2], f_ro[2])),
10162 hex->face(2)->isotropic_child_index(
10164 3, f_or[2], f_fl[2], f_ro[2])),
10166 hex->face(3)->isotropic_child_index(
10168 0, f_or[3], f_fl[3], f_ro[3])),
10169 hex->face(3)->isotropic_child_index(
10171 1, f_or[3], f_fl[3], f_ro[3])),
10172 hex->face(3)->isotropic_child_index(
10174 2, f_or[3], f_fl[3], f_ro[3])),
10175 hex->face(3)->isotropic_child_index(
10177 3, f_or[3], f_fl[3], f_ro[3])),
10179 hex->face(4)->child_index(
10180 child_at_origin[hex->face(4)->refinement_case() -
10181 1][f_fl[4]][f_ro[4]]),
10182 hex->face(4)->child_index(
10184 child_at_origin[hex->face(4)->refinement_case() -
10185 1][f_fl[4]][f_ro[4]]),
10187 hex->face(5)->child_index(
10188 child_at_origin[hex->face(5)->refinement_case() -
10189 1][f_fl[5]][f_ro[5]]),
10190 hex->face(5)->child_index(
10192 child_at_origin[hex->face(5)->refinement_case() -
10193 1][f_fl[5]][f_ro[5]])};
10204 new_hexes[0]->set_bounding_object_indices(
10211 new_hexes[1]->set_bounding_object_indices(
10217 quad_indices[18]});
10218 new_hexes[2]->set_bounding_object_indices(
10225 new_hexes[3]->set_bounding_object_indices(
10231 quad_indices[19]});
10258 new_lines[0]->set_bounding_object_indices(
10260 {middle_vertex_index<dim, spacedim>(hex->face(0)),
10261 middle_vertex_index<dim, spacedim>(hex->face(1))});
10330 spacedim>::raw_line_iterator lines[13] = {
10331 hex->face(2)->child(0)->line(
10332 (hex->face(2)->refinement_case() ==
10336 hex->face(3)->child(0)->line(
10337 (hex->face(3)->refinement_case() ==
10341 hex->face(4)->child(0)->line(
10342 (hex->face(4)->refinement_case() ==
10346 hex->face(5)->child(0)->line(
10347 (hex->face(5)->refinement_case() ==
10355 0, f_or[0], f_fl[0], f_ro[0]))
10358 1, f_or[0], f_fl[0], f_ro[0])),
10362 3, f_or[0], f_fl[0], f_ro[0]))
10365 0, f_or[0], f_fl[0], f_ro[0])),
10369 0, f_or[0], f_fl[0], f_ro[0]))
10372 3, f_or[0], f_fl[0], f_ro[0])),
10376 3, f_or[0], f_fl[0], f_ro[0]))
10379 2, f_or[0], f_fl[0], f_ro[0])),
10384 0, f_or[1], f_fl[1], f_ro[1]))
10387 1, f_or[1], f_fl[1], f_ro[1])),
10391 3, f_or[1], f_fl[1], f_ro[1]))
10394 0, f_or[1], f_fl[1], f_ro[1])),
10398 0, f_or[1], f_fl[1], f_ro[1]))
10401 3, f_or[1], f_fl[1], f_ro[1])),
10405 3, f_or[1], f_fl[1], f_ro[1]))
10408 2, f_or[1], f_fl[1], f_ro[1])),
10413 unsigned int line_indices[13];
10415 for (
unsigned int i = 0; i < 13; ++i)
10416 line_indices[i] = lines[i]->
index();
10423 bool line_orientation[13];
10427 const unsigned int middle_vertices[4] = {
10428 hex->line(8)->child(0)->vertex_index(1),
10429 hex->line(10)->child(0)->vertex_index(1),
10430 hex->line(0)->child(0)->vertex_index(1),
10431 hex->line(4)->child(0)->vertex_index(1),
10436 for (
unsigned int i = 0; i < 4; ++i)
10437 if (lines[i]->vertex_index(0) == middle_vertices[i])
10438 line_orientation[i] =
true;
10442 Assert(lines[i]->vertex_index(1) ==
10443 middle_vertices[i],
10445 line_orientation[i] =
false;
10454 for (
unsigned int i = 4; i < 12; ++i)
10455 if (lines[i]->vertex_index((i + 1) % 2) ==
10456 middle_vertex_index<dim, spacedim>(
10457 hex->face(i / 4 - 1)))
10458 line_orientation[i] =
true;
10463 Assert(lines[i]->vertex_index(i % 2) ==
10464 (middle_vertex_index<dim, spacedim>(
10465 hex->face(i / 4 - 1))),
10467 line_orientation[i] =
false;
10472 line_orientation[12] =
true;
10492 new_quads[0]->set_bounding_object_indices(
10496 line_indices[12]});
10497 new_quads[1]->set_bounding_object_indices(
10502 new_quads[2]->set_bounding_object_indices(
10507 new_quads[3]->set_bounding_object_indices(
10513 new_quads[0]->set_line_orientation(
10514 0, line_orientation[6]);
10515 new_quads[0]->set_line_orientation(
10516 1, line_orientation[10]);
10517 new_quads[0]->set_line_orientation(
10518 2, line_orientation[0]);
10520 new_quads[1]->set_line_orientation(
10521 0, line_orientation[7]);
10522 new_quads[1]->set_line_orientation(
10523 1, line_orientation[11]);
10524 new_quads[1]->set_line_orientation(
10525 3, line_orientation[1]);
10527 new_quads[2]->set_line_orientation(
10528 0, line_orientation[2]);
10529 new_quads[2]->set_line_orientation(
10530 2, line_orientation[4]);
10531 new_quads[2]->set_line_orientation(
10532 3, line_orientation[8]);
10534 new_quads[3]->set_line_orientation(
10535 1, line_orientation[3]);
10536 new_quads[3]->set_line_orientation(
10537 2, line_orientation[5]);
10538 new_quads[3]->set_line_orientation(
10539 3, line_orientation[9]);
10573 const int quad_indices[20] = {
10574 new_quads[0]->index(),
10575 new_quads[1]->index(),
10576 new_quads[2]->index(),
10577 new_quads[3]->index(),
10579 hex->face(0)->isotropic_child_index(
10581 0, f_or[0], f_fl[0], f_ro[0])),
10582 hex->face(0)->isotropic_child_index(
10584 1, f_or[0], f_fl[0], f_ro[0])),
10585 hex->face(0)->isotropic_child_index(
10587 2, f_or[0], f_fl[0], f_ro[0])),
10588 hex->face(0)->isotropic_child_index(
10590 3, f_or[0], f_fl[0], f_ro[0])),
10592 hex->face(1)->isotropic_child_index(
10594 0, f_or[1], f_fl[1], f_ro[1])),
10595 hex->face(1)->isotropic_child_index(
10597 1, f_or[1], f_fl[1], f_ro[1])),
10598 hex->face(1)->isotropic_child_index(
10600 2, f_or[1], f_fl[1], f_ro[1])),
10601 hex->face(1)->isotropic_child_index(
10603 3, f_or[1], f_fl[1], f_ro[1])),
10605 hex->face(2)->child_index(
10606 child_at_origin[hex->face(2)->refinement_case() -
10607 1][f_fl[2]][f_ro[2]]),
10608 hex->face(2)->child_index(
10610 child_at_origin[hex->face(2)->refinement_case() -
10611 1][f_fl[2]][f_ro[2]]),
10613 hex->face(3)->child_index(
10614 child_at_origin[hex->face(3)->refinement_case() -
10615 1][f_fl[3]][f_ro[3]]),
10616 hex->face(3)->child_index(
10618 child_at_origin[hex->face(3)->refinement_case() -
10619 1][f_fl[3]][f_ro[3]]),
10621 hex->face(4)->child_index(
10622 child_at_origin[hex->face(4)->refinement_case() -
10623 1][f_fl[4]][f_ro[4]]),
10624 hex->face(4)->child_index(
10626 child_at_origin[hex->face(4)->refinement_case() -
10627 1][f_fl[4]][f_ro[4]]),
10629 hex->face(5)->child_index(
10630 child_at_origin[hex->face(5)->refinement_case() -
10631 1][f_fl[5]][f_ro[5]]),
10632 hex->face(5)->child_index(
10634 child_at_origin[hex->face(5)->refinement_case() -
10635 1][f_fl[5]][f_ro[5]])};
10637 new_hexes[0]->set_bounding_object_indices(
10644 new_hexes[1]->set_bounding_object_indices(
10651 new_hexes[2]->set_bounding_object_indices(
10657 quad_indices[18]});
10658 new_hexes[3]->set_bounding_object_indices(
10664 quad_indices[19]});
10696 ++next_unused_vertex;
10700 "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."));
10711 hex->center(
true,
true);
10733 middle_vertex_index<dim, spacedim>(hex->face(0)),
10734 middle_vertex_index<dim, spacedim>(hex->face(1)),
10735 middle_vertex_index<dim, spacedim>(hex->face(2)),
10736 middle_vertex_index<dim, spacedim>(hex->face(3)),
10737 middle_vertex_index<dim, spacedim>(hex->face(4)),
10738 middle_vertex_index<dim, spacedim>(hex->face(5)),
10739 next_unused_vertex};
10741 new_lines[0]->set_bounding_object_indices(
10743 new_lines[1]->set_bounding_object_indices(
10745 new_lines[2]->set_bounding_object_indices(
10747 new_lines[3]->set_bounding_object_indices(
10749 new_lines[4]->set_bounding_object_indices(
10751 new_lines[5]->set_bounding_object_indices(
10821 spacedim>::raw_line_iterator lines[30] = {
10825 0, f_or[0], f_fl[0], f_ro[0]))
10828 1, f_or[0], f_fl[0], f_ro[0])),
10832 3, f_or[0], f_fl[0], f_ro[0]))
10835 0, f_or[0], f_fl[0], f_ro[0])),
10839 0, f_or[0], f_fl[0], f_ro[0]))
10842 3, f_or[0], f_fl[0], f_ro[0])),
10846 3, f_or[0], f_fl[0], f_ro[0]))
10849 2, f_or[0], f_fl[0], f_ro[0])),
10854 0, f_or[1], f_fl[1], f_ro[1]))
10857 1, f_or[1], f_fl[1], f_ro[1])),
10861 3, f_or[1], f_fl[1], f_ro[1]))
10864 0, f_or[1], f_fl[1], f_ro[1])),
10868 0, f_or[1], f_fl[1], f_ro[1]))
10871 3, f_or[1], f_fl[1], f_ro[1])),
10875 3, f_or[1], f_fl[1], f_ro[1]))
10878 2, f_or[1], f_fl[1], f_ro[1])),
10883 0, f_or[2], f_fl[2], f_ro[2]))
10886 1, f_or[2], f_fl[2], f_ro[2])),
10890 3, f_or[2], f_fl[2], f_ro[2]))
10893 0, f_or[2], f_fl[2], f_ro[2])),
10897 0, f_or[2], f_fl[2], f_ro[2]))
10900 3, f_or[2], f_fl[2], f_ro[2])),
10904 3, f_or[2], f_fl[2], f_ro[2]))
10907 2, f_or[2], f_fl[2], f_ro[2])),
10912 0, f_or[3], f_fl[3], f_ro[3]))
10915 1, f_or[3], f_fl[3], f_ro[3])),
10919 3, f_or[3], f_fl[3], f_ro[3]))
10922 0, f_or[3], f_fl[3], f_ro[3])),
10926 0, f_or[3], f_fl[3], f_ro[3]))
10929 3, f_or[3], f_fl[3], f_ro[3])),
10933 3, f_or[3], f_fl[3], f_ro[3]))
10936 2, f_or[3], f_fl[3], f_ro[3])),
10941 0, f_or[4], f_fl[4], f_ro[4]))
10944 1, f_or[4], f_fl[4], f_ro[4])),
10948 3, f_or[4], f_fl[4], f_ro[4]))
10951 0, f_or[4], f_fl[4], f_ro[4])),
10955 0, f_or[4], f_fl[4], f_ro[4]))
10958 3, f_or[4], f_fl[4], f_ro[4])),
10962 3, f_or[4], f_fl[4], f_ro[4]))
10965 2, f_or[4], f_fl[4], f_ro[4])),
10970 0, f_or[5], f_fl[5], f_ro[5]))
10973 1, f_or[5], f_fl[5], f_ro[5])),
10977 3, f_or[5], f_fl[5], f_ro[5]))
10980 0, f_or[5], f_fl[5], f_ro[5])),
10984 0, f_or[5], f_fl[5], f_ro[5]))
10987 3, f_or[5], f_fl[5], f_ro[5])),
10991 3, f_or[5], f_fl[5], f_ro[5]))
10994 2, f_or[5], f_fl[5], f_ro[5])),
11004 unsigned int line_indices[30];
11005 for (
unsigned int i = 0; i < 30; ++i)
11006 line_indices[i] = lines[i]->
index();
11013 bool line_orientation[30];
11021 for (
unsigned int i = 0; i < 24; ++i)
11022 if (lines[i]->vertex_index((i + 1) % 2) ==
11024 line_orientation[i] =
true;
11029 Assert(lines[i]->vertex_index(i % 2) ==
11032 line_orientation[i] =
false;
11037 for (
unsigned int i = 24; i < 30; ++i)
11038 line_orientation[i] =
true;
11070 new_quads[0]->set_bounding_object_indices(
11074 line_indices[24]});
11075 new_quads[1]->set_bounding_object_indices(
11079 line_indices[25]});
11080 new_quads[2]->set_bounding_object_indices(
11084 line_indices[20]});
11085 new_quads[3]->set_bounding_object_indices(
11089 line_indices[21]});
11090 new_quads[4]->set_bounding_object_indices(
11094 line_indices[28]});
11095 new_quads[5]->set_bounding_object_indices(
11099 line_indices[29]});
11100 new_quads[6]->set_bounding_object_indices(
11105 new_quads[7]->set_bounding_object_indices(
11110 new_quads[8]->set_bounding_object_indices(
11114 line_indices[26]});
11115 new_quads[9]->set_bounding_object_indices(
11119 line_indices[27]});
11120 new_quads[10]->set_bounding_object_indices(
11124 line_indices[12]});
11125 new_quads[11]->set_bounding_object_indices(
11129 line_indices[13]});
11134 new_quads[0]->set_line_orientation(
11135 0, line_orientation[10]);
11136 new_quads[0]->set_line_orientation(
11137 2, line_orientation[16]);
11139 new_quads[1]->set_line_orientation(
11140 1, line_orientation[14]);
11141 new_quads[1]->set_line_orientation(
11142 2, line_orientation[17]);
11144 new_quads[2]->set_line_orientation(
11145 0, line_orientation[11]);
11146 new_quads[2]->set_line_orientation(
11147 3, line_orientation[20]);
11149 new_quads[3]->set_line_orientation(
11150 1, line_orientation[15]);
11151 new_quads[3]->set_line_orientation(
11152 3, line_orientation[21]);
11154 new_quads[4]->set_line_orientation(
11155 0, line_orientation[18]);
11156 new_quads[4]->set_line_orientation(
11157 2, line_orientation[0]);
11159 new_quads[5]->set_line_orientation(
11160 1, line_orientation[22]);
11161 new_quads[5]->set_line_orientation(
11162 2, line_orientation[1]);
11164 new_quads[6]->set_line_orientation(
11165 0, line_orientation[19]);
11166 new_quads[6]->set_line_orientation(
11167 3, line_orientation[4]);
11169 new_quads[7]->set_line_orientation(
11170 1, line_orientation[23]);
11171 new_quads[7]->set_line_orientation(
11172 3, line_orientation[5]);
11174 new_quads[8]->set_line_orientation(
11175 0, line_orientation[2]);
11176 new_quads[8]->set_line_orientation(
11177 2, line_orientation[8]);
11179 new_quads[9]->set_line_orientation(
11180 1, line_orientation[6]);
11181 new_quads[9]->set_line_orientation(
11182 2, line_orientation[9]);
11184 new_quads[10]->set_line_orientation(
11185 0, line_orientation[3]);
11186 new_quads[10]->set_line_orientation(
11187 3, line_orientation[12]);
11189 new_quads[11]->set_line_orientation(
11190 1, line_orientation[7]);
11191 new_quads[11]->set_line_orientation(
11192 3, line_orientation[13]);
11233 const int quad_indices[36] = {
11234 new_quads[0]->index(),
11235 new_quads[1]->index(),
11236 new_quads[2]->index(),
11237 new_quads[3]->index(),
11238 new_quads[4]->index(),
11239 new_quads[5]->index(),
11240 new_quads[6]->index(),
11241 new_quads[7]->index(),
11242 new_quads[8]->index(),
11243 new_quads[9]->index(),
11244 new_quads[10]->index(),
11245 new_quads[11]->index(),
11247 hex->face(0)->isotropic_child_index(
11249 0, f_or[0], f_fl[0], f_ro[0])),
11250 hex->face(0)->isotropic_child_index(
11252 1, f_or[0], f_fl[0], f_ro[0])),
11253 hex->face(0)->isotropic_child_index(
11255 2, f_or[0], f_fl[0], f_ro[0])),
11256 hex->face(0)->isotropic_child_index(
11258 3, f_or[0], f_fl[0], f_ro[0])),
11260 hex->face(1)->isotropic_child_index(
11262 0, f_or[1], f_fl[1], f_ro[1])),
11263 hex->face(1)->isotropic_child_index(
11265 1, f_or[1], f_fl[1], f_ro[1])),
11266 hex->face(1)->isotropic_child_index(
11268 2, f_or[1], f_fl[1], f_ro[1])),
11269 hex->face(1)->isotropic_child_index(
11271 3, f_or[1], f_fl[1], f_ro[1])),
11273 hex->face(2)->isotropic_child_index(
11275 0, f_or[2], f_fl[2], f_ro[2])),
11276 hex->face(2)->isotropic_child_index(
11278 1, f_or[2], f_fl[2], f_ro[2])),
11279 hex->face(2)->isotropic_child_index(
11281 2, f_or[2], f_fl[2], f_ro[2])),
11282 hex->face(2)->isotropic_child_index(
11284 3, f_or[2], f_fl[2], f_ro[2])),
11286 hex->face(3)->isotropic_child_index(
11288 0, f_or[3], f_fl[3], f_ro[3])),
11289 hex->face(3)->isotropic_child_index(
11291 1, f_or[3], f_fl[3], f_ro[3])),
11292 hex->face(3)->isotropic_child_index(
11294 2, f_or[3], f_fl[3], f_ro[3])),
11295 hex->face(3)->isotropic_child_index(
11297 3, f_or[3], f_fl[3], f_ro[3])),
11299 hex->face(4)->isotropic_child_index(
11301 0, f_or[4], f_fl[4], f_ro[4])),
11302 hex->face(4)->isotropic_child_index(
11304 1, f_or[4], f_fl[4], f_ro[4])),
11305 hex->face(4)->isotropic_child_index(
11307 2, f_or[4], f_fl[4], f_ro[4])),
11308 hex->face(4)->isotropic_child_index(
11310 3, f_or[4], f_fl[4], f_ro[4])),
11312 hex->face(5)->isotropic_child_index(
11314 0, f_or[5], f_fl[5], f_ro[5])),
11315 hex->face(5)->isotropic_child_index(
11317 1, f_or[5], f_fl[5], f_ro[5])),
11318 hex->face(5)->isotropic_child_index(
11320 2, f_or[5], f_fl[5], f_ro[5])),
11321 hex->face(5)->isotropic_child_index(
11323 3, f_or[5], f_fl[5], f_ro[5]))};
11326 new_hexes[0]->set_bounding_object_indices(
11333 new_hexes[1]->set_bounding_object_indices(
11340 new_hexes[2]->set_bounding_object_indices(
11346 quad_indices[10]});
11347 new_hexes[3]->set_bounding_object_indices(
11353 quad_indices[11]});
11356 new_hexes[4]->set_bounding_object_indices(
11362 quad_indices[32]});
11363 new_hexes[5]->set_bounding_object_indices(
11369 quad_indices[33]});
11370 new_hexes[6]->set_bounding_object_indices(
11376 quad_indices[34]});
11377 new_hexes[7]->set_bounding_object_indices(
11383 quad_indices[35]});
11417 for (
unsigned int s = 0;
11424 const unsigned int current_child =
11433 ref_case, f, f_or[f], f_fl[f], f_ro[f]));
11434 new_hexes[current_child]->set_combined_face_orientation(
11440 if (check_for_distorted_cells &&
11441 has_distorted_children<dim, spacedim>(hex))
11461 return cells_with_distorted_children;