GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
DASSL-opts.h
Go to the documentation of this file.
1 // DO NOT EDIT!
2 // Generated automatically from liboctave/numeric/DASSL-opts.in.
3 
4 #if ! defined (octave_DASSL_options_h)
5 #define octave_DASSL_options_h 1
6 
7 #include <cmath>
8 
9 #include <limits>
10 
11 #include "DAE.h"
12 
13 
14 class
16 {
17 public:
18 
20  : m_absolute_tolerance (),
21  m_relative_tolerance (),
22  m_compute_consistent_initial_condition (),
23  m_enforce_nonnegativity_constraints (),
24  m_initial_step_size (),
25  m_maximum_order (),
26  m_maximum_step_size (),
27  m_step_limit (),
28  m_reset ()
29  {
30  init ();
31  }
32 
34  : m_absolute_tolerance (opt.m_absolute_tolerance),
35  m_relative_tolerance (opt.m_relative_tolerance),
36  m_compute_consistent_initial_condition (opt.m_compute_consistent_initial_condition),
37  m_enforce_nonnegativity_constraints (opt.m_enforce_nonnegativity_constraints),
38  m_initial_step_size (opt.m_initial_step_size),
39  m_maximum_order (opt.m_maximum_order),
40  m_maximum_step_size (opt.m_maximum_step_size),
41  m_step_limit (opt.m_step_limit),
42  m_reset (opt.m_reset)
43  { }
44 
45  DASSL_options& operator = (const DASSL_options& opt)
46  {
47  if (this != &opt)
48  {
49  m_absolute_tolerance = opt.m_absolute_tolerance;
50  m_relative_tolerance = opt.m_relative_tolerance;
51  m_compute_consistent_initial_condition = opt.m_compute_consistent_initial_condition;
52  m_enforce_nonnegativity_constraints = opt.m_enforce_nonnegativity_constraints;
53  m_initial_step_size = opt.m_initial_step_size;
54  m_maximum_order = opt.m_maximum_order;
55  m_maximum_step_size = opt.m_maximum_step_size;
56  m_step_limit = opt.m_step_limit;
57  m_reset = opt.m_reset;
58  }
59 
60  return *this;
61  }
62 
64 
65  void init ()
66  {
67  m_absolute_tolerance.resize (dim_vector (1, 1));
68  m_absolute_tolerance(0) = ::sqrt (std::numeric_limits<double>::epsilon ());
69  m_relative_tolerance.resize (dim_vector (1, 1));
70  m_relative_tolerance(0) = ::sqrt (std::numeric_limits<double>::epsilon ());
71  m_compute_consistent_initial_condition = 0;
72  m_enforce_nonnegativity_constraints = 0;
73  m_initial_step_size = -1.0;
74  m_maximum_order = -1;
75  m_maximum_step_size = -1.0;
76  m_step_limit = -1;
77  m_reset = true;
78  }
79 
80  void set_options (const DASSL_options& opt)
81  {
82  m_absolute_tolerance = opt.m_absolute_tolerance;
83  m_relative_tolerance = opt.m_relative_tolerance;
84  m_compute_consistent_initial_condition = opt.m_compute_consistent_initial_condition;
85  m_enforce_nonnegativity_constraints = opt.m_enforce_nonnegativity_constraints;
86  m_initial_step_size = opt.m_initial_step_size;
87  m_maximum_order = opt.m_maximum_order;
88  m_maximum_step_size = opt.m_maximum_step_size;
89  m_step_limit = opt.m_step_limit;
90  m_reset = opt.m_reset;
91  }
92 
93  void set_default_options () { init (); }
94 
95  void set_absolute_tolerance (double val)
96  {
97  m_absolute_tolerance.resize (dim_vector (1, 1));
98  m_absolute_tolerance(0) = (val > 0.0) ? val : ::sqrt (std::numeric_limits<double>::epsilon ());
99  m_reset = true;
100  }
101 
103  { m_absolute_tolerance = val; m_reset = true; }
104 
105  void set_relative_tolerance (double val)
106  {
107  m_relative_tolerance.resize (dim_vector (1, 1));
108  m_relative_tolerance(0) = (val > 0.0) ? val : ::sqrt (std::numeric_limits<double>::epsilon ());
109  m_reset = true;
110  }
111 
113  { m_relative_tolerance = val; m_reset = true; }
114 
116  { m_compute_consistent_initial_condition = val; m_reset = true; }
117 
119  { m_enforce_nonnegativity_constraints = val; m_reset = true; }
120 
121  void set_initial_step_size (double val)
122  { m_initial_step_size = (val >= 0.0) ? val : -1.0; m_reset = true; }
123 
125  { m_maximum_order = val; m_reset = true; }
126 
127  void set_maximum_step_size (double val)
128  { m_maximum_step_size = (val >= 0.0) ? val : -1.0; m_reset = true; }
129 
131  { m_step_limit = (val >= 0) ? val : -1; m_reset = true; }
133  { return m_absolute_tolerance; }
134 
136  { return m_relative_tolerance; }
137 
139  { return m_compute_consistent_initial_condition; }
140 
142  { return m_enforce_nonnegativity_constraints; }
143 
144  double initial_step_size () const
145  { return m_initial_step_size; }
146 
148  { return m_maximum_order; }
149 
150  double maximum_step_size () const
151  { return m_maximum_step_size; }
152 
154  { return m_step_limit; }
155 
156 private:
157 
158  Array<double> m_absolute_tolerance;
159  Array<double> m_relative_tolerance;
160  octave_idx_type m_compute_consistent_initial_condition;
161  octave_idx_type m_enforce_nonnegativity_constraints;
162  double m_initial_step_size;
163  octave_idx_type m_maximum_order;
164  double m_maximum_step_size;
165  octave_idx_type m_step_limit;
166 
167 protected:
168 
169  bool m_reset;
170 };
171 
172 #endif
void set_enforce_nonnegativity_constraints(octave_idx_type val)
Definition: DASSL-opts.h:118
Array< double > relative_tolerance() const
Definition: DASSL-opts.h:135
octave_idx_type compute_consistent_initial_condition() const
Definition: DASSL-opts.h:138
octave_idx_type maximum_order() const
Definition: DASSL-opts.h:147
void set_maximum_step_size(double val)
Definition: DASSL-opts.h:127
void set_absolute_tolerance(const Array< double > &val)
Definition: DASSL-opts.h:102
void set_maximum_order(octave_idx_type val)
Definition: DASSL-opts.h:124
Array< double > absolute_tolerance() const
Definition: DASSL-opts.h:132
void set_relative_tolerance(const Array< double > &val)
Definition: DASSL-opts.h:112
double initial_step_size() const
Definition: DASSL-opts.h:144
void set_options(const DASSL_options &opt)
Definition: DASSL-opts.h:80
void set_step_limit(octave_idx_type val)
Definition: DASSL-opts.h:130
DASSL_options(const DASSL_options &opt)
Definition: DASSL-opts.h:33
void set_relative_tolerance(double val)
Definition: DASSL-opts.h:105
void set_default_options()
Definition: DASSL-opts.h:93
double maximum_step_size() const
Definition: DASSL-opts.h:150
void set_compute_consistent_initial_condition(octave_idx_type val)
Definition: DASSL-opts.h:115
void init()
Definition: DASSL-opts.h:65
octave_idx_type enforce_nonnegativity_constraints() const
Definition: DASSL-opts.h:141
octave_idx_type step_limit() const
Definition: DASSL-opts.h:153
void set_initial_step_size(double val)
Definition: DASSL-opts.h:121
void set_absolute_tolerance(double val)
Definition: DASSL-opts.h:95
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:94