25 struct DASPK_options_struct
30 int min_toks_to_match;
33 #define NUM_OPTIONS 13
35 static DASPK_options_struct DASPK_options_table [] =
37 {
"absolute tolerance",
38 {
"absolute",
"tolerance",
nullptr,
nullptr,
nullptr,
nullptr,
nullptr, },
39 { 2, 0, 0, 0, 0, 0, 0, }, 1, },
41 {
"relative tolerance",
42 {
"relative",
"tolerance",
nullptr,
nullptr,
nullptr,
nullptr,
nullptr, },
43 { 1, 0, 0, 0, 0, 0, 0, }, 1, },
45 {
"compute consistent initial condition",
46 {
"compute",
"consistent",
"initial",
"condition",
nullptr,
nullptr,
nullptr, },
47 { 1, 0, 0, 0, 0, 0, 0, }, 1, },
49 {
"use initial condition heuristics",
50 {
"use",
"initial",
"condition",
"heuristics",
nullptr,
nullptr,
nullptr, },
51 { 1, 0, 0, 0, 0, 0, 0, }, 1, },
53 {
"initial condition heuristics",
54 {
"initial",
"condition",
"heuristics",
nullptr,
nullptr,
nullptr,
nullptr, },
55 { 3, 1, 0, 0, 0, 0, 0, }, 2, },
57 {
"print initial condition info",
58 {
"print",
"initial",
"condition",
"info",
nullptr,
nullptr,
nullptr, },
59 { 1, 0, 0, 0, 0, 0, 0, }, 1, },
61 {
"exclude algebraic variables from error test",
62 {
"exclude",
"algebraic",
"variables",
"from",
"error",
"test",
nullptr, },
63 { 2, 0, 0, 0, 0, 0, 0, }, 1, },
65 {
"algebraic variables",
66 {
"algebraic",
"variables",
nullptr,
nullptr,
nullptr,
nullptr,
nullptr, },
67 { 2, 0, 0, 0, 0, 0, 0, }, 1, },
69 {
"enforce inequality constraints",
70 {
"enforce",
"inequality",
"constraints",
nullptr,
nullptr,
nullptr,
nullptr, },
71 { 2, 0, 0, 0, 0, 0, 0, }, 1, },
73 {
"inequality constraint types",
74 {
"inequality",
"constraint",
"types",
nullptr,
nullptr,
nullptr,
nullptr, },
75 { 3, 0, 0, 0, 0, 0, 0, }, 1, },
77 {
"initial step size",
78 {
"initial",
"step",
"size",
nullptr,
nullptr,
nullptr,
nullptr, },
79 { 3, 1, 0, 0, 0, 0, 0, }, 2, },
82 {
"maximum",
"order",
nullptr,
nullptr,
nullptr,
nullptr,
nullptr, },
83 { 1, 1, 0, 0, 0, 0, 0, }, 2, },
85 {
"maximum step size",
86 {
"maximum",
"step",
"size",
nullptr,
nullptr,
nullptr,
nullptr, },
87 { 1, 1, 0, 0, 0, 0, 0, }, 2, },
91 print_DASPK_options (std::ostream& os)
93 std::ostringstream buf;
96 <<
"Options for DASPK include:\n\n"
98 <<
" ------- -----\n";
100 DASPK_options_struct *list = DASPK_options_table;
104 << std::setiosflags (std::ios::left) << std::setw (50)
106 << std::resetiosflags (std::ios::left)
111 if (val.
numel () == 1)
113 os << val(0) <<
"\n";
126 << std::setiosflags (std::ios::left) << std::setw (50)
128 << std::resetiosflags (std::ios::left)
133 if (val.
numel () == 1)
135 os << val(0) <<
"\n";
148 << std::setiosflags (std::ios::left) << std::setw (50)
150 << std::resetiosflags (std::ios::left)
160 << std::setiosflags (std::ios::left) << std::setw (50)
162 << std::resetiosflags (std::ios::left)
172 << std::setiosflags (std::ios::left) << std::setw (50)
174 << std::resetiosflags (std::ios::left)
179 if (val.
numel () == 1)
181 os << val(0) <<
"\n";
194 << std::setiosflags (std::ios::left) << std::setw (50)
196 << std::resetiosflags (std::ios::left)
206 << std::setiosflags (std::ios::left) << std::setw (50)
208 << std::resetiosflags (std::ios::left)
218 << std::setiosflags (std::ios::left) << std::setw (50)
220 << std::resetiosflags (std::ios::left)
225 if (val.
numel () == 1)
227 os << val(0) <<
"\n";
243 << std::setiosflags (std::ios::left) << std::setw (50)
245 << std::resetiosflags (std::ios::left)
255 << std::setiosflags (std::ios::left) << std::setw (50)
257 << std::resetiosflags (std::ios::left)
262 if (val.
numel () == 1)
264 os << val(0) <<
"\n";
280 << std::setiosflags (std::ios::left) << std::setw (50)
282 << std::resetiosflags (std::ios::left)
292 << std::setiosflags (std::ios::left) << std::setw (50)
294 << std::resetiosflags (std::ios::left)
304 << std::setiosflags (std::ios::left) << std::setw (50)
306 << std::resetiosflags (std::ios::left)
318 set_DASPK_options (
const std::string& keyword,
const octave_value& val)
320 DASPK_options_struct *list = DASPK_options_table;
323 keyword, list[0].min_toks_to_match,
MAX_TOKENS))
330 keyword, list[1].min_toks_to_match,
MAX_TOKENS))
337 keyword, list[2].min_toks_to_match,
MAX_TOKENS))
344 keyword, list[3].min_toks_to_match,
MAX_TOKENS))
351 keyword, list[4].min_toks_to_match,
MAX_TOKENS))
358 keyword, list[5].min_toks_to_match,
MAX_TOKENS))
365 keyword, list[6].min_toks_to_match,
MAX_TOKENS))
372 keyword, list[7].min_toks_to_match,
MAX_TOKENS))
379 keyword, list[8].min_toks_to_match,
MAX_TOKENS))
386 keyword, list[9].min_toks_to_match,
MAX_TOKENS))
393 keyword, list[10].min_toks_to_match,
MAX_TOKENS))
400 keyword, list[11].min_toks_to_match,
MAX_TOKENS))
407 keyword, list[12].min_toks_to_match,
MAX_TOKENS))
415 warning (
"daspk_options: no match for `%s'", keyword.c_str ());
420 show_DASPK_options (
const std::string& keyword)
424 DASPK_options_struct *list = DASPK_options_table;
427 keyword, list[0].min_toks_to_match,
MAX_TOKENS))
431 if (val.
numel () == 1)
441 keyword, list[1].min_toks_to_match,
MAX_TOKENS))
445 if (val.
numel () == 1)
455 keyword, list[2].min_toks_to_match,
MAX_TOKENS))
459 retval =
static_cast<double> (val);
462 keyword, list[3].min_toks_to_match,
MAX_TOKENS))
466 retval =
static_cast<double> (val);
469 keyword, list[4].min_toks_to_match,
MAX_TOKENS))
473 if (val.
numel () == 1)
483 keyword, list[5].min_toks_to_match,
MAX_TOKENS))
487 retval =
static_cast<double> (val);
490 keyword, list[6].min_toks_to_match,
MAX_TOKENS))
494 retval =
static_cast<double> (val);
497 keyword, list[7].min_toks_to_match,
MAX_TOKENS))
501 if (val.
numel () == 1)
503 retval =
static_cast<double> (val(0));
515 keyword, list[8].min_toks_to_match,
MAX_TOKENS))
519 retval =
static_cast<double> (val);
522 keyword, list[9].min_toks_to_match,
MAX_TOKENS))
526 if (val.
numel () == 1)
528 retval =
static_cast<double> (val(0));
540 keyword, list[10].min_toks_to_match,
MAX_TOKENS))
547 keyword, list[11].min_toks_to_match,
MAX_TOKENS))
551 retval =
static_cast<double> (val);
554 keyword, list[12].min_toks_to_match,
MAX_TOKENS))
562 warning (
"daspk_options: no match for `%s'", keyword.c_str ());
570 DEFUN (daspk_options, args, ,
746 int nargin = args.
length ();
757 std::string keyword = args(0).xstring_value (
"daspk_options: expecting keyword as first argument");
760 retval = show_DASPK_options (keyword);
762 set_DASPK_options (keyword, args(1));
768 OCTAVE_END_NAMESPACE(
octave)
octave_idx_type numel() const
Number of elements in the array.
void set_use_initial_condition_heuristics(octave_idx_type val)
octave_idx_type enforce_inequality_constraints() const
double initial_step_size() const
void set_maximum_step_size(double val)
octave_idx_type maximum_order() const
Array< double > absolute_tolerance() const
void set_enforce_inequality_constraints(octave_idx_type val)
Array< octave_idx_type > inequality_constraint_types() const
void set_maximum_order(octave_idx_type val)
octave_idx_type use_initial_condition_heuristics() const
void set_compute_consistent_initial_condition(octave_idx_type val)
void set_exclude_algebraic_variables_from_error_test(octave_idx_type val)
void set_absolute_tolerance(double val)
octave_idx_type compute_consistent_initial_condition() const
double maximum_step_size() const
void set_print_initial_condition_info(octave_idx_type val)
void set_inequality_constraint_types(octave_idx_type val)
void set_relative_tolerance(double val)
void set_initial_step_size(double val)
void set_algebraic_variables(int val)
Array< octave_idx_type > algebraic_variables() const
void set_initial_condition_heuristics(const Array< double > &val)
Array< double > relative_tolerance() const
Array< double > initial_condition_heuristics() const
octave_idx_type exclude_algebraic_variables_from_error_test() const
octave_idx_type print_initial_condition_info() const
int int_value(bool req_int=false, bool frc_str_conv=false) const
Array< double > vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_idx_type length() const
Array< int > int_vector_value(bool req_int=false, bool frc_str_conv=false, bool frc_vec_conv=false) const
double double_value(bool frc_str_conv=false) const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void warning(const char *fmt,...)
int keyword_almost_match(const char *const *std, int *min_len, const std::string &s, int min_toks_to_match, int max_toks)
void octave_print_internal(std::ostream &os, const float_display_format &fmt, bool d, bool pr_as_read_syntax)