2006-02-07 07:49:24 +08:00
|
|
|
/*BHEADER**********************************************************************
|
2006-07-28 07:26:57 +08:00
|
|
|
* Copyright (c) 2006 The Regents of the University of California.
|
|
|
|
|
* Produced at the Lawrence Livermore National Laboratory.
|
2006-09-27 06:53:11 +08:00
|
|
|
* Written by the HYPRE team, UCRL-CODE-222953.
|
2006-07-28 07:26:57 +08:00
|
|
|
* All rights reserved.
|
2006-02-07 07:49:24 +08:00
|
|
|
*
|
2006-07-28 07:26:57 +08:00
|
|
|
* This file is part of HYPRE (see http://www.llnl.gov/CASC/hypre/).
|
|
|
|
|
* Please see the COPYRIGHT_and_LICENSE file for the copyright notice,
|
|
|
|
|
* disclaimer and the GNU Lesser General Public License.
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
|
* under the terms of the GNU General Public License (as published by the Free
|
|
|
|
|
* Software Foundation) version 2.1 dated February 1999.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
|
* ANY WARRANTY; without even the IMPLIED WARRANTY OF MERCHANTABILITY or
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the terms and conditions of the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2006-02-07 07:49:24 +08:00
|
|
|
*
|
|
|
|
|
* $Revision$
|
2006-07-28 07:26:57 +08:00
|
|
|
***********************************************************************EHEADER*/
|
|
|
|
|
|
2006-02-07 07:49:24 +08:00
|
|
|
|
2006-11-15 09:08:13 +08:00
|
|
|
#include "_hypre_utilities.h"
|
2006-02-07 07:49:24 +08:00
|
|
|
|
|
|
|
|
int hypre__global_error = 0;
|
|
|
|
|
|
|
|
|
|
/* Process the error with code ierr raised in the given line of the
|
|
|
|
|
given source file. */
|
|
|
|
|
void hypre_error_handler(char *filename, int line, int ierr)
|
|
|
|
|
{
|
|
|
|
|
hypre_error_flag |= ierr;
|
|
|
|
|
|
|
|
|
|
#ifdef HYPRE_PRINT_ERRORS
|
|
|
|
|
fprintf(stderr,
|
|
|
|
|
"hypre error in file \"%s\", line %d, error code = %d ",
|
|
|
|
|
filename, line, ierr);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int HYPRE_GetError()
|
|
|
|
|
{
|
|
|
|
|
return hypre_error_flag;
|
|
|
|
|
}
|
|
|
|
|
|
2006-09-14 04:46:11 +08:00
|
|
|
int HYPRE_CheckError(int ierr, int hypre_error_code)
|
|
|
|
|
{
|
|
|
|
|
return ierr & hypre_error_code;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void HYPRE_DescribeError(int ierr, char *msg)
|
2006-02-07 07:49:24 +08:00
|
|
|
{
|
|
|
|
|
if (ierr == 0)
|
2006-09-14 04:46:11 +08:00
|
|
|
sprintf(msg,"[No error] ");
|
2006-02-07 07:49:24 +08:00
|
|
|
|
|
|
|
|
if (ierr & HYPRE_ERROR_GENERIC)
|
2006-09-14 04:46:11 +08:00
|
|
|
sprintf(msg,"[Generic error] ");
|
2006-02-07 07:49:24 +08:00
|
|
|
|
|
|
|
|
if (ierr & HYPRE_ERROR_MEMORY)
|
2006-09-14 04:46:11 +08:00
|
|
|
sprintf(msg,"[Memory error] ");
|
2006-02-07 07:49:24 +08:00
|
|
|
|
|
|
|
|
if (ierr & HYPRE_ERROR_ARG)
|
2006-09-14 04:46:11 +08:00
|
|
|
sprintf(msg,"[Error in argument %d] ", HYPRE_GetErrorArg());
|
2006-02-07 07:49:24 +08:00
|
|
|
|
|
|
|
|
if (ierr & HYPRE_ERROR_CONV)
|
2006-09-14 04:46:11 +08:00
|
|
|
sprintf(msg,"[Method did not converge] ");
|
2006-02-07 07:49:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int HYPRE_GetErrorArg()
|
|
|
|
|
{
|
2006-03-30 09:16:35 +08:00
|
|
|
return (hypre_error_flag>>3 & 31);
|
2006-02-07 07:49:24 +08:00
|
|
|
}
|