KASKADE 7 development version
Loading...
Searching...
No Matches
detailed_exception.hh
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the library KASKADE 7 */
4/* https://www.zib.de/research/projects/kaskade7-finite-element-toolbox */
5/* */
6/* Copyright (C) 2012-2025 Zuse Institute Berlin */
7/* */
8/* KASKADE 7 is distributed under the terms of the ZIB Academic License. */
9/* see $KASKADE/academic.txt */
10/* */
11/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
12#ifndef DETAILED_EXCEPTION_HH
13#define DETAILED_EXCEPTION_HH
14
15#include <string>
16#include <stdexcept>
17#include <boost/lexical_cast.hpp>
18
19namespace Kaskade{
34 class DetailedException : public std::runtime_error{
35 public:
36 DetailedException(std::string const& message, std::string const& file, int const line) :
37 std::runtime_error(std::string("Exception in ") + file + " at line " + boost::lexical_cast<std::string>(line) + ".\n" + message)
38 {
39 }
40 };
41
47 {
48 public:
49 IOException(std::string const& message, std::string const& file, int const line) :
50 DetailedException(message,file,line)
51 {
52 }
53 };
54
60 {
61 public:
62 FileIOException(std::string const& message, std::string const& filename_, std::string const& file, int const line) :
63 IOException(std::string("File I/O exception for file ") + filename_ + ".\n" + message,file,line), filename(filename_)
64 {
65 }
66
67 std::string filename;
68 };
69
75 {
76 public:
77 LookupException (std::string const& message, std::string const& file, int const line):
78 DetailedException(std::string("Key lookup failed:\n")+message,file,line)
79 {
80 }
81 };
82
92 {
93 public:
94 ArgumentValueException(int argno, std::string const& message,
95 std::string const& file, int const line):
96 DetailedException(std::string("Argument ") + std::to_string(argno) + "has illegal value:\n"
97 + message,file,line)
98 {
99 }
100 };
101
107 {
108 public:
109 LinearAlgebraException(std::string const& message, std::string const& file, int const line) :
110 DetailedException(std::string("Linear algebra failure:\n")+message,file,line)
111 {
112 }
113 };
114
120 {
121 public:
122 NonpositiveMatrixException(std::string const& message, std::string const& file, int const line) :
123 LinearAlgebraException(std::string("Matrix is not positive definite:\n")+message,file,line)
124 {
125 }
126 };
127
133 {
134 public:
135 SingularMatrixException(std::string const& message, std::string const& file, int const line):
136 LinearAlgebraException(std::string("Matrix is singular.\n")+message,file,line)
137 {
138 }
139 };
140
146 {
147 public:
148 NonsquareMatrixException(std::string const& message, std::string const& file, int const line):
149 LinearAlgebraException(std::string("Matrix is nonsquare.\n")+message,file,line)
150 {
151 }
152 };
153
161 {
162 public:
163 DirectSolverException(std::string const& message, std::string const& file, int const line):
164 LinearAlgebraException(std::string("Direct solver failed.\n")+message,file,line)
165 {
166 }
167 };
168
174 {
175 public:
176 IterativeSolverException(std::string const& message, std::string const& file, int const line):
177 DetailedException(std::string("Iterative solver failed.\n")+message,file,line)
178 {
179 }
180 };
181
187 {
188 public:
189 InfeasibleProblemException(std::string const& message, std::string const& file, int const line):
190 IterativeSolverException(std::string("Problem has no solution (infeasible).\n")+message,file,line)
191 {
192 }
193 };
194
200 {
201 public:
202 UnboundedProblemException(std::string const& message, std::string const& file, int const line):
203 IterativeSolverException(std::string("Optimization problem has no solution (unbounded).\n")+message,file,line)
204 {
205 }
206 };
207
213 {
214 public:
215 LinesearchException(std::string const& message, std::string const& file, int const line):
216 IterativeSolverException(std::string("Linesearch failed.\n")+message,file,line)
217 {
218 }
219 };
220
226 {
227 public:
228 GridException(std::string const& message, std::string const& file, int const line) :
229 DetailedException("Grid error.\n"+message,file,line)
230 {
231 }
232 };
233
234
235}
236
237#endif
ArgumentValueException(int argno, std::string const &message, std::string const &file, int const line)
DetailedException(std::string const &message, std::string const &file, int const line)
DirectSolverException(std::string const &message, std::string const &file, int const line)
FileIOException(std::string const &message, std::string const &filename_, std::string const &file, int const line)
GridException(std::string const &message, std::string const &file, int const line)
IOException(std::string const &message, std::string const &file, int const line)
InfeasibleProblemException(std::string const &message, std::string const &file, int const line)
IterativeSolverException(std::string const &message, std::string const &file, int const line)
LinearAlgebraException(std::string const &message, std::string const &file, int const line)
LinesearchException(std::string const &message, std::string const &file, int const line)
LookupException(std::string const &message, std::string const &file, int const line)
NonpositiveMatrixException(std::string const &message, std::string const &file, int const line)
NonsquareMatrixException(std::string const &message, std::string const &file, int const line)
SingularMatrixException(std::string const &message, std::string const &file, int const line)
UnboundedProblemException(std::string const &message, std::string const &file, int const line)