Skip to content

Commit 92e4a66

Browse files
committed
Added default arguments
1 parent d5e8320 commit 92e4a66

File tree

4 files changed

+7
-12
lines changed

4 files changed

+7
-12
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if (NOT EXISTS ${EIGEN_ROOT})
2929
endif()
3030

3131
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/bindings/python)
32-
include_directories($ENV{EIGEN_ROOT} /usr/include/eigen3)
32+
include_directories($ENV{EIGEN_ROOT})
3333
include_directories(${Boost_INCLUDE_DIRS})
3434
include_directories(${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDE_DIR})
3535

bindings/python/module.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@
55
#include <boost/python/module.hpp>
66
#include <boost/python/extract.hpp>
77
#include <boost/python/scope.hpp>
8+
#include <boost/python/args.hpp>
89

910
namespace python = boost::python;
1011

1112

1213
python::object solve_python(PyObject* KP, PyObject* KQ, PyObject* Ct, PyObject* asgTX,
1314
const python::dict& gph1, const python::dict& gph2,
14-
const python::dict& params)
15+
int nAlp, int nItMa, int nHst)
1516
{
1617
Eigen::MatrixXd _KP = python::extract<Eigen::MatrixXd>(KP);
1718
Eigen::MatrixXd _KQ = python::extract<Eigen::MatrixXd>(KQ);
1819
Eigen::MatrixXd _Ct = python::extract<Eigen::MatrixXd>(Ct);
1920
Eigen::MatrixXd _asgTX = python::extract<Eigen::MatrixXd>(asgTX);
2021
auto _gph1 = dict2map<std::string, Eigen::MatrixXd>(gph1);
2122
auto _gph2 = dict2map<std::string, Eigen::MatrixXd>(gph2);
22-
auto _params = dict2map<std::string, std::string>(params);
23-
return python::object(fgm(_KP, _KQ, _Ct, _asgTX, _gph1, _gph2, _params));
23+
return python::object(fgm(_KP, _KQ, _Ct, _asgTX, _gph1, _gph2, nAlp, nItMa, nHst));
2424
}
2525

2626

2727
BOOST_PYTHON_MODULE(fgm)
2828
{
2929
initializeConverters();
30-
python::def("solve", solve_python);
30+
python::def("solve", solve_python, (python::arg("nAlp")=101, python::arg("nItMa")=100, python::arg("nHst")=10));
3131
python::scope().attr("version") = FGM_VERSION;
3232
}

fgm.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,8 @@ double multGXHSQTr(const MatrixXd& indG, const MatrixXd& X, const MatrixXd& indH
112112
std::pair<MatrixXd, double> fgm(MatrixXd& KP, MatrixXd& KQ, MatrixXd& Ct, MatrixXd& asgTX,
113113
std::map<std::string, MatrixXd>& gph1,
114114
std::map<std::string, MatrixXd>& gph2,
115-
std::map<std::string, std::string>& params)
115+
int nAlp, int nItMa, int nHst)
116116
{
117-
// TODO : get params from python
118-
int nAlp = 101;
119-
int nItMa = 100;
120-
int nHst = 10;
121-
122117
// weight
123118
VectorXd alps = VectorXd::LinSpaced(nAlp, 0, 1);
124119

fgm.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ std::pair<Eigen::MatrixXd, double> fgm(Eigen::MatrixXd& KP, Eigen::MatrixXd& KQ,
1818
Eigen::MatrixXd& Ct, Eigen::MatrixXd& asgTX,
1919
std::map<std::string, Eigen::MatrixXd>& gph1,
2020
std::map<std::string, Eigen::MatrixXd>& gph2,
21-
std::map<std::string, std::string>& params);
21+
int nAlp = 101, int nItMa = 100, int nHst = 10);
2222

2323
#endif

0 commit comments

Comments
 (0)