From: Reza Rastak Date: Wed, 12 Feb 2020 08:45:22 +0000 (-0800) Subject: Use value semantics for parameters with trivial small types X-Git-Tag: v9.2.0-rc1~529^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b3e2eed0d08c18f89dc624cff57b6dcb9672eaf;p=dealii.git Use value semantics for parameters with trivial small types --- diff --git a/include/deal.II/base/parsed_convergence_table.h b/include/deal.II/base/parsed_convergence_table.h index f25ce91f7f..76659f449a 100644 --- a/include/deal.II/base/parsed_convergence_table.h +++ b/include/deal.II/base/parsed_convergence_table.h @@ -245,13 +245,13 @@ public: ParsedConvergenceTable( const std::vector & component_names, const std::vector> &list_of_error_norms, - const double & exponent, + const double exponent, const std::set & extra_columns, const std::string & rate_key, const std::string & rate_mode, const std::string & error_file_name, - const unsigned int & precision, - const bool & compute_error); + const unsigned int precision, + const bool compute_error); /** * Attach all the parameters in this class to entries of the parameter @@ -362,7 +362,7 @@ public: void add_extra_column(const std::string & column_name, const std::function &custom_function, - const bool & compute_rate = true); + const bool compute_rate = true); /** * Difference between two solutions in the same vector space. diff --git a/include/deal.II/differentiation/ad/ad_helpers.h b/include/deal.II/differentiation/ad/ad_helpers.h index e9c9261a74..f8c6ec810e 100644 --- a/include/deal.II/differentiation/ad/ad_helpers.h +++ b/include/deal.II/differentiation/ad/ad_helpers.h @@ -2438,9 +2438,9 @@ namespace Differentiation */ template inline void - set_tensor_entry(TensorType & t, - const unsigned int &unrolled_index, - const NumberType & value) + set_tensor_entry(TensorType & t, + const unsigned int unrolled_index, + const NumberType & value) { // Where possible, set values using TableIndices AssertIndexRange(unrolled_index, t.n_independent_components); @@ -2454,7 +2454,7 @@ namespace Differentiation */ template inline void set_tensor_entry(Tensor<0, dim, NumberType> &t, - const unsigned int & unrolled_index, + const unsigned int unrolled_index, const NumberType & value) { AssertIndexRange(unrolled_index, 1); @@ -2470,9 +2470,9 @@ namespace Differentiation */ template inline void - set_tensor_entry(NumberType & t, - const unsigned int &unrolled_index, - const NumberType & value) + set_tensor_entry(NumberType & t, + const unsigned int unrolled_index, + const NumberType & value) { AssertIndexRange(unrolled_index, 1); (void)unrolled_index; @@ -2487,9 +2487,9 @@ namespace Differentiation */ template inline void set_tensor_entry(SymmetricTensor<4, dim, NumberType> &t, - const unsigned int &unrolled_index_row, - const unsigned int &unrolled_index_col, - const NumberType & value) + const unsigned int unrolled_index_row, + const unsigned int unrolled_index_col, + const NumberType & value) { // Fourth order symmetric tensors require a specialized interface // to extract values. @@ -2517,7 +2517,7 @@ namespace Differentiation template class TensorType> inline NumberType get_tensor_entry(const TensorType &t, - const unsigned int & unrolled_index) + const unsigned int unrolled_index) { // Where possible, get values using TableIndices AssertIndexRange(unrolled_index, t.n_independent_components); @@ -2535,7 +2535,7 @@ namespace Differentiation template class TensorType> inline NumberType get_tensor_entry(const TensorType<0, dim, NumberType> &t, - const unsigned int & unrolled_index) + const unsigned int unrolled_index) { AssertIndexRange(unrolled_index, 1); (void)unrolled_index; @@ -2550,7 +2550,7 @@ namespace Differentiation */ template inline const NumberType & - get_tensor_entry(const NumberType &t, const unsigned int &unrolled_index) + get_tensor_entry(const NumberType &t, const unsigned int unrolled_index) { AssertIndexRange(unrolled_index, 1); (void)unrolled_index; @@ -2568,7 +2568,7 @@ namespace Differentiation template class TensorType> inline NumberType & get_tensor_entry(TensorType &t, - const unsigned int & unrolled_index) + const unsigned int unrolled_index) { // Where possible, get values using TableIndices AssertIndexRange(unrolled_index, t.n_independent_components); @@ -2585,7 +2585,7 @@ namespace Differentiation typename NumberType, template class TensorType> NumberType &get_tensor_entry(TensorType<0, dim, NumberType> &t, - const unsigned int & index) + const unsigned int index) { AssertIndexRange(index, 1); (void)index; @@ -2600,7 +2600,7 @@ namespace Differentiation */ template inline NumberType & - get_tensor_entry(NumberType &t, const unsigned int &index) + get_tensor_entry(NumberType &t, const unsigned int index) { AssertIndexRange(index, 1); (void)index; diff --git a/include/deal.II/differentiation/sd/symengine_number_types.h b/include/deal.II/differentiation/sd/symengine_number_types.h index 7ba464c259..fc3578a3e1 100644 --- a/include/deal.II/differentiation/sd/symengine_number_types.h +++ b/include/deal.II/differentiation/sd/symengine_number_types.h @@ -194,7 +194,7 @@ namespace Differentiation * potential ambiguities related to implicit conversions in either user * code or math functions that are loaded into the standard namespace. */ - explicit Expression(const bool &value); + explicit Expression(const bool value); /** * Constructor for arithmetic number types. diff --git a/include/deal.II/differentiation/sd/symengine_tensor_operations.h b/include/deal.II/differentiation/sd/symengine_tensor_operations.h index faa80c3c3c..348aba7f91 100644 --- a/include/deal.II/differentiation/sd/symengine_tensor_operations.h +++ b/include/deal.II/differentiation/sd/symengine_tensor_operations.h @@ -777,8 +777,8 @@ namespace Differentiation { template TableIndices<4> - make_rank_4_tensor_indices(const unsigned int &idx_i, - const unsigned int &idx_j) + make_rank_4_tensor_indices(const unsigned int idx_i, + const unsigned int idx_j) { const TableIndices<2> indices_i( SymmetricTensor<2, dim>::unrolled_to_component_indices(idx_i)); diff --git a/include/deal.II/fe/fe_interface_values.h b/include/deal.II/fe/fe_interface_values.h index f7171a9ef9..5231b202b0 100644 --- a/include/deal.II/fe/fe_interface_values.h +++ b/include/deal.II/fe/fe_interface_values.h @@ -113,11 +113,11 @@ public: template void reinit(const CellIteratorType & cell, - const unsigned int & face_no, - const unsigned int & sub_face_no, + const unsigned int face_no, + const unsigned int sub_face_no, const typename identity::type &cell_neighbor, - const unsigned int & face_no_neighbor, - const unsigned int & sub_face_no_neighbor); + const unsigned int face_no_neighbor, + const unsigned int sub_face_no_neighbor); /** * Re-initialize this object to be used on an interface given by a single face @@ -132,7 +132,7 @@ public: */ template void - reinit(const CellIteratorType &cell, const unsigned int &face_no); + reinit(const CellIteratorType &cell, const unsigned int face_no); /** * Return a reference to the FEFaceValues or FESubfaceValues object @@ -508,11 +508,11 @@ template void FEInterfaceValues::reinit( const CellIteratorType & cell, - const unsigned int & face_no, - const unsigned int & sub_face_no, + const unsigned int face_no, + const unsigned int sub_face_no, const typename identity::type &cell_neighbor, - const unsigned int & face_no_neighbor, - const unsigned int & sub_face_no_neighbor) + const unsigned int face_no_neighbor, + const unsigned int sub_face_no_neighbor) { if (sub_face_no == numbers::invalid_unsigned_int) { @@ -587,7 +587,7 @@ template template void FEInterfaceValues::reinit(const CellIteratorType &cell, - const unsigned int & face_no) + const unsigned int face_no) { internal_fe_face_values.reinit(cell, face_no); fe_face_values = &internal_fe_face_values; diff --git a/include/deal.II/meshworker/copy_data.h b/include/deal.II/meshworker/copy_data.h index d3c1549e3f..866034034d 100644 --- a/include/deal.II/meshworker/copy_data.h +++ b/include/deal.II/meshworker/copy_data.h @@ -82,7 +82,7 @@ namespace MeshWorker * all set to numbers::invalid_dof_index. */ void - operator=(const double &number); + operator=(const double number); /** * An array of local matrices. @@ -140,8 +140,7 @@ namespace MeshWorker template void - CopyData:: - operator=(const double &number) + CopyData::operator=(const double number) { Assert(number == 0.0, ExcMessage("You should only call this method with " diff --git a/source/base/parsed_convergence_table.cc b/source/base/parsed_convergence_table.cc index cfcf8bca63..67481e13b2 100644 --- a/source/base/parsed_convergence_table.cc +++ b/source/base/parsed_convergence_table.cc @@ -78,13 +78,13 @@ ParsedConvergenceTable::ParsedConvergenceTable( ParsedConvergenceTable::ParsedConvergenceTable( const std::vector & component_names, const std::vector> &list_of_error_norms, - const double & exponent, + const double exponent, const std::set & extra_columns, const std::string & rate_key, const std::string & rate_mode, const std::string & error_file_name, - const unsigned int & precision, - const bool & compute_error) + const unsigned int precision, + const bool compute_error) : component_names(component_names) , unique_component_names(get_unique_component_names(component_names)) , unique_component_masks(get_unique_component_masks(component_names)) @@ -262,7 +262,7 @@ void ParsedConvergenceTable::add_extra_column( const std::string & column_name, const std::function &custom_function, - const bool & compute_rate) + const bool compute_rate) { extra_column_functions[column_name] = {custom_function, compute_rate}; } diff --git a/source/differentiation/sd/symengine_number_types.cc b/source/differentiation/sd/symengine_number_types.cc index 7851d8fbae..f4ff2f1206 100644 --- a/source/differentiation/sd/symengine_number_types.cc +++ b/source/differentiation/sd/symengine_number_types.cc @@ -50,7 +50,7 @@ namespace Differentiation {} - Expression::Expression(const bool &value) + Expression::Expression(const bool value) : expression(SE::boolean(value)) {} diff --git a/source/particles/particle_handler.cc b/source/particles/particle_handler.cc index 10cc945d00..f470a83534 100644 --- a/source/particles/particle_handler.cc +++ b/source/particles/particle_handler.cc @@ -525,9 +525,9 @@ namespace Particles i_particle < local_positions[i_cell].size(); ++i_particle) { - const unsigned int &local_id_on_calling_process = + const unsigned int local_id_on_calling_process = original_indices_of_local_particles[i_cell][i_particle]; - const unsigned int &calling_process = + const unsigned int calling_process = calling_process_indices[i_cell][i_particle]; if (original_process_to_local_particle_indices.find( @@ -600,9 +600,9 @@ namespace Particles i_particle < local_positions[i_cell].size(); ++i_particle) { - const unsigned int &local_id_on_calling_process = + const unsigned int local_id_on_calling_process = original_indices_of_local_particles[i_cell][i_particle]; - const unsigned int &calling_process = + const unsigned int calling_process = calling_process_indices[i_cell][i_particle]; const unsigned int particle_id =