From 3d0aea6addfd0ac31cd1c449b8c7e15592729401 Mon Sep 17 00:00:00 2001 From: Marc Fehling Date: Thu, 6 Oct 2022 11:54:42 -0600 Subject: [PATCH] Apply suggestions from code review. --- include/deal.II/dofs/dof_handler.h | 34 ++++++++++++++++++------------ source/dofs/dof_handler.cc | 2 +- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/include/deal.II/dofs/dof_handler.h b/include/deal.II/dofs/dof_handler.h index 657aa8eeaa..de569d227c 100644 --- a/include/deal.II/dofs/dof_handler.h +++ b/include/deal.II/dofs/dof_handler.h @@ -581,15 +581,16 @@ public: /** * For each locally owned cell, set the active finite element index to the - * corresponding value given in @p active_fe_indices. Indices must be in the - * order how we iterate over active cells. + * corresponding value given in @p active_fe_indices. + * + * The vector @p active_fe_indices needs to have as many entries as there + * are active cells. The FE indices must be in the order in which we iterate + * over active cells. Vector entries corresponding to active cells that are + * not locally owned are ignored. * * Active FE indices will only be set for locally owned cells. Ghost and * artificial cells will be ignored; no active FE index will be assigned to * them. - * - * The vector @p active_fe_indices is assumed to have as many entries as - * there are active cells. */ void set_active_fe_indices(const std::vector &active_fe_indices); @@ -605,7 +606,7 @@ public: /** * For each locally relevant cell, extract the active finite element index and - * return them in the order how we iterate over active cells. + * return them in the order in which we iterate over active cells. * * As we do not know the active FE index on artificial cells, they are set to * the invalid value numbers::invalid_fe_index. @@ -613,13 +614,15 @@ public: * For DoFHandler objects without hp-capabilities, the vector will consist of * zeros, indicating that all cells use the same finite element. In hp-mode, * the values may be different, though. + * + * The returned vector has as many entries as there are active cells. */ std::vector get_active_fe_indices() const; /** * For each locally relevant cell, extract the active finite element index and - * fill the vector @p active_fe_indices in the order how we iterate over + * fill the vector @p active_fe_indices in the order in which we iterate over * active cells. This vector is resized, if necessary. * * As we do not know the active FE index on artificial cells, they are set to @@ -629,6 +632,8 @@ public: * zeros, indicating that all cells use the same finite element. In hp-mode, * the values may be different, though. * + * The returned vector has as many entries as there are active cells. + * * @deprecated Use get_active_fe_indices() that returns the result vector. */ DEAL_II_DEPRECATED_EARLY @@ -637,26 +642,29 @@ public: /** * For each locally owned cell, set the future finite element index to the - * corresponding value given in @p future_fe_indices. Indices must be in the - * order how we iterate over active cells. + * corresponding value given in @p future_fe_indices. + * + * The vector @p future_fe_indices needs to have as many entries as there + * are active cells. The FE indices must be in the order in which we iterate + * over active cells. Vector entries corresponding to active cells that are + * not locally owned are ignored. * * Future FE indices will only be set for locally owned cells. Ghost and * artificial cells will be ignored; no future FE index will be assigned to * them. - * - * The vector @p future_fe_indices is assumed to have as many entries as - * there are active cells. */ void set_future_fe_indices(const std::vector &future_fe_indices); /** * For each locally owned cell, extract the future finite element index and - * return them in the order how we iterate over active cells. + * return them in the order in which we iterate over active cells. * * As we do not know the future FE index on ghost and artificial cells, they * are set to the invalid value numbers::invalid_fe_index. The same applies to * locally owned cells that have no future FE index assigned. + * + * The returned vector has as many entries as there are active cells. */ std::vector get_future_fe_indices() const; diff --git a/source/dofs/dof_handler.cc b/source/dofs/dof_handler.cc index 4eab815d31..0e91d85544 100644 --- a/source/dofs/dof_handler.cc +++ b/source/dofs/dof_handler.cc @@ -2619,7 +2619,7 @@ void DoFHandler::get_active_fe_indices( std::vector &active_fe_indices) const { - std::vector indices = get_active_fe_indices(); + const std::vector indices = get_active_fe_indices(); active_fe_indices.assign(indices.begin(), indices.end()); } -- 2.39.5