From: Wolfgang Bangerth Date: Mon, 3 Jul 2017 00:17:01 +0000 (-0600) Subject: Simplify code a bit. X-Git-Tag: v9.0.0-rc1~1439^2~6 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=274fd80c057f64871e88af808c24448eb4722a52;p=dealii.git Simplify code a bit. --- diff --git a/source/dofs/dof_handler_policy.cc b/source/dofs/dof_handler_policy.cc index e1c0490b1e..a298d25c1e 100644 --- a/source/dofs/dof_handler_policy.cc +++ b/source/dofs/dof_handler_policy.cc @@ -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); } diff --git a/source/hp/dof_handler.cc b/source/hp/dof_handler.cc index 4ec421b208..54893a9558 100644 --- a/source/hp/dof_handler.cc +++ b/source/hp/dof_handler.cc @@ -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*> (&this->get_triangulation())