From: Peter Munch Date: Tue, 13 Apr 2021 19:58:57 +0000 (+0200) Subject: Fix process_dof_indices (for artificial faces in DoFTools::set_periodicity_constraints) X-Git-Tag: v9.3.0-rc1~228^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe17fe1d35fd55047f34df0e8efb4aa80fe8a965;p=dealii.git Fix process_dof_indices (for artificial faces in DoFTools::set_periodicity_constraints) --- diff --git a/include/deal.II/dofs/dof_accessor.templates.h b/include/deal.II/dofs/dof_accessor.templates.h index 9c8ee929be..cb52366be0 100644 --- a/include/deal.II/dofs/dof_accessor.templates.h +++ b/include/deal.II/dofs/dof_accessor.templates.h @@ -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 &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 &, + 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 &, + const unsigned int) const + { + Assert(false, ExcInternalError()); + } + private: const FiniteElement &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 &, + const unsigned int) const + { + Assert(false, ExcInternalError()); + } + private: const FiniteElement &fe; const unsigned int level;