From: Guido Kanschat Date: Wed, 23 Mar 2005 02:57:32 +0000 (+0000) Subject: more exceptions X-Git-Tag: v8.0.0~14329 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15e4050f86f35174a475afae2b0bd1dd90c9d96f;p=dealii.git more exceptions git-svn-id: https://svn.dealii.org/trunk@10209 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/include/base/data_out_base.h b/deal.II/base/include/base/data_out_base.h index 496f26f569..abf7fefb53 100644 --- a/deal.II/base/include/base/data_out_base.h +++ b/deal.II/base/include/base/data_out_base.h @@ -1436,14 +1436,6 @@ class DataOutBase /** @addtogroup Exceptions * @{ */ - /** - * Exception - */ - DeclException2 (ExcUnexpectedNumberOfDatasets, - int, int, - << "The number of data sets on this patch is " << arg1 - << ", but we expected " << arg2); - /** * Exception */ @@ -1452,22 +1444,9 @@ class DataOutBase << "The number of points in this data set is " << arg1 << ", but we expected " << arg2 << " in each space direction."); /** - * Exception - */ - DeclException2 (ExcInvalidVectorNumber, - int, int, - << "The number " << arg1 << " of the vector to be used for " - << "this information is invalid, since there are only " - << arg2 << " data sets."); - /** - * Exception - */ - DeclException2 (ExcUnexpectedNumberOfSubdivisions, - int, int, - << "The number of subdivisions is " << arg1 - << ", but we excepted " << arg2<< " for bicubic patch"); - /** - * Exception + * An output function did not + * receive any patches for + * writing. */ DeclException0 (ExcNoPatches); /** diff --git a/deal.II/base/include/base/function.h b/deal.II/base/include/base/function.h index 2e99dec27e..db4b953b97 100644 --- a/deal.II/base/include/base/function.h +++ b/deal.II/base/include/base/function.h @@ -1,15 +1,15 @@ -//---------------------------- function.h --------------------------- +//--------------------------------------------------------------------------- // $Id$ // Version: $Name$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal authors +// Copyright (C) 1998 - 2005 by the deal authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer // to the file deal.II/doc/license.html for the text and // further information on this license. // -//---------------------------- function.h --------------------------- +//--------------------------------------------------------------------------- #ifndef __deal2__function_h #define __deal2__function_h @@ -346,13 +346,6 @@ class Function : public FunctionTime, << "number of components. However, here the left operand " << "has " << arg1 << " components, and the right operand " << arg2 << " components."); - /** - * Exception - */ - DeclException1 (ExcInvalidNumberOfComponents, - int, - << "The number of components of a function object must " - << "at least be one, but you gave " << arg1); //@} }; diff --git a/deal.II/base/include/base/polynomial.h b/deal.II/base/include/base/polynomial.h index fad282ff18..69132c77d5 100644 --- a/deal.II/base/include/base/polynomial.h +++ b/deal.II/base/include/base/polynomial.h @@ -1,15 +1,15 @@ -//---------------------------- polynomial.h --------------------------- +//--------------------------------------------------------------------------- // $Id$ // Version: $Name$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004 by the deal.II authors +// Copyright (C) 2000 - 2005 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer // to the file deal.II/doc/license.html for the text and // further information on this license. // -//---------------------------- polynomial.h --------------------------- +//--------------------------------------------------------------------------- #ifndef __deal2__polynomial_h #define __deal2__polynomial_h @@ -178,19 +178,6 @@ namespace Polynomials */ void print(std::ostream& out) const; - /** @addtogroup Exceptions - * @{ */ - - /** - * Exception - */ - DeclException0 (ExcEmptyArray); - - /** - * Exception - */ - DeclException0 (ExcVoidPolynomial); - //@} protected: /** @@ -529,7 +516,7 @@ namespace Polynomials unsigned int Polynomial::degree () const { - Assert (coefficients.size()>0, ExcVoidPolynomial()); + Assert (coefficients.size()>0, ExcEmptyObject()); return coefficients.size() - 1; } } diff --git a/deal.II/base/include/base/quadrature.h b/deal.II/base/include/base/quadrature.h index 6c238abe25..5759041669 100644 --- a/deal.II/base/include/base/quadrature.h +++ b/deal.II/base/include/base/quadrature.h @@ -1,15 +1,15 @@ -//---------------------------- quadrature.h --------------------------- +//--------------------------------------------------------------------------- // $Id$ // Version: $Name$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal authors +// Copyright (C) 1998 - 2005 by the deal authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer // to the file deal.II/doc/license.html for the text and // further information on this license. // -//---------------------------- quadrature.h --------------------------- +//--------------------------------------------------------------------------- #ifndef __deal2__quadrature_h #define __deal2__quadrature_h @@ -242,24 +242,10 @@ class QIterated : public Quadrature /** @addtogroup Exceptions * @{ */ - - - /** - * Exception - */ - DeclException0 (ExcSumOfWeightsNotOne); /** * Exception */ DeclException0 (ExcInvalidQuadratureFormula); - /** - * Exception - */ - DeclException1 (ExcInvalidNumberOfCopies, - int, - << "The numbers of copies (" << arg1 - << ") of the quadrature formula is not valid."); - //@} private: /** * Check whether the given diff --git a/deal.II/base/source/data_out_base.cc b/deal.II/base/source/data_out_base.cc index 077e346dde..ab92b15abb 100644 --- a/deal.II/base/source/data_out_base.cc +++ b/deal.II/base/source/data_out_base.cc @@ -41,7 +41,7 @@ DataOutBase::Patch::Patch () for (unsigned int i=0;i::faces_per_cell;++i) neighbors[i] = no_neighbor; - Assert (dim<=spacedim, ExcInvalidCombinationOfDimensions(dim,spacedim)); + Assert (dim<=spacedim, ExcIndexRange(dim,0,spacedim)); Assert (spacedim<=3, ExcNotImplemented()); } @@ -813,7 +813,7 @@ void DataOutBase::write_ucd (const std::vector > &patches, const unsigned int n_subdivisions = patch->n_subdivisions; Assert (patch->data.n_rows() == n_data_sets, - ExcUnexpectedNumberOfDatasets (patch->data.n_rows(), n_data_sets)); + ExcDimensionMismatch (patch->data.n_rows(), n_data_sets)); Assert (patch->data.n_cols() == (dim==1 ? n_subdivisions+1 : (dim==2 ? @@ -1297,7 +1297,7 @@ void DataOutBase::write_dx (const std::vector > &patches, const unsigned int n_subdivisions = patch->n_subdivisions; Assert (patch->data.n_rows() == n_data_sets, - ExcUnexpectedNumberOfDatasets (patch->data.n_rows(), n_data_sets)); + ExcDimensionMismatch (patch->data.n_rows(), n_data_sets)); Assert (patch->data.n_cols() == (dim==1 ? n_subdivisions+1 : (dim==2 ? @@ -1457,7 +1457,7 @@ void DataOutBase::write_gnuplot (const std::vector > &patche const unsigned int n_subdivisions = patch->n_subdivisions; Assert (patch->data.n_rows() == n_data_sets, - ExcUnexpectedNumberOfDatasets (patch->data.n_rows(), n_data_sets)); + ExcDimensionMismatch (patch->data.n_rows(), n_data_sets)); Assert (patch->data.n_cols() == (dim==1 ? n_subdivisions+1 : (dim==2 ? @@ -1756,7 +1756,7 @@ void DataOutBase::write_povray (const std::vector > &patches const unsigned int n_subdivisions = patch->n_subdivisions; Assert (patch->data.n_rows() == n_data_sets, - ExcUnexpectedNumberOfDatasets (patch->data.n_rows(), n_data_sets)); + ExcDimensionMismatch (patch->data.n_rows(), n_data_sets)); Assert (patch->data.n_cols() == (dim==1 ? n_subdivisions+1 : (dim==2 ? @@ -1806,7 +1806,7 @@ void DataOutBase::write_povray (const std::vector > &patches const unsigned int n_subdivisions = patch->n_subdivisions; Assert (patch->data.n_rows() == n_data_sets, - ExcUnexpectedNumberOfDatasets (patch->data.n_rows(), n_data_sets)); + ExcDimensionMismatch (patch->data.n_rows(), n_data_sets)); Assert (patch->data.n_cols() == (dim==1 ? n_subdivisions+1 : (dim==2 ? @@ -2011,7 +2011,7 @@ void DataOutBase::write_povray (const std::vector > &patches } else { // writing bicubic_patch - Assert (n_subdivisions==3, ExcUnexpectedNumberOfSubdivisions(n_subdivisions,3)); + Assert (n_subdivisions==3, ExcDimensionMismatch(n_subdivisions,3)); out << std::endl << "bicubic_patch {" << std::endl << " type 0" << std::endl @@ -2130,8 +2130,8 @@ void DataOutBase::write_eps (const std::vector > &patches, case 2: Assert ((flags.height_vector < patch->data.n_rows()) || patch->data.n_rows() == 0, - ExcInvalidVectorNumber (flags.height_vector, - patch->data.n_rows())); + ExcIndexRange (flags.height_vector, 0, + patch->data.n_rows())); heights[0] = patch->data.n_rows() != 0 ? patch->data(flags.height_vector,i*(n_subdivisions+1) + j) * flags.z_scaling : 0; @@ -2226,8 +2226,8 @@ void DataOutBase::write_eps (const std::vector > &patches, { Assert ((flags.color_vector < patch->data.n_rows()) || patch->data.n_rows() == 0, - ExcInvalidVectorNumber (flags.color_vector, - patch->data.n_rows())); + ExcIndexRange (flags.color_vector, 0, + patch->data.n_rows())); const double color_values[4] = { patch->data.n_rows() != 0 ? patch->data(flags.color_vector,i*(n_subdivisions+1) + j) : 1, @@ -2441,7 +2441,7 @@ void DataOutBase::write_gmv (const std::vector > &patches, // other patches are made in // write_gmv_reorder_data_vectors Assert (n_data_sets == patches[0].data.n_rows(), - ExcUnexpectedNumberOfDatasets (patches[0].data.n_rows(), n_data_sets)); + ExcDimensionMismatch (patches[0].data.n_rows(), n_data_sets)); /////////////////////// @@ -2752,7 +2752,7 @@ void DataOutBase::write_tecplot (const std::vector > &patche // other patches are made in // write_gmv_reorder_data_vectors Assert (n_data_sets == patches[0].data.n_rows(), - ExcUnexpectedNumberOfDatasets (patches[0].data.n_rows(), n_data_sets)); + ExcDimensionMismatch (patches[0].data.n_rows(), n_data_sets)); @@ -3206,7 +3206,7 @@ void DataOutBase::write_tecplot_binary (const std::vector > // other patches are made in // write_gmv_reorder_data_vectors Assert (n_data_sets == patches[0].data.n_rows(), - ExcUnexpectedNumberOfDatasets (patches[0].data.n_rows(), n_data_sets)); + ExcDimensionMismatch (patches[0].data.n_rows(), n_data_sets)); @@ -3564,7 +3564,7 @@ void DataOutBase::write_vtk (const std::vector > &patches, // other patches are made in // write_gmv_reorder_data_vectors Assert (n_data_sets == patches[0].data.n_rows(), - ExcUnexpectedNumberOfDatasets (patches[0].data.n_rows(), n_data_sets)); + ExcDimensionMismatch (patches[0].data.n_rows(), n_data_sets)); /////////////////////// @@ -3900,7 +3900,7 @@ DataOutBase::write_gmv_reorder_data_vectors (const std::vectorn_subdivisions; Assert (patch->data.n_rows() == n_data_sets, - ExcUnexpectedNumberOfDatasets (patch->data.n_rows(), n_data_sets)); + ExcDimensionMismatch (patch->data.n_rows(), n_data_sets)); Assert (patch->data.n_cols() == (dim==1 ? n_subdivisions+1 : (dim==2 ? diff --git a/deal.II/base/source/function.cc b/deal.II/base/source/function.cc index 2c7dca438e..428c730a8d 100644 --- a/deal.II/base/source/function.cc +++ b/deal.II/base/source/function.cc @@ -1,15 +1,15 @@ -//---------------------------- function.cc --------------------------- +//--------------------------------------------------------------------------- // $Id$ // Version: $Name$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors +// Copyright (C) 1998 - 2005 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer // to the file deal.II/doc/license.html for the text and // further information on this license. // -//---------------------------- function.cc --------------------------- +//--------------------------------------------------------------------------- #include @@ -36,7 +36,7 @@ Function::Function (const unsigned int n_components, // errors later on (happened to me in fact // :-) Assert (n_components > 0, - ExcInvalidNumberOfComponents(n_components)); + ExcZero()); } diff --git a/deal.II/base/source/polynomial.cc b/deal.II/base/source/polynomial.cc index b7528f8d03..65e7500bdb 100644 --- a/deal.II/base/source/polynomial.cc +++ b/deal.II/base/source/polynomial.cc @@ -1,15 +1,15 @@ -//---------------------------- polynomial.cc ----------------------- +//--------------------------------------------------------------------------- // $Id$ // Version: $Name$ // -// Copyright (C) 2000, 2001, 2002, 2003 by the deal.II authors +// Copyright (C) 2000 - 2005 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer // to the file deal.II/doc/license.html for the text and // further information on this license. // -//---------------------------- polynomial.cc ---------------------- +//--------------------------------------------------------------------------- #include @@ -53,7 +53,7 @@ namespace Polynomials number Polynomial::value (const number x) const { - Assert (coefficients.size() > 0, ExcVoidPolynomial()); + Assert (coefficients.size() > 0, ExcEmptyObject()); const unsigned int m=coefficients.size(); // Horner scheme @@ -71,8 +71,8 @@ namespace Polynomials Polynomial::value (const number x, std::vector &values) const { - Assert (coefficients.size() > 0, ExcVoidPolynomial()); - Assert (values.size() > 0, ExcEmptyArray()); + Assert (coefficients.size() > 0, ExcEmptyObject()); + Assert (values.size() > 0, ExcZero()); const unsigned int values_size=values.size(); diff --git a/deal.II/base/source/quadrature.cc b/deal.II/base/source/quadrature.cc index f076967f3b..fe1e4025f3 100644 --- a/deal.II/base/source/quadrature.cc +++ b/deal.II/base/source/quadrature.cc @@ -1,15 +1,15 @@ -//---------------------------- quadrature.cc --------------------------- +//--------------------------------------------------------------------------- // $Id$ // Version: $Name$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors +// Copyright (C) 1998 - 2005 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer // to the file deal.II/doc/license.html for the text and // further information on this license. // -//---------------------------- quadrature.cc --------------------------- +//--------------------------------------------------------------------------- #include @@ -1022,7 +1022,7 @@ QIterated<1>::QIterated (const Quadrature<1> &base_quadrature, (base_quadrature.n_quadrature_points-1) * n_copies + 1 : base_quadrature.n_quadrature_points * n_copies) { - Assert (n_copies >= 1, ExcInvalidNumberOfCopies(n_copies)); + Assert (n_copies > 0, ExcZero()); if (!uses_both_endpoints(base_quadrature)) // we don't have to skip some @@ -1066,7 +1066,7 @@ QIterated<1>::QIterated (const Quadrature<1> &base_quadrature, }; // scale the weight correctly double_point_weight /= n_copies; - +//TODO:[WB] The following assertion looks strange. InternalError??? // make sure the base quadrature formula // has only one quadrature point // per end point @@ -1110,7 +1110,7 @@ QIterated<1>::QIterated (const Quadrature<1> &base_quadrature, for (unsigned int i=0; in_quadrature_points; ++i) sum_of_weights += this->weight(i); Assert (std::fabs(sum_of_weights-1) < 1e-15, - ExcSumOfWeightsNotOne()); + ExcInternalError()); #endif }