GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
LSODE-opts.h
Go to the documentation of this file.
1 // DO NOT EDIT!
2 // Generated automatically from liboctave/numeric/LSODE-opts.in.
3 
4 #if ! defined (octave_LSODE_options_h)
5 #define octave_LSODE_options_h 1
6 
7 #include <cmath>
8 
9 #include <limits>
10 
11 #include "ODE.h"
12 
13 
14 class
16 {
17 public:
18 
20  : m_absolute_tolerance (),
21  m_relative_tolerance (),
22  m_integration_method (),
23  m_initial_step_size (),
24  m_maximum_order (),
25  m_maximum_step_size (),
26  m_minimum_step_size (),
27  m_step_limit (),
28  m_jacobian_type (),
29  m_lower_jacobian_subdiagonals (),
30  m_upper_jacobian_subdiagonals (),
31  m_reset ()
32  {
33  init ();
34  }
35 
37  : m_absolute_tolerance (opt.m_absolute_tolerance),
38  m_relative_tolerance (opt.m_relative_tolerance),
39  m_integration_method (opt.m_integration_method),
40  m_initial_step_size (opt.m_initial_step_size),
41  m_maximum_order (opt.m_maximum_order),
42  m_maximum_step_size (opt.m_maximum_step_size),
43  m_minimum_step_size (opt.m_minimum_step_size),
44  m_step_limit (opt.m_step_limit),
45  m_jacobian_type (opt.m_jacobian_type),
46  m_lower_jacobian_subdiagonals (opt.m_lower_jacobian_subdiagonals),
47  m_upper_jacobian_subdiagonals (opt.m_upper_jacobian_subdiagonals),
48  m_reset (opt.m_reset)
49  { }
50 
51  LSODE_options& operator = (const LSODE_options& opt)
52  {
53  if (this != &opt)
54  {
55  m_absolute_tolerance = opt.m_absolute_tolerance;
56  m_relative_tolerance = opt.m_relative_tolerance;
57  m_integration_method = opt.m_integration_method;
58  m_initial_step_size = opt.m_initial_step_size;
59  m_maximum_order = opt.m_maximum_order;
60  m_maximum_step_size = opt.m_maximum_step_size;
61  m_minimum_step_size = opt.m_minimum_step_size;
62  m_step_limit = opt.m_step_limit;
63  m_jacobian_type = opt.m_jacobian_type;
64  m_lower_jacobian_subdiagonals = opt.m_lower_jacobian_subdiagonals;
65  m_upper_jacobian_subdiagonals = opt.m_upper_jacobian_subdiagonals;
66  m_reset = opt.m_reset;
67  }
68 
69  return *this;
70  }
71 
73 
74  void init ()
75  {
76  m_absolute_tolerance.resize (dim_vector (1, 1));
77  m_absolute_tolerance(0) = ::sqrt (std::numeric_limits<double>::epsilon ());
78  m_relative_tolerance = ::sqrt (std::numeric_limits<double>::epsilon ());
79  m_integration_method = "stiff";
80  m_initial_step_size = -1.0;
81  m_maximum_order = -1;
82  m_maximum_step_size = -1.0;
83  m_minimum_step_size = 0.0;
84  m_step_limit = 100000;
85  m_jacobian_type = "full";
86  m_lower_jacobian_subdiagonals = 0;
87  m_upper_jacobian_subdiagonals = 0;
88  m_reset = true;
89  }
90 
91  void set_options (const LSODE_options& opt)
92  {
93  m_absolute_tolerance = opt.m_absolute_tolerance;
94  m_relative_tolerance = opt.m_relative_tolerance;
95  m_integration_method = opt.m_integration_method;
96  m_initial_step_size = opt.m_initial_step_size;
97  m_maximum_order = opt.m_maximum_order;
98  m_maximum_step_size = opt.m_maximum_step_size;
99  m_minimum_step_size = opt.m_minimum_step_size;
100  m_step_limit = opt.m_step_limit;
101  m_jacobian_type = opt.m_jacobian_type;
102  m_lower_jacobian_subdiagonals = opt.m_lower_jacobian_subdiagonals;
103  m_upper_jacobian_subdiagonals = opt.m_upper_jacobian_subdiagonals;
104  m_reset = opt.m_reset;
105  }
106 
107  void set_default_options () { init (); }
108 
109  void set_absolute_tolerance (double val)
110  {
111  m_absolute_tolerance.resize (dim_vector (1, 1));
112  m_absolute_tolerance(0) = (val > 0.0) ? val : ::sqrt (std::numeric_limits<double>::epsilon ());
113  m_reset = true;
114  }
115 
117  { m_absolute_tolerance = val; m_reset = true; }
118 
119  void set_relative_tolerance (double val)
120  { m_relative_tolerance = (val > 0.0) ? val : ::sqrt (std::numeric_limits<double>::epsilon ()); m_reset = true; }
121 
122  void set_integration_method (const std::string& val)
123  {
124  if (val == "stiff" || val == "bdf")
125  m_integration_method = "stiff";
126  else if (val == "non-stiff" || val == "adams")
127  m_integration_method = "non-stiff";
128  else
130  ("lsode_options: method must be \"stiff\", \"bdf\", \"non-stiff\", or \"adams\"");
131  m_reset = true;
132  }
133 
134  void set_initial_step_size (double val)
135  { m_initial_step_size = (val >= 0.0) ? val : -1.0; m_reset = true; }
136 
138  { m_maximum_order = val; m_reset = true; }
139 
140  void set_maximum_step_size (double val)
141  { m_maximum_step_size = (val >= 0.0) ? val : -1.0; m_reset = true; }
142 
143  void set_minimum_step_size (double val)
144  { m_minimum_step_size = (val >= 0.0) ? val : 0.0; m_reset = true; }
145 
147  { m_step_limit = val; m_reset = true; }
148 
149  void set_jacobian_type (const std::string& val)
150  {
151  if (val == "full" || val == "banded" || val == "diagonal")
152  m_jacobian_type = val;
153  else
155  ("lsode_options: jacobian type must be \"full\", \"banded\", or \"diagonal\"");
156  m_reset = true;
157  }
158 
160  { m_lower_jacobian_subdiagonals = val; m_reset = true; }
161 
163  { m_upper_jacobian_subdiagonals = val; m_reset = true; }
165  { return m_absolute_tolerance; }
166 
167  double relative_tolerance () const
168  { return m_relative_tolerance; }
169 
170  std::string integration_method () const
171  { return m_integration_method; }
172 
173  double initial_step_size () const
174  { return m_initial_step_size; }
175 
177  { return m_maximum_order; }
178 
179  double maximum_step_size () const
180  { return m_maximum_step_size; }
181 
182  double minimum_step_size () const
183  { return m_minimum_step_size; }
184 
186  { return m_step_limit; }
187 
188  std::string jacobian_type () const
189  { return m_jacobian_type; }
190 
192  { return m_lower_jacobian_subdiagonals; }
193 
195  { return m_upper_jacobian_subdiagonals; }
196 
197 private:
198 
199  Array<double> m_absolute_tolerance;
200  double m_relative_tolerance;
201  std::string m_integration_method;
202  double m_initial_step_size;
203  octave_idx_type m_maximum_order;
204  double m_maximum_step_size;
205  double m_minimum_step_size;
206  octave_idx_type m_step_limit;
207  std::string m_jacobian_type;
208  octave_idx_type m_lower_jacobian_subdiagonals;
209  octave_idx_type m_upper_jacobian_subdiagonals;
210 
211 protected:
212 
213  bool m_reset;
214 };
215 
216 #endif
void set_absolute_tolerance(double val)
Definition: LSODE-opts.h:109
std::string jacobian_type() const
Definition: LSODE-opts.h:188
void set_integration_method(const std::string &val)
Definition: LSODE-opts.h:122
double minimum_step_size() const
Definition: LSODE-opts.h:182
octave_idx_type lower_jacobian_subdiagonals() const
Definition: LSODE-opts.h:191
void set_absolute_tolerance(const Array< double > &val)
Definition: LSODE-opts.h:116
void set_jacobian_type(const std::string &val)
Definition: LSODE-opts.h:149
void set_upper_jacobian_subdiagonals(octave_idx_type val)
Definition: LSODE-opts.h:162
void set_lower_jacobian_subdiagonals(octave_idx_type val)
Definition: LSODE-opts.h:159
void set_default_options()
Definition: LSODE-opts.h:107
void set_minimum_step_size(double val)
Definition: LSODE-opts.h:143
std::string integration_method() const
Definition: LSODE-opts.h:170
void set_initial_step_size(double val)
Definition: LSODE-opts.h:134
octave_idx_type step_limit() const
Definition: LSODE-opts.h:185
octave_idx_type maximum_order() const
Definition: LSODE-opts.h:176
octave_idx_type upper_jacobian_subdiagonals() const
Definition: LSODE-opts.h:194
double relative_tolerance() const
Definition: LSODE-opts.h:167
LSODE_options(const LSODE_options &opt)
Definition: LSODE-opts.h:36
void init()
Definition: LSODE-opts.h:74
void set_step_limit(octave_idx_type val)
Definition: LSODE-opts.h:146
double maximum_step_size() const
Definition: LSODE-opts.h:179
double initial_step_size() const
Definition: LSODE-opts.h:173
void set_relative_tolerance(double val)
Definition: LSODE-opts.h:119
Array< double > absolute_tolerance() const
Definition: LSODE-opts.h:164
void set_maximum_order(octave_idx_type val)
Definition: LSODE-opts.h:137
void set_options(const LSODE_options &opt)
Definition: LSODE-opts.h:91
void set_maximum_step_size(double val)
Definition: LSODE-opts.h:140
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:94
OCTAVE_NORETURN liboctave_error_handler current_liboctave_error_handler
Definition: lo-error.c:41