12 #ifndef MFEM_ERROR_HPP
13 #define MFEM_ERROR_HPP
15 #include "../config/config.hpp"
38 #ifdef MFEM_USE_EXCEPTIONS
48 virtual const char*
what()
const throw();
63 #ifndef _MFEM_FUNC_NAME
66 #define _MFEM_FUNC_NAME __PRETTY_FUNCTION__
71 #define _MFEM_FUNC_NAME __FUNCSIG__
75 #define MFEM_LOCATION \
76 "\n ... in function: " << _MFEM_FUNC_NAME << \
77 "\n ... at line " << __LINE__ << " of file: " << __FILE__ << '\n'
80 #define _MFEM_MESSAGE(msg, warn) \
82 std::ostringstream mfemMsgStream; \
83 mfemMsgStream << std::setprecision(16); \
84 mfemMsgStream << std::setiosflags(std::ios_base::scientific); \
85 mfemMsgStream << msg << MFEM_LOCATION; \
87 mfem::mfem_error(mfemMsgStream.str().c_str()); \
89 mfem::mfem_warning(mfemMsgStream.str().c_str()); \
97 #define MFEM_ABORT(msg) _MFEM_MESSAGE("MFEM abort: " << msg, 0)
100 #define MFEM_VERIFY(x, msg) \
103 _MFEM_MESSAGE("Verification failed: (" \
104 << #x << ") is false:\n --> " << msg, 0); \
113 #define MFEM_CONTRACT_VAR(x) if (0 && &x == &x){}
118 #define MFEM_ASSERT(x, msg) \
121 _MFEM_MESSAGE("Assertion failed: (" \
122 << #x << ") is false:\n --> " << msg, 0); \
126 #define MFEM_DEBUG_DO(x) x
131 #define MFEM_ASSERT(x, msg)
134 #define MFEM_DEBUG_DO(x)
139 #define MFEM_WARNING(msg) _MFEM_MESSAGE("MFEM Warning: " << msg, 1)
virtual const char * what() const
ErrorAction get_error_action()
Get the action MFEM takes when an error is encountered.
Exception class thrown when MFEM encounters an error and the current ErrorAction is set to MFEM_ERROR...
void mfem_error(const char *msg)
Function called when an error is encountered. Used by the macros MFEM_ABORT, MFEM_ASSERT, MFEM_VERIFY.
virtual ~ErrorException()
void set_error_action(ErrorAction action)
Set the action MFEM takes when an error is encountered.
ErrorAction
Action to take when MFEM encounters an error.
ErrorException(const std::string &in_msg)
void mfem_warning(const char *msg)
Function called by the macro MFEM_WARNING.
void mfem_backtrace(int mode, int depth)