From 3360a7bf49db75ced54068f83914322314137ff2 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 18 May 2020 17:42:13 -0600 Subject: [PATCH] Simplify more pieces of code. --- examples/step-70/step-70.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/step-70/step-70.cc b/examples/step-70/step-70.cc index bf3a698e71..d3e35dc9ec 100644 --- a/examples/step-70/step-70.cc +++ b/examples/step-70/step-70.cc @@ -1009,16 +1009,17 @@ namespace Step70 // non-matching grid). std::vector> quadrature_points_vec( quadrature.size() * solid_tria.n_locally_owned_active_cells()); + std::vector> quadrature_points_vec; + quadrature_points_vec.reserve(quadrature.size() * + solid_tria.n_locally_owned_active_cells()); - std::vector> properties( - quadrature.size() * solid_tria.n_locally_owned_active_cells(), - std::vector(n_properties)); + std::vector> properties; + properties.reserve(quadrature.size() * + solid_tria.n_locally_owned_active_cells()); FEValues fe_v(*solid_fe, quadrature, update_JxW_values | update_quadrature_points); - - unsigned int point_index = 0; for (const auto &cell : solid_dh.active_cell_iterators()) if (cell->is_locally_owned()) { @@ -1028,9 +1029,8 @@ namespace Step70 for (unsigned int q = 0; q < points.size(); ++q) { - quadrature_points_vec[point_index] = points[q]; - properties[point_index][0] = JxW[q]; - ++point_index; + quadrature_points_vec.emplace_back(points[q]); + properties.emplace_back (std::vector(n_properties, JxW[q])); } } -- 2.39.5