From 51ea5a19d359a2dc2343d24fc551736cce68247c Mon Sep 17 00:00:00 2001 From: Vladimir Yushutin Date: Thu, 16 May 2024 15:23:12 -0400 Subject: [PATCH] Dynamic Sparsity Pattern must be initialized with locally_relevant_rows. Without the suggested assertion, one could easily make a crucial mistake of initializing the sparsity pattern with global DoFs instead of local DoFs. --- source/lac/sparsity_tools.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/lac/sparsity_tools.cc b/source/lac/sparsity_tools.cc index 348358f4ff..a57bada4a1 100644 --- a/source/lac/sparsity_tools.cc +++ b/source/lac/sparsity_tools.cc @@ -1022,6 +1022,13 @@ namespace SparsityTools const MPI_Comm mpi_comm, const IndexSet &locally_relevant_rows) { + IndexSet rows_dsp = dsp.row_index_set(); + rows_dsp.subtract_set(locally_relevant_rows); + AssertThrow( + rows_dsp.n_elements() == 0, + ExcMessage( + "Dynamic Sparsity Pattern must be initialized with locally_relevant_rows.")); + IndexSet requested_rows(locally_relevant_rows); requested_rows.subtract_set(locally_owned_rows); -- 2.39.5