From 284c85cae0199dd6175726f3bee1657773364495 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Wed, 21 Feb 2018 00:58:02 +0100 Subject: [PATCH] clang-tidy performance findings --- examples/step-49/step-49.cc | 2 +- include/deal.II/base/work_stream.h | 4 ++-- include/deal.II/fe/fe_tools.templates.h | 1 + include/deal.II/lac/full_matrix.templates.h | 4 ++-- include/deal.II/numerics/vector_tools.templates.h | 2 +- source/fe/fe_dgq.cc | 3 +-- source/fe/fe_q_base.cc | 8 ++++---- source/grid/tria.cc | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/step-49/step-49.cc b/examples/step-49/step-49.cc index dd977db64f..35f41ab85d 100644 --- a/examples/step-49/step-49.cc +++ b/examples/step-49/step-49.cc @@ -82,7 +82,7 @@ void print_mesh_info(const Triangulation &triangulation, } std::cout << " boundary indicators: "; - for (const std::pair &pair : boundary_count) + for (const std::pair &pair : boundary_count) { std::cout << pair.first << "(" << pair.second << " times) "; } diff --git a/include/deal.II/base/work_stream.h b/include/deal.II/base/work_stream.h index 7b84630764..994dc1eb33 100644 --- a/include/deal.II/base/work_stream.h +++ b/include/deal.II/base/work_stream.h @@ -1021,7 +1021,7 @@ namespace WorkStream { // need to copy the sample since it is marked const ScratchData scratch_data = sample_scratch_data; - CopyData copy_data = sample_copy_data; + CopyData copy_data = sample_copy_data; // NOLINT for (Iterator i=begin; i!=end; ++i) { @@ -1127,7 +1127,7 @@ namespace WorkStream { // need to copy the sample since it is marked const ScratchData scratch_data = sample_scratch_data; - CopyData copy_data = sample_copy_data; + CopyData copy_data = sample_copy_data; // NOLINT for (unsigned int color=0; color::const_iterator p = colored_iterators[color].begin(); diff --git a/include/deal.II/fe/fe_tools.templates.h b/include/deal.II/fe/fe_tools.templates.h index 9286a882b2..0a5a3c8787 100644 --- a/include/deal.II/fe/fe_tools.templates.h +++ b/include/deal.II/fe/fe_tools.templates.h @@ -2403,6 +2403,7 @@ namespace FETools // this is a workaround since the constructor for FESystem // only accepts raw pointers. std::vector *> raw_base_fes; + raw_base_fes.reserve(base_fes.size()); for (const auto &base_fe: base_fes) raw_base_fes.push_back(base_fe.get()); diff --git a/include/deal.II/lac/full_matrix.templates.h b/include/deal.II/lac/full_matrix.templates.h index bedb3aa375..b511693b1f 100644 --- a/include/deal.II/lac/full_matrix.templates.h +++ b/include/deal.II/lac/full_matrix.templates.h @@ -1319,7 +1319,7 @@ FullMatrix::invert (const FullMatrix &M) { // avoid overwriting source // by destination matrix: - const FullMatrix M2 = M; + const FullMatrix M2 = M; // NOLINT invert(M2); } else @@ -1490,7 +1490,7 @@ FullMatrix::cholesky (const FullMatrix &A) { // avoid overwriting source // by destination matrix: - const FullMatrix A2 = A; + const FullMatrix A2 = A; // NOLINT cholesky(A2); } else diff --git a/include/deal.II/numerics/vector_tools.templates.h b/include/deal.II/numerics/vector_tools.templates.h index 6d38fa3dcb..18c5b755fb 100644 --- a/include/deal.II/numerics/vector_tools.templates.h +++ b/include/deal.II/numerics/vector_tools.templates.h @@ -2530,7 +2530,7 @@ namespace VectorTools // now that we have a q_collection object with all the right quadrature // points, create an hp::FEFaceValues object that we can use to evaluate // the boundary values at - const dealii::hp::MappingCollection mapping_collection (mapping); + const dealii::hp::MappingCollection mapping_collection (mapping); // NOLINT dealii::hp::FEFaceValues x_fe_values (mapping_collection, finite_elements, q_collection, diff --git a/source/fe/fe_dgq.cc b/source/fe/fe_dgq.cc index 341f3f741c..9abded35b8 100644 --- a/source/fe/fe_dgq.cc +++ b/source/fe/fe_dgq.cc @@ -698,8 +698,7 @@ FE_DGQArbitraryNodes::FE_DGQArbitraryNodes (const Quadrature<1> &p { Assert (points.size() > 0, (typename FiniteElement::ExcFEHasNoSupportPoints ())); - const Quadrature support_quadrature(points); - this->unit_support_points = support_quadrature.get_points(); + this->unit_support_points = Quadrature(points).get_points(); } diff --git a/source/fe/fe_q_base.cc b/source/fe/fe_q_base.cc index 4040f6b8d0..5e435325e3 100644 --- a/source/fe/fe_q_base.cc +++ b/source/fe/fe_q_base.cc @@ -909,10 +909,10 @@ void FE_Q_Base::initialize_unit_support_points this->poly_space.get_numbering_inverse(); Quadrature<1> support_1d(points); - const Quadrature support_quadrature(support_1d); + const Quadrature support_quadrature(support_1d); // NOLINT this->unit_support_points.resize(support_quadrature.size()); - for (unsigned int k=0; kunit_support_points[index_map_inverse[k]] = support_quadrature.point(k); } @@ -933,10 +933,10 @@ void FE_Q_Base::initialize_unit_face_support_points std::vector face_index_map = internal::FE_Q_Base::face_lexicographic_to_hierarchic_numbering(q_degree); Quadrature<1> support_1d(points); - const Quadrature support_quadrature(support_1d); + const Quadrature support_quadrature(support_1d); // NOLINT this->unit_face_support_points.resize(support_quadrature.size()); - for (unsigned int k=0; kunit_face_support_points[face_index_map[k]] = support_quadrature.point(k); } diff --git a/source/grid/tria.cc b/source/grid/tria.cc index a4ea89f37a..fc7b9aa812 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -9204,8 +9204,8 @@ create_triangulation_compatibility (const std::vector > &v, const std::vector > &cells, const SubCellData &subcelldata) { - std::vector > reordered_cells (cells); - SubCellData reordered_subcelldata (subcelldata); + std::vector > reordered_cells (cells); // NOLINT + SubCellData reordered_subcelldata (subcelldata); // NOLINT // in-place reordering of data reorder_compatibility (reordered_cells, reordered_subcelldata); -- 2.39.5