From: Stefano Zampini Date: Tue, 11 Apr 2023 21:53:51 +0000 (+0300) Subject: add assert X-Git-Tag: v9.5.0-rc1~336^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70bacfe6d49ae0725bcc15fbc614348774c149e0;p=dealii.git add assert --- diff --git a/source/lac/petsc_parallel_block_sparse_matrix.cc b/source/lac/petsc_parallel_block_sparse_matrix.cc index f75fb5513d..fdaa00f15f 100644 --- a/source/lac/petsc_parallel_block_sparse_matrix.cc +++ b/source/lac/petsc_parallel_block_sparse_matrix.cc @@ -192,6 +192,24 @@ namespace PETScWrappers { if (!this->sub_objects[r][c]) { + Assert( + row_sizes[r] != size_type(-1), + ExcMessage( + "When passing empty sub-blocks of a block matrix, you need to make " + "sure that at least one block in each block row and block column is " + "non-empty. However, block row " + + std::to_string(r) + + " is completely empty " + "and so it is not possible to determine how many rows it should have.")); + Assert( + col_sizes[c] != size_type(-1), + ExcMessage( + "When passing empty sub-blocks of a block matrix, you need to make " + "sure that at least one block in each block row and block column is " + "non-empty. However, block column " + + std::to_string(c) + + " is completely empty " + "and so it is not possible to determine how many columns it should have.")); Mat dummy = ::create_dummy_mat( comm, static_cast(row_local_sizes[r]),