20 #ifndef LIBMESH_LIBMESH_EXCEPTIONS_H 21 #define LIBMESH_LIBMESH_EXCEPTIONS_H 23 #include "libmesh/libmesh_config.h" 25 #include "libmesh/libmesh_abort.h" 81 NotImplemented(std::string msg=
"") :
std::logic_error(
"Error: feature not implemented!\n" + msg ) {}
95 FileError(
const std::string & filename,
const std::string msg=
"") :
96 std::runtime_error(
"Error with file `" + filename +
"'\n" +
std::move(msg)) {}
120 std::runtime_error(
"Degenerate map, e.g. negative Jacobian or singular matrix.\n" + msg ) {}
134 ConvergenceFailure(
const std::string & err_msg=
"Unrecoverable failure to converge") :
std::runtime_error( err_msg ) {}
166 std::ostringstream oss;
167 oss <<
"Error code " <<
error_code <<
" during solve." << std::endl;
179 virtual const char *
what() const noexcept
override 212 const char *
what() const noexcept {
return "libMesh termination requested"; }
217 #ifdef LIBMESH_ENABLE_EXCEPTIONS 218 #define libmesh_noexcept noexcept 220 #define LIBMESH_THROW(e) do { throw e; } while (0) 221 #define libmesh_rethrow throw 222 #define libmesh_try try 223 #define libmesh_catch(e) catch(e) 227 #define LIBMESH_THROW(e) do { libMesh::err << e.what(); libMesh::libmesh_abort(); } while (0) 228 #define libmesh_rethrow 230 #define libmesh_catch(e) if (0) 232 #endif // LIBMESH_ENABLE_EXCEPTIONS 234 #endif // LIBMESH_LIBMESH_EXCEPTIONS_H DegenerateMap(std::string msg="")
A class to stub for features that should be in libMesh, but haven't been written yet, to be thrown by "libmesh_not_implemented();".
NotImplemented(std::string msg="")
A class representing that a dynamic cast failed to produce expected output.
SolverException(int error_code_in)
A class representing the detection of an unexpected degeneracy, e.g.
ConvergenceFailure(const std::string &err_msg="Unrecoverable failure to converge")
void enableSEGV(bool on)
Toggle libMesh reporting of segmentation faults.
int error_code
The error code generated by the solver.
A class representing a floating point exception.
The libMesh namespace provides an interface to certain functionality in the library.
std::string what_message
string which holds the message built in the constructor.
A class representing an exception during a solve.
LogicError(const std::string &msg)
A class representing an exception used only to send a program to the terminate handler for abort afte...
virtual const char * what() const noexcept override
Override the what() function to provide a generic error message.
void enableFPE(bool on)
Toggle hardware trap floating point exceptions.
FileError(const std::string &filename, const std::string msg="")
A class to represent the internal "this should never happen" errors, to be thrown by "libmesh_error()...
A class representing a solver's failure to converge, to be thrown by "libmesh_convergence_failure();"...
void enableSIGINT(bool on)
Toggle libMesh handling of SIGINT (Ctrl+C) interrupts.
virtual ~SolverException()=default
Virtual destructor, gotta have one of those.
A class representing a failed attempt by the library to open a file (or construct an fstream...
const char * what() const noexcept
void libmesh_terminate_handler()
A terminate handler.