]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use simpler initialization of std::set
authorMartin Kronbichler <martin.kronbichler@uni-a.de>
Thu, 5 May 2022 19:29:55 +0000 (21:29 +0200)
committerMartin Kronbichler <martin.kronbichler@uni-a.de>
Thu, 5 May 2022 19:29:55 +0000 (21:29 +0200)
19 files changed:
examples/step-31/step-31.cc
examples/step-37/step-37.cc
examples/step-38/doc/results.dox
examples/step-38/step-38.cc
examples/step-56/step-56.cc
tests/matrix_free/copy_feevaluation.cc
tests/matrix_free/matrix_vector_stokes_flux.cc
tests/matrix_free/matrix_vector_stokes_noflux.cc
tests/matrix_free/matrix_vector_stokes_noflux2.cc
tests/matrix_free/matrix_vector_stokes_notempl.cc
tests/matrix_free/matrix_vector_stokes_onedof.cc
tests/matrix_free/parallel_multigrid.cc
tests/matrix_free/parallel_multigrid_fullydistributed.cc
tests/matrix_free/parallel_multigrid_interleave.cc
tests/matrix_free/parallel_multigrid_interleave_renumber.cc
tests/matrix_free/parallel_multigrid_mf.cc
tests/matrix_free/step-37-inhomogeneous-1.cc
tests/matrix_free/stokes_computation.cc
tests/performance/timing_step_37.cc

index 27474bfa4ec439c02f32bd70693d912a9f03336c..2bd9d0a237250e3e6beb13a5b4e49c95541bcc36 100644 (file)
@@ -847,8 +847,7 @@ namespace Step31
       stokes_constraints.clear();
       DoFTools::make_hanging_node_constraints(stokes_dof_handler,
                                               stokes_constraints);
