]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Remove assertion from `DoFHandler::get_fe_collection()`. 11988/head
authorMarc Fehling <mafehling.git@gmail.com>
Wed, 31 Mar 2021 02:40:48 +0000 (20:40 -0600)
committerMarc Fehling <mafehling.git@gmail.com>
Wed, 31 Mar 2021 02:40:48 +0000 (20:40 -0600)
include/deal.II/dofs/dof_handler.h
source/hp/refinement.cc

index 35a7c578a196a58a0cd61ce53ddd893f94b7c7db..53a21d9aa547923d07ee302d6a26c648ce55dd2c 100644 (file)
@@ -2019,9 +2019,6 @@ template <int dim, int spacedim>
 inline const hp::FECollection<dim, spacedim> &
 DoFHandler<dim, spacedim>::get_fe_collection() const
 {
-  Assert(fe_collection.size() > 0,
-         ExcMessage("No finite element collection is associated with "
-                    "this DoFHandler"));
   return fe_collection;
 }
 
index 5eebda33550b251fc6115545874f462ec1b8a956..a9b568fc63a4501dec6b109d1f5104f00ee683c4 100644 (file)
@@ -45,6 +45,10 @@ namespace hp
     void
     full_p_adaptivity(const dealii::DoFHandler<dim, spacedim> &dof_handler)
     {
+      if (dof_handler.get_fe_collection().size() == 0)
+        // nothing to do
+        return;
+
       Assert(
         dof_handler.has_hp_capabilities(),
         (typename dealii::DoFHandler<dim, spacedim>::ExcOnlyAvailableWithHP()));
@@ -63,6 +67,10 @@ namespace hp
       const dealii::DoFHandler<dim, spacedim> &dof_handler,
       const std::vector<bool> &                p_flags)
     {
+      if (dof_handler.get_fe_collection().size() == 0)
+        // nothing to do
+        return;
+
       Assert(
         dof_handler.has_hp_capabilities(),
         (typename dealii::DoFHandler<dim, spacedim>::ExcOnlyAvailableWithHP()));
@@ -108,6 +116,10 @@ namespace hp
       const ComparisonFunction<typename identity<Number>::type>
         &compare_coarsen)
     {
+      if (dof_handler.get_fe_collection().size() == 0)
+        // nothing to do
+        return;
+
       Assert(
         dof_handler.has_hp_capabilities(),
         (typename dealii::DoFHandler<dim, spacedim>::ExcOnlyAvailableWithHP()));
@@ -143,6 +155,10 @@ namespace hp
       const ComparisonFunction<typename identity<Number>::type>
         &compare_coarsen)
     {
+      if (dof_handler.get_fe_collection().size() == 0)
+        // nothing to do
+        return;
+
       Assert(
         dof_handler.has_hp_capabilities(),
         (typename dealii::DoFHandler<dim, spacedim>::ExcOnlyAvailableWithHP()));
@@ -236,6 +252,10 @@ namespace hp
       const ComparisonFunction<typename identity<Number>::type>
         &compare_coarsen)
     {
+      if (dof_handler.get_fe_collection().size() == 0)
+        // nothing to do
+        return;
+
       Assert(
         dof_handler.has_hp_capabilities(),
         (typename dealii::DoFHandler<dim, spacedim>::ExcOnlyAvailableWithHP()));
@@ -428,6 +448,10 @@ namespace hp
       const dealii::DoFHandler<dim, spacedim> &dof_handler,
       const Vector<Number> &                   sobolev_indices)
     {
+      if (dof_handler.get_fe_collection().size() == 0)
+        // nothing to do
+        return;
+
       Assert(
         dof_handler.has_hp_capabilities(),
         (typename dealii::DoFHandler<dim, spacedim>::ExcOnlyAvailableWithHP()));
@@ -486,6 +510,10 @@ namespace hp
       const ComparisonFunction<typename identity<Number>::type>
         &compare_coarsen)
     {
+      if (dof_handler.get_fe_collection().size() == 0)
+        // nothing to do
+        return;
+
       Assert(
         dof_handler.has_hp_capabilities(),
         (typename dealii::DoFHandler<dim, spacedim>::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<dim, spacedim> &dof_handler)
     {
+      if (dof_handler.get_fe_collection().size() == 0)
+        // nothing to do
+        return;
+
       Assert(
         dof_handler.has_hp_capabilities(),
         (typename dealii::DoFHandler<dim, spacedim>::ExcOnlyAvailableWithHP()));
@@ -651,6 +687,10 @@ namespace hp
     void
     choose_p_over_h(const dealii::DoFHandler<dim, spacedim> &dof_handler)
     {
+      if (dof_handler.get_fe_collection().size() == 0)
+        // nothing to do
+        return;
+
       Assert(
         dof_handler.has_hp_capabilities(),
         (typename dealii::DoFHandler<dim, spacedim>::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<dim, spacedim>::ExcOnlyAvailableWithHP()));

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.