List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions
casadi::DaeBuilder Class Reference

A symbolic representation of a differential-algebraic equations model. More...

#include <dae_builder.hpp>

Detailed Description

Variables:

t:      independent variable (usually time)
c:      constants
p:      parameters
d:      dependent parameters (time independent)
u:      controls
w:      dependent variables  (time dependent)
x:      differential states
z:      algebraic variables
q:      quadrature states
y:      outputs

Equations:

differential equations: \dot{x} ==  ode(...)
algebraic equations:          0 ==  alg(...)
quadrature equations:   \dot{q} == quad(...)
dependent parameters:         d == ddef(d_prev,p)
dependent variables:          w == wdef(w_prev,x,z,u,p,t)
output equations:             y == ydef(...)
initial equations:     init_lhs == init_rhs(...)
events:      when when_cond < 0: when_lhs := when_rhs
Date
2012-2021
Author
Joel Andersson

Extra doc: https://github.com/casadi/casadi/wiki/L_5c

Definition at line 68 of file dae_builder.hpp.

Inheritance diagram for casadi::DaeBuilder:
Inheritance graph
[legend]
Collaboration diagram for casadi::DaeBuilder:
Collaboration graph
[legend]

Public Types

using internal_base_type = SharedObjectInternal
 
using base_type = SharedObject
 

Public Member Functions

std::string type_name () const
 Readable name of the class. More...
 
 DaeBuilder ()
 Default constructor. More...
 
 DaeBuilder (const std::string &name, const std::string &path="", const Dict &opts=Dict())
 Construct a DaeBuilder instance. More...
 
const std::string & name () const
 Name of instance. More...
 
void reorder (const std::string &cat, const std::vector< std::string > &v)
 Reorder variables in a category. More...
 
void clear_all (const std::string &v)
 [DEPRECATED] Use set_variability, set_causality or set_category to change variable category More...
 
void set_all (const std::string &v, const std::vector< std::string > &name)
 [DEPRECATED] Use set_variability, set_causality, set_category and/or reorder More...
 
void eliminate_d ()
 [DEPRECATED] Use eliminate("d") More...
 
void eliminate_w ()
 [DEPRECATED] Use eliminate("w") More...
 
void eliminate_quad ()
 [DEPRECATED] Use eliminate("q") More...
 
void sort_d ()
 [DEPRECATED] Use sort("d") More...
 
void sort_w ()
 [DEPRECATED] Use sort("w") More...
 
void sort_z (const std::vector< std::string > &z_order)
 [DEPRECATED] Use reorder("z", new_order) More...
 
Function create (const std::string &fname, const Dict &opts=Dict()) const
 Create a function with standard integrator DAE signature. More...
 
Function create () const
 Create a function with standard integrator DAE signature, default naming. More...
 
Function dependent_fun (const std::string &fname, const std::vector< std::string > &s_in, const std::vector< std::string > &s_out) const
 Construct a function for evaluating dependent parameters. More...
 
Function transition (const std::string &fname, casadi_int index) const
 Construct a function describing transition at a specific events. More...
 
Function transition (const std::string &fname) const
 Construct a function describing transition at any events. More...
 
Function transition () const
 Construct an event transition function, default naming. More...
 
std::vector< std::string > der (const std::vector< std::string > &name) const
 Get the time derivative of model variables. More...
 
std::vector< std::string > pre (const std::vector< std::string > &name) const
 Get the pre-variables of model variables. More...
 
MX pre (const MX &v) const
 Get the pre-expression given variable expression. More...
 
bool has_beq (const std::string &name) const
 Does a variable have a binding equation? More...
 
MX beq (const std::string &name) const
 Get the binding equation for a variable. More...
 
std::string causality (const std::string &name) const
 Get the causality. More...
 
void set_causality (const std::string &name, const std::string &val)
 Set the causality, if permitted. More...
 
std::string variability (const std::string &name) const
 Get the variability. More...
 
void set_variability (const std::string &name, const std::string &val)
 Set the variability, if permitted. More...
 
std::string category (const std::string &name) const
 Get the variable category. More...
 
void set_category (const std::string &name, const std::string &val)
 Set the variable category, if permitted. More...
 
casadi_int numel (const std::string &name) const
 Get the number of elements of a variable. More...
 
std::vector< casadi_int > dimension (const std::string &name) const
 Get the dimensions of a variable. More...
 
double start_time () const
 Get the start time. More...
 
void set_start_time (double val)
 Set the start time. More...
 
double stop_time () const
 Get the stop time. More...
 
void set_stop_time (double val)
 Set the stop time. More...
 
double tolerance () const
 Get the tolerance. More...
 
void set_tolerance (double val)
 Set the tolerance. More...
 
double step_size () const
 Get the step size. More...
 
void set_step_size (double val)
 Set the step size. More...
 
std::string der (const std::string &name) const
 Get the time derivative of model variables, single variable. More...
 
std::string pre (const std::string &name) const
 Get the pre-variables of model variables. More...
 
double attribute (const std::string &a, const std::string &name) const
 Get an attribute, single variable. More...
 
void set_attribute (const std::string &a, const std::string &name, double val)
 Set an attribute, single variable. More...
 
double min (const std::string &name) const
 Get the lower bound, single variable. More...
 
void set_min (const std::string &name, double val)
 Set the lower bound, single variable. More...
 
double max (const std::string &name) const
 Get the upper bound, single variable. More...
 
void set_max (const std::string &name, double val)
 Set the upper bound, single variable. More...
 
double nominal (const std::string &name) const
 Get the nominal value, single variable. More...
 
void set_nominal (const std::string &name, double val)
 Set the nominal value, single variable. More...
 
std::vector< double > start (const std::string &name) const
 Get the start attribute, single variable. More...
 
void set_start (const std::string &name, double val)
 Set the start attribute, single variable. More...
 
void set_start (const std::string &name, const std::vector< double > &val)
 Set the start attribute, vector argument. More...
 
void reset ()
 
void set (const std::string &name, double val)
 
void set (const std::string &name, const std::string &val)
 
GenericType get (const std::string &name) const
 Evaluate the values for a set of variables at the initial time, single value. More...
 
std::vector< double > attribute (const std::string &a, const std::vector< std::string > &name) const
 Get an attribute. More...
 
void set_attribute (const std::string &a, const std::vector< std::string > &name, const std::vector< double > &val)
 Set an attribute. More...
 
std::vector< double > min (const std::vector< std::string > &name) const
 Get the lower bound. More...
 
void set_min (const std::vector< std::string > &name, const std::vector< double > &val)
 Set the lower bound. More...
 
std::vector< double > max (const std::vector< std::string > &name) const
 Get the upper bound. More...
 
void set_max (const std::vector< std::string > &name, const std::vector< double > &val)
 Set the upper bound. More...
 
std::vector< double > nominal (const std::vector< std::string > &name) const
 Get the nominal value. More...
 
void set_nominal (const std::vector< std::string > &name, const std::vector< double > &val)
 Set the nominal value. More...
 
std::vector< double > start (const std::vector< std::string > &name) const
 Get the start attribute. More...
 
void set_start (const std::vector< std::string > &name, const std::vector< double > &val)
 Set the start attribute. More...
 
void set (const std::vector< std::string > &name, const std::vector< double > &val)
 Set the current value. More...
 
void set (const std::vector< std::string > &name, const std::vector< std::string > &val)
 Set the current value (string) More...
 
std::vector< GenericTypeget (const std::vector< std::string > &name) const
 Evaluate the values for a set of variables at the initial time. More...
 
bool has (const std::string &name) const
 Check if a particular variable exists. More...
 
std::vector< std::string > all () const
 Get a list of all variables. More...
 
std::vector< std::string > all (const std::string &cat) const
 Get a list of all variables of a particular category. More...
 
MX add_variable (const std::string &name, casadi_int n=1)
 [DEPRECATED] Use add More...
 
MX add_variable (const std::string &name, const Sparsity &sp)
 [DEPRECATED] Use add More...
 
void add_variable (const MX &new_v)
 Add a new variable from symbolic expressions. More...
 
size_t add_variable_new (const std::string &name, casadi_int n=1)
 [DEPRECATED] Use add More...
 
size_t add_variable_new (const std::string &name, const Sparsity &sp)
 [DEPRECATED] Use add More...
 
size_t add_variable_new (const MX &new_v)
 [DEPRECATED] Use add More...
 
bool has_variable (const std::string &name) const
 [DEPRECATED] Ranamed "has" More...
 
std::vector< std::string > all_variables () const
 Get a list of all variables. More...
 
Function oracle (bool sx=false, bool elim_w=false, bool lifted_calls=false) const
 Get the (cached) oracle, SX or MX. More...
 
Sparsity jac_sparsity (const std::vector< std::string > &onames, const std::vector< std::string > &inames) const
 Get Jacobian sparsity. More...
 
Variablenew_variable (const std::string &name, casadi_int numel=1)
 [DEPRECATED] Use add More...
 
const DaeBuilderInternaloperator-> () const
 Access a member function or object. More...
 
DaeBuilderInternaloperator-> ()
 Access a member function or object. More...
 
std::string class_name () const
 Get class name. More...
 
void disp (std::ostream &stream, bool more=false) const
 Print a description of the object. More...
 
std::string get_str (bool more=false) const
 Get string representation. More...
 
void print_ptr (std::ostream &stream=casadi::uout()) const
 
void own (SharedObjectInternal *node)
 
void assign (SharedObjectInternal *node)
 Assign the node to a node class pointer without reference counting. More...
 
SharedObjectInternalget () const
 Get a const pointer to the node. More...
 
casadi_int getCount () const
 Get the reference count. More...
 
void swap (GenericShared &other)
 Swap content with another instance. More...
 
std::string debug_repr () const
 
bool is_null () const
 Is a null pointer? More...
 
casadi_int __hash__ () const
 Returns a number that is unique for a given Node. More...
 
GenericWeakRef< SharedObject, SharedObjectInternal > * weak ()
 Get a weak reference to the object. More...
 
Variables and equations
const MXtime () const
 Expression for independent variable (usually time) More...
 
std::vector< std::string > t_new () const
 Independent variable (usually time) More...
 
std::vector< std::string > x () const
 Differential states. More...
 
std::vector< std::string > y () const
 Outputs *‍/. More...
 
std::vector< MXode () const
 Ordinary differential equations (ODE) More...
 
std::vector< std::string > z () const
 Algebraic variables. More...
 
std::vector< MXalg () const
 Algebraic equations. More...
 
std::vector< std::string > q () const
 Quadrature states. More...
 
std::vector< MXquad () const
 Quadrature equations. More...
 
std::vector< MXzero () const
 Zero-crossing functions. More...
 
std::vector< MXydef () const
 Definitions of output variables. More...
 
std::vector< std::string > u () const
 Free controls. More...
 
std::vector< std::string > p () const
 Parameters. More...
 
std::vector< std::string > c () const
 Named constants. More...
 
std::vector< MXcdef () const
 Definitions of named constants. More...
 
std::vector< std::string > d () const
 Dependent parameters. More...
 
std::vector< MXddef () const
 Definitions of dependent parameters. More...
 
std::vector< std::string > w () const
 Dependent variables. More...
 
std::vector< MXwdef () const
 Dependent variables and corresponding definitions. More...
 
std::vector< MXinit_lhs () const
 Initial conditions, left-hand-side. More...
 
std::vector< MXinit_rhs () const
 Initial conditions, right-hand-side. More...
 
std::vector< std::string > outputs () const
 Model structure: outputs. More...
 
std::vector< std::string > derivatives () const
 Model structure: derivatives. More...
 
std::vector< std::string > initial_unknowns () const
 Model structure: initial unknowns. More...
 
bool has_t () const
 Is there a time variable? More...
 
casadi_int nx () const
 Differential states. More...
 
casadi_int nz () const
 Algebraic variables. More...
 
casadi_int nq () const
 Quadrature states. More...
 
casadi_int nzero () const
 Zero-crossing functions. More...
 
casadi_int ny () const
 Output variables. More...
 
casadi_int nu () const
 Free controls. More...
 
casadi_int np () const
 Parameters. More...
 
casadi_int nc () const
 Named constants. More...
 
casadi_int nd () const
 Dependent parameters. More...
 
casadi_int nw () const
 Dependent variables. More...
 
Symbolic modeling

Formulate a dynamic system model

MX add (const std::string &name, const std::string &causality, const std::string &variability, const Dict &opts=Dict())
 Add a new model variable. More...
 
MX add (const std::string &name, const std::string &causality, const Dict &opts=Dict())
 Add a new model variable, default variability. More...
 
MX add (const std::string &name, const Dict &opts=Dict())
 Add a new model variable, default variability and causality. More...
 
void add (const std::string &name, const std::string &causality, const std::string &variability, const MX &expr, const Dict &opts=Dict())
 Add a new model variable, symbolic expression already available. More...
 
const MXt () const
 [DEPRECATED] Renamed "time" More...
 
MX add_t (const std::string &name="t")
 [DEPRECATED] Replaced by add More...
 
MX add_p (const std::string &name=std::string())
 [DEPRECATED] Replaced by add More...
 
MX add_u (const std::string &name=std::string())
 [DEPRECATED] Replaced by add More...
 
