26 #ifndef CASADI_ORACLE_FUNCTION_HPP
27 #define CASADI_ORACLE_FUNCTION_HPP
29 #include "function_internal.hpp"
100 bool monitored =
false;
136 void init(
const Dict& opts)
override;
139 void finalize()
override;
156 const std::vector<std::string>& s_in,
157 const std::vector<std::string>& s_out,
162 Function create_function(
const std::string& fname,
163 const std::vector<std::string>& s_in,
164 const std::vector<std::string>& s_out,
169 Function create_function(
const std::string& fname,
170 const std::vector<MX>& e_in,
171 const std::vector<MX>& e_out,
172 const std::vector<std::string>& s_in,
173 const std::vector<std::string>& s_out,
177 Function create_forward(
const std::string& fname, casadi_int nfwd);
180 void set_function(
const Function& fcn,
const std::string& fname,
bool jit=
false);
187 const double*
const* arg=
nullptr,
int thread_id=0)
const;
190 int calc_sp_forward(
const std::string& fcn,
const bvec_t** arg,
bvec_t** res,
191 casadi_int* iw,
bvec_t* w)
const;
194 int calc_sp_reverse(
const std::string& fcn,
bvec_t** arg,
bvec_t** res,
195 casadi_int* iw,
bvec_t* w)
const;
202 std::vector<std::string> get_function()
const override;
205 const Function& get_function(
const std::string &name)
const override;
208 virtual bool monitored(
const std::string &name)
const;
211 bool has_function(
const std::string& fname)
const override;
216 std::string generate_dependencies(
const std::string& fname,
const Dict& opts)
const override;
221 void jit_dependencies(
const std::string& fname)
override;
231 int local_init_mem(
void* mem)
const;
236 int init_mem(
void* mem)
const override;
246 void set_temp(
void* mem,
const double** arg,
double** res,
247 casadi_int* iw,
double* w)
const override;
250 Dict get_stats(
void* mem)
const override;
275 template<
typename T1>
281 catch (
const std::exception& e) {
282 uerr() << e.what() << std::endl;
Helper class for C code generation.
Helper class for Serialization.
Internal class for Function.
const std::string & name() const
Name of the function.
std::map< std::string, std::vector< std::string > > AuxOut
Base class for functions that perform calculation with an oracle.
Function oracle_
Oracle: Used to generate other functions.
std::map< std::string, RegFun > all_functions_
void * alloc_mem() const override
Create memory block.
int calc_function(OracleMemory *m, const std::string &fcn, const double *const *arg=nullptr, int thread_id=0) const
std::vector< std::string > monitor_
void set_function(const Function &fcn)
void free_mem(void *mem) const override
Free memory block.
Dict common_options_
Options for creating functions.
static const Options options_
Options.
const Function & oracle() const override
Get oracle.
bool show_eval_warnings_
Show evaluation warnings.
const Options & get_options() const override
Options.
Helper class for Serialization.
unsigned long long bvec_t
int calc_function(const OracleCallback *cb, casadi_oracle_data< T1 > *d)
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.
Function memory with temporary work vectors.
Function memory with temporary work vectors.
Options metadata for a class.
casadi_oracle_data< double > d_oracle
std::vector< LocalOracleMemory * > thread_local_mem