From a506ab51f9818f88e5d182d275264a0679066578 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sun, 11 Oct 2015 17:28:31 -0500 Subject: [PATCH] Improve an error message. --- include/deal.II/lac/chunk_sparse_matrix.h | 18 ++++++++++++++++-- include/deal.II/lac/sparse_matrix.h | 18 ++++++++++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/include/deal.II/lac/chunk_sparse_matrix.h b/include/deal.II/lac/chunk_sparse_matrix.h index 73dc8e6894..039741a956 100644 --- a/include/deal.II/lac/chunk_sparse_matrix.h +++ b/include/deal.II/lac/chunk_sparse_matrix.h @@ -1284,8 +1284,22 @@ public: */ DeclException2 (ExcInvalidIndex, int, int, - << "The entry with index <" << arg1 << ',' << arg2 - << "> does not exist."); + << "You are trying to access the matrix entry with index <" + << arg1 << ',' << arg2 + << ">, but this entry does not exist in the sparsity pattern" + "of this matrix." + "\n\n" + "The most common cause for this problem is that you used " + "a method to build the sparsity pattern that did not " + "(completely) take into account all of the entries you " + "will later try to write into. An example would be " + "building a sparsity pattern that does not include " + "the entries you will write into due to constraint " + "on degrees of freedom such as handing nodes or periodic " + "boundary conditions. In such cases, building the " + "sparsity pattern will succeed, but you will get errors " + "such as the current one at one point or other when " + "trying to write into the entries of the matrix."); /** * Exception */ diff --git a/include/deal.II/lac/sparse_matrix.h b/include/deal.II/lac/sparse_matrix.h index 86988585a4..e6ac726f5c 100644 --- a/include/deal.II/lac/sparse_matrix.h +++ b/include/deal.II/lac/sparse_matrix.h @@ -1508,8 +1508,22 @@ public: */ DeclException2 (ExcInvalidIndex, int, int, - << "The entry with index <" << arg1 << ',' << arg2 - << "> does not exist."); + << "You are trying to access the matrix entry with index <" + << arg1 << ',' << arg2 + << ">, but this entry does not exist in the sparsity pattern" + "of this matrix." + "\n\n" + "The most common cause for this problem is that you used " + "a method to build the sparsity pattern that did not " + "(completely) take into account all of the entries you " + "will later try to write into. An example would be " + "building a sparsity pattern that does not include " + "the entries you will write into due to constraint " + "on degrees of freedom such as handing nodes or periodic " + "boundary conditions. In such cases, building the " + "sparsity pattern will succeed, but you will get errors " + "such as the current one at one point or other when " + "trying to write into the entries of the matrix."); /** * Exception */ -- 2.39.5