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

Global coarsening: compress weights #13099

Merged
merged 1 commit into from
Dec 22, 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
34 changes: 34 additions & 0 deletions include/deal.II/matrix_free/tensor_product_kernels.h
Original file line number Diff line number Diff line change
Expand Up @@ -2586,6 +2586,40 @@ namespace internal
}


template <int dim, int loop_length_template, typename Number>
inline void
weight_fe_q_dofs_by_entity(const VectorizedArray<Number> *weights,
const unsigned int n_components,
const int loop_length_non_template,
VectorizedArray<Number> *data)
{
const int loop_length = loop_length_template != -1 ?
loop_length_template :
loop_length_non_template;

Assert(loop_length > 0, ExcNotImplemented());
Assert(loop_length < 100, ExcNotImplemented());
unsigned int degree_to_3[100];
degree_to_3[0] = 0;
for (int i = 1; i < loop_length - 1; ++i)
degree_to_3[i] = 1;
degree_to_3[loop_length - 1] = 2;
for (unsigned int c = 0; c < n_components; ++c)
for (int k = 0; k < (dim > 2 ? loop_length : 1); ++k)
for (int j = 0; j < (dim > 1 ? loop_length : 1); ++j)
{
const unsigned int shift = 9 * degree_to_3[k] + 3 * degree_to_3[j];
data[0] *= weights[shift];
// loop bound as int avoids compiler warnings in case loop_length
// == 1 (polynomial degree 0)
for (int i = 1; i < loop_length - 1; ++i)
data[i] *= weights[shift + 1];
data[loop_length - 1] *= weights[shift + 2];
data += loop_length;
}
}


} // end of namespace internal


Expand Down
7 changes: 7 additions & 0 deletions include/deal.II/multigrid/mg_transfer_global_coarsening.h
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,13 @@ class MGTwoLevelTransfer<dim, LinearAlgebra::distributed::Vector<Number>>
*/
std::vector<Number> weights;

/**
* Weights for continuous elements, compressed into 3^dim doubles per
* cell if possible.
*/
std::vector<std::array<VectorizedArray<Number>, Utilities::pow(3, dim)>>
weights_compressed;

/**
* DoF indices of the coarse cells, expressed in indices local to the MPI
* rank.
Expand Down