-
Notifications
You must be signed in to change notification settings - Fork 3
/
enums.hpp
130 lines (89 loc) · 3.34 KB
/
enums.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
Rehuel: a simple C++ library for solving ODEs
Copyright 2017-2019, Stefan Paquay (stefanpaquay@gmail.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
============================================================================= */
/**
\file enums.hpp
\brief some enums that should be exposed publicly.
*/
#ifndef ENUMS_HPP
#define ENUMS_HPP
#define FOREACH_MULTISTEP_METHOD(METHOD) \
METHOD(ADAMS_BASHFORTH, 10) \
METHOD(ADAMS_MOULTON,11) \
METHOD(BDF, 20) \
// Some macro magic for enum to string and back.
#define FOREACH_IRK_METHOD(METHOD) \
METHOD(IMPLICIT_EULER,200) \
\
METHOD(RADAU_IIA_32, 210) \
METHOD(RADAU_IIA_53, 211) \
METHOD(RADAU_IIA_95, 212) \
METHOD(RADAU_IIA_137, 213) \
\
METHOD(LOBATTO_IIIA_43, 220) \
METHOD(LOBATTO_IIIA_85, 221) \
METHOD(LOBATTO_IIIA_127, 222) \
\
METHOD(LOBATTO_IIIC_43, 230) \
METHOD(LOBATTO_IIIC_85, 231) \
METHOD(LOBATTO_IIIC_127, 232) \
\
METHOD(GAUSS_LEGENDRE_42, 240) \
METHOD(GAUSS_LEGENDRE_63, 241) \
METHOD(GAUSS_LEGENDRE_105, 242) \
METHOD(GAUSS_LEGENDRE_147, 243)
#define FOREACH_ERK_METHOD(METHOD) \
METHOD(EXPLICIT_EULER, 100) \
METHOD(RUNGE_KUTTA_4, 110) \
\
METHOD(BOGACKI_SHAMPINE_32,120) \
\
METHOD(CASH_KARP_54,130) \
METHOD(DORMAND_PRINCE_54,131) \
METHOD(FEHLBERG_54,132)
#define FOREACH_ROSENBROCK_METHOD(METHOD)
#define GENERATE_ENUM(ENUM, VAL) ENUM = VAL,
#define GENERATE_STRING(STRING, VAL) {VAL,#STRING},
#define GENERATE_MAP(STRING, VAL) {#STRING, VAL},
namespace irk {
/// \brief enumerates all implemented implicit RK methods.
enum rk_methods {
FOREACH_IRK_METHOD(GENERATE_ENUM)
};
} // namespace irk
/// \brief enumerates all implemented explicit RK methods.
namespace erk {
enum rk_methods {
FOREACH_ERK_METHOD(GENERATE_ENUM)
};
} // namespace erk
/// \brief enumerates possible return codes.
enum odeint_status_codes {
SUCCESS = 0, ///< Everything is A-OK.
/// The error estimate is too small, so attempt a larger step
DT_TOO_SMALL = 1,
/// The internal solver used very few iterations
INTERNAL_SOLVE_FEW_ITERS = 2,
GENERAL_ERROR = 4, ///< A generic error
/// The error estimate became too large, so attempt a smaller step size
DT_TOO_LARGE = 8,
/// Internal solver failed to calculate stages
INTERNAL_SOLVE_FAILURE = 16,
/// The error exceeded the relative tolerance
ERROR_LARGER_THAN_RELTOL = 32,
/// The error exceeded the absolute tolerance
ERROR_LARGER_THAN_ABSTOL = 64,
ERROR_MAX_STEPS_EXCEEDED = 128
};
static constexpr const double machine_precision = 1e-17;
#endif // ENUMS_HPP