]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify code using structured bindings. 15796/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 24 Jul 2023 20:56:49 +0000 (14:56 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 26 Jul 2023 00:36:18 +0000 (18:36 -0600)
source/grid/grid_generator.cc

index 2ac550a402b396a9cdd1a0afebadbcc58fccf89d..d55e7a5ce56de5928bee83da0d10ab9726511f4b 100644 (file)
@@ -6487,12 +6487,12 @@ namespace GridGenerator
                ExcMessage("The input triangulations must be non-empty "
                           "and must not be refined."));
 
-        std::vector<Point<spacedim>> tria_vertices;
-        std::vector<CellData<dim>>   tria_cells;
-        SubCellData                  tria_subcell_data;
-        std::tie(tria_vertices, tria_cells, tria_subcell_data) =
+        auto [tria_vertices, tria_cells, tria_subcell_data] =
           GridTools::get_coarse_mesh_description(*triangulation);
 
+        // Copy the vertices of the current triangulation into the merged list,
+        // and then let the vertex indices of the cells refer to those in
+        // the merged list:
         vertices.insert(vertices.end(),
                         tria_vertices.begin(),
                         tria_vertices.end());
@@ -6750,11 +6750,9 @@ namespace GridGenerator
     tria_to_replicate.copy_triangulation(input);
     for (unsigned int d = 0; d < dim; ++d)
       {
-        std::vector<Point<spacedim>> input_vertices;
-        std::vector<CellData<dim>>   input_cell_data;
-        SubCellData                  input_subcell_data;
-        std::tie(input_vertices, input_cell_data, input_subcell_data) =
+        auto [input_vertices, input_cell_data, input_subcell_data] =
           GridTools::get_coarse_mesh_description(tria_to_replicate);
+
         std::vector<Point<spacedim>> output_vertices     = input_vertices;
         std::vector<CellData<dim>>   output_cell_data    = input_cell_data;
         SubCellData                  output_subcell_data = input_subcell_data;

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.