/usr/include/openturns/swig/OptimizationAlgorithmImplementation.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 OptimizationAlgorithmImplementation.i
%{
#include "openturns/OptimizationAlgorithmImplementation.hxx"
#include "openturns/PythonWrappingFunctions.hxx"
static void OptimizationAlgorithmImplementation_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 OptimizationAlgorithmImplementation_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 OptimizationAlgorithmImplementation_doc.i
%ignore OT::OptimizationAlgorithmImplementation::setProgressCallback(ProgressCallback callBack, void * data);
%ignore OT::OptimizationAlgorithmImplementation::setStopCallback(StopCallback callBack, void * data);
%include openturns/OptimizationAlgorithmImplementation.hxx
namespace OT{ %extend OptimizationAlgorithmImplementation {
OptimizationAlgorithmImplementation(const OptimizationAlgorithmImplementation & other) {
return new OT::OptimizationAlgorithmImplementation(other);
}
void setProgressCallback(PyObject * callBack) {
if (PyCallable_Check(callBack)) {
self->setProgressCallback(&OptimizationAlgorithmImplementation_ProgressCallback, callBack);
}
else {
throw OT::InvalidArgumentException(HERE) << "Argument is not a callable object.";
}
}
void setStopCallback(PyObject * callBack) {
if (PyCallable_Check(callBack)) {
self->setStopCallback(&OptimizationAlgorithmImplementation_StopCallback, callBack);
}
else {
throw OT::InvalidArgumentException(HERE) << "Argument is not a callable object.";
}
}
} }
|