21#ifndef CCGSL_EXCEPTION_HPP
22#define CCGSL_EXCEPTION_HPP
25#include<gsl/gsl_errno.h>
400 if(
file != 0 ) std::clog <<
file <<
":";
401 if(
line != 0 ) std::clog <<
line <<
": ";
402 std::clog <<
"gsl::exception: ";
405 std::clog << message;
407 std::clog <<
"undefined error: ";
409 std::clog <<
": " <<
reason;
410 std::clog << std::endl;
446 static void (*
set_handler(
void (*handler)(
char const*,
char const*,
int,
int )))
447 (
char const*,
char const*, int, int ){
return gsl_set_error_handler( handler ); }
This class is used to handle gsl exceptions so that gsl can use these rather than the GSL error handl...
int const gsl_errno
A number indicating error type.
char const * reason
A message giving a reason for this exception.
static void(*)(char const *, char const *, int, int) set_handler_off()
Set the handler function to a null handler.
static void handler_off(char const *, char const *, int, int)
The empty exception handler for gsl.
char const * get_file() const
Get the name of the file that caused an exception.
static void(*)(char const *, char const *, int, int) set_handler(void(*handler)(char const *, char const *, int, int))
Set the handler function.
@ GSL_ENOPROGJ
jacobian evaluations are not improving the solution
@ GSL_EDOM
input domain error, e.g sqrt(-1)
@ GSL_ETOLF
cannot reach the specified tolerance in F
@ GSL_ENOPROG
iteration is not making progress towards solution
@ GSL_EDIVERGE
integral or series is divergent
@ GSL_ELOSS
loss of accuracy
@ GSL_ETABLE
table limit exceeded
@ GSL_EFACTOR
factorization failed
@ GSL_ECACHE
cache limit exceeded
@ GSL_EZERODIV
tried to divide by zero
@ GSL_CONTINUE
iteration has not converged
@ GSL_EMAXITER
exceeded max number of iterations
@ GSL_EFAILED
generic failure
@ GSL_ENOTSQR
matrix not square
@ GSL_ESANITY
sanity check failed - shouldn't happen
@ GSL_EINVAL
invalid argument supplied by user
@ GSL_ETOLX
cannot reach the specified tolerance in X
@ GSL_ERANGE
output range error, e.g.
@ GSL_ETOLG
cannot reach the specified tolerance in gradient
@ GSL_EBADTOL
user specified an invalid tolerance
@ GSL_ETOL
failed to reach the specified tolerance
@ GSL_EUNIMPL
requested feature not (yet) implemented
@ GSL_EUNSUP
requested feature is not supported by the hardware
@ GSL_ERUNAWAY
iterative process is out of control
@ GSL_ENOMEM
malloc failed
@ GSL_EBADLEN
matrix, vector lengths are not conformant
@ GSL_EFAULT
invalid pointer
@ GSL_EROUND
failed because of roundoff error
@ GSL_ESING
apparent singularity detected
@ GSL_EBADFUNC
problem with user-supplied function
static void(*)(char const *, char const *, int, int) set_handler_gsl_exceptions()
Set the handler function to handle exceptions.
int get_line() const
Get the line number at which a GSL error handler caused the exception.
static void handler_gsl_exceptions(char const *reason, char const *file, int line, int gsl_errno)
The default exception handler for gsl.
int get_gsl_errno() const
Get an error number.
char const * strerror() const
Get a standard GSL message corresponding to the error number.
static void enable()
Set the handler function to handle exceptions.
char const * file
The file that cause this exception.
int const line
The line number in file at which exception handler was called.
exception(char const *reason, char const *file, int line, int gsl_errno)
The constructor takes the same paramters as a GSL error handler: a description of the reason for the ...
char const * get_reason() const
Get the message explaining the reason for the error/exception.
The gsl package creates an interface to the GNU Scientific Library for C++.