From: David Wells Date: Sat, 6 Apr 2024 21:02:58 +0000 (-0400) Subject: execute_refinement_isotropic(): refactor. X-Git-Tag: v9.6.0-rc1~382^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6ba1cd6afc82c9babb01d2fcc410b4f84f86b93;p=dealii.git execute_refinement_isotropic(): refactor. --- diff --git a/source/grid/tria.cc b/source/grid/tria.cc index dc080be1e3..4bfc037caa 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -5263,8 +5263,25 @@ namespace internal ++next_unused_cell; } - if ((dim == 2) && - (cell->reference_cell() == ReferenceCells::Triangle)) + // Set subcell line orientations by checking the line's second + // vertex (from the subcell's perspective) to the line's actual + // second vertex. + const auto fix_line_orientation = + [&](const unsigned int line_no, + const unsigned int vertex_no, + const unsigned int subcell_no, + const unsigned int subcell_line_no) { + if (new_lines[line_no]->vertex_index(1) != + new_vertices[vertex_no]) + triangulation.levels[subcells[subcell_no]->level()] + ->face_orientations.set_combined_orientation( + subcells[subcell_no]->index() * + GeometryInfo<2>::faces_per_cell + + subcell_line_no, + ReferenceCell::reversed_combined_line_orientation()); + }; + + if (cell->reference_cell() == ReferenceCells::Triangle) { subcells[0]->set_bounding_object_indices({new_lines[0]->index(), new_lines[8]->index(), @@ -5279,24 +5296,6 @@ namespace internal new_lines[7]->index(), new_lines[8]->index()}); - // Set subcell line orientations by checking the line's second - // vertex (from the subcell's perspective) to the line's actual - // second vertex. - const auto fix_line_orientation = - [&](const unsigned int line_no, - const unsigned int vertex_no, - const unsigned int subcell_no, - const unsigned int subcell_line_no) { - if (new_lines[line_no]->vertex_index(1) != - new_vertices[vertex_no]) - triangulation.levels[subcells[subcell_no]->level()] - ->face_orientations.set_combined_orientation( - subcells[subcell_no]->index() * - GeometryInfo<2>::faces_per_cell + - subcell_line_no, - 0u); - }; - fix_line_orientation(0, 3, 0, 0); fix_line_orientation(8, 5, 0, 1); fix_line_orientation(5, 0, 0, 2); @@ -5315,8 +5314,7 @@ namespace internal fix_line_orientation(7, 5, 3, 1); fix_line_orientation(8, 3, 3, 2); } - else if ((dim == 2) && - (cell->reference_cell() == ReferenceCells::Quadrilateral)) + else if (cell->reference_cell() == ReferenceCells::Quadrilateral) { subcells[0]->set_bounding_object_indices( {new_lines[0]->index(),