/usr/include/openturns/swig/OptimizationAlgorithm.i is in libopenturns-dev 1.9-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | // SWIG file OptimizationAlgorithm.i
%{
#include "openturns/OptimizationAlgorithm.hxx"
#include "openturns/PythonWrappingFunctions.hxx"
static void OptimizationAlgorithm_ProgressCallback(OT::Scalar percent, void * data) {
PyObject * pyObj = reinterpret_cast<PyObject *>(data);
OT::ScopedPyObjectPointer point(OT::convert< OT::Scalar, OT::_PyFloat_ >(percent));
OT::ScopedPyObjectPointer result(PyObject_CallFunctionObjArgs( pyObj, point.get(), NULL ));
}
static OT::Bool OptimizationAlgorithm_StopCallback(void * data) {
PyObject * pyObj = reinterpret_cast<PyObject *>(data);
OT::ScopedPyObjectPointer result(PyObject_CallFunctionObjArgs( pyObj, NULL ));
return OT::convert< OT::_PyInt_, OT::UnsignedInteger >(result.get());
}
%}
%include OptimizationAlgorithm_doc.i
%ignore OT::OptimizationAlgorithm::setProgressCallback(ProgressCallback callBack, void * data);
%ignore OT::OptimizationAlgorithm::setStopCallback(StopCallback callBack, void * data);
OTTypedInterfaceObjectHelper(OptimizationAlgorithm)
%include openturns/OptimizationAlgorithm.hxx
namespace OT{ %extend OptimizationAlgorithm {
OptimizationAlgorithm(const OptimizationAlgorithm & other) { return new OT::OptimizationAlgorithm(other); }
void setProgressCallback(PyObject * callBack) {
if (PyCallable_Check(callBack)) {
self->setProgressCallback(&OptimizationAlgorithm_ProgressCallback, callBack);
}
else {
throw OT::InvalidArgumentException(HERE) << "Argument is not a callable object.";
}
}
void setStopCallback(PyObject * callBack) {
if (PyCallable_Check(callBack)) {
self->setStopCallback(&OptimizationAlgorithm_StopCallback, callBack);
}
else {
throw OT::InvalidArgumentException(HERE) << "Argument is not a callable object.";
}
}
} }
|