]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make DoFRenumbering work when some processors have 0 DoFs. 13567/head
authorDavid Wells <drwells@email.unc.edu>
Sat, 12 Mar 2022 00:58:20 +0000 (19:58 -0500)
committerDavid Wells <drwells@email.unc.edu>
Wed, 23 Mar 2022 13:04:25 +0000 (09:04 -0400)
doc/news/changes/minor/20220323DavidWells [new file with mode: 0644]
source/dofs/dof_renumbering.cc

diff --git a/doc/news/changes/minor/20220323DavidWells b/doc/news/changes/minor/20220323DavidWells
new file mode 100644 (file)
index 0000000..d72ea27
--- /dev/null
@@ -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.
+<br>
+(David Wells, 2022/03/23)
index d4c31794ff9c7e98788ec76695161bcf8180f26c..be9947610cff179bf3b3c291b192c44082343087 100644 (file)
@@ -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<dim, spacedim>(
         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);
   }
 

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.