CLASS = "LSODE"

INCLUDE = "ODE.h"

OPTION
  NAME = "absolute tolerance"
  TYPE = "Array<double>"
  SET_ARG_TYPE = "const $TYPE&"
  INIT_BODY
    $OPTVAR.resize (1);
    $OPTVAR(0) = ::sqrt (DBL_EPSILON);
  END_INIT_BODY
  SET_CODE
    void set_$OPT (double val)
      {
        $OPTVAR.resize (1);
        $OPTVAR(0) = (val > 0.0) ? val : ::sqrt (DBL_EPSILON);
        reset = true;
      }

    void set_$OPT (const $TYPE& val)
      { $OPTVAR = val; reset = true; }
  END_SET_CODE
END_OPTION

OPTION
  NAME = "integration method"
  TYPE = "std::string"
  SET_ARG_TYPE = "const $TYPE&"
  INIT_VALUE = ""stiff""
  SET_BODY
    if (val == "stiff" || val == "bdf")
      $OPTVAR = "stiff";
    else if (val == "non-stiff" || val == "adams")
      $OPTVAR = "non-stiff";
    else
      (*current_liboctave_error_handler)
        ("lsode_options: method must be \"stiff\", \"bdf\", \"non-stiff\", or \"adams\"");
  END_SET_BODY
END_OPTION

OPTION
  NAME = "initial step size"
  TYPE = "double"
  INIT_VALUE = "-1.0"
  SET_EXPR = "(val >= 0.0) ? val : -1.0"
END_OPTION

OPTION
  NAME = "maximum step size"
  TYPE = "double"
  INIT_VALUE = "-1.0"
  SET_EXPR = "(val >= 0.0) ? val : -1.0"
END_OPTION

OPTION
  NAME = "minimum step size"
  TYPE = "double"
  INIT_VALUE = "0.0"
  SET_EXPR = "(val >= 0.0) ? val : 0.0"
END_OPTION

OPTION
  NAME = "relative tolerance"
  TYPE = "double"
  INIT_VALUE = "::sqrt (DBL_EPSILON)"
  SET_EXPR = "(val > 0.0) ? val : ::sqrt (DBL_EPSILON)"
END_OPTION

OPTION
  NAME = "step limit"
  TYPE = "int"
  INIT_VALUE = "100000"
  SET_EXPR = "val"
END_OPTION
