]> https://gitweb.dealii.org/ - dealii.git/commitdiff
more exceptions
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Wed, 23 Mar 2005 02:57:32 +0000 (02:57 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Wed, 23 Mar 2005 02:57:32 +0000 (02:57 +0000)
git-svn-id: https://svn.dealii.org/trunk@10209 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/data_out_base.h
deal.II/base/include/base/function.h
deal.II/base/include/base/polynomial.h
deal.II/base/include/base/quadrature.h
deal.II/base/source/data_out_base.cc
deal.II/base/source/function.cc
deal.II/base/source/polynomial.cc
deal.II/base/source/quadrature.cc

index 496f26f569b4cb57172cc89a5c281414e430fc85..abf7fefb53ea30ba43bf51c5ccf6386c46bf081d 100644 (file)
@@ -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);
                                     /**
index 2e99dec27e110ac9d803a3704d2e66bc46decced..db4b953b9739ddbdba3440c3b526d435ca367761 100644 (file)
@@ -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);
                                     //@}
 };
 
index fad282ff184679bc6835e6b36e18bec96e9f6208..69132c77d5d6f38ef40b809fe3d913bbc1d9e586 100644 (file)
@@ -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<number>::degree () const
   {
-    Assert (coefficients.size()>0, ExcVoidPolynomial());
+    Assert (coefficients.size()>0, ExcEmptyObject());
     return coefficients.size() - 1;
   }
 }
index 6c238abe250d9bc588ff004c37d5124876526037..575904166982d9447c34b601db2a6aa887d4795d 100644 (file)
@@ -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<dim>
 
                                     /** @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
index 077e346dde465591170e8800ae744cf763036077..ab92b15abb8579d1cf0d625f7a91f79996210c40 100644 (file)
@@ -41,7 +41,7 @@ DataOutBase::Patch<dim,spacedim>::Patch ()
   for (unsigned int i=0;i<GeometryInfo<dim>::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<Patch<dim,spacedim> > &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<Patch<dim,spacedim> > &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<Patch<dim,spacedim> > &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<Patch<dim,spacedim> > &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<Patch<dim,spacedim> > &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<Patch<dim,spacedim> > &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<Patch<dim,spacedim> > &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<Patch<dim,spacedim> > &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<Patch<dim,spacedim> > &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<Patch<dim,spacedim> > &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<Patch<dim,spacedim> >
                                   // 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<Patch<dim,spacedim> > &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::vector<Patch<dim,spacedi
       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 ?
index 2c7dca438e56aa6dccad61e0f9b956a48e0fd1dc..428c730a8da0e8414bda70afe70223414f968cfe 100644 (file)
@@ -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 <base/function.h>
@@ -36,7 +36,7 @@ Function<dim>::Function (const unsigned int n_components,
                                    // errors later on (happened to me in fact
                                    // :-)
   Assert (n_components > 0,
-          ExcInvalidNumberOfComponents(n_components));
+          ExcZero());
 }
 
 
index b7528f8d031048b1484c061e0a4b0c03e532e98a..65e7500bdb4bc8f57aadfe4373ce523d1c1d546f 100644 (file)
@@ -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 <base/polynomial.h>
@@ -53,7 +53,7 @@ namespace Polynomials
   number
   Polynomial<number>::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<number>::value (const number         x,
                              std::vector<number> &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();
   
   
index f076967f3bad903d37f89b2505575a1348fa686b..fe1e4025f30cba3ad86c173a1b3695ab3ec8d280 100644 (file)
@@ -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 <grid/geometry_info.h>
@@ -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; i<this->n_quadrature_points; ++i)
     sum_of_weights += this->weight(i);
   Assert (std::fabs(sum_of_weights-1) < 1e-15,
-         ExcSumOfWeightsNotOne());
+         ExcInternalError());
 #endif
 }
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.