From: Wolfgang Bangerth Date: Mon, 18 May 2020 23:42:13 +0000 (-0600) Subject: Simplify more pieces of code. X-Git-Tag: v9.3.0-rc1~1613^2~7 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a17d2e8690288433cf51b39f07f441ad55f9037f;p=dealii.git Simplify more pieces of code. --- 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])); } }