MX add_x (const std::string &name=std::string())
 [DEPRECATED] Replaced by add More...
 
MX add_z (const std::string &name=std::string())
 [DEPRECATED] Replaced by add More...
 
MX add_q (const std::string &name=std::string())
 [DEPRECATED] Replaced by add More...
 
MX add_c (const std::string &name, const MX &new_cdef)
 [DEPRECATED] Replaced by add and eq More...
 
MX add_d (const std::string &name, const MX &new_ddef)
 [DEPRECATED] Replaced by add and eq More...
 
MX add_w (const std::string &name, const MX &new_wdef)
 [DEPRECATED] Replaced by add and eq More...
 
MX add_y (const std::string &name, const MX &new_ydef)
 [DEPRECATED] Replaced by add and eq More...
 
void set_beq (const std::string &name, const MX &val)
 [DEPRECATED] Replaced by eq More...
 
void eq (const MX &lhs, const MX &rhs, const Dict &opts=Dict())
 Add a simple equation. More...
 
void when (const MX &cond, const std::vector< std::string > &eqs, const Dict &opts=Dict())
 Add when equations. More...
 
std::string assign (const std::string &name, const MX &val)
 Assignment inside a when-equation or if-else equation. More...
 
std::string reinit (const std::string &name, const MX &val)
 Reinitialize a state inside when-equations. More...
 
void set_init (const std::string &name, const MX &init_rhs)
 Specify the initial equation for a variable. More...
 
void set_ode (const std::string &name, const MX &ode_rhs)
 [DEPRECATED] Replaced by eq More...
 
void set_alg (const std::string &name, const MX &alg_rhs)
 [DEPRECATED] Replaced by eq More...
 
void add_init (const MX &lhs, const MX &rhs)
 [DEPRECATED] Replaced by set_init More...
 
casadi_int ne () const
 [DEPRECATED] Replaced by nzero() More...
 
std::vector< std::string > e () const
 [DEPRECATED] Use all("zero") *‍/ More...
 
void sanity_check () const
 Check if dimensions match. More...
 
[DEPRECATED] Register an existing variable
void register_t (const std::string &name)
 
void register_p (const std::string &name)
 
void register_u (const std::string &name)
 
void register_x (const std::string &name)
 
void register_z (const std::string &name)
 
void register_q (const std::string &name)
 
void register_c (const std::string &name)
 
void register_d (const std::string &name)
 
void register_w (const std::string &name)
 
void register_y (const std::string &name)
 
void register_e (const std::string &name)
 
Manipulation

Reformulate the dynamic optimization problem.

void eliminate (const std::string &cat)
 Eliminate all dependent parameters. More...
 
void sort (const std::string &cat)
 Sort dependent parameters. More...
 
void lift (bool lift_shared=true, bool lift_calls=true)
 Lift problem formulation by extracting shared subexpressions. More...
 
void prune (bool prune_p=true, bool prune_u=true)
 Prune unused controls. More...
 
void tear ()
 Identify iteration variables and residual equations using naming convention. More...
 
Functions

Add or load auxiliary functions

Function add_fun (const std::string &name, const std::vector< std::string > &arg, const std::vector< std::string > &res, const Dict &opts=Dict())
 Add a function from loaded expressions. More...
 
Function add_fun (const Function &f)
 Add an already existing function. More...
 
Function add_fun (const std::string &name, const Importer &compiler, const Dict &opts=Dict())
 Add an external function. More...
 
bool has_fun (const std::string &name) const
 Does a particular function already exist? More...
 
Function fun (const std::string &name) const
 Get function by name. More...
 
std::vector< Functionfun () const
 Get all functions. More...
 
void gather_fun (casadi_int max_depth=-1)
 Collect embedded functions from the expression graph. More...
 
Import and export
void parse_fmi (const std::string &filename)
 
bool provides_directional_derivatives () const
 Does the FMU provide support for analytic derivatives. More...
 
bool provides_directional_derivative () const
 Does the FMU provide support for analytic derivatives (FMI 2 naming) More...
 
void load_fmi_description (const std::string &filename)
 Import problem description from FMI or XML. More...
 
std::vector< std::string > export_fmu (const Dict &opts=Dict())
 Export instance into an FMU. More...
 
void add_lc (const std::string &name, const std::vector< std::string > &f_out)
 Add a named linear combination of output expressions. More...
 
Function create (const std::string &fname, const std::vector< std::string > &name_in, const std::vector< std::string > &name_out, bool sx, bool lifted_calls=false) const
 Construct a function object, legacy syntax. More...
 
Function create (const std::string &name, const std::vector< std::string > &name_in, const std::vector< std::string > &name_out, const Dict &opts=Dict()) const
 Construct a function object, names provided. More...
 
MX var (const std::string &name) const
 
MX operator() (const std::string &name) const
 
MX der (const MX &v) const
 
MX der (const MX &v)
 
casadi_int value_reference (const std::string &name) const
 
void set_value_reference (const std::string &name, casadi_int val)
 
std::string description (const std::string &name) const
 
void set_description (const std::string &name, const std::string &val)
 
std::string type (const std::string &name, casadi_int fmi_version=3) const
 
void set_type (const std::string &name, const std::string &val)
 
std::string initial (const std::string &name) const
 
void set_initial (const std::string &name, const std::string &val)
 
std::string unit (const std::string &name) const
 
void set_unit (const std::string &name, const std::string &val)
 
std::string display_unit (const std::string &name) const
 
void set_display_unit (const std::string &name, const std::string &val)
 
Variablevariable (const std::string &name)
 
const Variablevariable (const std::string &name) const
 
Variablevariable (size_t ind)
 
const Variablevariable (size_t ind) const
 
size_t find (const std::string &name) const
 
std::vector< size_t > find (const std::vector< std::string > &name) const
 
const std::string & name (size_t ind) const
 
std::vector< std::string > name (const std::vector< size_t > &ind) const
 
const MXvar (size_t ind) const
 
std::vector< MXvar (const std::vector< size_t > &ind) const
 

Static Public Member Functions

static bool test_cast (const SharedObjectInternal *ptr)
 Check if a particular cast is allowed. More...
 

Protected Member Functions

void count_up ()
 
void count_down ()
 

Member Typedef Documentation

◆ base_type

Definition at line 103 of file shared_object.hpp.

◆ internal_base_type

Definition at line 102 of file shared_object.hpp.

Constructor & Destructor Documentation

◆ DaeBuilder() [1/2]

casadi::DaeBuilder::DaeBuilder ( )

Definition at line 51 of file dae_builder.cpp.

51  {
52 }

◆ DaeBuilder() [2/2]

casadi::DaeBuilder::DaeBuilder ( const std::string &  name,
const std::string &  path = "",
const Dict opts = Dict() 
)
explicit

Definition at line 54 of file dae_builder.cpp.

54  {
55  own(new DaeBuilderInternal(name, path, opts));
56  if (!path.empty()) load_fmi_description((*this)->resource_.path() + "/modelDescription.xml");
57 }
const std::string & name() const
Name of instance.
Definition: dae_builder.cpp:59
void load_fmi_description(const std::string &filename)
Import problem description from FMI or XML.
std::vector< casadi_int > path(const std::vector< casadi_int > &map, casadi_int i_start)

References load_fmi_description(), name(), casadi::GenericShared< SharedObject, SharedObjectInternal >::own(), and casadi::path().

Member Function Documentation

◆ __hash__()

casadi_int casadi::GenericShared< SharedObject , SharedObjectInternal >::__hash__
inherited

If the Object does not point to any node, "0" is returned.

Extra doc: https://github.com/casadi/casadi/wiki/L_av

Definition at line 124 of file generic_shared_impl.hpp.

137  {
138  return reinterpret_cast<casadi_int>(get());
139  }

◆ add() [1/4]

MX casadi::DaeBuilder::add ( const std::string &  name,
const Dict opts = Dict() 
)

Definition at line 587 of file dae_builder.cpp.

587  {
588  try {
589  return (*this)->add(name, opts).v;
590  } catch (std::exception& e) {
591  THROW_ERROR("add", e.what());
592  return MX();
593  }
594 }
std::vector< std::string > e() const
[DEPRECATED] Use all("zero") *‍/

References e(), and name().

◆ add() [2/4]

MX casadi::DaeBuilder::add ( const std::string &  name,
const std::string &  causality,
const Dict opts = Dict() 
)

Definition at line 578 of file dae_builder.cpp.

578  {
579  try {
580  return (*this)->add(name, to_enum<Causality>(causality), opts).v;
581  } catch (std::exception& e) {
582  THROW_ERROR("add", e.what());
583  return MX();
584  }
585 }
std::string causality(const std::string &name) const
Get the causality.

References causality(), e(), and name().

◆ add() [3/4]

MX casadi::DaeBuilder::add ( const std::string &  name,
const std::string &  causality,
const std::string &  variability,
const Dict opts = Dict() 
)

Definition at line 567 of file dae_builder.cpp.

568  {
569  try {
570  return (*this)->add(name, to_enum<Causality>(causality),
571  to_enum<Variability>(variability), opts).v;
572  } catch (std::exception& e) {
573  THROW_ERROR("add", e.what());
574  return MX();
575  }
576 }
std::string variability(const std::string &name) const
Get the variability.

References causality(), e(), name(), and variability().

Referenced by add_c(), add_d(), add_p(), add_q(), add_t(), add_u(), add_w(), add_x(), add_y(), and add_z().

◆ add() [4/4]

void casadi::DaeBuilder::add ( const std::string &  name,
const std::string &  causality,
const std::string &  variability,
const MX expr,
const Dict opts = Dict() 
)

Definition at line 596 of file dae_builder.cpp.

597  {
598  try {
599  // Ensure pure symbolic expression
600  casadi_assert(expr.is_symbolic(), "Expression must be symbolic");
601  // Make sure name matches expression
602  casadi_assert(name == expr.name(), "Name must match expression");
603  // Add variable
604  (*this)->add(name, to_enum<Causality>(causality), to_enum<Variability>(variability),
605  expr, opts);
606  } catch (std::exception& e) {
607  THROW_ERROR("add", e.what());
608  }
609 }

References causality(), e(), casadi::MX::is_symbolic(), name(), casadi::MX::name(), and variability().

◆ add_c()

MX casadi::DaeBuilder::add_c ( const std::string &  name,
const MX new_cdef 
)

Definition at line 641 of file dae_builder.cpp.

641  {
642  MX v = add(name, "local", "constant");
643  set_beq(name, new_cdef);
644  return v;
645 }
void set_beq(const std::string &name, const MX &val)
[DEPRECATED] Replaced by eq
MX add(const std::string &name, const std::string &causality, const std::string &variability, const Dict &opts=Dict())
Add a new model variable.

References add(), name(), and set_beq().

◆ add_d()

MX casadi::DaeBuilder::add_d ( const std::string &  name,
const MX new_ddef 
)

Definition at line 647 of file dae_builder.cpp.

647  {
648  MX v = add(name, "calculatedParameter", "fixed");
649  set_beq(name, new_ddef);
650  return v;
651 }

References add(), name(), and set_beq().

◆ add_fun() [1/3]

Function casadi::DaeBuilder::add_fun ( const Function f)

Definition at line 1071 of file dae_builder.cpp.

1071  {
1072  try {
1073  return (*this)->add_fun(f);
1074  } catch (std::exception& e) {
1075  THROW_ERROR("add_fun", e.what());
1076  return Function(); // never reached
1077  }
1078 }

References e().

◆ add_fun() [2/3]

Function casadi::DaeBuilder::add_fun ( const std::string &  name,
const Importer compiler,
const Dict opts = Dict() 
)

Definition at line 1090 of file dae_builder.cpp.

1090  {
1091  casadi_assert(!has_fun(name), "Function '" + name + "' already exists");
1092  return add_fun(external(name, compiler, opts));
1093 }
bool has_fun(const std::string &name) const
Does a particular function already exist?
Function add_fun(const std::string &name, const std::vector< std::string > &arg, const std::vector< std::string > &res, const Dict &opts=Dict())
Add a function from loaded expressions.
Function external(const std::string &name, const Importer &li, const Dict &opts)
Load a just-in-time compiled external function.
Definition: external.cpp:42

References add_fun(), casadi::external(), has_fun(), and name().

◆ add_fun() [3/3]

Function casadi::DaeBuilder::add_fun ( const std::string &  name,
const std::vector< std::string > &  arg,
const std::vector< std::string > &  res,
const Dict opts = Dict() 
)

Definition at line 1080 of file dae_builder.cpp.

1081  {
1082  try {
1083  return (*this)->add_fun(name, arg, res, opts);
1084  } catch (std::exception& e) {
1085  THROW_ERROR("add_fun", e.what());
1086  return Function(); // never reached
1087  }
1088 }

References e(), and name().

Referenced by add_fun(), and gather_fun().

◆ add_init()

void casadi::DaeBuilder::add_init ( const MX lhs,
const MX rhs 
)
inline

Definition at line 365 of file dae_builder.hpp.

365  {
366  set_init(lhs.name(), rhs);
367  }
void set_init(const std::string &name, const MX &init_rhs)
Specify the initial equation for a variable.

