12 #include "DASPK-opts.h"
33 #define NUM_OPTIONS 13
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, },
93 std::ostringstream buf;
96 <<
"Options for DASPK include:\n\n"
98 <<
" ------- -----\n";
111 if (val.
numel () == 1)
113 os << val(0) <<
"\n";
133 if (val.
numel () == 1)
135 os << val(0) <<
"\n";
153 int val =
daspk_opts.compute_consistent_initial_condition ();
165 int val =
daspk_opts.use_initial_condition_heuristics ();
179 if (val.
numel () == 1)
181 os << val(0) <<
"\n";
199 int val =
daspk_opts.print_initial_condition_info ();
211 int val =
daspk_opts.exclude_algebraic_variables_from_error_test ();
225 if (val.
numel () == 1)
227 os << val(0) <<
"\n";
248 int val =
daspk_opts.enforce_inequality_constraints ();
262 if (val.
numel () == 1)
264 os << val(0) <<
"\n";
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))
341 daspk_opts.set_compute_consistent_initial_condition (tmp);
344 keyword, list[3].min_toks_to_match,
MAX_TOKENS))
348 daspk_opts.set_use_initial_condition_heuristics (tmp);
351 keyword, list[4].min_toks_to_match,
MAX_TOKENS))
355 daspk_opts.set_initial_condition_heuristics (tmp);
358 keyword, list[5].min_toks_to_match,
MAX_TOKENS))
362 daspk_opts.set_print_initial_condition_info (tmp);
365 keyword, list[6].min_toks_to_match,
MAX_TOKENS))
369 daspk_opts.set_exclude_algebraic_variables_from_error_test (tmp);
372 keyword, list[7].min_toks_to_match,
MAX_TOKENS))
379 keyword, list[8].min_toks_to_match,
MAX_TOKENS))
383 daspk_opts.set_enforce_inequality_constraints (tmp);
386 keyword, list[9].min_toks_to_match,
MAX_TOKENS))
390 daspk_opts.set_inequality_constraint_types (tmp);
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 ());
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))
457 int val =
daspk_opts.compute_consistent_initial_condition ();
459 retval =
static_cast<double> (val);
462 keyword, list[3].min_toks_to_match,
MAX_TOKENS))
464 int val =
daspk_opts.use_initial_condition_heuristics ();
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))
485 int val =
daspk_opts.print_initial_condition_info ();
487 retval =
static_cast<double> (val);
490 keyword, list[6].min_toks_to_match,
MAX_TOKENS))
492 int val =
daspk_opts.exclude_algebraic_variables_from_error_test ();
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))
517 int val =
daspk_opts.enforce_inequality_constraints ();
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 ());
568 DEFUN (daspk_options, args, ,
744 int nargin = args.length ();
755 std::string keyword = args(0).xstring_value (
"daspk_options: expecting keyword as first argument");
static DASPK_options_struct DASPK_options_table[]
static void set_DASPK_options(const std::string &keyword, const octave_value &val)
static void print_DASPK_options(std::ostream &os)
static octave_value_list show_DASPK_options(const std::string &keyword)
static DASPK_options daspk_opts
octave_idx_type numel(void) const
Number of elements in the array.
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
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
OCTINTERP_API void print_usage(void)
#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)
octave_value::octave_value(const Array< char > &chm, char type) return retval
void octave_print_internal(std::ostream &os, const float_display_format &fmt, bool d, bool pr_as_read_syntax)