X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling_Swig%2FMEDCouplingDataArrayTypemaps.i;h=8f596420d4ec9165d220cc30667be8469c85961e;hb=5eae23234bd4841ace5096e61a8126b8c0eabe49;hp=ef8946fbf70a1d660f74c9b5fae443c991165217;hpb=8c9ecbe43d32cbea0d0b9ce867144df3f3061abd;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i b/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i index ef8946fbf..8f596420d 100644 --- a/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i +++ b/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i @@ -21,18 +21,47 @@ #ifndef __MEDCOUPLINGDATAARRAYTYPEMAPS_I__ #define __MEDCOUPLINGDATAARRAYTYPEMAPS_I__ +#if PY_VERSION_HEX >= 0x03000000 +#define PyInt_AS_LONG PyLong_AS_LONG +#endif + #include "InterpKernelAutoPtr.hxx" #include "MEDCouplingDataArrayTraits.hxx" #include +static PyObject *convertArray(MEDCoupling::DataArray *array, int owner) +{ + PyObject *ret(NULL); + if(!array) + { + Py_XINCREF(Py_None); + return Py_None; + } + if(dynamic_cast(array)) + ret=SWIG_NewPointerObj((void*)array,SWIGTYPE_p_MEDCoupling__DataArrayDouble,owner); + if(dynamic_cast(array)) + ret=SWIG_NewPointerObj((void*)array,SWIGTYPE_p_MEDCoupling__DataArrayInt,owner); + if(dynamic_cast(array)) + ret=SWIG_NewPointerObj((void*)array,SWIGTYPE_p_MEDCoupling__DataArrayFloat,owner); + if(!ret) + throw INTERP_KERNEL::Exception("Not recognized type of array on downcast !"); + return ret; +} + /*! * This method is an extention of PySlice_GetIndices but less * open than PySlice_GetIndicesEx that accepts too many situations. */ -void GetIndicesOfSlice(PySliceObject *slice, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, const char *msgInCaseOfFailure) +void GetIndicesOfSlice(PyObject *slice, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, const char *msgInCaseOfFailure) { - int ret(PySlice_GetIndices(slice,length,start,stop,step)); + int ret(PySlice_GetIndices( +#if PY_VERSION_HEX >= 0x03000000 + slice, +#else + reinterpret_cast(slice), +#endif + length,start,stop,step)); if(ret==0) return ; if(*step>0 && *start==*stop && length==*start) @@ -43,9 +72,15 @@ void GetIndicesOfSlice(PySliceObject *slice, Py_ssize_t length, Py_ssize_t *star /*! * This method allows to retrieve slice info from \a slice. */ -void GetIndicesOfSliceExplicitely(PySliceObject *slice, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, const char *msgInCaseOfFailure) +void GetIndicesOfSliceExplicitely(PyObject *slice, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, const char *msgInCaseOfFailure) { - int ret(PySlice_GetIndices(slice,std::numeric_limits::max(),start,stop,step)); + int ret(PySlice_GetIndices( +#if PY_VERSION_HEX >= 0x03000000 + slice, +#else + reinterpret_cast(slice), +#endif + std::numeric_limits::max(),start,stop,step)); if(ret==0) { if(*start!=std::numeric_limits::max() && *stop!=std::numeric_limits::max()) @@ -73,6 +108,7 @@ int InterpreteNegativeInt(int val, int nbelem) return val; } +#ifdef WITH_NUMPY // this is the second type of specific deallocator, only valid for the constructor of DataArrays taking numpy array // in input when an another DataArray is already client of this. template @@ -307,7 +343,10 @@ PyObject *ToNumPyArray(MCData *self, int npyObjectType, const char *MCDataStr) SWIGINTERN PyObject *MEDCoupling_DataArrayInt_toNumPyArray(MEDCoupling::DataArrayInt *self); SWIGINTERN PyObject *MEDCoupling_DataArrayDouble_toNumPyArray(MEDCoupling::DataArrayDouble *self); -PyObject *ToCSRMatrix(const std::vector >& m, int nbCols) throw(INTERP_KERNEL::Exception) +#endif + +#ifdef WITH_SCIPY +PyObject *ToCSRMatrix(const std::vector >& m, int nbCols) { int nbRows((int)m.size()); MEDCoupling::MCAuto indPtr(MEDCoupling::DataArrayInt::New()),indices(MEDCoupling::DataArrayInt::New()); @@ -349,7 +388,9 @@ PyObject *ToCSRMatrix(const std::vector >& m, int nbCols) t return ret; } -static PyObject *convertDataArrayChar(MEDCoupling::DataArrayChar *dac, int owner) throw(INTERP_KERNEL::Exception) +#endif + +static PyObject *convertDataArrayChar(MEDCoupling::DataArrayChar *dac, int owner) { PyObject *ret=0; if(!dac) @@ -366,7 +407,7 @@ static PyObject *convertDataArrayChar(MEDCoupling::DataArrayChar *dac, int owner return ret; } -static PyObject *convertDataArray(MEDCoupling::DataArray *dac, int owner) throw(INTERP_KERNEL::Exception) +static PyObject *convertDataArray(MEDCoupling::DataArray *dac, int owner) { PyObject *ret=0; if(!dac) @@ -389,7 +430,7 @@ static PyObject *convertDataArray(MEDCoupling::DataArray *dac, int owner) throw( return ret; } -static PyObject *convertIntArrToPyList(const int *ptr, int size) throw(INTERP_KERNEL::Exception) +static PyObject *convertIntArrToPyList(const int *ptr, int size) { PyObject *ret=PyList_New(size); for(int i=0;i& v) throw(INTERP_KERNEL::Exception) +static PyObject *convertIntArrToPyList2(const std::vector& v) { int size=v.size(); PyObject *ret=PyList_New(size); @@ -406,7 +447,7 @@ static PyObject *convertIntArrToPyList2(const std::vector& v) throw(INTERP_ return ret; } -static PyObject *convertIntArrToPyList3(const std::set& v) throw(INTERP_KERNEL::Exception) +static PyObject *convertIntArrToPyList3(const std::set& v) { int size=v.size(); PyObject *ret=PyList_New(size); @@ -416,7 +457,45 @@ static PyObject *convertIntArrToPyList3(const std::set& v) throw(INTERP_KER return ret; } -static PyObject *convertIntArrToPyListOfTuple(const int *vals, int nbOfComp, int nbOfTuples) throw(INTERP_KERNEL::Exception) +static bool convertPyObjectToStrNT(PyObject *obj, std::string& ret) +{ + if(PyString_Check(obj)) + { + ret=PyString_AsString(obj); + return true; + } +#if PY_VERSION_HEX >= 0x03000000 + else if(PyUnicode_Check(obj)) + { + ret=PyUnicode_AsUTF8(obj); + return true; + } +#endif + return false; +} + +static std::string convertPyObjectToStr(PyObject *obj, const char *msg=NULL) +{ + std::string ret; + if(PyString_Check(obj)) + ret=PyString_AsString(obj); +#if PY_VERSION_HEX >= 0x03000000 + else if(PyUnicode_Check(obj)) + ret=PyUnicode_AsUTF8(obj); +#endif + else + { + std::ostringstream oss; + if(msg) + oss << msg; + else + oss << "PyWrap convertPyObjectToStr : expect a sting like py object !"; + throw INTERP_KERNEL::Exception(oss.str()); + } + return ret; +} + +static PyObject *convertIntArrToPyListOfTuple(const int *vals, int nbOfComp, int nbOfTuples) { PyObject *ret=PyList_New(nbOfTuples); for(int i=0;i >& arr) throw(INTERP_KERNEL::Exception) +static PyObject *convertFromVectorPairInt(const std::vector< std::pair >& arr) { PyObject *ret=PyList_New(arr.size()); for(std::size_t i=0;i return ret; } -static void convertPyToVectorPairInt(PyObject *pyLi, std::vector< std::pair >& arr) throw(INTERP_KERNEL::Exception) +static void convertPyToVectorPairInt(PyObject *pyLi, std::vector< std::pair >& arr) { const char msg[]="list must contain tuples of 2 integers only or tuple must contain tuples of 2 integers only !"; if(PyList_Check(pyLi)) @@ -547,7 +626,7 @@ static void convertPyToVectorPairInt(PyObject *pyLi, std::vector< std::pair >& arr) throw(INTERP_KERNEL::Exception) +static void convertPyToVectorPairStringInt(PyObject *pyLi, std::vector< std::pair >& arr) { const char msg[]="convertPyToVectorPairStringInt : list must contain tuples of 2 integers only or tuple must contain tuples of 1 string and 1 integer only !"; if(PyList_Check(pyLi)) @@ -563,12 +642,10 @@ static void convertPyToVectorPairStringInt(PyObject *pyLi, std::vector< std::pai if(sz2!=2) throw INTERP_KERNEL::Exception(msg); PyObject *o_0=PyTuple_GetItem(o,0); - if(!PyString_Check(o_0)) - throw INTERP_KERNEL::Exception(msg); PyObject *o_1=PyTuple_GetItem(o,1); + arr[i].first=convertPyObjectToStr(o_0,msg); if(!PyInt_Check(o_1)) throw INTERP_KERNEL::Exception(msg); - arr[i].first=PyString_AsString(o_0); arr[i].second=(int)PyInt_AS_LONG(o_1); } else @@ -588,12 +665,10 @@ static void convertPyToVectorPairStringInt(PyObject *pyLi, std::vector< std::pai if(sz2!=2) throw INTERP_KERNEL::Exception(msg); PyObject *o_0=PyTuple_GetItem(o,0); - if(!PyString_Check(o_0)) - throw INTERP_KERNEL::Exception(msg); PyObject *o_1=PyTuple_GetItem(o,1); + arr[i].first=convertPyObjectToStr(o_0,msg); if(!PyInt_Check(o_1)) throw INTERP_KERNEL::Exception(msg); - arr[i].first=PyString_AsString(o_0); arr[i].second=(int)PyInt_AS_LONG(o_1); } else @@ -604,7 +679,7 @@ static void convertPyToVectorPairStringInt(PyObject *pyLi, std::vector< std::pai throw INTERP_KERNEL::Exception(msg); } -static void convertPyToNewIntArr3(PyObject *pyLi, std::vector& arr) throw(INTERP_KERNEL::Exception) +static void convertPyToNewIntArr3(PyObject *pyLi, std::vector& arr) { if(PyList_Check(pyLi)) { @@ -644,7 +719,7 @@ static void convertPyToNewIntArr3(PyObject *pyLi, std::vector& arr) throw(I } } -static void convertPyToNewIntArr4(PyObject *pyLi, int recurseLev, int nbOfSubPart, std::vector& arr) throw(INTERP_KERNEL::Exception) +static void convertPyToNewIntArr4(PyObject *pyLi, int recurseLev, int nbOfSubPart, std::vector& arr) { if(recurseLev<0) throw INTERP_KERNEL::Exception("convertPyToNewIntArr4 : invalid list of integers level of recursion !"); @@ -701,7 +776,7 @@ static void convertPyToNewIntArr4(PyObject *pyLi, int recurseLev, int nbOfSubPar throw INTERP_KERNEL::Exception("convertPyToNewIntArr4 : not a list nor a tuple recursively !"); } -static void checkFillArrayWithPyList(int size1, int size2, int& nbOfTuples, int& nbOfComp) throw(INTERP_KERNEL::Exception) +static void checkFillArrayWithPyList(int size1, int size2, int& nbOfTuples, int& nbOfComp) { if(nbOfTuples==-1) { @@ -796,7 +871,7 @@ static void fillArrayWithPyListInt3(PyObject *pyLi, int& nbOfElt, std::vector fillArrayWithPyListInt2(PyObject *pyLi, int& nbOfTuples, int& nbOfComp) throw(INTERP_KERNEL::Exception) +static std::vector fillArrayWithPyListInt2(PyObject *pyLi, int& nbOfTuples, int& nbOfComp) { std::vector ret; int size1=-1,size2=-1; @@ -829,7 +904,7 @@ static std::vector fillArrayWithPyListInt2(PyObject *pyLi, int& nbOfTuples, return ret; } -static bool fillStringVector(PyObject *pyLi, std::vector& vec) throw(INTERP_KERNEL::Exception) +static bool fillStringVector(PyObject *pyLi, std::vector& vec) { if(PyList_Check(pyLi)) { @@ -838,9 +913,7 @@ static bool fillStringVector(PyObject *pyLi, std::vector& vec) thro for(int i=0;i& vec) thro for(int i=0;i& vec) thro else return false; } -static void convertPyToVectorOfVectorOfString(PyObject *pyLi, std::vector< std::vector >& arr) throw(INTERP_KERNEL::Exception) +static void convertPyToVectorOfVectorOfString(PyObject *pyLi, std::vector< std::vector >& arr) { const char msg[]="convertPyToVectorOfVectorOfString : expecting list of list of strings !"; if(PyList_Check(pyLi)) @@ -891,7 +962,7 @@ static void convertPyToVectorOfVectorOfString(PyObject *pyLi, std::vector< std:: throw INTERP_KERNEL::Exception(msg); } -static bool fillIntVector(PyObject *pyLi, std::vector& vec) throw(INTERP_KERNEL::Exception) +static bool fillIntVector(PyObject *pyLi, std::vector& vec) { if(PyList_Check(pyLi)) { @@ -925,7 +996,7 @@ static bool fillIntVector(PyObject *pyLi, std::vector& vec) throw(INTERP_KE return false; } -static void convertPyToVectorOfVectorOfInt(PyObject *pyLi, std::vector< std::vector >& arr) throw(INTERP_KERNEL::Exception) +static void convertPyToVectorOfVectorOfInt(PyObject *pyLi, std::vector< std::vector >& arr) { const char msg[]="convertPyToVectorOfVectorOfInt : expecting list of list of strings !"; if(PyList_Check(pyLi)) @@ -954,7 +1025,7 @@ static void convertPyToVectorOfVectorOfInt(PyObject *pyLi, std::vector< std::vec throw INTERP_KERNEL::Exception(msg); } -static void convertPyToVectorPairStringVecString(PyObject *pyLi, std::vector< std::pair > >& arr) throw(INTERP_KERNEL::Exception) +static void convertPyToVectorPairStringVecString(PyObject *pyLi, std::vector< std::pair > >& arr) { const char msg[]="convertPyToVectorPairStringVecString : expecting list of tuples containing each exactly 2 items : one string and one vector of string !"; if(PyList_Check(pyLi)) @@ -971,9 +1042,7 @@ static void convertPyToVectorPairStringVecString(PyObject *pyLi, std::vector< st throw INTERP_KERNEL::Exception(msg); std::pair > item; PyObject *o_0=PyTuple_GetItem(o,0); - if(!PyString_Check(o_0)) - throw INTERP_KERNEL::Exception(msg); - item.first=PyString_AsString(o_0); + item.first=convertPyObjectToStr(o_0,msg); PyObject *o_1=PyTuple_GetItem(o,1); if(!fillStringVector(o_1,item.second)) throw INTERP_KERNEL::Exception(msg); @@ -997,9 +1066,7 @@ static void convertPyToVectorPairStringVecString(PyObject *pyLi, std::vector< st throw INTERP_KERNEL::Exception(msg); std::pair > item; PyObject *o_0=PyTuple_GetItem(o,0); - if(!PyString_Check(o_0)) - throw INTERP_KERNEL::Exception(msg); - item.first=PyString_AsString(o_0); + item.first=convertPyObjectToStr(o_0,msg); PyObject *o_1=PyTuple_GetItem(o,1); if(!fillStringVector(o_1,item.second)) throw INTERP_KERNEL::Exception(msg); @@ -1014,7 +1081,7 @@ static void convertPyToVectorPairStringVecString(PyObject *pyLi, std::vector< st } template -PyObject *convertDblArrToPyList(const T *ptr, int size) throw(INTERP_KERNEL::Exception) +PyObject *convertDblArrToPyList(const T *ptr, int size) { PyObject *ret(PyList_New(size)); for(int i=0;i& v) throw(INTERP_KERNEL::Exception) +static PyObject *convertDblArrToPyList2(const std::vector& v) { int size(v.size()); PyObject *ret(PyList_New(size)); @@ -1032,7 +1099,7 @@ static PyObject *convertDblArrToPyList2(const std::vector& v) throw(INTE } template -PyObject *convertDblArrToPyListOfTuple(const T *vals, int nbOfComp, int nbOfTuples) throw(INTERP_KERNEL::Exception) +PyObject *convertDblArrToPyListOfTuple(const T *vals, int nbOfComp, int nbOfTuples) { PyObject *ret(PyList_New(nbOfTuples)); for(int i=0;i tmp=new char[nbOfComp+1]; tmp[nbOfComp]='\0'; @@ -1057,7 +1124,7 @@ static PyObject *convertCharArrToPyListOfTuple(const char *vals, int nbOfComp, i return ret; } -static double *convertPyToNewDblArr2(PyObject *pyLi, int *size) throw(INTERP_KERNEL::Exception) +static double *convertPyToNewDblArr2(PyObject *pyLi, int *size) { if(PyList_Check(pyLi)) { @@ -1181,7 +1248,7 @@ static void fillArrayWithPyListDbl3(PyObject *pyLi, int& nbOfElt, std::vector fillArrayWithPyListDbl2(PyObject *pyLi, int& nbOfTuples, int& nbOfComp) throw(INTERP_KERNEL::Exception) +static std::vector fillArrayWithPyListDbl2(PyObject *pyLi, int& nbOfTuples, int& nbOfComp) { std::vector ret; int size1=-1,size2=-1; @@ -1272,7 +1339,7 @@ static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, cons * * switch between (int,vector,DataArrayInt) */ -static void convertObjToPossibleCpp1(PyObject *value, int& sw, int& iTyypp, std::vector& stdvecTyypp, MEDCoupling::DataArrayInt *& daIntTyypp, MEDCoupling::DataArrayIntTuple *&daIntTuple) throw(INTERP_KERNEL::Exception) +static void convertIntStarLikePyObjToCpp(PyObject *value, int& sw, int& iTyypp, std::vector& stdvecTyypp, MEDCoupling::DataArrayInt *& daIntTyypp, MEDCoupling::DataArrayIntTuple *&daIntTuple) { sw=-1; if(PyInt_Check(value)) @@ -1335,6 +1402,86 @@ static void convertObjToPossibleCpp1(PyObject *value, int& sw, int& iTyypp, std: throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayInt, DataArrayIntTuple"); } +/*! + * if python int -> cpp int sw=1 + * if python list[int] -> cpp vector sw=2 + * if python tuple[int] -> cpp vector sw=2 + * if python DataArrayInt -> cpp DataArrayInt sw=3 + * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4 + * + * switch between (int,vector,DataArrayInt) + */ +static const int *convertIntStarLikePyObjToCppIntStar(PyObject *value, int& sw, int& sz, int& iTyypp, std::vector& stdvecTyypp) +{ + sw=-1; + if(PyInt_Check(value)) + { + iTyypp=(int)PyInt_AS_LONG(value); + sw=1; sz=1; + return &iTyypp; + } + if(PyTuple_Check(value)) + { + int size=PyTuple_Size(value); + stdvecTyypp.resize(size); + for(int i=0;i(argp); + if(daIntTyypp) + { + sw=3; sz=daIntTyypp->getNbOfElems(); + return daIntTyypp->begin(); + } + else + { + sz=0; + return 0; + } + } + status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0); + if(SWIG_IsOK(status)) + { + MEDCoupling::DataArrayIntTuple *daIntTuple=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp); + sw=4; sz=daIntTuple->getNumberOfCompo(); + return daIntTuple->getConstPointer(); + } + throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayInt, DataArrayIntTuple"); +} + /*! * if python double -> cpp double sw=1 * if python int -> cpp double sw=1 @@ -1347,7 +1494,7 @@ static void convertObjToPossibleCpp1(PyObject *value, int& sw, int& iTyypp, std: * switch between (int,vector,DataArrayInt) */ template -void convertObjToPossibleCpp4(PyObject *value, int& sw, T& iTyypp, std::vector& stdvecTyypp, typename MEDCoupling::Traits::ArrayType *& daIntTyypp, swig_type_info *ti) throw(INTERP_KERNEL::Exception) +void considerPyObjAsATStarLikeObject(PyObject *value, int& sw, T& iTyypp, std::vector& stdvecTyypp, typename MEDCoupling::Traits::ArrayType *& daIntTyypp, swig_type_info *ti) { sw=-1; if(PyFloat_Check(value)) @@ -1421,7 +1568,7 @@ void convertObjToPossibleCpp4(PyObject *value, int& sw, T& iTyypp, std::vector,DataArrayInt) */ -static void convertObjToPossibleCpp44(PyObject *value, int& sw, double& iTyypp, std::vector& stdvecTyypp, MEDCoupling::DataArrayDoubleTuple *& daIntTyypp) throw(INTERP_KERNEL::Exception) +static void convertDoubleStarLikePyObjToCpp(PyObject *value, int& sw, double& iTyypp, std::vector& stdvecTyypp, MEDCoupling::DataArrayDoubleTuple *& daIntTyypp) { sw=-1; if(PyFloat_Check(value)) @@ -1484,6 +1631,93 @@ static void convertObjToPossibleCpp44(PyObject *value, int& sw, double& iTyypp, sw=3; } +template +void convertFPStarLikePyObjToCpp_2(PyObject *value, int& sw, T& val, typename MEDCoupling::Traits::ArrayType *&d, typename MEDCoupling::Traits::ArrayTuple *&e, std::vector& f, swig_type_info *ti_da, swig_type_info *ti_tuple) +{ + sw=-1; + if(PyFloat_Check(value)) + { + val=PyFloat_AS_DOUBLE(value); + sw=1; + return; + } + if(PyInt_Check(value)) + { + val=(T)PyInt_AS_LONG(value); + sw=1; + return; + } + if(PyTuple_Check(value)) + { + int size=PyTuple_Size(value); + f.resize(size); + for(int i=0;i::ArrayType * >(argp); + sw=2; + return ; + } + status=SWIG_ConvertPtr(value,&argp,ti_tuple,0|0); + if(SWIG_IsOK(status)) + { + e=reinterpret_cast< typename MEDCoupling::Traits::ArrayTuple * >(argp); + sw=3; + return ; + } + throw INTERP_KERNEL::Exception("4 types accepted : integer, double, DataArrayDouble, DataArrayDoubleTuple"); +} + +/*! + * if value int -> cpp val sw=1 + * if value double -> cpp val sw=1 + * if value DataArrayDouble -> cpp DataArrayDouble sw=2 + * if value DataArrayDoubleTuple -> cpp DataArrayDoubleTuple sw=3 + * if value list[int,double] -> cpp std::vector sw=4 + * if value tuple[int,double] -> cpp std::vector sw=4 + */ +static void convertDoubleStarLikePyObjToCpp_2(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector& f) +{ + convertFPStarLikePyObjToCpp_2(value,sw,val,d,e,f,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple); +} + /*! * if python int -> cpp int sw=1 * if python list[int] -> cpp vector sw=2 @@ -1493,7 +1727,7 @@ static void convertObjToPossibleCpp44(PyObject *value, int& sw, double& iTyypp, * * switch between (int,vector,DataArrayInt) */ -static void convertObjToPossibleCpp2(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector& stdvecTyypp, std::pair >& p, MEDCoupling::DataArrayInt *& daIntTyypp) throw(INTERP_KERNEL::Exception) +static void convertIntStarOrSliceLikePyObjToCpp(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector& stdvecTyypp, std::pair >& p, MEDCoupling::DataArrayInt *& daIntTyypp) { const char *msg="5 types accepted : integer, tuple of integer, list of integer, slice, DataArrayInt, DataArrayIntTuple"; sw=-1; @@ -1542,8 +1776,7 @@ static void convertObjToPossibleCpp2(PyObject *value, int nbelem, int& sw, int& if(PySlice_Check(value)) { Py_ssize_t strt=2,stp=2,step=2; - PySliceObject *oC=reinterpret_cast(value); - GetIndicesOfSlice(oC,nbelem,&strt,&stp,&step,"Slice in subscriptable object DataArray invalid !"); + GetIndicesOfSlice(value,nbelem,&strt,&stp,&step,"Slice in subscriptable object DataArray invalid !"); p.first=strt; p.second.first=stp; p.second.second=step; @@ -1581,11 +1814,11 @@ static void convertObjToPossibleCpp2(PyObject *value, int nbelem, int& sw, int& } /*! - * Idem than convertObjToPossibleCpp2 + * Idem than convertIntStarOrSliceLikePyObjToCpp */ -static void convertObjToPossibleCpp2WithNegIntInterp(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector& stdvecTyypp, std::pair >& p, MEDCoupling::DataArrayInt *& daIntTyypp) throw(INTERP_KERNEL::Exception) +static void convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector& stdvecTyypp, std::pair >& p, MEDCoupling::DataArrayInt *& daIntTyypp) { - convertObjToPossibleCpp2(value,nbelem,sw,iTyypp,stdvecTyypp,p,daIntTyypp); + convertIntStarOrSliceLikePyObjToCpp(value,nbelem,sw,iTyypp,stdvecTyypp,p,daIntTyypp); if(sw==1) { iTyypp=InterpreteNegativeInt(iTyypp,nbelem); @@ -1599,7 +1832,7 @@ static void convertObjToPossibleCpp2WithNegIntInterp(PyObject *value, int nbelem * if python slice -> cpp pair sw=3 * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4 . WARNING The returned pointer can be the null pointer ! */ -static void convertObjToPossibleCpp22(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector& stdvecTyypp, std::pair >& p, MEDCoupling::DataArrayIntTuple *& daIntTyypp) throw(INTERP_KERNEL::Exception) +static void convertObjToPossibleCpp22(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector& stdvecTyypp, std::pair >& p, MEDCoupling::DataArrayIntTuple *& daIntTyypp) { sw=-1; if(PyInt_Check(value)) @@ -1647,8 +1880,7 @@ static void convertObjToPossibleCpp22(PyObject *value, int nbelem, int& sw, int& if(PySlice_Check(value)) { Py_ssize_t strt=2,stp=2,step=2; - PySliceObject *oC=reinterpret_cast(value); - GetIndicesOfSlice(oC,nbelem,&strt,&stp,&step,"Slice in subscriptable object DataArray invalid !"); + GetIndicesOfSlice(value,nbelem,&strt,&stp,&step,"Slice in subscriptable object DataArray invalid !"); p.first=strt; p.second.first=stp; p.second.second=step; @@ -1670,7 +1902,7 @@ static void convertObjToPossibleCpp22(PyObject *value, int nbelem, int& sw, int& * if python not null pointer of DataArrayChar -> cpp DataArrayChar sw=4 * switch between (int,string,vector,DataArrayChar) */ -static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std::string& sType, std::vector& vsType, MEDCoupling::DataArrayChar *& dacType) throw(INTERP_KERNEL::Exception) +static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std::string& sType, std::vector& vsType, MEDCoupling::DataArrayChar *& dacType) { const char *msg="4 types accepted : string, list or tuple of strings having same size, not null DataArrayChar instance."; sw=-1; @@ -1691,6 +1923,25 @@ static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std:: return; } } +#if PY_VERSION_HEX >= 0x03000000 + if(PyUnicode_Check(value)) + { + Py_ssize_t sz; + const char *pt = PyUnicode_AsUTF8AndSize(value, &sz); + if(sz==1) + { + cTyp=pt[0]; + sw=1; + return; + } + else + { + sType=pt; + sw=2; + return; + } + } +#endif if(PyTuple_Check(value)) { int size=PyTuple_Size(value); @@ -1698,9 +1949,11 @@ static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std:: for(int i=0;i& vt, std::vector& vc, std::pair >& pt, std::pair >& pc, - MEDCoupling::DataArrayInt *&dt, MEDCoupling::DataArrayInt *&dc) throw(INTERP_KERNEL::Exception) + MEDCoupling::DataArrayInt *&dt, MEDCoupling::DataArrayInt *&dc) { if(!PyTuple_Check(value)) { - convertObjToPossibleCpp2WithNegIntInterp(value,nbTuple,sw,it,vt,pt,dt); + convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(value,nbTuple,sw,it,vt,pt,dt); return ; } else @@ -1788,94 +2043,13 @@ static void convertObjToPossibleCpp3(PyObject *value, int nbTuple, int nbCompo, throw INTERP_KERNEL::Exception("Unexpected nb of slice element : 1 or 2 expected !\n1st is for tuple selection, 2nd for component selection !"); PyObject *ob0=PyTuple_GetItem(value,0); int sw1,sw2; - convertObjToPossibleCpp2WithNegIntInterp(ob0,nbTuple,sw1,it,vt,pt,dt); + convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(ob0,nbTuple,sw1,it,vt,pt,dt); PyObject *ob1=PyTuple_GetItem(value,1); - convertObjToPossibleCpp2WithNegIntInterp(ob1,nbCompo,sw2,ic,vc,pc,dc); + convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(ob1,nbCompo,sw2,ic,vc,pc,dc); sw=4*sw2+sw1; } } -/*! - * if value int -> cpp val sw=1 - * if value double -> cpp val sw=1 - * if value DataArrayDouble -> cpp DataArrayDouble sw=2 - * if value DataArrayDoubleTuple -> cpp DataArrayDoubleTuple sw=3 - * if value list[int,double] -> cpp std::vector sw=4 - * if value tuple[int,double] -> cpp std::vector sw=4 - */ -static void convertObjToPossibleCpp5(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector& f) -{ - sw=-1; - if(PyFloat_Check(value)) - { - val=PyFloat_AS_DOUBLE(value); - sw=1; - return; - } - if(PyInt_Check(value)) - { - val=(double)PyInt_AS_LONG(value); - sw=1; - return; - } - if(PyTuple_Check(value)) - { - int size=PyTuple_Size(value); - f.resize(size); - for(int i=0;i(argp); - sw=2; - return ; - } - status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,0|0); - if(SWIG_IsOK(status)) - { - e=reinterpret_cast< MEDCoupling::DataArrayDoubleTuple * >(argp); - sw=3; - return ; - } - throw INTERP_KERNEL::Exception("4 types accepted : integer, double, DataArrayDouble, DataArrayDoubleTuple"); -} - /*! * if value int -> cpp val sw=1 * if value double -> cpp val sw=1 @@ -1885,7 +2059,7 @@ static void convertObjToPossibleCpp5(PyObject *value, int& sw, double& val, MEDC * if value tuple[int,double] -> cpp std::vector sw=4 */ static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector& f, - const char *msg, int nbTuplesExpected, int nbCompExpected, bool throwIfNullPt) throw(INTERP_KERNEL::Exception) + const char *msg, int nbTuplesExpected, int nbCompExpected, bool throwIfNullPt) { sw=-1; if(PyFloat_Check(value)) @@ -1992,7 +2166,7 @@ static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, dou * if value tuple[int,double] -> cpp std::vector sw=4 */ static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector& f, - const char *msg, int nbCompExpected, bool throwIfNullPt, int& nbTuples) throw(INTERP_KERNEL::Exception) + const char *msg, int nbCompExpected, bool throwIfNullPt, int& nbTuples) { sw=-1; if(PyFloat_Check(value)) @@ -2142,7 +2316,7 @@ static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, do * if value tuple[int,double] -> cpp std::vector sw=4 */ static const double *convertObjToPossibleCpp5_SingleCompo(PyObject *value, int& sw, double& val, std::vector& f, - const char *msg, bool throwIfNullPt, int& nbTuples) throw(INTERP_KERNEL::Exception) + const char *msg, bool throwIfNullPt, int& nbTuples) { MEDCoupling::DataArrayDouble *d=0; MEDCoupling::DataArrayDoubleTuple *e=0; @@ -2257,86 +2431,6 @@ static const double *convertObjToPossibleCpp5_SingleCompo(PyObject *value, int& throw INTERP_KERNEL::Exception("4 types accepted : integer, double, DataArrayDouble, DataArrayDoubleTuple"); } -/*! - * if python int -> cpp int sw=1 - * if python list[int] -> cpp vector sw=2 - * if python tuple[int] -> cpp vector sw=2 - * if python DataArrayInt -> cpp DataArrayInt sw=3 - * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4 - * - * switch between (int,vector,DataArrayInt) - */ -static const int *convertObjToPossibleCpp1_Safe(PyObject *value, int& sw, int& sz, int& iTyypp, std::vector& stdvecTyypp) throw(INTERP_KERNEL::Exception) -{ - sw=-1; - if(PyInt_Check(value)) - { - iTyypp=(int)PyInt_AS_LONG(value); - sw=1; sz=1; - return &iTyypp; - } - if(PyTuple_Check(value)) - { - int size=PyTuple_Size(value); - stdvecTyypp.resize(size); - for(int i=0;i(argp); - if(daIntTyypp) - { - sw=3; sz=daIntTyypp->getNbOfElems(); - return daIntTyypp->begin(); - } - else - { - sz=0; - return 0; - } - } - status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0); - if(SWIG_IsOK(status)) - { - MEDCoupling::DataArrayIntTuple *daIntTuple=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp); - sw=4; sz=daIntTuple->getNumberOfCompo(); - return daIntTuple->getConstPointer(); - } - throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayInt, DataArrayIntTuple"); -} - static MEDCoupling::DataArray *CheckAndRetrieveDataArrayInstance(PyObject *obj, const char *msg) { void *aBasePtrVS=0; @@ -2390,7 +2484,8 @@ static PyObject *NewMethWrapCallInitOnlyIfEmptyDictInInput(PyObject *cls, PyObje return instance; } -static PyObject *NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(PyObject *cls, PyObject *args, const char *clsName) +template +static PyObject *NewMethWrapCallInitOnlyIfDictWithSingleEltInInputGeneral(PyObject *cls, PyObject *args, const char *clsName) { if(!PyTuple_Check(args)) { @@ -2415,11 +2510,27 @@ static PyObject *NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(PyObject *cls zeNumpyRepr=PyDict_GetItem(PyTuple_GetItem(args,1),tmp1);//borrowed Py_DECREF(tmp1); } + if(!zeNumpyRepr) + { + std::ostringstream oss; oss << clsName << ".__new__ : the args in input is expected to be a tuple !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + T tt; { - PyObject *tmp3(PyTuple_New(1)); - PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr); - PyObject *tmp2(PyObject_CallObject(initMeth,tmp3)); - Py_XDECREF(tmp2); + PyObject *tmp3(0); + try + { + tmp3=tt(zeNumpyRepr); + } + catch(INTERP_KERNEL::Exception& e) + { + std::ostringstream oss; oss << clsName << ".__new__ : Invalid type in input " << " : " << e.what(); + throw INTERP_KERNEL::Exception(oss.str()); + } + { + PyObject *tmp2(PyObject_CallObject(initMeth,tmp3)); + Py_XDECREF(tmp2); + } Py_DECREF(tmp3); } Py_DECREF(initMeth); @@ -2427,7 +2538,33 @@ static PyObject *NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(PyObject *cls return instance; } -static PyObject *convertPartDefinition(MEDCoupling::PartDefinition *pd, int owner) throw(INTERP_KERNEL::Exception) +struct SinglePyObjToBePutInATuple +{ + PyObject *operator()(PyObject *zeNumpyRepr) + { + PyObject *tmp3(PyTuple_New(1)); + PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr); + return tmp3; + } +}; + +struct SinglePyObjExpectToBeAListOfSz2 +{ + PyObject *operator()(PyObject *uniqueElt) + { + if(!PyTuple_Check(uniqueElt) || PyTuple_Size(uniqueElt)!=2) + throw INTERP_KERNEL::Exception("Not a tuple of size 2 !"); + Py_XINCREF(uniqueElt); + return uniqueElt; + } +}; + +static PyObject *NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(PyObject *cls, PyObject *args, const char *clsName) +{ + return NewMethWrapCallInitOnlyIfDictWithSingleEltInInputGeneral(cls,args,clsName); +} + +static PyObject *convertPartDefinition(MEDCoupling::PartDefinition *pd, int owner) { PyObject *ret=0; if(!pd) @@ -2548,7 +2685,7 @@ typename MEDCoupling::Traits::ArrayType *DataArrayT__setitem__internal(typena T i1; std::vector v1; typename MEDCoupling::Traits::ArrayType *d1=0; - convertObjToPossibleCpp4(value,sw1,i1,v1,d1,ti); + considerPyObjAsATStarLikeObject(value,sw1,i1,v1,d1,ti); int it1,ic1; std::vector vt1,vc1; std::pair > pt1,pc1; @@ -2990,20 +3127,202 @@ PyObject *DataArrayT__getitem__internal(const typename MEDCoupling::Traits::A } } +template +PyObject *DataArrayT_imul__internal(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits::ArrayType *self, swig_type_info *ti_da, swig_type_info *ti_tuple) +{ + const char msg[]="Unexpected situation in __imul__ !"; + T val; + typename MEDCoupling::Traits::ArrayType *a; + typename MEDCoupling::Traits::ArrayTuple *aa; + std::vector bb; + int sw; + convertFPStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb,ti_da,ti_tuple); + switch(sw) + { + case 1: + { + self->applyLin(val,0.); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 2: + { + self->multiplyEqual(a); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 3: + { + MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(aa->buildDA(1,self->getNumberOfComponents())); + self->multiplyEqual(aaa); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 4: + { + MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size()); + self->multiplyEqual(aaa); + Py_XINCREF(trueSelf); + return trueSelf; + } + default: + throw INTERP_KERNEL::Exception(msg); + } +} + +template +PyObject *DataArrayT_idiv__internal(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits::ArrayType *self, swig_type_info *ti_da, swig_type_info *ti_tuple) +{ + const char msg[]="Unexpected situation in __idiv__ !"; + T val; + typename MEDCoupling::Traits::ArrayType *a; + typename MEDCoupling::Traits::ArrayTuple *aa; + std::vector bb; + int sw; + convertFPStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb,ti_da,ti_tuple); + switch(sw) + { + case 1: + { + if(val==0.) + throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !"); + self->applyLin(1./val,0.); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 2: + { + self->divideEqual(a); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 3: + { + MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(aa->buildDA(1,self->getNumberOfComponents())); + self->divideEqual(aaa); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 4: + { + MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size()); + self->divideEqual(aaa); + Py_XINCREF(trueSelf); + return trueSelf; + } + default: + throw INTERP_KERNEL::Exception(msg); + } +} + +template +PyObject *DataArrayT_iadd__internal(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits::ArrayType *self, swig_type_info *ti_da, swig_type_info *ti_tuple) +{ + const char msg[]="Unexpected situation in __iadd__ !"; + T val; + typename MEDCoupling::Traits::ArrayType *a; + typename MEDCoupling::Traits::ArrayTuple *aa; + std::vector bb; + int sw; + convertFPStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb,ti_da,ti_tuple); + switch(sw) + { + case 1: + { + self->applyLin(1.,val); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 2: + { + self->addEqual(a); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 3: + { + MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(aa->buildDA(1,self->getNumberOfComponents())); + self->addEqual(aaa); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 4: + { + MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size()); + self->addEqual(aaa); + Py_XINCREF(trueSelf); + return trueSelf; + } + default: + throw INTERP_KERNEL::Exception(msg); + } +} + +template +PyObject *DataArrayT_isub__internal(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits::ArrayType *self, swig_type_info *ti_da, swig_type_info *ti_tuple) +{ + const char msg[]="Unexpected situation in __isub__ !"; + T val; + typename MEDCoupling::Traits::ArrayType *a; + typename MEDCoupling::Traits::ArrayTuple *aa; + std::vector bb; + int sw; + convertFPStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb,ti_da,ti_tuple); + switch(sw) + { + case 1: + { + self->applyLin(1.,-val); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 2: + { + self->substractEqual(a); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 3: + { + MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(aa->buildDA(1,self->getNumberOfComponents())); + self->substractEqual(aaa); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 4: + { + MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size()); + self->substractEqual(aaa); + Py_XINCREF(trueSelf); + return trueSelf; + } + default: + throw INTERP_KERNEL::Exception(msg); + } +} + template struct SWIGTITraits { }; template<> struct SWIGTITraits -{ static swig_type_info *TI; }; +{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; }; template<> struct SWIGTITraits -{ static swig_type_info *TI; }; +{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; }; + +template<> +struct SWIGTITraits +{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; }; swig_type_info *SWIGTITraits::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayDouble is null when called here ! Postpone initialization at inlined initializeMe() swig_type_info *SWIGTITraits::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe() +swig_type_info *SWIGTITraits::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe() +swig_type_info *SWIGTITraits::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayDouble is null when called here ! Postpone initialization at inlined initializeMe() +swig_type_info *SWIGTITraits::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe() +swig_type_info *SWIGTITraits::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe() PyTypeObject *NPYTraits::NPYFunc=&PyCallBackDataArrayDouble_RefType; @@ -3021,4 +3340,28 @@ PyObject *DataArrayT__getitem(const typename MEDCoupling::Traits::ArrayType * return DataArrayT__getitem__internal(self,obj,SWIGTITraits::TI); } +template +PyObject *DataArrayT_imul(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits::ArrayType *self) +{ + return DataArrayT_imul__internal(trueSelf,obj,self,SWIGTITraits::TI,SWIGTITraits::TI_TUPLE); +} + +template +PyObject *DataArrayT_idiv(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits::ArrayType *self) +{ + return DataArrayT_idiv__internal(trueSelf,obj,self,SWIGTITraits::TI,SWIGTITraits::TI_TUPLE); +} + +template +PyObject *DataArrayT_iadd(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits::ArrayType *self) +{ + return DataArrayT_iadd__internal(trueSelf,obj,self,SWIGTITraits::TI,SWIGTITraits::TI_TUPLE); +} + +template +PyObject *DataArrayT_isub(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits::ArrayType *self) +{ + return DataArrayT_isub__internal(trueSelf,obj,self,SWIGTITraits::TI,SWIGTITraits::TI_TUPLE); +} + #endif