From: Timo Heister Date: Mon, 1 Aug 2016 09:32:20 +0000 (+0200) Subject: comment, add Assert X-Git-Tag: v8.5.0-rc1~818^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8a9a55b419931d1f96e5b296c85941940e9eb94;p=dealii.git comment, add Assert --- diff --git a/source/dofs/dof_tools.cc b/source/dofs/dof_tools.cc index 738da85a2d..f8aab0f3ad 100644 --- a/source/dofs/dof_tools.cc +++ b/source/dofs/dof_tools.cc @@ -1131,6 +1131,9 @@ namespace DoFTools std::vector locally_owned_dofs_per_subdomain (const DoFHandlerType &dof_handler) { + Assert(dof_handler.n_dofs() > 0, + ExcMessage("The given DoFHandler has no DoFs.")); + // If the Triangulation is distributed, the only thing we can usefully // ask is for its locally owned subdomain Assert ((dynamic_cast subdomain_association (dof_handler.n_dofs ()); dealii::DoFTools::get_subdomain_association (dof_handler, subdomain_association); + // We have no MPI communicator with a serial computation and the subdomains + // can be set to arbitrary values. In case of a parallel Triangulation, + // we can check that we don't have more subdomains than processors. + // Note that max_element is well-defined because subdomain_association + // is non-empty (n_dofs()>0). const unsigned int n_subdomains = (dynamic_cast *> (&dof_handler.get_triangulation()) == 0