$extrastylesheet
00001 // The libMesh Finite Element Library. 00002 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner 00003 00004 // This library is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public 00006 // License as published by the Free Software Foundation; either 00007 // version 2.1 of the License, or (at your option) any later version. 00008 00009 // This library is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // Lesser General Public License for more details. 00013 00014 // You should have received a copy of the GNU Lesser General Public 00015 // License along with this library; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 00019 00020 #ifndef LIBMESH_LIBMESH_EXCEPTIONS_H 00021 #define LIBMESH_LIBMESH_EXCEPTIONS_H 00022 00023 #include "libmesh/libmesh_config.h" 00024 00025 #ifdef LIBMESH_ENABLE_EXCEPTIONS 00026 #include <stdexcept> 00027 #include <string> 00028 00029 namespace libMesh { 00030 00035 class LogicError : public std::logic_error 00036 { 00037 public: 00038 LogicError() : std::logic_error( "Error in libMesh internal logic" ) {} 00039 }; 00040 00041 00047 class NotImplemented : public std::logic_error 00048 { 00049 public: 00050 NotImplemented() : std::logic_error( "Error: not implemented!" ) {} 00051 }; 00052 00053 00061 class FileError : public std::runtime_error 00062 { 00063 public: 00064 FileError(const std::string& filename) : std::runtime_error( "Error accessing file: " + filename ) {} 00065 }; 00066 00067 00075 class ConvergenceFailure : public std::runtime_error 00076 { 00077 public: 00078 ConvergenceFailure() : std::runtime_error( "Unrecoverable failure to converge" ) {} 00079 }; 00080 00081 00085 class DynamicCastFailure: public std::runtime_error 00086 { 00087 public: 00088 DynamicCastFailure() : std::runtime_error( "Failed dynamic cast!" ) {} 00089 }; 00090 00094 class FloatingPointException: public std::runtime_error 00095 { 00096 public: 00097 FloatingPointException() : std::runtime_error( "libmesh FPE!" ) {} 00098 }; 00099 } 00100 00101 #define LIBMESH_THROW(e) do { throw e; } while (0) 00102 00103 #else 00104 00105 #define LIBMESH_THROW(e) do { std::abort(); } while (0) 00106 00107 #endif // LIBMESH_ENABLE_EXCEPTIONS 00108 00109 #endif // LIBMESH_LIBMESH_EXCEPTIONS_H