25 struct LSODE_options_struct
30 int min_toks_to_match;
33 #define NUM_OPTIONS 11
35 static LSODE_options_struct LSODE_options_table [] =
37 {
"absolute tolerance",
38 {
"absolute",
"tolerance",
nullptr,
nullptr, },
39 { 1, 0, 0, 0, }, 1, },
41 {
"relative tolerance",
42 {
"relative",
"tolerance",
nullptr,
nullptr, },
43 { 1, 0, 0, 0, }, 1, },
45 {
"integration method",
46 {
"integration",
"method",
nullptr,
nullptr, },
47 { 3, 0, 0, 0, }, 1, },
49 {
"initial step size",
50 {
"initial",
"step",
"size",
nullptr, },
51 { 3, 0, 0, 0, }, 1, },
54 {
"maximum",
"order",
nullptr,
nullptr, },
55 { 2, 1, 0, 0, }, 2, },
57 {
"maximum step size",
58 {
"maximum",
"step",
"size",
nullptr, },
59 { 2, 1, 0, 0, }, 2, },
61 {
"minimum step size",
62 {
"minimum",
"step",
"size",
nullptr, },
63 { 2, 0, 0, 0, }, 1, },
66 {
"step",
"limit",
nullptr,
nullptr, },
67 { 1, 0, 0, 0, }, 1, },
70 {
"jacobian",
"type",
nullptr,
nullptr, },
71 { 1, 0, 0, 0, }, 1, },
73 {
"lower jacobian subdiagonals",
74 {
"lower",
"jacobian",
"subdiagonals",
nullptr, },
75 { 1, 0, 0, 0, }, 1, },
77 {
"upper jacobian subdiagonals",
78 {
"upper",
"jacobian",
"subdiagonals",
nullptr, },
79 { 1, 0, 0, 0, }, 1, },
83 print_LSODE_options (std::ostream& os)
85 std::ostringstream buf;
88 <<
"Options for LSODE include:\n\n"
90 <<
" ------- -----\n";
92 LSODE_options_struct *list = LSODE_options_table;
96 << std::setiosflags (std::ios::left) << std::setw (50)
98 << std::resetiosflags (std::ios::left)
103 if (val.
numel () == 1)
105 os << val(0) <<
"\n";
118 << std::setiosflags (std::ios::left) << std::setw (50)
120 << std::resetiosflags (std::ios::left)
130 << std::setiosflags (std::ios::left) << std::setw (50)
132 << std::resetiosflags (std::ios::left)
140 << std::setiosflags (std::ios::left) << std::setw (50)
142 << std::resetiosflags (std::ios::left)
152 << std::setiosflags (std::ios::left) << std::setw (50)
154 << std::resetiosflags (std::ios::left)
164 << std::setiosflags (std::ios::left) << std::setw (50)
166 << std::resetiosflags (std::ios::left)
176 << std::setiosflags (std::ios::left) << std::setw (50)
178 << std::resetiosflags (std::ios::left)
188 << std::setiosflags (std::ios::left) << std::setw (50)
190 << std::resetiosflags (std::ios::left)
200 << std::setiosflags (std::ios::left) << std::setw (50)
202 << std::resetiosflags (std::ios::left)
210 << std::setiosflags (std::ios::left) << std::setw (50)
212 << std::resetiosflags (std::ios::left)
222 << std::setiosflags (std::ios::left) << std::setw (50)
224 << std::resetiosflags (std::ios::left)
236 set_LSODE_options (
const std::string& keyword,
const octave_value& val)
238 LSODE_options_struct *list = LSODE_options_table;
241 keyword, list[0].min_toks_to_match,
MAX_TOKENS))
248 keyword, list[1].min_toks_to_match,
MAX_TOKENS))
255 keyword, list[2].min_toks_to_match,
MAX_TOKENS))
262 keyword, list[3].min_toks_to_match,
MAX_TOKENS))
269 keyword, list[4].min_toks_to_match,
MAX_TOKENS))
276 keyword, list[5].min_toks_to_match,
MAX_TOKENS))
283 keyword, list[6].min_toks_to_match,
MAX_TOKENS))
290 keyword, list[7].min_toks_to_match,
MAX_TOKENS))
297 keyword, list[8].min_toks_to_match,
MAX_TOKENS))
304 keyword, list[9].min_toks_to_match,
MAX_TOKENS))
311 keyword, list[10].min_toks_to_match,
MAX_TOKENS))
319 warning (
"lsode_options: no match for `%s'", keyword.c_str ());
324 show_LSODE_options (
const std::string& keyword)
328 LSODE_options_struct *list = LSODE_options_table;
331 keyword, list[0].min_toks_to_match,
MAX_TOKENS))
335 if (val.
numel () == 1)
345 keyword, list[1].min_toks_to_match,
MAX_TOKENS))
352 keyword, list[2].min_toks_to_match,
MAX_TOKENS))
357 keyword, list[3].min_toks_to_match,
MAX_TOKENS))
364 keyword, list[4].min_toks_to_match,
MAX_TOKENS))
368 retval =
static_cast<double> (val);
371 keyword, list[5].min_toks_to_match,
MAX_TOKENS))
378 keyword, list[6].min_toks_to_match,
MAX_TOKENS))
385 keyword, list[7].min_toks_to_match,
MAX_TOKENS))
389 retval =
static_cast<double> (val);
392 keyword, list[8].min_toks_to_match,
MAX_TOKENS))
397 keyword, list[9].min_toks_to_match,
MAX_TOKENS))
401 retval =
static_cast<double> (val);
404 keyword, list[10].min_toks_to_match,
MAX_TOKENS))
408 retval =
static_cast<double> (val);
412 warning (
"lsode_options: no match for `%s'", keyword.c_str ());
420 DEFUN (lsode_options, args, ,
528 int nargin = args.
length ();
539 std::string keyword = args(0).xstring_value (
"lsode_options: expecting keyword as first argument");
542 retval = show_LSODE_options (keyword);
544 set_LSODE_options (keyword, args(1));
550 OCTAVE_END_NAMESPACE(
octave)
octave_idx_type numel() const
Number of elements in the array.
void set_absolute_tolerance(double val)
std::string jacobian_type() const
void set_integration_method(const std::string &val)
double minimum_step_size() const
octave_idx_type lower_jacobian_subdiagonals() const
void set_jacobian_type(const std::string &val)
void set_upper_jacobian_subdiagonals(octave_idx_type val)
void set_lower_jacobian_subdiagonals(octave_idx_type val)
void set_minimum_step_size(double val)
std::string integration_method() const
void set_initial_step_size(double val)
octave_idx_type step_limit() const
octave_idx_type maximum_order() const
octave_idx_type upper_jacobian_subdiagonals() const
double relative_tolerance() const
void set_step_limit(octave_idx_type val)
double maximum_step_size() const
double initial_step_size() const
void set_relative_tolerance(double val)
Array< double > absolute_tolerance() const
void set_maximum_order(octave_idx_type val)
void set_maximum_step_size(double val)
int int_value(bool req_int=false, bool frc_str_conv=false) const
std::string string_value(bool force=false) const
Array< double > vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_idx_type length() 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)