CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Views: 418426
1
/*
2
* Normaliz
3
* Copyright (C) 2007-2014 Winfried Bruns, Bogdan Ichim, Christof Soeger
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 3 of the License, or
7
* (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
*
17
* As an exception, when this program is distributed through (i) the App Store
18
* by Apple Inc.; (ii) the Mac App Store by Apple Inc.; or (iii) Google Play
19
* by Google Inc., then that store may impose any digital rights management,
20
* device limits and/or redistribution restrictions that are required by its
21
* terms of service.
22
*/
23
24
#ifndef NORMALIZ_EXEPTION_H_
25
#define NORMALIZ_EXEPTION_H_
26
27
#include <exception>
28
#include <string>
29
#include <sstream>
30
#include <libnormaliz/libnormaliz.h>
31
#include <libnormaliz/cone_property.h>
32
33
namespace libnormaliz {
34
35
class NormalizException: public std::exception {
36
public:
37
virtual const char* what() const throw() = 0;
38
};
39
40
class ArithmeticException: public NormalizException {
41
public:
42
ArithmeticException() : msg("Overflow detected. A fatal size excess or a computation overflow.\n If Normaliz has terminated and you are using LongLong, rerun without it.") {}
43
~ArithmeticException() throw() {}
44
45
template<typename Integer>
46
ArithmeticException(const Integer& convert_number){
47
48
static int CCCCCCC=0;
49
50
CCCCCCC++;
51
/* if(CCCCCCC>=3)
52
assert(false);*/
53
std::stringstream stream;
54
stream << "Could not convert " << convert_number << ".\n";
55
stream << "Overflow detected. A fatal size excess or a computation overflow.\n If Normaliz has terminated and you are using LongLong, rerun without it.";
56
msg = stream.str();
57
}
58
59
virtual const char* what() const throw() {
60
return msg.c_str();
61
}
62
63
private:
64
std::string msg;
65
};
66
67
class NonpointedException: public NormalizException {
68
public:
69
virtual const char* what() const throw() {
70
return "Cone is not pointed.";
71
}
72
};
73
74
class NotIntegrallyClosedException: public NormalizException {
75
public:
76
virtual const char* what() const throw() {
77
return "Original monoid is not integrally closed.";
78
}
79
};
80
81
class BadInputException: public NormalizException {
82
public:
83
BadInputException(const std::string& message) :
84
msg("Some error in the normaliz input data detected: " + message)
85
{}
86
~BadInputException() throw() {}
87
88
virtual const char* what() const throw() {
89
return msg.c_str();
90
}
91
92
private:
93
std::string msg;
94
};
95
96
class NmzCoCoAException: public NormalizException {
97
public:
98
NmzCoCoAException(const std::string& message) :
99
msg(message)
100
{}
101
~NmzCoCoAException() throw() {}
102
103
virtual const char* what() const throw() {
104
return msg.c_str();
105
}
106
107
private:
108
std::string msg;
109
};
110
111
class NotComputableException: public NormalizException {
112
public:
113
NotComputableException(const std::string& message) : msg("Could not compute: " + message) {}
114
NotComputableException(const ConeProperties& missing) {
115
std::stringstream stream;
116
stream << "Could not compute: " << missing << "!";
117
msg = stream.str();
118
}
119
~NotComputableException() throw() {}
120
121
virtual const char* what() const throw() {
122
return msg.c_str();
123
}
124
125
private:
126
std::string msg;
127
};
128
129
class FatalException: public NormalizException {
130
public:
131
FatalException(const std::string& message) :
132
msg("Fatal error: " + message +"\nThis should not happen, please contact the developers!")
133
{}
134
~FatalException() throw() {}
135
136
virtual const char* what() const throw() {
137
return msg.c_str();
138
}
139
140
private:
141
std::string msg;
142
};
143
144
class InterruptException: public NormalizException {
145
public:
146
InterruptException(const std::string& message ):
147
msg("Interrupted: " + message )
148
{}
149
~InterruptException() throw() {}
150
151
virtual const char* what() const throw() {
152
return msg.c_str();
153
}
154
155
private:
156
std::string msg;
157
158
};
159
160
161
} /* end namespace */
162
163
#endif /* LIBNORMALIZ_H_ */
164
165