Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pre-compiled code for CellwiseInverseMassMatrix #13003

Merged
merged 1 commit into from
Nov 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions doc/news/changes/minor/20211129MartinKronbichler
Original file line number Diff line number Diff line change
@@ -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.
<br>
(Martin Kronbichler, 2021/11/29)
3 changes: 0 additions & 3 deletions include/deal.II/matrix_free/evaluation_template_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ namespace internal
{
static void
apply(const unsigned int n_components,
const unsigned int fe_degree,
const FEEvaluationBaseData<dim, Number, false, VectorizedArrayType>
& fe_eval,
const VectorizedArrayType *in_array,
Expand All @@ -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<dim, Number, false, VectorizedArrayType>
& fe_eval,
const VectorizedArrayType *in_array,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,12 @@ namespace internal
void
CellwiseInverseMassFactory<dim, Number, VectorizedArrayType>::apply(
const unsigned int n_components,
const unsigned int fe_degree,
const FEEvaluationBaseData<dim, Number, false, VectorizedArrayType>
& 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<dim, VectorizedArrayType>>(
Expand Down Expand Up @@ -373,13 +373,14 @@ namespace internal
CellwiseInverseMassFactory<dim, Number, VectorizedArrayType>::
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<dim, Number, false, VectorizedArrayType>
& 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<dim,
Expand Down
36 changes: 25 additions & 11 deletions include/deal.II/matrix_free/operators.h
Original file line number Diff line number Diff line change
Expand Up @@ -1063,8 +1063,12 @@ namespace MatrixFreeOperators
VectorizedArrayType>::apply(const VectorizedArrayType *in_array,
VectorizedArrayType * out_array) const
{
internal::CellwiseInverseMassMatrixImplBasic<dim, VectorizedArrayType>::
template run<fe_degree>(n_components, fe_eval, in_array, out_array);
if (fe_degree > -1)
internal::CellwiseInverseMassMatrixImplBasic<dim, VectorizedArrayType>::
template run<fe_degree>(n_components, fe_eval, in_array, out_array);
else
internal::CellwiseInverseMassFactory<dim, Number, VectorizedArrayType>::
apply(n_components, fe_eval, in_array, out_array);
}


Expand All @@ -1085,13 +1089,25 @@ namespace MatrixFreeOperators
const VectorizedArrayType * in_array,
VectorizedArrayType * out_array) const
{
internal::CellwiseInverseMassMatrixImplFlexible<dim, VectorizedArrayType>::
template run<fe_degree>(
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<dim,
VectorizedArrayType>::
template run<fe_degree>(
n_actual_components,
fe_eval.get_shape_info().data.front().inverse_shape_values_eo,
inverse_coefficients,
in_array,
out_array);
else
internal::CellwiseInverseMassFactory<dim, Number, VectorizedArrayType>::
apply(n_actual_components,
given_degree,
fe_eval.get_shape_info().data.front().inverse_shape_values_eo,
inverse_coefficients,
in_array,
out_array);
}


Expand Down Expand Up @@ -1124,8 +1140,6 @@ namespace MatrixFreeOperators
else
internal::CellwiseInverseMassFactory<dim, Number, VectorizedArrayType>::
transform_from_q_points_to_basis(n_actual_components,
fe_degree,
n_q_points_1d,
fe_eval,
in_array,
out_array);
Expand Down