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

MGTwoLevelTransfer: use ConstraintInfo also for fine vectors #15158

Merged
merged 1 commit into from
May 2, 2023
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
3 changes: 2 additions & 1 deletion include/deal.II/matrix_free/constraint_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,8 @@ namespace internal
const unsigned int n_dofs_per_cell,
const bool apply_constraints) const
{
if (apply_constraints == false)
if ((row_starts_plain_indices.empty() == false) &&
(apply_constraints == false))
{
for (unsigned int v = 0; v < n_cells; ++v)
{
Expand Down
40 changes: 22 additions & 18 deletions include/deal.II/multigrid/mg_transfer_global_coarsening.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,10 @@ class MGTwoLevelTransferBase<LinearAlgebra::distributed::Vector<Number>>
const std::shared_ptr<const Utilities::MPI::Partitioner>
&partitioner_coarse,
const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner_fine,
internal::MatrixFreeFunctions::
ConstraintInfo<dim, VectorizedArray<Number, width>> &constraint_info);
internal::MatrixFreeFunctions::ConstraintInfo<
dim,
VectorizedArray<Number, width>> &constraint_info_coarse,
std::vector<unsigned int> & dof_indices_fine);

/**
* Flag if the finite elements on the fine cells are continuous. If yes,
Expand Down Expand Up @@ -361,12 +363,6 @@ class MGTwoLevelTransferBase<LinearAlgebra::distributed::Vector<Number>>
* are a subset of an external Partitioner object.
*/
mutable AlignedVector<Number> buffer_fine_embedded;

/**
* DoF indices of the fine cells, expressed in indices local to the MPI
* rank.
*/
std::vector<unsigned int> level_dof_indices_fine;
};


Expand Down Expand Up @@ -429,6 +425,8 @@ template <int dim, typename Number>
class MGTwoLevelTransfer<dim, LinearAlgebra::distributed::Vector<Number>>
: public MGTwoLevelTransferBase<LinearAlgebra::distributed::Vector<Number>>
{
using VectorizedArrayType = VectorizedArray<Number>;

public:
/**
* Set up global coarsening between the given DoFHandler objects (
Expand Down Expand Up @@ -584,28 +582,28 @@ class MGTwoLevelTransfer<dim, LinearAlgebra::distributed::Vector<Number>>
/**
* Prolongation matrix for non-tensor-product elements.
*/
AlignedVector<VectorizedArray<Number>> prolongation_matrix;
AlignedVector<VectorizedArrayType> prolongation_matrix;

/**
* 1d prolongation matrix for tensor-product elements.
*/
AlignedVector<VectorizedArray<Number>> prolongation_matrix_1d;
AlignedVector<VectorizedArrayType> prolongation_matrix_1d;

/**
* Restriction matrix for non-tensor-product elements.
*/
AlignedVector<VectorizedArray<Number>> restriction_matrix;
AlignedVector<VectorizedArrayType> restriction_matrix;

/**
* 1d restriction matrix for tensor-product elements.
*/
AlignedVector<VectorizedArray<Number>> restriction_matrix_1d;
AlignedVector<VectorizedArrayType> restriction_matrix_1d;

/**
* ShapeInfo description of the coarse cell. Needed during the
* fast application of hanging-node constraints.
*/
internal::MatrixFreeFunctions::ShapeInfo<VectorizedArray<Number>>
internal::MatrixFreeFunctions::ShapeInfo<VectorizedArrayType>
shape_info_coarse;
};

Expand All @@ -615,22 +613,28 @@ class MGTwoLevelTransfer<dim, LinearAlgebra::distributed::Vector<Number>>
std::vector<MGTransferScheme> schemes;

/**
* Helper class for reading from and writing to global vectors and for
* Helper class for reading from and writing to global coarse vectors and for
* applying constraints.
*/
internal::MatrixFreeFunctions::ConstraintInfo<dim, VectorizedArray<Number>>
constraint_info;
internal::MatrixFreeFunctions::ConstraintInfo<dim, VectorizedArrayType>
constraint_info_coarse;

/**
* Helper class for reading from and writing to global fine vectors.
*/
internal::MatrixFreeFunctions::ConstraintInfo<dim, VectorizedArrayType>
constraint_info_fine;

/**
* Weights for continuous elements.
*/
std::vector<Number> weights;
std::vector<Number> weights; // TODO: vectorize

/**
* Weights for continuous elements, compressed into 3^dim doubles per
* cell if possible.
*/
AlignedVector<VectorizedArray<Number>> weights_compressed;
AlignedVector<VectorizedArrayType> weights_compressed;

/**
* Number of components.
Expand Down