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
MGTransferMF: check compatibility of DoFHandlers #16088
Conversation
* is required to be able to use MGTransferMF and | ||
* MGTransferMatrixFree as template argument. | ||
* Interpolate fine-mesh field @p src to each multigrid level in | ||
* @p dof_handler and store the result in @p dst. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does dof_handler
in this comment refer to? I assume you mean the one held in the class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the comments in interpolate_to_mg()
, since they are outdated. Could you check if the notes are helpful.
include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h
Outdated
Show resolved
Hide resolved
if (const auto t = dynamic_cast< | ||
const MGTwoLevelTransfer<dim, | ||
LinearAlgebra::distributed::Vector<Number>> *>( | ||
this->transfer[this->transfer.max_level()].get())) | ||
{ | ||
return {t->dof_handler_fine, t->mg_level_fine}; | ||
} | ||
else if (const auto t = dynamic_cast<const MGTwoLevelTransferNonNested< | ||
dim, | ||
LinearAlgebra::distributed::Vector<Number>> *>( | ||
this->transfer[this->transfer.max_level()].get())) | ||
{ | ||
return {t->dof_handler_fine, t->mg_level_fine}; | ||
} | ||
else | ||
{ | ||
Assert(false, ExcNotImplemented()); | ||
return {nullptr, numbers::invalid_unsigned_int}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the logic in this function is harder to read than necessary because you have two different return values but four cases. Can that we re-organized?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you suggest? The problem is that the base class of MGTwoLevelTransfer
and MGTwoLevelTransferNonNested
does not have dim
as template argument so that we need to cast to the two implementations.
/rebuild |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let us go with this solution. I did reason about combining the if
statements in the one open discussion a bit more, but it does not make a big difference, so let's not bother with it.
When using multigrid as preconditioner, it is possible that the outer solver and multigrid are set up with different numberings in the DoFHandlers (e.g. by using
DoFRenumbering::matrix_free_data_locality
once withMatrixFree
set up withdouble
and once withfloat
). In this case, it is not enough to simply copy the vectors duringMGTransferMF::copy_to_mg()
,MGTransferMF::copy_to_mg()
, andMGTransferMF::interpolate_to_mg()
, but one needs to permute the data. This is implemented now for global coarsening. A similar infrastructure was already available for local smoothing.