/usr/include/openturns/swig/NumericalPoint.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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | // SWIG file NumericalPoint.i
%ignore OT::NumericalPoint::at; // Use __getitem__ instead
%ignore OT::NumericalPoint::getCollection;
%{
#include "NumericalPoint.hxx"
%}
%include NumericalPoint_doc.i
%template(NumericalScalarCollection) OT::Collection<OT::NumericalScalar>;
%template(NumericalScalarPersistentCollection) OT::PersistentCollection<OT::NumericalScalar>;
%typemap(in) const NumericalScalarCollection & ($1_basetype temp) {
if (! SWIG_IsOK(SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, 0))) {
try {
temp = OT::convert<OT::_PySequence_,OT::Collection<OT::NumericalScalar> >( $input );
$1 = &temp;
} catch (OT::InvalidArgumentException & ex) {
SWIG_exception(SWIG_TypeError, "Object passed as argument is not convertible to a collection of NumericalScalar");
}
}
}
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) const NumericalScalarCollection & {
$1 = SWIG_IsOK(SWIG_ConvertPtr($input, NULL, $1_descriptor, 0)) ||
OT::isAPythonSequenceOf<OT::_PyFloat_>( $input );
}
%template(NumericalPointCollection) OT::Collection<OT::NumericalPoint>;
%template(NumericalPointPersistentCollection) OT::PersistentCollection<OT::NumericalPoint>;
#define OT_TYPECHECK_NUMERICALPOINT 4
%typemap(in) const NumericalPoint & ($1_basetype temp) {
if (SWIG_IsOK(SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, 0)))
{
//Nothing to do for NP
}
else if (OT::isAPythonSequenceOf<OT::_PyFloat_>( $input ))
{
temp = OT::convert<OT::_PySequence_,OT::NumericalPoint>( $input );
$1 = &temp;
}
else
{
SWIG_exception(SWIG_TypeError, "Object passed as argument is not convertible to a NumericalPoint");
}
}
%typemap(typecheck,precedence=OT_TYPECHECK_NUMERICALPOINT) const NumericalPoint & {
$1 = SWIG_IsOK(SWIG_ConvertPtr($input, NULL, $1_descriptor, 0)) || OT::isAPythonSequenceOf<OT::_PyFloat_>( $input );
}
%apply const NumericalPoint & { const OT::NumericalPoint & };
%include NumericalPoint.hxx
%copyctor NumericalPoint;
namespace OT {
%extend NumericalPoint {
NumericalPoint(PyObject * pyObj)
{
return new OT::NumericalPoint(OT::convert<OT::_PySequence_,OT::NumericalPoint>(pyObj));
}
OT_COLLECTION_GETITEM(OT::NumericalPoint, OT::NumericalScalar)
OT_COLLECTION_SETITEM(OT::NumericalPoint, OT::NumericalScalar)
Bool __eq__(const NumericalPoint & other)
{
return operator == (*self, other);
}
/* NumericalPoint __add__(const NumericalPoint & other) */
/* { */
/* return *self + other; */
/* } */
NumericalPoint operator +(const NumericalPoint & other)
{
return *self + other;
}
NumericalPoint __sub__(const NumericalPoint & other)
{
return *self - other;
}
NumericalPoint __mul__(NumericalScalar s)
{
return (*self) * s;
}
NumericalPoint __rmul__(NumericalScalar s)
{
return s * (*self);
}
NumericalPoint __div__(NumericalScalar s)
{
return (*self) / s;
}
NumericalPoint __truediv__(NumericalScalar s) { return (*self) / s; }
NumericalPoint __iadd__(const NumericalPoint & other)
{
*self += other;
return *self;
}
NumericalPoint __isub__(const NumericalPoint & other)
{
*self -= other;
return *self;
}
} // %extend
} // OT
|