From 595293ff15a411aaf138de69f6f352d9f1a522c8 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 13 May 2024 15:05:54 -0600 Subject: [PATCH] Let the class own its finite element, rather than storing a reference. --- examples/step-39/step-39.cc | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/examples/step-39/step-39.cc b/examples/step-39/step-39.cc index ddb40b553b..b3df253f78 100644 --- a/examples/step-39/step-39.cc +++ b/examples/step-39/step-39.cc @@ -584,7 +584,7 @@ namespace Step39 public: using CellInfo = MeshWorker::IntegrationInfo; - InteriorPenaltyProblem(const FiniteElement &fe); + InteriorPenaltyProblem(); void run(unsigned int n_steps); @@ -599,10 +599,10 @@ namespace Step39 void output_results(const unsigned int cycle) const; // The member objects related to the discretization are here. - Triangulation triangulation; - const MappingQ1 mapping; - const FiniteElement &fe; - DoFHandler dof_handler; + Triangulation triangulation; + const MappingQ1 mapping; + const FE_DGQ<2> fe; + DoFHandler dof_handler; // Then, we have the matrices and vectors related to the global discrete // system. @@ -634,14 +634,12 @@ namespace Step39 }; - // The constructor simply sets up the coarse grid and the DoFHandler. The - // FiniteElement is provided as a parameter to allow flexibility. + // The constructor simply sets up the coarse grid and the DoFHandler. template - InteriorPenaltyProblem::InteriorPenaltyProblem( - const FiniteElement &fe) + InteriorPenaltyProblem::InteriorPenaltyProblem() : triangulation(Triangulation::limit_level_difference_at_vertices) , mapping() - , fe(fe) + , fe(3) , dof_handler(triangulation) , estimates(1) { @@ -1117,8 +1115,8 @@ int main() deallog.depth_console(2); std::ofstream logfile("deallog"); deallog.attach(logfile); - const FE_DGQ<2> fe1(3); - InteriorPenaltyProblem<2> test1(fe1); + + InteriorPenaltyProblem<2> test1; test1.run(12); } catch (std::exception &exc) -- 2.39.5