From 88344f1e1e9aa731f657ef0d0a8adf71a474db91 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 24 Aug 2016 10:27:36 -0600 Subject: [PATCH] Provide better error messages. --- include/deal.II/lac/chunk_sparsity_pattern.h | 14 ++++++++++---- .../deal.II/lac/sparse_decomposition.templates.h | 3 ++- include/deal.II/lac/sparsity_pattern.h | 14 ++++++-------- include/deal.II/lac/sparsity_tools.h | 5 ++++- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/include/deal.II/lac/chunk_sparsity_pattern.h b/include/deal.II/lac/chunk_sparsity_pattern.h index 36ac6d5039..5f8b4d99ab 100644 --- a/include/deal.II/lac/chunk_sparsity_pattern.h +++ b/include/deal.II/lac/chunk_sparsity_pattern.h @@ -734,13 +734,19 @@ public: << "(Maximum number of entries for this row: " << arg2 << "; maybe the matrix is already compressed?)"); /** - * Exception + * The operation is only allowed after the SparsityPattern has been set up + * and compress() was called. */ - DeclException0 (ExcNotCompressed); + DeclExceptionMsg (ExcNotCompressed, + "The operation you attempted is only allowed after the SparsityPattern " + "has been set up and compress() was called."); /** - * Exception + * This operation changes the structure of the SparsityPattern and is not + * possible after compress() has been called. */ - DeclException0 (ExcMatrixIsCompressed); + DeclExceptionMsg (ExcMatrixIsCompressed, + "The operation you attempted changes the structure of the SparsityPattern " + "and is not possible after compress() has been called."); /** * Exception */ diff --git a/include/deal.II/lac/sparse_decomposition.templates.h b/include/deal.II/lac/sparse_decomposition.templates.h index 665e9cb760..3f871ad8e6 100644 --- a/include/deal.II/lac/sparse_decomposition.templates.h +++ b/include/deal.II/lac/sparse_decomposition.templates.h @@ -118,7 +118,8 @@ void SparseLUDecomposition::initialize ( // now use this sparsity pattern Assert (sparsity_pattern_to_use->n_rows()==sparsity_pattern_to_use->n_cols(), - typename SparsityPattern::ExcDiagonalNotOptimized()); + ExcMessage ("It is not possible to compute this matrix decomposition for " + "matrices that are not square.")); { std::vector tmp; tmp.swap (prebuilt_lower_bound); diff --git a/include/deal.II/lac/sparsity_pattern.h b/include/deal.II/lac/sparsity_pattern.h index a5645e05a2..104d40cb56 100644 --- a/include/deal.II/lac/sparsity_pattern.h +++ b/include/deal.II/lac/sparsity_pattern.h @@ -979,22 +979,20 @@ public: * The operation is only allowed after the SparsityPattern has been set up * and compress() was called. */ - DeclException0 (ExcNotCompressed); + DeclExceptionMsg (ExcNotCompressed, + "The operation you attempted is only allowed after the SparsityPattern " + "has been set up and compress() was called."); /** * This operation changes the structure of the SparsityPattern and is not * possible after compress() has been called. */ - DeclException0 (ExcMatrixIsCompressed); + DeclExceptionMsg (ExcMatrixIsCompressed, + "The operation you attempted changes the structure of the SparsityPattern " + "and is not possible after compress() has been called."); /** * Exception */ DeclException0 (ExcInvalidConstructorCall); - /** - * This exception is thrown if the matrix does not follow the convention of - * storing diagonal elements first in row. Refer to - * SparityPattern::optimize_diagonal() for more information. - */ - DeclException0 (ExcDiagonalNotOptimized); /** * Exception */ diff --git a/include/deal.II/lac/sparsity_tools.h b/include/deal.II/lac/sparsity_tools.h index e5a820499c..4f1061c9c4 100644 --- a/include/deal.II/lac/sparsity_tools.h +++ b/include/deal.II/lac/sparsity_tools.h @@ -225,7 +225,10 @@ namespace SparsityTools /** * Exception */ - DeclException0 (ExcMETISNotInstalled); + DeclExceptionMsg (ExcMETISNotInstalled, + "The function you called requires METIS, but you did not " + "configure deal.II with METIS."); + /** * Exception */ -- 2.39.5