From: Vladimir Yushutin Date: Thu, 16 May 2024 19:23:12 +0000 (-0400) Subject: Dynamic Sparsity Pattern must be initialized with locally_relevant_rows. Without... X-Git-Tag: v9.6.0-rc1~254^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51ea5a19d359a2dc2343d24fc551736cce68247c;p=dealii.git 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. --- 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);