1use failure::Fail;
2
3#[derive(Debug)]
4pub enum Recoverable {
5 Residual,
7 LSetup,
9 LSolve,
11 Constraint,
13 NLSSetup,
15}
16
17#[derive(Debug, Fail)]
18pub enum IdaError {
19 #[fail(display = "Error Test Failed")]
21 TestFail,
22
23 #[fail(
27 display = "The user's residual function repeatedly returned a recoverable error flag, \
28 but the solver was unable to recover"
29 )]
30 RepeatedResidualError {},
31
32 #[fail(display = "One of the input arguments was illegal. See printed message")]
34 IllegalInput { msg: String },
35
36 #[fail(display = "The linear solver's init routine failed")]
38 LinearInitFail {},
39
40 #[fail(
42 display = "Some component of the error weight vector is zero (illegal), either for the \
43 input value of y0 or a corrected value"
44 )]
45 BadErrorWeightVector {},
46
47 #[fail(display = "The user's residual routine returned a non-recoverable error flag")]
49 ResidualFail {},
50
51 #[fail(
53 display = "The user's residual routine returned a recoverable error flag on the first \
54 call, but IDACalcIC was unable to recover"
55 )]
56 FirstResidualFail {},
57
58 #[fail(display = "The linear solver's setup routine had a non-recoverable error")]
60 LinearSetupFail {},
61
62 #[fail(display = "The linear solver's solve routine had a non-recoverable error")]
64 LinearSolveFail {},
65
66 #[fail(
68 display = "The user's residual routine, or the linear solver's setup or solve routine \
69 had a recoverable error, but IDACalcIC was unable to recover"
70 )]
71 NoRecovery {},
72
73 #[fail(display = "Recoverable failure")]
74 RecoverableFail { rec_type: Recoverable },
75
76 #[fail(
79 display = "IDACalcIC was unable to find a solution satisfying the inequality constraints"
80 )]
81 ConstraintFail {},
82
83 #[fail(
85 display = "The Linesearch algorithm failed to find a solution with a step larger than \
86 steptol in weighted RMS norm"
87 )]
88 LinesearchFail {},
89
90 #[fail(display = "IDACalcIC failed to get convergence of the Newton iterations")]
92 ConvergenceFail {},
93
94 #[fail(display = "Illegal value for k.")]
96 BadK {},
97
98 #[fail(
101 display = "Illegal value for t: t = {} is not between tcur - hu = {} and tcur = {}.",
102 t, tdiff, tcurr
103 )]
104 BadTimeValue { t: f64, tdiff: f64, tcurr: f64 },
105
106 #[fail(
107 display = "At t = {}, the rootfinding routine failed in an unrecoverable manner.",
108 t
109 )]
110 RootFunctionFail { t: f64 },
111
112 #[fail(
114 display = "The value tstop = {} is behind current t = {} in the direction of integration.",
115 tstop, t
116 )]
117 BadStopTime { tstop: f64, t: f64 },
118
119 #[fail(display = "At t = {} too much accuracy requested.", t)]
121 TooMuchAccuracy { t: f64 },
122
123 #[fail(display = "Root found at and very near {}.", t)]
125 CloseRoots { t: f64 },
126}