From: Peter Munch Date: Thu, 23 Mar 2023 18:49:41 +0000 (+0100) Subject: Remove derived classes X-Git-Tag: v9.5.0-rc1~415^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3ad01e915b8bd4ec5194020d452f101df86f7c7;p=dealii.git Remove derived classes --- diff --git a/include/deal.II/matrix_free/evaluation_kernels.h b/include/deal.II/matrix_free/evaluation_kernels.h index a2c6bb29b9..bf994afb1b 100644 --- a/include/deal.II/matrix_free/evaluation_kernels.h +++ b/include/deal.II/matrix_free/evaluation_kernels.h @@ -2247,8 +2247,8 @@ namespace internal /** - * This class chooses an appropriate evaluation strategy based on the - * template parameters and the shape_info variable which contains runtime + * This class chooses an appropriate evaluation/integration strategy based on + * the template parameters and the shape_info variable which contains runtime * parameters for the strategy underlying FEEvaluation::evaluate(), i.e. * this calls internal::FEEvaluationImpl::evaluate(), * internal::FEEvaluationImplCollocation::evaluate() or @@ -2264,14 +2264,21 @@ namespace internal template struct FEEvaluationImplSelector { - template + template static bool run(const unsigned int n_components, const EvaluationFlags::EvaluationFlags evaluation_flag, - VNumber * values_dofs, + OtherNumber * values_dofs, FEEvaluationData & fe_eval, const bool sum_into_values_array = false) { + // `OtherNumber` is either `const Number` (evaluate()) or `Number` + // (integrate()) + static_assert( + std::is_same::type>::value, + "Type of Number and of OtherNumber do not match."); + const auto element_type = fe_eval.get_shape_info().element_type; using ElementType = MatrixFreeFunctions::ElementType; @@ -2425,12 +2432,12 @@ namespace internal sum_into_values_array); } - template + template static void evaluate_or_integrate( const unsigned int n_components, const EvaluationFlags::EvaluationFlags evaluation_flag, - VNumber * values_dofs, + OtherNumber * values_dofs, FEEvaluationData & fe_eval, const bool sum_into_values_array) { @@ -2445,35 +2452,6 @@ namespace internal - template - struct FEEvaluationImplEvaluateSelector - : public FEEvaluationImplSelector - {}; - - - - /** - * This class chooses an appropriate evaluation strategy based on the - * template parameters and the shape_info variable which contains runtime - * parameters for the strategy underlying FEEvaluation::integrate(), i.e. - * this calls internal::FEEvaluationImpl::integrate(), - * internal::FEEvaluationImplCollocation::integrate() or - * internal::FEEvaluationImplTransformToCollocation::integrate() with - * appropriate template parameters. In case the template parameters - * fe_degree and n_q_points_1d contain valid information (i.e. fe_degree>-1 - * and n_q_points_1d>0), we simply pass these values to the respective - * template specializations. Otherwise, we perform a runtime matching of - * the runtime parameters to find the correct specialization. This matching - * currently supports $0\leq fe\_degree \leq 9$ and $degree+1\leq - * n\_q\_points\_1d\leq fe\_degree+2$. - */ - template - struct FEEvaluationImplIntegrateSelector - : public FEEvaluationImplSelector - {}; - - - template ::evaluate( { Assert(fe_degree >= 0 && n_q_points_1d > 0, ExcInternalError()); - internal::FEEvaluationImplEvaluateSelector::template run< + internal::FEEvaluationImplSelector::template run< fe_degree, n_q_points_1d>(n_components, evaluation_flag, values_dofs, eval); } @@ -94,7 +94,7 @@ SelectEvaluator::integrate( { Assert(fe_degree >= 0 && n_q_points_1d > 0, ExcInternalError()); - internal::FEEvaluationImplIntegrateSelector:: + internal::FEEvaluationImplSelector:: template run( n_components, integration_flag, values_dofs, eval, sum_into_values_array); } diff --git a/include/deal.II/matrix_free/evaluation_template_factory.templates.h b/include/deal.II/matrix_free/evaluation_template_factory.templates.h index 67eba41712..bd0f37fda6 100644 --- a/include/deal.II/matrix_free/evaluation_template_factory.templates.h +++ b/include/deal.II/matrix_free/evaluation_template_factory.templates.h @@ -49,7 +49,7 @@ namespace internal const Number * values_dofs, FEEvaluationData & fe_eval) { - instantiation_helper_run<1, FEEvaluationImplEvaluateSelector>( + instantiation_helper_run<1, FEEvaluationImplSelector>( fe_eval.get_shape_info().data[0].fe_degree, fe_eval.get_shape_info().data[0].n_q_points_1d, n_components, @@ -69,7 +69,7 @@ namespace internal FEEvaluationData & fe_eval, const bool sum_into_values_array) { - instantiation_helper_run<1, FEEvaluationImplIntegrateSelector>( + instantiation_helper_run<1, FEEvaluationImplSelector>( fe_eval.get_shape_info().data[0].fe_degree, fe_eval.get_shape_info().data[0].n_q_points_1d, n_components,