/usr/include/openturns/swig/Point.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 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 126 127 128 129 130 131 132 133 | // SWIG file Point.i
%ignore OT::Point::at; // Use __getitem__ instead
%ignore OT::Point::getCollection;
%{
#include "openturns/Point.hxx"
%}
%include Point_doc.i
%template(ScalarCollection) OT::Collection<OT::Scalar>;
%template(ScalarPersistentCollection) OT::PersistentCollection<OT::Scalar>;
%typemap(in) const ScalarCollection & ($1_basetype temp) {
if (! SWIG_IsOK(SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, 0))) {
try {
temp = OT::convert<OT::_PySequence_,OT::Collection<OT::Scalar> >( $input );
$1 = &temp;
} catch (OT::InvalidArgumentException &) {
SWIG_exception(SWIG_TypeError, "Object passed as argument is not convertible to a collection of Scalar");
}
}
}
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) const ScalarCollection & {
$1 = SWIG_IsOK(SWIG_ConvertPtr($input, NULL, $1_descriptor, 0)) ||
OT::isAPythonSequenceOf<OT::_PyFloat_>( $input );
}
%template(PointCollection) OT::Collection<OT::Point>;
%template(PointPersistentCollection) OT::PersistentCollection<OT::Point>;
#define OT_TYPECHECK_NUMERICALPOINT 4
%typemap(in) const Point & ($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::Point>( $input );
$1 = &temp;
}
else
{
SWIG_exception(SWIG_TypeError, "Object passed as argument is not convertible to a Point");
}
}
%typemap(typecheck,precedence=OT_TYPECHECK_NUMERICALPOINT) const Point & {
$1 = SWIG_IsOK(SWIG_ConvertPtr($input, NULL, $1_descriptor, 0)) || OT::isAPythonSequenceOf<OT::_PyFloat_>( $input );
}
%apply const Point & { const OT::Point & };
%include openturns/Point.hxx
%copyctor Point;
namespace OT {
%extend Point {
Point(PyObject * pyObj)
{
return new OT::Point(OT::convert<OT::_PySequence_,OT::Point>(pyObj));
}
OTCollectionOperatorsHelper(OT::Point, OT::Scalar)
/* Point __add__(const Point & other) */
/* { */
/* return *self + other; */
/* } */
Point operator +(const Point & other)
{
return *self + other;
}
Point __sub__(const Point & other)
{
return *self - other;
}
Point __mul__(Scalar s)
{
return (*self) * s;
}
Point __rmul__(Scalar s)
{
return s * (*self);
}
Point __div__(Scalar s)
{
return (*self) / s;
}
Point __truediv__(Scalar s) { return (*self) / s; }
Point __iadd__(const Point & other)
{
*self += other;
return *self;
}
Point __isub__(const Point & other)
{
*self -= other;
return *self;
}
} // %extend
} // OT
%pythoncode %{
# deprecated
class NumericalPoint(Point):
def __init__(self, *args):
super(NumericalPoint, self).__init__(*args)
openturns.common.Log.Warn('class NumericalPoint is deprecated in favor of Point')
class NumericalScalarCollection(ScalarCollection):
def __init__(self, *args):
super(NumericalScalarCollection, self).__init__(*args)
openturns.common.Log.Warn('class NumericalScalarCollection is deprecated in favor of ScalarCollection')
%}
|