From: Marc Fehling Date: Mon, 20 Mar 2023 11:59:11 +0000 (+0100) Subject: Move check about FECollection size to DoFHandler. X-Git-Tag: v9.5.0-rc1~424^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=77fbb346d14b46990e8437d0335f5760e5e57bfc;p=dealii.git Move check about FECollection size to DoFHandler. --- diff --git a/source/dofs/dof_handler.cc b/source/dofs/dof_handler.cc index 62fc1523ea..a296b3cb48 100644 --- a/source/dofs/dof_handler.cc +++ b/source/dofs/dof_handler.cc @@ -2149,14 +2149,19 @@ DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim)) void DoFHandler::distribute_dofs( const hp::FECollection &ff) { - Assert( - this->tria != nullptr, - ExcMessage( - "You need to set the Triangulation in the DoFHandler using reinit() or " - "in the constructor before you can distribute DoFs.")); + Assert(this->tria != nullptr, + ExcMessage( + "You need to set the Triangulation in the DoFHandler using reinit() " + "or in the constructor before you can distribute DoFs.")); Assert(this->tria->n_levels() > 0, ExcMessage("The Triangulation you are using is empty!")); + + // verify size of provided FE collection Assert(ff.size() > 0, ExcMessage("The given hp::FECollection is empty!")); + Assert((ff.size() <= std::numeric_limits::max()) && + (ff.size() != numbers::invalid_fe_index), + ExcMessage("The given hp::FECollection contains more finite elements " + "than the DoFHandler can cover with active FE indices.")); // // register the new finite element collection diff --git a/source/hp/fe_collection.cc b/source/hp/fe_collection.cc index 2ac945c033..5a45fdd234 100644 --- a/source/hp/fe_collection.cc +++ b/source/hp/fe_collection.cc @@ -73,11 +73,6 @@ namespace hp ExcMessage("All elements inside a collection need to have the " "same number of vector components!")); - Assert(this->size() <= std::numeric_limits::max() && - this->size() != numbers::invalid_fe_index, - ExcMessage( - "You reached the maximum possible number of finite elements.")); - Collection>::push_back(new_fe.clone()); }