References casadi::MX::name().

◆ add_lc()

void casadi::DaeBuilder::add_lc ( const std::string &  name,
const std::vector< std::string > &  f_out 
)

Definition at line 1031 of file dae_builder.cpp.

1032  {
1033  try {
1034  (*this)->add_lc(name, f_out);
1035  } catch (std::exception& e) {
1036  THROW_ERROR("add_lc", e.what());
1037  }
1038 }

References e(), and name().

◆ add_p()

MX casadi::DaeBuilder::add_p ( const std::string &  name = std::string())

Definition at line 616 of file dae_builder.cpp.

616  {
617  casadi_assert(!name.empty(), "Variable name is required");
618  return add(name, "parameter", "tunable");
619 }

References add(), and name().

◆ add_q()

MX casadi::DaeBuilder::add_q ( const std::string &  name = std::string())

Definition at line 636 of file dae_builder.cpp.

636  {
637  casadi_assert(!name.empty(), "Variable name is required");
638  return add(name);
639 }

References add(), and name().

◆ add_t()

MX casadi::DaeBuilder::add_t ( const std::string &  name = "t")

Definition at line 612 of file dae_builder.cpp.

612  {
613  return add(name, "independent");
614 }

References add(), and name().

◆ add_u()

MX casadi::DaeBuilder::add_u ( const std::string &  name = std::string())

Definition at line 621 of file dae_builder.cpp.

621  {
622  casadi_assert(!name.empty(), "Variable name is required");
623  return add(name, "input");
624 }

References add(), and name().

◆ add_variable() [1/3]

void casadi::DaeBuilder::add_variable ( const MX new_v)

Definition at line 412 of file dae_builder.cpp.

412  {
413  Variable& v = new_variable(new_v.name());
414  v.v = new_v;
415 }
Variable & new_variable(const std::string &name, casadi_int numel=1)
[DEPRECATED] Use add
struct VariableStruct Variable

References casadi::MX::name(), new_variable(), and casadi::Variable::v.

◆ add_variable() [2/3]

MX casadi::DaeBuilder::add_variable ( const std::string &  name,
casadi_int  n = 1 
)

Definition at line 402 of file dae_builder.cpp.

402  {
403  return add_variable(name, Sparsity::dense(n));
404 }
MX add_variable(const std::string &name, casadi_int n=1)
[DEPRECATED] Use add
static Sparsity dense(casadi_int nrow, casadi_int ncol=1)
Create a dense rectangular sparsity pattern *.
Definition: sparsity.cpp:1012

References casadi::Sparsity::dense(), and name().

◆ add_variable() [3/3]

MX casadi::DaeBuilder::add_variable ( const std::string &  name,
const Sparsity sp 
)

Definition at line 406 of file dae_builder.cpp.

406  {
407  Variable& v = new_variable(name);
408  v.v = MX::sym(name, sp);
409  return v.v;
410 }
static MX sym(const std::string &name, casadi_int nrow=1, casadi_int ncol=1)
Create an nrow-by-ncol symbolic primitive.

References name(), new_variable(), casadi::GenericMatrix< MX >::sym(), and casadi::Variable::v.

◆ add_variable_new() [1/3]

size_t casadi::DaeBuilder::add_variable_new ( const MX new_v)

Definition at line 427 of file dae_builder.cpp.

427  {
428  Variable& v = new_variable(new_v.name());
429  v.v = new_v;
430  return v.index;
431 }

References casadi::Variable::index, casadi::MX::name(), new_variable(), and casadi::Variable::v.

◆ add_variable_new() [2/3]

size_t casadi::DaeBuilder::add_variable_new ( const std::string &  name,
casadi_int  n = 1 
)

Definition at line 417 of file dae_builder.cpp.

417  {
419 }
size_t add_variable_new(const std::string &name, casadi_int n=1)
[DEPRECATED] Use add

References casadi::Sparsity::dense(), and name().

◆ add_variable_new() [3/3]

size_t casadi::DaeBuilder::add_variable_new ( const std::string &  name,
const Sparsity sp 
)

Definition at line 421 of file dae_builder.cpp.

421  {
422  Variable& v = new_variable(name);
423  v.v = MX::sym(name, sp);
424  return v.index;
425 }

References casadi::Variable::index, name(), new_variable(), casadi::GenericMatrix< MX >::sym(), and casadi::Variable::v.

◆ add_w()

MX casadi::DaeBuilder::add_w ( const std::string &  name,
const MX new_wdef 
)

Definition at line 653 of file dae_builder.cpp.

653  {
654  MX v = add(name);
655  eq(v, new_wdef);
656  return v;
657 }
void eq(const MX &lhs, const MX &rhs, const Dict &opts=Dict())
Add a simple equation.

References add(), eq(), and name().

◆ add_x()

MX casadi::DaeBuilder::add_x ( const std::string &  name = std::string())

Definition at line 626 of file dae_builder.cpp.

626  {
627  casadi_assert(!name.empty(), "Variable name is required");
628  return add(name);
629 }

References add(), and name().

◆ add_y()

MX casadi::DaeBuilder::add_y ( const std::string &  name,
const MX new_ydef 
)

Definition at line 659 of file dae_builder.cpp.

659  {
660  MX v = add(name, "output");
661  eq(v, new_ydef);
662  return v;
663 }

References add(), eq(), and name().

◆ add_z()

MX casadi::DaeBuilder::add_z ( const std::string &  name = std::string())

Definition at line 631 of file dae_builder.cpp.

631  {
632  casadi_assert(!name.empty(), "Variable name is required");
633  return add(name);
634 }

References add(), and name().

◆ alg()

std::vector< MX > casadi::DaeBuilder::alg ( ) const

Extra doc: https://github.com/casadi/casadi/wiki/L_5i

Definition at line 91 of file dae_builder.cpp.

91  {
92  try {
93  return (*this)->output(OutputCategory::ALG);
94  } catch (std::exception& e) {
95  THROW_ERROR("alg", e.what());
96  return {}; // never reached
97  }
98 }

References casadi::ALG, and e().

◆ all() [1/2]

std::vector< std::string > casadi::DaeBuilder::all ( ) const

Definition at line 288 of file dae_builder.cpp.

288  {
289  try {
290  return (*this)->all();
291  } catch (std::exception& e) {
292  THROW_ERROR("all", e.what());
293  return {}; // never reached
294  }
295 }

References e().

◆ all() [2/2]

std::vector< std::string > casadi::DaeBuilder::all ( const std::string &  cat) const

Definition at line 297 of file dae_builder.cpp.

297  {
298  try {
299  return (*this)->all(to_enum<Category>(cat));
300  } catch (std::exception& e) {
301  THROW_ERROR("all", e.what());
302  return {}; // never reached
303  }
304 }

References e().

◆ all_variables()

std::vector<std::string> casadi::DaeBuilder::all_variables ( ) const
inline

Definition at line 814 of file dae_builder.hpp.

814 {return all();}
std::vector< std::string > all() const
Get a list of all variables.

References casadi::all().

◆ assign() [1/2]

std::string casadi::DaeBuilder::assign ( const std::string &  name,
const MX val 
)

Definition at line 691 of file dae_builder.cpp.

691  {
692  try {
693  return (*this)->assign(name, val).name;
694  } catch (std::exception& e) {
695  THROW_ERROR("assign", e.what());
696  return std::string(); // never reached
697  }
698 }

References e(), and name().

◆ assign() [2/2]

void casadi::GenericShared< SharedObject , SharedObjectInternal >::assign ( Internal *  node)
inherited

improper use will cause memory leaks!

Extra doc: https://github.com/casadi/casadi/wiki/L_at

Definition at line 97 of file generic_shared_impl.hpp.

75  {
76  node = node_;
77  }

◆ attribute() [1/2]

double casadi::DaeBuilder::attribute ( const std::string &  a,
const std::string &  name 
) const

Definition at line 1206 of file dae_builder.cpp.

1206  {
1207  try {
1208  return (*this)->attribute(to_enum<Attribute>(a), name);
1209  } catch (std::exception& e) {
1210  THROW_ERROR("attribute", e.what());
1211  return 0; // never reached
1212  }
1213 }

References e(), and name().

◆ attribute() [2/2]

std::vector< double > casadi::DaeBuilder::attribute ( const std::string &  a,
const std::vector< std::string > &  name 
) const

Definition at line 1215 of file dae_builder.cpp.

1216  {
1217  try {
1218  return (*this)->attribute(to_enum<Attribute>(a), name);
1219  } catch (std::exception& e) {
1220  THROW_ERROR("attribute", e.what());
1221  return {}; // never reached
1222  }
1223 }

References e(), and name().

◆ beq()

MX casadi::DaeBuilder::beq ( const std::string &  name) const

Definition at line 810 of file dae_builder.cpp.

810  {
811  try {
812  const Variable& v = (*this)->variable(name);
813  return (*this)->variable(v.bind).v;
814  } catch (std::exception& e) {
815  THROW_ERROR("beq", e.what());
816  return MX(); // never reached
817  }
818 }

References casadi::Variable::bind, e(), name(), and casadi::Variable::v.

◆ c()

std::vector<std::string> casadi::DaeBuilder::c ( ) const
inline

Extra doc: https://github.com/casadi/casadi/wiki/L_5p

Definition at line 156 of file dae_builder.hpp.

156 {return all("c");}

References casadi::all().

◆ category()

std::string casadi::DaeBuilder::category ( const std::string &  name) const

Definition at line 914 of file dae_builder.cpp.

914  {
915  try {
916  return to_string((*this)->category((*this)->find(name)));
917  } catch (std::exception& e) {
918  THROW_ERROR("category", e.what());
919  return std::string(); // never reached
920  }
921 }
std::string to_string(TypeFmi2 v)

References e(), name(), and casadi::to_string().

◆ causality()

std::string casadi::DaeBuilder::causality ( const std::string &  name) const

Definition at line 880 of file dae_builder.cpp.

880  {
881  try {
882  return to_string((*this)->causality((*this)->find(name)));
883  } catch (std::exception& e) {
884  THROW_ERROR("causality", e.what());
885  return std::string(); // never reached
886  }
887 }

References e(), name(), and casadi::to_string().

Referenced by add().

◆ cdef()

std::vector< MX > casadi::DaeBuilder::cdef ( ) const

Extra doc: https://github.com/casadi/casadi/wiki/L_5q

Definition at line 126 of file dae_builder.cpp.

126  {
127  try {
128  return (*this)->cdef();
129  } catch (std::exception& e) {
130  THROW_ERROR("cdef", e.what());
131  return {}; // never reached
132  }
133 }

References e().

◆ class_name()

std::string casadi::SharedObject::class_name ( ) const
inherited

◆ clear_all()

void casadi::DaeBuilder::clear_all ( const std::string &  v)

Definition at line 527 of file dae_builder.cpp.

527  {
528  try {
529  (*this)->clear_cache_ = true; // Clear cache after this
530  (*this)->indices(to_enum<Category>(v)).clear();
531  } catch (std::exception& e) {
532  THROW_ERROR("clear_all", e.what());
533  }
534 }

References e().

◆ count_down()

void casadi::GenericShared< SharedObject , SharedObjectInternal >::count_down
protectedinherited

Definition at line 134 of file generic_shared_impl.hpp.

42  {
43 #ifdef WITH_EXTRA_CHECKS
44  casadi_assert_dev(Function::call_depth_==0);
45 #endif // WITH_EXTRA_CHECKS
46  if (!node) return;
47  if (node->weak_ref_) {
48 #ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
49  auto mutex = node->weak_ref_->get_mutex();
50  // Avoid triggering a delete while a weak_ref.shared_if_alive is being called
51  std::lock_guard<std::mutex> lock(*mutex);
52  // Could it be that this mutex is destroyed when the lock goes out of scope?
53 #endif // CASADI_WITH_THREADSAFE_SYMBOLICS
54 
55  if (--static_cast<Internal*>(node)->count == 0) {
56  delete node;
57  node = nullptr;
58  }
59  } else {
60  if (--static_cast<Internal*>(node)->count == 0) {
61  delete node;
62  node = nullptr;
63  }
64  }
65  }

◆ count_up()

void casadi::GenericShared< SharedObject , SharedObjectInternal >::count_up
protectedinherited

Definition at line 133 of file generic_shared_impl.hpp.

32  {
33 #ifdef WITH_EXTRA_CHECKS
34  casadi_assert_dev(Function::call_depth_==0);
35 #endif // WITH_EXTRA_CHECKS
36 
37  if (node) static_cast<Internal*>(node)->count++;
38 
39  }

◆ create() [1/4]

Function casadi::DaeBuilder::create ( ) const
inline

Extra doc: https://github.com/casadi/casadi/wiki/L_2c1

Definition at line 529 of file dae_builder.hpp.

529 {return create(name() + "_dae");}
Function create() const
Create a function with standard integrator DAE signature, default naming.

References create().

Referenced by create(), and get().

◆ create() [2/4]

Function casadi::DaeBuilder::create ( const std::string &  fname,
const Dict opts = Dict() 
) const
Parameters
nameName assigned to the resulting function object
optsOptional settings

Extra doc: https://github.com/casadi/casadi/wiki/L_2c0

