23 #if defined (HAVE_CONFIG_H) 45 #include "DASRT-opts.cc" 66 assert (
x.numel () == xdot.
numel ());
82 catch (octave::execution_exception&
e)
87 if (
tmp.empty () || !
tmp(0).is_defined ())
92 warning (
"dasrt: ignoring imaginary part returned from user-supplied function");
123 catch (octave::execution_exception&
e)
128 if (
tmp.empty () || !
tmp(0).is_defined ())
133 warning (
"dasrt: ignoring imaginary part returned from user-supplied constraint function");
152 assert (
x.numel () == xdot.
numel ());
169 catch (octave::execution_exception&
e)
174 int tlen =
tmp.length ();
175 if (tlen == 0 || !
tmp(0).is_defined ())
180 warning (
"dasrt: ignoring imaginary part returned from user-supplied jacobian function");
336 int nargin = args.length ();
353 error (
"dasrt: invalid recursive call");
374 else if (
c.numel () == 2)
376 if (
c(0).is_function_handle () ||
c(0).is_inline_function ())
381 fname =
"function y = ";
382 fname.append (fcn_name);
383 fname.append (
" (x, xdot, t) y = ");
390 if (
c(1).is_function_handle () ||
c(1).is_inline_function ())
395 jname =
"function jac = ";
396 jname.append (jac_name);
397 jname.append (
" (x, xdot, t, cj) jac = ");
403 if (fcn_name.length ())
411 error (
"dasrt: incorrect number of elements in cell array");
420 switch (f_arg.
rows ())
424 fname =
"function y = ";
425 fname.append (fcn_name);
426 fname.append (
" (x, xdot, t) y = ");
436 fname =
"function y = ";
437 fname.append (fcn_name);
438 fname.append (
" (x, xdot, t) y = ");
440 fname,
"; endfunction");
445 jname =
"function jac = ";
446 jname.append (jac_name);
447 jname.append (
" (x, xdot, t, cj) jac = ");
449 jname,
"; endfunction");
458 error (
"dasrt: first arg should be a string or 2-element string array");
470 if (args(1).isempty () && args(1).is_double_type ())
479 if (args(1).is_function_handle () || args(1).is_inline_function ())
481 else if (args(1).is_string ())
484 fname =
"function g_out = ";
485 fname.append (fcn_name);
486 fname.append (
" (x, t) g_out = ");
502 ColumnVector state = args(argp++).xvector_value (
"dasrt: initial state X_0 must be a vector");
504 ColumnVector stateprime = args(argp++).xvector_value (
"dasrt: initial derivatives XDOT_0 must be a vector");
506 ColumnVector out_times = args(argp++).xvector_value (
"dasrt: output time variable T must be a vector");
508 double tzero = out_times (0);
512 bool crit_times_set =
false;
516 crit_times = args(argp).xvector_value (
"dasrt: list of critical times T_CRIT must be a vector");
519 crit_times_set =
true;
529 dae.set_options (dasrt_opts);
532 output = dae.
integrate (out_times, crit_times);
536 if (fcn_name.length ())
538 if (jac_name.length ())
552 error (
"dasrt: %s", msg.c_str ());
OCTINTERP_API octave_value_list feval(const std::string &name, const octave_value_list &args=octave_value_list(), int nargout=0)
std::string error_message(void) const
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
OCTINTERP_API void print_usage(void)
DAERTFunc & set_constraint_function(DAERTConstrFunc cf)
void error(const char *fmt,...)
static octave_function * dasrt_j
octave_idx_type integration_state(void) const
ColumnVector times(void) const
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
std::string unique_symbol_name(const std::string &basename)
bool integration_ok(void) const
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
bool is_function_handle(void) const
static octave_function * dasrt_cf
octave_idx_type rows(void) const
octave_function * function_value(bool silent=false) const
DASRT_result integrate(const ColumnVector &tout)
static bool warned_cf_imaginary
static uint32_t state[624]
void warning(const char *fmt,...)
octave::unwind_protect frame
static ColumnVector dasrt_user_f(const ColumnVector &x, const ColumnVector &xdot, double t, octave_idx_type &)
static ColumnVector dasrt_user_cf(const ColumnVector &x, double t)
void err_user_supplied_eval(const char *name)
static Matrix dasrt_user_j(const ColumnVector &x, const ColumnVector &xdot, double t, double cj)
static bool warned_fcn_imaginary
octave_function * extract_function(const octave_value &arg, const std::string &warn_for, const std::string &fname, const std::string &header, const std::string &trailer)
void clear_function(const std::string &name)
virtual octave_function * function_value(bool silent=false)
octave_idx_type numel(void) const
Number of elements in the array.
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
static octave_function * dasrt_f
Cell cell_value(void) const
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE * x
static bool warned_jac_imaginary
bool is_inline_function(void) const
DAEFunc & set_jacobian_function(DAEJacFunc j)