Skip to content

Commit

Permalink
[py] added binding for CtcNewton
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonRohou committed Jan 28, 2022
1 parent c91d672 commit f43de8e
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
src/core/contractors/static/codac_py_CtcDist.cpp
src/core/contractors/static/codac_py_CtcFunction.cpp
src/core/contractors/static/codac_py_CtcConstell.cpp
src/core/contractors/static/codac_py_CtcNewton.cpp

src/core/contractors/dyn/codac_py_DynCtc.cpp
src/core/contractors/dyn/codac_py_CtcDelay.cpp
Expand Down
2 changes: 2 additions & 0 deletions python/codac_py.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ void export_IntervalVectorVar(py::module& m);
void export_CtcDist(py::module& m);
void export_CtcFunction(py::module& m);
void export_CtcConstell(py::module& m);
void export_CtcNewton(py::module& m);

py::class_<DynCtc,pyDynCtc> export_DynCtc(py::module& m);
void export_CtcDelay(py::module& m, py::class_<DynCtc, pyDynCtc>& dyn_ctc);
Expand Down Expand Up @@ -77,6 +78,7 @@ PYBIND11_MODULE(tube, m)
export_CtcDist(m);
export_CtcFunction(m);
export_CtcConstell(m);
export_CtcNewton(m);

py::class_<DynCtc, pyDynCtc> dyn_ctc = export_DynCtc(m);
export_CtcDelay(m, dyn_ctc);
Expand Down
44 changes: 44 additions & 0 deletions python/src/core/contractors/static/codac_py_CtcNewton.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* \file
* CtcNewton Python binding
* ----------------------------------------------------------------------------
* \date 2022
* \author Simon Rohou
* \copyright Copyright 2022 Codac Team
* \license This program is distributed under the terms of
* the GNU Lesser General Public License (LGPL).
*/

#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <pybind11/operators.h>
#include <pybind11/functional.h>
#include "pyIbex_type_caster.h"

#include "ibex_Domain.h"
#include "ibex_Newton.h" // for default values of the Ctc
#include "ibex_CtcNewton.h"
// Generated file from Doxygen XML (doxygen2docstring.py):
// todo: #include "codac_py_CtcNewton_docs.h"

using namespace std;
using namespace ibex;
using namespace codac;
namespace py = pybind11;
using namespace pybind11::literals;


void export_CtcNewton(py::module& m)
{
py::class_<CtcNewton,Ctc> ctc_newton(m, "CtcNewton", "todo");
ctc_newton

.def(py::init<const Function&,double,double,double>(),
"todo",
"f"_a, "ceil"_a=CtcNewton::default_ceil, "prec"_a=default_newton_prec, "ratio"_a=default_gauss_seidel_ratio)

.def("contract", (void (CtcNewton::*)(IntervalVector&))&CtcNewton::contract,
"todo",
"x"_a.noconvert());
;
}

0 comments on commit f43de8e

Please sign in to comment.