/usr/include/openturns/swig/Simulation.i is in libopenturns-dev 1.7-3.
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 52 53 54 | // SWIG file Simulation.i
%{
#include "Simulation.hxx"
#include "PythonWrappingFunctions.hxx"
static void PythonProgressCallback(OT::NumericalScalar percent, void * data) {
PyObject * pyObj = reinterpret_cast<PyObject *>(data);
OT::ScopedPyObjectPointer point(OT::convert< OT::NumericalScalar, OT::_PyFloat_ >(percent));
OT::ScopedPyObjectPointer result(PyObject_CallFunctionObjArgs( pyObj, point.get(), NULL ));
}
static OT::Bool PythonStopCallback(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 Simulation_doc.i
%ignore OT::Simulation::setProgressCallback(ProgressCallback callBack, void * data);
%ignore OT::Simulation::setStopCallback(StopCallback callBack, void * data);
%include Simulation.hxx
namespace OT {
%extend Simulation {
Simulation(const Simulation & other) { return new OT::Simulation(other); }
void setProgressCallback(PyObject * callBack) {
if (PyCallable_Check(callBack)) {
self->setProgressCallback(&PythonProgressCallback, callBack);
}
else {
throw OT::InvalidArgumentException(HERE) << "Argument is not a callable object.";
}
}
void setStopCallback(PyObject * callBack) {
if (PyCallable_Check(callBack)) {
self->setStopCallback(&PythonStopCallback, callBack);
}
else {
throw OT::InvalidArgumentException(HERE) << "Argument is not a callable object.";
}
}
} // Simulation
} // OT
|