From 3820b76f21669bba4bac2ef53cabc1e6b92d7fb6 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Thu, 14 Sep 2017 15:34:30 +0200 Subject: [PATCH] Use const& instead of const where applicable --- include/deal.II/base/data_out_base.h | 10 +++++----- include/deal.II/fe/mapping_fe_field.h | 4 ++-- include/deal.II/grid/filtered_iterator.h | 8 ++++---- include/deal.II/lac/read_write_vector.h | 6 +++--- include/deal.II/lac/read_write_vector.templates.h | 6 +++--- include/deal.II/numerics/dof_output_operator.h | 2 +- .../deal.II/numerics/dof_output_operator.templates.h | 2 +- include/deal.II/numerics/error_estimator.templates.h | 4 ++-- source/base/convergence_table.cc | 4 ++-- source/base/data_out_base.cc | 10 +++++----- source/fe/mapping_fe_field.cc | 4 ++-- source/opencascade/utilities.cc | 2 +- 12 files changed, 31 insertions(+), 31 deletions(-) diff --git a/include/deal.II/base/data_out_base.h b/include/deal.II/base/data_out_base.h index 0aa48c01ba..be9c8e584e 100644 --- a/include/deal.II/base/data_out_base.h +++ b/include/deal.II/base/data_out_base.h @@ -2988,7 +2988,7 @@ public: * cases where solution_filename == mesh_filename, and * dim==spacedim. */ - XDMFEntry(const std::string filename, + XDMFEntry(const std::string &filename, const double time, const unsigned int nodes, const unsigned int cells, @@ -2998,8 +2998,8 @@ public: * Simplified constructor that calls the complete constructor for * cases where dim==spacedim. */ - XDMFEntry(const std::string mesh_filename, - const std::string solution_filename, + XDMFEntry(const std::string &mesh_filename, + const std::string &solution_filename, const double time, const unsigned int nodes, const unsigned int cells, @@ -3008,8 +3008,8 @@ public: /** * Constructor that sets all members to provided parameters. */ - XDMFEntry(const std::string mesh_filename, - const std::string solution_filename, + XDMFEntry(const std::string &mesh_filename, + const std::string &solution_filename, const double time, const unsigned int nodes, const unsigned int cells, diff --git a/include/deal.II/fe/mapping_fe_field.h b/include/deal.II/fe/mapping_fe_field.h index 48b0f34e8c..43993b4f2b 100644 --- a/include/deal.II/fe/mapping_fe_field.h +++ b/include/deal.II/fe/mapping_fe_field.h @@ -111,7 +111,7 @@ public: */ MappingFEField (const DoFHandlerType &euler_dof_handler, const VectorType &euler_vector, - const ComponentMask mask = ComponentMask()); + const ComponentMask &mask = ComponentMask()); /** * Copy constructor. @@ -253,7 +253,7 @@ public: * Constructor. */ InternalData(const FiniteElement &fe, - const ComponentMask mask); + const ComponentMask &mask); /** * Shape function at quadrature point. Shape functions are in tensor diff --git a/include/deal.II/grid/filtered_iterator.h b/include/deal.II/grid/filtered_iterator.h index af9d13b9f5..a7ac28c0f2 100644 --- a/include/deal.II/grid/filtered_iterator.h +++ b/include/deal.II/grid/filtered_iterator.h @@ -234,7 +234,7 @@ namespace IteratorFilters * have to be evaluated to true and state if the iterator must be locally * owned. */ - MaterialIdEqualTo (const std::set material_ids, + MaterialIdEqualTo (const std::set &material_ids, const bool only_locally_owned = false); /** @@ -280,7 +280,7 @@ namespace IteratorFilters * shall have to be evaluated to true and state if the iterator must be * locally owned. */ - ActiveFEIndexEqualTo (const std::set active_fe_indices, + ActiveFEIndexEqualTo (const std::set &active_fe_indices, const bool only_locally_owned = false); /** @@ -1301,7 +1301,7 @@ namespace IteratorFilters inline - MaterialIdEqualTo::MaterialIdEqualTo (const std::set material_ids, + MaterialIdEqualTo::MaterialIdEqualTo (const std::set &material_ids, const bool only_locally_owned) : material_ids (material_ids), @@ -1339,7 +1339,7 @@ namespace IteratorFilters inline - ActiveFEIndexEqualTo::ActiveFEIndexEqualTo (const std::set active_fe_indices, + ActiveFEIndexEqualTo::ActiveFEIndexEqualTo (const std::set &active_fe_indices, const bool only_locally_owned) : active_fe_indices (active_fe_indices), diff --git a/include/deal.II/lac/read_write_vector.h b/include/deal.II/lac/read_write_vector.h index 8a89f0229a..60feffc99b 100644 --- a/include/deal.II/lac/read_write_vector.h +++ b/include/deal.II/lac/read_write_vector.h @@ -283,7 +283,7 @@ namespace LinearAlgebra */ void import(const distributed::Vector &vec, VectorOperation::values operation, - std::shared_ptr communication_pattern = + const std::shared_ptr &communication_pattern = std::shared_ptr ()); #ifdef DEAL_II_WITH_PETSC @@ -297,7 +297,7 @@ namespace LinearAlgebra */ void import(const PETScWrappers::MPI::Vector &petsc_vec, VectorOperation::values operation, - std::shared_ptr communication_pattern = + const std::shared_ptr &communication_pattern = std::shared_ptr ()); #endif @@ -564,7 +564,7 @@ namespace LinearAlgebra const IndexSet &locally_owned_elements, VectorOperation::values operation, const MPI_Comm &mpi_comm, - std::shared_ptr communication_pattern); + const std::shared_ptr &communication_pattern); #endif /** diff --git a/include/deal.II/lac/read_write_vector.templates.h b/include/deal.II/lac/read_write_vector.templates.h index 6d61802ef1..80037c4139 100644 --- a/include/deal.II/lac/read_write_vector.templates.h +++ b/include/deal.II/lac/read_write_vector.templates.h @@ -232,7 +232,7 @@ namespace LinearAlgebra void ReadWriteVector::import(const distributed::Vector &vec, VectorOperation::values operation, - std::shared_ptr communication_pattern) + const std::shared_ptr &communication_pattern) { // If no communication pattern is given, create one. Otherwise, use the // given one. @@ -301,7 +301,7 @@ namespace LinearAlgebra void ReadWriteVector::import(const PETScWrappers::MPI::Vector &petsc_vec, VectorOperation::values /*operation*/, - std::shared_ptr /*communication_pattern*/) + const std::shared_ptr & /*communication_pattern*/) { //TODO: this works only if no communication is needed. Assert(petsc_vec.locally_owned_elements() == stored_elements, @@ -330,7 +330,7 @@ namespace LinearAlgebra const IndexSet &source_elements, VectorOperation::values operation, const MPI_Comm &mpi_comm, - std::shared_ptr communication_pattern) + const std::shared_ptr &communication_pattern) { std::shared_ptr epetra_comm_pattern; diff --git a/include/deal.II/numerics/dof_output_operator.h b/include/deal.II/numerics/dof_output_operator.h index dd9b757bdf..497bfe93ac 100644 --- a/include/deal.II/numerics/dof_output_operator.h +++ b/include/deal.II/numerics/dof_output_operator.h @@ -47,7 +47,7 @@ namespace Algorithms * last step command. Numbers with less digits are filled with * zeros from the left. */ - DoFOutputOperator (const std::string filename_base = std::string("output"), + DoFOutputOperator (const std::string &filename_base = std::string("output"), const unsigned int digits = 3); void parse_parameters(ParameterHandler ¶m); diff --git a/include/deal.II/numerics/dof_output_operator.templates.h b/include/deal.II/numerics/dof_output_operator.templates.h index 61e013c29b..d76630c2ec 100644 --- a/include/deal.II/numerics/dof_output_operator.templates.h +++ b/include/deal.II/numerics/dof_output_operator.templates.h @@ -25,7 +25,7 @@ namespace Algorithms { template DoFOutputOperator::DoFOutputOperator ( - const std::string filename_base, + const std::string &filename_base, const unsigned int digits) : filename_base(filename_base), diff --git a/include/deal.II/numerics/error_estimator.templates.h b/include/deal.II/numerics/error_estimator.templates.h index 8ccab4a00c..b0e8d70213 100644 --- a/include/deal.II/numerics/error_estimator.templates.h +++ b/include/deal.II/numerics/error_estimator.templates.h @@ -185,7 +185,7 @@ namespace internal const types::subdomain_id subdomain_id, const types::material_id material_id, const typename FunctionMap::type *neumann_bc, - const ComponentMask component_mask, + const ComponentMask &component_mask, const Function *coefficients); /** @@ -209,7 +209,7 @@ namespace internal const types::subdomain_id subdomain_id, const types::material_id material_id, const typename FunctionMap::type *neumann_bc, - const ComponentMask component_mask, + const ComponentMask &component_mask, const Function *coefficients) : finite_element (fe), diff --git a/source/base/convergence_table.cc b/source/base/convergence_table.cc index dec8ebc996..b106525cfe 100644 --- a/source/base/convergence_table.cc +++ b/source/base/convergence_table.cc @@ -105,7 +105,7 @@ void ConvergenceTable::evaluate_convergence_rates(const std::string &data_column columns[rate_key].flag = 1; set_precision(rate_key, 2); - std::string superkey = data_column_key; + const std::string &superkey = data_column_key; if (!supercolumns.count(superkey)) { add_column_to_supercolumn(data_column_key, superkey); @@ -193,7 +193,7 @@ ConvergenceTable::evaluate_convergence_rates(const std::string &data_column_key, set_precision(rate_key, 2); // set the superkey equal to the key - std::string superkey=data_column_key; + const std::string &superkey=data_column_key; // and set the tex caption of the supercolumn to the tex caption of the // data_column. if (!supercolumns.count(superkey)) diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index 3ec7dbf731..39f462ebf4 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -7652,7 +7652,7 @@ XDMFEntry::XDMFEntry() -XDMFEntry::XDMFEntry(const std::string filename, +XDMFEntry::XDMFEntry(const std::string &filename, const double time, const unsigned int nodes, const unsigned int cells, @@ -7669,8 +7669,8 @@ XDMFEntry::XDMFEntry(const std::string filename, -XDMFEntry::XDMFEntry(const std::string mesh_filename, - const std::string solution_filename, +XDMFEntry::XDMFEntry(const std::string &mesh_filename, + const std::string &solution_filename, const double time, const unsigned int nodes, const unsigned int cells, @@ -7687,8 +7687,8 @@ XDMFEntry::XDMFEntry(const std::string mesh_filename, -XDMFEntry::XDMFEntry(const std::string mesh_filename, - const std::string solution_filename, +XDMFEntry::XDMFEntry(const std::string &mesh_filename, + const std::string &solution_filename, const double time, const unsigned int nodes, const unsigned int cells, diff --git a/source/fe/mapping_fe_field.cc b/source/fe/mapping_fe_field.cc index decdef0fe6..1f2e35e624 100644 --- a/source/fe/mapping_fe_field.cc +++ b/source/fe/mapping_fe_field.cc @@ -58,7 +58,7 @@ DEAL_II_NAMESPACE_OPEN template MappingFEField::InternalData::InternalData (const FiniteElement &fe, - const ComponentMask mask) + const ComponentMask &mask) : n_shape_functions (fe.dofs_per_cell), mask (mask), @@ -204,7 +204,7 @@ template MappingFEField::MappingFEField (const DoFHandlerType &euler_dof_handler, const VectorType &euler_vector, - const ComponentMask mask) + const ComponentMask &mask) : euler_vector(&euler_vector), fe(&euler_dof_handler.get_fe()), diff --git a/source/opencascade/utilities.cc b/source/opencascade/utilities.cc index 4ced09c483..113ac6ee07 100644 --- a/source/opencascade/utilities.cc +++ b/source/opencascade/utilities.cc @@ -328,7 +328,7 @@ namespace OpenCASCADE const double tolerance) { TopoDS_Edge out_shape; - TopoDS_Shape edges = in_shape; + const TopoDS_Shape &edges = in_shape; std::vector intersections; TopLoc_Location L; Standard_Real First; -- 2.39.5