Definition at line 1062 of file dae_builder.cpp.

1062  {
1063  try {
1064  return (*this)->create(name, dyn_in(), dyn_out(), opts, false, false);
1065  } catch (std::exception& e) {
1066  THROW_ERROR("create", e.what());
1067  return Function(); // never reached
1068  }
1069 }
std::vector< std::string > dyn_out()
Get output scheme of a DAE function.
Definition: integrator.cpp:236
std::vector< std::string > dyn_in()
Get input scheme of a DAE function.
Definition: integrator.cpp:232

References casadi::dyn_in(), casadi::dyn_out(), e(), and name().

◆ create() [3/4]

Function casadi::DaeBuilder::create ( const std::string &  fname,
const std::vector< std::string > &  name_in,
const std::vector< std::string > &  name_out,
bool  sx,
bool  lifted_calls = false 
) const

Definition at line 1040 of file dae_builder.cpp.

1042  {
1043  try {
1044  return (*this)->create(fname, name_in, name_out, Dict(), sx, lifted_calls);
1045  } catch (std::exception& e) {
1046  THROW_ERROR("create", e.what());
1047  return Function(); // never reached
1048  }
1049 }
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.

References e().

◆ create() [4/4]

Function casadi::DaeBuilder::create ( const std::string &  name,
const std::vector< std::string > &  name_in,
const std::vector< std::string > &  name_out,
const Dict opts = Dict() 
) const
Parameters
nameName assigned to the resulting function object
name_inNames of all the inputs
name_outNames of all the outputs
optsOptional settings

Extra doc: https://github.com/casadi/casadi/wiki/L_6e

Definition at line 1051 of file dae_builder.cpp.

1053  {
1054  try {
1055  return (*this)->create(fname, name_in, name_out, opts, false, false);
1056  } catch (std::exception& e) {
1057  THROW_ERROR("create", e.what());
1058  return Function(); // never reached
1059  }
1060 }

References e().

◆ d()

std::vector<std::string> casadi::DaeBuilder::d ( ) const
inline

Extra doc: https://github.com/casadi/casadi/wiki/L_5r

Definition at line 166 of file dae_builder.hpp.

166 {return all("d");}

References casadi::all().

◆ ddef()

std::vector< MX > casadi::DaeBuilder::ddef ( ) const

Interdependencies are allowed but must be non-cyclic.

Extra doc: https://github.com/casadi/casadi/wiki/L_5s

Definition at line 135 of file dae_builder.cpp.

135  {
136  try {
137  return (*this)->output(OutputCategory::DDEF);
138  } catch (std::exception& e) {
139  THROW_ERROR("ddef", e.what());
140  return {}; // never reached
141  }
142 }

References casadi::DDEF, and e().

◆ debug_repr()

std::string casadi::GenericShared< SharedObject , SharedObjectInternal >::debug_repr
inherited

Definition at line 113 of file generic_shared_impl.hpp.

80  {
81  if (node) {
82  return node->debug_repr(node);
83  } else {
84  return "NULL";
85  }
86  }
std::string debug_repr(const Internal *) const

◆ dependent_fun()

Function casadi::DaeBuilder::dependent_fun ( const std::string &  fname,
const std::vector< std::string > &  s_in,
const std::vector< std::string > &  s_out 
) const

Definition at line 1147 of file dae_builder.cpp.

1149  {
1150  try {
1151  return (*this)->dependent_fun(fname, s_in, s_out);
1152  } catch (std::exception& e) {
1153  THROW_ERROR("dependent_fun", e.what());
1154  return Function(); // never reached
1155  }
1156 }

References e().

◆ der() [1/4]

MX casadi::DaeBuilder::der ( const MX v)

Differentiate an expression with respect to time

Definition at line 1197 of file dae_builder.cpp.

1197  {
1198  try {
1199  return (*this)->der(v);
1200  } catch (std::exception& e) {
1201  THROW_ERROR("der", e.what());
1202  return MX(); // never reached
1203  }
1204 }

References e().

◆ der() [2/4]

MX casadi::DaeBuilder::der ( const MX v) const

Differentiate an expression with respect to time

Definition at line 1188 of file dae_builder.cpp.

1188  {
1189  try {
1190  return (*this)->der(v);
1191  } catch (std::exception& e) {
1192  THROW_ERROR("der", e.what());
1193  return MX(); // never reached
1194  }
1195 }

References e().

◆ der() [3/4]

std::string casadi::DaeBuilder::der ( const std::string &  name) const

Definition at line 734 of file dae_builder.cpp.

734  {
735  try {
736  // Get variable index
737  size_t ind = (*this)->find(name);
738  // Differentiate
739  ind = (*this)->variable(ind).der;
740  casadi_assert(ind != size_t(-1), "No derivative expression for " + name);
741  // Return name
742  return (*this)->variable(ind).name;
743  } catch (std::exception& e) {
744  THROW_ERROR("der", e.what());
745  return std::string(); // never reached
746  }
747 }

References e(), and name().

◆ der() [4/4]

std::vector< std::string > casadi::DaeBuilder::der ( const std::vector< std::string > &  name) const

Definition at line 779 of file dae_builder.cpp.

779  {
780  try {
781  std::vector<std::string> r(name.size());
782  for (size_t i = 0; i < r.size(); ++i) r[i] = der(name[i]);
783  return r;
784  } catch (std::exception& e) {
785  THROW_ERROR("der", e.what());
786  return {}; // never reached
787  }
788 }
std::vector< std::string > der(const std::vector< std::string > &name) const
Get the time derivative of model variables.

References e(), and name().

◆ derivatives()

std::vector< std::string > casadi::DaeBuilder::derivatives ( ) const

Extra doc: https://github.com/casadi/casadi/wiki/L_62

Definition at line 170 of file dae_builder.cpp.

170  {
171  try {
172  return (*this)->name((*this)->derivatives_);
173  } catch (std::exception& e) {
174  THROW_ERROR("derivatives", e.what());
175  return {}; // never reached
176  }
177 }

References e().

◆ description()

std::string casadi::DaeBuilder::description ( const std::string &  name) const

Get/set description

Definition at line 852 of file dae_builder.cpp.

852  {
853  return (*this)->variable(name).description;
854 }

References name().

◆ dimension()

std::vector< casadi_int > casadi::DaeBuilder::dimension ( const std::string &  name) const

Definition at line 959 of file dae_builder.cpp.

959  {
960  return (*this)->variable(name).dimension;
961 }

References name().

◆ disp()

void casadi::SharedObject::disp ( std::ostream &  stream,
bool  more = false 
) const
inherited

Definition at line 35 of file shared_object.cpp.

35  {
36  if (is_null()) {
37  stream << "NULL";
38  } else {
39  (*this)->disp(stream, more);
40  }
41  }

References casadi::GenericShared< SharedObject, SharedObjectInternal >::is_null().

Referenced by casadi::Nlpsol::disp_more(), and casadi::CsparseInterface::nfact().

◆ display_unit()

std::string casadi::DaeBuilder::display_unit ( const std::string &  name) const

Get/set the display unit

Definition at line 947 of file dae_builder.cpp.

947  {
948  return (*this)->variable(name).display_unit;
949 }

References name().

◆ e()

std::vector<std::string> casadi::DaeBuilder::e ( ) const
inline

◆ eliminate()

void casadi::DaeBuilder::eliminate ( const std::string &  cat)

Definition at line 820 of file dae_builder.cpp.

820  {
821  try {
822  return (*this)->eliminate(to_enum<Category>(cat));
823  } catch (std::exception& e) {
824  THROW_ERROR("eliminate", e.what());
825  }
826 }

References e().

Referenced by eliminate_d(), eliminate_quad(), and eliminate_w().

◆ eliminate_d()

void casadi::DaeBuilder::eliminate_d ( )

Definition at line 479 of file dae_builder.cpp.

479  {
480  try {
481  return eliminate("d");
482  } catch (std::exception& e) {
483  THROW_ERROR("eliminate_d", e.what());
484  }
485 }
void eliminate(const std::string &cat)
Eliminate all dependent parameters.

References e(), and eliminate().

◆ eliminate_quad()

void casadi::DaeBuilder::eliminate_quad ( )

Definition at line 495 of file dae_builder.cpp.

495  {
496  try {
497  return eliminate("q");
498  } catch (std::exception& e) {
499  THROW_ERROR("eliminate_quad", e.what());
500  }
501 }

References e(), and eliminate().

◆ eliminate_w()

void casadi::DaeBuilder::eliminate_w ( )

Definition at line 487 of file dae_builder.cpp.

487  {
488  try {
489  return eliminate("w");
490  } catch (std::exception& e) {
491  THROW_ERROR("eliminate_w", e.what());
492  }
493 }

References e(), and eliminate().

◆ eq()

void casadi::DaeBuilder::eq ( const MX lhs,
const MX rhs,
const Dict opts = Dict() 
)

Definition at line 675 of file dae_builder.cpp.

675  {
676  try {
677  (*this)->eq(lhs, rhs, opts);
678  } catch (std::exception& e) {
679  THROW_ERROR("eq", e.what());
680  }
681 }

References e().

Referenced by add_w(), add_y(), and set_beq().

◆ export_fmu()

std::vector< std::string > casadi::DaeBuilder::export_fmu ( const Dict opts = Dict())

Definition at line 255 of file dae_builder.cpp.

255  {
256  try {
257  return (*this)->export_fmu(opts);
258  } catch (std::exception& e) {
259  THROW_ERROR("export_fmu", e.what());
260  }
261 }

References e().

◆ find() [1/2]

size_t casadi::DaeBuilder::find ( const std::string &  name) const

[DEPRECATED] Access to internal class and corresponding indexing removed

Definition at line 347 of file dae_builder.cpp.

347  {
348  try {
349  return (*this)->find(name);
350  } catch (std::exception& e) {
351  THROW_ERROR("find", e.what());
352  return -1; // never reached
353  }
354 }

References e(), and name().

Referenced by register_c(), register_d(), register_e(), register_p(), register_q(), register_t(), register_u(), register_w(), register_x(), register_y(), and register_z().

◆ find() [2/2]

std::vector< size_t > casadi::DaeBuilder::find ( const std::vector< std::string > &  name) const

[DEPRECATED] Access to internal class and corresponding indexing removed

Definition at line 356 of file dae_builder.cpp.

356  {
357  try {
358  return (*this)->find(name);
359  } catch (std::exception& e) {
360  THROW_ERROR("find", e.what());
361  return {}; // never reached
362  }
363 }

References e(), and name().

◆ fun() [1/2]

std::vector< Function > casadi::DaeBuilder::fun ( ) const

Definition at line 1134 of file dae_builder.cpp.

1134  {
1135  return (*this)->fun_;
1136 }

◆ fun() [2/2]

Function casadi::DaeBuilder::fun ( const std::string &  name) const

Definition at line 1104 of file dae_builder.cpp.

1104  {
1105  try {
1106  return (*this)->fun(name);
1107  } catch (std::exception& e) {
1108  THROW_ERROR("fun", e.what());
1109  return Function(); // never reached
1110  }
1111 }

References e(), and name().

◆ gather_fun()

void casadi::DaeBuilder::gather_fun ( casadi_int  max_depth = -1)

Definition at line 1113 of file dae_builder.cpp.

1113  {
1114  try {
1115  // Get a function corresponding to all equations (no inputs)
1116  Function all_eq = (*this)->gather_eq();
1117  // Gather all functions
1118  std::vector<Function> allfun = all_eq.find_functions(max_depth);
1119  // Add to list of functions
1120  for (const Function& f : allfun) {
1121  if (has_fun(f.name())) {
1122  // Skip functions with duplicate names
1123  casadi_warning("Duplicate function: '" + f.name() + "', ignored");
1124  } else {
1125  // Add to list of functions
1126  add_fun(f);
1127  }
1128  }
1129  } catch (std::exception& e) {
1130  THROW_ERROR("gather_fun", e.what());
1131  }
1132 }

References add_fun(), e(), casadi::Function::find_functions(), and has_fun().

◆ get() [1/3]

Definition at line 100 of file generic_shared_impl.hpp.

104  {
105  return node;
106  }

◆ get() [2/3]

GenericType casadi::DaeBuilder::get ( const std::string &  name) const

Definition at line 1427 of file dae_builder.cpp.

1427  {
1428  return get(std::vector<std::string>{name}).front();
1429 }
SharedObjectInternal * get() const
Get a const pointer to the node.

References casadi::GenericShared< SharedObject, SharedObjectInternal >::get(), and name().

◆ get() [3/3]

std::vector< GenericType > casadi::DaeBuilder::get ( const std::vector< std::string > &  name) const

Definition at line 1431 of file dae_builder.cpp.

1431  {
1432  try {
1433  // Create a temporary FmuFunction instance
1434  Function f = create(this->name() + "_get", {}, {}, Dict{{"aux", name}});
1435  // Get the stats
1436  Dict stats = f.stats().at("aux");
1437  // Return in the same order as inputs
1438  std::vector<GenericType> ret;
1439  ret.reserve(name.size());
1440  for (const std::string& n : name) ret.push_back(stats.at(n));
1441  return ret;
1442  } catch (std::exception& e) {
1443  THROW_ERROR("get", e.what());
1444  return {};
1445  }
1446 }

