From 1c4d95d1c0ff56b7a6d6ab3505d60c452b1093ce Mon Sep 17 00:00:00 2001 From: Maximilian Bergbauer Date: Wed, 24 Jan 2024 22:40:50 +0100 Subject: [PATCH] Fix performance quadrature generator --- source/non_matching/quadrature_generator.cc | 59 ++++++++++++--------- 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/source/non_matching/quadrature_generator.cc b/source/non_matching/quadrature_generator.cc index e14dd7093d..2af704b2e2 100644 --- a/source/non_matching/quadrature_generator.cc +++ b/source/non_matching/quadrature_generator.cc @@ -1505,8 +1505,6 @@ namespace NonMatching const auto dof_handler_cell = cell->as_dof_handler_iterator(*dof_handler); - const FE_Q fe_q1(1); - // Save the element and the local dof values, since this is what we need // to evaluate the function. @@ -1520,6 +1518,8 @@ 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())) @@ -1621,13 +1621,18 @@ namespace NonMatching if (!poly.empty() && component == 0) { // TODO: this could be extended to a component that is not zero - return dealii::internal::evaluate_tensor_product_value( - poly, - this->is_fe_q_iso_q1() ? local_dof_values_subcell : - local_dof_values, - this->is_fe_q_iso_q1() ? subcell_box.real_to_unit(point) : point, - polynomials_are_hat_functions, - this->is_fe_q_iso_q1() ? std::vector() : renumber); + return this->is_fe_q_iso_q1() ? + dealii::internal::evaluate_tensor_product_value( + poly, + local_dof_values_subcell, + subcell_box.real_to_unit(point), + polynomials_are_hat_functions) : + dealii::internal::evaluate_tensor_product_value( + poly, + local_dof_values, + point, + polynomials_are_hat_functions, + renumber); } else { @@ -1654,15 +1659,20 @@ namespace NonMatching if (!poly.empty() && component == 0) { // TODO: this could be extended to a component that is not zero - return dealii::internal::evaluate_tensor_product_value_and_gradient( - poly, - this->is_fe_q_iso_q1() ? local_dof_values_subcell : - local_dof_values, - this->is_fe_q_iso_q1() ? subcell_box.real_to_unit(point) : - point, - polynomials_are_hat_functions, - this->is_fe_q_iso_q1() ? std::vector() : - renumber) + return (this->is_fe_q_iso_q1() ? + dealii::internal:: + evaluate_tensor_product_value_and_gradient( + poly, + local_dof_values_subcell, + subcell_box.real_to_unit(point), + polynomials_are_hat_functions) : + dealii::internal:: + evaluate_tensor_product_value_and_gradient( + poly, + local_dof_values, + point, + polynomials_are_hat_functions, + renumber)) .second; } else @@ -1690,12 +1700,13 @@ namespace NonMatching if (!poly.empty() && component == 0) { // TODO: this could be extended to a component that is not zero - return dealii::internal::evaluate_tensor_product_hessian( - poly, - this->is_fe_q_iso_q1() ? local_dof_values_subcell : - local_dof_values, - this->is_fe_q_iso_q1() ? subcell_box.real_to_unit(point) : point, - this->is_fe_q_iso_q1() ? std::vector() : renumber); + return this->is_fe_q_iso_q1() ? + dealii::internal::evaluate_tensor_product_hessian( + poly, + local_dof_values_subcell, + subcell_box.real_to_unit(point)) : + dealii::internal::evaluate_tensor_product_hessian( + poly, local_dof_values, point, renumber); } else { -- 2.39.5