From 79d4cae1756caefd3846608469931f543fbbd191 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Sun, 20 Aug 2017 12:42:06 +0200 Subject: [PATCH] Add an Assert for DoFHandler::get_finite_element() --- include/deal.II/dofs/dof_handler.h | 8 ++++++-- include/deal.II/hp/dof_handler.h | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/deal.II/dofs/dof_handler.h b/include/deal.II/dofs/dof_handler.h index 2d4f0aa5a2..7fa090decb 100644 --- a/include/deal.II/dofs/dof_handler.h +++ b/include/deal.II/dofs/dof_handler.h @@ -836,9 +836,11 @@ public: /** * Return a constant reference to the selected finite element object. + * Since there is only one FiniteElement @index must be equal to zero + * which is also the default value. */ const FiniteElement & - get_finite_element (const unsigned int number=0) const; + get_finite_element (const unsigned int index=0) const; /** * Return a constant reference to the set of finite element objects that @@ -1243,8 +1245,10 @@ template inline const FiniteElement & DoFHandler::get_finite_element -(const unsigned int) const +(const unsigned int index) const { + (void) index; + Assert(index == 0, ExcMessage("There is only one FiniteElement stored. The index must be zero!")); Assert(selected_fe!=nullptr, ExcMessage("You are trying to access the DoFHandler's FiniteElement object before it has been initialized.")); return *selected_fe; diff --git a/include/deal.II/hp/dof_handler.h b/include/deal.II/hp/dof_handler.h index c3b1d33b12..12961669b2 100644 --- a/include/deal.II/hp/dof_handler.h +++ b/include/deal.II/hp/dof_handler.h @@ -665,11 +665,11 @@ namespace hp const hp::FECollection &get_fe () const DEAL_II_DEPRECATED; /** - * Return a constant reference to the ith finite element object that is + * Return a constant reference to the indexth finite element object that is * used by this @p DoFHandler. */ const FiniteElement & - get_finite_element (const unsigned int i) const; + get_finite_element (const unsigned int index) const; /** * Return a constant reference to the set of finite element objects that -- 2.39.5