From: Martin Kronbichler Date: Mon, 29 Nov 2021 10:18:02 +0000 (+0100) Subject: Use pre-compiled code for CellwiseInverseMassMatrix X-Git-Tag: v9.4.0-rc1~791^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F13003%2Fhead;p=dealii.git Use pre-compiled code for CellwiseInverseMassMatrix --- diff --git a/doc/news/changes/minor/20211129MartinKronbichler b/doc/news/changes/minor/20211129MartinKronbichler new file mode 100644 index 0000000000..eea4c28eb2 --- /dev/null +++ b/doc/news/changes/minor/20211129MartinKronbichler @@ -0,0 +1,6 @@ +Fixed: MatrixFreeOperators::CellwiseInverseMassMatrix with template argument +`-1` for the polynomial degree now chooses the pre-compiled code with fast +tensor-product algorithms if available, rather than a slower general-purpose +code. +
+(Martin Kronbichler, 2021/11/29) diff --git a/include/deal.II/matrix_free/evaluation_template_factory.h b/include/deal.II/matrix_free/evaluation_template_factory.h index 8afb37d092..50ac727c87 100644 --- a/include/deal.II/matrix_free/evaluation_template_factory.h +++ b/include/deal.II/matrix_free/evaluation_template_factory.h @@ -172,7 +172,6 @@ namespace internal { static void apply(const unsigned int n_components, - const unsigned int fe_degree, const FEEvaluationBaseData & fe_eval, const VectorizedArrayType *in_array, @@ -189,8 +188,6 @@ namespace internal static void transform_from_q_points_to_basis( const unsigned int n_components, - const unsigned int fe_degree, - const unsigned int n_q_points_1d, const FEEvaluationBaseData & fe_eval, const VectorizedArrayType *in_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 b246ee4e44..5a98c3781b 100644 --- a/include/deal.II/matrix_free/evaluation_template_factory.templates.h +++ b/include/deal.II/matrix_free/evaluation_template_factory.templates.h @@ -330,12 +330,12 @@ namespace internal void CellwiseInverseMassFactory::apply( const unsigned int n_components, - const unsigned int fe_degree, const FEEvaluationBaseData & fe_eval, const VectorizedArrayType *in_array, VectorizedArrayType * out_array) { + const unsigned int fe_degree = fe_eval.get_shape_info().data[0].fe_degree; instantiation_helper_run< 1, CellwiseInverseMassMatrixImplBasic>( @@ -373,13 +373,14 @@ namespace internal CellwiseInverseMassFactory:: transform_from_q_points_to_basis( const unsigned int n_components, - const unsigned int fe_degree, - const unsigned int n_q_points_1d, const FEEvaluationBaseData & fe_eval, const VectorizedArrayType *in_array, VectorizedArrayType * out_array) { + const unsigned int fe_degree = fe_eval.get_shape_info().data[0].fe_degree; + const unsigned int n_q_points_1d = + fe_eval.get_shape_info().data[0].n_q_points_1d; instantiation_helper_run< 1, CellwiseInverseMassMatrixImplTransformFromQPoints::apply(const VectorizedArrayType *in_array, VectorizedArrayType * out_array) const { - internal::CellwiseInverseMassMatrixImplBasic:: - template run(n_components, fe_eval, in_array, out_array); + if (fe_degree > -1) + internal::CellwiseInverseMassMatrixImplBasic:: + template run(n_components, fe_eval, in_array, out_array); + else + internal::CellwiseInverseMassFactory:: + apply(n_components, fe_eval, in_array, out_array); } @@ -1085,13 +1089,25 @@ namespace MatrixFreeOperators const VectorizedArrayType * in_array, VectorizedArrayType * out_array) const { - internal::CellwiseInverseMassMatrixImplFlexible:: - template run( - n_actual_components, - fe_eval.get_shape_info().data.front().inverse_shape_values_eo, - inverse_coefficients, - in_array, - out_array); + const unsigned int given_degree = + fe_eval.get_shape_info().data[0].fe_degree; + if (fe_degree > -1) + internal::CellwiseInverseMassMatrixImplFlexible:: + template run( + n_actual_components, + fe_eval.get_shape_info().data.front().inverse_shape_values_eo, + inverse_coefficients, + in_array, + out_array); + else + internal::CellwiseInverseMassFactory:: + apply(n_actual_components, + given_degree, + fe_eval.get_shape_info().data.front().inverse_shape_values_eo, + inverse_coefficients, + in_array, + out_array); } @@ -1124,8 +1140,6 @@ namespace MatrixFreeOperators else internal::CellwiseInverseMassFactory:: transform_from_q_points_to_basis(n_actual_components, - fe_degree, - n_q_points_1d, fe_eval, in_array, out_array);