]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify a function. 4561/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Fri, 30 Jun 2017 20:01:32 +0000 (14:01 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Sat, 1 Jul 2017 02:19:19 +0000 (20:19 -0600)
The hp DoF renumbering function for the <3,3> case was unnecessarily
convoluted because it tried to look just like the functions that
deal with faces of higher dimensional cells. But we know that in <3,3>,
a hex is a cell, and so there can only be one finite element associated
with the cell. This allows simplifying a fair share of code.

source/hp/dof_handler.cc

index e68dc9d3fc01f3d09dc737e9de3147cb60642487..34a11d2df94ff4d0106a79d3099849954b866b07 100644 (file)
@@ -3044,51 +3044,20 @@ namespace hp
   renumber_dofs_internal (const std::vector<types::global_dof_index> &new_numbers,
                           dealii::internal::int2type<3>)
   {
-    const unsigned int dim = 3;
-    const unsigned int spacedim = 3;
-
     Assert (new_numbers.size() == n_dofs(), ExcRenumberingIncomplete());
 
     renumber_dofs_internal (new_numbers, internal::int2type<2>());
 
-    // save user flags on hexes so we
-    // can use them to mark hexes
-    // we've already treated
-    std::vector<bool> saved_hex_user_flags;
-    const_cast<dealii::Triangulation<dim,spacedim>&>(*tria)
-    .save_user_flags_hex (saved_hex_user_flags);
-    const_cast<dealii::Triangulation<dim,spacedim>&>(*tria)
-    .clear_user_flags_hex ();
-
-    // we're in 3d, so hexes are also
-    // cells. stick with the same
-    // kind of notation as in the
-    // previous functions, though
+    // we're in 3d, so hexes are also cells. by design, we only visit each cell once
     for (active_cell_iterator cell = begin_active(); cell!=end(); ++cell)
-      if (cell->user_flag_set() == false)
-        {
-          const hex_iterator hex = cell;
-          hex->set_user_flag();
-
-          const unsigned int n_active_fe_indices
-            = hex->n_active_fe_indices ();
-
-          for (unsigned int f=0; f<n_active_fe_indices; ++f)
-            {
-              const unsigned int fe_index
-                = hex->nth_active_fe_index (f);
-
-              for (unsigned int d=0; d<(*finite_elements)[fe_index].dofs_per_hex; ++d)
-                hex->set_dof_index (d,
-                                    new_numbers[hex->dof_index(d,fe_index)],
-                                    fe_index);
-            }
-        }
+      {
+        const unsigned int fe_index = cell->active_fe_index ();
 
-    // at the end, restore the user
-    // flags for the hexs
-    const_cast<dealii::Triangulation<dim,spacedim>&>(*tria)
-    .load_user_flags_hex (saved_hex_user_flags);
+        for (unsigned int d=0; d<(*finite_elements)[fe_index].dofs_per_hex; ++d)
+          cell->set_dof_index (d,
+                               new_numbers[cell->dof_index(d,fe_index)],
+                               fe_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.