]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Don't pass const double by reference
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 25 Aug 2018 17:47:44 +0000 (19:47 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sun, 26 Aug 2018 10:50:41 +0000 (12:50 +0200)
19 files changed:
include/deal.II/base/parameter_handler.h
include/deal.II/base/vectorization.h
include/deal.II/differentiation/ad/adolc_math.h
include/deal.II/numerics/kdtree.h
include/deal.II/numerics/vector_tools.templates.h
include/deal.II/opencascade/utilities.h
include/deal.II/sundials/arkode.h
include/deal.II/sundials/ida.h
include/deal.II/sundials/kinsol.h
source/base/function_cspline.cc
source/base/function_spherical.cc
source/base/parameter_handler.cc
source/grid/grid_tools_dof_handlers.cc
source/lac/trilinos_solver.cc
source/numerics/kdtree.cc
source/opencascade/utilities.cc
source/opencascade/utilities.inst.in
source/sundials/arkode.cc
source/sundials/ida.cc

index 2cf6b492f16579c173d04c874854a453cfd7e081..a6fc80fdf7717a3699ab5e6eaad099630a0d2ff9 100644 (file)
@@ -1305,7 +1305,7 @@ public:
    * the new value does not conform to the pattern for this entry.
    */
   void
-  set(const std::string &entry_name, const double &new_value);
+  set(const std::string &entry_name, const double new_value);
 
   /**
    * Change the value presently stored for <tt>entry_name</tt> to the one
index 94aa7e9aa550226b2e4d22001dc50516d31a3c36..084980e07722b153126275f65769ba2c7c52fa66 100644 (file)
@@ -2976,7 +2976,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray<Number>
  * @relatesalso VectorizedArray
  */
 inline DEAL_II_ALWAYS_INLINE VectorizedArray<float>
-                             operator+(const double &u, const VectorizedArray<float> &v)
+                             operator+(const double u, const VectorizedArray<float> &v)
 {
   VectorizedArray<float> tmp;
   tmp = u;
@@ -3005,7 +3005,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray<Number>
  * @relatesalso VectorizedArray
  */
 inline DEAL_II_ALWAYS_INLINE VectorizedArray<float>
-                             operator+(const VectorizedArray<float> &v, const double &u)
+                             operator+(const VectorizedArray<float> &v, const double u)
 {
   return u + v;
 }
@@ -3034,7 +3034,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray<Number>
  * @relatesalso VectorizedArray
  */
 inline DEAL_II_ALWAYS_INLINE VectorizedArray<float>
-                             operator-(const double &u, const VectorizedArray<float> &v)
+                             operator-(const double u, const VectorizedArray<float> &v)
 {
   VectorizedArray<float> tmp;
   tmp = float(u);
@@ -3065,7 +3065,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray<Number>
  * @relatesalso VectorizedArray
  */
 inline DEAL_II_ALWAYS_INLINE VectorizedArray<float>
-                             operator-(const VectorizedArray<float> &v, const double &u)
+                             operator-(const VectorizedArray<float> &v, const double u)
 {
   VectorizedArray<float> tmp;
   tmp = float(u);
@@ -3096,7 +3096,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray<Number>
  * @relatesalso VectorizedArray
  */
 inline DEAL_II_ALWAYS_INLINE VectorizedArray<float>
-                             operator*(const double &u, const VectorizedArray<float> &v)
+                             operator*(const double u, const VectorizedArray<float> &v)
 {
   VectorizedArray<float> tmp;
   tmp = float(u);
@@ -3125,7 +3125,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray<Number>
  * @relatesalso VectorizedArray
  */
 inline DEAL_II_ALWAYS_INLINE VectorizedArray<float>
-                             operator*(const VectorizedArray<float> &v, const double &u)
+                             operator*(const VectorizedArray<float> &v, const double u)
 {
   return u * v;
 }
@@ -3154,7 +3154,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray<Number>
  * @relatesalso VectorizedArray
  */
 inline DEAL_II_ALWAYS_INLINE VectorizedArray<float>
-                             operator/(const double &u, const VectorizedArray<float> &v)
+                             operator/(const double u, const VectorizedArray<float> &v)
 {
   VectorizedArray<float> tmp;
   tmp = float(u);
@@ -3185,7 +3185,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray<Number>
  * @relatesalso VectorizedArray
  */
 inline DEAL_II_ALWAYS_INLINE VectorizedArray<float>
-                             operator/(const VectorizedArray<float> &v, const double &u)
+                             operator/(const VectorizedArray<float> &v, const double u)
 {
   VectorizedArray<float> tmp;
   tmp = float(u);
index ca6292f635ba0a32b2923d88bc995820145120a2..544fc3d83c5575bfda782c90eca030eddd2c79cb 100644 (file)
@@ -66,11 +66,11 @@ namespace std
         return func_from(static_cast<const badouble &>(x),                     \
                          static_cast<const badouble &>(y));                    \
       }                                                                        \
-      inline adouble func_to(const double &x, const adouble &y)                \
+      inline adouble func_to(const double x, const adouble &y)                 \
       {                                                                        \
         return func_from(x, static_cast<const badouble &>(y));                 \
       }                                                                        \
-      inline adouble func_to(const adouble &x, const double &y)                \
+      inline adouble func_to(const adouble &x, const double y)                 \
       {                                                                        \
         return func_from(static_cast<const badouble &>(x), y);                 \
       }                                                                        \
@@ -79,11 +79,11 @@ namespace std
       {                                                                        \
         return adtl::func_from(x, y);                                          \
       }                                                                        \
-      inline adtl::adouble func_to(const double &x, const adtl::adouble &y)    \
+      inline adtl::adouble func_to(const double x, const adtl::adouble &y)     \
       {                                                                        \
         return adtl::func_from(x, y);                                          \
       }                                                                        \
-      inline adtl::adouble func_to(const adtl::adouble &x, const double &y)    \
+      inline adtl::adouble func_to(const adtl::adouble &x, const double y)     \
       {                                                                        \
         return adtl::func_from(x, y);                                          \
       }
index bb8deec4614ff60714c1e5a87d767b445f88bf2e..34627a3ebeffe0bd017742c78eb1bcb6772d29a9 100644 (file)
@@ -210,7 +210,7 @@ public:
    */
   std::vector<std::pair<unsigned int, double>>
   get_points_within_ball(const Point<dim> &target,
-                         const double &    radius,
+                         const double      radius,
                          const bool        sorted = false) const;
 
   /**
index e975b69b60e36ed848e48a213f0e220b1d68d145..a2acfe503f1fd31629507d503f73e89748dd8f76 100644 (file)
@@ -8975,7 +8975,7 @@ namespace VectorTools
   {
     template <typename Number>
     void
-    set_possibly_complex_number(const double &r, const double &, Number &n)
+    set_possibly_complex_number(const double r, const double, Number &n)
     {
       n = r;
     }
@@ -8984,8 +8984,8 @@ namespace VectorTools
 
     template <typename Type>
     void
-    set_possibly_complex_number(const double &      r,
-                                const double &      i,
+    set_possibly_complex_number(const double        r,
+                                const double        i,
                                 std::complex<Type> &n)
     {
       n = std::complex<Type>(r, i);
index b0b4883f9e5193c7228763f0997a143f6eb27761..b3ba801f83e1a530cbc70e96be79a0222518498d 100644 (file)
@@ -371,7 +371,7 @@ namespace OpenCASCADE
    */
   template <int spacedim>
   Point<spacedim>
-  point(const gp_Pnt &p, const double &tolerance = 1e-10);
+  point(const gp_Pnt &p, const double tolerance = 1e-10);
 
 
   /**
index 95e56c772ff1dcce7de94ae51ef48ebab988b7f6..4cf6f82616bbe4e39583e24ad0a70606b8e4c218 100644 (file)
@@ -345,19 +345,19 @@ namespace SUNDIALS
        */
       AdditionalData(
         // Initial parameters
-        const double &initial_time      = 0.0,
-        const double &final_time        = 1.0,
-        const double &initial_step_size = 1e-2,
-        const double &output_period     = 1e-1,
+        const double initial_time      = 0.0,
+        const double final_time        = 1.0,
+        const double initial_step_size = 1e-2,
+        const double output_period     = 1e-1,
         // Running parameters
-        const double &     minimum_step_size                     = 1e-6,
+        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)
+        const double absolute_tolerance = 1e-6,
+        const double relative_tolerance = 1e-5)
         : initial_time(initial_time)
         , final_time(final_time)
         , initial_step_size(initial_step_size)
@@ -538,7 +538,7 @@ namespace SUNDIALS
      * @param[in,out] y   The new initial solution
      */
     void
-    reset(const double &t, const double &h, const VectorType &y);
+    reset(const double t, const double h, const VectorType &y);
 
     /**
      * A function object that users need to supply and that is intended to
index 66de1f64617dff5a804563493a845703940d8ea6..66542b64b7a9485d6ceecc6dba0f099a55ee3c09 100644 (file)
@@ -304,18 +304,18 @@ namespace SUNDIALS
        * iterations
        */
       AdditionalData( // Initial parameters
-        const double &initial_time      = 0.0,
-        const double &final_time        = 1.0,
-        const double &initial_step_size = 1e-2,
-        const double &output_period     = 1e-1,
+        const double initial_time      = 0.0,
+        const double final_time        = 1.0,
+        const double initial_step_size = 1e-2,
+        const double output_period     = 1e-1,
         // Running parameters
-        const double &     minimum_step_size             = 1e-6,
+        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,
-        const bool    ignore_algebraic_terms_for_errors = true,
+        const double absolute_tolerance                = 1e-6,
+        const double relative_tolerance                = 1e-5,
+        const bool   ignore_algebraic_terms_for_errors = true,
         // Initial conditions parameters
         const InitialConditionCorrection &ic_type    = use_y_diff,
         const InitialConditionCorrection &reset_type = use_y_diff,
@@ -619,7 +619,7 @@ namespace SUNDIALS
      * @param[in,out] yp  The new (tentative) initial solution_dot
      */
     void
-    reset(const double &t, const double &h, VectorType &y, VectorType &yp);
+    reset(const double t, const double h, VectorType &y, VectorType &yp);
 
     /**
      * Reinit vector to have the right size, MPI communicator, etc.
index 16681e232a71cc7281c4a44aa7aabd8c274b1806..9a637da28c8f00e9601134f8fb8862473e58f14c 100644 (file)
@@ -260,12 +260,12 @@ namespace SUNDIALS
         // Global parameters
         const SolutionStrategy &strategy                      = linesearch,
         const unsigned int      maximum_non_linear_iterations = 200,
-        const double &          function_tolerance            = 0.0,
-        const double &          step_tolerance                = 0.0,
+        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 double &          maximum_newton_step           = 0.0,
-        const double &          dq_relative_error             = 0.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)
         : strategy(strategy)
index 46a26c4b8028fed8569639c3cb55992521b2f1c0..3391d9b2d2aafd731d82d191e29ed489b232dfad 100644 (file)
@@ -75,7 +75,7 @@ namespace Functions
     // structures via a mutex.
     Threads::Mutex::ScopedLock lock(acc_mutex);
 
-    const double &x = p[0];
+    const double x = p[0];
     Assert(x >= interpolation_points.front() &&
              x <= interpolation_points.back(),
            ExcCSplineRange(x,
@@ -96,7 +96,7 @@ namespace Functions
     // structures via a mutex.
     Threads::Mutex::ScopedLock lock(acc_mutex);
 
-    const double &x = p[0];
+    const double x = p[0];
     Assert(x >= interpolation_points.front() &&
              x <= interpolation_points.back(),
            ExcCSplineRange(x,
@@ -120,7 +120,7 @@ namespace Functions
     // structures via a mutex.
     Threads::Mutex::ScopedLock lock(acc_mutex);
 
-    const double &x = p[0];
+    const double x = p[0];
     Assert(x >= interpolation_points.front() &&
              x <= interpolation_points.back(),
            ExcCSplineRange(x,
index 78c3ed62c2d9dff7c96fce13092df839c47e2ab1..2c08d33be2eba60aa6fc3cb8fbc81d36eb431251 100644 (file)
@@ -98,10 +98,10 @@ namespace Functions
      */
     template <int dim>
     void
-    set_unit_vectors(const double &  cos_theta,
-                     const double &  sin_theta,
-                     const double &  cos_phi,
-                     const double &  sin_phi,
+    set_unit_vectors(const double    cos_theta,
+                     const double    sin_theta,
+                     const double    cos_phi,
+                     const double    sin_phi,
                      Tensor<1, dim> &unit_r,
                      Tensor<1, dim> &unit_theta,
                      Tensor<1, dim> &unit_phi)
@@ -125,7 +125,7 @@ namespace Functions
      */
     template <int dim>
     void add_outer_product(SymmetricTensor<2, dim> &out,
-                           const double &           val,
+                           const double             val,
                            const Tensor<1, dim> &   in1,
                            const Tensor<1, dim> &   in2)
     {
@@ -140,7 +140,7 @@ namespace Functions
      */
     template <int dim>
     void add_outer_product(SymmetricTensor<2, dim> &out,
-                           const double &           val,
+                           const double             val,
                            const Tensor<1, dim> &   in)
     {
       if (val != 0.)
index 54d4e4619e31528a0473d65f2d5d6675fef54174..246efe92b45bf0b745cd898ddaf00f22695283be 100644 (file)
@@ -1004,7 +1004,7 @@ ParameterHandler::set(const std::string &entry_string, const char *new_value)
 
 
 void
-ParameterHandler::set(const std::string &entry_string, const double &new_value)
+ParameterHandler::set(const std::string &entry_string, const double new_value)
 {
   std::ostringstream s;
   s << std::setprecision(16);
index 98b9dc8f4cf482ac3b5c847b654da4e201a850c6..132fe14ed078149187d7172ce07b7110ef73f9cd 100644 (file)
@@ -949,8 +949,7 @@ namespace GridTools
       compute_bounding_box(mesh, predicate);
 
     // DOUBLE_EPSILON to compare really close double values
-    const double &DOUBLE_EPSILON =
-      100. * std::numeric_limits<double>::epsilon();
+    const double DOUBLE_EPSILON = 100. * std::numeric_limits<double>::epsilon();
 
     // Add layer_thickness to the bounding box
     for (unsigned int d = 0; d < spacedim; ++d)
@@ -1006,7 +1005,7 @@ namespace GridTools
 
         const Point<spacedim> &cell_enclosing_ball_center =
           cell_enclosing_ball.first;
-        const double &cell_enclosing_ball_radius = cell_enclosing_ball.second;
+        const double cell_enclosing_ball_radius = cell_enclosing_ball.second;
 
         bool cell_inside = true; // reset for each cell
 
index 5354c9df2b51445eeadf0e29375da0a6a54aa454..09f5a211a5a47b8c29b6b3a3bbc67769a4c35ece 100644 (file)
@@ -297,8 +297,8 @@ namespace TrilinosWrappers
       {
       public:
         TrilinosReductionControl(const int                   max_steps,
-                                 const double &              tolerance,
-                                 const double &              reduction,
+                                 const double                tolerance,
+                                 const double                reduction,
                                  const Epetra_LinearProblem &linear_problem);
 
         virtual ~TrilinosReductionControl() override = default;
@@ -365,8 +365,8 @@ namespace TrilinosWrappers
 
       TrilinosReductionControl::TrilinosReductionControl(
         const int                   max_steps,
-        const double &              tolerance,
-        const double &              reduction,
+        const double                tolerance,
+        const double                reduction,
         const Epetra_LinearProblem &linear_problem)
         : initial_residual(std::numeric_limits<double>::max())
         , current_residual(std::numeric_limits<double>::max())
index 564a9ba4c54097d34652dd10f66e817091246633..4f96a9d281147e62d19a00ca9cbe1dbfac3b5e70 100644 (file)
@@ -36,7 +36,7 @@ KDTree<dim>::KDTree(const unsigned int             max_leaf_size,
 template <int dim>
 std::vector<std::pair<unsigned int, double>>
 KDTree<dim>::get_points_within_ball(const Point<dim> &center,
-                                    const double &    radius,
+                                    const double      radius,
                                     bool              sorted) const
 {
   Assert(adaptor, ExcNotInitialized());
index 4b8bcb0c080240c133433aee8eb48e8abab7a68e..e2bd301c7e01997adc676653a2d57d736315b3a3 100644 (file)
@@ -177,7 +177,7 @@ namespace OpenCASCADE
 
   template <int spacedim>
   Point<spacedim>
-  point(const gp_Pnt &p, const double &tolerance)
+  point(const gp_Pnt &p, const double tolerance)
   {
     (void)tolerance;
     switch (spacedim)
index f57451593eaa4b6cdb714602b31c37f5e6630528..90e548f4d3e448a433b608c393471aba565fa4ec 100644 (file)
@@ -27,7 +27,7 @@ for (deal_II_dimension : DIMENSIONS)
                                 const double                        tolerance);
 
     template Point<deal_II_dimension> point(const gp_Pnt &p,
-                                            const double &tolerance);
+                                            const double  tolerance);
 
     template gp_Pnt point(const Point<deal_II_dimension> &p);
 
index 3f8397e7b62db98be3acd4ff95e8a14cea60fc9e..64bd8be758af62bab299b7fca64b43fd8f6b5c51 100644 (file)
@@ -344,8 +344,8 @@ namespace SUNDIALS
 
   template <typename VectorType>
   void
-  ARKode<VectorType>::reset(const double &    current_time,
-                            const double &    current_time_step,
+  ARKode<VectorType>::reset(const double      current_time,
+                            const double      current_time_step,
                             const VectorType &solution)
   {
     unsigned int system_size;
index f929cc4c8115c44fe3914126d75e1e03a0fc859c..31ea6417f4eeca7e482306406d9673b152993e8a 100644 (file)
@@ -277,10 +277,10 @@ namespace SUNDIALS
 
   template <typename VectorType>
   void
-  IDA<VectorType>::reset(const double &current_time,
-                         const double &current_time_step,
-                         VectorType &  solution,
-                         VectorType &  solution_dot)
+  IDA<VectorType>::reset(const double current_time,
+                         const double current_time_step,
+                         VectorType & solution,
+                         VectorType & solution_dot)
   {
     unsigned int system_size;
     bool         first_step = (current_time == data.initial_time);

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.