26 #ifndef CASADI_RUNTIME_INTEGRATOR_HPP
27 #define CASADI_RUNTIME_INTEGRATOR_HPP
29 #include "integrator_impl.hpp"
54 const std::vector<double>& tout);
68 void init(
const Dict& opts)
override;
73 void set_work(
void* mem,
const double**& arg,
double**& res,
74 casadi_int*& iw,
double*& w)
const override;
79 int init_mem(
void* mem)
const override;
88 bool has_reverse(casadi_int nadj)
const override {
return true;}
95 const double* adj_x,
const double* adj_z,
const double* adj_q)
const override;
99 Sparsity get_sparsity_in(casadi_int i)
override;
100 Sparsity get_sparsity_out(casadi_int i)
override;
104 int eval(
const double** arg,
double** res, casadi_int* iw,
double* w,
105 void* mem)
const override;
110 casadi_int* iw,
bvec_t* w,
void* mem)
const override;
112 void* mem)
const override;
117 double* adj_x,
double* adj_p,
double* adj_u)
const override;
120 Dict get_stats(
void* mem)
const override;
129 bool has_codegen()
const override;
165 void set_nominal_prob();
168 casadi_int
ngroup()
const {
return group_start_.size() - 1;}
171 void alloc_ivp_work();
177 casadi_int tape_capacity()
const;
181 std::vector<double>
a_, alpha_, m_, m_dense_, m_err_;
191 double step_size_,
abstol_, reltol_, step0_, max_step_size_, min_step_size_;
207 enum Src {SRC_T, SRC_Y, SRC_P, SRC_U, SRC_RES, SRC_W, SRC_JAC, SRC_JAC_FWD, SRC_JAC_ADJ,
208 SRC_JAC_ADJ_FWD, SRC_VJP_X, SRC_VJP_Z, SRC_VJP_P, SRC_VJP_U, SRC_EV_ONE, SRC_EV_W, SRC_YDOT,
221 casadi_int n_in, n_out;
222 std::vector<Slot> arg, res;
226 std::vector<std::vector<TaskCall>> task_calls(
const std::string& suffix)
const;
230 const std::vector<std::vector<TaskCall>>& calls)
const;
234 static std::string slot_expr(
const std::string& d,
const Slot& e);
237 int task(RuntimeIntegratorMemory* m)
const;
240 void codegen_task(CodeGenerator& g,
const std::string& d,
241 const std::vector<std::vector<TaskCall>>& calls,
bool in_event =
false)
const;
244 void codegen_loop(CodeGenerator& g)
const;
247 void codegen_ivp_prob(CodeGenerator& g,
const std::string& p, casadi_int tape_size)
const;
250 std::vector<std::vector<TaskCall>> calls_, calls_nom_;
Helper class for C code generation.
Helper class for Serialization.
Internal storage for integrator related data.
Base class of one-step integrators driven by a reverse communication kernel.
std::vector< Sparsity > sp_jac_
bool has_reverse(casadi_int nadj) const override
Adjoint sensitivities, also with events.
casadi_int max_num_steps_
std::vector< casadi_int > group_start_
casadi_ivp_prob< double > p_nom_
virtual void codegen_method(CodeGenerator &g) const =0
Generate code for the problem and data of the method, variables pe and e.
const Options & get_options() const override
Options.
casadi_ivp_prob< double > p_
casadi_int ngroup() const
Number of control groups, columns of the controls.
virtual int kernel(RuntimeIntegratorMemory *m) const =0
Call the kernel of the method: returns 1 while a task is requested.
virtual bool needs_jacobian() const =0
Does the method linearize (tasks EVAL_JAC, EVAL_JAC_ADJ)?
static const Options options_
Options.
Helper class for Serialization.
unsigned long long bvec_t
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.
Options metadata for a class.
casadi_ivp_data< double > d
std::vector< double > tape