From 972d6d9bd85eb5ccfba3c984731941785d9bd965 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Sat, 25 Aug 2018 19:47:44 +0200 Subject: [PATCH] Don't pass const double by reference --- include/deal.II/base/parameter_handler.h | 2 +- include/deal.II/base/vectorization.h | 16 ++++++++-------- .../deal.II/differentiation/ad/adolc_math.h | 8 ++++---- include/deal.II/numerics/kdtree.h | 2 +- .../deal.II/numerics/vector_tools.templates.h | 6 +++--- include/deal.II/opencascade/utilities.h | 2 +- include/deal.II/sundials/arkode.h | 16 ++++++++-------- include/deal.II/sundials/ida.h | 18 +++++++++--------- include/deal.II/sundials/kinsol.h | 8 ++++---- source/base/function_cspline.cc | 6 +++--- source/base/function_spherical.cc | 12 ++++++------ source/base/parameter_handler.cc | 2 +- source/grid/grid_tools_dof_handlers.cc | 5 ++--- source/lac/trilinos_solver.cc | 8 ++++---- source/numerics/kdtree.cc | 2 +- source/opencascade/utilities.cc | 2 +- source/opencascade/utilities.inst.in | 2 +- source/sundials/arkode.cc | 4 ++-- source/sundials/ida.cc | 8 ++++---- 19 files changed, 64 insertions(+), 65 deletions(-) diff --git a/include/deal.II/base/parameter_handler.h b/include/deal.II/base/parameter_handler.h index 2cf6b492f1..a6fc80fdf7 100644 --- a/include/deal.II/base/parameter_handler.h +++ b/include/deal.II/base/parameter_handler.h @@ -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 entry_name to the one diff --git a/include/deal.II/base/vectorization.h b/include/deal.II/base/vectorization.h index 94aa7e9aa5..084980e077 100644 --- a/include/deal.II/base/vectorization.h +++ b/include/deal.II/base/vectorization.h @@ -2976,7 +2976,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray * @relatesalso VectorizedArray */ inline DEAL_II_ALWAYS_INLINE VectorizedArray - operator+(const double &u, const VectorizedArray &v) + operator+(const double u, const VectorizedArray &v) { VectorizedArray tmp; tmp = u; @@ -3005,7 +3005,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray * @relatesalso VectorizedArray */ inline DEAL_II_ALWAYS_INLINE VectorizedArray - operator+(const VectorizedArray &v, const double &u) + operator+(const VectorizedArray &v, const double u) { return u + v; } @@ -3034,7 +3034,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray * @relatesalso VectorizedArray */ inline DEAL_II_ALWAYS_INLINE VectorizedArray - operator-(const double &u, const VectorizedArray &v) + operator-(const double u, const VectorizedArray &v) { VectorizedArray tmp; tmp = float(u); @@ -3065,7 +3065,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray * @relatesalso VectorizedArray */ inline DEAL_II_ALWAYS_INLINE VectorizedArray - operator-(const VectorizedArray &v, const double &u) + operator-(const VectorizedArray &v, const double u) { VectorizedArray tmp; tmp = float(u); @@ -3096,7 +3096,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray * @relatesalso VectorizedArray */ inline DEAL_II_ALWAYS_INLINE VectorizedArray - operator*(const double &u, const VectorizedArray &v) + operator*(const double u, const VectorizedArray &v) { VectorizedArray tmp; tmp = float(u); @@ -3125,7 +3125,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray * @relatesalso VectorizedArray */ inline DEAL_II_ALWAYS_INLINE VectorizedArray - operator*(const VectorizedArray &v, const double &u) + operator*(const VectorizedArray &v, const double u) { return u * v; } @@ -3154,7 +3154,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray * @relatesalso VectorizedArray */ inline DEAL_II_ALWAYS_INLINE VectorizedArray - operator/(const double &u, const VectorizedArray &v) + operator/(const double u, const VectorizedArray &v) { VectorizedArray tmp; tmp = float(u); @@ -3185,7 +3185,7 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArray * @relatesalso VectorizedArray */ inline DEAL_II_ALWAYS_INLINE VectorizedArray - operator/(const VectorizedArray &v, const double &u) + operator/(const VectorizedArray &v, const double u) { VectorizedArray tmp; tmp = float(u); diff --git a/include/deal.II/differentiation/ad/adolc_math.h b/include/deal.II/differentiation/ad/adolc_math.h index ca6292f635..544fc3d83c 100644 --- a/include/deal.II/differentiation/ad/adolc_math.h +++ b/include/deal.II/differentiation/ad/adolc_math.h @@ -66,11 +66,11 @@ namespace std return func_from(static_cast(x), \ static_cast(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(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(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); \ } diff --git a/include/deal.II/numerics/kdtree.h b/include/deal.II/numerics/kdtree.h index bb8deec461..34627a3ebe 100644 --- a/include/deal.II/numerics/kdtree.h +++ b/include/deal.II/numerics/kdtree.h @@ -210,7 +210,7 @@ public: */ std::vector> get_points_within_ball(const Point &target, - const double & radius, + const double radius, const bool sorted = false) const; /** diff --git a/include/deal.II/numerics/vector_tools.templates.h b/include/deal.II/numerics/vector_tools.templates.h index e975b69b60..a2acfe503f 100644 --- a/include/deal.II/numerics/vector_tools.templates.h +++ b/include/deal.II/numerics/vector_tools.templates.h @@ -8975,7 +8975,7 @@ namespace VectorTools { template 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 void - set_possibly_complex_number(const double & r, - const double & i, + set_possibly_complex_number(const double r, + const double i, std::complex &n) { n = std::complex(r, i); diff --git a/include/deal.II/opencascade/utilities.h b/include/deal.II/opencascade/utilities.h index b0b4883f9e..b3ba801f83 100644 --- a/include/deal.II/opencascade/utilities.h +++ b/include/deal.II/opencascade/utilities.h @@ -371,7 +371,7 @@ namespace OpenCASCADE */ template Point - point(const gp_Pnt &p, const double &tolerance = 1e-10); + point(const gp_Pnt &p, const double tolerance = 1e-10); /** diff --git a/include/deal.II/sundials/arkode.h b/include/deal.II/sundials/arkode.h index 95e56c772f..4cf6f82616 100644 --- a/include/deal.II/sundials/arkode.h +++ b/include/deal.II/sundials/arkode.h @@ -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 diff --git a/include/deal.II/sundials/ida.h b/include/deal.II/sundials/ida.h index 66de1f6461..66542b64b7 100644 --- a/include/deal.II/sundials/ida.h +++ b/include/deal.II/sundials/ida.h @@ -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. diff --git a/include/deal.II/sundials/kinsol.h b/include/deal.II/sundials/kinsol.h index 16681e232a..9a637da28c 100644 --- a/include/deal.II/sundials/kinsol.h +++ b/include/deal.II/sundials/kinsol.h @@ -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) diff --git a/source/base/function_cspline.cc b/source/base/function_cspline.cc index 46a26c4b80..3391d9b2d2 100644 --- a/source/base/function_cspline.cc +++ b/source/base/function_cspline.cc @@ -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, diff --git a/source/base/function_spherical.cc b/source/base/function_spherical.cc index 78c3ed62c2..2c08d33be2 100644 --- a/source/base/function_spherical.cc +++ b/source/base/function_spherical.cc @@ -98,10 +98,10 @@ namespace Functions */ template 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 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 void add_outer_product(SymmetricTensor<2, dim> &out, - const double & val, + const double val, const Tensor<1, dim> & in) { if (val != 0.) diff --git a/source/base/parameter_handler.cc b/source/base/parameter_handler.cc index 54d4e4619e..246efe92b4 100644 --- a/source/base/parameter_handler.cc +++ b/source/base/parameter_handler.cc @@ -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); diff --git a/source/grid/grid_tools_dof_handlers.cc b/source/grid/grid_tools_dof_handlers.cc index 98b9dc8f4c..132fe14ed0 100644 --- a/source/grid/grid_tools_dof_handlers.cc +++ b/source/grid/grid_tools_dof_handlers.cc @@ -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::epsilon(); + const double DOUBLE_EPSILON = 100. * std::numeric_limits::epsilon(); // Add layer_thickness to the bounding box for (unsigned int d = 0; d < spacedim; ++d) @@ -1006,7 +1005,7 @@ namespace GridTools const Point &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 diff --git a/source/lac/trilinos_solver.cc b/source/lac/trilinos_solver.cc index 5354c9df2b..09f5a211a5 100644 --- a/source/lac/trilinos_solver.cc +++ b/source/lac/trilinos_solver.cc @@ -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::max()) , current_residual(std::numeric_limits::max()) diff --git a/source/numerics/kdtree.cc b/source/numerics/kdtree.cc index 564a9ba4c5..4f96a9d281 100644 --- a/source/numerics/kdtree.cc +++ b/source/numerics/kdtree.cc @@ -36,7 +36,7 @@ KDTree::KDTree(const unsigned int max_leaf_size, template std::vector> KDTree::get_points_within_ball(const Point ¢er, - const double & radius, + const double radius, bool sorted) const { Assert(adaptor, ExcNotInitialized()); diff --git a/source/opencascade/utilities.cc b/source/opencascade/utilities.cc index 4b8bcb0c08..e2bd301c7e 100644 --- a/source/opencascade/utilities.cc +++ b/source/opencascade/utilities.cc @@ -177,7 +177,7 @@ namespace OpenCASCADE template Point - point(const gp_Pnt &p, const double &tolerance) + point(const gp_Pnt &p, const double tolerance) { (void)tolerance; switch (spacedim) diff --git a/source/opencascade/utilities.inst.in b/source/opencascade/utilities.inst.in index f57451593e..90e548f4d3 100644 --- a/source/opencascade/utilities.inst.in +++ b/source/opencascade/utilities.inst.in @@ -27,7 +27,7 @@ for (deal_II_dimension : DIMENSIONS) const double tolerance); template Point point(const gp_Pnt &p, - const double &tolerance); + const double tolerance); template gp_Pnt point(const Point &p); diff --git a/source/sundials/arkode.cc b/source/sundials/arkode.cc index 3f8397e7b6..64bd8be758 100644 --- a/source/sundials/arkode.cc +++ b/source/sundials/arkode.cc @@ -344,8 +344,8 @@ namespace SUNDIALS template void - ARKode::reset(const double & current_time, - const double & current_time_step, + ARKode::reset(const double current_time, + const double current_time_step, const VectorType &solution) { unsigned int system_size; diff --git a/source/sundials/ida.cc b/source/sundials/ida.cc index f929cc4c81..31ea6417f4 100644 --- a/source/sundials/ida.cc +++ b/source/sundials/ida.cc @@ -277,10 +277,10 @@ namespace SUNDIALS template void - IDA::reset(const double ¤t_time, - const double ¤t_time_step, - VectorType & solution, - VectorType & solution_dot) + IDA::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); -- 2.39.5