From: Maximilian Bergbauer Date: Mon, 5 Feb 2024 12:03:50 +0000 (+0100) Subject: Use Lazy X-Git-Tag: relicensing~73^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60cf90e5ce8cb9ee1c7a83b8a9b7cf06f180c52b;p=dealii.git Use Lazy --- diff --git a/include/deal.II/base/lazy.h b/include/deal.II/base/lazy.h index 3e8715916d..712f229e47 100644 --- a/include/deal.II/base/lazy.h +++ b/include/deal.II/base/lazy.h @@ -185,7 +185,7 @@ public: * Return a reference to the contained object. * * @pre The object has been initialized with a call to - * ensure_initialized() or value_or_initialized(). + * ensure_initialized() or value_or_initialize(). */ T & value(); diff --git a/source/non_matching/quadrature_generator.cc b/source/non_matching/quadrature_generator.cc index 2af704b2e2..7e9ae0dbb3 100644 --- a/source/non_matching/quadrature_generator.cc +++ b/source/non_matching/quadrature_generator.cc @@ -1473,6 +1473,11 @@ namespace NonMatching * Check whether the shape functions are linear. */ bool polynomials_are_hat_functions; + + /** + * Linear FE_Q object for FE_Q_iso_Q1 path. + */ + Lazy>> fe_q1; }; @@ -1518,15 +1523,18 @@ namespace NonMatching const FiniteElement *fe = &dof_handler_cell->get_fe(); - const FE_Q fe_q1(1); - if (const FE_Q_iso_Q1 *fe_q_iso_q1 = dynamic_cast *>( &dof_handler_cell->get_fe())) { this->n_subdivisions_per_line = fe_q_iso_q1->get_degree(); - fe = &fe_q1; - local_dof_values_subcell.resize(fe_q1.n_dofs_per_cell()); + + fe = fe_q1 + .value_or_initialize( + []() { return std::make_unique>(1); }) + .get(); + local_dof_values_subcell.resize( + fe_q1.value()->n_dofs_per_cell()); } else this->n_subdivisions_per_line = numbers::invalid_unsigned_int;