Amesos Package Browser (Single Doxygen Collection) Development
amesos_cholmod_l_error.c
Go to the documentation of this file.
00001 /* ========================================================================== */
00002 /* === Core/cholmod_error =================================================== */
00003 /* ========================================================================== */
00004 
00005 /* -----------------------------------------------------------------------------
00006  * CHOLMOD/Core Module.  Copyright (C) 2005-2006,
00007  * Univ. of Florida.  Author: Timothy A. Davis
00008  * The CHOLMOD/Core Module is licensed under Version 2.1 of the GNU
00009  * Lesser General Public License.  See lesser.txt for a text of the license.
00010  * CHOLMOD is also available under other licenses; contact authors for details.
00011  * http://www.cise.ufl.edu/research/sparse
00012  * -------------------------------------------------------------------------- */
00013 
00014 /* CHOLMOD error-handling routine.  */
00015 
00016 /* This file should make the long int version of CHOLMOD */
00017 #define DLONG 1
00018 
00019 #include "amesos_cholmod_internal.h"
00020 #include "amesos_cholmod_core.h"
00021 
00022 /* ========================================================================== */
00023 /* ==== cholmod_error ======================================================= */
00024 /* ========================================================================== */
00025 
00026 /* An error has occurred.  Set the status, optionally print an error message,
00027  * and call the user error-handling routine (if it exists).  If
00028  * Common->try_catch is TRUE, then CHOLMOD is inside a try/catch block.
00029  * The status is set, but no message is printed and the user error handler
00030  * is not called.  This is not (yet) an error, since CHOLMOD may recover.
00031  *
00032  * In the current version, this try/catch mechanism is used internally only in
00033  * cholmod_analyze, which tries multiple ordering methods and picks the best
00034  * one.  If one or more ordering method fails, it keeps going.  Only one
00035  * ordering needs to succeed for cholmod_analyze to succeed.
00036  */
00037 
00038 int CHOLMOD(error)
00039 (
00040     /* ---- input ---- */
00041     int status,   /* error status */
00042     char *file,   /* name of source code file where error occured */ 
00043     int line,   /* line number in source code file where error occured*/
00044     char *message,  /* error message */
00045     /* --------------- */
00046     cholmod_common *Common
00047 )
00048 {
00049     RETURN_IF_NULL_COMMON (FALSE) ;
00050 
00051     Common->status = status ;
00052 
00053     if (!(Common->try_catch))
00054     {
00055 
00056 #ifndef NPRINT
00057   /* print a warning or error message */
00058   if (Common->print_function != NULL)
00059   {
00060       if (status > 0 && Common->print > 1)
00061       {
00062     (Common->print_function) ("CHOLMOD warning: %s\n", message) ;
00063     fflush (stdout) ;
00064     fflush (stderr) ;
00065       }
00066       else if (Common->print > 0)
00067       {
00068     (Common->print_function) ("CHOLMOD error: %s\n", message) ;
00069     fflush (stdout) ;
00070     fflush (stderr) ;
00071       }
00072   }
00073 #endif
00074 
00075   /* call the user error handler, if it exists */
00076   if (Common->error_handler != NULL)
00077   {
00078       Common->error_handler (status, file, line, message) ;
00079   }
00080     }
00081 
00082     return (TRUE) ;
00083 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines