From 64dfb964e0a61eada8bb6fb1bd409731189c9346 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 6 Mar 1998 16:11:46 +0000 Subject: [PATCH] Move exceptions.h. git-svn-id: https://svn.dealii.org/trunk@38 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/parameter_handler.h | 2 +- .../deal.II/include/dofs/dof_constraints.h | 2 +- deal.II/deal.II/include/dofs/dof_handler.h | 2 +- deal.II/deal.II/include/fe/fe.h | 2 +- deal.II/deal.II/include/grid/exceptions.h | 405 ------------------ deal.II/deal.II/include/grid/point.h | 2 +- deal.II/deal.II/include/grid/tria_accessor.h | 2 +- deal.II/deal.II/include/grid/tria_iterator.h | 2 +- deal.II/deal.II/include/grid/tria_line.h | 2 +- deal.II/deal.II/include/grid/tria_quad.h | 2 +- deal.II/deal.II/include/numerics/assembler.h | 2 +- deal.II/deal.II/include/numerics/data_io.h | 2 +- 12 files changed, 11 insertions(+), 416 deletions(-) delete mode 100644 deal.II/deal.II/include/grid/exceptions.h diff --git a/deal.II/base/include/base/parameter_handler.h b/deal.II/base/include/base/parameter_handler.h index 6a4dd3bd25..81aff2ad10 100644 --- a/deal.II/base/include/base/parameter_handler.h +++ b/deal.II/base/include/base/parameter_handler.h @@ -12,7 +12,7 @@ template class MultipleParameterLoop; #include #include -#include +#include #ifdef DEBUG # define _G_NO_NRV // don't use GNU's named return values in debug modes diff --git a/deal.II/deal.II/include/dofs/dof_constraints.h b/deal.II/deal.II/include/dofs/dof_constraints.h index 6dda0b669c..305b46f1c4 100644 --- a/deal.II/deal.II/include/dofs/dof_constraints.h +++ b/deal.II/deal.II/include/dofs/dof_constraints.h @@ -7,7 +7,7 @@ #include #include -#include +#include diff --git a/deal.II/deal.II/include/dofs/dof_handler.h b/deal.II/deal.II/include/dofs/dof_handler.h index 1d40095d09..8a72bd2415 100644 --- a/deal.II/deal.II/include/dofs/dof_handler.h +++ b/deal.II/deal.II/include/dofs/dof_handler.h @@ -6,7 +6,7 @@ #include #include -#include +#include diff --git a/deal.II/deal.II/include/fe/fe.h b/deal.II/deal.II/include/fe/fe.h index 0e67b6713c..5006d86763 100644 --- a/deal.II/deal.II/include/fe/fe.h +++ b/deal.II/deal.II/include/fe/fe.h @@ -6,7 +6,7 @@ #include #include -#include +#include #include diff --git a/deal.II/deal.II/include/grid/exceptions.h b/deal.II/deal.II/include/grid/exceptions.h deleted file mode 100644 index d59a48796e..0000000000 --- a/deal.II/deal.II/include/grid/exceptions.h +++ /dev/null @@ -1,405 +0,0 @@ -/*---------------------------- exceptions.h ---------------------------*/ -/* $Id$ */ -#ifndef __exceptions_H -#define __exceptions_H -/*---------------------------- exceptions.h ---------------------------*/ - - -#include - - - -#ifndef __GNUC__ -# define __PRETTY_FUNCTION__ "(unknown)" -#endif - - /** - * This class should be used as a base class for - * all exception classes. Do not use its methods - * and variables directly since the interface - * and mechanism may be subject to change. Rather - * create new exception classes using the - * #DeclException# macro family. - * - * @see Assert - * @see DeclException0 - * @author Wolfgang Bangerth, November 1997 - */ -class ExceptionBase { - public: - ExceptionBase () {}; - /** - * The constructor takes the file in which the - * error happened, the line and the violated - * condition as well as the name of the - * exception class as a #char*# as arguments. - */ - ExceptionBase (const char* f, const int l, const char *func, - const char* c, const char *e) : - file(f), line(l), function(func), cond(c), exc(e) {}; - - /** - * Set the file name and line of where the - * exception appeared as well as the violated - * condition and the name of the exception as - * a char pointer. - */ - void SetFields (const char* f, - const int l, - const char *func, - const char *c, - const char *e) { - file = f; - line = l; - function = func; - cond = c; - exc = e; - }; - /** - * Print out the general part of the error - * information. - */ - void PrintExcData (ostream &out) const { - out << "An error occurred in line <" << line - << "> of file <" << file - << "> in function" << endl - << " " << function << endl - << "The violated condition was: "<< endl - << " " << cond << endl - << "The name and call sequence of the exception was:" << endl - << " " << exc << endl - << "Additional Information: " << endl; - }; - - /** - * Print more specific information about the - * exception which occured. Overload this - * function in your own exception classes. - * Since we use templates rather than derivation - * information, we need not declare this - * function as #virtual# and thus avoid problems - * with virtual functions in classes in which - * all functions are declared inline. - */ - void PrintInfo (ostream &out) const { - out << "(none)" << endl; - }; - - - const char *file; - int line; - const char *function; - const char *cond; - const char *exc; -}; - - - /** - * This routine does the main work for the - * exception generation mechanism. - * - * @see Assert - */ -template -void __IssueError (const char *file, - int line, - const char *function, - const char *cond, - const char *exc, - exc e) { - // Fill the fields of the exception object - e.SetFields (file, line, function, cond, exc); - cerr << "--------------------------------------------------------" - << endl; - // print out general data - e.PrintExcData (cerr); - // print out exception specific data - e.PrintInfo (cerr); - cerr << "--------------------------------------------------------" - << endl; - - abort (); - }; - - - -#ifdef DEBUG //////////////////////////////////////// - -/** - This is the main routine in the exception mechanism. - Use it in the following way: declare an exception - class using the #DeclException# macros (see there), - for example - \begin{verbatim} - DeclException2 (ExcDomain, int, int, - << "Index= " << arg1 << "Upper Bound= " << arg2); - \end{verbatim} - to declare an exception class named #ExcDomain#, which - has two variables as additional information (named - #arg1# and #arg2# by default) and which outputs the - given sequence (which is appended to an #ostream# - variable's name, thus the weird syntax). There are - other #DeclExceptionN# macros for exception classes - with more or no parameters. It is proposed to let start - the name of all exceptions by #Exc...#. - - In your source code write lines like - \begin{verbatim} - Assert (nm, ExcSomewhat());# - - {\bf How it works internally:} - The call #Assert (cond, exc);# - is converted by the preprocessor into the sequence - \begin{verbatim} - if (!(cond)) - __IssueError (__FILE__, - __LINE__, - __PRETTY_FUNCTION__, - #cond, - #exc, - &exc); - \end{verbatim} - i.e. if the given condition is violated, then the file and - line in which the exception occured as well as - the condition itself and the call sequence of the - exception object is transferred. Additionally an object - of the form given by #exc# is created (this is normally an - unnamed object like in #ExcDomain (n, dim)# of class - #ExcDomain#) and transferred to the #__IssueError# - function. - - #__PRETTY__FUNCTION__# is a macro defined only by the GNU CC - compiler and gives the name of the function. If another compiler - is used, we set #__PRETTY_FUNCTION__ = "(unknown)"#. - - In #__IssueError# the given data - is transferred into the #exc# object by calling the - #SetFields# function; after that, the general error info - is printed onto #cerr# using the #PrintError# function of - #exc# and finally the exception specific data is printed - using the user defined function #PrintError# (which is - normally created using the #DeclException (...)# macro - family. - - After printing all this information, #abort()# is called. - This may in future versions be replaced by calling - #throw exc;#. - - If the preprocessor variable #DEBUG# is not set, then nothing - happens, i.e. the macro is expanded to #(void) 0;#. - - @memo Assert that a certain condition is fulfilled, otherwise - issue an error and abort the program. - - @see DeclException0 - @author Wolfgang Bangerth, November 1997 - */ -#define Assert(cond, exc) \ - if (!(cond)) \ - __IssueError (__FILE__, \ - __LINE__, \ - __PRETTY_FUNCTION__, #cond, #exc, exc) - - -#else //////////////////////////////////////// - -#define Assert(cond, exc) \ - (void) 0 -#endif //////////////////////////////////////// - - - -/** - Declare an exception class without any additional parameters. - There is a whole family of #DeclException?# macros - where #?# is to be replaced by the number of additional - parameters (0 to 5 presently). - - The syntax is as follows: - \begin{verbatim} - DeclException2 (ExcDomain, - int, - int, - << " i=" << arg1 << ", m=" << arg2); - \end{verbatim} - The first is the name of the exception class to be created. - The next arguments are the types of the parameters (in this - case there are two type names needed) and finally the output - sequence with which you can print additional information. - - The syntax of the output sequence is a bit weird but gets - clear once you see how this macro is defined: - \begin{verbatim} - class name : public ExceptionBase { - public: - name (const type1 a1, const type2 a2) : - arg1 (a1), arg2(a2) {}; - void PrintInfo (ostream &out) const { - out outsequence << endl; - }; - private: - type1 arg1; - type2 arg2; - }; - \end{verbatim} - The #PrintInfo# function is not declared #virtual# since we would - then create a class with virtual functions and only inlined code. - For this kind of class at least GNU C++ does not know where to put - the virtual method table and the program will not be compiled. - - If declared as specified, you can later use this exception class - in the following manner: - \begin{verbatim} - int i=5; - int m=3; - Assert (i of file . - The violated condition was: - i +#include #include diff --git a/deal.II/deal.II/include/grid/tria_accessor.h b/deal.II/deal.II/include/grid/tria_accessor.h index 4d23f76416..492b049d47 100644 --- a/deal.II/deal.II/include/grid/tria_accessor.h +++ b/deal.II/deal.II/include/grid/tria_accessor.h @@ -5,7 +5,7 @@ /*---------------------------- tria_accessor.h ---------------------------*/ -#include +#include // forward declaration needed diff --git a/deal.II/deal.II/include/grid/tria_iterator.h b/deal.II/deal.II/include/grid/tria_iterator.h index 8686317690..9e260ee31e 100644 --- a/deal.II/deal.II/include/grid/tria_iterator.h +++ b/deal.II/deal.II/include/grid/tria_iterator.h @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include diff --git a/deal.II/deal.II/include/grid/tria_line.h b/deal.II/deal.II/include/grid/tria_line.h index 8d001c7bf2..4a3150907c 100644 --- a/deal.II/deal.II/include/grid/tria_line.h +++ b/deal.II/deal.II/include/grid/tria_line.h @@ -4,7 +4,7 @@ #define __tria_line_H /*---------------------------- tria_line.h ---------------------------*/ -#include +#include /** diff --git a/deal.II/deal.II/include/grid/tria_quad.h b/deal.II/deal.II/include/grid/tria_quad.h index f42f0f0875..faed7dfa1e 100644 --- a/deal.II/deal.II/include/grid/tria_quad.h +++ b/deal.II/deal.II/include/grid/tria_quad.h @@ -5,7 +5,7 @@ /*---------------------------- tria_quad.h ---------------------------*/ -#include +#include /** #Quad#s denote the fundamental entities of triangulations in two dimensions diff --git a/deal.II/deal.II/include/numerics/assembler.h b/deal.II/deal.II/include/numerics/assembler.h index 0d6282aad9..4f6c6ac987 100644 --- a/deal.II/deal.II/include/numerics/assembler.h +++ b/deal.II/deal.II/include/numerics/assembler.h @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include diff --git a/deal.II/deal.II/include/numerics/data_io.h b/deal.II/deal.II/include/numerics/data_io.h index 8925a7241f..7751111e5d 100644 --- a/deal.II/deal.II/include/numerics/data_io.h +++ b/deal.II/deal.II/include/numerics/data_io.h @@ -4,7 +4,7 @@ #define __data_io_H /*---------------------------- io.h ---------------------------*/ -#include +#include #include #ifdef DEBUG -- 2.39.5