add cholmod_error.c

release/4.3a0
Kai Ni 2010-07-07 20:30:22 +00:00
parent f59d694d4e
commit acb37a0277
2 changed files with 81 additions and 1 deletions

View File

@ -3,7 +3,7 @@ includedir = ${prefix}/include/spqr_mini
libdir = ${exec_prefix}/lib
if USE_LAPACK_MACOS
sources = cholmod_common.c cholmod_memory.c spqr_front.cpp spqr_larftb.cpp
sources = cholmod_error.c cholmod_common.c cholmod_memory.c spqr_front.cpp spqr_larftb.cpp
headers = UFconfig.h cholmod_common.h cholmod_internal.h cholmod_blas.h cholmod_core.h
headers += SuiteSparseQR_definitions.h SuiteSparseQR_subset.hpp spqr_subset.hpp spqr_larftb.h spqr_front.h

80
spqr_mini/cholmod_error.c Normal file
View File

@ -0,0 +1,80 @@
/* ========================================================================== */
/* === Core/cholmod_error =================================================== */
/* ========================================================================== */
/* -----------------------------------------------------------------------------
* CHOLMOD/Core Module. Copyright (C) 2005-2006,
* Univ. of Florida. Author: Timothy A. Davis
* The CHOLMOD/Core Module is licensed under Version 2.1 of the GNU
* Lesser General Public License. See lesser.txt for a text of the license.
* CHOLMOD is also available under other licenses; contact authors for details.
* http://www.cise.ufl.edu/research/sparse
* -------------------------------------------------------------------------- */
/* CHOLMOD error-handling routine. */
#include "cholmod_internal.h"
#include "cholmod_core.h"
/* ========================================================================== */
/* ==== cholmod_error ======================================================= */
/* ========================================================================== */
/* An error has occurred. Set the status, optionally print an error message,
* and call the user error-handling routine (if it exists). If
* Common->try_catch is TRUE, then CHOLMOD is inside a try/catch block.
* The status is set, but no message is printed and the user error handler
* is not called. This is not (yet) an error, since CHOLMOD may recover.
*
* In the current version, this try/catch mechanism is used internally only in
* cholmod_analyze, which tries multiple ordering methods and picks the best
* one. If one or more ordering method fails, it keeps going. Only one
* ordering needs to succeed for cholmod_analyze to succeed.
*/
int CHOLMOD(error)
(
/* ---- input ---- */
int status, /* error status */
const char *file, /* name of source code file where error occured */
int line, /* line number in source code file where error occured*/
const char *message, /* error message */
/* --------------- */
cholmod_common *Common
)
{
RETURN_IF_NULL_COMMON (FALSE) ;
Common->status = status ;
if (!(Common->try_catch))
{
#ifndef NPRINT
/* print a warning or error message */
if (Common->print_function != NULL)
{
if (status > 0 && Common->print > 1)
{
(Common->print_function) ("CHOLMOD warning: %s\n", message) ;
fflush (stdout) ;
fflush (stderr) ;
}
else if (Common->print > 0)
{
(Common->print_function) ("CHOLMOD error: %s\n", message) ;
fflush (stdout) ;
fflush (stderr) ;
}
}
#endif
/* call the user error handler, if it exists */
if (Common->error_handler != NULL)
{
Common->error_handler (status, file, line, message) ;
}
}
return (TRUE) ;
}