Skip to content

Commit

Permalink
Global coarsening: compress weights
Browse files Browse the repository at this point in the history
  • Loading branch information
peterrum committed Dec 21, 2021
1 parent 5cc5007 commit 9f5e645
Show file tree
Hide file tree
Showing 4 changed files with 290 additions and 85 deletions.
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

0 comments on commit 9f5e645

Please sign in to comment.