References create(), e(), name(), and casadi::Function::stats().

◆ get_str()

std::string casadi::SharedObject::get_str ( bool  more = false) const
inlineinherited

Definition at line 91 of file shared_object.hpp.

91  {
92  std::stringstream ss;
93  disp(ss, more);
94  return ss.str();
95  }
void disp(std::ostream &stream, bool more=false) const
Print a description of the object.

◆ getCount()

casadi_int casadi::GenericShared< SharedObject , SharedObjectInternal >::getCount
inherited

Definition at line 103 of file generic_shared_impl.hpp.

127  {
128  return (*this)->getCount();
129  }

◆ has()

bool casadi::DaeBuilder::has ( const std::string &  name) const

Definition at line 279 of file dae_builder.cpp.

279  {
280  try {
281  return (*this)->has(name);
282  } catch (std::exception& e) {
283  THROW_ERROR("has", e.what());
284  return false; // never reached
285  }
286 }

References e(), and name().

◆ has_beq()

bool casadi::DaeBuilder::has_beq ( const std::string &  name) const

Definition at line 801 of file dae_builder.cpp.

801  {
802  try {
803  return !(*this)->variable(name).has_beq();
804  } catch (std::exception& e) {
805  THROW_ERROR("has_beq", e.what());
806  return false; // never reached
807  }
808 }

References e(), and name().

◆ has_fun()

bool casadi::DaeBuilder::has_fun ( const std::string &  name) const

Definition at line 1095 of file dae_builder.cpp.

1095  {
1096  try {
1097  return (*this)->has_fun(name);
1098  } catch (std::exception& e) {
1099  THROW_ERROR("has_fun", e.what());
1100  return false; // never reached
1101  }
1102 }

References e(), and name().

Referenced by add_fun(), and gather_fun().

◆ has_t()

bool casadi::DaeBuilder::has_t ( ) const

Extra doc: https://github.com/casadi/casadi/wiki/L_64

Definition at line 188 of file dae_builder.cpp.

188  {
189  try {
190  return (*this)->has_t();
191  } catch (std::exception& e) {
192  THROW_ERROR("has_t", e.what());
193  return false; // never reached
194  }
195 }

References e().

Referenced by register_t().

◆ has_variable()

bool casadi::DaeBuilder::has_variable ( const std::string &  name) const
inline

Definition at line 811 of file dae_builder.hpp.

811 {return has(name);}
bool has(const std::string &name) const
Check if a particular variable exists.

◆ init_lhs()

std::vector< MX > casadi::DaeBuilder::init_lhs ( ) const

Extra doc: https://github.com/casadi/casadi/wiki/L_2b1

Definition at line 153 of file dae_builder.cpp.

153  {
154  return (*this)->init_lhs();
155 }

◆ init_rhs()

std::vector< MX > casadi::DaeBuilder::init_rhs ( ) const

Extra doc: https://github.com/casadi/casadi/wiki/L_2b2

Definition at line 157 of file dae_builder.cpp.

157  {
158  return (*this)->init_rhs();
159 }

Referenced by set_init().

◆ initial()

std::string casadi::DaeBuilder::initial ( const std::string &  name) const

Get/set the initial property

Definition at line 931 of file dae_builder.cpp.

931  {
932  return to_string((*this)->variable(name).initial);
933 }

References name(), and casadi::to_string().

◆ initial_unknowns()

std::vector< std::string > casadi::DaeBuilder::initial_unknowns ( ) const

Extra doc: https://github.com/casadi/casadi/wiki/L_63

Definition at line 179 of file dae_builder.cpp.

179  {
180  try {
181  return (*this)->name((*this)->initial_unknowns_);
182  } catch (std::exception& e) {
183  THROW_ERROR("initial_unknowns", e.what());
184  return {}; // never reached
185  }
186 }

References e().

◆ is_null()

Definition at line 117 of file generic_shared_impl.hpp.

109  {
110  return node==nullptr;
111  }

◆ jac_sparsity()

Sparsity casadi::DaeBuilder::jac_sparsity ( const std::vector< std::string > &  onames,
const std::vector< std::string > &  inames 
) const

Extra doc: https://github.com/casadi/casadi/wiki/L_6g

Definition at line 1448 of file dae_builder.cpp.

1449  {
1450  try {
1451  return (*this)->jac_sparsity((*this)->find(onames), (*this)->find(inames));
1452  } catch (std::exception& e) {
1453  THROW_ERROR("jac_sparsity", e.what());
1454  return Sparsity(); // never reached
1455  }
1456 }

References e().

◆ lift()

void casadi::DaeBuilder::lift ( bool  lift_shared = true,
bool  lift_calls = true 
)

Definition at line 836 of file dae_builder.cpp.

836  {
837  try {
838  (*this)->lift(lift_shared, lift_calls);
839  } catch (std::exception& e) {
840  THROW_ERROR("lift", e.what());
841  }
842 }

References e().

◆ load_fmi_description()

void casadi::DaeBuilder::load_fmi_description ( const std::string &  filename)

Definition at line 237 of file dae_builder.cpp.

237  {
238  try {
239  (*this)->load_fmi_description(filename);
240  } catch (std::exception& e) {
241  THROW_ERROR("load_fmi_description", e.what());
242  }
243 }
std::string filename(const std::string &path)
Definition: ghc.cpp:55

References e(), and casadi::filename().

Referenced by DaeBuilder().

◆ max() [1/2]

double casadi::DaeBuilder::max ( const std::string &  name) const

Definition at line 1276 of file dae_builder.cpp.

1276  {
1277  try {
1278  return (*this)->variable(name).max;
1279  } catch (std::exception& e) {
1280  THROW_ERROR("max", e.what());
1281  return 0; // never reached
1282  }
1283 }

References e(), and name().

◆ max() [2/2]

std::vector< double > casadi::DaeBuilder::max ( const std::vector< std::string > &  name) const

Definition at line 1285 of file dae_builder.cpp.

1285  {
1286  try {
1287  return (*this)->attribute(Attribute::MAX, name);
1288  } catch (std::exception& e) {
1289  THROW_ERROR("max", e.what());
1290  return {}; // never reached
1291  }
1292 }

References e(), casadi::MAX, and name().

◆ min() [1/2]

double casadi::DaeBuilder::min ( const std::string &  name) const

Definition at line 1242 of file dae_builder.cpp.

1242  {
1243  try {
1244  return (*this)->variable(name).min;
1245  } catch (std::exception& e) {
1246  THROW_ERROR("min", e.what());
1247  return 0; // never reached
1248  }
1249 }

References e(), and name().

◆ min() [2/2]

std::vector< double > casadi::DaeBuilder::min ( const std::vector< std::string > &  name) const

Definition at line 1251 of file dae_builder.cpp.

1251  {
1252  try {
1253  return (*this)->attribute(Attribute::MIN, name);
1254  } catch (std::exception& e) {
1255  THROW_ERROR("min", e.what());
1256  return {}; // never reached
1257  }
1258 }

References e(), casadi::MIN, and name().

◆ name() [1/3]

const std::string & casadi::DaeBuilder::name ( ) const

◆ name() [2/3]

std::vector< std::string > casadi::DaeBuilder::name ( const std::vector< size_t > &  ind) const

[DEPRECATED] Access to internal class and corresponding indexing removed

Definition at line 375 of file dae_builder.cpp.

375  {
376  try {
377  return (*this)->name(ind);
378  } catch (std::exception& e) {
379  THROW_ERROR("name", e.what());
380  return {}; // never reached
381  }
382 }

References e().

◆ name() [3/3]

const std::string & casadi::DaeBuilder::name ( size_t  ind) const

[DEPRECATED] Access to internal class and corresponding indexing removed

Definition at line 365 of file dae_builder.cpp.

365  {
366  try {
367  return (*this)->name(ind);
368  } catch (std::exception& e) {
369  THROW_ERROR("name", e.what());
370  static std::string dummy;
371  return dummy; // never reached
372  }
373 }

References e().

◆ nc()

casadi_int casadi::DaeBuilder::nc ( ) const

Extra doc: https://github.com/casadi/casadi/wiki/L_6b

Definition at line 225 of file dae_builder.cpp.

225  {
226  return (*this)->size(Category::C);
227 }

References casadi::C.

◆ nd()

casadi_int casadi::DaeBuilder::nd ( ) const

Extra doc: https://github.com/casadi/casadi/wiki/L_6c

Definition at line 229 of file dae_builder.cpp.

229  {
230  return (*this)->size(Category::D);
231 }

References casadi::D.

◆ ne()

casadi_int casadi::DaeBuilder::ne ( ) const
inline

Definition at line 370 of file dae_builder.hpp.

370 {return nzero();}
casadi_int nzero() const
Zero-crossing functions.

◆ new_variable()

Variable & casadi::DaeBuilder::new_variable ( const std::string &  name,
casadi_int  numel = 1 
)

Definition at line 307 of file dae_builder.cpp.

307  {
308  try {
309  return (*this)->new_variable(name, {numel});
310  } catch (std::exception& e) {
311  THROW_ERROR("new_variable", e.what());
312  }
313 }

References e(), and name().

Referenced by add_variable(), and add_variable_new().

◆ nominal() [1/2]

double casadi::DaeBuilder::nominal ( const std::string &  name) const

Definition at line 1310 of file dae_builder.cpp.

1310  {
1311  try {
1312  return (*this)->variable(name).nominal;
1313  } catch (std::exception& e) {
1314  THROW_ERROR("nominal", e.what());
1315  return 0; // never reached
1316  }
1317 }

References e(), and name().

◆ nominal() [2/2]

std::vector< double > casadi::DaeBuilder::nominal ( const std::vector< std::string > &  name) const

Definition at line 1319 of file dae_builder.cpp.

1319  {
1320  try {
1321  return (*this)->attribute(Attribute::NOMINAL, name);
1322  } catch (std::exception& e) {
1323  THROW_ERROR("nominal", e.what());
1324  return {}; // never reached
1325  }
1326 }

References e(), name(), and casadi::NOMINAL.

◆ np()

casadi_int casadi::DaeBuilder::np ( ) const

Extra doc: https://github.com/casadi/casadi/wiki/L_6a

Definition at line 221 of file dae_builder.cpp.

221  {
222  return (*this)->size(Category::P);
223 }

References casadi::P.

◆ nq()

casadi_int casadi::DaeBuilder::nq ( ) const

Extra doc: https://github.com/casadi/casadi/wiki/L_67

Definition at line 205 of file dae_builder.cpp.

205  {
206  return (*this)->size(Category::Q);
207 }

References casadi::Q.

◆ nu()

casadi_int casadi::DaeBuilder::nu ( ) const

Extra doc: https://github.com/casadi/casadi/wiki/L_69

Definition at line 217 of file dae_builder.cpp.

217  {
218  return (*this)->size(Category::U);
219 }

References casadi::U.

◆ numel()

casadi_int casadi::DaeBuilder::numel ( const std::string &  name) const

Definition at line 955 of file dae_builder.cpp.

955  {
956  return (*this)->variable(name).numel;
957 }

References name().

◆ nw()

casadi_int casadi::DaeBuilder::nw ( ) const

Extra doc: https://github.com/casadi/casadi/wiki/L_6d

Definition at line 233 of file dae_builder.cpp.

233  {
234  return (*this)->size(Category::W);
235 }

References casadi::W.

◆ nx()

casadi_int casadi::DaeBuilder::nx ( ) const

Extra doc: https://github.com/casadi/casadi/wiki/L_65

Definition at line 197 of file dae_builder.cpp.

197  {
198  return (*this)->size(Category::X);
199 }

References casadi::X.

◆ ny()

casadi_int casadi::DaeBuilder::ny ( ) const

Extra doc: https://github.com/casadi/casadi/wiki/L_68

Definition at line 213 of file dae_builder.cpp.

213  {
214  return (*this)->outputs_.size();
215 }

◆ nz()

casadi_int casadi::DaeBuilder::nz ( ) const

Extra doc: https://github.com/casadi/casadi/wiki/L_66

Definition at line 201 of file dae_builder.cpp.

201  {
202  return (*this)->size(Category::Z);
203 }

References casadi::Z.

◆ nzero()

casadi_int casadi::DaeBuilder::nzero ( ) const

Extra doc: https://github.com/casadi/casadi/wiki/L_2cb

Definition at line 209 of file dae_builder.cpp.

209  {
210  return (*this)->event_indicators_.size();
211 }

◆ ode()

std::vector< MX > casadi::DaeBuilder::ode ( ) const

Extra doc: https://github.com/casadi/casadi/wiki/L_5g

Definition at line 82 of file dae_builder.cpp.

82  {
83  try {
84  return (*this)->output(OutputCategory::ODE);
85  } catch (std::exception& e) {
86  THROW_ERROR("ode", e.what());
87  return {}; // never reached
88  }
89 }

References e(), and casadi::ODE.

◆ operator()()

MX casadi::DaeBuilder::operator() ( const std::string &  name) const
inline

Get variable expression by name

Definition at line 548 of file dae_builder.hpp.

548 {return var(name);}
MX var(const std::string &name) const

◆ operator->() [1/2]

