]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make DoFAccessor::set_active_fe_index() a 'const' function. 4817/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Sun, 13 Aug 2017 19:21:43 +0000 (13:21 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Sun, 13 Aug 2017 19:21:43 +0000 (13:21 -0600)
We are not being very consistent in marking which DoFAccessor functions are 'const'
because it's difficult to actually define what 'const' would mean: does it change
the accessor, or does it change the DoFHandler it points to. As a consequence,
the TriaAccessor member functions are *all* const, but the DoFAccessor functions
are more or less random.

Rather than attacking this problem altogether, I'm making the minimal change that
solves the problem I currently have.

include/deal.II/dofs/dof_accessor.h
include/deal.II/dofs/dof_accessor.templates.h

index b7944069fe00792d671da47cbd401ec862cd30cb..c848eb9de9dbc7210f16ea51500957767dfe76c4 100644 (file)
@@ -1710,7 +1710,7 @@ public:
    * associated with them without having any degrees of freedom. Consequently,
    * this function will produce an exception when called on non-active cells.
    */
-  void set_active_fe_index (const unsigned int i);
+  void set_active_fe_index (const unsigned int i) const;
   /**
    * @}
    */
index 881af450ac45c65d81d5e197c9db7012c121911e..a7953d72730038bd148bfecaca1c6bf693978c0e 100644 (file)
@@ -3116,7 +3116,7 @@ namespace internal
       template <int dim, int spacedim, bool level_dof_access>
       static
       void
-      set_active_fe_index (DoFCellAccessor<dealii::hp::DoFHandler<dim,spacedim>, level_dof_access> &accessor,
+      set_active_fe_index (const DoFCellAccessor<dealii::hp::DoFHandler<dim,spacedim>, level_dof_access> &accessor,
                            const unsigned int                                      i)
       {
         typedef dealii::DoFAccessor<dim,DoFHandler<dim,spacedim>, level_dof_access> BaseClass;
@@ -3771,7 +3771,7 @@ DoFCellAccessor<DoFHandlerType,level_dof_access>::active_fe_index () const
 template <typename DoFHandlerType, bool level_dof_access>
 inline
 void
-DoFCellAccessor<DoFHandlerType,level_dof_access>::set_active_fe_index (const unsigned int i)
+DoFCellAccessor<DoFHandlerType,level_dof_access>::set_active_fe_index (const unsigned int i) const
 {
   Assert ((dynamic_cast<const dealii::DoFHandler<DoFHandlerType::dimension,DoFHandlerType::space_dimension>*>
            (this->dof_handler) != nullptr)

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.