]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify code a bit.
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 3 Jul 2017 00:17:01 +0000 (18:17 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 6 Jul 2017 12:56:40 +0000 (06:56 -0600)
source/dofs/dof_handler_policy.cc
source/hp/dof_handler.cc

index e1c0490b1e2e30c2656f91bab27f4f301b717f1e..a298d25c1e464598e061def3ed63000379b71a00 100644 (file)
@@ -1398,8 +1398,16 @@ namespace internal
         Implementation::renumber_dofs (new_numbers, IndexSet(0),
                                        *dof_handler, true);
 
-        // return a sequential, complete index set
-        return NumberCache (new_numbers.size());
+        // return a sequential, complete index set. take into account that the
+        // number of DoF indices may in fact be smaller than there were before
+        // if some previously separately numbered dofs have been identified.
+        // this is, for example, what the hp::DoFHandler does: it first
+        // enumerates all DoFs on cells independently, and then unifies
+        // some located at vertices or faces; this leaves us with fewer
+        // DoFs than there were before, so use the largest index as
+        // the one to determine the size of the index space
+        return NumberCache (*std::max_element(new_numbers.begin(),
+                                              new_numbers.end()) + 1);
       }
 
 
index 4ec421b20808b3bc15a740fcdc66fe6130286a35..54893a95586d69fe388b7eff6bc39aa8b13a943a 100644 (file)
@@ -2691,10 +2691,7 @@ namespace hp
 
     // finally, do the renumbering and set the number of actually
     // used dof indices
-    policy->renumber_dofs (new_dof_indices);
-
-    // now set the elements of the number cache appropriately
-    number_cache = dealii::internal::DoFHandler::NumberCache (next_free_dof);
+    number_cache = policy->renumber_dofs (new_dof_indices);
 
     Assert ((dynamic_cast<const parallel::shared::Triangulation< dim, spacedim >*>
              (&this->get_triangulation())

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.