]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix process_dof_indices (for artificial faces in DoFTools::set_periodicity_constraints) 12040/head
authorPeter Munch <peterrmuench@gmail.com>
Tue, 13 Apr 2021 19:58:57 +0000 (21:58 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Tue, 13 Apr 2021 21:29:59 +0000 (23:29 +0200)
include/deal.II/dofs/dof_accessor.templates.h

index 9c8ee929be075d7423d768efee6a557c555ee14d..cb52366be0e3db6e9a186cc4dc85b530ecc55cb4 100644 (file)
@@ -896,8 +896,8 @@ namespace internal
         // can be called even if level_dof_access==false.
         (void)count_level_dofs;
 
-        AssertDimension(dof_indices.size(),
-                        n_dof_indices(accessor, fe_index, count_level_dofs));
+        AssertIndexRange(n_dof_indices(accessor, fe_index, count_level_dofs),
+                         dof_indices.size() + 1);
 
         const auto &fe = accessor.get_fe(fe_index);
 
@@ -958,7 +958,17 @@ namespace internal
                                    dof_indices,
                                    fe_index);
 
-        AssertDimension(dof_indices.size(), index);
+        AssertDimension(n_dof_indices(accessor, fe_index, count_level_dofs),
+                        index);
+
+        // PM: This is a part that should not be reached since it indicates that
+        // an object (and/or its subobjects) is not active. However,
+        // unfortunately this function is called by
+        // DoFTools::set_periodicity_constraints() indirectly by
+        // get_dof_indices() also for artificial faces to determine if a face
+        // is artificial.
+        for (; index < dof_indices.size(); ++index)
+          dof_operation.process_non_active_dof(dof_indices, index);
       }
 
 
@@ -1046,6 +1056,17 @@ namespace internal
         {
           Assert(false, ExcInternalError());
         }
+
+        /**
+         * Process non-active DoF.
+         */
+        DEAL_II_ALWAYS_INLINE void
+        process_non_active_dof(
+          std::vector<types::global_dof_index> &dof_indices,
+          const unsigned int                    index) const
+        {
+          dof_indices[index] = numbers::invalid_dof_index;
+        }
       };
 
 
@@ -1133,6 +1154,16 @@ namespace internal
         {
           Assert(false, ExcInternalError());
         }
+
+        /**
+         * Process non-active DoF.
+         */
+        DEAL_II_ALWAYS_INLINE void
+        process_non_active_dof(const std::vector<types::global_dof_index> &,
+                               const unsigned int) const
+        {
+          Assert(false, ExcInternalError());
+        }
       };
 
 
@@ -1208,6 +1239,16 @@ namespace internal
           Assert(false, ExcInternalError());
         }
 
+        /**
+         * Process non-active DoF.
+         */
+        DEAL_II_ALWAYS_INLINE void
+        process_non_active_dof(std::vector<types::global_dof_index> &,
+                               const unsigned int) const
+        {
+          Assert(false, ExcInternalError());
+        }
+
       private:
         const FiniteElement<dim, spacedim> &fe;
         const unsigned int                  level;
@@ -1288,6 +1329,16 @@ namespace internal
           Assert(false, ExcInternalError());
         }
 
+        /**
+         * Process non-active DoF.
+         */
+        DEAL_II_ALWAYS_INLINE void
+        process_non_active_dof(const std::vector<types::global_dof_index> &,
+                               const unsigned int) const
+        {
+          Assert(false, ExcInternalError());
+        }
+
       private:
         const FiniteElement<dim, spacedim> &fe;
         const unsigned int                  level;

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.