source: CIVL/examples/mpi-omp/AMG2013/utilities/hypre_error.c

main
Last change on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 1.6 KB
RevLine 
[2aa6644]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#include "utilities.h"
15
16int hypre__global_error = 0;
17
18/* Process the error with code ierr raised in the given line of the
19 given source file. */
20void hypre_error_handler(char *filename, int line, int ierr)
21{
22 hypre_error_flag |= ierr;
23
24#ifdef HYPRE_PRINT_ERRORS
25 fprintf(stderr,
26 "hypre error in file \"%s\", line %d, error code = %d ",
27 filename, line, ierr);
28#endif
29}
30
31int HYPRE_GetError()
32{
33 return hypre_error_flag;
34}
35
36int HYPRE_CheckError(int ierr, int hypre_error_code)
37{
38 return ierr & hypre_error_code;
39}
40
41void HYPRE_DescribeError(int ierr, char *msg)
42{
43 if (ierr == 0)
44 sprintf(msg,"[No error] ");
45
46 if (ierr & HYPRE_ERROR_GENERIC)
47 sprintf(msg,"[Generic error] ");
48
49 if (ierr & HYPRE_ERROR_MEMORY)
50 sprintf(msg,"[Memory error] ");
51
52 if (ierr & HYPRE_ERROR_ARG)
53 sprintf(msg,"[Error in argument %d] ", HYPRE_GetErrorArg());
54
55 if (ierr & HYPRE_ERROR_CONV)
56 sprintf(msg,"[Method did not converge] ");
57}
58
59int HYPRE_GetErrorArg()
60{
61 return (hypre_error_flag>>3 & 31);
62}
Note: See TracBrowser for help on using the repository browser.