DaeBuilderInternal * casadi::DaeBuilder::operator-> ( )

Definition at line 1180 of file dae_builder.cpp.

1180  {
1181  return static_cast<DaeBuilderInternal*>(SharedObject::operator->());
1182 }
SharedObjectInternal * operator->() const
Access a member function or object.

References casadi::GenericShared< SharedObject, SharedObjectInternal >::operator->().

◆ operator->() [2/2]

const DaeBuilderInternal * casadi::DaeBuilder::operator-> ( ) const

Definition at line 1184 of file dae_builder.cpp.

1184  {
1185  return static_cast<const DaeBuilderInternal*>(SharedObject::operator->());
1186 }

References casadi::GenericShared< SharedObject, SharedObjectInternal >::operator->().

◆ oracle()

Function casadi::DaeBuilder::oracle ( bool  sx = false,
bool  elim_w = false,
bool  lifted_calls = false 
) const

Definition at line 1138 of file dae_builder.cpp.

1138  {
1139  try {
1140  return (*this)->oracle(sx, elim_w, lifted_calls);
1141  } catch (std::exception& e) {
1142  THROW_ERROR("oracle", e.what());
1143  return Function(); // never reached
1144  }
1145 }

References e(), and casadi::FunctionInternal::oracle().

◆ outputs()

std::vector< std::string > casadi::DaeBuilder::outputs ( ) const

Extra doc: https://github.com/casadi/casadi/wiki/L_61

Definition at line 161 of file dae_builder.cpp.

161  {
162  try {
163  return (*this)->name((*this)->outputs_);
164  } catch (std::exception& e) {
165  THROW_ERROR("outputs", e.what());
166  return {}; // never reached
167  }
168 }

References e().

◆ own()

void casadi::GenericShared< SharedObject , SharedObjectInternal >::own ( Internal *  node)
inherited

Assign the node to a node class pointer (or null)

Definition at line 90 of file generic_shared_impl.hpp.

◆ p()

std::vector<std::string> casadi::DaeBuilder::p ( ) const
inline

Extra doc: https://github.com/casadi/casadi/wiki/L_5o

Definition at line 151 of file dae_builder.hpp.

151 {return all("p");}

References casadi::all().

◆ parse_fmi()

void casadi::DaeBuilder::parse_fmi ( const std::string &  filename)
inline

Import existing problem from FMI/XML

Definition at line 482 of file dae_builder.hpp.

References casadi::filename().

◆ pre() [1/3]

MX casadi::DaeBuilder::pre ( const MX v) const

Definition at line 764 of file dae_builder.cpp.

764  {
765  try {
766  // Not implemented
767  static bool warned = false;
768  if (!warned) {
769  casadi_warning("DaeBuilder::pre has not been implemented: Returning identity mapping");
770  warned = true;
771  }
772  return v;
773  } catch (std::exception& e) {
774  THROW_ERROR("pre", e.what());
775  return MX(); // never reached
776  }
777 }

References e().

◆ pre() [2/3]

std::string casadi::DaeBuilder::pre ( const std::string &  name) const

Definition at line 749 of file dae_builder.cpp.

749  {
750  try {
751  // Not implemented
752  static bool warned = false;
753  if (!warned) {
754  casadi_warning("DaeBuilder::pre has not been implemented: Returning identity mapping");
755  warned = true;
756  }
757  return name;
758  } catch (std::exception& e) {
759  THROW_ERROR("pre", e.what());
760  return std::string(); // never reached
761  }
762 }

References e(), and name().

◆ pre() [3/3]

std::vector< std::string > casadi::DaeBuilder::pre ( const std::vector< std::string > &  name) const

Definition at line 790 of file dae_builder.cpp.

790  {
791  try {
792  std::vector<std::string> r(name.size());
793  for (size_t i = 0; i < r.size(); ++i) r[i] = pre(name[i]);
794  return r;
795  } catch (std::exception& e) {
796  THROW_ERROR("pre", e.what());
797  return {}; // never reached
798  }
799 }
std::vector< std::string > pre(const std::vector< std::string > &name) const
Get the pre-variables of model variables.

References e(), and name().

◆ print_ptr()

void casadi::SharedObject::print_ptr ( std::ostream &  stream = casadi::uout()) const
inherited

Print the pointer to the internal class

Definition at line 43 of file shared_object.cpp.

43  {
44  stream << get();
45  }

References casadi::GenericShared< SharedObject, SharedObjectInternal >::get().

◆ provides_directional_derivative()

bool casadi::DaeBuilder::provides_directional_derivative ( ) const
inline

Definition at line 488 of file dae_builder.hpp.

bool provides_directional_derivatives() const
Does the FMU provide support for analytic derivatives.

◆ provides_directional_derivatives()

bool casadi::DaeBuilder::provides_directional_derivatives ( ) const

Definition at line 245 of file dae_builder.cpp.

245  {
246  try {
247  casadi_assert(!(*this)->symbolic_, "Functionality only applies to imported standard FMUs");
248  return (*this)->provides_directional_derivatives_;
249  } catch (std::exception& e) {
250  THROW_ERROR("provides_directional_derivatives", e.what());
251  return false;
252  }
253 }

References e().

◆ prune()

void casadi::DaeBuilder::prune ( bool  prune_p = true,
bool  prune_u = true 
)

Definition at line 263 of file dae_builder.cpp.

263  {
264  try {
265  (*this)->prune(prune_p, prune_u);
266  } catch (std::exception& e) {
267  THROW_ERROR("prune", e.what());
268  }
269 }

References e().

◆ q()

std::vector<std::string> casadi::DaeBuilder::q ( ) const
inline

Extra doc: https://github.com/casadi/casadi/wiki/L_5j

Definition at line 126 of file dae_builder.hpp.

126 {return all("q");}

References casadi::all().

◆ quad()

std::vector< MX > casadi::DaeBuilder::quad ( ) const

Extra doc: https://github.com/casadi/casadi/wiki/L_5k

Definition at line 100 of file dae_builder.cpp.

100  {
101  try {
102  return (*this)->output(OutputCategory::QUAD);
103  } catch (std::exception& e) {
104  THROW_ERROR("quad", e.what());
105  return {}; // never reached
106  }
107 }

References e(), and casadi::QUAD.

◆ register_c()

void casadi::DaeBuilder::register_c ( const std::string &  name)

Definition at line 459 of file dae_builder.cpp.

459  {
460  (*this)->indices(Category::C).push_back(find(name));
461 }
size_t find(const std::string &name) const

References casadi::C, find(), and name().

◆ register_d()

void casadi::DaeBuilder::register_d ( const std::string &  name)

Definition at line 463 of file dae_builder.cpp.

463  {
464  (*this)->indices(Category::D).push_back(find(name));
465 }

References casadi::D, find(), and name().

◆ register_e()

void casadi::DaeBuilder::register_e ( const std::string &  name)

Definition at line 475 of file dae_builder.cpp.

475  {
476  (*this)->event_indicators_.push_back(find(name));
477 }

References find(), and name().

◆ register_p()

void casadi::DaeBuilder::register_p ( const std::string &  name)

Definition at line 439 of file dae_builder.cpp.

439  {
440  (*this)->indices(Category::P).push_back(find(name));
441 }

References find(), name(), and casadi::P.

◆ register_q()

void casadi::DaeBuilder::register_q ( const std::string &  name)

Definition at line 455 of file dae_builder.cpp.

455  {
456  (*this)->indices(Category::Q).push_back(find(name));
457 }

References find(), name(), and casadi::Q.

◆ register_t()

void casadi::DaeBuilder::register_t ( const std::string &  name)

Definition at line 433 of file dae_builder.cpp.

433  {
434  // Save to class
435  casadi_assert(!has_t(), "'t' already defined");
436  (*this)->indices(Category::T).push_back(find(name));
437 }
bool has_t() const
Is there a time variable?

References find(), has_t(), name(), and casadi::T.

◆ register_u()

void casadi::DaeBuilder::register_u ( const std::string &  name)

Definition at line 443 of file dae_builder.cpp.

443  {
444  (*this)->indices(Category::U).push_back(find(name));
445 }

References find(), name(), and casadi::U.

◆ register_w()

void casadi::DaeBuilder::register_w ( const std::string &  name)

Definition at line 467 of file dae_builder.cpp.

467  {
468  (*this)->indices(Category::W).push_back(find(name));
469 }

References find(), name(), and casadi::W.

◆ register_x()

void casadi::DaeBuilder::register_x ( const std::string &  name)

Definition at line 447 of file dae_builder.cpp.

447  {
448  (*this)->indices(Category::X).push_back(find(name));
449 }

References find(), name(), and casadi::X.

◆ register_y()

void casadi::DaeBuilder::register_y ( const std::string &  name)

Definition at line 471 of file dae_builder.cpp.

471  {
472  (*this)->outputs_.push_back(find(name));
473 }

References find(), and name().

◆ register_z()

void casadi::DaeBuilder::register_z ( const std::string &  name)

Definition at line 451 of file dae_builder.cpp.

451  {
452  (*this)->indices(Category::Z).push_back(find(name));
453 }

References find(), name(), and casadi::Z.

◆ reinit()

std::string casadi::DaeBuilder::reinit ( const std::string &  name,
const MX val 
)

Definition at line 700 of file dae_builder.cpp.

700  {
701  try {
702  return (*this)->reinit(name, val).name;
703  } catch (std::exception& e) {
704  THROW_ERROR("reinit", e.what());
705  return std::string(); // never reached
706  }
707 }

References e(), and name().

◆ reorder()

void casadi::DaeBuilder::reorder ( const std::string &  cat,
const std::vector< std::string > &  v 
)

Definition at line 552 of file dae_builder.cpp.

552  {
553  try {
554  auto vind = (*this)->find(v);
555  if (cat == "y") {
556  // Reorder outputs
557  (*this)->reorder("y", (*this)->outputs_, vind);
558  } else {
559  // Reorder inputs
560  (*this)->reorder(to_enum<Category>(cat), vind);
561  }
562  } catch (std::exception& e) {
563  THROW_ERROR("reorder", e.what());
564  }
565 }

References e().

Referenced by sort_z().

◆ reset()

void casadi::DaeBuilder::reset ( )

Definition at line 1386 of file dae_builder.cpp.

1386  {
1387  try {
1388  (*this)->reset();
1389  } catch (std::exception& e) {
1390  THROW_ERROR("reset", e.what());
1391  }
1392 }

References e().

◆ sanity_check()

void casadi::DaeBuilder::sanity_check ( ) const

Definition at line 717 of file dae_builder.cpp.

717  {
718  try {
719  (*this)->sanity_check();
720  } catch (std::exception& e) {
721  THROW_ERROR("sanity_check", e.what());
722  }
723 }

References e().

◆ set() [1/4]

void casadi::DaeBuilder::set ( const std::string &  name,
const std::string &  val 
)

Definition at line 1402 of file dae_builder.cpp.

1402  {
1403  try {
1404  (*this)->set_string_attribute(Attribute::STRINGVALUE, name, val);
1405  } catch (std::exception& e) {
1406  THROW_ERROR("set", e.what());
1407  }
1408 }

References e(), name(), and casadi::STRINGVALUE.

◆ set() [2/4]

void casadi::DaeBuilder::set ( const std::string &  name,
double  val 
)

Definition at line 1394 of file dae_builder.cpp.

1394  {
1395  try {
1396  (*this)->set_attribute(Attribute::VALUE, name, val);
1397  } catch (std::exception& e) {
1398  THROW_ERROR("set", e.what());
1399  }
1400 }

References e(), name(), and casadi::VALUE.

◆ set() [3/4]

void casadi::DaeBuilder::set ( const std::vector< std::string > &  name,
const std::vector< double > &  val 
)

Definition at line 1410 of file dae_builder.cpp.

1410  {
1411  try {
1412  (*this)->set_attribute(Attribute::VALUE, name, val);
1413  } catch (std::exception& e) {
1414  THROW_ERROR("set", e.what());
1415  }
1416 }

References e(), name(), and casadi::VALUE.

◆ set() [4/4]

void casadi::DaeBuilder::set ( const std::vector< std::string > &  name,
const std::vector< std::string > &  val 
)

Definition at line 1418 of file dae_builder.cpp.

1419  {
1420  try {
1421  (*this)->set_string_attribute(Attribute::STRINGVALUE, name, val);
1422  } catch (std::exception& e) {
1423  THROW_ERROR("set", e.what());
1424  }
1425 }

References e(), name(), and casadi::STRINGVALUE.

◆ set_alg()

void casadi::DaeBuilder::set_alg ( const std::string &  name,
const MX alg_rhs 
)
inline

Definition at line 359 of file dae_builder.hpp.

359  {
360  (void)name;
361  eq(0, alg_rhs);
362  }

◆ set_all()

void casadi::DaeBuilder::set_all ( const std::string &  v,
const std::vector< std::string > &  name 
)

Definition at line 536 of file dae_builder.cpp.

536  {
537  try {
538  (*this)->clear_cache_ = true; // Clear cache after this
539  const std::vector<size_t>& new_ind = (*this)->find(name);
540  if (v == "y") {
541  (*this)->outputs_ = new_ind;
542  } else {
543  (*this)->indices(to_enum<Category>(v)) = new_ind;
544  }
545  } catch (std::exception& e) {
546  THROW_ERROR("set_all", e.what());
547  }
548 }

