00001
00002
00003
00004 #if !defined (octave_DASPK_options_h)
00005 #define octave_DASPK_options_h 1
00006
00007 #include <cfloat>
00008 #include <cmath>
00009
00010 #include <DAE.h>
00011
00012
00013 class
00014 DASPK_options
00015 {
00016 public:
00017
00018 DASPK_options (void) { init (); }
00019
00020 DASPK_options (const DASPK_options& opt) { copy (opt); }
00021
00022 DASPK_options& operator = (const DASPK_options& opt)
00023 {
00024 if (this != &opt)
00025 copy (opt);
00026
00027 return *this;
00028 }
00029
00030 ~DASPK_options (void) { }
00031
00032 void init (void)
00033 {
00034 x_absolute_tolerance.resize (1);
00035 x_absolute_tolerance(0) = ::sqrt (DBL_EPSILON);
00036 x_relative_tolerance.resize (1);
00037 x_relative_tolerance(0) = ::sqrt (DBL_EPSILON);
00038 x_initial_condition_heuristics.resize (6);
00039 x_initial_condition_heuristics(0) = 5.0;
00040 x_initial_condition_heuristics(1) = 6.0;
00041 x_initial_condition_heuristics(2) = 5.0;
00042 x_initial_condition_heuristics(3) = 0.0;
00043 x_initial_condition_heuristics(4) = ::pow (DBL_EPSILON, 2.0/3.0);
00044 x_initial_condition_heuristics(5) = 0.01;
00045 x_algebraic_variables.resize (1);
00046 x_algebraic_variables(0) = 0;
00047 x_inequality_constraint_types.resize (1);
00048 x_inequality_constraint_types(0) = 0;
00049 x_initial_step_size = -1.0;
00050 x_maximum_order = 5;
00051 x_maximum_step_size = -1.0;
00052 reset = true;
00053 }
00054
00055 void copy (const DASPK_options& opt)
00056 {
00057 x_absolute_tolerance = opt.x_absolute_tolerance;
00058 x_relative_tolerance = opt.x_relative_tolerance;
00059 x_compute_consistent_initial_condition = opt.x_compute_consistent_initial_condition;
00060 x_use_initial_condition_heuristics = opt.x_use_initial_condition_heuristics;
00061 x_initial_condition_heuristics = opt.x_initial_condition_heuristics;
00062 x_print_initial_condition_info = opt.x_print_initial_condition_info;
00063 x_exclude_algebraic_variables_from_error_test = opt.x_exclude_algebraic_variables_from_error_test;
00064 x_algebraic_variables = opt.x_algebraic_variables;
00065 x_enforce_inequality_constraints = opt.x_enforce_inequality_constraints;
00066 x_inequality_constraint_types = opt.x_inequality_constraint_types;
00067 x_initial_step_size = opt.x_initial_step_size;
00068 x_maximum_order = opt.x_maximum_order;
00069 x_maximum_step_size = opt.x_maximum_step_size;
00070 reset = opt.reset;
00071 }
00072
00073 void set_options (const DASPK_options& opt) { copy (opt); }
00074
00075 void set_default_options (void) { init (); }
00076
00077 void set_absolute_tolerance (double val)
00078 {
00079 x_absolute_tolerance.resize (1);
00080 x_absolute_tolerance(0) = (val > 0.0) ? val : ::sqrt (DBL_EPSILON);
00081 reset = true;
00082 }
00083
00084 void set_absolute_tolerance (const Array<double>& val)
00085 { x_absolute_tolerance = val; reset = true; }
00086
00087 void set_relative_tolerance (double val)
00088 {
00089 x_relative_tolerance.resize (1);
00090 x_relative_tolerance(0) = (val > 0.0) ? val : ::sqrt (DBL_EPSILON);
00091 reset = true;
00092 }
00093
00094 void set_relative_tolerance (const Array<double>& val)
00095 { x_relative_tolerance = val; reset = true; }
00096
00097 void set_compute_consistent_initial_condition (octave_idx_type val)
00098 { x_compute_consistent_initial_condition = val; reset = true; }
00099
00100 void set_use_initial_condition_heuristics (octave_idx_type val)
00101 { x_use_initial_condition_heuristics = val; reset = true; }
00102
00103 void set_initial_condition_heuristics (const Array<double>& val)
00104 { x_initial_condition_heuristics = val; reset = true; }
00105
00106 void set_print_initial_condition_info (octave_idx_type val)
00107 { x_print_initial_condition_info = val; reset = true; }
00108
00109 void set_exclude_algebraic_variables_from_error_test (octave_idx_type val)
00110 { x_exclude_algebraic_variables_from_error_test = val; reset = true; }
00111
00112 void set_algebraic_variables (int val)
00113 {
00114 x_algebraic_variables.resize (1);
00115 x_algebraic_variables(0) = val;
00116 reset = true;
00117 }
00118
00119 void set_algebraic_variables (const Array<octave_idx_type>& val)
00120 { x_algebraic_variables = val; reset = true; }
00121
00122 void set_enforce_inequality_constraints (octave_idx_type val)
00123 { x_enforce_inequality_constraints = val; reset = true; }
00124
00125 void set_inequality_constraint_types (octave_idx_type val)
00126 {
00127 x_inequality_constraint_types.resize (1);
00128 x_inequality_constraint_types(0) = val;
00129 reset = true;
00130 }
00131
00132 void set_inequality_constraint_types (const Array<octave_idx_type>& val)
00133 { x_inequality_constraint_types = val; reset = true; }
00134
00135 void set_initial_step_size (double val)
00136 { x_initial_step_size = (val >= 0.0) ? val : -1.0; reset = true; }
00137
00138 void set_maximum_order (octave_idx_type val)
00139 { x_maximum_order = val; reset = true; }
00140
00141 void set_maximum_step_size (double val)
00142 { x_maximum_step_size = (val >= 0.0) ? val : -1.0; reset = true; }
00143 Array<double> absolute_tolerance (void) const
00144 { return x_absolute_tolerance; }
00145
00146 Array<double> relative_tolerance (void) const
00147 { return x_relative_tolerance; }
00148
00149 octave_idx_type compute_consistent_initial_condition (void) const
00150 { return x_compute_consistent_initial_condition; }
00151
00152 octave_idx_type use_initial_condition_heuristics (void) const
00153 { return x_use_initial_condition_heuristics; }
00154
00155 Array<double> initial_condition_heuristics (void) const
00156 { return x_initial_condition_heuristics; }
00157
00158 octave_idx_type print_initial_condition_info (void) const
00159 { return x_print_initial_condition_info; }
00160
00161 octave_idx_type exclude_algebraic_variables_from_error_test (void) const
00162 { return x_exclude_algebraic_variables_from_error_test; }
00163
00164 Array<octave_idx_type> algebraic_variables (void) const
00165 { return x_algebraic_variables; }
00166
00167 octave_idx_type enforce_inequality_constraints (void) const
00168 { return x_enforce_inequality_constraints; }
00169
00170 Array<octave_idx_type> inequality_constraint_types (void) const
00171 { return x_inequality_constraint_types; }
00172
00173 double initial_step_size (void) const
00174 { return x_initial_step_size; }
00175
00176 octave_idx_type maximum_order (void) const
00177 { return x_maximum_order; }
00178
00179 double maximum_step_size (void) const
00180 { return x_maximum_step_size; }
00181
00182 private:
00183
00184 Array<double> x_absolute_tolerance;
00185 Array<double> x_relative_tolerance;
00186 octave_idx_type x_compute_consistent_initial_condition;
00187 octave_idx_type x_use_initial_condition_heuristics;
00188 Array<double> x_initial_condition_heuristics;
00189 octave_idx_type x_print_initial_condition_info;
00190 octave_idx_type x_exclude_algebraic_variables_from_error_test;
00191 Array<octave_idx_type> x_algebraic_variables;
00192 octave_idx_type x_enforce_inequality_constraints;
00193 Array<octave_idx_type> x_inequality_constraint_types;
00194 double x_initial_step_size;
00195 octave_idx_type x_maximum_order;
00196 double x_maximum_step_size;
00197
00198 protected:
00199
00200 bool reset;
00201 };
00202
00203 #endif