From 4e472cae5112c6ae1fae40b7dcbd4472565f0390 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Tue, 30 May 2023 13:22:40 -0400 Subject: [PATCH] Fix a couple clang-tidy warnings --- include/deal.II/matrix_free/hanging_nodes_internal.h | 5 ++--- include/deal.II/optimization/line_minimization.h | 12 ++++++------ include/deal.II/physics/notation.h | 2 +- source/base/logstream.cc | 2 +- source/base/qprojector.cc | 8 ++++---- source/hp/fe_collection.cc | 4 ++-- source/non_matching/fe_values.cc | 8 ++++---- source/non_matching/quadrature_generator.cc | 4 ++-- 8 files changed, 22 insertions(+), 23 deletions(-) diff --git a/include/deal.II/matrix_free/hanging_nodes_internal.h b/include/deal.II/matrix_free/hanging_nodes_internal.h index a53ac8cea1..91853a0ca1 100644 --- a/include/deal.II/matrix_free/hanging_nodes_internal.h +++ b/include/deal.II/matrix_free/hanging_nodes_internal.h @@ -436,10 +436,9 @@ namespace internal { const unsigned int line_idx = cell->line(line)->index(); if (cell->is_active()) - line_to_cells[line_idx].push_back(std::make_pair(cell, line)); + line_to_cells[line_idx].emplace_back(cell, line); else - line_to_inactive_cells[line_idx].push_back( - std::make_pair(cell, line)); + line_to_inactive_cells[line_idx].emplace_back(cell, line); } } diff --git a/include/deal.II/optimization/line_minimization.h b/include/deal.II/optimization/line_minimization.h index be571a27ab..0d6e0f1944 100644 --- a/include/deal.II/optimization/line_minimization.h +++ b/include/deal.II/optimization/line_minimization.h @@ -480,12 +480,12 @@ namespace LineMinimization template NumberType - poly_fit_three_points(const NumberType x1, - const NumberType f1, - const NumberType g1, - const NumberType x2, - const NumberType f2, - const NumberType g2, + poly_fit_three_points(const NumberType x1, + const NumberType f1, + const NumberType g1, + const NumberType x2, + const NumberType f2, + const NumberType /*g2*/, const FiniteSizeHistory &x_rec, const FiniteSizeHistory &f_rec, const FiniteSizeHistory & /*g_rec*/, diff --git a/include/deal.II/physics/notation.h b/include/deal.II/physics/notation.h index 28d09f74b3..13f3cc9612 100644 --- a/include/deal.II/physics/notation.h +++ b/include/deal.II/physics/notation.h @@ -677,7 +677,7 @@ namespace Physics template std::pair - indices_from_component(const unsigned int component_n, const bool) + indices_from_component(const unsigned int /*component_n*/, const bool) { AssertThrow(false, ExcNotImplemented()); return std::make_pair(0u, 0u); diff --git a/source/base/logstream.cc b/source/base/logstream.cc index 3d612366be..99ce2c7a81 100644 --- a/source/base/logstream.cc +++ b/source/base/logstream.cc @@ -81,7 +81,7 @@ LogStream::LogStream() , print_thread_id(false) , at_newline(true) { - get_prefixes().push("DEAL:"); + get_prefixes().emplace("DEAL:"); } diff --git a/source/base/qprojector.cc b/source/base/qprojector.cc index e96aed68ec..115534e5f7 100644 --- a/source/base/qprojector.cc +++ b/source/base/qprojector.cc @@ -845,8 +845,8 @@ QProjector<2>::project_to_all_faces(const ReferenceCell & reference_cell, else { AssertDimension(quadrature.size(), GeometryInfo::faces_per_cell); - for (unsigned int i = 0; i < quadrature.size(); ++i) - n_points_total += quadrature[i].size(); + for (const auto &q : quadrature) + n_points_total += q.size(); } // first fix quadrature points @@ -1011,8 +1011,8 @@ QProjector<3>::project_to_all_faces(const ReferenceCell & reference_cell, else { AssertDimension(quadrature.size(), GeometryInfo::faces_per_cell); - for (unsigned int i = 0; i < quadrature.size(); ++i) - n_points_total += quadrature[i].size(); + for (const auto &q : quadrature) + n_points_total += q.size(); } n_points_total *= 8; diff --git a/source/hp/fe_collection.cc b/source/hp/fe_collection.cc index 5a45fdd234..3bdc25982f 100644 --- a/source/hp/fe_collection.cc +++ b/source/hp/fe_collection.cc @@ -388,8 +388,8 @@ namespace hp if (fe_index_1 != fe_index_2) for (const auto &identity : query_identities(fe_index_1, fe_index_2)) - identities_graph.emplace(Edge(Node(fe_index_1, identity.first), - Node(fe_index_2, identity.second))); + identities_graph.emplace(Node(fe_index_1, identity.first), + Node(fe_index_2, identity.second)); #ifdef DEBUG // Now verify that indeed the graph is symmetric: If one element diff --git a/source/non_matching/fe_values.cc b/source/non_matching/fe_values.cc index 5c8afb299b..d89d075fb8 100644 --- a/source/non_matching/fe_values.cc +++ b/source/non_matching/fe_values.cc @@ -66,8 +66,8 @@ namespace NonMatching // Tensor products of each quadrature in q_collection_1d. Used on the // non-intersected cells. hp::QCollection q_collection; - for (unsigned int i = 0; i < q_collection_1D.size(); ++i) - q_collection.push_back(Quadrature(q_collection_1D[i])); + for (const auto &quadrature : q_collection_1D) + q_collection.push_back(Quadrature(quadrature)); initialize(q_collection); } @@ -292,8 +292,8 @@ namespace NonMatching // Tensor products of each quadrature in q_collection_1d. Used on the // non-intersected cells. hp::QCollection q_collection; - for (unsigned int i = 0; i < q_collection_1D.size(); ++i) - q_collection.push_back(Quadrature(q_collection_1D[i])); + for (const auto &quadrature : q_collection_1D) + q_collection.push_back(quadrature); initialize(q_collection); } diff --git a/source/non_matching/quadrature_generator.cc b/source/non_matching/quadrature_generator.cc index 195cdeb818..463b7caa53 100644 --- a/source/non_matching/quadrature_generator.cc +++ b/source/non_matching/quadrature_generator.cc @@ -861,8 +861,8 @@ namespace NonMatching , low_dim_algorithm(q_collection1D, additional_data) , up_through_dimension_creator(q_collection1D, additional_data) { - for (unsigned int i = 0; i < q_collection1D.size(); ++i) - tensor_products.push_back(Quadrature(q_collection1D[i])); + for (const auto &quadrature : q_collection1D) + tensor_products.push_back(quadrature); } -- 2.39.5