From 0dbaedd4a87a7459935c821e945fab5d658fbd35 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 30 Jun 2017 14:01:32 -0600 Subject: [PATCH] Simplify a function. 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 | 47 +++++++--------------------------------- 1 file changed, 8 insertions(+), 39 deletions(-) diff --git a/source/hp/dof_handler.cc b/source/hp/dof_handler.cc index e68dc9d3fc..34a11d2df9 100644 --- a/source/hp/dof_handler.cc +++ b/source/hp/dof_handler.cc @@ -3044,51 +3044,20 @@ namespace hp renumber_dofs_internal (const std::vector &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 saved_hex_user_flags; - const_cast&>(*tria) - .save_user_flags_hex (saved_hex_user_flags); - const_cast&>(*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; fnth_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&>(*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); + } } -- 2.39.5