1 | /* |
---|
2 | * ----------------------------------------------------------------- |
---|
3 | * Programmer(s): Radu Serban @ LLNL |
---|
4 | * ----------------------------------------------------------------- |
---|
5 | * LLNS Copyright Start |
---|
6 | * Copyright (c) 2014, Lawrence Livermore National Security |
---|
7 | * This work was performed under the auspices of the U.S. Department |
---|
8 | * of Energy by Lawrence Livermore National Laboratory in part under |
---|
9 | * Contract W-7405-Eng-48 and in part under Contract DE-AC52-07NA27344. |
---|
10 | * Produced at the Lawrence Livermore National Laboratory. |
---|
11 | * All rights reserved. |
---|
12 | * For details, see the LICENSE file. |
---|
13 | * LLNS Copyright End |
---|
14 | * ----------------------------------------------------------------- |
---|
15 | * This is the header file for the diagonal linear solver CVSDIAG. |
---|
16 | * |
---|
17 | * |
---|
18 | * Part I contains type definitions and function prototypes for using |
---|
19 | * CVDIAG on forward problems (IVP integration and/or FSA) |
---|
20 | * |
---|
21 | * Part II contains type definitions and function prototypes for using |
---|
22 | * CVDIAG on adjoint (backward) problems |
---|
23 | * ----------------------------------------------------------------- |
---|
24 | */ |
---|
25 | |
---|
26 | #ifndef _CVSDIAG_H |
---|
27 | #define _CVSDIAG_H |
---|
28 | |
---|
29 | #include <sundials/sundials_nvector.h> |
---|
30 | |
---|
31 | #ifdef __cplusplus /* wrapper to enable C++ usage */ |
---|
32 | extern "C" { |
---|
33 | #endif |
---|
34 | |
---|
35 | /* |
---|
36 | * ----------------------------------------------------------------- |
---|
37 | * CVDIAG return values |
---|
38 | * ----------------------------------------------------------------- |
---|
39 | */ |
---|
40 | |
---|
41 | #define CVDIAG_SUCCESS 0 |
---|
42 | #define CVDIAG_MEM_NULL -1 |
---|
43 | #define CVDIAG_LMEM_NULL -2 |
---|
44 | #define CVDIAG_ILL_INPUT -3 |
---|
45 | #define CVDIAG_MEM_FAIL -4 |
---|
46 | |
---|
47 | /* Additional last_flag values */ |
---|
48 | |
---|
49 | #define CVDIAG_INV_FAIL -5 |
---|
50 | #define CVDIAG_RHSFUNC_UNRECVR -6 |
---|
51 | #define CVDIAG_RHSFUNC_RECVR -7 |
---|
52 | |
---|
53 | /* Return values for adjoint module */ |
---|
54 | |
---|
55 | #define CVDIAG_NO_ADJ -101 |
---|
56 | |
---|
57 | /* |
---|
58 | * ----------------------------------------------------------------- |
---|
59 | * PART I - forward problems |
---|
60 | * ----------------------------------------------------------------- |
---|
61 | */ |
---|
62 | |
---|
63 | /* |
---|
64 | * ----------------------------------------------------------------- |
---|
65 | * Function : CVDiag |
---|
66 | * ----------------------------------------------------------------- |
---|
67 | * A call to the CVDiag function links the main integrator with |
---|
68 | * the CVDIAG linear solver. |
---|
69 | * |
---|
70 | * cvode_mem is the pointer to the integrator memory returned by |
---|
71 | * CVodeCreate. |
---|
72 | * |
---|
73 | * The return value of CVDiag is one of: |
---|
74 | * CVDIAG_SUCCESS if successful |
---|
75 | * CVDIAG_MEM_NULL if the cvode memory was NULL |
---|
76 | * CVDIAG_MEM_FAIL if there was a memory allocation failure |
---|
77 | * CVDIAG_ILL_INPUT if a required vector operation is missing |
---|
78 | * ----------------------------------------------------------------- |
---|
79 | */ |
---|
80 | |
---|
81 | SUNDIALS_EXPORT int CVDiag(void *cvode_mem); |
---|
82 | |
---|
83 | /* |
---|
84 | * ----------------------------------------------------------------- |
---|
85 | * Optional outputs from the CVDIAG linear solver |
---|
86 | * ----------------------------------------------------------------- |
---|
87 | * |
---|
88 | * CVDiagGetWorkSpace returns the real and integer workspace used |
---|
89 | * by CVDIAG. |
---|
90 | * CVDiagGetNumRhsEvals returns the number of calls to the user |
---|
91 | * f routine due to finite difference Jacobian |
---|
92 | * evaluation. |
---|
93 | * Note: The number of diagonal approximate |
---|
94 | * Jacobians formed is equal to the number of |
---|
95 | * CVDiagSetup calls. This number is available |
---|
96 | * through CVodeGetNumLinSolvSetups. |
---|
97 | * CVDiagGetLastFlag returns the last error flag set by any of |
---|
98 | * the CVDIAG interface functions. |
---|
99 | * |
---|
100 | * The return value of CVDiagGet* is one of: |
---|
101 | * CVDIAG_SUCCESS if successful |
---|
102 | * CVDIAG_MEM_NULL if the cvode memory was NULL |
---|
103 | * CVDIAG_LMEM_NULL if the cvdiag memory was NULL |
---|
104 | * ----------------------------------------------------------------- |
---|
105 | */ |
---|
106 | |
---|
107 | SUNDIALS_EXPORT int CVDiagGetWorkSpace(void *cvode_mem, long int *lenrwLS, long int *leniwLS); |
---|
108 | SUNDIALS_EXPORT int CVDiagGetNumRhsEvals(void *cvode_mem, long int *nfevalsLS); |
---|
109 | SUNDIALS_EXPORT int CVDiagGetLastFlag(void *cvode_mem, long int *flag); |
---|
110 | |
---|
111 | /* |
---|
112 | * ----------------------------------------------------------------- |
---|
113 | * The following function returns the name of the constant |
---|
114 | * associated with a CVDIAG return flag |
---|
115 | * ----------------------------------------------------------------- |
---|
116 | */ |
---|
117 | |
---|
118 | SUNDIALS_EXPORT char *CVDiagGetReturnFlagName(long int flag); |
---|
119 | |
---|
120 | /* |
---|
121 | * ----------------------------------------------------------------- |
---|
122 | * PART II - backward problems |
---|
123 | * ----------------------------------------------------------------- |
---|
124 | */ |
---|
125 | |
---|
126 | /* |
---|
127 | * ----------------------------------------------------------------- |
---|
128 | * Function: CVDiagB |
---|
129 | * ----------------------------------------------------------------- |
---|
130 | * CVDiagB links the main CVODE integrator with the CVDIAG |
---|
131 | * linear solver for the backward integration. |
---|
132 | * The 'which' argument is the int returned by CVodeCreateB. |
---|
133 | * ----------------------------------------------------------------- |
---|
134 | */ |
---|
135 | |
---|
136 | SUNDIALS_EXPORT int CVDiagB(void *cvode_mem, int which); |
---|
137 | |
---|
138 | |
---|
139 | #ifdef __cplusplus |
---|
140 | } |
---|
141 | #endif |
---|
142 | |
---|
143 | #endif |
---|