00001 /* 00002 * ----------------------------------------------------------------- 00003 * $Revision: 1.3 $ 00004 * $Date: 2006/11/29 00:05:06 $ 00005 * ----------------------------------------------------------------- 00006 * Programmer(s): Radu Serban @ LLNL 00007 * ----------------------------------------------------------------- 00008 * Copyright (c) 2005, The Regents of the University of California. 00009 * Produced at the Lawrence Livermore National Laboratory. 00010 * All rights reserved. 00011 * For details, see the LICENSE file. 00012 * ----------------------------------------------------------------- 00013 * This is the header file for the diagonal linear solver CVSDIAG. 00014 * 00015 * 00016 * Part I contains type definitions and function prototypes for using 00017 * CVDIAG on forward problems (IVP integration and/or FSA) 00018 * 00019 * Part II contains type definitions and function prototypes for using 00020 * CVDIAG on adjoint (backward) problems 00021 * ----------------------------------------------------------------- 00022 */ 00023 00024 #ifndef _CVSDIAG_H 00025 #define _CVSDIAG_H 00026 00027 #ifdef __cplusplus /* wrapper to enable C++ usage */ 00028 extern "C" { 00029 #endif 00030 00031 #include <sundials/sundials_nvector.h> 00032 00033 /* 00034 * ----------------------------------------------------------------- 00035 * CVDIAG return values 00036 * ----------------------------------------------------------------- 00037 */ 00038 00039 #define CVDIAG_SUCCESS 0 00040 #define CVDIAG_MEM_NULL -1 00041 #define CVDIAG_LMEM_NULL -2 00042 #define CVDIAG_ILL_INPUT -3 00043 #define CVDIAG_MEM_FAIL -4 00044 00045 /* Additional last_flag values */ 00046 00047 #define CVDIAG_INV_FAIL -5 00048 #define CVDIAG_RHSFUNC_UNRECVR -6 00049 #define CVDIAG_RHSFUNC_RECVR -7 00050 00051 /* Return values for adjoint module */ 00052 00053 #define CVDIAG_ADJMEM_NULL -101 00054 00055 /* 00056 * ----------------------------------------------------------------- 00057 * PART I - forward problems 00058 * ----------------------------------------------------------------- 00059 */ 00060 00061 /* 00062 * ----------------------------------------------------------------- 00063 * Function : CVDiag 00064 * ----------------------------------------------------------------- 00065 * A call to the CVDiag function links the main integrator with 00066 * the CVDIAG linear solver. 00067 * 00068 * cvode_mem is the pointer to the integrator memory returned by 00069 * CVodeCreate. 00070 * 00071 * The return value of CVDiag is one of: 00072 * CVDIAG_SUCCESS if successful 00073 * CVDIAG_MEM_NULL if the cvode memory was NULL 00074 * CVDIAG_MEM_FAIL if there was a memory allocation failure 00075 * CVDIAG_ILL_INPUT if a required vector operation is missing 00076 * ----------------------------------------------------------------- 00077 */ 00078 00079 SUNDIALS_EXPORT int CVDiag(void *cvode_mem); 00080 00081 /* 00082 * ----------------------------------------------------------------- 00083 * Optional outputs from the CVDIAG linear solver 00084 * ----------------------------------------------------------------- 00085 * 00086 * CVDiagGetWorkSpace returns the real and integer workspace used 00087 * by CVDIAG. 00088 * CVDiagGetNumRhsEvals returns the number of calls to the user 00089 * f routine due to finite difference Jacobian 00090 * evaluation. 00091 * Note: The number of diagonal approximate 00092 * Jacobians formed is equal to the number of 00093 * CVDiagSetup calls. This number is available 00094 * through CVodeGetNumLinSolvSetups. 00095 * CVDiagGetLastFlag returns the last error flag set by any of 00096 * the CVDIAG interface functions. 00097 * 00098 * The return value of CVDiagGet* is one of: 00099 * CVDIAG_SUCCESS if successful 00100 * CVDIAG_MEM_NULL if the cvode memory was NULL 00101 * CVDIAG_LMEM_NULL if the cvdiag memory was NULL 00102 * ----------------------------------------------------------------- 00103 */ 00104 00105 SUNDIALS_EXPORT int CVDiagGetWorkSpace(void *cvode_mem, long int *lenrwLS, long int *leniwLS); 00106 SUNDIALS_EXPORT int CVDiagGetNumRhsEvals(void *cvode_mem, long int *nfevalsLS); 00107 SUNDIALS_EXPORT int CVDiagGetLastFlag(void *cvode_mem, int *flag); 00108 00109 /* 00110 * ----------------------------------------------------------------- 00111 * The following function returns the name of the constant 00112 * associated with a CVDIAG return flag 00113 * ----------------------------------------------------------------- 00114 */ 00115 00116 SUNDIALS_EXPORT char *CVDiagGetReturnFlagName(int flag); 00117 00118 /* 00119 * ----------------------------------------------------------------- 00120 * PART II - backward problems 00121 * ----------------------------------------------------------------- 00122 */ 00123 00124 /* 00125 * ----------------------------------------------------------------- 00126 * Function: CVDiagB 00127 * ----------------------------------------------------------------- 00128 * CVDiagB links the main CVODE integrator with the CVDIAG 00129 * linear solver for the backward integration. 00130 * ----------------------------------------------------------------- 00131 */ 00132 00133 SUNDIALS_EXPORT int CVDiagB(void *cvadj_mem); 00134 00135 00136 #ifdef __cplusplus 00137 } 00138 #endif 00139 00140 #endif