GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LSODE-opts.h
Go to the documentation of this file.
1 // DO NOT EDIT!
2 // Generated automatically from numeric/LSODE-opts.in.
3 
4 #if !defined (octave_LSODE_options_h)
5 #define octave_LSODE_options_h 1
6 
7 #include <cfloat>
8 #include <cmath>
9 
10 #include <ODE.h>
11 
12 
13 class
15 {
16 public:
17 
19  : x_absolute_tolerance (),
20  x_relative_tolerance (),
21  x_integration_method (),
22  x_initial_step_size (),
23  x_maximum_order (),
24  x_maximum_step_size (),
25  x_minimum_step_size (),
26  x_step_limit (),
27  reset ()
28  {
29  init ();
30  }
31 
33  : x_absolute_tolerance (opt.x_absolute_tolerance),
34  x_relative_tolerance (opt.x_relative_tolerance),
35  x_integration_method (opt.x_integration_method),
36  x_initial_step_size (opt.x_initial_step_size),
37  x_maximum_order (opt.x_maximum_order),
38  x_maximum_step_size (opt.x_maximum_step_size),
39  x_minimum_step_size (opt.x_minimum_step_size),
40  x_step_limit (opt.x_step_limit),
41  reset (opt.reset)
42  { }
43 
44  LSODE_options& operator = (const LSODE_options& opt)
45  {
46  if (this != &opt)
47  {
48  x_absolute_tolerance = opt.x_absolute_tolerance;
49  x_relative_tolerance = opt.x_relative_tolerance;
50  x_integration_method = opt.x_integration_method;
51  x_initial_step_size = opt.x_initial_step_size;
52  x_maximum_order = opt.x_maximum_order;
53  x_maximum_step_size = opt.x_maximum_step_size;
54  x_minimum_step_size = opt.x_minimum_step_size;
55  x_step_limit = opt.x_step_limit;
56  reset = opt.reset;
57  }
58 
59  return *this;
60  }
61 
62  ~LSODE_options (void) { }
63 
64  void init (void)
65  {
66  x_absolute_tolerance.resize (dim_vector (1, 1));
67  x_absolute_tolerance(0) = ::sqrt (std::numeric_limits<double>::epsilon ());
68  x_relative_tolerance = ::sqrt (std::numeric_limits<double>::epsilon ());
69  x_integration_method = "stiff";
70  x_initial_step_size = -1.0;
71  x_maximum_order = -1;
72  x_maximum_step_size = -1.0;
73  x_minimum_step_size = 0.0;
74  x_step_limit = 100000;
75  reset = true;
76  }
77 
78  void set_options (const LSODE_options& opt)
79  {
80  x_absolute_tolerance = opt.x_absolute_tolerance;
81  x_relative_tolerance = opt.x_relative_tolerance;
82  x_integration_method = opt.x_integration_method;
83  x_initial_step_size = opt.x_initial_step_size;
84  x_maximum_order = opt.x_maximum_order;
85  x_maximum_step_size = opt.x_maximum_step_size;
86  x_minimum_step_size = opt.x_minimum_step_size;
87  x_step_limit = opt.x_step_limit;
88  reset = opt.reset;
89  }
90 
91  void set_default_options (void) { init (); }
92 
93  void set_absolute_tolerance (double val)
94  {
95  x_absolute_tolerance.resize (dim_vector (1, 1));
96  x_absolute_tolerance(0) = (val > 0.0) ? val : ::sqrt (std::numeric_limits<double>::epsilon ());
97  reset = true;
98  }
99 
101  { x_absolute_tolerance = val; reset = true; }
102 
103  void set_relative_tolerance (double val)
104  { x_relative_tolerance = (val > 0.0) ? val : ::sqrt (std::numeric_limits<double>::epsilon ()); reset = true; }
105 
106  void set_integration_method (const std::string& val)
107  {
108  if (val == "stiff" || val == "bdf")
109  x_integration_method = "stiff";
110  else if (val == "non-stiff" || val == "adams")
111  x_integration_method = "non-stiff";
112  else
114  ("lsode_options: method must be \"stiff\", \"bdf\", \"non-stiff\", or \"adams\"");
115  reset = true;
116  }
117 
118  void set_initial_step_size (double val)
119  { x_initial_step_size = (val >= 0.0) ? val : -1.0; reset = true; }
120 
122  { x_maximum_order = val; reset = true; }
123 
124  void set_maximum_step_size (double val)
125  { x_maximum_step_size = (val >= 0.0) ? val : -1.0; reset = true; }
126 
127  void set_minimum_step_size (double val)
128  { x_minimum_step_size = (val >= 0.0) ? val : 0.0; reset = true; }
129 
131  { x_step_limit = val; reset = true; }
133  { return x_absolute_tolerance; }
134 
135  double relative_tolerance (void) const
136  { return x_relative_tolerance; }
137 
138  std::string integration_method (void) const
139  { return x_integration_method; }
140 
141  double initial_step_size (void) const
142  { return x_initial_step_size; }
143 
145  { return x_maximum_order; }
146 
147  double maximum_step_size (void) const
148  { return x_maximum_step_size; }
149 
150  double minimum_step_size (void) const
151  { return x_minimum_step_size; }
152 
154  { return x_step_limit; }
155 
156 private:
157 
160  std::string x_integration_method;
166 
167 protected:
168 
169  bool reset;
170 };
171 
172 #endif
double relative_tolerance(void) const
Definition: LSODE-opts.h:135
~LSODE_options(void)
Definition: LSODE-opts.h:62
void set_initial_step_size(double val)
Definition: LSODE-opts.h:118
double maximum_step_size(void) const
Definition: LSODE-opts.h:147
Array< double > absolute_tolerance(void) const
Definition: LSODE-opts.h:132
double initial_step_size(void) const
Definition: LSODE-opts.h:141
void set_absolute_tolerance(double val)
Definition: LSODE-opts.h:93
std::string integration_method(void) const
Definition: LSODE-opts.h:138
void set_default_options(void)
Definition: LSODE-opts.h:91
Array< double > x_absolute_tolerance
Definition: LSODE-opts.h:158
void set_maximum_step_size(double val)
Definition: LSODE-opts.h:124
void set_options(const LSODE_options &opt)
Definition: LSODE-opts.h:78
void set_relative_tolerance(double val)
Definition: LSODE-opts.h:103
liboctave_error_handler current_liboctave_error_handler
Definition: lo-error.c:38
double x_relative_tolerance
Definition: LSODE-opts.h:159
void set_minimum_step_size(double val)
Definition: LSODE-opts.h:127
void init(void)
Definition: LSODE-opts.h:64
octave_idx_type step_limit(void) const
Definition: LSODE-opts.h:153
std::string x_integration_method
Definition: LSODE-opts.h:160
void set_step_limit(octave_idx_type val)
Definition: LSODE-opts.h:130
LSODE_options(const LSODE_options &opt)
Definition: LSODE-opts.h:32
double x_initial_step_size
Definition: LSODE-opts.h:161
double x_minimum_step_size
Definition: LSODE-opts.h:164
octave_idx_type maximum_order(void) const
Definition: LSODE-opts.h:144
octave_idx_type x_maximum_order
Definition: LSODE-opts.h:162
double x_maximum_step_size
Definition: LSODE-opts.h:163
void set_maximum_order(octave_idx_type val)
Definition: LSODE-opts.h:121
LSODE_options(void)
Definition: LSODE-opts.h:18
octave_idx_type x_step_limit
Definition: LSODE-opts.h:165
double minimum_step_size(void) const
Definition: LSODE-opts.h:150
void set_integration_method(const std::string &val)
Definition: LSODE-opts.h:106
void set_absolute_tolerance(const Array< double > &val)
Definition: LSODE-opts.h:100