From: Nils Schween Date: Wed, 15 Mar 2023 15:54:55 +0000 (+0100) Subject: replace if constexpr with a for loop X-Git-Tag: v9.5.0-rc1~454^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a61a1245f1ae31a4008e4114f54c99e3a92ada58;p=dealii.git replace if constexpr with a for loop --- diff --git a/tests/grid/grid_tools_collect_periodic_faces_parallel_shared_tria.cc b/tests/grid/grid_tools_collect_periodic_faces_parallel_shared_tria.cc index 4654a0e589..c68cf02b5e 100644 --- a/tests/grid/grid_tools_collect_periodic_faces_parallel_shared_tria.cc +++ b/tests/grid/grid_tools_collect_periodic_faces_parallel_shared_tria.cc @@ -39,42 +39,22 @@ test(MPI_Comm comm) typename parallel::shared::Triangulation::cell_iterator>> matched_pairs; - unsigned int num_refinements = 1 << 4; + unsigned int num_refinements = 1 << 4; + Point p1; + Point p2; + std::vector repitions(dim); - if constexpr (dim == 1) + for (unsigned int i = 0; i < dim; ++i) { - Point p1{0.}; - Point p2{1.}; - std::vector repitions{num_refinements}; - GridGenerator::subdivided_hyper_rectangle(tria, repitions, p1, p2, true); - - // Collect periodic faces in the x-direction - GridTools::collect_periodic_faces(tria, 0, 1, 0, matched_pairs); - // Check the size of the matched_pairs vector - deallog << matched_pairs.size() << std::endl; - } - else if constexpr (dim == 2) - { - Point p1{0., 0.}; - Point p2{1., 1.}; - std::vector repitions{num_refinements, num_refinements}; - GridGenerator::subdivided_hyper_rectangle(tria, repitions, p1, p2, true); - - GridTools::collect_periodic_faces(tria, 0, 1, 0, matched_pairs); - deallog << matched_pairs.size() << std::endl; - } - else if constexpr (dim == 3) - { - Point p1{0., 0., 0.}; - Point p2{1., 1., 1.}; - std::vector repitions{num_refinements, - num_refinements, - num_refinements}; - GridGenerator::subdivided_hyper_rectangle(tria, repitions, p1, p2, true); - - GridTools::collect_periodic_faces(tria, 0, 1, 0, matched_pairs); - deallog << matched_pairs.size() << std::endl; + p1[i] = 0.; + p2[i] = 1.; + repitions[i] = num_refinements; } + GridGenerator::subdivided_hyper_rectangle(tria, repitions, p1, p2, true); + // Collect periodic faces in the x-direction + GridTools::collect_periodic_faces(tria, 0, 1, 0, matched_pairs); + // Check the size of the matched_pairs vector + deallog << matched_pairs.size() << std::endl; } int