From d1716be135faf538ad28dadfeeecc18c51793ad7 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Mon, 10 Jul 2023 11:58:20 -0400 Subject: [PATCH] Use readability-qualified-auto clang-tidy check --- .clang-tidy | 3 +- examples/step-1/step-1.cc | 2 +- examples/step-12/step-12.cc | 2 +- examples/step-2/step-2.cc | 2 +- examples/step-47/step-47.cc | 2 +- examples/step-50/step-50.cc | 2 +- include/deal.II/base/patterns.h | 28 +++++----- include/deal.II/base/tensor.h | 2 +- include/deal.II/base/utilities.h | 4 +- .../lac/affine_constraints.templates.h | 2 +- include/deal.II/lac/diagonal_matrix.h | 6 +-- include/deal.II/lac/trilinos_tpetra_vector.h | 4 +- .../lac/trilinos_tpetra_vector.templates.h | 9 ++-- include/deal.II/lac/vector_element_access.h | 4 +- .../deal.II/matrix_free/evaluation_kernels.h | 54 ++++++++++--------- .../deal.II/multigrid/mg_transfer.templates.h | 6 +-- .../mg_transfer_global_coarsening.templates.h | 28 +++++----- source/base/data_out_base.cc | 2 +- source/base/mpi.cc | 4 +- source/base/parameter_acceptor.cc | 2 +- source/base/subscriptor.cc | 6 +-- source/distributed/solution_transfer.cc | 6 +-- source/fe/fe_system.cc | 4 +- source/grid/grid_generator.cc | 8 +-- source/lac/petsc_precondition.cc | 4 +- source/particles/property_pool.cc | 2 +- 26 files changed, 101 insertions(+), 97 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index d41b0cef49..46c3e9a24a 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -34,6 +34,7 @@ Checks: > mpi-*, performance-*, -performance-inefficient-string-concatenation, - -performance-no-automatic-move + -performance-no-automatic-move, + readability-qualified-auto WarningsAsErrors: '*' diff --git a/examples/step-1/step-1.cc b/examples/step-1/step-1.cc index 262d4ee257..8c31217eda 100644 --- a/examples/step-1/step-1.cc +++ b/examples/step-1/step-1.cc @@ -191,7 +191,7 @@ void second_grid() // range- // based for loops, which wrap up all of the syntax shown above into a // much shorter form: - for (auto &cell : triangulation.active_cell_iterators()) + for (const auto &cell : triangulation.active_cell_iterators()) { // @note See @ref Iterators for more information about the iterator // classes used in deal.II, and @ref CPP11 for more information about diff --git a/examples/step-12/step-12.cc b/examples/step-12/step-12.cc index 9d4228ea6f..796bf858ed 100644 --- a/examples/step-12/step-12.cc +++ b/examples/step-12/step-12.cc @@ -430,7 +430,7 @@ namespace Step12 system_matrix, right_hand_side); - for (auto &cdf : c.face_data) + for (const auto &cdf : c.face_data) { constraints.distribute_local_to_global(cdf.cell_matrix, cdf.joint_dof_indices, diff --git a/examples/step-2/step-2.cc b/examples/step-2/step-2.cc index 0d6f86d4ab..5fa3aacfde 100644 --- a/examples/step-2/step-2.cc +++ b/examples/step-2/step-2.cc @@ -84,7 +84,7 @@ void make_grid(Triangulation<2> &triangulation) for (unsigned int step = 0; step < 3; ++step) { - for (auto &cell : triangulation.active_cell_iterators()) + for (const auto &cell : triangulation.active_cell_iterators()) for (const auto v : cell->vertex_indices()) { const double distance_from_center = diff --git a/examples/step-47/step-47.cc b/examples/step-47/step-47.cc index ec6522be4c..c2494c32e4 100644 --- a/examples/step-47/step-47.cc +++ b/examples/step-47/step-47.cc @@ -702,7 +702,7 @@ namespace Step47 system_matrix, system_rhs); - for (auto &cdf : copy_data.face_data) + for (const auto &cdf : copy_data.face_data) { constraints.distribute_local_to_global(cdf.cell_matrix, cdf.joint_dof_indices, diff --git a/examples/step-50/step-50.cc b/examples/step-50/step-50.cc index bfa022496f..5749c9a8bb 100644 --- a/examples/step-50/step-50.cc +++ b/examples/step-50/step-50.cc @@ -1358,7 +1358,7 @@ void LaplaceProblem::estimate() if (copy_data.cell_index != numbers::invalid_unsigned_int) estimated_error_square_per_cell[copy_data.cell_index] += copy_data.value; - for (auto &cdf : copy_data.face_data) + for (const auto &cdf : copy_data.face_data) for (unsigned int j = 0; j < 2; ++j) estimated_error_square_per_cell[cdf.cell_indices[j]] += cdf.values[j]; }; diff --git a/include/deal.II/base/patterns.h b/include/deal.II/base/patterns.h index 01a762a2e5..95e3026057 100644 --- a/include/deal.II/base/patterns.h +++ b/include/deal.II/base/patterns.h @@ -1777,7 +1777,7 @@ namespace Patterns const T & t, const Patterns::PatternBase &pattern = *Convert::to_pattern()) { - auto p = dynamic_cast(&pattern); + const auto *p = dynamic_cast(&pattern); AssertThrow(p, ExcMessage("I need a List pattern to convert a " "string to a List type.")); @@ -1805,7 +1805,7 @@ namespace Patterns { AssertThrow(pattern.match(s), ExcNoMatch(s, pattern.description())); - auto p = dynamic_cast(&pattern); + const auto *p = dynamic_cast(&pattern); AssertThrow(p, ExcMessage("I need a List pattern to convert a string " "to a List type.")); @@ -1848,7 +1848,7 @@ namespace Patterns const T & t, const Patterns::PatternBase &pattern = *Convert::to_pattern()) { - auto p = dynamic_cast(&pattern); + const auto *p = dynamic_cast(&pattern); AssertThrow(p, ExcMessage("I need a Map pattern to convert a string to " "a Map compatible type.")); @@ -1879,7 +1879,7 @@ namespace Patterns { AssertThrow(pattern.match(s), ExcNoMatch(s, pattern.description())); - auto p = dynamic_cast(&pattern); + const auto *p = dynamic_cast(&pattern); AssertThrow(p, ExcMessage("I need a Map pattern to convert a " "string to a Map compatible type.")); @@ -1927,7 +1927,7 @@ namespace Patterns const T & t, const Patterns::PatternBase &pattern = *Convert::to_pattern()) { - auto p = dynamic_cast(&pattern); + const auto *p = dynamic_cast(&pattern); AssertThrow(p, ExcMessage("I need a List pattern to convert a " "string to a std::array.")); @@ -1955,7 +1955,7 @@ namespace Patterns { AssertThrow(pattern.match(s), ExcNoMatch(s, pattern.description())); - auto p = dynamic_cast(&pattern); + const auto *p = dynamic_cast(&pattern); AssertThrow(p, ExcMessage("I need a List pattern to convert a string " "to a std::array.")); @@ -1994,7 +1994,7 @@ namespace Patterns const T & t, const Patterns::PatternBase &pattern = *Convert::to_pattern()) { - auto p = dynamic_cast(&pattern); + const auto *p = dynamic_cast(&pattern); AssertThrow(p, ExcMessage("I need a List pattern to convert a string " "to a List compatible type.")); @@ -2020,7 +2020,7 @@ namespace Patterns { AssertThrow(pattern.match(s), ExcNoMatch(s, pattern.description())); - auto p = dynamic_cast(&pattern); + const auto *p = dynamic_cast(&pattern); AssertThrow(p, ExcMessage("I need a List pattern to convert a string " "to a List compatible type.")); @@ -2091,7 +2091,7 @@ namespace Patterns const T & t, const Patterns::PatternBase &pattern = *Convert::to_pattern()) { - auto p = dynamic_cast(&pattern); + const auto *p = dynamic_cast(&pattern); AssertThrow(p, ExcMessage("I need a List pattern to convert a string " "to a List compatible type.")); @@ -2114,7 +2114,7 @@ namespace Patterns { AssertThrow(pattern.match(s), ExcNoMatch(s, pattern.description())); - auto p = dynamic_cast(&pattern); + const auto *p = dynamic_cast(&pattern); AssertThrow(p, ExcMessage("I need a List pattern to convert a string " "to a List compatible type.")); @@ -2188,7 +2188,7 @@ namespace Patterns const T & t, const Patterns::PatternBase &pattern = *Convert::to_pattern()) { - auto p = dynamic_cast(&pattern); + const auto *p = dynamic_cast(&pattern); AssertThrow(p, ExcMessage("I need a List pattern to convert a string " "to a List compatible type.")); @@ -2212,7 +2212,7 @@ namespace Patterns { AssertThrow(pattern.match(s), ExcNoMatch(s, pattern.description())); - auto p = dynamic_cast(&pattern); + const auto *p = dynamic_cast(&pattern); AssertThrow(p, ExcMessage("I need a List pattern to convert a string " "to a List compatible type.")); @@ -2316,7 +2316,7 @@ namespace Patterns const T & t, const Patterns::PatternBase &pattern = *Convert::to_pattern()) { - auto p = dynamic_cast(&pattern); + const auto *p = dynamic_cast(&pattern); AssertThrow(p, ExcMessage("I need a Tuple pattern to convert a tuple " "to a string.")); @@ -2336,7 +2336,7 @@ namespace Patterns { AssertThrow(pattern.match(s), ExcNoMatch(s, pattern.description())); - auto p = dynamic_cast(&pattern); + const auto *p = dynamic_cast(&pattern); AssertThrow(p, ExcMessage("I need a Tuple pattern to convert a string " "to a tuple type.")); diff --git a/include/deal.II/base/tensor.h b/include/deal.II/base/tensor.h index bd0f6d3317..df6bfc8762 100644 --- a/include/deal.II/base/tensor.h +++ b/include/deal.II/base/tensor.h @@ -1793,7 +1793,7 @@ Iterator Tensor::unroll_recursion(const Iterator current, const Iterator end) const { - auto next = current; + Iterator next = current; for (unsigned int i = 0; i < dim; ++i) next = values[i].unroll_recursion(next, end); return next; diff --git a/include/deal.II/base/utilities.h b/include/deal.II/base/utilities.h index 28c6ebf927..1b12d95c2e 100644 --- a/include/deal.II/base/utilities.h +++ b/include/deal.II/base/utilities.h @@ -1286,9 +1286,9 @@ namespace Utilities object.clear(); if (vector_size > 0) { - const auto buffer_data_begin = + const auto *const buffer_data_begin = reinterpret_cast(&*cbegin + sizeof(vector_size)); - const auto buffer_data_end = buffer_data_begin + vector_size; + const auto *const buffer_data_end = buffer_data_begin + vector_size; object.insert(object.end(), buffer_data_begin, buffer_data_end); } } diff --git a/include/deal.II/lac/affine_constraints.templates.h b/include/deal.II/lac/affine_constraints.templates.h index ffb891f61b..8d7a3d79ac 100644 --- a/include/deal.II/lac/affine_constraints.templates.h +++ b/include/deal.II/lac/affine_constraints.templates.h @@ -2289,7 +2289,7 @@ namespace internal using ExecutionSpace = MemorySpace::Default::kokkos_space::execution_space; ExecutionSpace exec; - auto local_values = vec.get_values(); + auto * local_values = vec.get_values(); Kokkos::parallel_for( "dealii::set_zero_parallel", Kokkos::RangePolicy(exec, 0, n_constraints), diff --git a/include/deal.II/lac/diagonal_matrix.h b/include/deal.II/lac/diagonal_matrix.h index 4c8a0c75ac..0478e0a98f 100644 --- a/include/deal.II/lac/diagonal_matrix.h +++ b/include/deal.II/lac/diagonal_matrix.h @@ -422,9 +422,9 @@ namespace internal const LinearAlgebra::distributed::Vector &diagonal) { - const auto dst_ptr = dst.begin(); - const auto src_ptr = src.begin(); - const auto diagonal_ptr = diagonal.begin(); + auto *const dst_ptr = dst.begin(); + const auto *const src_ptr = src.begin(); + const auto *const diagonal_ptr = diagonal.begin(); DEAL_II_OPENMP_SIMD_PRAGMA for (unsigned int i = 0; i < src.locally_owned_size(); ++i) diff --git a/include/deal.II/lac/trilinos_tpetra_vector.h b/include/deal.II/lac/trilinos_tpetra_vector.h index f80784cbd2..44a9921e37 100644 --- a/include/deal.II/lac/trilinos_tpetra_vector.h +++ b/include/deal.II/lac/trilinos_tpetra_vector.h @@ -192,8 +192,8 @@ namespace LinearAlgebra import_elements( const ReadWriteVector &V, VectorOperation::values operation, - std::shared_ptr - communication_pattern = {}); + const std::shared_ptr + &communication_pattern = {}); /** * @deprecated Use import_elements() instead. diff --git a/include/deal.II/lac/trilinos_tpetra_vector.templates.h b/include/deal.II/lac/trilinos_tpetra_vector.templates.h index 67076259ff..78ce85ce04 100644 --- a/include/deal.II/lac/trilinos_tpetra_vector.templates.h +++ b/include/deal.II/lac/trilinos_tpetra_vector.templates.h @@ -201,8 +201,8 @@ namespace LinearAlgebra Vector::import_elements( const ReadWriteVector &V, 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 // one given. @@ -563,8 +563,9 @@ namespace LinearAlgebra MPI_Comm Vector::get_mpi_communicator() const { - const auto tpetra_comm = dynamic_cast *>( - vector->getMap()->getComm().get()); + const auto *const tpetra_comm = + dynamic_cast *>( + vector->getMap()->getComm().get()); Assert(tpetra_comm != nullptr, ExcInternalError()); return *(tpetra_comm->getRawMpiComm())(); } diff --git a/include/deal.II/lac/vector_element_access.h b/include/deal.II/lac/vector_element_access.h index 274b609968..fbc849e1b9 100644 --- a/include/deal.II/lac/vector_element_access.h +++ b/include/deal.II/lac/vector_element_access.h @@ -228,8 +228,8 @@ namespace internal const types::global_dof_index i) { // Extract local indices in the vector. - Tpetra::Vector vector = - V.trilinos_vector(); + const Tpetra::Vector + & vector = V.trilinos_vector(); TrilinosWrappers::types::int_type trilinos_i = vector.getMap()->getLocalElement( static_cast(i)); diff --git a/include/deal.II/matrix_free/evaluation_kernels.h b/include/deal.II/matrix_free/evaluation_kernels.h index 49f5607cd2..9ed4bc5f67 100644 --- a/include/deal.II/matrix_free/evaluation_kernels.h +++ b/include/deal.II/matrix_free/evaluation_kernels.h @@ -853,9 +853,9 @@ namespace internal if (evaluation_flag & EvaluationFlags::values) { - const auto shape_values = shape_data.front().shape_values.data(); - auto values_quad_ptr = fe_eval.begin_values(); - auto values_dofs_actual_ptr = values_dofs_actual; + const auto *const shape_values = shape_data.front().shape_values.data(); + auto * values_quad_ptr = fe_eval.begin_values(); + const auto * values_dofs_actual_ptr = values_dofs_actual; Eval eval(shape_values, nullptr, nullptr, n_dofs, n_q_points); for (unsigned int c = 0; c < n_components; ++c) @@ -870,9 +870,10 @@ namespace internal if (evaluation_flag & EvaluationFlags::gradients) { - const auto shape_gradients = shape_data.front().shape_gradients.data(); - auto gradients_quad_ptr = fe_eval.begin_gradients(); - auto values_dofs_actual_ptr = values_dofs_actual; + const auto *const shape_gradients = + shape_data.front().shape_gradients.data(); + auto * gradients_quad_ptr = fe_eval.begin_gradients(); + const auto *values_dofs_actual_ptr = values_dofs_actual; for (unsigned int c = 0; c < n_components; ++c) { @@ -925,9 +926,9 @@ namespace internal if (integration_flag & EvaluationFlags::values) { - const auto shape_values = shape_data.front().shape_values.data(); - auto values_quad_ptr = fe_eval.begin_values(); - auto values_dofs_actual_ptr = values_dofs_actual; + const auto *const shape_values = shape_data.front().shape_values.data(); + auto * values_quad_ptr = fe_eval.begin_values(); + auto * values_dofs_actual_ptr = values_dofs_actual; Eval eval(shape_values, nullptr, nullptr, n_dofs, n_q_points); for (unsigned int c = 0; c < n_components; ++c) @@ -946,9 +947,10 @@ namespace internal if (integration_flag & EvaluationFlags::gradients) { - const auto shape_gradients = shape_data.front().shape_gradients.data(); - auto gradients_quad_ptr = fe_eval.begin_gradients(); - auto values_dofs_actual_ptr = values_dofs_actual; + const auto *const shape_gradients = + shape_data.front().shape_gradients.data(); + auto *gradients_quad_ptr = fe_eval.begin_gradients(); + auto *values_dofs_actual_ptr = values_dofs_actual; for (unsigned int c = 0; c < n_components; ++c) { @@ -4100,11 +4102,11 @@ namespace internal if (evaluation_flag & EvaluationFlags::values) { - const auto shape_values = + const auto *const shape_values = &shape_data.shape_values_face(face_no, face_orientation, 0); - auto values_quad_ptr = fe_eval.begin_values(); - auto values_dofs_actual_ptr = values_dofs; + auto *values_quad_ptr = fe_eval.begin_values(); + auto *values_dofs_actual_ptr = values_dofs; Eval eval(shape_values, nullptr, nullptr, n_dofs, n_q_points); for (unsigned int c = 0; c < n_components; ++c) @@ -4119,8 +4121,8 @@ namespace internal if (evaluation_flag & EvaluationFlags::gradients) { - auto gradients_quad_ptr = fe_eval.begin_gradients(); - auto values_dofs_actual_ptr = values_dofs; + auto * gradients_quad_ptr = fe_eval.begin_gradients(); + const auto *values_dofs_actual_ptr = values_dofs; std::array shape_gradients; for (unsigned int d = 0; d < dim; ++d) @@ -4339,11 +4341,11 @@ namespace internal if (integration_flag & EvaluationFlags::values) { - const auto shape_values = + const auto *const shape_values = &shape_data.shape_values_face(face_no, face_orientation, 0); - auto values_quad_ptr = fe_eval.begin_values(); - auto values_dofs_actual_ptr = values_dofs; + auto *values_quad_ptr = fe_eval.begin_values(); + auto *values_dofs_actual_ptr = values_dofs; Eval eval(shape_values, nullptr, nullptr, n_dofs, n_q_points); for (unsigned int c = 0; c < n_components; ++c) @@ -4358,8 +4360,8 @@ namespace internal if (integration_flag & EvaluationFlags::gradients) { - auto gradients_quad_ptr = fe_eval.begin_gradients(); - auto values_dofs_actual_ptr = values_dofs; + auto *gradients_quad_ptr = fe_eval.begin_gradients(); + auto *values_dofs_actual_ptr = values_dofs; std::array shape_gradients; for (unsigned int d = 0; d < dim; ++d) @@ -5833,10 +5835,10 @@ namespace internal const Number *in = in_array + d * n_q_points; Number * out = out_array + d * dofs_per_component; - auto temp_1 = do_inplace ? out : fe_eval.get_scratch_data().begin(); - auto temp_2 = do_inplace ? - out : - (temp_1 + std::max(n_q_points, dofs_per_component)); + auto *temp_1 = do_inplace ? out : fe_eval.get_scratch_data().begin(); + auto *temp_2 = do_inplace ? + out : + (temp_1 + std::max(n_q_points, dofs_per_component)); if (dim == 3) { diff --git a/include/deal.II/multigrid/mg_transfer.templates.h b/include/deal.II/multigrid/mg_transfer.templates.h index 7df4cef54f..d40f45cae6 100644 --- a/include/deal.II/multigrid/mg_transfer.templates.h +++ b/include/deal.II/multigrid/mg_transfer.templates.h @@ -574,9 +574,9 @@ MGLevelGlobalTransfer>::copy_from_mg( if (ghosted_level_vector[level].size() > 0) ghosted_vector = src[level]; - const auto ghosted_vector_ptr = (ghosted_level_vector[level].size() > 0) ? - &ghosted_vector : - &src[level]; + const auto *const ghosted_vector_ptr = + (ghosted_level_vector[level].size() > 0) ? &ghosted_vector : + &src[level]; ghosted_vector_ptr->update_ghost_values(); diff --git a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h index e0589e3989..10d136d34b 100644 --- a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h +++ b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h @@ -2597,13 +2597,13 @@ MGTwoLevelTransferBase>:: LinearAlgebra::distributed::Vector & dst, const LinearAlgebra::distributed::Vector &src) const { - const bool use_dst_inplace = this->vec_fine.size() == 0; - const auto vec_fine_ptr = use_dst_inplace ? &dst : &this->vec_fine; + const bool use_dst_inplace = this->vec_fine.size() == 0; + auto *const vec_fine_ptr = use_dst_inplace ? &dst : &this->vec_fine; Assert(vec_fine_ptr->get_partitioner().get() == this->partitioner_fine.get(), ExcInternalError()); - const bool use_src_inplace = this->vec_coarse.size() == 0; - const auto vec_coarse_ptr = use_src_inplace ? &src : &this->vec_coarse; + const bool use_src_inplace = this->vec_coarse.size() == 0; + const auto *const vec_coarse_ptr = use_src_inplace ? &src : &this->vec_coarse; Assert(vec_coarse_ptr->get_partitioner().get() == this->partitioner_coarse.get(), ExcInternalError()); @@ -2764,13 +2764,13 @@ MGTwoLevelTransferBase>:: restrict_and_add(LinearAlgebra::distributed::Vector & dst, const LinearAlgebra::distributed::Vector &src) const { - const bool use_src_inplace = this->vec_fine.size() == 0; - const auto vec_fine_ptr = use_src_inplace ? &src : &this->vec_fine; + const bool use_src_inplace = this->vec_fine.size() == 0; + const auto *const vec_fine_ptr = use_src_inplace ? &src : &this->vec_fine; Assert(vec_fine_ptr->get_partitioner().get() == this->partitioner_fine.get(), ExcInternalError()); - const bool use_dst_inplace = this->vec_coarse.size() == 0; - const auto vec_coarse_ptr = use_dst_inplace ? &dst : &this->vec_coarse; + const bool use_dst_inplace = this->vec_coarse.size() == 0; + auto *const vec_coarse_ptr = use_dst_inplace ? &dst : &this->vec_coarse; Assert(vec_coarse_ptr->get_partitioner().get() == this->partitioner_coarse.get(), ExcInternalError()); @@ -2943,13 +2943,13 @@ MGTwoLevelTransfer>:: { const unsigned int n_lanes = VectorizedArrayType::size(); - const bool use_src_inplace = this->vec_fine.size() == 0; - const auto vec_fine_ptr = use_src_inplace ? &src : &this->vec_fine; + const bool use_src_inplace = this->vec_fine.size() == 0; + const auto *const vec_fine_ptr = use_src_inplace ? &src : &this->vec_fine; Assert(vec_fine_ptr->get_partitioner().get() == this->partitioner_fine.get(), ExcInternalError()); - const bool use_dst_inplace = this->vec_coarse.size() == 0; - const auto vec_coarse_ptr = use_dst_inplace ? &dst : &this->vec_coarse; + const bool use_dst_inplace = this->vec_coarse.size() == 0; + auto *const vec_coarse_ptr = use_dst_inplace ? &dst : &this->vec_coarse; Assert(vec_coarse_ptr->get_partitioner().get() == this->partitioner_coarse.get(), ExcInternalError()); @@ -3633,10 +3633,10 @@ namespace internal if (dof_processed[local_dof_idx] == false) { if (!constraint.is_constrained(global_dof_idx)) - support_point_dofs.emplace_back(std::make_pair( + support_point_dofs.emplace_back( partitioner_support_points.global_to_local( support_point_indices[i]), - global_dof_idx)); + global_dof_idx); dof_processed[local_dof_idx] = true; } diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index 912e1cf2fc..0fff50e0ec 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -178,7 +178,7 @@ namespace static_cast( compressed_data_length)}; /* list of compressed sizes of blocks */ - const auto header_start = + const auto *const header_start = reinterpret_cast(&compression_header[0]); return (Utilities::encode_base64( diff --git a/source/base/mpi.cc b/source/base/mpi.cc index 909590a782..61e6801461 100644 --- a/source/base/mpi.cc +++ b/source/base/mpi.cc @@ -795,7 +795,7 @@ namespace Utilities // likely did not intend. As a consequence, filter out this specific // flag. std::vector argv_new; - for (const auto arg : make_array_view(&argv[0], &argv[0] + argc)) + for (auto *const arg : make_array_view(&argv[0], &argv[0] + argc)) if (strcmp(arg, "--help") != 0) argv_new.push_back(arg); @@ -976,7 +976,7 @@ namespace Utilities #ifdef DEAL_II_WITH_MPI // Before exiting, wait for nonblocking communication to complete: - for (auto request : requests) + for (auto *request : requests) { const int ierr = MPI_Wait(request, MPI_STATUS_IGNORE); AssertThrowMPI(ierr); diff --git a/source/base/parameter_acceptor.cc b/source/base/parameter_acceptor.cc index 0d898efd6c..c56f409248 100644 --- a/source/base/parameter_acceptor.cc +++ b/source/base/parameter_acceptor.cc @@ -199,7 +199,7 @@ ParameterAcceptor::get_section_path() const acceptor_it != class_list.rend(); ++acceptor_it) { - const auto acceptor = *acceptor_it; + auto *const acceptor = *acceptor_it; if (acceptor->get_acceptor_id() >= get_acceptor_id()) continue; bool has_trailing = acceptor->get_section_name().back() == sep; diff --git a/source/base/subscriptor.cc b/source/base/subscriptor.cc index 352124ca2a..a60bd7ed7f 100644 --- a/source/base/subscriptor.cc +++ b/source/base/subscriptor.cc @@ -34,7 +34,7 @@ Subscriptor::Subscriptor(Subscriptor &&subscriptor) noexcept : counter(0) , object_info(subscriptor.object_info) { - for (const auto validity_ptr : subscriptor.validity_pointers) + for (auto *const validity_ptr : subscriptor.validity_pointers) *validity_ptr = false; subscriptor.validity_pointers.clear(); } @@ -43,7 +43,7 @@ Subscriptor::Subscriptor(Subscriptor &&subscriptor) noexcept Subscriptor::~Subscriptor() { - for (const auto validity_ptr : validity_pointers) + for (auto *const validity_ptr : validity_pointers) *validity_ptr = false; object_info = nullptr; } @@ -123,7 +123,7 @@ Subscriptor::check_no_subscribers() const noexcept Subscriptor & Subscriptor::operator=(Subscriptor &&s) noexcept { - for (const auto validity_ptr : s.validity_pointers) + for (auto *const validity_ptr : s.validity_pointers) *validity_ptr = false; s.validity_pointers.clear(); object_info = s.object_info; diff --git a/source/distributed/solution_transfer.cc b/source/distributed/solution_transfer.cc index 6018dcd97d..f389a711dc 100644 --- a/source/distributed/solution_transfer.cc +++ b/source/distributed/solution_transfer.cc @@ -247,7 +247,7 @@ namespace parallel Assert(tria != nullptr, ExcInternalError()); if (average_values) - for (const auto vec : all_out) + for (auto *const vec : all_out) *vec = 0.0; VectorType valence; @@ -277,7 +277,7 @@ namespace parallel (Number(1.0) / static_cast(valence[i]))); valence.compress(VectorOperation::insert); - for (const auto vec : all_out) + for (auto *const vec : all_out) { // compress and weight with valence vec->compress(VectorOperation::add); @@ -286,7 +286,7 @@ namespace parallel } else { - for (const auto vec : all_out) + for (auto *const vec : all_out) vec->compress(VectorOperation::insert); } diff --git a/source/fe/fe_system.cc b/source/fe/fe_system.cc index d7a6627c37..dfd97f7ddb 100644 --- a/source/fe/fe_system.cc +++ b/source/fe/fe_system.cc @@ -2698,9 +2698,9 @@ FESystem::convert_generalized_support_point_values_to_dof_values( // we have to extract the correct slice out of the global // vector of values: - const auto begin = + const auto *const begin = std::begin(point_values[n]) + current_vector_component; - const auto end = begin + n_base_components; + const auto *const end = begin + n_base_components; std::copy(begin, end, std::begin(base_point_values[j])); } diff --git a/source/grid/grid_generator.cc b/source/grid/grid_generator.cc index 7450ec245b..ea614d9305 100644 --- a/source/grid/grid_generator.cc +++ b/source/grid/grid_generator.cc @@ -977,7 +977,7 @@ namespace GridGenerator std::sin(gamma) * edge_length); // loop over vertices of all cells - for (auto &cell : tria.cell_iterators()) + for (const auto &cell : tria.cell_iterators()) for (const unsigned int v : GeometryInfo<2>::vertex_indices()) { // vertex has been already processed: nothing to do @@ -1168,11 +1168,11 @@ namespace GridGenerator MeshGenerator mesh_generator(additional_data); // Cast the triangulation to the right type so that the right // specialization of the function create_triangulation is picked up. - if (auto parallel_tria = + if (auto *parallel_tria = dynamic_cast *>( &tria)) mesh_generator.create_triangulation(*parallel_tria, periodic_faces); - else if (auto parallel_tria = dynamic_cast< + else if (auto *parallel_tria = dynamic_cast< dealii::parallel::fullydistributed::Triangulation<2, 2> *>( &tria)) mesh_generator.create_triangulation(*parallel_tria, periodic_faces); @@ -2092,7 +2092,7 @@ namespace GridGenerator tria.reset_all_manifolds(); tria.set_all_manifold_ids(0); - for (auto &cell : tria.cell_iterators()) + for (const auto &cell : tria.cell_iterators()) { // identify faces on torus surface and set manifold to 1 for (const unsigned int f : GeometryInfo<3>::face_indices()) diff --git a/source/lac/petsc_precondition.cc b/source/lac/petsc_precondition.cc index 8cd9966e05..2e51d0cdfe 100644 --- a/source/lac/petsc_precondition.cc +++ b/source/lac/petsc_precondition.cc @@ -1125,7 +1125,7 @@ namespace PETScWrappers PetscFunctionBeginUser; PetscCall(PCShellGetContext(ppc, &ctx)); - auto user = static_cast(ctx); + auto *user = static_cast(ctx); if (!user->vmult) SETERRQ( PetscObjectComm((PetscObject)ppc), @@ -1166,7 +1166,7 @@ namespace PETScWrappers PetscFunctionBeginUser; PetscCall(PCShellGetContext(ppc, &ctx)); - auto user = static_cast(ctx); + auto *user = static_cast(ctx); if (!user->vmultT) SETERRQ( PetscObjectComm((PetscObject)ppc), diff --git a/source/particles/property_pool.cc b/source/particles/property_pool.cc index 2aa595f232..5abbd31307 100644 --- a/source/particles/property_pool.cc +++ b/source/particles/property_pool.cc @@ -205,7 +205,7 @@ namespace Particles sorted_ids.reserve(ids.size()); sorted_properties.reserve(properties.size()); - for (auto &handle : handles_to_sort) + for (const auto &handle : handles_to_sort) { Assert(handle != invalid_handle, ExcMessage( -- 2.39.5