From a067c2ad82eb4551ab93e4ae9b4d6be35aab3485 Mon Sep 17 00:00:00 2001 From: Marc Fehling Date: Tue, 30 Mar 2021 20:40:48 -0600 Subject: [PATCH] Remove assertion from `DoFHandler::get_fe_collection()`. --- include/deal.II/dofs/dof_handler.h | 3 -- source/hp/refinement.cc | 44 ++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 3 deletions(-) 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())); -- 2.39.5