From e60c2726965432b9658ebc977704ed16700b58b8 Mon Sep 17 00:00:00 2001 From: David Wells Date: Fri, 11 Mar 2022 19:58:20 -0500 Subject: [PATCH] Make DoFRenumbering work when some processors have 0 DoFs. --- doc/news/changes/minor/20220323DavidWells | 4 ++++ source/dofs/dof_renumbering.cc | 27 ++++++++++++++--------- 2 files changed, 20 insertions(+), 11 deletions(-) create mode 100644 doc/news/changes/minor/20220323DavidWells diff --git a/doc/news/changes/minor/20220323DavidWells b/doc/news/changes/minor/20220323DavidWells new file mode 100644 index 0000000000..d72ea271b2 --- /dev/null +++ b/doc/news/changes/minor/20220323DavidWells @@ -0,0 +1,4 @@ +Fixed: The functions in DoFRenumbering now work correctly (they do not deadlock) +when a processor has zero locally owned degrees of freedom. +
+(David Wells, 2022/03/23) diff --git a/source/dofs/dof_renumbering.cc b/source/dofs/dof_renumbering.cc index d4c31794ff..be9947610c 100644 --- a/source/dofs/dof_renumbering.cc +++ b/source/dofs/dof_renumbering.cc @@ -689,7 +689,12 @@ namespace DoFRenumbering dof_handler.end(), component_order_arg, false); - if (result == 0) + (void)result; + + // If we don't have a renumbering (i.e., when there is 1 component) then + // return + if (Utilities::MPI::max(renumbering.size(), + dof_handler.get_communicator()) == 0) return; // verify that the last numbered @@ -730,13 +735,13 @@ namespace DoFRenumbering const types::global_dof_index result = compute_component_wise( renumbering, start, end, component_order_arg, true); + (void)result; - if (result == 0) - return; - - Assert(result == dof_handler.n_dofs(level), ExcInternalError()); + Assert(result == 0 || result == dof_handler.n_dofs(level), + ExcInternalError()); - if (renumbering.size() != 0) + if (Utilities::MPI::max(renumbering.size(), + dof_handler.get_communicator()) > 0) dof_handler.renumber_dofs(level, renumbering); } @@ -1048,13 +1053,13 @@ namespace DoFRenumbering start, end, true); + (void)result; - if (result == 0) - return; - - Assert(result == dof_handler.n_dofs(level), ExcInternalError()); + Assert(result == 0 || result == dof_handler.n_dofs(level), + ExcInternalError()); - if (renumbering.size() != 0) + if (Utilities::MPI::max(renumbering.size(), + dof_handler.get_communicator()) > 0) dof_handler.renumber_dofs(level, renumbering); } -- 2.39.5