libmesh_exceptions.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_LIBMESH_EXCEPTIONS_H
21 #define LIBMESH_LIBMESH_EXCEPTIONS_H
22 
23 #include "libmesh/libmesh_config.h"
24 
25 #ifdef LIBMESH_ENABLE_EXCEPTIONS
26 #include <stdexcept>
27 #include <string>
28 
29 namespace libMesh {
30 
35  class LogicError : public std::logic_error
36  {
37  public:
38  LogicError() : std::logic_error( "Error in libMesh internal logic" ) {}
39  };
40 
41 
47  class NotImplemented : public std::logic_error
48  {
49  public:
50  NotImplemented() : std::logic_error( "Error: not implemented!" ) {}
51  };
52 
53 
61  class FileError : public std::runtime_error
62  {
63  public:
64  FileError(const std::string& filename) : std::runtime_error( "Error accessing file: " + filename ) {}
65  };
66 
67 
75  class ConvergenceFailure : public std::runtime_error
76  {
77  public:
78  ConvergenceFailure() : std::runtime_error( "Unrecoverable failure to converge" ) {}
79  };
80 
81 
85  class DynamicCastFailure: public std::runtime_error
86  {
87  public:
88  DynamicCastFailure() : std::runtime_error( "Failed dynamic cast!" ) {}
89  };
90 
94  class FloatingPointException: public std::runtime_error
95  {
96  public:
97  FloatingPointException() : std::runtime_error( "libmesh FPE!" ) {}
98  };
99 }
100 
101 #define LIBMESH_THROW(e) do { throw e; } while (0)
102 
103 #else
104 
105 #define LIBMESH_THROW(e) do { std::abort(); } while (0)
106 
107 #endif // LIBMESH_ENABLE_EXCEPTIONS
108 
109 #endif // LIBMESH_LIBMESH_EXCEPTIONS_H

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:05 UTC

Hosted By:
SourceForge.net Logo