From 70bacfe6d49ae0725bcc15fbc614348774c149e0 Mon Sep 17 00:00:00 2001 From: Stefano Zampini Date: Wed, 12 Apr 2023 00:53:51 +0300 Subject: [PATCH] add assert --- .../lac/petsc_parallel_block_sparse_matrix.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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]), -- 2.39.5