From: Marc Fehling Date: Wed, 5 Apr 2023 22:16:28 +0000 (-0600) Subject: Replace make_2_cells() with TestGrids::hyper_line(). X-Git-Tag: v9.5.0-rc1~365^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0df9c959f28f9f39bc2f61bd31d357dd7bc51cf5;p=dealii.git Replace make_2_cells() with TestGrids::hyper_line(). --- diff --git a/tests/feinterface/fe_interface_values_01.cc b/tests/feinterface/fe_interface_values_01.cc index bdf3955126..b47a7afd6b 100644 --- a/tests/feinterface/fe_interface_values_01.cc +++ b/tests/feinterface/fe_interface_values_01.cc @@ -22,7 +22,6 @@ #include #include -#include #include #include @@ -31,6 +30,8 @@ #include "../tests.h" +#include "../test_grids.h" + template void @@ -67,41 +68,13 @@ inspect_fiv(FEInterfaceValues &fiv) } -template -void -make_2_cells(Triangulation &tria); - -template <> -void -make_2_cells<2>(Triangulation<2> &tria) -{ - const unsigned int dim = 2; - std::vector repetitions = {2, 1}; - Point p1; - Point p2(2.0, 1.0); - - GridGenerator::subdivided_hyper_rectangle(tria, repetitions, p1, p2); -} - -template <> -void -make_2_cells<3>(Triangulation<3> &tria) -{ - const unsigned int dim = 3; - std::vector repetitions = {2, 1, 1}; - Point p1; - Point p2(2.0, 1.0, 1.0); - - GridGenerator::subdivided_hyper_rectangle(tria, repetitions, p1, p2); -} - template void test() { Triangulation tria; - make_2_cells(tria); + TestGrids::hyper_line(tria, 2); DoFHandler dofh(tria); FE_DGQ fe(1); diff --git a/tests/feinterface/fe_interface_values_02.cc b/tests/feinterface/fe_interface_values_02.cc index 1b692eaad9..4053459863 100644 --- a/tests/feinterface/fe_interface_values_02.cc +++ b/tests/feinterface/fe_interface_values_02.cc @@ -23,7 +23,6 @@ #include #include -#include #include #include @@ -32,33 +31,7 @@ #include "../tests.h" -template -void -make_2_cells(Triangulation &tria); - -template <> -void -make_2_cells<2>(Triangulation<2> &tria) -{ - const unsigned int dim = 2; - std::vector repetitions = {2, 1}; - Point p1; - Point p2(2.0, 1.0); - - GridGenerator::subdivided_hyper_rectangle(tria, repetitions, p1, p2); -} - -template <> -void -make_2_cells<3>(Triangulation<3> &tria) -{ - const unsigned int dim = 3; - std::vector repetitions = {2, 1, 1}; - Point p1; - Point p2(2.0, 1.0, 1.0); - - GridGenerator::subdivided_hyper_rectangle(tria, repetitions, p1, p2); -} +#include "../test_grids.h" template @@ -66,7 +39,7 @@ void test(unsigned int fe_degree) { Triangulation tria; - make_2_cells(tria); + TestGrids::hyper_line(tria, 2); DoFHandler dofh(tria); FE_DGQ fe(fe_degree); diff --git a/tests/feinterface/fe_interface_values_03.cc b/tests/feinterface/fe_interface_values_03.cc index 72c082cd4e..512ad391df 100644 --- a/tests/feinterface/fe_interface_values_03.cc +++ b/tests/feinterface/fe_interface_values_03.cc @@ -23,7 +23,6 @@ #include #include -#include #include #include @@ -32,33 +31,7 @@ #include "../tests.h" -template -void -make_2_cells(Triangulation &tria); - -template <> -void -make_2_cells<2>(Triangulation<2> &tria) -{ - const unsigned int dim = 2; - std::vector repetitions = {2, 1}; - Point p1; - Point p2(2.0, 1.0); - - GridGenerator::subdivided_hyper_rectangle(tria, repetitions, p1, p2); -} - -template <> -void -make_2_cells<3>(Triangulation<3> &tria) -{ - const unsigned int dim = 3; - std::vector repetitions = {2, 1, 1}; - Point p1; - Point p2(2.0, 1.0, 1.0); - - GridGenerator::subdivided_hyper_rectangle(tria, repetitions, p1, p2); -} +#include "../test_grids.h" template @@ -66,7 +39,8 @@ void test(unsigned int fe_degree) { Triangulation tria; - make_2_cells(tria); + TestGrids::hyper_line(tria, 2); + tria.begin()->set_refine_flag(); tria.execute_coarsening_and_refinement(); diff --git a/tests/feinterface/fe_interface_values_05.cc b/tests/feinterface/fe_interface_values_05.cc index 251cb86316..48c1727c8c 100644 --- a/tests/feinterface/fe_interface_values_05.cc +++ b/tests/feinterface/fe_interface_values_05.cc @@ -22,7 +22,6 @@ #include #include -#include #include #include @@ -31,6 +30,8 @@ #include "../tests.h" +#include "../test_grids.h" + template void @@ -67,41 +68,13 @@ inspect_fiv(FEInterfaceValues &fiv) } -template -void -make_2_cells(Triangulation &tria); - -template <> -void -make_2_cells<2>(Triangulation<2> &tria) -{ - const unsigned int dim = 2; - std::vector repetitions = {2, 1}; - Point p1; - Point p2(2.0, 1.0); - - GridGenerator::subdivided_hyper_rectangle(tria, repetitions, p1, p2); -} - -template <> -void -make_2_cells<3>(Triangulation<3> &tria) -{ - const unsigned int dim = 3; - std::vector repetitions = {2, 1, 1}; - Point p1; - Point p2(2.0, 1.0, 1.0); - - GridGenerator::subdivided_hyper_rectangle(tria, repetitions, p1, p2); -} - template void test() { Triangulation tria; - make_2_cells(tria); + TestGrids::hyper_line(tria, 2); DoFHandler dofh(tria); FE_Q fe(1); diff --git a/tests/feinterface/fe_interface_values_06.cc b/tests/feinterface/fe_interface_values_06.cc index fe47f3552e..2bd3a9966e 100644 --- a/tests/feinterface/fe_interface_values_06.cc +++ b/tests/feinterface/fe_interface_values_06.cc @@ -24,7 +24,6 @@ #include #include -#include #include #include @@ -33,33 +32,7 @@ #include "../tests.h" -template -void -make_2_cells(Triangulation &tria); - -template <> -void -make_2_cells<2>(Triangulation<2> &tria) -{ - const unsigned int dim = 2; - std::vector repetitions = {2, 1}; - Point p1; - Point p2(2.0, 1.0); - - GridGenerator::subdivided_hyper_rectangle(tria, repetitions, p1, p2); -} - -template <> -void -make_2_cells<3>(Triangulation<3> &tria) -{ - const unsigned int dim = 3; - std::vector repetitions = {2, 1, 1}; - Point p1; - Point p2(2.0, 1.0, 1.0); - - GridGenerator::subdivided_hyper_rectangle(tria, repetitions, p1, p2); -} +#include "../test_grids.h" template @@ -67,7 +40,8 @@ void test(unsigned int fe_degree) { Triangulation tria; - make_2_cells(tria); + TestGrids::hyper_line(tria, 2); + tria.begin()->set_refine_flag(); tria.execute_coarsening_and_refinement(); diff --git a/tests/feinterface/fe_interface_values_07.cc b/tests/feinterface/fe_interface_values_07.cc index e58d2edbab..5be13683d9 100644 --- a/tests/feinterface/fe_interface_values_07.cc +++ b/tests/feinterface/fe_interface_values_07.cc @@ -24,7 +24,6 @@ #include #include -#include #include #include @@ -33,33 +32,7 @@ #include "../tests.h" -template -void -make_2_cells(Triangulation &tria); - -template <> -void -make_2_cells<2>(Triangulation<2> &tria) -{ - const unsigned int dim = 2; - std::vector repetitions = {2, 1}; - Point p1; - Point p2(2.0, 1.0); - - GridGenerator::subdivided_hyper_rectangle(tria, repetitions, p1, p2); -} - -template <> -void -make_2_cells<3>(Triangulation<3> &tria) -{ - const unsigned int dim = 3; - std::vector repetitions = {2, 1, 1}; - Point p1; - Point p2(2.0, 1.0, 1.0); - - GridGenerator::subdivided_hyper_rectangle(tria, repetitions, p1, p2); -} +#include "../test_grids.h" template @@ -67,7 +40,7 @@ void test(unsigned int fe_degree) { Triangulation tria; - make_2_cells(tria); + TestGrids::hyper_line(tria, 2); DoFHandler dofh(tria); FE_Q fe(fe_degree); diff --git a/tests/feinterface/fe_interface_values_08.cc b/tests/feinterface/fe_interface_values_08.cc index 987f1ad5e0..c082dafbd5 100644 --- a/tests/feinterface/fe_interface_values_08.cc +++ b/tests/feinterface/fe_interface_values_08.cc @@ -24,7 +24,6 @@ #include #include -#include #include #include @@ -33,33 +32,7 @@ #include "../tests.h" -template -void -make_2_cells(Triangulation &tria); - -template <> -void -make_2_cells<2>(Triangulation<2> &tria) -{ - const unsigned int dim = 2; - std::vector repetitions = {2, 1}; - Point p1; - Point p2(2.0, 1.0); - - GridGenerator::subdivided_hyper_rectangle(tria, repetitions, p1, p2); -} - -template <> -void -make_2_cells<3>(Triangulation<3> &tria) -{ - const unsigned int dim = 3; - std::vector repetitions = {2, 1, 1}; - Point p1; - Point p2(2.0, 1.0, 1.0); - - GridGenerator::subdivided_hyper_rectangle(tria, repetitions, p1, p2); -} +#include "../test_grids.h" template @@ -67,7 +40,7 @@ void test(const FiniteElement &fe) { Triangulation tria; - make_2_cells(tria); + TestGrids::hyper_line(tria, 2); DoFHandler dofh(tria); deallog << fe.get_name() << std::endl; diff --git a/tests/feinterface/fe_interface_values_09.cc b/tests/feinterface/fe_interface_values_09.cc index 528c42e055..89062b2e78 100644 --- a/tests/feinterface/fe_interface_values_09.cc +++ b/tests/feinterface/fe_interface_values_09.cc @@ -23,7 +23,6 @@ #include #include -#include #include #include @@ -32,37 +31,7 @@ #include "../tests.h" -template -void -make_2_cells(Triangulation &tria); - - - -template <> -void -make_2_cells<2>(Triangulation<2> &tria) -{ - const unsigned int dim = 2; - std::vector repetitions = {2, 1}; - Point p1; - Point p2(2.0, 1.0); - - GridGenerator::subdivided_hyper_rectangle(tria, repetitions, p1, p2); -} - - - -template <> -void -make_2_cells<3>(Triangulation<3> &tria) -{ - const unsigned int dim = 3; - std::vector repetitions = {2, 1, 1}; - Point p1; - Point p2(2.0, 1.0, 1.0); - - GridGenerator::subdivided_hyper_rectangle(tria, repetitions, p1, p2); -} +#include "../test_grids.h" @@ -96,7 +65,7 @@ void test(const FiniteElement &fe) { Triangulation tria; - make_2_cells(tria); + TestGrids::hyper_line(tria, 2); DoFHandler dofh(tria); deallog << fe.get_name() << std::endl; diff --git a/tests/feinterface/fe_interface_values_11.cc b/tests/feinterface/fe_interface_values_11.cc index 52b09de88c..fb6c170963 100644 --- a/tests/feinterface/fe_interface_values_11.cc +++ b/tests/feinterface/fe_interface_values_11.cc @@ -22,7 +22,6 @@ #include #include -#include #include #include @@ -34,6 +33,8 @@ #include "../tests.h" +#include "../test_grids.h" + template void @@ -69,41 +70,13 @@ inspect_fiv(FEInterfaceValues &fiv) } -template -void -make_2_cells(Triangulation &tria); - -template <> -void -make_2_cells<2>(Triangulation<2> &tria) -{ - const unsigned int dim = 2; - std::vector repetitions = {2, 1}; - Point p1; - Point p2(2.0, 1.0); - - GridGenerator::subdivided_hyper_rectangle(tria, repetitions, p1, p2); -} - -template <> -void -make_2_cells<3>(Triangulation<3> &tria) -{ - const unsigned int dim = 3; - std::vector repetitions = {2, 1, 1}; - Point p1; - Point p2(2.0, 1.0, 1.0); - - GridGenerator::subdivided_hyper_rectangle(tria, repetitions, p1, p2); -} - template void test(const unsigned int p) { Triangulation tria; - make_2_cells(tria); + TestGrids::hyper_line(tria, 2); DoFHandler dofh(tria); hp::FECollection fe_collection; diff --git a/tests/feinterface/fe_interface_values_12.cc b/tests/feinterface/fe_interface_values_12.cc index e32d1f0a22..0b38aef450 100644 --- a/tests/feinterface/fe_interface_values_12.cc +++ b/tests/feinterface/fe_interface_values_12.cc @@ -23,7 +23,6 @@ #include #include -#include #include #include @@ -32,33 +31,7 @@ #include "../tests.h" -template -void -make_2_cells(Triangulation &tria); - -template <> -void -make_2_cells<2>(Triangulation<2> &tria) -{ - const unsigned int dim = 2; - std::vector repetitions = {2, 1}; - Point p1; - Point p2(2.0, 1.0); - - GridGenerator::subdivided_hyper_rectangle(tria, repetitions, p1, p2); -} - -template <> -void -make_2_cells<3>(Triangulation<3> &tria) -{ - const unsigned int dim = 3; - std::vector repetitions = {2, 1, 1}; - Point p1; - Point p2(2.0, 1.0, 1.0); - - GridGenerator::subdivided_hyper_rectangle(tria, repetitions, p1, p2); -} +#include "../test_grids.h" template @@ -66,7 +39,7 @@ void test(const unsigned int fe_degree0, const unsigned int fe_degree1 = 0) { Triangulation tria; - make_2_cells(tria); + TestGrids::hyper_line(tria, 2); tria.begin()->set_refine_flag(); tria.execute_coarsening_and_refinement(); diff --git a/tests/feinterface/multigrid_01.cc b/tests/feinterface/multigrid_01.cc index 00b1fbf8b0..57edc09ec0 100644 --- a/tests/feinterface/multigrid_01.cc +++ b/tests/feinterface/multigrid_01.cc @@ -22,7 +22,6 @@ #include #include -#include #include #include @@ -31,6 +30,8 @@ #include "../tests.h" +#include "../test_grids.h" + template void @@ -66,27 +67,6 @@ inspect_fiv(FEInterfaceValues &fiv) deallog << std::endl; } -void -make_2_cells(Triangulation<2> &tria) -{ - const unsigned int dim = 2; - std::vector repetitions = {2, 1}; - Point p1; - Point p2(2.0, 1.0); - - GridGenerator::subdivided_hyper_rectangle(tria, repetitions, p1, p2); -} - -void -make_2_cells(Triangulation<3> &tria) -{ - const unsigned int dim = 3; - std::vector repetitions = {2, 1, 1}; - Point p1; - Point p2(2.0, 1.0, 1.0); - - GridGenerator::subdivided_hyper_rectangle(tria, repetitions, p1, p2); -} template @@ -95,7 +75,7 @@ test() { Triangulation tria( Triangulation::limit_level_difference_at_vertices); - make_2_cells(tria); + TestGrids::hyper_line(tria, 2); tria.refine_global();