From: Wolfgang Bangerth Date: Tue, 7 Jan 2020 04:25:54 +0000 (-0700) Subject: Mark some input arguments as 'const'. X-Git-Tag: v9.2.0-rc1~734^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=757c2b0208872d71fc63cb64497f8ab4322ddef2;p=dealii.git Mark some input arguments as 'const'. This requires to also make a 'std::vector' argument a reference. Incidentally, this also matches our usual style. --- diff --git a/include/deal.II/dofs/dof_tools.h b/include/deal.II/dofs/dof_tools.h index 31f33893b4..cee3ae9e41 100644 --- a/include/deal.II/dofs/dof_tools.h +++ b/include/deal.II/dofs/dof_tools.h @@ -2262,7 +2262,7 @@ namespace DoFTools const DoFHandlerType & dof_handler, std::vector &dofs_per_component, const bool vector_valued_once = false, - std::vector target_component = {}); + const std::vector & target_component = {}); /** * Count the degrees of freedom in each block. This function is similar to diff --git a/source/dofs/dof_tools.cc b/source/dofs/dof_tools.cc index da3cb6402e..cc1d0ba1eb 100644 --- a/source/dofs/dof_tools.cc +++ b/source/dofs/dof_tools.cc @@ -1900,13 +1900,15 @@ namespace DoFTools } // namespace } // namespace internal + + template void count_dofs_per_component( const DoFHandlerType & dof_handler, std::vector &dofs_per_component, - bool only_once, - std::vector target_component) + const bool only_once, + const std::vector & target_component_) { const unsigned int n_components = dof_handler.get_fe(0).n_components(); @@ -1916,6 +1918,7 @@ namespace DoFTools // If the empty vector was given as default argument, set up this // vector as identity. + std::vector target_component = target_component_; if (target_component.size() == 0) { target_component.resize(n_components); diff --git a/source/dofs/dof_tools.inst.in b/source/dofs/dof_tools.inst.in index 49ac735e01..19db8f6970 100644 --- a/source/dofs/dof_tools.inst.in +++ b/source/dofs/dof_tools.inst.in @@ -398,15 +398,15 @@ for (deal_II_dimension : DIMENSIONS) template void DoFTools::count_dofs_per_component< DoFHandler>(const DoFHandler &, std::vector &, - bool, - std::vector); + const bool, + const std::vector &); template void DoFTools::count_dofs_per_component>( const hp::DoFHandler &, std::vector &, - bool, - std::vector); + const bool, + const std::vector &); #if deal_II_dimension < 3 @@ -414,15 +414,15 @@ for (deal_II_dimension : DIMENSIONS) DoFHandler>( const DoFHandler &, std::vector &, - bool, - std::vector); + const bool, + const std::vector &); template void DoFTools::count_dofs_per_component< hp::DoFHandler>( const hp::DoFHandler &, std::vector &, - bool, - std::vector); + const bool, + const std::vector &); template void DoFTools::extract_level_dofs< DoFHandler>( @@ -438,14 +438,14 @@ for (deal_II_dimension : DIMENSIONS) template void DoFTools::count_dofs_per_component>( const DoFHandler<1, 3> &, std::vector &, - bool, - std::vector); + const bool, + const std::vector &); template void DoFTools::count_dofs_per_component>( const hp::DoFHandler<1, 3> &, std::vector &, - bool, - std::vector); + const bool, + const std::vector &); template void DoFTools::extract_level_dofs>( const unsigned int level,