From 79176702881489d41a8cdec234b2135a4fda7dac Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Mon, 21 Aug 2023 22:14:09 -0500 Subject: [PATCH] Standardize on 'const X' instead of 'X const', part II --- contrib/python-bindings/source/wrappers.cc | 2 +- include/deal.II/base/numbers.h | 2 +- include/deal.II/base/patterns.h | 4 +- .../deal.II/base/time_stepping.templates.h | 2 +- include/deal.II/boost_adaptors/bounding_box.h | 4 +- include/deal.II/boost_adaptors/point.h | 2 +- .../numerics/matrix_creator.templates.h | 71 +++++++++---------- source/grid/grid_generator.cc | 8 +-- source/grid/grid_tools.cc | 6 +- source/lac/cuda_solver_direct.cc | 4 +- source/lac/cuda_sparse_matrix.cc | 6 +- source/lac/vector.cc | 2 +- source/numerics/derivative_approximation.cc | 14 ++-- tests/base/time_stepping_01.cc | 64 ++++++++--------- tests/base/time_stepping_02.cc | 8 +-- tests/cuda/solver_02.cc | 2 +- tests/cuda/sparse_matrix_01.cc | 8 +-- tests/grid/grid_generator_open_torus.cc | 16 ++--- tests/grid/grid_tools_aspect_ratio.cc | 10 +-- tests/lac/sparse_matrix_print.cc | 2 +- tests/manifold/transfinite_manifold_10.cc | 6 +- .../mappings/mapping_get_vertices_on_face.cc | 2 +- tests/matrix_free/coefficient_eval_device.cc | 6 +- tests/matrix_free/matrix_vector_rt_04.cc | 24 +++---- tests/matrix_free/matrix_vector_rt_common.h | 2 +- tests/matrix_free/matrix_vector_rt_face_04.cc | 24 +++---- .../matrix_vector_rt_face_common.h | 2 +- tests/particles/properties_01.cc | 2 +- tests/particles/properties_02.cc | 2 +- .../search_adjacent_cells.cc | 24 +++---- tests/tensors/tensor_accessors_01.cc | 2 +- tests/trilinos/assemble_matrix_parallel_02.cc | 6 +- tests/trilinos/assemble_matrix_parallel_03.cc | 6 +- tests/trilinos/assemble_matrix_parallel_04.cc | 6 +- tests/trilinos/assemble_matrix_parallel_05.cc | 6 +- tests/trilinos/assemble_matrix_parallel_06.cc | 6 +- tests/trilinos/assemble_matrix_parallel_07.cc | 6 +- 37 files changed, 184 insertions(+), 185 deletions(-) diff --git a/contrib/python-bindings/source/wrappers.cc b/contrib/python-bindings/source/wrappers.cc index 3dabef03cf..0846367979 100644 --- a/contrib/python-bindings/source/wrappers.cc +++ b/contrib/python-bindings/source/wrappers.cc @@ -41,7 +41,7 @@ namespace python DEAL_II_NAMESPACE_CLOSE -char const *pydealii_docstring = +const char *pydealii_docstring = " \n" "PyDealII \n" "======== \n" diff --git a/include/deal.II/base/numbers.h b/include/deal.II/base/numbers.h index 360b7cda76..099b4745cf 100644 --- a/include/deal.II/base/numbers.h +++ b/include/deal.II/base/numbers.h @@ -687,7 +687,7 @@ namespace internal } public: - static bool const value = test(0); + static const bool value = test(0); }; /* diff --git a/include/deal.II/base/patterns.h b/include/deal.II/base/patterns.h index 96daf28834..64fcb694b7 100644 --- a/include/deal.II/base/patterns.h +++ b/include/deal.II/base/patterns.h @@ -1628,14 +1628,14 @@ namespace Patterns template struct is_list_compatible { - static constexpr bool const value = + static constexpr const bool value = internal::is_list_compatible>::value; }; template struct is_map_compatible { - static constexpr bool const value = + static constexpr const bool value = internal::is_map_compatible>::value; }; diff --git a/include/deal.II/base/time_stepping.templates.h b/include/deal.II/base/time_stepping.templates.h index 0b2af26ef2..27fb5e3719 100644 --- a/include/deal.II/base/time_stepping.templates.h +++ b/include/deal.II/base/time_stepping.templates.h @@ -543,7 +543,7 @@ namespace TimeStepping this->n_stages = 2; this->b.reserve(this->n_stages); this->c.reserve(this->n_stages); - double const gamma = 1.0 - 1.0 / std::sqrt(2.0); + const double gamma = 1.0 - 1.0 / std::sqrt(2.0); this->b.push_back(1.0 - gamma); this->b.push_back(gamma); this->a.push_back(std::vector(1, gamma)); diff --git a/include/deal.II/boost_adaptors/bounding_box.h b/include/deal.II/boost_adaptors/bounding_box.h index f8dac97331..1968ef69f0 100644 --- a/include/deal.II/boost_adaptors/bounding_box.h +++ b/include/deal.II/boost_adaptors/bounding_box.h @@ -59,7 +59,7 @@ namespace boost * a dealii::BoundingBox. */ static inline double - get(dealii::BoundingBox const &box) + get(const dealii::BoundingBox &box) { return box.get_boundary_points().first[D]; } @@ -87,7 +87,7 @@ namespace boost * a dealii::BoundingBox. */ static inline double - get(dealii::BoundingBox const &box) + get(const dealii::BoundingBox &box) { return box.get_boundary_points().second[D]; } diff --git a/include/deal.II/boost_adaptors/point.h b/include/deal.II/boost_adaptors/point.h index 6a1ad0f3a1..4eee748f7d 100644 --- a/include/deal.II/boost_adaptors/point.h +++ b/include/deal.II/boost_adaptors/point.h @@ -68,7 +68,7 @@ namespace boost struct access, D> { static inline double - get(dealii::Point const &p) + get(const dealii::Point &p) { return p[D]; } diff --git a/include/deal.II/numerics/matrix_creator.templates.h b/include/deal.II/numerics/matrix_creator.templates.h index 46d7ee87d6..c994cbe859 100644 --- a/include/deal.II/numerics/matrix_creator.templates.h +++ b/include/deal.II/numerics/matrix_creator.templates.h @@ -986,14 +986,13 @@ namespace MatrixCreator const MatrixCreator::internal::AssemblerBoundary::Scratch &, MatrixCreator::internal::AssemblerBoundary:: CopyData & copy_data, - Mapping const & mapping, - FiniteElement const &fe, - Quadrature const & q, - std::map *> const + const Mapping & mapping, + const FiniteElement &fe, + const Quadrature & q, + const std::map *> & boundary_functions, - Function const *const coefficient, - std::vector const & component_mapping) - + const Function *const coefficient, + const std::vector & component_mapping) { // Most assertions for this function are in the calling function // before creating threads. @@ -1218,11 +1217,11 @@ namespace MatrixCreator template void copy_boundary_mass_matrix_1( - MatrixCreator::internal::AssemblerBoundary:: - CopyData const ©_data, - std::map *> const + const MatrixCreator::internal::AssemblerBoundary:: + CopyData ©_data, + const std::map *> & boundary_functions, - std::vector const &dof_to_boundary_mapping, + const std::vector &dof_to_boundary_mapping, SparseMatrix & matrix, Vector & rhs_vector) { @@ -1295,13 +1294,13 @@ namespace MatrixCreator const MatrixCreator::internal::AssemblerBoundary::Scratch &, MatrixCreator::internal::AssemblerBoundary::CopyData<1, 3, float> & /*copy_data*/, - Mapping<1, 3> const &, - FiniteElement<1, 3> const &, - Quadrature<0> const &, - std::map *> const + const Mapping<1, 3> &, + const FiniteElement<1, 3> &, + const Quadrature<0> &, + const std::map *> & /*boundary_functions*/, - Function<3, float> const *const /*coefficient*/, - std::vector const & /*component_mapping*/) + const Function<3, float> *const /*coefficient*/, + const std::vector & /*component_mapping*/) { Assert(false, ExcNotImplemented()); } @@ -1312,13 +1311,13 @@ namespace MatrixCreator const MatrixCreator::internal::AssemblerBoundary::Scratch &, MatrixCreator::internal::AssemblerBoundary::CopyData<1, 3, double> & /*copy_data*/, - Mapping<1, 3> const &, - FiniteElement<1, 3> const &, - Quadrature<0> const &, - std::map *> const + const Mapping<1, 3> &, + const FiniteElement<1, 3> &, + const Quadrature<0> &, + const std::map *> & /*boundary_functions*/, - Function<3, double> const *const /*coefficient*/, - std::vector const & /*component_mapping*/) + const Function<3, double> *const /*coefficient*/, + const std::vector & /*component_mapping*/) { Assert(false, ExcNotImplemented()); } @@ -1396,8 +1395,8 @@ namespace MatrixCreator component_mapping); }, [&boundary_functions, &dof_to_boundary_mapping, &matrix, &rhs_vector]( - MatrixCreator::internal::AssemblerBoundary:: - CopyData const ©_data) { + const MatrixCreator::internal::AssemblerBoundary:: + CopyData ©_data) { internal::copy_boundary_mass_matrix_1(copy_data, boundary_functions, dof_to_boundary_mapping, @@ -1419,13 +1418,13 @@ namespace MatrixCreator const MatrixCreator::internal::AssemblerBoundary::Scratch &, MatrixCreator::internal::AssemblerBoundary :: CopyData & copy_data, - hp::MappingCollection const &mapping, - hp::FECollection const & fe_collection, - hp::QCollection const & q, + const hp::MappingCollection &mapping, + const hp::FECollection & fe_collection, + const hp::QCollection & q, const std::map *> & boundary_functions, - Function const *const coefficient, - std::vector const & component_mapping) + const Function *const coefficient, + const std::vector & component_mapping) { const unsigned int n_components = fe_collection.n_components(); const unsigned int n_function_components = @@ -1672,11 +1671,11 @@ namespace MatrixCreator template void copy_hp_boundary_mass_matrix_1( - MatrixCreator::internal::AssemblerBoundary :: - CopyData const ©_data, - std::map *> const + const MatrixCreator::internal::AssemblerBoundary :: + CopyData ©_data, + const std::map *> & boundary_functions, - std::vector const &dof_to_boundary_mapping, + const std::vector &dof_to_boundary_mapping, SparseMatrix & matrix, Vector & rhs_vector) { @@ -1872,8 +1871,8 @@ namespace MatrixCreator component_mapping); }, [&boundary_functions, &dof_to_boundary_mapping, &matrix, &rhs_vector]( - MatrixCreator::internal::AssemblerBoundary :: - CopyData const ©_data) { + const MatrixCreator::internal::AssemblerBoundary :: + CopyData ©_data) { internal::copy_hp_boundary_mass_matrix_1(copy_data, boundary_functions, dof_to_boundary_mapping, diff --git a/source/grid/grid_generator.cc b/source/grid/grid_generator.cc index a3062a5910..9e5434400f 100644 --- a/source/grid/grid_generator.cc +++ b/source/grid/grid_generator.cc @@ -2009,8 +2009,8 @@ namespace GridGenerator ExcMessage("Invalid angle phi specified.")); // the first 8 vertices are in the x-y-plane - Point<3> const p = Point<3>(R, 0.0, 0.0); - double const a = 1. / (1 + std::sqrt(2.0)); + const Point<3> p = Point<3>(R, 0.0, 0.0); + const double a = 1. / (1 + std::sqrt(2.0)); // A value of 1 indicates "open" torus with angle < 2*pi, which // means that we need an additional layer of vertices const unsigned int additional_layer = @@ -2031,12 +2031,12 @@ namespace GridGenerator // create remaining vertices by rotating around negative y-axis (the // direction is to ensure positive cell measures) - double const phi_cell = phi / n_cells_toroidal; + const double phi_cell = phi / n_cells_toroidal; for (unsigned int c = 1; c < n_point_layers_toroidal; ++c) { for (unsigned int v = 0; v < 8; ++v) { - double const r_2d = vertices[v][0]; + const double r_2d = vertices[v][0]; vertices[8 * c + v][0] = r_2d * std::cos(phi_cell * c); vertices[8 * c + v][1] = vertices[v][1]; vertices[8 * c + v][2] = r_2d * std::sin(phi_cell * c); diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index 7b7ad67ad2..856745b8b3 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -394,9 +394,9 @@ namespace GridTools J.compute_svd(); - double const max_sv = J.singular_value(0); - double const min_sv = J.singular_value(dim - 1); - double const ar = max_sv / min_sv; + const double max_sv = J.singular_value(0); + const double min_sv = J.singular_value(dim - 1); + const double ar = max_sv / min_sv; // Take the max between the previous and the current // aspect ratio value; if we had previously encountered diff --git a/source/lac/cuda_solver_direct.cc b/source/lac/cuda_solver_direct.cc index dbad0a6d27..02fa4d1bff 100644 --- a/source/lac/cuda_solver_direct.cc +++ b/source/lac/cuda_solver_direct.cc @@ -316,8 +316,8 @@ namespace CUDAWrappers Number * x_dev) { // Change the format of the matrix from sparse to dense - unsigned int const m = matrix.m(); - unsigned int const n = matrix.n(); + const unsigned int m = matrix.m(); + const unsigned int n = matrix.n(); Assert(m == n, ExcMessage("The matrix is not square")); Number *dense_matrix_dev; Utilities::CUDA::malloc(dense_matrix_dev, m * n); diff --git a/source/lac/cuda_sparse_matrix.cc b/source/lac/cuda_sparse_matrix.cc index 95ebe1e798..1cce237c1e 100644 --- a/source/lac/cuda_sparse_matrix.cc +++ b/source/lac/cuda_sparse_matrix.cc @@ -392,7 +392,7 @@ namespace CUDAWrappers nnz = sparse_matrix_host.n_nonzero_elements(); n_rows = sparse_matrix_host.m(); n_cols = sparse_matrix_host.n(); - unsigned int const row_ptr_size = n_rows + 1; + const unsigned int row_ptr_size = n_rows + 1; std::vector val; val.reserve(nnz); std::vector column_index; @@ -414,8 +414,8 @@ namespace CUDAWrappers row_ptr[row + 1] = row_ptr[row] + counter; // Sort the elements in the row - unsigned int const offset = row_ptr[row]; - int const diag_index = column_index[offset]; + const unsigned int offset = row_ptr[row]; + const int diag_index = column_index[offset]; Number diag_elem = sparse_matrix_host.diag_element(row); unsigned int pos = 1; while ((column_index[offset + pos] < row) && (pos < counter)) diff --git a/source/lac/vector.cc b/source/lac/vector.cc index 342e723ce0..54d97765c1 100644 --- a/source/lac/vector.cc +++ b/source/lac/vector.cc @@ -31,7 +31,7 @@ template class Vector; template Vector & Vector::operator=(const dealii::Vector &); template bool -Vector::operator==(dealii::Vector const &) const; +Vector::operator==(const dealii::Vector &) const; // instantiate for long double manually because we use it in a few places: template class Vector; diff --git a/source/numerics/derivative_approximation.cc b/source/numerics/derivative_approximation.cc index d61405f461..4d7de36ef9 100644 --- a/source/numerics/derivative_approximation.cc +++ b/source/numerics/derivative_approximation.cc @@ -918,13 +918,13 @@ namespace DerivativeApproximation int spacedim> void approximate( - SynchronousIterators< + const SynchronousIterators< std::tuple::active_cell_iterator, - Vector::iterator>> const &cell, - const Mapping & mapping, - const DoFHandler & dof_handler, - const InputVector & solution, - const unsigned int component) + Vector::iterator>> &cell, + const Mapping & mapping, + const DoFHandler & dof_handler, + const InputVector & solution, + const unsigned int component) { // if the cell is not locally owned, then there is nothing to do if (std::get<0>(*cell)->is_locally_owned() == false) @@ -992,7 +992,7 @@ namespace DerivativeApproximation begin, end, [&mapping, &dof_handler, &solution, component]( - SynchronousIterators const &cell, + const SynchronousIterators &cell, const Assembler::Scratch &, Assembler::CopyData &) { approximate( diff --git a/tests/base/time_stepping_01.cc b/tests/base/time_stepping_01.cc index be33fa9d2c..27ce5c6d7a 100644 --- a/tests/base/time_stepping_01.cc +++ b/tests/base/time_stepping_01.cc @@ -22,7 +22,7 @@ #include "../tests.h" Vector -f1(double const t, Vector const &y) +f1(const double t, const Vector &y) { Vector values(y); for (unsigned int i = 0; i < values.size(); ++i) @@ -32,7 +32,7 @@ f1(double const t, Vector const &y) } Vector -f2(double const t, Vector const &y) +f2(const double t, const Vector &y) { Vector values(y); for (unsigned int i = 0; i < values.size(); ++i) @@ -42,7 +42,7 @@ f2(double const t, Vector const &y) } Vector -f3(double const t, Vector const &y) +f3(const double t, const Vector &y) { Vector values(y); for (unsigned int i = 0; i < values.size(); ++i) @@ -52,7 +52,7 @@ f3(double const t, Vector const &y) } Vector -f4(double const t, Vector const &y) +f4(const double t, const Vector &y) { Vector values(y); for (unsigned int i = 0; i < values.size(); ++i) @@ -62,7 +62,7 @@ f4(double const t, Vector const &y) } Vector -f5(double const t, Vector const &y) +f5(const double t, const Vector &y) { Vector values(y); for (unsigned int i = 0; i < values.size(); ++i) @@ -73,7 +73,7 @@ f5(double const t, Vector const &y) Vector -my_rhs_function(double const t, Vector const &y) +my_rhs_function(const double t, const Vector &y) { Vector values(y); for (unsigned int i = 0; i < values.size(); ++i) @@ -83,78 +83,78 @@ my_rhs_function(double const t, Vector const &y) } Vector -id_minus_tau_J_inv1(double const t, double const tau, Vector const &y) +id_minus_tau_J_inv1(const double t, const double tau, const Vector &y) { return y; } Vector -id_minus_tau_J_inv2(double const t, double const tau, Vector const &y) +id_minus_tau_J_inv2(const double t, const double tau, const Vector &y) { return y; } Vector -id_minus_tau_J_inv3(double const t, double const tau, Vector const &y) +id_minus_tau_J_inv3(const double t, const double tau, const Vector &y) { return y; } Vector -id_minus_tau_J_inv4(double const t, double const tau, Vector const &y) +id_minus_tau_J_inv4(const double t, const double tau, const Vector &y) { return y; } Vector -id_minus_tau_J_inv5(double const t, double const tau, Vector const &y) +id_minus_tau_J_inv5(const double t, const double tau, const Vector &y) { return y; } double -my1(double const t) +my1(const double t) { return t; } double -my2(double const t) +my2(const double t) { return t * t; } double -my3(double const t) +my3(const double t) { return t * t * t; } double -my4(double const t) +my4(const double t) { return t * t * t * t; } double -my5(double const t) +my5(const double t) { return t * t * t * t * t; } double -my_exact_solution(double const t) +my_exact_solution(const double t) { return 0.1 * std::exp(t * t); } void test(TimeStepping::RungeKutta> & solver, - std::function(double const, Vector const &)> f, - std::function(double const, - double const, - Vector const &)> id_minus_tau_J_inv, - std::function my) + std::function(const double, const Vector &)> f, + std::function(const double, + const double, + const Vector &)> id_minus_tau_J_inv, + std::function my) { unsigned int n_time_steps = 1; unsigned int size = 1; @@ -182,11 +182,11 @@ test(TimeStepping::RungeKutta> & solver, void test2(TimeStepping::EmbeddedExplicitRungeKutta> &solver, - std::function(double const, Vector const &)> f, - std::function(double const, - double const, - Vector const &)> id_minus_tau_J_inv, - std::function my) + std::function(const double, const Vector &)> f, + std::function(const double, + const double, + const Vector &)> id_minus_tau_J_inv, + std::function my) { double initial_time = 0.0, final_time = 1.0; double time_step = 1.0; @@ -221,11 +221,11 @@ test2(TimeStepping::EmbeddedExplicitRungeKutta> &solver, void test_convergence( TimeStepping::RungeKutta> & solver, - std::function(double const, Vector const &)> f, - std::function(double const, - double const, - Vector const &)> id_minus_tau_J_inv, - std::function my) + std::function(const double, const Vector &)> f, + std::function(const double, + const double, + const Vector &)> id_minus_tau_J_inv, + std::function my) { std::vector errors; double initial_time = 0.0, final_time = 1.0; diff --git a/tests/base/time_stepping_02.cc b/tests/base/time_stepping_02.cc index 6e56899f4c..235d063e28 100644 --- a/tests/base/time_stepping_02.cc +++ b/tests/base/time_stepping_02.cc @@ -24,7 +24,7 @@ #include "../tests.h" Vector -f(double const t, Vector const &y) +f(const double t, const Vector &y) { Vector values(y); for (unsigned int i = 0; i < values.size(); ++i) @@ -34,15 +34,15 @@ f(double const t, Vector const &y) } double -my(double const t) +my(const double t) { return t; } void test(TimeStepping::EmbeddedExplicitRungeKutta> & solver, - std::function(double const, Vector const &)> f, - std::function my) + std::function(const double, const Vector &)> f, + std::function my) { double initial_time = 0.0, final_time = 1.0; double time_step = 0.1; diff --git a/tests/cuda/solver_02.cc b/tests/cuda/solver_02.cc index a38b5e230e..331f987fec 100644 --- a/tests/cuda/solver_02.cc +++ b/tests/cuda/solver_02.cc @@ -35,7 +35,7 @@ test(Utilities::CUDA::Handle &cuda_handle) // Create the matrix on the host. dealii::SparsityPattern sparsity_pattern; dealii::SparseMatrix matrix; - unsigned int const size = 30; + const unsigned int size = 30; std::vector> column_indices(size); for (unsigned int i = 0; i < size; ++i) { diff --git a/tests/cuda/sparse_matrix_01.cc b/tests/cuda/sparse_matrix_01.cc index f9ffa651f0..c708b90ee4 100644 --- a/tests/cuda/sparse_matrix_01.cc +++ b/tests/cuda/sparse_matrix_01.cc @@ -28,7 +28,7 @@ void -check_matrix(SparseMatrix const & A, +check_matrix(const SparseMatrix & A, CUDAWrappers::SparseMatrix &A_dev) { cudaError_t cuda_error_code; @@ -53,7 +53,7 @@ check_matrix(SparseMatrix const & A, cudaMemcpyDeviceToHost); AssertCuda(cuda_error_code); - int const n_rows = A_dev.m() + 1; + const int n_rows = A_dev.m() + 1; std::vector row_ptr_host(n_rows + 1); cuda_error_code = cudaMemcpy(&row_ptr_host[0], row_ptr_dev, @@ -68,8 +68,8 @@ check_matrix(SparseMatrix const & A, } void -check_vector(Vector const & a, - LinearAlgebra::ReadWriteVector const &b) +check_vector(const Vector & a, + const LinearAlgebra::ReadWriteVector &b) { unsigned int size = a.size(); for (unsigned int i = 0; i < size; ++i) diff --git a/tests/grid/grid_generator_open_torus.cc b/tests/grid/grid_generator_open_torus.cc index bd9553de8c..55e148e3c9 100644 --- a/tests/grid/grid_generator_open_torus.cc +++ b/tests/grid/grid_generator_open_torus.cc @@ -38,22 +38,22 @@ void test() { Triangulation<3> tria; - unsigned int const n_cells_toroidal = 9; - double const angle = 2.0 * numbers::PI; - double const R = 3., r = 1.; + const unsigned int n_cells_toroidal = 9; + const double angle = 2.0 * numbers::PI; + const double R = 3., r = 1.; GridGenerator::torus(tria, R, r, n_cells_toroidal, angle); Triangulation<3> tria_open; - unsigned int const factor = 3; + const unsigned int factor = 3; GridGenerator::torus( tria_open, R, r, n_cells_toroidal / factor, angle / (double)factor); - MappingQ<3> const mapping(3); - QGauss<3> const gauss(4); + const MappingQ<3> mapping(3); + const QGauss<3> gauss(4); - double const ar_full_torus = + const double ar_full_torus = GridTools::compute_maximum_aspect_ratio(mapping, tria, gauss); - double const ar_open_torus = + const double ar_open_torus = GridTools::compute_maximum_aspect_ratio(mapping, tria_open, gauss); deallog << "N_active_cells_full = " << tria.n_global_active_cells() diff --git a/tests/grid/grid_tools_aspect_ratio.cc b/tests/grid/grid_tools_aspect_ratio.cc index 996ad81905..1de69fd483 100644 --- a/tests/grid/grid_tools_aspect_ratio.cc +++ b/tests/grid/grid_tools_aspect_ratio.cc @@ -50,9 +50,9 @@ template double compute_aspect_ratio_hyper_rectangle( - Point const & left, - Point const & right, - std::vector const &refinements, + const Point & left, + const Point & right, + const std::vector &refinements, unsigned int degree = 1, unsigned int n_q_points = 2, bool deform = false, @@ -72,8 +72,8 @@ compute_aspect_ratio_hyper_rectangle( tria.begin_active()->vertex(0) += shift; } - MappingQ const mapping(degree); - QGauss const gauss(n_q_points); + const MappingQ mapping(degree); + const QGauss gauss(n_q_points); Vector ratios = GridTools::compute_aspect_ratio_of_cells(mapping, tria, gauss); diff --git a/tests/lac/sparse_matrix_print.cc b/tests/lac/sparse_matrix_print.cc index de6b4086e5..c0085ccf8a 100644 --- a/tests/lac/sparse_matrix_print.cc +++ b/tests/lac/sparse_matrix_print.cc @@ -26,7 +26,7 @@ template void print_sparse_matrix() { - unsigned int const n = 20; + const unsigned int n = 20; SparsityPattern sp(n, n); for (unsigned int i = 0; i < n; ++i) for (unsigned int j = 0; j < n; ++j) diff --git a/tests/manifold/transfinite_manifold_10.cc b/tests/manifold/transfinite_manifold_10.cc index 5721d9bb2a..cc892aa05f 100644 --- a/tests/manifold/transfinite_manifold_10.cc +++ b/tests/manifold/transfinite_manifold_10.cc @@ -75,8 +75,8 @@ main() const unsigned int n_cells = 3; // the first 8 vertices are in the x-y-plane - Point<3> const p = Point<3>(R, 0.0, 0.0); - double const a = 1. / (1 + std::sqrt(2.0)); + const Point<3> p = Point<3>(R, 0.0, 0.0); + const double a = 1. / (1 + std::sqrt(2.0)); std::vector> vertices(8 * n_cells); vertices[0] = p + Point<3>(-1, -1, 0) * (r / std::sqrt(2.0)), vertices[1] = p + Point<3>(+1, -1, 0) * (r / std::sqrt(2.0)), @@ -93,7 +93,7 @@ main() { for (unsigned int v = 0; v < 8; ++v) { - double const r_2d = vertices[v][0]; + const double r_2d = vertices[v][0]; vertices[8 * c + v][0] = r_2d * std::cos(phi_cell * c); vertices[8 * c + v][1] = vertices[v][1]; vertices[8 * c + v][2] = r_2d * std::sin(phi_cell * c); diff --git a/tests/mappings/mapping_get_vertices_on_face.cc b/tests/mappings/mapping_get_vertices_on_face.cc index 76a6a01227..2e57ad08f4 100644 --- a/tests/mappings/mapping_get_vertices_on_face.cc +++ b/tests/mappings/mapping_get_vertices_on_face.cc @@ -62,7 +62,7 @@ test_vertex_order() for (unsigned int i = 0; i < vertices.size(); ++i) { - auto const diff = vertices[i] - vertices_detour[i]; + const auto diff = vertices[i] - vertices_detour[i]; AssertThrow(diff.norm() < 1e-12, ExcMessage("Vertices differ!")); } } diff --git a/tests/matrix_free/coefficient_eval_device.cc b/tests/matrix_free/coefficient_eval_device.cc index e733a2b8fc..deaf77242f 100644 --- a/tests/matrix_free/coefficient_eval_device.cc +++ b/tests/matrix_free/coefficient_eval_device.cc @@ -151,19 +151,19 @@ test() // Computation the host auto graph = mf_data.get_colored_graph(); - unsigned int const n_colors = graph.size(); + const unsigned int n_colors = graph.size(); for (unsigned int color = 0; color < n_colors; ++color) { typename CUDAWrappers::MatrixFree::Data gpu_data = mf_data.get_data(color); - unsigned int const n_cells = gpu_data.n_cells; + const unsigned int n_cells = gpu_data.n_cells; auto gpu_data_host = CUDAWrappers::copy_mf_data_to_host( gpu_data, additional_data.mapping_update_flags); for (unsigned int cell_id = 0; cell_id < n_cells; ++cell_id) { for (unsigned int i = 0; i < n_q_points_per_cell; ++i) { - unsigned int const pos = + const unsigned int pos = gpu_data_host.local_q_point_id(cell_id, n_q_points_per_cell, i); auto p = gpu_data_host.get_quadrature_point(cell_id, i); const double p_val = dim == 2 ? p(0) + p(1) : p(0) + p(1) + p(2); diff --git a/tests/matrix_free/matrix_vector_rt_04.cc b/tests/matrix_free/matrix_vector_rt_04.cc index fe11677863..e4ad5db477 100644 --- a/tests/matrix_free/matrix_vector_rt_04.cc +++ b/tests/matrix_free/matrix_vector_rt_04.cc @@ -30,10 +30,10 @@ template class DeformedCubeManifold : public dealii::ChartManifold { public: - DeformedCubeManifold(double const left, - double const right, - double const deformation, - unsigned int const frequency = 1) + DeformedCubeManifold(const double left, + const double right, + const double deformation, + const unsigned int frequency = 1) : left(left) , right(right) , deformation(deformation) @@ -41,7 +41,7 @@ public: {} dealii::Point - push_forward(dealii::Point const &chart_point) const override + push_forward(const dealii::Point &chart_point) const override { double sinval = deformation; for (unsigned int d = 0; d < dim; ++d) @@ -54,7 +54,7 @@ public: } dealii::Point - pull_back(dealii::Point const &space_point) const override + pull_back(const dealii::Point &space_point) const override { dealii::Point x = space_point; dealii::Point one; @@ -117,10 +117,10 @@ public: } private: - double const left; - double const right; - double const deformation; - unsigned int const frequency; + const double left; + const double right; + const double deformation; + const unsigned int frequency; }; template @@ -130,8 +130,8 @@ test() Triangulation tria; GridGenerator::hyper_cube(tria); tria.refine_global(2); - unsigned int const frequency = 2; - double const deformation = 0.05; + const unsigned int frequency = 2; + const double deformation = 0.05; static DeformedCubeManifold manifold(0.0, 1.0, deformation, frequency); tria.set_all_manifold_ids(1); tria.set_manifold(1, manifold); diff --git a/tests/matrix_free/matrix_vector_rt_common.h b/tests/matrix_free/matrix_vector_rt_common.h index 64798807ae..ce6d8644d0 100644 --- a/tests/matrix_free/matrix_vector_rt_common.h +++ b/tests/matrix_free/matrix_vector_rt_common.h @@ -70,7 +70,7 @@ enum TestType : unsigned char }; std::string -enum_to_string(TestType const enum_type) +enum_to_string(const TestType enum_type) { std::string string_type; switch (enum_type) diff --git a/tests/matrix_free/matrix_vector_rt_face_04.cc b/tests/matrix_free/matrix_vector_rt_face_04.cc index 9f100a4b0a..781730776e 100644 --- a/tests/matrix_free/matrix_vector_rt_face_04.cc +++ b/tests/matrix_free/matrix_vector_rt_face_04.cc @@ -31,10 +31,10 @@ template class DeformedCubeManifold : public dealii::ChartManifold { public: - DeformedCubeManifold(double const left, - double const right, - double const deformation, - unsigned int const frequency = 1) + DeformedCubeManifold(const double left, + const double right, + const double deformation, + const unsigned int frequency = 1) : left(left) , right(right) , deformation(deformation) @@ -42,7 +42,7 @@ public: {} dealii::Point - push_forward(dealii::Point const &chart_point) const override + push_forward(const dealii::Point &chart_point) const override { double sinval = deformation; for (unsigned int d = 0; d < dim; ++d) @@ -55,7 +55,7 @@ public: } dealii::Point - pull_back(dealii::Point const &space_point) const override + pull_back(const dealii::Point &space_point) const override { dealii::Point x = space_point; dealii::Point one; @@ -118,10 +118,10 @@ public: } private: - double const left; - double const right; - double const deformation; - unsigned int const frequency; + const double left; + const double right; + const double deformation; + const unsigned int frequency; }; template @@ -131,8 +131,8 @@ test() Triangulation tria; GridGenerator::hyper_cube(tria); tria.refine_global(2); - unsigned int const frequency = 2; - double const deformation = 0.05; + const unsigned int frequency = 2; + const double deformation = 0.05; static DeformedCubeManifold manifold(0.0, 1.0, deformation, frequency); tria.set_all_manifold_ids(1); tria.set_manifold(1, manifold); diff --git a/tests/matrix_free/matrix_vector_rt_face_common.h b/tests/matrix_free/matrix_vector_rt_face_common.h index 8a75ea7415..34a6c1bead 100644 --- a/tests/matrix_free/matrix_vector_rt_face_common.h +++ b/tests/matrix_free/matrix_vector_rt_face_common.h @@ -70,7 +70,7 @@ enum TestType : unsigned char }; std::string -enum_to_string(TestType const enum_type) +enum_to_string(const TestType enum_type) { std::string string_type; switch (enum_type) diff --git a/tests/particles/properties_01.cc b/tests/particles/properties_01.cc index 4401e8458b..cc10d4fe08 100644 --- a/tests/particles/properties_01.cc +++ b/tests/particles/properties_01.cc @@ -47,7 +47,7 @@ public: {} inline virtual void - vector_value(Point const &p, Vector &values) const override + vector_value(const Point &p, Vector &values) const override { for (unsigned int i = 0; i < dim; ++i) { diff --git a/tests/particles/properties_02.cc b/tests/particles/properties_02.cc index cb14ffd4e7..dc06ed8016 100644 --- a/tests/particles/properties_02.cc +++ b/tests/particles/properties_02.cc @@ -51,7 +51,7 @@ public: {} inline virtual void - vector_value(Point const &p, Vector &values) const override + vector_value(const Point &p, Vector &values) const override { for (unsigned int i = 0; i < dim; ++i) { diff --git a/tests/remote_point_evaluation/search_adjacent_cells.cc b/tests/remote_point_evaluation/search_adjacent_cells.cc index 9ea900755d..14f760ff41 100644 --- a/tests/remote_point_evaluation/search_adjacent_cells.cc +++ b/tests/remote_point_evaluation/search_adjacent_cells.cc @@ -53,19 +53,19 @@ template void construct_triangulation(Triangulation &tria) { - double const L_F = 0.7; - double const B_F = 1.0; - double const H_F = 0.5; + const double L_F = 0.7; + const double B_F = 1.0; + const double H_F = 0.5; - double const T_S = 0.05; - double const B_S = 0.6; - double const H_S = 0.4; + const double T_S = 0.05; + const double B_S = 0.6; + const double H_S = 0.4; - double const L_IN = 0.6; + const double L_IN = 0.6; - unsigned int const N_CELLS_X_OUTFLOW = 1; - unsigned int const N_CELLS_Y_LOWER = 2; - unsigned int const N_CELLS_Z_MIDDLE = 2; + const unsigned int N_CELLS_X_OUTFLOW = 1; + const unsigned int N_CELLS_Y_LOWER = 2; + const unsigned int N_CELLS_Z_MIDDLE = 2; std::vector> tria_vec; tria_vec.resize(4); @@ -95,7 +95,7 @@ construct_triangulation(Triangulation &tria) dealii::Point<3>(L_IN, -H_F / 2.0, -B_F / 2.0), dealii::Point<3>(L_IN + T_S, H_S - H_F / 2.0, -B_S / 2.0)); - std::vector const *> tria_vec_ptr(tria_vec.size()); + std::vector *> tria_vec_ptr(tria_vec.size()); for (unsigned int i = 0; i < tria_vec.size(); ++i) tria_vec_ptr[i] = &tria_vec[i]; @@ -224,7 +224,7 @@ test(const unsigned int mapping_degree, // enclosing dummy triangulation for point plots dealii::BoundingBox bounding_box(points); - auto const boundary_points = + const auto boundary_points = bounding_box.create_extended_relative(1e-3).get_boundary_points(); dealii::Triangulation particle_dummy_tria; diff --git a/tests/tensors/tensor_accessors_01.cc b/tests/tensors/tensor_accessors_01.cc index 4e2810add0..d78d8ee189 100644 --- a/tests/tensors/tensor_accessors_01.cc +++ b/tests/tensors/tensor_accessors_01.cc @@ -150,7 +150,7 @@ main() const double(&t_ref)[3][3][3][3][3] = t; dealii::TensorAccessors::internal:: - ReorderedIndexView<2, 5, double const[3][3][3][3][3]> // auto ... + ReorderedIndexView<2, 5, const double[3][3][3][3][3]> // auto ... foo2 = TensorAccessors::reordered_index_view<2, 5>(t_ref); deallog << foo2[0][1][0][1][2] << std::endl; } diff --git a/tests/trilinos/assemble_matrix_parallel_02.cc b/tests/trilinos/assemble_matrix_parallel_02.cc index 7f9c3fb338..aa07a29351 100644 --- a/tests/trilinos/assemble_matrix_parallel_02.cc +++ b/tests/trilinos/assemble_matrix_parallel_02.cc @@ -132,7 +132,7 @@ private: std::vector get_conflict_indices( - FilteredIterator::active_cell_iterator> const + const FilteredIterator::active_cell_iterator> &cell) const; parallel::distributed::Triangulation triangulation; @@ -226,7 +226,7 @@ LaplaceProblem::~LaplaceProblem() template std::vector LaplaceProblem::get_conflict_indices( - FilteredIterator::active_cell_iterator> const &cell) + const FilteredIterator::active_cell_iterator> &cell) const { std::vector local_dof_indices( @@ -268,7 +268,7 @@ LaplaceProblem::setup_system() begin, end, static_cast( - FilteredIterator::active_cell_iterator> const + const FilteredIterator::active_cell_iterator> &)>>(std::bind(&LaplaceProblem::get_conflict_indices, this, std::placeholders::_1))); diff --git a/tests/trilinos/assemble_matrix_parallel_03.cc b/tests/trilinos/assemble_matrix_parallel_03.cc index d5e542793c..d30d7818dd 100644 --- a/tests/trilinos/assemble_matrix_parallel_03.cc +++ b/tests/trilinos/assemble_matrix_parallel_03.cc @@ -133,7 +133,7 @@ private: std::vector get_conflict_indices( - FilteredIterator::active_cell_iterator> const + const FilteredIterator::active_cell_iterator> &cell) const; parallel::distributed::Triangulation triangulation; @@ -227,7 +227,7 @@ LaplaceProblem::~LaplaceProblem() template std::vector LaplaceProblem::get_conflict_indices( - FilteredIterator::active_cell_iterator> const &cell) + const FilteredIterator::active_cell_iterator> &cell) const { std::vector local_dof_indices( @@ -269,7 +269,7 @@ LaplaceProblem::setup_system() begin, end, static_cast( - FilteredIterator::active_cell_iterator> const + const FilteredIterator::active_cell_iterator> &)>>(std::bind(&LaplaceProblem::get_conflict_indices, this, std::placeholders::_1))); diff --git a/tests/trilinos/assemble_matrix_parallel_04.cc b/tests/trilinos/assemble_matrix_parallel_04.cc index 1aa96afced..029c67deb6 100644 --- a/tests/trilinos/assemble_matrix_parallel_04.cc +++ b/tests/trilinos/assemble_matrix_parallel_04.cc @@ -134,7 +134,7 @@ private: std::vector get_conflict_indices( - FilteredIterator::active_cell_iterator> const + const FilteredIterator::active_cell_iterator> &cell) const; parallel::distributed::Triangulation triangulation; @@ -228,7 +228,7 @@ LaplaceProblem::~LaplaceProblem() template std::vector LaplaceProblem::get_conflict_indices( - FilteredIterator::active_cell_iterator> const &cell) + const FilteredIterator::active_cell_iterator> &cell) const { std::vector local_dof_indices( @@ -273,7 +273,7 @@ LaplaceProblem::setup_system() begin, end, static_cast( - FilteredIterator::active_cell_iterator> const + const FilteredIterator::active_cell_iterator> &)>>(std::bind(&LaplaceProblem::get_conflict_indices, this, std::placeholders::_1))); diff --git a/tests/trilinos/assemble_matrix_parallel_05.cc b/tests/trilinos/assemble_matrix_parallel_05.cc index 4914bccc27..e4d53ede4d 100644 --- a/tests/trilinos/assemble_matrix_parallel_05.cc +++ b/tests/trilinos/assemble_matrix_parallel_05.cc @@ -134,7 +134,7 @@ private: std::vector get_conflict_indices( - FilteredIterator::active_cell_iterator> const + const FilteredIterator::active_cell_iterator> &cell) const; parallel::distributed::Triangulation triangulation; @@ -228,7 +228,7 @@ LaplaceProblem::~LaplaceProblem() template std::vector LaplaceProblem::get_conflict_indices( - FilteredIterator::active_cell_iterator> const &cell) + const FilteredIterator::active_cell_iterator> &cell) const { std::vector local_dof_indices( @@ -270,7 +270,7 @@ LaplaceProblem::setup_system() begin, end, static_cast( - FilteredIterator::active_cell_iterator> const + const FilteredIterator::active_cell_iterator> &)>>(std::bind(&LaplaceProblem::get_conflict_indices, this, std::placeholders::_1))); diff --git a/tests/trilinos/assemble_matrix_parallel_06.cc b/tests/trilinos/assemble_matrix_parallel_06.cc index 36122c73bb..603ba58622 100644 --- a/tests/trilinos/assemble_matrix_parallel_06.cc +++ b/tests/trilinos/assemble_matrix_parallel_06.cc @@ -136,7 +136,7 @@ private: std::vector get_conflict_indices( - FilteredIterator::active_cell_iterator> const + const FilteredIterator::active_cell_iterator> &cell) const; parallel::distributed::Triangulation triangulation; @@ -230,7 +230,7 @@ LaplaceProblem::~LaplaceProblem() template std::vector LaplaceProblem::get_conflict_indices( - FilteredIterator::active_cell_iterator> const &cell) + const FilteredIterator::active_cell_iterator> &cell) const { std::vector local_dof_indices( @@ -275,7 +275,7 @@ LaplaceProblem::setup_system() begin, end, static_cast( - FilteredIterator::active_cell_iterator> const + const FilteredIterator::active_cell_iterator> &)>>(std::bind(&LaplaceProblem::get_conflict_indices, this, std::placeholders::_1))); diff --git a/tests/trilinos/assemble_matrix_parallel_07.cc b/tests/trilinos/assemble_matrix_parallel_07.cc index 6cbd60786e..23c466bbb6 100644 --- a/tests/trilinos/assemble_matrix_parallel_07.cc +++ b/tests/trilinos/assemble_matrix_parallel_07.cc @@ -133,7 +133,7 @@ private: std::vector get_conflict_indices( - FilteredIterator::active_cell_iterator> const + const FilteredIterator::active_cell_iterator> &cell) const; parallel::distributed::Triangulation triangulation; @@ -227,7 +227,7 @@ LaplaceProblem::~LaplaceProblem() template std::vector LaplaceProblem::get_conflict_indices( - FilteredIterator::active_cell_iterator> const &cell) + const FilteredIterator::active_cell_iterator> &cell) const { std::vector local_dof_indices( @@ -269,7 +269,7 @@ LaplaceProblem::setup_system() begin, end, static_cast( - FilteredIterator::active_cell_iterator> const + const FilteredIterator::active_cell_iterator> &)>>(std::bind(&LaplaceProblem::get_conflict_indices, this, std::placeholders::_1))); -- 2.39.5