]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Don't pass const unsigned int by reference
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 25 Aug 2018 17:39:12 +0000 (19:39 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sun, 26 Aug 2018 10:50:41 +0000 (12:50 +0200)
18 files changed:
include/deal.II/base/patterns.h
include/deal.II/base/quadrature_lib.h
include/deal.II/fe/fe_series.h
include/deal.II/fe/mapping.h
include/deal.II/grid/grid_tools.h
include/deal.II/meshworker/mesh_loop.h
include/deal.II/numerics/vector_tools.templates.h
include/deal.II/sundials/arkode.h
include/deal.II/sundials/ida.h
include/deal.II/sundials/kinsol.h
source/base/patterns.cc
source/base/polynomials_nedelec.cc
source/base/quadrature_lib.cc
source/dofs/dof_handler.cc
source/fe/fe_nedelec.cc
source/fe/fe_q_hierarchical.cc
source/fe/mapping.cc
source/hp/dof_handler.cc

index cf675452fe6d510b07c545d2a2bce3eb6c1a5272..9414567e8a4bbe1b872e153cba03f3ed0290b727 100644 (file)
@@ -860,7 +860,7 @@ namespace Patterns
      * Return a reference to the i-th pattern in the tuple.
      */
     const PatternBase &
-    get_pattern(const unsigned int &i) const;
+    get_pattern(const unsigned int i) const;
 
     /**
      * Return the separator of the tuple entries.
index 87fa1d54b3c7fbaffbb0a75e10a1ddc316ea7092..57c16efa10195579f566b35fe7720a000707728c 100644 (file)
@@ -686,7 +686,7 @@ public:
    *
    * @param n Order of QGauss quadrature
    */
-  QTrianglePolar(const unsigned int &n);
+  QTrianglePolar(const unsigned int n);
 };
 
 /**
index 40e95844f0718768ac670fc0a905460f255cf30c..652ce9c24bdca8cc34385f3fe7d969a01d8440e4 100644 (file)
@@ -305,8 +305,8 @@ namespace internal
       if (pred_pair.first == false)
         return;
 
-      const unsigned int &pred_value  = pred_pair.second;
-      const T &           coeff_value = coefficients(ind);
+      const unsigned int pred_value  = pred_pair.second;
+      const T &          coeff_value = coefficients(ind);
       // If pred_value is not in the pred_to_values map, the element will be
       // created. Otherwise a reference to the existing element is returned.
       pred_to_values[pred_value].push_back(coeff_value);
index 391c822a159809a4cf8a65fc0958e41124099e8b..b5ca1f949f518ad282428b68755e0b3a5794bda2 100644 (file)
@@ -416,7 +416,7 @@ public:
   Point<dim - 1>
   project_real_point_to_unit_point_on_face(
     const typename Triangulation<dim, spacedim>::cell_iterator &cell,
-    const unsigned int &                                        face_no,
+    const unsigned int                                          face_no,
     const Point<spacedim> &                                     p) const;
 
   /**
index 44adc18cc72386ed4a867861cf7abee35eb439bc..2414cd72b3e00651193c5720bf8ee0e9b1ad477e 100644 (file)
@@ -2603,7 +2603,7 @@ namespace GridTools
    *             };
    *
    * auto unpack = [] (const active_cell_iterator &cell,
-   *                   const unsigned int &active_fe_index) -> void
+   *                   const unsigned int active_fe_index) -> void
    *               {
    *                 cell->set_active_fe_index(active_fe_index);
    *               };
index 14b8e41db88ce012b65501eae9d03f22992a847f..f2a53f05023b9ca5fe51639192a1424400a41bd4 100644 (file)
@@ -132,28 +132,28 @@ namespace MeshWorker
             const AssembleFlags flags = assemble_own_cells,
 
             const typename identity<std::function<void(const CellIteratorType &,
-                                                       const unsigned int &,
+                                                       const unsigned int,
                                                        ScratchData &,
                                                        CopyData &)>>::type
               &boundary_worker = std::function<void(const CellIteratorType &,
-                                                    const unsigned int &,
+                                                    const unsigned int,
                                                     ScratchData &,
                                                     CopyData &)>(),
 
             const typename identity<std::function<void(const CellIteratorType &,
-                                                       const unsigned int &,
-                                                       const unsigned int &,
+                                                       const unsigned int,
+                                                       const unsigned int,
                                                        const CellIteratorType &,
-                                                       const unsigned int &,
-                                                       const unsigned int &,
+                                                       const unsigned int,
+                                                       const unsigned int,
                                                        ScratchData &,
                                                        CopyData &)>>::type
               &face_worker = std::function<void(const CellIteratorType &,
-                                                const unsigned int &,
-                                                const unsigned int &,
+                                                const unsigned int,
+                                                const unsigned int,
                                                 const CellIteratorType &,
-                                                const unsigned int &,
-                                                const unsigned int &,
+                                                const unsigned int,
+                                                const unsigned int,
                                                 ScratchData &,
                                                 CopyData &)>(),
 
index 8980930b52bab6cf1c7f2c99bd9cb32a670328c3..e975b69b60e36ed848e48a213f0e220b1d68d145 100644 (file)
@@ -6667,7 +6667,7 @@ namespace VectorTools
             // choose the one, which was computed with the higher order
             // element. If both elements are of the same order, we just
             // keep the first value and do not compute a second one.
-            const unsigned int &                 n_dofs = dof_handler.n_dofs();
+            const unsigned int                   n_dofs = dof_handler.n_dofs();
             std::vector<double>                  dof_values(n_dofs);
             std::vector<types::global_dof_index> projected_dofs(n_dofs);
 
@@ -6832,7 +6832,7 @@ namespace VectorTools
 
         case 3:
           {
-            const unsigned int &                 n_dofs = dof_handler.n_dofs();
+            const unsigned int                   n_dofs = dof_handler.n_dofs();
             std::vector<double>                  dof_values(n_dofs);
             std::vector<types::global_dof_index> projected_dofs(n_dofs);
 
index e8fb2b46961bbb8b177b1c732e61e2b50e3c5d76..95e56c772ff1dcce7de94ae51ef48ebab988b7f6 100644 (file)
@@ -350,11 +350,11 @@ namespace SUNDIALS
         const double &initial_step_size = 1e-2,
         const double &output_period     = 1e-1,
         // Running parameters
-        const double &      minimum_step_size                     = 1e-6,
-        const unsigned int &maximum_order                         = 5,
-        const unsigned int &maximum_non_linear_iterations         = 10,
-        const bool          implicit_function_is_linear           = false,
-        const bool          implicit_function_is_time_independent = false,
+        const double &     minimum_step_size                     = 1e-6,
+        const unsigned int maximum_order                         = 5,
+        const unsigned int maximum_non_linear_iterations         = 10,
+        const bool         implicit_function_is_linear           = false,
+        const bool         implicit_function_is_time_independent = false,
         // Error parameters
         const double &absolute_tolerance = 1e-6,
         const double &relative_tolerance = 1e-5)
index 969c0003935ad8bd11a1afd4d85e6459bc4f75f0..ad48bd2ec54f531ea00d761160465ba79758bf54 100644 (file)
@@ -309,9 +309,9 @@ namespace SUNDIALS
         const double &initial_step_size = 1e-2,
         const double &output_period     = 1e-1,
         // Running parameters
-        const double &      minimum_step_size             = 1e-6,
-        const unsigned int &maximum_order                 = 5,
-        const unsigned int &maximum_non_linear_iterations = 10,
+        const double &     minimum_step_size             = 1e-6,
+        const unsigned int maximum_order                 = 5,
+        const unsigned int maximum_non_linear_iterations = 10,
         // Error parameters
         const double &absolute_tolerance                = 1e-6,
         const double &relative_tolerance                = 1e-5,
@@ -319,7 +319,7 @@ namespace SUNDIALS
         // Initial conditions parameters
         const InitialConditionCorrection &ic_type    = use_y_diff,
         const InitialConditionCorrection &reset_type = use_y_diff,
-        const unsigned int &              maximum_non_linear_iterations_ic = 5)
+        const unsigned int                maximum_non_linear_iterations_ic = 5)
         : initial_time(initial_time)
         , final_time(final_time)
         , initial_step_size(initial_step_size)
index 5dd42d8ef3ed032bd72d576066d8a203ead28b4f..0c7dfab7c3c80f31cc473ebc827440b47793651f 100644 (file)
@@ -259,15 +259,15 @@ namespace SUNDIALS
       AdditionalData(
         // Global parameters
         const SolutionStrategy &strategy                      = linesearch,
-        const unsigned int &    maximum_non_linear_iterations = 200,
+        const unsigned int      maximum_non_linear_iterations = 200,
         const double &          function_tolerance            = 0.0,
         const double &          step_tolerance                = 0.0,
         const bool &            no_init_setup                 = false,
-        const unsigned int &    maximum_setup_calls           = 0,
+        const unsigned int      maximum_setup_calls           = 0,
         const double &          maximum_newton_step           = 0.0,
         const double &          dq_relative_error             = 0.0,
-        const unsigned int &    maximum_beta_failures         = 0,
-        const unsigned int &    anderson_subspace_size        = 0)
+        const unsigned int      maximum_beta_failures         = 0,
+        const unsigned int      anderson_subspace_size        = 0)
         : strategy(strategy)
         , maximum_non_linear_iterations(maximum_non_linear_iterations)
         , function_tolerance(function_tolerance)
index 52a8965610762153d80ec0e00efbb8a631af81b2..4e883abea17adf7c229c3413d4628776e0a52f5c 100644 (file)
@@ -1216,7 +1216,7 @@ namespace Patterns
 
 
   const PatternBase &
-  Tuple::get_pattern(const unsigned int &i) const
+  Tuple::get_pattern(const unsigned int i) const
   {
     return *patterns[i];
   }
index 5484e308fb62af3ca4ec969aacffeb072cc85871..44351c39955b1f92c0f2a2daafc3b4c5139b61eb 100644 (file)
@@ -80,7 +80,7 @@ PolynomialsNedelec<dim>::compute(
   // and second derivatives vectors of
   // <tt>polynomial_space</tt> at
   // <tt>unit_point</tt>
-  const unsigned int &n_basis = polynomial_space.n();
+  const unsigned int  n_basis = polynomial_space.n();
   std::vector<double> unit_point_values((values.size() == 0) ? 0 : n_basis);
   std::vector<Tensor<1, dim>> unit_point_grads((grads.size() == 0) ? 0 :
                                                                      n_basis);
index 1e0ab46bb5682a2dc68dd17e2540379340b50aa6..2d5247c197f41c955de740d5d43c5a99471e3f30 100644 (file)
@@ -1275,7 +1275,7 @@ QTrianglePolar::QTrianglePolar(const Quadrature<1> &radial_quadrature,
 
 
 
-QTrianglePolar::QTrianglePolar(const unsigned int &n)
+QTrianglePolar::QTrianglePolar(const unsigned int n)
   : QTrianglePolar(QGauss<1>(n), QGauss<1>(n))
 {}
 
index 7da33fb08a2daf7c5759c4948df9997f36ffa65a..81b173e18c443ba6ce0a04b591bb75707042fea4 100644 (file)
@@ -399,8 +399,8 @@ namespace internal
 
         const dealii::Triangulation<1, spacedim> &tria =
           dof_handler.get_triangulation();
-        const unsigned int &dofs_per_line = dof_handler.get_fe().dofs_per_line;
-        const unsigned int &n_levels      = tria.n_levels();
+        const unsigned int dofs_per_line = dof_handler.get_fe().dofs_per_line;
+        const unsigned int n_levels      = tria.n_levels();
 
         for (unsigned int i = 0; i < n_levels; ++i)
           {
@@ -412,7 +412,7 @@ namespace internal
                                                    numbers::invalid_dof_index);
           }
 
-        const unsigned int &n_vertices = tria.n_vertices();
+        const unsigned int n_vertices = tria.n_vertices();
 
         dof_handler.mg_vertex_dofs.resize(n_vertices);
 
@@ -470,7 +470,7 @@ namespace internal
         const dealii::FiniteElement<2, spacedim> &fe = dof_handler.get_fe();
         const dealii::Triangulation<2, spacedim> &tria =
           dof_handler.get_triangulation();
-        const unsigned int &n_levels = tria.n_levels();
+        const unsigned int n_levels = tria.n_levels();
 
         for (unsigned int i = 0; i < n_levels; ++i)
           {
@@ -488,7 +488,7 @@ namespace internal
         dof_handler.mg_faces->lines.dofs = std::vector<types::global_dof_index>(
           tria.n_raw_lines() * fe.dofs_per_line, numbers::invalid_dof_index);
 
-        const unsigned int &n_vertices = tria.n_vertices();
+        const unsigned int n_vertices = tria.n_vertices();
 
         dof_handler.mg_vertex_dofs.resize(n_vertices);
 
@@ -545,7 +545,7 @@ namespace internal
         const dealii::FiniteElement<3, spacedim> &fe = dof_handler.get_fe();
         const dealii::Triangulation<3, spacedim> &tria =
           dof_handler.get_triangulation();
-        const unsigned int &n_levels = tria.n_levels();
+        const unsigned int n_levels = tria.n_levels();
 
         for (unsigned int i = 0; i < n_levels; ++i)
           {
@@ -565,7 +565,7 @@ namespace internal
         dof_handler.mg_faces->quads.dofs = std::vector<types::global_dof_index>(
           tria.n_raw_quads() * fe.dofs_per_quad, numbers::invalid_dof_index);
 
-        const unsigned int &n_vertices = tria.n_vertices();
+        const unsigned int n_vertices = tria.n_vertices();
 
         dof_handler.mg_vertex_dofs.resize(n_vertices);
 
index 68904854aa0c96179d59bb674bbec42f59eda809..06139b146b5946e4ec3a8db3dae383bb3372584c 100644 (file)
@@ -284,8 +284,8 @@ FE_Nedelec<2>::initialize_support_points(const unsigned int order)
       // If the polynomial degree is positive
       // we have support points on the faces
       // and in the interior of a cell.
-      const QGauss<dim>   quadrature(order + 1);
-      const unsigned int &n_interior_points = quadrature.size();
+      const QGauss<dim>  quadrature(order + 1);
+      const unsigned int n_interior_points = quadrature.size();
 
       this->generalized_support_points.resize(n_boundary_points +
                                               n_interior_points);
@@ -348,7 +348,7 @@ FE_Nedelec<3>::initialize_support_points(const unsigned int order)
   // Initialize quadratures to obtain
   // quadrature points later on.
   const QGauss<1>            reference_edge_quadrature(order + 1);
-  const unsigned int &       n_edge_points = reference_edge_quadrature.size();
+  const unsigned int         n_edge_points = reference_edge_quadrature.size();
   const Quadrature<dim - 1> &edge_quadrature =
     QProjector<dim - 1>::project_to_all_faces(reference_edge_quadrature);
 
@@ -358,12 +358,12 @@ FE_Nedelec<3>::initialize_support_points(const unsigned int order)
       // we have support points on the edges,
       // faces and in the interior of a cell.
       const QGauss<dim - 1> reference_face_quadrature(order + 1);
-      const unsigned int &  n_face_points = reference_face_quadrature.size();
+      const unsigned int    n_face_points = reference_face_quadrature.size();
       const unsigned int    n_boundary_points =
         GeometryInfo<dim>::lines_per_cell * n_edge_points +
         GeometryInfo<dim>::faces_per_cell * n_face_points;
-      const QGauss<dim>   quadrature(order + 1);
-      const unsigned int &n_interior_points = quadrature.size();
+      const QGauss<dim>  quadrature(order + 1);
+      const unsigned int n_interior_points = quadrature.size();
 
       boundary_weights.reinit(n_edge_points + n_face_points,
                               2 * (order + 1) * order);
@@ -524,8 +524,8 @@ FE_Nedelec<dim>::initialize_restriction()
   const QGauss<1>              edge_quadrature(2 * this->degree);
   const std::vector<Point<1>> &edge_quadrature_points =
     edge_quadrature.get_points();
-  const unsigned int &n_edge_quadrature_points = edge_quadrature.size();
-  const unsigned int  index = RefinementCase<dim>::isotropic_refinement - 1;
+  const unsigned int n_edge_quadrature_points = edge_quadrature.size();
+  const unsigned int index = RefinementCase<dim>::isotropic_refinement - 1;
 
   switch (dim)
     {
@@ -764,7 +764,7 @@ FE_Nedelec<dim>::initialize_restriction()
                   Polynomials::Lobatto::generate_complete_basis(this->degree);
               const unsigned int n_boundary_dofs =
                 GeometryInfo<dim>::faces_per_cell * this->degree;
-              const unsigned int &n_quadrature_points = quadrature.size();
+              const unsigned int n_quadrature_points = quadrature.size();
 
               {
                 FullMatrix<double> assembling_matrix((this->degree - 1) *
@@ -1261,7 +1261,7 @@ FE_Nedelec<dim>::initialize_restriction()
                   Polynomials::Lobatto::generate_complete_basis(this->degree);
               const unsigned int n_edge_dofs =
                 GeometryInfo<dim>::lines_per_cell * this->degree;
-              const unsigned int &n_face_quadrature_points =
+              const unsigned int n_face_quadrature_points =
                 face_quadrature.size();
 
               {
@@ -1598,7 +1598,7 @@ FE_Nedelec<dim>::initialize_restriction()
               const unsigned int n_boundary_dofs =
                 2 * GeometryInfo<dim>::faces_per_cell * deg * this->degree +
                 n_edge_dofs;
-              const unsigned int &n_quadrature_points = quadrature.size();
+              const unsigned int n_quadrature_points = quadrature.size();
 
               {
                 FullMatrix<double> assembling_matrix(deg * deg * this->degree,
@@ -2575,7 +2575,7 @@ FE_Nedelec<dim>::get_subface_interpolation_matrix(
   const QGauss<1>              edge_quadrature(source_fe.degree);
   const std::vector<Point<1>> &edge_quadrature_points =
     edge_quadrature.get_points();
-  const unsigned int &n_edge_quadrature_points = edge_quadrature.size();
+  const unsigned int n_edge_quadrature_points = edge_quadrature.size();
 
   switch (dim)
     {
@@ -2830,7 +2830,7 @@ FE_Nedelec<dim>::get_subface_interpolation_matrix(
                     source_fe.degree);
               const unsigned int n_boundary_dofs =
                 GeometryInfo<dim>::lines_per_face * source_fe.degree;
-              const unsigned int &n_quadrature_points = quadrature.size();
+              const unsigned int n_quadrature_points = quadrature.size();
 
               {
                 FullMatrix<double> assembling_matrix(source_fe.degree *
@@ -3117,7 +3117,7 @@ FE_Nedelec<dim>::convert_generalized_support_point_values_to_dof_values(
           // Let us begin with the
           // interpolation part.
           const QGauss<dim - 1> reference_edge_quadrature(this->degree);
-          const unsigned int &n_edge_points = reference_edge_quadrature.size();
+          const unsigned int n_edge_points = reference_edge_quadrature.size();
 
           for (unsigned int i = 0; i < 2; ++i)
             for (unsigned int j = 0; j < 2; ++j)
@@ -3230,8 +3230,8 @@ FE_Nedelec<dim>::convert_generalized_support_point_values_to_dof_values(
               // horizontal and the
               // vertical, interior
               // shape functions.
-              const QGauss<dim>   reference_quadrature(this->degree);
-              const unsigned int &n_interior_points =
+              const QGauss<dim>  reference_quadrature(this->degree);
+              const unsigned int n_interior_points =
                 reference_quadrature.size();
               const std::vector<Polynomials::Polynomial<double>>
                 &legendre_polynomials =
@@ -3381,8 +3381,8 @@ FE_Nedelec<dim>::convert_generalized_support_point_values_to_dof_values(
         {
           // Let us begin with the
           // interpolation part.
-          const QGauss<1>     reference_edge_quadrature(this->degree);
-          const unsigned int &n_edge_points = reference_edge_quadrature.size();
+          const QGauss<1>    reference_edge_quadrature(this->degree);
+          const unsigned int n_edge_points = reference_edge_quadrature.size();
 
           for (unsigned int q_point = 0; q_point < n_edge_points; ++q_point)
             {
index 896834421396b8a76dc4d9adb2de4ea76a947433..06294e3aa21fb00aa7db71e29a0df21319354e82 100644 (file)
@@ -266,8 +266,8 @@ FE_Q_Hierarchical<dim>::hp_line_dof_identities(
   // one is an FE_Nothing.
   if (dynamic_cast<const FE_Q_Hierarchical<dim> *>(&fe_other) != nullptr)
     {
-      const unsigned int &this_dpl  = this->dofs_per_line;
-      const unsigned int &other_dpl = fe_other.dofs_per_line;
+      const unsigned int this_dpl  = this->dofs_per_line;
+      const unsigned int other_dpl = fe_other.dofs_per_line;
 
       // we deal with hierarchical 1d polynomials where dofs are enumerated
       // increasingly. Thus we return a vector of pairs for the first N-1, where
@@ -304,8 +304,8 @@ FE_Q_Hierarchical<dim>::hp_quad_dof_identities(
   // one is an FE_Nothing.
   if (dynamic_cast<const FE_Q_Hierarchical<dim> *>(&fe_other) != nullptr)
     {
-      const unsigned int &this_dpq  = this->dofs_per_quad;
-      const unsigned int &other_dpq = fe_other.dofs_per_quad;
+      const unsigned int this_dpq  = this->dofs_per_quad;
+      const unsigned int other_dpq = fe_other.dofs_per_quad;
 
       // we deal with hierarchical 1d polynomials where dofs are enumerated
       // increasingly. Thus we return a vector of pairs for the first N-1, where
index 11da97210d6d599ef7fc76dd9e99832a071cf508..7222e6d7066b06cf446edfb60dc1734f1e35b6ff 100644 (file)
@@ -39,7 +39,7 @@ template <int dim, int spacedim>
 Point<dim - 1>
 Mapping<dim, spacedim>::project_real_point_to_unit_point_on_face(
   const typename Triangulation<dim, spacedim>::cell_iterator &cell,
-  const unsigned int &                                        face_no,
+  const unsigned int                                          face_no,
   const Point<spacedim> &                                     p) const
 {
   // The function doesn't make physical sense for dim=1
index 583be7eb3a0c20f862132367551c0501f6a06b0d..b60518903e0ec5458b3e35f0dc2dd05d2f014bc7 100644 (file)
@@ -970,7 +970,7 @@ namespace internal
                 [&dof_handler](
                   const typename dealii::hp::DoFHandler<dim, spacedim>::
                     active_cell_iterator &cell,
-                  const unsigned int &    active_fe_index) -> void {
+                  const unsigned int      active_fe_index) -> void {
                 // we would like to say
                 //   cell->set_active_fe_index(active_fe_index);
                 // but this is not allowed on cells that are not

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.