pardiso_wrapper/
error_types.rs1use num_enum::{FromPrimitive, IntoPrimitive};
2use thiserror::Error;
3
4#[derive(Error, Debug, FromPrimitive, IntoPrimitive)]
5#[repr(i32)]
6pub enum PanuaPardisoError {
7 #[error("Input inconsistent.")]
9 InputInconsistent = -1,
10 #[error("Not enough memory.")]
11 NotEnoughMemory = -2,
12 #[error("Reordering problem.")]
13 ReorderingProblem = -3,
14 #[error("Zero pivot, numerical factorization, or iterative refinement problem.")]
15 ZeroPivot = -4,
16 #[error("Unclassified (internal) error.")]
17 UnclassifiedError = -5,
18 #[error("Preordering failed (matrix types 11, 13 only).")]
19 PreorderingFailed = -6,
20 #[error("Diagonal matrix problem.")]
21 DiagonalMatrixProblem = -7,
22 #[error("32-bit integer overflow problem.")]
23 IntegerOverflow = -8,
24 #[error("No license file panua.lic found.")]
25 NoLicenseFile = -10,
26 #[error("License is expired.")]
27 LicenseExpired = -11,
28 #[error("Wrong username or hostname.")]
29 WrongUsernameOrHostname = -12,
30 #[error("Reached maximum number of Krylov-subspace iterations in iterative solver.")]
31 MaxKrylovIterations = -100,
32 #[error("No sufficient convergence in Krylov-subspace iteration within 25 iterations.")]
33 InsufficientConvergence = -101,
34 #[error("Error in Krylov-subspace iteration.")]
35 KrylovIterationError = -102,
36 #[error("Breakdown in Krylov-subspace iteration.")]
37 KrylovBreakdown = -103,
38 #[error("Library load failure.")]
40 LibraryLoadFailure = -900,
41 #[error("Library load failure.")]
43 LibraryLicenseFailure = -901,
44 #[num_enum(default)]
45 #[error("Unrecognized error code.")]
46 UnrecognizedError = -999,
47}
48
49#[derive(Error, Debug, FromPrimitive, IntoPrimitive)]
50#[repr(i32)]
51pub enum MKLPardisoError {
52 #[error("Input inconsistent.")]
54 InputInconsistent = -1,
55 #[error("Not enough memory.")]
56 NotEnoughMemory = -2,
57 #[error("Reordering problem.")]
58 ReorderingProblem = -3,
59 #[error("Zero pivot, numerical factorization, or iterative refinement problem.")]
60 ZeroPivot = -4,
61 #[error("Unclassified (internal) error.")]
62 UnclassifiedError = -5,
63 #[error("Preordering failed (matrix types 11, 13 only).")]
64 PreorderingFailed = -6,
65 #[error("Diagonal matrix is singular.")]
66 DiagonalMatrixSingular = -7,
67 #[error("32-bit integer overflow problem.")]
68 IntegerOverflow = -8,
69 #[error("Not enough memory for OOC.")]
70 NotEnoughMemoryOOC = -9,
71 #[error("Error opening OOC files.")]
72 ErrorOpeningOOCFiles = -10,
73 #[error("Read/write error with OOC files.")]
74 ReadWriteErrorOOCFiles = -11,
75 #[error("pardiso_64 called from 32-bit library.")]
76 Pardiso64CalledFrom32BitLibrary = -12,
77 #[num_enum(default)]
78 #[error("Library load failure.")]
80 LibraryLoadFailure = -900,
81 #[error("Unrecognized error code.")]
82 UnrecognizedError = -999,
83}
84
85#[derive(Error, Debug)]
86pub enum PardisoError {
87 #[error("MKL ERROR: {0}")]
88 MKL(#[from] MKLPardisoError),
89 #[error("PANUA ERROR: {0}")]
90 Panua(#[from] PanuaPardisoError),
91 #[error("Unknown error.")]
92 Unknown,
93}