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
Function to restrict matrices #14096
Conversation
template <typename T> | ||
std::tuple<T, T> | ||
prefix_sum(const T & value, | ||
const MPI_Comm &comm, | ||
const bool exclusive = true) |
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.
@kronbichler Do you thinks such a function would be helpful? We have used prefix sums already at so many places! If yes, I would generalize the function so that it also works for vectors (as we need to process data for all multigrid levels simultaneously).
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 that function would make sense, yes.
Could we put these in |
I know the |
Regarding the namespace, I have no strong opinion. |
@kronbichler I went through the
which is the following way: dealii/include/deal.II/lac/full_matrix.h Lines 1207 to 1225 in 900dc61
That code, however, is not able to handle the two major issues tackled in the new functions in this PR: dealii/include/deal.II/lac/sparse_matrix_tools.h Lines 130 to 134 in 0579b4c
|
0579b4c
to
932282b
Compare
I have updated PR and removed the dependency to #14124. Ready from my side. |
8906844
to
0e49f20
Compare
* is performed to iterativly solve a system of type $Au=f$. | ||
* | ||
* @warning This is a collective call that needs to be executed by all | ||
* processes in the communicator. |
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.
Can you explain which communicator you refer to? The one of the system_matrix
?
MPI_Comm | ||
get_mpi_communicator(const SparseMatrixType &sparse_matrix) | ||
{ | ||
return sparse_matrix.get_mpi_communicator(); |
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 this needs to be adjusted, because we also have ChunkSparseMatrix
and some similar classes, that are similar to dealii::SparseMatrix
.
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.
Done.
if (indices[c].size() == 0) | ||
continue; |
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 this needs to be documented - we support the case of empty indices, in which case the result is also empty (clearly).
0e49f20
to
6d118c3
Compare
@kronbichler I have fixed the typos and updated the documentation. |
This PR introduces functions that allow to extract parts of a distributed sparse matrix. In the context of Schwarz and Domain Decomposition methods this is known as restriction:
A_i = R_i A R_i^T
, whereR_i
is Boolean matrix. The granularity of the restriction is either on a cell level (restrict_to_cells()
) or can be specified by an index set (restrict_to_serial_sparse_matrix()
).I have create a new namespace with the name
SparseMatrixTools
. Is there already a more suitable place for such functionality?