Skip to content

Commit 9c20ca0

Browse files
authored
Merge pull request dealii#18917 from mwichro/tensor_prodct_matrix_improvement
Cleanup TensorProductMatrix with compile-time checks
2 parents 32a0840 + 5819cd8 commit 9c20ca0

File tree

1 file changed

+20
-22
lines changed

1 file changed

+20
-22
lines changed

include/deal.II/lac/tensor_product_matrix.h

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -969,14 +969,14 @@ TensorProductMatrixSymmetricSum<dim, Number, n_rows_1d>::vmult(
969969

970970
const unsigned int n_rows_1d_non_templated = this->mass_matrix[0].n_rows();
971971

972-
if (n_rows_1d != -1)
973-
internal::TensorProductMatrixSymmetricSum::vmult<
974-
n_rows_1d == -1 ? 0 : n_rows_1d>(dst,
975-
src,
976-
tmp_array,
977-
n_rows_1d_non_templated,
978-
mass_matrix,
979-
derivative_matrix);
972+
if constexpr (n_rows_1d != -1)
973+
internal::TensorProductMatrixSymmetricSum::vmult<n_rows_1d>(
974+
dst,
975+
src,
976+
tmp_array,
977+
n_rows_1d_non_templated,
978+
mass_matrix,
979+
derivative_matrix);
980980
else
981981
internal::TensorProductMatrixSymmetricSum::select_vmult<1>(
982982
dst,
@@ -1011,9 +1011,8 @@ TensorProductMatrixSymmetricSum<dim, Number, n_rows_1d>::apply_inverse(
10111011

10121012
const unsigned int n_rows_1d_non_templated = this->mass_matrix[0].n_rows();
10131013

1014-
if (n_rows_1d != -1)
1015-
internal::TensorProductMatrixSymmetricSum::apply_inverse<
1016-
n_rows_1d == -1 ? 0 : n_rows_1d>(
1014+
if constexpr (n_rows_1d != -1)
1015+
internal::TensorProductMatrixSymmetricSum::apply_inverse<n_rows_1d>(
10171016
dst, src, n_rows_1d_non_templated, eigenvectors, eigenvalues);
10181017
else
10191018
internal::TensorProductMatrixSymmetricSum::select_apply_inverse<1>(
@@ -1507,9 +1506,8 @@ TensorProductMatrixSymmetricSumCollection<dim, Number, n_rows_1d>::
15071506
vector_ptr[translated_index + 1] - vector_ptr[translated_index];
15081507
}
15091508

1510-
if (n_rows_1d != -1)
1511-
internal::TensorProductMatrixSymmetricSum::apply_inverse<
1512-
n_rows_1d == -1 ? 0 : n_rows_1d>(
1509+
if constexpr (n_rows_1d != -1)
1510+
internal::TensorProductMatrixSymmetricSum::apply_inverse<n_rows_1d>(
15131511
dst, src, n_rows_1d_non_templated, eigenvectors, eigenvalues);
15141512
else
15151513
internal::TensorProductMatrixSymmetricSum::select_apply_inverse<1>(
@@ -1546,14 +1544,14 @@ TensorProductMatrixSymmetricSumCollection<dim, Number, n_rows_1d>::
15461544
vector_n_rows_1d[translated_index];
15471545
}
15481546

1549-
if (n_rows_1d != -1)
1550-
internal::TensorProductMatrixSymmetricSum::apply_inverse<
1551-
n_rows_1d == -1 ? 0 : n_rows_1d>(dst,
1552-
src,
1553-
n_rows_1d_non_templated,
1554-
eigenvectors,
1555-
{},
1556-
inverted_eigenvalues);
1547+
if constexpr (n_rows_1d != -1)
1548+
internal::TensorProductMatrixSymmetricSum::apply_inverse<n_rows_1d>(
1549+
dst,
1550+
src,
1551+
n_rows_1d_non_templated,
1552+
eigenvectors,
1553+
{},
1554+
inverted_eigenvalues);
15571555
else
15581556
internal::TensorProductMatrixSymmetricSum::select_apply_inverse<1>(
15591557
dst,

0 commit comments

Comments
 (0)