| 1 | /*BHEADER**********************************************************************
|
|---|
| 2 | * Copyright (c) 2008, Lawrence Livermore National Security, LLC.
|
|---|
| 3 | * Produced at the Lawrence Livermore National Laboratory.
|
|---|
| 4 | * This file is part of HYPRE. See file COPYRIGHT for details.
|
|---|
| 5 | *
|
|---|
| 6 | * HYPRE is free software; you can redistribute it and/or modify it under the
|
|---|
| 7 | * terms of the GNU Lesser General Public License (as published by the Free
|
|---|
| 8 | * Software Foundation) version 2.1 dated February 1999.
|
|---|
| 9 | *
|
|---|
| 10 | * $Revision: 2.4 $
|
|---|
| 11 | ***********************************************************************EHEADER*/
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 | #ifndef hypre_ERROR_HEADER
|
|---|
| 15 | #define hypre_ERROR_HEADER
|
|---|
| 16 |
|
|---|
| 17 | /*--------------------------------------------------------------------------
|
|---|
| 18 | * HYPRE error codes
|
|---|
| 19 | *--------------------------------------------------------------------------*/
|
|---|
| 20 |
|
|---|
| 21 | #define HYPRE_ERROR_GENERIC 1 /* generic error */
|
|---|
| 22 | #define HYPRE_ERROR_MEMORY 2 /* unable to allocate memory */
|
|---|
| 23 | #define HYPRE_ERROR_ARG 4 /* argument error */
|
|---|
| 24 | /* bits 4-8 are reserved for the index of the argument error */
|
|---|
| 25 | #define HYPRE_ERROR_CONV 256 /* method did not converge as expected */
|
|---|
| 26 |
|
|---|
| 27 | /*--------------------------------------------------------------------------
|
|---|
| 28 | * Global variable used in hypre error checking
|
|---|
| 29 | *--------------------------------------------------------------------------*/
|
|---|
| 30 |
|
|---|
| 31 | extern int hypre__global_error;
|
|---|
| 32 | #define hypre_error_flag hypre__global_error
|
|---|
| 33 |
|
|---|
| 34 | /*--------------------------------------------------------------------------
|
|---|
| 35 | * HYPRE error macros
|
|---|
| 36 | *--------------------------------------------------------------------------*/
|
|---|
| 37 |
|
|---|
| 38 | void hypre_error_handler(char *filename, int line, int ierr);
|
|---|
| 39 | #define hypre_error(IERR) hypre_error_handler(__FILE__, __LINE__, IERR)
|
|---|
| 40 | #define hypre_error_in_arg(IARG) hypre_error(HYPRE_ERROR_ARG | IARG<<3)
|
|---|
| 41 | #ifdef NDEBUG
|
|---|
| 42 | #define hypre_assert(EX)
|
|---|
| 43 | #else
|
|---|
| 44 | #define hypre_assert(EX) if (!(EX)) {fprintf(stderr,"hypre_assert failed: %s\n", #EX); hypre_error(1);}
|
|---|
| 45 | #endif
|
|---|
| 46 |
|
|---|
| 47 | #endif
|
|---|