You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
case -1 : msg = {"CV_TOO_MUCH_WORK" , "The solver took mxstep internal steps but could not reach tout"}; break; // NOLINT
30
-
case -2 : msg = {"CV_TOO_MUCH_ACC" , "The solver could not satisfy the accuracy demanded by the user for some internal step"}; break; // NOLINT
31
-
case -3 : msg = {"CV_ERR_FAILURE" , "Error test failures occurred too many times during one internal time step or minimum step size was reached"}; break; // NOLINT
32
-
case -4 : msg = {"CV_CONV_FAILURE" , "Convergence test failures occurred too many times during one internal time step or minimum step size was reached"}; break; // NOLINT
33
-
case -8 : msg = {"CV_RHSFUNC_FAIL" , "The right-hand side function failed in an unrecoverable manner"}; break; // NOLINT
34
-
case -9 : msg = {"CV_FIRST_RHSFUNC_ERR", "The right-hand side function failed at the first call"}; break; // NOLINT
35
-
case -10 : msg = {"CV_REPTD_RHSFUNC_ERR", "The right-hand side function had repetead recoverable errors"}; break; // NOLINT
36
-
case -11 : msg = {"CV_UNREC_RHSFUNC_ERR", "The right-hand side function had a recoverable error, but no recovery is possible"}; break; // NOLINT
37
-
case -27 : msg = {"CV_TOO_CLOSE" , "The output and initial times are too close to each other"}; break; // NOLINT
15
+
/**
16
+
* Map cvodes error flag to acutally error msg. The most frequent
17
+
* errors are put at the top. An alternative would be to use std::map
18
+
* but in our case the difference would be negligible. Note that we
19
+
* don't use CVGetReturnFlagName function to retrieve the constant
20
+
* because sanitizer indicates it contains mem leak.
21
+
*
22
+
* @param flag
23
+
*
24
+
* @return error msg string constant and actuall informative msg
"The solver took mxstep internal steps but could not reach tout"};
32
+
break; // NOLINT
33
+
case -2:
34
+
msg = {"CV_TOO_MUCH_ACC",
35
+
"The solver could not satisfy the accuracy demanded by the user "
36
+
"for some internal step"};
37
+
break; // NOLINT
38
+
case -3:
39
+
msg = {"CV_ERR_FAILURE",
40
+
"Error test failures occurred too many times during one internal "
41
+
"time step or minimum step size was reached"};
42
+
break; // NOLINT
43
+
case -4:
44
+
msg = {"CV_CONV_FAILURE",
45
+
"Convergence test failures occurred too many times during one "
46
+
"internal time step or minimum step size was reached"};
47
+
break; // NOLINT
48
+
case -8:
49
+
msg = {"CV_RHSFUNC_FAIL",
50
+
"The right-hand side function failed in an unrecoverable manner"};
51
+
break; // NOLINT
52
+
case -9:
53
+
msg = {"CV_FIRST_RHSFUNC_ERR",
54
+
"The right-hand side function failed at the first call"};
55
+
break; // NOLINT
56
+
case -10:
57
+
msg = {"CV_REPTD_RHSFUNC_ERR",
58
+
"The right-hand side function had repetead recoverable errors"};
59
+
break; // NOLINT
60
+
case -11:
61
+
msg = {"CV_UNREC_RHSFUNC_ERR",
62
+
"The right-hand side function had a recoverable error, but no "
63
+
"recovery is possible"};
64
+
break; // NOLINT
65
+
case -27:
66
+
msg = {"CV_TOO_CLOSE",
67
+
"The output and initial times are too close to each other"};
68
+
break; // NOLINT
38
69
default:
39
70
switch (flag) {
40
-
case -5 : msg = {"CV_LINIT_FAIL" , "The linear solver's initialization function failed"}; break; // NOLINT
41
-
case -6 : msg = {"CV_LSETUP_FAIL" , "The linear solver's setup function failed in an unrecoverable manner"}; break; // NOLINT
42
-
case -7 : msg = {"CV_LSOLVE_FAIL" , "The linear solver's solve function failed in an unrecoverable manner"}; break; // NOLINT
43
-
case -20 : msg = {"CV_MEM_FAIL" , "A memory allocation failed"}; break; // NOLINT
44
-
case -21 : msg = {"CV_MEM_NULL" , "The cvode_mem argument was NULL"}; break; // NOLINT
45
-
case -22 : msg = {"CV_ILL_INPUT" , "One of the function inputs is illegal"}; break; // NOLINT
46
-
case -23 : msg = {"CV_NO_MALLOC" , "The CVODE memory block was not allocated by a call to CVodeMalloc"}; break; // NOLINT
47
-
case -24 : msg = {"CV_BAD_K" , "The derivative order k is larger than the order used"}; break; // NOLINT
48
-
case -25 : msg = {"CV_BAD_T" , "The time t s outside the last step taken"}; break; // NOLINT
49
-
case -26 : msg = {"CV_BAD_DKY" , "The output derivative vector is NULL"}; break; // NOLINT
50
-
case -40 : msg = {"CV_BAD_IS" , "The sensitivity index is larger than the number of sensitivities computed"}; break; // NOLINT
51
-
case -41 : msg = {"CV_NO_SENS" , "Forward sensitivity integration was not activated"}; break; // NOLINT
52
-
case -42 : msg = {"CV_SRHSFUNC_FAIL" , "The sensitivity right-hand side function failed in an unrecoverable manner"}; break; // NOLINT
53
-
case -43 : msg = {"CV_FIRST_SRHSFUNC_ER", "The sensitivity right-hand side function failed at the first call"}; break; // NOLINT
54
-
case -44 : msg = {"CV_REPTD_SRHSFUNC_ER", "The sensitivity ight-hand side function had repetead recoverable errors"}; break; // NOLINT
55
-
case -45 : msg = {"CV_UNREC_SRHSFUNC_ER", "The sensitivity right-hand side function had a recoverable error, but no recovery is possible"}; break; // NOLINT
56
-
case -101: msg = {"CV_ADJMEM_NULL" , "The cvadj_mem argument was NULL"}; break; // NOLINT
57
-
case -103: msg = {"CV_BAD_TB0" , "The final time for the adjoint problem is outside the interval over which the forward problem was solved"}; break; // NOLINT
58
-
case -104: msg = {"CV_BCKMEM_NULL" , "The cvodes memory for the backward problem was not created"}; break; // NOLINT
59
-
case -105: msg = {"CV_REIFWD_FAIL" , "Reinitialization of the forward problem failed at the first checkpoint"}; break; // NOLINT
60
-
case -106: msg = {"CV_FWD_FAIL" , "An error occured during the integration of the forward problem"}; break; // NOLINT
61
-
case -107: msg = {"CV_BAD_ITASK" , "Wrong task for backward integration"}; break; // NOLINT
62
-
case -108: msg = {"CV_BAD_TBOUT" , "The desired output time is outside the interval over which the forward problem was solved"}; break; // NOLINT
63
-
case -109: msg = {"CV_GETY_BADT" , "Wrong time in interpolation function"}; break; // NOLINT
71
+
case -5:
72
+
msg = {"CV_LINIT_FAIL",
73
+
"The linear solver's initialization function failed"};
74
+
break; // NOLINT
75
+
case -6:
76
+
msg = {"CV_LSETUP_FAIL",
77
+
"The linear solver's setup function failed in an "
78
+
"unrecoverable manner"};
79
+
break; // NOLINT
80
+
case -7:
81
+
msg = {"CV_LSOLVE_FAIL",
82
+
"The linear solver's solve function failed in an "
83
+
"unrecoverable manner"};
84
+
break; // NOLINT
85
+
case -20:
86
+
msg = {"CV_MEM_FAIL", "A memory allocation failed"};
87
+
break; // NOLINT
88
+
case -21:
89
+
msg = {"CV_MEM_NULL", "The cvode_mem argument was NULL"};
90
+
break; // NOLINT
91
+
case -22:
92
+
msg = {"CV_ILL_INPUT", "One of the function inputs is illegal"};
93
+
break; // NOLINT
94
+
case -23:
95
+
msg = {"CV_NO_MALLOC",
96
+
"The CVODE memory block was not allocated by a call to "
97
+
"CVodeMalloc"};
98
+
break; // NOLINT
99
+
case -24:
100
+
msg = {"CV_BAD_K",
101
+
"The derivative order k is larger than the order used"};
102
+
break; // NOLINT
103
+
case -25:
104
+
msg = {"CV_BAD_T", "The time t s outside the last step taken"};
105
+
break; // NOLINT
106
+
case -26:
107
+
msg = {"CV_BAD_DKY", "The output derivative vector is NULL"};
108
+
break; // NOLINT
109
+
case -40:
110
+
msg = {"CV_BAD_IS",
111
+
"The sensitivity index is larger than the number of "
112
+
"sensitivities computed"};
113
+
break; // NOLINT
114
+
case -41:
115
+
msg = {"CV_NO_SENS",
116
+
"Forward sensitivity integration was not activated"};
117
+
break; // NOLINT
118
+
case -42:
119
+
msg = {"CV_SRHSFUNC_FAIL",
120
+
"The sensitivity right-hand side function failed in an "
121
+
"unrecoverable manner"};
122
+
break; // NOLINT
123
+
case -43:
124
+
msg = {"CV_FIRST_SRHSFUNC_ER",
125
+
"The sensitivity right-hand side function failed at the first "
126
+
"call"};
127
+
break; // NOLINT
128
+
case -44:
129
+
msg = {"CV_REPTD_SRHSFUNC_ER",
130
+
"The sensitivity ight-hand side function had repetead "
131
+
"recoverable errors"};
132
+
break; // NOLINT
133
+
case -45:
134
+
msg = {"CV_UNREC_SRHSFUNC_ER",
135
+
"The sensitivity right-hand side function had a recoverable "
136
+
"error, but no recovery is possible"};
137
+
break; // NOLINT
138
+
case -101:
139
+
msg = {"CV_ADJMEM_NULL", "The cvadj_mem argument was NULL"};
140
+
break; // NOLINT
141
+
case -103:
142
+
msg = {"CV_BAD_TB0",
143
+
"The final time for the adjoint problem is outside the "
144
+
"interval over which the forward problem was solved"};
145
+
break; // NOLINT
146
+
case -104:
147
+
msg = {"CV_BCKMEM_NULL",
148
+
"The cvodes memory for the backward problem was not created"};
149
+
break; // NOLINT
150
+
case -105:
151
+
msg = {"CV_REIFWD_FAIL",
152
+
"Reinitialization of the forward problem failed at the first "
153
+
"checkpoint"};
154
+
break; // NOLINT
155
+
case -106:
156
+
msg = {
157
+
"CV_FWD_FAIL",
158
+
"An error occured during the integration of the forward problem"};
159
+
break; // NOLINT
160
+
case -107:
161
+
msg = {"CV_BAD_ITASK", "Wrong task for backward integration"};
162
+
break; // NOLINT
163
+
case -108:
164
+
msg = {"CV_BAD_TBOUT",
165
+
"The desired output time is outside the interval over which "
166
+
"the forward problem was solved"};
167
+
break; // NOLINT
168
+
case -109:
169
+
msg = {"CV_GETY_BADT", "Wrong time in interpolation function"};
170
+
break; // NOLINT
64
171
}
65
-
}
66
-
return msg;
67
-
}
68
-
69
-
/**
70
-
* Throws a std::runtime_error exception when a Sundial function fails
71
-
* (i.e. returns a negative flag)
72
-
*
73
-
* @param flag Error flag
74
-
* @param func_name Name of the function that returned the flag
75
-
* @throw <code>std::runtime_error</code> if the flag is negative
0 commit comments