References e(), and name().

◆ set_attribute() [1/2]

void casadi::DaeBuilder::set_attribute ( const std::string &  a,
const std::string &  name,
double  val 
)

Definition at line 1225 of file dae_builder.cpp.

1225  {
1226  try {
1227  (*this)->set_attribute(to_enum<Attribute>(a), name, val);
1228  } catch (std::exception& e) {
1229  THROW_ERROR("set_attribute", e.what());
1230  }
1231 }

References e(), and name().

◆ set_attribute() [2/2]

void casadi::DaeBuilder::set_attribute ( const std::string &  a,
const std::vector< std::string > &  name,
const std::vector< double > &  val 
)

Definition at line 1233 of file dae_builder.cpp.

1234  {
1235  try {
1236  (*this)->set_attribute(to_enum<Attribute>(a), name, val);
1237  } catch (std::exception& e) {
1238  THROW_ERROR("set_attribute", e.what());
1239  }
1240 }

References e(), and name().

◆ set_beq()

void casadi::DaeBuilder::set_beq ( const std::string &  name,
const MX val 
)

Definition at line 665 of file dae_builder.cpp.

665  {
666  try {
667  eq(var(name), val);
668  } catch (std::exception& e) {
669  THROW_ERROR("set_beq", e.what());
670  }
671 }

References e(), eq(), name(), and var().

Referenced by add_c(), and add_d().

◆ set_category()

void casadi::DaeBuilder::set_category ( const std::string &  name,
const std::string &  val 
)

The following changes are permitted: Controls 'u' can be changed to/from tunable parameters 'p' or fixed parameters 'c' Differential states that do not appear in the right-hand-sides can be changed between regular states 'x' and quadrature states 'q'

Other changes are not permitted. Causality and variability is updated accordingly.

Extra doc: https://github.com/casadi/casadi/wiki/L_2c4

Definition at line 923 of file dae_builder.cpp.

923  {
924  try {
925  (*this)->set_category((*this)->find(name), to_enum<Category>(val));
926  } catch (std::exception& e) {
927  THROW_ERROR("set_category", e.what());
928  }
929 }

References e(), and name().

◆ set_causality()

void casadi::DaeBuilder::set_causality ( const std::string &  name,
const std::string &  val 
)

The following changes are permitted: For controls 'u' (variability 'continuous', causality 'input'), free parameters 'p' (variability 'tunable', causality 'parameter') and fixed parameters 'c' (variability 'fixed', causality 'parameter'), causality can only be changed indirectly, by updating the variability Add or remove an output 'y' by setting the causality to 'output' or 'local', respectively

No other changes are permitted.

Extra doc: https://github.com/casadi/casadi/wiki/L_2c2

Definition at line 889 of file dae_builder.cpp.

889  {
890  try {
891  (*this)->set_causality((*this)->find(name), to_enum<Causality>(val));
892  } catch (std::exception& e) {
893  THROW_ERROR("set_causality", e.what());
894  }
895 }

References e(), and name().

◆ set_description()

void casadi::DaeBuilder::set_description ( const std::string &  name,
const std::string &  val 
)

Get/set description

Definition at line 856 of file dae_builder.cpp.

856  {
857  (*this)->variable(name).description = val;
858 }

References name().

◆ set_display_unit()

void casadi::DaeBuilder::set_display_unit ( const std::string &  name,
const std::string &  val 
)

Get/set the display unit

Definition at line 951 of file dae_builder.cpp.

951  {
952  (*this)->variable(name).display_unit = val;
953 }

References name().

◆ set_init()

void casadi::DaeBuilder::set_init ( const std::string &  name,
const MX init_rhs 
)

Definition at line 709 of file dae_builder.cpp.

709  {
710  try {
711  (*this)->set_init(name, init_rhs);
712  } catch (std::exception& e) {
713  THROW_ERROR("set_init", e.what());
714  }
715 }
std::vector< MX > init_rhs() const
Initial conditions, right-hand-side.

References e(), init_rhs(), and name().

◆ set_initial()

void casadi::DaeBuilder::set_initial ( const std::string &  name,
const std::string &  val 
)

Get/set the initial property

Definition at line 935 of file dae_builder.cpp.

935  {
936  (*this)->variable(name).initial = to_enum<Initial>(val);
937 }

References name().

◆ set_max() [1/2]

void casadi::DaeBuilder::set_max ( const std::string &  name,
double  val 
)

Definition at line 1294 of file dae_builder.cpp.

1294  {
1295  try {
1296  (*this)->variable(name).max = val;
1297  } catch (std::exception& e) {
1298  THROW_ERROR("set_max", e.what());
1299  }
1300 }

References e(), and name().

◆ set_max() [2/2]

void casadi::DaeBuilder::set_max ( const std::vector< std::string > &  name,
const std::vector< double > &  val 
)

Definition at line 1302 of file dae_builder.cpp.

1302  {
1303  try {
1304  (*this)->set_attribute(Attribute::MAX, name, val);
1305  } catch (std::exception& e) {
1306  THROW_ERROR("set_max", e.what());
1307  }
1308 }

References e(), casadi::MAX, and name().

◆ set_min() [1/2]

void casadi::DaeBuilder::set_min ( const std::string &  name,
double  val 
)

Definition at line 1260 of file dae_builder.cpp.

1260  {
1261  try {
1262  (*this)->variable(name).min = val;
1263  } catch (std::exception& e) {
1264  THROW_ERROR("set_min", e.what());
1265  }
1266 }

References e(), and name().

◆ set_min() [2/2]

void casadi::DaeBuilder::set_min ( const std::vector< std::string > &  name,
const std::vector< double > &  val 
)

Definition at line 1268 of file dae_builder.cpp.

1268  {
1269  try {
1270  (*this)->set_attribute(Attribute::MIN, name, val);
1271  } catch (std::exception& e) {
1272  THROW_ERROR("set_min", e.what());
1273  }
1274 }

References e(), casadi::MIN, and name().

◆ set_nominal() [1/2]

void casadi::DaeBuilder::set_nominal ( const std::string &  name,
double  val 
)

Definition at line 1328 of file dae_builder.cpp.

1328  {
1329  try {
1330  (*this)->variable(name).nominal = val;
1331  } catch (std::exception& e) {
1332  THROW_ERROR("set_nominal", e.what());
1333  }
1334 }

References e(), and name().

◆ set_nominal() [2/2]

void casadi::DaeBuilder::set_nominal ( const std::vector< std::string > &  name,
const std::vector< double > &  val 
)

Definition at line 1336 of file dae_builder.cpp.

1336  {
1337  try {
1338  (*this)->set_attribute(Attribute::NOMINAL, name, val);
1339  } catch (std::exception& e) {
1340  THROW_ERROR("set_mininal", e.what());
1341  }
1342 }

References e(), name(), and casadi::NOMINAL.

◆ set_ode()

void casadi::DaeBuilder::set_ode ( const std::string &  name,
const MX ode_rhs 
)
inline

Definition at line 354 of file dae_builder.hpp.

354  {
355  eq(var(name), ode_rhs);
356  }

◆ set_start() [1/3]

void casadi::DaeBuilder::set_start ( const std::string &  name,
const std::vector< double > &  val 
)

Definition at line 1370 of file dae_builder.cpp.

1370  {
1371  try {
1372  (*this)->set_attribute(Attribute::START, std::vector<std::string>{name}, val);
1373  } catch (std::exception& e) {
1374  THROW_ERROR("set_start", e.what());
1375  }
1376 }

References e(), name(), and casadi::START.

◆ set_start() [2/3]

void casadi::DaeBuilder::set_start ( const std::string &  name,
double  val 
)

Definition at line 1362 of file dae_builder.cpp.

1362  {
1363  try {
1364  (*this)->set_attribute(Attribute::START, name, val);
1365  } catch (std::exception& e) {
1366  THROW_ERROR("set_start", e.what());
1367  }
1368 }

References e(), name(), and casadi::START.

◆ set_start() [3/3]

void casadi::DaeBuilder::set_start ( const std::vector< std::string > &  name,
const std::vector< double > &  val 
)

Definition at line 1378 of file dae_builder.cpp.

1378  {
1379  try {
1380  (*this)->set_attribute(Attribute::START, name, val);
1381  } catch (std::exception& e) {
1382  THROW_ERROR("set_start", e.what());
1383  }
1384 }

References e(), name(), and casadi::START.

◆ set_start_time()

void casadi::DaeBuilder::set_start_time ( double  val)

Definition at line 972 of file dae_builder.cpp.

972  {
973  try {
974  (*this)->start_time_ = val;
975  } catch (std::exception& e) {
976  THROW_ERROR("set_start_time", e.what());
977  }
978 }

References e().

◆ set_step_size()

void casadi::DaeBuilder::set_step_size ( double  val)

Definition at line 1023 of file dae_builder.cpp.

1023  {
1024  try {
1025  (*this)->step_size_ = val;
1026  } catch (std::exception& e) {
1027  THROW_ERROR("set_step_size", e.what());
1028  }
1029 }

References e().

◆ set_stop_time()

void casadi::DaeBuilder::set_stop_time ( double  val)

Definition at line 989 of file dae_builder.cpp.

989  {
990  try {
991  (*this)->stop_time_ = val;
992  } catch (std::exception& e) {
993  THROW_ERROR("set_stop_time", e.what());
994  }
995 }

References e().

◆ set_tolerance()

void casadi::DaeBuilder::set_tolerance ( double  val)

Definition at line 1006 of file dae_builder.cpp.

1006  {
1007  try {
1008  (*this)->tolerance_ = val;
1009  } catch (std::exception& e) {
1010  THROW_ERROR("set_tolerance", e.what());
1011  }
1012 }

References e().

◆ set_type()

void casadi::DaeBuilder::set_type ( const std::string &  name,
const std::string &  val 
)

Get/set the type

Definition at line 871 of file dae_builder.cpp.

871  {
872  // Fallback to FMI 2, if necessary
873  if (has_enum<TypeFmi2>(val) && !has_enum<Type>(val)) {
874  (*this)->variable(name).type = from_fmi2(to_enum<TypeFmi2>(val));
875  }
876  // Assume FMI 3
877  (*this)->variable(name).type = to_enum<Type>(val);
878 }
Type from_fmi2(TypeFmi2 v)

References casadi::from_fmi2(), and name().

◆ set_unit()

void casadi::DaeBuilder::set_unit ( const std::string &  name,
const std::string &  val 
)

Get/set the unit

Definition at line 943 of file dae_builder.cpp.

943  {
944  (*this)->variable(name).unit = val;
945 }

References name().

◆ set_value_reference()

void casadi::DaeBuilder::set_value_reference ( const std::string &  name,
casadi_int  val 
)

Get/set value reference

Definition at line 848 of file dae_builder.cpp.

848  {
849  (*this)->variable(name).value_reference = val;
850 }

References name().

◆ set_variability()

void casadi::DaeBuilder::set_variability ( const std::string &  name,
const std::string &  val 
)

For controls 'u' (variability 'continuous', causality 'input'), free parameters 'p' (variability 'tunable', causality 'parameter') and fixed parameters 'c' (variability 'fixed', causality 'parameter'), update variability in order to change the category. Causality is updated accordingly.

Other changes are not permitted

Extra doc: https://github.com/casadi/casadi/wiki/L_2c3 

Definition at line 906 of file dae_builder.cpp.

906  {
907  try {
908  (*this)->set_variability((*this)->find(name), to_enum<Variability>(val));
909  } catch (std::exception& e) {
910  THROW_ERROR("set_variability", e.what());
911  }
912 }

References e(), and name().

◆ sort()

void casadi::DaeBuilder::sort ( const std::string &  cat)

Definition at line 828 of file dae_builder.cpp.

828  {
829  try {
830  return (*this)->sort(to_enum<Category>(cat));
831  } catch (std::exception& e) {
832  THROW_ERROR("sort", e.what());
833  }
834 }

References e().

Referenced by sort_d(), and sort_w().

◆ sort_d()

void casadi::DaeBuilder::sort_d ( )

Definition at line 503 of file dae_builder.cpp.

503  {
504  try {
505  return sort("d");
506  } catch (std::exception& e) {
507  THROW_ERROR("sort_d", e.what());
508  }
509 }
void sort(const std::string &cat)
Sort dependent parameters.

References e(), and sort().

◆ sort_w()

void casadi::DaeBuilder::sort_w ( )

Definition at line 511 of file dae_builder.cpp.

511  {
512  try {
513  return sort("w");
514  } catch (std::exception& e) {
515  THROW_ERROR("sort_w", e.what());
516  }
517 }

References e(), and sort().

◆ sort_z()

void casadi::DaeBuilder::sort_z ( const std::vector< std::string > &  z_order)

Definition at line 519 of file dae_builder.cpp.

519  {
520  try {
521  return reorder("z", z_order);
522  } catch (std::exception& e) {
523  THROW_ERROR("sort_z", e.what());
524  }
525 }
void reorder(const std::string &cat, const std::vector< std::string > &v)
Reorder variables in a category.

