Amesos Package Browser (Single Doxygen Collection)
Development
src
SuiteSparse
CHOLMOD
Core
amesos_cholmod_error.c
Go to the documentation of this file.
1
/* ========================================================================== */
2
/* === Core/cholmod_error =================================================== */
3
/* ========================================================================== */
4
5
/* -----------------------------------------------------------------------------
6
* CHOLMOD/Core Module. Copyright (C) 2005-2006,
7
* Univ. of Florida. Author: Timothy A. Davis
8
* The CHOLMOD/Core Module is licensed under Version 2.1 of the GNU
9
* Lesser General Public License. See lesser.txt for a text of the license.
10
* CHOLMOD is also available under other licenses; contact authors for details.
11
* http://www.cise.ufl.edu/research/sparse
12
* -------------------------------------------------------------------------- */
13
14
/* CHOLMOD error-handling routine. */
15
16
#include "
amesos_cholmod_internal.h
"
17
#include "
amesos_cholmod_core.h
"
18
19
/* ========================================================================== */
20
/* ==== cholmod_error ======================================================= */
21
/* ========================================================================== */
22
23
/* An error has occurred. Set the status, optionally print an error message,
24
* and call the user error-handling routine (if it exists). If
25
* Common->try_catch is TRUE, then CHOLMOD is inside a try/catch block.
26
* The status is set, but no message is printed and the user error handler
27
* is not called. This is not (yet) an error, since CHOLMOD may recover.
28
*
29
* In the current version, this try/catch mechanism is used internally only in
30
* cholmod_analyze, which tries multiple ordering methods and picks the best
31
* one. If one or more ordering method fails, it keeps going. Only one
32
* ordering needs to succeed for cholmod_analyze to succeed.
33
*/
34
35
int
CHOLMOD
(
error
)
36
(
37
/* ---- input ---- */
38
int
status,
/* error status */
39
char
*file,
/* name of source code file where error occured */
40
int
line,
/* line number in source code file where error occured*/
41
char
*message,
/* error message */
42
/* --------------- */
43
cholmod_common
*
Common
44
)
45
{
46
RETURN_IF_NULL_COMMON
(
FALSE
) ;
47
48
Common
->status = status ;
49
50
if
(!(
Common
->try_catch))
51
{
52
53
#ifndef NPRINT
54
/* print a warning or error message */
55
if
(
Common
->print_function !=
NULL
)
56
{
57
if
(status > 0 &&
Common
->print > 1)
58
{
59
(
Common
->print_function) (
"CHOLMOD warning: %s\n"
, message) ;
60
fflush (stdout) ;
61
fflush (stderr) ;
62
}
63
else
if
(
Common
->print > 0)
64
{
65
(
Common
->print_function) (
"CHOLMOD error: %s\n"
, message) ;
66
fflush (stdout) ;
67
fflush (stderr) ;
68
}
69
}
70
#endif
71
72
/* call the user error handler, if it exists */
73
if
(
Common
->error_handler !=
NULL
)
74
{
75
Common
->error_handler (status, file, line, message) ;
76
}
77
}
78
79
return
(
TRUE
) ;
80
}
cholmod_common_struct
Definition:
amesos_cholmod_core.h:393
Common
FALSE
#define FALSE
Definition:
amesos_amd_internal.h:141
RETURN_IF_NULL_COMMON
#define RETURN_IF_NULL_COMMON(result)
Definition:
amesos_cholmod_internal.h:126
amesos_cholmod_core.h
CHOLMOD
#define CHOLMOD(name)
Definition:
amesos_cholmod_internal.h:272
NULL
#define NULL
Definition:
amesos_amd_internal.h:153
error
int CHOLMOD() error(int status, char *file, int line, char *message, cholmod_common *Common)
Definition:
amesos_cholmod_error.c:36
amesos_cholmod_internal.h
TRUE
#define TRUE
Definition:
amesos_amd_internal.h:140
Generated by
1.8.14