From 36a1cfafc5fcb792d3f1954d48a7fda9f13eaafd Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 20 Aug 2024 17:28:00 -0600 Subject: [PATCH] Adjust a variable name in a test. The test checks the FiniteElementData members, but the objects stored in the array used in the test are all FiniteElement objects. --- tests/fe/fe_data_test.cc | 242 ++++++++++++++++++++------------------- 1 file changed, 123 insertions(+), 119 deletions(-) diff --git a/tests/fe/fe_data_test.cc b/tests/fe/fe_data_test.cc index cba84aa3c8..848fdbd140 100644 --- a/tests/fe/fe_data_test.cc +++ b/tests/fe/fe_data_test.cc @@ -42,137 +42,138 @@ template void -test_2d_3d(std::vector *> &fe_datas) +test_2d_3d(std::vector *> &finite_elements) { // Vector DG elements - fe_datas.push_back(new FE_DGRaviartThomas(0)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_DGRaviartThomas(1)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_DGBDM(1)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_DGBDM(2)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_DGNedelec(0)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_DGNedelec(1)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_DGRaviartThomas(0)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_DGRaviartThomas(1)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_DGBDM(1)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_DGBDM(2)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_DGNedelec(0)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_DGNedelec(1)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; // Hdiv elements FE_RaviartThomas *rt0 = new FE_RaviartThomas(0); - fe_datas.push_back(rt0); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; + finite_elements.push_back(rt0); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; FE_RaviartThomas *rt1 = new FE_RaviartThomas(1); - fe_datas.push_back(rt1); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; + finite_elements.push_back(rt1); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_RaviartThomas(2)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FESystem(*rt1, 1, FE_DGQ(1), 1)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_RaviartThomas(2)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FESystem(*rt1, 1, FE_DGQ(1), 1)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_BDM(1)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_BDM(2)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_BDM(1)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_BDM(2)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; // Hcurl elements FE_Nedelec *ned0 = new FE_Nedelec(0); - fe_datas.push_back(ned0); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; + finite_elements.push_back(ned0); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; FE_Nedelec *ned1 = new FE_Nedelec(1); - fe_datas.push_back(ned1); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; + finite_elements.push_back(ned1); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; } void -test_2d_3d(std::vector *> &fe_datas) +test_2d_3d(std::vector *> &finite_elements) {} template void -test_fe_datas() +test_finite_elements() { - std::vector *> fe_datas; - fe_datas.push_back(new FE_Q(1)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_Q(2)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_Q(4)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_Q_Hierarchical(1)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_Q_Hierarchical(2)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_Q_Hierarchical(4)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_DGQ(1)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_DGQ(2)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back( + std::vector *> finite_elements; + finite_elements.push_back(new FE_Q(1)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_Q(2)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_Q(4)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_Q_Hierarchical(1)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_Q_Hierarchical(2)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_Q_Hierarchical(4)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_DGQ(1)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_DGQ(2)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back( new FE_DGQArbitraryNodes(QIterated<1>(QTrapezoid<1>(), 4))); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_DGQ(4)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_DGQArbitraryNodes(QGauss<1>(3))); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_DGQLegendre(1)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_DGQLegendre(2)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_DGQHermite(3)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_DGP(1)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_DGP(2)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FESystem(FE_Q(2), 2)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FESystem(FE_Q(1), 2, FE_Q(2), 1)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_DGQ(4)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_DGQArbitraryNodes(QGauss<1>(3))); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_DGQLegendre(1)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_DGQLegendre(2)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_DGQHermite(3)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_DGP(1)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_DGP(2)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FESystem(FE_Q(2), 2)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back( + new FESystem(FE_Q(1), 2, FE_Q(2), 1)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; // Face Q elements - fe_datas.push_back(new FE_FaceQ(0)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_FaceQ(1)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_FaceQ(3)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_FaceQ(0)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_FaceQ(1)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_FaceQ(3)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; // Face P elements - fe_datas.push_back(new FE_FaceP(0)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_FaceP(1)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_FaceP(3)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_FaceP(0)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_FaceP(1)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_FaceP(3)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; // Check vector elements in 2d and higher only - test_2d_3d(fe_datas); + test_2d_3d(finite_elements); if (dim == 2) { - fe_datas.push_back(new FE_DGBDM(1)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FE_DGBDM(2)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_DGBDM(1)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FE_DGBDM(2)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; } if (dim > 1) { FE_RaviartThomasNodal *rt0 = new FE_RaviartThomasNodal(0); FE_RaviartThomasNodal *rt1 = new FE_RaviartThomasNodal(1); - fe_datas.push_back(rt0); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(rt1); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FESystem(*rt1, 1, FE_DGQ(1), 1)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; + finite_elements.push_back(rt0); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(rt1); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FESystem(*rt1, 1, FE_DGQ(1), 1)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; } @@ -180,12 +181,13 @@ test_fe_datas() // only hardcoded for Q1-Q2 if (dim != 3) { - fe_datas.push_back(new FESystem(FE_Q(3), 2)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FESystem(FE_Q(1), 2, FE_Q(3), 1)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FESystem(FE_Q(4), 2)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FESystem(FE_Q(3), 2)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back( + new FESystem(FE_Q(1), 2, FE_Q(3), 1)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FESystem(FE_Q(4), 2)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; } // have systems of systems, and @@ -193,31 +195,33 @@ test_fe_datas() // subsequently weirder elements by // taking each of them in turn as // basis of others - fe_datas.push_back(new FESystem(FESystem(FE_Q(1), 2), 2)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FESystem( + finite_elements.push_back( + new FESystem(FESystem(FE_Q(1), 2), 2)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back(new FESystem( FESystem(FE_Q(1), 2), 1, FESystem(FE_DGQ(1), 2), 1)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back( + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back( new FESystem(FESystem(FE_Q(1), 1, FE_Q(2), 1), 1, FESystem(FE_Q(2), 2), 1, FESystem(FE_DGQ(2), 2), 1)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; - fe_datas.push_back(new FESystem(*fe_datas[fe_datas.size() - 3], - 2, - *fe_datas[fe_datas.size() - 2], - 1, - *fe_datas[fe_datas.size() - 1], - 2)); - deallog << (*fe_datas.rbegin())->get_name() << std::endl; + deallog << (*finite_elements.rbegin())->get_name() << std::endl; + finite_elements.push_back( + new FESystem(*finite_elements[finite_elements.size() - 3], + 2, + *finite_elements[finite_elements.size() - 2], + 1, + *finite_elements[finite_elements.size() - 1], + 2)); + deallog << (*finite_elements.rbegin())->get_name() << std::endl; deallog << std::endl << "dim=" << dim << std::endl; - for (unsigned int n = 0; n < fe_datas.size(); ++n) + for (unsigned int n = 0; n < finite_elements.size(); ++n) { - FiniteElement *fe_data = fe_datas[n]; + FiniteElement *fe_data = finite_elements[n]; deallog << "fe_data[" << n << "]:" << fe_data->get_name() << std::endl; deallog << "dofs_per_vertex=" << fe_data->dofs_per_vertex << std::endl; deallog << "dofs_per_line=" << fe_data->dofs_per_line << std::endl; @@ -272,16 +276,16 @@ test_fe_datas() { deallog << "support on face " << f << ':'; for (unsigned int s = 0; s < fe_data->dofs_per_cell; ++s) - if (fe_datas[n]->has_support_on_face(s, f)) + if (finite_elements[n]->has_support_on_face(s, f)) deallog << '\t' << s; deallog << std::endl; } deallog << std::endl; } - // delete all FiniteElementDatas - for (unsigned int i = 0; i < fe_datas.size(); ++i) - delete fe_datas[i]; + // delete all finite elements + for (unsigned int i = 0; i < finite_elements.size(); ++i) + delete finite_elements[i]; } int @@ -289,7 +293,7 @@ main() { initlog(); - test_fe_datas<1>(); - test_fe_datas<2>(); - test_fe_datas<3>(); + test_finite_elements<1>(); + test_finite_elements<2>(); + test_finite_elements<3>(); } -- 2.39.5