From: Marc Fehling Date: Wed, 31 Mar 2021 02:40:48 +0000 (-0600) Subject: Remove assertion from `DoFHandler::get_fe_collection()`. X-Git-Tag: v9.3.0-rc1~258^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11988%2Fhead;p=dealii.git Remove assertion from `DoFHandler::get_fe_collection()`. --- diff --git a/include/deal.II/dofs/dof_handler.h b/include/deal.II/dofs/dof_handler.h index 35a7c578a1..53a21d9aa5 100644 --- a/include/deal.II/dofs/dof_handler.h +++ b/include/deal.II/dofs/dof_handler.h @@ -2019,9 +2019,6 @@ template inline const hp::FECollection & DoFHandler::get_fe_collection() const { - Assert(fe_collection.size() > 0, - ExcMessage("No finite element collection is associated with " - "this DoFHandler")); return fe_collection; } diff --git a/source/hp/refinement.cc b/source/hp/refinement.cc index 5eebda3355..a9b568fc63 100644 --- a/source/hp/refinement.cc +++ b/source/hp/refinement.cc @@ -45,6 +45,10 @@ namespace hp void full_p_adaptivity(const dealii::DoFHandler &dof_handler) { + if (dof_handler.get_fe_collection().size() == 0) + // nothing to do + return; + Assert( dof_handler.has_hp_capabilities(), (typename dealii::DoFHandler::ExcOnlyAvailableWithHP())); @@ -63,6 +67,10 @@ namespace hp const dealii::DoFHandler &dof_handler, const std::vector & p_flags) { + if (dof_handler.get_fe_collection().size() == 0) + // nothing to do + return; + Assert( dof_handler.has_hp_capabilities(), (typename dealii::DoFHandler::ExcOnlyAvailableWithHP())); @@ -108,6 +116,10 @@ namespace hp const ComparisonFunction::type> &compare_coarsen) { + if (dof_handler.get_fe_collection().size() == 0) + // nothing to do + return; + Assert( dof_handler.has_hp_capabilities(), (typename dealii::DoFHandler::ExcOnlyAvailableWithHP())); @@ -143,6 +155,10 @@ namespace hp const ComparisonFunction::type> &compare_coarsen) { + if (dof_handler.get_fe_collection().size() == 0) + // nothing to do + return; + Assert( dof_handler.has_hp_capabilities(), (typename dealii::DoFHandler::ExcOnlyAvailableWithHP())); @@ -236,6 +252,10 @@ namespace hp const ComparisonFunction::type> &compare_coarsen) { + if (dof_handler.get_fe_collection().size() == 0) + // nothing to do + return; + Assert( dof_handler.has_hp_capabilities(), (typename dealii::DoFHandler::ExcOnlyAvailableWithHP())); @@ -428,6 +448,10 @@ namespace hp const dealii::DoFHandler &dof_handler, const Vector & sobolev_indices) { + if (dof_handler.get_fe_collection().size() == 0) + // nothing to do + return; + Assert( dof_handler.has_hp_capabilities(), (typename dealii::DoFHandler::ExcOnlyAvailableWithHP())); @@ -486,6 +510,10 @@ namespace hp const ComparisonFunction::type> &compare_coarsen) { + if (dof_handler.get_fe_collection().size() == 0) + // nothing to do + return; + Assert( dof_handler.has_hp_capabilities(), (typename dealii::DoFHandler::ExcOnlyAvailableWithHP())); @@ -524,6 +552,10 @@ namespace hp const double gamma_h, const double gamma_n) { + if (dof_handler.get_fe_collection().size() == 0) + // nothing to do + return; + AssertDimension(dof_handler.get_triangulation().n_active_cells(), error_indicators.size()); AssertDimension(dof_handler.get_triangulation().n_active_cells(), @@ -633,6 +665,10 @@ namespace hp void force_p_over_h(const dealii::DoFHandler &dof_handler) { + if (dof_handler.get_fe_collection().size() == 0) + // nothing to do + return; + Assert( dof_handler.has_hp_capabilities(), (typename dealii::DoFHandler::ExcOnlyAvailableWithHP())); @@ -651,6 +687,10 @@ namespace hp void choose_p_over_h(const dealii::DoFHandler &dof_handler) { + if (dof_handler.get_fe_collection().size() == 0) + // nothing to do + return; + Assert( dof_handler.has_hp_capabilities(), (typename dealii::DoFHandler::ExcOnlyAvailableWithHP())); @@ -768,6 +808,10 @@ namespace hp const unsigned int max_difference, const unsigned int contains_fe_index) { + if (dof_handler.get_fe_collection().size() == 0) + // nothing to do + return false; + Assert( dof_handler.has_hp_capabilities(), (typename dealii::DoFHandler::ExcOnlyAvailableWithHP()));