From cc6deead72a7f9727c911e534adc08bd82b203dd Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sun, 15 Mar 2015 00:50:28 -0500 Subject: [PATCH] Improve error messages in DerivativeApproximation. --- .../deal.II/numerics/derivative_approximation.h | 17 ++++++++++++----- source/numerics/derivative_approximation.cc | 4 ++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/deal.II/numerics/derivative_approximation.h b/include/deal.II/numerics/derivative_approximation.h index fb729bb89a..9d3d33360d 100644 --- a/include/deal.II/numerics/derivative_approximation.h +++ b/include/deal.II/numerics/derivative_approximation.h @@ -25,7 +25,7 @@ #include #include #ifdef _MSC_VER -#include +# include #endif #include @@ -284,14 +284,21 @@ namespace DerivativeApproximation /** * Exception */ - DeclException2 (ExcInvalidVectorLength, + DeclException2 (ExcVectorLengthVsNActiveCells, int, int, - << "Vector has length " << arg1 << ", but should have " - << arg2); + << "The output vector needs to have a size equal " + "to the number of active cells of your triangulation " + "but has length " << arg1 << "There are " + << arg2 << " active cells in your triangulation."); /** * Exception */ - DeclException0 (ExcInsufficientDirections); + DeclExceptionMsg (ExcInsufficientDirections, + "We have encountered a cell on which the number of linearly " + "independent directions that span the matrix Y (discussed " + "in the documentation of the DerivativeApproximation " + "class) is not equal to dim. The matrix Y then is " + "rank deficient and can not be inverted."); } diff --git a/source/numerics/derivative_approximation.cc b/source/numerics/derivative_approximation.cc index 7c7653d18b..231f5d0ab6 100644 --- a/source/numerics/derivative_approximation.cc +++ b/source/numerics/derivative_approximation.cc @@ -974,8 +974,8 @@ namespace DerivativeApproximation Vector &derivative_norm) { Assert (derivative_norm.size() == dof_handler.get_tria().n_active_cells(), - ExcInvalidVectorLength (derivative_norm.size(), - dof_handler.get_tria().n_active_cells())); + ExcVectorLengthVsNActiveCells (derivative_norm.size(), + dof_handler.get_tria().n_active_cells())); Assert (component < dof_handler.get_fe().n_components(), ExcIndexRange (component, 0, dof_handler.get_fe().n_components())); -- 2.39.5