References e(), and reorder().

◆ start() [1/2]

std::vector< double > casadi::DaeBuilder::start ( const std::string &  name) const

Definition at line 1344 of file dae_builder.cpp.

1344  {
1345  try {
1346  return (*this)->attribute(Attribute::START, std::vector<std::string>{name});
1347  } catch (std::exception& e) {
1348  THROW_ERROR("start", e.what());
1349  return {}; // never reached
1350  }
1351 }

References e(), and casadi::START.

◆ start() [2/2]

std::vector< double > casadi::DaeBuilder::start ( const std::vector< std::string > &  name) const

Definition at line 1353 of file dae_builder.cpp.

1353  {
1354  try {
1355  return (*this)->attribute(Attribute::START, name);
1356  } catch (std::exception& e) {
1357  THROW_ERROR("start", e.what());
1358  return {}; // never reached
1359  }
1360 }

References e(), name(), and casadi::START.

◆ start_time()

double casadi::DaeBuilder::start_time ( ) const

Definition at line 963 of file dae_builder.cpp.

963  {
964  try {
965  return (*this)->start_time_;
966  } catch (std::exception& e) {
967  THROW_ERROR("start_time", e.what());
968  return nan;
969  }
970 }
const double nan
Not a number.
Definition: calculus.hpp:53

References e(), and casadi::nan.

◆ step_size()

double casadi::DaeBuilder::step_size ( ) const

Definition at line 1014 of file dae_builder.cpp.

1014  {
1015  try {
1016  return (*this)->step_size_;
1017  } catch (std::exception& e) {
1018  THROW_ERROR("step_size", e.what());
1019  return nan;
1020  }
1021 }

References e(), and casadi::nan.

◆ stop_time()

double casadi::DaeBuilder::stop_time ( ) const

Definition at line 980 of file dae_builder.cpp.

980  {
981  try {
982  return (*this)->stop_time_;
983  } catch (std::exception& e) {
984  THROW_ERROR("stop_time", e.what());
985  return nan;
986  }
987 }

References e(), and casadi::nan.

◆ swap()

Definition at line 106 of file generic_shared_impl.hpp.

120  {
121  GenericShared<Shared, Internal> temp = *this;
122  *this = other;
123  other = temp;
124  }

◆ t()

const MX& casadi::DaeBuilder::t ( ) const
inline

Definition at line 300 of file dae_builder.hpp.

300 { return time();}
const MX & time() const
Expression for independent variable (usually time)
Definition: dae_builder.cpp:63

Referenced by time().

◆ t_new()

std::vector<std::string> casadi::DaeBuilder::t_new ( ) const
inline

Extra doc: https://github.com/casadi/casadi/wiki/L_2bz

Definition at line 98 of file dae_builder.hpp.

98 {return all("t");}

References casadi::all().

◆ tear()

void casadi::DaeBuilder::tear ( )

Definition at line 271 of file dae_builder.cpp.

271  {
272  try {
273  (*this)->tear();
274  } catch (std::exception& e) {
275  THROW_ERROR("tear", e.what());
276  }
277 }

References e().

◆ test_cast()

bool casadi::DaeBuilder::test_cast ( const SharedObjectInternal ptr)
static

Definition at line 1176 of file dae_builder.cpp.

1176  {
1177  return dynamic_cast<const DaeBuilderInternal*>(ptr) != nullptr;
1178 }

◆ time()

const MX & casadi::DaeBuilder::time ( ) const

Extra doc: https://github.com/casadi/casadi/wiki/L_2by

Definition at line 63 of file dae_builder.cpp.

63  {
64  try {
65  return (*this)->time();
66  } catch (std::exception& e) {
67  THROW_ERROR("time", e.what());
68  static const MX t;
69  return t; // never reached
70  }
71 }
const MX & t() const
[DEPRECATED] Renamed "time"

References e(), and t().

◆ tolerance()

double casadi::DaeBuilder::tolerance ( ) const

Definition at line 997 of file dae_builder.cpp.

997  {
998  try {
999  return (*this)->tolerance_;
1000  } catch (std::exception& e) {
1001  THROW_ERROR("tolerance", e.what());
1002  return nan;
1003  }
1004 }

References e(), and casadi::nan.

◆ transition() [1/3]

Function casadi::DaeBuilder::transition ( ) const
inline

Definition at line 543 of file dae_builder.hpp.

543 {return transition(name() + "_transition");}
Function transition() const
Construct an event transition function, default naming.

References transition().

Referenced by transition().

◆ transition() [2/3]

Function casadi::DaeBuilder::transition ( const std::string &  fname) const

Definition at line 1167 of file dae_builder.cpp.

1167  {
1168  try {
1169  return (*this)->transition(fname);
1170  } catch (std::exception& e) {
1171  THROW_ERROR("transition", e.what());
1172  return Function(); // never reached
1173  }
1174 }

References e().

◆ transition() [3/3]

Function casadi::DaeBuilder::transition ( const std::string &  fname,
casadi_int  index 
) const

Definition at line 1158 of file dae_builder.cpp.

1158  {
1159  try {
1160  return (*this)->transition(fname, index);
1161  } catch (std::exception& e) {
1162  THROW_ERROR("transition", e.what());
1163  return Function(); // never reached
1164  }
1165 }

References e().

◆ type()

std::string casadi::DaeBuilder::type ( const std::string &  name,
casadi_int  fmi_version = 3 
) const

Get/set the type

Definition at line 860 of file dae_builder.cpp.

860  {
861  // Check version
862  casadi_assert(fmi_version == 2 || fmi_version == 3, "Only FMI version 2 or 3 supported");
863  // Handle FMI 2
864  if (fmi_version == 2) {
865  return to_string(to_fmi2((*this)->variable(name).type));
866  }
867  // Assume FMI 3
868  return to_string((*this)->variable(name).type);
869 }
TypeFmi2 to_fmi2(Type v)

References name(), casadi::to_fmi2(), and casadi::to_string().

◆ type_name()

std::string casadi::DaeBuilder::type_name ( ) const
inline

Definition at line 74 of file dae_builder.hpp.

74 {return "DaeBuilder";}

◆ u()

std::vector<std::string> casadi::DaeBuilder::u ( ) const
inline

Extra doc: https://github.com/casadi/casadi/wiki/L_5n

Definition at line 146 of file dae_builder.hpp.

146 {return all("u");}

References casadi::all().

◆ unit()

std::string casadi::DaeBuilder::unit ( const std::string &  name) const

Get/set the unit

Definition at line 939 of file dae_builder.cpp.

939  {
940  return (*this)->variable(name).unit;
941 }

References name().

◆ value_reference()

casadi_int casadi::DaeBuilder::value_reference ( const std::string &  name) const

Get/set value reference

Definition at line 844 of file dae_builder.cpp.

844  {
845  return (*this)->variable(name).value_reference;
846 }

References name().

◆ var() [1/3]

MX casadi::DaeBuilder::var ( const std::string &  name) const

Get variable expression by name

Definition at line 725 of file dae_builder.cpp.

725  {
726  try {
727  return (*this)->variable(name).v;
728  } catch (std::exception& e) {
729  THROW_ERROR("var", e.what());
730  return MX(); // never reached
731  }
732 }

References e(), and name().

Referenced by set_beq().

◆ var() [2/3]

std::vector< MX > casadi::DaeBuilder::var ( const std::vector< size_t > &  ind) const

[DEPRECATED] Use string name, not internal index to access variables

Definition at line 393 of file dae_builder.cpp.

393  {
394  try {
395  return (*this)->var(ind);
396  } catch (std::exception& e) {
397  THROW_ERROR("var", e.what());
398  return {}; // never reached
399  }
400 }

References e().

◆ var() [3/3]

const MX & casadi::DaeBuilder::var ( size_t  ind) const

[DEPRECATED] Use string name, not internal index to access variables

Definition at line 383 of file dae_builder.cpp.

383  {
384  try {
385  return (*this)->var(ind);
386  } catch (std::exception& e) {
387  THROW_ERROR("var", e.what());
388  static MX dummy;
389  return dummy; // never reached
390  }
391 }

References e().

◆ variability()

std::string casadi::DaeBuilder::variability ( const std::string &  name) const

Definition at line 897 of file dae_builder.cpp.

897  {
898  try {
899  return to_string((*this)->variability((*this)->find(name)));
900  } catch (std::exception& e) {
901  THROW_ERROR("variability", e.what());
902  return std::string(); // never reached
903  }
904 }

References e(), name(), and casadi::to_string().

Referenced by add().

◆ variable() [1/4]

Variable & casadi::DaeBuilder::variable ( const std::string &  name)

[DEPRECATED] Access to internal class and corresponding indexing removed

Definition at line 315 of file dae_builder.cpp.

315  {
316  try {
317  return (*this)->variable(name);
318  } catch (std::exception& e) {
319  THROW_ERROR("variable", e.what());
320  }
321 }

References e(), and name().

◆ variable() [2/4]

const Variable & casadi::DaeBuilder::variable ( const std::string &  name) const

[DEPRECATED] Access to internal class and corresponding indexing removed

Definition at line 323 of file dae_builder.cpp.

323  {
324  try {
325  return (*this)->variable(name);
326  } catch (std::exception& e) {
327  THROW_ERROR("variable", e.what());
328  }
329 }

References e(), and name().

◆ variable() [3/4]

Variable & casadi::DaeBuilder::variable ( size_t  ind)

[DEPRECATED] Access to internal class and corresponding indexing removed

Definition at line 331 of file dae_builder.cpp.

331  {
332  try {
333  return (*this)->variable(ind);
334  } catch (std::exception& e) {
335  THROW_ERROR("variable", e.what());
336  }
337 }

References e().

◆ variable() [4/4]

const Variable & casadi::DaeBuilder::variable ( size_t  ind) const

[DEPRECATED] Access to internal class and corresponding indexing removed

Definition at line 339 of file dae_builder.cpp.

339  {
340  try {
341  return (*this)->variable(ind);
342  } catch (std::exception& e) {
343  THROW_ERROR("variable", e.what());
344  }
345 }

References e().

◆ w()

std::vector<std::string> casadi::DaeBuilder::w ( ) const
inline

Extra doc: https://github.com/casadi/casadi/wiki/L_5t

Definition at line 178 of file dae_builder.hpp.

178 {return all("w");}

References casadi::all().

◆ wdef()

std::vector< MX > casadi::DaeBuilder::wdef ( ) const

Interdependencies are allowed but must be non-cyclic.

Extra doc: https://github.com/casadi/casadi/wiki/L_5u

Definition at line 144 of file dae_builder.cpp.

144  {
145  try {
146  return (*this)->output(OutputCategory::WDEF);
147  } catch (std::exception& e) {
148  THROW_ERROR("wdef", e.what());
149  return {}; // never reached
150  }
151 }

References e(), and casadi::WDEF.

◆ weak()

Extra doc: https://github.com/casadi/casadi/wiki/L_aw

Definition at line 131 of file generic_shared_impl.hpp.

132  {
133  return (*this)->weak();
134  }

◆ when()

void casadi::DaeBuilder::when ( const MX cond,
const std::vector< std::string > &  eqs,
const Dict opts = Dict() 
)

Definition at line 683 of file dae_builder.cpp.

683  {
684  try {
685  (*this)->when(cond, eqs, opts);
686  } catch (std::exception& e) {
687  THROW_ERROR("when", e.what());
688  }
689 }

References e().

◆ x()

std::vector<std::string> casadi::DaeBuilder::x ( ) const
inline

Extra doc: https://github.com/casadi/casadi/wiki/L_5f

Definition at line 103 of file dae_builder.hpp.

103 {return all("x");}

References casadi::all().

◆ y()

std::vector< std::string > casadi::DaeBuilder::y ( ) const

Definition at line 73 of file dae_builder.cpp.

73  {
74  try {
75  return (*this)->name((*this)->outputs_);
76  } catch (std::exception& e) {
77  THROW_ERROR("y", e.what());
78  return {}; // never reached
79  }
80 }

References e().

◆ ydef()

std::vector< MX > casadi::DaeBuilder::ydef ( ) const

Extra doc: https://github.com/casadi/casadi/wiki/L_5m

Definition at line 117 of file dae_builder.cpp.

117  {
118  try {
119  return (*this)->output(OutputCategory::Y);
120  } catch (std::exception& e) {
121  THROW_ERROR("ydef", e.what());
122  return {}; // never reached
123  }
124 }

References e(), and casadi::Y.

◆ z()

std::vector<std::string> casadi::DaeBuilder::z ( ) const
inline

Extra doc: https://github.com/casadi/casadi/wiki/L_5h

Definition at line 116 of file dae_builder.hpp.

116 {return all("z");}

References casadi::all().

◆ zero()

std::vector< MX > casadi::DaeBuilder::zero ( ) const

Extra doc: https://github.com/casadi/casadi/wiki/L_2b0

Definition at line 109 of file dae_builder.cpp.

109  {
110  try {
111  return (*this)->output(OutputCategory::ZERO);
112  } catch (std::exception& e) {
113  THROW_ERROR("zero", e.what());
114  }
115 }

References e(), and casadi::ZERO.


The documentation for this class was generated from the following files: