From: Timo Heister <timo.heister@gmail.com>
Date: Fri, 16 Oct 2020 18:17:56 +0000 (-0400)
Subject: improve error message in make_hanging_node_constraints()
X-Git-Tag: v9.3.0-rc1~999^2
X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11049%2Fhead;p=dealii.git

improve error message in make_hanging_node_constraints()

Without this, it fails with an internal error deep inside the
constraints computation.
---

diff --git a/source/dofs/dof_tools_constraints.cc b/source/dofs/dof_tools_constraints.cc
index ae4f919a88..06bc59730f 100644
--- a/source/dofs/dof_tools_constraints.cc
+++ b/source/dofs/dof_tools_constraints.cc
@@ -1768,6 +1768,11 @@ namespace DoFTools
   make_hanging_node_constraints(const DoFHandler<dim, spacedim> &dof_handler,
                                 AffineConstraints<number> &      constraints)
   {
+    Assert(dof_handler.has_active_dofs(),
+           ExcMessage(
+             "The given DoFHandler does not have any DoFs. Did you forget to "
+             "call dof_handler.distribute_dofs()?"));
+
     // Decide whether to use the new or old make_hanging_node_constraints
     // function. If all the FiniteElement or all elements in a FECollection
     // support the new face constraint matrix, the new code will be used.