LASError, LASBreak, LASResult, WriteLASErrDescr -- error handling routines
#include <laspack/errhandl.h> typedef enum { LASOK, LASMemAllocErr, LASLValErr, LASDimErr, LASRangeErr, LASSymStorErr, LASMatrCombErr, LASMulInvErr, LASElNotSortedErr, LASZeroInDiagErr, LASZeroPivotErr, LASILUStructErr, LASBreakdownErr, LASUserBreak } LASErrType; void LASError(LASErrIdType ErrId, char *ProcName, char *Object1Name, char *Object2Name, char *Object3Name); void LASBreak(void); LASErrIdType LASResult(void); void WriteLASErrDescr(FILE *File);
LASPack incorporates a system for error handling. In the most routines of the library, the consistency of passed parameters as well as the appearance of some exception situations are checked.
LASMemAllocErr Not enough memory is available. LASLValErr L-value parameter is expected. LASDimErr Objects have incompatible dimensions. LASRangeErr Indices are out of range. LASSymStorErr Some elements are stored in lower triangular part of a symmetric matrix. LASMatrCombErr Matrices can not be combined. LASMulInvErr Inverse multiplication can not be carried out. LASElNotSortedErr Matrix elements are not sorted. LASZeroInDiagErr Zero elements in matrix diagonal are not allowed. LASZeroPivotErr Factorization produces zero pivot elements. LASILUStructErr Matrix has structure which is not allowed for ILU factorization. LASBreakdownErr Iterative solver fails.
In addition, the name of the routine where the error has occured ProcName and names of concerning objects Object1Name, Object2Name and Object3Name (e.g. names of vector or matrices) should be passed, too. The unused parameters should be set to NULL.
errhandl.h ... header file
errhandl.c ... source file
The code fragment
Vector a, b; V_Constr(&a, "a", 6, Normal, True); V_Constr(&b, "b", 7, Normal, True); V_SetAllCmp(&a, 0.0); Asgn_VV(&b, &a); if (LASResult() != LASOK) { printf("LASPack error: "); WriteLASErrDescr(stdin); } V_Destr(&a); V_Destr(&b);produces the following error message:
LASPack error: in Asgn_VV for a, b: Objects have incompatible dimensions.