]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a couple of duplicate checks to avoid triggering array access warnings. 11595/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 21 Jan 2021 03:38:03 +0000 (20:38 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 21 Jan 2021 03:38:03 +0000 (20:38 -0700)
source/grid/tria.cc

index 5eadb32ab419268089dd8e3985635ef4b69d7ae2..cf30f4e3565175c9da92c881c623933c6d51f595 100644 (file)
@@ -4452,7 +4452,8 @@ namespace internal
                   ++next_unused_cell;
             }
 
-          if (cell->reference_cell_type() == ReferenceCell::Type::Tri)
+          if ((dim == 2) &&
+              (cell->reference_cell_type() == ReferenceCell::Type::Tri))
             {
               subcells[0]->set_bounding_object_indices({new_lines[0]->index(),
                                                         new_lines[8]->index(),
@@ -4502,7 +4503,8 @@ namespace internal
               // triangulation.levels[subcells[2]->level()]->face_orientations[subcells[2]->index()
               // * GeometryInfo<2>::faces_per_cell + 0] = 0;
             }
-          else if (cell->reference_cell_type() == ReferenceCell::Type::Quad)
+          else if ((dim == 2) &&
+                   (cell->reference_cell_type() == ReferenceCell::Type::Quad))
             {
               subcells[0]->set_bounding_object_indices(
                 {new_lines[0]->index(),

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.