From: Wolfgang Bangerth Date: Fri, 15 Sep 2023 00:38:42 +0000 (-0600) Subject: Simplify some code. X-Git-Tag: relicensing~505^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F15990%2Fhead;p=dealii.git Simplify some code. --- diff --git a/source/dofs/dof_renumbering.cc b/source/dofs/dof_renumbering.cc index d234305774..5582a6b5b0 100644 --- a/source/dofs/dof_renumbering.cc +++ b/source/dofs/dof_renumbering.cc @@ -411,23 +411,17 @@ namespace DoFRenumbering // // note that if constraints are not requested, then the 'constraints' // object will be empty and using it has no effect - IndexSet locally_relevant_dofs; - const IndexSet &locally_owned_dofs = [&]() -> const IndexSet & { - if (reorder_level_dofs == false) - { - locally_relevant_dofs = - DoFTools::extract_locally_relevant_dofs(dof_handler); - return dof_handler.locally_owned_dofs(); - } - else - { - Assert(dof_handler.n_dofs(level) != numbers::invalid_dof_index, - ExcDoFHandlerNotInitialized()); - locally_relevant_dofs = - DoFTools::extract_locally_relevant_level_dofs(dof_handler, level); - return dof_handler.locally_owned_mg_dofs(level); - } - }(); + if (reorder_level_dofs == true) + Assert(dof_handler.n_dofs(level) != numbers::invalid_dof_index, + ExcDoFHandlerNotInitialized()); + + const IndexSet locally_relevant_dofs = + (reorder_level_dofs == false ? + DoFTools::extract_locally_relevant_dofs(dof_handler) : + DoFTools::extract_locally_relevant_level_dofs(dof_handler, level)); + const IndexSet &locally_owned_dofs = + (reorder_level_dofs == false ? dof_handler.locally_owned_dofs() : + dof_handler.locally_owned_mg_dofs(level)); AffineConstraints constraints; if (use_constraints) @@ -472,17 +466,10 @@ namespace DoFRenumbering // indices that are locally owned, or that are only locally // relevant. in the process, also check that all indices // really belong to at least the locally relevant ones - IndexSet locally_active_dofs; - if (reorder_level_dofs == false) - { - locally_active_dofs = - DoFTools::extract_locally_active_dofs(dof_handler); - } - else - { - locally_active_dofs = - DoFTools::extract_locally_active_level_dofs(dof_handler, level); - } + const IndexSet locally_active_dofs = + (reorder_level_dofs == false ? + DoFTools::extract_locally_active_dofs(dof_handler) : + DoFTools::extract_locally_active_level_dofs(dof_handler, level)); bool needs_locally_active = false; for (const auto starting_index : starting_indices)