From: Daniel Arndt Date: Sat, 25 Aug 2018 17:39:12 +0000 (+0200) Subject: Don't pass const unsigned int by reference X-Git-Tag: v9.1.0-rc1~776^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ec7db22ddd903df5aedd1dd43164f92f1d4ddac;p=dealii.git Don't pass const unsigned int by reference --- diff --git a/include/deal.II/base/patterns.h b/include/deal.II/base/patterns.h index cf675452fe..9414567e8a 100644 --- a/include/deal.II/base/patterns.h +++ b/include/deal.II/base/patterns.h @@ -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. diff --git a/include/deal.II/base/quadrature_lib.h b/include/deal.II/base/quadrature_lib.h index 87fa1d54b3..57c16efa10 100644 --- a/include/deal.II/base/quadrature_lib.h +++ b/include/deal.II/base/quadrature_lib.h @@ -686,7 +686,7 @@ public: * * @param n Order of QGauss quadrature */ - QTrianglePolar(const unsigned int &n); + QTrianglePolar(const unsigned int n); }; /** diff --git a/include/deal.II/fe/fe_series.h b/include/deal.II/fe/fe_series.h index 40e95844f0..652ce9c24b 100644 --- a/include/deal.II/fe/fe_series.h +++ b/include/deal.II/fe/fe_series.h @@ -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); diff --git a/include/deal.II/fe/mapping.h b/include/deal.II/fe/mapping.h index 391c822a15..b5ca1f949f 100644 --- a/include/deal.II/fe/mapping.h +++ b/include/deal.II/fe/mapping.h @@ -416,7 +416,7 @@ public: Point project_real_point_to_unit_point_on_face( const typename Triangulation::cell_iterator &cell, - const unsigned int & face_no, + const unsigned int face_no, const Point & p) const; /** diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h index 44adc18cc7..2414cd72b3 100644 --- a/include/deal.II/grid/grid_tools.h +++ b/include/deal.II/grid/grid_tools.h @@ -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); * }; diff --git a/include/deal.II/meshworker/mesh_loop.h b/include/deal.II/meshworker/mesh_loop.h index 14b8e41db8..f2a53f0502 100644 --- a/include/deal.II/meshworker/mesh_loop.h +++ b/include/deal.II/meshworker/mesh_loop.h @@ -132,28 +132,28 @@ namespace MeshWorker const AssembleFlags flags = assemble_own_cells, const typename identity>::type &boundary_worker = std::function(), const typename identity>::type &face_worker = std::function(), diff --git a/include/deal.II/numerics/vector_tools.templates.h b/include/deal.II/numerics/vector_tools.templates.h index 8980930b52..e975b69b60 100644 --- a/include/deal.II/numerics/vector_tools.templates.h +++ b/include/deal.II/numerics/vector_tools.templates.h @@ -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 dof_values(n_dofs); std::vector 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 dof_values(n_dofs); std::vector projected_dofs(n_dofs); diff --git a/include/deal.II/sundials/arkode.h b/include/deal.II/sundials/arkode.h index e8fb2b4696..95e56c772f 100644 --- a/include/deal.II/sundials/arkode.h +++ b/include/deal.II/sundials/arkode.h @@ -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) diff --git a/include/deal.II/sundials/ida.h b/include/deal.II/sundials/ida.h index 969c000393..ad48bd2ec5 100644 --- a/include/deal.II/sundials/ida.h +++ b/include/deal.II/sundials/ida.h @@ -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) diff --git a/include/deal.II/sundials/kinsol.h b/include/deal.II/sundials/kinsol.h index 5dd42d8ef3..0c7dfab7c3 100644 --- a/include/deal.II/sundials/kinsol.h +++ b/include/deal.II/sundials/kinsol.h @@ -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) diff --git a/source/base/patterns.cc b/source/base/patterns.cc index 52a8965610..4e883abea1 100644 --- a/source/base/patterns.cc +++ b/source/base/patterns.cc @@ -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]; } diff --git a/source/base/polynomials_nedelec.cc b/source/base/polynomials_nedelec.cc index 5484e308fb..44351c3995 100644 --- a/source/base/polynomials_nedelec.cc +++ b/source/base/polynomials_nedelec.cc @@ -80,7 +80,7 @@ PolynomialsNedelec::compute( // and second derivatives vectors of // polynomial_space at // unit_point - const unsigned int &n_basis = polynomial_space.n(); + const unsigned int n_basis = polynomial_space.n(); std::vector unit_point_values((values.size() == 0) ? 0 : n_basis); std::vector> unit_point_grads((grads.size() == 0) ? 0 : n_basis); diff --git a/source/base/quadrature_lib.cc b/source/base/quadrature_lib.cc index 1e0ab46bb5..2d5247c197 100644 --- a/source/base/quadrature_lib.cc +++ b/source/base/quadrature_lib.cc @@ -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)) {} diff --git a/source/dofs/dof_handler.cc b/source/dofs/dof_handler.cc index 7da33fb08a..81b173e18c 100644 --- a/source/dofs/dof_handler.cc +++ b/source/dofs/dof_handler.cc @@ -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( 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( 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); diff --git a/source/fe/fe_nedelec.cc b/source/fe/fe_nedelec.cc index 68904854aa..06139b146b 100644 --- a/source/fe/fe_nedelec.cc +++ b/source/fe/fe_nedelec.cc @@ -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 quadrature(order + 1); - const unsigned int &n_interior_points = quadrature.size(); + const QGauss 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 &edge_quadrature = QProjector::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 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::lines_per_cell * n_edge_points + GeometryInfo::faces_per_cell * n_face_points; - const QGauss quadrature(order + 1); - const unsigned int &n_interior_points = quadrature.size(); + const QGauss 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::initialize_restriction() const QGauss<1> edge_quadrature(2 * this->degree); const std::vector> &edge_quadrature_points = edge_quadrature.get_points(); - const unsigned int &n_edge_quadrature_points = edge_quadrature.size(); - const unsigned int index = RefinementCase::isotropic_refinement - 1; + const unsigned int n_edge_quadrature_points = edge_quadrature.size(); + const unsigned int index = RefinementCase::isotropic_refinement - 1; switch (dim) { @@ -764,7 +764,7 @@ FE_Nedelec::initialize_restriction() Polynomials::Lobatto::generate_complete_basis(this->degree); const unsigned int n_boundary_dofs = GeometryInfo::faces_per_cell * this->degree; - const unsigned int &n_quadrature_points = quadrature.size(); + const unsigned int n_quadrature_points = quadrature.size(); { FullMatrix assembling_matrix((this->degree - 1) * @@ -1261,7 +1261,7 @@ FE_Nedelec::initialize_restriction() Polynomials::Lobatto::generate_complete_basis(this->degree); const unsigned int n_edge_dofs = GeometryInfo::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::initialize_restriction() const unsigned int n_boundary_dofs = 2 * GeometryInfo::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 assembling_matrix(deg * deg * this->degree, @@ -2575,7 +2575,7 @@ FE_Nedelec::get_subface_interpolation_matrix( const QGauss<1> edge_quadrature(source_fe.degree); const std::vector> &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::get_subface_interpolation_matrix( source_fe.degree); const unsigned int n_boundary_dofs = GeometryInfo::lines_per_face * source_fe.degree; - const unsigned int &n_quadrature_points = quadrature.size(); + const unsigned int n_quadrature_points = quadrature.size(); { FullMatrix assembling_matrix(source_fe.degree * @@ -3117,7 +3117,7 @@ FE_Nedelec::convert_generalized_support_point_values_to_dof_values( // Let us begin with the // interpolation part. const QGauss 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::convert_generalized_support_point_values_to_dof_values( // horizontal and the // vertical, interior // shape functions. - const QGauss reference_quadrature(this->degree); - const unsigned int &n_interior_points = + const QGauss reference_quadrature(this->degree); + const unsigned int n_interior_points = reference_quadrature.size(); const std::vector> &legendre_polynomials = @@ -3381,8 +3381,8 @@ FE_Nedelec::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) { diff --git a/source/fe/fe_q_hierarchical.cc b/source/fe/fe_q_hierarchical.cc index 8968344213..06294e3aa2 100644 --- a/source/fe/fe_q_hierarchical.cc +++ b/source/fe/fe_q_hierarchical.cc @@ -266,8 +266,8 @@ FE_Q_Hierarchical::hp_line_dof_identities( // one is an FE_Nothing. if (dynamic_cast *>(&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::hp_quad_dof_identities( // one is an FE_Nothing. if (dynamic_cast *>(&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 diff --git a/source/fe/mapping.cc b/source/fe/mapping.cc index 11da97210d..7222e6d706 100644 --- a/source/fe/mapping.cc +++ b/source/fe/mapping.cc @@ -39,7 +39,7 @@ template Point Mapping::project_real_point_to_unit_point_on_face( const typename Triangulation::cell_iterator &cell, - const unsigned int & face_no, + const unsigned int face_no, const Point & p) const { // The function doesn't make physical sense for dim=1 diff --git a/source/hp/dof_handler.cc b/source/hp/dof_handler.cc index 583be7eb3a..b60518903e 100644 --- a/source/hp/dof_handler.cc +++ b/source/hp/dof_handler.cc @@ -970,7 +970,7 @@ namespace internal [&dof_handler]( const typename dealii::hp::DoFHandler:: 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