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

Weight kernel for multigrid: Simplify aliasing analysis for compiler #15185

Merged
merged 1 commit into from
May 8, 2023
Merged
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
11 changes: 7 additions & 4 deletions include/deal.II/matrix_free/tensor_product_kernels.h
Original file line number Diff line number Diff line change
Expand Up @@ -3693,8 +3693,9 @@ namespace internal
data[0] *= weights[shift];
// loop bound as int avoids compiler warnings in case n_points_1d
// == 1 (polynomial degree 0)
const Number weight = weights[shift + 1];
for (int i = 1; i < n_points_1d - 1; ++i)
data[i] *= weights[shift + 1];
data[i] *= weight;
data[n_points_1d - 1] *= weights[shift + 2];
data += n_points_1d;
}
Expand Down Expand Up @@ -3735,12 +3736,14 @@ namespace internal
const unsigned int shift =
9 * compressed_index[k] + 3 * compressed_index[j];

unsigned int c = 0;
unsigned int c = 0;
const Number weight1 = weights[shift];
for (int i = 0; i < n_inside_1d; ++i)
data[c++] *= weights[shift];
data[c++] *= weight1;
data[c++] *= weights[shift + 1];
const Number weight2 = weights[shift + 2];
for (int i = 0; i < n_inside_1d; ++i)
data[c++] *= weights[shift + 2];
data[c++] *= weight2;
data += n_points_1d;
}
}
Expand Down