Permalink
Browse files

added setters for opts to dynamics and constraints

  • Loading branch information...
giaf committed Jun 9, 2018
1 parent 25ca782 commit 326cc30d31412cdff71b36a9514820ea585fee93
@@ -210,6 +210,29 @@ void ocp_nlp_constraints_bgh_opts_update(void *config_, void *dims_, void *opts_
void ocp_nlp_constraints_bgh_opts_set(void *config_, void *dims_, void *opts_, enum acados_opts name, void *ptr_value)
{
ocp_nlp_constraints_bgh_opts *opts = opts_;
if (name==COMPUTE_ADJ)
{
int *compute_adj = ptr_value;
opts->compute_adj = *compute_adj;
}
else
{
// TODO something better tha this print-and-exit
printf("\nocp_nlp_constraints_bgh_opts_set: unknown opts name !\n");
exit(1);
}
return;
}
/************************************************
* memory
************************************************/
@@ -549,6 +572,7 @@ void ocp_nlp_constraints_bgh_config_initialize_default(void *config_)
config->opts_assign = &ocp_nlp_constraints_bgh_opts_assign;
config->opts_initialize_default = &ocp_nlp_constraints_bgh_opts_initialize_default;
config->opts_update = &ocp_nlp_constraints_bgh_opts_update;
config->opts_set = &ocp_nlp_constraints_bgh_opts_set;
config->memory_calculate_size = &ocp_nlp_constraints_bgh_memory_calculate_size;
config->memory_assign = &ocp_nlp_constraints_bgh_memory_assign;
config->memory_get_fun_ptr = &ocp_nlp_constraints_bgh_memory_get_fun_ptr;
@@ -96,6 +96,8 @@ void *ocp_nlp_constraints_bgh_opts_assign(void *config, void *dims, void *raw_me
void ocp_nlp_constraints_bgh_opts_initialize_default(void *config, void *dims, void *opts);
//
void ocp_nlp_constraints_bgh_opts_update(void *config, void *dims, void *opts);
//
void ocp_nlp_constraints_bgh_opts_set(void *config, void *dims, void *opts, enum acados_opts name, void *ptr_value);
@@ -205,6 +205,29 @@ void ocp_nlp_constraints_bghp_opts_update(void *config_, void *dims_, void *opts
void ocp_nlp_constraints_bghp_opts_set(void *config_, void *dims_, void *opts_, enum acados_opts name, void *ptr_value)
{
ocp_nlp_constraints_bghp_opts *opts = opts_;
if (name==COMPUTE_ADJ)
{
int *compute_adj = ptr_value;
opts->compute_adj = *compute_adj;
}
else
{
// TODO something better tha this print-and-exit
printf("\nocp_nlp_constraints_bghp_opts_set: unknown opts name !\n");
exit(1);
}
return;
}
/* memory */
int ocp_nlp_constraints_bghp_memory_calculate_size(void *config_, void *dims_, void *opts_)
@@ -577,6 +600,7 @@ void ocp_nlp_constraints_bghp_config_initialize_default(void *config_)
config->opts_assign = &ocp_nlp_constraints_bghp_opts_assign;
config->opts_initialize_default = &ocp_nlp_constraints_bghp_opts_initialize_default;
config->opts_update = &ocp_nlp_constraints_bghp_opts_update;
config->opts_set = &ocp_nlp_constraints_bghp_opts_set;
config->memory_calculate_size = &ocp_nlp_constraints_bghp_memory_calculate_size;
config->memory_assign = &ocp_nlp_constraints_bghp_memory_assign;
config->memory_get_fun_ptr = &ocp_nlp_constraints_bghp_memory_get_fun_ptr;
@@ -90,6 +90,8 @@ void *ocp_nlp_constraints_bghp_opts_assign(void *config, void *dims, void *raw_m
void ocp_nlp_constraints_bghp_opts_initialize_default(void *config, void *dims, void *opts);
//
void ocp_nlp_constraints_bghp_opts_update(void *config, void *dims, void *opts);
//
void ocp_nlp_constraints_bghp_opts_set(void *config, void *dims, void *opts, enum acados_opts name, void *ptr_value);
/* memory */
@@ -47,6 +47,7 @@ typedef struct
void *(*opts_assign)(void *config, void *dims, void *raw_memory);
void (*opts_initialize_default)(void *config, void *dims, void *opts);
void (*opts_update)(void *config, void *dims, void *opts);
void (*opts_set) (void *config_, void *dims_, void *opts_, enum acados_opts name, void *ptr_value);
int (*memory_calculate_size)(void *config, void *dims, void *opts);
struct blasfeo_dvec *(*memory_get_fun_ptr)(void *memory);
struct blasfeo_dvec *(*memory_get_adj_ptr)(void *memory);
@@ -24,6 +24,8 @@
extern "C" {
#endif
// blasfeo
#include "blasfeo/include/blasfeo_common.h"
@@ -32,6 +34,8 @@ extern "C" {
#include "acados/utils/external_function_generic.h"
#include "acados/utils/types.h"
/************************************************
* config
************************************************/
@@ -47,6 +51,7 @@ typedef struct
int (*opts_calculate_size)(void *config, void *dims);
void *(*opts_assign)(void *config, void *dims, void *raw_memory);
void (*opts_initialize_default)(void *config, void *dims, void *opts);
void (*opts_set) (void *config_, void *dims_, void *opts_, enum acados_opts name, void *ptr_value);
void (*opts_update)(void *config, void *dims, void *opts);
int (*memory_calculate_size)(void *config, void *dims, void *opts);
void *(*memory_assign)(void *config, void *dims, void *opts, void *raw_memory);
@@ -70,6 +75,8 @@ int ocp_nlp_dynamics_config_calculate_size();
//
ocp_nlp_dynamics_config *ocp_nlp_dynamics_config_assign(void *raw_memory);
#ifdef __cplusplus
} /* extern "C" */
#endif
@@ -30,6 +30,8 @@
// acados
#include "acados/utils/mem.h"
/************************************************
* dims
************************************************/
@@ -47,6 +49,8 @@ int ocp_nlp_dynamics_cont_dims_calculate_size(void *config_)
return size;
}
void *ocp_nlp_dynamics_cont_dims_assign(void *config_, void *raw_memory)
{
ocp_nlp_dynamics_config *dyn_config = (ocp_nlp_dynamics_config *) config_;
@@ -66,6 +70,8 @@ void *ocp_nlp_dynamics_cont_dims_assign(void *config_, void *raw_memory)
return dims;
}
void ocp_nlp_dynamics_cont_dims_initialize(void *config_, void *dims_, int nx, int nu, int nx1,
int nu1)
{
@@ -85,6 +91,8 @@ void ocp_nlp_dynamics_cont_dims_initialize(void *config_, void *dims_, int nx, i
return;
}
/************************************************
* options
************************************************/
@@ -103,6 +111,8 @@ int ocp_nlp_dynamics_cont_opts_calculate_size(void *config_, void *dims_)
return size;
}
void *ocp_nlp_dynamics_cont_opts_assign(void *config_, void *dims_, void *raw_memory)
{
ocp_nlp_dynamics_config *config = config_;
@@ -121,6 +131,8 @@ void *ocp_nlp_dynamics_cont_opts_assign(void *config_, void *dims_, void *raw_me
return opts;
}
void ocp_nlp_dynamics_cont_opts_initialize_default(void *config_, void *dims_, void *opts_)
{
ocp_nlp_dynamics_config *config = config_;
@@ -134,6 +146,8 @@ void ocp_nlp_dynamics_cont_opts_initialize_default(void *config_, void *dims_, v
return;
}
void ocp_nlp_dynamics_cont_opts_update(void *config_, void *dims_, void *opts_)
{
ocp_nlp_dynamics_config *config = config_;
@@ -145,6 +159,31 @@ void ocp_nlp_dynamics_cont_opts_update(void *config_, void *dims_, void *opts_)
return;
}
void ocp_nlp_dynamics_cont_opts_set(void *config_, void *dims_, void *opts_, enum acados_opts name, void *ptr_value)
{
ocp_nlp_dynamics_cont_opts *opts = opts_;
if (name==COMPUTE_ADJ)
{
int *compute_adj = ptr_value;
opts->compute_adj = *compute_adj;
}
else
{
// TODO something better tha this print-and-exit
printf("\nocp_nlp_dynamics_cont_opts_set: unknown opts name !\n");
exit(1);
}
return;
}
/************************************************
* memory
************************************************/
@@ -175,6 +214,8 @@ int ocp_nlp_dynamics_cont_memory_calculate_size(void *config_, void *dims_, void
return size;
}
void *ocp_nlp_dynamics_cont_memory_assign(void *config_, void *dims_, void *opts_, void *raw_memory)
{
ocp_nlp_dynamics_config *config = config_;
@@ -213,20 +254,26 @@ void *ocp_nlp_dynamics_cont_memory_assign(void *config_, void *dims_, void *opts
return memory;
}
struct blasfeo_dvec *ocp_nlp_dynamics_cont_memory_get_fun_ptr(void *memory_)
{
ocp_nlp_dynamics_cont_memory *memory = memory_;
return &memory->fun;
}
struct blasfeo_dvec *ocp_nlp_dynamics_cont_memory_get_adj_ptr(void *memory_)
{
ocp_nlp_dynamics_cont_memory *memory = memory_;
return &memory->adj;
}
void ocp_nlp_dynamics_cont_memory_set_ux_ptr(struct blasfeo_dvec *ux, void *memory_)
{
ocp_nlp_dynamics_cont_memory *memory = memory_;
@@ -236,6 +283,8 @@ void ocp_nlp_dynamics_cont_memory_set_ux_ptr(struct blasfeo_dvec *ux, void *memo
return;
}
void ocp_nlp_dynamics_cont_memory_set_ux1_ptr(struct blasfeo_dvec *ux1, void *memory_)
{
ocp_nlp_dynamics_cont_memory *memory = memory_;
@@ -245,6 +294,8 @@ void ocp_nlp_dynamics_cont_memory_set_ux1_ptr(struct blasfeo_dvec *ux1, void *me
return;
}
void ocp_nlp_dynamics_cont_memory_set_pi_ptr(struct blasfeo_dvec *pi, void *memory_)
{
ocp_nlp_dynamics_cont_memory *memory = memory_;
@@ -254,6 +305,8 @@ void ocp_nlp_dynamics_cont_memory_set_pi_ptr(struct blasfeo_dvec *pi, void *memo
return;
}
void ocp_nlp_dynamics_cont_memory_set_BAbt_ptr(struct blasfeo_dmat *BAbt, void *memory_)
{
ocp_nlp_dynamics_cont_memory *memory = memory_;
@@ -263,6 +316,8 @@ void ocp_nlp_dynamics_cont_memory_set_BAbt_ptr(struct blasfeo_dmat *BAbt, void *
return;
}
/************************************************
* workspace
************************************************/
@@ -285,6 +340,8 @@ int ocp_nlp_dynamics_cont_workspace_calculate_size(void *config_, void *dims_, v
return size;
}
static void ocp_nlp_dynamics_cont_cast_workspace(void *config_, void *dims_, void *opts_,
void *work_)
{
@@ -313,6 +370,8 @@ static void ocp_nlp_dynamics_cont_cast_workspace(void *config_, void *dims_, voi
return;
}
/************************************************
* model
************************************************/
@@ -335,6 +394,8 @@ int ocp_nlp_dynamics_cont_model_calculate_size(void *config_, void *dims_)
return size;
}
void *ocp_nlp_dynamics_cont_model_assign(void *config_, void *dims_, void *raw_memory)
{
ocp_nlp_dynamics_config *config = config_;
@@ -358,6 +419,8 @@ void *ocp_nlp_dynamics_cont_model_assign(void *config_, void *dims_, void *raw_m
return model;
}
void ocp_nlp_dynamics_cont_model_set_T(double T, void *model_)
{
ocp_nlp_dynamics_cont_model *model = model_;
@@ -367,6 +430,8 @@ void ocp_nlp_dynamics_cont_model_set_T(double T, void *model_)
return;
}
/************************************************
* functions
************************************************/
@@ -377,6 +442,8 @@ void ocp_nlp_dynamics_cont_initialize(void *config_, void *dims_, void *model_,
return;
}
void ocp_nlp_dynamics_cont_update_qp_matrices(void *config_, void *dims_, void *model_, void *opts_,
void *mem_, void *work_)
{
@@ -433,6 +500,8 @@ void ocp_nlp_dynamics_cont_update_qp_matrices(void *config_, void *dims_, void *
return;
}
void ocp_nlp_dynamics_cont_config_initialize_default(void *config_)
{
ocp_nlp_dynamics_config *config = config_;
@@ -447,6 +516,7 @@ void ocp_nlp_dynamics_cont_config_initialize_default(void *config_)
config->opts_assign = &ocp_nlp_dynamics_cont_opts_assign;
config->opts_initialize_default = &ocp_nlp_dynamics_cont_opts_initialize_default;
config->opts_update = &ocp_nlp_dynamics_cont_opts_update;
config->opts_set = &ocp_nlp_dynamics_cont_opts_set;
config->memory_calculate_size = &ocp_nlp_dynamics_cont_memory_calculate_size;
config->memory_assign = &ocp_nlp_dynamics_cont_memory_assign;
config->memory_get_fun_ptr = &ocp_nlp_dynamics_cont_memory_get_fun_ptr;
Oops, something went wrong.

0 comments on commit 326cc30

Please sign in to comment.