]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Un-hardcode some numbers.
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 24 Jan 2022 19:01:40 +0000 (12:01 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 26 Jan 2022 18:34:00 +0000 (11:34 -0700)
source/grid/tria.cc

index 77845fcc54dcbd28becfad6762581674bc803f68..3547f4512347d470f20baadf2dc1b1ce4fc67ff7 100644 (file)
@@ -5108,23 +5108,26 @@ namespace internal
                  triangulation.active_cell_iterators_on_level(level))
               if (cell->refine_flag_set())
                 {
+                  // Only support isotropic refinement
                   Assert(cell->refine_flag_set() ==
                            RefinementCase<dim>::cut_xyz,
                          ExcInternalError());
 
+                  // Now count up how many new cells, faces, edges, and vertices
+                  // we will need to allocate to do this refinement.
+                  new_cells += cell->reference_cell().n_isotropic_children();
+
                   if (cell->reference_cell() == ReferenceCells::Hexahedron)
                     {
                       ++needed_vertices;
                       needed_lines_single += 6;
                       needed_quads_single += 12;
-                      new_cells += 8;
                     }
                   else if (cell->reference_cell() ==
                            ReferenceCells::Tetrahedron)
                     {
                       needed_lines_single += 1;
                       needed_quads_single += 8;
-                      new_cells += 8;
                     }
                   else
                     {

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.