error_handling Namespace Reference

Exception classes in this namespace. More...


Classes

class  error
 generic error and base struct. /*GSL_FAILURE = -1,*/ More...
struct  noConvergence
 GSL_CONTINUE = -2, /* iteration has not converged */. More...
struct  badDomain
 GSL_EDOM = 1, /* input domain error, e.g sqrt(-1) */. More...
struct  badRange
 GSL_ERANGE = 2, /* output range error, e.g. exp(1e100) */. More...
struct  badPointer
 GSL_EFAULT = 3, /* invalid pointer */. More...
struct  badArgument
 GSL_EINVAL = 4, /* invalid argument supplied by user */. More...
struct  failure
 GSL_EFAILED = 5, /* generic failure */. More...
struct  failedFactorisation
 GSL_EFACTOR = 6, /* factorization failed */. More...
struct  failedSanity
 GSL_ESANITY = 7, /* sanity check failed - shouldn't happen */. More...
struct  outOfMemory
 GSL_ENOMEM = 8, /* malloc failed */. More...
struct  badFunction
 GSL_EBADFUNC = 9, /* problem with user-supplied function */. More...
struct  runAway
 GSL_ERUNAWAY = 10, /* iterative process is out of control */. More...
struct  maxIterations
 GSL_EMAXITER = 11, /* exceeded max number of iterations */. More...
struct  divideByZero
 GSL_EZERODIV = 12, /* tried to divide by zero */. More...
struct  badTolerance
 GSL_EBADTOL = 13, /* user specified an invalid tolerance */. More...
struct  aboveTolerance
 GSL_ETOL = 14, /* failed to reach the specified tolerance */. More...
struct  underflow
 GSL_EUNDRFLW = 15, /* underflow */. More...
struct  overflow
 GSL_EOVRFLW = 16, /* overflow */. More...
struct  lossOfAccuracy
 GSL_ELOSS = 17, /* loss of accuracy */. More...
struct  roundOffError
 GSL_EROUND = 18, /* failed because of roundoff error */. More...
struct  inconformantSizes
 GSL_EBADLEN = 19, /* matrix, vector lengths are not conformant */. More...
struct  matrixNotSquare
 GSL_ENOTSQR = 20, /* matrix not square */. More...
struct  singularityFound
 GSL_ESING = 21, /* apparent singularity detected */. More...
struct  integralOrSeriesDivergent
 GSL_EDIVERGE = 22, /* integral or series is divergent */. More...
struct  badHardware
 GSL_EUNSUP = 23, /* requested feature is not supported by the hardware */. More...
struct  notImplemented
 GSL_EUNIMPL = 24, /* requested feature not (yet) implemented */. More...
struct  cacheLimitExceeded
 GSL_ECACHE = 25, /* cache limit exceeded */. More...
struct  tableLimitExceeded
 GSL_ETABLE = 26, /* table limit exceeded */. More...
struct  iterationNotProgressing
 GSL_ENOPROG = 27, /* iteration is not making progress towards solution */. More...
struct  jacobiansNotImprovingSolution
 GSL_ENOPROGJ = 28, /* jacobian evaluations are not improving solution */. More...
struct  cannotReachToleranceInF
 GSL_ETOLF = 29, /* cannot reach the specified tolerance in F */. More...
struct  cannotReachToleranceInX
 GSL_ETOLX = 30, /* cannot reach the specified tolerance in X */. More...
struct  cannotReachToleranceInGradient
 GSL_ETOLG = 31, /* cannot reach the specified tolerance in gradient */. More...
struct  endOfFile
 GSL_EOF = 32 /* end of file */. More...
struct  indexOutOfRange
 Exception for indices out of range. More...
struct  badDimension
 An exception struct for RBFs when attempting to use the wrong dimension. More...

Functions

void errorHandler (const char *reason, const char *file, int line, int gsl_errno)
 Custom error handler to be used for GSL.


Detailed Description

Exception classes in this namespace.

Function Documentation

void error_handling::errorHandler ( const char *  reason,
const char *  file,
int  line,
int  gsl_errno 
)

Custom error handler to be used for GSL.

Throw exceptions instead of calling abort().

Remember to put `gsl_set_error_handler(&errorHandler);' in the main() loops when including this header file; otherwise it's useless!

00006                                             {
00007     //This exception is so common that we will want more information
00008     //when it happens.
00009     if(reason == string("index out of range")){ //GSL gives this message.
00010       throw indexOutOfRange(reason,file,line);
00011     }
00012 
00013     else{ //Other exceptions are more generic
00014     
00015       switch(gsl_errno){
00016       case -2:
00017         throw noConvergence(reason,file,line); break;
00018       case 1:
00019         throw badDomain(reason,file,line); break;
00020       case 2:
00021         throw badRange(reason,file,line); break;
00022       case 3:
00023         throw badPointer(reason,file,line); break;
00024       case 4:
00025         throw badArgument(reason,file,line); break;
00026       case 5:
00027         throw failure(reason,file,line); break;
00028       case 6:
00029         throw failedFactorisation(reason,file,line); break;
00030       case 7:
00031         throw failedSanity(reason,file,line); break;
00032       case 8:
00033         throw outOfMemory(reason,file,line); break;
00034       case 9:
00035         throw badFunction(reason,file,line); break;
00036       case 10:
00037         throw runAway(reason,file,line); break;
00038       case 11:
00039         throw maxIterations(reason,file,line); break;
00040       case 12:
00041         throw divideByZero(reason,file,line); break;
00042       case 13:
00043         throw badTolerance(reason,file,line); break;
00044       case 14:
00045         throw aboveTolerance(reason,file,line); break;
00046       case 15:
00047         throw underflow(reason,file,line); break;
00048       case 16:
00049         throw overflow(reason,file,line); break;
00050       case 17:
00051         throw lossOfAccuracy(reason,file,line); break;
00052       case 18:
00053         throw roundOffError(reason,file,line); break;
00054       case 19:
00055         throw inconformantSizes(reason,file,line); break;
00056       case 20:
00057         throw matrixNotSquare(reason,file,line); break;
00058       case 21:
00059         throw singularityFound(reason,file,line); break;
00060       case 22:
00061         throw integralOrSeriesDivergent(reason,file,line); break;
00062       case 23:
00063         throw badHardware(reason,file,line); break;
00064       case 24:
00065         throw notImplemented(reason,file,line); break;
00066       case 25:
00067         throw cacheLimitExceeded(reason,file,line); break;
00068       case 26:
00069         throw tableLimitExceeded(reason,file,line); break;
00070       case 27:
00071         throw iterationNotProgressing(reason,file,line); break;
00072       case 28:
00073         throw jacobiansNotImprovingSolution(reason,file,line); break;
00074       case 29:  
00075         cannotReachToleranceInF(reason,file,line); break;
00076       case 30:
00077         throw cannotReachToleranceInX(reason,file,line); break;
00078       case 31:
00079         throw cannotReachToleranceInGradient(reason,file,line); break;
00080       case 32:
00081         throw endOfFile(reason,file,line); break;
00082       default: //Corresponds to GSL_ERRNO=-1.
00083         throw error(reason,file,line);
00084       }
00085 
00086     }
00087 
00088   } //ends void handler(const char*, const char*, int, int);


Generated on Fri Jun 6 17:28:28 2008 by  doxygen 1.5.6