alpaqa
pi-pico
Nonconvex constrained optimization
Loading...
Searching...
No Matches
src
interop
casadi
include
alpaqa
casadi
casadi-functions.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "
casadi-namespace.hpp
"
4
#include "
casadi-types.hpp
"
5
6
#include <
alpaqa/util/dl.hpp
>
7
#include <cassert>
8
9
namespace
alpaqa
{
10
BEGIN_ALPAQA_CASADI_LOADER_NAMESPACE
11
namespace
casadi {
12
13
// clang-format off
14
using
fname_incref
=
ExternalFunction
<
"_incref"
,
void
(
void
)>;
15
using
fname_decref
=
ExternalFunction
<
"_decref"
,
void
(
void
)>;
16
using
fname_n_in
=
ExternalFunction
<
"_n_in"
,
casadi_int
(
void
)>;
17
using
fname_n_out
=
ExternalFunction
<
"_n_out"
,
casadi_int
(
void
)>;
18
using
fname_name_in
=
ExternalFunction
<
"_name_in"
,
const
char
*(
casadi_int
ind
)>;
19
using
fname_name_out
=
ExternalFunction
<
"_name_out"
,
const
char
*(
casadi_int
ind
)>;
20
using
fname_sparsity_in
=
ExternalFunction
<
"_sparsity_in"
,
const
casadi_int
*(
casadi_int
ind
)>;
21
using
fname_sparsity_out
=
ExternalFunction
<
"_sparsity_out"
,
const
casadi_int
*(
casadi_int
ind
)>;
22
using
fname_alloc_mem
=
ExternalFunction
<
"_alloc_mem"
,
void
*(
void
)>;
23
using
fname_init_mem
=
ExternalFunction
<
"_init_mem"
,
int
(
void
*mem)>;
24
using
fname_free_mem
=
ExternalFunction
<
"_free_mem"
,
int
(
void
*mem)>;
25
using
fname_work
=
ExternalFunction
<
"_work"
,
int
(
casadi_int
*
sz_arg
,
casadi_int
*
sz_res
,
casadi_int
*
sz_iw
,
casadi_int
*
sz_w
)>;
26
using
fname
=
ExternalFunction
<
""
,
int
(
const
casadi_real
**arg,
casadi_real
**res,
casadi_int
*iw,
casadi_real
*w,
void
*mem)>;
27
// clang-format on
28
29
template
<Name Nm,
class
Sgn>
30
auto
ExternalFunction<Nm, Sgn>::load
(
void
*handle, std::string
fname
)
31
->
signature_t
* {
32
static_assert
(name.value.back() ==
'\0'
);
33
fname
+= name.value.data();
34
auto
func =
reinterpret_cast<
signature_t
*
>
(
util::load_func
(handle,
fname
));
35
assert
(func);
36
return
func;
37
}
38
39
}
// namespace casadi
40
END_ALPAQA_CASADI_LOADER_NAMESPACE
41
}
// namespace alpaqa
casadi-namespace.hpp
BEGIN_ALPAQA_CASADI_LOADER_NAMESPACE
#define BEGIN_ALPAQA_CASADI_LOADER_NAMESPACE
Definition
casadi-namespace.hpp:4
END_ALPAQA_CASADI_LOADER_NAMESPACE
#define END_ALPAQA_CASADI_LOADER_NAMESPACE
Definition
casadi-namespace.hpp:5
casadi-types.hpp
dl.hpp
alpaqa::util::load_func
void * load_func(void *lib_handle, const std::string &name)
Get a pointer to a function inside of a loaded DLL or SO file.
Definition
dl.cpp:66
alpaqa
Definition
anderson.hpp:10
alpaqa::casadi_real
double casadi_real
Definition
casadi-types.hpp:16
alpaqa::inf
constexpr const auto inf
Definition
config.hpp:112
alpaqa::casadi_int
long long int casadi_int
Definition
casadi-types.hpp:13
alpaqa::casadi::ExternalFunction
Reference to CasADi function.
Definition
casadi-types.hpp:32
alpaqa::casadi::ExternalFunction::signature_t
Sgn signature_t
Definition
casadi-types.hpp:33
alpaqa::casadi::ExternalFunction::load
static signature_t * load(void *handle, std::string fname)
Definition
casadi-functions.hpp:30
Generated on Fri May 3 2024 for alpaqa by
1.9.8