-      std::set<types::boundary_id> no_normal_flux_boundaries;
-      no_normal_flux_boundaries.insert(0);
+      const std::set<types::boundary_id> no_normal_flux_boundaries = {0};
       VectorTools::compute_no_normal_flux_constraints(stokes_dof_handler,
                                                       0,
                                                       no_normal_flux_boundaries,
index ae500f3b7fe3379a1aedf2ca69e63ad74560b02b..1669ff13cac7816f560f55cde031abc134de3508 100644 (file)
@@ -841,8 +841,7 @@ namespace Step37
     const unsigned int nlevels = triangulation.n_global_levels();
     mg_matrices.resize(0, nlevels - 1);
 
-    std::set<types::boundary_id> dirichlet_boundary;
-    dirichlet_boundary.insert(0);
+    const std::set<types::boundary_id> dirichlet_boundary = {0};
     mg_constrained_dofs.initialize(dof_handler);
     mg_constrained_dofs.make_zero_boundary_constraints(dof_handler,
                                                        dirichlet_boundary);
index 169a4ed84969143c675300771a7322aa641f0869..8ba06eb3ab30fa886a7664b5e887d8b3d2728f64 100644 (file)
@@ -117,8 +117,7 @@ void LaplaceBeltrami<spacedim>::make_grid_and_dofs()
 
     volume_mesh.refine_global(4);
 
-    std::set<types::boundary_id> boundary_ids;
-    boundary_ids.insert(0);
+    const std::set<types::boundary_id> boundary_ids = {0};
 
     GridGenerator::extract_boundary_mesh(volume_mesh, triangulation,
                                          boundary_ids);
index d00baa161ce32bba8911cdb575eb8915da27023f..26503a9325052592cea5705c2de8a9b3db9cec23 100644 (file)
@@ -306,8 +306,7 @@ namespace Step38
       Triangulation<spacedim> volume_mesh;
       GridGenerator::half_hyper_ball(volume_mesh);
 
-      std::set<types::boundary_id> boundary_ids;
-      boundary_ids.insert(0);
+      const std::set<types::boundary_id> boundary_ids = {0};
 
       GridGenerator::extract_boundary_mesh(volume_mesh,
                                            triangulation,
index 09509709bd188da4265042a5ddba4de95eb1e22d..625b035d6bc046169af8d3a7ab54e3617472c514 100644 (file)
@@ -525,8 +525,7 @@ namespace Step56
         // sparsity patterns and matrices for each level. The resize()
         // function of MGLevelObject<T> will destroy all existing contained
         // objects.
-        std::set<types::boundary_id> zero_boundary_ids;
-        zero_boundary_ids.insert(0);
+        const std::set<types::boundary_id> zero_boundary_ids = {0};
 
         mg_constrained_dofs.clear();
         mg_constrained_dofs.initialize(velocity_dof_handler);
index f1805a2abc891c6022eff7fbceae3e20313db09b..42bbc64ab36fff0349d56dbd05e6772b596085a7 100644 (file)
@@ -172,8 +172,7 @@ test()
   stokes_sub_blocks[dim] = 1;
   DoFRenumbering::component_wise(dof_handler, stokes_sub_blocks);
 
-  std::set<types::boundary_id> no_normal_flux_boundaries;
-  no_normal_flux_boundaries.insert(1);
+  std::set<types::boundary_id> no_normal_flux_boundaries = {1};
   DoFTools::make_hanging_node_constraints(dof_handler, constraints);
   VectorTools::compute_no_normal_flux_constraints(
     dof_handler, 0, no_normal_flux_boundaries, constraints, mapping);
index f340e1999784bf4e0ecc70e77300cd00065f6e1a..aa4b30922ecafc674abcbd96c5bf4aa114f5e0e2 100644 (file)
@@ -158,9 +158,7 @@ test()
   stokes_sub_blocks[dim] = 1;
   DoFRenumbering::component_wise(dof_handler, stokes_sub_blocks);
 
-  std::set<types::boundary_id> no_normal_flux_boundaries;
-  no_normal_flux_boundaries.insert(0);
-  no_normal_flux_boundaries.insert(1);
+  const std::set<types::boundary_id> no_normal_flux_boundaries = {0, 1};
   DoFTools::make_hanging_node_constraints(dof_handler, constraints);
   VectorTools::compute_normal_flux_constraints(dof_handler,
                                                0,
index 0478bedac3ca357f4572a1bd96d2d9fcf09c73de..b58e0404e09abd44b50c2d6f35e5ac164dae0429 100644 (file)
@@ -166,9 +166,7 @@ test()
   stokes_sub_blocks[dim] = 1;
   DoFRenumbering::component_wise(dof_handler, stokes_sub_blocks);
 
-  std::set<types::boundary_id> no_normal_flux_boundaries;
-  no_normal_flux_boundaries.insert(0);
-  no_normal_flux_boundaries.insert(1);
+  const std::set<types::boundary_id> no_normal_flux_boundaries = {0, 1};
   DoFTools::make_hanging_node_constraints(dof_handler, constraints);
   VectorTools::compute_no_normal_flux_constraints(
     dof_handler, 0, no_normal_flux_boundaries, constraints, mapping);
index c3d2ea5d6930c3f5d70800835806408ee1780503..103b272f6ebe90f93eec742f00cb98817332a7c4 100644 (file)
@@ -160,9 +160,7 @@ test()
   stokes_sub_blocks[dim] = 1;
   DoFRenumbering::component_wise(dof_handler, stokes_sub_blocks);
 
-  std::set<types::boundary_id> no_normal_flux_boundaries;
-  no_normal_flux_boundaries.insert(0);
-  no_normal_flux_boundaries.insert(1);
+  const std::set<types::boundary_id> no_normal_flux_boundaries = {0, 1};
   DoFTools::make_hanging_node_constraints(dof_handler, constraints);
   VectorTools::compute_no_normal_flux_constraints(
     dof_handler, 0, no_normal_flux_boundaries, constraints, mapping);
index 0ff0cbd884d7089875f65b9f29b8df0424abbe3a..2b5e257a59abe8d5e18b6aacd0bd00ac249807f8 100644 (file)
@@ -162,9 +162,7 @@ test(const unsigned int fe_degree)
   stokes_sub_blocks[dim] = 1;
   DoFRenumbering::component_wise(dof_handler, stokes_sub_blocks);
 
-  std::set<types::boundary_id> no_normal_flux_boundaries;
-  no_normal_flux_boundaries.insert(0);
-  no_normal_flux_boundaries.insert(1);
+  const std::set<types::boundary_id> no_normal_flux_boundaries = {0, 1};
   DoFTools::make_hanging_node_constraints(dof_handler, constraints);
   VectorTools::compute_no_normal_flux_constraints(
     dof_handler, 0, no_normal_flux_boundaries, constraints, mapping);
index 1730e732d2bd2ee647f57fbc6e062351e779ae56..27f072b9ef982060da831c8311fcf5110f18ba0f 100644 (file)
@@ -160,9 +160,7 @@ test(const FESystem<dim> &fe)
 
   dof_handler.distribute_dofs(fe);
 
-  std::set<types::boundary_id> no_normal_flux_boundaries;
-  no_normal_flux_boundaries.insert(0);
-  no_normal_flux_boundaries.insert(1);
+  const std::set<types::boundary_id> no_normal_flux_boundaries = {0, 1};
   DoFTools::make_hanging_node_constraints(dof_handler, constraints);
   if (fe.dofs_per_vertex > 0)
     VectorTools::compute_no_normal_flux_constraints(
index f0ab3f8a768f0aef8cb3548e49adf0c770321023..ebf825b9b7f94962e8b2d08c687ab22a8df0f9f9 100644 (file)
@@ -351,8 +351,7 @@ do_test(const DoFHandler<dim> &dof)
 
   MappingQ<dim>                                          mapping(fe_degree + 1);
   LaplaceOperator<dim, fe_degree, n_q_points_1d, number> fine_matrix;
-  std::set<types::boundary_id>                           dirichlet_boundaries;
-  dirichlet_boundaries.insert(0);
+  const std::set<types::boundary_id> dirichlet_boundaries = {0};
   fine_matrix.initialize(mapping, dof, dirichlet_boundaries);
 
   LinearAlgebra::distributed::Vector<number> in, sol;
index 9a48bf2ff2c9d6b27b1089f6841184245e72542e..dfe028a7b2b3f65fb98534f69963b2d91edffd9e 100644 (file)
@@ -354,8 +354,7 @@ do_test(const DoFHandler<dim> &dof)
 
   MappingQ<dim>                                          mapping(fe_degree + 1);
   LaplaceOperator<dim, fe_degree, n_q_points_1d, double> fine_matrix;
-  std::set<types::boundary_id>                           dirichlet_boundaries;
-  dirichlet_boundaries.insert(0);
+  const std::set<types::boundary_id> dirichlet_boundaries = {0};
   fine_matrix.initialize(mapping, dof, dirichlet_boundaries);
 
   LinearAlgebra::distributed::Vector<double> in, sol;
index 20b59fc2bca55748050cf35fc4d9d6a8960960a2..37fd4f7d75e553aade3507131fb80b8396f8355d 100644 (file)
@@ -342,11 +342,10 @@ do_test(const DoFHandler<dim> &dof)
   deallog << std::endl;
   deallog << "Number of degrees of freedom: " << dof.n_dofs() << std::endl;
 
-  const unsigned int           fe_degree = dof.get_fe().degree;
-  MappingQ<dim>                mapping(fe_degree + 1);
-  LaplaceOperator<dim, double> fine_matrix;
-  std::set<types::boundary_id> dirichlet_boundaries;
-  dirichlet_boundaries.insert(0);
+  const unsigned int                 fe_degree = dof.get_fe().degree;
+  MappingQ<dim>                      mapping(fe_degree + 1);
+  LaplaceOperator<dim, double>       fine_matrix;
+  const std::set<types::boundary_id> dirichlet_boundaries = {0};
   fine_matrix.initialize(mapping, dof, dirichlet_boundaries);
 
   LinearAlgebra::distributed::Vector<double> in, sol;
index 24d882e517615b1ee78fa7a98969ce80f14a4957..507c0ed3883921372fe7f8206fdd47478b692299 100644 (file)
@@ -384,11 +384,10 @@ do_test(DoFHandler<dim> &dof)
   deallog << std::endl;
   deallog << "Number of degrees of freedom: " << dof.n_dofs() << std::endl;
 
-  const unsigned int           fe_degree = dof.get_fe().degree;
-  MappingQ<dim>                mapping(fe_degree + 1);
-  LaplaceOperator<dim, double> fine_matrix;
-  std::set<types::boundary_id> dirichlet_boundaries;
-  dirichlet_boundaries.insert(0);
+  const unsigned int                 fe_degree = dof.get_fe().degree;
+  MappingQ<dim>                      mapping(fe_degree + 1);
+  LaplaceOperator<dim, double>       fine_matrix;
+  const std::set<types::boundary_id> dirichlet_boundaries = {0};
   fine_matrix.initialize(mapping, dof, dirichlet_boundaries);
 
   LinearAlgebra::distributed::Vector<double> in, sol;
index 60467a8c658fb02be73b9b19ab474721bdcab59b..0b76aa679f5cb1b23f8623e45bedfa84ebd51b66 100644 (file)
@@ -349,8 +349,7 @@ do_test(const DoFHandler<dim> &dof)
 
   MappingQ<dim>                                          mapping(fe_degree + 1);
   LaplaceOperator<dim, fe_degree, n_q_points_1d, double> fine_matrix;
-  std::set<types::boundary_id>                           dirichlet_boundaries;
-  dirichlet_boundaries.insert(0);
+  const std::set<types::boundary_id> dirichlet_boundaries = {0};
   fine_matrix.initialize(mapping, dof, dirichlet_boundaries);
 
   LinearAlgebra::distributed::Vector<double> in, sol;
index 31361fd8e1049ce92542a08f0349df9e4ad6fa49..801d908e21bef86585a67393f06ecfc325cd0473 100644 (file)
@@ -434,8 +434,7 @@ namespace Step37
     const unsigned int nlevels = triangulation.n_global_levels();
     mg_matrices.resize(0, nlevels - 1);
 
-    std::set<types::boundary_id> dirichlet_boundary;
-    dirichlet_boundary.insert(0);
+    const std::set<types::boundary_id> dirichlet_boundary = {0};
     mg_constrained_dofs.initialize(dof_handler);
     mg_constrained_dofs.make_zero_boundary_constraints(dof_handler,
                                                        dirichlet_boundary);
index d04f170ea903594c6325ff18e9bb1beaa3efca46..061cf429d0962c6e1ea4592327726c8a04346d0d 100644 (file)
@@ -1102,8 +1102,7 @@ namespace StokesClass
     mg_matrices.resize(0, n_levels - 1);
 
     mg_constrained_dofs.clear();
-    std::set<types::boundary_id> dirichlet_boundary;
-    dirichlet_boundary.insert(0);
+    const std::set<types::boundary_id> dirichlet_boundary = {0};
     mg_constrained_dofs.initialize(dof_handler_u);
     mg_constrained_dofs.make_zero_boundary_constraints(dof_handler_u,
                                                        dirichlet_boundary);
index e63057b32a9ddc6026760b93766891e96d51e5bd..ef35faec65871e06ff33b2d1f19a0b70efcd2d77 100644 (file)
@@ -419,8 +419,7 @@ LaplaceProblem<dim>::setup_dofs()
   additional_data.tasks_parallel_scheme =
     MatrixFree<dim, float>::AdditionalData::none;
 
-  std::set<types::boundary_id> dirichlet_boundary;
-  dirichlet_boundary.insert(0);
+  const std::set<types::boundary_id> dirichlet_boundary = {0};
   mg_constrained_dofs.initialize(dof_handler);
   mg_constrained_dofs.make_zero_boundary_constraints(dof_handler,
                                                      dirichlet_boundary);
@@ -471,8 +470,7 @@ LaplaceProblem<dim>::setup_matrix_free()
   const unsigned int nlevels = triangulation.n_global_levels();
   mg_matrices.resize(0, nlevels - 1);
 
-  std::set<types::boundary_id> dirichlet_boundary;
-  dirichlet_boundary.insert(0);
+  const std::set<types::boundary_id> dirichlet_boundary = {0};
   mg_constrained_dofs.initialize(dof_handler);
   mg_constrained_dofs.make_zero_boundary_constraints(dof_handler,
                                                      dirichlet_boundary);

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.