From 185a84a4990c973b7c091402a4da0d36fe83533d Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Mon, 17 Apr 2017 13:19:16 +0200 Subject: [PATCH] clang-tidy emplace_back --- source/base/event.cc | 2 +- source/base/polynomials_piecewise.cc | 12 ++++++------ source/base/table_handler.cc | 2 +- source/fe/fe_q_base.cc | 12 ++++++------ source/grid/grid_generator.cc | 6 +++--- tests/numerics/point_value_history_02.cc | 14 +++++++------- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/source/base/event.cc b/source/base/event.cc index 330e77f410..120074ba56 100644 --- a/source/base/event.cc +++ b/source/base/event.cc @@ -28,7 +28,7 @@ namespace Algorithms Event::assign(const char *name) { unsigned int index = names.size(); - names.push_back(name); + names.emplace_back(name); Event result; // The constructor generated an diff --git a/source/base/polynomials_piecewise.cc b/source/base/polynomials_piecewise.cc index 00155bd50c..bf574b0887 100644 --- a/source/base/polynomials_piecewise.cc +++ b/source/base/polynomials_piecewise.cc @@ -131,14 +131,14 @@ namespace Polynomials std::vector > p; p.reserve (n_subdivisions * base_degree + 1); - p.push_back (PiecewisePolynomial (p_base[0], n_subdivisions, 0, - false)); + p.emplace_back(p_base[0], n_subdivisions, 0, + false); for (unsigned int s=0; s (p_base[i+1], n_subdivisions, - s, - i==(base_degree-1) && - s::iterator col=columns.begin(); col!=columns.end(); ++col) while (col->second.entries.size() < max_col_length) { - col->second.entries.push_back (internal::TableEntry("")); + col->second.entries.emplace_back(""); internal::TableEntry &entry = col->second.entries.back(); entry.cache_string(col->second.scientific, col->second.precision); col->second.max_length = std::max(col->second.max_length, diff --git a/source/fe/fe_q_base.cc b/source/fe/fe_q_base.cc index 5efda3554a..dc05bbe552 100644 --- a/source/fe/fe_q_base.cc +++ b/source/fe/fe_q_base.cc @@ -177,7 +177,7 @@ struct FE_Q_Base::Implementation // 0 and on subface 1 std::vector > constraint_points; // Add midpoint - constraint_points.push_back (Point (0.5)); + constraint_points.emplace_back(0.5); if (q_deg>1) { @@ -256,13 +256,13 @@ struct FE_Q_Base::Implementation std::vector > constraint_points; // Add midpoint - constraint_points.push_back (Point (0.5, 0.5)); + constraint_points.emplace_back(0.5, 0.5); // Add midpoints of lines of "mother-face" - constraint_points.push_back (Point (0, 0.5)); - constraint_points.push_back (Point (1, 0.5)); - constraint_points.push_back (Point (0.5, 0)); - constraint_points.push_back (Point (0.5, 1)); + constraint_points.emplace_back(0, 0.5); + constraint_points.emplace_back(1, 0.5); + constraint_points.emplace_back(0.5, 0); + constraint_points.emplace_back(0.5, 1); if (q_deg>1) { diff --git a/source/grid/grid_generator.cc b/source/grid/grid_generator.cc index 7989aa5e97..b18a7874c5 100644 --- a/source/grid/grid_generator.cc +++ b/source/grid/grid_generator.cc @@ -1524,7 +1524,7 @@ namespace GridGenerator double ax = p[0]; for (unsigned int x=0; x<=n_cells; ++x) { - points.push_back (Point<1> (ax)); + points.emplace_back(ax); if (x (ax,ay)); + points.emplace_back(ax,ay); if (x (ax,ay,az)); + points.emplace_back(ax,ay,az); if (x::run() { node_monitor.add_field_name("Solution"); std::vector solution_names; - solution_names.push_back("X velocity"); - solution_names.push_back("Y velocity"); - solution_names.push_back("Z velocity"); + solution_names.emplace_back("X velocity"); + solution_names.emplace_back("Y velocity"); + solution_names.emplace_back("Z velocity"); node_monitor.add_component_names ("Solution", solution_names); node_monitor.add_field_name("Post Processed Vector"); // not sensitive to spaces std::vector component_mask (3, false); @@ -294,7 +294,7 @@ void TestPointValueHistory::run() node_monitor.add_field_name("Scalar_out", component_mask); std::vector indep_names; - indep_names.push_back ("Input"); + indep_names.emplace_back("Input"); node_monitor.add_independent_names(indep_names); // two alternatives here, adding a point at a time or a vector of points @@ -342,8 +342,8 @@ void TestPointValueHistory::run() Postprocess postprocessor; QGauss postprocess_quadrature (2); std::vector names; - names.push_back ("Vector_out"); - names.push_back ("Scalar_out"); + names.emplace_back("Vector_out"); + names.emplace_back("Scalar_out"); node_monitor.evaluate_field(names, solution, postprocessor, postprocess_quadrature); // output_results (step, solution); step++; @@ -401,7 +401,7 @@ template void TestPointValueHistory::output_results (unsigned int step, Vector solution) const { std::vector solution_names (dim, "velocity"); - solution_names.push_back ("pressure"); + solution_names.emplace_back("pressure"); std::vector data_component_interpretation -- 2.39.5